pdf.worker.js 1.9 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505
  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
  30. root["pdfjs-dist/build/pdf.worker"] = root.pdfjsWorker = factory();
  31. })(globalThis, () => {
  32. return /******/ (() => { // webpackBootstrap
  33. /******/ "use strict";
  34. /******/ var __webpack_modules__ = ([
  35. /* 0 */,
  36. /* 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__(3);
  44. var _core_utils = __w_pdfjs_require__(4);
  45. var _pdf_manager = __w_pdfjs_require__(6);
  46. var _cleanup_helper = __w_pdfjs_require__(69);
  47. var _writer = __w_pdfjs_require__(63);
  48. var _is_node = __w_pdfjs_require__(100);
  49. var _message_handler = __w_pdfjs_require__(101);
  50. var _worker_stream = __w_pdfjs_require__(102);
  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 (data) {
  77. if (testMessageProcessed) {
  78. return;
  79. }
  80. testMessageProcessed = true;
  81. handler.send("test", data instanceof Uint8Array);
  82. });
  83. handler.on("configure", function (data) {
  84. (0, _util.setVerbosityLevel)(data.verbosity);
  85. });
  86. handler.on("GetDocRequest", function (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 {
  97. docId,
  98. apiVersion
  99. } = docParams;
  100. const workerVersion = '3.2.146';
  101. if (apiVersion !== workerVersion) {
  102. throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
  103. }
  104. const enumerableProperties = [];
  105. for (const property in []) {
  106. enumerableProperties.push(property);
  107. }
  108. if (enumerableProperties.length) {
  109. throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s.");
  110. }
  111. if (typeof ReadableStream === "undefined") {
  112. const partialMsg = "The browser/environment lacks native support for critical " + "functionality used by the PDF.js library (e.g. `ReadableStream`); ";
  113. if (_is_node.isNodeJS) {
  114. throw new Error(partialMsg + "please use a `legacy`-build instead.");
  115. }
  116. throw new Error(partialMsg + "please update to a supported browser.");
  117. }
  118. const workerHandlerName = docId + "_worker";
  119. let handler = new _message_handler.MessageHandler(workerHandlerName, docId, port);
  120. function ensureNotTerminated() {
  121. if (terminated) {
  122. throw new Error("Worker was terminated");
  123. }
  124. }
  125. function startWorkerTask(task) {
  126. WorkerTasks.push(task);
  127. }
  128. function finishWorkerTask(task) {
  129. task.finish();
  130. const i = WorkerTasks.indexOf(task);
  131. WorkerTasks.splice(i, 1);
  132. }
  133. async function loadDocument(recoveryMode) {
  134. await pdfManager.ensureDoc("checkHeader");
  135. await pdfManager.ensureDoc("parseStartXRef");
  136. await pdfManager.ensureDoc("parse", [recoveryMode]);
  137. await pdfManager.ensureDoc("checkFirstPage", [recoveryMode]);
  138. await pdfManager.ensureDoc("checkLastPage", [recoveryMode]);
  139. const isPureXfa = await pdfManager.ensureDoc("isPureXfa");
  140. if (isPureXfa) {
  141. const task = new WorkerTask("loadXfaFonts");
  142. startWorkerTask(task);
  143. await Promise.all([pdfManager.loadXfaFonts(handler, task).catch(reason => {}).then(() => finishWorkerTask(task)), pdfManager.loadXfaImages()]);
  144. }
  145. const [numPages, fingerprints] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprints")]);
  146. const htmlForXfa = isPureXfa ? await pdfManager.ensureDoc("htmlForXfa") : null;
  147. return {
  148. numPages,
  149. fingerprints,
  150. htmlForXfa
  151. };
  152. }
  153. function getPdfManager({
  154. data,
  155. password,
  156. disableAutoFetch,
  157. rangeChunkSize,
  158. length,
  159. docBaseUrl,
  160. enableXfa,
  161. evaluatorOptions
  162. }) {
  163. const pdfManagerCapability = (0, _util.createPromiseCapability)();
  164. let newPdfManager;
  165. if (data) {
  166. try {
  167. newPdfManager = new _pdf_manager.LocalPdfManager(docId, data, password, handler, evaluatorOptions, enableXfa, docBaseUrl);
  168. pdfManagerCapability.resolve(newPdfManager);
  169. } catch (ex) {
  170. pdfManagerCapability.reject(ex);
  171. }
  172. return pdfManagerCapability.promise;
  173. }
  174. let pdfStream,
  175. cachedChunks = [];
  176. try {
  177. pdfStream = new _worker_stream.PDFWorkerStream(handler);
  178. } catch (ex) {
  179. pdfManagerCapability.reject(ex);
  180. return pdfManagerCapability.promise;
  181. }
  182. const fullRequest = pdfStream.getFullReader();
  183. fullRequest.headersReady.then(function () {
  184. if (!fullRequest.isRangeSupported) {
  185. return;
  186. }
  187. disableAutoFetch = disableAutoFetch || fullRequest.isStreamingSupported;
  188. newPdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {
  189. msgHandler: handler,
  190. password,
  191. length: fullRequest.contentLength,
  192. disableAutoFetch,
  193. rangeChunkSize
  194. }, evaluatorOptions, enableXfa, docBaseUrl);
  195. for (const chunk of cachedChunks) {
  196. newPdfManager.sendProgressiveData(chunk);
  197. }
  198. cachedChunks = [];
  199. pdfManagerCapability.resolve(newPdfManager);
  200. cancelXHRs = null;
  201. }).catch(function (reason) {
  202. pdfManagerCapability.reject(reason);
  203. cancelXHRs = null;
  204. });
  205. let loaded = 0;
  206. const flushChunks = function () {
  207. const pdfFile = (0, _util.arraysToBytes)(cachedChunks);
  208. if (length && pdfFile.length !== length) {
  209. (0, _util.warn)("reported HTTP length is different from actual");
  210. }
  211. try {
  212. newPdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, password, handler, evaluatorOptions, enableXfa, docBaseUrl);
  213. pdfManagerCapability.resolve(newPdfManager);
  214. } catch (ex) {
  215. pdfManagerCapability.reject(ex);
  216. }
  217. cachedChunks = [];
  218. };
  219. new Promise(function (resolve, reject) {
  220. const readChunk = function ({
  221. value,
  222. done
  223. }) {
  224. try {
  225. ensureNotTerminated();
  226. if (done) {
  227. if (!newPdfManager) {
  228. flushChunks();
  229. }
  230. cancelXHRs = null;
  231. return;
  232. }
  233. loaded += (0, _util.arrayByteLength)(value);
  234. if (!fullRequest.isStreamingSupported) {
  235. handler.send("DocProgress", {
  236. loaded,
  237. total: Math.max(loaded, fullRequest.contentLength || 0)
  238. });
  239. }
  240. if (newPdfManager) {
  241. newPdfManager.sendProgressiveData(value);
  242. } else {
  243. cachedChunks.push(value);
  244. }
  245. fullRequest.read().then(readChunk, reject);
  246. } catch (e) {
  247. reject(e);
  248. }
  249. };
  250. fullRequest.read().then(readChunk, reject);
  251. }).catch(function (e) {
  252. pdfManagerCapability.reject(e);
  253. cancelXHRs = null;
  254. });
  255. cancelXHRs = function (reason) {
  256. pdfStream.cancelAllRequests(reason);
  257. };
  258. return pdfManagerCapability.promise;
  259. }
  260. function setupDoc(data) {
  261. function onSuccess(doc) {
  262. ensureNotTerminated();
  263. handler.send("GetDoc", {
  264. pdfInfo: doc
  265. });
  266. }
  267. function onFailure(ex) {
  268. ensureNotTerminated();
  269. if (ex instanceof _util.PasswordException) {
  270. const task = new WorkerTask(`PasswordException: response ${ex.code}`);
  271. startWorkerTask(task);
  272. handler.sendWithPromise("PasswordRequest", ex).then(function ({
  273. password
  274. }) {
  275. finishWorkerTask(task);
  276. pdfManager.updatePassword(password);
  277. pdfManagerReady();
  278. }).catch(function () {
  279. finishWorkerTask(task);
  280. handler.send("DocException", ex);
  281. });
  282. } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) {
  283. handler.send("DocException", ex);
  284. } else {
  285. handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString()));
  286. }
  287. }
  288. function pdfManagerReady() {
  289. ensureNotTerminated();
  290. loadDocument(false).then(onSuccess, function (reason) {
  291. ensureNotTerminated();
  292. if (!(reason instanceof _core_utils.XRefParseException)) {
  293. onFailure(reason);
  294. return;
  295. }
  296. pdfManager.requestLoadedStream().then(function () {
  297. ensureNotTerminated();
  298. loadDocument(true).then(onSuccess, onFailure);
  299. });
  300. });
  301. }
  302. ensureNotTerminated();
  303. getPdfManager(data).then(function (newPdfManager) {
  304. if (terminated) {
  305. newPdfManager.terminate(new _util.AbortException("Worker was terminated."));
  306. throw new Error("Worker was terminated");
  307. }
  308. pdfManager = newPdfManager;
  309. pdfManager.requestLoadedStream(true).then(stream => {
  310. handler.send("DataLoaded", {
  311. length: stream.bytes.byteLength
  312. });
  313. });
  314. }).then(pdfManagerReady, onFailure);
  315. }
  316. handler.on("GetPage", function (data) {
  317. return pdfManager.getPage(data.pageIndex).then(function (page) {
  318. return Promise.all([pdfManager.ensure(page, "rotate"), pdfManager.ensure(page, "ref"), pdfManager.ensure(page, "userUnit"), pdfManager.ensure(page, "view")]).then(function ([rotate, ref, userUnit, view]) {
  319. return {
  320. rotate,
  321. ref,
  322. userUnit,
  323. view
  324. };
  325. });
  326. });
  327. });
  328. handler.on("GetPageIndex", function (data) {
  329. const pageRef = _primitives.Ref.get(data.num, data.gen);
  330. return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  331. });
  332. handler.on("GetDestinations", function (data) {
  333. return pdfManager.ensureCatalog("destinations");
  334. });
  335. handler.on("GetDestination", function (data) {
  336. return pdfManager.ensureCatalog("getDestination", [data.id]);
  337. });
  338. handler.on("GetPageLabels", function (data) {
  339. return pdfManager.ensureCatalog("pageLabels");
  340. });
  341. handler.on("GetPageLayout", function (data) {
  342. return pdfManager.ensureCatalog("pageLayout");
  343. });
  344. handler.on("GetPageMode", function (data) {
  345. return pdfManager.ensureCatalog("pageMode");
  346. });
  347. handler.on("GetViewerPreferences", function (data) {
  348. return pdfManager.ensureCatalog("viewerPreferences");
  349. });
  350. handler.on("GetOpenAction", function (data) {
  351. return pdfManager.ensureCatalog("openAction");
  352. });
  353. handler.on("GetAttachments", function (data) {
  354. return pdfManager.ensureCatalog("attachments");
  355. });
  356. handler.on("GetJavaScript", function (data) {
  357. return pdfManager.ensureCatalog("javaScript");
  358. });
  359. handler.on("GetDocJSActions", function (data) {
  360. return pdfManager.ensureCatalog("jsActions");
  361. });
  362. handler.on("GetPageJSActions", function ({
  363. pageIndex
  364. }) {
  365. return pdfManager.getPage(pageIndex).then(function (page) {
  366. return pdfManager.ensure(page, "jsActions");
  367. });
  368. });
  369. handler.on("GetOutline", function (data) {
  370. return pdfManager.ensureCatalog("documentOutline");
  371. });
  372. handler.on("GetOptionalContentConfig", function (data) {
  373. return pdfManager.ensureCatalog("optionalContentConfig");
  374. });
  375. handler.on("GetPermissions", function (data) {
  376. return pdfManager.ensureCatalog("permissions");
  377. });
  378. handler.on("GetMetadata", function (data) {
  379. return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]);
  380. });
  381. handler.on("GetMarkInfo", function (data) {
  382. return pdfManager.ensureCatalog("markInfo");
  383. });
  384. handler.on("GetData", function (data) {
  385. return pdfManager.requestLoadedStream().then(function (stream) {
  386. return stream.bytes;
  387. });
  388. });
  389. handler.on("GetAnnotations", function ({
  390. pageIndex,
  391. intent
  392. }) {
  393. return pdfManager.getPage(pageIndex).then(function (page) {
  394. const task = new WorkerTask(`GetAnnotations: page ${pageIndex}`);
  395. startWorkerTask(task);
  396. return page.getAnnotationsData(handler, task, intent).then(data => {
  397. finishWorkerTask(task);
  398. return data;
  399. }, reason => {
  400. finishWorkerTask(task);
  401. });
  402. });
  403. });
  404. handler.on("GetFieldObjects", function (data) {
  405. return pdfManager.ensureDoc("fieldObjects");
  406. });
  407. handler.on("HasJSActions", function (data) {
  408. return pdfManager.ensureDoc("hasJSActions");
  409. });
  410. handler.on("GetCalculationOrderIds", function (data) {
  411. return pdfManager.ensureDoc("calculationOrderIds");
  412. });
  413. handler.on("SaveDocument", function ({
  414. isPureXfa,
  415. numPages,
  416. annotationStorage,
  417. filename
  418. }) {
  419. const promises = [pdfManager.requestLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("startXRef")];
  420. const newAnnotationsByPage = !isPureXfa ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null;
  421. if (newAnnotationsByPage) {
  422. for (const [pageIndex, annotations] of newAnnotationsByPage) {
  423. promises.push(pdfManager.getPage(pageIndex).then(page => {
  424. const task = new WorkerTask(`Save (editor): page ${pageIndex}`);
  425. return page.saveNewAnnotations(handler, task, annotations).finally(function () {
  426. finishWorkerTask(task);
  427. });
  428. }));
  429. }
  430. }
  431. if (isPureXfa) {
  432. promises.push(pdfManager.serializeXfaData(annotationStorage));
  433. } else {
  434. for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
  435. promises.push(pdfManager.getPage(pageIndex).then(function (page) {
  436. const task = new WorkerTask(`Save: page ${pageIndex}`);
  437. return page.save(handler, task, annotationStorage).finally(function () {
  438. finishWorkerTask(task);
  439. });
  440. }));
  441. }
  442. }
  443. return Promise.all(promises).then(function ([stream, acroForm, acroFormRef, xref, startXRef, ...refs]) {
  444. let newRefs = [];
  445. let xfaData = null;
  446. if (isPureXfa) {
  447. xfaData = refs[0];
  448. if (!xfaData) {
  449. return stream.bytes;
  450. }
  451. } else {
  452. newRefs = refs.flat(2);
  453. if (newRefs.length === 0) {
  454. return stream.bytes;
  455. }
  456. }
  457. const needAppearances = acroFormRef && acroForm instanceof _primitives.Dict && newRefs.some(ref => ref.needAppearances);
  458. const xfa = acroForm instanceof _primitives.Dict && acroForm.get("XFA") || null;
  459. let xfaDatasetsRef = null;
  460. let hasXfaDatasetsEntry = false;
  461. if (Array.isArray(xfa)) {
  462. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  463. if (xfa[i] === "datasets") {
  464. xfaDatasetsRef = xfa[i + 1];
  465. hasXfaDatasetsEntry = true;
  466. }
  467. }
  468. if (xfaDatasetsRef === null) {
  469. xfaDatasetsRef = xref.getNewTemporaryRef();
  470. }
  471. } else if (xfa) {
  472. (0, _util.warn)("Unsupported XFA type.");
  473. }
  474. let newXrefInfo = Object.create(null);
  475. if (xref.trailer) {
  476. const infoObj = Object.create(null);
  477. const xrefInfo = xref.trailer.get("Info") || null;
  478. if (xrefInfo instanceof _primitives.Dict) {
  479. xrefInfo.forEach((key, value) => {
  480. if (typeof value === "string") {
  481. infoObj[key] = (0, _util.stringToPDFString)(value);
  482. }
  483. });
  484. }
  485. newXrefInfo = {
  486. rootRef: xref.trailer.getRaw("Root") || null,
  487. encryptRef: xref.trailer.getRaw("Encrypt") || null,
  488. newRef: xref.getNewTemporaryRef(),
  489. infoRef: xref.trailer.getRaw("Info") || null,
  490. info: infoObj,
  491. fileIds: xref.trailer.get("ID") || null,
  492. startXRef,
  493. filename
  494. };
  495. }
  496. try {
  497. return (0, _writer.incrementalUpdate)({
  498. originalData: stream.bytes,
  499. xrefInfo: newXrefInfo,
  500. newRefs,
  501. xref,
  502. hasXfa: !!xfa,
  503. xfaDatasetsRef,
  504. hasXfaDatasetsEntry,
  505. needAppearances,
  506. acroFormRef,
  507. acroForm,
  508. xfaData
  509. });
  510. } finally {
  511. xref.resetNewTemporaryRef();
  512. }
  513. });
  514. });
  515. handler.on("GetOperatorList", function (data, sink) {
  516. const pageIndex = data.pageIndex;
  517. pdfManager.getPage(pageIndex).then(function (page) {
  518. const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
  519. startWorkerTask(task);
  520. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  521. page.getOperatorList({
  522. handler,
  523. sink,
  524. task,
  525. intent: data.intent,
  526. cacheKey: data.cacheKey,
  527. annotationStorage: data.annotationStorage
  528. }).then(function (operatorListInfo) {
  529. finishWorkerTask(task);
  530. if (start) {
  531. (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
  532. }
  533. sink.close();
  534. }, function (reason) {
  535. finishWorkerTask(task);
  536. if (task.terminated) {
  537. return;
  538. }
  539. sink.error(reason);
  540. });
  541. });
  542. });
  543. handler.on("GetTextContent", function (data, sink) {
  544. const pageIndex = data.pageIndex;
  545. pdfManager.getPage(pageIndex).then(function (page) {
  546. const task = new WorkerTask("GetTextContent: page " + pageIndex);
  547. startWorkerTask(task);
  548. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  549. page.extractTextContent({
  550. handler,
  551. task,
  552. sink,
  553. includeMarkedContent: data.includeMarkedContent,
  554. combineTextItems: data.combineTextItems
  555. }).then(function () {
  556. finishWorkerTask(task);
  557. if (start) {
  558. (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
  559. }
  560. sink.close();
  561. }, function (reason) {
  562. finishWorkerTask(task);
  563. if (task.terminated) {
  564. return;
  565. }
  566. sink.error(reason);
  567. });
  568. });
  569. });
  570. handler.on("GetStructTree", function (data) {
  571. return pdfManager.getPage(data.pageIndex).then(function (page) {
  572. return pdfManager.ensure(page, "getStructTree");
  573. });
  574. });
  575. handler.on("FontFallback", function (data) {
  576. return pdfManager.fontFallback(data.id, handler);
  577. });
  578. handler.on("Cleanup", function (data) {
  579. return pdfManager.cleanup(true);
  580. });
  581. handler.on("Terminate", function (data) {
  582. terminated = true;
  583. const waitOn = [];
  584. if (pdfManager) {
  585. pdfManager.terminate(new _util.AbortException("Worker was terminated."));
  586. const cleanupPromise = pdfManager.cleanup();
  587. waitOn.push(cleanupPromise);
  588. pdfManager = null;
  589. } else {
  590. (0, _cleanup_helper.clearGlobalCaches)();
  591. }
  592. if (cancelXHRs) {
  593. cancelXHRs(new _util.AbortException("Worker was terminated."));
  594. }
  595. for (const task of WorkerTasks) {
  596. waitOn.push(task.finished);
  597. task.terminate();
  598. }
  599. return Promise.all(waitOn).then(function () {
  600. handler.destroy();
  601. handler = null;
  602. });
  603. });
  604. handler.on("Ready", function (data) {
  605. setupDoc(docParams);
  606. docParams = null;
  607. });
  608. return workerHandlerName;
  609. }
  610. static initializeFromPort(port) {
  611. const handler = new _message_handler.MessageHandler("worker", "main", port);
  612. WorkerMessageHandler.setup(handler, port);
  613. handler.send("ready", null);
  614. }
  615. }
  616. exports.WorkerMessageHandler = WorkerMessageHandler;
  617. function isMessagePort(maybePort) {
  618. return typeof maybePort.postMessage === "function" && "onmessage" in maybePort;
  619. }
  620. if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) {
  621. WorkerMessageHandler.initializeFromPort(self);
  622. }
  623. /***/ }),
  624. /* 2 */
  625. /***/ ((__unused_webpack_module, exports) => {
  626. Object.defineProperty(exports, "__esModule", ({
  627. value: true
  628. }));
  629. exports.VerbosityLevel = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.UNSUPPORTED_FEATURES = exports.TextRenderingMode = exports.StreamType = exports.RenderingIntentFlag = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.LINE_FACTOR = exports.LINE_DESCENT_FACTOR = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FontType = exports.FeatureTest = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = exports.CMapCompressionType = exports.BaseException = exports.BASELINE_FACTOR = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMode = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationEditorType = exports.AnnotationEditorPrefix = exports.AnnotationEditorParamsType = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0;
  630. exports.arrayByteLength = arrayByteLength;
  631. exports.arraysToBytes = arraysToBytes;
  632. exports.assert = assert;
  633. exports.bytesToString = bytesToString;
  634. exports.createPromiseCapability = createPromiseCapability;
  635. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  636. exports.getModificationDate = getModificationDate;
  637. exports.getVerbosityLevel = getVerbosityLevel;
  638. exports.info = info;
  639. exports.isArrayBuffer = isArrayBuffer;
  640. exports.isArrayEqual = isArrayEqual;
  641. exports.objectFromMap = objectFromMap;
  642. exports.objectSize = objectSize;
  643. exports.setVerbosityLevel = setVerbosityLevel;
  644. exports.shadow = shadow;
  645. exports.string32 = string32;
  646. exports.stringToBytes = stringToBytes;
  647. exports.stringToPDFString = stringToPDFString;
  648. exports.stringToUTF8String = stringToUTF8String;
  649. exports.unreachable = unreachable;
  650. exports.utf8StringToString = utf8StringToString;
  651. exports.warn = warn;
  652. ;
  653. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  654. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  655. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  656. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  657. const LINE_FACTOR = 1.35;
  658. exports.LINE_FACTOR = LINE_FACTOR;
  659. const LINE_DESCENT_FACTOR = 0.35;
  660. exports.LINE_DESCENT_FACTOR = LINE_DESCENT_FACTOR;
  661. const BASELINE_FACTOR = LINE_DESCENT_FACTOR / LINE_FACTOR;
  662. exports.BASELINE_FACTOR = BASELINE_FACTOR;
  663. const RenderingIntentFlag = {
  664. ANY: 0x01,
  665. DISPLAY: 0x02,
  666. PRINT: 0x04,
  667. SAVE: 0x08,
  668. ANNOTATIONS_FORMS: 0x10,
  669. ANNOTATIONS_STORAGE: 0x20,
  670. ANNOTATIONS_DISABLE: 0x40,
  671. OPLIST: 0x100
  672. };
  673. exports.RenderingIntentFlag = RenderingIntentFlag;
  674. const AnnotationMode = {
  675. DISABLE: 0,
  676. ENABLE: 1,
  677. ENABLE_FORMS: 2,
  678. ENABLE_STORAGE: 3
  679. };
  680. exports.AnnotationMode = AnnotationMode;
  681. const AnnotationEditorPrefix = "pdfjs_internal_editor_";
  682. exports.AnnotationEditorPrefix = AnnotationEditorPrefix;
  683. const AnnotationEditorType = {
  684. DISABLE: -1,
  685. NONE: 0,
  686. FREETEXT: 3,
  687. INK: 15
  688. };
  689. exports.AnnotationEditorType = AnnotationEditorType;
  690. const AnnotationEditorParamsType = {
  691. FREETEXT_SIZE: 1,
  692. FREETEXT_COLOR: 2,
  693. FREETEXT_OPACITY: 3,
  694. INK_COLOR: 11,
  695. INK_THICKNESS: 12,
  696. INK_OPACITY: 13
  697. };
  698. exports.AnnotationEditorParamsType = AnnotationEditorParamsType;
  699. const PermissionFlag = {
  700. PRINT: 0x04,
  701. MODIFY_CONTENTS: 0x08,
  702. COPY: 0x10,
  703. MODIFY_ANNOTATIONS: 0x20,
  704. FILL_INTERACTIVE_FORMS: 0x100,
  705. COPY_FOR_ACCESSIBILITY: 0x200,
  706. ASSEMBLE: 0x400,
  707. PRINT_HIGH_QUALITY: 0x800
  708. };
  709. exports.PermissionFlag = PermissionFlag;
  710. const TextRenderingMode = {
  711. FILL: 0,
  712. STROKE: 1,
  713. FILL_STROKE: 2,
  714. INVISIBLE: 3,
  715. FILL_ADD_TO_PATH: 4,
  716. STROKE_ADD_TO_PATH: 5,
  717. FILL_STROKE_ADD_TO_PATH: 6,
  718. ADD_TO_PATH: 7,
  719. FILL_STROKE_MASK: 3,
  720. ADD_TO_PATH_FLAG: 4
  721. };
  722. exports.TextRenderingMode = TextRenderingMode;
  723. const ImageKind = {
  724. GRAYSCALE_1BPP: 1,
  725. RGB_24BPP: 2,
  726. RGBA_32BPP: 3
  727. };
  728. exports.ImageKind = ImageKind;
  729. const AnnotationType = {
  730. TEXT: 1,
  731. LINK: 2,
  732. FREETEXT: 3,
  733. LINE: 4,
  734. SQUARE: 5,
  735. CIRCLE: 6,
  736. POLYGON: 7,
  737. POLYLINE: 8,
  738. HIGHLIGHT: 9,
  739. UNDERLINE: 10,
  740. SQUIGGLY: 11,
  741. STRIKEOUT: 12,
  742. STAMP: 13,
  743. CARET: 14,
  744. INK: 15,
  745. POPUP: 16,
  746. FILEATTACHMENT: 17,
  747. SOUND: 18,
  748. MOVIE: 19,
  749. WIDGET: 20,
  750. SCREEN: 21,
  751. PRINTERMARK: 22,
  752. TRAPNET: 23,
  753. WATERMARK: 24,
  754. THREED: 25,
  755. REDACT: 26
  756. };
  757. exports.AnnotationType = AnnotationType;
  758. const AnnotationStateModelType = {
  759. MARKED: "Marked",
  760. REVIEW: "Review"
  761. };
  762. exports.AnnotationStateModelType = AnnotationStateModelType;
  763. const AnnotationMarkedState = {
  764. MARKED: "Marked",
  765. UNMARKED: "Unmarked"
  766. };
  767. exports.AnnotationMarkedState = AnnotationMarkedState;
  768. const AnnotationReviewState = {
  769. ACCEPTED: "Accepted",
  770. REJECTED: "Rejected",
  771. CANCELLED: "Cancelled",
  772. COMPLETED: "Completed",
  773. NONE: "None"
  774. };
  775. exports.AnnotationReviewState = AnnotationReviewState;
  776. const AnnotationReplyType = {
  777. GROUP: "Group",
  778. REPLY: "R"
  779. };
  780. exports.AnnotationReplyType = AnnotationReplyType;
  781. const AnnotationFlag = {
  782. INVISIBLE: 0x01,
  783. HIDDEN: 0x02,
  784. PRINT: 0x04,
  785. NOZOOM: 0x08,
  786. NOROTATE: 0x10,
  787. NOVIEW: 0x20,
  788. READONLY: 0x40,
  789. LOCKED: 0x80,
  790. TOGGLENOVIEW: 0x100,
  791. LOCKEDCONTENTS: 0x200
  792. };
  793. exports.AnnotationFlag = AnnotationFlag;
  794. const AnnotationFieldFlag = {
  795. READONLY: 0x0000001,
  796. REQUIRED: 0x0000002,
  797. NOEXPORT: 0x0000004,
  798. MULTILINE: 0x0001000,
  799. PASSWORD: 0x0002000,
  800. NOTOGGLETOOFF: 0x0004000,
  801. RADIO: 0x0008000,
  802. PUSHBUTTON: 0x0010000,
  803. COMBO: 0x0020000,
  804. EDIT: 0x0040000,
  805. SORT: 0x0080000,
  806. FILESELECT: 0x0100000,
  807. MULTISELECT: 0x0200000,
  808. DONOTSPELLCHECK: 0x0400000,
  809. DONOTSCROLL: 0x0800000,
  810. COMB: 0x1000000,
  811. RICHTEXT: 0x2000000,
  812. RADIOSINUNISON: 0x2000000,
  813. COMMITONSELCHANGE: 0x4000000
  814. };
  815. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  816. const AnnotationBorderStyleType = {
  817. SOLID: 1,
  818. DASHED: 2,
  819. BEVELED: 3,
  820. INSET: 4,
  821. UNDERLINE: 5
  822. };
  823. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  824. const AnnotationActionEventType = {
  825. E: "Mouse Enter",
  826. X: "Mouse Exit",
  827. D: "Mouse Down",
  828. U: "Mouse Up",
  829. Fo: "Focus",
  830. Bl: "Blur",
  831. PO: "PageOpen",
  832. PC: "PageClose",
  833. PV: "PageVisible",
  834. PI: "PageInvisible",
  835. K: "Keystroke",
  836. F: "Format",
  837. V: "Validate",
  838. C: "Calculate"
  839. };
  840. exports.AnnotationActionEventType = AnnotationActionEventType;
  841. const DocumentActionEventType = {
  842. WC: "WillClose",
  843. WS: "WillSave",
  844. DS: "DidSave",
  845. WP: "WillPrint",
  846. DP: "DidPrint"
  847. };
  848. exports.DocumentActionEventType = DocumentActionEventType;
  849. const PageActionEventType = {
  850. O: "PageOpen",
  851. C: "PageClose"
  852. };
  853. exports.PageActionEventType = PageActionEventType;
  854. const StreamType = {
  855. UNKNOWN: "UNKNOWN",
  856. FLATE: "FLATE",
  857. LZW: "LZW",
  858. DCT: "DCT",
  859. JPX: "JPX",
  860. JBIG: "JBIG",
  861. A85: "A85",
  862. AHX: "AHX",
  863. CCF: "CCF",
  864. RLX: "RLX"
  865. };
  866. exports.StreamType = StreamType;
  867. const FontType = {
  868. UNKNOWN: "UNKNOWN",
  869. TYPE1: "TYPE1",
  870. TYPE1STANDARD: "TYPE1STANDARD",
  871. TYPE1C: "TYPE1C",
  872. CIDFONTTYPE0: "CIDFONTTYPE0",
  873. CIDFONTTYPE0C: "CIDFONTTYPE0C",
  874. TRUETYPE: "TRUETYPE",
  875. CIDFONTTYPE2: "CIDFONTTYPE2",
  876. TYPE3: "TYPE3",
  877. OPENTYPE: "OPENTYPE",
  878. TYPE0: "TYPE0",
  879. MMTYPE1: "MMTYPE1"
  880. };
  881. exports.FontType = FontType;
  882. const VerbosityLevel = {
  883. ERRORS: 0,
  884. WARNINGS: 1,
  885. INFOS: 5
  886. };
  887. exports.VerbosityLevel = VerbosityLevel;
  888. const CMapCompressionType = {
  889. NONE: 0,
  890. BINARY: 1
  891. };
  892. exports.CMapCompressionType = CMapCompressionType;
  893. const OPS = {
  894. dependency: 1,
  895. setLineWidth: 2,
  896. setLineCap: 3,
  897. setLineJoin: 4,
  898. setMiterLimit: 5,
  899. setDash: 6,
  900. setRenderingIntent: 7,
  901. setFlatness: 8,
  902. setGState: 9,
  903. save: 10,
  904. restore: 11,
  905. transform: 12,
  906. moveTo: 13,
  907. lineTo: 14,
  908. curveTo: 15,
  909. curveTo2: 16,
  910. curveTo3: 17,
  911. closePath: 18,
  912. rectangle: 19,
  913. stroke: 20,
  914. closeStroke: 21,
  915. fill: 22,
  916. eoFill: 23,
  917. fillStroke: 24,
  918. eoFillStroke: 25,
  919. closeFillStroke: 26,
  920. closeEOFillStroke: 27,
  921. endPath: 28,
  922. clip: 29,
  923. eoClip: 30,
  924. beginText: 31,
  925. endText: 32,
  926. setCharSpacing: 33,
  927. setWordSpacing: 34,
  928. setHScale: 35,
  929. setLeading: 36,
  930. setFont: 37,
  931. setTextRenderingMode: 38,
  932. setTextRise: 39,
  933. moveText: 40,
  934. setLeadingMoveText: 41,
  935. setTextMatrix: 42,
  936. nextLine: 43,
  937. showText: 44,
  938. showSpacedText: 45,
  939. nextLineShowText: 46,
  940. nextLineSetSpacingShowText: 47,
  941. setCharWidth: 48,
  942. setCharWidthAndBounds: 49,
  943. setStrokeColorSpace: 50,
  944. setFillColorSpace: 51,
  945. setStrokeColor: 52,
  946. setStrokeColorN: 53,
  947. setFillColor: 54,
  948. setFillColorN: 55,
  949. setStrokeGray: 56,
  950. setFillGray: 57,
  951. setStrokeRGBColor: 58,
  952. setFillRGBColor: 59,
  953. setStrokeCMYKColor: 60,
  954. setFillCMYKColor: 61,
  955. shadingFill: 62,
  956. beginInlineImage: 63,
  957. beginImageData: 64,
  958. endInlineImage: 65,
  959. paintXObject: 66,
  960. markPoint: 67,
  961. markPointProps: 68,
  962. beginMarkedContent: 69,
  963. beginMarkedContentProps: 70,
  964. endMarkedContent: 71,
  965. beginCompat: 72,
  966. endCompat: 73,
  967. paintFormXObjectBegin: 74,
  968. paintFormXObjectEnd: 75,
  969. beginGroup: 76,
  970. endGroup: 77,
  971. beginAnnotation: 80,
  972. endAnnotation: 81,
  973. paintImageMaskXObject: 83,
  974. paintImageMaskXObjectGroup: 84,
  975. paintImageXObject: 85,
  976. paintInlineImageXObject: 86,
  977. paintInlineImageXObjectGroup: 87,
  978. paintImageXObjectRepeat: 88,
  979. paintImageMaskXObjectRepeat: 89,
  980. paintSolidColorImageMask: 90,
  981. constructPath: 91
  982. };
  983. exports.OPS = OPS;
  984. const UNSUPPORTED_FEATURES = {
  985. forms: "forms",
  986. javaScript: "javaScript",
  987. signatures: "signatures",
  988. smask: "smask",
  989. shadingPattern: "shadingPattern",
  990. errorTilingPattern: "errorTilingPattern",
  991. errorExtGState: "errorExtGState",
  992. errorXObject: "errorXObject",
  993. errorFontLoadType3: "errorFontLoadType3",
  994. errorFontState: "errorFontState",
  995. errorFontMissing: "errorFontMissing",
  996. errorFontTranslate: "errorFontTranslate",
  997. errorColorSpace: "errorColorSpace",
  998. errorOperatorList: "errorOperatorList",
  999. errorFontToUnicode: "errorFontToUnicode",
  1000. errorFontLoadNative: "errorFontLoadNative",
  1001. errorFontBuildPath: "errorFontBuildPath",
  1002. errorFontGetPath: "errorFontGetPath",
  1003. errorMarkedContent: "errorMarkedContent",
  1004. errorContentSubStream: "errorContentSubStream"
  1005. };
  1006. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  1007. const PasswordResponses = {
  1008. NEED_PASSWORD: 1,
  1009. INCORRECT_PASSWORD: 2
  1010. };
  1011. exports.PasswordResponses = PasswordResponses;
  1012. let verbosity = VerbosityLevel.WARNINGS;
  1013. function setVerbosityLevel(level) {
  1014. if (Number.isInteger(level)) {
  1015. verbosity = level;
  1016. }
  1017. }
  1018. function getVerbosityLevel() {
  1019. return verbosity;
  1020. }
  1021. function info(msg) {
  1022. if (verbosity >= VerbosityLevel.INFOS) {
  1023. console.log(`Info: ${msg}`);
  1024. }
  1025. }
  1026. function warn(msg) {
  1027. if (verbosity >= VerbosityLevel.WARNINGS) {
  1028. console.log(`Warning: ${msg}`);
  1029. }
  1030. }
  1031. function unreachable(msg) {
  1032. throw new Error(msg);
  1033. }
  1034. function assert(cond, msg) {
  1035. if (!cond) {
  1036. unreachable(msg);
  1037. }
  1038. }
  1039. function _isValidProtocol(url) {
  1040. if (!url) {
  1041. return false;
  1042. }
  1043. switch (url.protocol) {
  1044. case "http:":
  1045. case "https:":
  1046. case "ftp:":
  1047. case "mailto:":
  1048. case "tel:":
  1049. return true;
  1050. default:
  1051. return false;
  1052. }
  1053. }
  1054. function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
  1055. if (!url) {
  1056. return null;
  1057. }
  1058. try {
  1059. if (options && typeof url === "string") {
  1060. if (options.addDefaultProtocol && url.startsWith("www.")) {
  1061. const dots = url.match(/\./g);
  1062. if (dots && dots.length >= 2) {
  1063. url = `http://${url}`;
  1064. }
  1065. }
  1066. if (options.tryConvertEncoding) {
  1067. try {
  1068. url = stringToUTF8String(url);
  1069. } catch (ex) {}
  1070. }
  1071. }
  1072. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  1073. if (_isValidProtocol(absoluteUrl)) {
  1074. return absoluteUrl;
  1075. }
  1076. } catch (ex) {}
  1077. return null;
  1078. }
  1079. function shadow(obj, prop, value, nonSerializable = false) {
  1080. Object.defineProperty(obj, prop, {
  1081. value,
  1082. enumerable: !nonSerializable,
  1083. configurable: true,
  1084. writable: false
  1085. });
  1086. return value;
  1087. }
  1088. const BaseException = function BaseExceptionClosure() {
  1089. function BaseException(message, name) {
  1090. if (this.constructor === BaseException) {
  1091. unreachable("Cannot initialize BaseException.");
  1092. }
  1093. this.message = message;
  1094. this.name = name;
  1095. }
  1096. BaseException.prototype = new Error();
  1097. BaseException.constructor = BaseException;
  1098. return BaseException;
  1099. }();
  1100. exports.BaseException = BaseException;
  1101. class PasswordException extends BaseException {
  1102. constructor(msg, code) {
  1103. super(msg, "PasswordException");
  1104. this.code = code;
  1105. }
  1106. }
  1107. exports.PasswordException = PasswordException;
  1108. class UnknownErrorException extends BaseException {
  1109. constructor(msg, details) {
  1110. super(msg, "UnknownErrorException");
  1111. this.details = details;
  1112. }
  1113. }
  1114. exports.UnknownErrorException = UnknownErrorException;
  1115. class InvalidPDFException extends BaseException {
  1116. constructor(msg) {
  1117. super(msg, "InvalidPDFException");
  1118. }
  1119. }
  1120. exports.InvalidPDFException = InvalidPDFException;
  1121. class MissingPDFException extends BaseException {
  1122. constructor(msg) {
  1123. super(msg, "MissingPDFException");
  1124. }
  1125. }
  1126. exports.MissingPDFException = MissingPDFException;
  1127. class UnexpectedResponseException extends BaseException {
  1128. constructor(msg, status) {
  1129. super(msg, "UnexpectedResponseException");
  1130. this.status = status;
  1131. }
  1132. }
  1133. exports.UnexpectedResponseException = UnexpectedResponseException;
  1134. class FormatError extends BaseException {
  1135. constructor(msg) {
  1136. super(msg, "FormatError");
  1137. }
  1138. }
  1139. exports.FormatError = FormatError;
  1140. class AbortException extends BaseException {
  1141. constructor(msg) {
  1142. super(msg, "AbortException");
  1143. }
  1144. }
  1145. exports.AbortException = AbortException;
  1146. function bytesToString(bytes) {
  1147. if (typeof bytes !== "object" || bytes === null || bytes.length === undefined) {
  1148. unreachable("Invalid argument for bytesToString");
  1149. }
  1150. const length = bytes.length;
  1151. const MAX_ARGUMENT_COUNT = 8192;
  1152. if (length < MAX_ARGUMENT_COUNT) {
  1153. return String.fromCharCode.apply(null, bytes);
  1154. }
  1155. const strBuf = [];
  1156. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  1157. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  1158. const chunk = bytes.subarray(i, chunkEnd);
  1159. strBuf.push(String.fromCharCode.apply(null, chunk));
  1160. }
  1161. return strBuf.join("");
  1162. }
  1163. function stringToBytes(str) {
  1164. if (typeof str !== "string") {
  1165. unreachable("Invalid argument for stringToBytes");
  1166. }
  1167. const length = str.length;
  1168. const bytes = new Uint8Array(length);
  1169. for (let i = 0; i < length; ++i) {
  1170. bytes[i] = str.charCodeAt(i) & 0xff;
  1171. }
  1172. return bytes;
  1173. }
  1174. function arrayByteLength(arr) {
  1175. if (arr.length !== undefined) {
  1176. return arr.length;
  1177. }
  1178. if (arr.byteLength !== undefined) {
  1179. return arr.byteLength;
  1180. }
  1181. unreachable("Invalid argument for arrayByteLength");
  1182. }
  1183. function arraysToBytes(arr) {
  1184. const length = arr.length;
  1185. if (length === 1 && arr[0] instanceof Uint8Array) {
  1186. return arr[0];
  1187. }
  1188. let resultLength = 0;
  1189. for (let i = 0; i < length; i++) {
  1190. resultLength += arrayByteLength(arr[i]);
  1191. }
  1192. let pos = 0;
  1193. const data = new Uint8Array(resultLength);
  1194. for (let i = 0; i < length; i++) {
  1195. let item = arr[i];
  1196. if (!(item instanceof Uint8Array)) {
  1197. if (typeof item === "string") {
  1198. item = stringToBytes(item);
  1199. } else {
  1200. item = new Uint8Array(item);
  1201. }
  1202. }
  1203. const itemLength = item.byteLength;
  1204. data.set(item, pos);
  1205. pos += itemLength;
  1206. }
  1207. return data;
  1208. }
  1209. function string32(value) {
  1210. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  1211. }
  1212. function objectSize(obj) {
  1213. return Object.keys(obj).length;
  1214. }
  1215. function objectFromMap(map) {
  1216. const obj = Object.create(null);
  1217. for (const [key, value] of map) {
  1218. obj[key] = value;
  1219. }
  1220. return obj;
  1221. }
  1222. function isLittleEndian() {
  1223. const buffer8 = new Uint8Array(4);
  1224. buffer8[0] = 1;
  1225. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  1226. return view32[0] === 1;
  1227. }
  1228. function isEvalSupported() {
  1229. try {
  1230. new Function("");
  1231. return true;
  1232. } catch (e) {
  1233. return false;
  1234. }
  1235. }
  1236. class FeatureTest {
  1237. static get isLittleEndian() {
  1238. return shadow(this, "isLittleEndian", isLittleEndian());
  1239. }
  1240. static get isEvalSupported() {
  1241. return shadow(this, "isEvalSupported", isEvalSupported());
  1242. }
  1243. static get isOffscreenCanvasSupported() {
  1244. return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
  1245. }
  1246. static get platform() {
  1247. if (typeof navigator === "undefined") {
  1248. return shadow(this, "platform", {
  1249. isWin: false,
  1250. isMac: false
  1251. });
  1252. }
  1253. return shadow(this, "platform", {
  1254. isWin: navigator.platform.includes("Win"),
  1255. isMac: navigator.platform.includes("Mac")
  1256. });
  1257. }
  1258. }
  1259. exports.FeatureTest = FeatureTest;
  1260. const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
  1261. class Util {
  1262. static makeHexColor(r, g, b) {
  1263. return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
  1264. }
  1265. static scaleMinMax(transform, minMax) {
  1266. let temp;
  1267. if (transform[0]) {
  1268. if (transform[0] < 0) {
  1269. temp = minMax[0];
  1270. minMax[0] = minMax[1];
  1271. minMax[1] = temp;
  1272. }
  1273. minMax[0] *= transform[0];
  1274. minMax[1] *= transform[0];
  1275. if (transform[3] < 0) {
  1276. temp = minMax[2];
  1277. minMax[2] = minMax[3];
  1278. minMax[3] = temp;
  1279. }
  1280. minMax[2] *= transform[3];
  1281. minMax[3] *= transform[3];
  1282. } else {
  1283. temp = minMax[0];
  1284. minMax[0] = minMax[2];
  1285. minMax[2] = temp;
  1286. temp = minMax[1];
  1287. minMax[1] = minMax[3];
  1288. minMax[3] = temp;
  1289. if (transform[1] < 0) {
  1290. temp = minMax[2];
  1291. minMax[2] = minMax[3];
  1292. minMax[3] = temp;
  1293. }
  1294. minMax[2] *= transform[1];
  1295. minMax[3] *= transform[1];
  1296. if (transform[2] < 0) {
  1297. temp = minMax[0];
  1298. minMax[0] = minMax[1];
  1299. minMax[1] = temp;
  1300. }
  1301. minMax[0] *= transform[2];
  1302. minMax[1] *= transform[2];
  1303. }
  1304. minMax[0] += transform[4];
  1305. minMax[1] += transform[4];
  1306. minMax[2] += transform[5];
  1307. minMax[3] += transform[5];
  1308. }
  1309. static transform(m1, m2) {
  1310. return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]];
  1311. }
  1312. static applyTransform(p, m) {
  1313. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  1314. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  1315. return [xt, yt];
  1316. }
  1317. static applyInverseTransform(p, m) {
  1318. const d = m[0] * m[3] - m[1] * m[2];
  1319. const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  1320. const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  1321. return [xt, yt];
  1322. }
  1323. static getAxialAlignedBoundingBox(r, m) {
  1324. const p1 = Util.applyTransform(r, m);
  1325. const p2 = Util.applyTransform(r.slice(2, 4), m);
  1326. const p3 = Util.applyTransform([r[0], r[3]], m);
  1327. const p4 = Util.applyTransform([r[2], r[1]], m);
  1328. return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])];
  1329. }
  1330. static inverseTransform(m) {
  1331. const d = m[0] * m[3] - m[1] * m[2];
  1332. return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d];
  1333. }
  1334. static singularValueDecompose2dScale(m) {
  1335. const transpose = [m[0], m[2], m[1], m[3]];
  1336. const a = m[0] * transpose[0] + m[1] * transpose[2];
  1337. const b = m[0] * transpose[1] + m[1] * transpose[3];
  1338. const c = m[2] * transpose[0] + m[3] * transpose[2];
  1339. const d = m[2] * transpose[1] + m[3] * transpose[3];
  1340. const first = (a + d) / 2;
  1341. const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
  1342. const sx = first + second || 1;
  1343. const sy = first - second || 1;
  1344. return [Math.sqrt(sx), Math.sqrt(sy)];
  1345. }
  1346. static normalizeRect(rect) {
  1347. const r = rect.slice(0);
  1348. if (rect[0] > rect[2]) {
  1349. r[0] = rect[2];
  1350. r[2] = rect[0];
  1351. }
  1352. if (rect[1] > rect[3]) {
  1353. r[1] = rect[3];
  1354. r[3] = rect[1];
  1355. }
  1356. return r;
  1357. }
  1358. static intersect(rect1, rect2) {
  1359. const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2]));
  1360. const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2]));
  1361. if (xLow > xHigh) {
  1362. return null;
  1363. }
  1364. const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3]));
  1365. const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3]));
  1366. if (yLow > yHigh) {
  1367. return null;
  1368. }
  1369. return [xLow, yLow, xHigh, yHigh];
  1370. }
  1371. static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {
  1372. const tvalues = [],
  1373. bounds = [[], []];
  1374. let a, b, c, t, t1, t2, b2ac, sqrtb2ac;
  1375. for (let i = 0; i < 2; ++i) {
  1376. if (i === 0) {
  1377. b = 6 * x0 - 12 * x1 + 6 * x2;
  1378. a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
  1379. c = 3 * x1 - 3 * x0;
  1380. } else {
  1381. b = 6 * y0 - 12 * y1 + 6 * y2;
  1382. a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
  1383. c = 3 * y1 - 3 * y0;
  1384. }
  1385. if (Math.abs(a) < 1e-12) {
  1386. if (Math.abs(b) < 1e-12) {
  1387. continue;
  1388. }
  1389. t = -c / b;
  1390. if (0 < t && t < 1) {
  1391. tvalues.push(t);
  1392. }
  1393. continue;
  1394. }
  1395. b2ac = b * b - 4 * c * a;
  1396. sqrtb2ac = Math.sqrt(b2ac);
  1397. if (b2ac < 0) {
  1398. continue;
  1399. }
  1400. t1 = (-b + sqrtb2ac) / (2 * a);
  1401. if (0 < t1 && t1 < 1) {
  1402. tvalues.push(t1);
  1403. }
  1404. t2 = (-b - sqrtb2ac) / (2 * a);
  1405. if (0 < t2 && t2 < 1) {
  1406. tvalues.push(t2);
  1407. }
  1408. }
  1409. let j = tvalues.length,
  1410. mt;
  1411. const jlen = j;
  1412. while (j--) {
  1413. t = tvalues[j];
  1414. mt = 1 - t;
  1415. bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
  1416. bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
  1417. }
  1418. bounds[0][jlen] = x0;
  1419. bounds[1][jlen] = y0;
  1420. bounds[0][jlen + 1] = x3;
  1421. bounds[1][jlen + 1] = y3;
  1422. bounds[0].length = bounds[1].length = jlen + 2;
  1423. return [Math.min(...bounds[0]), Math.min(...bounds[1]), Math.max(...bounds[0]), Math.max(...bounds[1])];
  1424. }
  1425. }
  1426. exports.Util = Util;
  1427. const PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2d8, 0x2c7, 0x2c6, 0x2d9, 0x2dd, 0x2db, 0x2da, 0x2dc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203a, 0x2212, 0x2030, 0x201e, 0x201c, 0x201d, 0x2018, 0x2019, 0x201a, 0x2122, 0xfb01, 0xfb02, 0x141, 0x152, 0x160, 0x178, 0x17d, 0x131, 0x142, 0x153, 0x161, 0x17e, 0, 0x20ac];
  1428. function stringToPDFString(str) {
  1429. if (str[0] >= "\xEF") {
  1430. let encoding;
  1431. if (str[0] === "\xFE" && str[1] === "\xFF") {
  1432. encoding = "utf-16be";
  1433. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  1434. encoding = "utf-16le";
  1435. } else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") {
  1436. encoding = "utf-8";
  1437. }
  1438. if (encoding) {
  1439. try {
  1440. const decoder = new TextDecoder(encoding, {
  1441. fatal: true
  1442. });
  1443. const buffer = stringToBytes(str);
  1444. return decoder.decode(buffer);
  1445. } catch (ex) {
  1446. warn(`stringToPDFString: "${ex}".`);
  1447. }
  1448. }
  1449. }
  1450. const strBuf = [];
  1451. for (let i = 0, ii = str.length; i < ii; i++) {
  1452. const code = PDFStringTranslateTable[str.charCodeAt(i)];
  1453. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1454. }
  1455. return strBuf.join("");
  1456. }
  1457. function stringToUTF8String(str) {
  1458. return decodeURIComponent(escape(str));
  1459. }
  1460. function utf8StringToString(str) {
  1461. return unescape(encodeURIComponent(str));
  1462. }
  1463. function isArrayBuffer(v) {
  1464. return typeof v === "object" && v !== null && v.byteLength !== undefined;
  1465. }
  1466. function isArrayEqual(arr1, arr2) {
  1467. if (arr1.length !== arr2.length) {
  1468. return false;
  1469. }
  1470. for (let i = 0, ii = arr1.length; i < ii; i++) {
  1471. if (arr1[i] !== arr2[i]) {
  1472. return false;
  1473. }
  1474. }
  1475. return true;
  1476. }
  1477. function getModificationDate(date = new Date()) {
  1478. const buffer = [date.getUTCFullYear().toString(), (date.getUTCMonth() + 1).toString().padStart(2, "0"), date.getUTCDate().toString().padStart(2, "0"), date.getUTCHours().toString().padStart(2, "0"), date.getUTCMinutes().toString().padStart(2, "0"), date.getUTCSeconds().toString().padStart(2, "0")];
  1479. return buffer.join("");
  1480. }
  1481. function createPromiseCapability() {
  1482. const capability = Object.create(null);
  1483. let isSettled = false;
  1484. Object.defineProperty(capability, "settled", {
  1485. get() {
  1486. return isSettled;
  1487. }
  1488. });
  1489. capability.promise = new Promise(function (resolve, reject) {
  1490. capability.resolve = function (data) {
  1491. isSettled = true;
  1492. resolve(data);
  1493. };
  1494. capability.reject = function (reason) {
  1495. isSettled = true;
  1496. reject(reason);
  1497. };
  1498. });
  1499. return capability;
  1500. }
  1501. /***/ }),
  1502. /* 3 */
  1503. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1504. Object.defineProperty(exports, "__esModule", ({
  1505. value: true
  1506. }));
  1507. exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd = exports.CIRCULAR_REF = void 0;
  1508. exports.clearPrimitiveCaches = clearPrimitiveCaches;
  1509. exports.isCmd = isCmd;
  1510. exports.isDict = isDict;
  1511. exports.isName = isName;
  1512. exports.isRefsEqual = isRefsEqual;
  1513. var _util = __w_pdfjs_require__(2);
  1514. const CIRCULAR_REF = Symbol("CIRCULAR_REF");
  1515. exports.CIRCULAR_REF = CIRCULAR_REF;
  1516. const EOF = Symbol("EOF");
  1517. exports.EOF = EOF;
  1518. const Name = function NameClosure() {
  1519. let nameCache = Object.create(null);
  1520. class Name {
  1521. constructor(name) {
  1522. this.name = name;
  1523. }
  1524. static get(name) {
  1525. return nameCache[name] || (nameCache[name] = new Name(name));
  1526. }
  1527. static _clearCache() {
  1528. nameCache = Object.create(null);
  1529. }
  1530. }
  1531. return Name;
  1532. }();
  1533. exports.Name = Name;
  1534. const Cmd = function CmdClosure() {
  1535. let cmdCache = Object.create(null);
  1536. class Cmd {
  1537. constructor(cmd) {
  1538. this.cmd = cmd;
  1539. }
  1540. static get(cmd) {
  1541. return cmdCache[cmd] || (cmdCache[cmd] = new Cmd(cmd));
  1542. }
  1543. static _clearCache() {
  1544. cmdCache = Object.create(null);
  1545. }
  1546. }
  1547. return Cmd;
  1548. }();
  1549. exports.Cmd = Cmd;
  1550. const nonSerializable = function nonSerializableClosure() {
  1551. return nonSerializable;
  1552. };
  1553. class Dict {
  1554. constructor(xref = null) {
  1555. this._map = Object.create(null);
  1556. this.xref = xref;
  1557. this.objId = null;
  1558. this.suppressEncryption = false;
  1559. this.__nonSerializable__ = nonSerializable;
  1560. }
  1561. assignXref(newXref) {
  1562. this.xref = newXref;
  1563. }
  1564. get size() {
  1565. return Object.keys(this._map).length;
  1566. }
  1567. get(key1, key2, key3) {
  1568. let value = this._map[key1];
  1569. if (value === undefined && key2 !== undefined) {
  1570. value = this._map[key2];
  1571. if (value === undefined && key3 !== undefined) {
  1572. value = this._map[key3];
  1573. }
  1574. }
  1575. if (value instanceof Ref && this.xref) {
  1576. return this.xref.fetch(value, this.suppressEncryption);
  1577. }
  1578. return value;
  1579. }
  1580. async getAsync(key1, key2, key3) {
  1581. let value = this._map[key1];
  1582. if (value === undefined && key2 !== undefined) {
  1583. value = this._map[key2];
  1584. if (value === undefined && key3 !== undefined) {
  1585. value = this._map[key3];
  1586. }
  1587. }
  1588. if (value instanceof Ref && this.xref) {
  1589. return this.xref.fetchAsync(value, this.suppressEncryption);
  1590. }
  1591. return value;
  1592. }
  1593. getArray(key1, key2, key3) {
  1594. let value = this._map[key1];
  1595. if (value === undefined && key2 !== undefined) {
  1596. value = this._map[key2];
  1597. if (value === undefined && key3 !== undefined) {
  1598. value = this._map[key3];
  1599. }
  1600. }
  1601. if (value instanceof Ref && this.xref) {
  1602. value = this.xref.fetch(value, this.suppressEncryption);
  1603. }
  1604. if (Array.isArray(value)) {
  1605. value = value.slice();
  1606. for (let i = 0, ii = value.length; i < ii; i++) {
  1607. if (value[i] instanceof Ref && this.xref) {
  1608. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  1609. }
  1610. }
  1611. }
  1612. return value;
  1613. }
  1614. getRaw(key) {
  1615. return this._map[key];
  1616. }
  1617. getKeys() {
  1618. return Object.keys(this._map);
  1619. }
  1620. getRawValues() {
  1621. return Object.values(this._map);
  1622. }
  1623. set(key, value) {
  1624. this._map[key] = value;
  1625. }
  1626. has(key) {
  1627. return this._map[key] !== undefined;
  1628. }
  1629. forEach(callback) {
  1630. for (const key in this._map) {
  1631. callback(key, this.get(key));
  1632. }
  1633. }
  1634. static get empty() {
  1635. const emptyDict = new Dict(null);
  1636. emptyDict.set = (key, value) => {
  1637. (0, _util.unreachable)("Should not call `set` on the empty dictionary.");
  1638. };
  1639. return (0, _util.shadow)(this, "empty", emptyDict);
  1640. }
  1641. static merge({
  1642. xref,
  1643. dictArray,
  1644. mergeSubDicts = false
  1645. }) {
  1646. const mergedDict = new Dict(xref),
  1647. properties = new Map();
  1648. for (const dict of dictArray) {
  1649. if (!(dict instanceof Dict)) {
  1650. continue;
  1651. }
  1652. for (const [key, value] of Object.entries(dict._map)) {
  1653. let property = properties.get(key);
  1654. if (property === undefined) {
  1655. property = [];
  1656. properties.set(key, property);
  1657. } else if (!mergeSubDicts || !(value instanceof Dict)) {
  1658. continue;
  1659. }
  1660. property.push(value);
  1661. }
  1662. }
  1663. for (const [name, values] of properties) {
  1664. if (values.length === 1 || !(values[0] instanceof Dict)) {
  1665. mergedDict._map[name] = values[0];
  1666. continue;
  1667. }
  1668. const subDict = new Dict(xref);
  1669. for (const dict of values) {
  1670. for (const [key, value] of Object.entries(dict._map)) {
  1671. if (subDict._map[key] === undefined) {
  1672. subDict._map[key] = value;
  1673. }
  1674. }
  1675. }
  1676. if (subDict.size > 0) {
  1677. mergedDict._map[name] = subDict;
  1678. }
  1679. }
  1680. properties.clear();
  1681. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  1682. }
  1683. }
  1684. exports.Dict = Dict;
  1685. const Ref = function RefClosure() {
  1686. let refCache = Object.create(null);
  1687. class Ref {
  1688. constructor(num, gen) {
  1689. this.num = num;
  1690. this.gen = gen;
  1691. }
  1692. toString() {
  1693. if (this.gen === 0) {
  1694. return `${this.num}R`;
  1695. }
  1696. return `${this.num}R${this.gen}`;
  1697. }
  1698. static get(num, gen) {
  1699. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  1700. return refCache[key] || (refCache[key] = new Ref(num, gen));
  1701. }
  1702. static _clearCache() {
  1703. refCache = Object.create(null);
  1704. }
  1705. }
  1706. return Ref;
  1707. }();
  1708. exports.Ref = Ref;
  1709. class RefSet {
  1710. constructor(parent = null) {
  1711. this._set = new Set(parent && parent._set);
  1712. }
  1713. has(ref) {
  1714. return this._set.has(ref.toString());
  1715. }
  1716. put(ref) {
  1717. this._set.add(ref.toString());
  1718. }
  1719. remove(ref) {
  1720. this._set.delete(ref.toString());
  1721. }
  1722. [Symbol.iterator]() {
  1723. return this._set.values();
  1724. }
  1725. clear() {
  1726. this._set.clear();
  1727. }
  1728. }
  1729. exports.RefSet = RefSet;
  1730. class RefSetCache {
  1731. constructor() {
  1732. this._map = new Map();
  1733. }
  1734. get size() {
  1735. return this._map.size;
  1736. }
  1737. get(ref) {
  1738. return this._map.get(ref.toString());
  1739. }
  1740. has(ref) {
  1741. return this._map.has(ref.toString());
  1742. }
  1743. put(ref, obj) {
  1744. this._map.set(ref.toString(), obj);
  1745. }
  1746. putAlias(ref, aliasRef) {
  1747. this._map.set(ref.toString(), this.get(aliasRef));
  1748. }
  1749. [Symbol.iterator]() {
  1750. return this._map.values();
  1751. }
  1752. clear() {
  1753. this._map.clear();
  1754. }
  1755. }
  1756. exports.RefSetCache = RefSetCache;
  1757. function isName(v, name) {
  1758. return v instanceof Name && (name === undefined || v.name === name);
  1759. }
  1760. function isCmd(v, cmd) {
  1761. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  1762. }
  1763. function isDict(v, type) {
  1764. return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
  1765. }
  1766. function isRefsEqual(v1, v2) {
  1767. return v1.num === v2.num && v1.gen === v2.gen;
  1768. }
  1769. function clearPrimitiveCaches() {
  1770. Cmd._clearCache();
  1771. Name._clearCache();
  1772. Ref._clearCache();
  1773. }
  1774. /***/ }),
  1775. /* 4 */
  1776. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1777. Object.defineProperty(exports, "__esModule", ({
  1778. value: true
  1779. }));
  1780. exports.XRefParseException = exports.XRefEntryException = exports.ParserEOFException = exports.PDF_VERSION_REGEXP = exports.MissingDataException = exports.DocStats = void 0;
  1781. exports.collectActions = collectActions;
  1782. exports.encodeToXmlString = encodeToXmlString;
  1783. exports.escapePDFName = escapePDFName;
  1784. exports.escapeString = escapeString;
  1785. exports.getArrayLookupTableFactory = getArrayLookupTableFactory;
  1786. exports.getInheritableProperty = getInheritableProperty;
  1787. exports.getLookupTableFactory = getLookupTableFactory;
  1788. exports.getNewAnnotationsMap = getNewAnnotationsMap;
  1789. exports.getRotationMatrix = getRotationMatrix;
  1790. exports.isAscii = isAscii;
  1791. exports.isWhiteSpace = isWhiteSpace;
  1792. exports.log2 = log2;
  1793. exports.numberToString = numberToString;
  1794. exports.parseXFAPath = parseXFAPath;
  1795. exports.readInt8 = readInt8;
  1796. exports.readUint16 = readUint16;
  1797. exports.readUint32 = readUint32;
  1798. exports.recoverJsURL = recoverJsURL;
  1799. exports.stringToUTF16HexString = stringToUTF16HexString;
  1800. exports.stringToUTF16String = stringToUTF16String;
  1801. exports.toRomanNumerals = toRomanNumerals;
  1802. exports.validateCSSFont = validateCSSFont;
  1803. var _util = __w_pdfjs_require__(2);
  1804. var _primitives = __w_pdfjs_require__(3);
  1805. var _base_stream = __w_pdfjs_require__(5);
  1806. const PDF_VERSION_REGEXP = /^[1-9]\.\d$/;
  1807. exports.PDF_VERSION_REGEXP = PDF_VERSION_REGEXP;
  1808. function getLookupTableFactory(initializer) {
  1809. let lookup;
  1810. return function () {
  1811. if (initializer) {
  1812. lookup = Object.create(null);
  1813. initializer(lookup);
  1814. initializer = null;
  1815. }
  1816. return lookup;
  1817. };
  1818. }
  1819. function getArrayLookupTableFactory(initializer) {
  1820. let lookup;
  1821. return function () {
  1822. if (initializer) {
  1823. let arr = initializer();
  1824. initializer = null;
  1825. lookup = Object.create(null);
  1826. for (let i = 0, ii = arr.length; i < ii; i += 2) {
  1827. lookup[arr[i]] = arr[i + 1];
  1828. }
  1829. arr = null;
  1830. }
  1831. return lookup;
  1832. };
  1833. }
  1834. class MissingDataException extends _util.BaseException {
  1835. constructor(begin, end) {
  1836. super(`Missing data [${begin}, ${end})`, "MissingDataException");
  1837. this.begin = begin;
  1838. this.end = end;
  1839. }
  1840. }
  1841. exports.MissingDataException = MissingDataException;
  1842. class ParserEOFException extends _util.BaseException {
  1843. constructor(msg) {
  1844. super(msg, "ParserEOFException");
  1845. }
  1846. }
  1847. exports.ParserEOFException = ParserEOFException;
  1848. class XRefEntryException extends _util.BaseException {
  1849. constructor(msg) {
  1850. super(msg, "XRefEntryException");
  1851. }
  1852. }
  1853. exports.XRefEntryException = XRefEntryException;
  1854. class XRefParseException extends _util.BaseException {
  1855. constructor(msg) {
  1856. super(msg, "XRefParseException");
  1857. }
  1858. }
  1859. exports.XRefParseException = XRefParseException;
  1860. class DocStats {
  1861. constructor(handler) {
  1862. this._handler = handler;
  1863. this._streamTypes = new Set();
  1864. this._fontTypes = new Set();
  1865. }
  1866. _send() {
  1867. const streamTypes = Object.create(null),
  1868. fontTypes = Object.create(null);
  1869. for (const type of this._streamTypes) {
  1870. streamTypes[type] = true;
  1871. }
  1872. for (const type of this._fontTypes) {
  1873. fontTypes[type] = true;
  1874. }
  1875. this._handler.send("DocStats", {
  1876. streamTypes,
  1877. fontTypes
  1878. });
  1879. }
  1880. addStreamType(type) {
  1881. if (this._streamTypes.has(type)) {
  1882. return;
  1883. }
  1884. this._streamTypes.add(type);
  1885. this._send();
  1886. }
  1887. addFontType(type) {
  1888. if (this._fontTypes.has(type)) {
  1889. return;
  1890. }
  1891. this._fontTypes.add(type);
  1892. this._send();
  1893. }
  1894. }
  1895. exports.DocStats = DocStats;
  1896. function getInheritableProperty({
  1897. dict,
  1898. key,
  1899. getArray = false,
  1900. stopWhenFound = true
  1901. }) {
  1902. let values;
  1903. const visited = new _primitives.RefSet();
  1904. while (dict instanceof _primitives.Dict && !(dict.objId && visited.has(dict.objId))) {
  1905. if (dict.objId) {
  1906. visited.put(dict.objId);
  1907. }
  1908. const value = getArray ? dict.getArray(key) : dict.get(key);
  1909. if (value !== undefined) {
  1910. if (stopWhenFound) {
  1911. return value;
  1912. }
  1913. if (!values) {
  1914. values = [];
  1915. }
  1916. values.push(value);
  1917. }
  1918. dict = dict.get("Parent");
  1919. }
  1920. return values;
  1921. }
  1922. const ROMAN_NUMBER_MAP = ["", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM", "", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC", "", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"];
  1923. function toRomanNumerals(number, lowerCase = false) {
  1924. (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
  1925. const romanBuf = [];
  1926. let pos;
  1927. while (number >= 1000) {
  1928. number -= 1000;
  1929. romanBuf.push("M");
  1930. }
  1931. pos = number / 100 | 0;
  1932. number %= 100;
  1933. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  1934. pos = number / 10 | 0;
  1935. number %= 10;
  1936. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  1937. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  1938. const romanStr = romanBuf.join("");
  1939. return lowerCase ? romanStr.toLowerCase() : romanStr;
  1940. }
  1941. function log2(x) {
  1942. if (x <= 0) {
  1943. return 0;
  1944. }
  1945. return Math.ceil(Math.log2(x));
  1946. }
  1947. function readInt8(data, offset) {
  1948. return data[offset] << 24 >> 24;
  1949. }
  1950. function readUint16(data, offset) {
  1951. return data[offset] << 8 | data[offset + 1];
  1952. }
  1953. function readUint32(data, offset) {
  1954. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  1955. }
  1956. function isWhiteSpace(ch) {
  1957. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  1958. }
  1959. function parseXFAPath(path) {
  1960. const positionPattern = /(.+)\[(\d+)\]$/;
  1961. return path.split(".").map(component => {
  1962. const m = component.match(positionPattern);
  1963. if (m) {
  1964. return {
  1965. name: m[1],
  1966. pos: parseInt(m[2], 10)
  1967. };
  1968. }
  1969. return {
  1970. name: component,
  1971. pos: 0
  1972. };
  1973. });
  1974. }
  1975. function escapePDFName(str) {
  1976. const buffer = [];
  1977. let start = 0;
  1978. for (let i = 0, ii = str.length; i < ii; i++) {
  1979. const char = str.charCodeAt(i);
  1980. if (char < 0x21 || char > 0x7e || char === 0x23 || char === 0x28 || char === 0x29 || char === 0x3c || char === 0x3e || char === 0x5b || char === 0x5d || char === 0x7b || char === 0x7d || char === 0x2f || char === 0x25) {
  1981. if (start < i) {
  1982. buffer.push(str.substring(start, i));
  1983. }
  1984. buffer.push(`#${char.toString(16)}`);
  1985. start = i + 1;
  1986. }
  1987. }
  1988. if (buffer.length === 0) {
  1989. return str;
  1990. }
  1991. if (start < str.length) {
  1992. buffer.push(str.substring(start, str.length));
  1993. }
  1994. return buffer.join("");
  1995. }
  1996. function escapeString(str) {
  1997. return str.replace(/([()\\\n\r])/g, match => {
  1998. if (match === "\n") {
  1999. return "\\n";
  2000. } else if (match === "\r") {
  2001. return "\\r";
  2002. }
  2003. return `\\${match}`;
  2004. });
  2005. }
  2006. function _collectJS(entry, xref, list, parents) {
  2007. if (!entry) {
  2008. return;
  2009. }
  2010. let parent = null;
  2011. if (entry instanceof _primitives.Ref) {
  2012. if (parents.has(entry)) {
  2013. return;
  2014. }
  2015. parent = entry;
  2016. parents.put(parent);
  2017. entry = xref.fetch(entry);
  2018. }
  2019. if (Array.isArray(entry)) {
  2020. for (const element of entry) {
  2021. _collectJS(element, xref, list, parents);
  2022. }
  2023. } else if (entry instanceof _primitives.Dict) {
  2024. if ((0, _primitives.isName)(entry.get("S"), "JavaScript")) {
  2025. const js = entry.get("JS");
  2026. let code;
  2027. if (js instanceof _base_stream.BaseStream) {
  2028. code = js.getString();
  2029. } else if (typeof js === "string") {
  2030. code = js;
  2031. }
  2032. code = code && (0, _util.stringToPDFString)(code).replace(/\u0000/g, "");
  2033. if (code) {
  2034. list.push(code);
  2035. }
  2036. }
  2037. _collectJS(entry.getRaw("Next"), xref, list, parents);
  2038. }
  2039. if (parent) {
  2040. parents.remove(parent);
  2041. }
  2042. }
  2043. function collectActions(xref, dict, eventType) {
  2044. const actions = Object.create(null);
  2045. const additionalActionsDicts = getInheritableProperty({
  2046. dict,
  2047. key: "AA",
  2048. stopWhenFound: false
  2049. });
  2050. if (additionalActionsDicts) {
  2051. for (let i = additionalActionsDicts.length - 1; i >= 0; i--) {
  2052. const additionalActions = additionalActionsDicts[i];
  2053. if (!(additionalActions instanceof _primitives.Dict)) {
  2054. continue;
  2055. }
  2056. for (const key of additionalActions.getKeys()) {
  2057. const action = eventType[key];
  2058. if (!action) {
  2059. continue;
  2060. }
  2061. const actionDict = additionalActions.getRaw(key);
  2062. const parents = new _primitives.RefSet();
  2063. const list = [];
  2064. _collectJS(actionDict, xref, list, parents);
  2065. if (list.length > 0) {
  2066. actions[action] = list;
  2067. }
  2068. }
  2069. }
  2070. }
  2071. if (dict.has("A")) {
  2072. const actionDict = dict.get("A");
  2073. const parents = new _primitives.RefSet();
  2074. const list = [];
  2075. _collectJS(actionDict, xref, list, parents);
  2076. if (list.length > 0) {
  2077. actions.Action = list;
  2078. }
  2079. }
  2080. return (0, _util.objectSize)(actions) > 0 ? actions : null;
  2081. }
  2082. const XMLEntities = {
  2083. 0x3c: "&lt;",
  2084. 0x3e: "&gt;",
  2085. 0x26: "&amp;",
  2086. 0x22: "&quot;",
  2087. 0x27: "&apos;"
  2088. };
  2089. function encodeToXmlString(str) {
  2090. const buffer = [];
  2091. let start = 0;
  2092. for (let i = 0, ii = str.length; i < ii; i++) {
  2093. const char = str.codePointAt(i);
  2094. if (0x20 <= char && char <= 0x7e) {
  2095. const entity = XMLEntities[char];
  2096. if (entity) {
  2097. if (start < i) {
  2098. buffer.push(str.substring(start, i));
  2099. }
  2100. buffer.push(entity);
  2101. start = i + 1;
  2102. }
  2103. } else {
  2104. if (start < i) {
  2105. buffer.push(str.substring(start, i));
  2106. }
  2107. buffer.push(`&#x${char.toString(16).toUpperCase()};`);
  2108. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  2109. i++;
  2110. }
  2111. start = i + 1;
  2112. }
  2113. }
  2114. if (buffer.length === 0) {
  2115. return str;
  2116. }
  2117. if (start < str.length) {
  2118. buffer.push(str.substring(start, str.length));
  2119. }
  2120. return buffer.join("");
  2121. }
  2122. function validateCSSFont(cssFontInfo) {
  2123. const DEFAULT_CSS_FONT_OBLIQUE = "14";
  2124. const DEFAULT_CSS_FONT_WEIGHT = "400";
  2125. const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]);
  2126. const {
  2127. fontFamily,
  2128. fontWeight,
  2129. italicAngle
  2130. } = cssFontInfo;
  2131. if (/^".*"$/.test(fontFamily)) {
  2132. if (/[^\\]"/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2133. (0, _util.warn)(`XFA - FontFamily contains some unescaped ": ${fontFamily}.`);
  2134. return false;
  2135. }
  2136. } else if (/^'.*'$/.test(fontFamily)) {
  2137. if (/[^\\]'/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2138. (0, _util.warn)(`XFA - FontFamily contains some unescaped ': ${fontFamily}.`);
  2139. return false;
  2140. }
  2141. } else {
  2142. for (const ident of fontFamily.split(/[ \t]+/)) {
  2143. if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) {
  2144. (0, _util.warn)(`XFA - FontFamily contains some invalid <custom-ident>: ${fontFamily}.`);
  2145. return false;
  2146. }
  2147. }
  2148. }
  2149. const weight = fontWeight ? fontWeight.toString() : "";
  2150. cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT;
  2151. const angle = parseFloat(italicAngle);
  2152. cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString();
  2153. return true;
  2154. }
  2155. function recoverJsURL(str) {
  2156. const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"];
  2157. const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
  2158. const jsUrl = regex.exec(str);
  2159. if (jsUrl && jsUrl[2]) {
  2160. const url = jsUrl[2];
  2161. let newWindow = false;
  2162. if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
  2163. newWindow = true;
  2164. }
  2165. return {
  2166. url,
  2167. newWindow
  2168. };
  2169. }
  2170. return null;
  2171. }
  2172. function numberToString(value) {
  2173. if (Number.isInteger(value)) {
  2174. return value.toString();
  2175. }
  2176. const roundedValue = Math.round(value * 100);
  2177. if (roundedValue % 100 === 0) {
  2178. return (roundedValue / 100).toString();
  2179. }
  2180. if (roundedValue % 10 === 0) {
  2181. return value.toFixed(1);
  2182. }
  2183. return value.toFixed(2);
  2184. }
  2185. function getNewAnnotationsMap(annotationStorage) {
  2186. if (!annotationStorage) {
  2187. return null;
  2188. }
  2189. const newAnnotationsByPage = new Map();
  2190. for (const [key, value] of annotationStorage) {
  2191. if (!key.startsWith(_util.AnnotationEditorPrefix)) {
  2192. continue;
  2193. }
  2194. let annotations = newAnnotationsByPage.get(value.pageIndex);
  2195. if (!annotations) {
  2196. annotations = [];
  2197. newAnnotationsByPage.set(value.pageIndex, annotations);
  2198. }
  2199. annotations.push(value);
  2200. }
  2201. return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null;
  2202. }
  2203. function isAscii(str) {
  2204. return /^[\x00-\x7F]*$/.test(str);
  2205. }
  2206. function stringToUTF16HexString(str) {
  2207. const buf = [];
  2208. for (let i = 0, ii = str.length; i < ii; i++) {
  2209. const char = str.charCodeAt(i);
  2210. buf.push((char >> 8 & 0xff).toString(16).padStart(2, "0"), (char & 0xff).toString(16).padStart(2, "0"));
  2211. }
  2212. return buf.join("");
  2213. }
  2214. function stringToUTF16String(str, bigEndian = false) {
  2215. const buf = [];
  2216. if (bigEndian) {
  2217. buf.push("\xFE\xFF");
  2218. }
  2219. for (let i = 0, ii = str.length; i < ii; i++) {
  2220. const char = str.charCodeAt(i);
  2221. buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
  2222. }
  2223. return buf.join("");
  2224. }
  2225. function getRotationMatrix(rotation, width, height) {
  2226. switch (rotation) {
  2227. case 90:
  2228. return [0, 1, -1, 0, width, 0];
  2229. case 180:
  2230. return [-1, 0, 0, -1, width, height];
  2231. case 270:
  2232. return [0, -1, 1, 0, 0, height];
  2233. default:
  2234. throw new Error("Invalid rotation");
  2235. }
  2236. }
  2237. /***/ }),
  2238. /* 5 */
  2239. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2240. Object.defineProperty(exports, "__esModule", ({
  2241. value: true
  2242. }));
  2243. exports.BaseStream = void 0;
  2244. var _util = __w_pdfjs_require__(2);
  2245. class BaseStream {
  2246. constructor() {
  2247. if (this.constructor === BaseStream) {
  2248. (0, _util.unreachable)("Cannot initialize BaseStream.");
  2249. }
  2250. }
  2251. get length() {
  2252. (0, _util.unreachable)("Abstract getter `length` accessed");
  2253. }
  2254. get isEmpty() {
  2255. (0, _util.unreachable)("Abstract getter `isEmpty` accessed");
  2256. }
  2257. get isDataLoaded() {
  2258. return (0, _util.shadow)(this, "isDataLoaded", true);
  2259. }
  2260. getByte() {
  2261. (0, _util.unreachable)("Abstract method `getByte` called");
  2262. }
  2263. getBytes(length) {
  2264. (0, _util.unreachable)("Abstract method `getBytes` called");
  2265. }
  2266. peekByte() {
  2267. const peekedByte = this.getByte();
  2268. if (peekedByte !== -1) {
  2269. this.pos--;
  2270. }
  2271. return peekedByte;
  2272. }
  2273. peekBytes(length) {
  2274. const bytes = this.getBytes(length);
  2275. this.pos -= bytes.length;
  2276. return bytes;
  2277. }
  2278. getUint16() {
  2279. const b0 = this.getByte();
  2280. const b1 = this.getByte();
  2281. if (b0 === -1 || b1 === -1) {
  2282. return -1;
  2283. }
  2284. return (b0 << 8) + b1;
  2285. }
  2286. getInt32() {
  2287. const b0 = this.getByte();
  2288. const b1 = this.getByte();
  2289. const b2 = this.getByte();
  2290. const b3 = this.getByte();
  2291. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  2292. }
  2293. getByteRange(begin, end) {
  2294. (0, _util.unreachable)("Abstract method `getByteRange` called");
  2295. }
  2296. getString(length) {
  2297. return (0, _util.bytesToString)(this.getBytes(length));
  2298. }
  2299. skip(n) {
  2300. this.pos += n || 1;
  2301. }
  2302. reset() {
  2303. (0, _util.unreachable)("Abstract method `reset` called");
  2304. }
  2305. moveStart() {
  2306. (0, _util.unreachable)("Abstract method `moveStart` called");
  2307. }
  2308. makeSubStream(start, length, dict = null) {
  2309. (0, _util.unreachable)("Abstract method `makeSubStream` called");
  2310. }
  2311. getBaseStreams() {
  2312. return null;
  2313. }
  2314. }
  2315. exports.BaseStream = BaseStream;
  2316. /***/ }),
  2317. /* 6 */
  2318. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2319. Object.defineProperty(exports, "__esModule", ({
  2320. value: true
  2321. }));
  2322. exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
  2323. var _util = __w_pdfjs_require__(2);
  2324. var _chunked_stream = __w_pdfjs_require__(7);
  2325. var _core_utils = __w_pdfjs_require__(4);
  2326. var _document = __w_pdfjs_require__(9);
  2327. var _stream = __w_pdfjs_require__(8);
  2328. function parseDocBaseUrl(url) {
  2329. if (url) {
  2330. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url);
  2331. if (absoluteUrl) {
  2332. return absoluteUrl.href;
  2333. }
  2334. (0, _util.warn)(`Invalid absolute docBaseUrl: "${url}".`);
  2335. }
  2336. return null;
  2337. }
  2338. class BasePdfManager {
  2339. constructor() {
  2340. if (this.constructor === BasePdfManager) {
  2341. (0, _util.unreachable)("Cannot initialize BasePdfManager.");
  2342. }
  2343. }
  2344. get docId() {
  2345. return this._docId;
  2346. }
  2347. get password() {
  2348. return this._password;
  2349. }
  2350. get docBaseUrl() {
  2351. const catalog = this.pdfDocument.catalog;
  2352. return (0, _util.shadow)(this, "docBaseUrl", catalog.baseUrl || this._docBaseUrl);
  2353. }
  2354. ensureDoc(prop, args) {
  2355. return this.ensure(this.pdfDocument, prop, args);
  2356. }
  2357. ensureXRef(prop, args) {
  2358. return this.ensure(this.pdfDocument.xref, prop, args);
  2359. }
  2360. ensureCatalog(prop, args) {
  2361. return this.ensure(this.pdfDocument.catalog, prop, args);
  2362. }
  2363. getPage(pageIndex) {
  2364. return this.pdfDocument.getPage(pageIndex);
  2365. }
  2366. fontFallback(id, handler) {
  2367. return this.pdfDocument.fontFallback(id, handler);
  2368. }
  2369. loadXfaFonts(handler, task) {
  2370. return this.pdfDocument.loadXfaFonts(handler, task);
  2371. }
  2372. loadXfaImages() {
  2373. return this.pdfDocument.loadXfaImages();
  2374. }
  2375. serializeXfaData(annotationStorage) {
  2376. return this.pdfDocument.serializeXfaData(annotationStorage);
  2377. }
  2378. cleanup(manuallyTriggered = false) {
  2379. return this.pdfDocument.cleanup(manuallyTriggered);
  2380. }
  2381. async ensure(obj, prop, args) {
  2382. (0, _util.unreachable)("Abstract method `ensure` called");
  2383. }
  2384. requestRange(begin, end) {
  2385. (0, _util.unreachable)("Abstract method `requestRange` called");
  2386. }
  2387. requestLoadedStream(noFetch = false) {
  2388. (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
  2389. }
  2390. sendProgressiveData(chunk) {
  2391. (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
  2392. }
  2393. updatePassword(password) {
  2394. this._password = password;
  2395. }
  2396. terminate(reason) {
  2397. (0, _util.unreachable)("Abstract method `terminate` called");
  2398. }
  2399. }
  2400. class LocalPdfManager extends BasePdfManager {
  2401. constructor(docId, data, password, msgHandler, evaluatorOptions, enableXfa, docBaseUrl) {
  2402. super();
  2403. this._docId = docId;
  2404. this._password = password;
  2405. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  2406. this.msgHandler = msgHandler;
  2407. this.evaluatorOptions = evaluatorOptions;
  2408. this.enableXfa = enableXfa;
  2409. const stream = new _stream.Stream(data);
  2410. this.pdfDocument = new _document.PDFDocument(this, stream);
  2411. this._loadedStreamPromise = Promise.resolve(stream);
  2412. }
  2413. async ensure(obj, prop, args) {
  2414. const value = obj[prop];
  2415. if (typeof value === "function") {
  2416. return value.apply(obj, args);
  2417. }
  2418. return value;
  2419. }
  2420. requestRange(begin, end) {
  2421. return Promise.resolve();
  2422. }
  2423. requestLoadedStream(noFetch = false) {
  2424. return this._loadedStreamPromise;
  2425. }
  2426. terminate(reason) {}
  2427. }
  2428. exports.LocalPdfManager = LocalPdfManager;
  2429. class NetworkPdfManager extends BasePdfManager {
  2430. constructor(docId, pdfNetworkStream, args, evaluatorOptions, enableXfa, docBaseUrl) {
  2431. super();
  2432. this._docId = docId;
  2433. this._password = args.password;
  2434. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  2435. this.msgHandler = args.msgHandler;
  2436. this.evaluatorOptions = evaluatorOptions;
  2437. this.enableXfa = enableXfa;
  2438. this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
  2439. msgHandler: args.msgHandler,
  2440. length: args.length,
  2441. disableAutoFetch: args.disableAutoFetch,
  2442. rangeChunkSize: args.rangeChunkSize
  2443. });
  2444. this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
  2445. }
  2446. async ensure(obj, prop, args) {
  2447. try {
  2448. const value = obj[prop];
  2449. if (typeof value === "function") {
  2450. return value.apply(obj, args);
  2451. }
  2452. return value;
  2453. } catch (ex) {
  2454. if (!(ex instanceof _core_utils.MissingDataException)) {
  2455. throw ex;
  2456. }
  2457. await this.requestRange(ex.begin, ex.end);
  2458. return this.ensure(obj, prop, args);
  2459. }
  2460. }
  2461. requestRange(begin, end) {
  2462. return this.streamManager.requestRange(begin, end);
  2463. }
  2464. requestLoadedStream(noFetch = false) {
  2465. return this.streamManager.requestAllChunks(noFetch);
  2466. }
  2467. sendProgressiveData(chunk) {
  2468. this.streamManager.onReceiveData({
  2469. chunk
  2470. });
  2471. }
  2472. terminate(reason) {
  2473. this.streamManager.abort(reason);
  2474. }
  2475. }
  2476. exports.NetworkPdfManager = NetworkPdfManager;
  2477. /***/ }),
  2478. /* 7 */
  2479. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2480. Object.defineProperty(exports, "__esModule", ({
  2481. value: true
  2482. }));
  2483. exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
  2484. var _util = __w_pdfjs_require__(2);
  2485. var _core_utils = __w_pdfjs_require__(4);
  2486. var _stream = __w_pdfjs_require__(8);
  2487. class ChunkedStream extends _stream.Stream {
  2488. constructor(length, chunkSize, manager) {
  2489. super(new Uint8Array(length), 0, length, null);
  2490. this.chunkSize = chunkSize;
  2491. this._loadedChunks = new Set();
  2492. this.numChunks = Math.ceil(length / chunkSize);
  2493. this.manager = manager;
  2494. this.progressiveDataLength = 0;
  2495. this.lastSuccessfulEnsureByteChunk = -1;
  2496. }
  2497. getMissingChunks() {
  2498. const chunks = [];
  2499. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  2500. if (!this._loadedChunks.has(chunk)) {
  2501. chunks.push(chunk);
  2502. }
  2503. }
  2504. return chunks;
  2505. }
  2506. get numChunksLoaded() {
  2507. return this._loadedChunks.size;
  2508. }
  2509. get isDataLoaded() {
  2510. return this.numChunksLoaded === this.numChunks;
  2511. }
  2512. onReceiveData(begin, chunk) {
  2513. const chunkSize = this.chunkSize;
  2514. if (begin % chunkSize !== 0) {
  2515. throw new Error(`Bad begin offset: ${begin}`);
  2516. }
  2517. const end = begin + chunk.byteLength;
  2518. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  2519. throw new Error(`Bad end offset: ${end}`);
  2520. }
  2521. this.bytes.set(new Uint8Array(chunk), begin);
  2522. const beginChunk = Math.floor(begin / chunkSize);
  2523. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  2524. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2525. this._loadedChunks.add(curChunk);
  2526. }
  2527. }
  2528. onReceiveProgressiveData(data) {
  2529. let position = this.progressiveDataLength;
  2530. const beginChunk = Math.floor(position / this.chunkSize);
  2531. this.bytes.set(new Uint8Array(data), position);
  2532. position += data.byteLength;
  2533. this.progressiveDataLength = position;
  2534. const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  2535. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2536. this._loadedChunks.add(curChunk);
  2537. }
  2538. }
  2539. ensureByte(pos) {
  2540. if (pos < this.progressiveDataLength) {
  2541. return;
  2542. }
  2543. const chunk = Math.floor(pos / this.chunkSize);
  2544. if (chunk > this.numChunks) {
  2545. return;
  2546. }
  2547. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  2548. return;
  2549. }
  2550. if (!this._loadedChunks.has(chunk)) {
  2551. throw new _core_utils.MissingDataException(pos, pos + 1);
  2552. }
  2553. this.lastSuccessfulEnsureByteChunk = chunk;
  2554. }
  2555. ensureRange(begin, end) {
  2556. if (begin >= end) {
  2557. return;
  2558. }
  2559. if (end <= this.progressiveDataLength) {
  2560. return;
  2561. }
  2562. const beginChunk = Math.floor(begin / this.chunkSize);
  2563. if (beginChunk > this.numChunks) {
  2564. return;
  2565. }
  2566. const endChunk = Math.min(Math.floor((end - 1) / this.chunkSize) + 1, this.numChunks);
  2567. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2568. if (!this._loadedChunks.has(chunk)) {
  2569. throw new _core_utils.MissingDataException(begin, end);
  2570. }
  2571. }
  2572. }
  2573. nextEmptyChunk(beginChunk) {
  2574. const numChunks = this.numChunks;
  2575. for (let i = 0; i < numChunks; ++i) {
  2576. const chunk = (beginChunk + i) % numChunks;
  2577. if (!this._loadedChunks.has(chunk)) {
  2578. return chunk;
  2579. }
  2580. }
  2581. return null;
  2582. }
  2583. hasChunk(chunk) {
  2584. return this._loadedChunks.has(chunk);
  2585. }
  2586. getByte() {
  2587. const pos = this.pos;
  2588. if (pos >= this.end) {
  2589. return -1;
  2590. }
  2591. if (pos >= this.progressiveDataLength) {
  2592. this.ensureByte(pos);
  2593. }
  2594. return this.bytes[this.pos++];
  2595. }
  2596. getBytes(length) {
  2597. const bytes = this.bytes;
  2598. const pos = this.pos;
  2599. const strEnd = this.end;
  2600. if (!length) {
  2601. if (strEnd > this.progressiveDataLength) {
  2602. this.ensureRange(pos, strEnd);
  2603. }
  2604. return bytes.subarray(pos, strEnd);
  2605. }
  2606. let end = pos + length;
  2607. if (end > strEnd) {
  2608. end = strEnd;
  2609. }
  2610. if (end > this.progressiveDataLength) {
  2611. this.ensureRange(pos, end);
  2612. }
  2613. this.pos = end;
  2614. return bytes.subarray(pos, end);
  2615. }
  2616. getByteRange(begin, end) {
  2617. if (begin < 0) {
  2618. begin = 0;
  2619. }
  2620. if (end > this.end) {
  2621. end = this.end;
  2622. }
  2623. if (end > this.progressiveDataLength) {
  2624. this.ensureRange(begin, end);
  2625. }
  2626. return this.bytes.subarray(begin, end);
  2627. }
  2628. makeSubStream(start, length, dict = null) {
  2629. if (length) {
  2630. if (start + length > this.progressiveDataLength) {
  2631. this.ensureRange(start, start + length);
  2632. }
  2633. } else {
  2634. if (start >= this.progressiveDataLength) {
  2635. this.ensureByte(start);
  2636. }
  2637. }
  2638. function ChunkedStreamSubstream() {}
  2639. ChunkedStreamSubstream.prototype = Object.create(this);
  2640. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  2641. const chunkSize = this.chunkSize;
  2642. const beginChunk = Math.floor(this.start / chunkSize);
  2643. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  2644. const missingChunks = [];
  2645. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2646. if (!this._loadedChunks.has(chunk)) {
  2647. missingChunks.push(chunk);
  2648. }
  2649. }
  2650. return missingChunks;
  2651. };
  2652. Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", {
  2653. get() {
  2654. if (this.numChunksLoaded === this.numChunks) {
  2655. return true;
  2656. }
  2657. return this.getMissingChunks().length === 0;
  2658. },
  2659. configurable: true
  2660. });
  2661. const subStream = new ChunkedStreamSubstream();
  2662. subStream.pos = subStream.start = start;
  2663. subStream.end = start + length || this.end;
  2664. subStream.dict = dict;
  2665. return subStream;
  2666. }
  2667. getBaseStreams() {
  2668. return [this];
  2669. }
  2670. }
  2671. exports.ChunkedStream = ChunkedStream;
  2672. class ChunkedStreamManager {
  2673. constructor(pdfNetworkStream, args) {
  2674. this.length = args.length;
  2675. this.chunkSize = args.rangeChunkSize;
  2676. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  2677. this.pdfNetworkStream = pdfNetworkStream;
  2678. this.disableAutoFetch = args.disableAutoFetch;
  2679. this.msgHandler = args.msgHandler;
  2680. this.currRequestId = 0;
  2681. this._chunksNeededByRequest = new Map();
  2682. this._requestsByChunk = new Map();
  2683. this._promisesByRequest = new Map();
  2684. this.progressiveDataLength = 0;
  2685. this.aborted = false;
  2686. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  2687. }
  2688. sendRequest(begin, end) {
  2689. const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  2690. if (!rangeReader.isStreamingSupported) {
  2691. rangeReader.onProgress = this.onProgress.bind(this);
  2692. }
  2693. let chunks = [],
  2694. loaded = 0;
  2695. return new Promise((resolve, reject) => {
  2696. const readChunk = chunk => {
  2697. try {
  2698. if (!chunk.done) {
  2699. const data = chunk.value;
  2700. chunks.push(data);
  2701. loaded += (0, _util.arrayByteLength)(data);
  2702. if (rangeReader.isStreamingSupported) {
  2703. this.onProgress({
  2704. loaded
  2705. });
  2706. }
  2707. rangeReader.read().then(readChunk, reject);
  2708. return;
  2709. }
  2710. const chunkData = (0, _util.arraysToBytes)(chunks);
  2711. chunks = null;
  2712. resolve(chunkData);
  2713. } catch (e) {
  2714. reject(e);
  2715. }
  2716. };
  2717. rangeReader.read().then(readChunk, reject);
  2718. }).then(data => {
  2719. if (this.aborted) {
  2720. return;
  2721. }
  2722. this.onReceiveData({
  2723. chunk: data,
  2724. begin
  2725. });
  2726. });
  2727. }
  2728. requestAllChunks(noFetch = false) {
  2729. if (!noFetch) {
  2730. const missingChunks = this.stream.getMissingChunks();
  2731. this._requestChunks(missingChunks);
  2732. }
  2733. return this._loadedStreamCapability.promise;
  2734. }
  2735. _requestChunks(chunks) {
  2736. const requestId = this.currRequestId++;
  2737. const chunksNeeded = new Set();
  2738. this._chunksNeededByRequest.set(requestId, chunksNeeded);
  2739. for (const chunk of chunks) {
  2740. if (!this.stream.hasChunk(chunk)) {
  2741. chunksNeeded.add(chunk);
  2742. }
  2743. }
  2744. if (chunksNeeded.size === 0) {
  2745. return Promise.resolve();
  2746. }
  2747. const capability = (0, _util.createPromiseCapability)();
  2748. this._promisesByRequest.set(requestId, capability);
  2749. const chunksToRequest = [];
  2750. for (const chunk of chunksNeeded) {
  2751. let requestIds = this._requestsByChunk.get(chunk);
  2752. if (!requestIds) {
  2753. requestIds = [];
  2754. this._requestsByChunk.set(chunk, requestIds);
  2755. chunksToRequest.push(chunk);
  2756. }
  2757. requestIds.push(requestId);
  2758. }
  2759. if (chunksToRequest.length > 0) {
  2760. const groupedChunksToRequest = this.groupChunks(chunksToRequest);
  2761. for (const groupedChunk of groupedChunksToRequest) {
  2762. const begin = groupedChunk.beginChunk * this.chunkSize;
  2763. const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  2764. this.sendRequest(begin, end).catch(capability.reject);
  2765. }
  2766. }
  2767. return capability.promise.catch(reason => {
  2768. if (this.aborted) {
  2769. return;
  2770. }
  2771. throw reason;
  2772. });
  2773. }
  2774. getStream() {
  2775. return this.stream;
  2776. }
  2777. requestRange(begin, end) {
  2778. end = Math.min(end, this.length);
  2779. const beginChunk = this.getBeginChunk(begin);
  2780. const endChunk = this.getEndChunk(end);
  2781. const chunks = [];
  2782. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2783. chunks.push(chunk);
  2784. }
  2785. return this._requestChunks(chunks);
  2786. }
  2787. requestRanges(ranges = []) {
  2788. const chunksToRequest = [];
  2789. for (const range of ranges) {
  2790. const beginChunk = this.getBeginChunk(range.begin);
  2791. const endChunk = this.getEndChunk(range.end);
  2792. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2793. if (!chunksToRequest.includes(chunk)) {
  2794. chunksToRequest.push(chunk);
  2795. }
  2796. }
  2797. }
  2798. chunksToRequest.sort(function (a, b) {
  2799. return a - b;
  2800. });
  2801. return this._requestChunks(chunksToRequest);
  2802. }
  2803. groupChunks(chunks) {
  2804. const groupedChunks = [];
  2805. let beginChunk = -1;
  2806. let prevChunk = -1;
  2807. for (let i = 0, ii = chunks.length; i < ii; ++i) {
  2808. const chunk = chunks[i];
  2809. if (beginChunk < 0) {
  2810. beginChunk = chunk;
  2811. }
  2812. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  2813. groupedChunks.push({
  2814. beginChunk,
  2815. endChunk: prevChunk + 1
  2816. });
  2817. beginChunk = chunk;
  2818. }
  2819. if (i + 1 === chunks.length) {
  2820. groupedChunks.push({
  2821. beginChunk,
  2822. endChunk: chunk + 1
  2823. });
  2824. }
  2825. prevChunk = chunk;
  2826. }
  2827. return groupedChunks;
  2828. }
  2829. onProgress(args) {
  2830. this.msgHandler.send("DocProgress", {
  2831. loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
  2832. total: this.length
  2833. });
  2834. }
  2835. onReceiveData(args) {
  2836. const chunk = args.chunk;
  2837. const isProgressive = args.begin === undefined;
  2838. const begin = isProgressive ? this.progressiveDataLength : args.begin;
  2839. const end = begin + chunk.byteLength;
  2840. const beginChunk = Math.floor(begin / this.chunkSize);
  2841. const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  2842. if (isProgressive) {
  2843. this.stream.onReceiveProgressiveData(chunk);
  2844. this.progressiveDataLength = end;
  2845. } else {
  2846. this.stream.onReceiveData(begin, chunk);
  2847. }
  2848. if (this.stream.isDataLoaded) {
  2849. this._loadedStreamCapability.resolve(this.stream);
  2850. }
  2851. const loadedRequests = [];
  2852. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2853. const requestIds = this._requestsByChunk.get(curChunk);
  2854. if (!requestIds) {
  2855. continue;
  2856. }
  2857. this._requestsByChunk.delete(curChunk);
  2858. for (const requestId of requestIds) {
  2859. const chunksNeeded = this._chunksNeededByRequest.get(requestId);
  2860. if (chunksNeeded.has(curChunk)) {
  2861. chunksNeeded.delete(curChunk);
  2862. }
  2863. if (chunksNeeded.size > 0) {
  2864. continue;
  2865. }
  2866. loadedRequests.push(requestId);
  2867. }
  2868. }
  2869. if (!this.disableAutoFetch && this._requestsByChunk.size === 0) {
  2870. let nextEmptyChunk;
  2871. if (this.stream.numChunksLoaded === 1) {
  2872. const lastChunk = this.stream.numChunks - 1;
  2873. if (!this.stream.hasChunk(lastChunk)) {
  2874. nextEmptyChunk = lastChunk;
  2875. }
  2876. } else {
  2877. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  2878. }
  2879. if (Number.isInteger(nextEmptyChunk)) {
  2880. this._requestChunks([nextEmptyChunk]);
  2881. }
  2882. }
  2883. for (const requestId of loadedRequests) {
  2884. const capability = this._promisesByRequest.get(requestId);
  2885. this._promisesByRequest.delete(requestId);
  2886. capability.resolve();
  2887. }
  2888. this.msgHandler.send("DocProgress", {
  2889. loaded: this.stream.numChunksLoaded * this.chunkSize,
  2890. total: this.length
  2891. });
  2892. }
  2893. onError(err) {
  2894. this._loadedStreamCapability.reject(err);
  2895. }
  2896. getBeginChunk(begin) {
  2897. return Math.floor(begin / this.chunkSize);
  2898. }
  2899. getEndChunk(end) {
  2900. return Math.floor((end - 1) / this.chunkSize) + 1;
  2901. }
  2902. abort(reason) {
  2903. this.aborted = true;
  2904. if (this.pdfNetworkStream) {
  2905. this.pdfNetworkStream.cancelAllRequests(reason);
  2906. }
  2907. for (const capability of this._promisesByRequest.values()) {
  2908. capability.reject(reason);
  2909. }
  2910. }
  2911. }
  2912. exports.ChunkedStreamManager = ChunkedStreamManager;
  2913. /***/ }),
  2914. /* 8 */
  2915. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2916. Object.defineProperty(exports, "__esModule", ({
  2917. value: true
  2918. }));
  2919. exports.StringStream = exports.Stream = exports.NullStream = void 0;
  2920. var _base_stream = __w_pdfjs_require__(5);
  2921. var _util = __w_pdfjs_require__(2);
  2922. class Stream extends _base_stream.BaseStream {
  2923. constructor(arrayBuffer, start, length, dict) {
  2924. super();
  2925. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  2926. this.start = start || 0;
  2927. this.pos = this.start;
  2928. this.end = start + length || this.bytes.length;
  2929. this.dict = dict;
  2930. }
  2931. get length() {
  2932. return this.end - this.start;
  2933. }
  2934. get isEmpty() {
  2935. return this.length === 0;
  2936. }
  2937. getByte() {
  2938. if (this.pos >= this.end) {
  2939. return -1;
  2940. }
  2941. return this.bytes[this.pos++];
  2942. }
  2943. getBytes(length) {
  2944. const bytes = this.bytes;
  2945. const pos = this.pos;
  2946. const strEnd = this.end;
  2947. if (!length) {
  2948. return bytes.subarray(pos, strEnd);
  2949. }
  2950. let end = pos + length;
  2951. if (end > strEnd) {
  2952. end = strEnd;
  2953. }
  2954. this.pos = end;
  2955. return bytes.subarray(pos, end);
  2956. }
  2957. getByteRange(begin, end) {
  2958. if (begin < 0) {
  2959. begin = 0;
  2960. }
  2961. if (end > this.end) {
  2962. end = this.end;
  2963. }
  2964. return this.bytes.subarray(begin, end);
  2965. }
  2966. reset() {
  2967. this.pos = this.start;
  2968. }
  2969. moveStart() {
  2970. this.start = this.pos;
  2971. }
  2972. makeSubStream(start, length, dict = null) {
  2973. return new Stream(this.bytes.buffer, start, length, dict);
  2974. }
  2975. }
  2976. exports.Stream = Stream;
  2977. class StringStream extends Stream {
  2978. constructor(str) {
  2979. super((0, _util.stringToBytes)(str));
  2980. }
  2981. }
  2982. exports.StringStream = StringStream;
  2983. class NullStream extends Stream {
  2984. constructor() {
  2985. super(new Uint8Array(0));
  2986. }
  2987. }
  2988. exports.NullStream = NullStream;
  2989. /***/ }),
  2990. /* 9 */
  2991. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2992. Object.defineProperty(exports, "__esModule", ({
  2993. value: true
  2994. }));
  2995. exports.Page = exports.PDFDocument = void 0;
  2996. var _annotation = __w_pdfjs_require__(10);
  2997. var _util = __w_pdfjs_require__(2);
  2998. var _core_utils = __w_pdfjs_require__(4);
  2999. var _primitives = __w_pdfjs_require__(3);
  3000. var _xfa_fonts = __w_pdfjs_require__(49);
  3001. var _base_stream = __w_pdfjs_require__(5);
  3002. var _crypto = __w_pdfjs_require__(65);
  3003. var _catalog = __w_pdfjs_require__(67);
  3004. var _cleanup_helper = __w_pdfjs_require__(69);
  3005. var _dataset_reader = __w_pdfjs_require__(98);
  3006. var _parser = __w_pdfjs_require__(15);
  3007. var _stream = __w_pdfjs_require__(8);
  3008. var _object_loader = __w_pdfjs_require__(73);
  3009. var _operator_list = __w_pdfjs_require__(60);
  3010. var _evaluator = __w_pdfjs_require__(13);
  3011. var _decode_stream = __w_pdfjs_require__(17);
  3012. var _struct_tree = __w_pdfjs_require__(72);
  3013. var _writer = __w_pdfjs_require__(63);
  3014. var _factory = __w_pdfjs_require__(74);
  3015. var _xref = __w_pdfjs_require__(99);
  3016. const DEFAULT_USER_UNIT = 1.0;
  3017. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  3018. class Page {
  3019. constructor({
  3020. pdfManager,
  3021. xref,
  3022. pageIndex,
  3023. pageDict,
  3024. ref,
  3025. globalIdFactory,
  3026. fontCache,
  3027. builtInCMapCache,
  3028. standardFontDataCache,
  3029. globalImageCache,
  3030. nonBlendModesSet,
  3031. xfaFactory
  3032. }) {
  3033. this.pdfManager = pdfManager;
  3034. this.pageIndex = pageIndex;
  3035. this.pageDict = pageDict;
  3036. this.xref = xref;
  3037. this.ref = ref;
  3038. this.fontCache = fontCache;
  3039. this.builtInCMapCache = builtInCMapCache;
  3040. this.standardFontDataCache = standardFontDataCache;
  3041. this.globalImageCache = globalImageCache;
  3042. this.nonBlendModesSet = nonBlendModesSet;
  3043. this.evaluatorOptions = pdfManager.evaluatorOptions;
  3044. this.resourcesPromise = null;
  3045. this.xfaFactory = xfaFactory;
  3046. const idCounters = {
  3047. obj: 0
  3048. };
  3049. this._localIdFactory = class extends globalIdFactory {
  3050. static createObjId() {
  3051. return `p${pageIndex}_${++idCounters.obj}`;
  3052. }
  3053. static getPageObjId() {
  3054. return `page${ref.toString()}`;
  3055. }
  3056. };
  3057. }
  3058. _getInheritableProperty(key, getArray = false) {
  3059. const value = (0, _core_utils.getInheritableProperty)({
  3060. dict: this.pageDict,
  3061. key,
  3062. getArray,
  3063. stopWhenFound: false
  3064. });
  3065. if (!Array.isArray(value)) {
  3066. return value;
  3067. }
  3068. if (value.length === 1 || !(value[0] instanceof _primitives.Dict)) {
  3069. return value[0];
  3070. }
  3071. return _primitives.Dict.merge({
  3072. xref: this.xref,
  3073. dictArray: value
  3074. });
  3075. }
  3076. get content() {
  3077. return this.pageDict.getArray("Contents");
  3078. }
  3079. get resources() {
  3080. const resources = this._getInheritableProperty("Resources");
  3081. return (0, _util.shadow)(this, "resources", resources instanceof _primitives.Dict ? resources : _primitives.Dict.empty);
  3082. }
  3083. _getBoundingBox(name) {
  3084. if (this.xfaData) {
  3085. return this.xfaData.bbox;
  3086. }
  3087. let box = this._getInheritableProperty(name, true);
  3088. if (Array.isArray(box) && box.length === 4) {
  3089. box = _util.Util.normalizeRect(box);
  3090. if (box[2] - box[0] > 0 && box[3] - box[1] > 0) {
  3091. return box;
  3092. }
  3093. (0, _util.warn)(`Empty, or invalid, /${name} entry.`);
  3094. }
  3095. return null;
  3096. }
  3097. get mediaBox() {
  3098. return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
  3099. }
  3100. get cropBox() {
  3101. return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
  3102. }
  3103. get userUnit() {
  3104. let obj = this.pageDict.get("UserUnit");
  3105. if (typeof obj !== "number" || obj <= 0) {
  3106. obj = DEFAULT_USER_UNIT;
  3107. }
  3108. return (0, _util.shadow)(this, "userUnit", obj);
  3109. }
  3110. get view() {
  3111. const {
  3112. cropBox,
  3113. mediaBox
  3114. } = this;
  3115. if (cropBox !== mediaBox && !(0, _util.isArrayEqual)(cropBox, mediaBox)) {
  3116. const box = _util.Util.intersect(cropBox, mediaBox);
  3117. if (box && box[2] - box[0] > 0 && box[3] - box[1] > 0) {
  3118. return (0, _util.shadow)(this, "view", box);
  3119. }
  3120. (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
  3121. }
  3122. return (0, _util.shadow)(this, "view", mediaBox);
  3123. }
  3124. get rotate() {
  3125. let rotate = this._getInheritableProperty("Rotate") || 0;
  3126. if (rotate % 90 !== 0) {
  3127. rotate = 0;
  3128. } else if (rotate >= 360) {
  3129. rotate %= 360;
  3130. } else if (rotate < 0) {
  3131. rotate = (rotate % 360 + 360) % 360;
  3132. }
  3133. return (0, _util.shadow)(this, "rotate", rotate);
  3134. }
  3135. _onSubStreamError(handler, reason, objId) {
  3136. if (this.evaluatorOptions.ignoreErrors) {
  3137. handler.send("UnsupportedFeature", {
  3138. featureId: _util.UNSUPPORTED_FEATURES.errorContentSubStream
  3139. });
  3140. (0, _util.warn)(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`);
  3141. return;
  3142. }
  3143. throw reason;
  3144. }
  3145. getContentStream(handler) {
  3146. return this.pdfManager.ensure(this, "content").then(content => {
  3147. if (content instanceof _base_stream.BaseStream) {
  3148. return content;
  3149. }
  3150. if (Array.isArray(content)) {
  3151. return new _decode_stream.StreamsSequenceStream(content, this._onSubStreamError.bind(this, handler));
  3152. }
  3153. return new _stream.NullStream();
  3154. });
  3155. }
  3156. get xfaData() {
  3157. return (0, _util.shadow)(this, "xfaData", this.xfaFactory ? {
  3158. bbox: this.xfaFactory.getBoundingBox(this.pageIndex)
  3159. } : null);
  3160. }
  3161. async saveNewAnnotations(handler, task, annotations) {
  3162. if (this.xfaFactory) {
  3163. throw new Error("XFA: Cannot save new annotations.");
  3164. }
  3165. const partialEvaluator = new _evaluator.PartialEvaluator({
  3166. xref: this.xref,
  3167. handler,
  3168. pageIndex: this.pageIndex,
  3169. idFactory: this._localIdFactory,
  3170. fontCache: this.fontCache,
  3171. builtInCMapCache: this.builtInCMapCache,
  3172. standardFontDataCache: this.standardFontDataCache,
  3173. globalImageCache: this.globalImageCache,
  3174. options: this.evaluatorOptions
  3175. });
  3176. const pageDict = this.pageDict;
  3177. const annotationsArray = this.annotations.slice();
  3178. const newData = await _annotation.AnnotationFactory.saveNewAnnotations(partialEvaluator, task, annotations);
  3179. for (const {
  3180. ref
  3181. } of newData.annotations) {
  3182. annotationsArray.push(ref);
  3183. }
  3184. const savedDict = pageDict.get("Annots");
  3185. pageDict.set("Annots", annotationsArray);
  3186. const buffer = [];
  3187. let transform = null;
  3188. if (this.xref.encrypt) {
  3189. transform = this.xref.encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  3190. }
  3191. (0, _writer.writeObject)(this.ref, pageDict, buffer, transform);
  3192. if (savedDict) {
  3193. pageDict.set("Annots", savedDict);
  3194. }
  3195. const objects = newData.dependencies;
  3196. objects.push({
  3197. ref: this.ref,
  3198. data: buffer.join("")
  3199. }, ...newData.annotations);
  3200. return objects;
  3201. }
  3202. save(handler, task, annotationStorage) {
  3203. const partialEvaluator = new _evaluator.PartialEvaluator({
  3204. xref: this.xref,
  3205. handler,
  3206. pageIndex: this.pageIndex,
  3207. idFactory: this._localIdFactory,
  3208. fontCache: this.fontCache,
  3209. builtInCMapCache: this.builtInCMapCache,
  3210. standardFontDataCache: this.standardFontDataCache,
  3211. globalImageCache: this.globalImageCache,
  3212. options: this.evaluatorOptions
  3213. });
  3214. return this._parsedAnnotations.then(function (annotations) {
  3215. const newRefsPromises = [];
  3216. for (const annotation of annotations) {
  3217. if (!annotation.mustBePrinted(annotationStorage)) {
  3218. continue;
  3219. }
  3220. newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) {
  3221. (0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3222. return null;
  3223. }));
  3224. }
  3225. return Promise.all(newRefsPromises).then(function (newRefs) {
  3226. return newRefs.filter(newRef => !!newRef);
  3227. });
  3228. });
  3229. }
  3230. loadResources(keys) {
  3231. if (!this.resourcesPromise) {
  3232. this.resourcesPromise = this.pdfManager.ensure(this, "resources");
  3233. }
  3234. return this.resourcesPromise.then(() => {
  3235. const objectLoader = new _object_loader.ObjectLoader(this.resources, keys, this.xref);
  3236. return objectLoader.load();
  3237. });
  3238. }
  3239. getOperatorList({
  3240. handler,
  3241. sink,
  3242. task,
  3243. intent,
  3244. cacheKey,
  3245. annotationStorage = null
  3246. }) {
  3247. const contentStreamPromise = this.getContentStream(handler);
  3248. const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]);
  3249. const partialEvaluator = new _evaluator.PartialEvaluator({
  3250. xref: this.xref,
  3251. handler,
  3252. pageIndex: this.pageIndex,
  3253. idFactory: this._localIdFactory,
  3254. fontCache: this.fontCache,
  3255. builtInCMapCache: this.builtInCMapCache,
  3256. standardFontDataCache: this.standardFontDataCache,
  3257. globalImageCache: this.globalImageCache,
  3258. options: this.evaluatorOptions
  3259. });
  3260. const newAnnotationsByPage = !this.xfaFactory ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null;
  3261. let newAnnotationsPromise = Promise.resolve(null);
  3262. if (newAnnotationsByPage) {
  3263. const newAnnotations = newAnnotationsByPage.get(this.pageIndex);
  3264. if (newAnnotations) {
  3265. newAnnotationsPromise = _annotation.AnnotationFactory.printNewAnnotations(partialEvaluator, task, newAnnotations);
  3266. }
  3267. }
  3268. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  3269. const pageListPromise = dataPromises.then(([contentStream]) => {
  3270. const opList = new _operator_list.OperatorList(intent, sink);
  3271. handler.send("StartRenderPage", {
  3272. transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
  3273. pageIndex: this.pageIndex,
  3274. cacheKey
  3275. });
  3276. return partialEvaluator.getOperatorList({
  3277. stream: contentStream,
  3278. task,
  3279. resources: this.resources,
  3280. operatorList: opList
  3281. }).then(function () {
  3282. return opList;
  3283. });
  3284. });
  3285. return Promise.all([pageListPromise, this._parsedAnnotations, newAnnotationsPromise]).then(function ([pageOpList, annotations, newAnnotations]) {
  3286. if (newAnnotations) {
  3287. annotations = annotations.concat(newAnnotations);
  3288. }
  3289. if (annotations.length === 0 || intent & _util.RenderingIntentFlag.ANNOTATIONS_DISABLE) {
  3290. pageOpList.flush(true);
  3291. return {
  3292. length: pageOpList.totalLength
  3293. };
  3294. }
  3295. const renderForms = !!(intent & _util.RenderingIntentFlag.ANNOTATIONS_FORMS),
  3296. intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  3297. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  3298. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  3299. const opListPromises = [];
  3300. for (const annotation of annotations) {
  3301. if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage) || intentPrint && annotation.mustBePrinted(annotationStorage)) {
  3302. opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, renderForms, annotationStorage).catch(function (reason) {
  3303. (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3304. return {
  3305. opList: null,
  3306. separateForm: false,
  3307. separateCanvas: false
  3308. };
  3309. }));
  3310. }
  3311. }
  3312. return Promise.all(opListPromises).then(function (opLists) {
  3313. let form = false,
  3314. canvas = false;
  3315. for (const {
  3316. opList,
  3317. separateForm,
  3318. separateCanvas
  3319. } of opLists) {
  3320. pageOpList.addOpList(opList);
  3321. if (separateForm) {
  3322. form = separateForm;
  3323. }
  3324. if (separateCanvas) {
  3325. canvas = separateCanvas;
  3326. }
  3327. }
  3328. pageOpList.flush(true, {
  3329. form,
  3330. canvas
  3331. });
  3332. return {
  3333. length: pageOpList.totalLength
  3334. };
  3335. });
  3336. });
  3337. }
  3338. extractTextContent({
  3339. handler,
  3340. task,
  3341. includeMarkedContent,
  3342. sink,
  3343. combineTextItems
  3344. }) {
  3345. const contentStreamPromise = this.getContentStream(handler);
  3346. const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]);
  3347. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  3348. return dataPromises.then(([contentStream]) => {
  3349. const partialEvaluator = new _evaluator.PartialEvaluator({
  3350. xref: this.xref,
  3351. handler,
  3352. pageIndex: this.pageIndex,
  3353. idFactory: this._localIdFactory,
  3354. fontCache: this.fontCache,
  3355. builtInCMapCache: this.builtInCMapCache,
  3356. standardFontDataCache: this.standardFontDataCache,
  3357. globalImageCache: this.globalImageCache,
  3358. options: this.evaluatorOptions
  3359. });
  3360. return partialEvaluator.getTextContent({
  3361. stream: contentStream,
  3362. task,
  3363. resources: this.resources,
  3364. includeMarkedContent,
  3365. combineTextItems,
  3366. sink,
  3367. viewBox: this.view
  3368. });
  3369. });
  3370. }
  3371. async getStructTree() {
  3372. const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot");
  3373. if (!structTreeRoot) {
  3374. return null;
  3375. }
  3376. const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]);
  3377. return structTree.serializable;
  3378. }
  3379. _parseStructTree(structTreeRoot) {
  3380. const tree = new _struct_tree.StructTreePage(structTreeRoot, this.pageDict);
  3381. tree.parse();
  3382. return tree;
  3383. }
  3384. async getAnnotationsData(handler, task, intent) {
  3385. const annotations = await this._parsedAnnotations;
  3386. if (annotations.length === 0) {
  3387. return [];
  3388. }
  3389. const textContentPromises = [];
  3390. const annotationsData = [];
  3391. let partialEvaluator;
  3392. const intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  3393. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  3394. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  3395. for (const annotation of annotations) {
  3396. const isVisible = intentAny || intentDisplay && annotation.viewable;
  3397. if (isVisible || intentPrint && annotation.printable) {
  3398. annotationsData.push(annotation.data);
  3399. }
  3400. if (annotation.hasTextContent && isVisible) {
  3401. if (!partialEvaluator) {
  3402. partialEvaluator = new _evaluator.PartialEvaluator({
  3403. xref: this.xref,
  3404. handler,
  3405. pageIndex: this.pageIndex,
  3406. idFactory: this._localIdFactory,
  3407. fontCache: this.fontCache,
  3408. builtInCMapCache: this.builtInCMapCache,
  3409. standardFontDataCache: this.standardFontDataCache,
  3410. globalImageCache: this.globalImageCache,
  3411. options: this.evaluatorOptions
  3412. });
  3413. }
  3414. textContentPromises.push(annotation.extractTextContent(partialEvaluator, task, this.view).catch(function (reason) {
  3415. (0, _util.warn)(`getAnnotationsData - ignoring textContent during "${task.name}" task: "${reason}".`);
  3416. }));
  3417. }
  3418. }
  3419. await Promise.all(textContentPromises);
  3420. return annotationsData;
  3421. }
  3422. get annotations() {
  3423. const annots = this._getInheritableProperty("Annots");
  3424. return (0, _util.shadow)(this, "annotations", Array.isArray(annots) ? annots : []);
  3425. }
  3426. get _parsedAnnotations() {
  3427. const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
  3428. const annotationPromises = [];
  3429. for (const annotationRef of this.annotations) {
  3430. annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this._localIdFactory, false).catch(function (reason) {
  3431. (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
  3432. return null;
  3433. }));
  3434. }
  3435. return Promise.all(annotationPromises).then(function (annotations) {
  3436. if (annotations.length === 0) {
  3437. return annotations;
  3438. }
  3439. const sortedAnnotations = [];
  3440. let popupAnnotations;
  3441. for (const annotation of annotations) {
  3442. if (!annotation) {
  3443. continue;
  3444. }
  3445. if (annotation instanceof _annotation.PopupAnnotation) {
  3446. if (!popupAnnotations) {
  3447. popupAnnotations = [];
  3448. }
  3449. popupAnnotations.push(annotation);
  3450. continue;
  3451. }
  3452. sortedAnnotations.push(annotation);
  3453. }
  3454. if (popupAnnotations) {
  3455. sortedAnnotations.push(...popupAnnotations);
  3456. }
  3457. return sortedAnnotations;
  3458. });
  3459. });
  3460. return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
  3461. }
  3462. get jsActions() {
  3463. const actions = (0, _core_utils.collectActions)(this.xref, this.pageDict, _util.PageActionEventType);
  3464. return (0, _util.shadow)(this, "jsActions", actions);
  3465. }
  3466. }
  3467. exports.Page = Page;
  3468. const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
  3469. const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
  3470. const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
  3471. const FINGERPRINT_FIRST_BYTES = 1024;
  3472. const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  3473. function find(stream, signature, limit = 1024, backwards = false) {
  3474. const signatureLength = signature.length;
  3475. const scanBytes = stream.peekBytes(limit);
  3476. const scanLength = scanBytes.length - signatureLength;
  3477. if (scanLength <= 0) {
  3478. return false;
  3479. }
  3480. if (backwards) {
  3481. const signatureEnd = signatureLength - 1;
  3482. let pos = scanBytes.length - 1;
  3483. while (pos >= signatureEnd) {
  3484. let j = 0;
  3485. while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
  3486. j++;
  3487. }
  3488. if (j >= signatureLength) {
  3489. stream.pos += pos - signatureEnd;
  3490. return true;
  3491. }
  3492. pos--;
  3493. }
  3494. } else {
  3495. let pos = 0;
  3496. while (pos <= scanLength) {
  3497. let j = 0;
  3498. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  3499. j++;
  3500. }
  3501. if (j >= signatureLength) {
  3502. stream.pos += pos;
  3503. return true;
  3504. }
  3505. pos++;
  3506. }
  3507. }
  3508. return false;
  3509. }
  3510. class PDFDocument {
  3511. constructor(pdfManager, stream) {
  3512. if (stream.length <= 0) {
  3513. throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
  3514. }
  3515. this.pdfManager = pdfManager;
  3516. this.stream = stream;
  3517. this.xref = new _xref.XRef(stream, pdfManager);
  3518. this._pagePromises = new Map();
  3519. this._version = null;
  3520. const idCounters = {
  3521. font: 0
  3522. };
  3523. this._globalIdFactory = class {
  3524. static getDocId() {
  3525. return `g_${pdfManager.docId}`;
  3526. }
  3527. static createFontId() {
  3528. return `f${++idCounters.font}`;
  3529. }
  3530. static createObjId() {
  3531. (0, _util.unreachable)("Abstract method `createObjId` called.");
  3532. }
  3533. static getPageObjId() {
  3534. (0, _util.unreachable)("Abstract method `getPageObjId` called.");
  3535. }
  3536. };
  3537. }
  3538. parse(recoveryMode) {
  3539. this.xref.parse(recoveryMode);
  3540. this.catalog = new _catalog.Catalog(this.pdfManager, this.xref);
  3541. }
  3542. get linearization() {
  3543. let linearization = null;
  3544. try {
  3545. linearization = _parser.Linearization.create(this.stream);
  3546. } catch (err) {
  3547. if (err instanceof _core_utils.MissingDataException) {
  3548. throw err;
  3549. }
  3550. (0, _util.info)(err);
  3551. }
  3552. return (0, _util.shadow)(this, "linearization", linearization);
  3553. }
  3554. get startXRef() {
  3555. const stream = this.stream;
  3556. let startXRef = 0;
  3557. if (this.linearization) {
  3558. stream.reset();
  3559. if (find(stream, ENDOBJ_SIGNATURE)) {
  3560. startXRef = stream.pos + 6 - stream.start;
  3561. }
  3562. } else {
  3563. const step = 1024;
  3564. const startXRefLength = STARTXREF_SIGNATURE.length;
  3565. let found = false,
  3566. pos = stream.end;
  3567. while (!found && pos > 0) {
  3568. pos -= step - startXRefLength;
  3569. if (pos < 0) {
  3570. pos = 0;
  3571. }
  3572. stream.pos = pos;
  3573. found = find(stream, STARTXREF_SIGNATURE, step, true);
  3574. }
  3575. if (found) {
  3576. stream.skip(9);
  3577. let ch;
  3578. do {
  3579. ch = stream.getByte();
  3580. } while ((0, _core_utils.isWhiteSpace)(ch));
  3581. let str = "";
  3582. while (ch >= 0x20 && ch <= 0x39) {
  3583. str += String.fromCharCode(ch);
  3584. ch = stream.getByte();
  3585. }
  3586. startXRef = parseInt(str, 10);
  3587. if (isNaN(startXRef)) {
  3588. startXRef = 0;
  3589. }
  3590. }
  3591. }
  3592. return (0, _util.shadow)(this, "startXRef", startXRef);
  3593. }
  3594. checkHeader() {
  3595. const stream = this.stream;
  3596. stream.reset();
  3597. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  3598. return;
  3599. }
  3600. stream.moveStart();
  3601. stream.skip(PDF_HEADER_SIGNATURE.length);
  3602. let version = "",
  3603. ch;
  3604. while ((ch = stream.getByte()) > 0x20 && version.length < 7) {
  3605. version += String.fromCharCode(ch);
  3606. }
  3607. if (_core_utils.PDF_VERSION_REGEXP.test(version)) {
  3608. this._version = version;
  3609. } else {
  3610. (0, _util.warn)(`Invalid PDF header version: ${version}`);
  3611. }
  3612. }
  3613. parseStartXRef() {
  3614. this.xref.setStartXRef(this.startXRef);
  3615. }
  3616. get numPages() {
  3617. let num = 0;
  3618. if (this.catalog.hasActualNumPages) {
  3619. num = this.catalog.numPages;
  3620. } else if (this.xfaFactory) {
  3621. num = this.xfaFactory.getNumPages();
  3622. } else if (this.linearization) {
  3623. num = this.linearization.numPages;
  3624. } else {
  3625. num = this.catalog.numPages;
  3626. }
  3627. return (0, _util.shadow)(this, "numPages", num);
  3628. }
  3629. _hasOnlyDocumentSignatures(fields, recursionDepth = 0) {
  3630. const RECURSION_LIMIT = 10;
  3631. if (!Array.isArray(fields)) {
  3632. return false;
  3633. }
  3634. return fields.every(field => {
  3635. field = this.xref.fetchIfRef(field);
  3636. if (!(field instanceof _primitives.Dict)) {
  3637. return false;
  3638. }
  3639. if (field.has("Kids")) {
  3640. if (++recursionDepth > RECURSION_LIMIT) {
  3641. (0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached");
  3642. return false;
  3643. }
  3644. return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
  3645. }
  3646. const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig");
  3647. const rectangle = field.get("Rect");
  3648. const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
  3649. return isSignature && isInvisible;
  3650. });
  3651. }
  3652. get _xfaStreams() {
  3653. const acroForm = this.catalog.acroForm;
  3654. if (!acroForm) {
  3655. return null;
  3656. }
  3657. const xfa = acroForm.get("XFA");
  3658. const entries = {
  3659. "xdp:xdp": "",
  3660. template: "",
  3661. datasets: "",
  3662. config: "",
  3663. connectionSet: "",
  3664. localeSet: "",
  3665. stylesheet: "",
  3666. "/xdp:xdp": ""
  3667. };
  3668. if (xfa instanceof _base_stream.BaseStream && !xfa.isEmpty) {
  3669. entries["xdp:xdp"] = xfa;
  3670. return entries;
  3671. }
  3672. if (!Array.isArray(xfa) || xfa.length === 0) {
  3673. return null;
  3674. }
  3675. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  3676. let name;
  3677. if (i === 0) {
  3678. name = "xdp:xdp";
  3679. } else if (i === ii - 2) {
  3680. name = "/xdp:xdp";
  3681. } else {
  3682. name = xfa[i];
  3683. }
  3684. if (!entries.hasOwnProperty(name)) {
  3685. continue;
  3686. }
  3687. const data = this.xref.fetchIfRef(xfa[i + 1]);
  3688. if (!(data instanceof _base_stream.BaseStream) || data.isEmpty) {
  3689. continue;
  3690. }
  3691. entries[name] = data;
  3692. }
  3693. return entries;
  3694. }
  3695. get xfaDatasets() {
  3696. const streams = this._xfaStreams;
  3697. if (!streams) {
  3698. return (0, _util.shadow)(this, "xfaDatasets", null);
  3699. }
  3700. for (const key of ["datasets", "xdp:xdp"]) {
  3701. const stream = streams[key];
  3702. if (!stream) {
  3703. continue;
  3704. }
  3705. try {
  3706. const str = (0, _util.stringToUTF8String)(stream.getString());
  3707. const data = {
  3708. [key]: str
  3709. };
  3710. return (0, _util.shadow)(this, "xfaDatasets", new _dataset_reader.DatasetReader(data));
  3711. } catch (_) {
  3712. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3713. break;
  3714. }
  3715. }
  3716. return (0, _util.shadow)(this, "xfaDatasets", null);
  3717. }
  3718. get xfaData() {
  3719. const streams = this._xfaStreams;
  3720. if (!streams) {
  3721. return null;
  3722. }
  3723. const data = Object.create(null);
  3724. for (const [key, stream] of Object.entries(streams)) {
  3725. if (!stream) {
  3726. continue;
  3727. }
  3728. try {
  3729. data[key] = (0, _util.stringToUTF8String)(stream.getString());
  3730. } catch (_) {
  3731. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3732. return null;
  3733. }
  3734. }
  3735. return data;
  3736. }
  3737. get xfaFactory() {
  3738. let data;
  3739. if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
  3740. data = this.xfaData;
  3741. }
  3742. return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null);
  3743. }
  3744. get isPureXfa() {
  3745. return this.xfaFactory ? this.xfaFactory.isValid() : false;
  3746. }
  3747. get htmlForXfa() {
  3748. return this.xfaFactory ? this.xfaFactory.getPages() : null;
  3749. }
  3750. async loadXfaImages() {
  3751. const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages");
  3752. if (!xfaImagesDict) {
  3753. return;
  3754. }
  3755. const keys = xfaImagesDict.getKeys();
  3756. const objectLoader = new _object_loader.ObjectLoader(xfaImagesDict, keys, this.xref);
  3757. await objectLoader.load();
  3758. const xfaImages = new Map();
  3759. for (const key of keys) {
  3760. const stream = xfaImagesDict.get(key);
  3761. if (stream instanceof _base_stream.BaseStream) {
  3762. xfaImages.set(key, stream.getBytes());
  3763. }
  3764. }
  3765. this.xfaFactory.setImages(xfaImages);
  3766. }
  3767. async loadXfaFonts(handler, task) {
  3768. const acroForm = await this.pdfManager.ensureCatalog("acroForm");
  3769. if (!acroForm) {
  3770. return;
  3771. }
  3772. const resources = await acroForm.getAsync("DR");
  3773. if (!(resources instanceof _primitives.Dict)) {
  3774. return;
  3775. }
  3776. const objectLoader = new _object_loader.ObjectLoader(resources, ["Font"], this.xref);
  3777. await objectLoader.load();
  3778. const fontRes = resources.get("Font");
  3779. if (!(fontRes instanceof _primitives.Dict)) {
  3780. return;
  3781. }
  3782. const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions);
  3783. options.useSystemFonts = false;
  3784. const partialEvaluator = new _evaluator.PartialEvaluator({
  3785. xref: this.xref,
  3786. handler,
  3787. pageIndex: -1,
  3788. idFactory: this._globalIdFactory,
  3789. fontCache: this.catalog.fontCache,
  3790. builtInCMapCache: this.catalog.builtInCMapCache,
  3791. standardFontDataCache: this.catalog.standardFontDataCache,
  3792. options
  3793. });
  3794. const operatorList = new _operator_list.OperatorList();
  3795. const pdfFonts = [];
  3796. const initialState = {
  3797. get font() {
  3798. return pdfFonts.at(-1);
  3799. },
  3800. set font(font) {
  3801. pdfFonts.push(font);
  3802. },
  3803. clone() {
  3804. return this;
  3805. }
  3806. };
  3807. const fonts = new Map();
  3808. fontRes.forEach((fontName, font) => {
  3809. fonts.set(fontName, font);
  3810. });
  3811. const promises = [];
  3812. for (const [fontName, font] of fonts) {
  3813. const descriptor = font.get("FontDescriptor");
  3814. if (!(descriptor instanceof _primitives.Dict)) {
  3815. continue;
  3816. }
  3817. let fontFamily = descriptor.get("FontFamily");
  3818. fontFamily = fontFamily.replace(/[ ]+(\d)/g, "$1");
  3819. const fontWeight = descriptor.get("FontWeight");
  3820. const italicAngle = -descriptor.get("ItalicAngle");
  3821. const cssFontInfo = {
  3822. fontFamily,
  3823. fontWeight,
  3824. italicAngle
  3825. };
  3826. if (!(0, _core_utils.validateCSSFont)(cssFontInfo)) {
  3827. continue;
  3828. }
  3829. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(fontName), 1], null, operatorList, task, initialState, null, cssFontInfo).catch(function (reason) {
  3830. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3831. return null;
  3832. }));
  3833. }
  3834. await Promise.all(promises);
  3835. const missingFonts = this.xfaFactory.setFonts(pdfFonts);
  3836. if (!missingFonts) {
  3837. return;
  3838. }
  3839. options.ignoreErrors = true;
  3840. promises.length = 0;
  3841. pdfFonts.length = 0;
  3842. const reallyMissingFonts = new Set();
  3843. for (const missing of missingFonts) {
  3844. if (!(0, _xfa_fonts.getXfaFontName)(`${missing}-Regular`)) {
  3845. reallyMissingFonts.add(missing);
  3846. }
  3847. }
  3848. if (reallyMissingFonts.size) {
  3849. missingFonts.push("PdfJS-Fallback");
  3850. }
  3851. for (const missing of missingFonts) {
  3852. if (reallyMissingFonts.has(missing)) {
  3853. continue;
  3854. }
  3855. for (const fontInfo of [{
  3856. name: "Regular",
  3857. fontWeight: 400,
  3858. italicAngle: 0
  3859. }, {
  3860. name: "Bold",
  3861. fontWeight: 700,
  3862. italicAngle: 0
  3863. }, {
  3864. name: "Italic",
  3865. fontWeight: 400,
  3866. italicAngle: 12
  3867. }, {
  3868. name: "BoldItalic",
  3869. fontWeight: 700,
  3870. italicAngle: 12
  3871. }]) {
  3872. const name = `${missing}-${fontInfo.name}`;
  3873. const dict = (0, _xfa_fonts.getXfaFontDict)(name);
  3874. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(name), 1], null, operatorList, task, initialState, dict, {
  3875. fontFamily: missing,
  3876. fontWeight: fontInfo.fontWeight,
  3877. italicAngle: fontInfo.italicAngle
  3878. }).catch(function (reason) {
  3879. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3880. return null;
  3881. }));
  3882. }
  3883. }
  3884. await Promise.all(promises);
  3885. this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts);
  3886. }
  3887. async serializeXfaData(annotationStorage) {
  3888. return this.xfaFactory ? this.xfaFactory.serializeData(annotationStorage) : null;
  3889. }
  3890. get version() {
  3891. return this.catalog.version || this._version;
  3892. }
  3893. get formInfo() {
  3894. const formInfo = {
  3895. hasFields: false,
  3896. hasAcroForm: false,
  3897. hasXfa: false,
  3898. hasSignatures: false
  3899. };
  3900. const acroForm = this.catalog.acroForm;
  3901. if (!acroForm) {
  3902. return (0, _util.shadow)(this, "formInfo", formInfo);
  3903. }
  3904. try {
  3905. const fields = acroForm.get("Fields");
  3906. const hasFields = Array.isArray(fields) && fields.length > 0;
  3907. formInfo.hasFields = hasFields;
  3908. const xfa = acroForm.get("XFA");
  3909. formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || xfa instanceof _base_stream.BaseStream && !xfa.isEmpty;
  3910. const sigFlags = acroForm.get("SigFlags");
  3911. const hasSignatures = !!(sigFlags & 0x1);
  3912. const hasOnlyDocumentSignatures = hasSignatures && this._hasOnlyDocumentSignatures(fields);
  3913. formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
  3914. formInfo.hasSignatures = hasSignatures;
  3915. } catch (ex) {
  3916. if (ex instanceof _core_utils.MissingDataException) {
  3917. throw ex;
  3918. }
  3919. (0, _util.warn)(`Cannot fetch form information: "${ex}".`);
  3920. }
  3921. return (0, _util.shadow)(this, "formInfo", formInfo);
  3922. }
  3923. get documentInfo() {
  3924. const docInfo = {
  3925. PDFFormatVersion: this.version,
  3926. Language: this.catalog.lang,
  3927. EncryptFilterName: this.xref.encrypt ? this.xref.encrypt.filterName : null,
  3928. IsLinearized: !!this.linearization,
  3929. IsAcroFormPresent: this.formInfo.hasAcroForm,
  3930. IsXFAPresent: this.formInfo.hasXfa,
  3931. IsCollectionPresent: !!this.catalog.collection,
  3932. IsSignaturesPresent: this.formInfo.hasSignatures
  3933. };
  3934. let infoDict;
  3935. try {
  3936. infoDict = this.xref.trailer.get("Info");
  3937. } catch (err) {
  3938. if (err instanceof _core_utils.MissingDataException) {
  3939. throw err;
  3940. }
  3941. (0, _util.info)("The document information dictionary is invalid.");
  3942. }
  3943. if (!(infoDict instanceof _primitives.Dict)) {
  3944. return (0, _util.shadow)(this, "documentInfo", docInfo);
  3945. }
  3946. for (const key of infoDict.getKeys()) {
  3947. const value = infoDict.get(key);
  3948. switch (key) {
  3949. case "Title":
  3950. case "Author":
  3951. case "Subject":
  3952. case "Keywords":
  3953. case "Creator":
  3954. case "Producer":
  3955. case "CreationDate":
  3956. case "ModDate":
  3957. if (typeof value === "string") {
  3958. docInfo[key] = (0, _util.stringToPDFString)(value);
  3959. continue;
  3960. }
  3961. break;
  3962. case "Trapped":
  3963. if (value instanceof _primitives.Name) {
  3964. docInfo[key] = value;
  3965. continue;
  3966. }
  3967. break;
  3968. default:
  3969. let customValue;
  3970. switch (typeof value) {
  3971. case "string":
  3972. customValue = (0, _util.stringToPDFString)(value);
  3973. break;
  3974. case "number":
  3975. case "boolean":
  3976. customValue = value;
  3977. break;
  3978. default:
  3979. if (value instanceof _primitives.Name) {
  3980. customValue = value;
  3981. }
  3982. break;
  3983. }
  3984. if (customValue === undefined) {
  3985. (0, _util.warn)(`Bad value, for custom key "${key}", in Info: ${value}.`);
  3986. continue;
  3987. }
  3988. if (!docInfo.Custom) {
  3989. docInfo.Custom = Object.create(null);
  3990. }
  3991. docInfo.Custom[key] = customValue;
  3992. continue;
  3993. }
  3994. (0, _util.warn)(`Bad value, for key "${key}", in Info: ${value}.`);
  3995. }
  3996. return (0, _util.shadow)(this, "documentInfo", docInfo);
  3997. }
  3998. get fingerprints() {
  3999. function validate(data) {
  4000. return typeof data === "string" && data.length > 0 && data !== EMPTY_FINGERPRINT;
  4001. }
  4002. function hexString(hash) {
  4003. const buf = [];
  4004. for (const num of hash) {
  4005. const hex = num.toString(16);
  4006. buf.push(hex.padStart(2, "0"));
  4007. }
  4008. return buf.join("");
  4009. }
  4010. const idArray = this.xref.trailer.get("ID");
  4011. let hashOriginal, hashModified;
  4012. if (Array.isArray(idArray) && validate(idArray[0])) {
  4013. hashOriginal = (0, _util.stringToBytes)(idArray[0]);
  4014. if (idArray[1] !== idArray[0] && validate(idArray[1])) {
  4015. hashModified = (0, _util.stringToBytes)(idArray[1]);
  4016. }
  4017. } else {
  4018. hashOriginal = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  4019. }
  4020. return (0, _util.shadow)(this, "fingerprints", [hexString(hashOriginal), hashModified ? hexString(hashModified) : null]);
  4021. }
  4022. async _getLinearizationPage(pageIndex) {
  4023. const {
  4024. catalog,
  4025. linearization,
  4026. xref
  4027. } = this;
  4028. const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
  4029. try {
  4030. const obj = await xref.fetchAsync(ref);
  4031. if (obj instanceof _primitives.Dict) {
  4032. let type = obj.getRaw("Type");
  4033. if (type instanceof _primitives.Ref) {
  4034. type = await xref.fetchAsync(type);
  4035. }
  4036. if ((0, _primitives.isName)(type, "Page") || !obj.has("Type") && !obj.has("Kids")) {
  4037. if (!catalog.pageKidsCountCache.has(ref)) {
  4038. catalog.pageKidsCountCache.put(ref, 1);
  4039. }
  4040. if (!catalog.pageIndexCache.has(ref)) {
  4041. catalog.pageIndexCache.put(ref, 0);
  4042. }
  4043. return [obj, ref];
  4044. }
  4045. }
  4046. throw new _util.FormatError("The Linearization dictionary doesn't point to a valid Page dictionary.");
  4047. } catch (reason) {
  4048. (0, _util.warn)(`_getLinearizationPage: "${reason.message}".`);
  4049. return catalog.getPageDict(pageIndex);
  4050. }
  4051. }
  4052. getPage(pageIndex) {
  4053. const cachedPromise = this._pagePromises.get(pageIndex);
  4054. if (cachedPromise) {
  4055. return cachedPromise;
  4056. }
  4057. const {
  4058. catalog,
  4059. linearization,
  4060. xfaFactory
  4061. } = this;
  4062. let promise;
  4063. if (xfaFactory) {
  4064. promise = Promise.resolve([_primitives.Dict.empty, null]);
  4065. } else if (linearization && linearization.pageFirst === pageIndex) {
  4066. promise = this._getLinearizationPage(pageIndex);
  4067. } else {
  4068. promise = catalog.getPageDict(pageIndex);
  4069. }
  4070. promise = promise.then(([pageDict, ref]) => {
  4071. return new Page({
  4072. pdfManager: this.pdfManager,
  4073. xref: this.xref,
  4074. pageIndex,
  4075. pageDict,
  4076. ref,
  4077. globalIdFactory: this._globalIdFactory,
  4078. fontCache: catalog.fontCache,
  4079. builtInCMapCache: catalog.builtInCMapCache,
  4080. standardFontDataCache: catalog.standardFontDataCache,
  4081. globalImageCache: catalog.globalImageCache,
  4082. nonBlendModesSet: catalog.nonBlendModesSet,
  4083. xfaFactory
  4084. });
  4085. });
  4086. this._pagePromises.set(pageIndex, promise);
  4087. return promise;
  4088. }
  4089. async checkFirstPage(recoveryMode = false) {
  4090. if (recoveryMode) {
  4091. return;
  4092. }
  4093. try {
  4094. await this.getPage(0);
  4095. } catch (reason) {
  4096. if (reason instanceof _core_utils.XRefEntryException) {
  4097. this._pagePromises.delete(0);
  4098. await this.cleanup();
  4099. throw new _core_utils.XRefParseException();
  4100. }
  4101. }
  4102. }
  4103. async checkLastPage(recoveryMode = false) {
  4104. const {
  4105. catalog,
  4106. pdfManager
  4107. } = this;
  4108. catalog.setActualNumPages();
  4109. let numPages;
  4110. try {
  4111. await Promise.all([pdfManager.ensureDoc("xfaFactory"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("numPages")]);
  4112. if (this.xfaFactory) {
  4113. return;
  4114. } else if (this.linearization) {
  4115. numPages = this.linearization.numPages;
  4116. } else {
  4117. numPages = catalog.numPages;
  4118. }
  4119. if (!Number.isInteger(numPages)) {
  4120. throw new _util.FormatError("Page count is not an integer.");
  4121. } else if (numPages <= 1) {
  4122. return;
  4123. }
  4124. await this.getPage(numPages - 1);
  4125. } catch (reason) {
  4126. this._pagePromises.delete(numPages - 1);
  4127. await this.cleanup();
  4128. if (reason instanceof _core_utils.XRefEntryException && !recoveryMode) {
  4129. throw new _core_utils.XRefParseException();
  4130. }
  4131. (0, _util.warn)(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`);
  4132. let pagesTree;
  4133. try {
  4134. pagesTree = await catalog.getAllPageDicts(recoveryMode);
  4135. } catch (reasonAll) {
  4136. if (reasonAll instanceof _core_utils.XRefEntryException && !recoveryMode) {
  4137. throw new _core_utils.XRefParseException();
  4138. }
  4139. catalog.setActualNumPages(1);
  4140. return;
  4141. }
  4142. for (const [pageIndex, [pageDict, ref]] of pagesTree) {
  4143. let promise;
  4144. if (pageDict instanceof Error) {
  4145. promise = Promise.reject(pageDict);
  4146. promise.catch(() => {});
  4147. } else {
  4148. promise = Promise.resolve(new Page({
  4149. pdfManager,
  4150. xref: this.xref,
  4151. pageIndex,
  4152. pageDict,
  4153. ref,
  4154. globalIdFactory: this._globalIdFactory,
  4155. fontCache: catalog.fontCache,
  4156. builtInCMapCache: catalog.builtInCMapCache,
  4157. standardFontDataCache: catalog.standardFontDataCache,
  4158. globalImageCache: catalog.globalImageCache,
  4159. nonBlendModesSet: catalog.nonBlendModesSet,
  4160. xfaFactory: null
  4161. }));
  4162. }
  4163. this._pagePromises.set(pageIndex, promise);
  4164. }
  4165. catalog.setActualNumPages(pagesTree.size);
  4166. }
  4167. }
  4168. fontFallback(id, handler) {
  4169. return this.catalog.fontFallback(id, handler);
  4170. }
  4171. async cleanup(manuallyTriggered = false) {
  4172. return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _cleanup_helper.clearGlobalCaches)();
  4173. }
  4174. _collectFieldObjects(name, fieldRef, promises) {
  4175. const field = this.xref.fetchIfRef(fieldRef);
  4176. if (field.has("T")) {
  4177. const partName = (0, _util.stringToPDFString)(field.get("T"));
  4178. if (name === "") {
  4179. name = partName;
  4180. } else {
  4181. name = `${name}.${partName}`;
  4182. }
  4183. }
  4184. if (!promises.has(name)) {
  4185. promises.set(name, []);
  4186. }
  4187. promises.get(name).push(_annotation.AnnotationFactory.create(this.xref, fieldRef, this.pdfManager, this._localIdFactory, true).then(annotation => annotation && annotation.getFieldObject()).catch(function (reason) {
  4188. (0, _util.warn)(`_collectFieldObjects: "${reason}".`);
  4189. return null;
  4190. }));
  4191. if (field.has("Kids")) {
  4192. const kids = field.get("Kids");
  4193. for (const kid of kids) {
  4194. this._collectFieldObjects(name, kid, promises);
  4195. }
  4196. }
  4197. }
  4198. get fieldObjects() {
  4199. if (!this.formInfo.hasFields) {
  4200. return (0, _util.shadow)(this, "fieldObjects", Promise.resolve(null));
  4201. }
  4202. const allFields = Object.create(null);
  4203. const fieldPromises = new Map();
  4204. for (const fieldRef of this.catalog.acroForm.get("Fields")) {
  4205. this._collectFieldObjects("", fieldRef, fieldPromises);
  4206. }
  4207. const allPromises = [];
  4208. for (const [name, promises] of fieldPromises) {
  4209. allPromises.push(Promise.all(promises).then(fields => {
  4210. fields = fields.filter(field => !!field);
  4211. if (fields.length > 0) {
  4212. allFields[name] = fields;
  4213. }
  4214. }));
  4215. }
  4216. return (0, _util.shadow)(this, "fieldObjects", Promise.all(allPromises).then(() => allFields));
  4217. }
  4218. get hasJSActions() {
  4219. const promise = this.pdfManager.ensureDoc("_parseHasJSActions");
  4220. return (0, _util.shadow)(this, "hasJSActions", promise);
  4221. }
  4222. async _parseHasJSActions() {
  4223. const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]);
  4224. if (catalogJsActions) {
  4225. return true;
  4226. }
  4227. if (fieldObjects) {
  4228. return Object.values(fieldObjects).some(fieldObject => fieldObject.some(object => object.actions !== null));
  4229. }
  4230. return false;
  4231. }
  4232. get calculationOrderIds() {
  4233. const acroForm = this.catalog.acroForm;
  4234. if (!acroForm || !acroForm.has("CO")) {
  4235. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4236. }
  4237. const calculationOrder = acroForm.get("CO");
  4238. if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
  4239. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4240. }
  4241. const ids = [];
  4242. for (const id of calculationOrder) {
  4243. if (id instanceof _primitives.Ref) {
  4244. ids.push(id.toString());
  4245. }
  4246. }
  4247. if (ids.length === 0) {
  4248. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4249. }
  4250. return (0, _util.shadow)(this, "calculationOrderIds", ids);
  4251. }
  4252. }
  4253. exports.PDFDocument = PDFDocument;
  4254. /***/ }),
  4255. /* 10 */
  4256. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4257. Object.defineProperty(exports, "__esModule", ({
  4258. value: true
  4259. }));
  4260. exports.PopupAnnotation = exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
  4261. exports.getQuadPoints = getQuadPoints;
  4262. var _util = __w_pdfjs_require__(2);
  4263. var _core_utils = __w_pdfjs_require__(4);
  4264. var _default_appearance = __w_pdfjs_require__(11);
  4265. var _primitives = __w_pdfjs_require__(3);
  4266. var _writer = __w_pdfjs_require__(63);
  4267. var _base_stream = __w_pdfjs_require__(5);
  4268. var _bidi = __w_pdfjs_require__(58);
  4269. var _catalog = __w_pdfjs_require__(67);
  4270. var _colorspace = __w_pdfjs_require__(12);
  4271. var _file_spec = __w_pdfjs_require__(70);
  4272. var _object_loader = __w_pdfjs_require__(73);
  4273. var _operator_list = __w_pdfjs_require__(60);
  4274. var _stream = __w_pdfjs_require__(8);
  4275. var _factory = __w_pdfjs_require__(74);
  4276. class AnnotationFactory {
  4277. static create(xref, ref, pdfManager, idFactory, collectFields) {
  4278. return Promise.all([pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("baseUrl"), pdfManager.ensureCatalog("attachments"), pdfManager.ensureDoc("xfaDatasets"), collectFields ? this._getPageIndex(xref, ref, pdfManager) : -1]).then(([acroForm, baseUrl, attachments, xfaDatasets, pageIndex]) => pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory, acroForm, attachments, xfaDatasets, collectFields, pageIndex]));
  4279. }
  4280. static _create(xref, ref, pdfManager, idFactory, acroForm, attachments = null, xfaDatasets, collectFields, pageIndex = -1) {
  4281. const dict = xref.fetchIfRef(ref);
  4282. if (!(dict instanceof _primitives.Dict)) {
  4283. return undefined;
  4284. }
  4285. const id = ref instanceof _primitives.Ref ? ref.toString() : `annot_${idFactory.createObjId()}`;
  4286. let subtype = dict.get("Subtype");
  4287. subtype = subtype instanceof _primitives.Name ? subtype.name : null;
  4288. const acroFormDict = acroForm instanceof _primitives.Dict ? acroForm : _primitives.Dict.empty;
  4289. const parameters = {
  4290. xref,
  4291. ref,
  4292. dict,
  4293. subtype,
  4294. id,
  4295. pdfManager,
  4296. acroForm: acroFormDict,
  4297. attachments,
  4298. xfaDatasets,
  4299. collectFields,
  4300. needAppearances: !collectFields && acroFormDict.get("NeedAppearances") === true,
  4301. pageIndex,
  4302. isOffscreenCanvasSupported: _util.FeatureTest.isOffscreenCanvasSupported && pdfManager.evaluatorOptions.isOffscreenCanvasSupported
  4303. };
  4304. switch (subtype) {
  4305. case "Link":
  4306. return new LinkAnnotation(parameters);
  4307. case "Text":
  4308. return new TextAnnotation(parameters);
  4309. case "Widget":
  4310. let fieldType = (0, _core_utils.getInheritableProperty)({
  4311. dict,
  4312. key: "FT"
  4313. });
  4314. fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  4315. switch (fieldType) {
  4316. case "Tx":
  4317. return new TextWidgetAnnotation(parameters);
  4318. case "Btn":
  4319. return new ButtonWidgetAnnotation(parameters);
  4320. case "Ch":
  4321. return new ChoiceWidgetAnnotation(parameters);
  4322. case "Sig":
  4323. return new SignatureWidgetAnnotation(parameters);
  4324. }
  4325. (0, _util.warn)(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type.");
  4326. return new WidgetAnnotation(parameters);
  4327. case "Popup":
  4328. return new PopupAnnotation(parameters);
  4329. case "FreeText":
  4330. return new FreeTextAnnotation(parameters);
  4331. case "Line":
  4332. return new LineAnnotation(parameters);
  4333. case "Square":
  4334. return new SquareAnnotation(parameters);
  4335. case "Circle":
  4336. return new CircleAnnotation(parameters);
  4337. case "PolyLine":
  4338. return new PolylineAnnotation(parameters);
  4339. case "Polygon":
  4340. return new PolygonAnnotation(parameters);
  4341. case "Caret":
  4342. return new CaretAnnotation(parameters);
  4343. case "Ink":
  4344. return new InkAnnotation(parameters);
  4345. case "Highlight":
  4346. return new HighlightAnnotation(parameters);
  4347. case "Underline":
  4348. return new UnderlineAnnotation(parameters);
  4349. case "Squiggly":
  4350. return new SquigglyAnnotation(parameters);
  4351. case "StrikeOut":
  4352. return new StrikeOutAnnotation(parameters);
  4353. case "Stamp":
  4354. return new StampAnnotation(parameters);
  4355. case "FileAttachment":
  4356. return new FileAttachmentAnnotation(parameters);
  4357. default:
  4358. if (!collectFields) {
  4359. if (!subtype) {
  4360. (0, _util.warn)("Annotation is missing the required /Subtype.");
  4361. } else {
  4362. (0, _util.warn)(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation.");
  4363. }
  4364. }
  4365. return new Annotation(parameters);
  4366. }
  4367. }
  4368. static async _getPageIndex(xref, ref, pdfManager) {
  4369. try {
  4370. const annotDict = await xref.fetchIfRefAsync(ref);
  4371. if (!(annotDict instanceof _primitives.Dict)) {
  4372. return -1;
  4373. }
  4374. const pageRef = annotDict.getRaw("P");
  4375. if (!(pageRef instanceof _primitives.Ref)) {
  4376. return -1;
  4377. }
  4378. const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  4379. return pageIndex;
  4380. } catch (ex) {
  4381. (0, _util.warn)(`_getPageIndex: "${ex}".`);
  4382. return -1;
  4383. }
  4384. }
  4385. static async saveNewAnnotations(evaluator, task, annotations) {
  4386. const xref = evaluator.xref;
  4387. let baseFontRef;
  4388. const dependencies = [];
  4389. const promises = [];
  4390. for (const annotation of annotations) {
  4391. switch (annotation.annotationType) {
  4392. case _util.AnnotationEditorType.FREETEXT:
  4393. if (!baseFontRef) {
  4394. const baseFont = new _primitives.Dict(xref);
  4395. baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
  4396. baseFont.set("Type", _primitives.Name.get("Font"));
  4397. baseFont.set("Subtype", _primitives.Name.get("Type1"));
  4398. baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  4399. const buffer = [];
  4400. baseFontRef = xref.getNewTemporaryRef();
  4401. (0, _writer.writeObject)(baseFontRef, baseFont, buffer, null);
  4402. dependencies.push({
  4403. ref: baseFontRef,
  4404. data: buffer.join("")
  4405. });
  4406. }
  4407. promises.push(FreeTextAnnotation.createNewAnnotation(xref, annotation, dependencies, {
  4408. evaluator,
  4409. task,
  4410. baseFontRef
  4411. }));
  4412. break;
  4413. case _util.AnnotationEditorType.INK:
  4414. promises.push(InkAnnotation.createNewAnnotation(xref, annotation, dependencies));
  4415. }
  4416. }
  4417. return {
  4418. annotations: await Promise.all(promises),
  4419. dependencies
  4420. };
  4421. }
  4422. static async printNewAnnotations(evaluator, task, annotations) {
  4423. if (!annotations) {
  4424. return null;
  4425. }
  4426. const xref = evaluator.xref;
  4427. const promises = [];
  4428. const isOffscreenCanvasSupported = _util.FeatureTest.isOffscreenCanvasSupported && evaluator.options.isOffscreenCanvasSupported;
  4429. for (const annotation of annotations) {
  4430. switch (annotation.annotationType) {
  4431. case _util.AnnotationEditorType.FREETEXT:
  4432. promises.push(FreeTextAnnotation.createNewPrintAnnotation(xref, annotation, {
  4433. evaluator,
  4434. task,
  4435. isOffscreenCanvasSupported
  4436. }));
  4437. break;
  4438. case _util.AnnotationEditorType.INK:
  4439. promises.push(InkAnnotation.createNewPrintAnnotation(xref, annotation, {
  4440. isOffscreenCanvasSupported
  4441. }));
  4442. break;
  4443. }
  4444. }
  4445. return Promise.all(promises);
  4446. }
  4447. }
  4448. exports.AnnotationFactory = AnnotationFactory;
  4449. function getRgbColor(color, defaultColor = new Uint8ClampedArray(3)) {
  4450. if (!Array.isArray(color)) {
  4451. return defaultColor;
  4452. }
  4453. const rgbColor = defaultColor || new Uint8ClampedArray(3);
  4454. switch (color.length) {
  4455. case 0:
  4456. return null;
  4457. case 1:
  4458. _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  4459. return rgbColor;
  4460. case 3:
  4461. _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  4462. return rgbColor;
  4463. case 4:
  4464. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  4465. return rgbColor;
  4466. default:
  4467. return defaultColor;
  4468. }
  4469. }
  4470. function getPdfColorArray(color) {
  4471. return Array.from(color, c => c / 255);
  4472. }
  4473. function getQuadPoints(dict, rect) {
  4474. const quadPoints = dict.getArray("QuadPoints");
  4475. if (!Array.isArray(quadPoints) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
  4476. return null;
  4477. }
  4478. const quadPointsLists = [];
  4479. for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
  4480. let minX = Infinity,
  4481. maxX = -Infinity,
  4482. minY = Infinity,
  4483. maxY = -Infinity;
  4484. for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
  4485. const x = quadPoints[j];
  4486. const y = quadPoints[j + 1];
  4487. minX = Math.min(x, minX);
  4488. maxX = Math.max(x, maxX);
  4489. minY = Math.min(y, minY);
  4490. maxY = Math.max(y, maxY);
  4491. }
  4492. if (rect !== null && (minX < rect[0] || maxX > rect[2] || minY < rect[1] || maxY > rect[3])) {
  4493. return null;
  4494. }
  4495. quadPointsLists.push([{
  4496. x: minX,
  4497. y: maxY
  4498. }, {
  4499. x: maxX,
  4500. y: maxY
  4501. }, {
  4502. x: minX,
  4503. y: minY
  4504. }, {
  4505. x: maxX,
  4506. y: minY
  4507. }]);
  4508. }
  4509. return quadPointsLists;
  4510. }
  4511. function getTransformMatrix(rect, bbox, matrix) {
  4512. const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
  4513. if (minX === maxX || minY === maxY) {
  4514. return [1, 0, 0, 1, rect[0], rect[1]];
  4515. }
  4516. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  4517. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  4518. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  4519. }
  4520. class Annotation {
  4521. constructor(params) {
  4522. const {
  4523. dict,
  4524. xref
  4525. } = params;
  4526. this.setTitle(dict.get("T"));
  4527. this.setContents(dict.get("Contents"));
  4528. this.setModificationDate(dict.get("M"));
  4529. this.setFlags(dict.get("F"));
  4530. this.setRectangle(dict.getArray("Rect"));
  4531. this.setColor(dict.getArray("C"));
  4532. this.setBorderStyle(dict);
  4533. this.setAppearance(dict);
  4534. this.setOptionalContent(dict);
  4535. const MK = dict.get("MK");
  4536. this.setBorderAndBackgroundColors(MK);
  4537. this.setRotation(MK);
  4538. this._streams = [];
  4539. if (this.appearance) {
  4540. this._streams.push(this.appearance);
  4541. }
  4542. this.data = {
  4543. annotationFlags: this.flags,
  4544. borderStyle: this.borderStyle,
  4545. color: this.color,
  4546. backgroundColor: this.backgroundColor,
  4547. borderColor: this.borderColor,
  4548. rotation: this.rotation,
  4549. contentsObj: this._contents,
  4550. hasAppearance: !!this.appearance,
  4551. id: params.id,
  4552. modificationDate: this.modificationDate,
  4553. rect: this.rectangle,
  4554. subtype: params.subtype,
  4555. hasOwnCanvas: false
  4556. };
  4557. if (params.collectFields) {
  4558. const kids = dict.get("Kids");
  4559. if (Array.isArray(kids)) {
  4560. const kidIds = [];
  4561. for (const kid of kids) {
  4562. if (kid instanceof _primitives.Ref) {
  4563. kidIds.push(kid.toString());
  4564. }
  4565. }
  4566. if (kidIds.length !== 0) {
  4567. this.data.kidIds = kidIds;
  4568. }
  4569. }
  4570. this.data.actions = (0, _core_utils.collectActions)(xref, dict, _util.AnnotationActionEventType);
  4571. this.data.fieldName = this._constructFieldName(dict);
  4572. this.data.pageIndex = params.pageIndex;
  4573. }
  4574. this._isOffscreenCanvasSupported = params.isOffscreenCanvasSupported;
  4575. this._fallbackFontDict = null;
  4576. this._needAppearances = false;
  4577. }
  4578. _hasFlag(flags, flag) {
  4579. return !!(flags & flag);
  4580. }
  4581. _isViewable(flags) {
  4582. return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
  4583. }
  4584. _isPrintable(flags) {
  4585. return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE);
  4586. }
  4587. mustBeViewed(annotationStorage) {
  4588. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  4589. if (storageEntry && storageEntry.hidden !== undefined) {
  4590. return !storageEntry.hidden;
  4591. }
  4592. return this.viewable && !this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN);
  4593. }
  4594. mustBePrinted(annotationStorage) {
  4595. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  4596. if (storageEntry && storageEntry.print !== undefined) {
  4597. return storageEntry.print;
  4598. }
  4599. return this.printable;
  4600. }
  4601. get viewable() {
  4602. if (this.data.quadPoints === null) {
  4603. return false;
  4604. }
  4605. if (this.flags === 0) {
  4606. return true;
  4607. }
  4608. return this._isViewable(this.flags);
  4609. }
  4610. get printable() {
  4611. if (this.data.quadPoints === null) {
  4612. return false;
  4613. }
  4614. if (this.flags === 0) {
  4615. return false;
  4616. }
  4617. return this._isPrintable(this.flags);
  4618. }
  4619. _parseStringHelper(data) {
  4620. const str = typeof data === "string" ? (0, _util.stringToPDFString)(data) : "";
  4621. const dir = str && (0, _bidi.bidi)(str).dir === "rtl" ? "rtl" : "ltr";
  4622. return {
  4623. str,
  4624. dir
  4625. };
  4626. }
  4627. setDefaultAppearance(params) {
  4628. const defaultAppearance = (0, _core_utils.getInheritableProperty)({
  4629. dict: params.dict,
  4630. key: "DA"
  4631. }) || params.acroForm.get("DA");
  4632. this._defaultAppearance = typeof defaultAppearance === "string" ? defaultAppearance : "";
  4633. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance);
  4634. }
  4635. setTitle(title) {
  4636. this._title = this._parseStringHelper(title);
  4637. }
  4638. setContents(contents) {
  4639. this._contents = this._parseStringHelper(contents);
  4640. }
  4641. setModificationDate(modificationDate) {
  4642. this.modificationDate = typeof modificationDate === "string" ? modificationDate : null;
  4643. }
  4644. setFlags(flags) {
  4645. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  4646. }
  4647. hasFlag(flag) {
  4648. return this._hasFlag(this.flags, flag);
  4649. }
  4650. setRectangle(rectangle) {
  4651. if (Array.isArray(rectangle) && rectangle.length === 4) {
  4652. this.rectangle = _util.Util.normalizeRect(rectangle);
  4653. } else {
  4654. this.rectangle = [0, 0, 0, 0];
  4655. }
  4656. }
  4657. setColor(color) {
  4658. this.color = getRgbColor(color);
  4659. }
  4660. setLineEndings(lineEndings) {
  4661. this.lineEndings = ["None", "None"];
  4662. if (Array.isArray(lineEndings) && lineEndings.length === 2) {
  4663. for (let i = 0; i < 2; i++) {
  4664. const obj = lineEndings[i];
  4665. if (obj instanceof _primitives.Name) {
  4666. switch (obj.name) {
  4667. case "None":
  4668. continue;
  4669. case "Square":
  4670. case "Circle":
  4671. case "Diamond":
  4672. case "OpenArrow":
  4673. case "ClosedArrow":
  4674. case "Butt":
  4675. case "ROpenArrow":
  4676. case "RClosedArrow":
  4677. case "Slash":
  4678. this.lineEndings[i] = obj.name;
  4679. continue;
  4680. }
  4681. }
  4682. (0, _util.warn)(`Ignoring invalid lineEnding: ${obj}`);
  4683. }
  4684. }
  4685. }
  4686. setRotation(mk) {
  4687. this.rotation = 0;
  4688. if (mk instanceof _primitives.Dict) {
  4689. let angle = mk.get("R") || 0;
  4690. if (Number.isInteger(angle) && angle !== 0) {
  4691. angle %= 360;
  4692. if (angle < 0) {
  4693. angle += 360;
  4694. }
  4695. if (angle % 90 === 0) {
  4696. this.rotation = angle;
  4697. }
  4698. }
  4699. }
  4700. }
  4701. setBorderAndBackgroundColors(mk) {
  4702. if (mk instanceof _primitives.Dict) {
  4703. this.borderColor = getRgbColor(mk.getArray("BC"), null);
  4704. this.backgroundColor = getRgbColor(mk.getArray("BG"), null);
  4705. } else {
  4706. this.borderColor = this.backgroundColor = null;
  4707. }
  4708. }
  4709. setBorderStyle(borderStyle) {
  4710. this.borderStyle = new AnnotationBorderStyle();
  4711. if (!(borderStyle instanceof _primitives.Dict)) {
  4712. return;
  4713. }
  4714. if (borderStyle.has("BS")) {
  4715. const dict = borderStyle.get("BS");
  4716. const dictType = dict.get("Type");
  4717. if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
  4718. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  4719. this.borderStyle.setStyle(dict.get("S"));
  4720. this.borderStyle.setDashArray(dict.getArray("D"));
  4721. }
  4722. } else if (borderStyle.has("Border")) {
  4723. const array = borderStyle.getArray("Border");
  4724. if (Array.isArray(array) && array.length >= 3) {
  4725. this.borderStyle.setHorizontalCornerRadius(array[0]);
  4726. this.borderStyle.setVerticalCornerRadius(array[1]);
  4727. this.borderStyle.setWidth(array[2], this.rectangle);
  4728. if (array.length === 4) {
  4729. this.borderStyle.setDashArray(array[3], true);
  4730. }
  4731. }
  4732. } else {
  4733. this.borderStyle.setWidth(0);
  4734. }
  4735. }
  4736. setAppearance(dict) {
  4737. this.appearance = null;
  4738. const appearanceStates = dict.get("AP");
  4739. if (!(appearanceStates instanceof _primitives.Dict)) {
  4740. return;
  4741. }
  4742. const normalAppearanceState = appearanceStates.get("N");
  4743. if (normalAppearanceState instanceof _base_stream.BaseStream) {
  4744. this.appearance = normalAppearanceState;
  4745. return;
  4746. }
  4747. if (!(normalAppearanceState instanceof _primitives.Dict)) {
  4748. return;
  4749. }
  4750. const as = dict.get("AS");
  4751. if (!(as instanceof _primitives.Name) || !normalAppearanceState.has(as.name)) {
  4752. return;
  4753. }
  4754. this.appearance = normalAppearanceState.get(as.name);
  4755. }
  4756. setOptionalContent(dict) {
  4757. this.oc = null;
  4758. const oc = dict.get("OC");
  4759. if (oc instanceof _primitives.Name) {
  4760. (0, _util.warn)("setOptionalContent: Support for /Name-entry is not implemented.");
  4761. } else if (oc instanceof _primitives.Dict) {
  4762. this.oc = oc;
  4763. }
  4764. }
  4765. loadResources(keys, appearance) {
  4766. return appearance.dict.getAsync("Resources").then(resources => {
  4767. if (!resources) {
  4768. return undefined;
  4769. }
  4770. const objectLoader = new _object_loader.ObjectLoader(resources, keys, resources.xref);
  4771. return objectLoader.load().then(function () {
  4772. return resources;
  4773. });
  4774. });
  4775. }
  4776. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  4777. const data = this.data;
  4778. let appearance = this.appearance;
  4779. const isUsingOwnCanvas = !!(this.data.hasOwnCanvas && intent & _util.RenderingIntentFlag.DISPLAY);
  4780. if (!appearance) {
  4781. if (!isUsingOwnCanvas) {
  4782. return {
  4783. opList: new _operator_list.OperatorList(),
  4784. separateForm: false,
  4785. separateCanvas: false
  4786. };
  4787. }
  4788. appearance = new _stream.StringStream("");
  4789. appearance.dict = new _primitives.Dict();
  4790. }
  4791. const appearanceDict = appearance.dict;
  4792. const resources = await this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"], appearance);
  4793. const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
  4794. const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
  4795. const transform = getTransformMatrix(data.rect, bbox, matrix);
  4796. const opList = new _operator_list.OperatorList();
  4797. let optionalContent;
  4798. if (this.oc) {
  4799. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  4800. }
  4801. if (optionalContent !== undefined) {
  4802. opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  4803. }
  4804. opList.addOp(_util.OPS.beginAnnotation, [data.id, data.rect, transform, matrix, isUsingOwnCanvas]);
  4805. await evaluator.getOperatorList({
  4806. stream: appearance,
  4807. task,
  4808. resources,
  4809. operatorList: opList,
  4810. fallbackFontDict: this._fallbackFontDict
  4811. });
  4812. opList.addOp(_util.OPS.endAnnotation, []);
  4813. if (optionalContent !== undefined) {
  4814. opList.addOp(_util.OPS.endMarkedContent, []);
  4815. }
  4816. this.reset();
  4817. return {
  4818. opList,
  4819. separateForm: false,
  4820. separateCanvas: isUsingOwnCanvas
  4821. };
  4822. }
  4823. async save(evaluator, task, annotationStorage) {
  4824. return null;
  4825. }
  4826. get hasTextContent() {
  4827. return false;
  4828. }
  4829. async extractTextContent(evaluator, task, viewBox) {
  4830. if (!this.appearance) {
  4831. return;
  4832. }
  4833. const resources = await this.loadResources(["ExtGState", "Font", "Properties", "XObject"], this.appearance);
  4834. const text = [];
  4835. const buffer = [];
  4836. const sink = {
  4837. desiredSize: Math.Infinity,
  4838. ready: true,
  4839. enqueue(chunk, size) {
  4840. for (const item of chunk.items) {
  4841. buffer.push(item.str);
  4842. if (item.hasEOL) {
  4843. text.push(buffer.join(""));
  4844. buffer.length = 0;
  4845. }
  4846. }
  4847. }
  4848. };
  4849. await evaluator.getTextContent({
  4850. stream: this.appearance,
  4851. task,
  4852. resources,
  4853. includeMarkedContent: true,
  4854. combineTextItems: true,
  4855. sink,
  4856. viewBox
  4857. });
  4858. this.reset();
  4859. if (buffer.length) {
  4860. text.push(buffer.join(""));
  4861. }
  4862. if (text.length > 0) {
  4863. this.data.textContent = text;
  4864. }
  4865. }
  4866. getFieldObject() {
  4867. if (this.data.kidIds) {
  4868. return {
  4869. id: this.data.id,
  4870. actions: this.data.actions,
  4871. name: this.data.fieldName,
  4872. strokeColor: this.data.borderColor,
  4873. fillColor: this.data.backgroundColor,
  4874. type: "",
  4875. kidIds: this.data.kidIds,
  4876. page: this.data.pageIndex,
  4877. rotation: this.rotation
  4878. };
  4879. }
  4880. return null;
  4881. }
  4882. reset() {
  4883. for (const stream of this._streams) {
  4884. stream.reset();
  4885. }
  4886. }
  4887. _constructFieldName(dict) {
  4888. if (!dict.has("T") && !dict.has("Parent")) {
  4889. (0, _util.warn)("Unknown field name, falling back to empty field name.");
  4890. return "";
  4891. }
  4892. if (!dict.has("Parent")) {
  4893. return (0, _util.stringToPDFString)(dict.get("T"));
  4894. }
  4895. const fieldName = [];
  4896. if (dict.has("T")) {
  4897. fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
  4898. }
  4899. let loopDict = dict;
  4900. const visited = new _primitives.RefSet();
  4901. if (dict.objId) {
  4902. visited.put(dict.objId);
  4903. }
  4904. while (loopDict.has("Parent")) {
  4905. loopDict = loopDict.get("Parent");
  4906. if (!(loopDict instanceof _primitives.Dict) || loopDict.objId && visited.has(loopDict.objId)) {
  4907. break;
  4908. }
  4909. if (loopDict.objId) {
  4910. visited.put(loopDict.objId);
  4911. }
  4912. if (loopDict.has("T")) {
  4913. fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T")));
  4914. }
  4915. }
  4916. return fieldName.join(".");
  4917. }
  4918. }
  4919. exports.Annotation = Annotation;
  4920. class AnnotationBorderStyle {
  4921. constructor() {
  4922. this.width = 1;
  4923. this.style = _util.AnnotationBorderStyleType.SOLID;
  4924. this.dashArray = [3];
  4925. this.horizontalCornerRadius = 0;
  4926. this.verticalCornerRadius = 0;
  4927. }
  4928. setWidth(width, rect = [0, 0, 0, 0]) {
  4929. if (width instanceof _primitives.Name) {
  4930. this.width = 0;
  4931. return;
  4932. }
  4933. if (typeof width === "number") {
  4934. if (width > 0) {
  4935. const maxWidth = (rect[2] - rect[0]) / 2;
  4936. const maxHeight = (rect[3] - rect[1]) / 2;
  4937. if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
  4938. (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
  4939. width = 1;
  4940. }
  4941. }
  4942. this.width = width;
  4943. }
  4944. }
  4945. setStyle(style) {
  4946. if (!(style instanceof _primitives.Name)) {
  4947. return;
  4948. }
  4949. switch (style.name) {
  4950. case "S":
  4951. this.style = _util.AnnotationBorderStyleType.SOLID;
  4952. break;
  4953. case "D":
  4954. this.style = _util.AnnotationBorderStyleType.DASHED;
  4955. break;
  4956. case "B":
  4957. this.style = _util.AnnotationBorderStyleType.BEVELED;
  4958. break;
  4959. case "I":
  4960. this.style = _util.AnnotationBorderStyleType.INSET;
  4961. break;
  4962. case "U":
  4963. this.style = _util.AnnotationBorderStyleType.UNDERLINE;
  4964. break;
  4965. default:
  4966. break;
  4967. }
  4968. }
  4969. setDashArray(dashArray, forceStyle = false) {
  4970. if (Array.isArray(dashArray) && dashArray.length > 0) {
  4971. let isValid = true;
  4972. let allZeros = true;
  4973. for (const element of dashArray) {
  4974. const validNumber = +element >= 0;
  4975. if (!validNumber) {
  4976. isValid = false;
  4977. break;
  4978. } else if (element > 0) {
  4979. allZeros = false;
  4980. }
  4981. }
  4982. if (isValid && !allZeros) {
  4983. this.dashArray = dashArray;
  4984. if (forceStyle) {
  4985. this.setStyle(_primitives.Name.get("D"));
  4986. }
  4987. } else {
  4988. this.width = 0;
  4989. }
  4990. } else if (dashArray) {
  4991. this.width = 0;
  4992. }
  4993. }
  4994. setHorizontalCornerRadius(radius) {
  4995. if (Number.isInteger(radius)) {
  4996. this.horizontalCornerRadius = radius;
  4997. }
  4998. }
  4999. setVerticalCornerRadius(radius) {
  5000. if (Number.isInteger(radius)) {
  5001. this.verticalCornerRadius = radius;
  5002. }
  5003. }
  5004. }
  5005. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  5006. class MarkupAnnotation extends Annotation {
  5007. constructor(params) {
  5008. super(params);
  5009. const {
  5010. dict
  5011. } = params;
  5012. if (dict.has("IRT")) {
  5013. const rawIRT = dict.getRaw("IRT");
  5014. this.data.inReplyTo = rawIRT instanceof _primitives.Ref ? rawIRT.toString() : null;
  5015. const rt = dict.get("RT");
  5016. this.data.replyType = rt instanceof _primitives.Name ? rt.name : _util.AnnotationReplyType.REPLY;
  5017. }
  5018. if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
  5019. const parent = dict.get("IRT");
  5020. this.setTitle(parent.get("T"));
  5021. this.data.titleObj = this._title;
  5022. this.setContents(parent.get("Contents"));
  5023. this.data.contentsObj = this._contents;
  5024. if (!parent.has("CreationDate")) {
  5025. this.data.creationDate = null;
  5026. } else {
  5027. this.setCreationDate(parent.get("CreationDate"));
  5028. this.data.creationDate = this.creationDate;
  5029. }
  5030. if (!parent.has("M")) {
  5031. this.data.modificationDate = null;
  5032. } else {
  5033. this.setModificationDate(parent.get("M"));
  5034. this.data.modificationDate = this.modificationDate;
  5035. }
  5036. this.data.hasPopup = parent.has("Popup");
  5037. if (!parent.has("C")) {
  5038. this.data.color = null;
  5039. } else {
  5040. this.setColor(parent.getArray("C"));
  5041. this.data.color = this.color;
  5042. }
  5043. } else {
  5044. this.data.titleObj = this._title;
  5045. this.setCreationDate(dict.get("CreationDate"));
  5046. this.data.creationDate = this.creationDate;
  5047. this.data.hasPopup = dict.has("Popup");
  5048. if (!dict.has("C")) {
  5049. this.data.color = null;
  5050. }
  5051. }
  5052. if (dict.has("RC")) {
  5053. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(dict.get("RC"));
  5054. }
  5055. }
  5056. setCreationDate(creationDate) {
  5057. this.creationDate = typeof creationDate === "string" ? creationDate : null;
  5058. }
  5059. _setDefaultAppearance({
  5060. xref,
  5061. extra,
  5062. strokeColor,
  5063. fillColor,
  5064. blendMode,
  5065. strokeAlpha,
  5066. fillAlpha,
  5067. pointsCallback
  5068. }) {
  5069. let minX = Number.MAX_VALUE;
  5070. let minY = Number.MAX_VALUE;
  5071. let maxX = Number.MIN_VALUE;
  5072. let maxY = Number.MIN_VALUE;
  5073. const buffer = ["q"];
  5074. if (extra) {
  5075. buffer.push(extra);
  5076. }
  5077. if (strokeColor) {
  5078. buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`);
  5079. }
  5080. if (fillColor) {
  5081. buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
  5082. }
  5083. let pointsArray = this.data.quadPoints;
  5084. if (!pointsArray) {
  5085. pointsArray = [[{
  5086. x: this.rectangle[0],
  5087. y: this.rectangle[3]
  5088. }, {
  5089. x: this.rectangle[2],
  5090. y: this.rectangle[3]
  5091. }, {
  5092. x: this.rectangle[0],
  5093. y: this.rectangle[1]
  5094. }, {
  5095. x: this.rectangle[2],
  5096. y: this.rectangle[1]
  5097. }]];
  5098. }
  5099. for (const points of pointsArray) {
  5100. const [mX, MX, mY, MY] = pointsCallback(buffer, points);
  5101. minX = Math.min(minX, mX);
  5102. maxX = Math.max(maxX, MX);
  5103. minY = Math.min(minY, mY);
  5104. maxY = Math.max(maxY, MY);
  5105. }
  5106. buffer.push("Q");
  5107. const formDict = new _primitives.Dict(xref);
  5108. const appearanceStreamDict = new _primitives.Dict(xref);
  5109. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  5110. const appearanceStream = new _stream.StringStream(buffer.join(" "));
  5111. appearanceStream.dict = appearanceStreamDict;
  5112. formDict.set("Fm0", appearanceStream);
  5113. const gsDict = new _primitives.Dict(xref);
  5114. if (blendMode) {
  5115. gsDict.set("BM", _primitives.Name.get(blendMode));
  5116. }
  5117. if (typeof strokeAlpha === "number") {
  5118. gsDict.set("CA", strokeAlpha);
  5119. }
  5120. if (typeof fillAlpha === "number") {
  5121. gsDict.set("ca", fillAlpha);
  5122. }
  5123. const stateDict = new _primitives.Dict(xref);
  5124. stateDict.set("GS0", gsDict);
  5125. const resources = new _primitives.Dict(xref);
  5126. resources.set("ExtGState", stateDict);
  5127. resources.set("XObject", formDict);
  5128. const appearanceDict = new _primitives.Dict(xref);
  5129. appearanceDict.set("Resources", resources);
  5130. const bbox = this.data.rect = [minX, minY, maxX, maxY];
  5131. appearanceDict.set("BBox", bbox);
  5132. this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do");
  5133. this.appearance.dict = appearanceDict;
  5134. this._streams.push(this.appearance, appearanceStream);
  5135. }
  5136. static async createNewAnnotation(xref, annotation, dependencies, params) {
  5137. const annotationRef = xref.getNewTemporaryRef();
  5138. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  5139. const buffer = [];
  5140. let annotationDict;
  5141. if (ap) {
  5142. const apRef = xref.getNewTemporaryRef();
  5143. annotationDict = this.createNewDict(annotation, xref, {
  5144. apRef
  5145. });
  5146. const transform = xref.encrypt ? xref.encrypt.createCipherTransform(apRef.num, apRef.gen) : null;
  5147. (0, _writer.writeObject)(apRef, ap, buffer, transform);
  5148. dependencies.push({
  5149. ref: apRef,
  5150. data: buffer.join("")
  5151. });
  5152. } else {
  5153. annotationDict = this.createNewDict(annotation, xref, {});
  5154. }
  5155. buffer.length = 0;
  5156. const transform = xref.encrypt ? xref.encrypt.createCipherTransform(annotationRef.num, annotationRef.gen) : null;
  5157. (0, _writer.writeObject)(annotationRef, annotationDict, buffer, transform);
  5158. return {
  5159. ref: annotationRef,
  5160. data: buffer.join("")
  5161. };
  5162. }
  5163. static async createNewPrintAnnotation(xref, annotation, params) {
  5164. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  5165. const annotationDict = this.createNewDict(annotation, xref, {
  5166. ap
  5167. });
  5168. return new this.prototype.constructor({
  5169. dict: annotationDict,
  5170. xref,
  5171. isOffscreenCanvasSupported: params.isOffscreenCanvasSupported
  5172. });
  5173. }
  5174. }
  5175. exports.MarkupAnnotation = MarkupAnnotation;
  5176. class WidgetAnnotation extends Annotation {
  5177. constructor(params) {
  5178. super(params);
  5179. const {
  5180. dict,
  5181. xref
  5182. } = params;
  5183. const data = this.data;
  5184. this.ref = params.ref;
  5185. this._needAppearances = params.needAppearances;
  5186. data.annotationType = _util.AnnotationType.WIDGET;
  5187. if (data.fieldName === undefined) {
  5188. data.fieldName = this._constructFieldName(dict);
  5189. }
  5190. if (data.actions === undefined) {
  5191. data.actions = (0, _core_utils.collectActions)(xref, dict, _util.AnnotationActionEventType);
  5192. }
  5193. let fieldValue = (0, _core_utils.getInheritableProperty)({
  5194. dict,
  5195. key: "V",
  5196. getArray: true
  5197. });
  5198. data.fieldValue = this._decodeFormValue(fieldValue);
  5199. const defaultFieldValue = (0, _core_utils.getInheritableProperty)({
  5200. dict,
  5201. key: "DV",
  5202. getArray: true
  5203. });
  5204. data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
  5205. if (fieldValue === undefined && params.xfaDatasets) {
  5206. const path = this._title.str;
  5207. if (path) {
  5208. this._hasValueFromXFA = true;
  5209. data.fieldValue = fieldValue = params.xfaDatasets.getValue(path);
  5210. }
  5211. }
  5212. if (fieldValue === undefined && data.defaultFieldValue !== null) {
  5213. data.fieldValue = data.defaultFieldValue;
  5214. }
  5215. data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || "");
  5216. this.setDefaultAppearance(params);
  5217. data.hasAppearance = this._needAppearances && data.fieldValue !== undefined && data.fieldValue !== null || data.hasAppearance;
  5218. const fieldType = (0, _core_utils.getInheritableProperty)({
  5219. dict,
  5220. key: "FT"
  5221. });
  5222. data.fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  5223. const localResources = (0, _core_utils.getInheritableProperty)({
  5224. dict,
  5225. key: "DR"
  5226. });
  5227. const acroFormResources = params.acroForm.get("DR");
  5228. const appearanceResources = this.appearance && this.appearance.dict.get("Resources");
  5229. this._fieldResources = {
  5230. localResources,
  5231. acroFormResources,
  5232. appearanceResources,
  5233. mergedResources: _primitives.Dict.merge({
  5234. xref,
  5235. dictArray: [localResources, appearanceResources, acroFormResources],
  5236. mergeSubDicts: true
  5237. })
  5238. };
  5239. data.fieldFlags = (0, _core_utils.getInheritableProperty)({
  5240. dict,
  5241. key: "Ff"
  5242. });
  5243. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  5244. data.fieldFlags = 0;
  5245. }
  5246. data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
  5247. data.required = this.hasFieldFlag(_util.AnnotationFieldFlag.REQUIRED);
  5248. data.hidden = this._hasFlag(data.annotationFlags, _util.AnnotationFlag.HIDDEN);
  5249. }
  5250. _decodeFormValue(formValue) {
  5251. if (Array.isArray(formValue)) {
  5252. return formValue.filter(item => typeof item === "string").map(item => (0, _util.stringToPDFString)(item));
  5253. } else if (formValue instanceof _primitives.Name) {
  5254. return (0, _util.stringToPDFString)(formValue.name);
  5255. } else if (typeof formValue === "string") {
  5256. return (0, _util.stringToPDFString)(formValue);
  5257. }
  5258. return null;
  5259. }
  5260. hasFieldFlag(flag) {
  5261. return !!(this.data.fieldFlags & flag);
  5262. }
  5263. getRotationMatrix(annotationStorage) {
  5264. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  5265. let rotation = storageEntry && storageEntry.rotation;
  5266. if (rotation === undefined) {
  5267. rotation = this.rotation;
  5268. }
  5269. if (rotation === 0) {
  5270. return _util.IDENTITY_MATRIX;
  5271. }
  5272. const width = this.data.rect[2] - this.data.rect[0];
  5273. const height = this.data.rect[3] - this.data.rect[1];
  5274. return (0, _core_utils.getRotationMatrix)(rotation, width, height);
  5275. }
  5276. getBorderAndBackgroundAppearances(annotationStorage) {
  5277. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  5278. let rotation = storageEntry && storageEntry.rotation;
  5279. if (rotation === undefined) {
  5280. rotation = this.rotation;
  5281. }
  5282. if (!this.backgroundColor && !this.borderColor) {
  5283. return "";
  5284. }
  5285. const width = this.data.rect[2] - this.data.rect[0];
  5286. const height = this.data.rect[3] - this.data.rect[1];
  5287. const rect = rotation === 0 || rotation === 180 ? `0 0 ${width} ${height} re` : `0 0 ${height} ${width} re`;
  5288. let str = "";
  5289. if (this.backgroundColor) {
  5290. str = `${(0, _default_appearance.getPdfColor)(this.backgroundColor, true)} ${rect} f `;
  5291. }
  5292. if (this.borderColor) {
  5293. const borderWidth = this.borderStyle.width || 1;
  5294. str += `${borderWidth} w ${(0, _default_appearance.getPdfColor)(this.borderColor, false)} ${rect} S `;
  5295. }
  5296. return str;
  5297. }
  5298. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  5299. if (renderForms && !(this instanceof SignatureWidgetAnnotation)) {
  5300. return {
  5301. opList: new _operator_list.OperatorList(),
  5302. separateForm: true,
  5303. separateCanvas: false
  5304. };
  5305. }
  5306. if (!this._hasText) {
  5307. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  5308. }
  5309. const content = await this._getAppearance(evaluator, task, intent, annotationStorage);
  5310. if (this.appearance && content === null) {
  5311. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  5312. }
  5313. const opList = new _operator_list.OperatorList();
  5314. if (!this._defaultAppearance || content === null) {
  5315. return {
  5316. opList,
  5317. separateForm: false,
  5318. separateCanvas: false
  5319. };
  5320. }
  5321. const matrix = [1, 0, 0, 1, 0, 0];
  5322. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  5323. const transform = getTransformMatrix(this.data.rect, bbox, matrix);
  5324. let optionalContent;
  5325. if (this.oc) {
  5326. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  5327. }
  5328. if (optionalContent !== undefined) {
  5329. opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  5330. }
  5331. opList.addOp(_util.OPS.beginAnnotation, [this.data.id, this.data.rect, transform, this.getRotationMatrix(annotationStorage), false]);
  5332. const stream = new _stream.StringStream(content);
  5333. await evaluator.getOperatorList({
  5334. stream,
  5335. task,
  5336. resources: this._fieldResources.mergedResources,
  5337. operatorList: opList
  5338. });
  5339. opList.addOp(_util.OPS.endAnnotation, []);
  5340. if (optionalContent !== undefined) {
  5341. opList.addOp(_util.OPS.endMarkedContent, []);
  5342. }
  5343. return {
  5344. opList,
  5345. separateForm: false,
  5346. separateCanvas: false
  5347. };
  5348. }
  5349. _getMKDict(rotation) {
  5350. const mk = new _primitives.Dict(null);
  5351. if (rotation) {
  5352. mk.set("R", rotation);
  5353. }
  5354. if (this.borderColor) {
  5355. mk.set("BC", getPdfColorArray(this.borderColor));
  5356. }
  5357. if (this.backgroundColor) {
  5358. mk.set("BG", getPdfColorArray(this.backgroundColor));
  5359. }
  5360. return mk.size > 0 ? mk : null;
  5361. }
  5362. async save(evaluator, task, annotationStorage) {
  5363. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  5364. let value = storageEntry && storageEntry.value;
  5365. let rotation = storageEntry && storageEntry.rotation;
  5366. if (value === this.data.fieldValue || value === undefined) {
  5367. if (!this._hasValueFromXFA && rotation === undefined) {
  5368. return null;
  5369. }
  5370. value = value || this.data.fieldValue;
  5371. }
  5372. if (rotation === undefined && !this._hasValueFromXFA && Array.isArray(value) && Array.isArray(this.data.fieldValue) && value.length === this.data.fieldValue.length && value.every((x, i) => x === this.data.fieldValue[i])) {
  5373. return null;
  5374. }
  5375. if (rotation === undefined) {
  5376. rotation = this.rotation;
  5377. }
  5378. let appearance = null;
  5379. if (!this._needAppearances) {
  5380. appearance = await this._getAppearance(evaluator, task, _util.RenderingIntentFlag.SAVE, annotationStorage);
  5381. if (appearance === null) {
  5382. return null;
  5383. }
  5384. } else {}
  5385. let needAppearances = false;
  5386. if (appearance && appearance.needAppearances) {
  5387. needAppearances = true;
  5388. appearance = null;
  5389. }
  5390. const {
  5391. xref
  5392. } = evaluator;
  5393. const originalDict = xref.fetchIfRef(this.ref);
  5394. if (!(originalDict instanceof _primitives.Dict)) {
  5395. return null;
  5396. }
  5397. const dict = new _primitives.Dict(xref);
  5398. for (const key of originalDict.getKeys()) {
  5399. if (key !== "AP") {
  5400. dict.set(key, originalDict.getRaw(key));
  5401. }
  5402. }
  5403. const xfa = {
  5404. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  5405. value
  5406. };
  5407. const encoder = val => {
  5408. return (0, _core_utils.isAscii)(val) ? val : (0, _core_utils.stringToUTF16String)(val, true);
  5409. };
  5410. dict.set("V", Array.isArray(value) ? value.map(encoder) : encoder(value));
  5411. const maybeMK = this._getMKDict(rotation);
  5412. if (maybeMK) {
  5413. dict.set("MK", maybeMK);
  5414. }
  5415. const encrypt = xref.encrypt;
  5416. const originalTransform = encrypt ? encrypt.createCipherTransform(this.ref.num, this.ref.gen) : null;
  5417. const buffer = [];
  5418. const changes = [{
  5419. ref: this.ref,
  5420. data: "",
  5421. xfa,
  5422. needAppearances
  5423. }];
  5424. if (appearance !== null) {
  5425. const newRef = xref.getNewTemporaryRef();
  5426. const AP = new _primitives.Dict(xref);
  5427. dict.set("AP", AP);
  5428. AP.set("N", newRef);
  5429. let newTransform = null;
  5430. if (encrypt) {
  5431. newTransform = encrypt.createCipherTransform(newRef.num, newRef.gen);
  5432. appearance = newTransform.encryptString(appearance);
  5433. }
  5434. const resources = this._getSaveFieldResources(xref);
  5435. const appearanceStream = new _stream.StringStream(appearance);
  5436. const appearanceDict = appearanceStream.dict = new _primitives.Dict(xref);
  5437. appearanceDict.set("Length", appearance.length);
  5438. appearanceDict.set("Subtype", _primitives.Name.get("Form"));
  5439. appearanceDict.set("Resources", resources);
  5440. appearanceDict.set("BBox", [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]]);
  5441. const rotationMatrix = this.getRotationMatrix(annotationStorage);
  5442. if (rotationMatrix !== _util.IDENTITY_MATRIX) {
  5443. appearanceDict.set("Matrix", rotationMatrix);
  5444. }
  5445. (0, _writer.writeObject)(newRef, appearanceStream, buffer, newTransform);
  5446. changes.push({
  5447. ref: newRef,
  5448. data: buffer.join(""),
  5449. xfa: null,
  5450. needAppearances: false
  5451. });
  5452. buffer.length = 0;
  5453. }
  5454. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  5455. (0, _writer.writeObject)(this.ref, dict, buffer, originalTransform);
  5456. changes[0].data = buffer.join("");
  5457. return changes;
  5458. }
  5459. async _getAppearance(evaluator, task, intent, annotationStorage) {
  5460. const isPassword = this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD);
  5461. if (isPassword) {
  5462. return null;
  5463. }
  5464. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  5465. let value, rotation;
  5466. if (storageEntry) {
  5467. value = storageEntry.formattedValue || storageEntry.value;
  5468. rotation = storageEntry.rotation;
  5469. }
  5470. if (rotation === undefined && value === undefined && !this._needAppearances) {
  5471. if (!this._hasValueFromXFA || this.appearance) {
  5472. return null;
  5473. }
  5474. }
  5475. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  5476. if (value === undefined) {
  5477. value = this.data.fieldValue;
  5478. if (!value) {
  5479. return `/Tx BMC q ${colors}Q EMC`;
  5480. }
  5481. }
  5482. if (Array.isArray(value) && value.length === 1) {
  5483. value = value[0];
  5484. }
  5485. (0, _util.assert)(typeof value === "string", "Expected `value` to be a string.");
  5486. if (!this.data.combo) {
  5487. value = value.trim();
  5488. } else {
  5489. const option = this.data.options.find(({
  5490. exportValue
  5491. }) => value === exportValue) || this.data.options[0];
  5492. value = option && option.displayValue || "";
  5493. }
  5494. if (value === "") {
  5495. return `/Tx BMC q ${colors}Q EMC`;
  5496. }
  5497. if (rotation === undefined) {
  5498. rotation = this.rotation;
  5499. }
  5500. let lineCount = -1;
  5501. let lines;
  5502. if (this.data.multiLine) {
  5503. lines = value.split(/\r\n?|\n/).map(line => line.normalize("NFC"));
  5504. lineCount = lines.length;
  5505. } else {
  5506. lines = [value.replace(/\r\n?|\n/, "").normalize("NFC")];
  5507. }
  5508. const defaultPadding = 1;
  5509. const defaultHPadding = 2;
  5510. let totalHeight = this.data.rect[3] - this.data.rect[1];
  5511. let totalWidth = this.data.rect[2] - this.data.rect[0];
  5512. if (rotation === 90 || rotation === 270) {
  5513. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  5514. }
  5515. if (!this._defaultAppearance) {
  5516. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  5517. }
  5518. let font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  5519. let defaultAppearance, fontSize, lineHeight;
  5520. const encodedLines = [];
  5521. let encodingError = false;
  5522. for (const line of lines) {
  5523. const encodedString = font.encodeString(line);
  5524. if (encodedString.length > 1) {
  5525. encodingError = true;
  5526. }
  5527. encodedLines.push(encodedString.join(""));
  5528. }
  5529. if (encodingError && intent & _util.RenderingIntentFlag.SAVE) {
  5530. return {
  5531. needAppearances: true
  5532. };
  5533. }
  5534. if (encodingError && this._isOffscreenCanvasSupported) {
  5535. const fontFamily = this.data.comb ? "monospace" : "sans-serif";
  5536. const fakeUnicodeFont = new _default_appearance.FakeUnicodeFont(evaluator.xref, fontFamily);
  5537. const resources = fakeUnicodeFont.createFontResources(lines.join(""));
  5538. const newFont = resources.getRaw("Font");
  5539. if (this._fieldResources.mergedResources.has("Font")) {
  5540. const oldFont = this._fieldResources.mergedResources.get("Font");
  5541. for (const key of newFont.getKeys()) {
  5542. oldFont.set(key, newFont.getRaw(key));
  5543. }
  5544. } else {
  5545. this._fieldResources.mergedResources.set("Font", newFont);
  5546. }
  5547. const fontName = fakeUnicodeFont.fontName.name;
  5548. font = await WidgetAnnotation._getFontData(evaluator, task, {
  5549. fontName,
  5550. fontSize: 0
  5551. }, resources);
  5552. for (let i = 0, ii = encodedLines.length; i < ii; i++) {
  5553. encodedLines[i] = (0, _core_utils.stringToUTF16String)(lines[i]);
  5554. }
  5555. const savedDefaultAppearance = Object.assign(Object.create(null), this.data.defaultAppearanceData);
  5556. this.data.defaultAppearanceData.fontSize = 0;
  5557. this.data.defaultAppearanceData.fontName = fontName;
  5558. [defaultAppearance, fontSize, lineHeight] = this._computeFontSize(totalHeight - 2 * defaultPadding, totalWidth - 2 * defaultHPadding, value, font, lineCount);
  5559. this.data.defaultAppearanceData = savedDefaultAppearance;
  5560. } else {
  5561. if (!this._isOffscreenCanvasSupported) {
  5562. (0, _util.warn)("_getAppearance: OffscreenCanvas is not supported, annotation may not render correctly.");
  5563. }
  5564. [defaultAppearance, fontSize, lineHeight] = this._computeFontSize(totalHeight - 2 * defaultPadding, totalWidth - 2 * defaultHPadding, value, font, lineCount);
  5565. }
  5566. let descent = font.descent;
  5567. if (isNaN(descent)) {
  5568. descent = _util.BASELINE_FACTOR * lineHeight;
  5569. } else {
  5570. descent = Math.max(_util.BASELINE_FACTOR * lineHeight, Math.abs(descent) * fontSize);
  5571. }
  5572. const defaultVPadding = Math.min(Math.floor((totalHeight - fontSize) / 2), defaultPadding);
  5573. const alignment = this.data.textAlignment;
  5574. if (this.data.multiLine) {
  5575. return this._getMultilineAppearance(defaultAppearance, encodedLines, font, fontSize, totalWidth, totalHeight, alignment, defaultHPadding, defaultVPadding, descent, lineHeight, annotationStorage);
  5576. }
  5577. if (this.data.comb) {
  5578. return this._getCombAppearance(defaultAppearance, font, encodedLines[0], fontSize, totalWidth, totalHeight, defaultHPadding, defaultVPadding, descent, lineHeight, annotationStorage);
  5579. }
  5580. const bottomPadding = defaultVPadding + descent;
  5581. if (alignment === 0 || alignment > 2) {
  5582. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${(0, _core_utils.numberToString)(defaultHPadding)} ${(0, _core_utils.numberToString)(bottomPadding)} Tm (${(0, _core_utils.escapeString)(encodedLines[0])}) Tj` + " ET Q EMC";
  5583. }
  5584. const prevInfo = {
  5585. shift: 0
  5586. };
  5587. const renderedText = this._renderText(encodedLines[0], font, fontSize, totalWidth, alignment, prevInfo, defaultHPadding, bottomPadding);
  5588. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC";
  5589. }
  5590. static async _getFontData(evaluator, task, appearanceData, resources) {
  5591. const operatorList = new _operator_list.OperatorList();
  5592. const initialState = {
  5593. font: null,
  5594. clone() {
  5595. return this;
  5596. }
  5597. };
  5598. const {
  5599. fontName,
  5600. fontSize
  5601. } = appearanceData;
  5602. await evaluator.handleSetFont(resources, [fontName && _primitives.Name.get(fontName), fontSize], null, operatorList, task, initialState, null);
  5603. return initialState.font;
  5604. }
  5605. _getTextWidth(text, font) {
  5606. return font.charsToGlyphs(text).reduce((width, glyph) => width + glyph.width, 0) / 1000;
  5607. }
  5608. _computeFontSize(height, width, text, font, lineCount) {
  5609. let {
  5610. fontSize
  5611. } = this.data.defaultAppearanceData;
  5612. let lineHeight = (fontSize || 12) * _util.LINE_FACTOR,
  5613. numberOfLines = Math.round(height / lineHeight);
  5614. if (!fontSize) {
  5615. const roundWithTwoDigits = x => Math.floor(x * 100) / 100;
  5616. if (lineCount === -1) {
  5617. const textWidth = this._getTextWidth(text, font);
  5618. fontSize = roundWithTwoDigits(Math.min(height / _util.LINE_FACTOR, textWidth > width ? width / textWidth : Infinity));
  5619. numberOfLines = 1;
  5620. } else {
  5621. const lines = text.split(/\r\n?|\n/);
  5622. const cachedLines = [];
  5623. for (const line of lines) {
  5624. const encoded = font.encodeString(line).join("");
  5625. const glyphs = font.charsToGlyphs(encoded);
  5626. const positions = font.getCharPositions(encoded);
  5627. cachedLines.push({
  5628. line: encoded,
  5629. glyphs,
  5630. positions
  5631. });
  5632. }
  5633. const isTooBig = fsize => {
  5634. let totalHeight = 0;
  5635. for (const cache of cachedLines) {
  5636. const chunks = this._splitLine(null, font, fsize, width, cache);
  5637. totalHeight += chunks.length * fsize;
  5638. if (totalHeight > height) {
  5639. return true;
  5640. }
  5641. }
  5642. return false;
  5643. };
  5644. numberOfLines = Math.max(numberOfLines, lineCount);
  5645. while (true) {
  5646. lineHeight = height / numberOfLines;
  5647. fontSize = roundWithTwoDigits(lineHeight / _util.LINE_FACTOR);
  5648. if (isTooBig(fontSize)) {
  5649. numberOfLines++;
  5650. continue;
  5651. }
  5652. break;
  5653. }
  5654. }
  5655. const {
  5656. fontName,
  5657. fontColor
  5658. } = this.data.defaultAppearanceData;
  5659. this._defaultAppearance = (0, _default_appearance.createDefaultAppearance)({
  5660. fontSize,
  5661. fontName,
  5662. fontColor
  5663. });
  5664. }
  5665. return [this._defaultAppearance, fontSize, height / numberOfLines];
  5666. }
  5667. _renderText(text, font, fontSize, totalWidth, alignment, prevInfo, hPadding, vPadding) {
  5668. let shift;
  5669. if (alignment === 1) {
  5670. const width = this._getTextWidth(text, font) * fontSize;
  5671. shift = (totalWidth - width) / 2;
  5672. } else if (alignment === 2) {
  5673. const width = this._getTextWidth(text, font) * fontSize;
  5674. shift = totalWidth - width - hPadding;
  5675. } else {
  5676. shift = hPadding;
  5677. }
  5678. const shiftStr = (0, _core_utils.numberToString)(shift - prevInfo.shift);
  5679. prevInfo.shift = shift;
  5680. vPadding = (0, _core_utils.numberToString)(vPadding);
  5681. return `${shiftStr} ${vPadding} Td (${(0, _core_utils.escapeString)(text)}) Tj`;
  5682. }
  5683. _getSaveFieldResources(xref) {
  5684. const {
  5685. localResources,
  5686. appearanceResources,
  5687. acroFormResources
  5688. } = this._fieldResources;
  5689. const fontName = this.data.defaultAppearanceData && this.data.defaultAppearanceData.fontName;
  5690. if (!fontName) {
  5691. return localResources || _primitives.Dict.empty;
  5692. }
  5693. for (const resources of [localResources, appearanceResources]) {
  5694. if (resources instanceof _primitives.Dict) {
  5695. const localFont = resources.get("Font");
  5696. if (localFont instanceof _primitives.Dict && localFont.has(fontName)) {
  5697. return resources;
  5698. }
  5699. }
  5700. }
  5701. if (acroFormResources instanceof _primitives.Dict) {
  5702. const acroFormFont = acroFormResources.get("Font");
  5703. if (acroFormFont instanceof _primitives.Dict && acroFormFont.has(fontName)) {
  5704. const subFontDict = new _primitives.Dict(xref);
  5705. subFontDict.set(fontName, acroFormFont.getRaw(fontName));
  5706. const subResourcesDict = new _primitives.Dict(xref);
  5707. subResourcesDict.set("Font", subFontDict);
  5708. return _primitives.Dict.merge({
  5709. xref,
  5710. dictArray: [subResourcesDict, localResources],
  5711. mergeSubDicts: true
  5712. });
  5713. }
  5714. }
  5715. return localResources || _primitives.Dict.empty;
  5716. }
  5717. getFieldObject() {
  5718. return null;
  5719. }
  5720. }
  5721. class TextWidgetAnnotation extends WidgetAnnotation {
  5722. constructor(params) {
  5723. super(params);
  5724. this._hasText = true;
  5725. const dict = params.dict;
  5726. if (typeof this.data.fieldValue !== "string") {
  5727. this.data.fieldValue = "";
  5728. }
  5729. let alignment = (0, _core_utils.getInheritableProperty)({
  5730. dict,
  5731. key: "Q"
  5732. });
  5733. if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
  5734. alignment = null;
  5735. }
  5736. this.data.textAlignment = alignment;
  5737. let maximumLength = (0, _core_utils.getInheritableProperty)({
  5738. dict,
  5739. key: "MaxLen"
  5740. });
  5741. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  5742. maximumLength = 0;
  5743. }
  5744. this.data.maxLen = maximumLength;
  5745. this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
  5746. this.data.comb = this.hasFieldFlag(_util.AnnotationFieldFlag.COMB) && !this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(_util.AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== 0;
  5747. this.data.doNotScroll = this.hasFieldFlag(_util.AnnotationFieldFlag.DONOTSCROLL);
  5748. }
  5749. _getCombAppearance(defaultAppearance, font, text, fontSize, width, height, hPadding, vPadding, descent, lineHeight, annotationStorage) {
  5750. const combWidth = width / this.data.maxLen;
  5751. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  5752. const buf = [];
  5753. const positions = font.getCharPositions(text);
  5754. for (const [start, end] of positions) {
  5755. buf.push(`(${(0, _core_utils.escapeString)(text.substring(start, end))}) Tj`);
  5756. }
  5757. const renderedComb = buf.join(` ${(0, _core_utils.numberToString)(combWidth)} 0 Td `);
  5758. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${(0, _core_utils.numberToString)(hPadding)} ${(0, _core_utils.numberToString)(vPadding + descent)} Tm ${renderedComb}` + " ET Q EMC";
  5759. }
  5760. _getMultilineAppearance(defaultAppearance, lines, font, fontSize, width, height, alignment, hPadding, vPadding, descent, lineHeight, annotationStorage) {
  5761. const buf = [];
  5762. const totalWidth = width - 2 * hPadding;
  5763. const prevInfo = {
  5764. shift: 0
  5765. };
  5766. for (let i = 0, ii = lines.length; i < ii; i++) {
  5767. const line = lines[i];
  5768. const chunks = this._splitLine(line, font, fontSize, totalWidth);
  5769. for (let j = 0, jj = chunks.length; j < jj; j++) {
  5770. const chunk = chunks[j];
  5771. const vShift = i === 0 && j === 0 ? -vPadding - (lineHeight - descent) : -lineHeight;
  5772. buf.push(this._renderText(chunk, font, fontSize, width, alignment, prevInfo, hPadding, vShift));
  5773. }
  5774. }
  5775. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  5776. const renderedText = buf.join("\n");
  5777. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 ${(0, _core_utils.numberToString)(height)} Tm ${renderedText}` + " ET Q EMC";
  5778. }
  5779. _splitLine(line, font, fontSize, width, cache = {}) {
  5780. line = cache.line || line;
  5781. const glyphs = cache.glyphs || font.charsToGlyphs(line);
  5782. if (glyphs.length <= 1) {
  5783. return [line];
  5784. }
  5785. const positions = cache.positions || font.getCharPositions(line);
  5786. const scale = fontSize / 1000;
  5787. const chunks = [];
  5788. let lastSpacePosInStringStart = -1,
  5789. lastSpacePosInStringEnd = -1,
  5790. lastSpacePos = -1,
  5791. startChunk = 0,
  5792. currentWidth = 0;
  5793. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  5794. const [start, end] = positions[i];
  5795. const glyph = glyphs[i];
  5796. const glyphWidth = glyph.width * scale;
  5797. if (glyph.unicode === " ") {
  5798. if (currentWidth + glyphWidth > width) {
  5799. chunks.push(line.substring(startChunk, start));
  5800. startChunk = start;
  5801. currentWidth = glyphWidth;
  5802. lastSpacePosInStringStart = -1;
  5803. lastSpacePos = -1;
  5804. } else {
  5805. currentWidth += glyphWidth;
  5806. lastSpacePosInStringStart = start;
  5807. lastSpacePosInStringEnd = end;
  5808. lastSpacePos = i;
  5809. }
  5810. } else {
  5811. if (currentWidth + glyphWidth > width) {
  5812. if (lastSpacePosInStringStart !== -1) {
  5813. chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
  5814. startChunk = lastSpacePosInStringEnd;
  5815. i = lastSpacePos + 1;
  5816. lastSpacePosInStringStart = -1;
  5817. currentWidth = 0;
  5818. } else {
  5819. chunks.push(line.substring(startChunk, start));
  5820. startChunk = start;
  5821. currentWidth = glyphWidth;
  5822. }
  5823. } else {
  5824. currentWidth += glyphWidth;
  5825. }
  5826. }
  5827. }
  5828. if (startChunk < line.length) {
  5829. chunks.push(line.substring(startChunk, line.length));
  5830. }
  5831. return chunks;
  5832. }
  5833. getFieldObject() {
  5834. return {
  5835. id: this.data.id,
  5836. value: this.data.fieldValue,
  5837. defaultValue: this.data.defaultFieldValue || "",
  5838. multiline: this.data.multiLine,
  5839. password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD),
  5840. charLimit: this.data.maxLen,
  5841. comb: this.data.comb,
  5842. editable: !this.data.readOnly,
  5843. hidden: this.data.hidden,
  5844. name: this.data.fieldName,
  5845. rect: this.data.rect,
  5846. actions: this.data.actions,
  5847. page: this.data.pageIndex,
  5848. strokeColor: this.data.borderColor,
  5849. fillColor: this.data.backgroundColor,
  5850. rotation: this.rotation,
  5851. type: "text"
  5852. };
  5853. }
  5854. }
  5855. class ButtonWidgetAnnotation extends WidgetAnnotation {
  5856. constructor(params) {
  5857. super(params);
  5858. this.checkedAppearance = null;
  5859. this.uncheckedAppearance = null;
  5860. this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  5861. this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  5862. this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  5863. this.data.isTooltipOnly = false;
  5864. if (this.data.checkBox) {
  5865. this._processCheckBox(params);
  5866. } else if (this.data.radioButton) {
  5867. this._processRadioButton(params);
  5868. } else if (this.data.pushButton) {
  5869. this.data.hasOwnCanvas = true;
  5870. this._processPushButton(params);
  5871. } else {
  5872. (0, _util.warn)("Invalid field flags for button widget annotation");
  5873. }
  5874. }
  5875. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  5876. if (this.data.pushButton) {
  5877. return super.getOperatorList(evaluator, task, intent, false, annotationStorage);
  5878. }
  5879. let value = null;
  5880. let rotation = null;
  5881. if (annotationStorage) {
  5882. const storageEntry = annotationStorage.get(this.data.id);
  5883. value = storageEntry ? storageEntry.value : null;
  5884. rotation = storageEntry ? storageEntry.rotation : null;
  5885. }
  5886. if (value === null && this.appearance) {
  5887. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  5888. }
  5889. if (value === null || value === undefined) {
  5890. if (this.data.checkBox) {
  5891. value = this.data.fieldValue === this.data.exportValue;
  5892. } else {
  5893. value = this.data.fieldValue === this.data.buttonValue;
  5894. }
  5895. }
  5896. const appearance = value ? this.checkedAppearance : this.uncheckedAppearance;
  5897. if (appearance) {
  5898. const savedAppearance = this.appearance;
  5899. const savedMatrix = appearance.dict.getArray("Matrix") || _util.IDENTITY_MATRIX;
  5900. if (rotation) {
  5901. appearance.dict.set("Matrix", this.getRotationMatrix(annotationStorage));
  5902. }
  5903. this.appearance = appearance;
  5904. const operatorList = super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  5905. this.appearance = savedAppearance;
  5906. appearance.dict.set("Matrix", savedMatrix);
  5907. return operatorList;
  5908. }
  5909. return {
  5910. opList: new _operator_list.OperatorList(),
  5911. separateForm: false,
  5912. separateCanvas: false
  5913. };
  5914. }
  5915. async save(evaluator, task, annotationStorage) {
  5916. if (this.data.checkBox) {
  5917. return this._saveCheckbox(evaluator, task, annotationStorage);
  5918. }
  5919. if (this.data.radioButton) {
  5920. return this._saveRadioButton(evaluator, task, annotationStorage);
  5921. }
  5922. return null;
  5923. }
  5924. async _saveCheckbox(evaluator, task, annotationStorage) {
  5925. if (!annotationStorage) {
  5926. return null;
  5927. }
  5928. const storageEntry = annotationStorage.get(this.data.id);
  5929. let rotation = storageEntry && storageEntry.rotation;
  5930. let value = storageEntry && storageEntry.value;
  5931. if (rotation === undefined) {
  5932. if (value === undefined) {
  5933. return null;
  5934. }
  5935. const defaultValue = this.data.fieldValue === this.data.exportValue;
  5936. if (defaultValue === value) {
  5937. return null;
  5938. }
  5939. }
  5940. const dict = evaluator.xref.fetchIfRef(this.ref);
  5941. if (!(dict instanceof _primitives.Dict)) {
  5942. return null;
  5943. }
  5944. if (rotation === undefined) {
  5945. rotation = this.rotation;
  5946. }
  5947. if (value === undefined) {
  5948. value = this.data.fieldValue === this.data.exportValue;
  5949. }
  5950. const xfa = {
  5951. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  5952. value: value ? this.data.exportValue : ""
  5953. };
  5954. const name = _primitives.Name.get(value ? this.data.exportValue : "Off");
  5955. dict.set("V", name);
  5956. dict.set("AS", name);
  5957. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  5958. const maybeMK = this._getMKDict(rotation);
  5959. if (maybeMK) {
  5960. dict.set("MK", maybeMK);
  5961. }
  5962. const encrypt = evaluator.xref.encrypt;
  5963. let originalTransform = null;
  5964. if (encrypt) {
  5965. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  5966. }
  5967. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  5968. (0, _writer.writeDict)(dict, buffer, originalTransform);
  5969. buffer.push("\nendobj\n");
  5970. return [{
  5971. ref: this.ref,
  5972. data: buffer.join(""),
  5973. xfa
  5974. }];
  5975. }
  5976. async _saveRadioButton(evaluator, task, annotationStorage) {
  5977. if (!annotationStorage) {
  5978. return null;
  5979. }
  5980. const storageEntry = annotationStorage.get(this.data.id);
  5981. let rotation = storageEntry && storageEntry.rotation;
  5982. let value = storageEntry && storageEntry.value;
  5983. if (rotation === undefined) {
  5984. if (value === undefined) {
  5985. return null;
  5986. }
  5987. const defaultValue = this.data.fieldValue === this.data.buttonValue;
  5988. if (defaultValue === value) {
  5989. return null;
  5990. }
  5991. }
  5992. const dict = evaluator.xref.fetchIfRef(this.ref);
  5993. if (!(dict instanceof _primitives.Dict)) {
  5994. return null;
  5995. }
  5996. if (value === undefined) {
  5997. value = this.data.fieldValue === this.data.buttonValue;
  5998. }
  5999. if (rotation === undefined) {
  6000. rotation = this.rotation;
  6001. }
  6002. const xfa = {
  6003. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  6004. value: value ? this.data.buttonValue : ""
  6005. };
  6006. const name = _primitives.Name.get(value ? this.data.buttonValue : "Off");
  6007. let parentBuffer = null;
  6008. const encrypt = evaluator.xref.encrypt;
  6009. if (value) {
  6010. if (this.parent instanceof _primitives.Ref) {
  6011. const parent = evaluator.xref.fetch(this.parent);
  6012. let parentTransform = null;
  6013. if (encrypt) {
  6014. parentTransform = encrypt.createCipherTransform(this.parent.num, this.parent.gen);
  6015. }
  6016. parent.set("V", name);
  6017. parentBuffer = [`${this.parent.num} ${this.parent.gen} obj\n`];
  6018. (0, _writer.writeDict)(parent, parentBuffer, parentTransform);
  6019. parentBuffer.push("\nendobj\n");
  6020. } else if (this.parent instanceof _primitives.Dict) {
  6021. this.parent.set("V", name);
  6022. }
  6023. }
  6024. dict.set("AS", name);
  6025. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  6026. const maybeMK = this._getMKDict(rotation);
  6027. if (maybeMK) {
  6028. dict.set("MK", maybeMK);
  6029. }
  6030. let originalTransform = null;
  6031. if (encrypt) {
  6032. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  6033. }
  6034. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  6035. (0, _writer.writeDict)(dict, buffer, originalTransform);
  6036. buffer.push("\nendobj\n");
  6037. const newRefs = [{
  6038. ref: this.ref,
  6039. data: buffer.join(""),
  6040. xfa
  6041. }];
  6042. if (parentBuffer !== null) {
  6043. newRefs.push({
  6044. ref: this.parent,
  6045. data: parentBuffer.join(""),
  6046. xfa: null
  6047. });
  6048. }
  6049. return newRefs;
  6050. }
  6051. _getDefaultCheckedAppearance(params, type) {
  6052. const width = this.data.rect[2] - this.data.rect[0];
  6053. const height = this.data.rect[3] - this.data.rect[1];
  6054. const bbox = [0, 0, width, height];
  6055. const FONT_RATIO = 0.8;
  6056. const fontSize = Math.min(width, height) * FONT_RATIO;
  6057. let metrics, char;
  6058. if (type === "check") {
  6059. metrics = {
  6060. width: 0.755 * fontSize,
  6061. height: 0.705 * fontSize
  6062. };
  6063. char = "\x33";
  6064. } else if (type === "disc") {
  6065. metrics = {
  6066. width: 0.791 * fontSize,
  6067. height: 0.705 * fontSize
  6068. };
  6069. char = "\x6C";
  6070. } else {
  6071. (0, _util.unreachable)(`_getDefaultCheckedAppearance - unsupported type: ${type}`);
  6072. }
  6073. const xShift = (0, _core_utils.numberToString)((width - metrics.width) / 2);
  6074. const yShift = (0, _core_utils.numberToString)((height - metrics.height) / 2);
  6075. const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`;
  6076. const appearanceStreamDict = new _primitives.Dict(params.xref);
  6077. appearanceStreamDict.set("FormType", 1);
  6078. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  6079. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  6080. appearanceStreamDict.set("BBox", bbox);
  6081. appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]);
  6082. appearanceStreamDict.set("Length", appearance.length);
  6083. const resources = new _primitives.Dict(params.xref);
  6084. const font = new _primitives.Dict(params.xref);
  6085. font.set("PdfJsZaDb", this.fallbackFontDict);
  6086. resources.set("Font", font);
  6087. appearanceStreamDict.set("Resources", resources);
  6088. this.checkedAppearance = new _stream.StringStream(appearance);
  6089. this.checkedAppearance.dict = appearanceStreamDict;
  6090. this._streams.push(this.checkedAppearance);
  6091. }
  6092. _processCheckBox(params) {
  6093. const customAppearance = params.dict.get("AP");
  6094. if (!(customAppearance instanceof _primitives.Dict)) {
  6095. return;
  6096. }
  6097. const normalAppearance = customAppearance.get("N");
  6098. if (!(normalAppearance instanceof _primitives.Dict)) {
  6099. return;
  6100. }
  6101. const asValue = this._decodeFormValue(params.dict.get("AS"));
  6102. if (typeof asValue === "string") {
  6103. this.data.fieldValue = asValue;
  6104. }
  6105. const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes";
  6106. const exportValues = normalAppearance.getKeys();
  6107. if (exportValues.length === 0) {
  6108. exportValues.push("Off", yes);
  6109. } else if (exportValues.length === 1) {
  6110. if (exportValues[0] === "Off") {
  6111. exportValues.push(yes);
  6112. } else {
  6113. exportValues.unshift("Off");
  6114. }
  6115. } else if (exportValues.includes(yes)) {
  6116. exportValues.length = 0;
  6117. exportValues.push("Off", yes);
  6118. } else {
  6119. const otherYes = exportValues.find(v => v !== "Off");
  6120. exportValues.length = 0;
  6121. exportValues.push("Off", otherYes);
  6122. }
  6123. if (!exportValues.includes(this.data.fieldValue)) {
  6124. this.data.fieldValue = "Off";
  6125. }
  6126. this.data.exportValue = exportValues[1];
  6127. this.checkedAppearance = normalAppearance.get(this.data.exportValue) || null;
  6128. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  6129. if (this.checkedAppearance) {
  6130. this._streams.push(this.checkedAppearance);
  6131. } else {
  6132. this._getDefaultCheckedAppearance(params, "check");
  6133. }
  6134. if (this.uncheckedAppearance) {
  6135. this._streams.push(this.uncheckedAppearance);
  6136. }
  6137. this._fallbackFontDict = this.fallbackFontDict;
  6138. }
  6139. _processRadioButton(params) {
  6140. this.data.fieldValue = this.data.buttonValue = null;
  6141. const fieldParent = params.dict.get("Parent");
  6142. if (fieldParent instanceof _primitives.Dict) {
  6143. this.parent = params.dict.getRaw("Parent");
  6144. const fieldParentValue = fieldParent.get("V");
  6145. if (fieldParentValue instanceof _primitives.Name) {
  6146. this.data.fieldValue = this._decodeFormValue(fieldParentValue);
  6147. }
  6148. }
  6149. const appearanceStates = params.dict.get("AP");
  6150. if (!(appearanceStates instanceof _primitives.Dict)) {
  6151. return;
  6152. }
  6153. const normalAppearance = appearanceStates.get("N");
  6154. if (!(normalAppearance instanceof _primitives.Dict)) {
  6155. return;
  6156. }
  6157. for (const key of normalAppearance.getKeys()) {
  6158. if (key !== "Off") {
  6159. this.data.buttonValue = this._decodeFormValue(key);
  6160. break;
  6161. }
  6162. }
  6163. this.checkedAppearance = normalAppearance.get(this.data.buttonValue) || null;
  6164. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  6165. if (this.checkedAppearance) {
  6166. this._streams.push(this.checkedAppearance);
  6167. } else {
  6168. this._getDefaultCheckedAppearance(params, "disc");
  6169. }
  6170. if (this.uncheckedAppearance) {
  6171. this._streams.push(this.uncheckedAppearance);
  6172. }
  6173. this._fallbackFontDict = this.fallbackFontDict;
  6174. }
  6175. _processPushButton(params) {
  6176. if (!params.dict.has("A") && !params.dict.has("AA") && !this.data.alternativeText) {
  6177. (0, _util.warn)("Push buttons without action dictionaries are not supported");
  6178. return;
  6179. }
  6180. this.data.isTooltipOnly = !params.dict.has("A") && !params.dict.has("AA");
  6181. _catalog.Catalog.parseDestDictionary({
  6182. destDict: params.dict,
  6183. resultObj: this.data,
  6184. docBaseUrl: params.pdfManager.docBaseUrl,
  6185. docAttachments: params.attachments
  6186. });
  6187. }
  6188. getFieldObject() {
  6189. let type = "button";
  6190. let exportValues;
  6191. if (this.data.checkBox) {
  6192. type = "checkbox";
  6193. exportValues = this.data.exportValue;
  6194. } else if (this.data.radioButton) {
  6195. type = "radiobutton";
  6196. exportValues = this.data.buttonValue;
  6197. }
  6198. return {
  6199. id: this.data.id,
  6200. value: this.data.fieldValue || "Off",
  6201. defaultValue: this.data.defaultFieldValue,
  6202. exportValues,
  6203. editable: !this.data.readOnly,
  6204. name: this.data.fieldName,
  6205. rect: this.data.rect,
  6206. hidden: this.data.hidden,
  6207. actions: this.data.actions,
  6208. page: this.data.pageIndex,
  6209. strokeColor: this.data.borderColor,
  6210. fillColor: this.data.backgroundColor,
  6211. rotation: this.rotation,
  6212. type
  6213. };
  6214. }
  6215. get fallbackFontDict() {
  6216. const dict = new _primitives.Dict();
  6217. dict.set("BaseFont", _primitives.Name.get("ZapfDingbats"));
  6218. dict.set("Type", _primitives.Name.get("FallbackType"));
  6219. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  6220. dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding"));
  6221. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  6222. }
  6223. }
  6224. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  6225. constructor(params) {
  6226. super(params);
  6227. const {
  6228. dict,
  6229. xref
  6230. } = params;
  6231. this.data.options = [];
  6232. const options = (0, _core_utils.getInheritableProperty)({
  6233. dict,
  6234. key: "Opt"
  6235. });
  6236. if (Array.isArray(options)) {
  6237. for (let i = 0, ii = options.length; i < ii; i++) {
  6238. const option = xref.fetchIfRef(options[i]);
  6239. const isOptionArray = Array.isArray(option);
  6240. this.data.options[i] = {
  6241. exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
  6242. displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
  6243. };
  6244. }
  6245. }
  6246. if (typeof this.data.fieldValue === "string") {
  6247. this.data.fieldValue = [this.data.fieldValue];
  6248. } else if (!this.data.fieldValue) {
  6249. this.data.fieldValue = [];
  6250. }
  6251. this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
  6252. this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
  6253. this._hasText = true;
  6254. }
  6255. getFieldObject() {
  6256. const type = this.data.combo ? "combobox" : "listbox";
  6257. const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
  6258. return {
  6259. id: this.data.id,
  6260. value,
  6261. defaultValue: this.data.defaultFieldValue,
  6262. editable: !this.data.readOnly,
  6263. name: this.data.fieldName,
  6264. rect: this.data.rect,
  6265. numItems: this.data.fieldValue.length,
  6266. multipleSelection: this.data.multiSelect,
  6267. hidden: this.data.hidden,
  6268. actions: this.data.actions,
  6269. items: this.data.options,
  6270. page: this.data.pageIndex,
  6271. strokeColor: this.data.borderColor,
  6272. fillColor: this.data.backgroundColor,
  6273. rotation: this.rotation,
  6274. type
  6275. };
  6276. }
  6277. async _getAppearance(evaluator, task, intent, annotationStorage) {
  6278. if (this.data.combo) {
  6279. return super._getAppearance(evaluator, task, intent, annotationStorage);
  6280. }
  6281. let exportedValue, rotation;
  6282. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  6283. if (storageEntry) {
  6284. rotation = storageEntry.rotation;
  6285. exportedValue = storageEntry.value;
  6286. }
  6287. if (rotation === undefined && exportedValue === undefined && !this._needAppearances) {
  6288. return null;
  6289. }
  6290. if (exportedValue === undefined) {
  6291. exportedValue = this.data.fieldValue;
  6292. } else if (!Array.isArray(exportedValue)) {
  6293. exportedValue = [exportedValue];
  6294. }
  6295. const defaultPadding = 1;
  6296. const defaultHPadding = 2;
  6297. let totalHeight = this.data.rect[3] - this.data.rect[1];
  6298. let totalWidth = this.data.rect[2] - this.data.rect[0];
  6299. if (rotation === 90 || rotation === 270) {
  6300. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  6301. }
  6302. const lineCount = this.data.options.length;
  6303. const valueIndices = [];
  6304. for (let i = 0; i < lineCount; i++) {
  6305. const {
  6306. exportValue
  6307. } = this.data.options[i];
  6308. if (exportedValue.includes(exportValue)) {
  6309. valueIndices.push(i);
  6310. }
  6311. }
  6312. if (!this._defaultAppearance) {
  6313. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  6314. }
  6315. const font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  6316. let defaultAppearance;
  6317. let {
  6318. fontSize
  6319. } = this.data.defaultAppearanceData;
  6320. if (!fontSize) {
  6321. const lineHeight = (totalHeight - defaultPadding) / lineCount;
  6322. let lineWidth = -1;
  6323. let value;
  6324. for (const {
  6325. displayValue
  6326. } of this.data.options) {
  6327. const width = this._getTextWidth(displayValue, font);
  6328. if (width > lineWidth) {
  6329. lineWidth = width;
  6330. value = displayValue;
  6331. }
  6332. }
  6333. [defaultAppearance, fontSize] = this._computeFontSize(lineHeight, totalWidth - 2 * defaultHPadding, value, font, -1);
  6334. } else {
  6335. defaultAppearance = this._defaultAppearance;
  6336. }
  6337. const lineHeight = fontSize * _util.LINE_FACTOR;
  6338. const vPadding = (lineHeight - fontSize) / 2;
  6339. const numberOfVisibleLines = Math.floor(totalHeight / lineHeight);
  6340. let firstIndex;
  6341. if (valueIndices.length === 1) {
  6342. const valuePosition = valueIndices[0];
  6343. const indexInPage = valuePosition % numberOfVisibleLines;
  6344. firstIndex = valuePosition - indexInPage;
  6345. } else {
  6346. firstIndex = valueIndices.length ? valueIndices[0] : 0;
  6347. }
  6348. const end = Math.min(firstIndex + numberOfVisibleLines + 1, lineCount);
  6349. const buf = ["/Tx BMC q", `1 1 ${totalWidth} ${totalHeight} re W n`];
  6350. if (valueIndices.length) {
  6351. buf.push("0.600006 0.756866 0.854904 rg");
  6352. for (const index of valueIndices) {
  6353. if (firstIndex <= index && index < end) {
  6354. buf.push(`1 ${totalHeight - (index - firstIndex + 1) * lineHeight} ${totalWidth} ${lineHeight} re f`);
  6355. }
  6356. }
  6357. }
  6358. buf.push("BT", defaultAppearance, `1 0 0 1 0 ${totalHeight} Tm`);
  6359. const prevInfo = {
  6360. shift: 0
  6361. };
  6362. for (let i = firstIndex; i < end; i++) {
  6363. const {
  6364. displayValue
  6365. } = this.data.options[i];
  6366. const vpadding = i === firstIndex ? vPadding : 0;
  6367. buf.push(this._renderText(displayValue, font, fontSize, totalWidth, 0, prevInfo, defaultHPadding, -lineHeight + vpadding));
  6368. }
  6369. buf.push("ET Q EMC");
  6370. return buf.join("\n");
  6371. }
  6372. }
  6373. class SignatureWidgetAnnotation extends WidgetAnnotation {
  6374. constructor(params) {
  6375. super(params);
  6376. this.data.fieldValue = null;
  6377. }
  6378. getFieldObject() {
  6379. return {
  6380. id: this.data.id,
  6381. value: null,
  6382. page: this.data.pageIndex,
  6383. type: "signature"
  6384. };
  6385. }
  6386. }
  6387. class TextAnnotation extends MarkupAnnotation {
  6388. constructor(params) {
  6389. const DEFAULT_ICON_SIZE = 22;
  6390. super(params);
  6391. const {
  6392. dict
  6393. } = params;
  6394. this.data.annotationType = _util.AnnotationType.TEXT;
  6395. if (this.data.hasAppearance) {
  6396. this.data.name = "NoIcon";
  6397. } else {
  6398. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  6399. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  6400. this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
  6401. }
  6402. if (dict.has("State")) {
  6403. this.data.state = dict.get("State") || null;
  6404. this.data.stateModel = dict.get("StateModel") || null;
  6405. } else {
  6406. this.data.state = null;
  6407. this.data.stateModel = null;
  6408. }
  6409. }
  6410. }
  6411. class LinkAnnotation extends Annotation {
  6412. constructor(params) {
  6413. super(params);
  6414. this.data.annotationType = _util.AnnotationType.LINK;
  6415. const quadPoints = getQuadPoints(params.dict, this.rectangle);
  6416. if (quadPoints) {
  6417. this.data.quadPoints = quadPoints;
  6418. }
  6419. this.data.borderColor = this.data.borderColor || this.data.color;
  6420. _catalog.Catalog.parseDestDictionary({
  6421. destDict: params.dict,
  6422. resultObj: this.data,
  6423. docBaseUrl: params.pdfManager.docBaseUrl,
  6424. docAttachments: params.attachments
  6425. });
  6426. }
  6427. }
  6428. class PopupAnnotation extends Annotation {
  6429. constructor(params) {
  6430. super(params);
  6431. const {
  6432. dict
  6433. } = params;
  6434. this.data.annotationType = _util.AnnotationType.POPUP;
  6435. let parentItem = dict.get("Parent");
  6436. if (!parentItem) {
  6437. (0, _util.warn)("Popup annotation has a missing or invalid parent annotation.");
  6438. return;
  6439. }
  6440. const parentSubtype = parentItem.get("Subtype");
  6441. this.data.parentType = parentSubtype instanceof _primitives.Name ? parentSubtype.name : null;
  6442. const rawParent = dict.getRaw("Parent");
  6443. this.data.parentId = rawParent instanceof _primitives.Ref ? rawParent.toString() : null;
  6444. const parentRect = parentItem.getArray("Rect");
  6445. if (Array.isArray(parentRect) && parentRect.length === 4) {
  6446. this.data.parentRect = _util.Util.normalizeRect(parentRect);
  6447. } else {
  6448. this.data.parentRect = [0, 0, 0, 0];
  6449. }
  6450. const rt = parentItem.get("RT");
  6451. if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
  6452. parentItem = parentItem.get("IRT");
  6453. }
  6454. if (!parentItem.has("M")) {
  6455. this.data.modificationDate = null;
  6456. } else {
  6457. this.setModificationDate(parentItem.get("M"));
  6458. this.data.modificationDate = this.modificationDate;
  6459. }
  6460. if (!parentItem.has("C")) {
  6461. this.data.color = null;
  6462. } else {
  6463. this.setColor(parentItem.getArray("C"));
  6464. this.data.color = this.color;
  6465. }
  6466. if (!this.viewable) {
  6467. const parentFlags = parentItem.get("F");
  6468. if (this._isViewable(parentFlags)) {
  6469. this.setFlags(parentFlags);
  6470. }
  6471. }
  6472. this.setTitle(parentItem.get("T"));
  6473. this.data.titleObj = this._title;
  6474. this.setContents(parentItem.get("Contents"));
  6475. this.data.contentsObj = this._contents;
  6476. if (parentItem.has("RC")) {
  6477. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(parentItem.get("RC"));
  6478. }
  6479. }
  6480. }
  6481. exports.PopupAnnotation = PopupAnnotation;
  6482. class FreeTextAnnotation extends MarkupAnnotation {
  6483. constructor(params) {
  6484. super(params);
  6485. const {
  6486. xref
  6487. } = params;
  6488. this.data.annotationType = _util.AnnotationType.FREETEXT;
  6489. this.setDefaultAppearance(params);
  6490. if (!this.appearance && this._isOffscreenCanvasSupported) {
  6491. const fakeUnicodeFont = new _default_appearance.FakeUnicodeFont(xref, "sans-serif");
  6492. const fontData = this.data.defaultAppearanceData;
  6493. this.appearance = fakeUnicodeFont.createAppearance(this._contents.str, this.rectangle, this.rotation, fontData.fontSize || 10, fontData.fontColor);
  6494. this._streams.push(this.appearance, _default_appearance.FakeUnicodeFont.toUnicodeStream);
  6495. } else if (!this._isOffscreenCanvasSupported) {
  6496. (0, _util.warn)("FreeTextAnnotation: OffscreenCanvas is not supported, annotation may not render correctly.");
  6497. }
  6498. }
  6499. get hasTextContent() {
  6500. return !!this.appearance;
  6501. }
  6502. static createNewDict(annotation, xref, {
  6503. apRef,
  6504. ap
  6505. }) {
  6506. const {
  6507. color,
  6508. fontSize,
  6509. rect,
  6510. rotation,
  6511. user,
  6512. value
  6513. } = annotation;
  6514. const freetext = new _primitives.Dict(xref);
  6515. freetext.set("Type", _primitives.Name.get("Annot"));
  6516. freetext.set("Subtype", _primitives.Name.get("FreeText"));
  6517. freetext.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
  6518. freetext.set("Rect", rect);
  6519. const da = `/Helv ${fontSize} Tf ${(0, _default_appearance.getPdfColor)(color, true)}`;
  6520. freetext.set("DA", da);
  6521. freetext.set("Contents", (0, _core_utils.isAscii)(value) ? value : (0, _core_utils.stringToUTF16String)(value, true));
  6522. freetext.set("F", 4);
  6523. freetext.set("Border", [0, 0, 0]);
  6524. freetext.set("Rotate", rotation);
  6525. if (user) {
  6526. freetext.set("T", (0, _core_utils.isAscii)(user) ? user : (0, _core_utils.stringToUTF16String)(user, true));
  6527. }
  6528. if (apRef || ap) {
  6529. const n = new _primitives.Dict(xref);
  6530. freetext.set("AP", n);
  6531. if (apRef) {
  6532. n.set("N", apRef);
  6533. } else {
  6534. n.set("N", ap);
  6535. }
  6536. }
  6537. return freetext;
  6538. }
  6539. static async createNewAppearanceStream(annotation, xref, params) {
  6540. const {
  6541. baseFontRef,
  6542. evaluator,
  6543. task
  6544. } = params;
  6545. const {
  6546. color,
  6547. fontSize,
  6548. rect,
  6549. rotation,
  6550. value
  6551. } = annotation;
  6552. const resources = new _primitives.Dict(xref);
  6553. const font = new _primitives.Dict(xref);
  6554. if (baseFontRef) {
  6555. font.set("Helv", baseFontRef);
  6556. } else {
  6557. const baseFont = new _primitives.Dict(xref);
  6558. baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
  6559. baseFont.set("Type", _primitives.Name.get("Font"));
  6560. baseFont.set("Subtype", _primitives.Name.get("Type1"));
  6561. baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  6562. font.set("Helv", baseFont);
  6563. }
  6564. resources.set("Font", font);
  6565. const helv = await WidgetAnnotation._getFontData(evaluator, task, {
  6566. fontName: "Helvetica",
  6567. fontSize
  6568. }, resources);
  6569. const [x1, y1, x2, y2] = rect;
  6570. let w = x2 - x1;
  6571. let h = y2 - y1;
  6572. if (rotation % 180 !== 0) {
  6573. [w, h] = [h, w];
  6574. }
  6575. const lines = value.split("\n");
  6576. const scale = fontSize / 1000;
  6577. let totalWidth = -Infinity;
  6578. const encodedLines = [];
  6579. for (let line of lines) {
  6580. const encoded = helv.encodeString(line);
  6581. if (encoded.length > 1) {
  6582. return null;
  6583. }
  6584. line = encoded.join("");
  6585. encodedLines.push(line);
  6586. let lineWidth = 0;
  6587. const glyphs = helv.charsToGlyphs(line);
  6588. for (const glyph of glyphs) {
  6589. lineWidth += glyph.width * scale;
  6590. }
  6591. totalWidth = Math.max(totalWidth, lineWidth);
  6592. }
  6593. let hscale = 1;
  6594. if (totalWidth > w) {
  6595. hscale = w / totalWidth;
  6596. }
  6597. let vscale = 1;
  6598. const lineHeight = _util.LINE_FACTOR * fontSize;
  6599. const lineDescent = _util.LINE_DESCENT_FACTOR * fontSize;
  6600. const totalHeight = lineHeight * lines.length;
  6601. if (totalHeight > h) {
  6602. vscale = h / totalHeight;
  6603. }
  6604. const fscale = Math.min(hscale, vscale);
  6605. const newFontSize = fontSize * fscale;
  6606. const buffer = ["q", `0 0 ${(0, _core_utils.numberToString)(w)} ${(0, _core_utils.numberToString)(h)} re W n`, `BT`, `1 0 0 1 0 ${(0, _core_utils.numberToString)(h + lineDescent)} Tm 0 Tc ${(0, _default_appearance.getPdfColor)(color, true)}`, `/Helv ${(0, _core_utils.numberToString)(newFontSize)} Tf`];
  6607. const vShift = (0, _core_utils.numberToString)(lineHeight);
  6608. for (const line of encodedLines) {
  6609. buffer.push(`0 -${vShift} Td (${(0, _core_utils.escapeString)(line)}) Tj`);
  6610. }
  6611. buffer.push("ET", "Q");
  6612. const appearance = buffer.join("\n");
  6613. const appearanceStreamDict = new _primitives.Dict(xref);
  6614. appearanceStreamDict.set("FormType", 1);
  6615. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  6616. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  6617. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  6618. appearanceStreamDict.set("Length", appearance.length);
  6619. appearanceStreamDict.set("Resources", resources);
  6620. if (rotation) {
  6621. const matrix = (0, _core_utils.getRotationMatrix)(rotation, w, h);
  6622. appearanceStreamDict.set("Matrix", matrix);
  6623. }
  6624. const ap = new _stream.StringStream(appearance);
  6625. ap.dict = appearanceStreamDict;
  6626. return ap;
  6627. }
  6628. }
  6629. class LineAnnotation extends MarkupAnnotation {
  6630. constructor(params) {
  6631. super(params);
  6632. const {
  6633. dict,
  6634. xref
  6635. } = params;
  6636. this.data.annotationType = _util.AnnotationType.LINE;
  6637. const lineCoordinates = dict.getArray("L");
  6638. this.data.lineCoordinates = _util.Util.normalizeRect(lineCoordinates);
  6639. this.setLineEndings(dict.getArray("LE"));
  6640. this.data.lineEndings = this.lineEndings;
  6641. if (!this.appearance) {
  6642. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  6643. const strokeAlpha = dict.get("CA");
  6644. const interiorColor = getRgbColor(dict.getArray("IC"), null);
  6645. const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
  6646. const fillAlpha = fillColor ? strokeAlpha : null;
  6647. const borderWidth = this.borderStyle.width || 1,
  6648. borderAdjust = 2 * borderWidth;
  6649. const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust];
  6650. if (!_util.Util.intersect(this.rectangle, bbox)) {
  6651. this.rectangle = bbox;
  6652. }
  6653. this._setDefaultAppearance({
  6654. xref,
  6655. extra: `${borderWidth} w`,
  6656. strokeColor,
  6657. fillColor,
  6658. strokeAlpha,
  6659. fillAlpha,
  6660. pointsCallback: (buffer, points) => {
  6661. buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
  6662. return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth];
  6663. }
  6664. });
  6665. }
  6666. }
  6667. }
  6668. class SquareAnnotation extends MarkupAnnotation {
  6669. constructor(params) {
  6670. super(params);
  6671. const {
  6672. dict,
  6673. xref
  6674. } = params;
  6675. this.data.annotationType = _util.AnnotationType.SQUARE;
  6676. if (!this.appearance) {
  6677. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  6678. const strokeAlpha = dict.get("CA");
  6679. const interiorColor = getRgbColor(dict.getArray("IC"), null);
  6680. const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
  6681. const fillAlpha = fillColor ? strokeAlpha : null;
  6682. if (this.borderStyle.width === 0 && !fillColor) {
  6683. return;
  6684. }
  6685. this._setDefaultAppearance({
  6686. xref,
  6687. extra: `${this.borderStyle.width} w`,
  6688. strokeColor,
  6689. fillColor,
  6690. strokeAlpha,
  6691. fillAlpha,
  6692. pointsCallback: (buffer, points) => {
  6693. const x = points[2].x + this.borderStyle.width / 2;
  6694. const y = points[2].y + this.borderStyle.width / 2;
  6695. const width = points[3].x - points[2].x - this.borderStyle.width;
  6696. const height = points[1].y - points[3].y - this.borderStyle.width;
  6697. buffer.push(`${x} ${y} ${width} ${height} re`);
  6698. if (fillColor) {
  6699. buffer.push("B");
  6700. } else {
  6701. buffer.push("S");
  6702. }
  6703. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6704. }
  6705. });
  6706. }
  6707. }
  6708. }
  6709. class CircleAnnotation extends MarkupAnnotation {
  6710. constructor(params) {
  6711. super(params);
  6712. const {
  6713. dict,
  6714. xref
  6715. } = params;
  6716. this.data.annotationType = _util.AnnotationType.CIRCLE;
  6717. if (!this.appearance) {
  6718. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  6719. const strokeAlpha = dict.get("CA");
  6720. const interiorColor = getRgbColor(dict.getArray("IC"), null);
  6721. const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
  6722. const fillAlpha = fillColor ? strokeAlpha : null;
  6723. if (this.borderStyle.width === 0 && !fillColor) {
  6724. return;
  6725. }
  6726. const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4));
  6727. this._setDefaultAppearance({
  6728. xref,
  6729. extra: `${this.borderStyle.width} w`,
  6730. strokeColor,
  6731. fillColor,
  6732. strokeAlpha,
  6733. fillAlpha,
  6734. pointsCallback: (buffer, points) => {
  6735. const x0 = points[0].x + this.borderStyle.width / 2;
  6736. const y0 = points[0].y - this.borderStyle.width / 2;
  6737. const x1 = points[3].x - this.borderStyle.width / 2;
  6738. const y1 = points[3].y + this.borderStyle.width / 2;
  6739. const xMid = x0 + (x1 - x0) / 2;
  6740. const yMid = y0 + (y1 - y0) / 2;
  6741. const xOffset = (x1 - x0) / 2 * controlPointsDistance;
  6742. const yOffset = (y1 - y0) / 2 * controlPointsDistance;
  6743. buffer.push(`${xMid} ${y1} m`, `${xMid + xOffset} ${y1} ${x1} ${yMid + yOffset} ${x1} ${yMid} c`, `${x1} ${yMid - yOffset} ${xMid + xOffset} ${y0} ${xMid} ${y0} c`, `${xMid - xOffset} ${y0} ${x0} ${yMid - yOffset} ${x0} ${yMid} c`, `${x0} ${yMid + yOffset} ${xMid - xOffset} ${y1} ${xMid} ${y1} c`, "h");
  6744. if (fillColor) {
  6745. buffer.push("B");
  6746. } else {
  6747. buffer.push("S");
  6748. }
  6749. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6750. }
  6751. });
  6752. }
  6753. }
  6754. }
  6755. class PolylineAnnotation extends MarkupAnnotation {
  6756. constructor(params) {
  6757. super(params);
  6758. const {
  6759. dict,
  6760. xref
  6761. } = params;
  6762. this.data.annotationType = _util.AnnotationType.POLYLINE;
  6763. this.data.vertices = [];
  6764. if (!(this instanceof PolygonAnnotation)) {
  6765. this.setLineEndings(dict.getArray("LE"));
  6766. this.data.lineEndings = this.lineEndings;
  6767. }
  6768. const rawVertices = dict.getArray("Vertices");
  6769. if (!Array.isArray(rawVertices)) {
  6770. return;
  6771. }
  6772. for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
  6773. this.data.vertices.push({
  6774. x: rawVertices[i],
  6775. y: rawVertices[i + 1]
  6776. });
  6777. }
  6778. if (!this.appearance) {
  6779. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  6780. const strokeAlpha = dict.get("CA");
  6781. const borderWidth = this.borderStyle.width || 1,
  6782. borderAdjust = 2 * borderWidth;
  6783. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  6784. for (const vertex of this.data.vertices) {
  6785. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  6786. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  6787. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  6788. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  6789. }
  6790. if (!_util.Util.intersect(this.rectangle, bbox)) {
  6791. this.rectangle = bbox;
  6792. }
  6793. this._setDefaultAppearance({
  6794. xref,
  6795. extra: `${borderWidth} w`,
  6796. strokeColor,
  6797. strokeAlpha,
  6798. pointsCallback: (buffer, points) => {
  6799. const vertices = this.data.vertices;
  6800. for (let i = 0, ii = vertices.length; i < ii; i++) {
  6801. buffer.push(`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`);
  6802. }
  6803. buffer.push("S");
  6804. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6805. }
  6806. });
  6807. }
  6808. }
  6809. }
  6810. class PolygonAnnotation extends PolylineAnnotation {
  6811. constructor(params) {
  6812. super(params);
  6813. this.data.annotationType = _util.AnnotationType.POLYGON;
  6814. }
  6815. }
  6816. class CaretAnnotation extends MarkupAnnotation {
  6817. constructor(params) {
  6818. super(params);
  6819. this.data.annotationType = _util.AnnotationType.CARET;
  6820. }
  6821. }
  6822. class InkAnnotation extends MarkupAnnotation {
  6823. constructor(params) {
  6824. super(params);
  6825. const {
  6826. dict,
  6827. xref
  6828. } = params;
  6829. this.data.annotationType = _util.AnnotationType.INK;
  6830. this.data.inkLists = [];
  6831. const rawInkLists = dict.getArray("InkList");
  6832. if (!Array.isArray(rawInkLists)) {
  6833. return;
  6834. }
  6835. for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
  6836. this.data.inkLists.push([]);
  6837. for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
  6838. this.data.inkLists[i].push({
  6839. x: xref.fetchIfRef(rawInkLists[i][j]),
  6840. y: xref.fetchIfRef(rawInkLists[i][j + 1])
  6841. });
  6842. }
  6843. }
  6844. if (!this.appearance) {
  6845. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  6846. const strokeAlpha = dict.get("CA");
  6847. const borderWidth = this.borderStyle.width || 1,
  6848. borderAdjust = 2 * borderWidth;
  6849. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  6850. for (const inkLists of this.data.inkLists) {
  6851. for (const vertex of inkLists) {
  6852. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  6853. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  6854. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  6855. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  6856. }
  6857. }
  6858. if (!_util.Util.intersect(this.rectangle, bbox)) {
  6859. this.rectangle = bbox;
  6860. }
  6861. this._setDefaultAppearance({
  6862. xref,
  6863. extra: `${borderWidth} w`,
  6864. strokeColor,
  6865. strokeAlpha,
  6866. pointsCallback: (buffer, points) => {
  6867. for (const inkList of this.data.inkLists) {
  6868. for (let i = 0, ii = inkList.length; i < ii; i++) {
  6869. buffer.push(`${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`);
  6870. }
  6871. buffer.push("S");
  6872. }
  6873. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6874. }
  6875. });
  6876. }
  6877. }
  6878. static createNewDict(annotation, xref, {
  6879. apRef,
  6880. ap
  6881. }) {
  6882. const {
  6883. paths,
  6884. rect,
  6885. rotation
  6886. } = annotation;
  6887. const ink = new _primitives.Dict(xref);
  6888. ink.set("Type", _primitives.Name.get("Annot"));
  6889. ink.set("Subtype", _primitives.Name.get("Ink"));
  6890. ink.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
  6891. ink.set("Rect", rect);
  6892. ink.set("InkList", paths.map(p => p.points));
  6893. ink.set("F", 4);
  6894. ink.set("Border", [0, 0, 0]);
  6895. ink.set("Rotate", rotation);
  6896. const n = new _primitives.Dict(xref);
  6897. ink.set("AP", n);
  6898. if (apRef) {
  6899. n.set("N", apRef);
  6900. } else {
  6901. n.set("N", ap);
  6902. }
  6903. return ink;
  6904. }
  6905. static async createNewAppearanceStream(annotation, xref, params) {
  6906. const {
  6907. color,
  6908. rect,
  6909. rotation,
  6910. paths,
  6911. thickness,
  6912. opacity
  6913. } = annotation;
  6914. const [x1, y1, x2, y2] = rect;
  6915. let w = x2 - x1;
  6916. let h = y2 - y1;
  6917. if (rotation % 180 !== 0) {
  6918. [w, h] = [h, w];
  6919. }
  6920. const appearanceBuffer = [`${thickness} w 1 J 1 j`, `${(0, _default_appearance.getPdfColor)(color, false)}`];
  6921. if (opacity !== 1) {
  6922. appearanceBuffer.push("/R0 gs");
  6923. }
  6924. const buffer = [];
  6925. for (const {
  6926. bezier
  6927. } of paths) {
  6928. buffer.length = 0;
  6929. buffer.push(`${(0, _core_utils.numberToString)(bezier[0])} ${(0, _core_utils.numberToString)(bezier[1])} m`);
  6930. for (let i = 2, ii = bezier.length; i < ii; i += 6) {
  6931. const curve = bezier.slice(i, i + 6).map(_core_utils.numberToString).join(" ");
  6932. buffer.push(`${curve} c`);
  6933. }
  6934. buffer.push("S");
  6935. appearanceBuffer.push(buffer.join("\n"));
  6936. }
  6937. const appearance = appearanceBuffer.join("\n");
  6938. const appearanceStreamDict = new _primitives.Dict(xref);
  6939. appearanceStreamDict.set("FormType", 1);
  6940. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  6941. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  6942. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  6943. appearanceStreamDict.set("Length", appearance.length);
  6944. if (rotation) {
  6945. const matrix = (0, _core_utils.getRotationMatrix)(rotation, w, h);
  6946. appearanceStreamDict.set("Matrix", matrix);
  6947. }
  6948. if (opacity !== 1) {
  6949. const resources = new _primitives.Dict(xref);
  6950. const extGState = new _primitives.Dict(xref);
  6951. const r0 = new _primitives.Dict(xref);
  6952. r0.set("CA", opacity);
  6953. r0.set("Type", _primitives.Name.get("ExtGState"));
  6954. extGState.set("R0", r0);
  6955. resources.set("ExtGState", extGState);
  6956. appearanceStreamDict.set("Resources", resources);
  6957. }
  6958. const ap = new _stream.StringStream(appearance);
  6959. ap.dict = appearanceStreamDict;
  6960. return ap;
  6961. }
  6962. }
  6963. class HighlightAnnotation extends MarkupAnnotation {
  6964. constructor(params) {
  6965. super(params);
  6966. const {
  6967. dict,
  6968. xref
  6969. } = params;
  6970. this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
  6971. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  6972. if (quadPoints) {
  6973. const resources = this.appearance && this.appearance.dict.get("Resources");
  6974. if (!this.appearance || !(resources && resources.has("ExtGState"))) {
  6975. if (this.appearance) {
  6976. (0, _util.warn)("HighlightAnnotation - ignoring built-in appearance stream.");
  6977. }
  6978. const fillColor = this.color ? getPdfColorArray(this.color) : [1, 1, 0];
  6979. const fillAlpha = dict.get("CA");
  6980. this._setDefaultAppearance({
  6981. xref,
  6982. fillColor,
  6983. blendMode: "Multiply",
  6984. fillAlpha,
  6985. pointsCallback: (buffer, points) => {
  6986. buffer.push(`${points[0].x} ${points[0].y} m`, `${points[1].x} ${points[1].y} l`, `${points[3].x} ${points[3].y} l`, `${points[2].x} ${points[2].y} l`, "f");
  6987. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6988. }
  6989. });
  6990. }
  6991. } else {
  6992. this.data.hasPopup = false;
  6993. }
  6994. }
  6995. }
  6996. class UnderlineAnnotation extends MarkupAnnotation {
  6997. constructor(params) {
  6998. super(params);
  6999. const {
  7000. dict,
  7001. xref
  7002. } = params;
  7003. this.data.annotationType = _util.AnnotationType.UNDERLINE;
  7004. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  7005. if (quadPoints) {
  7006. if (!this.appearance) {
  7007. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  7008. const strokeAlpha = dict.get("CA");
  7009. this._setDefaultAppearance({
  7010. xref,
  7011. extra: "[] 0 d 1 w",
  7012. strokeColor,
  7013. strokeAlpha,
  7014. pointsCallback: (buffer, points) => {
  7015. buffer.push(`${points[2].x} ${points[2].y} m`, `${points[3].x} ${points[3].y} l`, "S");
  7016. return [points[0].x, points[1].x, points[3].y, points[1].y];
  7017. }
  7018. });
  7019. }
  7020. } else {
  7021. this.data.hasPopup = false;
  7022. }
  7023. }
  7024. }
  7025. class SquigglyAnnotation extends MarkupAnnotation {
  7026. constructor(params) {
  7027. super(params);
  7028. const {
  7029. dict,
  7030. xref
  7031. } = params;
  7032. this.data.annotationType = _util.AnnotationType.SQUIGGLY;
  7033. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  7034. if (quadPoints) {
  7035. if (!this.appearance) {
  7036. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  7037. const strokeAlpha = dict.get("CA");
  7038. this._setDefaultAppearance({
  7039. xref,
  7040. extra: "[] 0 d 1 w",
  7041. strokeColor,
  7042. strokeAlpha,
  7043. pointsCallback: (buffer, points) => {
  7044. const dy = (points[0].y - points[2].y) / 6;
  7045. let shift = dy;
  7046. let x = points[2].x;
  7047. const y = points[2].y;
  7048. const xEnd = points[3].x;
  7049. buffer.push(`${x} ${y + shift} m`);
  7050. do {
  7051. x += 2;
  7052. shift = shift === 0 ? dy : 0;
  7053. buffer.push(`${x} ${y + shift} l`);
  7054. } while (x < xEnd);
  7055. buffer.push("S");
  7056. return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy];
  7057. }
  7058. });
  7059. }
  7060. } else {
  7061. this.data.hasPopup = false;
  7062. }
  7063. }
  7064. }
  7065. class StrikeOutAnnotation extends MarkupAnnotation {
  7066. constructor(params) {
  7067. super(params);
  7068. const {
  7069. dict,
  7070. xref
  7071. } = params;
  7072. this.data.annotationType = _util.AnnotationType.STRIKEOUT;
  7073. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  7074. if (quadPoints) {
  7075. if (!this.appearance) {
  7076. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  7077. const strokeAlpha = dict.get("CA");
  7078. this._setDefaultAppearance({
  7079. xref,
  7080. extra: "[] 0 d 1 w",
  7081. strokeColor,
  7082. strokeAlpha,
  7083. pointsCallback: (buffer, points) => {
  7084. buffer.push(`${(points[0].x + points[2].x) / 2} ` + `${(points[0].y + points[2].y) / 2} m`, `${(points[1].x + points[3].x) / 2} ` + `${(points[1].y + points[3].y) / 2} l`, "S");
  7085. return [points[0].x, points[1].x, points[3].y, points[1].y];
  7086. }
  7087. });
  7088. }
  7089. } else {
  7090. this.data.hasPopup = false;
  7091. }
  7092. }
  7093. }
  7094. class StampAnnotation extends MarkupAnnotation {
  7095. constructor(params) {
  7096. super(params);
  7097. this.data.annotationType = _util.AnnotationType.STAMP;
  7098. }
  7099. }
  7100. class FileAttachmentAnnotation extends MarkupAnnotation {
  7101. constructor(params) {
  7102. super(params);
  7103. const {
  7104. dict,
  7105. xref
  7106. } = params;
  7107. const file = new _file_spec.FileSpec(dict.get("FS"), xref);
  7108. this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
  7109. this.data.file = file.serializable;
  7110. const name = dict.get("Name");
  7111. this.data.name = name instanceof _primitives.Name ? (0, _util.stringToPDFString)(name.name) : "PushPin";
  7112. }
  7113. }
  7114. /***/ }),
  7115. /* 11 */
  7116. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  7117. Object.defineProperty(exports, "__esModule", ({
  7118. value: true
  7119. }));
  7120. exports.FakeUnicodeFont = void 0;
  7121. exports.createDefaultAppearance = createDefaultAppearance;
  7122. exports.getPdfColor = getPdfColor;
  7123. exports.parseDefaultAppearance = parseDefaultAppearance;
  7124. var _primitives = __w_pdfjs_require__(3);
  7125. var _core_utils = __w_pdfjs_require__(4);
  7126. var _util = __w_pdfjs_require__(2);
  7127. var _colorspace = __w_pdfjs_require__(12);
  7128. var _evaluator = __w_pdfjs_require__(13);
  7129. var _stream = __w_pdfjs_require__(8);
  7130. class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor {
  7131. constructor(str) {
  7132. super(new _stream.StringStream(str));
  7133. }
  7134. parse() {
  7135. const operation = {
  7136. fn: 0,
  7137. args: []
  7138. };
  7139. const result = {
  7140. fontSize: 0,
  7141. fontName: "",
  7142. fontColor: new Uint8ClampedArray(3)
  7143. };
  7144. try {
  7145. while (true) {
  7146. operation.args.length = 0;
  7147. if (!this.read(operation)) {
  7148. break;
  7149. }
  7150. if (this.savedStatesDepth !== 0) {
  7151. continue;
  7152. }
  7153. const {
  7154. fn,
  7155. args
  7156. } = operation;
  7157. switch (fn | 0) {
  7158. case _util.OPS.setFont:
  7159. const [fontName, fontSize] = args;
  7160. if (fontName instanceof _primitives.Name) {
  7161. result.fontName = fontName.name;
  7162. }
  7163. if (typeof fontSize === "number" && fontSize > 0) {
  7164. result.fontSize = fontSize;
  7165. }
  7166. break;
  7167. case _util.OPS.setFillRGBColor:
  7168. _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
  7169. break;
  7170. case _util.OPS.setFillGray:
  7171. _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
  7172. break;
  7173. case _util.OPS.setFillColorSpace:
  7174. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
  7175. break;
  7176. }
  7177. }
  7178. } catch (reason) {
  7179. (0, _util.warn)(`parseDefaultAppearance - ignoring errors: "${reason}".`);
  7180. }
  7181. return result;
  7182. }
  7183. }
  7184. function parseDefaultAppearance(str) {
  7185. return new DefaultAppearanceEvaluator(str).parse();
  7186. }
  7187. function getPdfColor(color, isFill) {
  7188. if (color[0] === color[1] && color[1] === color[2]) {
  7189. const gray = color[0] / 255;
  7190. return `${(0, _core_utils.numberToString)(gray)} ${isFill ? "g" : "G"}`;
  7191. }
  7192. return Array.from(color, c => (0, _core_utils.numberToString)(c / 255)).join(" ") + ` ${isFill ? "rg" : "RG"}`;
  7193. }
  7194. function createDefaultAppearance({
  7195. fontSize,
  7196. fontName,
  7197. fontColor
  7198. }) {
  7199. return `/${(0, _core_utils.escapePDFName)(fontName)} ${fontSize} Tf ${getPdfColor(fontColor, true)}`;
  7200. }
  7201. class FakeUnicodeFont {
  7202. constructor(xref, fontFamily) {
  7203. this.xref = xref;
  7204. this.widths = null;
  7205. this.firstChar = Infinity;
  7206. this.lastChar = -Infinity;
  7207. this.fontFamily = fontFamily;
  7208. const canvas = new OffscreenCanvas(1, 1);
  7209. this.ctxMeasure = canvas.getContext("2d");
  7210. if (!FakeUnicodeFont._fontNameId) {
  7211. FakeUnicodeFont._fontNameId = 1;
  7212. }
  7213. this.fontName = _primitives.Name.get(`InvalidPDFjsFont_${fontFamily}_${FakeUnicodeFont._fontNameId++}`);
  7214. }
  7215. get toUnicodeRef() {
  7216. if (!FakeUnicodeFont._toUnicodeRef) {
  7217. const toUnicode = `/CIDInit /ProcSet findresource begin
  7218. 12 dict begin
  7219. begincmap
  7220. /CIDSystemInfo
  7221. << /Registry (Adobe)
  7222. /Ordering (UCS) /Supplement 0 >> def
  7223. /CMapName /Adobe-Identity-UCS def
  7224. /CMapType 2 def
  7225. 1 begincodespacerange
  7226. <0000> <FFFF>
  7227. endcodespacerange
  7228. 1 beginbfrange
  7229. <0000> <FFFF> <0000>
  7230. endbfrange
  7231. endcmap CMapName currentdict /CMap defineresource pop end end`;
  7232. const toUnicodeStream = FakeUnicodeFont.toUnicodeStream = new _stream.StringStream(toUnicode);
  7233. const toUnicodeDict = new _primitives.Dict(this.xref);
  7234. toUnicodeStream.dict = toUnicodeDict;
  7235. toUnicodeDict.set("Length", toUnicode.length);
  7236. FakeUnicodeFont._toUnicodeRef = this.xref.getNewPersistentRef(toUnicodeStream);
  7237. }
  7238. return FakeUnicodeFont._toUnicodeRef;
  7239. }
  7240. get fontDescriptorRef() {
  7241. if (!FakeUnicodeFont._fontDescriptorRef) {
  7242. const fontDescriptor = new _primitives.Dict(this.xref);
  7243. fontDescriptor.set("Type", _primitives.Name.get("FontDescriptor"));
  7244. fontDescriptor.set("FontName", this.fontName);
  7245. fontDescriptor.set("FontFamily", "MyriadPro Regular");
  7246. fontDescriptor.set("FontBBox", [0, 0, 0, 0]);
  7247. fontDescriptor.set("FontStretch", _primitives.Name.get("Normal"));
  7248. fontDescriptor.set("FontWeight", 400);
  7249. fontDescriptor.set("ItalicAngle", 0);
  7250. FakeUnicodeFont._fontDescriptorRef = this.xref.getNewPersistentRef(fontDescriptor);
  7251. }
  7252. return FakeUnicodeFont._fontDescriptorRef;
  7253. }
  7254. get descendantFontRef() {
  7255. const descendantFont = new _primitives.Dict(this.xref);
  7256. descendantFont.set("BaseFont", this.fontName);
  7257. descendantFont.set("Type", _primitives.Name.get("Font"));
  7258. descendantFont.set("Subtype", _primitives.Name.get("CIDFontType0"));
  7259. descendantFont.set("CIDToGIDMap", _primitives.Name.get("Identity"));
  7260. descendantFont.set("FirstChar", this.firstChar);
  7261. descendantFont.set("LastChar", this.lastChar);
  7262. descendantFont.set("FontDescriptor", this.fontDescriptorRef);
  7263. descendantFont.set("DW", 1000);
  7264. const widths = [];
  7265. const chars = [...this.widths.entries()].sort();
  7266. let currentChar = null;
  7267. let currentWidths = null;
  7268. for (const [char, width] of chars) {
  7269. if (!currentChar) {
  7270. currentChar = char;
  7271. currentWidths = [width];
  7272. continue;
  7273. }
  7274. if (char === currentChar + currentWidths.length) {
  7275. currentWidths.push(width);
  7276. } else {
  7277. widths.push(currentChar, currentWidths);
  7278. currentChar = char;
  7279. currentWidths = [width];
  7280. }
  7281. }
  7282. if (currentChar) {
  7283. widths.push(currentChar, currentWidths);
  7284. }
  7285. descendantFont.set("W", widths);
  7286. const cidSystemInfo = new _primitives.Dict(this.xref);
  7287. cidSystemInfo.set("Ordering", "Identity");
  7288. cidSystemInfo.set("Registry", "Adobe");
  7289. cidSystemInfo.set("Supplement", 0);
  7290. descendantFont.set("CIDSystemInfo", cidSystemInfo);
  7291. return this.xref.getNewPersistentRef(descendantFont);
  7292. }
  7293. get baseFontRef() {
  7294. const baseFont = new _primitives.Dict(this.xref);
  7295. baseFont.set("BaseFont", this.fontName);
  7296. baseFont.set("Type", _primitives.Name.get("Font"));
  7297. baseFont.set("Subtype", _primitives.Name.get("Type0"));
  7298. baseFont.set("Encoding", _primitives.Name.get("Identity-H"));
  7299. baseFont.set("DescendantFonts", [this.descendantFontRef]);
  7300. baseFont.set("ToUnicode", this.toUnicodeRef);
  7301. return this.xref.getNewPersistentRef(baseFont);
  7302. }
  7303. get resources() {
  7304. const resources = new _primitives.Dict(this.xref);
  7305. const font = new _primitives.Dict(this.xref);
  7306. font.set(this.fontName.name, this.baseFontRef);
  7307. resources.set("Font", font);
  7308. return resources;
  7309. }
  7310. _createContext() {
  7311. this.widths = new Map();
  7312. this.ctxMeasure.font = `1000px ${this.fontFamily}`;
  7313. return this.ctxMeasure;
  7314. }
  7315. createFontResources(text) {
  7316. const ctx = this._createContext();
  7317. for (const line of text.split(/\r\n?|\n/)) {
  7318. for (const char of line.split("")) {
  7319. const code = char.charCodeAt(0);
  7320. if (this.widths.has(code)) {
  7321. continue;
  7322. }
  7323. const metrics = ctx.measureText(char);
  7324. const width = Math.ceil(metrics.width);
  7325. this.widths.set(code, width);
  7326. this.firstChar = Math.min(code, this.firstChar);
  7327. this.lastChar = Math.max(code, this.lastChar);
  7328. }
  7329. }
  7330. return this.resources;
  7331. }
  7332. createAppearance(text, rect, rotation, fontSize, bgColor) {
  7333. const ctx = this._createContext();
  7334. const lines = [];
  7335. let maxWidth = -Infinity;
  7336. for (const line of text.split(/\r\n?|\n/)) {
  7337. lines.push(line);
  7338. const lineWidth = ctx.measureText(line).width;
  7339. maxWidth = Math.max(maxWidth, lineWidth);
  7340. for (const char of line.split("")) {
  7341. const code = char.charCodeAt(0);
  7342. let width = this.widths.get(code);
  7343. if (width === undefined) {
  7344. const metrics = ctx.measureText(char);
  7345. width = Math.ceil(metrics.width);
  7346. this.widths.set(code, width);
  7347. this.firstChar = Math.min(code, this.firstChar);
  7348. this.lastChar = Math.max(code, this.lastChar);
  7349. }
  7350. }
  7351. }
  7352. maxWidth *= fontSize / 1000;
  7353. const [x1, y1, x2, y2] = rect;
  7354. let w = x2 - x1;
  7355. let h = y2 - y1;
  7356. if (rotation % 180 !== 0) {
  7357. [w, h] = [h, w];
  7358. }
  7359. let hscale = 1;
  7360. if (maxWidth > w) {
  7361. hscale = w / maxWidth;
  7362. }
  7363. let vscale = 1;
  7364. const lineHeight = _util.LINE_FACTOR * fontSize;
  7365. const lineDescent = _util.LINE_DESCENT_FACTOR * fontSize;
  7366. const maxHeight = lineHeight * lines.length;
  7367. if (maxHeight > h) {
  7368. vscale = h / maxHeight;
  7369. }
  7370. const fscale = Math.min(hscale, vscale);
  7371. const newFontSize = fontSize * fscale;
  7372. const buffer = ["q", `0 0 ${(0, _core_utils.numberToString)(w)} ${(0, _core_utils.numberToString)(h)} re W n`, `BT`, `1 0 0 1 0 ${(0, _core_utils.numberToString)(h + lineDescent)} Tm 0 Tc ${getPdfColor(bgColor, true)}`, `/${this.fontName.name} ${(0, _core_utils.numberToString)(newFontSize)} Tf`];
  7373. const vShift = (0, _core_utils.numberToString)(lineHeight);
  7374. for (const line of lines) {
  7375. buffer.push(`0 -${vShift} Td <${(0, _core_utils.stringToUTF16HexString)(line)}> Tj`);
  7376. }
  7377. buffer.push("ET", "Q");
  7378. const appearance = buffer.join("\n");
  7379. const appearanceStreamDict = new _primitives.Dict(this.xref);
  7380. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  7381. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  7382. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  7383. appearanceStreamDict.set("Length", appearance.length);
  7384. appearanceStreamDict.set("Resources", this.resources);
  7385. if (rotation) {
  7386. const matrix = (0, _core_utils.getRotationMatrix)(rotation, w, h);
  7387. appearanceStreamDict.set("Matrix", matrix);
  7388. }
  7389. const ap = new _stream.StringStream(appearance);
  7390. ap.dict = appearanceStreamDict;
  7391. return ap;
  7392. }
  7393. }
  7394. exports.FakeUnicodeFont = FakeUnicodeFont;
  7395. /***/ }),
  7396. /* 12 */
  7397. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  7398. Object.defineProperty(exports, "__esModule", ({
  7399. value: true
  7400. }));
  7401. exports.ColorSpace = void 0;
  7402. var _util = __w_pdfjs_require__(2);
  7403. var _primitives = __w_pdfjs_require__(3);
  7404. var _base_stream = __w_pdfjs_require__(5);
  7405. var _core_utils = __w_pdfjs_require__(4);
  7406. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  7407. const COMPONENTS = 3;
  7408. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  7409. const xRatio = w1 / w2;
  7410. const yRatio = h1 / h2;
  7411. let newIndex = 0,
  7412. oldIndex;
  7413. const xScaled = new Uint16Array(w2);
  7414. const w1Scanline = w1 * COMPONENTS;
  7415. for (let i = 0; i < w2; i++) {
  7416. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  7417. }
  7418. for (let i = 0; i < h2; i++) {
  7419. const py = Math.floor(i * yRatio) * w1Scanline;
  7420. for (let j = 0; j < w2; j++) {
  7421. oldIndex = py + xScaled[j];
  7422. dest[newIndex++] = src[oldIndex++];
  7423. dest[newIndex++] = src[oldIndex++];
  7424. dest[newIndex++] = src[oldIndex++];
  7425. newIndex += alpha01;
  7426. }
  7427. }
  7428. }
  7429. class ColorSpace {
  7430. constructor(name, numComps) {
  7431. if (this.constructor === ColorSpace) {
  7432. (0, _util.unreachable)("Cannot initialize ColorSpace.");
  7433. }
  7434. this.name = name;
  7435. this.numComps = numComps;
  7436. }
  7437. getRgb(src, srcOffset) {
  7438. const rgb = new Uint8ClampedArray(3);
  7439. this.getRgbItem(src, srcOffset, rgb, 0);
  7440. return rgb;
  7441. }
  7442. getRgbItem(src, srcOffset, dest, destOffset) {
  7443. (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
  7444. }
  7445. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7446. (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
  7447. }
  7448. getOutputLength(inputLength, alpha01) {
  7449. (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
  7450. }
  7451. isPassthrough(bits) {
  7452. return false;
  7453. }
  7454. isDefaultDecode(decodeMap, bpc) {
  7455. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  7456. }
  7457. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  7458. const count = originalWidth * originalHeight;
  7459. let rgbBuf = null;
  7460. const numComponentColors = 1 << bpc;
  7461. const needsResizing = originalHeight !== height || originalWidth !== width;
  7462. if (this.isPassthrough(bpc)) {
  7463. rgbBuf = comps;
  7464. } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
  7465. const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  7466. for (let i = 0; i < numComponentColors; i++) {
  7467. allColors[i] = i;
  7468. }
  7469. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  7470. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  7471. if (!needsResizing) {
  7472. let destPos = 0;
  7473. for (let i = 0; i < count; ++i) {
  7474. const key = comps[i] * 3;
  7475. dest[destPos++] = colorMap[key];
  7476. dest[destPos++] = colorMap[key + 1];
  7477. dest[destPos++] = colorMap[key + 2];
  7478. destPos += alpha01;
  7479. }
  7480. } else {
  7481. rgbBuf = new Uint8Array(count * 3);
  7482. let rgbPos = 0;
  7483. for (let i = 0; i < count; ++i) {
  7484. const key = comps[i] * 3;
  7485. rgbBuf[rgbPos++] = colorMap[key];
  7486. rgbBuf[rgbPos++] = colorMap[key + 1];
  7487. rgbBuf[rgbPos++] = colorMap[key + 2];
  7488. }
  7489. }
  7490. } else {
  7491. if (!needsResizing) {
  7492. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  7493. } else {
  7494. rgbBuf = new Uint8ClampedArray(count * 3);
  7495. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  7496. }
  7497. }
  7498. if (rgbBuf) {
  7499. if (needsResizing) {
  7500. resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
  7501. } else {
  7502. let destPos = 0,
  7503. rgbPos = 0;
  7504. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  7505. dest[destPos++] = rgbBuf[rgbPos++];
  7506. dest[destPos++] = rgbBuf[rgbPos++];
  7507. dest[destPos++] = rgbBuf[rgbPos++];
  7508. destPos += alpha01;
  7509. }
  7510. }
  7511. }
  7512. }
  7513. get usesZeroToOneRange() {
  7514. return (0, _util.shadow)(this, "usesZeroToOneRange", true);
  7515. }
  7516. static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
  7517. if (!localColorSpaceCache) {
  7518. throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.');
  7519. }
  7520. if (!parsedColorSpace) {
  7521. throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.');
  7522. }
  7523. let csName, csRef;
  7524. if (cacheKey instanceof _primitives.Ref) {
  7525. csRef = cacheKey;
  7526. cacheKey = xref.fetch(cacheKey);
  7527. }
  7528. if (cacheKey instanceof _primitives.Name) {
  7529. csName = cacheKey.name;
  7530. }
  7531. if (csName || csRef) {
  7532. localColorSpaceCache.set(csName, csRef, parsedColorSpace);
  7533. }
  7534. }
  7535. static getCached(cacheKey, xref, localColorSpaceCache) {
  7536. if (!localColorSpaceCache) {
  7537. throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.');
  7538. }
  7539. if (cacheKey instanceof _primitives.Ref) {
  7540. const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
  7541. if (localColorSpace) {
  7542. return localColorSpace;
  7543. }
  7544. try {
  7545. cacheKey = xref.fetch(cacheKey);
  7546. } catch (ex) {
  7547. if (ex instanceof _core_utils.MissingDataException) {
  7548. throw ex;
  7549. }
  7550. }
  7551. }
  7552. if (cacheKey instanceof _primitives.Name) {
  7553. const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
  7554. if (localColorSpace) {
  7555. return localColorSpace;
  7556. }
  7557. }
  7558. return null;
  7559. }
  7560. static async parseAsync({
  7561. cs,
  7562. xref,
  7563. resources = null,
  7564. pdfFunctionFactory,
  7565. localColorSpaceCache
  7566. }) {
  7567. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  7568. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  7569. return parsedColorSpace;
  7570. }
  7571. static parse({
  7572. cs,
  7573. xref,
  7574. resources = null,
  7575. pdfFunctionFactory,
  7576. localColorSpaceCache
  7577. }) {
  7578. const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
  7579. if (cachedColorSpace) {
  7580. return cachedColorSpace;
  7581. }
  7582. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  7583. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  7584. return parsedColorSpace;
  7585. }
  7586. static _parse(cs, xref, resources = null, pdfFunctionFactory) {
  7587. cs = xref.fetchIfRef(cs);
  7588. if (cs instanceof _primitives.Name) {
  7589. switch (cs.name) {
  7590. case "G":
  7591. case "DeviceGray":
  7592. return this.singletons.gray;
  7593. case "RGB":
  7594. case "DeviceRGB":
  7595. return this.singletons.rgb;
  7596. case "CMYK":
  7597. case "DeviceCMYK":
  7598. return this.singletons.cmyk;
  7599. case "Pattern":
  7600. return new PatternCS(null);
  7601. default:
  7602. if (resources instanceof _primitives.Dict) {
  7603. const colorSpaces = resources.get("ColorSpace");
  7604. if (colorSpaces instanceof _primitives.Dict) {
  7605. const resourcesCS = colorSpaces.get(cs.name);
  7606. if (resourcesCS) {
  7607. if (resourcesCS instanceof _primitives.Name) {
  7608. return this._parse(resourcesCS, xref, resources, pdfFunctionFactory);
  7609. }
  7610. cs = resourcesCS;
  7611. break;
  7612. }
  7613. }
  7614. }
  7615. throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`);
  7616. }
  7617. }
  7618. if (Array.isArray(cs)) {
  7619. const mode = xref.fetchIfRef(cs[0]).name;
  7620. let params, numComps, baseCS, whitePoint, blackPoint, gamma;
  7621. switch (mode) {
  7622. case "G":
  7623. case "DeviceGray":
  7624. return this.singletons.gray;
  7625. case "RGB":
  7626. case "DeviceRGB":
  7627. return this.singletons.rgb;
  7628. case "CMYK":
  7629. case "DeviceCMYK":
  7630. return this.singletons.cmyk;
  7631. case "CalGray":
  7632. params = xref.fetchIfRef(cs[1]);
  7633. whitePoint = params.getArray("WhitePoint");
  7634. blackPoint = params.getArray("BlackPoint");
  7635. gamma = params.get("Gamma");
  7636. return new CalGrayCS(whitePoint, blackPoint, gamma);
  7637. case "CalRGB":
  7638. params = xref.fetchIfRef(cs[1]);
  7639. whitePoint = params.getArray("WhitePoint");
  7640. blackPoint = params.getArray("BlackPoint");
  7641. gamma = params.getArray("Gamma");
  7642. const matrix = params.getArray("Matrix");
  7643. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  7644. case "ICCBased":
  7645. const stream = xref.fetchIfRef(cs[1]);
  7646. const dict = stream.dict;
  7647. numComps = dict.get("N");
  7648. const alt = dict.get("Alternate");
  7649. if (alt) {
  7650. const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
  7651. if (altCS.numComps === numComps) {
  7652. return altCS;
  7653. }
  7654. (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
  7655. }
  7656. if (numComps === 1) {
  7657. return this.singletons.gray;
  7658. } else if (numComps === 3) {
  7659. return this.singletons.rgb;
  7660. } else if (numComps === 4) {
  7661. return this.singletons.cmyk;
  7662. }
  7663. break;
  7664. case "Pattern":
  7665. baseCS = cs[1] || null;
  7666. if (baseCS) {
  7667. baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
  7668. }
  7669. return new PatternCS(baseCS);
  7670. case "I":
  7671. case "Indexed":
  7672. baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
  7673. const hiVal = xref.fetchIfRef(cs[2]) + 1;
  7674. const lookup = xref.fetchIfRef(cs[3]);
  7675. return new IndexedCS(baseCS, hiVal, lookup);
  7676. case "Separation":
  7677. case "DeviceN":
  7678. const name = xref.fetchIfRef(cs[1]);
  7679. numComps = Array.isArray(name) ? name.length : 1;
  7680. baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
  7681. const tintFn = pdfFunctionFactory.create(cs[3]);
  7682. return new AlternateCS(numComps, baseCS, tintFn);
  7683. case "Lab":
  7684. params = xref.fetchIfRef(cs[1]);
  7685. whitePoint = params.getArray("WhitePoint");
  7686. blackPoint = params.getArray("BlackPoint");
  7687. const range = params.getArray("Range");
  7688. return new LabCS(whitePoint, blackPoint, range);
  7689. default:
  7690. throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`);
  7691. }
  7692. }
  7693. throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`);
  7694. }
  7695. static isDefaultDecode(decode, numComps) {
  7696. if (!Array.isArray(decode)) {
  7697. return true;
  7698. }
  7699. if (numComps * 2 !== decode.length) {
  7700. (0, _util.warn)("The decode map is not the correct length");
  7701. return true;
  7702. }
  7703. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  7704. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  7705. return false;
  7706. }
  7707. }
  7708. return true;
  7709. }
  7710. static get singletons() {
  7711. return (0, _util.shadow)(this, "singletons", {
  7712. get gray() {
  7713. return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
  7714. },
  7715. get rgb() {
  7716. return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
  7717. },
  7718. get cmyk() {
  7719. return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
  7720. }
  7721. });
  7722. }
  7723. }
  7724. exports.ColorSpace = ColorSpace;
  7725. class AlternateCS extends ColorSpace {
  7726. constructor(numComps, base, tintFn) {
  7727. super("Alternate", numComps);
  7728. this.base = base;
  7729. this.tintFn = tintFn;
  7730. this.tmpBuf = new Float32Array(base.numComps);
  7731. }
  7732. getRgbItem(src, srcOffset, dest, destOffset) {
  7733. const tmpBuf = this.tmpBuf;
  7734. this.tintFn(src, srcOffset, tmpBuf, 0);
  7735. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  7736. }
  7737. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7738. const tintFn = this.tintFn;
  7739. const base = this.base;
  7740. const scale = 1 / ((1 << bits) - 1);
  7741. const baseNumComps = base.numComps;
  7742. const usesZeroToOneRange = base.usesZeroToOneRange;
  7743. const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  7744. let pos = isPassthrough ? destOffset : 0;
  7745. const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
  7746. const numComps = this.numComps;
  7747. const scaled = new Float32Array(numComps);
  7748. const tinted = new Float32Array(baseNumComps);
  7749. let i, j;
  7750. for (i = 0; i < count; i++) {
  7751. for (j = 0; j < numComps; j++) {
  7752. scaled[j] = src[srcOffset++] * scale;
  7753. }
  7754. tintFn(scaled, 0, tinted, 0);
  7755. if (usesZeroToOneRange) {
  7756. for (j = 0; j < baseNumComps; j++) {
  7757. baseBuf[pos++] = tinted[j] * 255;
  7758. }
  7759. } else {
  7760. base.getRgbItem(tinted, 0, baseBuf, pos);
  7761. pos += baseNumComps;
  7762. }
  7763. }
  7764. if (!isPassthrough) {
  7765. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  7766. }
  7767. }
  7768. getOutputLength(inputLength, alpha01) {
  7769. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  7770. }
  7771. }
  7772. class PatternCS extends ColorSpace {
  7773. constructor(baseCS) {
  7774. super("Pattern", null);
  7775. this.base = baseCS;
  7776. }
  7777. isDefaultDecode(decodeMap, bpc) {
  7778. (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
  7779. }
  7780. }
  7781. class IndexedCS extends ColorSpace {
  7782. constructor(base, highVal, lookup) {
  7783. super("Indexed", 1);
  7784. this.base = base;
  7785. this.highVal = highVal;
  7786. const length = base.numComps * highVal;
  7787. this.lookup = new Uint8Array(length);
  7788. if (lookup instanceof _base_stream.BaseStream) {
  7789. const bytes = lookup.getBytes(length);
  7790. this.lookup.set(bytes);
  7791. } else if (typeof lookup === "string") {
  7792. for (let i = 0; i < length; ++i) {
  7793. this.lookup[i] = lookup.charCodeAt(i) & 0xff;
  7794. }
  7795. } else {
  7796. throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
  7797. }
  7798. }
  7799. getRgbItem(src, srcOffset, dest, destOffset) {
  7800. const numComps = this.base.numComps;
  7801. const start = src[srcOffset] * numComps;
  7802. this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
  7803. }
  7804. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7805. const base = this.base;
  7806. const numComps = base.numComps;
  7807. const outputDelta = base.getOutputLength(numComps, alpha01);
  7808. const lookup = this.lookup;
  7809. for (let i = 0; i < count; ++i) {
  7810. const lookupPos = src[srcOffset++] * numComps;
  7811. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  7812. destOffset += outputDelta;
  7813. }
  7814. }
  7815. getOutputLength(inputLength, alpha01) {
  7816. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  7817. }
  7818. isDefaultDecode(decodeMap, bpc) {
  7819. if (!Array.isArray(decodeMap)) {
  7820. return true;
  7821. }
  7822. if (decodeMap.length !== 2) {
  7823. (0, _util.warn)("Decode map length is not correct");
  7824. return true;
  7825. }
  7826. if (!Number.isInteger(bpc) || bpc < 1) {
  7827. (0, _util.warn)("Bits per component is not correct");
  7828. return true;
  7829. }
  7830. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  7831. }
  7832. }
  7833. class DeviceGrayCS extends ColorSpace {
  7834. constructor() {
  7835. super("DeviceGray", 1);
  7836. }
  7837. getRgbItem(src, srcOffset, dest, destOffset) {
  7838. const c = src[srcOffset] * 255;
  7839. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  7840. }
  7841. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7842. const scale = 255 / ((1 << bits) - 1);
  7843. let j = srcOffset,
  7844. q = destOffset;
  7845. for (let i = 0; i < count; ++i) {
  7846. const c = scale * src[j++];
  7847. dest[q++] = c;
  7848. dest[q++] = c;
  7849. dest[q++] = c;
  7850. q += alpha01;
  7851. }
  7852. }
  7853. getOutputLength(inputLength, alpha01) {
  7854. return inputLength * (3 + alpha01);
  7855. }
  7856. }
  7857. class DeviceRgbCS extends ColorSpace {
  7858. constructor() {
  7859. super("DeviceRGB", 3);
  7860. }
  7861. getRgbItem(src, srcOffset, dest, destOffset) {
  7862. dest[destOffset] = src[srcOffset] * 255;
  7863. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  7864. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  7865. }
  7866. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7867. if (bits === 8 && alpha01 === 0) {
  7868. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  7869. return;
  7870. }
  7871. const scale = 255 / ((1 << bits) - 1);
  7872. let j = srcOffset,
  7873. q = destOffset;
  7874. for (let i = 0; i < count; ++i) {
  7875. dest[q++] = scale * src[j++];
  7876. dest[q++] = scale * src[j++];
  7877. dest[q++] = scale * src[j++];
  7878. q += alpha01;
  7879. }
  7880. }
  7881. getOutputLength(inputLength, alpha01) {
  7882. return inputLength * (3 + alpha01) / 3 | 0;
  7883. }
  7884. isPassthrough(bits) {
  7885. return bits === 8;
  7886. }
  7887. }
  7888. const DeviceCmykCS = function DeviceCmykCSClosure() {
  7889. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  7890. const c = src[srcOffset] * srcScale;
  7891. const m = src[srcOffset + 1] * srcScale;
  7892. const y = src[srcOffset + 2] * srcScale;
  7893. const k = src[srcOffset + 3] * srcScale;
  7894. dest[destOffset] = 255 + c * (-4.387332384609988 * c + 54.48615194189176 * m + 18.82290502165302 * y + 212.25662451639585 * k + -285.2331026137004) + m * (1.7149763477362134 * m - 5.6096736904047315 * y + -17.873870861415444 * k - 5.497006427196366) + y * (-2.5217340131683033 * y - 21.248923337353073 * k + 17.5119270841813) + k * (-21.86122147463605 * k - 189.48180835922747);
  7895. dest[destOffset + 1] = 255 + c * (8.841041422036149 * c + 60.118027045597366 * m + 6.871425592049007 * y + 31.159100130055922 * k + -79.2970844816548) + m * (-15.310361306967817 * m + 17.575251261109482 * y + 131.35250912493976 * k - 190.9453302588951) + y * (4.444339102852739 * y + 9.8632861493405 * k - 24.86741582555878) + k * (-20.737325471181034 * k - 187.80453709719578);
  7896. dest[destOffset + 2] = 255 + c * (0.8842522430003296 * c + 8.078677503112928 * m + 30.89978309703729 * y - 0.23883238689178934 * k + -14.183576799673286) + m * (10.49593273432072 * m + 63.02378494754052 * y + 50.606957656360734 * k - 112.23884253719248) + y * (0.03296041114873217 * y + 115.60384449646641 * k + -193.58209356861505) + k * (-22.33816807309886 * k - 180.12613974708367);
  7897. }
  7898. class DeviceCmykCS extends ColorSpace {
  7899. constructor() {
  7900. super("DeviceCMYK", 4);
  7901. }
  7902. getRgbItem(src, srcOffset, dest, destOffset) {
  7903. convertToRgb(src, srcOffset, 1, dest, destOffset);
  7904. }
  7905. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7906. const scale = 1 / ((1 << bits) - 1);
  7907. for (let i = 0; i < count; i++) {
  7908. convertToRgb(src, srcOffset, scale, dest, destOffset);
  7909. srcOffset += 4;
  7910. destOffset += 3 + alpha01;
  7911. }
  7912. }
  7913. getOutputLength(inputLength, alpha01) {
  7914. return inputLength / 4 * (3 + alpha01) | 0;
  7915. }
  7916. }
  7917. return DeviceCmykCS;
  7918. }();
  7919. const CalGrayCS = function CalGrayCSClosure() {
  7920. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  7921. const A = src[srcOffset] * scale;
  7922. const AG = A ** cs.G;
  7923. const L = cs.YW * AG;
  7924. const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0);
  7925. dest[destOffset] = val;
  7926. dest[destOffset + 1] = val;
  7927. dest[destOffset + 2] = val;
  7928. }
  7929. class CalGrayCS extends ColorSpace {
  7930. constructor(whitePoint, blackPoint, gamma) {
  7931. super("CalGray", 1);
  7932. if (!whitePoint) {
  7933. throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
  7934. }
  7935. blackPoint = blackPoint || [0, 0, 0];
  7936. gamma = gamma || 1;
  7937. this.XW = whitePoint[0];
  7938. this.YW = whitePoint[1];
  7939. this.ZW = whitePoint[2];
  7940. this.XB = blackPoint[0];
  7941. this.YB = blackPoint[1];
  7942. this.ZB = blackPoint[2];
  7943. this.G = gamma;
  7944. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  7945. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  7946. }
  7947. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  7948. (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
  7949. this.XB = this.YB = this.ZB = 0;
  7950. }
  7951. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  7952. (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
  7953. }
  7954. if (this.G < 1) {
  7955. (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default.");
  7956. this.G = 1;
  7957. }
  7958. }
  7959. getRgbItem(src, srcOffset, dest, destOffset) {
  7960. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  7961. }
  7962. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7963. const scale = 1 / ((1 << bits) - 1);
  7964. for (let i = 0; i < count; ++i) {
  7965. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  7966. srcOffset += 1;
  7967. destOffset += 3 + alpha01;
  7968. }
  7969. }
  7970. getOutputLength(inputLength, alpha01) {
  7971. return inputLength * (3 + alpha01);
  7972. }
  7973. }
  7974. return CalGrayCS;
  7975. }();
  7976. const CalRGBCS = function CalRGBCSClosure() {
  7977. const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  7978. const BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([0.9869929, -0.1470543, 0.1599627, 0.4323053, 0.5183603, 0.0492912, -0.0085287, 0.0400428, 0.9684867]);
  7979. const SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([3.2404542, -1.5371385, -0.4985314, -0.9692660, 1.8760108, 0.0415560, 0.0556434, -0.2040259, 1.0572252]);
  7980. const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  7981. const tempNormalizeMatrix = new Float32Array(3);
  7982. const tempConvertMatrix1 = new Float32Array(3);
  7983. const tempConvertMatrix2 = new Float32Array(3);
  7984. const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  7985. function matrixProduct(a, b, result) {
  7986. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  7987. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  7988. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  7989. }
  7990. function convertToFlat(sourceWhitePoint, LMS, result) {
  7991. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  7992. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  7993. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  7994. }
  7995. function convertToD65(sourceWhitePoint, LMS, result) {
  7996. const D65X = 0.95047;
  7997. const D65Y = 1;
  7998. const D65Z = 1.08883;
  7999. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  8000. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  8001. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  8002. }
  8003. function sRGBTransferFunction(color) {
  8004. if (color <= 0.0031308) {
  8005. return adjustToRange(0, 1, 12.92 * color);
  8006. }
  8007. if (color >= 0.99554525) {
  8008. return 1;
  8009. }
  8010. return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
  8011. }
  8012. function adjustToRange(min, max, value) {
  8013. return Math.max(min, Math.min(max, value));
  8014. }
  8015. function decodeL(L) {
  8016. if (L < 0) {
  8017. return -decodeL(-L);
  8018. }
  8019. if (L > 8.0) {
  8020. return ((L + 16) / 116) ** 3;
  8021. }
  8022. return L * DECODE_L_CONSTANT;
  8023. }
  8024. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  8025. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  8026. result[0] = XYZ_Flat[0];
  8027. result[1] = XYZ_Flat[1];
  8028. result[2] = XYZ_Flat[2];
  8029. return;
  8030. }
  8031. const zeroDecodeL = decodeL(0);
  8032. const X_DST = zeroDecodeL;
  8033. const X_SRC = decodeL(sourceBlackPoint[0]);
  8034. const Y_DST = zeroDecodeL;
  8035. const Y_SRC = decodeL(sourceBlackPoint[1]);
  8036. const Z_DST = zeroDecodeL;
  8037. const Z_SRC = decodeL(sourceBlackPoint[2]);
  8038. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  8039. const X_Offset = 1 - X_Scale;
  8040. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  8041. const Y_Offset = 1 - Y_Scale;
  8042. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  8043. const Z_Offset = 1 - Z_Scale;
  8044. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  8045. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  8046. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  8047. }
  8048. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  8049. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  8050. result[0] = XYZ_In[0];
  8051. result[1] = XYZ_In[1];
  8052. result[2] = XYZ_In[2];
  8053. return;
  8054. }
  8055. const LMS = result;
  8056. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  8057. const LMS_Flat = tempNormalizeMatrix;
  8058. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  8059. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  8060. }
  8061. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  8062. const LMS = result;
  8063. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  8064. const LMS_D65 = tempNormalizeMatrix;
  8065. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  8066. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  8067. }
  8068. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  8069. const A = adjustToRange(0, 1, src[srcOffset] * scale);
  8070. const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  8071. const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  8072. const AGR = A === 1 ? 1 : A ** cs.GR;
  8073. const BGG = B === 1 ? 1 : B ** cs.GG;
  8074. const CGB = C === 1 ? 1 : C ** cs.GB;
  8075. const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  8076. const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  8077. const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  8078. const XYZ = tempConvertMatrix1;
  8079. XYZ[0] = X;
  8080. XYZ[1] = Y;
  8081. XYZ[2] = Z;
  8082. const XYZ_Flat = tempConvertMatrix2;
  8083. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  8084. const XYZ_Black = tempConvertMatrix1;
  8085. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  8086. const XYZ_D65 = tempConvertMatrix2;
  8087. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  8088. const SRGB = tempConvertMatrix1;
  8089. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  8090. dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
  8091. dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
  8092. dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
  8093. }
  8094. class CalRGBCS extends ColorSpace {
  8095. constructor(whitePoint, blackPoint, gamma, matrix) {
  8096. super("CalRGB", 3);
  8097. if (!whitePoint) {
  8098. throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
  8099. }
  8100. blackPoint = blackPoint || new Float32Array(3);
  8101. gamma = gamma || new Float32Array([1, 1, 1]);
  8102. matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  8103. const XW = whitePoint[0];
  8104. const YW = whitePoint[1];
  8105. const ZW = whitePoint[2];
  8106. this.whitePoint = whitePoint;
  8107. const XB = blackPoint[0];
  8108. const YB = blackPoint[1];
  8109. const ZB = blackPoint[2];
  8110. this.blackPoint = blackPoint;
  8111. this.GR = gamma[0];
  8112. this.GG = gamma[1];
  8113. this.GB = gamma[2];
  8114. this.MXA = matrix[0];
  8115. this.MYA = matrix[1];
  8116. this.MZA = matrix[2];
  8117. this.MXB = matrix[3];
  8118. this.MYB = matrix[4];
  8119. this.MZB = matrix[5];
  8120. this.MXC = matrix[6];
  8121. this.MYC = matrix[7];
  8122. this.MZC = matrix[8];
  8123. if (XW < 0 || ZW < 0 || YW !== 1) {
  8124. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  8125. }
  8126. if (XB < 0 || YB < 0 || ZB < 0) {
  8127. (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
  8128. this.blackPoint = new Float32Array(3);
  8129. }
  8130. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  8131. (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
  8132. this.GR = this.GG = this.GB = 1;
  8133. }
  8134. }
  8135. getRgbItem(src, srcOffset, dest, destOffset) {
  8136. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  8137. }
  8138. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8139. const scale = 1 / ((1 << bits) - 1);
  8140. for (let i = 0; i < count; ++i) {
  8141. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  8142. srcOffset += 3;
  8143. destOffset += 3 + alpha01;
  8144. }
  8145. }
  8146. getOutputLength(inputLength, alpha01) {
  8147. return inputLength * (3 + alpha01) / 3 | 0;
  8148. }
  8149. }
  8150. return CalRGBCS;
  8151. }();
  8152. const LabCS = function LabCSClosure() {
  8153. function fn_g(x) {
  8154. let result;
  8155. if (x >= 6 / 29) {
  8156. result = x ** 3;
  8157. } else {
  8158. result = 108 / 841 * (x - 4 / 29);
  8159. }
  8160. return result;
  8161. }
  8162. function decode(value, high1, low2, high2) {
  8163. return low2 + value * (high2 - low2) / high1;
  8164. }
  8165. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  8166. let Ls = src[srcOffset];
  8167. let as = src[srcOffset + 1];
  8168. let bs = src[srcOffset + 2];
  8169. if (maxVal !== false) {
  8170. Ls = decode(Ls, maxVal, 0, 100);
  8171. as = decode(as, maxVal, cs.amin, cs.amax);
  8172. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  8173. }
  8174. if (as > cs.amax) {
  8175. as = cs.amax;
  8176. } else if (as < cs.amin) {
  8177. as = cs.amin;
  8178. }
  8179. if (bs > cs.bmax) {
  8180. bs = cs.bmax;
  8181. } else if (bs < cs.bmin) {
  8182. bs = cs.bmin;
  8183. }
  8184. const M = (Ls + 16) / 116;
  8185. const L = M + as / 500;
  8186. const N = M - bs / 200;
  8187. const X = cs.XW * fn_g(L);
  8188. const Y = cs.YW * fn_g(M);
  8189. const Z = cs.ZW * fn_g(N);
  8190. let r, g, b;
  8191. if (cs.ZW < 1) {
  8192. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  8193. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  8194. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  8195. } else {
  8196. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  8197. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  8198. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  8199. }
  8200. dest[destOffset] = Math.sqrt(r) * 255;
  8201. dest[destOffset + 1] = Math.sqrt(g) * 255;
  8202. dest[destOffset + 2] = Math.sqrt(b) * 255;
  8203. }
  8204. class LabCS extends ColorSpace {
  8205. constructor(whitePoint, blackPoint, range) {
  8206. super("Lab", 3);
  8207. if (!whitePoint) {
  8208. throw new _util.FormatError("WhitePoint missing - required for color space Lab");
  8209. }
  8210. blackPoint = blackPoint || [0, 0, 0];
  8211. range = range || [-100, 100, -100, 100];
  8212. this.XW = whitePoint[0];
  8213. this.YW = whitePoint[1];
  8214. this.ZW = whitePoint[2];
  8215. this.amin = range[0];
  8216. this.amax = range[1];
  8217. this.bmin = range[2];
  8218. this.bmax = range[3];
  8219. this.XB = blackPoint[0];
  8220. this.YB = blackPoint[1];
  8221. this.ZB = blackPoint[2];
  8222. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  8223. throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
  8224. }
  8225. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  8226. (0, _util.info)("Invalid BlackPoint, falling back to default");
  8227. this.XB = this.YB = this.ZB = 0;
  8228. }
  8229. if (this.amin > this.amax || this.bmin > this.bmax) {
  8230. (0, _util.info)("Invalid Range, falling back to defaults");
  8231. this.amin = -100;
  8232. this.amax = 100;
  8233. this.bmin = -100;
  8234. this.bmax = 100;
  8235. }
  8236. }
  8237. getRgbItem(src, srcOffset, dest, destOffset) {
  8238. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  8239. }
  8240. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8241. const maxVal = (1 << bits) - 1;
  8242. for (let i = 0; i < count; i++) {
  8243. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  8244. srcOffset += 3;
  8245. destOffset += 3 + alpha01;
  8246. }
  8247. }
  8248. getOutputLength(inputLength, alpha01) {
  8249. return inputLength * (3 + alpha01) / 3 | 0;
  8250. }
  8251. isDefaultDecode(decodeMap, bpc) {
  8252. return true;
  8253. }
  8254. get usesZeroToOneRange() {
  8255. return (0, _util.shadow)(this, "usesZeroToOneRange", false);
  8256. }
  8257. }
  8258. return LabCS;
  8259. }();
  8260. /***/ }),
  8261. /* 13 */
  8262. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  8263. Object.defineProperty(exports, "__esModule", ({
  8264. value: true
  8265. }));
  8266. exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0;
  8267. var _util = __w_pdfjs_require__(2);
  8268. var _cmap = __w_pdfjs_require__(14);
  8269. var _primitives = __w_pdfjs_require__(3);
  8270. var _fonts = __w_pdfjs_require__(32);
  8271. var _fonts_utils = __w_pdfjs_require__(36);
  8272. var _encodings = __w_pdfjs_require__(35);
  8273. var _standard_fonts = __w_pdfjs_require__(39);
  8274. var _pattern = __w_pdfjs_require__(48);
  8275. var _xfa_fonts = __w_pdfjs_require__(49);
  8276. var _to_unicode_map = __w_pdfjs_require__(40);
  8277. var _function = __w_pdfjs_require__(55);
  8278. var _parser = __w_pdfjs_require__(15);
  8279. var _image_utils = __w_pdfjs_require__(57);
  8280. var _stream = __w_pdfjs_require__(8);
  8281. var _base_stream = __w_pdfjs_require__(5);
  8282. var _bidi = __w_pdfjs_require__(58);
  8283. var _colorspace = __w_pdfjs_require__(12);
  8284. var _decode_stream = __w_pdfjs_require__(17);
  8285. var _glyphlist = __w_pdfjs_require__(37);
  8286. var _core_utils = __w_pdfjs_require__(4);
  8287. var _metrics = __w_pdfjs_require__(43);
  8288. var _unicode = __w_pdfjs_require__(38);
  8289. var _murmurhash = __w_pdfjs_require__(59);
  8290. var _operator_list = __w_pdfjs_require__(60);
  8291. var _image = __w_pdfjs_require__(61);
  8292. const DefaultPartialEvaluatorOptions = Object.freeze({
  8293. maxImageSize: -1,
  8294. disableFontFace: false,
  8295. ignoreErrors: false,
  8296. isEvalSupported: true,
  8297. isOffscreenCanvasSupported: true,
  8298. fontExtraProperties: false,
  8299. useSystemFonts: true,
  8300. cMapUrl: null,
  8301. standardFontDataUrl: null
  8302. });
  8303. const PatternType = {
  8304. TILING: 1,
  8305. SHADING: 2
  8306. };
  8307. const TEXT_CHUNK_BATCH_SIZE = 10;
  8308. const deferred = Promise.resolve();
  8309. function normalizeBlendMode(value, parsingArray = false) {
  8310. if (Array.isArray(value)) {
  8311. for (const val of value) {
  8312. const maybeBM = normalizeBlendMode(val, true);
  8313. if (maybeBM) {
  8314. return maybeBM;
  8315. }
  8316. }
  8317. (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
  8318. return "source-over";
  8319. }
  8320. if (!(value instanceof _primitives.Name)) {
  8321. if (parsingArray) {
  8322. return null;
  8323. }
  8324. return "source-over";
  8325. }
  8326. switch (value.name) {
  8327. case "Normal":
  8328. case "Compatible":
  8329. return "source-over";
  8330. case "Multiply":
  8331. return "multiply";
  8332. case "Screen":
  8333. return "screen";
  8334. case "Overlay":
  8335. return "overlay";
  8336. case "Darken":
  8337. return "darken";
  8338. case "Lighten":
  8339. return "lighten";
  8340. case "ColorDodge":
  8341. return "color-dodge";
  8342. case "ColorBurn":
  8343. return "color-burn";
  8344. case "HardLight":
  8345. return "hard-light";
  8346. case "SoftLight":
  8347. return "soft-light";
  8348. case "Difference":
  8349. return "difference";
  8350. case "Exclusion":
  8351. return "exclusion";
  8352. case "Hue":
  8353. return "hue";
  8354. case "Saturation":
  8355. return "saturation";
  8356. case "Color":
  8357. return "color";
  8358. case "Luminosity":
  8359. return "luminosity";
  8360. }
  8361. if (parsingArray) {
  8362. return null;
  8363. }
  8364. (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
  8365. return "source-over";
  8366. }
  8367. function incrementCachedImageMaskCount(data) {
  8368. if (data.fn === _util.OPS.paintImageMaskXObject && data.args[0] && data.args[0].count > 0) {
  8369. data.args[0].count++;
  8370. }
  8371. }
  8372. class TimeSlotManager {
  8373. static get TIME_SLOT_DURATION_MS() {
  8374. return (0, _util.shadow)(this, "TIME_SLOT_DURATION_MS", 20);
  8375. }
  8376. static get CHECK_TIME_EVERY() {
  8377. return (0, _util.shadow)(this, "CHECK_TIME_EVERY", 100);
  8378. }
  8379. constructor() {
  8380. this.reset();
  8381. }
  8382. check() {
  8383. if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
  8384. return false;
  8385. }
  8386. this.checked = 0;
  8387. return this.endTime <= Date.now();
  8388. }
  8389. reset() {
  8390. this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
  8391. this.checked = 0;
  8392. }
  8393. }
  8394. class PartialEvaluator {
  8395. constructor({
  8396. xref,
  8397. handler,
  8398. pageIndex,
  8399. idFactory,
  8400. fontCache,
  8401. builtInCMapCache,
  8402. standardFontDataCache,
  8403. globalImageCache,
  8404. options = null
  8405. }) {
  8406. this.xref = xref;
  8407. this.handler = handler;
  8408. this.pageIndex = pageIndex;
  8409. this.idFactory = idFactory;
  8410. this.fontCache = fontCache;
  8411. this.builtInCMapCache = builtInCMapCache;
  8412. this.standardFontDataCache = standardFontDataCache;
  8413. this.globalImageCache = globalImageCache;
  8414. this.options = options || DefaultPartialEvaluatorOptions;
  8415. this.parsingType3Font = false;
  8416. this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
  8417. }
  8418. get _pdfFunctionFactory() {
  8419. const pdfFunctionFactory = new _function.PDFFunctionFactory({
  8420. xref: this.xref,
  8421. isEvalSupported: this.options.isEvalSupported
  8422. });
  8423. return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory);
  8424. }
  8425. clone(newOptions = null) {
  8426. const newEvaluator = Object.create(this);
  8427. newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
  8428. return newEvaluator;
  8429. }
  8430. hasBlendModes(resources, nonBlendModesSet) {
  8431. if (!(resources instanceof _primitives.Dict)) {
  8432. return false;
  8433. }
  8434. if (resources.objId && nonBlendModesSet.has(resources.objId)) {
  8435. return false;
  8436. }
  8437. const processed = new _primitives.RefSet(nonBlendModesSet);
  8438. if (resources.objId) {
  8439. processed.put(resources.objId);
  8440. }
  8441. const nodes = [resources],
  8442. xref = this.xref;
  8443. while (nodes.length) {
  8444. const node = nodes.shift();
  8445. const graphicStates = node.get("ExtGState");
  8446. if (graphicStates instanceof _primitives.Dict) {
  8447. for (let graphicState of graphicStates.getRawValues()) {
  8448. if (graphicState instanceof _primitives.Ref) {
  8449. if (processed.has(graphicState)) {
  8450. continue;
  8451. }
  8452. try {
  8453. graphicState = xref.fetch(graphicState);
  8454. } catch (ex) {
  8455. processed.put(graphicState);
  8456. (0, _util.info)(`hasBlendModes - ignoring ExtGState: "${ex}".`);
  8457. continue;
  8458. }
  8459. }
  8460. if (!(graphicState instanceof _primitives.Dict)) {
  8461. continue;
  8462. }
  8463. if (graphicState.objId) {
  8464. processed.put(graphicState.objId);
  8465. }
  8466. const bm = graphicState.get("BM");
  8467. if (bm instanceof _primitives.Name) {
  8468. if (bm.name !== "Normal") {
  8469. return true;
  8470. }
  8471. continue;
  8472. }
  8473. if (bm !== undefined && Array.isArray(bm)) {
  8474. for (const element of bm) {
  8475. if (element instanceof _primitives.Name && element.name !== "Normal") {
  8476. return true;
  8477. }
  8478. }
  8479. }
  8480. }
  8481. }
  8482. const xObjects = node.get("XObject");
  8483. if (!(xObjects instanceof _primitives.Dict)) {
  8484. continue;
  8485. }
  8486. for (let xObject of xObjects.getRawValues()) {
  8487. if (xObject instanceof _primitives.Ref) {
  8488. if (processed.has(xObject)) {
  8489. continue;
  8490. }
  8491. try {
  8492. xObject = xref.fetch(xObject);
  8493. } catch (ex) {
  8494. processed.put(xObject);
  8495. (0, _util.info)(`hasBlendModes - ignoring XObject: "${ex}".`);
  8496. continue;
  8497. }
  8498. }
  8499. if (!(xObject instanceof _base_stream.BaseStream)) {
  8500. continue;
  8501. }
  8502. if (xObject.dict.objId) {
  8503. processed.put(xObject.dict.objId);
  8504. }
  8505. const xResources = xObject.dict.get("Resources");
  8506. if (!(xResources instanceof _primitives.Dict)) {
  8507. continue;
  8508. }
  8509. if (xResources.objId && processed.has(xResources.objId)) {
  8510. continue;
  8511. }
  8512. nodes.push(xResources);
  8513. if (xResources.objId) {
  8514. processed.put(xResources.objId);
  8515. }
  8516. }
  8517. }
  8518. for (const ref of processed) {
  8519. nonBlendModesSet.put(ref);
  8520. }
  8521. return false;
  8522. }
  8523. async fetchBuiltInCMap(name) {
  8524. const cachedData = this.builtInCMapCache.get(name);
  8525. if (cachedData) {
  8526. return cachedData;
  8527. }
  8528. let data;
  8529. if (this.options.cMapUrl !== null) {
  8530. const url = `${this.options.cMapUrl}${name}.bcmap`;
  8531. const response = await fetch(url);
  8532. if (!response.ok) {
  8533. throw new Error(`fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`);
  8534. }
  8535. data = {
  8536. cMapData: new Uint8Array(await response.arrayBuffer()),
  8537. compressionType: _util.CMapCompressionType.BINARY
  8538. };
  8539. } else {
  8540. data = await this.handler.sendWithPromise("FetchBuiltInCMap", {
  8541. name
  8542. });
  8543. }
  8544. if (data.compressionType !== _util.CMapCompressionType.NONE) {
  8545. this.builtInCMapCache.set(name, data);
  8546. }
  8547. return data;
  8548. }
  8549. async fetchStandardFontData(name) {
  8550. const cachedData = this.standardFontDataCache.get(name);
  8551. if (cachedData) {
  8552. return new _stream.Stream(cachedData);
  8553. }
  8554. if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") {
  8555. return null;
  8556. }
  8557. const standardFontNameToFileName = (0, _standard_fonts.getFontNameToFileMap)(),
  8558. filename = standardFontNameToFileName[name];
  8559. let data;
  8560. if (this.options.standardFontDataUrl !== null) {
  8561. const url = `${this.options.standardFontDataUrl}${filename}`;
  8562. const response = await fetch(url);
  8563. if (!response.ok) {
  8564. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`);
  8565. } else {
  8566. data = await response.arrayBuffer();
  8567. }
  8568. } else {
  8569. try {
  8570. data = await this.handler.sendWithPromise("FetchStandardFontData", {
  8571. filename
  8572. });
  8573. } catch (e) {
  8574. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`);
  8575. }
  8576. }
  8577. if (!data) {
  8578. return null;
  8579. }
  8580. this.standardFontDataCache.set(name, data);
  8581. return new _stream.Stream(data);
  8582. }
  8583. async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) {
  8584. const dict = xobj.dict;
  8585. const matrix = dict.getArray("Matrix");
  8586. let bbox = dict.getArray("BBox");
  8587. if (Array.isArray(bbox) && bbox.length === 4) {
  8588. bbox = _util.Util.normalizeRect(bbox);
  8589. } else {
  8590. bbox = null;
  8591. }
  8592. let optionalContent, groupOptions;
  8593. if (dict.has("OC")) {
  8594. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  8595. }
  8596. if (optionalContent !== undefined) {
  8597. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  8598. }
  8599. const group = dict.get("Group");
  8600. if (group) {
  8601. groupOptions = {
  8602. matrix,
  8603. bbox,
  8604. smask,
  8605. isolated: false,
  8606. knockout: false
  8607. };
  8608. const groupSubtype = group.get("S");
  8609. let colorSpace = null;
  8610. if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
  8611. groupOptions.isolated = group.get("I") || false;
  8612. groupOptions.knockout = group.get("K") || false;
  8613. if (group.has("CS")) {
  8614. const cs = group.getRaw("CS");
  8615. const cachedColorSpace = _colorspace.ColorSpace.getCached(cs, this.xref, localColorSpaceCache);
  8616. if (cachedColorSpace) {
  8617. colorSpace = cachedColorSpace;
  8618. } else {
  8619. colorSpace = await this.parseColorSpace({
  8620. cs,
  8621. resources,
  8622. localColorSpaceCache
  8623. });
  8624. }
  8625. }
  8626. }
  8627. if (smask && smask.backdrop) {
  8628. colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
  8629. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  8630. }
  8631. operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
  8632. }
  8633. const args = group ? [matrix, null] : [matrix, bbox];
  8634. operatorList.addOp(_util.OPS.paintFormXObjectBegin, args);
  8635. return this.getOperatorList({
  8636. stream: xobj,
  8637. task,
  8638. resources: dict.get("Resources") || resources,
  8639. operatorList,
  8640. initialState
  8641. }).then(function () {
  8642. operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
  8643. if (group) {
  8644. operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
  8645. }
  8646. if (optionalContent !== undefined) {
  8647. operatorList.addOp(_util.OPS.endMarkedContent, []);
  8648. }
  8649. });
  8650. }
  8651. _sendImgData(objId, imgData, cacheGlobally = false) {
  8652. const transfers = imgData ? [imgData.bitmap || imgData.data.buffer] : null;
  8653. if (this.parsingType3Font || cacheGlobally) {
  8654. return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
  8655. }
  8656. return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
  8657. }
  8658. async buildPaintImageXObject({
  8659. resources,
  8660. image,
  8661. isInline = false,
  8662. operatorList,
  8663. cacheKey,
  8664. localImageCache,
  8665. localColorSpaceCache
  8666. }) {
  8667. const dict = image.dict;
  8668. const imageRef = dict.objId;
  8669. const w = dict.get("W", "Width");
  8670. const h = dict.get("H", "Height");
  8671. if (!(w && typeof w === "number") || !(h && typeof h === "number")) {
  8672. (0, _util.warn)("Image dimensions are missing, or not numbers.");
  8673. return;
  8674. }
  8675. const maxImageSize = this.options.maxImageSize;
  8676. if (maxImageSize !== -1 && w * h > maxImageSize) {
  8677. const msg = "Image exceeded maximum allowed size and was removed.";
  8678. if (this.options.ignoreErrors) {
  8679. (0, _util.warn)(msg);
  8680. return;
  8681. }
  8682. throw new Error(msg);
  8683. }
  8684. let optionalContent;
  8685. if (dict.has("OC")) {
  8686. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  8687. }
  8688. const imageMask = dict.get("IM", "ImageMask") || false;
  8689. let imgData, args;
  8690. if (imageMask) {
  8691. const interpolate = dict.get("I", "Interpolate");
  8692. const bitStrideLength = w + 7 >> 3;
  8693. const imgArray = image.getBytes(bitStrideLength * h);
  8694. const decode = dict.getArray("D", "Decode");
  8695. if (this.parsingType3Font) {
  8696. imgData = _image.PDFImage.createRawMask({
  8697. imgArray,
  8698. width: w,
  8699. height: h,
  8700. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  8701. inverseDecode: !!decode && decode[0] > 0,
  8702. interpolate
  8703. });
  8704. imgData.cached = !!cacheKey;
  8705. args = [imgData];
  8706. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  8707. if (cacheKey) {
  8708. localImageCache.set(cacheKey, imageRef, {
  8709. fn: _util.OPS.paintImageMaskXObject,
  8710. args,
  8711. optionalContent
  8712. });
  8713. }
  8714. return;
  8715. }
  8716. imgData = _image.PDFImage.createMask({
  8717. imgArray,
  8718. width: w,
  8719. height: h,
  8720. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  8721. inverseDecode: !!decode && decode[0] > 0,
  8722. interpolate,
  8723. isOffscreenCanvasSupported: this.options.isOffscreenCanvasSupported
  8724. });
  8725. if (imgData.isSingleOpaquePixel) {
  8726. operatorList.addImageOps(_util.OPS.paintSolidColorImageMask, [], optionalContent);
  8727. if (cacheKey) {
  8728. localImageCache.set(cacheKey, imageRef, {
  8729. fn: _util.OPS.paintSolidColorImageMask,
  8730. args: [],
  8731. optionalContent
  8732. });
  8733. }
  8734. return;
  8735. }
  8736. const objId = `mask_${this.idFactory.createObjId()}`;
  8737. operatorList.addDependency(objId);
  8738. this._sendImgData(objId, imgData);
  8739. args = [{
  8740. data: objId,
  8741. width: imgData.width,
  8742. height: imgData.height,
  8743. interpolate: imgData.interpolate,
  8744. count: 1
  8745. }];
  8746. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  8747. if (cacheKey) {
  8748. localImageCache.set(cacheKey, imageRef, {
  8749. fn: _util.OPS.paintImageMaskXObject,
  8750. args,
  8751. optionalContent
  8752. });
  8753. }
  8754. return;
  8755. }
  8756. const softMask = dict.get("SM", "SMask") || false;
  8757. const mask = dict.get("Mask") || false;
  8758. const SMALL_IMAGE_DIMENSIONS = 200;
  8759. if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) {
  8760. const imageObj = new _image.PDFImage({
  8761. xref: this.xref,
  8762. res: resources,
  8763. image,
  8764. isInline,
  8765. pdfFunctionFactory: this._pdfFunctionFactory,
  8766. localColorSpaceCache
  8767. });
  8768. imgData = imageObj.createImageData(true);
  8769. operatorList.addImageOps(_util.OPS.paintInlineImageXObject, [imgData], optionalContent);
  8770. return;
  8771. }
  8772. let objId = `img_${this.idFactory.createObjId()}`,
  8773. cacheGlobally = false;
  8774. if (this.parsingType3Font) {
  8775. objId = `${this.idFactory.getDocId()}_type3_${objId}`;
  8776. } else if (imageRef) {
  8777. cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
  8778. if (cacheGlobally) {
  8779. objId = `${this.idFactory.getDocId()}_${objId}`;
  8780. }
  8781. }
  8782. operatorList.addDependency(objId);
  8783. args = [objId, w, h];
  8784. _image.PDFImage.buildImage({
  8785. xref: this.xref,
  8786. res: resources,
  8787. image,
  8788. isInline,
  8789. pdfFunctionFactory: this._pdfFunctionFactory,
  8790. localColorSpaceCache
  8791. }).then(imageObj => {
  8792. imgData = imageObj.createImageData(false);
  8793. if (cacheKey && imageRef && cacheGlobally) {
  8794. this.globalImageCache.addByteSize(imageRef, imgData.data.length);
  8795. }
  8796. return this._sendImgData(objId, imgData, cacheGlobally);
  8797. }).catch(reason => {
  8798. (0, _util.warn)(`Unable to decode image "${objId}": "${reason}".`);
  8799. return this._sendImgData(objId, null, cacheGlobally);
  8800. });
  8801. operatorList.addImageOps(_util.OPS.paintImageXObject, args, optionalContent);
  8802. if (cacheKey) {
  8803. localImageCache.set(cacheKey, imageRef, {
  8804. fn: _util.OPS.paintImageXObject,
  8805. args,
  8806. optionalContent
  8807. });
  8808. if (imageRef) {
  8809. (0, _util.assert)(!isInline, "Cannot cache an inline image globally.");
  8810. this.globalImageCache.addPageIndex(imageRef, this.pageIndex);
  8811. if (cacheGlobally) {
  8812. this.globalImageCache.setData(imageRef, {
  8813. objId,
  8814. fn: _util.OPS.paintImageXObject,
  8815. args,
  8816. optionalContent,
  8817. byteSize: 0
  8818. });
  8819. }
  8820. }
  8821. }
  8822. }
  8823. handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) {
  8824. const smaskContent = smask.get("G");
  8825. const smaskOptions = {
  8826. subtype: smask.get("S").name,
  8827. backdrop: smask.get("BC")
  8828. };
  8829. const transferObj = smask.get("TR");
  8830. if ((0, _function.isPDFFunction)(transferObj)) {
  8831. const transferFn = this._pdfFunctionFactory.create(transferObj);
  8832. const transferMap = new Uint8Array(256);
  8833. const tmp = new Float32Array(1);
  8834. for (let i = 0; i < 256; i++) {
  8835. tmp[0] = i / 255;
  8836. transferFn(tmp, 0, tmp, 0);
  8837. transferMap[i] = tmp[0] * 255 | 0;
  8838. }
  8839. smaskOptions.transferMap = transferMap;
  8840. }
  8841. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache);
  8842. }
  8843. handleTransferFunction(tr) {
  8844. let transferArray;
  8845. if (Array.isArray(tr)) {
  8846. transferArray = tr;
  8847. } else if ((0, _function.isPDFFunction)(tr)) {
  8848. transferArray = [tr];
  8849. } else {
  8850. return null;
  8851. }
  8852. const transferMaps = [];
  8853. let numFns = 0,
  8854. numEffectfulFns = 0;
  8855. for (const entry of transferArray) {
  8856. const transferObj = this.xref.fetchIfRef(entry);
  8857. numFns++;
  8858. if ((0, _primitives.isName)(transferObj, "Identity")) {
  8859. transferMaps.push(null);
  8860. continue;
  8861. } else if (!(0, _function.isPDFFunction)(transferObj)) {
  8862. return null;
  8863. }
  8864. const transferFn = this._pdfFunctionFactory.create(transferObj);
  8865. const transferMap = new Uint8Array(256),
  8866. tmp = new Float32Array(1);
  8867. for (let j = 0; j < 256; j++) {
  8868. tmp[0] = j / 255;
  8869. transferFn(tmp, 0, tmp, 0);
  8870. transferMap[j] = tmp[0] * 255 | 0;
  8871. }
  8872. transferMaps.push(transferMap);
  8873. numEffectfulFns++;
  8874. }
  8875. if (!(numFns === 1 || numFns === 4)) {
  8876. return null;
  8877. }
  8878. if (numEffectfulFns === 0) {
  8879. return null;
  8880. }
  8881. return transferMaps;
  8882. }
  8883. handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) {
  8884. const tilingOpList = new _operator_list.OperatorList();
  8885. const patternResources = _primitives.Dict.merge({
  8886. xref: this.xref,
  8887. dictArray: [patternDict.get("Resources"), resources]
  8888. });
  8889. return this.getOperatorList({
  8890. stream: pattern,
  8891. task,
  8892. resources: patternResources,
  8893. operatorList: tilingOpList
  8894. }).then(function () {
  8895. const operatorListIR = tilingOpList.getIR();
  8896. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(operatorListIR, patternDict, color);
  8897. operatorList.addDependencies(tilingOpList.dependencies);
  8898. operatorList.addOp(fn, tilingPatternIR);
  8899. if (patternDict.objId) {
  8900. localTilingPatternCache.set(null, patternDict.objId, {
  8901. operatorListIR,
  8902. dict: patternDict
  8903. });
  8904. }
  8905. }).catch(reason => {
  8906. if (reason instanceof _util.AbortException) {
  8907. return;
  8908. }
  8909. if (this.options.ignoreErrors) {
  8910. this.handler.send("UnsupportedFeature", {
  8911. featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern
  8912. });
  8913. (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`);
  8914. return;
  8915. }
  8916. throw reason;
  8917. });
  8918. }
  8919. handleSetFont(resources, fontArgs, fontRef, operatorList, task, state, fallbackFontDict = null, cssFontInfo = null) {
  8920. const fontName = fontArgs && fontArgs[0] instanceof _primitives.Name ? fontArgs[0].name : null;
  8921. return this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo).then(translated => {
  8922. if (!translated.font.isType3Font) {
  8923. return translated;
  8924. }
  8925. return translated.loadType3Data(this, resources, task).then(function () {
  8926. operatorList.addDependencies(translated.type3Dependencies);
  8927. return translated;
  8928. }).catch(reason => {
  8929. this.handler.send("UnsupportedFeature", {
  8930. featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3
  8931. });
  8932. return new TranslatedFont({
  8933. loadedName: "g_font_error",
  8934. font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`),
  8935. dict: translated.font,
  8936. evaluatorOptions: this.options
  8937. });
  8938. });
  8939. }).then(translated => {
  8940. state.font = translated.font;
  8941. translated.send(this.handler);
  8942. return translated.loadedName;
  8943. });
  8944. }
  8945. handleText(chars, state) {
  8946. const font = state.font;
  8947. const glyphs = font.charsToGlyphs(chars);
  8948. if (font.data) {
  8949. const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  8950. if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
  8951. PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options);
  8952. }
  8953. }
  8954. return glyphs;
  8955. }
  8956. ensureStateFont(state) {
  8957. if (state.font) {
  8958. return;
  8959. }
  8960. const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
  8961. if (this.options.ignoreErrors) {
  8962. this.handler.send("UnsupportedFeature", {
  8963. featureId: _util.UNSUPPORTED_FEATURES.errorFontState
  8964. });
  8965. (0, _util.warn)(`ensureStateFont: "${reason}".`);
  8966. return;
  8967. }
  8968. throw reason;
  8969. }
  8970. async setGState({
  8971. resources,
  8972. gState,
  8973. operatorList,
  8974. cacheKey,
  8975. task,
  8976. stateManager,
  8977. localGStateCache,
  8978. localColorSpaceCache
  8979. }) {
  8980. const gStateRef = gState.objId;
  8981. let isSimpleGState = true;
  8982. const gStateObj = [];
  8983. let promise = Promise.resolve();
  8984. for (const key of gState.getKeys()) {
  8985. const value = gState.get(key);
  8986. switch (key) {
  8987. case "Type":
  8988. break;
  8989. case "LW":
  8990. case "LC":
  8991. case "LJ":
  8992. case "ML":
  8993. case "D":
  8994. case "RI":
  8995. case "FL":
  8996. case "CA":
  8997. case "ca":
  8998. gStateObj.push([key, value]);
  8999. break;
  9000. case "Font":
  9001. isSimpleGState = false;
  9002. promise = promise.then(() => {
  9003. return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  9004. operatorList.addDependency(loadedName);
  9005. gStateObj.push([key, [loadedName, value[1]]]);
  9006. });
  9007. });
  9008. break;
  9009. case "BM":
  9010. gStateObj.push([key, normalizeBlendMode(value)]);
  9011. break;
  9012. case "SMask":
  9013. if ((0, _primitives.isName)(value, "None")) {
  9014. gStateObj.push([key, false]);
  9015. break;
  9016. }
  9017. if (value instanceof _primitives.Dict) {
  9018. isSimpleGState = false;
  9019. promise = promise.then(() => {
  9020. return this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache);
  9021. });
  9022. gStateObj.push([key, true]);
  9023. } else {
  9024. (0, _util.warn)("Unsupported SMask type");
  9025. }
  9026. break;
  9027. case "TR":
  9028. const transferMaps = this.handleTransferFunction(value);
  9029. gStateObj.push([key, transferMaps]);
  9030. break;
  9031. case "OP":
  9032. case "op":
  9033. case "OPM":
  9034. case "BG":
  9035. case "BG2":
  9036. case "UCR":
  9037. case "UCR2":
  9038. case "TR2":
  9039. case "HT":
  9040. case "SM":
  9041. case "SA":
  9042. case "AIS":
  9043. case "TK":
  9044. (0, _util.info)("graphic state operator " + key);
  9045. break;
  9046. default:
  9047. (0, _util.info)("Unknown graphic state operator " + key);
  9048. break;
  9049. }
  9050. }
  9051. return promise.then(function () {
  9052. if (gStateObj.length > 0) {
  9053. operatorList.addOp(_util.OPS.setGState, [gStateObj]);
  9054. }
  9055. if (isSimpleGState) {
  9056. localGStateCache.set(cacheKey, gStateRef, gStateObj);
  9057. }
  9058. });
  9059. }
  9060. loadFont(fontName, font, resources, fallbackFontDict = null, cssFontInfo = null) {
  9061. const errorFont = async () => {
  9062. return new TranslatedFont({
  9063. loadedName: "g_font_error",
  9064. font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`),
  9065. dict: font,
  9066. evaluatorOptions: this.options
  9067. });
  9068. };
  9069. const xref = this.xref;
  9070. let fontRef;
  9071. if (font) {
  9072. if (font instanceof _primitives.Ref) {
  9073. fontRef = font;
  9074. }
  9075. } else {
  9076. const fontRes = resources.get("Font");
  9077. if (fontRes) {
  9078. fontRef = fontRes.getRaw(fontName);
  9079. }
  9080. }
  9081. if (!fontRef) {
  9082. const partialMsg = `Font "${fontName || font && font.toString()}" is not available`;
  9083. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  9084. (0, _util.warn)(`${partialMsg}.`);
  9085. return errorFont();
  9086. }
  9087. this.handler.send("UnsupportedFeature", {
  9088. featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing
  9089. });
  9090. (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`);
  9091. if (fallbackFontDict) {
  9092. fontRef = fallbackFontDict;
  9093. } else {
  9094. fontRef = PartialEvaluator.fallbackFontDict;
  9095. }
  9096. }
  9097. if (this.parsingType3Font && this.type3FontRefs.has(fontRef)) {
  9098. return errorFont();
  9099. }
  9100. if (this.fontCache.has(fontRef)) {
  9101. return this.fontCache.get(fontRef);
  9102. }
  9103. font = xref.fetchIfRef(fontRef);
  9104. if (!(font instanceof _primitives.Dict)) {
  9105. return errorFont();
  9106. }
  9107. if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
  9108. return this.fontCache.get(font.cacheKey);
  9109. }
  9110. const fontCapability = (0, _util.createPromiseCapability)();
  9111. let preEvaluatedFont;
  9112. try {
  9113. preEvaluatedFont = this.preEvaluateFont(font);
  9114. preEvaluatedFont.cssFontInfo = cssFontInfo;
  9115. } catch (reason) {
  9116. (0, _util.warn)(`loadFont - preEvaluateFont failed: "${reason}".`);
  9117. return errorFont();
  9118. }
  9119. const {
  9120. descriptor,
  9121. hash
  9122. } = preEvaluatedFont;
  9123. const fontRefIsRef = fontRef instanceof _primitives.Ref;
  9124. let fontID;
  9125. if (fontRefIsRef) {
  9126. fontID = `f${fontRef.toString()}`;
  9127. }
  9128. if (hash && descriptor instanceof _primitives.Dict) {
  9129. if (!descriptor.fontAliases) {
  9130. descriptor.fontAliases = Object.create(null);
  9131. }
  9132. const fontAliases = descriptor.fontAliases;
  9133. if (fontAliases[hash]) {
  9134. const aliasFontRef = fontAliases[hash].aliasRef;
  9135. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  9136. this.fontCache.putAlias(fontRef, aliasFontRef);
  9137. return this.fontCache.get(fontRef);
  9138. }
  9139. } else {
  9140. fontAliases[hash] = {
  9141. fontID: this.idFactory.createFontId()
  9142. };
  9143. }
  9144. if (fontRefIsRef) {
  9145. fontAliases[hash].aliasRef = fontRef;
  9146. }
  9147. fontID = fontAliases[hash].fontID;
  9148. }
  9149. if (fontRefIsRef) {
  9150. this.fontCache.put(fontRef, fontCapability.promise);
  9151. } else {
  9152. if (!fontID) {
  9153. fontID = this.idFactory.createFontId();
  9154. }
  9155. font.cacheKey = `cacheKey_${fontID}`;
  9156. this.fontCache.put(font.cacheKey, fontCapability.promise);
  9157. }
  9158. (0, _util.assert)(fontID && fontID.startsWith("f"), 'The "fontID" must be (correctly) defined.');
  9159. font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
  9160. this.translateFont(preEvaluatedFont).then(translatedFont => {
  9161. if (translatedFont.fontType !== undefined) {
  9162. xref.stats.addFontType(translatedFont.fontType);
  9163. }
  9164. fontCapability.resolve(new TranslatedFont({
  9165. loadedName: font.loadedName,
  9166. font: translatedFont,
  9167. dict: font,
  9168. evaluatorOptions: this.options
  9169. }));
  9170. }).catch(reason => {
  9171. this.handler.send("UnsupportedFeature", {
  9172. featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate
  9173. });
  9174. (0, _util.warn)(`loadFont - translateFont failed: "${reason}".`);
  9175. try {
  9176. const fontFile3 = descriptor && descriptor.get("FontFile3");
  9177. const subtype = fontFile3 && fontFile3.get("Subtype");
  9178. const fontType = (0, _fonts_utils.getFontType)(preEvaluatedFont.type, subtype && subtype.name);
  9179. if (fontType !== undefined) {
  9180. xref.stats.addFontType(fontType);
  9181. }
  9182. } catch (ex) {}
  9183. fontCapability.resolve(new TranslatedFont({
  9184. loadedName: font.loadedName,
  9185. font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason),
  9186. dict: font,
  9187. evaluatorOptions: this.options
  9188. }));
  9189. });
  9190. return fontCapability.promise;
  9191. }
  9192. buildPath(operatorList, fn, args, parsingText = false) {
  9193. const lastIndex = operatorList.length - 1;
  9194. if (!args) {
  9195. args = [];
  9196. }
  9197. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
  9198. if (parsingText) {
  9199. (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`);
  9200. operatorList.addOp(_util.OPS.save, null);
  9201. }
  9202. let minMax;
  9203. switch (fn) {
  9204. case _util.OPS.rectangle:
  9205. const x = args[0] + args[2];
  9206. const y = args[1] + args[3];
  9207. minMax = [Math.min(args[0], x), Math.max(args[0], x), Math.min(args[1], y), Math.max(args[1], y)];
  9208. break;
  9209. case _util.OPS.moveTo:
  9210. case _util.OPS.lineTo:
  9211. minMax = [args[0], args[0], args[1], args[1]];
  9212. break;
  9213. default:
  9214. minMax = [Infinity, -Infinity, Infinity, -Infinity];
  9215. break;
  9216. }
  9217. operatorList.addOp(_util.OPS.constructPath, [[fn], args, minMax]);
  9218. if (parsingText) {
  9219. operatorList.addOp(_util.OPS.restore, null);
  9220. }
  9221. } else {
  9222. const opArgs = operatorList.argsArray[lastIndex];
  9223. opArgs[0].push(fn);
  9224. opArgs[1].push(...args);
  9225. const minMax = opArgs[2];
  9226. switch (fn) {
  9227. case _util.OPS.rectangle:
  9228. const x = args[0] + args[2];
  9229. const y = args[1] + args[3];
  9230. minMax[0] = Math.min(minMax[0], args[0], x);
  9231. minMax[1] = Math.max(minMax[1], args[0], x);
  9232. minMax[2] = Math.min(minMax[2], args[1], y);
  9233. minMax[3] = Math.max(minMax[3], args[1], y);
  9234. break;
  9235. case _util.OPS.moveTo:
  9236. case _util.OPS.lineTo:
  9237. minMax[0] = Math.min(minMax[0], args[0]);
  9238. minMax[1] = Math.max(minMax[1], args[0]);
  9239. minMax[2] = Math.min(minMax[2], args[1]);
  9240. minMax[3] = Math.max(minMax[3], args[1]);
  9241. break;
  9242. }
  9243. }
  9244. }
  9245. parseColorSpace({
  9246. cs,
  9247. resources,
  9248. localColorSpaceCache
  9249. }) {
  9250. return _colorspace.ColorSpace.parseAsync({
  9251. cs,
  9252. xref: this.xref,
  9253. resources,
  9254. pdfFunctionFactory: this._pdfFunctionFactory,
  9255. localColorSpaceCache
  9256. }).catch(reason => {
  9257. if (reason instanceof _util.AbortException) {
  9258. return null;
  9259. }
  9260. if (this.options.ignoreErrors) {
  9261. this.handler.send("UnsupportedFeature", {
  9262. featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace
  9263. });
  9264. (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
  9265. return null;
  9266. }
  9267. throw reason;
  9268. });
  9269. }
  9270. parseShading({
  9271. shading,
  9272. resources,
  9273. localColorSpaceCache,
  9274. localShadingPatternCache
  9275. }) {
  9276. let id = localShadingPatternCache.get(shading);
  9277. if (!id) {
  9278. var shadingFill = _pattern.Pattern.parseShading(shading, this.xref, resources, this.handler, this._pdfFunctionFactory, localColorSpaceCache);
  9279. const patternIR = shadingFill.getIR();
  9280. id = `pattern_${this.idFactory.createObjId()}`;
  9281. localShadingPatternCache.set(shading, id);
  9282. this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
  9283. }
  9284. return id;
  9285. }
  9286. handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) {
  9287. const patternName = args.pop();
  9288. if (patternName instanceof _primitives.Name) {
  9289. const rawPattern = patterns.getRaw(patternName.name);
  9290. const localTilingPattern = rawPattern instanceof _primitives.Ref && localTilingPatternCache.getByRef(rawPattern);
  9291. if (localTilingPattern) {
  9292. try {
  9293. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  9294. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(localTilingPattern.operatorListIR, localTilingPattern.dict, color);
  9295. operatorList.addOp(fn, tilingPatternIR);
  9296. return undefined;
  9297. } catch (ex) {}
  9298. }
  9299. const pattern = this.xref.fetchIfRef(rawPattern);
  9300. if (pattern) {
  9301. const dict = pattern instanceof _base_stream.BaseStream ? pattern.dict : pattern;
  9302. const typeNum = dict.get("PatternType");
  9303. if (typeNum === PatternType.TILING) {
  9304. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  9305. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache);
  9306. } else if (typeNum === PatternType.SHADING) {
  9307. const shading = dict.get("Shading");
  9308. const matrix = dict.getArray("Matrix");
  9309. const objId = this.parseShading({
  9310. shading,
  9311. resources,
  9312. localColorSpaceCache,
  9313. localShadingPatternCache
  9314. });
  9315. operatorList.addOp(fn, ["Shading", objId, matrix]);
  9316. return undefined;
  9317. }
  9318. throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
  9319. }
  9320. }
  9321. throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
  9322. }
  9323. _parseVisibilityExpression(array, nestingCounter, currentResult) {
  9324. const MAX_NESTING = 10;
  9325. if (++nestingCounter > MAX_NESTING) {
  9326. (0, _util.warn)("Visibility expression is too deeply nested");
  9327. return;
  9328. }
  9329. const length = array.length;
  9330. const operator = this.xref.fetchIfRef(array[0]);
  9331. if (length < 2 || !(operator instanceof _primitives.Name)) {
  9332. (0, _util.warn)("Invalid visibility expression");
  9333. return;
  9334. }
  9335. switch (operator.name) {
  9336. case "And":
  9337. case "Or":
  9338. case "Not":
  9339. currentResult.push(operator.name);
  9340. break;
  9341. default:
  9342. (0, _util.warn)(`Invalid operator ${operator.name} in visibility expression`);
  9343. return;
  9344. }
  9345. for (let i = 1; i < length; i++) {
  9346. const raw = array[i];
  9347. const object = this.xref.fetchIfRef(raw);
  9348. if (Array.isArray(object)) {
  9349. const nestedResult = [];
  9350. currentResult.push(nestedResult);
  9351. this._parseVisibilityExpression(object, nestingCounter, nestedResult);
  9352. } else if (raw instanceof _primitives.Ref) {
  9353. currentResult.push(raw.toString());
  9354. }
  9355. }
  9356. }
  9357. async parseMarkedContentProps(contentProperties, resources) {
  9358. let optionalContent;
  9359. if (contentProperties instanceof _primitives.Name) {
  9360. const properties = resources.get("Properties");
  9361. optionalContent = properties.get(contentProperties.name);
  9362. } else if (contentProperties instanceof _primitives.Dict) {
  9363. optionalContent = contentProperties;
  9364. } else {
  9365. throw new _util.FormatError("Optional content properties malformed.");
  9366. }
  9367. const optionalContentType = optionalContent.get("Type").name;
  9368. if (optionalContentType === "OCG") {
  9369. return {
  9370. type: optionalContentType,
  9371. id: optionalContent.objId
  9372. };
  9373. } else if (optionalContentType === "OCMD") {
  9374. const expression = optionalContent.get("VE");
  9375. if (Array.isArray(expression)) {
  9376. const result = [];
  9377. this._parseVisibilityExpression(expression, 0, result);
  9378. if (result.length > 0) {
  9379. return {
  9380. type: "OCMD",
  9381. expression: result
  9382. };
  9383. }
  9384. }
  9385. const optionalContentGroups = optionalContent.get("OCGs");
  9386. if (Array.isArray(optionalContentGroups) || optionalContentGroups instanceof _primitives.Dict) {
  9387. const groupIds = [];
  9388. if (Array.isArray(optionalContentGroups)) {
  9389. for (const ocg of optionalContentGroups) {
  9390. groupIds.push(ocg.toString());
  9391. }
  9392. } else {
  9393. groupIds.push(optionalContentGroups.objId);
  9394. }
  9395. return {
  9396. type: optionalContentType,
  9397. ids: groupIds,
  9398. policy: optionalContent.get("P") instanceof _primitives.Name ? optionalContent.get("P").name : null,
  9399. expression: null
  9400. };
  9401. } else if (optionalContentGroups instanceof _primitives.Ref) {
  9402. return {
  9403. type: optionalContentType,
  9404. id: optionalContentGroups.toString()
  9405. };
  9406. }
  9407. }
  9408. return null;
  9409. }
  9410. getOperatorList({
  9411. stream,
  9412. task,
  9413. resources,
  9414. operatorList,
  9415. initialState = null,
  9416. fallbackFontDict = null
  9417. }) {
  9418. resources = resources || _primitives.Dict.empty;
  9419. initialState = initialState || new EvalState();
  9420. if (!operatorList) {
  9421. throw new Error('getOperatorList: missing "operatorList" parameter');
  9422. }
  9423. const self = this;
  9424. const xref = this.xref;
  9425. let parsingText = false;
  9426. const localImageCache = new _image_utils.LocalImageCache();
  9427. const localColorSpaceCache = new _image_utils.LocalColorSpaceCache();
  9428. const localGStateCache = new _image_utils.LocalGStateCache();
  9429. const localTilingPatternCache = new _image_utils.LocalTilingPatternCache();
  9430. const localShadingPatternCache = new Map();
  9431. const xobjs = resources.get("XObject") || _primitives.Dict.empty;
  9432. const patterns = resources.get("Pattern") || _primitives.Dict.empty;
  9433. const stateManager = new StateManager(initialState);
  9434. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  9435. const timeSlotManager = new TimeSlotManager();
  9436. function closePendingRestoreOPS(argument) {
  9437. for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  9438. operatorList.addOp(_util.OPS.restore, []);
  9439. }
  9440. }
  9441. return new Promise(function promiseBody(resolve, reject) {
  9442. const next = function (promise) {
  9443. Promise.all([promise, operatorList.ready]).then(function () {
  9444. try {
  9445. promiseBody(resolve, reject);
  9446. } catch (ex) {
  9447. reject(ex);
  9448. }
  9449. }, reject);
  9450. };
  9451. task.ensureNotTerminated();
  9452. timeSlotManager.reset();
  9453. const operation = {};
  9454. let stop, i, ii, cs, name, isValidName;
  9455. while (!(stop = timeSlotManager.check())) {
  9456. operation.args = null;
  9457. if (!preprocessor.read(operation)) {
  9458. break;
  9459. }
  9460. let args = operation.args;
  9461. let fn = operation.fn;
  9462. switch (fn | 0) {
  9463. case _util.OPS.paintXObject:
  9464. isValidName = args[0] instanceof _primitives.Name;
  9465. name = args[0].name;
  9466. if (isValidName) {
  9467. const localImage = localImageCache.getByName(name);
  9468. if (localImage) {
  9469. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  9470. incrementCachedImageMaskCount(localImage);
  9471. args = null;
  9472. continue;
  9473. }
  9474. }
  9475. next(new Promise(function (resolveXObject, rejectXObject) {
  9476. if (!isValidName) {
  9477. throw new _util.FormatError("XObject must be referred to by name.");
  9478. }
  9479. let xobj = xobjs.getRaw(name);
  9480. if (xobj instanceof _primitives.Ref) {
  9481. const localImage = localImageCache.getByRef(xobj);
  9482. if (localImage) {
  9483. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  9484. incrementCachedImageMaskCount(localImage);
  9485. resolveXObject();
  9486. return;
  9487. }
  9488. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  9489. if (globalImage) {
  9490. operatorList.addDependency(globalImage.objId);
  9491. operatorList.addImageOps(globalImage.fn, globalImage.args, globalImage.optionalContent);
  9492. resolveXObject();
  9493. return;
  9494. }
  9495. xobj = xref.fetch(xobj);
  9496. }
  9497. if (!(xobj instanceof _base_stream.BaseStream)) {
  9498. throw new _util.FormatError("XObject should be a stream");
  9499. }
  9500. const type = xobj.dict.get("Subtype");
  9501. if (!(type instanceof _primitives.Name)) {
  9502. throw new _util.FormatError("XObject should have a Name subtype");
  9503. }
  9504. if (type.name === "Form") {
  9505. stateManager.save();
  9506. self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () {
  9507. stateManager.restore();
  9508. resolveXObject();
  9509. }, rejectXObject);
  9510. return;
  9511. } else if (type.name === "Image") {
  9512. self.buildPaintImageXObject({
  9513. resources,
  9514. image: xobj,
  9515. operatorList,
  9516. cacheKey: name,
  9517. localImageCache,
  9518. localColorSpaceCache
  9519. }).then(resolveXObject, rejectXObject);
  9520. return;
  9521. } else if (type.name === "PS") {
  9522. (0, _util.info)("Ignored XObject subtype PS");
  9523. } else {
  9524. throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);
  9525. }
  9526. resolveXObject();
  9527. }).catch(function (reason) {
  9528. if (reason instanceof _util.AbortException) {
  9529. return;
  9530. }
  9531. if (self.options.ignoreErrors) {
  9532. self.handler.send("UnsupportedFeature", {
  9533. featureId: _util.UNSUPPORTED_FEATURES.errorXObject
  9534. });
  9535. (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`);
  9536. return;
  9537. }
  9538. throw reason;
  9539. }));
  9540. return;
  9541. case _util.OPS.setFont:
  9542. var fontSize = args[1];
  9543. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) {
  9544. operatorList.addDependency(loadedName);
  9545. operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
  9546. }));
  9547. return;
  9548. case _util.OPS.beginText:
  9549. parsingText = true;
  9550. break;
  9551. case _util.OPS.endText:
  9552. parsingText = false;
  9553. break;
  9554. case _util.OPS.endInlineImage:
  9555. var cacheKey = args[0].cacheKey;
  9556. if (cacheKey) {
  9557. const localImage = localImageCache.getByName(cacheKey);
  9558. if (localImage) {
  9559. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  9560. incrementCachedImageMaskCount(localImage);
  9561. args = null;
  9562. continue;
  9563. }
  9564. }
  9565. next(self.buildPaintImageXObject({
  9566. resources,
  9567. image: args[0],
  9568. isInline: true,
  9569. operatorList,
  9570. cacheKey,
  9571. localImageCache,
  9572. localColorSpaceCache
  9573. }));
  9574. return;
  9575. case _util.OPS.showText:
  9576. if (!stateManager.state.font) {
  9577. self.ensureStateFont(stateManager.state);
  9578. continue;
  9579. }
  9580. args[0] = self.handleText(args[0], stateManager.state);
  9581. break;
  9582. case _util.OPS.showSpacedText:
  9583. if (!stateManager.state.font) {
  9584. self.ensureStateFont(stateManager.state);
  9585. continue;
  9586. }
  9587. var combinedGlyphs = [];
  9588. var state = stateManager.state;
  9589. for (const arrItem of args[0]) {
  9590. if (typeof arrItem === "string") {
  9591. combinedGlyphs.push(...self.handleText(arrItem, state));
  9592. } else if (typeof arrItem === "number") {
  9593. combinedGlyphs.push(arrItem);
  9594. }
  9595. }
  9596. args[0] = combinedGlyphs;
  9597. fn = _util.OPS.showText;
  9598. break;
  9599. case _util.OPS.nextLineShowText:
  9600. if (!stateManager.state.font) {
  9601. self.ensureStateFont(stateManager.state);
  9602. continue;
  9603. }
  9604. operatorList.addOp(_util.OPS.nextLine);
  9605. args[0] = self.handleText(args[0], stateManager.state);
  9606. fn = _util.OPS.showText;
  9607. break;
  9608. case _util.OPS.nextLineSetSpacingShowText:
  9609. if (!stateManager.state.font) {
  9610. self.ensureStateFont(stateManager.state);
  9611. continue;
  9612. }
  9613. operatorList.addOp(_util.OPS.nextLine);
  9614. operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
  9615. operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
  9616. args[0] = self.handleText(args[0], stateManager.state);
  9617. fn = _util.OPS.showText;
  9618. break;
  9619. case _util.OPS.setTextRenderingMode:
  9620. stateManager.state.textRenderingMode = args[0];
  9621. break;
  9622. case _util.OPS.setFillColorSpace:
  9623. {
  9624. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  9625. if (cachedColorSpace) {
  9626. stateManager.state.fillColorSpace = cachedColorSpace;
  9627. continue;
  9628. }
  9629. next(self.parseColorSpace({
  9630. cs: args[0],
  9631. resources,
  9632. localColorSpaceCache
  9633. }).then(function (colorSpace) {
  9634. if (colorSpace) {
  9635. stateManager.state.fillColorSpace = colorSpace;
  9636. }
  9637. }));
  9638. return;
  9639. }
  9640. case _util.OPS.setStrokeColorSpace:
  9641. {
  9642. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  9643. if (cachedColorSpace) {
  9644. stateManager.state.strokeColorSpace = cachedColorSpace;
  9645. continue;
  9646. }
  9647. next(self.parseColorSpace({
  9648. cs: args[0],
  9649. resources,
  9650. localColorSpaceCache
  9651. }).then(function (colorSpace) {
  9652. if (colorSpace) {
  9653. stateManager.state.strokeColorSpace = colorSpace;
  9654. }
  9655. }));
  9656. return;
  9657. }
  9658. case _util.OPS.setFillColor:
  9659. cs = stateManager.state.fillColorSpace;
  9660. args = cs.getRgb(args, 0);
  9661. fn = _util.OPS.setFillRGBColor;
  9662. break;
  9663. case _util.OPS.setStrokeColor:
  9664. cs = stateManager.state.strokeColorSpace;
  9665. args = cs.getRgb(args, 0);
  9666. fn = _util.OPS.setStrokeRGBColor;
  9667. break;
  9668. case _util.OPS.setFillGray:
  9669. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  9670. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  9671. fn = _util.OPS.setFillRGBColor;
  9672. break;
  9673. case _util.OPS.setStrokeGray:
  9674. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  9675. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  9676. fn = _util.OPS.setStrokeRGBColor;
  9677. break;
  9678. case _util.OPS.setFillCMYKColor:
  9679. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  9680. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  9681. fn = _util.OPS.setFillRGBColor;
  9682. break;
  9683. case _util.OPS.setStrokeCMYKColor:
  9684. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  9685. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  9686. fn = _util.OPS.setStrokeRGBColor;
  9687. break;
  9688. case _util.OPS.setFillRGBColor:
  9689. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
  9690. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  9691. break;
  9692. case _util.OPS.setStrokeRGBColor:
  9693. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
  9694. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  9695. break;
  9696. case _util.OPS.setFillColorN:
  9697. cs = stateManager.state.fillColorSpace;
  9698. if (cs.name === "Pattern") {
  9699. next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  9700. return;
  9701. }
  9702. args = cs.getRgb(args, 0);
  9703. fn = _util.OPS.setFillRGBColor;
  9704. break;
  9705. case _util.OPS.setStrokeColorN:
  9706. cs = stateManager.state.strokeColorSpace;
  9707. if (cs.name === "Pattern") {
  9708. next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  9709. return;
  9710. }
  9711. args = cs.getRgb(args, 0);
  9712. fn = _util.OPS.setStrokeRGBColor;
  9713. break;
  9714. case _util.OPS.shadingFill:
  9715. var shadingRes = resources.get("Shading");
  9716. if (!shadingRes) {
  9717. throw new _util.FormatError("No shading resource found");
  9718. }
  9719. var shading = shadingRes.get(args[0].name);
  9720. if (!shading) {
  9721. throw new _util.FormatError("No shading object found");
  9722. }
  9723. const patternId = self.parseShading({
  9724. shading,
  9725. resources,
  9726. localColorSpaceCache,
  9727. localShadingPatternCache
  9728. });
  9729. args = [patternId];
  9730. fn = _util.OPS.shadingFill;
  9731. break;
  9732. case _util.OPS.setGState:
  9733. isValidName = args[0] instanceof _primitives.Name;
  9734. name = args[0].name;
  9735. if (isValidName) {
  9736. const localGStateObj = localGStateCache.getByName(name);
  9737. if (localGStateObj) {
  9738. if (localGStateObj.length > 0) {
  9739. operatorList.addOp(_util.OPS.setGState, [localGStateObj]);
  9740. }
  9741. args = null;
  9742. continue;
  9743. }
  9744. }
  9745. next(new Promise(function (resolveGState, rejectGState) {
  9746. if (!isValidName) {
  9747. throw new _util.FormatError("GState must be referred to by name.");
  9748. }
  9749. const extGState = resources.get("ExtGState");
  9750. if (!(extGState instanceof _primitives.Dict)) {
  9751. throw new _util.FormatError("ExtGState should be a dictionary.");
  9752. }
  9753. const gState = extGState.get(name);
  9754. if (!(gState instanceof _primitives.Dict)) {
  9755. throw new _util.FormatError("GState should be a dictionary.");
  9756. }
  9757. self.setGState({
  9758. resources,
  9759. gState,
  9760. operatorList,
  9761. cacheKey: name,
  9762. task,
  9763. stateManager,
  9764. localGStateCache,
  9765. localColorSpaceCache
  9766. }).then(resolveGState, rejectGState);
  9767. }).catch(function (reason) {
  9768. if (reason instanceof _util.AbortException) {
  9769. return;
  9770. }
  9771. if (self.options.ignoreErrors) {
  9772. self.handler.send("UnsupportedFeature", {
  9773. featureId: _util.UNSUPPORTED_FEATURES.errorExtGState
  9774. });
  9775. (0, _util.warn)(`getOperatorList - ignoring ExtGState: "${reason}".`);
  9776. return;
  9777. }
  9778. throw reason;
  9779. }));
  9780. return;
  9781. case _util.OPS.moveTo:
  9782. case _util.OPS.lineTo:
  9783. case _util.OPS.curveTo:
  9784. case _util.OPS.curveTo2:
  9785. case _util.OPS.curveTo3:
  9786. case _util.OPS.closePath:
  9787. case _util.OPS.rectangle:
  9788. self.buildPath(operatorList, fn, args, parsingText);
  9789. continue;
  9790. case _util.OPS.markPoint:
  9791. case _util.OPS.markPointProps:
  9792. case _util.OPS.beginCompat:
  9793. case _util.OPS.endCompat:
  9794. continue;
  9795. case _util.OPS.beginMarkedContentProps:
  9796. if (!(args[0] instanceof _primitives.Name)) {
  9797. (0, _util.warn)(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
  9798. continue;
  9799. }
  9800. if (args[0].name === "OC") {
  9801. next(self.parseMarkedContentProps(args[1], resources).then(data => {
  9802. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", data]);
  9803. }).catch(reason => {
  9804. if (reason instanceof _util.AbortException) {
  9805. return;
  9806. }
  9807. if (self.options.ignoreErrors) {
  9808. self.handler.send("UnsupportedFeature", {
  9809. featureId: _util.UNSUPPORTED_FEATURES.errorMarkedContent
  9810. });
  9811. (0, _util.warn)(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
  9812. return;
  9813. }
  9814. throw reason;
  9815. }));
  9816. return;
  9817. }
  9818. args = [args[0].name, args[1] instanceof _primitives.Dict ? args[1].get("MCID") : null];
  9819. break;
  9820. case _util.OPS.beginMarkedContent:
  9821. case _util.OPS.endMarkedContent:
  9822. default:
  9823. if (args !== null) {
  9824. for (i = 0, ii = args.length; i < ii; i++) {
  9825. if (args[i] instanceof _primitives.Dict) {
  9826. break;
  9827. }
  9828. }
  9829. if (i < ii) {
  9830. (0, _util.warn)("getOperatorList - ignoring operator: " + fn);
  9831. continue;
  9832. }
  9833. }
  9834. }
  9835. operatorList.addOp(fn, args);
  9836. }
  9837. if (stop) {
  9838. next(deferred);
  9839. return;
  9840. }
  9841. closePendingRestoreOPS();
  9842. resolve();
  9843. }).catch(reason => {
  9844. if (reason instanceof _util.AbortException) {
  9845. return;
  9846. }
  9847. if (this.options.ignoreErrors) {
  9848. this.handler.send("UnsupportedFeature", {
  9849. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  9850. });
  9851. (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  9852. closePendingRestoreOPS();
  9853. return;
  9854. }
  9855. throw reason;
  9856. });
  9857. }
  9858. getTextContent({
  9859. stream,
  9860. task,
  9861. resources,
  9862. stateManager = null,
  9863. combineTextItems = false,
  9864. includeMarkedContent = false,
  9865. sink,
  9866. seenStyles = new Set(),
  9867. viewBox,
  9868. markedContentData = null
  9869. }) {
  9870. resources = resources || _primitives.Dict.empty;
  9871. stateManager = stateManager || new StateManager(new TextState());
  9872. if (includeMarkedContent) {
  9873. markedContentData = markedContentData || {
  9874. level: 0
  9875. };
  9876. }
  9877. const textContent = {
  9878. items: [],
  9879. styles: Object.create(null)
  9880. };
  9881. const textContentItem = {
  9882. initialized: false,
  9883. str: [],
  9884. totalWidth: 0,
  9885. totalHeight: 0,
  9886. width: 0,
  9887. height: 0,
  9888. vertical: false,
  9889. prevTransform: null,
  9890. textAdvanceScale: 0,
  9891. spaceInFlowMin: 0,
  9892. spaceInFlowMax: 0,
  9893. trackingSpaceMin: Infinity,
  9894. negativeSpaceMax: -Infinity,
  9895. notASpace: -Infinity,
  9896. transform: null,
  9897. fontName: null,
  9898. hasEOL: false
  9899. };
  9900. const twoLastChars = [" ", " "];
  9901. let twoLastCharsPos = 0;
  9902. function saveLastChar(char) {
  9903. const nextPos = (twoLastCharsPos + 1) % 2;
  9904. const ret = twoLastChars[twoLastCharsPos] !== " " && twoLastChars[nextPos] === " ";
  9905. twoLastChars[twoLastCharsPos] = char;
  9906. twoLastCharsPos = nextPos;
  9907. return ret;
  9908. }
  9909. function resetLastChars() {
  9910. twoLastChars[0] = twoLastChars[1] = " ";
  9911. twoLastCharsPos = 0;
  9912. }
  9913. const TRACKING_SPACE_FACTOR = 0.1;
  9914. const NOT_A_SPACE_FACTOR = 0.03;
  9915. const NEGATIVE_SPACE_FACTOR = -0.2;
  9916. const SPACE_IN_FLOW_MIN_FACTOR = 0.1;
  9917. const SPACE_IN_FLOW_MAX_FACTOR = 0.6;
  9918. const self = this;
  9919. const xref = this.xref;
  9920. const showSpacedTextBuffer = [];
  9921. let xobjs = null;
  9922. const emptyXObjectCache = new _image_utils.LocalImageCache();
  9923. const emptyGStateCache = new _image_utils.LocalGStateCache();
  9924. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  9925. let textState;
  9926. function getCurrentTextTransform() {
  9927. const font = textState.font;
  9928. const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  9929. if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
  9930. const glyphHeight = font.bbox[3] - font.bbox[1];
  9931. if (glyphHeight > 0) {
  9932. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  9933. }
  9934. }
  9935. return _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
  9936. }
  9937. function ensureTextContentItem() {
  9938. if (textContentItem.initialized) {
  9939. return textContentItem;
  9940. }
  9941. const {
  9942. font,
  9943. loadedName
  9944. } = textState;
  9945. if (!seenStyles.has(loadedName)) {
  9946. seenStyles.add(loadedName);
  9947. textContent.styles[loadedName] = {
  9948. fontFamily: font.fallbackName,
  9949. ascent: font.ascent,
  9950. descent: font.descent,
  9951. vertical: font.vertical
  9952. };
  9953. }
  9954. textContentItem.fontName = loadedName;
  9955. const trm = textContentItem.transform = getCurrentTextTransform();
  9956. if (!font.vertical) {
  9957. textContentItem.width = textContentItem.totalWidth = 0;
  9958. textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]);
  9959. textContentItem.vertical = false;
  9960. } else {
  9961. textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]);
  9962. textContentItem.height = textContentItem.totalHeight = 0;
  9963. textContentItem.vertical = true;
  9964. }
  9965. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  9966. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  9967. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  9968. textContentItem.trackingSpaceMin = textState.fontSize * TRACKING_SPACE_FACTOR;
  9969. textContentItem.notASpace = textState.fontSize * NOT_A_SPACE_FACTOR;
  9970. textContentItem.negativeSpaceMax = textState.fontSize * NEGATIVE_SPACE_FACTOR;
  9971. textContentItem.spaceInFlowMin = textState.fontSize * SPACE_IN_FLOW_MIN_FACTOR;
  9972. textContentItem.spaceInFlowMax = textState.fontSize * SPACE_IN_FLOW_MAX_FACTOR;
  9973. textContentItem.hasEOL = false;
  9974. textContentItem.initialized = true;
  9975. return textContentItem;
  9976. }
  9977. function updateAdvanceScale() {
  9978. if (!textContentItem.initialized) {
  9979. return;
  9980. }
  9981. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  9982. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  9983. const scaleFactor = scaleCtmX * scaleLineX;
  9984. if (scaleFactor === textContentItem.textAdvanceScale) {
  9985. return;
  9986. }
  9987. if (!textContentItem.vertical) {
  9988. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  9989. textContentItem.width = 0;
  9990. } else {
  9991. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  9992. textContentItem.height = 0;
  9993. }
  9994. textContentItem.textAdvanceScale = scaleFactor;
  9995. }
  9996. function runBidiTransform(textChunk) {
  9997. const text = textChunk.str.join("");
  9998. const bidiResult = (0, _bidi.bidi)(text, -1, textChunk.vertical);
  9999. return {
  10000. str: bidiResult.str,
  10001. dir: bidiResult.dir,
  10002. width: Math.abs(textChunk.totalWidth),
  10003. height: Math.abs(textChunk.totalHeight),
  10004. transform: textChunk.transform,
  10005. fontName: textChunk.fontName,
  10006. hasEOL: textChunk.hasEOL
  10007. };
  10008. }
  10009. function handleSetFont(fontName, fontRef) {
  10010. return self.loadFont(fontName, fontRef, resources).then(function (translated) {
  10011. if (!translated.font.isType3Font) {
  10012. return translated;
  10013. }
  10014. return translated.loadType3Data(self, resources, task).catch(function () {}).then(function () {
  10015. return translated;
  10016. });
  10017. }).then(function (translated) {
  10018. textState.loadedName = translated.loadedName;
  10019. textState.font = translated.font;
  10020. textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  10021. });
  10022. }
  10023. function applyInverseRotation(x, y, matrix) {
  10024. const scale = Math.hypot(matrix[0], matrix[1]);
  10025. return [(matrix[0] * x + matrix[1] * y) / scale, (matrix[2] * x + matrix[3] * y) / scale];
  10026. }
  10027. function compareWithLastPosition() {
  10028. const currentTransform = getCurrentTextTransform();
  10029. let posX = currentTransform[4];
  10030. let posY = currentTransform[5];
  10031. const shiftedX = posX - viewBox[0];
  10032. const shiftedY = posY - viewBox[1];
  10033. if (shiftedX < 0 || shiftedX > viewBox[2] || shiftedY < 0 || shiftedY > viewBox[3]) {
  10034. return false;
  10035. }
  10036. if (!combineTextItems || !textState.font || !textContentItem.prevTransform) {
  10037. return true;
  10038. }
  10039. let lastPosX = textContentItem.prevTransform[4];
  10040. let lastPosY = textContentItem.prevTransform[5];
  10041. if (lastPosX === posX && lastPosY === posY) {
  10042. return true;
  10043. }
  10044. let rotate = -1;
  10045. if (currentTransform[0] && currentTransform[1] === 0 && currentTransform[2] === 0) {
  10046. rotate = currentTransform[0] > 0 ? 0 : 180;
  10047. } else if (currentTransform[1] && currentTransform[0] === 0 && currentTransform[3] === 0) {
  10048. rotate = currentTransform[1] > 0 ? 90 : 270;
  10049. }
  10050. switch (rotate) {
  10051. case 0:
  10052. break;
  10053. case 90:
  10054. [posX, posY] = [posY, posX];
  10055. [lastPosX, lastPosY] = [lastPosY, lastPosX];
  10056. break;
  10057. case 180:
  10058. [posX, posY, lastPosX, lastPosY] = [-posX, -posY, -lastPosX, -lastPosY];
  10059. break;
  10060. case 270:
  10061. [posX, posY] = [-posY, -posX];
  10062. [lastPosX, lastPosY] = [-lastPosY, -lastPosX];
  10063. break;
  10064. default:
  10065. [posX, posY] = applyInverseRotation(posX, posY, currentTransform);
  10066. [lastPosX, lastPosY] = applyInverseRotation(lastPosX, lastPosY, textContentItem.prevTransform);
  10067. }
  10068. if (textState.font.vertical) {
  10069. const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale;
  10070. const advanceX = posX - lastPosX;
  10071. const textOrientation = Math.sign(textContentItem.height);
  10072. if (advanceY < textOrientation * textContentItem.negativeSpaceMax) {
  10073. if (Math.abs(advanceX) > 0.5 * textContentItem.width) {
  10074. appendEOL();
  10075. return true;
  10076. }
  10077. resetLastChars();
  10078. flushTextContentItem();
  10079. return true;
  10080. }
  10081. if (Math.abs(advanceX) > textContentItem.width) {
  10082. appendEOL();
  10083. return true;
  10084. }
  10085. if (advanceY <= textOrientation * textContentItem.notASpace) {
  10086. resetLastChars();
  10087. }
  10088. if (advanceY <= textOrientation * textContentItem.trackingSpaceMin) {
  10089. textContentItem.height += advanceY;
  10090. } else if (!addFakeSpaces(advanceY, textContentItem.prevTransform, textOrientation)) {
  10091. if (textContentItem.str.length === 0) {
  10092. resetLastChars();
  10093. textContent.items.push({
  10094. str: " ",
  10095. dir: "ltr",
  10096. width: 0,
  10097. height: Math.abs(advanceY),
  10098. transform: textContentItem.prevTransform,
  10099. fontName: textContentItem.fontName,
  10100. hasEOL: false
  10101. });
  10102. } else {
  10103. textContentItem.height += advanceY;
  10104. }
  10105. }
  10106. return true;
  10107. }
  10108. const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
  10109. const advanceY = posY - lastPosY;
  10110. const textOrientation = Math.sign(textContentItem.width);
  10111. if (advanceX < textOrientation * textContentItem.negativeSpaceMax) {
  10112. if (Math.abs(advanceY) > 0.5 * textContentItem.height) {
  10113. appendEOL();
  10114. return true;
  10115. }
  10116. resetLastChars();
  10117. flushTextContentItem();
  10118. return true;
  10119. }
  10120. if (Math.abs(advanceY) > textContentItem.height) {
  10121. appendEOL();
  10122. return true;
  10123. }
  10124. if (advanceX <= textOrientation * textContentItem.notASpace) {
  10125. resetLastChars();
  10126. }
  10127. if (advanceX <= textOrientation * textContentItem.trackingSpaceMin) {
  10128. textContentItem.width += advanceX;
  10129. } else if (!addFakeSpaces(advanceX, textContentItem.prevTransform, textOrientation)) {
  10130. if (textContentItem.str.length === 0) {
  10131. resetLastChars();
  10132. textContent.items.push({
  10133. str: " ",
  10134. dir: "ltr",
  10135. width: Math.abs(advanceX),
  10136. height: 0,
  10137. transform: textContentItem.prevTransform,
  10138. fontName: textContentItem.fontName,
  10139. hasEOL: false
  10140. });
  10141. } else {
  10142. textContentItem.width += advanceX;
  10143. }
  10144. }
  10145. return true;
  10146. }
  10147. function buildTextContentItem({
  10148. chars,
  10149. extraSpacing
  10150. }) {
  10151. const font = textState.font;
  10152. if (!chars) {
  10153. const charSpacing = textState.charSpacing + extraSpacing;
  10154. if (charSpacing) {
  10155. if (!font.vertical) {
  10156. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  10157. } else {
  10158. textState.translateTextMatrix(0, -charSpacing);
  10159. }
  10160. }
  10161. return;
  10162. }
  10163. const glyphs = font.charsToGlyphs(chars);
  10164. const scale = textState.fontMatrix[0] * textState.fontSize;
  10165. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  10166. const glyph = glyphs[i];
  10167. const {
  10168. category
  10169. } = glyph;
  10170. if (category.isInvisibleFormatMark) {
  10171. continue;
  10172. }
  10173. let charSpacing = textState.charSpacing + (i + 1 === ii ? extraSpacing : 0);
  10174. let glyphWidth = glyph.width;
  10175. if (font.vertical) {
  10176. glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth;
  10177. }
  10178. let scaledDim = glyphWidth * scale;
  10179. if (category.isWhitespace) {
  10180. if (!font.vertical) {
  10181. charSpacing += scaledDim + textState.wordSpacing;
  10182. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  10183. } else {
  10184. charSpacing += -scaledDim + textState.wordSpacing;
  10185. textState.translateTextMatrix(0, -charSpacing);
  10186. }
  10187. saveLastChar(" ");
  10188. continue;
  10189. }
  10190. if (!compareWithLastPosition()) {
  10191. continue;
  10192. }
  10193. const textChunk = ensureTextContentItem();
  10194. if (category.isZeroWidthDiacritic) {
  10195. scaledDim = 0;
  10196. }
  10197. if (!font.vertical) {
  10198. scaledDim *= textState.textHScale;
  10199. textState.translateTextMatrix(scaledDim, 0);
  10200. textChunk.width += scaledDim;
  10201. } else {
  10202. textState.translateTextMatrix(0, scaledDim);
  10203. scaledDim = Math.abs(scaledDim);
  10204. textChunk.height += scaledDim;
  10205. }
  10206. if (scaledDim) {
  10207. textChunk.prevTransform = getCurrentTextTransform();
  10208. }
  10209. const glyphUnicode = glyph.normalizedUnicode;
  10210. if (saveLastChar(glyphUnicode)) {
  10211. textChunk.str.push(" ");
  10212. }
  10213. textChunk.str.push(glyphUnicode);
  10214. if (charSpacing) {
  10215. if (!font.vertical) {
  10216. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  10217. } else {
  10218. textState.translateTextMatrix(0, -charSpacing);
  10219. }
  10220. }
  10221. }
  10222. }
  10223. function appendEOL() {
  10224. resetLastChars();
  10225. if (textContentItem.initialized) {
  10226. textContentItem.hasEOL = true;
  10227. flushTextContentItem();
  10228. } else {
  10229. textContent.items.push({
  10230. str: "",
  10231. dir: "ltr",
  10232. width: 0,
  10233. height: 0,
  10234. transform: getCurrentTextTransform(),
  10235. fontName: textState.loadedName,
  10236. hasEOL: true
  10237. });
  10238. }
  10239. }
  10240. function addFakeSpaces(width, transf, textOrientation) {
  10241. if (textOrientation * textContentItem.spaceInFlowMin <= width && width <= textOrientation * textContentItem.spaceInFlowMax) {
  10242. if (textContentItem.initialized) {
  10243. resetLastChars();
  10244. textContentItem.str.push(" ");
  10245. }
  10246. return false;
  10247. }
  10248. const fontName = textContentItem.fontName;
  10249. let height = 0;
  10250. if (textContentItem.vertical) {
  10251. height = width;
  10252. width = 0;
  10253. }
  10254. flushTextContentItem();
  10255. resetLastChars();
  10256. textContent.items.push({
  10257. str: " ",
  10258. dir: "ltr",
  10259. width: Math.abs(width),
  10260. height: Math.abs(height),
  10261. transform: transf || getCurrentTextTransform(),
  10262. fontName,
  10263. hasEOL: false
  10264. });
  10265. return true;
  10266. }
  10267. function flushTextContentItem() {
  10268. if (!textContentItem.initialized || !textContentItem.str) {
  10269. return;
  10270. }
  10271. if (!textContentItem.vertical) {
  10272. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  10273. } else {
  10274. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  10275. }
  10276. textContent.items.push(runBidiTransform(textContentItem));
  10277. textContentItem.initialized = false;
  10278. textContentItem.str.length = 0;
  10279. }
  10280. function enqueueChunk(batch = false) {
  10281. const length = textContent.items.length;
  10282. if (length === 0) {
  10283. return;
  10284. }
  10285. if (batch && length < TEXT_CHUNK_BATCH_SIZE) {
  10286. return;
  10287. }
  10288. sink.enqueue(textContent, length);
  10289. textContent.items = [];
  10290. textContent.styles = Object.create(null);
  10291. }
  10292. const timeSlotManager = new TimeSlotManager();
  10293. return new Promise(function promiseBody(resolve, reject) {
  10294. const next = function (promise) {
  10295. enqueueChunk(true);
  10296. Promise.all([promise, sink.ready]).then(function () {
  10297. try {
  10298. promiseBody(resolve, reject);
  10299. } catch (ex) {
  10300. reject(ex);
  10301. }
  10302. }, reject);
  10303. };
  10304. task.ensureNotTerminated();
  10305. timeSlotManager.reset();
  10306. const operation = {};
  10307. let stop,
  10308. args = [];
  10309. while (!(stop = timeSlotManager.check())) {
  10310. args.length = 0;
  10311. operation.args = args;
  10312. if (!preprocessor.read(operation)) {
  10313. break;
  10314. }
  10315. textState = stateManager.state;
  10316. const fn = operation.fn;
  10317. args = operation.args;
  10318. switch (fn | 0) {
  10319. case _util.OPS.setFont:
  10320. var fontNameArg = args[0].name,
  10321. fontSizeArg = args[1];
  10322. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  10323. break;
  10324. }
  10325. flushTextContentItem();
  10326. textState.fontName = fontNameArg;
  10327. textState.fontSize = fontSizeArg;
  10328. next(handleSetFont(fontNameArg, null));
  10329. return;
  10330. case _util.OPS.setTextRise:
  10331. textState.textRise = args[0];
  10332. break;
  10333. case _util.OPS.setHScale:
  10334. textState.textHScale = args[0] / 100;
  10335. break;
  10336. case _util.OPS.setLeading:
  10337. textState.leading = args[0];
  10338. break;
  10339. case _util.OPS.moveText:
  10340. textState.translateTextLineMatrix(args[0], args[1]);
  10341. textState.textMatrix = textState.textLineMatrix.slice();
  10342. break;
  10343. case _util.OPS.setLeadingMoveText:
  10344. textState.leading = -args[1];
  10345. textState.translateTextLineMatrix(args[0], args[1]);
  10346. textState.textMatrix = textState.textLineMatrix.slice();
  10347. break;
  10348. case _util.OPS.nextLine:
  10349. textState.carriageReturn();
  10350. break;
  10351. case _util.OPS.setTextMatrix:
  10352. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  10353. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  10354. updateAdvanceScale();
  10355. break;
  10356. case _util.OPS.setCharSpacing:
  10357. textState.charSpacing = args[0];
  10358. break;
  10359. case _util.OPS.setWordSpacing:
  10360. textState.wordSpacing = args[0];
  10361. break;
  10362. case _util.OPS.beginText:
  10363. textState.textMatrix = _util.IDENTITY_MATRIX.slice();
  10364. textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  10365. break;
  10366. case _util.OPS.showSpacedText:
  10367. if (!stateManager.state.font) {
  10368. self.ensureStateFont(stateManager.state);
  10369. continue;
  10370. }
  10371. const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000;
  10372. const elements = args[0];
  10373. for (let i = 0, ii = elements.length; i < ii - 1; i++) {
  10374. const item = elements[i];
  10375. if (typeof item === "string") {
  10376. showSpacedTextBuffer.push(item);
  10377. } else if (typeof item === "number" && item !== 0) {
  10378. const str = showSpacedTextBuffer.join("");
  10379. showSpacedTextBuffer.length = 0;
  10380. buildTextContentItem({
  10381. chars: str,
  10382. extraSpacing: item * spaceFactor
  10383. });
  10384. }
  10385. }
  10386. const item = elements.at(-1);
  10387. if (typeof item === "string") {
  10388. showSpacedTextBuffer.push(item);
  10389. }
  10390. if (showSpacedTextBuffer.length > 0) {
  10391. const str = showSpacedTextBuffer.join("");
  10392. showSpacedTextBuffer.length = 0;
  10393. buildTextContentItem({
  10394. chars: str,
  10395. extraSpacing: 0
  10396. });
  10397. }
  10398. break;
  10399. case _util.OPS.showText:
  10400. if (!stateManager.state.font) {
  10401. self.ensureStateFont(stateManager.state);
  10402. continue;
  10403. }
  10404. buildTextContentItem({
  10405. chars: args[0],
  10406. extraSpacing: 0
  10407. });
  10408. break;
  10409. case _util.OPS.nextLineShowText:
  10410. if (!stateManager.state.font) {
  10411. self.ensureStateFont(stateManager.state);
  10412. continue;
  10413. }
  10414. textState.carriageReturn();
  10415. buildTextContentItem({
  10416. chars: args[0],
  10417. extraSpacing: 0
  10418. });
  10419. break;
  10420. case _util.OPS.nextLineSetSpacingShowText:
  10421. if (!stateManager.state.font) {
  10422. self.ensureStateFont(stateManager.state);
  10423. continue;
  10424. }
  10425. textState.wordSpacing = args[0];
  10426. textState.charSpacing = args[1];
  10427. textState.carriageReturn();
  10428. buildTextContentItem({
  10429. chars: args[2],
  10430. extraSpacing: 0
  10431. });
  10432. break;
  10433. case _util.OPS.paintXObject:
  10434. flushTextContentItem();
  10435. if (!xobjs) {
  10436. xobjs = resources.get("XObject") || _primitives.Dict.empty;
  10437. }
  10438. var isValidName = args[0] instanceof _primitives.Name;
  10439. var name = args[0].name;
  10440. if (isValidName && emptyXObjectCache.getByName(name)) {
  10441. break;
  10442. }
  10443. next(new Promise(function (resolveXObject, rejectXObject) {
  10444. if (!isValidName) {
  10445. throw new _util.FormatError("XObject must be referred to by name.");
  10446. }
  10447. let xobj = xobjs.getRaw(name);
  10448. if (xobj instanceof _primitives.Ref) {
  10449. if (emptyXObjectCache.getByRef(xobj)) {
  10450. resolveXObject();
  10451. return;
  10452. }
  10453. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  10454. if (globalImage) {
  10455. resolveXObject();
  10456. return;
  10457. }
  10458. xobj = xref.fetch(xobj);
  10459. }
  10460. if (!(xobj instanceof _base_stream.BaseStream)) {
  10461. throw new _util.FormatError("XObject should be a stream");
  10462. }
  10463. const type = xobj.dict.get("Subtype");
  10464. if (!(type instanceof _primitives.Name)) {
  10465. throw new _util.FormatError("XObject should have a Name subtype");
  10466. }
  10467. if (type.name !== "Form") {
  10468. emptyXObjectCache.set(name, xobj.dict.objId, true);
  10469. resolveXObject();
  10470. return;
  10471. }
  10472. const currentState = stateManager.state.clone();
  10473. const xObjStateManager = new StateManager(currentState);
  10474. const matrix = xobj.dict.getArray("Matrix");
  10475. if (Array.isArray(matrix) && matrix.length === 6) {
  10476. xObjStateManager.transform(matrix);
  10477. }
  10478. enqueueChunk();
  10479. const sinkWrapper = {
  10480. enqueueInvoked: false,
  10481. enqueue(chunk, size) {
  10482. this.enqueueInvoked = true;
  10483. sink.enqueue(chunk, size);
  10484. },
  10485. get desiredSize() {
  10486. return sink.desiredSize;
  10487. },
  10488. get ready() {
  10489. return sink.ready;
  10490. }
  10491. };
  10492. self.getTextContent({
  10493. stream: xobj,
  10494. task,
  10495. resources: xobj.dict.get("Resources") || resources,
  10496. stateManager: xObjStateManager,
  10497. combineTextItems,
  10498. includeMarkedContent,
  10499. sink: sinkWrapper,
  10500. seenStyles,
  10501. viewBox,
  10502. markedContentData
  10503. }).then(function () {
  10504. if (!sinkWrapper.enqueueInvoked) {
  10505. emptyXObjectCache.set(name, xobj.dict.objId, true);
  10506. }
  10507. resolveXObject();
  10508. }, rejectXObject);
  10509. }).catch(function (reason) {
  10510. if (reason instanceof _util.AbortException) {
  10511. return;
  10512. }
  10513. if (self.options.ignoreErrors) {
  10514. (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`);
  10515. return;
  10516. }
  10517. throw reason;
  10518. }));
  10519. return;
  10520. case _util.OPS.setGState:
  10521. isValidName = args[0] instanceof _primitives.Name;
  10522. name = args[0].name;
  10523. if (isValidName && emptyGStateCache.getByName(name)) {
  10524. break;
  10525. }
  10526. next(new Promise(function (resolveGState, rejectGState) {
  10527. if (!isValidName) {
  10528. throw new _util.FormatError("GState must be referred to by name.");
  10529. }
  10530. const extGState = resources.get("ExtGState");
  10531. if (!(extGState instanceof _primitives.Dict)) {
  10532. throw new _util.FormatError("ExtGState should be a dictionary.");
  10533. }
  10534. const gState = extGState.get(name);
  10535. if (!(gState instanceof _primitives.Dict)) {
  10536. throw new _util.FormatError("GState should be a dictionary.");
  10537. }
  10538. const gStateFont = gState.get("Font");
  10539. if (!gStateFont) {
  10540. emptyGStateCache.set(name, gState.objId, true);
  10541. resolveGState();
  10542. return;
  10543. }
  10544. flushTextContentItem();
  10545. textState.fontName = null;
  10546. textState.fontSize = gStateFont[1];
  10547. handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
  10548. }).catch(function (reason) {
  10549. if (reason instanceof _util.AbortException) {
  10550. return;
  10551. }
  10552. if (self.options.ignoreErrors) {
  10553. (0, _util.warn)(`getTextContent - ignoring ExtGState: "${reason}".`);
  10554. return;
  10555. }
  10556. throw reason;
  10557. }));
  10558. return;
  10559. case _util.OPS.beginMarkedContent:
  10560. flushTextContentItem();
  10561. if (includeMarkedContent) {
  10562. markedContentData.level++;
  10563. textContent.items.push({
  10564. type: "beginMarkedContent",
  10565. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  10566. });
  10567. }
  10568. break;
  10569. case _util.OPS.beginMarkedContentProps:
  10570. flushTextContentItem();
  10571. if (includeMarkedContent) {
  10572. markedContentData.level++;
  10573. let mcid = null;
  10574. if (args[1] instanceof _primitives.Dict) {
  10575. mcid = args[1].get("MCID");
  10576. }
  10577. textContent.items.push({
  10578. type: "beginMarkedContentProps",
  10579. id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mcid${mcid}` : null,
  10580. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  10581. });
  10582. }
  10583. break;
  10584. case _util.OPS.endMarkedContent:
  10585. flushTextContentItem();
  10586. if (includeMarkedContent) {
  10587. if (markedContentData.level === 0) {
  10588. break;
  10589. }
  10590. markedContentData.level--;
  10591. textContent.items.push({
  10592. type: "endMarkedContent"
  10593. });
  10594. }
  10595. break;
  10596. }
  10597. if (textContent.items.length >= sink.desiredSize) {
  10598. stop = true;
  10599. break;
  10600. }
  10601. }
  10602. if (stop) {
  10603. next(deferred);
  10604. return;
  10605. }
  10606. flushTextContentItem();
  10607. enqueueChunk();
  10608. resolve();
  10609. }).catch(reason => {
  10610. if (reason instanceof _util.AbortException) {
  10611. return;
  10612. }
  10613. if (this.options.ignoreErrors) {
  10614. (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  10615. flushTextContentItem();
  10616. enqueueChunk();
  10617. return;
  10618. }
  10619. throw reason;
  10620. });
  10621. }
  10622. extractDataStructures(dict, baseDict, properties) {
  10623. const xref = this.xref;
  10624. let cidToGidBytes;
  10625. const toUnicodePromise = this.readToUnicode(properties.toUnicode || dict.get("ToUnicode") || baseDict.get("ToUnicode"));
  10626. if (properties.composite) {
  10627. const cidSystemInfo = dict.get("CIDSystemInfo");
  10628. if (cidSystemInfo instanceof _primitives.Dict) {
  10629. properties.cidSystemInfo = {
  10630. registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")),
  10631. ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")),
  10632. supplement: cidSystemInfo.get("Supplement")
  10633. };
  10634. }
  10635. try {
  10636. const cidToGidMap = dict.get("CIDToGIDMap");
  10637. if (cidToGidMap instanceof _base_stream.BaseStream) {
  10638. cidToGidBytes = cidToGidMap.getBytes();
  10639. }
  10640. } catch (ex) {
  10641. if (!this.options.ignoreErrors) {
  10642. throw ex;
  10643. }
  10644. (0, _util.warn)(`extractDataStructures - ignoring CIDToGIDMap data: "${ex}".`);
  10645. }
  10646. }
  10647. const differences = [];
  10648. let baseEncodingName = null;
  10649. let encoding;
  10650. if (dict.has("Encoding")) {
  10651. encoding = dict.get("Encoding");
  10652. if (encoding instanceof _primitives.Dict) {
  10653. baseEncodingName = encoding.get("BaseEncoding");
  10654. baseEncodingName = baseEncodingName instanceof _primitives.Name ? baseEncodingName.name : null;
  10655. if (encoding.has("Differences")) {
  10656. const diffEncoding = encoding.get("Differences");
  10657. let index = 0;
  10658. for (const entry of diffEncoding) {
  10659. const data = xref.fetchIfRef(entry);
  10660. if (typeof data === "number") {
  10661. index = data;
  10662. } else if (data instanceof _primitives.Name) {
  10663. differences[index++] = data.name;
  10664. } else {
  10665. throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);
  10666. }
  10667. }
  10668. }
  10669. } else if (encoding instanceof _primitives.Name) {
  10670. baseEncodingName = encoding.name;
  10671. } else {
  10672. const msg = "Encoding is not a Name nor a Dict";
  10673. if (!this.options.ignoreErrors) {
  10674. throw new _util.FormatError(msg);
  10675. }
  10676. (0, _util.warn)(msg);
  10677. }
  10678. if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
  10679. baseEncodingName = null;
  10680. }
  10681. }
  10682. if (baseEncodingName) {
  10683. properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  10684. } else {
  10685. const isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  10686. const isNonsymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Nonsymbolic);
  10687. encoding = _encodings.StandardEncoding;
  10688. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  10689. encoding = _encodings.WinAnsiEncoding;
  10690. }
  10691. if (isSymbolicFont) {
  10692. encoding = _encodings.MacRomanEncoding;
  10693. if (!properties.file || properties.isInternalFont) {
  10694. if (/Symbol/i.test(properties.name)) {
  10695. encoding = _encodings.SymbolSetEncoding;
  10696. } else if (/Dingbats|Wingdings/i.test(properties.name)) {
  10697. encoding = _encodings.ZapfDingbatsEncoding;
  10698. }
  10699. }
  10700. }
  10701. properties.defaultEncoding = encoding;
  10702. }
  10703. properties.differences = differences;
  10704. properties.baseEncodingName = baseEncodingName;
  10705. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  10706. properties.dict = dict;
  10707. return toUnicodePromise.then(readToUnicode => {
  10708. properties.toUnicode = readToUnicode;
  10709. return this.buildToUnicode(properties);
  10710. }).then(builtToUnicode => {
  10711. properties.toUnicode = builtToUnicode;
  10712. if (cidToGidBytes) {
  10713. properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
  10714. }
  10715. return properties;
  10716. });
  10717. }
  10718. _simpleFontToUnicode(properties, forceGlyphs = false) {
  10719. (0, _util.assert)(!properties.composite, "Must be a simple font.");
  10720. const toUnicode = [];
  10721. const encoding = properties.defaultEncoding.slice();
  10722. const baseEncodingName = properties.baseEncodingName;
  10723. const differences = properties.differences;
  10724. for (const charcode in differences) {
  10725. const glyphName = differences[charcode];
  10726. if (glyphName === ".notdef") {
  10727. continue;
  10728. }
  10729. encoding[charcode] = glyphName;
  10730. }
  10731. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  10732. for (const charcode in encoding) {
  10733. let glyphName = encoding[charcode];
  10734. if (glyphName === "") {
  10735. continue;
  10736. }
  10737. let unicode = glyphsUnicodeMap[glyphName];
  10738. if (unicode !== undefined) {
  10739. toUnicode[charcode] = String.fromCharCode(unicode);
  10740. continue;
  10741. }
  10742. let code = 0;
  10743. switch (glyphName[0]) {
  10744. case "G":
  10745. if (glyphName.length === 3) {
  10746. code = parseInt(glyphName.substring(1), 16);
  10747. }
  10748. break;
  10749. case "g":
  10750. if (glyphName.length === 5) {
  10751. code = parseInt(glyphName.substring(1), 16);
  10752. }
  10753. break;
  10754. case "C":
  10755. case "c":
  10756. if (glyphName.length >= 3 && glyphName.length <= 4) {
  10757. const codeStr = glyphName.substring(1);
  10758. if (forceGlyphs) {
  10759. code = parseInt(codeStr, 16);
  10760. break;
  10761. }
  10762. code = +codeStr;
  10763. if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
  10764. return this._simpleFontToUnicode(properties, true);
  10765. }
  10766. }
  10767. break;
  10768. case "u":
  10769. unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  10770. if (unicode !== -1) {
  10771. code = unicode;
  10772. }
  10773. break;
  10774. }
  10775. if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
  10776. if (baseEncodingName && code === +charcode) {
  10777. const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  10778. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  10779. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  10780. continue;
  10781. }
  10782. }
  10783. toUnicode[charcode] = String.fromCodePoint(code);
  10784. }
  10785. }
  10786. return toUnicode;
  10787. }
  10788. async buildToUnicode(properties) {
  10789. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  10790. if (properties.hasIncludedToUnicodeMap) {
  10791. if (!properties.composite && properties.hasEncoding) {
  10792. properties.fallbackToUnicode = this._simpleFontToUnicode(properties);
  10793. }
  10794. return properties.toUnicode;
  10795. }
  10796. if (!properties.composite) {
  10797. return new _to_unicode_map.ToUnicodeMap(this._simpleFontToUnicode(properties));
  10798. }
  10799. if (properties.composite && (properties.cMap.builtInCMap && !(properties.cMap instanceof _cmap.IdentityCMap) || properties.cidSystemInfo.registry === "Adobe" && (properties.cidSystemInfo.ordering === "GB1" || properties.cidSystemInfo.ordering === "CNS1" || properties.cidSystemInfo.ordering === "Japan1" || properties.cidSystemInfo.ordering === "Korea1"))) {
  10800. const {
  10801. registry,
  10802. ordering
  10803. } = properties.cidSystemInfo;
  10804. const ucs2CMapName = _primitives.Name.get(`${registry}-${ordering}-UCS2`);
  10805. const ucs2CMap = await _cmap.CMapFactory.create({
  10806. encoding: ucs2CMapName,
  10807. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  10808. useCMap: null
  10809. });
  10810. const toUnicode = [];
  10811. properties.cMap.forEach(function (charcode, cid) {
  10812. if (cid > 0xffff) {
  10813. throw new _util.FormatError("Max size of CID is 65,535");
  10814. }
  10815. const ucs2 = ucs2CMap.lookup(cid);
  10816. if (ucs2) {
  10817. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  10818. }
  10819. });
  10820. return new _to_unicode_map.ToUnicodeMap(toUnicode);
  10821. }
  10822. return new _to_unicode_map.IdentityToUnicodeMap(properties.firstChar, properties.lastChar);
  10823. }
  10824. readToUnicode(cmapObj) {
  10825. if (!cmapObj) {
  10826. return Promise.resolve(null);
  10827. }
  10828. if (cmapObj instanceof _primitives.Name) {
  10829. return _cmap.CMapFactory.create({
  10830. encoding: cmapObj,
  10831. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  10832. useCMap: null
  10833. }).then(function (cmap) {
  10834. if (cmap instanceof _cmap.IdentityCMap) {
  10835. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  10836. }
  10837. return new _to_unicode_map.ToUnicodeMap(cmap.getMap());
  10838. });
  10839. } else if (cmapObj instanceof _base_stream.BaseStream) {
  10840. return _cmap.CMapFactory.create({
  10841. encoding: cmapObj,
  10842. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  10843. useCMap: null
  10844. }).then(function (cmap) {
  10845. if (cmap instanceof _cmap.IdentityCMap) {
  10846. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  10847. }
  10848. const map = new Array(cmap.length);
  10849. cmap.forEach(function (charCode, token) {
  10850. if (typeof token === "number") {
  10851. map[charCode] = String.fromCodePoint(token);
  10852. return;
  10853. }
  10854. const str = [];
  10855. for (let k = 0; k < token.length; k += 2) {
  10856. const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  10857. if ((w1 & 0xf800) !== 0xd800) {
  10858. str.push(w1);
  10859. continue;
  10860. }
  10861. k += 2;
  10862. const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  10863. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  10864. }
  10865. map[charCode] = String.fromCodePoint(...str);
  10866. });
  10867. return new _to_unicode_map.ToUnicodeMap(map);
  10868. }, reason => {
  10869. if (reason instanceof _util.AbortException) {
  10870. return null;
  10871. }
  10872. if (this.options.ignoreErrors) {
  10873. this.handler.send("UnsupportedFeature", {
  10874. featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode
  10875. });
  10876. (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
  10877. return null;
  10878. }
  10879. throw reason;
  10880. });
  10881. }
  10882. return Promise.resolve(null);
  10883. }
  10884. readCidToGidMap(glyphsData, toUnicode) {
  10885. const result = [];
  10886. for (let j = 0, jj = glyphsData.length; j < jj; j++) {
  10887. const glyphID = glyphsData[j++] << 8 | glyphsData[j];
  10888. const code = j >> 1;
  10889. if (glyphID === 0 && !toUnicode.has(code)) {
  10890. continue;
  10891. }
  10892. result[code] = glyphID;
  10893. }
  10894. return result;
  10895. }
  10896. extractWidths(dict, descriptor, properties) {
  10897. const xref = this.xref;
  10898. let glyphsWidths = [];
  10899. let defaultWidth = 0;
  10900. const glyphsVMetrics = [];
  10901. let defaultVMetrics;
  10902. let i, ii, j, jj, start, code, widths;
  10903. if (properties.composite) {
  10904. defaultWidth = dict.has("DW") ? dict.get("DW") : 1000;
  10905. widths = dict.get("W");
  10906. if (widths) {
  10907. for (i = 0, ii = widths.length; i < ii; i++) {
  10908. start = xref.fetchIfRef(widths[i++]);
  10909. code = xref.fetchIfRef(widths[i]);
  10910. if (Array.isArray(code)) {
  10911. for (j = 0, jj = code.length; j < jj; j++) {
  10912. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  10913. }
  10914. } else {
  10915. const width = xref.fetchIfRef(widths[++i]);
  10916. for (j = start; j <= code; j++) {
  10917. glyphsWidths[j] = width;
  10918. }
  10919. }
  10920. }
  10921. }
  10922. if (properties.vertical) {
  10923. let vmetrics = dict.getArray("DW2") || [880, -1000];
  10924. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  10925. vmetrics = dict.get("W2");
  10926. if (vmetrics) {
  10927. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  10928. start = xref.fetchIfRef(vmetrics[i++]);
  10929. code = xref.fetchIfRef(vmetrics[i]);
  10930. if (Array.isArray(code)) {
  10931. for (j = 0, jj = code.length; j < jj; j++) {
  10932. glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  10933. }
  10934. } else {
  10935. const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  10936. for (j = start; j <= code; j++) {
  10937. glyphsVMetrics[j] = vmetric;
  10938. }
  10939. }
  10940. }
  10941. }
  10942. }
  10943. } else {
  10944. const firstChar = properties.firstChar;
  10945. widths = dict.get("Widths");
  10946. if (widths) {
  10947. j = firstChar;
  10948. for (i = 0, ii = widths.length; i < ii; i++) {
  10949. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  10950. }
  10951. defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0;
  10952. } else {
  10953. const baseFontName = dict.get("BaseFont");
  10954. if (baseFontName instanceof _primitives.Name) {
  10955. const metrics = this.getBaseFontMetrics(baseFontName.name);
  10956. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  10957. defaultWidth = metrics.defaultWidth;
  10958. }
  10959. }
  10960. }
  10961. let isMonospace = true;
  10962. let firstWidth = defaultWidth;
  10963. for (const glyph in glyphsWidths) {
  10964. const glyphWidth = glyphsWidths[glyph];
  10965. if (!glyphWidth) {
  10966. continue;
  10967. }
  10968. if (!firstWidth) {
  10969. firstWidth = glyphWidth;
  10970. continue;
  10971. }
  10972. if (firstWidth !== glyphWidth) {
  10973. isMonospace = false;
  10974. break;
  10975. }
  10976. }
  10977. if (isMonospace) {
  10978. properties.flags |= _fonts_utils.FontFlags.FixedPitch;
  10979. }
  10980. properties.defaultWidth = defaultWidth;
  10981. properties.widths = glyphsWidths;
  10982. properties.defaultVMetrics = defaultVMetrics;
  10983. properties.vmetrics = glyphsVMetrics;
  10984. }
  10985. isSerifFont(baseFontName) {
  10986. const fontNameWoStyle = baseFontName.split("-")[0];
  10987. return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || /serif/gi.test(fontNameWoStyle);
  10988. }
  10989. getBaseFontMetrics(name) {
  10990. let defaultWidth = 0;
  10991. let widths = Object.create(null);
  10992. let monospace = false;
  10993. const stdFontMap = (0, _standard_fonts.getStdFontMap)();
  10994. let lookupName = stdFontMap[name] || name;
  10995. const Metrics = (0, _metrics.getMetrics)();
  10996. if (!(lookupName in Metrics)) {
  10997. if (this.isSerifFont(name)) {
  10998. lookupName = "Times-Roman";
  10999. } else {
  11000. lookupName = "Helvetica";
  11001. }
  11002. }
  11003. const glyphWidths = Metrics[lookupName];
  11004. if (typeof glyphWidths === "number") {
  11005. defaultWidth = glyphWidths;
  11006. monospace = true;
  11007. } else {
  11008. widths = glyphWidths();
  11009. }
  11010. return {
  11011. defaultWidth,
  11012. monospace,
  11013. widths
  11014. };
  11015. }
  11016. buildCharCodeToWidth(widthsByGlyphName, properties) {
  11017. const widths = Object.create(null);
  11018. const differences = properties.differences;
  11019. const encoding = properties.defaultEncoding;
  11020. for (let charCode = 0; charCode < 256; charCode++) {
  11021. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  11022. widths[charCode] = widthsByGlyphName[differences[charCode]];
  11023. continue;
  11024. }
  11025. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  11026. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  11027. continue;
  11028. }
  11029. }
  11030. return widths;
  11031. }
  11032. preEvaluateFont(dict) {
  11033. const baseDict = dict;
  11034. let type = dict.get("Subtype");
  11035. if (!(type instanceof _primitives.Name)) {
  11036. throw new _util.FormatError("invalid font Subtype");
  11037. }
  11038. let composite = false;
  11039. let hash, toUnicode;
  11040. if (type.name === "Type0") {
  11041. const df = dict.get("DescendantFonts");
  11042. if (!df) {
  11043. throw new _util.FormatError("Descendant fonts are not specified");
  11044. }
  11045. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  11046. if (!(dict instanceof _primitives.Dict)) {
  11047. throw new _util.FormatError("Descendant font is not a dictionary.");
  11048. }
  11049. type = dict.get("Subtype");
  11050. if (!(type instanceof _primitives.Name)) {
  11051. throw new _util.FormatError("invalid font Subtype");
  11052. }
  11053. composite = true;
  11054. }
  11055. const firstChar = dict.get("FirstChar") || 0,
  11056. lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
  11057. const descriptor = dict.get("FontDescriptor");
  11058. if (descriptor) {
  11059. hash = new _murmurhash.MurmurHash3_64();
  11060. const encoding = baseDict.getRaw("Encoding");
  11061. if (encoding instanceof _primitives.Name) {
  11062. hash.update(encoding.name);
  11063. } else if (encoding instanceof _primitives.Ref) {
  11064. hash.update(encoding.toString());
  11065. } else if (encoding instanceof _primitives.Dict) {
  11066. for (const entry of encoding.getRawValues()) {
  11067. if (entry instanceof _primitives.Name) {
  11068. hash.update(entry.name);
  11069. } else if (entry instanceof _primitives.Ref) {
  11070. hash.update(entry.toString());
  11071. } else if (Array.isArray(entry)) {
  11072. const diffLength = entry.length,
  11073. diffBuf = new Array(diffLength);
  11074. for (let j = 0; j < diffLength; j++) {
  11075. const diffEntry = entry[j];
  11076. if (diffEntry instanceof _primitives.Name) {
  11077. diffBuf[j] = diffEntry.name;
  11078. } else if (typeof diffEntry === "number" || diffEntry instanceof _primitives.Ref) {
  11079. diffBuf[j] = diffEntry.toString();
  11080. }
  11081. }
  11082. hash.update(diffBuf.join());
  11083. }
  11084. }
  11085. }
  11086. hash.update(`${firstChar}-${lastChar}`);
  11087. toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  11088. if (toUnicode instanceof _base_stream.BaseStream) {
  11089. const stream = toUnicode.str || toUnicode;
  11090. const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  11091. hash.update(uint8array);
  11092. } else if (toUnicode instanceof _primitives.Name) {
  11093. hash.update(toUnicode.name);
  11094. }
  11095. const widths = dict.get("Widths") || baseDict.get("Widths");
  11096. if (Array.isArray(widths)) {
  11097. const widthsBuf = [];
  11098. for (const entry of widths) {
  11099. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  11100. widthsBuf.push(entry.toString());
  11101. }
  11102. }
  11103. hash.update(widthsBuf.join());
  11104. }
  11105. if (composite) {
  11106. hash.update("compositeFont");
  11107. const compositeWidths = dict.get("W") || baseDict.get("W");
  11108. if (Array.isArray(compositeWidths)) {
  11109. const widthsBuf = [];
  11110. for (const entry of compositeWidths) {
  11111. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  11112. widthsBuf.push(entry.toString());
  11113. } else if (Array.isArray(entry)) {
  11114. const subWidthsBuf = [];
  11115. for (const element of entry) {
  11116. if (typeof element === "number" || element instanceof _primitives.Ref) {
  11117. subWidthsBuf.push(element.toString());
  11118. }
  11119. }
  11120. widthsBuf.push(`[${subWidthsBuf.join()}]`);
  11121. }
  11122. }
  11123. hash.update(widthsBuf.join());
  11124. }
  11125. const cidToGidMap = dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap");
  11126. if (cidToGidMap instanceof _primitives.Name) {
  11127. hash.update(cidToGidMap.name);
  11128. } else if (cidToGidMap instanceof _primitives.Ref) {
  11129. hash.update(cidToGidMap.toString());
  11130. } else if (cidToGidMap instanceof _base_stream.BaseStream) {
  11131. hash.update(cidToGidMap.peekBytes());
  11132. }
  11133. }
  11134. }
  11135. return {
  11136. descriptor,
  11137. dict,
  11138. baseDict,
  11139. composite,
  11140. type: type.name,
  11141. firstChar,
  11142. lastChar,
  11143. toUnicode,
  11144. hash: hash ? hash.hexdigest() : ""
  11145. };
  11146. }
  11147. async translateFont({
  11148. descriptor,
  11149. dict,
  11150. baseDict,
  11151. composite,
  11152. type,
  11153. firstChar,
  11154. lastChar,
  11155. toUnicode,
  11156. cssFontInfo
  11157. }) {
  11158. const isType3Font = type === "Type3";
  11159. let properties;
  11160. if (!descriptor) {
  11161. if (isType3Font) {
  11162. descriptor = new _primitives.Dict(null);
  11163. descriptor.set("FontName", _primitives.Name.get(type));
  11164. descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]);
  11165. } else {
  11166. let baseFontName = dict.get("BaseFont");
  11167. if (!(baseFontName instanceof _primitives.Name)) {
  11168. throw new _util.FormatError("Base font is not specified");
  11169. }
  11170. baseFontName = baseFontName.name.replace(/[,_]/g, "-");
  11171. const metrics = this.getBaseFontMetrics(baseFontName);
  11172. const fontNameWoStyle = baseFontName.split("-")[0];
  11173. const flags = (this.isSerifFont(fontNameWoStyle) ? _fonts_utils.FontFlags.Serif : 0) | (metrics.monospace ? _fonts_utils.FontFlags.FixedPitch : 0) | ((0, _standard_fonts.getSymbolsFonts)()[fontNameWoStyle] ? _fonts_utils.FontFlags.Symbolic : _fonts_utils.FontFlags.Nonsymbolic);
  11174. properties = {
  11175. type,
  11176. name: baseFontName,
  11177. loadedName: baseDict.loadedName,
  11178. widths: metrics.widths,
  11179. defaultWidth: metrics.defaultWidth,
  11180. isSimulatedFlags: true,
  11181. flags,
  11182. firstChar,
  11183. lastChar,
  11184. toUnicode,
  11185. xHeight: 0,
  11186. capHeight: 0,
  11187. italicAngle: 0,
  11188. isType3Font
  11189. };
  11190. const widths = dict.get("Widths");
  11191. const standardFontName = (0, _standard_fonts.getStandardFontName)(baseFontName);
  11192. let file = null;
  11193. if (standardFontName) {
  11194. properties.isStandardFont = true;
  11195. file = await this.fetchStandardFontData(standardFontName);
  11196. properties.isInternalFont = !!file;
  11197. }
  11198. return this.extractDataStructures(dict, dict, properties).then(newProperties => {
  11199. if (widths) {
  11200. const glyphWidths = [];
  11201. let j = firstChar;
  11202. for (const width of widths) {
  11203. glyphWidths[j++] = this.xref.fetchIfRef(width);
  11204. }
  11205. newProperties.widths = glyphWidths;
  11206. } else {
  11207. newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
  11208. }
  11209. return new _fonts.Font(baseFontName, file, newProperties);
  11210. });
  11211. }
  11212. }
  11213. let fontName = descriptor.get("FontName");
  11214. let baseFont = dict.get("BaseFont");
  11215. if (typeof fontName === "string") {
  11216. fontName = _primitives.Name.get(fontName);
  11217. }
  11218. if (typeof baseFont === "string") {
  11219. baseFont = _primitives.Name.get(baseFont);
  11220. }
  11221. if (!isType3Font) {
  11222. const fontNameStr = fontName && fontName.name;
  11223. const baseFontStr = baseFont && baseFont.name;
  11224. if (fontNameStr !== baseFontStr) {
  11225. (0, _util.info)(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`);
  11226. if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) {
  11227. fontName = baseFont;
  11228. }
  11229. }
  11230. }
  11231. fontName = fontName || baseFont;
  11232. if (!(fontName instanceof _primitives.Name)) {
  11233. throw new _util.FormatError("invalid font name");
  11234. }
  11235. let fontFile, subtype, length1, length2, length3;
  11236. try {
  11237. fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  11238. } catch (ex) {
  11239. if (!this.options.ignoreErrors) {
  11240. throw ex;
  11241. }
  11242. (0, _util.warn)(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
  11243. fontFile = new _stream.NullStream();
  11244. }
  11245. let isStandardFont = false;
  11246. let isInternalFont = false;
  11247. let glyphScaleFactors = null;
  11248. if (fontFile) {
  11249. if (fontFile.dict) {
  11250. const subtypeEntry = fontFile.dict.get("Subtype");
  11251. if (subtypeEntry instanceof _primitives.Name) {
  11252. subtype = subtypeEntry.name;
  11253. }
  11254. length1 = fontFile.dict.get("Length1");
  11255. length2 = fontFile.dict.get("Length2");
  11256. length3 = fontFile.dict.get("Length3");
  11257. }
  11258. } else if (cssFontInfo) {
  11259. const standardFontName = (0, _xfa_fonts.getXfaFontName)(fontName.name);
  11260. if (standardFontName) {
  11261. cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`;
  11262. cssFontInfo.metrics = standardFontName.metrics || null;
  11263. glyphScaleFactors = standardFontName.factors || null;
  11264. fontFile = await this.fetchStandardFontData(standardFontName.name);
  11265. isInternalFont = !!fontFile;
  11266. baseDict = dict = (0, _xfa_fonts.getXfaFontDict)(fontName.name);
  11267. composite = true;
  11268. }
  11269. } else if (!isType3Font) {
  11270. const standardFontName = (0, _standard_fonts.getStandardFontName)(fontName.name);
  11271. if (standardFontName) {
  11272. isStandardFont = true;
  11273. fontFile = await this.fetchStandardFontData(standardFontName);
  11274. isInternalFont = !!fontFile;
  11275. }
  11276. }
  11277. properties = {
  11278. type,
  11279. name: fontName.name,
  11280. subtype,
  11281. file: fontFile,
  11282. length1,
  11283. length2,
  11284. length3,
  11285. isStandardFont,
  11286. isInternalFont,
  11287. loadedName: baseDict.loadedName,
  11288. composite,
  11289. fixedPitch: false,
  11290. fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
  11291. firstChar,
  11292. lastChar,
  11293. toUnicode,
  11294. bbox: descriptor.getArray("FontBBox") || dict.getArray("FontBBox"),
  11295. ascent: descriptor.get("Ascent"),
  11296. descent: descriptor.get("Descent"),
  11297. xHeight: descriptor.get("XHeight") || 0,
  11298. capHeight: descriptor.get("CapHeight") || 0,
  11299. flags: descriptor.get("Flags"),
  11300. italicAngle: descriptor.get("ItalicAngle") || 0,
  11301. isType3Font,
  11302. cssFontInfo,
  11303. scaleFactors: glyphScaleFactors
  11304. };
  11305. if (composite) {
  11306. const cidEncoding = baseDict.get("Encoding");
  11307. if (cidEncoding instanceof _primitives.Name) {
  11308. properties.cidEncoding = cidEncoding.name;
  11309. }
  11310. const cMap = await _cmap.CMapFactory.create({
  11311. encoding: cidEncoding,
  11312. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  11313. useCMap: null
  11314. });
  11315. properties.cMap = cMap;
  11316. properties.vertical = properties.cMap.vertical;
  11317. }
  11318. return this.extractDataStructures(dict, baseDict, properties).then(newProperties => {
  11319. this.extractWidths(dict, descriptor, newProperties);
  11320. return new _fonts.Font(fontName.name, fontFile, newProperties);
  11321. });
  11322. }
  11323. static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
  11324. function buildPath(fontChar) {
  11325. const glyphName = `${font.loadedName}_path_${fontChar}`;
  11326. try {
  11327. if (font.renderer.hasBuiltPath(fontChar)) {
  11328. return;
  11329. }
  11330. handler.send("commonobj", [glyphName, "FontPath", font.renderer.getPathJs(fontChar)]);
  11331. } catch (reason) {
  11332. if (evaluatorOptions.ignoreErrors) {
  11333. handler.send("UnsupportedFeature", {
  11334. featureId: _util.UNSUPPORTED_FEATURES.errorFontBuildPath
  11335. });
  11336. (0, _util.warn)(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
  11337. return;
  11338. }
  11339. throw reason;
  11340. }
  11341. }
  11342. for (const glyph of glyphs) {
  11343. buildPath(glyph.fontChar);
  11344. const accent = glyph.accent;
  11345. if (accent && accent.fontChar) {
  11346. buildPath(accent.fontChar);
  11347. }
  11348. }
  11349. }
  11350. static get fallbackFontDict() {
  11351. const dict = new _primitives.Dict();
  11352. dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont"));
  11353. dict.set("Type", _primitives.Name.get("FallbackType"));
  11354. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  11355. dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  11356. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  11357. }
  11358. }
  11359. exports.PartialEvaluator = PartialEvaluator;
  11360. class TranslatedFont {
  11361. constructor({
  11362. loadedName,
  11363. font,
  11364. dict,
  11365. evaluatorOptions
  11366. }) {
  11367. this.loadedName = loadedName;
  11368. this.font = font;
  11369. this.dict = dict;
  11370. this._evaluatorOptions = evaluatorOptions || DefaultPartialEvaluatorOptions;
  11371. this.type3Loaded = null;
  11372. this.type3Dependencies = font.isType3Font ? new Set() : null;
  11373. this.sent = false;
  11374. }
  11375. send(handler) {
  11376. if (this.sent) {
  11377. return;
  11378. }
  11379. this.sent = true;
  11380. handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._evaluatorOptions.fontExtraProperties)]);
  11381. }
  11382. fallback(handler) {
  11383. if (!this.font.data) {
  11384. return;
  11385. }
  11386. this.font.disableFontFace = true;
  11387. PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, this._evaluatorOptions);
  11388. }
  11389. loadType3Data(evaluator, resources, task) {
  11390. if (this.type3Loaded) {
  11391. return this.type3Loaded;
  11392. }
  11393. if (!this.font.isType3Font) {
  11394. throw new Error("Must be a Type3 font.");
  11395. }
  11396. const type3Evaluator = evaluator.clone({
  11397. ignoreErrors: false
  11398. });
  11399. type3Evaluator.parsingType3Font = true;
  11400. const type3FontRefs = new _primitives.RefSet(evaluator.type3FontRefs);
  11401. if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
  11402. type3FontRefs.put(this.dict.objId);
  11403. }
  11404. type3Evaluator.type3FontRefs = type3FontRefs;
  11405. const translatedFont = this.font,
  11406. type3Dependencies = this.type3Dependencies;
  11407. let loadCharProcsPromise = Promise.resolve();
  11408. const charProcs = this.dict.get("CharProcs");
  11409. const fontResources = this.dict.get("Resources") || resources;
  11410. const charProcOperatorList = Object.create(null);
  11411. const fontBBox = _util.Util.normalizeRect(translatedFont.bbox || [0, 0, 0, 0]),
  11412. width = fontBBox[2] - fontBBox[0],
  11413. height = fontBBox[3] - fontBBox[1];
  11414. const fontBBoxSize = Math.hypot(width, height);
  11415. for (const key of charProcs.getKeys()) {
  11416. loadCharProcsPromise = loadCharProcsPromise.then(() => {
  11417. const glyphStream = charProcs.get(key);
  11418. const operatorList = new _operator_list.OperatorList();
  11419. return type3Evaluator.getOperatorList({
  11420. stream: glyphStream,
  11421. task,
  11422. resources: fontResources,
  11423. operatorList
  11424. }).then(() => {
  11425. if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) {
  11426. this._removeType3ColorOperators(operatorList, fontBBoxSize);
  11427. }
  11428. charProcOperatorList[key] = operatorList.getIR();
  11429. for (const dependency of operatorList.dependencies) {
  11430. type3Dependencies.add(dependency);
  11431. }
  11432. }).catch(function (reason) {
  11433. (0, _util.warn)(`Type3 font resource "${key}" is not available.`);
  11434. const dummyOperatorList = new _operator_list.OperatorList();
  11435. charProcOperatorList[key] = dummyOperatorList.getIR();
  11436. });
  11437. });
  11438. }
  11439. this.type3Loaded = loadCharProcsPromise.then(() => {
  11440. translatedFont.charProcOperatorList = charProcOperatorList;
  11441. if (this._bbox) {
  11442. translatedFont.isCharBBox = true;
  11443. translatedFont.bbox = this._bbox;
  11444. }
  11445. });
  11446. return this.type3Loaded;
  11447. }
  11448. _removeType3ColorOperators(operatorList, fontBBoxSize = NaN) {
  11449. const charBBox = _util.Util.normalizeRect(operatorList.argsArray[0].slice(2)),
  11450. width = charBBox[2] - charBBox[0],
  11451. height = charBBox[3] - charBBox[1];
  11452. const charBBoxSize = Math.hypot(width, height);
  11453. if (width === 0 || height === 0) {
  11454. operatorList.fnArray.splice(0, 1);
  11455. operatorList.argsArray.splice(0, 1);
  11456. } else if (fontBBoxSize === 0 || Math.round(charBBoxSize / fontBBoxSize) >= 10) {
  11457. if (!this._bbox) {
  11458. this._bbox = [Infinity, Infinity, -Infinity, -Infinity];
  11459. }
  11460. this._bbox[0] = Math.min(this._bbox[0], charBBox[0]);
  11461. this._bbox[1] = Math.min(this._bbox[1], charBBox[1]);
  11462. this._bbox[2] = Math.max(this._bbox[2], charBBox[2]);
  11463. this._bbox[3] = Math.max(this._bbox[3], charBBox[3]);
  11464. }
  11465. let i = 0,
  11466. ii = operatorList.length;
  11467. while (i < ii) {
  11468. switch (operatorList.fnArray[i]) {
  11469. case _util.OPS.setCharWidthAndBounds:
  11470. break;
  11471. case _util.OPS.setStrokeColorSpace:
  11472. case _util.OPS.setFillColorSpace:
  11473. case _util.OPS.setStrokeColor:
  11474. case _util.OPS.setStrokeColorN:
  11475. case _util.OPS.setFillColor:
  11476. case _util.OPS.setFillColorN:
  11477. case _util.OPS.setStrokeGray:
  11478. case _util.OPS.setFillGray:
  11479. case _util.OPS.setStrokeRGBColor:
  11480. case _util.OPS.setFillRGBColor:
  11481. case _util.OPS.setStrokeCMYKColor:
  11482. case _util.OPS.setFillCMYKColor:
  11483. case _util.OPS.shadingFill:
  11484. case _util.OPS.setRenderingIntent:
  11485. operatorList.fnArray.splice(i, 1);
  11486. operatorList.argsArray.splice(i, 1);
  11487. ii--;
  11488. continue;
  11489. case _util.OPS.setGState:
  11490. const [gStateObj] = operatorList.argsArray[i];
  11491. let j = 0,
  11492. jj = gStateObj.length;
  11493. while (j < jj) {
  11494. const [gStateKey] = gStateObj[j];
  11495. switch (gStateKey) {
  11496. case "TR":
  11497. case "TR2":
  11498. case "HT":
  11499. case "BG":
  11500. case "BG2":
  11501. case "UCR":
  11502. case "UCR2":
  11503. gStateObj.splice(j, 1);
  11504. jj--;
  11505. continue;
  11506. }
  11507. j++;
  11508. }
  11509. break;
  11510. }
  11511. i++;
  11512. }
  11513. }
  11514. }
  11515. class StateManager {
  11516. constructor(initialState = new EvalState()) {
  11517. this.state = initialState;
  11518. this.stateStack = [];
  11519. }
  11520. save() {
  11521. const old = this.state;
  11522. this.stateStack.push(this.state);
  11523. this.state = old.clone();
  11524. }
  11525. restore() {
  11526. const prev = this.stateStack.pop();
  11527. if (prev) {
  11528. this.state = prev;
  11529. }
  11530. }
  11531. transform(args) {
  11532. this.state.ctm = _util.Util.transform(this.state.ctm, args);
  11533. }
  11534. }
  11535. class TextState {
  11536. constructor() {
  11537. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  11538. this.fontName = null;
  11539. this.fontSize = 0;
  11540. this.loadedName = null;
  11541. this.font = null;
  11542. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  11543. this.textMatrix = _util.IDENTITY_MATRIX.slice();
  11544. this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  11545. this.charSpacing = 0;
  11546. this.wordSpacing = 0;
  11547. this.leading = 0;
  11548. this.textHScale = 1;
  11549. this.textRise = 0;
  11550. }
  11551. setTextMatrix(a, b, c, d, e, f) {
  11552. const m = this.textMatrix;
  11553. m[0] = a;
  11554. m[1] = b;
  11555. m[2] = c;
  11556. m[3] = d;
  11557. m[4] = e;
  11558. m[5] = f;
  11559. }
  11560. setTextLineMatrix(a, b, c, d, e, f) {
  11561. const m = this.textLineMatrix;
  11562. m[0] = a;
  11563. m[1] = b;
  11564. m[2] = c;
  11565. m[3] = d;
  11566. m[4] = e;
  11567. m[5] = f;
  11568. }
  11569. translateTextMatrix(x, y) {
  11570. const m = this.textMatrix;
  11571. m[4] = m[0] * x + m[2] * y + m[4];
  11572. m[5] = m[1] * x + m[3] * y + m[5];
  11573. }
  11574. translateTextLineMatrix(x, y) {
  11575. const m = this.textLineMatrix;
  11576. m[4] = m[0] * x + m[2] * y + m[4];
  11577. m[5] = m[1] * x + m[3] * y + m[5];
  11578. }
  11579. carriageReturn() {
  11580. this.translateTextLineMatrix(0, -this.leading);
  11581. this.textMatrix = this.textLineMatrix.slice();
  11582. }
  11583. clone() {
  11584. const clone = Object.create(this);
  11585. clone.textMatrix = this.textMatrix.slice();
  11586. clone.textLineMatrix = this.textLineMatrix.slice();
  11587. clone.fontMatrix = this.fontMatrix.slice();
  11588. return clone;
  11589. }
  11590. }
  11591. class EvalState {
  11592. constructor() {
  11593. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  11594. this.font = null;
  11595. this.textRenderingMode = _util.TextRenderingMode.FILL;
  11596. this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  11597. this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  11598. }
  11599. clone() {
  11600. return Object.create(this);
  11601. }
  11602. }
  11603. class EvaluatorPreprocessor {
  11604. static get opMap() {
  11605. const getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  11606. t.w = {
  11607. id: _util.OPS.setLineWidth,
  11608. numArgs: 1,
  11609. variableArgs: false
  11610. };
  11611. t.J = {
  11612. id: _util.OPS.setLineCap,
  11613. numArgs: 1,
  11614. variableArgs: false
  11615. };
  11616. t.j = {
  11617. id: _util.OPS.setLineJoin,
  11618. numArgs: 1,
  11619. variableArgs: false
  11620. };
  11621. t.M = {
  11622. id: _util.OPS.setMiterLimit,
  11623. numArgs: 1,
  11624. variableArgs: false
  11625. };
  11626. t.d = {
  11627. id: _util.OPS.setDash,
  11628. numArgs: 2,
  11629. variableArgs: false
  11630. };
  11631. t.ri = {
  11632. id: _util.OPS.setRenderingIntent,
  11633. numArgs: 1,
  11634. variableArgs: false
  11635. };
  11636. t.i = {
  11637. id: _util.OPS.setFlatness,
  11638. numArgs: 1,
  11639. variableArgs: false
  11640. };
  11641. t.gs = {
  11642. id: _util.OPS.setGState,
  11643. numArgs: 1,
  11644. variableArgs: false
  11645. };
  11646. t.q = {
  11647. id: _util.OPS.save,
  11648. numArgs: 0,
  11649. variableArgs: false
  11650. };
  11651. t.Q = {
  11652. id: _util.OPS.restore,
  11653. numArgs: 0,
  11654. variableArgs: false
  11655. };
  11656. t.cm = {
  11657. id: _util.OPS.transform,
  11658. numArgs: 6,
  11659. variableArgs: false
  11660. };
  11661. t.m = {
  11662. id: _util.OPS.moveTo,
  11663. numArgs: 2,
  11664. variableArgs: false
  11665. };
  11666. t.l = {
  11667. id: _util.OPS.lineTo,
  11668. numArgs: 2,
  11669. variableArgs: false
  11670. };
  11671. t.c = {
  11672. id: _util.OPS.curveTo,
  11673. numArgs: 6,
  11674. variableArgs: false
  11675. };
  11676. t.v = {
  11677. id: _util.OPS.curveTo2,
  11678. numArgs: 4,
  11679. variableArgs: false
  11680. };
  11681. t.y = {
  11682. id: _util.OPS.curveTo3,
  11683. numArgs: 4,
  11684. variableArgs: false
  11685. };
  11686. t.h = {
  11687. id: _util.OPS.closePath,
  11688. numArgs: 0,
  11689. variableArgs: false
  11690. };
  11691. t.re = {
  11692. id: _util.OPS.rectangle,
  11693. numArgs: 4,
  11694. variableArgs: false
  11695. };
  11696. t.S = {
  11697. id: _util.OPS.stroke,
  11698. numArgs: 0,
  11699. variableArgs: false
  11700. };
  11701. t.s = {
  11702. id: _util.OPS.closeStroke,
  11703. numArgs: 0,
  11704. variableArgs: false
  11705. };
  11706. t.f = {
  11707. id: _util.OPS.fill,
  11708. numArgs: 0,
  11709. variableArgs: false
  11710. };
  11711. t.F = {
  11712. id: _util.OPS.fill,
  11713. numArgs: 0,
  11714. variableArgs: false
  11715. };
  11716. t["f*"] = {
  11717. id: _util.OPS.eoFill,
  11718. numArgs: 0,
  11719. variableArgs: false
  11720. };
  11721. t.B = {
  11722. id: _util.OPS.fillStroke,
  11723. numArgs: 0,
  11724. variableArgs: false
  11725. };
  11726. t["B*"] = {
  11727. id: _util.OPS.eoFillStroke,
  11728. numArgs: 0,
  11729. variableArgs: false
  11730. };
  11731. t.b = {
  11732. id: _util.OPS.closeFillStroke,
  11733. numArgs: 0,
  11734. variableArgs: false
  11735. };
  11736. t["b*"] = {
  11737. id: _util.OPS.closeEOFillStroke,
  11738. numArgs: 0,
  11739. variableArgs: false
  11740. };
  11741. t.n = {
  11742. id: _util.OPS.endPath,
  11743. numArgs: 0,
  11744. variableArgs: false
  11745. };
  11746. t.W = {
  11747. id: _util.OPS.clip,
  11748. numArgs: 0,
  11749. variableArgs: false
  11750. };
  11751. t["W*"] = {
  11752. id: _util.OPS.eoClip,
  11753. numArgs: 0,
  11754. variableArgs: false
  11755. };
  11756. t.BT = {
  11757. id: _util.OPS.beginText,
  11758. numArgs: 0,
  11759. variableArgs: false
  11760. };
  11761. t.ET = {
  11762. id: _util.OPS.endText,
  11763. numArgs: 0,
  11764. variableArgs: false
  11765. };
  11766. t.Tc = {
  11767. id: _util.OPS.setCharSpacing,
  11768. numArgs: 1,
  11769. variableArgs: false
  11770. };
  11771. t.Tw = {
  11772. id: _util.OPS.setWordSpacing,
  11773. numArgs: 1,
  11774. variableArgs: false
  11775. };
  11776. t.Tz = {
  11777. id: _util.OPS.setHScale,
  11778. numArgs: 1,
  11779. variableArgs: false
  11780. };
  11781. t.TL = {
  11782. id: _util.OPS.setLeading,
  11783. numArgs: 1,
  11784. variableArgs: false
  11785. };
  11786. t.Tf = {
  11787. id: _util.OPS.setFont,
  11788. numArgs: 2,
  11789. variableArgs: false
  11790. };
  11791. t.Tr = {
  11792. id: _util.OPS.setTextRenderingMode,
  11793. numArgs: 1,
  11794. variableArgs: false
  11795. };
  11796. t.Ts = {
  11797. id: _util.OPS.setTextRise,
  11798. numArgs: 1,
  11799. variableArgs: false
  11800. };
  11801. t.Td = {
  11802. id: _util.OPS.moveText,
  11803. numArgs: 2,
  11804. variableArgs: false
  11805. };
  11806. t.TD = {
  11807. id: _util.OPS.setLeadingMoveText,
  11808. numArgs: 2,
  11809. variableArgs: false
  11810. };
  11811. t.Tm = {
  11812. id: _util.OPS.setTextMatrix,
  11813. numArgs: 6,
  11814. variableArgs: false
  11815. };
  11816. t["T*"] = {
  11817. id: _util.OPS.nextLine,
  11818. numArgs: 0,
  11819. variableArgs: false
  11820. };
  11821. t.Tj = {
  11822. id: _util.OPS.showText,
  11823. numArgs: 1,
  11824. variableArgs: false
  11825. };
  11826. t.TJ = {
  11827. id: _util.OPS.showSpacedText,
  11828. numArgs: 1,
  11829. variableArgs: false
  11830. };
  11831. t["'"] = {
  11832. id: _util.OPS.nextLineShowText,
  11833. numArgs: 1,
  11834. variableArgs: false
  11835. };
  11836. t['"'] = {
  11837. id: _util.OPS.nextLineSetSpacingShowText,
  11838. numArgs: 3,
  11839. variableArgs: false
  11840. };
  11841. t.d0 = {
  11842. id: _util.OPS.setCharWidth,
  11843. numArgs: 2,
  11844. variableArgs: false
  11845. };
  11846. t.d1 = {
  11847. id: _util.OPS.setCharWidthAndBounds,
  11848. numArgs: 6,
  11849. variableArgs: false
  11850. };
  11851. t.CS = {
  11852. id: _util.OPS.setStrokeColorSpace,
  11853. numArgs: 1,
  11854. variableArgs: false
  11855. };
  11856. t.cs = {
  11857. id: _util.OPS.setFillColorSpace,
  11858. numArgs: 1,
  11859. variableArgs: false
  11860. };
  11861. t.SC = {
  11862. id: _util.OPS.setStrokeColor,
  11863. numArgs: 4,
  11864. variableArgs: true
  11865. };
  11866. t.SCN = {
  11867. id: _util.OPS.setStrokeColorN,
  11868. numArgs: 33,
  11869. variableArgs: true
  11870. };
  11871. t.sc = {
  11872. id: _util.OPS.setFillColor,
  11873. numArgs: 4,
  11874. variableArgs: true
  11875. };
  11876. t.scn = {
  11877. id: _util.OPS.setFillColorN,
  11878. numArgs: 33,
  11879. variableArgs: true
  11880. };
  11881. t.G = {
  11882. id: _util.OPS.setStrokeGray,
  11883. numArgs: 1,
  11884. variableArgs: false
  11885. };
  11886. t.g = {
  11887. id: _util.OPS.setFillGray,
  11888. numArgs: 1,
  11889. variableArgs: false
  11890. };
  11891. t.RG = {
  11892. id: _util.OPS.setStrokeRGBColor,
  11893. numArgs: 3,
  11894. variableArgs: false
  11895. };
  11896. t.rg = {
  11897. id: _util.OPS.setFillRGBColor,
  11898. numArgs: 3,
  11899. variableArgs: false
  11900. };
  11901. t.K = {
  11902. id: _util.OPS.setStrokeCMYKColor,
  11903. numArgs: 4,
  11904. variableArgs: false
  11905. };
  11906. t.k = {
  11907. id: _util.OPS.setFillCMYKColor,
  11908. numArgs: 4,
  11909. variableArgs: false
  11910. };
  11911. t.sh = {
  11912. id: _util.OPS.shadingFill,
  11913. numArgs: 1,
  11914. variableArgs: false
  11915. };
  11916. t.BI = {
  11917. id: _util.OPS.beginInlineImage,
  11918. numArgs: 0,
  11919. variableArgs: false
  11920. };
  11921. t.ID = {
  11922. id: _util.OPS.beginImageData,
  11923. numArgs: 0,
  11924. variableArgs: false
  11925. };
  11926. t.EI = {
  11927. id: _util.OPS.endInlineImage,
  11928. numArgs: 1,
  11929. variableArgs: false
  11930. };
  11931. t.Do = {
  11932. id: _util.OPS.paintXObject,
  11933. numArgs: 1,
  11934. variableArgs: false
  11935. };
  11936. t.MP = {
  11937. id: _util.OPS.markPoint,
  11938. numArgs: 1,
  11939. variableArgs: false
  11940. };
  11941. t.DP = {
  11942. id: _util.OPS.markPointProps,
  11943. numArgs: 2,
  11944. variableArgs: false
  11945. };
  11946. t.BMC = {
  11947. id: _util.OPS.beginMarkedContent,
  11948. numArgs: 1,
  11949. variableArgs: false
  11950. };
  11951. t.BDC = {
  11952. id: _util.OPS.beginMarkedContentProps,
  11953. numArgs: 2,
  11954. variableArgs: false
  11955. };
  11956. t.EMC = {
  11957. id: _util.OPS.endMarkedContent,
  11958. numArgs: 0,
  11959. variableArgs: false
  11960. };
  11961. t.BX = {
  11962. id: _util.OPS.beginCompat,
  11963. numArgs: 0,
  11964. variableArgs: false
  11965. };
  11966. t.EX = {
  11967. id: _util.OPS.endCompat,
  11968. numArgs: 0,
  11969. variableArgs: false
  11970. };
  11971. t.BM = null;
  11972. t.BD = null;
  11973. t.true = null;
  11974. t.fa = null;
  11975. t.fal = null;
  11976. t.fals = null;
  11977. t.false = null;
  11978. t.nu = null;
  11979. t.nul = null;
  11980. t.null = null;
  11981. });
  11982. return (0, _util.shadow)(this, "opMap", getOPMap());
  11983. }
  11984. static get MAX_INVALID_PATH_OPS() {
  11985. return (0, _util.shadow)(this, "MAX_INVALID_PATH_OPS", 10);
  11986. }
  11987. constructor(stream, xref, stateManager = new StateManager()) {
  11988. this.parser = new _parser.Parser({
  11989. lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap),
  11990. xref
  11991. });
  11992. this.stateManager = stateManager;
  11993. this.nonProcessedArgs = [];
  11994. this._isPathOp = false;
  11995. this._numInvalidPathOPS = 0;
  11996. }
  11997. get savedStatesDepth() {
  11998. return this.stateManager.stateStack.length;
  11999. }
  12000. read(operation) {
  12001. let args = operation.args;
  12002. while (true) {
  12003. const obj = this.parser.getObj();
  12004. if (obj instanceof _primitives.Cmd) {
  12005. const cmd = obj.cmd;
  12006. const opSpec = EvaluatorPreprocessor.opMap[cmd];
  12007. if (!opSpec) {
  12008. (0, _util.warn)(`Unknown command "${cmd}".`);
  12009. continue;
  12010. }
  12011. const fn = opSpec.id;
  12012. const numArgs = opSpec.numArgs;
  12013. let argsLength = args !== null ? args.length : 0;
  12014. if (!this._isPathOp) {
  12015. this._numInvalidPathOPS = 0;
  12016. }
  12017. this._isPathOp = fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath;
  12018. if (!opSpec.variableArgs) {
  12019. if (argsLength !== numArgs) {
  12020. const nonProcessedArgs = this.nonProcessedArgs;
  12021. while (argsLength > numArgs) {
  12022. nonProcessedArgs.push(args.shift());
  12023. argsLength--;
  12024. }
  12025. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  12026. if (args === null) {
  12027. args = [];
  12028. }
  12029. args.unshift(nonProcessedArgs.pop());
  12030. argsLength++;
  12031. }
  12032. }
  12033. if (argsLength < numArgs) {
  12034. const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
  12035. if (this._isPathOp && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
  12036. throw new _util.FormatError(`Invalid ${partialMsg}`);
  12037. }
  12038. (0, _util.warn)(`Skipping ${partialMsg}`);
  12039. if (args !== null) {
  12040. args.length = 0;
  12041. }
  12042. continue;
  12043. }
  12044. } else if (argsLength > numArgs) {
  12045. (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
  12046. }
  12047. this.preprocessCommand(fn, args);
  12048. operation.fn = fn;
  12049. operation.args = args;
  12050. return true;
  12051. }
  12052. if (obj === _primitives.EOF) {
  12053. return false;
  12054. }
  12055. if (obj !== null) {
  12056. if (args === null) {
  12057. args = [];
  12058. }
  12059. args.push(obj);
  12060. if (args.length > 33) {
  12061. throw new _util.FormatError("Too many arguments");
  12062. }
  12063. }
  12064. }
  12065. }
  12066. preprocessCommand(fn, args) {
  12067. switch (fn | 0) {
  12068. case _util.OPS.save:
  12069. this.stateManager.save();
  12070. break;
  12071. case _util.OPS.restore:
  12072. this.stateManager.restore();
  12073. break;
  12074. case _util.OPS.transform:
  12075. this.stateManager.transform(args);
  12076. break;
  12077. }
  12078. }
  12079. }
  12080. exports.EvaluatorPreprocessor = EvaluatorPreprocessor;
  12081. /***/ }),
  12082. /* 14 */
  12083. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  12084. Object.defineProperty(exports, "__esModule", ({
  12085. value: true
  12086. }));
  12087. exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0;
  12088. var _util = __w_pdfjs_require__(2);
  12089. var _primitives = __w_pdfjs_require__(3);
  12090. var _base_stream = __w_pdfjs_require__(5);
  12091. var _parser = __w_pdfjs_require__(15);
  12092. var _core_utils = __w_pdfjs_require__(4);
  12093. var _stream = __w_pdfjs_require__(8);
  12094. const BUILT_IN_CMAPS = ["Adobe-GB1-UCS2", "Adobe-CNS1-UCS2", "Adobe-Japan1-UCS2", "Adobe-Korea1-UCS2", "78-EUC-H", "78-EUC-V", "78-H", "78-RKSJ-H", "78-RKSJ-V", "78-V", "78ms-RKSJ-H", "78ms-RKSJ-V", "83pv-RKSJ-H", "90ms-RKSJ-H", "90ms-RKSJ-V", "90msp-RKSJ-H", "90msp-RKSJ-V", "90pv-RKSJ-H", "90pv-RKSJ-V", "Add-H", "Add-RKSJ-H", "Add-RKSJ-V", "Add-V", "Adobe-CNS1-0", "Adobe-CNS1-1", "Adobe-CNS1-2", "Adobe-CNS1-3", "Adobe-CNS1-4", "Adobe-CNS1-5", "Adobe-CNS1-6", "Adobe-GB1-0", "Adobe-GB1-1", "Adobe-GB1-2", "Adobe-GB1-3", "Adobe-GB1-4", "Adobe-GB1-5", "Adobe-Japan1-0", "Adobe-Japan1-1", "Adobe-Japan1-2", "Adobe-Japan1-3", "Adobe-Japan1-4", "Adobe-Japan1-5", "Adobe-Japan1-6", "Adobe-Korea1-0", "Adobe-Korea1-1", "Adobe-Korea1-2", "B5-H", "B5-V", "B5pc-H", "B5pc-V", "CNS-EUC-H", "CNS-EUC-V", "CNS1-H", "CNS1-V", "CNS2-H", "CNS2-V", "ETHK-B5-H", "ETHK-B5-V", "ETen-B5-H", "ETen-B5-V", "ETenms-B5-H", "ETenms-B5-V", "EUC-H", "EUC-V", "Ext-H", "Ext-RKSJ-H", "Ext-RKSJ-V", "Ext-V", "GB-EUC-H", "GB-EUC-V", "GB-H", "GB-V", "GBK-EUC-H", "GBK-EUC-V", "GBK2K-H", "GBK2K-V", "GBKp-EUC-H", "GBKp-EUC-V", "GBT-EUC-H", "GBT-EUC-V", "GBT-H", "GBT-V", "GBTpc-EUC-H", "GBTpc-EUC-V", "GBpc-EUC-H", "GBpc-EUC-V", "H", "HKdla-B5-H", "HKdla-B5-V", "HKdlb-B5-H", "HKdlb-B5-V", "HKgccs-B5-H", "HKgccs-B5-V", "HKm314-B5-H", "HKm314-B5-V", "HKm471-B5-H", "HKm471-B5-V", "HKscs-B5-H", "HKscs-B5-V", "Hankaku", "Hiragana", "KSC-EUC-H", "KSC-EUC-V", "KSC-H", "KSC-Johab-H", "KSC-Johab-V", "KSC-V", "KSCms-UHC-H", "KSCms-UHC-HW-H", "KSCms-UHC-HW-V", "KSCms-UHC-V", "KSCpc-EUC-H", "KSCpc-EUC-V", "Katakana", "NWP-H", "NWP-V", "RKSJ-H", "RKSJ-V", "Roman", "UniCNS-UCS2-H", "UniCNS-UCS2-V", "UniCNS-UTF16-H", "UniCNS-UTF16-V", "UniCNS-UTF32-H", "UniCNS-UTF32-V", "UniCNS-UTF8-H", "UniCNS-UTF8-V", "UniGB-UCS2-H", "UniGB-UCS2-V", "UniGB-UTF16-H", "UniGB-UTF16-V", "UniGB-UTF32-H", "UniGB-UTF32-V", "UniGB-UTF8-H", "UniGB-UTF8-V", "UniJIS-UCS2-H", "UniJIS-UCS2-HW-H", "UniJIS-UCS2-HW-V", "UniJIS-UCS2-V", "UniJIS-UTF16-H", "UniJIS-UTF16-V", "UniJIS-UTF32-H", "UniJIS-UTF32-V", "UniJIS-UTF8-H", "UniJIS-UTF8-V", "UniJIS2004-UTF16-H", "UniJIS2004-UTF16-V", "UniJIS2004-UTF32-H", "UniJIS2004-UTF32-V", "UniJIS2004-UTF8-H", "UniJIS2004-UTF8-V", "UniJISPro-UCS2-HW-V", "UniJISPro-UCS2-V", "UniJISPro-UTF8-V", "UniJISX0213-UTF32-H", "UniJISX0213-UTF32-V", "UniJISX02132004-UTF32-H", "UniJISX02132004-UTF32-V", "UniKS-UCS2-H", "UniKS-UCS2-V", "UniKS-UTF16-H", "UniKS-UTF16-V", "UniKS-UTF32-H", "UniKS-UTF32-V", "UniKS-UTF8-H", "UniKS-UTF8-V", "V", "WP-Symbol"];
  12095. const MAX_MAP_RANGE = 2 ** 24 - 1;
  12096. class CMap {
  12097. constructor(builtInCMap = false) {
  12098. this.codespaceRanges = [[], [], [], []];
  12099. this.numCodespaceRanges = 0;
  12100. this._map = [];
  12101. this.name = "";
  12102. this.vertical = false;
  12103. this.useCMap = null;
  12104. this.builtInCMap = builtInCMap;
  12105. }
  12106. addCodespaceRange(n, low, high) {
  12107. this.codespaceRanges[n - 1].push(low, high);
  12108. this.numCodespaceRanges++;
  12109. }
  12110. mapCidRange(low, high, dstLow) {
  12111. if (high - low > MAX_MAP_RANGE) {
  12112. throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
  12113. }
  12114. while (low <= high) {
  12115. this._map[low++] = dstLow++;
  12116. }
  12117. }
  12118. mapBfRange(low, high, dstLow) {
  12119. if (high - low > MAX_MAP_RANGE) {
  12120. throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
  12121. }
  12122. const lastByte = dstLow.length - 1;
  12123. while (low <= high) {
  12124. this._map[low++] = dstLow;
  12125. const nextCharCode = dstLow.charCodeAt(lastByte) + 1;
  12126. if (nextCharCode > 0xff) {
  12127. dstLow = dstLow.substring(0, lastByte - 1) + String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 1) + "\x00";
  12128. continue;
  12129. }
  12130. dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(nextCharCode);
  12131. }
  12132. }
  12133. mapBfRangeToArray(low, high, array) {
  12134. if (high - low > MAX_MAP_RANGE) {
  12135. throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
  12136. }
  12137. const ii = array.length;
  12138. let i = 0;
  12139. while (low <= high && i < ii) {
  12140. this._map[low] = array[i++];
  12141. ++low;
  12142. }
  12143. }
  12144. mapOne(src, dst) {
  12145. this._map[src] = dst;
  12146. }
  12147. lookup(code) {
  12148. return this._map[code];
  12149. }
  12150. contains(code) {
  12151. return this._map[code] !== undefined;
  12152. }
  12153. forEach(callback) {
  12154. const map = this._map;
  12155. const length = map.length;
  12156. if (length <= 0x10000) {
  12157. for (let i = 0; i < length; i++) {
  12158. if (map[i] !== undefined) {
  12159. callback(i, map[i]);
  12160. }
  12161. }
  12162. } else {
  12163. for (const i in map) {
  12164. callback(i, map[i]);
  12165. }
  12166. }
  12167. }
  12168. charCodeOf(value) {
  12169. const map = this._map;
  12170. if (map.length <= 0x10000) {
  12171. return map.indexOf(value);
  12172. }
  12173. for (const charCode in map) {
  12174. if (map[charCode] === value) {
  12175. return charCode | 0;
  12176. }
  12177. }
  12178. return -1;
  12179. }
  12180. getMap() {
  12181. return this._map;
  12182. }
  12183. readCharCode(str, offset, out) {
  12184. let c = 0;
  12185. const codespaceRanges = this.codespaceRanges;
  12186. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  12187. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  12188. const codespaceRange = codespaceRanges[n];
  12189. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  12190. const low = codespaceRange[k++];
  12191. const high = codespaceRange[k++];
  12192. if (c >= low && c <= high) {
  12193. out.charcode = c;
  12194. out.length = n + 1;
  12195. return;
  12196. }
  12197. }
  12198. }
  12199. out.charcode = 0;
  12200. out.length = 1;
  12201. }
  12202. getCharCodeLength(charCode) {
  12203. const codespaceRanges = this.codespaceRanges;
  12204. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  12205. const codespaceRange = codespaceRanges[n];
  12206. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  12207. const low = codespaceRange[k++];
  12208. const high = codespaceRange[k++];
  12209. if (charCode >= low && charCode <= high) {
  12210. return n + 1;
  12211. }
  12212. }
  12213. }
  12214. return 1;
  12215. }
  12216. get length() {
  12217. return this._map.length;
  12218. }
  12219. get isIdentityCMap() {
  12220. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  12221. return false;
  12222. }
  12223. if (this._map.length !== 0x10000) {
  12224. return false;
  12225. }
  12226. for (let i = 0; i < 0x10000; i++) {
  12227. if (this._map[i] !== i) {
  12228. return false;
  12229. }
  12230. }
  12231. return true;
  12232. }
  12233. }
  12234. exports.CMap = CMap;
  12235. class IdentityCMap extends CMap {
  12236. constructor(vertical, n) {
  12237. super();
  12238. this.vertical = vertical;
  12239. this.addCodespaceRange(n, 0, 0xffff);
  12240. }
  12241. mapCidRange(low, high, dstLow) {
  12242. (0, _util.unreachable)("should not call mapCidRange");
  12243. }
  12244. mapBfRange(low, high, dstLow) {
  12245. (0, _util.unreachable)("should not call mapBfRange");
  12246. }
  12247. mapBfRangeToArray(low, high, array) {
  12248. (0, _util.unreachable)("should not call mapBfRangeToArray");
  12249. }
  12250. mapOne(src, dst) {
  12251. (0, _util.unreachable)("should not call mapCidOne");
  12252. }
  12253. lookup(code) {
  12254. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  12255. }
  12256. contains(code) {
  12257. return Number.isInteger(code) && code <= 0xffff;
  12258. }
  12259. forEach(callback) {
  12260. for (let i = 0; i <= 0xffff; i++) {
  12261. callback(i, i);
  12262. }
  12263. }
  12264. charCodeOf(value) {
  12265. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  12266. }
  12267. getMap() {
  12268. const map = new Array(0x10000);
  12269. for (let i = 0; i <= 0xffff; i++) {
  12270. map[i] = i;
  12271. }
  12272. return map;
  12273. }
  12274. get length() {
  12275. return 0x10000;
  12276. }
  12277. get isIdentityCMap() {
  12278. (0, _util.unreachable)("should not access .isIdentityCMap");
  12279. }
  12280. }
  12281. exports.IdentityCMap = IdentityCMap;
  12282. const BinaryCMapReader = function BinaryCMapReaderClosure() {
  12283. function hexToInt(a, size) {
  12284. let n = 0;
  12285. for (let i = 0; i <= size; i++) {
  12286. n = n << 8 | a[i];
  12287. }
  12288. return n >>> 0;
  12289. }
  12290. function hexToStr(a, size) {
  12291. if (size === 1) {
  12292. return String.fromCharCode(a[0], a[1]);
  12293. }
  12294. if (size === 3) {
  12295. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  12296. }
  12297. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  12298. }
  12299. function addHex(a, b, size) {
  12300. let c = 0;
  12301. for (let i = size; i >= 0; i--) {
  12302. c += a[i] + b[i];
  12303. a[i] = c & 255;
  12304. c >>= 8;
  12305. }
  12306. }
  12307. function incHex(a, size) {
  12308. let c = 1;
  12309. for (let i = size; i >= 0 && c > 0; i--) {
  12310. c += a[i];
  12311. a[i] = c & 255;
  12312. c >>= 8;
  12313. }
  12314. }
  12315. const MAX_NUM_SIZE = 16;
  12316. const MAX_ENCODED_NUM_SIZE = 19;
  12317. class BinaryCMapStream {
  12318. constructor(data) {
  12319. this.buffer = data;
  12320. this.pos = 0;
  12321. this.end = data.length;
  12322. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  12323. }
  12324. readByte() {
  12325. if (this.pos >= this.end) {
  12326. return -1;
  12327. }
  12328. return this.buffer[this.pos++];
  12329. }
  12330. readNumber() {
  12331. let n = 0;
  12332. let last;
  12333. do {
  12334. const b = this.readByte();
  12335. if (b < 0) {
  12336. throw new _util.FormatError("unexpected EOF in bcmap");
  12337. }
  12338. last = !(b & 0x80);
  12339. n = n << 7 | b & 0x7f;
  12340. } while (!last);
  12341. return n;
  12342. }
  12343. readSigned() {
  12344. const n = this.readNumber();
  12345. return n & 1 ? ~(n >>> 1) : n >>> 1;
  12346. }
  12347. readHex(num, size) {
  12348. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  12349. this.pos += size + 1;
  12350. }
  12351. readHexNumber(num, size) {
  12352. let last;
  12353. const stack = this.tmpBuf;
  12354. let sp = 0;
  12355. do {
  12356. const b = this.readByte();
  12357. if (b < 0) {
  12358. throw new _util.FormatError("unexpected EOF in bcmap");
  12359. }
  12360. last = !(b & 0x80);
  12361. stack[sp++] = b & 0x7f;
  12362. } while (!last);
  12363. let i = size,
  12364. buffer = 0,
  12365. bufferSize = 0;
  12366. while (i >= 0) {
  12367. while (bufferSize < 8 && stack.length > 0) {
  12368. buffer |= stack[--sp] << bufferSize;
  12369. bufferSize += 7;
  12370. }
  12371. num[i] = buffer & 255;
  12372. i--;
  12373. buffer >>= 8;
  12374. bufferSize -= 8;
  12375. }
  12376. }
  12377. readHexSigned(num, size) {
  12378. this.readHexNumber(num, size);
  12379. const sign = num[size] & 1 ? 255 : 0;
  12380. let c = 0;
  12381. for (let i = 0; i <= size; i++) {
  12382. c = (c & 1) << 8 | num[i];
  12383. num[i] = c >> 1 ^ sign;
  12384. }
  12385. }
  12386. readString() {
  12387. const len = this.readNumber();
  12388. let s = "";
  12389. for (let i = 0; i < len; i++) {
  12390. s += String.fromCharCode(this.readNumber());
  12391. }
  12392. return s;
  12393. }
  12394. }
  12395. class BinaryCMapReader {
  12396. async process(data, cMap, extend) {
  12397. const stream = new BinaryCMapStream(data);
  12398. const header = stream.readByte();
  12399. cMap.vertical = !!(header & 1);
  12400. let useCMap = null;
  12401. const start = new Uint8Array(MAX_NUM_SIZE);
  12402. const end = new Uint8Array(MAX_NUM_SIZE);
  12403. const char = new Uint8Array(MAX_NUM_SIZE);
  12404. const charCode = new Uint8Array(MAX_NUM_SIZE);
  12405. const tmp = new Uint8Array(MAX_NUM_SIZE);
  12406. let code;
  12407. let b;
  12408. while ((b = stream.readByte()) >= 0) {
  12409. const type = b >> 5;
  12410. if (type === 7) {
  12411. switch (b & 0x1f) {
  12412. case 0:
  12413. stream.readString();
  12414. break;
  12415. case 1:
  12416. useCMap = stream.readString();
  12417. break;
  12418. }
  12419. continue;
  12420. }
  12421. const sequence = !!(b & 0x10);
  12422. const dataSize = b & 15;
  12423. if (dataSize + 1 > MAX_NUM_SIZE) {
  12424. throw new Error("BinaryCMapReader.process: Invalid dataSize.");
  12425. }
  12426. const ucs2DataSize = 1;
  12427. const subitemsCount = stream.readNumber();
  12428. switch (type) {
  12429. case 0:
  12430. stream.readHex(start, dataSize);
  12431. stream.readHexNumber(end, dataSize);
  12432. addHex(end, start, dataSize);
  12433. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  12434. for (let i = 1; i < subitemsCount; i++) {
  12435. incHex(end, dataSize);
  12436. stream.readHexNumber(start, dataSize);
  12437. addHex(start, end, dataSize);
  12438. stream.readHexNumber(end, dataSize);
  12439. addHex(end, start, dataSize);
  12440. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  12441. }
  12442. break;
  12443. case 1:
  12444. stream.readHex(start, dataSize);
  12445. stream.readHexNumber(end, dataSize);
  12446. addHex(end, start, dataSize);
  12447. stream.readNumber();
  12448. for (let i = 1; i < subitemsCount; i++) {
  12449. incHex(end, dataSize);
  12450. stream.readHexNumber(start, dataSize);
  12451. addHex(start, end, dataSize);
  12452. stream.readHexNumber(end, dataSize);
  12453. addHex(end, start, dataSize);
  12454. stream.readNumber();
  12455. }
  12456. break;
  12457. case 2:
  12458. stream.readHex(char, dataSize);
  12459. code = stream.readNumber();
  12460. cMap.mapOne(hexToInt(char, dataSize), code);
  12461. for (let i = 1; i < subitemsCount; i++) {
  12462. incHex(char, dataSize);
  12463. if (!sequence) {
  12464. stream.readHexNumber(tmp, dataSize);
  12465. addHex(char, tmp, dataSize);
  12466. }
  12467. code = stream.readSigned() + (code + 1);
  12468. cMap.mapOne(hexToInt(char, dataSize), code);
  12469. }
  12470. break;
  12471. case 3:
  12472. stream.readHex(start, dataSize);
  12473. stream.readHexNumber(end, dataSize);
  12474. addHex(end, start, dataSize);
  12475. code = stream.readNumber();
  12476. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  12477. for (let i = 1; i < subitemsCount; i++) {
  12478. incHex(end, dataSize);
  12479. if (!sequence) {
  12480. stream.readHexNumber(start, dataSize);
  12481. addHex(start, end, dataSize);
  12482. } else {
  12483. start.set(end);
  12484. }
  12485. stream.readHexNumber(end, dataSize);
  12486. addHex(end, start, dataSize);
  12487. code = stream.readNumber();
  12488. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  12489. }
  12490. break;
  12491. case 4:
  12492. stream.readHex(char, ucs2DataSize);
  12493. stream.readHex(charCode, dataSize);
  12494. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  12495. for (let i = 1; i < subitemsCount; i++) {
  12496. incHex(char, ucs2DataSize);
  12497. if (!sequence) {
  12498. stream.readHexNumber(tmp, ucs2DataSize);
  12499. addHex(char, tmp, ucs2DataSize);
  12500. }
  12501. incHex(charCode, dataSize);
  12502. stream.readHexSigned(tmp, dataSize);
  12503. addHex(charCode, tmp, dataSize);
  12504. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  12505. }
  12506. break;
  12507. case 5:
  12508. stream.readHex(start, ucs2DataSize);
  12509. stream.readHexNumber(end, ucs2DataSize);
  12510. addHex(end, start, ucs2DataSize);
  12511. stream.readHex(charCode, dataSize);
  12512. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  12513. for (let i = 1; i < subitemsCount; i++) {
  12514. incHex(end, ucs2DataSize);
  12515. if (!sequence) {
  12516. stream.readHexNumber(start, ucs2DataSize);
  12517. addHex(start, end, ucs2DataSize);
  12518. } else {
  12519. start.set(end);
  12520. }
  12521. stream.readHexNumber(end, ucs2DataSize);
  12522. addHex(end, start, ucs2DataSize);
  12523. stream.readHex(charCode, dataSize);
  12524. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  12525. }
  12526. break;
  12527. default:
  12528. throw new Error(`BinaryCMapReader.process - unknown type: ${type}`);
  12529. }
  12530. }
  12531. if (useCMap) {
  12532. return extend(useCMap);
  12533. }
  12534. return cMap;
  12535. }
  12536. }
  12537. return BinaryCMapReader;
  12538. }();
  12539. const CMapFactory = function CMapFactoryClosure() {
  12540. function strToInt(str) {
  12541. let a = 0;
  12542. for (let i = 0; i < str.length; i++) {
  12543. a = a << 8 | str.charCodeAt(i);
  12544. }
  12545. return a >>> 0;
  12546. }
  12547. function expectString(obj) {
  12548. if (typeof obj !== "string") {
  12549. throw new _util.FormatError("Malformed CMap: expected string.");
  12550. }
  12551. }
  12552. function expectInt(obj) {
  12553. if (!Number.isInteger(obj)) {
  12554. throw new _util.FormatError("Malformed CMap: expected int.");
  12555. }
  12556. }
  12557. function parseBfChar(cMap, lexer) {
  12558. while (true) {
  12559. let obj = lexer.getObj();
  12560. if (obj === _primitives.EOF) {
  12561. break;
  12562. }
  12563. if ((0, _primitives.isCmd)(obj, "endbfchar")) {
  12564. return;
  12565. }
  12566. expectString(obj);
  12567. const src = strToInt(obj);
  12568. obj = lexer.getObj();
  12569. expectString(obj);
  12570. const dst = obj;
  12571. cMap.mapOne(src, dst);
  12572. }
  12573. }
  12574. function parseBfRange(cMap, lexer) {
  12575. while (true) {
  12576. let obj = lexer.getObj();
  12577. if (obj === _primitives.EOF) {
  12578. break;
  12579. }
  12580. if ((0, _primitives.isCmd)(obj, "endbfrange")) {
  12581. return;
  12582. }
  12583. expectString(obj);
  12584. const low = strToInt(obj);
  12585. obj = lexer.getObj();
  12586. expectString(obj);
  12587. const high = strToInt(obj);
  12588. obj = lexer.getObj();
  12589. if (Number.isInteger(obj) || typeof obj === "string") {
  12590. const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
  12591. cMap.mapBfRange(low, high, dstLow);
  12592. } else if ((0, _primitives.isCmd)(obj, "[")) {
  12593. obj = lexer.getObj();
  12594. const array = [];
  12595. while (!(0, _primitives.isCmd)(obj, "]") && obj !== _primitives.EOF) {
  12596. array.push(obj);
  12597. obj = lexer.getObj();
  12598. }
  12599. cMap.mapBfRangeToArray(low, high, array);
  12600. } else {
  12601. break;
  12602. }
  12603. }
  12604. throw new _util.FormatError("Invalid bf range.");
  12605. }
  12606. function parseCidChar(cMap, lexer) {
  12607. while (true) {
  12608. let obj = lexer.getObj();
  12609. if (obj === _primitives.EOF) {
  12610. break;
  12611. }
  12612. if ((0, _primitives.isCmd)(obj, "endcidchar")) {
  12613. return;
  12614. }
  12615. expectString(obj);
  12616. const src = strToInt(obj);
  12617. obj = lexer.getObj();
  12618. expectInt(obj);
  12619. const dst = obj;
  12620. cMap.mapOne(src, dst);
  12621. }
  12622. }
  12623. function parseCidRange(cMap, lexer) {
  12624. while (true) {
  12625. let obj = lexer.getObj();
  12626. if (obj === _primitives.EOF) {
  12627. break;
  12628. }
  12629. if ((0, _primitives.isCmd)(obj, "endcidrange")) {
  12630. return;
  12631. }
  12632. expectString(obj);
  12633. const low = strToInt(obj);
  12634. obj = lexer.getObj();
  12635. expectString(obj);
  12636. const high = strToInt(obj);
  12637. obj = lexer.getObj();
  12638. expectInt(obj);
  12639. const dstLow = obj;
  12640. cMap.mapCidRange(low, high, dstLow);
  12641. }
  12642. }
  12643. function parseCodespaceRange(cMap, lexer) {
  12644. while (true) {
  12645. let obj = lexer.getObj();
  12646. if (obj === _primitives.EOF) {
  12647. break;
  12648. }
  12649. if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
  12650. return;
  12651. }
  12652. if (typeof obj !== "string") {
  12653. break;
  12654. }
  12655. const low = strToInt(obj);
  12656. obj = lexer.getObj();
  12657. if (typeof obj !== "string") {
  12658. break;
  12659. }
  12660. const high = strToInt(obj);
  12661. cMap.addCodespaceRange(obj.length, low, high);
  12662. }
  12663. throw new _util.FormatError("Invalid codespace range.");
  12664. }
  12665. function parseWMode(cMap, lexer) {
  12666. const obj = lexer.getObj();
  12667. if (Number.isInteger(obj)) {
  12668. cMap.vertical = !!obj;
  12669. }
  12670. }
  12671. function parseCMapName(cMap, lexer) {
  12672. const obj = lexer.getObj();
  12673. if (obj instanceof _primitives.Name) {
  12674. cMap.name = obj.name;
  12675. }
  12676. }
  12677. async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  12678. let previous, embeddedUseCMap;
  12679. objLoop: while (true) {
  12680. try {
  12681. const obj = lexer.getObj();
  12682. if (obj === _primitives.EOF) {
  12683. break;
  12684. } else if (obj instanceof _primitives.Name) {
  12685. if (obj.name === "WMode") {
  12686. parseWMode(cMap, lexer);
  12687. } else if (obj.name === "CMapName") {
  12688. parseCMapName(cMap, lexer);
  12689. }
  12690. previous = obj;
  12691. } else if (obj instanceof _primitives.Cmd) {
  12692. switch (obj.cmd) {
  12693. case "endcmap":
  12694. break objLoop;
  12695. case "usecmap":
  12696. if (previous instanceof _primitives.Name) {
  12697. embeddedUseCMap = previous.name;
  12698. }
  12699. break;
  12700. case "begincodespacerange":
  12701. parseCodespaceRange(cMap, lexer);
  12702. break;
  12703. case "beginbfchar":
  12704. parseBfChar(cMap, lexer);
  12705. break;
  12706. case "begincidchar":
  12707. parseCidChar(cMap, lexer);
  12708. break;
  12709. case "beginbfrange":
  12710. parseBfRange(cMap, lexer);
  12711. break;
  12712. case "begincidrange":
  12713. parseCidRange(cMap, lexer);
  12714. break;
  12715. }
  12716. }
  12717. } catch (ex) {
  12718. if (ex instanceof _core_utils.MissingDataException) {
  12719. throw ex;
  12720. }
  12721. (0, _util.warn)("Invalid cMap data: " + ex);
  12722. continue;
  12723. }
  12724. }
  12725. if (!useCMap && embeddedUseCMap) {
  12726. useCMap = embeddedUseCMap;
  12727. }
  12728. if (useCMap) {
  12729. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  12730. }
  12731. return cMap;
  12732. }
  12733. async function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  12734. cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap);
  12735. if (cMap.numCodespaceRanges === 0) {
  12736. const useCodespaceRanges = cMap.useCMap.codespaceRanges;
  12737. for (let i = 0; i < useCodespaceRanges.length; i++) {
  12738. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  12739. }
  12740. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  12741. }
  12742. cMap.useCMap.forEach(function (key, value) {
  12743. if (!cMap.contains(key)) {
  12744. cMap.mapOne(key, cMap.useCMap.lookup(key));
  12745. }
  12746. });
  12747. return cMap;
  12748. }
  12749. async function createBuiltInCMap(name, fetchBuiltInCMap) {
  12750. if (name === "Identity-H") {
  12751. return new IdentityCMap(false, 2);
  12752. } else if (name === "Identity-V") {
  12753. return new IdentityCMap(true, 2);
  12754. }
  12755. if (!BUILT_IN_CMAPS.includes(name)) {
  12756. throw new Error("Unknown CMap name: " + name);
  12757. }
  12758. if (!fetchBuiltInCMap) {
  12759. throw new Error("Built-in CMap parameters are not provided.");
  12760. }
  12761. const {
  12762. cMapData,
  12763. compressionType
  12764. } = await fetchBuiltInCMap(name);
  12765. const cMap = new CMap(true);
  12766. if (compressionType === _util.CMapCompressionType.BINARY) {
  12767. return new BinaryCMapReader().process(cMapData, cMap, useCMap => {
  12768. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  12769. });
  12770. }
  12771. if (compressionType === _util.CMapCompressionType.NONE) {
  12772. const lexer = new _parser.Lexer(new _stream.Stream(cMapData));
  12773. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  12774. }
  12775. throw new Error(`Invalid CMap "compressionType" value: ${compressionType}`);
  12776. }
  12777. return {
  12778. async create(params) {
  12779. const encoding = params.encoding;
  12780. const fetchBuiltInCMap = params.fetchBuiltInCMap;
  12781. const useCMap = params.useCMap;
  12782. if (encoding instanceof _primitives.Name) {
  12783. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  12784. } else if (encoding instanceof _base_stream.BaseStream) {
  12785. const parsedCMap = await parseCMap(new CMap(), new _parser.Lexer(encoding), fetchBuiltInCMap, useCMap);
  12786. if (parsedCMap.isIdentityCMap) {
  12787. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  12788. }
  12789. return parsedCMap;
  12790. }
  12791. throw new Error("Encoding required.");
  12792. }
  12793. };
  12794. }();
  12795. exports.CMapFactory = CMapFactory;
  12796. /***/ }),
  12797. /* 15 */
  12798. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  12799. Object.defineProperty(exports, "__esModule", ({
  12800. value: true
  12801. }));
  12802. exports.Parser = exports.Linearization = exports.Lexer = void 0;
  12803. var _util = __w_pdfjs_require__(2);
  12804. var _primitives = __w_pdfjs_require__(3);
  12805. var _core_utils = __w_pdfjs_require__(4);
  12806. var _ascii_85_stream = __w_pdfjs_require__(16);
  12807. var _ascii_hex_stream = __w_pdfjs_require__(18);
  12808. var _ccitt_stream = __w_pdfjs_require__(19);
  12809. var _flate_stream = __w_pdfjs_require__(21);
  12810. var _jbig2_stream = __w_pdfjs_require__(22);
  12811. var _jpeg_stream = __w_pdfjs_require__(25);
  12812. var _jpx_stream = __w_pdfjs_require__(27);
  12813. var _lzw_stream = __w_pdfjs_require__(29);
  12814. var _stream = __w_pdfjs_require__(8);
  12815. var _predictor_stream = __w_pdfjs_require__(30);
  12816. var _run_length_stream = __w_pdfjs_require__(31);
  12817. const MAX_LENGTH_TO_CACHE = 1000;
  12818. function getInlineImageCacheKey(bytes) {
  12819. const strBuf = [],
  12820. ii = bytes.length;
  12821. let i = 0;
  12822. while (i < ii - 1) {
  12823. strBuf.push(bytes[i++] << 8 | bytes[i++]);
  12824. }
  12825. if (i < ii) {
  12826. strBuf.push(bytes[i]);
  12827. }
  12828. return ii + "_" + String.fromCharCode.apply(null, strBuf);
  12829. }
  12830. class Parser {
  12831. constructor({
  12832. lexer,
  12833. xref,
  12834. allowStreams = false,
  12835. recoveryMode = false
  12836. }) {
  12837. this.lexer = lexer;
  12838. this.xref = xref;
  12839. this.allowStreams = allowStreams;
  12840. this.recoveryMode = recoveryMode;
  12841. this.imageCache = Object.create(null);
  12842. this._imageId = 0;
  12843. this.refill();
  12844. }
  12845. refill() {
  12846. this.buf1 = this.lexer.getObj();
  12847. this.buf2 = this.lexer.getObj();
  12848. }
  12849. shift() {
  12850. if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
  12851. this.buf1 = this.buf2;
  12852. this.buf2 = null;
  12853. } else {
  12854. this.buf1 = this.buf2;
  12855. this.buf2 = this.lexer.getObj();
  12856. }
  12857. }
  12858. tryShift() {
  12859. try {
  12860. this.shift();
  12861. return true;
  12862. } catch (e) {
  12863. if (e instanceof _core_utils.MissingDataException) {
  12864. throw e;
  12865. }
  12866. return false;
  12867. }
  12868. }
  12869. getObj(cipherTransform = null) {
  12870. const buf1 = this.buf1;
  12871. this.shift();
  12872. if (buf1 instanceof _primitives.Cmd) {
  12873. switch (buf1.cmd) {
  12874. case "BI":
  12875. return this.makeInlineImage(cipherTransform);
  12876. case "[":
  12877. const array = [];
  12878. while (!(0, _primitives.isCmd)(this.buf1, "]") && this.buf1 !== _primitives.EOF) {
  12879. array.push(this.getObj(cipherTransform));
  12880. }
  12881. if (this.buf1 === _primitives.EOF) {
  12882. if (this.recoveryMode) {
  12883. return array;
  12884. }
  12885. throw new _core_utils.ParserEOFException("End of file inside array.");
  12886. }
  12887. this.shift();
  12888. return array;
  12889. case "<<":
  12890. const dict = new _primitives.Dict(this.xref);
  12891. while (!(0, _primitives.isCmd)(this.buf1, ">>") && this.buf1 !== _primitives.EOF) {
  12892. if (!(this.buf1 instanceof _primitives.Name)) {
  12893. (0, _util.info)("Malformed dictionary: key must be a name object");
  12894. this.shift();
  12895. continue;
  12896. }
  12897. const key = this.buf1.name;
  12898. this.shift();
  12899. if (this.buf1 === _primitives.EOF) {
  12900. break;
  12901. }
  12902. dict.set(key, this.getObj(cipherTransform));
  12903. }
  12904. if (this.buf1 === _primitives.EOF) {
  12905. if (this.recoveryMode) {
  12906. return dict;
  12907. }
  12908. throw new _core_utils.ParserEOFException("End of file inside dictionary.");
  12909. }
  12910. if ((0, _primitives.isCmd)(this.buf2, "stream")) {
  12911. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  12912. }
  12913. this.shift();
  12914. return dict;
  12915. default:
  12916. return buf1;
  12917. }
  12918. }
  12919. if (Number.isInteger(buf1)) {
  12920. if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
  12921. const ref = _primitives.Ref.get(buf1, this.buf1);
  12922. this.shift();
  12923. this.shift();
  12924. return ref;
  12925. }
  12926. return buf1;
  12927. }
  12928. if (typeof buf1 === "string") {
  12929. if (cipherTransform) {
  12930. return cipherTransform.decryptString(buf1);
  12931. }
  12932. return buf1;
  12933. }
  12934. return buf1;
  12935. }
  12936. findDefaultInlineStreamEnd(stream) {
  12937. const E = 0x45,
  12938. I = 0x49,
  12939. SPACE = 0x20,
  12940. LF = 0xa,
  12941. CR = 0xd,
  12942. NUL = 0x0;
  12943. const lexer = this.lexer,
  12944. startPos = stream.pos,
  12945. n = 10;
  12946. let state = 0,
  12947. ch,
  12948. maybeEIPos;
  12949. while ((ch = stream.getByte()) !== -1) {
  12950. if (state === 0) {
  12951. state = ch === E ? 1 : 0;
  12952. } else if (state === 1) {
  12953. state = ch === I ? 2 : 0;
  12954. } else {
  12955. if (ch === SPACE || ch === LF || ch === CR) {
  12956. maybeEIPos = stream.pos;
  12957. const followingBytes = stream.peekBytes(n);
  12958. for (let i = 0, ii = followingBytes.length; i < ii; i++) {
  12959. ch = followingBytes[i];
  12960. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  12961. continue;
  12962. }
  12963. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  12964. state = 0;
  12965. break;
  12966. }
  12967. }
  12968. if (state !== 2) {
  12969. continue;
  12970. }
  12971. if (lexer.knownCommands) {
  12972. const nextObj = lexer.peekObj();
  12973. if (nextObj instanceof _primitives.Cmd && !lexer.knownCommands[nextObj.cmd]) {
  12974. state = 0;
  12975. }
  12976. } else {
  12977. (0, _util.warn)("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");
  12978. }
  12979. if (state === 2) {
  12980. break;
  12981. }
  12982. } else {
  12983. state = 0;
  12984. }
  12985. }
  12986. }
  12987. if (ch === -1) {
  12988. (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
  12989. if (maybeEIPos) {
  12990. (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
  12991. stream.skip(-(stream.pos - maybeEIPos));
  12992. }
  12993. }
  12994. let endOffset = 4;
  12995. stream.skip(-endOffset);
  12996. ch = stream.peekByte();
  12997. stream.skip(endOffset);
  12998. if (!(0, _core_utils.isWhiteSpace)(ch)) {
  12999. endOffset--;
  13000. }
  13001. return stream.pos - endOffset - startPos;
  13002. }
  13003. findDCTDecodeInlineStreamEnd(stream) {
  13004. const startPos = stream.pos;
  13005. let foundEOI = false,
  13006. b,
  13007. markerLength;
  13008. while ((b = stream.getByte()) !== -1) {
  13009. if (b !== 0xff) {
  13010. continue;
  13011. }
  13012. switch (stream.getByte()) {
  13013. case 0x00:
  13014. break;
  13015. case 0xff:
  13016. stream.skip(-1);
  13017. break;
  13018. case 0xd9:
  13019. foundEOI = true;
  13020. break;
  13021. case 0xc0:
  13022. case 0xc1:
  13023. case 0xc2:
  13024. case 0xc3:
  13025. case 0xc5:
  13026. case 0xc6:
  13027. case 0xc7:
  13028. case 0xc9:
  13029. case 0xca:
  13030. case 0xcb:
  13031. case 0xcd:
  13032. case 0xce:
  13033. case 0xcf:
  13034. case 0xc4:
  13035. case 0xcc:
  13036. case 0xda:
  13037. case 0xdb:
  13038. case 0xdc:
  13039. case 0xdd:
  13040. case 0xde:
  13041. case 0xdf:
  13042. case 0xe0:
  13043. case 0xe1:
  13044. case 0xe2:
  13045. case 0xe3:
  13046. case 0xe4:
  13047. case 0xe5:
  13048. case 0xe6:
  13049. case 0xe7:
  13050. case 0xe8:
  13051. case 0xe9:
  13052. case 0xea:
  13053. case 0xeb:
  13054. case 0xec:
  13055. case 0xed:
  13056. case 0xee:
  13057. case 0xef:
  13058. case 0xfe:
  13059. markerLength = stream.getUint16();
  13060. if (markerLength > 2) {
  13061. stream.skip(markerLength - 2);
  13062. } else {
  13063. stream.skip(-2);
  13064. }
  13065. break;
  13066. }
  13067. if (foundEOI) {
  13068. break;
  13069. }
  13070. }
  13071. const length = stream.pos - startPos;
  13072. if (b === -1) {
  13073. (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
  13074. stream.skip(-length);
  13075. return this.findDefaultInlineStreamEnd(stream);
  13076. }
  13077. this.inlineStreamSkipEI(stream);
  13078. return length;
  13079. }
  13080. findASCII85DecodeInlineStreamEnd(stream) {
  13081. const TILDE = 0x7e,
  13082. GT = 0x3e;
  13083. const startPos = stream.pos;
  13084. let ch;
  13085. while ((ch = stream.getByte()) !== -1) {
  13086. if (ch === TILDE) {
  13087. const tildePos = stream.pos;
  13088. ch = stream.peekByte();
  13089. while ((0, _core_utils.isWhiteSpace)(ch)) {
  13090. stream.skip();
  13091. ch = stream.peekByte();
  13092. }
  13093. if (ch === GT) {
  13094. stream.skip();
  13095. break;
  13096. }
  13097. if (stream.pos > tildePos) {
  13098. const maybeEI = stream.peekBytes(2);
  13099. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  13100. break;
  13101. }
  13102. }
  13103. }
  13104. }
  13105. const length = stream.pos - startPos;
  13106. if (ch === -1) {
  13107. (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  13108. stream.skip(-length);
  13109. return this.findDefaultInlineStreamEnd(stream);
  13110. }
  13111. this.inlineStreamSkipEI(stream);
  13112. return length;
  13113. }
  13114. findASCIIHexDecodeInlineStreamEnd(stream) {
  13115. const GT = 0x3e;
  13116. const startPos = stream.pos;
  13117. let ch;
  13118. while ((ch = stream.getByte()) !== -1) {
  13119. if (ch === GT) {
  13120. break;
  13121. }
  13122. }
  13123. const length = stream.pos - startPos;
  13124. if (ch === -1) {
  13125. (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  13126. stream.skip(-length);
  13127. return this.findDefaultInlineStreamEnd(stream);
  13128. }
  13129. this.inlineStreamSkipEI(stream);
  13130. return length;
  13131. }
  13132. inlineStreamSkipEI(stream) {
  13133. const E = 0x45,
  13134. I = 0x49;
  13135. let state = 0,
  13136. ch;
  13137. while ((ch = stream.getByte()) !== -1) {
  13138. if (state === 0) {
  13139. state = ch === E ? 1 : 0;
  13140. } else if (state === 1) {
  13141. state = ch === I ? 2 : 0;
  13142. } else if (state === 2) {
  13143. break;
  13144. }
  13145. }
  13146. }
  13147. makeInlineImage(cipherTransform) {
  13148. const lexer = this.lexer;
  13149. const stream = lexer.stream;
  13150. const dictMap = Object.create(null);
  13151. let dictLength;
  13152. while (!(0, _primitives.isCmd)(this.buf1, "ID") && this.buf1 !== _primitives.EOF) {
  13153. if (!(this.buf1 instanceof _primitives.Name)) {
  13154. throw new _util.FormatError("Dictionary key must be a name object");
  13155. }
  13156. const key = this.buf1.name;
  13157. this.shift();
  13158. if (this.buf1 === _primitives.EOF) {
  13159. break;
  13160. }
  13161. dictMap[key] = this.getObj(cipherTransform);
  13162. }
  13163. if (lexer.beginInlineImagePos !== -1) {
  13164. dictLength = stream.pos - lexer.beginInlineImagePos;
  13165. }
  13166. const filter = this.xref.fetchIfRef(dictMap.F || dictMap.Filter);
  13167. let filterName;
  13168. if (filter instanceof _primitives.Name) {
  13169. filterName = filter.name;
  13170. } else if (Array.isArray(filter)) {
  13171. const filterZero = this.xref.fetchIfRef(filter[0]);
  13172. if (filterZero instanceof _primitives.Name) {
  13173. filterName = filterZero.name;
  13174. }
  13175. }
  13176. const startPos = stream.pos;
  13177. let length;
  13178. switch (filterName) {
  13179. case "DCT":
  13180. case "DCTDecode":
  13181. length = this.findDCTDecodeInlineStreamEnd(stream);
  13182. break;
  13183. case "A85":
  13184. case "ASCII85Decode":
  13185. length = this.findASCII85DecodeInlineStreamEnd(stream);
  13186. break;
  13187. case "AHx":
  13188. case "ASCIIHexDecode":
  13189. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  13190. break;
  13191. default:
  13192. length = this.findDefaultInlineStreamEnd(stream);
  13193. }
  13194. let cacheKey;
  13195. if (length < MAX_LENGTH_TO_CACHE && dictLength > 0) {
  13196. const initialStreamPos = stream.pos;
  13197. stream.pos = lexer.beginInlineImagePos;
  13198. cacheKey = getInlineImageCacheKey(stream.getBytes(dictLength + length));
  13199. stream.pos = initialStreamPos;
  13200. const cacheEntry = this.imageCache[cacheKey];
  13201. if (cacheEntry !== undefined) {
  13202. this.buf2 = _primitives.Cmd.get("EI");
  13203. this.shift();
  13204. cacheEntry.reset();
  13205. return cacheEntry;
  13206. }
  13207. }
  13208. const dict = new _primitives.Dict(this.xref);
  13209. for (const key in dictMap) {
  13210. dict.set(key, dictMap[key]);
  13211. }
  13212. let imageStream = stream.makeSubStream(startPos, length, dict);
  13213. if (cipherTransform) {
  13214. imageStream = cipherTransform.createStream(imageStream, length);
  13215. }
  13216. imageStream = this.filter(imageStream, dict, length);
  13217. imageStream.dict = dict;
  13218. if (cacheKey !== undefined) {
  13219. imageStream.cacheKey = `inline_img_${++this._imageId}`;
  13220. this.imageCache[cacheKey] = imageStream;
  13221. }
  13222. this.buf2 = _primitives.Cmd.get("EI");
  13223. this.shift();
  13224. return imageStream;
  13225. }
  13226. _findStreamLength(startPos, signature) {
  13227. const {
  13228. stream
  13229. } = this.lexer;
  13230. stream.pos = startPos;
  13231. const SCAN_BLOCK_LENGTH = 2048;
  13232. const signatureLength = signature.length;
  13233. while (stream.pos < stream.end) {
  13234. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  13235. const scanLength = scanBytes.length - signatureLength;
  13236. if (scanLength <= 0) {
  13237. break;
  13238. }
  13239. let pos = 0;
  13240. while (pos < scanLength) {
  13241. let j = 0;
  13242. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  13243. j++;
  13244. }
  13245. if (j >= signatureLength) {
  13246. stream.pos += pos;
  13247. return stream.pos - startPos;
  13248. }
  13249. pos++;
  13250. }
  13251. stream.pos += scanLength;
  13252. }
  13253. return -1;
  13254. }
  13255. makeStream(dict, cipherTransform) {
  13256. const lexer = this.lexer;
  13257. let stream = lexer.stream;
  13258. lexer.skipToNextLine();
  13259. const startPos = stream.pos - 1;
  13260. let length = dict.get("Length");
  13261. if (!Number.isInteger(length)) {
  13262. (0, _util.info)(`Bad length "${length && length.toString()}" in stream.`);
  13263. length = 0;
  13264. }
  13265. stream.pos = startPos + length;
  13266. lexer.nextChar();
  13267. if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
  13268. this.shift();
  13269. } else {
  13270. const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]);
  13271. let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
  13272. if (actualLength < 0) {
  13273. const MAX_TRUNCATION = 1;
  13274. for (let i = 1; i <= MAX_TRUNCATION; i++) {
  13275. const end = ENDSTREAM_SIGNATURE.length - i;
  13276. const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
  13277. const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
  13278. if (maybeLength >= 0) {
  13279. const lastByte = stream.peekBytes(end + 1)[end];
  13280. if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
  13281. break;
  13282. }
  13283. (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command.");
  13284. actualLength = maybeLength;
  13285. break;
  13286. }
  13287. }
  13288. if (actualLength < 0) {
  13289. throw new _util.FormatError("Missing endstream command.");
  13290. }
  13291. }
  13292. length = actualLength;
  13293. lexer.nextChar();
  13294. this.shift();
  13295. this.shift();
  13296. }
  13297. this.shift();
  13298. stream = stream.makeSubStream(startPos, length, dict);
  13299. if (cipherTransform) {
  13300. stream = cipherTransform.createStream(stream, length);
  13301. }
  13302. stream = this.filter(stream, dict, length);
  13303. stream.dict = dict;
  13304. return stream;
  13305. }
  13306. filter(stream, dict, length) {
  13307. let filter = dict.get("F", "Filter");
  13308. let params = dict.get("DP", "DecodeParms");
  13309. if (filter instanceof _primitives.Name) {
  13310. if (Array.isArray(params)) {
  13311. (0, _util.warn)("/DecodeParms should not be an Array, when /Filter is a Name.");
  13312. }
  13313. return this.makeFilter(stream, filter.name, length, params);
  13314. }
  13315. let maybeLength = length;
  13316. if (Array.isArray(filter)) {
  13317. const filterArray = filter;
  13318. const paramsArray = params;
  13319. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  13320. filter = this.xref.fetchIfRef(filterArray[i]);
  13321. if (!(filter instanceof _primitives.Name)) {
  13322. throw new _util.FormatError(`Bad filter name "${filter}"`);
  13323. }
  13324. params = null;
  13325. if (Array.isArray(paramsArray) && i in paramsArray) {
  13326. params = this.xref.fetchIfRef(paramsArray[i]);
  13327. }
  13328. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  13329. maybeLength = null;
  13330. }
  13331. }
  13332. return stream;
  13333. }
  13334. makeFilter(stream, name, maybeLength, params) {
  13335. if (maybeLength === 0) {
  13336. (0, _util.warn)(`Empty "${name}" stream.`);
  13337. return new _stream.NullStream();
  13338. }
  13339. const xrefStats = this.xref.stats;
  13340. try {
  13341. switch (name) {
  13342. case "Fl":
  13343. case "FlateDecode":
  13344. xrefStats.addStreamType(_util.StreamType.FLATE);
  13345. if (params) {
  13346. return new _predictor_stream.PredictorStream(new _flate_stream.FlateStream(stream, maybeLength), maybeLength, params);
  13347. }
  13348. return new _flate_stream.FlateStream(stream, maybeLength);
  13349. case "LZW":
  13350. case "LZWDecode":
  13351. xrefStats.addStreamType(_util.StreamType.LZW);
  13352. let earlyChange = 1;
  13353. if (params) {
  13354. if (params.has("EarlyChange")) {
  13355. earlyChange = params.get("EarlyChange");
  13356. }
  13357. return new _predictor_stream.PredictorStream(new _lzw_stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  13358. }
  13359. return new _lzw_stream.LZWStream(stream, maybeLength, earlyChange);
  13360. case "DCT":
  13361. case "DCTDecode":
  13362. xrefStats.addStreamType(_util.StreamType.DCT);
  13363. return new _jpeg_stream.JpegStream(stream, maybeLength, params);
  13364. case "JPX":
  13365. case "JPXDecode":
  13366. xrefStats.addStreamType(_util.StreamType.JPX);
  13367. return new _jpx_stream.JpxStream(stream, maybeLength, params);
  13368. case "A85":
  13369. case "ASCII85Decode":
  13370. xrefStats.addStreamType(_util.StreamType.A85);
  13371. return new _ascii_85_stream.Ascii85Stream(stream, maybeLength);
  13372. case "AHx":
  13373. case "ASCIIHexDecode":
  13374. xrefStats.addStreamType(_util.StreamType.AHX);
  13375. return new _ascii_hex_stream.AsciiHexStream(stream, maybeLength);
  13376. case "CCF":
  13377. case "CCITTFaxDecode":
  13378. xrefStats.addStreamType(_util.StreamType.CCF);
  13379. return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
  13380. case "RL":
  13381. case "RunLengthDecode":
  13382. xrefStats.addStreamType(_util.StreamType.RLX);
  13383. return new _run_length_stream.RunLengthStream(stream, maybeLength);
  13384. case "JBIG2Decode":
  13385. xrefStats.addStreamType(_util.StreamType.JBIG);
  13386. return new _jbig2_stream.Jbig2Stream(stream, maybeLength, params);
  13387. }
  13388. (0, _util.warn)(`Filter "${name}" is not supported.`);
  13389. return stream;
  13390. } catch (ex) {
  13391. if (ex instanceof _core_utils.MissingDataException) {
  13392. throw ex;
  13393. }
  13394. (0, _util.warn)(`Invalid stream: "${ex}"`);
  13395. return new _stream.NullStream();
  13396. }
  13397. }
  13398. }
  13399. exports.Parser = Parser;
  13400. const specialChars = [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
  13401. function toHexDigit(ch) {
  13402. if (ch >= 0x30 && ch <= 0x39) {
  13403. return ch & 0x0f;
  13404. }
  13405. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  13406. return (ch & 0x0f) + 9;
  13407. }
  13408. return -1;
  13409. }
  13410. class Lexer {
  13411. constructor(stream, knownCommands = null) {
  13412. this.stream = stream;
  13413. this.nextChar();
  13414. this.strBuf = [];
  13415. this.knownCommands = knownCommands;
  13416. this._hexStringNumWarn = 0;
  13417. this.beginInlineImagePos = -1;
  13418. }
  13419. nextChar() {
  13420. return this.currentChar = this.stream.getByte();
  13421. }
  13422. peekChar() {
  13423. return this.stream.peekByte();
  13424. }
  13425. getNumber() {
  13426. let ch = this.currentChar;
  13427. let eNotation = false;
  13428. let divideBy = 0;
  13429. let sign = 0;
  13430. if (ch === 0x2d) {
  13431. sign = -1;
  13432. ch = this.nextChar();
  13433. if (ch === 0x2d) {
  13434. ch = this.nextChar();
  13435. }
  13436. } else if (ch === 0x2b) {
  13437. sign = 1;
  13438. ch = this.nextChar();
  13439. }
  13440. if (ch === 0x0a || ch === 0x0d) {
  13441. do {
  13442. ch = this.nextChar();
  13443. } while (ch === 0x0a || ch === 0x0d);
  13444. }
  13445. if (ch === 0x2e) {
  13446. divideBy = 10;
  13447. ch = this.nextChar();
  13448. }
  13449. if (ch < 0x30 || ch > 0x39) {
  13450. const msg = `Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`;
  13451. if ((0, _core_utils.isWhiteSpace)(ch) || ch === -1) {
  13452. (0, _util.info)(`Lexer.getNumber - "${msg}".`);
  13453. return 0;
  13454. }
  13455. throw new _util.FormatError(msg);
  13456. }
  13457. sign = sign || 1;
  13458. let baseValue = ch - 0x30;
  13459. let powerValue = 0;
  13460. let powerValueSign = 1;
  13461. while ((ch = this.nextChar()) >= 0) {
  13462. if (ch >= 0x30 && ch <= 0x39) {
  13463. const currentDigit = ch - 0x30;
  13464. if (eNotation) {
  13465. powerValue = powerValue * 10 + currentDigit;
  13466. } else {
  13467. if (divideBy !== 0) {
  13468. divideBy *= 10;
  13469. }
  13470. baseValue = baseValue * 10 + currentDigit;
  13471. }
  13472. } else if (ch === 0x2e) {
  13473. if (divideBy === 0) {
  13474. divideBy = 1;
  13475. } else {
  13476. break;
  13477. }
  13478. } else if (ch === 0x2d) {
  13479. (0, _util.warn)("Badly formatted number: minus sign in the middle");
  13480. } else if (ch === 0x45 || ch === 0x65) {
  13481. ch = this.peekChar();
  13482. if (ch === 0x2b || ch === 0x2d) {
  13483. powerValueSign = ch === 0x2d ? -1 : 1;
  13484. this.nextChar();
  13485. } else if (ch < 0x30 || ch > 0x39) {
  13486. break;
  13487. }
  13488. eNotation = true;
  13489. } else {
  13490. break;
  13491. }
  13492. }
  13493. if (divideBy !== 0) {
  13494. baseValue /= divideBy;
  13495. }
  13496. if (eNotation) {
  13497. baseValue *= 10 ** (powerValueSign * powerValue);
  13498. }
  13499. return sign * baseValue;
  13500. }
  13501. getString() {
  13502. let numParen = 1;
  13503. let done = false;
  13504. const strBuf = this.strBuf;
  13505. strBuf.length = 0;
  13506. let ch = this.nextChar();
  13507. while (true) {
  13508. let charBuffered = false;
  13509. switch (ch | 0) {
  13510. case -1:
  13511. (0, _util.warn)("Unterminated string");
  13512. done = true;
  13513. break;
  13514. case 0x28:
  13515. ++numParen;
  13516. strBuf.push("(");
  13517. break;
  13518. case 0x29:
  13519. if (--numParen === 0) {
  13520. this.nextChar();
  13521. done = true;
  13522. } else {
  13523. strBuf.push(")");
  13524. }
  13525. break;
  13526. case 0x5c:
  13527. ch = this.nextChar();
  13528. switch (ch) {
  13529. case -1:
  13530. (0, _util.warn)("Unterminated string");
  13531. done = true;
  13532. break;
  13533. case 0x6e:
  13534. strBuf.push("\n");
  13535. break;
  13536. case 0x72:
  13537. strBuf.push("\r");
  13538. break;
  13539. case 0x74:
  13540. strBuf.push("\t");
  13541. break;
  13542. case 0x62:
  13543. strBuf.push("\b");
  13544. break;
  13545. case 0x66:
  13546. strBuf.push("\f");
  13547. break;
  13548. case 0x5c:
  13549. case 0x28:
  13550. case 0x29:
  13551. strBuf.push(String.fromCharCode(ch));
  13552. break;
  13553. case 0x30:
  13554. case 0x31:
  13555. case 0x32:
  13556. case 0x33:
  13557. case 0x34:
  13558. case 0x35:
  13559. case 0x36:
  13560. case 0x37:
  13561. let x = ch & 0x0f;
  13562. ch = this.nextChar();
  13563. charBuffered = true;
  13564. if (ch >= 0x30 && ch <= 0x37) {
  13565. x = (x << 3) + (ch & 0x0f);
  13566. ch = this.nextChar();
  13567. if (ch >= 0x30 && ch <= 0x37) {
  13568. charBuffered = false;
  13569. x = (x << 3) + (ch & 0x0f);
  13570. }
  13571. }
  13572. strBuf.push(String.fromCharCode(x));
  13573. break;
  13574. case 0x0d:
  13575. if (this.peekChar() === 0x0a) {
  13576. this.nextChar();
  13577. }
  13578. break;
  13579. case 0x0a:
  13580. break;
  13581. default:
  13582. strBuf.push(String.fromCharCode(ch));
  13583. break;
  13584. }
  13585. break;
  13586. default:
  13587. strBuf.push(String.fromCharCode(ch));
  13588. break;
  13589. }
  13590. if (done) {
  13591. break;
  13592. }
  13593. if (!charBuffered) {
  13594. ch = this.nextChar();
  13595. }
  13596. }
  13597. return strBuf.join("");
  13598. }
  13599. getName() {
  13600. let ch, previousCh;
  13601. const strBuf = this.strBuf;
  13602. strBuf.length = 0;
  13603. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  13604. if (ch === 0x23) {
  13605. ch = this.nextChar();
  13606. if (specialChars[ch]) {
  13607. (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
  13608. strBuf.push("#");
  13609. break;
  13610. }
  13611. const x = toHexDigit(ch);
  13612. if (x !== -1) {
  13613. previousCh = ch;
  13614. ch = this.nextChar();
  13615. const x2 = toHexDigit(ch);
  13616. if (x2 === -1) {
  13617. (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
  13618. strBuf.push("#", String.fromCharCode(previousCh));
  13619. if (specialChars[ch]) {
  13620. break;
  13621. }
  13622. strBuf.push(String.fromCharCode(ch));
  13623. continue;
  13624. }
  13625. strBuf.push(String.fromCharCode(x << 4 | x2));
  13626. } else {
  13627. strBuf.push("#", String.fromCharCode(ch));
  13628. }
  13629. } else {
  13630. strBuf.push(String.fromCharCode(ch));
  13631. }
  13632. }
  13633. if (strBuf.length > 127) {
  13634. (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
  13635. }
  13636. return _primitives.Name.get(strBuf.join(""));
  13637. }
  13638. _hexStringWarn(ch) {
  13639. const MAX_HEX_STRING_NUM_WARN = 5;
  13640. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  13641. (0, _util.warn)("getHexString - ignoring additional invalid characters.");
  13642. return;
  13643. }
  13644. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  13645. return;
  13646. }
  13647. (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
  13648. }
  13649. getHexString() {
  13650. const strBuf = this.strBuf;
  13651. strBuf.length = 0;
  13652. let ch = this.currentChar;
  13653. let isFirstHex = true;
  13654. let firstDigit, secondDigit;
  13655. this._hexStringNumWarn = 0;
  13656. while (true) {
  13657. if (ch < 0) {
  13658. (0, _util.warn)("Unterminated hex string");
  13659. break;
  13660. } else if (ch === 0x3e) {
  13661. this.nextChar();
  13662. break;
  13663. } else if (specialChars[ch] === 1) {
  13664. ch = this.nextChar();
  13665. continue;
  13666. } else {
  13667. if (isFirstHex) {
  13668. firstDigit = toHexDigit(ch);
  13669. if (firstDigit === -1) {
  13670. this._hexStringWarn(ch);
  13671. ch = this.nextChar();
  13672. continue;
  13673. }
  13674. } else {
  13675. secondDigit = toHexDigit(ch);
  13676. if (secondDigit === -1) {
  13677. this._hexStringWarn(ch);
  13678. ch = this.nextChar();
  13679. continue;
  13680. }
  13681. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  13682. }
  13683. isFirstHex = !isFirstHex;
  13684. ch = this.nextChar();
  13685. }
  13686. }
  13687. return strBuf.join("");
  13688. }
  13689. getObj() {
  13690. let comment = false;
  13691. let ch = this.currentChar;
  13692. while (true) {
  13693. if (ch < 0) {
  13694. return _primitives.EOF;
  13695. }
  13696. if (comment) {
  13697. if (ch === 0x0a || ch === 0x0d) {
  13698. comment = false;
  13699. }
  13700. } else if (ch === 0x25) {
  13701. comment = true;
  13702. } else if (specialChars[ch] !== 1) {
  13703. break;
  13704. }
  13705. ch = this.nextChar();
  13706. }
  13707. switch (ch | 0) {
  13708. case 0x30:
  13709. case 0x31:
  13710. case 0x32:
  13711. case 0x33:
  13712. case 0x34:
  13713. case 0x35:
  13714. case 0x36:
  13715. case 0x37:
  13716. case 0x38:
  13717. case 0x39:
  13718. case 0x2b:
  13719. case 0x2d:
  13720. case 0x2e:
  13721. return this.getNumber();
  13722. case 0x28:
  13723. return this.getString();
  13724. case 0x2f:
  13725. return this.getName();
  13726. case 0x5b:
  13727. this.nextChar();
  13728. return _primitives.Cmd.get("[");
  13729. case 0x5d:
  13730. this.nextChar();
  13731. return _primitives.Cmd.get("]");
  13732. case 0x3c:
  13733. ch = this.nextChar();
  13734. if (ch === 0x3c) {
  13735. this.nextChar();
  13736. return _primitives.Cmd.get("<<");
  13737. }
  13738. return this.getHexString();
  13739. case 0x3e:
  13740. ch = this.nextChar();
  13741. if (ch === 0x3e) {
  13742. this.nextChar();
  13743. return _primitives.Cmd.get(">>");
  13744. }
  13745. return _primitives.Cmd.get(">");
  13746. case 0x7b:
  13747. this.nextChar();
  13748. return _primitives.Cmd.get("{");
  13749. case 0x7d:
  13750. this.nextChar();
  13751. return _primitives.Cmd.get("}");
  13752. case 0x29:
  13753. this.nextChar();
  13754. throw new _util.FormatError(`Illegal character: ${ch}`);
  13755. }
  13756. let str = String.fromCharCode(ch);
  13757. if (ch < 0x20 || ch > 0x7f) {
  13758. const nextCh = this.peekChar();
  13759. if (nextCh >= 0x20 && nextCh <= 0x7f) {
  13760. this.nextChar();
  13761. return _primitives.Cmd.get(str);
  13762. }
  13763. }
  13764. const knownCommands = this.knownCommands;
  13765. let knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  13766. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  13767. const possibleCommand = str + String.fromCharCode(ch);
  13768. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  13769. break;
  13770. }
  13771. if (str.length === 128) {
  13772. throw new _util.FormatError(`Command token too long: ${str.length}`);
  13773. }
  13774. str = possibleCommand;
  13775. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  13776. }
  13777. if (str === "true") {
  13778. return true;
  13779. }
  13780. if (str === "false") {
  13781. return false;
  13782. }
  13783. if (str === "null") {
  13784. return null;
  13785. }
  13786. if (str === "BI") {
  13787. this.beginInlineImagePos = this.stream.pos;
  13788. }
  13789. return _primitives.Cmd.get(str);
  13790. }
  13791. peekObj() {
  13792. const streamPos = this.stream.pos,
  13793. currentChar = this.currentChar,
  13794. beginInlineImagePos = this.beginInlineImagePos;
  13795. let nextObj;
  13796. try {
  13797. nextObj = this.getObj();
  13798. } catch (ex) {
  13799. if (ex instanceof _core_utils.MissingDataException) {
  13800. throw ex;
  13801. }
  13802. (0, _util.warn)(`peekObj: ${ex}`);
  13803. }
  13804. this.stream.pos = streamPos;
  13805. this.currentChar = currentChar;
  13806. this.beginInlineImagePos = beginInlineImagePos;
  13807. return nextObj;
  13808. }
  13809. skipToNextLine() {
  13810. let ch = this.currentChar;
  13811. while (ch >= 0) {
  13812. if (ch === 0x0d) {
  13813. ch = this.nextChar();
  13814. if (ch === 0x0a) {
  13815. this.nextChar();
  13816. }
  13817. break;
  13818. } else if (ch === 0x0a) {
  13819. this.nextChar();
  13820. break;
  13821. }
  13822. ch = this.nextChar();
  13823. }
  13824. }
  13825. }
  13826. exports.Lexer = Lexer;
  13827. class Linearization {
  13828. static create(stream) {
  13829. function getInt(linDict, name, allowZeroValue = false) {
  13830. const obj = linDict.get(name);
  13831. if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  13832. return obj;
  13833. }
  13834. throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
  13835. }
  13836. function getHints(linDict) {
  13837. const hints = linDict.get("H");
  13838. let hintsLength;
  13839. if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  13840. for (let index = 0; index < hintsLength; index++) {
  13841. const hint = hints[index];
  13842. if (!(Number.isInteger(hint) && hint > 0)) {
  13843. throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
  13844. }
  13845. }
  13846. return hints;
  13847. }
  13848. throw new Error("Hint array in the linearization dictionary is invalid.");
  13849. }
  13850. const parser = new Parser({
  13851. lexer: new Lexer(stream),
  13852. xref: null
  13853. });
  13854. const obj1 = parser.getObj();
  13855. const obj2 = parser.getObj();
  13856. const obj3 = parser.getObj();
  13857. const linDict = parser.getObj();
  13858. let obj, length;
  13859. if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && linDict instanceof _primitives.Dict && typeof (obj = linDict.get("Linearized")) === "number" && obj > 0)) {
  13860. return null;
  13861. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  13862. throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
  13863. }
  13864. return {
  13865. length,
  13866. hints: getHints(linDict),
  13867. objectNumberFirst: getInt(linDict, "O"),
  13868. endFirst: getInt(linDict, "E"),
  13869. numPages: getInt(linDict, "N"),
  13870. mainXRefEntriesOffset: getInt(linDict, "T"),
  13871. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
  13872. };
  13873. }
  13874. }
  13875. exports.Linearization = Linearization;
  13876. /***/ }),
  13877. /* 16 */
  13878. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  13879. Object.defineProperty(exports, "__esModule", ({
  13880. value: true
  13881. }));
  13882. exports.Ascii85Stream = void 0;
  13883. var _decode_stream = __w_pdfjs_require__(17);
  13884. var _core_utils = __w_pdfjs_require__(4);
  13885. class Ascii85Stream extends _decode_stream.DecodeStream {
  13886. constructor(str, maybeLength) {
  13887. if (maybeLength) {
  13888. maybeLength *= 0.8;
  13889. }
  13890. super(maybeLength);
  13891. this.str = str;
  13892. this.dict = str.dict;
  13893. this.input = new Uint8Array(5);
  13894. }
  13895. readBlock() {
  13896. const TILDA_CHAR = 0x7e;
  13897. const Z_LOWER_CHAR = 0x7a;
  13898. const EOF = -1;
  13899. const str = this.str;
  13900. let c = str.getByte();
  13901. while ((0, _core_utils.isWhiteSpace)(c)) {
  13902. c = str.getByte();
  13903. }
  13904. if (c === EOF || c === TILDA_CHAR) {
  13905. this.eof = true;
  13906. return;
  13907. }
  13908. const bufferLength = this.bufferLength;
  13909. let buffer, i;
  13910. if (c === Z_LOWER_CHAR) {
  13911. buffer = this.ensureBuffer(bufferLength + 4);
  13912. for (i = 0; i < 4; ++i) {
  13913. buffer[bufferLength + i] = 0;
  13914. }
  13915. this.bufferLength += 4;
  13916. } else {
  13917. const input = this.input;
  13918. input[0] = c;
  13919. for (i = 1; i < 5; ++i) {
  13920. c = str.getByte();
  13921. while ((0, _core_utils.isWhiteSpace)(c)) {
  13922. c = str.getByte();
  13923. }
  13924. input[i] = c;
  13925. if (c === EOF || c === TILDA_CHAR) {
  13926. break;
  13927. }
  13928. }
  13929. buffer = this.ensureBuffer(bufferLength + i - 1);
  13930. this.bufferLength += i - 1;
  13931. if (i < 5) {
  13932. for (; i < 5; ++i) {
  13933. input[i] = 0x21 + 84;
  13934. }
  13935. this.eof = true;
  13936. }
  13937. let t = 0;
  13938. for (i = 0; i < 5; ++i) {
  13939. t = t * 85 + (input[i] - 0x21);
  13940. }
  13941. for (i = 3; i >= 0; --i) {
  13942. buffer[bufferLength + i] = t & 0xff;
  13943. t >>= 8;
  13944. }
  13945. }
  13946. }
  13947. }
  13948. exports.Ascii85Stream = Ascii85Stream;
  13949. /***/ }),
  13950. /* 17 */
  13951. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  13952. Object.defineProperty(exports, "__esModule", ({
  13953. value: true
  13954. }));
  13955. exports.StreamsSequenceStream = exports.DecodeStream = void 0;
  13956. var _base_stream = __w_pdfjs_require__(5);
  13957. var _stream = __w_pdfjs_require__(8);
  13958. const emptyBuffer = new Uint8Array(0);
  13959. class DecodeStream extends _base_stream.BaseStream {
  13960. constructor(maybeMinBufferLength) {
  13961. super();
  13962. this._rawMinBufferLength = maybeMinBufferLength || 0;
  13963. this.pos = 0;
  13964. this.bufferLength = 0;
  13965. this.eof = false;
  13966. this.buffer = emptyBuffer;
  13967. this.minBufferLength = 512;
  13968. if (maybeMinBufferLength) {
  13969. while (this.minBufferLength < maybeMinBufferLength) {
  13970. this.minBufferLength *= 2;
  13971. }
  13972. }
  13973. }
  13974. get isEmpty() {
  13975. while (!this.eof && this.bufferLength === 0) {
  13976. this.readBlock();
  13977. }
  13978. return this.bufferLength === 0;
  13979. }
  13980. ensureBuffer(requested) {
  13981. const buffer = this.buffer;
  13982. if (requested <= buffer.byteLength) {
  13983. return buffer;
  13984. }
  13985. let size = this.minBufferLength;
  13986. while (size < requested) {
  13987. size *= 2;
  13988. }
  13989. const buffer2 = new Uint8Array(size);
  13990. buffer2.set(buffer);
  13991. return this.buffer = buffer2;
  13992. }
  13993. getByte() {
  13994. const pos = this.pos;
  13995. while (this.bufferLength <= pos) {
  13996. if (this.eof) {
  13997. return -1;
  13998. }
  13999. this.readBlock();
  14000. }
  14001. return this.buffer[this.pos++];
  14002. }
  14003. getBytes(length) {
  14004. const pos = this.pos;
  14005. let end;
  14006. if (length) {
  14007. this.ensureBuffer(pos + length);
  14008. end = pos + length;
  14009. while (!this.eof && this.bufferLength < end) {
  14010. this.readBlock();
  14011. }
  14012. const bufEnd = this.bufferLength;
  14013. if (end > bufEnd) {
  14014. end = bufEnd;
  14015. }
  14016. } else {
  14017. while (!this.eof) {
  14018. this.readBlock();
  14019. }
  14020. end = this.bufferLength;
  14021. }
  14022. this.pos = end;
  14023. return this.buffer.subarray(pos, end);
  14024. }
  14025. reset() {
  14026. this.pos = 0;
  14027. }
  14028. makeSubStream(start, length, dict = null) {
  14029. if (length === undefined) {
  14030. while (!this.eof) {
  14031. this.readBlock();
  14032. }
  14033. } else {
  14034. const end = start + length;
  14035. while (this.bufferLength <= end && !this.eof) {
  14036. this.readBlock();
  14037. }
  14038. }
  14039. return new _stream.Stream(this.buffer, start, length, dict);
  14040. }
  14041. getBaseStreams() {
  14042. return this.str ? this.str.getBaseStreams() : null;
  14043. }
  14044. }
  14045. exports.DecodeStream = DecodeStream;
  14046. class StreamsSequenceStream extends DecodeStream {
  14047. constructor(streams, onError = null) {
  14048. let maybeLength = 0;
  14049. for (const stream of streams) {
  14050. maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length;
  14051. }
  14052. super(maybeLength);
  14053. this.streams = streams;
  14054. this._onError = onError;
  14055. }
  14056. readBlock() {
  14057. const streams = this.streams;
  14058. if (streams.length === 0) {
  14059. this.eof = true;
  14060. return;
  14061. }
  14062. const stream = streams.shift();
  14063. let chunk;
  14064. try {
  14065. chunk = stream.getBytes();
  14066. } catch (reason) {
  14067. if (this._onError) {
  14068. this._onError(reason, stream.dict && stream.dict.objId);
  14069. return;
  14070. }
  14071. throw reason;
  14072. }
  14073. const bufferLength = this.bufferLength;
  14074. const newLength = bufferLength + chunk.length;
  14075. const buffer = this.ensureBuffer(newLength);
  14076. buffer.set(chunk, bufferLength);
  14077. this.bufferLength = newLength;
  14078. }
  14079. getBaseStreams() {
  14080. const baseStreamsBuf = [];
  14081. for (const stream of this.streams) {
  14082. const baseStreams = stream.getBaseStreams();
  14083. if (baseStreams) {
  14084. baseStreamsBuf.push(...baseStreams);
  14085. }
  14086. }
  14087. return baseStreamsBuf.length > 0 ? baseStreamsBuf : null;
  14088. }
  14089. }
  14090. exports.StreamsSequenceStream = StreamsSequenceStream;
  14091. /***/ }),
  14092. /* 18 */
  14093. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14094. Object.defineProperty(exports, "__esModule", ({
  14095. value: true
  14096. }));
  14097. exports.AsciiHexStream = void 0;
  14098. var _decode_stream = __w_pdfjs_require__(17);
  14099. class AsciiHexStream extends _decode_stream.DecodeStream {
  14100. constructor(str, maybeLength) {
  14101. if (maybeLength) {
  14102. maybeLength *= 0.5;
  14103. }
  14104. super(maybeLength);
  14105. this.str = str;
  14106. this.dict = str.dict;
  14107. this.firstDigit = -1;
  14108. }
  14109. readBlock() {
  14110. const UPSTREAM_BLOCK_SIZE = 8000;
  14111. const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  14112. if (!bytes.length) {
  14113. this.eof = true;
  14114. return;
  14115. }
  14116. const maxDecodeLength = bytes.length + 1 >> 1;
  14117. const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  14118. let bufferLength = this.bufferLength;
  14119. let firstDigit = this.firstDigit;
  14120. for (const ch of bytes) {
  14121. let digit;
  14122. if (ch >= 0x30 && ch <= 0x39) {
  14123. digit = ch & 0x0f;
  14124. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  14125. digit = (ch & 0x0f) + 9;
  14126. } else if (ch === 0x3e) {
  14127. this.eof = true;
  14128. break;
  14129. } else {
  14130. continue;
  14131. }
  14132. if (firstDigit < 0) {
  14133. firstDigit = digit;
  14134. } else {
  14135. buffer[bufferLength++] = firstDigit << 4 | digit;
  14136. firstDigit = -1;
  14137. }
  14138. }
  14139. if (firstDigit >= 0 && this.eof) {
  14140. buffer[bufferLength++] = firstDigit << 4;
  14141. firstDigit = -1;
  14142. }
  14143. this.firstDigit = firstDigit;
  14144. this.bufferLength = bufferLength;
  14145. }
  14146. }
  14147. exports.AsciiHexStream = AsciiHexStream;
  14148. /***/ }),
  14149. /* 19 */
  14150. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14151. Object.defineProperty(exports, "__esModule", ({
  14152. value: true
  14153. }));
  14154. exports.CCITTFaxStream = void 0;
  14155. var _ccitt = __w_pdfjs_require__(20);
  14156. var _decode_stream = __w_pdfjs_require__(17);
  14157. var _primitives = __w_pdfjs_require__(3);
  14158. class CCITTFaxStream extends _decode_stream.DecodeStream {
  14159. constructor(str, maybeLength, params) {
  14160. super(maybeLength);
  14161. this.str = str;
  14162. this.dict = str.dict;
  14163. if (!(params instanceof _primitives.Dict)) {
  14164. params = _primitives.Dict.empty;
  14165. }
  14166. const source = {
  14167. next() {
  14168. return str.getByte();
  14169. }
  14170. };
  14171. this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
  14172. K: params.get("K"),
  14173. EndOfLine: params.get("EndOfLine"),
  14174. EncodedByteAlign: params.get("EncodedByteAlign"),
  14175. Columns: params.get("Columns"),
  14176. Rows: params.get("Rows"),
  14177. EndOfBlock: params.get("EndOfBlock"),
  14178. BlackIs1: params.get("BlackIs1")
  14179. });
  14180. }
  14181. readBlock() {
  14182. while (!this.eof) {
  14183. const c = this.ccittFaxDecoder.readNextChar();
  14184. if (c === -1) {
  14185. this.eof = true;
  14186. return;
  14187. }
  14188. this.ensureBuffer(this.bufferLength + 1);
  14189. this.buffer[this.bufferLength++] = c;
  14190. }
  14191. }
  14192. }
  14193. exports.CCITTFaxStream = CCITTFaxStream;
  14194. /***/ }),
  14195. /* 20 */
  14196. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14197. Object.defineProperty(exports, "__esModule", ({
  14198. value: true
  14199. }));
  14200. exports.CCITTFaxDecoder = void 0;
  14201. var _util = __w_pdfjs_require__(2);
  14202. const ccittEOL = -2;
  14203. const ccittEOF = -1;
  14204. const twoDimPass = 0;
  14205. const twoDimHoriz = 1;
  14206. const twoDimVert0 = 2;
  14207. const twoDimVertR1 = 3;
  14208. const twoDimVertL1 = 4;
  14209. const twoDimVertR2 = 5;
  14210. const twoDimVertL2 = 6;
  14211. const twoDimVertR3 = 7;
  14212. const twoDimVertL3 = 8;
  14213. const twoDimTable = [[-1, -1], [-1, -1], [7, twoDimVertL3], [7, twoDimVertR3], [6, twoDimVertL2], [6, twoDimVertL2], [6, twoDimVertR2], [6, twoDimVertR2], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0]];
  14214. const whiteTable1 = [[-1, -1], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [12, 1984], [12, 2048], [12, 2112], [12, 2176], [12, 2240], [12, 2304], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [12, 2368], [12, 2432], [12, 2496], [12, 2560]];
  14215. const whiteTable2 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [8, 29], [8, 29], [8, 30], [8, 30], [8, 45], [8, 45], [8, 46], [8, 46], [7, 22], [7, 22], [7, 22], [7, 22], [7, 23], [7, 23], [7, 23], [7, 23], [8, 47], [8, 47], [8, 48], [8, 48], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [7, 20], [7, 20], [7, 20], [7, 20], [8, 33], [8, 33], [8, 34], [8, 34], [8, 35], [8, 35], [8, 36], [8, 36], [8, 37], [8, 37], [8, 38], [8, 38], [7, 19], [7, 19], [7, 19], [7, 19], [8, 31], [8, 31], [8, 32], [8, 32], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [8, 53], [8, 53], [8, 54], [8, 54], [7, 26], [7, 26], [7, 26], [7, 26], [8, 39], [8, 39], [8, 40], [8, 40], [8, 41], [8, 41], [8, 42], [8, 42], [8, 43], [8, 43], [8, 44], [8, 44], [7, 21], [7, 21], [7, 21], [7, 21], [7, 28], [7, 28], [7, 28], [7, 28], [8, 61], [8, 61], [8, 62], [8, 62], [8, 63], [8, 63], [8, 0], [8, 0], [8, 320], [8, 320], [8, 384], [8, 384], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [7, 27], [7, 27], [7, 27], [7, 27], [8, 59], [8, 59], [8, 60], [8, 60], [9, 1472], [9, 1536], [9, 1600], [9, 1728], [7, 18], [7, 18], [7, 18], [7, 18], [7, 24], [7, 24], [7, 24], [7, 24], [8, 49], [8, 49], [8, 50], [8, 50], [8, 51], [8, 51], [8, 52], [8, 52], [7, 25], [7, 25], [7, 25], [7, 25], [8, 55], [8, 55], [8, 56], [8, 56], [8, 57], [8, 57], [8, 58], [8, 58], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [8, 448], [8, 448], [8, 512], [8, 512], [9, 704], [9, 768], [8, 640], [8, 640], [8, 576], [8, 576], [9, 832], [9, 896], [9, 960], [9, 1024], [9, 1088], [9, 1152], [9, 1216], [9, 1280], [9, 1344], [9, 1408], [7, 256], [7, 256], [7, 256], [7, 256], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7]];
  14216. const blackTable1 = [[-1, -1], [-1, -1], [12, ccittEOL], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [11, 1792], [11, 1792], [12, 1984], [12, 1984], [12, 2048], [12, 2048], [12, 2112], [12, 2112], [12, 2176], [12, 2176], [12, 2240], [12, 2240], [12, 2304], [12, 2304], [11, 1856], [11, 1856], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [11, 1920], [11, 1920], [12, 2368], [12, 2368], [12, 2432], [12, 2432], [12, 2496], [12, 2496], [12, 2560], [12, 2560], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [12, 52], [12, 52], [13, 640], [13, 704], [13, 768], [13, 832], [12, 55], [12, 55], [12, 56], [12, 56], [13, 1280], [13, 1344], [13, 1408], [13, 1472], [12, 59], [12, 59], [12, 60], [12, 60], [13, 1536], [13, 1600], [11, 24], [11, 24], [11, 24], [11, 24], [11, 25], [11, 25], [11, 25], [11, 25], [13, 1664], [13, 1728], [12, 320], [12, 320], [12, 384], [12, 384], [12, 448], [12, 448], [13, 512], [13, 576], [12, 53], [12, 53], [12, 54], [12, 54], [13, 896], [13, 960], [13, 1024], [13, 1088], [13, 1152], [13, 1216], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64]];
  14217. const blackTable2 = [[8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [11, 23], [11, 23], [12, 50], [12, 51], [12, 44], [12, 45], [12, 46], [12, 47], [12, 57], [12, 58], [12, 61], [12, 256], [10, 16], [10, 16], [10, 16], [10, 16], [10, 17], [10, 17], [10, 17], [10, 17], [12, 48], [12, 49], [12, 62], [12, 63], [12, 30], [12, 31], [12, 32], [12, 33], [12, 40], [12, 41], [11, 22], [11, 22], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [12, 128], [12, 192], [12, 26], [12, 27], [12, 28], [12, 29], [11, 19], [11, 19], [11, 20], [11, 20], [12, 34], [12, 35], [12, 36], [12, 37], [12, 38], [12, 39], [11, 21], [11, 21], [12, 42], [12, 43], [10, 0], [10, 0], [10, 0], [10, 0], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12]];
  14218. const blackTable3 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [6, 9], [6, 8], [5, 7], [5, 7], [4, 6], [4, 6], [4, 6], [4, 6], [4, 5], [4, 5], [4, 5], [4, 5], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2]];
  14219. class CCITTFaxDecoder {
  14220. constructor(source, options = {}) {
  14221. if (!source || typeof source.next !== "function") {
  14222. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  14223. }
  14224. this.source = source;
  14225. this.eof = false;
  14226. this.encoding = options.K || 0;
  14227. this.eoline = options.EndOfLine || false;
  14228. this.byteAlign = options.EncodedByteAlign || false;
  14229. this.columns = options.Columns || 1728;
  14230. this.rows = options.Rows || 0;
  14231. let eoblock = options.EndOfBlock;
  14232. if (eoblock === null || eoblock === undefined) {
  14233. eoblock = true;
  14234. }
  14235. this.eoblock = eoblock;
  14236. this.black = options.BlackIs1 || false;
  14237. this.codingLine = new Uint32Array(this.columns + 1);
  14238. this.refLine = new Uint32Array(this.columns + 2);
  14239. this.codingLine[0] = this.columns;
  14240. this.codingPos = 0;
  14241. this.row = 0;
  14242. this.nextLine2D = this.encoding < 0;
  14243. this.inputBits = 0;
  14244. this.inputBuf = 0;
  14245. this.outputBits = 0;
  14246. this.rowsDone = false;
  14247. let code1;
  14248. while ((code1 = this._lookBits(12)) === 0) {
  14249. this._eatBits(1);
  14250. }
  14251. if (code1 === 1) {
  14252. this._eatBits(12);
  14253. }
  14254. if (this.encoding > 0) {
  14255. this.nextLine2D = !this._lookBits(1);
  14256. this._eatBits(1);
  14257. }
  14258. }
  14259. readNextChar() {
  14260. if (this.eof) {
  14261. return -1;
  14262. }
  14263. const refLine = this.refLine;
  14264. const codingLine = this.codingLine;
  14265. const columns = this.columns;
  14266. let refPos, blackPixels, bits, i;
  14267. if (this.outputBits === 0) {
  14268. if (this.rowsDone) {
  14269. this.eof = true;
  14270. }
  14271. if (this.eof) {
  14272. return -1;
  14273. }
  14274. this.err = false;
  14275. let code1, code2, code3;
  14276. if (this.nextLine2D) {
  14277. for (i = 0; codingLine[i] < columns; ++i) {
  14278. refLine[i] = codingLine[i];
  14279. }
  14280. refLine[i++] = columns;
  14281. refLine[i] = columns;
  14282. codingLine[0] = 0;
  14283. this.codingPos = 0;
  14284. refPos = 0;
  14285. blackPixels = 0;
  14286. while (codingLine[this.codingPos] < columns) {
  14287. code1 = this._getTwoDimCode();
  14288. switch (code1) {
  14289. case twoDimPass:
  14290. this._addPixels(refLine[refPos + 1], blackPixels);
  14291. if (refLine[refPos + 1] < columns) {
  14292. refPos += 2;
  14293. }
  14294. break;
  14295. case twoDimHoriz:
  14296. code1 = code2 = 0;
  14297. if (blackPixels) {
  14298. do {
  14299. code1 += code3 = this._getBlackCode();
  14300. } while (code3 >= 64);
  14301. do {
  14302. code2 += code3 = this._getWhiteCode();
  14303. } while (code3 >= 64);
  14304. } else {
  14305. do {
  14306. code1 += code3 = this._getWhiteCode();
  14307. } while (code3 >= 64);
  14308. do {
  14309. code2 += code3 = this._getBlackCode();
  14310. } while (code3 >= 64);
  14311. }
  14312. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  14313. if (codingLine[this.codingPos] < columns) {
  14314. this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  14315. }
  14316. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14317. refPos += 2;
  14318. }
  14319. break;
  14320. case twoDimVertR3:
  14321. this._addPixels(refLine[refPos] + 3, blackPixels);
  14322. blackPixels ^= 1;
  14323. if (codingLine[this.codingPos] < columns) {
  14324. ++refPos;
  14325. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14326. refPos += 2;
  14327. }
  14328. }
  14329. break;
  14330. case twoDimVertR2:
  14331. this._addPixels(refLine[refPos] + 2, blackPixels);
  14332. blackPixels ^= 1;
  14333. if (codingLine[this.codingPos] < columns) {
  14334. ++refPos;
  14335. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14336. refPos += 2;
  14337. }
  14338. }
  14339. break;
  14340. case twoDimVertR1:
  14341. this._addPixels(refLine[refPos] + 1, blackPixels);
  14342. blackPixels ^= 1;
  14343. if (codingLine[this.codingPos] < columns) {
  14344. ++refPos;
  14345. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14346. refPos += 2;
  14347. }
  14348. }
  14349. break;
  14350. case twoDimVert0:
  14351. this._addPixels(refLine[refPos], blackPixels);
  14352. blackPixels ^= 1;
  14353. if (codingLine[this.codingPos] < columns) {
  14354. ++refPos;
  14355. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14356. refPos += 2;
  14357. }
  14358. }
  14359. break;
  14360. case twoDimVertL3:
  14361. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  14362. blackPixels ^= 1;
  14363. if (codingLine[this.codingPos] < columns) {
  14364. if (refPos > 0) {
  14365. --refPos;
  14366. } else {
  14367. ++refPos;
  14368. }
  14369. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14370. refPos += 2;
  14371. }
  14372. }
  14373. break;
  14374. case twoDimVertL2:
  14375. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  14376. blackPixels ^= 1;
  14377. if (codingLine[this.codingPos] < columns) {
  14378. if (refPos > 0) {
  14379. --refPos;
  14380. } else {
  14381. ++refPos;
  14382. }
  14383. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14384. refPos += 2;
  14385. }
  14386. }
  14387. break;
  14388. case twoDimVertL1:
  14389. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  14390. blackPixels ^= 1;
  14391. if (codingLine[this.codingPos] < columns) {
  14392. if (refPos > 0) {
  14393. --refPos;
  14394. } else {
  14395. ++refPos;
  14396. }
  14397. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14398. refPos += 2;
  14399. }
  14400. }
  14401. break;
  14402. case ccittEOF:
  14403. this._addPixels(columns, 0);
  14404. this.eof = true;
  14405. break;
  14406. default:
  14407. (0, _util.info)("bad 2d code");
  14408. this._addPixels(columns, 0);
  14409. this.err = true;
  14410. }
  14411. }
  14412. } else {
  14413. codingLine[0] = 0;
  14414. this.codingPos = 0;
  14415. blackPixels = 0;
  14416. while (codingLine[this.codingPos] < columns) {
  14417. code1 = 0;
  14418. if (blackPixels) {
  14419. do {
  14420. code1 += code3 = this._getBlackCode();
  14421. } while (code3 >= 64);
  14422. } else {
  14423. do {
  14424. code1 += code3 = this._getWhiteCode();
  14425. } while (code3 >= 64);
  14426. }
  14427. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  14428. blackPixels ^= 1;
  14429. }
  14430. }
  14431. let gotEOL = false;
  14432. if (this.byteAlign) {
  14433. this.inputBits &= ~7;
  14434. }
  14435. if (!this.eoblock && this.row === this.rows - 1) {
  14436. this.rowsDone = true;
  14437. } else {
  14438. code1 = this._lookBits(12);
  14439. if (this.eoline) {
  14440. while (code1 !== ccittEOF && code1 !== 1) {
  14441. this._eatBits(1);
  14442. code1 = this._lookBits(12);
  14443. }
  14444. } else {
  14445. while (code1 === 0) {
  14446. this._eatBits(1);
  14447. code1 = this._lookBits(12);
  14448. }
  14449. }
  14450. if (code1 === 1) {
  14451. this._eatBits(12);
  14452. gotEOL = true;
  14453. } else if (code1 === ccittEOF) {
  14454. this.eof = true;
  14455. }
  14456. }
  14457. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  14458. this.nextLine2D = !this._lookBits(1);
  14459. this._eatBits(1);
  14460. }
  14461. if (this.eoblock && gotEOL && this.byteAlign) {
  14462. code1 = this._lookBits(12);
  14463. if (code1 === 1) {
  14464. this._eatBits(12);
  14465. if (this.encoding > 0) {
  14466. this._lookBits(1);
  14467. this._eatBits(1);
  14468. }
  14469. if (this.encoding >= 0) {
  14470. for (i = 0; i < 4; ++i) {
  14471. code1 = this._lookBits(12);
  14472. if (code1 !== 1) {
  14473. (0, _util.info)("bad rtc code: " + code1);
  14474. }
  14475. this._eatBits(12);
  14476. if (this.encoding > 0) {
  14477. this._lookBits(1);
  14478. this._eatBits(1);
  14479. }
  14480. }
  14481. }
  14482. this.eof = true;
  14483. }
  14484. } else if (this.err && this.eoline) {
  14485. while (true) {
  14486. code1 = this._lookBits(13);
  14487. if (code1 === ccittEOF) {
  14488. this.eof = true;
  14489. return -1;
  14490. }
  14491. if (code1 >> 1 === 1) {
  14492. break;
  14493. }
  14494. this._eatBits(1);
  14495. }
  14496. this._eatBits(12);
  14497. if (this.encoding > 0) {
  14498. this._eatBits(1);
  14499. this.nextLine2D = !(code1 & 1);
  14500. }
  14501. }
  14502. if (codingLine[0] > 0) {
  14503. this.outputBits = codingLine[this.codingPos = 0];
  14504. } else {
  14505. this.outputBits = codingLine[this.codingPos = 1];
  14506. }
  14507. this.row++;
  14508. }
  14509. let c;
  14510. if (this.outputBits >= 8) {
  14511. c = this.codingPos & 1 ? 0 : 0xff;
  14512. this.outputBits -= 8;
  14513. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  14514. this.codingPos++;
  14515. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  14516. }
  14517. } else {
  14518. bits = 8;
  14519. c = 0;
  14520. do {
  14521. if (typeof this.outputBits !== "number") {
  14522. throw new _util.FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.');
  14523. }
  14524. if (this.outputBits > bits) {
  14525. c <<= bits;
  14526. if (!(this.codingPos & 1)) {
  14527. c |= 0xff >> 8 - bits;
  14528. }
  14529. this.outputBits -= bits;
  14530. bits = 0;
  14531. } else {
  14532. c <<= this.outputBits;
  14533. if (!(this.codingPos & 1)) {
  14534. c |= 0xff >> 8 - this.outputBits;
  14535. }
  14536. bits -= this.outputBits;
  14537. this.outputBits = 0;
  14538. if (codingLine[this.codingPos] < columns) {
  14539. this.codingPos++;
  14540. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  14541. } else if (bits > 0) {
  14542. c <<= bits;
  14543. bits = 0;
  14544. }
  14545. }
  14546. } while (bits);
  14547. }
  14548. if (this.black) {
  14549. c ^= 0xff;
  14550. }
  14551. return c;
  14552. }
  14553. _addPixels(a1, blackPixels) {
  14554. const codingLine = this.codingLine;
  14555. let codingPos = this.codingPos;
  14556. if (a1 > codingLine[codingPos]) {
  14557. if (a1 > this.columns) {
  14558. (0, _util.info)("row is wrong length");
  14559. this.err = true;
  14560. a1 = this.columns;
  14561. }
  14562. if (codingPos & 1 ^ blackPixels) {
  14563. ++codingPos;
  14564. }
  14565. codingLine[codingPos] = a1;
  14566. }
  14567. this.codingPos = codingPos;
  14568. }
  14569. _addPixelsNeg(a1, blackPixels) {
  14570. const codingLine = this.codingLine;
  14571. let codingPos = this.codingPos;
  14572. if (a1 > codingLine[codingPos]) {
  14573. if (a1 > this.columns) {
  14574. (0, _util.info)("row is wrong length");
  14575. this.err = true;
  14576. a1 = this.columns;
  14577. }
  14578. if (codingPos & 1 ^ blackPixels) {
  14579. ++codingPos;
  14580. }
  14581. codingLine[codingPos] = a1;
  14582. } else if (a1 < codingLine[codingPos]) {
  14583. if (a1 < 0) {
  14584. (0, _util.info)("invalid code");
  14585. this.err = true;
  14586. a1 = 0;
  14587. }
  14588. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  14589. --codingPos;
  14590. }
  14591. codingLine[codingPos] = a1;
  14592. }
  14593. this.codingPos = codingPos;
  14594. }
  14595. _findTableCode(start, end, table, limit) {
  14596. const limitValue = limit || 0;
  14597. for (let i = start; i <= end; ++i) {
  14598. let code = this._lookBits(i);
  14599. if (code === ccittEOF) {
  14600. return [true, 1, false];
  14601. }
  14602. if (i < end) {
  14603. code <<= end - i;
  14604. }
  14605. if (!limitValue || code >= limitValue) {
  14606. const p = table[code - limitValue];
  14607. if (p[0] === i) {
  14608. this._eatBits(i);
  14609. return [true, p[1], true];
  14610. }
  14611. }
  14612. }
  14613. return [false, 0, false];
  14614. }
  14615. _getTwoDimCode() {
  14616. let code = 0;
  14617. let p;
  14618. if (this.eoblock) {
  14619. code = this._lookBits(7);
  14620. p = twoDimTable[code];
  14621. if (p && p[0] > 0) {
  14622. this._eatBits(p[0]);
  14623. return p[1];
  14624. }
  14625. } else {
  14626. const result = this._findTableCode(1, 7, twoDimTable);
  14627. if (result[0] && result[2]) {
  14628. return result[1];
  14629. }
  14630. }
  14631. (0, _util.info)("Bad two dim code");
  14632. return ccittEOF;
  14633. }
  14634. _getWhiteCode() {
  14635. let code = 0;
  14636. let p;
  14637. if (this.eoblock) {
  14638. code = this._lookBits(12);
  14639. if (code === ccittEOF) {
  14640. return 1;
  14641. }
  14642. if (code >> 5 === 0) {
  14643. p = whiteTable1[code];
  14644. } else {
  14645. p = whiteTable2[code >> 3];
  14646. }
  14647. if (p[0] > 0) {
  14648. this._eatBits(p[0]);
  14649. return p[1];
  14650. }
  14651. } else {
  14652. let result = this._findTableCode(1, 9, whiteTable2);
  14653. if (result[0]) {
  14654. return result[1];
  14655. }
  14656. result = this._findTableCode(11, 12, whiteTable1);
  14657. if (result[0]) {
  14658. return result[1];
  14659. }
  14660. }
  14661. (0, _util.info)("bad white code");
  14662. this._eatBits(1);
  14663. return 1;
  14664. }
  14665. _getBlackCode() {
  14666. let code, p;
  14667. if (this.eoblock) {
  14668. code = this._lookBits(13);
  14669. if (code === ccittEOF) {
  14670. return 1;
  14671. }
  14672. if (code >> 7 === 0) {
  14673. p = blackTable1[code];
  14674. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  14675. p = blackTable2[(code >> 1) - 64];
  14676. } else {
  14677. p = blackTable3[code >> 7];
  14678. }
  14679. if (p[0] > 0) {
  14680. this._eatBits(p[0]);
  14681. return p[1];
  14682. }
  14683. } else {
  14684. let result = this._findTableCode(2, 6, blackTable3);
  14685. if (result[0]) {
  14686. return result[1];
  14687. }
  14688. result = this._findTableCode(7, 12, blackTable2, 64);
  14689. if (result[0]) {
  14690. return result[1];
  14691. }
  14692. result = this._findTableCode(10, 13, blackTable1);
  14693. if (result[0]) {
  14694. return result[1];
  14695. }
  14696. }
  14697. (0, _util.info)("bad black code");
  14698. this._eatBits(1);
  14699. return 1;
  14700. }
  14701. _lookBits(n) {
  14702. let c;
  14703. while (this.inputBits < n) {
  14704. if ((c = this.source.next()) === -1) {
  14705. if (this.inputBits === 0) {
  14706. return ccittEOF;
  14707. }
  14708. return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
  14709. }
  14710. this.inputBuf = this.inputBuf << 8 | c;
  14711. this.inputBits += 8;
  14712. }
  14713. return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
  14714. }
  14715. _eatBits(n) {
  14716. if ((this.inputBits -= n) < 0) {
  14717. this.inputBits = 0;
  14718. }
  14719. }
  14720. }
  14721. exports.CCITTFaxDecoder = CCITTFaxDecoder;
  14722. /***/ }),
  14723. /* 21 */
  14724. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14725. Object.defineProperty(exports, "__esModule", ({
  14726. value: true
  14727. }));
  14728. exports.FlateStream = void 0;
  14729. var _decode_stream = __w_pdfjs_require__(17);
  14730. var _util = __w_pdfjs_require__(2);
  14731. const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  14732. const lengthDecode = new Int32Array([0x00003, 0x00004, 0x00005, 0x00006, 0x00007, 0x00008, 0x00009, 0x0000a, 0x1000b, 0x1000d, 0x1000f, 0x10011, 0x20013, 0x20017, 0x2001b, 0x2001f, 0x30023, 0x3002b, 0x30033, 0x3003b, 0x40043, 0x40053, 0x40063, 0x40073, 0x50083, 0x500a3, 0x500c3, 0x500e3, 0x00102, 0x00102, 0x00102]);
  14733. const distDecode = new Int32Array([0x00001, 0x00002, 0x00003, 0x00004, 0x10005, 0x10007, 0x20009, 0x2000d, 0x30011, 0x30019, 0x40021, 0x40031, 0x50041, 0x50061, 0x60081, 0x600c1, 0x70101, 0x70181, 0x80201, 0x80301, 0x90401, 0x90601, 0xa0801, 0xa0c01, 0xb1001, 0xb1801, 0xc2001, 0xc3001, 0xd4001, 0xd6001]);
  14734. const fixedLitCodeTab = [new Int32Array([0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c0, 0x70108, 0x80060, 0x80020, 0x900a0, 0x80000, 0x80080, 0x80040, 0x900e0, 0x70104, 0x80058, 0x80018, 0x90090, 0x70114, 0x80078, 0x80038, 0x900d0, 0x7010c, 0x80068, 0x80028, 0x900b0, 0x80008, 0x80088, 0x80048, 0x900f0, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c8, 0x7010a, 0x80064, 0x80024, 0x900a8, 0x80004, 0x80084, 0x80044, 0x900e8, 0x70106, 0x8005c, 0x8001c, 0x90098, 0x70116, 0x8007c, 0x8003c, 0x900d8, 0x7010e, 0x8006c, 0x8002c, 0x900b8, 0x8000c, 0x8008c, 0x8004c, 0x900f8, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c4, 0x70109, 0x80062, 0x80022, 0x900a4, 0x80002, 0x80082, 0x80042, 0x900e4, 0x70105, 0x8005a, 0x8001a, 0x90094, 0x70115, 0x8007a, 0x8003a, 0x900d4, 0x7010d, 0x8006a, 0x8002a, 0x900b4, 0x8000a, 0x8008a, 0x8004a, 0x900f4, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cc, 0x7010b, 0x80066, 0x80026, 0x900ac, 0x80006, 0x80086, 0x80046, 0x900ec, 0x70107, 0x8005e, 0x8001e, 0x9009c, 0x70117, 0x8007e, 0x8003e, 0x900dc, 0x7010f, 0x8006e, 0x8002e, 0x900bc, 0x8000e, 0x8008e, 0x8004e, 0x900fc, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c2, 0x70108, 0x80061, 0x80021, 0x900a2, 0x80001, 0x80081, 0x80041, 0x900e2, 0x70104, 0x80059, 0x80019, 0x90092, 0x70114, 0x80079, 0x80039, 0x900d2, 0x7010c, 0x80069, 0x80029, 0x900b2, 0x80009, 0x80089, 0x80049, 0x900f2, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900ca, 0x7010a, 0x80065, 0x80025, 0x900aa, 0x80005, 0x80085, 0x80045, 0x900ea, 0x70106, 0x8005d, 0x8001d, 0x9009a, 0x70116, 0x8007d, 0x8003d, 0x900da, 0x7010e, 0x8006d, 0x8002d, 0x900ba, 0x8000d, 0x8008d, 0x8004d, 0x900fa, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c6, 0x70109, 0x80063, 0x80023, 0x900a6, 0x80003, 0x80083, 0x80043, 0x900e6, 0x70105, 0x8005b, 0x8001b, 0x90096, 0x70115, 0x8007b, 0x8003b, 0x900d6, 0x7010d, 0x8006b, 0x8002b, 0x900b6, 0x8000b, 0x8008b, 0x8004b, 0x900f6, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900ce, 0x7010b, 0x80067, 0x80027, 0x900ae, 0x80007, 0x80087, 0x80047, 0x900ee, 0x70107, 0x8005f, 0x8001f, 0x9009e, 0x70117, 0x8007f, 0x8003f, 0x900de, 0x7010f, 0x8006f, 0x8002f, 0x900be, 0x8000f, 0x8008f, 0x8004f, 0x900fe, 0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c1, 0x70108, 0x80060, 0x80020, 0x900a1, 0x80000, 0x80080, 0x80040, 0x900e1, 0x70104, 0x80058, 0x80018, 0x90091, 0x70114, 0x80078, 0x80038, 0x900d1, 0x7010c, 0x80068, 0x80028, 0x900b1, 0x80008, 0x80088, 0x80048, 0x900f1, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c9, 0x7010a, 0x80064, 0x80024, 0x900a9, 0x80004, 0x80084, 0x80044, 0x900e9, 0x70106, 0x8005c, 0x8001c, 0x90099, 0x70116, 0x8007c, 0x8003c, 0x900d9, 0x7010e, 0x8006c, 0x8002c, 0x900b9, 0x8000c, 0x8008c, 0x8004c, 0x900f9, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c5, 0x70109, 0x80062, 0x80022, 0x900a5, 0x80002, 0x80082, 0x80042, 0x900e5, 0x70105, 0x8005a, 0x8001a, 0x90095, 0x70115, 0x8007a, 0x8003a, 0x900d5, 0x7010d, 0x8006a, 0x8002a, 0x900b5, 0x8000a, 0x8008a, 0x8004a, 0x900f5, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cd, 0x7010b, 0x80066, 0x80026, 0x900ad, 0x80006, 0x80086, 0x80046, 0x900ed, 0x70107, 0x8005e, 0x8001e, 0x9009d, 0x70117, 0x8007e, 0x8003e, 0x900dd, 0x7010f, 0x8006e, 0x8002e, 0x900bd, 0x8000e, 0x8008e, 0x8004e, 0x900fd, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c3, 0x70108, 0x80061, 0x80021, 0x900a3, 0x80001, 0x80081, 0x80041, 0x900e3, 0x70104, 0x80059, 0x80019, 0x90093, 0x70114, 0x80079, 0x80039, 0x900d3, 0x7010c, 0x80069, 0x80029, 0x900b3, 0x80009, 0x80089, 0x80049, 0x900f3, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900cb, 0x7010a, 0x80065, 0x80025, 0x900ab, 0x80005, 0x80085, 0x80045, 0x900eb, 0x70106, 0x8005d, 0x8001d, 0x9009b, 0x70116, 0x8007d, 0x8003d, 0x900db, 0x7010e, 0x8006d, 0x8002d, 0x900bb, 0x8000d, 0x8008d, 0x8004d, 0x900fb, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c7, 0x70109, 0x80063, 0x80023, 0x900a7, 0x80003, 0x80083, 0x80043, 0x900e7, 0x70105, 0x8005b, 0x8001b, 0x90097, 0x70115, 0x8007b, 0x8003b, 0x900d7, 0x7010d, 0x8006b, 0x8002b, 0x900b7, 0x8000b, 0x8008b, 0x8004b, 0x900f7, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900cf, 0x7010b, 0x80067, 0x80027, 0x900af, 0x80007, 0x80087, 0x80047, 0x900ef, 0x70107, 0x8005f, 0x8001f, 0x9009f, 0x70117, 0x8007f, 0x8003f, 0x900df, 0x7010f, 0x8006f, 0x8002f, 0x900bf, 0x8000f, 0x8008f, 0x8004f, 0x900ff]), 9];
  14735. const fixedDistCodeTab = [new Int32Array([0x50000, 0x50010, 0x50008, 0x50018, 0x50004, 0x50014, 0x5000c, 0x5001c, 0x50002, 0x50012, 0x5000a, 0x5001a, 0x50006, 0x50016, 0x5000e, 0x00000, 0x50001, 0x50011, 0x50009, 0x50019, 0x50005, 0x50015, 0x5000d, 0x5001d, 0x50003, 0x50013, 0x5000b, 0x5001b, 0x50007, 0x50017, 0x5000f, 0x00000]), 5];
  14736. class FlateStream extends _decode_stream.DecodeStream {
  14737. constructor(str, maybeLength) {
  14738. super(maybeLength);
  14739. this.str = str;
  14740. this.dict = str.dict;
  14741. const cmf = str.getByte();
  14742. const flg = str.getByte();
  14743. if (cmf === -1 || flg === -1) {
  14744. throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
  14745. }
  14746. if ((cmf & 0x0f) !== 0x08) {
  14747. throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
  14748. }
  14749. if (((cmf << 8) + flg) % 31 !== 0) {
  14750. throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
  14751. }
  14752. if (flg & 0x20) {
  14753. throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
  14754. }
  14755. this.codeSize = 0;
  14756. this.codeBuf = 0;
  14757. }
  14758. getBits(bits) {
  14759. const str = this.str;
  14760. let codeSize = this.codeSize;
  14761. let codeBuf = this.codeBuf;
  14762. let b;
  14763. while (codeSize < bits) {
  14764. if ((b = str.getByte()) === -1) {
  14765. throw new _util.FormatError("Bad encoding in flate stream");
  14766. }
  14767. codeBuf |= b << codeSize;
  14768. codeSize += 8;
  14769. }
  14770. b = codeBuf & (1 << bits) - 1;
  14771. this.codeBuf = codeBuf >> bits;
  14772. this.codeSize = codeSize -= bits;
  14773. return b;
  14774. }
  14775. getCode(table) {
  14776. const str = this.str;
  14777. const codes = table[0];
  14778. const maxLen = table[1];
  14779. let codeSize = this.codeSize;
  14780. let codeBuf = this.codeBuf;
  14781. let b;
  14782. while (codeSize < maxLen) {
  14783. if ((b = str.getByte()) === -1) {
  14784. break;
  14785. }
  14786. codeBuf |= b << codeSize;
  14787. codeSize += 8;
  14788. }
  14789. const code = codes[codeBuf & (1 << maxLen) - 1];
  14790. const codeLen = code >> 16;
  14791. const codeVal = code & 0xffff;
  14792. if (codeLen < 1 || codeSize < codeLen) {
  14793. throw new _util.FormatError("Bad encoding in flate stream");
  14794. }
  14795. this.codeBuf = codeBuf >> codeLen;
  14796. this.codeSize = codeSize - codeLen;
  14797. return codeVal;
  14798. }
  14799. generateHuffmanTable(lengths) {
  14800. const n = lengths.length;
  14801. let maxLen = 0;
  14802. let i;
  14803. for (i = 0; i < n; ++i) {
  14804. if (lengths[i] > maxLen) {
  14805. maxLen = lengths[i];
  14806. }
  14807. }
  14808. const size = 1 << maxLen;
  14809. const codes = new Int32Array(size);
  14810. for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  14811. for (let val = 0; val < n; ++val) {
  14812. if (lengths[val] === len) {
  14813. let code2 = 0;
  14814. let t = code;
  14815. for (i = 0; i < len; ++i) {
  14816. code2 = code2 << 1 | t & 1;
  14817. t >>= 1;
  14818. }
  14819. for (i = code2; i < size; i += skip) {
  14820. codes[i] = len << 16 | val;
  14821. }
  14822. ++code;
  14823. }
  14824. }
  14825. }
  14826. return [codes, maxLen];
  14827. }
  14828. readBlock() {
  14829. let buffer, len;
  14830. const str = this.str;
  14831. let hdr = this.getBits(3);
  14832. if (hdr & 1) {
  14833. this.eof = true;
  14834. }
  14835. hdr >>= 1;
  14836. if (hdr === 0) {
  14837. let b;
  14838. if ((b = str.getByte()) === -1) {
  14839. throw new _util.FormatError("Bad block header in flate stream");
  14840. }
  14841. let blockLen = b;
  14842. if ((b = str.getByte()) === -1) {
  14843. throw new _util.FormatError("Bad block header in flate stream");
  14844. }
  14845. blockLen |= b << 8;
  14846. if ((b = str.getByte()) === -1) {
  14847. throw new _util.FormatError("Bad block header in flate stream");
  14848. }
  14849. let check = b;
  14850. if ((b = str.getByte()) === -1) {
  14851. throw new _util.FormatError("Bad block header in flate stream");
  14852. }
  14853. check |= b << 8;
  14854. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  14855. throw new _util.FormatError("Bad uncompressed block length in flate stream");
  14856. }
  14857. this.codeBuf = 0;
  14858. this.codeSize = 0;
  14859. const bufferLength = this.bufferLength,
  14860. end = bufferLength + blockLen;
  14861. buffer = this.ensureBuffer(end);
  14862. this.bufferLength = end;
  14863. if (blockLen === 0) {
  14864. if (str.peekByte() === -1) {
  14865. this.eof = true;
  14866. }
  14867. } else {
  14868. const block = str.getBytes(blockLen);
  14869. buffer.set(block, bufferLength);
  14870. if (block.length < blockLen) {
  14871. this.eof = true;
  14872. }
  14873. }
  14874. return;
  14875. }
  14876. let litCodeTable;
  14877. let distCodeTable;
  14878. if (hdr === 1) {
  14879. litCodeTable = fixedLitCodeTab;
  14880. distCodeTable = fixedDistCodeTab;
  14881. } else if (hdr === 2) {
  14882. const numLitCodes = this.getBits(5) + 257;
  14883. const numDistCodes = this.getBits(5) + 1;
  14884. const numCodeLenCodes = this.getBits(4) + 4;
  14885. const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  14886. let i;
  14887. for (i = 0; i < numCodeLenCodes; ++i) {
  14888. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  14889. }
  14890. const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  14891. len = 0;
  14892. i = 0;
  14893. const codes = numLitCodes + numDistCodes;
  14894. const codeLengths = new Uint8Array(codes);
  14895. let bitsLength, bitsOffset, what;
  14896. while (i < codes) {
  14897. const code = this.getCode(codeLenCodeTab);
  14898. if (code === 16) {
  14899. bitsLength = 2;
  14900. bitsOffset = 3;
  14901. what = len;
  14902. } else if (code === 17) {
  14903. bitsLength = 3;
  14904. bitsOffset = 3;
  14905. what = len = 0;
  14906. } else if (code === 18) {
  14907. bitsLength = 7;
  14908. bitsOffset = 11;
  14909. what = len = 0;
  14910. } else {
  14911. codeLengths[i++] = len = code;
  14912. continue;
  14913. }
  14914. let repeatLength = this.getBits(bitsLength) + bitsOffset;
  14915. while (repeatLength-- > 0) {
  14916. codeLengths[i++] = what;
  14917. }
  14918. }
  14919. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  14920. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  14921. } else {
  14922. throw new _util.FormatError("Unknown block type in flate stream");
  14923. }
  14924. buffer = this.buffer;
  14925. let limit = buffer ? buffer.length : 0;
  14926. let pos = this.bufferLength;
  14927. while (true) {
  14928. let code1 = this.getCode(litCodeTable);
  14929. if (code1 < 256) {
  14930. if (pos + 1 >= limit) {
  14931. buffer = this.ensureBuffer(pos + 1);
  14932. limit = buffer.length;
  14933. }
  14934. buffer[pos++] = code1;
  14935. continue;
  14936. }
  14937. if (code1 === 256) {
  14938. this.bufferLength = pos;
  14939. return;
  14940. }
  14941. code1 -= 257;
  14942. code1 = lengthDecode[code1];
  14943. let code2 = code1 >> 16;
  14944. if (code2 > 0) {
  14945. code2 = this.getBits(code2);
  14946. }
  14947. len = (code1 & 0xffff) + code2;
  14948. code1 = this.getCode(distCodeTable);
  14949. code1 = distDecode[code1];
  14950. code2 = code1 >> 16;
  14951. if (code2 > 0) {
  14952. code2 = this.getBits(code2);
  14953. }
  14954. const dist = (code1 & 0xffff) + code2;
  14955. if (pos + len >= limit) {
  14956. buffer = this.ensureBuffer(pos + len);
  14957. limit = buffer.length;
  14958. }
  14959. for (let k = 0; k < len; ++k, ++pos) {
  14960. buffer[pos] = buffer[pos - dist];
  14961. }
  14962. }
  14963. }
  14964. }
  14965. exports.FlateStream = FlateStream;
  14966. /***/ }),
  14967. /* 22 */
  14968. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14969. Object.defineProperty(exports, "__esModule", ({
  14970. value: true
  14971. }));
  14972. exports.Jbig2Stream = void 0;
  14973. var _base_stream = __w_pdfjs_require__(5);
  14974. var _decode_stream = __w_pdfjs_require__(17);
  14975. var _primitives = __w_pdfjs_require__(3);
  14976. var _jbig = __w_pdfjs_require__(23);
  14977. var _util = __w_pdfjs_require__(2);
  14978. class Jbig2Stream extends _decode_stream.DecodeStream {
  14979. constructor(stream, maybeLength, params) {
  14980. super(maybeLength);
  14981. this.stream = stream;
  14982. this.dict = stream.dict;
  14983. this.maybeLength = maybeLength;
  14984. this.params = params;
  14985. }
  14986. get bytes() {
  14987. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  14988. }
  14989. ensureBuffer(requested) {}
  14990. readBlock() {
  14991. if (this.eof) {
  14992. return;
  14993. }
  14994. const jbig2Image = new _jbig.Jbig2Image();
  14995. const chunks = [];
  14996. if (this.params instanceof _primitives.Dict) {
  14997. const globalsStream = this.params.get("JBIG2Globals");
  14998. if (globalsStream instanceof _base_stream.BaseStream) {
  14999. const globals = globalsStream.getBytes();
  15000. chunks.push({
  15001. data: globals,
  15002. start: 0,
  15003. end: globals.length
  15004. });
  15005. }
  15006. }
  15007. chunks.push({
  15008. data: this.bytes,
  15009. start: 0,
  15010. end: this.bytes.length
  15011. });
  15012. const data = jbig2Image.parseChunks(chunks);
  15013. const dataLength = data.length;
  15014. for (let i = 0; i < dataLength; i++) {
  15015. data[i] ^= 0xff;
  15016. }
  15017. this.buffer = data;
  15018. this.bufferLength = dataLength;
  15019. this.eof = true;
  15020. }
  15021. }
  15022. exports.Jbig2Stream = Jbig2Stream;
  15023. /***/ }),
  15024. /* 23 */
  15025. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  15026. Object.defineProperty(exports, "__esModule", ({
  15027. value: true
  15028. }));
  15029. exports.Jbig2Image = void 0;
  15030. var _util = __w_pdfjs_require__(2);
  15031. var _core_utils = __w_pdfjs_require__(4);
  15032. var _arithmetic_decoder = __w_pdfjs_require__(24);
  15033. var _ccitt = __w_pdfjs_require__(20);
  15034. class Jbig2Error extends _util.BaseException {
  15035. constructor(msg) {
  15036. super(`JBIG2 error: ${msg}`, "Jbig2Error");
  15037. }
  15038. }
  15039. class ContextCache {
  15040. getContexts(id) {
  15041. if (id in this) {
  15042. return this[id];
  15043. }
  15044. return this[id] = new Int8Array(1 << 16);
  15045. }
  15046. }
  15047. class DecodingContext {
  15048. constructor(data, start, end) {
  15049. this.data = data;
  15050. this.start = start;
  15051. this.end = end;
  15052. }
  15053. get decoder() {
  15054. const decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
  15055. return (0, _util.shadow)(this, "decoder", decoder);
  15056. }
  15057. get contextCache() {
  15058. const cache = new ContextCache();
  15059. return (0, _util.shadow)(this, "contextCache", cache);
  15060. }
  15061. }
  15062. function decodeInteger(contextCache, procedure, decoder) {
  15063. const contexts = contextCache.getContexts(procedure);
  15064. let prev = 1;
  15065. function readBits(length) {
  15066. let v = 0;
  15067. for (let i = 0; i < length; i++) {
  15068. const bit = decoder.readBit(contexts, prev);
  15069. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  15070. v = v << 1 | bit;
  15071. }
  15072. return v >>> 0;
  15073. }
  15074. const sign = readBits(1);
  15075. const value = readBits(1) ? readBits(1) ? readBits(1) ? readBits(1) ? readBits(1) ? readBits(32) + 4436 : readBits(12) + 340 : readBits(8) + 84 : readBits(6) + 20 : readBits(4) + 4 : readBits(2);
  15076. if (sign === 0) {
  15077. return value;
  15078. } else if (value > 0) {
  15079. return -value;
  15080. }
  15081. return null;
  15082. }
  15083. function decodeIAID(contextCache, decoder, codeLength) {
  15084. const contexts = contextCache.getContexts("IAID");
  15085. let prev = 1;
  15086. for (let i = 0; i < codeLength; i++) {
  15087. const bit = decoder.readBit(contexts, prev);
  15088. prev = prev << 1 | bit;
  15089. }
  15090. if (codeLength < 31) {
  15091. return prev & (1 << codeLength) - 1;
  15092. }
  15093. return prev & 0x7fffffff;
  15094. }
  15095. const SegmentTypes = ["SymbolDictionary", null, null, null, "IntermediateTextRegion", null, "ImmediateTextRegion", "ImmediateLosslessTextRegion", null, null, null, null, null, null, null, null, "PatternDictionary", null, null, null, "IntermediateHalftoneRegion", null, "ImmediateHalftoneRegion", "ImmediateLosslessHalftoneRegion", null, null, null, null, null, null, null, null, null, null, null, null, "IntermediateGenericRegion", null, "ImmediateGenericRegion", "ImmediateLosslessGenericRegion", "IntermediateGenericRefinementRegion", null, "ImmediateGenericRefinementRegion", "ImmediateLosslessGenericRefinementRegion", null, null, null, null, "PageInformation", "EndOfPage", "EndOfStripe", "EndOfFile", "Profiles", "Tables", null, null, null, null, null, null, null, null, "Extension"];
  15096. const CodingTemplates = [[{
  15097. x: -1,
  15098. y: -2
  15099. }, {
  15100. x: 0,
  15101. y: -2
  15102. }, {
  15103. x: 1,
  15104. y: -2
  15105. }, {
  15106. x: -2,
  15107. y: -1
  15108. }, {
  15109. x: -1,
  15110. y: -1
  15111. }, {
  15112. x: 0,
  15113. y: -1
  15114. }, {
  15115. x: 1,
  15116. y: -1
  15117. }, {
  15118. x: 2,
  15119. y: -1
  15120. }, {
  15121. x: -4,
  15122. y: 0
  15123. }, {
  15124. x: -3,
  15125. y: 0
  15126. }, {
  15127. x: -2,
  15128. y: 0
  15129. }, {
  15130. x: -1,
  15131. y: 0
  15132. }], [{
  15133. x: -1,
  15134. y: -2
  15135. }, {
  15136. x: 0,
  15137. y: -2
  15138. }, {
  15139. x: 1,
  15140. y: -2
  15141. }, {
  15142. x: 2,
  15143. y: -2
  15144. }, {
  15145. x: -2,
  15146. y: -1
  15147. }, {
  15148. x: -1,
  15149. y: -1
  15150. }, {
  15151. x: 0,
  15152. y: -1
  15153. }, {
  15154. x: 1,
  15155. y: -1
  15156. }, {
  15157. x: 2,
  15158. y: -1
  15159. }, {
  15160. x: -3,
  15161. y: 0
  15162. }, {
  15163. x: -2,
  15164. y: 0
  15165. }, {
  15166. x: -1,
  15167. y: 0
  15168. }], [{
  15169. x: -1,
  15170. y: -2
  15171. }, {
  15172. x: 0,
  15173. y: -2
  15174. }, {
  15175. x: 1,
  15176. y: -2
  15177. }, {
  15178. x: -2,
  15179. y: -1
  15180. }, {
  15181. x: -1,
  15182. y: -1
  15183. }, {
  15184. x: 0,
  15185. y: -1
  15186. }, {
  15187. x: 1,
  15188. y: -1
  15189. }, {
  15190. x: -2,
  15191. y: 0
  15192. }, {
  15193. x: -1,
  15194. y: 0
  15195. }], [{
  15196. x: -3,
  15197. y: -1
  15198. }, {
  15199. x: -2,
  15200. y: -1
  15201. }, {
  15202. x: -1,
  15203. y: -1
  15204. }, {
  15205. x: 0,
  15206. y: -1
  15207. }, {
  15208. x: 1,
  15209. y: -1
  15210. }, {
  15211. x: -4,
  15212. y: 0
  15213. }, {
  15214. x: -3,
  15215. y: 0
  15216. }, {
  15217. x: -2,
  15218. y: 0
  15219. }, {
  15220. x: -1,
  15221. y: 0
  15222. }]];
  15223. const RefinementTemplates = [{
  15224. coding: [{
  15225. x: 0,
  15226. y: -1
  15227. }, {
  15228. x: 1,
  15229. y: -1
  15230. }, {
  15231. x: -1,
  15232. y: 0
  15233. }],
  15234. reference: [{
  15235. x: 0,
  15236. y: -1
  15237. }, {
  15238. x: 1,
  15239. y: -1
  15240. }, {
  15241. x: -1,
  15242. y: 0
  15243. }, {
  15244. x: 0,
  15245. y: 0
  15246. }, {
  15247. x: 1,
  15248. y: 0
  15249. }, {
  15250. x: -1,
  15251. y: 1
  15252. }, {
  15253. x: 0,
  15254. y: 1
  15255. }, {
  15256. x: 1,
  15257. y: 1
  15258. }]
  15259. }, {
  15260. coding: [{
  15261. x: -1,
  15262. y: -1
  15263. }, {
  15264. x: 0,
  15265. y: -1
  15266. }, {
  15267. x: 1,
  15268. y: -1
  15269. }, {
  15270. x: -1,
  15271. y: 0
  15272. }],
  15273. reference: [{
  15274. x: 0,
  15275. y: -1
  15276. }, {
  15277. x: -1,
  15278. y: 0
  15279. }, {
  15280. x: 0,
  15281. y: 0
  15282. }, {
  15283. x: 1,
  15284. y: 0
  15285. }, {
  15286. x: 0,
  15287. y: 1
  15288. }, {
  15289. x: 1,
  15290. y: 1
  15291. }]
  15292. }];
  15293. const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  15294. const RefinementReusedContexts = [0x0020, 0x0008];
  15295. function decodeBitmapTemplate0(width, height, decodingContext) {
  15296. const decoder = decodingContext.decoder;
  15297. const contexts = decodingContext.contextCache.getContexts("GB");
  15298. const bitmap = [];
  15299. let contextLabel, i, j, pixel, row, row1, row2;
  15300. const OLD_PIXEL_MASK = 0x7bf7;
  15301. for (i = 0; i < height; i++) {
  15302. row = bitmap[i] = new Uint8Array(width);
  15303. row1 = i < 1 ? row : bitmap[i - 1];
  15304. row2 = i < 2 ? row : bitmap[i - 2];
  15305. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  15306. for (j = 0; j < width; j++) {
  15307. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  15308. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  15309. }
  15310. }
  15311. return bitmap;
  15312. }
  15313. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  15314. if (mmr) {
  15315. const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  15316. return decodeMMRBitmap(input, width, height, false);
  15317. }
  15318. if (templateIndex === 0 && !skip && !prediction && at.length === 4 && at[0].x === 3 && at[0].y === -1 && at[1].x === -3 && at[1].y === -1 && at[2].x === 2 && at[2].y === -2 && at[3].x === -2 && at[3].y === -2) {
  15319. return decodeBitmapTemplate0(width, height, decodingContext);
  15320. }
  15321. const useskip = !!skip;
  15322. const template = CodingTemplates[templateIndex].concat(at);
  15323. template.sort(function (a, b) {
  15324. return a.y - b.y || a.x - b.x;
  15325. });
  15326. const templateLength = template.length;
  15327. const templateX = new Int8Array(templateLength);
  15328. const templateY = new Int8Array(templateLength);
  15329. const changingTemplateEntries = [];
  15330. let reuseMask = 0,
  15331. minX = 0,
  15332. maxX = 0,
  15333. minY = 0;
  15334. let c, k;
  15335. for (k = 0; k < templateLength; k++) {
  15336. templateX[k] = template[k].x;
  15337. templateY[k] = template[k].y;
  15338. minX = Math.min(minX, template[k].x);
  15339. maxX = Math.max(maxX, template[k].x);
  15340. minY = Math.min(minY, template[k].y);
  15341. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  15342. reuseMask |= 1 << templateLength - 1 - k;
  15343. } else {
  15344. changingTemplateEntries.push(k);
  15345. }
  15346. }
  15347. const changingEntriesLength = changingTemplateEntries.length;
  15348. const changingTemplateX = new Int8Array(changingEntriesLength);
  15349. const changingTemplateY = new Int8Array(changingEntriesLength);
  15350. const changingTemplateBit = new Uint16Array(changingEntriesLength);
  15351. for (c = 0; c < changingEntriesLength; c++) {
  15352. k = changingTemplateEntries[c];
  15353. changingTemplateX[c] = template[k].x;
  15354. changingTemplateY[c] = template[k].y;
  15355. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  15356. }
  15357. const sbb_left = -minX;
  15358. const sbb_top = -minY;
  15359. const sbb_right = width - maxX;
  15360. const pseudoPixelContext = ReusedContexts[templateIndex];
  15361. let row = new Uint8Array(width);
  15362. const bitmap = [];
  15363. const decoder = decodingContext.decoder;
  15364. const contexts = decodingContext.contextCache.getContexts("GB");
  15365. let ltp = 0,
  15366. j,
  15367. i0,
  15368. j0,
  15369. contextLabel = 0,
  15370. bit,
  15371. shift;
  15372. for (let i = 0; i < height; i++) {
  15373. if (prediction) {
  15374. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  15375. ltp ^= sltp;
  15376. if (ltp) {
  15377. bitmap.push(row);
  15378. continue;
  15379. }
  15380. }
  15381. row = new Uint8Array(row);
  15382. bitmap.push(row);
  15383. for (j = 0; j < width; j++) {
  15384. if (useskip && skip[i][j]) {
  15385. row[j] = 0;
  15386. continue;
  15387. }
  15388. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  15389. contextLabel = contextLabel << 1 & reuseMask;
  15390. for (k = 0; k < changingEntriesLength; k++) {
  15391. i0 = i + changingTemplateY[k];
  15392. j0 = j + changingTemplateX[k];
  15393. bit = bitmap[i0][j0];
  15394. if (bit) {
  15395. bit = changingTemplateBit[k];
  15396. contextLabel |= bit;
  15397. }
  15398. }
  15399. } else {
  15400. contextLabel = 0;
  15401. shift = templateLength - 1;
  15402. for (k = 0; k < templateLength; k++, shift--) {
  15403. j0 = j + templateX[k];
  15404. if (j0 >= 0 && j0 < width) {
  15405. i0 = i + templateY[k];
  15406. if (i0 >= 0) {
  15407. bit = bitmap[i0][j0];
  15408. if (bit) {
  15409. contextLabel |= bit << shift;
  15410. }
  15411. }
  15412. }
  15413. }
  15414. }
  15415. const pixel = decoder.readBit(contexts, contextLabel);
  15416. row[j] = pixel;
  15417. }
  15418. }
  15419. return bitmap;
  15420. }
  15421. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  15422. let codingTemplate = RefinementTemplates[templateIndex].coding;
  15423. if (templateIndex === 0) {
  15424. codingTemplate = codingTemplate.concat([at[0]]);
  15425. }
  15426. const codingTemplateLength = codingTemplate.length;
  15427. const codingTemplateX = new Int32Array(codingTemplateLength);
  15428. const codingTemplateY = new Int32Array(codingTemplateLength);
  15429. let k;
  15430. for (k = 0; k < codingTemplateLength; k++) {
  15431. codingTemplateX[k] = codingTemplate[k].x;
  15432. codingTemplateY[k] = codingTemplate[k].y;
  15433. }
  15434. let referenceTemplate = RefinementTemplates[templateIndex].reference;
  15435. if (templateIndex === 0) {
  15436. referenceTemplate = referenceTemplate.concat([at[1]]);
  15437. }
  15438. const referenceTemplateLength = referenceTemplate.length;
  15439. const referenceTemplateX = new Int32Array(referenceTemplateLength);
  15440. const referenceTemplateY = new Int32Array(referenceTemplateLength);
  15441. for (k = 0; k < referenceTemplateLength; k++) {
  15442. referenceTemplateX[k] = referenceTemplate[k].x;
  15443. referenceTemplateY[k] = referenceTemplate[k].y;
  15444. }
  15445. const referenceWidth = referenceBitmap[0].length;
  15446. const referenceHeight = referenceBitmap.length;
  15447. const pseudoPixelContext = RefinementReusedContexts[templateIndex];
  15448. const bitmap = [];
  15449. const decoder = decodingContext.decoder;
  15450. const contexts = decodingContext.contextCache.getContexts("GR");
  15451. let ltp = 0;
  15452. for (let i = 0; i < height; i++) {
  15453. if (prediction) {
  15454. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  15455. ltp ^= sltp;
  15456. if (ltp) {
  15457. throw new Jbig2Error("prediction is not supported");
  15458. }
  15459. }
  15460. const row = new Uint8Array(width);
  15461. bitmap.push(row);
  15462. for (let j = 0; j < width; j++) {
  15463. let i0, j0;
  15464. let contextLabel = 0;
  15465. for (k = 0; k < codingTemplateLength; k++) {
  15466. i0 = i + codingTemplateY[k];
  15467. j0 = j + codingTemplateX[k];
  15468. if (i0 < 0 || j0 < 0 || j0 >= width) {
  15469. contextLabel <<= 1;
  15470. } else {
  15471. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  15472. }
  15473. }
  15474. for (k = 0; k < referenceTemplateLength; k++) {
  15475. i0 = i + referenceTemplateY[k] - offsetY;
  15476. j0 = j + referenceTemplateX[k] - offsetX;
  15477. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  15478. contextLabel <<= 1;
  15479. } else {
  15480. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  15481. }
  15482. }
  15483. const pixel = decoder.readBit(contexts, contextLabel);
  15484. row[j] = pixel;
  15485. }
  15486. }
  15487. return bitmap;
  15488. }
  15489. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
  15490. if (huffman && refinement) {
  15491. throw new Jbig2Error("symbol refinement with Huffman is not supported");
  15492. }
  15493. const newSymbols = [];
  15494. let currentHeight = 0;
  15495. let symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);
  15496. const decoder = decodingContext.decoder;
  15497. const contextCache = decodingContext.contextCache;
  15498. let tableB1, symbolWidths;
  15499. if (huffman) {
  15500. tableB1 = getStandardTable(1);
  15501. symbolWidths = [];
  15502. symbolCodeLength = Math.max(symbolCodeLength, 1);
  15503. }
  15504. while (newSymbols.length < numberOfNewSymbols) {
  15505. const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
  15506. currentHeight += deltaHeight;
  15507. let currentWidth = 0,
  15508. totalWidth = 0;
  15509. const firstSymbol = huffman ? symbolWidths.length : 0;
  15510. while (true) {
  15511. const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
  15512. if (deltaWidth === null) {
  15513. break;
  15514. }
  15515. currentWidth += deltaWidth;
  15516. totalWidth += currentWidth;
  15517. let bitmap;
  15518. if (refinement) {
  15519. const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
  15520. if (numberOfInstances > 1) {
  15521. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
  15522. } else {
  15523. const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  15524. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  15525. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  15526. const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  15527. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  15528. }
  15529. newSymbols.push(bitmap);
  15530. } else if (huffman) {
  15531. symbolWidths.push(currentWidth);
  15532. } else {
  15533. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  15534. newSymbols.push(bitmap);
  15535. }
  15536. }
  15537. if (huffman && !refinement) {
  15538. const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
  15539. huffmanInput.byteAlign();
  15540. let collectiveBitmap;
  15541. if (bitmapSize === 0) {
  15542. collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
  15543. } else {
  15544. const originalEnd = huffmanInput.end;
  15545. const bitmapEnd = huffmanInput.position + bitmapSize;
  15546. huffmanInput.end = bitmapEnd;
  15547. collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
  15548. huffmanInput.end = originalEnd;
  15549. huffmanInput.position = bitmapEnd;
  15550. }
  15551. const numberOfSymbolsDecoded = symbolWidths.length;
  15552. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  15553. newSymbols.push(collectiveBitmap);
  15554. } else {
  15555. let i,
  15556. y,
  15557. xMin = 0,
  15558. xMax,
  15559. bitmapWidth,
  15560. symbolBitmap;
  15561. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  15562. bitmapWidth = symbolWidths[i];
  15563. xMax = xMin + bitmapWidth;
  15564. symbolBitmap = [];
  15565. for (y = 0; y < currentHeight; y++) {
  15566. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  15567. }
  15568. newSymbols.push(symbolBitmap);
  15569. xMin = xMax;
  15570. }
  15571. }
  15572. }
  15573. }
  15574. const exportedSymbols = [],
  15575. flags = [];
  15576. let currentFlag = false,
  15577. i,
  15578. ii;
  15579. const totalSymbolsLength = symbols.length + numberOfNewSymbols;
  15580. while (flags.length < totalSymbolsLength) {
  15581. let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
  15582. while (runLength--) {
  15583. flags.push(currentFlag);
  15584. }
  15585. currentFlag = !currentFlag;
  15586. }
  15587. for (i = 0, ii = symbols.length; i < ii; i++) {
  15588. if (flags[i]) {
  15589. exportedSymbols.push(symbols[i]);
  15590. }
  15591. }
  15592. for (let j = 0; j < numberOfNewSymbols; i++, j++) {
  15593. if (flags[i]) {
  15594. exportedSymbols.push(newSymbols[j]);
  15595. }
  15596. }
  15597. return exportedSymbols;
  15598. }
  15599. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
  15600. if (huffman && refinement) {
  15601. throw new Jbig2Error("refinement with Huffman is not supported");
  15602. }
  15603. const bitmap = [];
  15604. let i, row;
  15605. for (i = 0; i < height; i++) {
  15606. row = new Uint8Array(width);
  15607. if (defaultPixelValue) {
  15608. for (let j = 0; j < width; j++) {
  15609. row[j] = defaultPixelValue;
  15610. }
  15611. }
  15612. bitmap.push(row);
  15613. }
  15614. const decoder = decodingContext.decoder;
  15615. const contextCache = decodingContext.contextCache;
  15616. let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
  15617. let firstS = 0;
  15618. i = 0;
  15619. while (i < numberOfSymbolInstances) {
  15620. const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
  15621. stripT += deltaT;
  15622. const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
  15623. firstS += deltaFirstS;
  15624. let currentS = firstS;
  15625. do {
  15626. let currentT = 0;
  15627. if (stripSize > 1) {
  15628. currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
  15629. }
  15630. const t = stripSize * stripT + currentT;
  15631. const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
  15632. const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
  15633. let symbolBitmap = inputSymbols[symbolId];
  15634. let symbolWidth = symbolBitmap[0].length;
  15635. let symbolHeight = symbolBitmap.length;
  15636. if (applyRefinement) {
  15637. const rdw = decodeInteger(contextCache, "IARDW", decoder);
  15638. const rdh = decodeInteger(contextCache, "IARDH", decoder);
  15639. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  15640. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  15641. symbolWidth += rdw;
  15642. symbolHeight += rdh;
  15643. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  15644. }
  15645. const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  15646. const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  15647. let s2, t2, symbolRow;
  15648. if (transposed) {
  15649. for (s2 = 0; s2 < symbolHeight; s2++) {
  15650. row = bitmap[offsetS + s2];
  15651. if (!row) {
  15652. continue;
  15653. }
  15654. symbolRow = symbolBitmap[s2];
  15655. const maxWidth = Math.min(width - offsetT, symbolWidth);
  15656. switch (combinationOperator) {
  15657. case 0:
  15658. for (t2 = 0; t2 < maxWidth; t2++) {
  15659. row[offsetT + t2] |= symbolRow[t2];
  15660. }
  15661. break;
  15662. case 2:
  15663. for (t2 = 0; t2 < maxWidth; t2++) {
  15664. row[offsetT + t2] ^= symbolRow[t2];
  15665. }
  15666. break;
  15667. default:
  15668. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  15669. }
  15670. }
  15671. currentS += symbolHeight - 1;
  15672. } else {
  15673. for (t2 = 0; t2 < symbolHeight; t2++) {
  15674. row = bitmap[offsetT + t2];
  15675. if (!row) {
  15676. continue;
  15677. }
  15678. symbolRow = symbolBitmap[t2];
  15679. switch (combinationOperator) {
  15680. case 0:
  15681. for (s2 = 0; s2 < symbolWidth; s2++) {
  15682. row[offsetS + s2] |= symbolRow[s2];
  15683. }
  15684. break;
  15685. case 2:
  15686. for (s2 = 0; s2 < symbolWidth; s2++) {
  15687. row[offsetS + s2] ^= symbolRow[s2];
  15688. }
  15689. break;
  15690. default:
  15691. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  15692. }
  15693. }
  15694. currentS += symbolWidth - 1;
  15695. }
  15696. i++;
  15697. const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
  15698. if (deltaS === null) {
  15699. break;
  15700. }
  15701. currentS += deltaS + dsOffset;
  15702. } while (true);
  15703. }
  15704. return bitmap;
  15705. }
  15706. function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
  15707. const at = [];
  15708. if (!mmr) {
  15709. at.push({
  15710. x: -patternWidth,
  15711. y: 0
  15712. });
  15713. if (template === 0) {
  15714. at.push({
  15715. x: -3,
  15716. y: -1
  15717. }, {
  15718. x: 2,
  15719. y: -2
  15720. }, {
  15721. x: -2,
  15722. y: -2
  15723. });
  15724. }
  15725. }
  15726. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  15727. const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
  15728. const patterns = [];
  15729. for (let i = 0; i <= maxPatternIndex; i++) {
  15730. const patternBitmap = [];
  15731. const xMin = patternWidth * i;
  15732. const xMax = xMin + patternWidth;
  15733. for (let y = 0; y < patternHeight; y++) {
  15734. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  15735. }
  15736. patterns.push(patternBitmap);
  15737. }
  15738. return patterns;
  15739. }
  15740. function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
  15741. const skip = null;
  15742. if (enableSkip) {
  15743. throw new Jbig2Error("skip is not supported");
  15744. }
  15745. if (combinationOperator !== 0) {
  15746. throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`);
  15747. }
  15748. const regionBitmap = [];
  15749. let i, j, row;
  15750. for (i = 0; i < regionHeight; i++) {
  15751. row = new Uint8Array(regionWidth);
  15752. if (defaultPixelValue) {
  15753. for (j = 0; j < regionWidth; j++) {
  15754. row[j] = defaultPixelValue;
  15755. }
  15756. }
  15757. regionBitmap.push(row);
  15758. }
  15759. const numberOfPatterns = patterns.length;
  15760. const pattern0 = patterns[0];
  15761. const patternWidth = pattern0[0].length,
  15762. patternHeight = pattern0.length;
  15763. const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
  15764. const at = [];
  15765. if (!mmr) {
  15766. at.push({
  15767. x: template <= 1 ? 3 : 2,
  15768. y: -1
  15769. });
  15770. if (template === 0) {
  15771. at.push({
  15772. x: -3,
  15773. y: -1
  15774. }, {
  15775. x: 2,
  15776. y: -2
  15777. }, {
  15778. x: -2,
  15779. y: -2
  15780. });
  15781. }
  15782. }
  15783. const grayScaleBitPlanes = [];
  15784. let mmrInput, bitmap;
  15785. if (mmr) {
  15786. mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  15787. }
  15788. for (i = bitsPerValue - 1; i >= 0; i--) {
  15789. if (mmr) {
  15790. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  15791. } else {
  15792. bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
  15793. }
  15794. grayScaleBitPlanes[i] = bitmap;
  15795. }
  15796. let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
  15797. for (mg = 0; mg < gridHeight; mg++) {
  15798. for (ng = 0; ng < gridWidth; ng++) {
  15799. bit = 0;
  15800. patternIndex = 0;
  15801. for (j = bitsPerValue - 1; j >= 0; j--) {
  15802. bit ^= grayScaleBitPlanes[j][mg][ng];
  15803. patternIndex |= bit << j;
  15804. }
  15805. patternBitmap = patterns[patternIndex];
  15806. x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
  15807. y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
  15808. if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
  15809. for (i = 0; i < patternHeight; i++) {
  15810. regionRow = regionBitmap[y + i];
  15811. patternRow = patternBitmap[i];
  15812. for (j = 0; j < patternWidth; j++) {
  15813. regionRow[x + j] |= patternRow[j];
  15814. }
  15815. }
  15816. } else {
  15817. let regionX, regionY;
  15818. for (i = 0; i < patternHeight; i++) {
  15819. regionY = y + i;
  15820. if (regionY < 0 || regionY >= regionHeight) {
  15821. continue;
  15822. }
  15823. regionRow = regionBitmap[regionY];
  15824. patternRow = patternBitmap[i];
  15825. for (j = 0; j < patternWidth; j++) {
  15826. regionX = x + j;
  15827. if (regionX >= 0 && regionX < regionWidth) {
  15828. regionRow[regionX] |= patternRow[j];
  15829. }
  15830. }
  15831. }
  15832. }
  15833. }
  15834. }
  15835. return regionBitmap;
  15836. }
  15837. function readSegmentHeader(data, start) {
  15838. const segmentHeader = {};
  15839. segmentHeader.number = (0, _core_utils.readUint32)(data, start);
  15840. const flags = data[start + 4];
  15841. const segmentType = flags & 0x3f;
  15842. if (!SegmentTypes[segmentType]) {
  15843. throw new Jbig2Error("invalid segment type: " + segmentType);
  15844. }
  15845. segmentHeader.type = segmentType;
  15846. segmentHeader.typeName = SegmentTypes[segmentType];
  15847. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  15848. const pageAssociationFieldSize = !!(flags & 0x40);
  15849. const referredFlags = data[start + 5];
  15850. let referredToCount = referredFlags >> 5 & 7;
  15851. const retainBits = [referredFlags & 31];
  15852. let position = start + 6;
  15853. if (referredFlags === 7) {
  15854. referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;
  15855. position += 3;
  15856. let bytes = referredToCount + 7 >> 3;
  15857. retainBits[0] = data[position++];
  15858. while (--bytes > 0) {
  15859. retainBits.push(data[position++]);
  15860. }
  15861. } else if (referredFlags === 5 || referredFlags === 6) {
  15862. throw new Jbig2Error("invalid referred-to flags");
  15863. }
  15864. segmentHeader.retainBits = retainBits;
  15865. let referredToSegmentNumberSize = 4;
  15866. if (segmentHeader.number <= 256) {
  15867. referredToSegmentNumberSize = 1;
  15868. } else if (segmentHeader.number <= 65536) {
  15869. referredToSegmentNumberSize = 2;
  15870. }
  15871. const referredTo = [];
  15872. let i, ii;
  15873. for (i = 0; i < referredToCount; i++) {
  15874. let number;
  15875. if (referredToSegmentNumberSize === 1) {
  15876. number = data[position];
  15877. } else if (referredToSegmentNumberSize === 2) {
  15878. number = (0, _core_utils.readUint16)(data, position);
  15879. } else {
  15880. number = (0, _core_utils.readUint32)(data, position);
  15881. }
  15882. referredTo.push(number);
  15883. position += referredToSegmentNumberSize;
  15884. }
  15885. segmentHeader.referredTo = referredTo;
  15886. if (!pageAssociationFieldSize) {
  15887. segmentHeader.pageAssociation = data[position++];
  15888. } else {
  15889. segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position);
  15890. position += 4;
  15891. }
  15892. segmentHeader.length = (0, _core_utils.readUint32)(data, position);
  15893. position += 4;
  15894. if (segmentHeader.length === 0xffffffff) {
  15895. if (segmentType === 38) {
  15896. const genericRegionInfo = readRegionSegmentInformation(data, position);
  15897. const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  15898. const genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  15899. const searchPatternLength = 6;
  15900. const searchPattern = new Uint8Array(searchPatternLength);
  15901. if (!genericRegionMmr) {
  15902. searchPattern[0] = 0xff;
  15903. searchPattern[1] = 0xac;
  15904. }
  15905. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
  15906. searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
  15907. searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
  15908. searchPattern[5] = genericRegionInfo.height & 0xff;
  15909. for (i = position, ii = data.length; i < ii; i++) {
  15910. let j = 0;
  15911. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  15912. j++;
  15913. }
  15914. if (j === searchPatternLength) {
  15915. segmentHeader.length = i + searchPatternLength;
  15916. break;
  15917. }
  15918. }
  15919. if (segmentHeader.length === 0xffffffff) {
  15920. throw new Jbig2Error("segment end was not found");
  15921. }
  15922. } else {
  15923. throw new Jbig2Error("invalid unknown segment length");
  15924. }
  15925. }
  15926. segmentHeader.headerEnd = position;
  15927. return segmentHeader;
  15928. }
  15929. function readSegments(header, data, start, end) {
  15930. const segments = [];
  15931. let position = start;
  15932. while (position < end) {
  15933. const segmentHeader = readSegmentHeader(data, position);
  15934. position = segmentHeader.headerEnd;
  15935. const segment = {
  15936. header: segmentHeader,
  15937. data
  15938. };
  15939. if (!header.randomAccess) {
  15940. segment.start = position;
  15941. position += segmentHeader.length;
  15942. segment.end = position;
  15943. }
  15944. segments.push(segment);
  15945. if (segmentHeader.type === 51) {
  15946. break;
  15947. }
  15948. }
  15949. if (header.randomAccess) {
  15950. for (let i = 0, ii = segments.length; i < ii; i++) {
  15951. segments[i].start = position;
  15952. position += segments[i].header.length;
  15953. segments[i].end = position;
  15954. }
  15955. }
  15956. return segments;
  15957. }
  15958. function readRegionSegmentInformation(data, start) {
  15959. return {
  15960. width: (0, _core_utils.readUint32)(data, start),
  15961. height: (0, _core_utils.readUint32)(data, start + 4),
  15962. x: (0, _core_utils.readUint32)(data, start + 8),
  15963. y: (0, _core_utils.readUint32)(data, start + 12),
  15964. combinationOperator: data[start + 16] & 7
  15965. };
  15966. }
  15967. const RegionSegmentInformationFieldLength = 17;
  15968. function processSegment(segment, visitor) {
  15969. const header = segment.header;
  15970. const data = segment.data,
  15971. end = segment.end;
  15972. let position = segment.start;
  15973. let args, at, i, atLength;
  15974. switch (header.type) {
  15975. case 0:
  15976. const dictionary = {};
  15977. const dictionaryFlags = (0, _core_utils.readUint16)(data, position);
  15978. dictionary.huffman = !!(dictionaryFlags & 1);
  15979. dictionary.refinement = !!(dictionaryFlags & 2);
  15980. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  15981. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  15982. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  15983. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  15984. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  15985. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  15986. dictionary.template = dictionaryFlags >> 10 & 3;
  15987. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  15988. position += 2;
  15989. if (!dictionary.huffman) {
  15990. atLength = dictionary.template === 0 ? 4 : 1;
  15991. at = [];
  15992. for (i = 0; i < atLength; i++) {
  15993. at.push({
  15994. x: (0, _core_utils.readInt8)(data, position),
  15995. y: (0, _core_utils.readInt8)(data, position + 1)
  15996. });
  15997. position += 2;
  15998. }
  15999. dictionary.at = at;
  16000. }
  16001. if (dictionary.refinement && !dictionary.refinementTemplate) {
  16002. at = [];
  16003. for (i = 0; i < 2; i++) {
  16004. at.push({
  16005. x: (0, _core_utils.readInt8)(data, position),
  16006. y: (0, _core_utils.readInt8)(data, position + 1)
  16007. });
  16008. position += 2;
  16009. }
  16010. dictionary.refinementAt = at;
  16011. }
  16012. dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position);
  16013. position += 4;
  16014. dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position);
  16015. position += 4;
  16016. args = [dictionary, header.number, header.referredTo, data, position, end];
  16017. break;
  16018. case 6:
  16019. case 7:
  16020. const textRegion = {};
  16021. textRegion.info = readRegionSegmentInformation(data, position);
  16022. position += RegionSegmentInformationFieldLength;
  16023. const textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position);
  16024. position += 2;
  16025. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  16026. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  16027. textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
  16028. textRegion.stripSize = 1 << textRegion.logStripSize;
  16029. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  16030. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  16031. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  16032. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  16033. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  16034. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  16035. if (textRegion.huffman) {
  16036. const textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position);
  16037. position += 2;
  16038. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  16039. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  16040. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  16041. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  16042. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  16043. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  16044. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  16045. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
  16046. }
  16047. if (textRegion.refinement && !textRegion.refinementTemplate) {
  16048. at = [];
  16049. for (i = 0; i < 2; i++) {
  16050. at.push({
  16051. x: (0, _core_utils.readInt8)(data, position),
  16052. y: (0, _core_utils.readInt8)(data, position + 1)
  16053. });
  16054. position += 2;
  16055. }
  16056. textRegion.refinementAt = at;
  16057. }
  16058. textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position);
  16059. position += 4;
  16060. args = [textRegion, header.referredTo, data, position, end];
  16061. break;
  16062. case 16:
  16063. const patternDictionary = {};
  16064. const patternDictionaryFlags = data[position++];
  16065. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  16066. patternDictionary.template = patternDictionaryFlags >> 1 & 3;
  16067. patternDictionary.patternWidth = data[position++];
  16068. patternDictionary.patternHeight = data[position++];
  16069. patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position);
  16070. position += 4;
  16071. args = [patternDictionary, header.number, data, position, end];
  16072. break;
  16073. case 22:
  16074. case 23:
  16075. const halftoneRegion = {};
  16076. halftoneRegion.info = readRegionSegmentInformation(data, position);
  16077. position += RegionSegmentInformationFieldLength;
  16078. const halftoneRegionFlags = data[position++];
  16079. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  16080. halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
  16081. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  16082. halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
  16083. halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
  16084. halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position);
  16085. position += 4;
  16086. halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position);
  16087. position += 4;
  16088. halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  16089. position += 4;
  16090. halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  16091. position += 4;
  16092. halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position);
  16093. position += 2;
  16094. halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position);
  16095. position += 2;
  16096. args = [halftoneRegion, header.referredTo, data, position, end];
  16097. break;
  16098. case 38:
  16099. case 39:
  16100. const genericRegion = {};
  16101. genericRegion.info = readRegionSegmentInformation(data, position);
  16102. position += RegionSegmentInformationFieldLength;
  16103. const genericRegionSegmentFlags = data[position++];
  16104. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  16105. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  16106. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  16107. if (!genericRegion.mmr) {
  16108. atLength = genericRegion.template === 0 ? 4 : 1;
  16109. at = [];
  16110. for (i = 0; i < atLength; i++) {
  16111. at.push({
  16112. x: (0, _core_utils.readInt8)(data, position),
  16113. y: (0, _core_utils.readInt8)(data, position + 1)
  16114. });
  16115. position += 2;
  16116. }
  16117. genericRegion.at = at;
  16118. }
  16119. args = [genericRegion, data, position, end];
  16120. break;
  16121. case 48:
  16122. const pageInfo = {
  16123. width: (0, _core_utils.readUint32)(data, position),
  16124. height: (0, _core_utils.readUint32)(data, position + 4),
  16125. resolutionX: (0, _core_utils.readUint32)(data, position + 8),
  16126. resolutionY: (0, _core_utils.readUint32)(data, position + 12)
  16127. };
  16128. if (pageInfo.height === 0xffffffff) {
  16129. delete pageInfo.height;
  16130. }
  16131. const pageSegmentFlags = data[position + 16];
  16132. (0, _core_utils.readUint16)(data, position + 17);
  16133. pageInfo.lossless = !!(pageSegmentFlags & 1);
  16134. pageInfo.refinement = !!(pageSegmentFlags & 2);
  16135. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  16136. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  16137. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  16138. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  16139. args = [pageInfo];
  16140. break;
  16141. case 49:
  16142. break;
  16143. case 50:
  16144. break;
  16145. case 51:
  16146. break;
  16147. case 53:
  16148. args = [header.number, data, position, end];
  16149. break;
  16150. case 62:
  16151. break;
  16152. default:
  16153. throw new Jbig2Error(`segment type ${header.typeName}(${header.type}) is not implemented`);
  16154. }
  16155. const callbackName = "on" + header.typeName;
  16156. if (callbackName in visitor) {
  16157. visitor[callbackName].apply(visitor, args);
  16158. }
  16159. }
  16160. function processSegments(segments, visitor) {
  16161. for (let i = 0, ii = segments.length; i < ii; i++) {
  16162. processSegment(segments[i], visitor);
  16163. }
  16164. }
  16165. function parseJbig2Chunks(chunks) {
  16166. const visitor = new SimpleSegmentVisitor();
  16167. for (let i = 0, ii = chunks.length; i < ii; i++) {
  16168. const chunk = chunks[i];
  16169. const segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  16170. processSegments(segments, visitor);
  16171. }
  16172. return visitor.buffer;
  16173. }
  16174. function parseJbig2(data) {
  16175. throw new Error("Not implemented: parseJbig2");
  16176. }
  16177. class SimpleSegmentVisitor {
  16178. onPageInformation(info) {
  16179. this.currentPageInfo = info;
  16180. const rowSize = info.width + 7 >> 3;
  16181. const buffer = new Uint8ClampedArray(rowSize * info.height);
  16182. if (info.defaultPixelValue) {
  16183. buffer.fill(0xff);
  16184. }
  16185. this.buffer = buffer;
  16186. }
  16187. drawBitmap(regionInfo, bitmap) {
  16188. const pageInfo = this.currentPageInfo;
  16189. const width = regionInfo.width,
  16190. height = regionInfo.height;
  16191. const rowSize = pageInfo.width + 7 >> 3;
  16192. const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  16193. const buffer = this.buffer;
  16194. const mask0 = 128 >> (regionInfo.x & 7);
  16195. let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  16196. let i, j, mask, offset;
  16197. switch (combinationOperator) {
  16198. case 0:
  16199. for (i = 0; i < height; i++) {
  16200. mask = mask0;
  16201. offset = offset0;
  16202. for (j = 0; j < width; j++) {
  16203. if (bitmap[i][j]) {
  16204. buffer[offset] |= mask;
  16205. }
  16206. mask >>= 1;
  16207. if (!mask) {
  16208. mask = 128;
  16209. offset++;
  16210. }
  16211. }
  16212. offset0 += rowSize;
  16213. }
  16214. break;
  16215. case 2:
  16216. for (i = 0; i < height; i++) {
  16217. mask = mask0;
  16218. offset = offset0;
  16219. for (j = 0; j < width; j++) {
  16220. if (bitmap[i][j]) {
  16221. buffer[offset] ^= mask;
  16222. }
  16223. mask >>= 1;
  16224. if (!mask) {
  16225. mask = 128;
  16226. offset++;
  16227. }
  16228. }
  16229. offset0 += rowSize;
  16230. }
  16231. break;
  16232. default:
  16233. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  16234. }
  16235. }
  16236. onImmediateGenericRegion(region, data, start, end) {
  16237. const regionInfo = region.info;
  16238. const decodingContext = new DecodingContext(data, start, end);
  16239. const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  16240. this.drawBitmap(regionInfo, bitmap);
  16241. }
  16242. onImmediateLosslessGenericRegion() {
  16243. this.onImmediateGenericRegion(...arguments);
  16244. }
  16245. onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  16246. let huffmanTables, huffmanInput;
  16247. if (dictionary.huffman) {
  16248. huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
  16249. huffmanInput = new Reader(data, start, end);
  16250. }
  16251. let symbols = this.symbols;
  16252. if (!symbols) {
  16253. this.symbols = symbols = {};
  16254. }
  16255. const inputSymbols = [];
  16256. for (const referredSegment of referredSegments) {
  16257. const referredSymbols = symbols[referredSegment];
  16258. if (referredSymbols) {
  16259. inputSymbols.push(...referredSymbols);
  16260. }
  16261. }
  16262. const decodingContext = new DecodingContext(data, start, end);
  16263. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
  16264. }
  16265. onImmediateTextRegion(region, referredSegments, data, start, end) {
  16266. const regionInfo = region.info;
  16267. let huffmanTables, huffmanInput;
  16268. const symbols = this.symbols;
  16269. const inputSymbols = [];
  16270. for (const referredSegment of referredSegments) {
  16271. const referredSymbols = symbols[referredSegment];
  16272. if (referredSymbols) {
  16273. inputSymbols.push(...referredSymbols);
  16274. }
  16275. }
  16276. const symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);
  16277. if (region.huffman) {
  16278. huffmanInput = new Reader(data, start, end);
  16279. huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
  16280. }
  16281. const decodingContext = new DecodingContext(data, start, end);
  16282. const bitmap = decodeTextRegion(region.huffman, region.refinement, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.numberOfSymbolInstances, region.stripSize, inputSymbols, symbolCodeLength, region.transposed, region.dsOffset, region.referenceCorner, region.combinationOperator, huffmanTables, region.refinementTemplate, region.refinementAt, decodingContext, region.logStripSize, huffmanInput);
  16283. this.drawBitmap(regionInfo, bitmap);
  16284. }
  16285. onImmediateLosslessTextRegion() {
  16286. this.onImmediateTextRegion(...arguments);
  16287. }
  16288. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  16289. let patterns = this.patterns;
  16290. if (!patterns) {
  16291. this.patterns = patterns = {};
  16292. }
  16293. const decodingContext = new DecodingContext(data, start, end);
  16294. patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
  16295. }
  16296. onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
  16297. const patterns = this.patterns[referredSegments[0]];
  16298. const regionInfo = region.info;
  16299. const decodingContext = new DecodingContext(data, start, end);
  16300. const bitmap = decodeHalftoneRegion(region.mmr, patterns, region.template, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.enableSkip, region.combinationOperator, region.gridWidth, region.gridHeight, region.gridOffsetX, region.gridOffsetY, region.gridVectorX, region.gridVectorY, decodingContext);
  16301. this.drawBitmap(regionInfo, bitmap);
  16302. }
  16303. onImmediateLosslessHalftoneRegion() {
  16304. this.onImmediateHalftoneRegion(...arguments);
  16305. }
  16306. onTables(currentSegment, data, start, end) {
  16307. let customTables = this.customTables;
  16308. if (!customTables) {
  16309. this.customTables = customTables = {};
  16310. }
  16311. customTables[currentSegment] = decodeTablesSegment(data, start, end);
  16312. }
  16313. }
  16314. class HuffmanLine {
  16315. constructor(lineData) {
  16316. if (lineData.length === 2) {
  16317. this.isOOB = true;
  16318. this.rangeLow = 0;
  16319. this.prefixLength = lineData[0];
  16320. this.rangeLength = 0;
  16321. this.prefixCode = lineData[1];
  16322. this.isLowerRange = false;
  16323. } else {
  16324. this.isOOB = false;
  16325. this.rangeLow = lineData[0];
  16326. this.prefixLength = lineData[1];
  16327. this.rangeLength = lineData[2];
  16328. this.prefixCode = lineData[3];
  16329. this.isLowerRange = lineData[4] === "lower";
  16330. }
  16331. }
  16332. }
  16333. class HuffmanTreeNode {
  16334. constructor(line) {
  16335. this.children = [];
  16336. if (line) {
  16337. this.isLeaf = true;
  16338. this.rangeLength = line.rangeLength;
  16339. this.rangeLow = line.rangeLow;
  16340. this.isLowerRange = line.isLowerRange;
  16341. this.isOOB = line.isOOB;
  16342. } else {
  16343. this.isLeaf = false;
  16344. }
  16345. }
  16346. buildTree(line, shift) {
  16347. const bit = line.prefixCode >> shift & 1;
  16348. if (shift <= 0) {
  16349. this.children[bit] = new HuffmanTreeNode(line);
  16350. } else {
  16351. let node = this.children[bit];
  16352. if (!node) {
  16353. this.children[bit] = node = new HuffmanTreeNode(null);
  16354. }
  16355. node.buildTree(line, shift - 1);
  16356. }
  16357. }
  16358. decodeNode(reader) {
  16359. if (this.isLeaf) {
  16360. if (this.isOOB) {
  16361. return null;
  16362. }
  16363. const htOffset = reader.readBits(this.rangeLength);
  16364. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  16365. }
  16366. const node = this.children[reader.readBit()];
  16367. if (!node) {
  16368. throw new Jbig2Error("invalid Huffman data");
  16369. }
  16370. return node.decodeNode(reader);
  16371. }
  16372. }
  16373. class HuffmanTable {
  16374. constructor(lines, prefixCodesDone) {
  16375. if (!prefixCodesDone) {
  16376. this.assignPrefixCodes(lines);
  16377. }
  16378. this.rootNode = new HuffmanTreeNode(null);
  16379. for (let i = 0, ii = lines.length; i < ii; i++) {
  16380. const line = lines[i];
  16381. if (line.prefixLength > 0) {
  16382. this.rootNode.buildTree(line, line.prefixLength - 1);
  16383. }
  16384. }
  16385. }
  16386. decode(reader) {
  16387. return this.rootNode.decodeNode(reader);
  16388. }
  16389. assignPrefixCodes(lines) {
  16390. const linesLength = lines.length;
  16391. let prefixLengthMax = 0;
  16392. for (let i = 0; i < linesLength; i++) {
  16393. prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
  16394. }
  16395. const histogram = new Uint32Array(prefixLengthMax + 1);
  16396. for (let i = 0; i < linesLength; i++) {
  16397. histogram[lines[i].prefixLength]++;
  16398. }
  16399. let currentLength = 1,
  16400. firstCode = 0,
  16401. currentCode,
  16402. currentTemp,
  16403. line;
  16404. histogram[0] = 0;
  16405. while (currentLength <= prefixLengthMax) {
  16406. firstCode = firstCode + histogram[currentLength - 1] << 1;
  16407. currentCode = firstCode;
  16408. currentTemp = 0;
  16409. while (currentTemp < linesLength) {
  16410. line = lines[currentTemp];
  16411. if (line.prefixLength === currentLength) {
  16412. line.prefixCode = currentCode;
  16413. currentCode++;
  16414. }
  16415. currentTemp++;
  16416. }
  16417. currentLength++;
  16418. }
  16419. }
  16420. }
  16421. function decodeTablesSegment(data, start, end) {
  16422. const flags = data[start];
  16423. const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
  16424. const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
  16425. const reader = new Reader(data, start + 9, end);
  16426. const prefixSizeBits = (flags >> 1 & 7) + 1;
  16427. const rangeSizeBits = (flags >> 4 & 7) + 1;
  16428. const lines = [];
  16429. let prefixLength,
  16430. rangeLength,
  16431. currentRangeLow = lowestValue;
  16432. do {
  16433. prefixLength = reader.readBits(prefixSizeBits);
  16434. rangeLength = reader.readBits(rangeSizeBits);
  16435. lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
  16436. currentRangeLow += 1 << rangeLength;
  16437. } while (currentRangeLow < highestValue);
  16438. prefixLength = reader.readBits(prefixSizeBits);
  16439. lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
  16440. prefixLength = reader.readBits(prefixSizeBits);
  16441. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  16442. if (flags & 1) {
  16443. prefixLength = reader.readBits(prefixSizeBits);
  16444. lines.push(new HuffmanLine([prefixLength, 0]));
  16445. }
  16446. return new HuffmanTable(lines, false);
  16447. }
  16448. const standardTablesCache = {};
  16449. function getStandardTable(number) {
  16450. let table = standardTablesCache[number];
  16451. if (table) {
  16452. return table;
  16453. }
  16454. let lines;
  16455. switch (number) {
  16456. case 1:
  16457. lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
  16458. break;
  16459. case 2:
  16460. lines = [[0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xe], [11, 5, 6, 0x1e], [75, 6, 32, 0x3e], [6, 0x3f]];
  16461. break;
  16462. case 3:
  16463. lines = [[-256, 8, 8, 0xfe], [0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xe], [11, 5, 6, 0x1e], [-257, 8, 32, 0xff, "lower"], [75, 7, 32, 0x7e], [6, 0x3e]];
  16464. break;
  16465. case 4:
  16466. lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xe], [12, 5, 6, 0x1e], [76, 5, 32, 0x1f]];
  16467. break;
  16468. case 5:
  16469. lines = [[-255, 7, 8, 0x7e], [1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xe], [12, 5, 6, 0x1e], [-256, 7, 32, 0x7f, "lower"], [76, 6, 32, 0x3e]];
  16470. break;
  16471. case 6:
  16472. lines = [[-2048, 5, 10, 0x1c], [-1024, 4, 9, 0x8], [-512, 4, 8, 0x9], [-256, 4, 7, 0xa], [-128, 5, 6, 0x1d], [-64, 5, 5, 0x1e], [-32, 4, 5, 0xb], [0, 2, 7, 0x0], [128, 3, 7, 0x2], [256, 3, 8, 0x3], [512, 4, 9, 0xc], [1024, 4, 10, 0xd], [-2049, 6, 32, 0x3e, "lower"], [2048, 6, 32, 0x3f]];
  16473. break;
  16474. case 7:
  16475. lines = [[-1024, 4, 9, 0x8], [-512, 3, 8, 0x0], [-256, 4, 7, 0x9], [-128, 5, 6, 0x1a], [-64, 5, 5, 0x1b], [-32, 4, 5, 0xa], [0, 4, 5, 0xb], [32, 5, 5, 0x1c], [64, 5, 6, 0x1d], [128, 4, 7, 0xc], [256, 3, 8, 0x1], [512, 3, 9, 0x2], [1024, 3, 10, 0x3], [-1025, 5, 32, 0x1e, "lower"], [2048, 5, 32, 0x1f]];
  16476. break;
  16477. case 8:
  16478. lines = [[-15, 8, 3, 0xfc], [-7, 9, 1, 0x1fc], [-5, 8, 1, 0xfd], [-3, 9, 0, 0x1fd], [-2, 7, 0, 0x7c], [-1, 4, 0, 0xa], [0, 2, 1, 0x0], [2, 5, 0, 0x1a], [3, 6, 0, 0x3a], [4, 3, 4, 0x4], [20, 6, 1, 0x3b], [22, 4, 4, 0xb], [38, 4, 5, 0xc], [70, 5, 6, 0x1b], [134, 5, 7, 0x1c], [262, 6, 7, 0x3c], [390, 7, 8, 0x7d], [646, 6, 10, 0x3d], [-16, 9, 32, 0x1fe, "lower"], [1670, 9, 32, 0x1ff], [2, 0x1]];
  16479. break;
  16480. case 9:
  16481. lines = [[-31, 8, 4, 0xfc], [-15, 9, 2, 0x1fc], [-11, 8, 2, 0xfd], [-7, 9, 1, 0x1fd], [-5, 7, 1, 0x7c], [-3, 4, 1, 0xa], [-1, 3, 1, 0x2], [1, 3, 1, 0x3], [3, 5, 1, 0x1a], [5, 6, 1, 0x3a], [7, 3, 5, 0x4], [39, 6, 2, 0x3b], [43, 4, 5, 0xb], [75, 4, 6, 0xc], [139, 5, 7, 0x1b], [267, 5, 8, 0x1c], [523, 6, 8, 0x3c], [779, 7, 9, 0x7d], [1291, 6, 11, 0x3d], [-32, 9, 32, 0x1fe, "lower"], [3339, 9, 32, 0x1ff], [2, 0x0]];
  16482. break;
  16483. case 10:
  16484. lines = [[-21, 7, 4, 0x7a], [-5, 8, 0, 0xfc], [-4, 7, 0, 0x7b], [-3, 5, 0, 0x18], [-2, 2, 2, 0x0], [2, 5, 0, 0x19], [3, 6, 0, 0x36], [4, 7, 0, 0x7c], [5, 8, 0, 0xfd], [6, 2, 6, 0x1], [70, 5, 5, 0x1a], [102, 6, 5, 0x37], [134, 6, 6, 0x38], [198, 6, 7, 0x39], [326, 6, 8, 0x3a], [582, 6, 9, 0x3b], [1094, 6, 10, 0x3c], [2118, 7, 11, 0x7d], [-22, 8, 32, 0xfe, "lower"], [4166, 8, 32, 0xff], [2, 0x2]];
  16485. break;
  16486. case 11:
  16487. lines = [[1, 1, 0, 0x0], [2, 2, 1, 0x2], [4, 4, 0, 0xc], [5, 4, 1, 0xd], [7, 5, 1, 0x1c], [9, 5, 2, 0x1d], [13, 6, 2, 0x3c], [17, 7, 2, 0x7a], [21, 7, 3, 0x7b], [29, 7, 4, 0x7c], [45, 7, 5, 0x7d], [77, 7, 6, 0x7e], [141, 7, 32, 0x7f]];
  16488. break;
  16489. case 12:
  16490. lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 1, 0x6], [5, 5, 0, 0x1c], [6, 5, 1, 0x1d], [8, 6, 1, 0x3c], [10, 7, 0, 0x7a], [11, 7, 1, 0x7b], [13, 7, 2, 0x7c], [17, 7, 3, 0x7d], [25, 7, 4, 0x7e], [41, 8, 5, 0xfe], [73, 8, 32, 0xff]];
  16491. break;
  16492. case 13:
  16493. lines = [[1, 1, 0, 0x0], [2, 3, 0, 0x4], [3, 4, 0, 0xc], [4, 5, 0, 0x1c], [5, 4, 1, 0xd], [7, 3, 3, 0x5], [15, 6, 1, 0x3a], [17, 6, 2, 0x3b], [21, 6, 3, 0x3c], [29, 6, 4, 0x3d], [45, 6, 5, 0x3e], [77, 7, 6, 0x7e], [141, 7, 32, 0x7f]];
  16494. break;
  16495. case 14:
  16496. lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
  16497. break;
  16498. case 15:
  16499. lines = [[-24, 7, 4, 0x7c], [-8, 6, 2, 0x3c], [-4, 5, 1, 0x1c], [-2, 4, 0, 0xc], [-1, 3, 0, 0x4], [0, 1, 0, 0x0], [1, 3, 0, 0x5], [2, 4, 0, 0xd], [3, 5, 1, 0x1d], [5, 6, 2, 0x3d], [9, 7, 4, 0x7d], [-25, 7, 32, 0x7e, "lower"], [25, 7, 32, 0x7f]];
  16500. break;
  16501. default:
  16502. throw new Jbig2Error(`standard table B.${number} does not exist`);
  16503. }
  16504. for (let i = 0, ii = lines.length; i < ii; i++) {
  16505. lines[i] = new HuffmanLine(lines[i]);
  16506. }
  16507. table = new HuffmanTable(lines, true);
  16508. standardTablesCache[number] = table;
  16509. return table;
  16510. }
  16511. class Reader {
  16512. constructor(data, start, end) {
  16513. this.data = data;
  16514. this.start = start;
  16515. this.end = end;
  16516. this.position = start;
  16517. this.shift = -1;
  16518. this.currentByte = 0;
  16519. }
  16520. readBit() {
  16521. if (this.shift < 0) {
  16522. if (this.position >= this.end) {
  16523. throw new Jbig2Error("end of data while reading bit");
  16524. }
  16525. this.currentByte = this.data[this.position++];
  16526. this.shift = 7;
  16527. }
  16528. const bit = this.currentByte >> this.shift & 1;
  16529. this.shift--;
  16530. return bit;
  16531. }
  16532. readBits(numBits) {
  16533. let result = 0,
  16534. i;
  16535. for (i = numBits - 1; i >= 0; i--) {
  16536. result |= this.readBit() << i;
  16537. }
  16538. return result;
  16539. }
  16540. byteAlign() {
  16541. this.shift = -1;
  16542. }
  16543. next() {
  16544. if (this.position >= this.end) {
  16545. return -1;
  16546. }
  16547. return this.data[this.position++];
  16548. }
  16549. }
  16550. function getCustomHuffmanTable(index, referredTo, customTables) {
  16551. let currentIndex = 0;
  16552. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  16553. const table = customTables[referredTo[i]];
  16554. if (table) {
  16555. if (index === currentIndex) {
  16556. return table;
  16557. }
  16558. currentIndex++;
  16559. }
  16560. }
  16561. throw new Jbig2Error("can't find custom Huffman table");
  16562. }
  16563. function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
  16564. const codes = [];
  16565. for (let i = 0; i <= 34; i++) {
  16566. const codeLength = reader.readBits(4);
  16567. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  16568. }
  16569. const runCodesTable = new HuffmanTable(codes, false);
  16570. codes.length = 0;
  16571. for (let i = 0; i < numberOfSymbols;) {
  16572. const codeLength = runCodesTable.decode(reader);
  16573. if (codeLength >= 32) {
  16574. let repeatedLength, numberOfRepeats, j;
  16575. switch (codeLength) {
  16576. case 32:
  16577. if (i === 0) {
  16578. throw new Jbig2Error("no previous value in symbol ID table");
  16579. }
  16580. numberOfRepeats = reader.readBits(2) + 3;
  16581. repeatedLength = codes[i - 1].prefixLength;
  16582. break;
  16583. case 33:
  16584. numberOfRepeats = reader.readBits(3) + 3;
  16585. repeatedLength = 0;
  16586. break;
  16587. case 34:
  16588. numberOfRepeats = reader.readBits(7) + 11;
  16589. repeatedLength = 0;
  16590. break;
  16591. default:
  16592. throw new Jbig2Error("invalid code length in symbol ID table");
  16593. }
  16594. for (j = 0; j < numberOfRepeats; j++) {
  16595. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  16596. i++;
  16597. }
  16598. } else {
  16599. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  16600. i++;
  16601. }
  16602. }
  16603. reader.byteAlign();
  16604. const symbolIDTable = new HuffmanTable(codes, false);
  16605. let customIndex = 0,
  16606. tableFirstS,
  16607. tableDeltaS,
  16608. tableDeltaT;
  16609. switch (textRegion.huffmanFS) {
  16610. case 0:
  16611. case 1:
  16612. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  16613. break;
  16614. case 3:
  16615. tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16616. customIndex++;
  16617. break;
  16618. default:
  16619. throw new Jbig2Error("invalid Huffman FS selector");
  16620. }
  16621. switch (textRegion.huffmanDS) {
  16622. case 0:
  16623. case 1:
  16624. case 2:
  16625. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  16626. break;
  16627. case 3:
  16628. tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16629. customIndex++;
  16630. break;
  16631. default:
  16632. throw new Jbig2Error("invalid Huffman DS selector");
  16633. }
  16634. switch (textRegion.huffmanDT) {
  16635. case 0:
  16636. case 1:
  16637. case 2:
  16638. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  16639. break;
  16640. case 3:
  16641. tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16642. customIndex++;
  16643. break;
  16644. default:
  16645. throw new Jbig2Error("invalid Huffman DT selector");
  16646. }
  16647. if (textRegion.refinement) {
  16648. throw new Jbig2Error("refinement with Huffman is not supported");
  16649. }
  16650. return {
  16651. symbolIDTable,
  16652. tableFirstS,
  16653. tableDeltaS,
  16654. tableDeltaT
  16655. };
  16656. }
  16657. function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
  16658. let customIndex = 0,
  16659. tableDeltaHeight,
  16660. tableDeltaWidth;
  16661. switch (dictionary.huffmanDHSelector) {
  16662. case 0:
  16663. case 1:
  16664. tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
  16665. break;
  16666. case 3:
  16667. tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16668. customIndex++;
  16669. break;
  16670. default:
  16671. throw new Jbig2Error("invalid Huffman DH selector");
  16672. }
  16673. switch (dictionary.huffmanDWSelector) {
  16674. case 0:
  16675. case 1:
  16676. tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
  16677. break;
  16678. case 3:
  16679. tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16680. customIndex++;
  16681. break;
  16682. default:
  16683. throw new Jbig2Error("invalid Huffman DW selector");
  16684. }
  16685. let tableBitmapSize, tableAggregateInstances;
  16686. if (dictionary.bitmapSizeSelector) {
  16687. tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16688. customIndex++;
  16689. } else {
  16690. tableBitmapSize = getStandardTable(1);
  16691. }
  16692. if (dictionary.aggregationInstancesSelector) {
  16693. tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16694. } else {
  16695. tableAggregateInstances = getStandardTable(1);
  16696. }
  16697. return {
  16698. tableDeltaHeight,
  16699. tableDeltaWidth,
  16700. tableBitmapSize,
  16701. tableAggregateInstances
  16702. };
  16703. }
  16704. function readUncompressedBitmap(reader, width, height) {
  16705. const bitmap = [];
  16706. for (let y = 0; y < height; y++) {
  16707. const row = new Uint8Array(width);
  16708. bitmap.push(row);
  16709. for (let x = 0; x < width; x++) {
  16710. row[x] = reader.readBit();
  16711. }
  16712. reader.byteAlign();
  16713. }
  16714. return bitmap;
  16715. }
  16716. function decodeMMRBitmap(input, width, height, endOfBlock) {
  16717. const params = {
  16718. K: -1,
  16719. Columns: width,
  16720. Rows: height,
  16721. BlackIs1: true,
  16722. EndOfBlock: endOfBlock
  16723. };
  16724. const decoder = new _ccitt.CCITTFaxDecoder(input, params);
  16725. const bitmap = [];
  16726. let currentByte,
  16727. eof = false;
  16728. for (let y = 0; y < height; y++) {
  16729. const row = new Uint8Array(width);
  16730. bitmap.push(row);
  16731. let shift = -1;
  16732. for (let x = 0; x < width; x++) {
  16733. if (shift < 0) {
  16734. currentByte = decoder.readNextChar();
  16735. if (currentByte === -1) {
  16736. currentByte = 0;
  16737. eof = true;
  16738. }
  16739. shift = 7;
  16740. }
  16741. row[x] = currentByte >> shift & 1;
  16742. shift--;
  16743. }
  16744. }
  16745. if (endOfBlock && !eof) {
  16746. const lookForEOFLimit = 5;
  16747. for (let i = 0; i < lookForEOFLimit; i++) {
  16748. if (decoder.readNextChar() === -1) {
  16749. break;
  16750. }
  16751. }
  16752. }
  16753. return bitmap;
  16754. }
  16755. class Jbig2Image {
  16756. parseChunks(chunks) {
  16757. return parseJbig2Chunks(chunks);
  16758. }
  16759. parse(data) {
  16760. throw new Error("Not implemented: Jbig2Image.parse");
  16761. }
  16762. }
  16763. exports.Jbig2Image = Jbig2Image;
  16764. /***/ }),
  16765. /* 24 */
  16766. /***/ ((__unused_webpack_module, exports) => {
  16767. Object.defineProperty(exports, "__esModule", ({
  16768. value: true
  16769. }));
  16770. exports.ArithmeticDecoder = void 0;
  16771. const QeTable = [{
  16772. qe: 0x5601,
  16773. nmps: 1,
  16774. nlps: 1,
  16775. switchFlag: 1
  16776. }, {
  16777. qe: 0x3401,
  16778. nmps: 2,
  16779. nlps: 6,
  16780. switchFlag: 0
  16781. }, {
  16782. qe: 0x1801,
  16783. nmps: 3,
  16784. nlps: 9,
  16785. switchFlag: 0
  16786. }, {
  16787. qe: 0x0ac1,
  16788. nmps: 4,
  16789. nlps: 12,
  16790. switchFlag: 0
  16791. }, {
  16792. qe: 0x0521,
  16793. nmps: 5,
  16794. nlps: 29,
  16795. switchFlag: 0
  16796. }, {
  16797. qe: 0x0221,
  16798. nmps: 38,
  16799. nlps: 33,
  16800. switchFlag: 0
  16801. }, {
  16802. qe: 0x5601,
  16803. nmps: 7,
  16804. nlps: 6,
  16805. switchFlag: 1
  16806. }, {
  16807. qe: 0x5401,
  16808. nmps: 8,
  16809. nlps: 14,
  16810. switchFlag: 0
  16811. }, {
  16812. qe: 0x4801,
  16813. nmps: 9,
  16814. nlps: 14,
  16815. switchFlag: 0
  16816. }, {
  16817. qe: 0x3801,
  16818. nmps: 10,
  16819. nlps: 14,
  16820. switchFlag: 0
  16821. }, {
  16822. qe: 0x3001,
  16823. nmps: 11,
  16824. nlps: 17,
  16825. switchFlag: 0
  16826. }, {
  16827. qe: 0x2401,
  16828. nmps: 12,
  16829. nlps: 18,
  16830. switchFlag: 0
  16831. }, {
  16832. qe: 0x1c01,
  16833. nmps: 13,
  16834. nlps: 20,
  16835. switchFlag: 0
  16836. }, {
  16837. qe: 0x1601,
  16838. nmps: 29,
  16839. nlps: 21,
  16840. switchFlag: 0
  16841. }, {
  16842. qe: 0x5601,
  16843. nmps: 15,
  16844. nlps: 14,
  16845. switchFlag: 1
  16846. }, {
  16847. qe: 0x5401,
  16848. nmps: 16,
  16849. nlps: 14,
  16850. switchFlag: 0
  16851. }, {
  16852. qe: 0x5101,
  16853. nmps: 17,
  16854. nlps: 15,
  16855. switchFlag: 0
  16856. }, {
  16857. qe: 0x4801,
  16858. nmps: 18,
  16859. nlps: 16,
  16860. switchFlag: 0
  16861. }, {
  16862. qe: 0x3801,
  16863. nmps: 19,
  16864. nlps: 17,
  16865. switchFlag: 0
  16866. }, {
  16867. qe: 0x3401,
  16868. nmps: 20,
  16869. nlps: 18,
  16870. switchFlag: 0
  16871. }, {
  16872. qe: 0x3001,
  16873. nmps: 21,
  16874. nlps: 19,
  16875. switchFlag: 0
  16876. }, {
  16877. qe: 0x2801,
  16878. nmps: 22,
  16879. nlps: 19,
  16880. switchFlag: 0
  16881. }, {
  16882. qe: 0x2401,
  16883. nmps: 23,
  16884. nlps: 20,
  16885. switchFlag: 0
  16886. }, {
  16887. qe: 0x2201,
  16888. nmps: 24,
  16889. nlps: 21,
  16890. switchFlag: 0
  16891. }, {
  16892. qe: 0x1c01,
  16893. nmps: 25,
  16894. nlps: 22,
  16895. switchFlag: 0
  16896. }, {
  16897. qe: 0x1801,
  16898. nmps: 26,
  16899. nlps: 23,
  16900. switchFlag: 0
  16901. }, {
  16902. qe: 0x1601,
  16903. nmps: 27,
  16904. nlps: 24,
  16905. switchFlag: 0
  16906. }, {
  16907. qe: 0x1401,
  16908. nmps: 28,
  16909. nlps: 25,
  16910. switchFlag: 0
  16911. }, {
  16912. qe: 0x1201,
  16913. nmps: 29,
  16914. nlps: 26,
  16915. switchFlag: 0
  16916. }, {
  16917. qe: 0x1101,
  16918. nmps: 30,
  16919. nlps: 27,
  16920. switchFlag: 0
  16921. }, {
  16922. qe: 0x0ac1,
  16923. nmps: 31,
  16924. nlps: 28,
  16925. switchFlag: 0
  16926. }, {
  16927. qe: 0x09c1,
  16928. nmps: 32,
  16929. nlps: 29,
  16930. switchFlag: 0
  16931. }, {
  16932. qe: 0x08a1,
  16933. nmps: 33,
  16934. nlps: 30,
  16935. switchFlag: 0
  16936. }, {
  16937. qe: 0x0521,
  16938. nmps: 34,
  16939. nlps: 31,
  16940. switchFlag: 0
  16941. }, {
  16942. qe: 0x0441,
  16943. nmps: 35,
  16944. nlps: 32,
  16945. switchFlag: 0
  16946. }, {
  16947. qe: 0x02a1,
  16948. nmps: 36,
  16949. nlps: 33,
  16950. switchFlag: 0
  16951. }, {
  16952. qe: 0x0221,
  16953. nmps: 37,
  16954. nlps: 34,
  16955. switchFlag: 0
  16956. }, {
  16957. qe: 0x0141,
  16958. nmps: 38,
  16959. nlps: 35,
  16960. switchFlag: 0
  16961. }, {
  16962. qe: 0x0111,
  16963. nmps: 39,
  16964. nlps: 36,
  16965. switchFlag: 0
  16966. }, {
  16967. qe: 0x0085,
  16968. nmps: 40,
  16969. nlps: 37,
  16970. switchFlag: 0
  16971. }, {
  16972. qe: 0x0049,
  16973. nmps: 41,
  16974. nlps: 38,
  16975. switchFlag: 0
  16976. }, {
  16977. qe: 0x0025,
  16978. nmps: 42,
  16979. nlps: 39,
  16980. switchFlag: 0
  16981. }, {
  16982. qe: 0x0015,
  16983. nmps: 43,
  16984. nlps: 40,
  16985. switchFlag: 0
  16986. }, {
  16987. qe: 0x0009,
  16988. nmps: 44,
  16989. nlps: 41,
  16990. switchFlag: 0
  16991. }, {
  16992. qe: 0x0005,
  16993. nmps: 45,
  16994. nlps: 42,
  16995. switchFlag: 0
  16996. }, {
  16997. qe: 0x0001,
  16998. nmps: 45,
  16999. nlps: 43,
  17000. switchFlag: 0
  17001. }, {
  17002. qe: 0x5601,
  17003. nmps: 46,
  17004. nlps: 46,
  17005. switchFlag: 0
  17006. }];
  17007. class ArithmeticDecoder {
  17008. constructor(data, start, end) {
  17009. this.data = data;
  17010. this.bp = start;
  17011. this.dataEnd = end;
  17012. this.chigh = data[start];
  17013. this.clow = 0;
  17014. this.byteIn();
  17015. this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
  17016. this.clow = this.clow << 7 & 0xffff;
  17017. this.ct -= 7;
  17018. this.a = 0x8000;
  17019. }
  17020. byteIn() {
  17021. const data = this.data;
  17022. let bp = this.bp;
  17023. if (data[bp] === 0xff) {
  17024. if (data[bp + 1] > 0x8f) {
  17025. this.clow += 0xff00;
  17026. this.ct = 8;
  17027. } else {
  17028. bp++;
  17029. this.clow += data[bp] << 9;
  17030. this.ct = 7;
  17031. this.bp = bp;
  17032. }
  17033. } else {
  17034. bp++;
  17035. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  17036. this.ct = 8;
  17037. this.bp = bp;
  17038. }
  17039. if (this.clow > 0xffff) {
  17040. this.chigh += this.clow >> 16;
  17041. this.clow &= 0xffff;
  17042. }
  17043. }
  17044. readBit(contexts, pos) {
  17045. let cx_index = contexts[pos] >> 1,
  17046. cx_mps = contexts[pos] & 1;
  17047. const qeTableIcx = QeTable[cx_index];
  17048. const qeIcx = qeTableIcx.qe;
  17049. let d;
  17050. let a = this.a - qeIcx;
  17051. if (this.chigh < qeIcx) {
  17052. if (a < qeIcx) {
  17053. a = qeIcx;
  17054. d = cx_mps;
  17055. cx_index = qeTableIcx.nmps;
  17056. } else {
  17057. a = qeIcx;
  17058. d = 1 ^ cx_mps;
  17059. if (qeTableIcx.switchFlag === 1) {
  17060. cx_mps = d;
  17061. }
  17062. cx_index = qeTableIcx.nlps;
  17063. }
  17064. } else {
  17065. this.chigh -= qeIcx;
  17066. if ((a & 0x8000) !== 0) {
  17067. this.a = a;
  17068. return cx_mps;
  17069. }
  17070. if (a < qeIcx) {
  17071. d = 1 ^ cx_mps;
  17072. if (qeTableIcx.switchFlag === 1) {
  17073. cx_mps = d;
  17074. }
  17075. cx_index = qeTableIcx.nlps;
  17076. } else {
  17077. d = cx_mps;
  17078. cx_index = qeTableIcx.nmps;
  17079. }
  17080. }
  17081. do {
  17082. if (this.ct === 0) {
  17083. this.byteIn();
  17084. }
  17085. a <<= 1;
  17086. this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
  17087. this.clow = this.clow << 1 & 0xffff;
  17088. this.ct--;
  17089. } while ((a & 0x8000) === 0);
  17090. this.a = a;
  17091. contexts[pos] = cx_index << 1 | cx_mps;
  17092. return d;
  17093. }
  17094. }
  17095. exports.ArithmeticDecoder = ArithmeticDecoder;
  17096. /***/ }),
  17097. /* 25 */
  17098. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17099. Object.defineProperty(exports, "__esModule", ({
  17100. value: true
  17101. }));
  17102. exports.JpegStream = void 0;
  17103. var _decode_stream = __w_pdfjs_require__(17);
  17104. var _primitives = __w_pdfjs_require__(3);
  17105. var _jpg = __w_pdfjs_require__(26);
  17106. var _util = __w_pdfjs_require__(2);
  17107. class JpegStream extends _decode_stream.DecodeStream {
  17108. constructor(stream, maybeLength, params) {
  17109. let ch;
  17110. while ((ch = stream.getByte()) !== -1) {
  17111. if (ch === 0xff) {
  17112. stream.skip(-1);
  17113. break;
  17114. }
  17115. }
  17116. super(maybeLength);
  17117. this.stream = stream;
  17118. this.dict = stream.dict;
  17119. this.maybeLength = maybeLength;
  17120. this.params = params;
  17121. }
  17122. get bytes() {
  17123. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  17124. }
  17125. ensureBuffer(requested) {}
  17126. readBlock() {
  17127. if (this.eof) {
  17128. return;
  17129. }
  17130. const jpegOptions = {
  17131. decodeTransform: undefined,
  17132. colorTransform: undefined
  17133. };
  17134. const decodeArr = this.dict.getArray("D", "Decode");
  17135. if (this.forceRGB && Array.isArray(decodeArr)) {
  17136. const bitsPerComponent = this.dict.get("BPC", "BitsPerComponent") || 8;
  17137. const decodeArrLength = decodeArr.length;
  17138. const transform = new Int32Array(decodeArrLength);
  17139. let transformNeeded = false;
  17140. const maxValue = (1 << bitsPerComponent) - 1;
  17141. for (let i = 0; i < decodeArrLength; i += 2) {
  17142. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  17143. transform[i + 1] = decodeArr[i] * maxValue | 0;
  17144. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  17145. transformNeeded = true;
  17146. }
  17147. }
  17148. if (transformNeeded) {
  17149. jpegOptions.decodeTransform = transform;
  17150. }
  17151. }
  17152. if (this.params instanceof _primitives.Dict) {
  17153. const colorTransform = this.params.get("ColorTransform");
  17154. if (Number.isInteger(colorTransform)) {
  17155. jpegOptions.colorTransform = colorTransform;
  17156. }
  17157. }
  17158. const jpegImage = new _jpg.JpegImage(jpegOptions);
  17159. jpegImage.parse(this.bytes);
  17160. const data = jpegImage.getData({
  17161. width: this.drawWidth,
  17162. height: this.drawHeight,
  17163. forceRGB: this.forceRGB,
  17164. isSourcePDF: true
  17165. });
  17166. this.buffer = data;
  17167. this.bufferLength = data.length;
  17168. this.eof = true;
  17169. }
  17170. }
  17171. exports.JpegStream = JpegStream;
  17172. /***/ }),
  17173. /* 26 */
  17174. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17175. Object.defineProperty(exports, "__esModule", ({
  17176. value: true
  17177. }));
  17178. exports.JpegImage = void 0;
  17179. var _util = __w_pdfjs_require__(2);
  17180. var _core_utils = __w_pdfjs_require__(4);
  17181. class JpegError extends _util.BaseException {
  17182. constructor(msg) {
  17183. super(`JPEG error: ${msg}`, "JpegError");
  17184. }
  17185. }
  17186. class DNLMarkerError extends _util.BaseException {
  17187. constructor(message, scanLines) {
  17188. super(message, "DNLMarkerError");
  17189. this.scanLines = scanLines;
  17190. }
  17191. }
  17192. class EOIMarkerError extends _util.BaseException {
  17193. constructor(msg) {
  17194. super(msg, "EOIMarkerError");
  17195. }
  17196. }
  17197. const dctZigZag = new Uint8Array([0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63]);
  17198. const dctCos1 = 4017;
  17199. const dctSin1 = 799;
  17200. const dctCos3 = 3406;
  17201. const dctSin3 = 2276;
  17202. const dctCos6 = 1567;
  17203. const dctSin6 = 3784;
  17204. const dctSqrt2 = 5793;
  17205. const dctSqrt1d2 = 2896;
  17206. function buildHuffmanTable(codeLengths, values) {
  17207. let k = 0,
  17208. i,
  17209. j,
  17210. length = 16;
  17211. while (length > 0 && !codeLengths[length - 1]) {
  17212. length--;
  17213. }
  17214. const code = [{
  17215. children: [],
  17216. index: 0
  17217. }];
  17218. let p = code[0],
  17219. q;
  17220. for (i = 0; i < length; i++) {
  17221. for (j = 0; j < codeLengths[i]; j++) {
  17222. p = code.pop();
  17223. p.children[p.index] = values[k];
  17224. while (p.index > 0) {
  17225. p = code.pop();
  17226. }
  17227. p.index++;
  17228. code.push(p);
  17229. while (code.length <= i) {
  17230. code.push(q = {
  17231. children: [],
  17232. index: 0
  17233. });
  17234. p.children[p.index] = q.children;
  17235. p = q;
  17236. }
  17237. k++;
  17238. }
  17239. if (i + 1 < length) {
  17240. code.push(q = {
  17241. children: [],
  17242. index: 0
  17243. });
  17244. p.children[p.index] = q.children;
  17245. p = q;
  17246. }
  17247. }
  17248. return code[0].children;
  17249. }
  17250. function getBlockBufferOffset(component, row, col) {
  17251. return 64 * ((component.blocksPerLine + 1) * row + col);
  17252. }
  17253. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) {
  17254. const mcusPerLine = frame.mcusPerLine;
  17255. const progressive = frame.progressive;
  17256. const startOffset = offset;
  17257. let bitsData = 0,
  17258. bitsCount = 0;
  17259. function readBit() {
  17260. if (bitsCount > 0) {
  17261. bitsCount--;
  17262. return bitsData >> bitsCount & 1;
  17263. }
  17264. bitsData = data[offset++];
  17265. if (bitsData === 0xff) {
  17266. const nextByte = data[offset++];
  17267. if (nextByte) {
  17268. if (nextByte === 0xdc && parseDNLMarker) {
  17269. offset += 2;
  17270. const scanLines = (0, _core_utils.readUint16)(data, offset);
  17271. offset += 2;
  17272. if (scanLines > 0 && scanLines !== frame.scanLines) {
  17273. throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
  17274. }
  17275. } else if (nextByte === 0xd9) {
  17276. if (parseDNLMarker) {
  17277. const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
  17278. if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 5) {
  17279. throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
  17280. }
  17281. }
  17282. throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
  17283. }
  17284. throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
  17285. }
  17286. }
  17287. bitsCount = 7;
  17288. return bitsData >>> 7;
  17289. }
  17290. function decodeHuffman(tree) {
  17291. let node = tree;
  17292. while (true) {
  17293. node = node[readBit()];
  17294. switch (typeof node) {
  17295. case "number":
  17296. return node;
  17297. case "object":
  17298. continue;
  17299. }
  17300. throw new JpegError("invalid huffman sequence");
  17301. }
  17302. }
  17303. function receive(length) {
  17304. let n = 0;
  17305. while (length > 0) {
  17306. n = n << 1 | readBit();
  17307. length--;
  17308. }
  17309. return n;
  17310. }
  17311. function receiveAndExtend(length) {
  17312. if (length === 1) {
  17313. return readBit() === 1 ? 1 : -1;
  17314. }
  17315. const n = receive(length);
  17316. if (n >= 1 << length - 1) {
  17317. return n;
  17318. }
  17319. return n + (-1 << length) + 1;
  17320. }
  17321. function decodeBaseline(component, blockOffset) {
  17322. const t = decodeHuffman(component.huffmanTableDC);
  17323. const diff = t === 0 ? 0 : receiveAndExtend(t);
  17324. component.blockData[blockOffset] = component.pred += diff;
  17325. let k = 1;
  17326. while (k < 64) {
  17327. const rs = decodeHuffman(component.huffmanTableAC);
  17328. const s = rs & 15,
  17329. r = rs >> 4;
  17330. if (s === 0) {
  17331. if (r < 15) {
  17332. break;
  17333. }
  17334. k += 16;
  17335. continue;
  17336. }
  17337. k += r;
  17338. const z = dctZigZag[k];
  17339. component.blockData[blockOffset + z] = receiveAndExtend(s);
  17340. k++;
  17341. }
  17342. }
  17343. function decodeDCFirst(component, blockOffset) {
  17344. const t = decodeHuffman(component.huffmanTableDC);
  17345. const diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  17346. component.blockData[blockOffset] = component.pred += diff;
  17347. }
  17348. function decodeDCSuccessive(component, blockOffset) {
  17349. component.blockData[blockOffset] |= readBit() << successive;
  17350. }
  17351. let eobrun = 0;
  17352. function decodeACFirst(component, blockOffset) {
  17353. if (eobrun > 0) {
  17354. eobrun--;
  17355. return;
  17356. }
  17357. let k = spectralStart;
  17358. const e = spectralEnd;
  17359. while (k <= e) {
  17360. const rs = decodeHuffman(component.huffmanTableAC);
  17361. const s = rs & 15,
  17362. r = rs >> 4;
  17363. if (s === 0) {
  17364. if (r < 15) {
  17365. eobrun = receive(r) + (1 << r) - 1;
  17366. break;
  17367. }
  17368. k += 16;
  17369. continue;
  17370. }
  17371. k += r;
  17372. const z = dctZigZag[k];
  17373. component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
  17374. k++;
  17375. }
  17376. }
  17377. let successiveACState = 0,
  17378. successiveACNextValue;
  17379. function decodeACSuccessive(component, blockOffset) {
  17380. let k = spectralStart;
  17381. const e = spectralEnd;
  17382. let r = 0;
  17383. let s;
  17384. let rs;
  17385. while (k <= e) {
  17386. const offsetZ = blockOffset + dctZigZag[k];
  17387. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  17388. switch (successiveACState) {
  17389. case 0:
  17390. rs = decodeHuffman(component.huffmanTableAC);
  17391. s = rs & 15;
  17392. r = rs >> 4;
  17393. if (s === 0) {
  17394. if (r < 15) {
  17395. eobrun = receive(r) + (1 << r);
  17396. successiveACState = 4;
  17397. } else {
  17398. r = 16;
  17399. successiveACState = 1;
  17400. }
  17401. } else {
  17402. if (s !== 1) {
  17403. throw new JpegError("invalid ACn encoding");
  17404. }
  17405. successiveACNextValue = receiveAndExtend(s);
  17406. successiveACState = r ? 2 : 3;
  17407. }
  17408. continue;
  17409. case 1:
  17410. case 2:
  17411. if (component.blockData[offsetZ]) {
  17412. component.blockData[offsetZ] += sign * (readBit() << successive);
  17413. } else {
  17414. r--;
  17415. if (r === 0) {
  17416. successiveACState = successiveACState === 2 ? 3 : 0;
  17417. }
  17418. }
  17419. break;
  17420. case 3:
  17421. if (component.blockData[offsetZ]) {
  17422. component.blockData[offsetZ] += sign * (readBit() << successive);
  17423. } else {
  17424. component.blockData[offsetZ] = successiveACNextValue << successive;
  17425. successiveACState = 0;
  17426. }
  17427. break;
  17428. case 4:
  17429. if (component.blockData[offsetZ]) {
  17430. component.blockData[offsetZ] += sign * (readBit() << successive);
  17431. }
  17432. break;
  17433. }
  17434. k++;
  17435. }
  17436. if (successiveACState === 4) {
  17437. eobrun--;
  17438. if (eobrun === 0) {
  17439. successiveACState = 0;
  17440. }
  17441. }
  17442. }
  17443. let blockRow = 0;
  17444. function decodeMcu(component, decode, mcu, row, col) {
  17445. const mcuRow = mcu / mcusPerLine | 0;
  17446. const mcuCol = mcu % mcusPerLine;
  17447. blockRow = mcuRow * component.v + row;
  17448. const blockCol = mcuCol * component.h + col;
  17449. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  17450. decode(component, blockOffset);
  17451. }
  17452. function decodeBlock(component, decode, mcu) {
  17453. blockRow = mcu / component.blocksPerLine | 0;
  17454. const blockCol = mcu % component.blocksPerLine;
  17455. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  17456. decode(component, blockOffset);
  17457. }
  17458. const componentsLength = components.length;
  17459. let component, i, j, k, n;
  17460. let decodeFn;
  17461. if (progressive) {
  17462. if (spectralStart === 0) {
  17463. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  17464. } else {
  17465. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  17466. }
  17467. } else {
  17468. decodeFn = decodeBaseline;
  17469. }
  17470. let mcu = 0,
  17471. fileMarker;
  17472. let mcuExpected;
  17473. if (componentsLength === 1) {
  17474. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  17475. } else {
  17476. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  17477. }
  17478. let h, v;
  17479. while (mcu <= mcuExpected) {
  17480. const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  17481. if (mcuToRead > 0) {
  17482. for (i = 0; i < componentsLength; i++) {
  17483. components[i].pred = 0;
  17484. }
  17485. eobrun = 0;
  17486. if (componentsLength === 1) {
  17487. component = components[0];
  17488. for (n = 0; n < mcuToRead; n++) {
  17489. decodeBlock(component, decodeFn, mcu);
  17490. mcu++;
  17491. }
  17492. } else {
  17493. for (n = 0; n < mcuToRead; n++) {
  17494. for (i = 0; i < componentsLength; i++) {
  17495. component = components[i];
  17496. h = component.h;
  17497. v = component.v;
  17498. for (j = 0; j < v; j++) {
  17499. for (k = 0; k < h; k++) {
  17500. decodeMcu(component, decodeFn, mcu, j, k);
  17501. }
  17502. }
  17503. }
  17504. mcu++;
  17505. }
  17506. }
  17507. }
  17508. bitsCount = 0;
  17509. fileMarker = findNextFileMarker(data, offset);
  17510. if (!fileMarker) {
  17511. break;
  17512. }
  17513. if (fileMarker.invalid) {
  17514. const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
  17515. (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
  17516. offset = fileMarker.offset;
  17517. }
  17518. if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
  17519. offset += 2;
  17520. } else {
  17521. break;
  17522. }
  17523. }
  17524. return offset - startOffset;
  17525. }
  17526. function quantizeAndInverse(component, blockBufferOffset, p) {
  17527. const qt = component.quantizationTable,
  17528. blockData = component.blockData;
  17529. let v0, v1, v2, v3, v4, v5, v6, v7;
  17530. let p0, p1, p2, p3, p4, p5, p6, p7;
  17531. let t;
  17532. if (!qt) {
  17533. throw new JpegError("missing required Quantization Table.");
  17534. }
  17535. for (let row = 0; row < 64; row += 8) {
  17536. p0 = blockData[blockBufferOffset + row];
  17537. p1 = blockData[blockBufferOffset + row + 1];
  17538. p2 = blockData[blockBufferOffset + row + 2];
  17539. p3 = blockData[blockBufferOffset + row + 3];
  17540. p4 = blockData[blockBufferOffset + row + 4];
  17541. p5 = blockData[blockBufferOffset + row + 5];
  17542. p6 = blockData[blockBufferOffset + row + 6];
  17543. p7 = blockData[blockBufferOffset + row + 7];
  17544. p0 *= qt[row];
  17545. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  17546. t = dctSqrt2 * p0 + 512 >> 10;
  17547. p[row] = t;
  17548. p[row + 1] = t;
  17549. p[row + 2] = t;
  17550. p[row + 3] = t;
  17551. p[row + 4] = t;
  17552. p[row + 5] = t;
  17553. p[row + 6] = t;
  17554. p[row + 7] = t;
  17555. continue;
  17556. }
  17557. p1 *= qt[row + 1];
  17558. p2 *= qt[row + 2];
  17559. p3 *= qt[row + 3];
  17560. p4 *= qt[row + 4];
  17561. p5 *= qt[row + 5];
  17562. p6 *= qt[row + 6];
  17563. p7 *= qt[row + 7];
  17564. v0 = dctSqrt2 * p0 + 128 >> 8;
  17565. v1 = dctSqrt2 * p4 + 128 >> 8;
  17566. v2 = p2;
  17567. v3 = p6;
  17568. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  17569. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  17570. v5 = p3 << 4;
  17571. v6 = p5 << 4;
  17572. v0 = v0 + v1 + 1 >> 1;
  17573. v1 = v0 - v1;
  17574. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  17575. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  17576. v3 = t;
  17577. v4 = v4 + v6 + 1 >> 1;
  17578. v6 = v4 - v6;
  17579. v7 = v7 + v5 + 1 >> 1;
  17580. v5 = v7 - v5;
  17581. v0 = v0 + v3 + 1 >> 1;
  17582. v3 = v0 - v3;
  17583. v1 = v1 + v2 + 1 >> 1;
  17584. v2 = v1 - v2;
  17585. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  17586. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  17587. v7 = t;
  17588. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  17589. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  17590. v6 = t;
  17591. p[row] = v0 + v7;
  17592. p[row + 7] = v0 - v7;
  17593. p[row + 1] = v1 + v6;
  17594. p[row + 6] = v1 - v6;
  17595. p[row + 2] = v2 + v5;
  17596. p[row + 5] = v2 - v5;
  17597. p[row + 3] = v3 + v4;
  17598. p[row + 4] = v3 - v4;
  17599. }
  17600. for (let col = 0; col < 8; ++col) {
  17601. p0 = p[col];
  17602. p1 = p[col + 8];
  17603. p2 = p[col + 16];
  17604. p3 = p[col + 24];
  17605. p4 = p[col + 32];
  17606. p5 = p[col + 40];
  17607. p6 = p[col + 48];
  17608. p7 = p[col + 56];
  17609. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  17610. t = dctSqrt2 * p0 + 8192 >> 14;
  17611. if (t < -2040) {
  17612. t = 0;
  17613. } else if (t >= 2024) {
  17614. t = 255;
  17615. } else {
  17616. t = t + 2056 >> 4;
  17617. }
  17618. blockData[blockBufferOffset + col] = t;
  17619. blockData[blockBufferOffset + col + 8] = t;
  17620. blockData[blockBufferOffset + col + 16] = t;
  17621. blockData[blockBufferOffset + col + 24] = t;
  17622. blockData[blockBufferOffset + col + 32] = t;
  17623. blockData[blockBufferOffset + col + 40] = t;
  17624. blockData[blockBufferOffset + col + 48] = t;
  17625. blockData[blockBufferOffset + col + 56] = t;
  17626. continue;
  17627. }
  17628. v0 = dctSqrt2 * p0 + 2048 >> 12;
  17629. v1 = dctSqrt2 * p4 + 2048 >> 12;
  17630. v2 = p2;
  17631. v3 = p6;
  17632. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  17633. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  17634. v5 = p3;
  17635. v6 = p5;
  17636. v0 = (v0 + v1 + 1 >> 1) + 4112;
  17637. v1 = v0 - v1;
  17638. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  17639. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  17640. v3 = t;
  17641. v4 = v4 + v6 + 1 >> 1;
  17642. v6 = v4 - v6;
  17643. v7 = v7 + v5 + 1 >> 1;
  17644. v5 = v7 - v5;
  17645. v0 = v0 + v3 + 1 >> 1;
  17646. v3 = v0 - v3;
  17647. v1 = v1 + v2 + 1 >> 1;
  17648. v2 = v1 - v2;
  17649. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  17650. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  17651. v7 = t;
  17652. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  17653. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  17654. v6 = t;
  17655. p0 = v0 + v7;
  17656. p7 = v0 - v7;
  17657. p1 = v1 + v6;
  17658. p6 = v1 - v6;
  17659. p2 = v2 + v5;
  17660. p5 = v2 - v5;
  17661. p3 = v3 + v4;
  17662. p4 = v3 - v4;
  17663. if (p0 < 16) {
  17664. p0 = 0;
  17665. } else if (p0 >= 4080) {
  17666. p0 = 255;
  17667. } else {
  17668. p0 >>= 4;
  17669. }
  17670. if (p1 < 16) {
  17671. p1 = 0;
  17672. } else if (p1 >= 4080) {
  17673. p1 = 255;
  17674. } else {
  17675. p1 >>= 4;
  17676. }
  17677. if (p2 < 16) {
  17678. p2 = 0;
  17679. } else if (p2 >= 4080) {
  17680. p2 = 255;
  17681. } else {
  17682. p2 >>= 4;
  17683. }
  17684. if (p3 < 16) {
  17685. p3 = 0;
  17686. } else if (p3 >= 4080) {
  17687. p3 = 255;
  17688. } else {
  17689. p3 >>= 4;
  17690. }
  17691. if (p4 < 16) {
  17692. p4 = 0;
  17693. } else if (p4 >= 4080) {
  17694. p4 = 255;
  17695. } else {
  17696. p4 >>= 4;
  17697. }
  17698. if (p5 < 16) {
  17699. p5 = 0;
  17700. } else if (p5 >= 4080) {
  17701. p5 = 255;
  17702. } else {
  17703. p5 >>= 4;
  17704. }
  17705. if (p6 < 16) {
  17706. p6 = 0;
  17707. } else if (p6 >= 4080) {
  17708. p6 = 255;
  17709. } else {
  17710. p6 >>= 4;
  17711. }
  17712. if (p7 < 16) {
  17713. p7 = 0;
  17714. } else if (p7 >= 4080) {
  17715. p7 = 255;
  17716. } else {
  17717. p7 >>= 4;
  17718. }
  17719. blockData[blockBufferOffset + col] = p0;
  17720. blockData[blockBufferOffset + col + 8] = p1;
  17721. blockData[blockBufferOffset + col + 16] = p2;
  17722. blockData[blockBufferOffset + col + 24] = p3;
  17723. blockData[blockBufferOffset + col + 32] = p4;
  17724. blockData[blockBufferOffset + col + 40] = p5;
  17725. blockData[blockBufferOffset + col + 48] = p6;
  17726. blockData[blockBufferOffset + col + 56] = p7;
  17727. }
  17728. }
  17729. function buildComponentData(frame, component) {
  17730. const blocksPerLine = component.blocksPerLine;
  17731. const blocksPerColumn = component.blocksPerColumn;
  17732. const computationBuffer = new Int16Array(64);
  17733. for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  17734. for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  17735. const offset = getBlockBufferOffset(component, blockRow, blockCol);
  17736. quantizeAndInverse(component, offset, computationBuffer);
  17737. }
  17738. }
  17739. return component.blockData;
  17740. }
  17741. function findNextFileMarker(data, currentPos, startPos = currentPos) {
  17742. const maxPos = data.length - 1;
  17743. let newPos = startPos < currentPos ? startPos : currentPos;
  17744. if (currentPos >= maxPos) {
  17745. return null;
  17746. }
  17747. const currentMarker = (0, _core_utils.readUint16)(data, currentPos);
  17748. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  17749. return {
  17750. invalid: null,
  17751. marker: currentMarker,
  17752. offset: currentPos
  17753. };
  17754. }
  17755. let newMarker = (0, _core_utils.readUint16)(data, newPos);
  17756. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  17757. if (++newPos >= maxPos) {
  17758. return null;
  17759. }
  17760. newMarker = (0, _core_utils.readUint16)(data, newPos);
  17761. }
  17762. return {
  17763. invalid: currentMarker.toString(16),
  17764. marker: newMarker,
  17765. offset: newPos
  17766. };
  17767. }
  17768. class JpegImage {
  17769. constructor({
  17770. decodeTransform = null,
  17771. colorTransform = -1
  17772. } = {}) {
  17773. this._decodeTransform = decodeTransform;
  17774. this._colorTransform = colorTransform;
  17775. }
  17776. parse(data, {
  17777. dnlScanLines = null
  17778. } = {}) {
  17779. function readDataBlock() {
  17780. const length = (0, _core_utils.readUint16)(data, offset);
  17781. offset += 2;
  17782. let endOffset = offset + length - 2;
  17783. const fileMarker = findNextFileMarker(data, endOffset, offset);
  17784. if (fileMarker && fileMarker.invalid) {
  17785. (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
  17786. endOffset = fileMarker.offset;
  17787. }
  17788. const array = data.subarray(offset, endOffset);
  17789. offset += array.length;
  17790. return array;
  17791. }
  17792. function prepareComponents(frame) {
  17793. const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  17794. const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  17795. for (const component of frame.components) {
  17796. const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  17797. const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  17798. const blocksPerLineForMcu = mcusPerLine * component.h;
  17799. const blocksPerColumnForMcu = mcusPerColumn * component.v;
  17800. const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  17801. component.blockData = new Int16Array(blocksBufferSize);
  17802. component.blocksPerLine = blocksPerLine;
  17803. component.blocksPerColumn = blocksPerColumn;
  17804. }
  17805. frame.mcusPerLine = mcusPerLine;
  17806. frame.mcusPerColumn = mcusPerColumn;
  17807. }
  17808. let offset = 0;
  17809. let jfif = null;
  17810. let adobe = null;
  17811. let frame, resetInterval;
  17812. let numSOSMarkers = 0;
  17813. const quantizationTables = [];
  17814. const huffmanTablesAC = [],
  17815. huffmanTablesDC = [];
  17816. let fileMarker = (0, _core_utils.readUint16)(data, offset);
  17817. offset += 2;
  17818. if (fileMarker !== 0xffd8) {
  17819. throw new JpegError("SOI not found");
  17820. }
  17821. fileMarker = (0, _core_utils.readUint16)(data, offset);
  17822. offset += 2;
  17823. markerLoop: while (fileMarker !== 0xffd9) {
  17824. let i, j, l;
  17825. switch (fileMarker) {
  17826. case 0xffe0:
  17827. case 0xffe1:
  17828. case 0xffe2:
  17829. case 0xffe3:
  17830. case 0xffe4:
  17831. case 0xffe5:
  17832. case 0xffe6:
  17833. case 0xffe7:
  17834. case 0xffe8:
  17835. case 0xffe9:
  17836. case 0xffea:
  17837. case 0xffeb:
  17838. case 0xffec:
  17839. case 0xffed:
  17840. case 0xffee:
  17841. case 0xffef:
  17842. case 0xfffe:
  17843. const appData = readDataBlock();
  17844. if (fileMarker === 0xffe0) {
  17845. if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  17846. jfif = {
  17847. version: {
  17848. major: appData[5],
  17849. minor: appData[6]
  17850. },
  17851. densityUnits: appData[7],
  17852. xDensity: appData[8] << 8 | appData[9],
  17853. yDensity: appData[10] << 8 | appData[11],
  17854. thumbWidth: appData[12],
  17855. thumbHeight: appData[13],
  17856. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  17857. };
  17858. }
  17859. }
  17860. if (fileMarker === 0xffee) {
  17861. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
  17862. adobe = {
  17863. version: appData[5] << 8 | appData[6],
  17864. flags0: appData[7] << 8 | appData[8],
  17865. flags1: appData[9] << 8 | appData[10],
  17866. transformCode: appData[11]
  17867. };
  17868. }
  17869. }
  17870. break;
  17871. case 0xffdb:
  17872. const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
  17873. offset += 2;
  17874. const quantizationTablesEnd = quantizationTablesLength + offset - 2;
  17875. let z;
  17876. while (offset < quantizationTablesEnd) {
  17877. const quantizationTableSpec = data[offset++];
  17878. const tableData = new Uint16Array(64);
  17879. if (quantizationTableSpec >> 4 === 0) {
  17880. for (j = 0; j < 64; j++) {
  17881. z = dctZigZag[j];
  17882. tableData[z] = data[offset++];
  17883. }
  17884. } else if (quantizationTableSpec >> 4 === 1) {
  17885. for (j = 0; j < 64; j++) {
  17886. z = dctZigZag[j];
  17887. tableData[z] = (0, _core_utils.readUint16)(data, offset);
  17888. offset += 2;
  17889. }
  17890. } else {
  17891. throw new JpegError("DQT - invalid table spec");
  17892. }
  17893. quantizationTables[quantizationTableSpec & 15] = tableData;
  17894. }
  17895. break;
  17896. case 0xffc0:
  17897. case 0xffc1:
  17898. case 0xffc2:
  17899. if (frame) {
  17900. throw new JpegError("Only single frame JPEGs supported");
  17901. }
  17902. offset += 2;
  17903. frame = {};
  17904. frame.extended = fileMarker === 0xffc1;
  17905. frame.progressive = fileMarker === 0xffc2;
  17906. frame.precision = data[offset++];
  17907. const sofScanLines = (0, _core_utils.readUint16)(data, offset);
  17908. offset += 2;
  17909. frame.scanLines = dnlScanLines || sofScanLines;
  17910. frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);
  17911. offset += 2;
  17912. frame.components = [];
  17913. frame.componentIds = {};
  17914. const componentsCount = data[offset++];
  17915. let maxH = 0,
  17916. maxV = 0;
  17917. for (i = 0; i < componentsCount; i++) {
  17918. const componentId = data[offset];
  17919. const h = data[offset + 1] >> 4;
  17920. const v = data[offset + 1] & 15;
  17921. if (maxH < h) {
  17922. maxH = h;
  17923. }
  17924. if (maxV < v) {
  17925. maxV = v;
  17926. }
  17927. const qId = data[offset + 2];
  17928. l = frame.components.push({
  17929. h,
  17930. v,
  17931. quantizationId: qId,
  17932. quantizationTable: null
  17933. });
  17934. frame.componentIds[componentId] = l - 1;
  17935. offset += 3;
  17936. }
  17937. frame.maxH = maxH;
  17938. frame.maxV = maxV;
  17939. prepareComponents(frame);
  17940. break;
  17941. case 0xffc4:
  17942. const huffmanLength = (0, _core_utils.readUint16)(data, offset);
  17943. offset += 2;
  17944. for (i = 2; i < huffmanLength;) {
  17945. const huffmanTableSpec = data[offset++];
  17946. const codeLengths = new Uint8Array(16);
  17947. let codeLengthSum = 0;
  17948. for (j = 0; j < 16; j++, offset++) {
  17949. codeLengthSum += codeLengths[j] = data[offset];
  17950. }
  17951. const huffmanValues = new Uint8Array(codeLengthSum);
  17952. for (j = 0; j < codeLengthSum; j++, offset++) {
  17953. huffmanValues[j] = data[offset];
  17954. }
  17955. i += 17 + codeLengthSum;
  17956. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  17957. }
  17958. break;
  17959. case 0xffdd:
  17960. offset += 2;
  17961. resetInterval = (0, _core_utils.readUint16)(data, offset);
  17962. offset += 2;
  17963. break;
  17964. case 0xffda:
  17965. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  17966. offset += 2;
  17967. const selectorsCount = data[offset++],
  17968. components = [];
  17969. for (i = 0; i < selectorsCount; i++) {
  17970. const index = data[offset++];
  17971. const componentIndex = frame.componentIds[index];
  17972. const component = frame.components[componentIndex];
  17973. component.index = index;
  17974. const tableSpec = data[offset++];
  17975. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  17976. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  17977. components.push(component);
  17978. }
  17979. const spectralStart = data[offset++],
  17980. spectralEnd = data[offset++],
  17981. successiveApproximation = data[offset++];
  17982. try {
  17983. const processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
  17984. offset += processed;
  17985. } catch (ex) {
  17986. if (ex instanceof DNLMarkerError) {
  17987. (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);
  17988. return this.parse(data, {
  17989. dnlScanLines: ex.scanLines
  17990. });
  17991. } else if (ex instanceof EOIMarkerError) {
  17992. (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
  17993. break markerLoop;
  17994. }
  17995. throw ex;
  17996. }
  17997. break;
  17998. case 0xffdc:
  17999. offset += 4;
  18000. break;
  18001. case 0xffff:
  18002. if (data[offset] !== 0xff) {
  18003. offset--;
  18004. }
  18005. break;
  18006. default:
  18007. const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
  18008. if (nextFileMarker && nextFileMarker.invalid) {
  18009. (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
  18010. offset = nextFileMarker.offset;
  18011. break;
  18012. }
  18013. if (!nextFileMarker || offset >= data.length - 1) {
  18014. (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
  18015. break markerLoop;
  18016. }
  18017. throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
  18018. }
  18019. fileMarker = (0, _core_utils.readUint16)(data, offset);
  18020. offset += 2;
  18021. }
  18022. this.width = frame.samplesPerLine;
  18023. this.height = frame.scanLines;
  18024. this.jfif = jfif;
  18025. this.adobe = adobe;
  18026. this.components = [];
  18027. for (const component of frame.components) {
  18028. const quantizationTable = quantizationTables[component.quantizationId];
  18029. if (quantizationTable) {
  18030. component.quantizationTable = quantizationTable;
  18031. }
  18032. this.components.push({
  18033. index: component.index,
  18034. output: buildComponentData(frame, component),
  18035. scaleX: component.h / frame.maxH,
  18036. scaleY: component.v / frame.maxV,
  18037. blocksPerLine: component.blocksPerLine,
  18038. blocksPerColumn: component.blocksPerColumn
  18039. });
  18040. }
  18041. this.numComponents = this.components.length;
  18042. return undefined;
  18043. }
  18044. _getLinearizedBlockData(width, height, isSourcePDF = false) {
  18045. const scaleX = this.width / width,
  18046. scaleY = this.height / height;
  18047. let component, componentScaleX, componentScaleY, blocksPerScanline;
  18048. let x, y, i, j, k;
  18049. let index;
  18050. let offset = 0;
  18051. let output;
  18052. const numComponents = this.components.length;
  18053. const dataLength = width * height * numComponents;
  18054. const data = new Uint8ClampedArray(dataLength);
  18055. const xScaleBlockOffset = new Uint32Array(width);
  18056. const mask3LSB = 0xfffffff8;
  18057. let lastComponentScaleX;
  18058. for (i = 0; i < numComponents; i++) {
  18059. component = this.components[i];
  18060. componentScaleX = component.scaleX * scaleX;
  18061. componentScaleY = component.scaleY * scaleY;
  18062. offset = i;
  18063. output = component.output;
  18064. blocksPerScanline = component.blocksPerLine + 1 << 3;
  18065. if (componentScaleX !== lastComponentScaleX) {
  18066. for (x = 0; x < width; x++) {
  18067. j = 0 | x * componentScaleX;
  18068. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  18069. }
  18070. lastComponentScaleX = componentScaleX;
  18071. }
  18072. for (y = 0; y < height; y++) {
  18073. j = 0 | y * componentScaleY;
  18074. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  18075. for (x = 0; x < width; x++) {
  18076. data[offset] = output[index + xScaleBlockOffset[x]];
  18077. offset += numComponents;
  18078. }
  18079. }
  18080. }
  18081. let transform = this._decodeTransform;
  18082. if (!isSourcePDF && numComponents === 4 && !transform) {
  18083. transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
  18084. }
  18085. if (transform) {
  18086. for (i = 0; i < dataLength;) {
  18087. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  18088. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  18089. }
  18090. }
  18091. }
  18092. return data;
  18093. }
  18094. get _isColorConversionNeeded() {
  18095. if (this.adobe) {
  18096. return !!this.adobe.transformCode;
  18097. }
  18098. if (this.numComponents === 3) {
  18099. if (this._colorTransform === 0) {
  18100. return false;
  18101. } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) {
  18102. return false;
  18103. }
  18104. return true;
  18105. }
  18106. if (this._colorTransform === 1) {
  18107. return true;
  18108. }
  18109. return false;
  18110. }
  18111. _convertYccToRgb(data) {
  18112. let Y, Cb, Cr;
  18113. for (let i = 0, length = data.length; i < length; i += 3) {
  18114. Y = data[i];
  18115. Cb = data[i + 1];
  18116. Cr = data[i + 2];
  18117. data[i] = Y - 179.456 + 1.402 * Cr;
  18118. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  18119. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  18120. }
  18121. return data;
  18122. }
  18123. _convertYcckToRgb(data) {
  18124. let Y, Cb, Cr, k;
  18125. let offset = 0;
  18126. for (let i = 0, length = data.length; i < length; i += 4) {
  18127. Y = data[i];
  18128. Cb = data[i + 1];
  18129. Cr = data[i + 2];
  18130. k = data[i + 3];
  18131. data[offset++] = -122.67195406894 + Cb * (-6.60635669420364e-5 * Cb + 0.000437130475926232 * Cr - 5.4080610064599e-5 * Y + 0.00048449797120281 * k - 0.154362151871126) + Cr * (-0.000957964378445773 * Cr + 0.000817076911346625 * Y - 0.00477271405408747 * k + 1.53380253221734) + Y * (0.000961250184130688 * Y - 0.00266257332283933 * k + 0.48357088451265) + k * (-0.000336197177618394 * k + 0.484791561490776);
  18132. data[offset++] = 107.268039397724 + Cb * (2.19927104525741e-5 * Cb - 0.000640992018297945 * Cr + 0.000659397001245577 * Y + 0.000426105652938837 * k - 0.176491792462875) + Cr * (-0.000778269941513683 * Cr + 0.00130872261408275 * Y + 0.000770482631801132 * k - 0.151051492775562) + Y * (0.00126935368114843 * Y - 0.00265090189010898 * k + 0.25802910206845) + k * (-0.000318913117588328 * k - 0.213742400323665);
  18133. data[offset++] = -20.810012546947 + Cb * (-0.000570115196973677 * Cb - 2.63409051004589e-5 * Cr + 0.0020741088115012 * Y - 0.00288260236853442 * k + 0.814272968359295) + Cr * (-1.53496057440975e-5 * Cr - 0.000132689043961446 * Y + 0.000560833691242812 * k - 0.195152027534049) + Y * (0.00174418132927582 * Y - 0.00255243321439347 * k + 0.116935020465145) + k * (-0.000343531996510555 * k + 0.24165260232407);
  18134. }
  18135. return data.subarray(0, offset);
  18136. }
  18137. _convertYcckToCmyk(data) {
  18138. let Y, Cb, Cr;
  18139. for (let i = 0, length = data.length; i < length; i += 4) {
  18140. Y = data[i];
  18141. Cb = data[i + 1];
  18142. Cr = data[i + 2];
  18143. data[i] = 434.456 - Y - 1.402 * Cr;
  18144. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  18145. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  18146. }
  18147. return data;
  18148. }
  18149. _convertCmykToRgb(data) {
  18150. let c, m, y, k;
  18151. let offset = 0;
  18152. for (let i = 0, length = data.length; i < length; i += 4) {
  18153. c = data[i];
  18154. m = data[i + 1];
  18155. y = data[i + 2];
  18156. k = data[i + 3];
  18157. data[offset++] = 255 + c * (-0.00006747147073602441 * c + 0.0008379262121013727 * m + 0.0002894718188643294 * y + 0.003264231057537806 * k - 1.1185611867203937) + m * (0.000026374107616089405 * m - 0.00008626949158638572 * y - 0.0002748769067499491 * k - 0.02155688794978967) + y * (-0.00003878099212869363 * y - 0.0003267808279485286 * k + 0.0686742238595345) - k * (0.0003361971776183937 * k + 0.7430659151342254);
  18158. data[offset++] = 255 + c * (0.00013596372813588848 * c + 0.000924537132573585 * m + 0.00010567359618683593 * y + 0.0004791864687436512 * k - 0.3109689587515875) + m * (-0.00023545346108370344 * m + 0.0002702845253534714 * y + 0.0020200308977307156 * k - 0.7488052167015494) + y * (0.00006834815998235662 * y + 0.00015168452363460973 * k - 0.09751927774728933) - k * (0.0003189131175883281 * k + 0.7364883807733168);
  18159. data[offset++] = 255 + c * (0.000013598650411385307 * c + 0.00012423956175490851 * m + 0.0004751985097583589 * y - 0.0000036729317476630422 * k - 0.05562186980264034) + m * (0.00016141380598724676 * m + 0.0009692239130725186 * y + 0.0007782692450036253 * k - 0.44015232367526463) + y * (5.068882914068769e-7 * y + 0.0017778369011375071 * k - 0.7591454649749609) - k * (0.0003435319965105553 * k + 0.7063770186160144);
  18160. }
  18161. return data.subarray(0, offset);
  18162. }
  18163. getData({
  18164. width,
  18165. height,
  18166. forceRGB = false,
  18167. isSourcePDF = false
  18168. }) {
  18169. if (this.numComponents > 4) {
  18170. throw new JpegError("Unsupported color mode");
  18171. }
  18172. const data = this._getLinearizedBlockData(width, height, isSourcePDF);
  18173. if (this.numComponents === 1 && forceRGB) {
  18174. const rgbData = new Uint8ClampedArray(data.length * 3);
  18175. let offset = 0;
  18176. for (const grayColor of data) {
  18177. rgbData[offset++] = grayColor;
  18178. rgbData[offset++] = grayColor;
  18179. rgbData[offset++] = grayColor;
  18180. }
  18181. return rgbData;
  18182. } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
  18183. return this._convertYccToRgb(data);
  18184. } else if (this.numComponents === 4) {
  18185. if (this._isColorConversionNeeded) {
  18186. if (forceRGB) {
  18187. return this._convertYcckToRgb(data);
  18188. }
  18189. return this._convertYcckToCmyk(data);
  18190. } else if (forceRGB) {
  18191. return this._convertCmykToRgb(data);
  18192. }
  18193. }
  18194. return data;
  18195. }
  18196. }
  18197. exports.JpegImage = JpegImage;
  18198. /***/ }),
  18199. /* 27 */
  18200. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18201. Object.defineProperty(exports, "__esModule", ({
  18202. value: true
  18203. }));
  18204. exports.JpxStream = void 0;
  18205. var _decode_stream = __w_pdfjs_require__(17);
  18206. var _jpx = __w_pdfjs_require__(28);
  18207. var _util = __w_pdfjs_require__(2);
  18208. class JpxStream extends _decode_stream.DecodeStream {
  18209. constructor(stream, maybeLength, params) {
  18210. super(maybeLength);
  18211. this.stream = stream;
  18212. this.dict = stream.dict;
  18213. this.maybeLength = maybeLength;
  18214. this.params = params;
  18215. }
  18216. get bytes() {
  18217. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  18218. }
  18219. ensureBuffer(requested) {}
  18220. readBlock() {
  18221. if (this.eof) {
  18222. return;
  18223. }
  18224. const jpxImage = new _jpx.JpxImage();
  18225. jpxImage.parse(this.bytes);
  18226. const width = jpxImage.width;
  18227. const height = jpxImage.height;
  18228. const componentsCount = jpxImage.componentsCount;
  18229. const tileCount = jpxImage.tiles.length;
  18230. if (tileCount === 1) {
  18231. this.buffer = jpxImage.tiles[0].items;
  18232. } else {
  18233. const data = new Uint8ClampedArray(width * height * componentsCount);
  18234. for (let k = 0; k < tileCount; k++) {
  18235. const tileComponents = jpxImage.tiles[k];
  18236. const tileWidth = tileComponents.width;
  18237. const tileHeight = tileComponents.height;
  18238. const tileLeft = tileComponents.left;
  18239. const tileTop = tileComponents.top;
  18240. const src = tileComponents.items;
  18241. let srcPosition = 0;
  18242. let dataPosition = (width * tileTop + tileLeft) * componentsCount;
  18243. const imgRowSize = width * componentsCount;
  18244. const tileRowSize = tileWidth * componentsCount;
  18245. for (let j = 0; j < tileHeight; j++) {
  18246. const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  18247. data.set(rowBytes, dataPosition);
  18248. srcPosition += tileRowSize;
  18249. dataPosition += imgRowSize;
  18250. }
  18251. }
  18252. this.buffer = data;
  18253. }
  18254. this.bufferLength = this.buffer.length;
  18255. this.eof = true;
  18256. }
  18257. }
  18258. exports.JpxStream = JpxStream;
  18259. /***/ }),
  18260. /* 28 */
  18261. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18262. Object.defineProperty(exports, "__esModule", ({
  18263. value: true
  18264. }));
  18265. exports.JpxImage = void 0;
  18266. var _util = __w_pdfjs_require__(2);
  18267. var _core_utils = __w_pdfjs_require__(4);
  18268. var _arithmetic_decoder = __w_pdfjs_require__(24);
  18269. class JpxError extends _util.BaseException {
  18270. constructor(msg) {
  18271. super(`JPX error: ${msg}`, "JpxError");
  18272. }
  18273. }
  18274. const SubbandsGainLog2 = {
  18275. LL: 0,
  18276. LH: 1,
  18277. HL: 1,
  18278. HH: 2
  18279. };
  18280. class JpxImage {
  18281. constructor() {
  18282. this.failOnCorruptedImage = false;
  18283. }
  18284. parse(data) {
  18285. const head = (0, _core_utils.readUint16)(data, 0);
  18286. if (head === 0xff4f) {
  18287. this.parseCodestream(data, 0, data.length);
  18288. return;
  18289. }
  18290. const length = data.length;
  18291. let position = 0;
  18292. while (position < length) {
  18293. let headerSize = 8;
  18294. let lbox = (0, _core_utils.readUint32)(data, position);
  18295. const tbox = (0, _core_utils.readUint32)(data, position + 4);
  18296. position += headerSize;
  18297. if (lbox === 1) {
  18298. lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4);
  18299. position += 8;
  18300. headerSize += 8;
  18301. }
  18302. if (lbox === 0) {
  18303. lbox = length - position + headerSize;
  18304. }
  18305. if (lbox < headerSize) {
  18306. throw new JpxError("Invalid box field size");
  18307. }
  18308. const dataLength = lbox - headerSize;
  18309. let jumpDataLength = true;
  18310. switch (tbox) {
  18311. case 0x6a703268:
  18312. jumpDataLength = false;
  18313. break;
  18314. case 0x636f6c72:
  18315. const method = data[position];
  18316. if (method === 1) {
  18317. const colorspace = (0, _core_utils.readUint32)(data, position + 3);
  18318. switch (colorspace) {
  18319. case 16:
  18320. case 17:
  18321. case 18:
  18322. break;
  18323. default:
  18324. (0, _util.warn)("Unknown colorspace " + colorspace);
  18325. break;
  18326. }
  18327. } else if (method === 2) {
  18328. (0, _util.info)("ICC profile not supported");
  18329. }
  18330. break;
  18331. case 0x6a703263:
  18332. this.parseCodestream(data, position, position + dataLength);
  18333. break;
  18334. case 0x6a502020:
  18335. if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) {
  18336. (0, _util.warn)("Invalid JP2 signature");
  18337. }
  18338. break;
  18339. case 0x6a501a1a:
  18340. case 0x66747970:
  18341. case 0x72726571:
  18342. case 0x72657320:
  18343. case 0x69686472:
  18344. break;
  18345. default:
  18346. const headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff);
  18347. (0, _util.warn)(`Unsupported header type ${tbox} (${headerType}).`);
  18348. break;
  18349. }
  18350. if (jumpDataLength) {
  18351. position += dataLength;
  18352. }
  18353. }
  18354. }
  18355. parseImageProperties(stream) {
  18356. let newByte = stream.getByte();
  18357. while (newByte >= 0) {
  18358. const oldByte = newByte;
  18359. newByte = stream.getByte();
  18360. const code = oldByte << 8 | newByte;
  18361. if (code === 0xff51) {
  18362. stream.skip(4);
  18363. const Xsiz = stream.getInt32() >>> 0;
  18364. const Ysiz = stream.getInt32() >>> 0;
  18365. const XOsiz = stream.getInt32() >>> 0;
  18366. const YOsiz = stream.getInt32() >>> 0;
  18367. stream.skip(16);
  18368. const Csiz = stream.getUint16();
  18369. this.width = Xsiz - XOsiz;
  18370. this.height = Ysiz - YOsiz;
  18371. this.componentsCount = Csiz;
  18372. this.bitsPerComponent = 8;
  18373. return;
  18374. }
  18375. }
  18376. throw new JpxError("No size marker found in JPX stream");
  18377. }
  18378. parseCodestream(data, start, end) {
  18379. const context = {};
  18380. let doNotRecover = false;
  18381. try {
  18382. let position = start;
  18383. while (position + 1 < end) {
  18384. const code = (0, _core_utils.readUint16)(data, position);
  18385. position += 2;
  18386. let length = 0,
  18387. j,
  18388. sqcd,
  18389. spqcds,
  18390. spqcdSize,
  18391. scalarExpounded,
  18392. tile;
  18393. switch (code) {
  18394. case 0xff4f:
  18395. context.mainHeader = true;
  18396. break;
  18397. case 0xffd9:
  18398. break;
  18399. case 0xff51:
  18400. length = (0, _core_utils.readUint16)(data, position);
  18401. const siz = {};
  18402. siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);
  18403. siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);
  18404. siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12);
  18405. siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16);
  18406. siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20);
  18407. siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24);
  18408. siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28);
  18409. siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32);
  18410. const componentsCount = (0, _core_utils.readUint16)(data, position + 36);
  18411. siz.Csiz = componentsCount;
  18412. const components = [];
  18413. j = position + 38;
  18414. for (let i = 0; i < componentsCount; i++) {
  18415. const component = {
  18416. precision: (data[j] & 0x7f) + 1,
  18417. isSigned: !!(data[j] & 0x80),
  18418. XRsiz: data[j + 1],
  18419. YRsiz: data[j + 2]
  18420. };
  18421. j += 3;
  18422. calculateComponentDimensions(component, siz);
  18423. components.push(component);
  18424. }
  18425. context.SIZ = siz;
  18426. context.components = components;
  18427. calculateTileGrids(context, components);
  18428. context.QCC = [];
  18429. context.COC = [];
  18430. break;
  18431. case 0xff5c:
  18432. length = (0, _core_utils.readUint16)(data, position);
  18433. const qcd = {};
  18434. j = position + 2;
  18435. sqcd = data[j++];
  18436. switch (sqcd & 0x1f) {
  18437. case 0:
  18438. spqcdSize = 8;
  18439. scalarExpounded = true;
  18440. break;
  18441. case 1:
  18442. spqcdSize = 16;
  18443. scalarExpounded = false;
  18444. break;
  18445. case 2:
  18446. spqcdSize = 16;
  18447. scalarExpounded = true;
  18448. break;
  18449. default:
  18450. throw new Error("Invalid SQcd value " + sqcd);
  18451. }
  18452. qcd.noQuantization = spqcdSize === 8;
  18453. qcd.scalarExpounded = scalarExpounded;
  18454. qcd.guardBits = sqcd >> 5;
  18455. spqcds = [];
  18456. while (j < length + position) {
  18457. const spqcd = {};
  18458. if (spqcdSize === 8) {
  18459. spqcd.epsilon = data[j++] >> 3;
  18460. spqcd.mu = 0;
  18461. } else {
  18462. spqcd.epsilon = data[j] >> 3;
  18463. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  18464. j += 2;
  18465. }
  18466. spqcds.push(spqcd);
  18467. }
  18468. qcd.SPqcds = spqcds;
  18469. if (context.mainHeader) {
  18470. context.QCD = qcd;
  18471. } else {
  18472. context.currentTile.QCD = qcd;
  18473. context.currentTile.QCC = [];
  18474. }
  18475. break;
  18476. case 0xff5d:
  18477. length = (0, _core_utils.readUint16)(data, position);
  18478. const qcc = {};
  18479. j = position + 2;
  18480. let cqcc;
  18481. if (context.SIZ.Csiz < 257) {
  18482. cqcc = data[j++];
  18483. } else {
  18484. cqcc = (0, _core_utils.readUint16)(data, j);
  18485. j += 2;
  18486. }
  18487. sqcd = data[j++];
  18488. switch (sqcd & 0x1f) {
  18489. case 0:
  18490. spqcdSize = 8;
  18491. scalarExpounded = true;
  18492. break;
  18493. case 1:
  18494. spqcdSize = 16;
  18495. scalarExpounded = false;
  18496. break;
  18497. case 2:
  18498. spqcdSize = 16;
  18499. scalarExpounded = true;
  18500. break;
  18501. default:
  18502. throw new Error("Invalid SQcd value " + sqcd);
  18503. }
  18504. qcc.noQuantization = spqcdSize === 8;
  18505. qcc.scalarExpounded = scalarExpounded;
  18506. qcc.guardBits = sqcd >> 5;
  18507. spqcds = [];
  18508. while (j < length + position) {
  18509. const spqcd = {};
  18510. if (spqcdSize === 8) {
  18511. spqcd.epsilon = data[j++] >> 3;
  18512. spqcd.mu = 0;
  18513. } else {
  18514. spqcd.epsilon = data[j] >> 3;
  18515. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  18516. j += 2;
  18517. }
  18518. spqcds.push(spqcd);
  18519. }
  18520. qcc.SPqcds = spqcds;
  18521. if (context.mainHeader) {
  18522. context.QCC[cqcc] = qcc;
  18523. } else {
  18524. context.currentTile.QCC[cqcc] = qcc;
  18525. }
  18526. break;
  18527. case 0xff52:
  18528. length = (0, _core_utils.readUint16)(data, position);
  18529. const cod = {};
  18530. j = position + 2;
  18531. const scod = data[j++];
  18532. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  18533. cod.sopMarkerUsed = !!(scod & 2);
  18534. cod.ephMarkerUsed = !!(scod & 4);
  18535. cod.progressionOrder = data[j++];
  18536. cod.layersCount = (0, _core_utils.readUint16)(data, j);
  18537. j += 2;
  18538. cod.multipleComponentTransform = data[j++];
  18539. cod.decompositionLevelsCount = data[j++];
  18540. cod.xcb = (data[j++] & 0xf) + 2;
  18541. cod.ycb = (data[j++] & 0xf) + 2;
  18542. const blockStyle = data[j++];
  18543. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  18544. cod.resetContextProbabilities = !!(blockStyle & 2);
  18545. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  18546. cod.verticallyStripe = !!(blockStyle & 8);
  18547. cod.predictableTermination = !!(blockStyle & 16);
  18548. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  18549. cod.reversibleTransformation = data[j++];
  18550. if (cod.entropyCoderWithCustomPrecincts) {
  18551. const precinctsSizes = [];
  18552. while (j < length + position) {
  18553. const precinctsSize = data[j++];
  18554. precinctsSizes.push({
  18555. PPx: precinctsSize & 0xf,
  18556. PPy: precinctsSize >> 4
  18557. });
  18558. }
  18559. cod.precinctsSizes = precinctsSizes;
  18560. }
  18561. const unsupported = [];
  18562. if (cod.selectiveArithmeticCodingBypass) {
  18563. unsupported.push("selectiveArithmeticCodingBypass");
  18564. }
  18565. if (cod.terminationOnEachCodingPass) {
  18566. unsupported.push("terminationOnEachCodingPass");
  18567. }
  18568. if (cod.verticallyStripe) {
  18569. unsupported.push("verticallyStripe");
  18570. }
  18571. if (cod.predictableTermination) {
  18572. unsupported.push("predictableTermination");
  18573. }
  18574. if (unsupported.length > 0) {
  18575. doNotRecover = true;
  18576. (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`);
  18577. }
  18578. if (context.mainHeader) {
  18579. context.COD = cod;
  18580. } else {
  18581. context.currentTile.COD = cod;
  18582. context.currentTile.COC = [];
  18583. }
  18584. break;
  18585. case 0xff90:
  18586. length = (0, _core_utils.readUint16)(data, position);
  18587. tile = {};
  18588. tile.index = (0, _core_utils.readUint16)(data, position + 2);
  18589. tile.length = (0, _core_utils.readUint32)(data, position + 4);
  18590. tile.dataEnd = tile.length + position - 2;
  18591. tile.partIndex = data[position + 8];
  18592. tile.partsCount = data[position + 9];
  18593. context.mainHeader = false;
  18594. if (tile.partIndex === 0) {
  18595. tile.COD = context.COD;
  18596. tile.COC = context.COC.slice(0);
  18597. tile.QCD = context.QCD;
  18598. tile.QCC = context.QCC.slice(0);
  18599. }
  18600. context.currentTile = tile;
  18601. break;
  18602. case 0xff93:
  18603. tile = context.currentTile;
  18604. if (tile.partIndex === 0) {
  18605. initializeTile(context, tile.index);
  18606. buildPackets(context);
  18607. }
  18608. length = tile.dataEnd - position;
  18609. parseTilePackets(context, data, position, length);
  18610. break;
  18611. case 0xff53:
  18612. (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented.");
  18613. case 0xff55:
  18614. case 0xff57:
  18615. case 0xff58:
  18616. case 0xff64:
  18617. length = (0, _core_utils.readUint16)(data, position);
  18618. break;
  18619. default:
  18620. throw new Error("Unknown codestream code: " + code.toString(16));
  18621. }
  18622. position += length;
  18623. }
  18624. } catch (e) {
  18625. if (doNotRecover || this.failOnCorruptedImage) {
  18626. throw new JpxError(e.message);
  18627. } else {
  18628. (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`);
  18629. }
  18630. }
  18631. this.tiles = transformComponents(context);
  18632. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  18633. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  18634. this.componentsCount = context.SIZ.Csiz;
  18635. }
  18636. }
  18637. exports.JpxImage = JpxImage;
  18638. function calculateComponentDimensions(component, siz) {
  18639. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  18640. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  18641. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  18642. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  18643. component.width = component.x1 - component.x0;
  18644. component.height = component.y1 - component.y0;
  18645. }
  18646. function calculateTileGrids(context, components) {
  18647. const siz = context.SIZ;
  18648. const tiles = [];
  18649. let tile;
  18650. const numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  18651. const numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  18652. for (let q = 0; q < numYtiles; q++) {
  18653. for (let p = 0; p < numXtiles; p++) {
  18654. tile = {};
  18655. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  18656. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  18657. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  18658. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  18659. tile.width = tile.tx1 - tile.tx0;
  18660. tile.height = tile.ty1 - tile.ty0;
  18661. tile.components = [];
  18662. tiles.push(tile);
  18663. }
  18664. }
  18665. context.tiles = tiles;
  18666. const componentsCount = siz.Csiz;
  18667. for (let i = 0, ii = componentsCount; i < ii; i++) {
  18668. const component = components[i];
  18669. for (let j = 0, jj = tiles.length; j < jj; j++) {
  18670. const tileComponent = {};
  18671. tile = tiles[j];
  18672. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  18673. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  18674. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  18675. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  18676. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  18677. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  18678. tile.components[i] = tileComponent;
  18679. }
  18680. }
  18681. }
  18682. function getBlocksDimensions(context, component, r) {
  18683. const codOrCoc = component.codingStyleParameters;
  18684. const result = {};
  18685. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  18686. result.PPx = 15;
  18687. result.PPy = 15;
  18688. } else {
  18689. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  18690. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  18691. }
  18692. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  18693. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  18694. return result;
  18695. }
  18696. function buildPrecincts(context, resolution, dimensions) {
  18697. const precinctWidth = 1 << dimensions.PPx;
  18698. const precinctHeight = 1 << dimensions.PPy;
  18699. const isZeroRes = resolution.resLevel === 0;
  18700. const precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  18701. const precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  18702. const numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  18703. const numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  18704. const numprecincts = numprecinctswide * numprecinctshigh;
  18705. resolution.precinctParameters = {
  18706. precinctWidth,
  18707. precinctHeight,
  18708. numprecinctswide,
  18709. numprecinctshigh,
  18710. numprecincts,
  18711. precinctWidthInSubband,
  18712. precinctHeightInSubband
  18713. };
  18714. }
  18715. function buildCodeblocks(context, subband, dimensions) {
  18716. const xcb_ = dimensions.xcb_;
  18717. const ycb_ = dimensions.ycb_;
  18718. const codeblockWidth = 1 << xcb_;
  18719. const codeblockHeight = 1 << ycb_;
  18720. const cbx0 = subband.tbx0 >> xcb_;
  18721. const cby0 = subband.tby0 >> ycb_;
  18722. const cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  18723. const cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  18724. const precinctParameters = subband.resolution.precinctParameters;
  18725. const codeblocks = [];
  18726. const precincts = [];
  18727. let i, j, codeblock, precinctNumber;
  18728. for (j = cby0; j < cby1; j++) {
  18729. for (i = cbx0; i < cbx1; i++) {
  18730. codeblock = {
  18731. cbx: i,
  18732. cby: j,
  18733. tbx0: codeblockWidth * i,
  18734. tby0: codeblockHeight * j,
  18735. tbx1: codeblockWidth * (i + 1),
  18736. tby1: codeblockHeight * (j + 1)
  18737. };
  18738. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  18739. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  18740. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  18741. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  18742. const pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  18743. const pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  18744. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  18745. codeblock.precinctNumber = precinctNumber;
  18746. codeblock.subbandType = subband.type;
  18747. codeblock.Lblock = 3;
  18748. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  18749. continue;
  18750. }
  18751. codeblocks.push(codeblock);
  18752. let precinct = precincts[precinctNumber];
  18753. if (precinct !== undefined) {
  18754. if (i < precinct.cbxMin) {
  18755. precinct.cbxMin = i;
  18756. } else if (i > precinct.cbxMax) {
  18757. precinct.cbxMax = i;
  18758. }
  18759. if (j < precinct.cbyMin) {
  18760. precinct.cbxMin = j;
  18761. } else if (j > precinct.cbyMax) {
  18762. precinct.cbyMax = j;
  18763. }
  18764. } else {
  18765. precincts[precinctNumber] = precinct = {
  18766. cbxMin: i,
  18767. cbyMin: j,
  18768. cbxMax: i,
  18769. cbyMax: j
  18770. };
  18771. }
  18772. codeblock.precinct = precinct;
  18773. }
  18774. }
  18775. subband.codeblockParameters = {
  18776. codeblockWidth: xcb_,
  18777. codeblockHeight: ycb_,
  18778. numcodeblockwide: cbx1 - cbx0 + 1,
  18779. numcodeblockhigh: cby1 - cby0 + 1
  18780. };
  18781. subband.codeblocks = codeblocks;
  18782. subband.precincts = precincts;
  18783. }
  18784. function createPacket(resolution, precinctNumber, layerNumber) {
  18785. const precinctCodeblocks = [];
  18786. const subbands = resolution.subbands;
  18787. for (let i = 0, ii = subbands.length; i < ii; i++) {
  18788. const subband = subbands[i];
  18789. const codeblocks = subband.codeblocks;
  18790. for (let j = 0, jj = codeblocks.length; j < jj; j++) {
  18791. const codeblock = codeblocks[j];
  18792. if (codeblock.precinctNumber !== precinctNumber) {
  18793. continue;
  18794. }
  18795. precinctCodeblocks.push(codeblock);
  18796. }
  18797. }
  18798. return {
  18799. layerNumber,
  18800. codeblocks: precinctCodeblocks
  18801. };
  18802. }
  18803. function LayerResolutionComponentPositionIterator(context) {
  18804. const siz = context.SIZ;
  18805. const tileIndex = context.currentTile.index;
  18806. const tile = context.tiles[tileIndex];
  18807. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18808. const componentsCount = siz.Csiz;
  18809. let maxDecompositionLevelsCount = 0;
  18810. for (let q = 0; q < componentsCount; q++) {
  18811. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  18812. }
  18813. let l = 0,
  18814. r = 0,
  18815. i = 0,
  18816. k = 0;
  18817. this.nextPacket = function JpxImage_nextPacket() {
  18818. for (; l < layersCount; l++) {
  18819. for (; r <= maxDecompositionLevelsCount; r++) {
  18820. for (; i < componentsCount; i++) {
  18821. const component = tile.components[i];
  18822. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  18823. continue;
  18824. }
  18825. const resolution = component.resolutions[r];
  18826. const numprecincts = resolution.precinctParameters.numprecincts;
  18827. for (; k < numprecincts;) {
  18828. const packet = createPacket(resolution, k, l);
  18829. k++;
  18830. return packet;
  18831. }
  18832. k = 0;
  18833. }
  18834. i = 0;
  18835. }
  18836. r = 0;
  18837. }
  18838. throw new JpxError("Out of packets");
  18839. };
  18840. }
  18841. function ResolutionLayerComponentPositionIterator(context) {
  18842. const siz = context.SIZ;
  18843. const tileIndex = context.currentTile.index;
  18844. const tile = context.tiles[tileIndex];
  18845. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18846. const componentsCount = siz.Csiz;
  18847. let maxDecompositionLevelsCount = 0;
  18848. for (let q = 0; q < componentsCount; q++) {
  18849. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  18850. }
  18851. let r = 0,
  18852. l = 0,
  18853. i = 0,
  18854. k = 0;
  18855. this.nextPacket = function JpxImage_nextPacket() {
  18856. for (; r <= maxDecompositionLevelsCount; r++) {
  18857. for (; l < layersCount; l++) {
  18858. for (; i < componentsCount; i++) {
  18859. const component = tile.components[i];
  18860. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  18861. continue;
  18862. }
  18863. const resolution = component.resolutions[r];
  18864. const numprecincts = resolution.precinctParameters.numprecincts;
  18865. for (; k < numprecincts;) {
  18866. const packet = createPacket(resolution, k, l);
  18867. k++;
  18868. return packet;
  18869. }
  18870. k = 0;
  18871. }
  18872. i = 0;
  18873. }
  18874. l = 0;
  18875. }
  18876. throw new JpxError("Out of packets");
  18877. };
  18878. }
  18879. function ResolutionPositionComponentLayerIterator(context) {
  18880. const siz = context.SIZ;
  18881. const tileIndex = context.currentTile.index;
  18882. const tile = context.tiles[tileIndex];
  18883. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18884. const componentsCount = siz.Csiz;
  18885. let l, r, c, p;
  18886. let maxDecompositionLevelsCount = 0;
  18887. for (c = 0; c < componentsCount; c++) {
  18888. const component = tile.components[c];
  18889. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  18890. }
  18891. const maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  18892. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  18893. let maxNumPrecincts = 0;
  18894. for (c = 0; c < componentsCount; ++c) {
  18895. const resolutions = tile.components[c].resolutions;
  18896. if (r < resolutions.length) {
  18897. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  18898. }
  18899. }
  18900. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  18901. }
  18902. l = 0;
  18903. r = 0;
  18904. c = 0;
  18905. p = 0;
  18906. this.nextPacket = function JpxImage_nextPacket() {
  18907. for (; r <= maxDecompositionLevelsCount; r++) {
  18908. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  18909. for (; c < componentsCount; c++) {
  18910. const component = tile.components[c];
  18911. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  18912. continue;
  18913. }
  18914. const resolution = component.resolutions[r];
  18915. const numprecincts = resolution.precinctParameters.numprecincts;
  18916. if (p >= numprecincts) {
  18917. continue;
  18918. }
  18919. for (; l < layersCount;) {
  18920. const packet = createPacket(resolution, p, l);
  18921. l++;
  18922. return packet;
  18923. }
  18924. l = 0;
  18925. }
  18926. c = 0;
  18927. }
  18928. p = 0;
  18929. }
  18930. throw new JpxError("Out of packets");
  18931. };
  18932. }
  18933. function PositionComponentResolutionLayerIterator(context) {
  18934. const siz = context.SIZ;
  18935. const tileIndex = context.currentTile.index;
  18936. const tile = context.tiles[tileIndex];
  18937. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18938. const componentsCount = siz.Csiz;
  18939. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  18940. const precinctsIterationSizes = precinctsSizes;
  18941. let l = 0,
  18942. r = 0,
  18943. c = 0,
  18944. px = 0,
  18945. py = 0;
  18946. this.nextPacket = function JpxImage_nextPacket() {
  18947. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  18948. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  18949. for (; c < componentsCount; c++) {
  18950. const component = tile.components[c];
  18951. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  18952. for (; r <= decompositionLevelsCount; r++) {
  18953. const resolution = component.resolutions[r];
  18954. const sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  18955. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  18956. if (k === null) {
  18957. continue;
  18958. }
  18959. for (; l < layersCount;) {
  18960. const packet = createPacket(resolution, k, l);
  18961. l++;
  18962. return packet;
  18963. }
  18964. l = 0;
  18965. }
  18966. r = 0;
  18967. }
  18968. c = 0;
  18969. }
  18970. px = 0;
  18971. }
  18972. throw new JpxError("Out of packets");
  18973. };
  18974. }
  18975. function ComponentPositionResolutionLayerIterator(context) {
  18976. const siz = context.SIZ;
  18977. const tileIndex = context.currentTile.index;
  18978. const tile = context.tiles[tileIndex];
  18979. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18980. const componentsCount = siz.Csiz;
  18981. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  18982. let l = 0,
  18983. r = 0,
  18984. c = 0,
  18985. px = 0,
  18986. py = 0;
  18987. this.nextPacket = function JpxImage_nextPacket() {
  18988. for (; c < componentsCount; ++c) {
  18989. const component = tile.components[c];
  18990. const precinctsIterationSizes = precinctsSizes.components[c];
  18991. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  18992. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  18993. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  18994. for (; r <= decompositionLevelsCount; r++) {
  18995. const resolution = component.resolutions[r];
  18996. const sizeInImageScale = precinctsIterationSizes.resolutions[r];
  18997. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  18998. if (k === null) {
  18999. continue;
  19000. }
  19001. for (; l < layersCount;) {
  19002. const packet = createPacket(resolution, k, l);
  19003. l++;
  19004. return packet;
  19005. }
  19006. l = 0;
  19007. }
  19008. r = 0;
  19009. }
  19010. px = 0;
  19011. }
  19012. py = 0;
  19013. }
  19014. throw new JpxError("Out of packets");
  19015. };
  19016. }
  19017. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  19018. const posX = pxIndex * precinctIterationSizes.minWidth;
  19019. const posY = pyIndex * precinctIterationSizes.minHeight;
  19020. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  19021. return null;
  19022. }
  19023. const startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  19024. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  19025. }
  19026. function getPrecinctSizesInImageScale(tile) {
  19027. const componentsCount = tile.components.length;
  19028. let minWidth = Number.MAX_VALUE;
  19029. let minHeight = Number.MAX_VALUE;
  19030. let maxNumWide = 0;
  19031. let maxNumHigh = 0;
  19032. const sizePerComponent = new Array(componentsCount);
  19033. for (let c = 0; c < componentsCount; c++) {
  19034. const component = tile.components[c];
  19035. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  19036. const sizePerResolution = new Array(decompositionLevelsCount + 1);
  19037. let minWidthCurrentComponent = Number.MAX_VALUE;
  19038. let minHeightCurrentComponent = Number.MAX_VALUE;
  19039. let maxNumWideCurrentComponent = 0;
  19040. let maxNumHighCurrentComponent = 0;
  19041. let scale = 1;
  19042. for (let r = decompositionLevelsCount; r >= 0; --r) {
  19043. const resolution = component.resolutions[r];
  19044. const widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  19045. const heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  19046. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  19047. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  19048. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  19049. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  19050. sizePerResolution[r] = {
  19051. width: widthCurrentResolution,
  19052. height: heightCurrentResolution
  19053. };
  19054. scale <<= 1;
  19055. }
  19056. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  19057. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  19058. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  19059. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  19060. sizePerComponent[c] = {
  19061. resolutions: sizePerResolution,
  19062. minWidth: minWidthCurrentComponent,
  19063. minHeight: minHeightCurrentComponent,
  19064. maxNumWide: maxNumWideCurrentComponent,
  19065. maxNumHigh: maxNumHighCurrentComponent
  19066. };
  19067. }
  19068. return {
  19069. components: sizePerComponent,
  19070. minWidth,
  19071. minHeight,
  19072. maxNumWide,
  19073. maxNumHigh
  19074. };
  19075. }
  19076. function buildPackets(context) {
  19077. const siz = context.SIZ;
  19078. const tileIndex = context.currentTile.index;
  19079. const tile = context.tiles[tileIndex];
  19080. const componentsCount = siz.Csiz;
  19081. for (let c = 0; c < componentsCount; c++) {
  19082. const component = tile.components[c];
  19083. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  19084. const resolutions = [];
  19085. const subbands = [];
  19086. for (let r = 0; r <= decompositionLevelsCount; r++) {
  19087. const blocksDimensions = getBlocksDimensions(context, component, r);
  19088. const resolution = {};
  19089. const scale = 1 << decompositionLevelsCount - r;
  19090. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  19091. resolution.try0 = Math.ceil(component.tcy0 / scale);
  19092. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  19093. resolution.try1 = Math.ceil(component.tcy1 / scale);
  19094. resolution.resLevel = r;
  19095. buildPrecincts(context, resolution, blocksDimensions);
  19096. resolutions.push(resolution);
  19097. let subband;
  19098. if (r === 0) {
  19099. subband = {};
  19100. subband.type = "LL";
  19101. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  19102. subband.tby0 = Math.ceil(component.tcy0 / scale);
  19103. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  19104. subband.tby1 = Math.ceil(component.tcy1 / scale);
  19105. subband.resolution = resolution;
  19106. buildCodeblocks(context, subband, blocksDimensions);
  19107. subbands.push(subband);
  19108. resolution.subbands = [subband];
  19109. } else {
  19110. const bscale = 1 << decompositionLevelsCount - r + 1;
  19111. const resolutionSubbands = [];
  19112. subband = {};
  19113. subband.type = "HL";
  19114. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  19115. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  19116. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  19117. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  19118. subband.resolution = resolution;
  19119. buildCodeblocks(context, subband, blocksDimensions);
  19120. subbands.push(subband);
  19121. resolutionSubbands.push(subband);
  19122. subband = {};
  19123. subband.type = "LH";
  19124. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  19125. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  19126. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  19127. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  19128. subband.resolution = resolution;
  19129. buildCodeblocks(context, subband, blocksDimensions);
  19130. subbands.push(subband);
  19131. resolutionSubbands.push(subband);
  19132. subband = {};
  19133. subband.type = "HH";
  19134. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  19135. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  19136. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  19137. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  19138. subband.resolution = resolution;
  19139. buildCodeblocks(context, subband, blocksDimensions);
  19140. subbands.push(subband);
  19141. resolutionSubbands.push(subband);
  19142. resolution.subbands = resolutionSubbands;
  19143. }
  19144. }
  19145. component.resolutions = resolutions;
  19146. component.subbands = subbands;
  19147. }
  19148. const progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  19149. switch (progressionOrder) {
  19150. case 0:
  19151. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  19152. break;
  19153. case 1:
  19154. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  19155. break;
  19156. case 2:
  19157. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  19158. break;
  19159. case 3:
  19160. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  19161. break;
  19162. case 4:
  19163. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  19164. break;
  19165. default:
  19166. throw new JpxError(`Unsupported progression order ${progressionOrder}`);
  19167. }
  19168. }
  19169. function parseTilePackets(context, data, offset, dataLength) {
  19170. let position = 0;
  19171. let buffer,
  19172. bufferSize = 0,
  19173. skipNextBit = false;
  19174. function readBits(count) {
  19175. while (bufferSize < count) {
  19176. const b = data[offset + position];
  19177. position++;
  19178. if (skipNextBit) {
  19179. buffer = buffer << 7 | b;
  19180. bufferSize += 7;
  19181. skipNextBit = false;
  19182. } else {
  19183. buffer = buffer << 8 | b;
  19184. bufferSize += 8;
  19185. }
  19186. if (b === 0xff) {
  19187. skipNextBit = true;
  19188. }
  19189. }
  19190. bufferSize -= count;
  19191. return buffer >>> bufferSize & (1 << count) - 1;
  19192. }
  19193. function skipMarkerIfEqual(value) {
  19194. if (data[offset + position - 1] === 0xff && data[offset + position] === value) {
  19195. skipBytes(1);
  19196. return true;
  19197. } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) {
  19198. skipBytes(2);
  19199. return true;
  19200. }
  19201. return false;
  19202. }
  19203. function skipBytes(count) {
  19204. position += count;
  19205. }
  19206. function alignToByte() {
  19207. bufferSize = 0;
  19208. if (skipNextBit) {
  19209. position++;
  19210. skipNextBit = false;
  19211. }
  19212. }
  19213. function readCodingpasses() {
  19214. if (readBits(1) === 0) {
  19215. return 1;
  19216. }
  19217. if (readBits(1) === 0) {
  19218. return 2;
  19219. }
  19220. let value = readBits(2);
  19221. if (value < 3) {
  19222. return value + 3;
  19223. }
  19224. value = readBits(5);
  19225. if (value < 31) {
  19226. return value + 6;
  19227. }
  19228. value = readBits(7);
  19229. return value + 37;
  19230. }
  19231. const tileIndex = context.currentTile.index;
  19232. const tile = context.tiles[tileIndex];
  19233. const sopMarkerUsed = context.COD.sopMarkerUsed;
  19234. const ephMarkerUsed = context.COD.ephMarkerUsed;
  19235. const packetsIterator = tile.packetsIterator;
  19236. while (position < dataLength) {
  19237. alignToByte();
  19238. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  19239. skipBytes(4);
  19240. }
  19241. const packet = packetsIterator.nextPacket();
  19242. if (!readBits(1)) {
  19243. continue;
  19244. }
  19245. const layerNumber = packet.layerNumber,
  19246. queue = [];
  19247. let codeblock;
  19248. for (let i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  19249. codeblock = packet.codeblocks[i];
  19250. let precinct = codeblock.precinct;
  19251. const codeblockColumn = codeblock.cbx - precinct.cbxMin;
  19252. const codeblockRow = codeblock.cby - precinct.cbyMin;
  19253. let codeblockIncluded = false;
  19254. let firstTimeInclusion = false;
  19255. let valueReady, zeroBitPlanesTree;
  19256. if (codeblock.included !== undefined) {
  19257. codeblockIncluded = !!readBits(1);
  19258. } else {
  19259. precinct = codeblock.precinct;
  19260. let inclusionTree;
  19261. if (precinct.inclusionTree !== undefined) {
  19262. inclusionTree = precinct.inclusionTree;
  19263. } else {
  19264. const width = precinct.cbxMax - precinct.cbxMin + 1;
  19265. const height = precinct.cbyMax - precinct.cbyMin + 1;
  19266. inclusionTree = new InclusionTree(width, height, layerNumber);
  19267. zeroBitPlanesTree = new TagTree(width, height);
  19268. precinct.inclusionTree = inclusionTree;
  19269. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  19270. for (let l = 0; l < layerNumber; l++) {
  19271. if (readBits(1) !== 0) {
  19272. throw new JpxError("Invalid tag tree");
  19273. }
  19274. }
  19275. }
  19276. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  19277. while (true) {
  19278. if (readBits(1)) {
  19279. valueReady = !inclusionTree.nextLevel();
  19280. if (valueReady) {
  19281. codeblock.included = true;
  19282. codeblockIncluded = firstTimeInclusion = true;
  19283. break;
  19284. }
  19285. } else {
  19286. inclusionTree.incrementValue(layerNumber);
  19287. break;
  19288. }
  19289. }
  19290. }
  19291. }
  19292. if (!codeblockIncluded) {
  19293. continue;
  19294. }
  19295. if (firstTimeInclusion) {
  19296. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  19297. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  19298. while (true) {
  19299. if (readBits(1)) {
  19300. valueReady = !zeroBitPlanesTree.nextLevel();
  19301. if (valueReady) {
  19302. break;
  19303. }
  19304. } else {
  19305. zeroBitPlanesTree.incrementValue();
  19306. }
  19307. }
  19308. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  19309. }
  19310. const codingpasses = readCodingpasses();
  19311. while (readBits(1)) {
  19312. codeblock.Lblock++;
  19313. }
  19314. const codingpassesLog2 = (0, _core_utils.log2)(codingpasses);
  19315. const bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  19316. const codedDataLength = readBits(bits);
  19317. queue.push({
  19318. codeblock,
  19319. codingpasses,
  19320. dataLength: codedDataLength
  19321. });
  19322. }
  19323. alignToByte();
  19324. if (ephMarkerUsed) {
  19325. skipMarkerIfEqual(0x92);
  19326. }
  19327. while (queue.length > 0) {
  19328. const packetItem = queue.shift();
  19329. codeblock = packetItem.codeblock;
  19330. if (codeblock.data === undefined) {
  19331. codeblock.data = [];
  19332. }
  19333. codeblock.data.push({
  19334. data,
  19335. start: offset + position,
  19336. end: offset + position + packetItem.dataLength,
  19337. codingpasses: packetItem.codingpasses
  19338. });
  19339. position += packetItem.dataLength;
  19340. }
  19341. }
  19342. return position;
  19343. }
  19344. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities) {
  19345. const x0 = subband.tbx0;
  19346. const y0 = subband.tby0;
  19347. const width = subband.tbx1 - subband.tbx0;
  19348. const codeblocks = subband.codeblocks;
  19349. const right = subband.type.charAt(0) === "H" ? 1 : 0;
  19350. const bottom = subband.type.charAt(1) === "H" ? levelWidth : 0;
  19351. for (let i = 0, ii = codeblocks.length; i < ii; ++i) {
  19352. const codeblock = codeblocks[i];
  19353. const blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  19354. const blockHeight = codeblock.tby1_ - codeblock.tby0_;
  19355. if (blockWidth === 0 || blockHeight === 0) {
  19356. continue;
  19357. }
  19358. if (codeblock.data === undefined) {
  19359. continue;
  19360. }
  19361. const bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  19362. let currentCodingpassType = 2;
  19363. const data = codeblock.data;
  19364. let totalLength = 0,
  19365. codingpasses = 0;
  19366. let j, jj, dataItem;
  19367. for (j = 0, jj = data.length; j < jj; j++) {
  19368. dataItem = data[j];
  19369. totalLength += dataItem.end - dataItem.start;
  19370. codingpasses += dataItem.codingpasses;
  19371. }
  19372. const encodedData = new Uint8Array(totalLength);
  19373. let position = 0;
  19374. for (j = 0, jj = data.length; j < jj; j++) {
  19375. dataItem = data[j];
  19376. const chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  19377. encodedData.set(chunk, position);
  19378. position += chunk.length;
  19379. }
  19380. const decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
  19381. bitModel.setDecoder(decoder);
  19382. for (j = 0; j < codingpasses; j++) {
  19383. switch (currentCodingpassType) {
  19384. case 0:
  19385. bitModel.runSignificancePropagationPass();
  19386. break;
  19387. case 1:
  19388. bitModel.runMagnitudeRefinementPass();
  19389. break;
  19390. case 2:
  19391. bitModel.runCleanupPass();
  19392. if (segmentationSymbolUsed) {
  19393. bitModel.checkSegmentationSymbol();
  19394. }
  19395. break;
  19396. }
  19397. if (resetContextProbabilities) {
  19398. bitModel.reset();
  19399. }
  19400. currentCodingpassType = (currentCodingpassType + 1) % 3;
  19401. }
  19402. let offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  19403. const sign = bitModel.coefficentsSign;
  19404. const magnitude = bitModel.coefficentsMagnitude;
  19405. const bitsDecoded = bitModel.bitsDecoded;
  19406. const magnitudeCorrection = reversible ? 0 : 0.5;
  19407. let k, n, nb;
  19408. position = 0;
  19409. const interleave = subband.type !== "LL";
  19410. for (j = 0; j < blockHeight; j++) {
  19411. const row = offset / width | 0;
  19412. const levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  19413. for (k = 0; k < blockWidth; k++) {
  19414. n = magnitude[position];
  19415. if (n !== 0) {
  19416. n = (n + magnitudeCorrection) * delta;
  19417. if (sign[position] !== 0) {
  19418. n = -n;
  19419. }
  19420. nb = bitsDecoded[position];
  19421. const pos = interleave ? levelOffset + (offset << 1) : offset;
  19422. if (reversible && nb >= mb) {
  19423. coefficients[pos] = n;
  19424. } else {
  19425. coefficients[pos] = n * (1 << mb - nb);
  19426. }
  19427. }
  19428. offset++;
  19429. position++;
  19430. }
  19431. offset += width - blockWidth;
  19432. }
  19433. }
  19434. }
  19435. function transformTile(context, tile, c) {
  19436. const component = tile.components[c];
  19437. const codingStyleParameters = component.codingStyleParameters;
  19438. const quantizationParameters = component.quantizationParameters;
  19439. const decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  19440. const spqcds = quantizationParameters.SPqcds;
  19441. const scalarExpounded = quantizationParameters.scalarExpounded;
  19442. const guardBits = quantizationParameters.guardBits;
  19443. const segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  19444. const resetContextProbabilities = codingStyleParameters.resetContextProbabilities;
  19445. const precision = context.components[c].precision;
  19446. const reversible = codingStyleParameters.reversibleTransformation;
  19447. const transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  19448. const subbandCoefficients = [];
  19449. let b = 0;
  19450. for (let i = 0; i <= decompositionLevelsCount; i++) {
  19451. const resolution = component.resolutions[i];
  19452. const width = resolution.trx1 - resolution.trx0;
  19453. const height = resolution.try1 - resolution.try0;
  19454. const coefficients = new Float32Array(width * height);
  19455. for (let j = 0, jj = resolution.subbands.length; j < jj; j++) {
  19456. let mu, epsilon;
  19457. if (!scalarExpounded) {
  19458. mu = spqcds[0].mu;
  19459. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  19460. } else {
  19461. mu = spqcds[b].mu;
  19462. epsilon = spqcds[b].epsilon;
  19463. b++;
  19464. }
  19465. const subband = resolution.subbands[j];
  19466. const gainLog2 = SubbandsGainLog2[subband.type];
  19467. const delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
  19468. const mb = guardBits + epsilon - 1;
  19469. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities);
  19470. }
  19471. subbandCoefficients.push({
  19472. width,
  19473. height,
  19474. items: coefficients
  19475. });
  19476. }
  19477. const result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  19478. return {
  19479. left: component.tcx0,
  19480. top: component.tcy0,
  19481. width: result.width,
  19482. height: result.height,
  19483. items: result.items
  19484. };
  19485. }
  19486. function transformComponents(context) {
  19487. const siz = context.SIZ;
  19488. const components = context.components;
  19489. const componentsCount = siz.Csiz;
  19490. const resultImages = [];
  19491. for (let i = 0, ii = context.tiles.length; i < ii; i++) {
  19492. const tile = context.tiles[i];
  19493. const transformedTiles = [];
  19494. for (let c = 0; c < componentsCount; c++) {
  19495. transformedTiles[c] = transformTile(context, tile, c);
  19496. }
  19497. const tile0 = transformedTiles[0];
  19498. const out = new Uint8ClampedArray(tile0.items.length * componentsCount);
  19499. const result = {
  19500. left: tile0.left,
  19501. top: tile0.top,
  19502. width: tile0.width,
  19503. height: tile0.height,
  19504. items: out
  19505. };
  19506. let shift, offset;
  19507. let pos = 0,
  19508. j,
  19509. jj,
  19510. y0,
  19511. y1,
  19512. y2;
  19513. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  19514. const fourComponents = componentsCount === 4;
  19515. const y0items = transformedTiles[0].items;
  19516. const y1items = transformedTiles[1].items;
  19517. const y2items = transformedTiles[2].items;
  19518. const y3items = fourComponents ? transformedTiles[3].items : null;
  19519. shift = components[0].precision - 8;
  19520. offset = (128 << shift) + 0.5;
  19521. const component0 = tile.components[0];
  19522. const alpha01 = componentsCount - 3;
  19523. jj = y0items.length;
  19524. if (!component0.codingStyleParameters.reversibleTransformation) {
  19525. for (j = 0; j < jj; j++, pos += alpha01) {
  19526. y0 = y0items[j] + offset;
  19527. y1 = y1items[j];
  19528. y2 = y2items[j];
  19529. out[pos++] = y0 + 1.402 * y2 >> shift;
  19530. out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
  19531. out[pos++] = y0 + 1.772 * y1 >> shift;
  19532. }
  19533. } else {
  19534. for (j = 0; j < jj; j++, pos += alpha01) {
  19535. y0 = y0items[j] + offset;
  19536. y1 = y1items[j];
  19537. y2 = y2items[j];
  19538. const g = y0 - (y2 + y1 >> 2);
  19539. out[pos++] = g + y2 >> shift;
  19540. out[pos++] = g >> shift;
  19541. out[pos++] = g + y1 >> shift;
  19542. }
  19543. }
  19544. if (fourComponents) {
  19545. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  19546. out[pos] = y3items[j] + offset >> shift;
  19547. }
  19548. }
  19549. } else {
  19550. for (let c = 0; c < componentsCount; c++) {
  19551. const items = transformedTiles[c].items;
  19552. shift = components[c].precision - 8;
  19553. offset = (128 << shift) + 0.5;
  19554. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  19555. out[pos] = items[j] + offset >> shift;
  19556. pos += componentsCount;
  19557. }
  19558. }
  19559. }
  19560. resultImages.push(result);
  19561. }
  19562. return resultImages;
  19563. }
  19564. function initializeTile(context, tileIndex) {
  19565. const siz = context.SIZ;
  19566. const componentsCount = siz.Csiz;
  19567. const tile = context.tiles[tileIndex];
  19568. for (let c = 0; c < componentsCount; c++) {
  19569. const component = tile.components[c];
  19570. const qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  19571. component.quantizationParameters = qcdOrQcc;
  19572. const codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  19573. component.codingStyleParameters = codOrCoc;
  19574. }
  19575. tile.codingStyleDefaultParameters = context.currentTile.COD;
  19576. }
  19577. class TagTree {
  19578. constructor(width, height) {
  19579. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  19580. this.levels = [];
  19581. for (let i = 0; i < levelsLength; i++) {
  19582. const level = {
  19583. width,
  19584. height,
  19585. items: []
  19586. };
  19587. this.levels.push(level);
  19588. width = Math.ceil(width / 2);
  19589. height = Math.ceil(height / 2);
  19590. }
  19591. }
  19592. reset(i, j) {
  19593. let currentLevel = 0,
  19594. value = 0,
  19595. level;
  19596. while (currentLevel < this.levels.length) {
  19597. level = this.levels[currentLevel];
  19598. const index = i + j * level.width;
  19599. if (level.items[index] !== undefined) {
  19600. value = level.items[index];
  19601. break;
  19602. }
  19603. level.index = index;
  19604. i >>= 1;
  19605. j >>= 1;
  19606. currentLevel++;
  19607. }
  19608. currentLevel--;
  19609. level = this.levels[currentLevel];
  19610. level.items[level.index] = value;
  19611. this.currentLevel = currentLevel;
  19612. delete this.value;
  19613. }
  19614. incrementValue() {
  19615. const level = this.levels[this.currentLevel];
  19616. level.items[level.index]++;
  19617. }
  19618. nextLevel() {
  19619. let currentLevel = this.currentLevel;
  19620. let level = this.levels[currentLevel];
  19621. const value = level.items[level.index];
  19622. currentLevel--;
  19623. if (currentLevel < 0) {
  19624. this.value = value;
  19625. return false;
  19626. }
  19627. this.currentLevel = currentLevel;
  19628. level = this.levels[currentLevel];
  19629. level.items[level.index] = value;
  19630. return true;
  19631. }
  19632. }
  19633. class InclusionTree {
  19634. constructor(width, height, defaultValue) {
  19635. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  19636. this.levels = [];
  19637. for (let i = 0; i < levelsLength; i++) {
  19638. const items = new Uint8Array(width * height);
  19639. for (let j = 0, jj = items.length; j < jj; j++) {
  19640. items[j] = defaultValue;
  19641. }
  19642. const level = {
  19643. width,
  19644. height,
  19645. items
  19646. };
  19647. this.levels.push(level);
  19648. width = Math.ceil(width / 2);
  19649. height = Math.ceil(height / 2);
  19650. }
  19651. }
  19652. reset(i, j, stopValue) {
  19653. let currentLevel = 0;
  19654. while (currentLevel < this.levels.length) {
  19655. const level = this.levels[currentLevel];
  19656. const index = i + j * level.width;
  19657. level.index = index;
  19658. const value = level.items[index];
  19659. if (value === 0xff) {
  19660. break;
  19661. }
  19662. if (value > stopValue) {
  19663. this.currentLevel = currentLevel;
  19664. this.propagateValues();
  19665. return false;
  19666. }
  19667. i >>= 1;
  19668. j >>= 1;
  19669. currentLevel++;
  19670. }
  19671. this.currentLevel = currentLevel - 1;
  19672. return true;
  19673. }
  19674. incrementValue(stopValue) {
  19675. const level = this.levels[this.currentLevel];
  19676. level.items[level.index] = stopValue + 1;
  19677. this.propagateValues();
  19678. }
  19679. propagateValues() {
  19680. let levelIndex = this.currentLevel;
  19681. let level = this.levels[levelIndex];
  19682. const currentValue = level.items[level.index];
  19683. while (--levelIndex >= 0) {
  19684. level = this.levels[levelIndex];
  19685. level.items[level.index] = currentValue;
  19686. }
  19687. }
  19688. nextLevel() {
  19689. let currentLevel = this.currentLevel;
  19690. let level = this.levels[currentLevel];
  19691. const value = level.items[level.index];
  19692. level.items[level.index] = 0xff;
  19693. currentLevel--;
  19694. if (currentLevel < 0) {
  19695. return false;
  19696. }
  19697. this.currentLevel = currentLevel;
  19698. level = this.levels[currentLevel];
  19699. level.items[level.index] = value;
  19700. return true;
  19701. }
  19702. }
  19703. const BitModel = function BitModelClosure() {
  19704. const UNIFORM_CONTEXT = 17;
  19705. const RUNLENGTH_CONTEXT = 18;
  19706. const LLAndLHContextsLabel = new Uint8Array([0, 5, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 1, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8]);
  19707. const HLContextLabel = new Uint8Array([0, 3, 4, 0, 5, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 1, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8]);
  19708. const HHContextLabel = new Uint8Array([0, 1, 2, 0, 1, 2, 2, 0, 2, 2, 2, 0, 0, 0, 0, 0, 3, 4, 5, 0, 4, 5, 5, 0, 5, 5, 5, 0, 0, 0, 0, 0, 6, 7, 7, 0, 7, 7, 7, 0, 7, 7, 7, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8]);
  19709. class BitModel {
  19710. constructor(width, height, subband, zeroBitPlanes, mb) {
  19711. this.width = width;
  19712. this.height = height;
  19713. let contextLabelTable;
  19714. if (subband === "HH") {
  19715. contextLabelTable = HHContextLabel;
  19716. } else if (subband === "HL") {
  19717. contextLabelTable = HLContextLabel;
  19718. } else {
  19719. contextLabelTable = LLAndLHContextsLabel;
  19720. }
  19721. this.contextLabelTable = contextLabelTable;
  19722. const coefficientCount = width * height;
  19723. this.neighborsSignificance = new Uint8Array(coefficientCount);
  19724. this.coefficentsSign = new Uint8Array(coefficientCount);
  19725. let coefficentsMagnitude;
  19726. if (mb > 14) {
  19727. coefficentsMagnitude = new Uint32Array(coefficientCount);
  19728. } else if (mb > 6) {
  19729. coefficentsMagnitude = new Uint16Array(coefficientCount);
  19730. } else {
  19731. coefficentsMagnitude = new Uint8Array(coefficientCount);
  19732. }
  19733. this.coefficentsMagnitude = coefficentsMagnitude;
  19734. this.processingFlags = new Uint8Array(coefficientCount);
  19735. const bitsDecoded = new Uint8Array(coefficientCount);
  19736. if (zeroBitPlanes !== 0) {
  19737. for (let i = 0; i < coefficientCount; i++) {
  19738. bitsDecoded[i] = zeroBitPlanes;
  19739. }
  19740. }
  19741. this.bitsDecoded = bitsDecoded;
  19742. this.reset();
  19743. }
  19744. setDecoder(decoder) {
  19745. this.decoder = decoder;
  19746. }
  19747. reset() {
  19748. this.contexts = new Int8Array(19);
  19749. this.contexts[0] = 4 << 1 | 0;
  19750. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  19751. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  19752. }
  19753. setNeighborsSignificance(row, column, index) {
  19754. const neighborsSignificance = this.neighborsSignificance;
  19755. const width = this.width,
  19756. height = this.height;
  19757. const left = column > 0;
  19758. const right = column + 1 < width;
  19759. let i;
  19760. if (row > 0) {
  19761. i = index - width;
  19762. if (left) {
  19763. neighborsSignificance[i - 1] += 0x10;
  19764. }
  19765. if (right) {
  19766. neighborsSignificance[i + 1] += 0x10;
  19767. }
  19768. neighborsSignificance[i] += 0x04;
  19769. }
  19770. if (row + 1 < height) {
  19771. i = index + width;
  19772. if (left) {
  19773. neighborsSignificance[i - 1] += 0x10;
  19774. }
  19775. if (right) {
  19776. neighborsSignificance[i + 1] += 0x10;
  19777. }
  19778. neighborsSignificance[i] += 0x04;
  19779. }
  19780. if (left) {
  19781. neighborsSignificance[index - 1] += 0x01;
  19782. }
  19783. if (right) {
  19784. neighborsSignificance[index + 1] += 0x01;
  19785. }
  19786. neighborsSignificance[index] |= 0x80;
  19787. }
  19788. runSignificancePropagationPass() {
  19789. const decoder = this.decoder;
  19790. const width = this.width,
  19791. height = this.height;
  19792. const coefficentsMagnitude = this.coefficentsMagnitude;
  19793. const coefficentsSign = this.coefficentsSign;
  19794. const neighborsSignificance = this.neighborsSignificance;
  19795. const processingFlags = this.processingFlags;
  19796. const contexts = this.contexts;
  19797. const labels = this.contextLabelTable;
  19798. const bitsDecoded = this.bitsDecoded;
  19799. const processedInverseMask = ~1;
  19800. const processedMask = 1;
  19801. const firstMagnitudeBitMask = 2;
  19802. for (let i0 = 0; i0 < height; i0 += 4) {
  19803. for (let j = 0; j < width; j++) {
  19804. let index = i0 * width + j;
  19805. for (let i1 = 0; i1 < 4; i1++, index += width) {
  19806. const i = i0 + i1;
  19807. if (i >= height) {
  19808. break;
  19809. }
  19810. processingFlags[index] &= processedInverseMask;
  19811. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  19812. continue;
  19813. }
  19814. const contextLabel = labels[neighborsSignificance[index]];
  19815. const decision = decoder.readBit(contexts, contextLabel);
  19816. if (decision) {
  19817. const sign = this.decodeSignBit(i, j, index);
  19818. coefficentsSign[index] = sign;
  19819. coefficentsMagnitude[index] = 1;
  19820. this.setNeighborsSignificance(i, j, index);
  19821. processingFlags[index] |= firstMagnitudeBitMask;
  19822. }
  19823. bitsDecoded[index]++;
  19824. processingFlags[index] |= processedMask;
  19825. }
  19826. }
  19827. }
  19828. }
  19829. decodeSignBit(row, column, index) {
  19830. const width = this.width,
  19831. height = this.height;
  19832. const coefficentsMagnitude = this.coefficentsMagnitude;
  19833. const coefficentsSign = this.coefficentsSign;
  19834. let contribution, sign0, sign1, significance1;
  19835. let contextLabel, decoded;
  19836. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  19837. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  19838. sign1 = coefficentsSign[index + 1];
  19839. if (significance1) {
  19840. sign0 = coefficentsSign[index - 1];
  19841. contribution = 1 - sign1 - sign0;
  19842. } else {
  19843. contribution = 1 - sign1 - sign1;
  19844. }
  19845. } else if (significance1) {
  19846. sign0 = coefficentsSign[index - 1];
  19847. contribution = 1 - sign0 - sign0;
  19848. } else {
  19849. contribution = 0;
  19850. }
  19851. const horizontalContribution = 3 * contribution;
  19852. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  19853. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  19854. sign1 = coefficentsSign[index + width];
  19855. if (significance1) {
  19856. sign0 = coefficentsSign[index - width];
  19857. contribution = 1 - sign1 - sign0 + horizontalContribution;
  19858. } else {
  19859. contribution = 1 - sign1 - sign1 + horizontalContribution;
  19860. }
  19861. } else if (significance1) {
  19862. sign0 = coefficentsSign[index - width];
  19863. contribution = 1 - sign0 - sign0 + horizontalContribution;
  19864. } else {
  19865. contribution = horizontalContribution;
  19866. }
  19867. if (contribution >= 0) {
  19868. contextLabel = 9 + contribution;
  19869. decoded = this.decoder.readBit(this.contexts, contextLabel);
  19870. } else {
  19871. contextLabel = 9 - contribution;
  19872. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  19873. }
  19874. return decoded;
  19875. }
  19876. runMagnitudeRefinementPass() {
  19877. const decoder = this.decoder;
  19878. const width = this.width,
  19879. height = this.height;
  19880. const coefficentsMagnitude = this.coefficentsMagnitude;
  19881. const neighborsSignificance = this.neighborsSignificance;
  19882. const contexts = this.contexts;
  19883. const bitsDecoded = this.bitsDecoded;
  19884. const processingFlags = this.processingFlags;
  19885. const processedMask = 1;
  19886. const firstMagnitudeBitMask = 2;
  19887. const length = width * height;
  19888. const width4 = width * 4;
  19889. for (let index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  19890. indexNext = Math.min(length, index0 + width4);
  19891. for (let j = 0; j < width; j++) {
  19892. for (let index = index0 + j; index < indexNext; index += width) {
  19893. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  19894. continue;
  19895. }
  19896. let contextLabel = 16;
  19897. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  19898. processingFlags[index] ^= firstMagnitudeBitMask;
  19899. const significance = neighborsSignificance[index] & 127;
  19900. contextLabel = significance === 0 ? 15 : 14;
  19901. }
  19902. const bit = decoder.readBit(contexts, contextLabel);
  19903. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  19904. bitsDecoded[index]++;
  19905. processingFlags[index] |= processedMask;
  19906. }
  19907. }
  19908. }
  19909. }
  19910. runCleanupPass() {
  19911. const decoder = this.decoder;
  19912. const width = this.width,
  19913. height = this.height;
  19914. const neighborsSignificance = this.neighborsSignificance;
  19915. const coefficentsMagnitude = this.coefficentsMagnitude;
  19916. const coefficentsSign = this.coefficentsSign;
  19917. const contexts = this.contexts;
  19918. const labels = this.contextLabelTable;
  19919. const bitsDecoded = this.bitsDecoded;
  19920. const processingFlags = this.processingFlags;
  19921. const processedMask = 1;
  19922. const firstMagnitudeBitMask = 2;
  19923. const oneRowDown = width;
  19924. const twoRowsDown = width * 2;
  19925. const threeRowsDown = width * 3;
  19926. let iNext;
  19927. for (let i0 = 0; i0 < height; i0 = iNext) {
  19928. iNext = Math.min(i0 + 4, height);
  19929. const indexBase = i0 * width;
  19930. const checkAllEmpty = i0 + 3 < height;
  19931. for (let j = 0; j < width; j++) {
  19932. const index0 = indexBase + j;
  19933. const allEmpty = checkAllEmpty && processingFlags[index0] === 0 && processingFlags[index0 + oneRowDown] === 0 && processingFlags[index0 + twoRowsDown] === 0 && processingFlags[index0 + threeRowsDown] === 0 && neighborsSignificance[index0] === 0 && neighborsSignificance[index0 + oneRowDown] === 0 && neighborsSignificance[index0 + twoRowsDown] === 0 && neighborsSignificance[index0 + threeRowsDown] === 0;
  19934. let i1 = 0,
  19935. index = index0;
  19936. let i = i0,
  19937. sign;
  19938. if (allEmpty) {
  19939. const hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  19940. if (!hasSignificantCoefficent) {
  19941. bitsDecoded[index0]++;
  19942. bitsDecoded[index0 + oneRowDown]++;
  19943. bitsDecoded[index0 + twoRowsDown]++;
  19944. bitsDecoded[index0 + threeRowsDown]++;
  19945. continue;
  19946. }
  19947. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  19948. if (i1 !== 0) {
  19949. i = i0 + i1;
  19950. index += i1 * width;
  19951. }
  19952. sign = this.decodeSignBit(i, j, index);
  19953. coefficentsSign[index] = sign;
  19954. coefficentsMagnitude[index] = 1;
  19955. this.setNeighborsSignificance(i, j, index);
  19956. processingFlags[index] |= firstMagnitudeBitMask;
  19957. index = index0;
  19958. for (let i2 = i0; i2 <= i; i2++, index += width) {
  19959. bitsDecoded[index]++;
  19960. }
  19961. i1++;
  19962. }
  19963. for (i = i0 + i1; i < iNext; i++, index += width) {
  19964. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  19965. continue;
  19966. }
  19967. const contextLabel = labels[neighborsSignificance[index]];
  19968. const decision = decoder.readBit(contexts, contextLabel);
  19969. if (decision === 1) {
  19970. sign = this.decodeSignBit(i, j, index);
  19971. coefficentsSign[index] = sign;
  19972. coefficentsMagnitude[index] = 1;
  19973. this.setNeighborsSignificance(i, j, index);
  19974. processingFlags[index] |= firstMagnitudeBitMask;
  19975. }
  19976. bitsDecoded[index]++;
  19977. }
  19978. }
  19979. }
  19980. }
  19981. checkSegmentationSymbol() {
  19982. const decoder = this.decoder;
  19983. const contexts = this.contexts;
  19984. const symbol = decoder.readBit(contexts, UNIFORM_CONTEXT) << 3 | decoder.readBit(contexts, UNIFORM_CONTEXT) << 2 | decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  19985. if (symbol !== 0xa) {
  19986. throw new JpxError("Invalid segmentation symbol");
  19987. }
  19988. }
  19989. }
  19990. return BitModel;
  19991. }();
  19992. class Transform {
  19993. constructor() {
  19994. if (this.constructor === Transform) {
  19995. (0, _util.unreachable)("Cannot initialize Transform.");
  19996. }
  19997. }
  19998. calculate(subbands, u0, v0) {
  19999. let ll = subbands[0];
  20000. for (let i = 1, ii = subbands.length; i < ii; i++) {
  20001. ll = this.iterate(ll, subbands[i], u0, v0);
  20002. }
  20003. return ll;
  20004. }
  20005. extend(buffer, offset, size) {
  20006. let i1 = offset - 1,
  20007. j1 = offset + 1;
  20008. let i2 = offset + size - 2,
  20009. j2 = offset + size;
  20010. buffer[i1--] = buffer[j1++];
  20011. buffer[j2++] = buffer[i2--];
  20012. buffer[i1--] = buffer[j1++];
  20013. buffer[j2++] = buffer[i2--];
  20014. buffer[i1--] = buffer[j1++];
  20015. buffer[j2++] = buffer[i2--];
  20016. buffer[i1] = buffer[j1];
  20017. buffer[j2] = buffer[i2];
  20018. }
  20019. filter(x, offset, length) {
  20020. (0, _util.unreachable)("Abstract method `filter` called");
  20021. }
  20022. iterate(ll, hl_lh_hh, u0, v0) {
  20023. const llWidth = ll.width,
  20024. llHeight = ll.height;
  20025. let llItems = ll.items;
  20026. const width = hl_lh_hh.width;
  20027. const height = hl_lh_hh.height;
  20028. const items = hl_lh_hh.items;
  20029. let i, j, k, l, u, v;
  20030. for (k = 0, i = 0; i < llHeight; i++) {
  20031. l = i * 2 * width;
  20032. for (j = 0; j < llWidth; j++, k++, l += 2) {
  20033. items[l] = llItems[k];
  20034. }
  20035. }
  20036. llItems = ll.items = null;
  20037. const bufferPadding = 4;
  20038. const rowBuffer = new Float32Array(width + 2 * bufferPadding);
  20039. if (width === 1) {
  20040. if ((u0 & 1) !== 0) {
  20041. for (v = 0, k = 0; v < height; v++, k += width) {
  20042. items[k] *= 0.5;
  20043. }
  20044. }
  20045. } else {
  20046. for (v = 0, k = 0; v < height; v++, k += width) {
  20047. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  20048. this.extend(rowBuffer, bufferPadding, width);
  20049. this.filter(rowBuffer, bufferPadding, width);
  20050. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  20051. }
  20052. }
  20053. let numBuffers = 16;
  20054. const colBuffers = [];
  20055. for (i = 0; i < numBuffers; i++) {
  20056. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  20057. }
  20058. let b,
  20059. currentBuffer = 0;
  20060. ll = bufferPadding + height;
  20061. if (height === 1) {
  20062. if ((v0 & 1) !== 0) {
  20063. for (u = 0; u < width; u++) {
  20064. items[u] *= 0.5;
  20065. }
  20066. }
  20067. } else {
  20068. for (u = 0; u < width; u++) {
  20069. if (currentBuffer === 0) {
  20070. numBuffers = Math.min(width - u, numBuffers);
  20071. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  20072. for (b = 0; b < numBuffers; b++) {
  20073. colBuffers[b][l] = items[k + b];
  20074. }
  20075. }
  20076. currentBuffer = numBuffers;
  20077. }
  20078. currentBuffer--;
  20079. const buffer = colBuffers[currentBuffer];
  20080. this.extend(buffer, bufferPadding, height);
  20081. this.filter(buffer, bufferPadding, height);
  20082. if (currentBuffer === 0) {
  20083. k = u - numBuffers + 1;
  20084. for (l = bufferPadding; l < ll; k += width, l++) {
  20085. for (b = 0; b < numBuffers; b++) {
  20086. items[k + b] = colBuffers[b][l];
  20087. }
  20088. }
  20089. }
  20090. }
  20091. }
  20092. return {
  20093. width,
  20094. height,
  20095. items
  20096. };
  20097. }
  20098. }
  20099. class IrreversibleTransform extends Transform {
  20100. filter(x, offset, length) {
  20101. const len = length >> 1;
  20102. offset |= 0;
  20103. let j, n, current, next;
  20104. const alpha = -1.586134342059924;
  20105. const beta = -0.052980118572961;
  20106. const gamma = 0.882911075530934;
  20107. const delta = 0.443506852043971;
  20108. const K = 1.230174104914001;
  20109. const K_ = 1 / K;
  20110. j = offset - 3;
  20111. for (n = len + 4; n--; j += 2) {
  20112. x[j] *= K_;
  20113. }
  20114. j = offset - 2;
  20115. current = delta * x[j - 1];
  20116. for (n = len + 3; n--; j += 2) {
  20117. next = delta * x[j + 1];
  20118. x[j] = K * x[j] - current - next;
  20119. if (n--) {
  20120. j += 2;
  20121. current = delta * x[j + 1];
  20122. x[j] = K * x[j] - current - next;
  20123. } else {
  20124. break;
  20125. }
  20126. }
  20127. j = offset - 1;
  20128. current = gamma * x[j - 1];
  20129. for (n = len + 2; n--; j += 2) {
  20130. next = gamma * x[j + 1];
  20131. x[j] -= current + next;
  20132. if (n--) {
  20133. j += 2;
  20134. current = gamma * x[j + 1];
  20135. x[j] -= current + next;
  20136. } else {
  20137. break;
  20138. }
  20139. }
  20140. j = offset;
  20141. current = beta * x[j - 1];
  20142. for (n = len + 1; n--; j += 2) {
  20143. next = beta * x[j + 1];
  20144. x[j] -= current + next;
  20145. if (n--) {
  20146. j += 2;
  20147. current = beta * x[j + 1];
  20148. x[j] -= current + next;
  20149. } else {
  20150. break;
  20151. }
  20152. }
  20153. if (len !== 0) {
  20154. j = offset + 1;
  20155. current = alpha * x[j - 1];
  20156. for (n = len; n--; j += 2) {
  20157. next = alpha * x[j + 1];
  20158. x[j] -= current + next;
  20159. if (n--) {
  20160. j += 2;
  20161. current = alpha * x[j + 1];
  20162. x[j] -= current + next;
  20163. } else {
  20164. break;
  20165. }
  20166. }
  20167. }
  20168. }
  20169. }
  20170. class ReversibleTransform extends Transform {
  20171. filter(x, offset, length) {
  20172. const len = length >> 1;
  20173. offset |= 0;
  20174. let j, n;
  20175. for (j = offset, n = len + 1; n--; j += 2) {
  20176. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  20177. }
  20178. for (j = offset + 1, n = len; n--; j += 2) {
  20179. x[j] += x[j - 1] + x[j + 1] >> 1;
  20180. }
  20181. }
  20182. }
  20183. /***/ }),
  20184. /* 29 */
  20185. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20186. Object.defineProperty(exports, "__esModule", ({
  20187. value: true
  20188. }));
  20189. exports.LZWStream = void 0;
  20190. var _decode_stream = __w_pdfjs_require__(17);
  20191. class LZWStream extends _decode_stream.DecodeStream {
  20192. constructor(str, maybeLength, earlyChange) {
  20193. super(maybeLength);
  20194. this.str = str;
  20195. this.dict = str.dict;
  20196. this.cachedData = 0;
  20197. this.bitsCached = 0;
  20198. const maxLzwDictionarySize = 4096;
  20199. const lzwState = {
  20200. earlyChange,
  20201. codeLength: 9,
  20202. nextCode: 258,
  20203. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  20204. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  20205. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  20206. currentSequence: new Uint8Array(maxLzwDictionarySize),
  20207. currentSequenceLength: 0
  20208. };
  20209. for (let i = 0; i < 256; ++i) {
  20210. lzwState.dictionaryValues[i] = i;
  20211. lzwState.dictionaryLengths[i] = 1;
  20212. }
  20213. this.lzwState = lzwState;
  20214. }
  20215. readBits(n) {
  20216. let bitsCached = this.bitsCached;
  20217. let cachedData = this.cachedData;
  20218. while (bitsCached < n) {
  20219. const c = this.str.getByte();
  20220. if (c === -1) {
  20221. this.eof = true;
  20222. return null;
  20223. }
  20224. cachedData = cachedData << 8 | c;
  20225. bitsCached += 8;
  20226. }
  20227. this.bitsCached = bitsCached -= n;
  20228. this.cachedData = cachedData;
  20229. this.lastCode = null;
  20230. return cachedData >>> bitsCached & (1 << n) - 1;
  20231. }
  20232. readBlock() {
  20233. const blockSize = 512,
  20234. decodedSizeDelta = blockSize;
  20235. let estimatedDecodedSize = blockSize * 2;
  20236. let i, j, q;
  20237. const lzwState = this.lzwState;
  20238. if (!lzwState) {
  20239. return;
  20240. }
  20241. const earlyChange = lzwState.earlyChange;
  20242. let nextCode = lzwState.nextCode;
  20243. const dictionaryValues = lzwState.dictionaryValues;
  20244. const dictionaryLengths = lzwState.dictionaryLengths;
  20245. const dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  20246. let codeLength = lzwState.codeLength;
  20247. let prevCode = lzwState.prevCode;
  20248. const currentSequence = lzwState.currentSequence;
  20249. let currentSequenceLength = lzwState.currentSequenceLength;
  20250. let decodedLength = 0;
  20251. let currentBufferLength = this.bufferLength;
  20252. let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  20253. for (i = 0; i < blockSize; i++) {
  20254. const code = this.readBits(codeLength);
  20255. const hasPrev = currentSequenceLength > 0;
  20256. if (code < 256) {
  20257. currentSequence[0] = code;
  20258. currentSequenceLength = 1;
  20259. } else if (code >= 258) {
  20260. if (code < nextCode) {
  20261. currentSequenceLength = dictionaryLengths[code];
  20262. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  20263. currentSequence[j] = dictionaryValues[q];
  20264. q = dictionaryPrevCodes[q];
  20265. }
  20266. } else {
  20267. currentSequence[currentSequenceLength++] = currentSequence[0];
  20268. }
  20269. } else if (code === 256) {
  20270. codeLength = 9;
  20271. nextCode = 258;
  20272. currentSequenceLength = 0;
  20273. continue;
  20274. } else {
  20275. this.eof = true;
  20276. delete this.lzwState;
  20277. break;
  20278. }
  20279. if (hasPrev) {
  20280. dictionaryPrevCodes[nextCode] = prevCode;
  20281. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  20282. dictionaryValues[nextCode] = currentSequence[0];
  20283. nextCode++;
  20284. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  20285. }
  20286. prevCode = code;
  20287. decodedLength += currentSequenceLength;
  20288. if (estimatedDecodedSize < decodedLength) {
  20289. do {
  20290. estimatedDecodedSize += decodedSizeDelta;
  20291. } while (estimatedDecodedSize < decodedLength);
  20292. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  20293. }
  20294. for (j = 0; j < currentSequenceLength; j++) {
  20295. buffer[currentBufferLength++] = currentSequence[j];
  20296. }
  20297. }
  20298. lzwState.nextCode = nextCode;
  20299. lzwState.codeLength = codeLength;
  20300. lzwState.prevCode = prevCode;
  20301. lzwState.currentSequenceLength = currentSequenceLength;
  20302. this.bufferLength = currentBufferLength;
  20303. }
  20304. }
  20305. exports.LZWStream = LZWStream;
  20306. /***/ }),
  20307. /* 30 */
  20308. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20309. Object.defineProperty(exports, "__esModule", ({
  20310. value: true
  20311. }));
  20312. exports.PredictorStream = void 0;
  20313. var _decode_stream = __w_pdfjs_require__(17);
  20314. var _primitives = __w_pdfjs_require__(3);
  20315. var _util = __w_pdfjs_require__(2);
  20316. class PredictorStream extends _decode_stream.DecodeStream {
  20317. constructor(str, maybeLength, params) {
  20318. super(maybeLength);
  20319. if (!(params instanceof _primitives.Dict)) {
  20320. return str;
  20321. }
  20322. const predictor = this.predictor = params.get("Predictor") || 1;
  20323. if (predictor <= 1) {
  20324. return str;
  20325. }
  20326. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  20327. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  20328. }
  20329. if (predictor === 2) {
  20330. this.readBlock = this.readBlockTiff;
  20331. } else {
  20332. this.readBlock = this.readBlockPng;
  20333. }
  20334. this.str = str;
  20335. this.dict = str.dict;
  20336. const colors = this.colors = params.get("Colors") || 1;
  20337. const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8;
  20338. const columns = this.columns = params.get("Columns") || 1;
  20339. this.pixBytes = colors * bits + 7 >> 3;
  20340. this.rowBytes = columns * colors * bits + 7 >> 3;
  20341. return this;
  20342. }
  20343. readBlockTiff() {
  20344. const rowBytes = this.rowBytes;
  20345. const bufferLength = this.bufferLength;
  20346. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  20347. const bits = this.bits;
  20348. const colors = this.colors;
  20349. const rawBytes = this.str.getBytes(rowBytes);
  20350. this.eof = !rawBytes.length;
  20351. if (this.eof) {
  20352. return;
  20353. }
  20354. let inbuf = 0,
  20355. outbuf = 0;
  20356. let inbits = 0,
  20357. outbits = 0;
  20358. let pos = bufferLength;
  20359. let i;
  20360. if (bits === 1 && colors === 1) {
  20361. for (i = 0; i < rowBytes; ++i) {
  20362. let c = rawBytes[i] ^ inbuf;
  20363. c ^= c >> 1;
  20364. c ^= c >> 2;
  20365. c ^= c >> 4;
  20366. inbuf = (c & 1) << 7;
  20367. buffer[pos++] = c;
  20368. }
  20369. } else if (bits === 8) {
  20370. for (i = 0; i < colors; ++i) {
  20371. buffer[pos++] = rawBytes[i];
  20372. }
  20373. for (; i < rowBytes; ++i) {
  20374. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  20375. pos++;
  20376. }
  20377. } else if (bits === 16) {
  20378. const bytesPerPixel = colors * 2;
  20379. for (i = 0; i < bytesPerPixel; ++i) {
  20380. buffer[pos++] = rawBytes[i];
  20381. }
  20382. for (; i < rowBytes; i += 2) {
  20383. const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
  20384. buffer[pos++] = sum >> 8 & 0xff;
  20385. buffer[pos++] = sum & 0xff;
  20386. }
  20387. } else {
  20388. const compArray = new Uint8Array(colors + 1);
  20389. const bitMask = (1 << bits) - 1;
  20390. let j = 0,
  20391. k = bufferLength;
  20392. const columns = this.columns;
  20393. for (i = 0; i < columns; ++i) {
  20394. for (let kk = 0; kk < colors; ++kk) {
  20395. if (inbits < bits) {
  20396. inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
  20397. inbits += 8;
  20398. }
  20399. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  20400. inbits -= bits;
  20401. outbuf = outbuf << bits | compArray[kk];
  20402. outbits += bits;
  20403. if (outbits >= 8) {
  20404. buffer[k++] = outbuf >> outbits - 8 & 0xff;
  20405. outbits -= 8;
  20406. }
  20407. }
  20408. }
  20409. if (outbits > 0) {
  20410. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  20411. }
  20412. }
  20413. this.bufferLength += rowBytes;
  20414. }
  20415. readBlockPng() {
  20416. const rowBytes = this.rowBytes;
  20417. const pixBytes = this.pixBytes;
  20418. const predictor = this.str.getByte();
  20419. const rawBytes = this.str.getBytes(rowBytes);
  20420. this.eof = !rawBytes.length;
  20421. if (this.eof) {
  20422. return;
  20423. }
  20424. const bufferLength = this.bufferLength;
  20425. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  20426. let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  20427. if (prevRow.length === 0) {
  20428. prevRow = new Uint8Array(rowBytes);
  20429. }
  20430. let i,
  20431. j = bufferLength,
  20432. up,
  20433. c;
  20434. switch (predictor) {
  20435. case 0:
  20436. for (i = 0; i < rowBytes; ++i) {
  20437. buffer[j++] = rawBytes[i];
  20438. }
  20439. break;
  20440. case 1:
  20441. for (i = 0; i < pixBytes; ++i) {
  20442. buffer[j++] = rawBytes[i];
  20443. }
  20444. for (; i < rowBytes; ++i) {
  20445. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
  20446. j++;
  20447. }
  20448. break;
  20449. case 2:
  20450. for (i = 0; i < rowBytes; ++i) {
  20451. buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
  20452. }
  20453. break;
  20454. case 3:
  20455. for (i = 0; i < pixBytes; ++i) {
  20456. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  20457. }
  20458. for (; i < rowBytes; ++i) {
  20459. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
  20460. j++;
  20461. }
  20462. break;
  20463. case 4:
  20464. for (i = 0; i < pixBytes; ++i) {
  20465. up = prevRow[i];
  20466. c = rawBytes[i];
  20467. buffer[j++] = up + c;
  20468. }
  20469. for (; i < rowBytes; ++i) {
  20470. up = prevRow[i];
  20471. const upLeft = prevRow[i - pixBytes];
  20472. const left = buffer[j - pixBytes];
  20473. const p = left + up - upLeft;
  20474. let pa = p - left;
  20475. if (pa < 0) {
  20476. pa = -pa;
  20477. }
  20478. let pb = p - up;
  20479. if (pb < 0) {
  20480. pb = -pb;
  20481. }
  20482. let pc = p - upLeft;
  20483. if (pc < 0) {
  20484. pc = -pc;
  20485. }
  20486. c = rawBytes[i];
  20487. if (pa <= pb && pa <= pc) {
  20488. buffer[j++] = left + c;
  20489. } else if (pb <= pc) {
  20490. buffer[j++] = up + c;
  20491. } else {
  20492. buffer[j++] = upLeft + c;
  20493. }
  20494. }
  20495. break;
  20496. default:
  20497. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  20498. }
  20499. this.bufferLength += rowBytes;
  20500. }
  20501. }
  20502. exports.PredictorStream = PredictorStream;
  20503. /***/ }),
  20504. /* 31 */
  20505. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20506. Object.defineProperty(exports, "__esModule", ({
  20507. value: true
  20508. }));
  20509. exports.RunLengthStream = void 0;
  20510. var _decode_stream = __w_pdfjs_require__(17);
  20511. class RunLengthStream extends _decode_stream.DecodeStream {
  20512. constructor(str, maybeLength) {
  20513. super(maybeLength);
  20514. this.str = str;
  20515. this.dict = str.dict;
  20516. }
  20517. readBlock() {
  20518. const repeatHeader = this.str.getBytes(2);
  20519. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  20520. this.eof = true;
  20521. return;
  20522. }
  20523. let buffer;
  20524. let bufferLength = this.bufferLength;
  20525. let n = repeatHeader[0];
  20526. if (n < 128) {
  20527. buffer = this.ensureBuffer(bufferLength + n + 1);
  20528. buffer[bufferLength++] = repeatHeader[1];
  20529. if (n > 0) {
  20530. const source = this.str.getBytes(n);
  20531. buffer.set(source, bufferLength);
  20532. bufferLength += n;
  20533. }
  20534. } else {
  20535. n = 257 - n;
  20536. const b = repeatHeader[1];
  20537. buffer = this.ensureBuffer(bufferLength + n + 1);
  20538. for (let i = 0; i < n; i++) {
  20539. buffer[bufferLength++] = b;
  20540. }
  20541. }
  20542. this.bufferLength = bufferLength;
  20543. }
  20544. }
  20545. exports.RunLengthStream = RunLengthStream;
  20546. /***/ }),
  20547. /* 32 */
  20548. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20549. Object.defineProperty(exports, "__esModule", ({
  20550. value: true
  20551. }));
  20552. exports.Font = exports.ErrorFont = void 0;
  20553. var _util = __w_pdfjs_require__(2);
  20554. var _cff_parser = __w_pdfjs_require__(33);
  20555. var _fonts_utils = __w_pdfjs_require__(36);
  20556. var _unicode = __w_pdfjs_require__(38);
  20557. var _glyphlist = __w_pdfjs_require__(37);
  20558. var _encodings = __w_pdfjs_require__(35);
  20559. var _standard_fonts = __w_pdfjs_require__(39);
  20560. var _to_unicode_map = __w_pdfjs_require__(40);
  20561. var _cff_font = __w_pdfjs_require__(41);
  20562. var _font_renderer = __w_pdfjs_require__(42);
  20563. var _metrics = __w_pdfjs_require__(43);
  20564. var _glyf = __w_pdfjs_require__(44);
  20565. var _cmap = __w_pdfjs_require__(14);
  20566. var _opentype_file_builder = __w_pdfjs_require__(45);
  20567. var _core_utils = __w_pdfjs_require__(4);
  20568. var _stream = __w_pdfjs_require__(8);
  20569. var _type1_font = __w_pdfjs_require__(46);
  20570. const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
  20571. const PDF_GLYPH_SPACE_UNITS = 1000;
  20572. const EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "charProcOperatorList", "composite", "cssFontInfo", "data", "defaultVMetrics", "defaultWidth", "descent", "fallbackName", "fontMatrix", "fontType", "isInvalidPDFjsFont", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "subtype", "type", "vertical"];
  20573. const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
  20574. function adjustWidths(properties) {
  20575. if (!properties.fontMatrix) {
  20576. return;
  20577. }
  20578. if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
  20579. return;
  20580. }
  20581. const scale = 0.001 / properties.fontMatrix[0];
  20582. const glyphsWidths = properties.widths;
  20583. for (const glyph in glyphsWidths) {
  20584. glyphsWidths[glyph] *= scale;
  20585. }
  20586. properties.defaultWidth *= scale;
  20587. }
  20588. function adjustToUnicode(properties, builtInEncoding) {
  20589. if (properties.isInternalFont) {
  20590. return;
  20591. }
  20592. if (properties.hasIncludedToUnicodeMap) {
  20593. return;
  20594. }
  20595. if (builtInEncoding === properties.defaultEncoding) {
  20596. return;
  20597. }
  20598. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  20599. return;
  20600. }
  20601. const toUnicode = [],
  20602. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  20603. for (const charCode in builtInEncoding) {
  20604. if (properties.hasEncoding) {
  20605. if (properties.differences.length === 0 || properties.differences[charCode] !== undefined) {
  20606. continue;
  20607. }
  20608. }
  20609. const glyphName = builtInEncoding[charCode];
  20610. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  20611. if (unicode !== -1) {
  20612. toUnicode[charCode] = String.fromCharCode(unicode);
  20613. }
  20614. }
  20615. if (toUnicode.length > 0) {
  20616. properties.toUnicode.amend(toUnicode);
  20617. }
  20618. }
  20619. function amendFallbackToUnicode(properties) {
  20620. if (!properties.fallbackToUnicode) {
  20621. return;
  20622. }
  20623. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  20624. return;
  20625. }
  20626. const toUnicode = [];
  20627. for (const charCode in properties.fallbackToUnicode) {
  20628. if (properties.toUnicode.has(charCode)) {
  20629. continue;
  20630. }
  20631. toUnicode[charCode] = properties.fallbackToUnicode[charCode];
  20632. }
  20633. if (toUnicode.length > 0) {
  20634. properties.toUnicode.amend(toUnicode);
  20635. }
  20636. }
  20637. class Glyph {
  20638. constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  20639. this.originalCharCode = originalCharCode;
  20640. this.fontChar = fontChar;
  20641. this.unicode = unicode;
  20642. this.accent = accent;
  20643. this.width = width;
  20644. this.vmetric = vmetric;
  20645. this.operatorListId = operatorListId;
  20646. this.isSpace = isSpace;
  20647. this.isInFont = isInFont;
  20648. }
  20649. get category() {
  20650. return (0, _util.shadow)(this, "category", (0, _unicode.getCharUnicodeCategory)(this.unicode), true);
  20651. }
  20652. get normalizedUnicode() {
  20653. return (0, _util.shadow)(this, "normalizedUnicode", (0, _unicode.reverseIfRtl)(Glyph._NormalizedUnicodes[this.unicode] || this.unicode), true);
  20654. }
  20655. static get _NormalizedUnicodes() {
  20656. return (0, _util.shadow)(this, "_NormalizedUnicodes", (0, _unicode.getNormalizedUnicodes)());
  20657. }
  20658. }
  20659. function int16(b0, b1) {
  20660. return (b0 << 8) + b1;
  20661. }
  20662. function writeSignedInt16(bytes, index, value) {
  20663. bytes[index + 1] = value;
  20664. bytes[index] = value >>> 8;
  20665. }
  20666. function signedInt16(b0, b1) {
  20667. const value = (b0 << 8) + b1;
  20668. return value & 1 << 15 ? value - 0x10000 : value;
  20669. }
  20670. function int32(b0, b1, b2, b3) {
  20671. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  20672. }
  20673. function string16(value) {
  20674. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  20675. }
  20676. function safeString16(value) {
  20677. if (value > 0x7fff) {
  20678. value = 0x7fff;
  20679. } else if (value < -0x8000) {
  20680. value = -0x8000;
  20681. }
  20682. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  20683. }
  20684. function isTrueTypeFile(file) {
  20685. const header = file.peekBytes(4);
  20686. return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true";
  20687. }
  20688. function isTrueTypeCollectionFile(file) {
  20689. const header = file.peekBytes(4);
  20690. return (0, _util.bytesToString)(header) === "ttcf";
  20691. }
  20692. function isOpenTypeFile(file) {
  20693. const header = file.peekBytes(4);
  20694. return (0, _util.bytesToString)(header) === "OTTO";
  20695. }
  20696. function isType1File(file) {
  20697. const header = file.peekBytes(2);
  20698. if (header[0] === 0x25 && header[1] === 0x21) {
  20699. return true;
  20700. }
  20701. if (header[0] === 0x80 && header[1] === 0x01) {
  20702. return true;
  20703. }
  20704. return false;
  20705. }
  20706. function isCFFFile(file) {
  20707. const header = file.peekBytes(4);
  20708. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  20709. return true;
  20710. }
  20711. return false;
  20712. }
  20713. function getFontFileType(file, {
  20714. type,
  20715. subtype,
  20716. composite
  20717. }) {
  20718. let fileType, fileSubtype;
  20719. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  20720. if (composite) {
  20721. fileType = "CIDFontType2";
  20722. } else {
  20723. fileType = "TrueType";
  20724. }
  20725. } else if (isOpenTypeFile(file)) {
  20726. if (composite) {
  20727. fileType = "CIDFontType2";
  20728. } else {
  20729. fileType = "OpenType";
  20730. }
  20731. } else if (isType1File(file)) {
  20732. if (composite) {
  20733. fileType = "CIDFontType0";
  20734. } else {
  20735. fileType = type === "MMType1" ? "MMType1" : "Type1";
  20736. }
  20737. } else if (isCFFFile(file)) {
  20738. if (composite) {
  20739. fileType = "CIDFontType0";
  20740. fileSubtype = "CIDFontType0C";
  20741. } else {
  20742. fileType = type === "MMType1" ? "MMType1" : "Type1";
  20743. fileSubtype = "Type1C";
  20744. }
  20745. } else {
  20746. (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");
  20747. fileType = type;
  20748. fileSubtype = subtype;
  20749. }
  20750. return [fileType, fileSubtype];
  20751. }
  20752. function applyStandardFontGlyphMap(map, glyphMap) {
  20753. for (const charCode in glyphMap) {
  20754. map[+charCode] = glyphMap[charCode];
  20755. }
  20756. }
  20757. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  20758. const toFontChar = [];
  20759. let unicode;
  20760. for (let i = 0, ii = encoding.length; i < ii; i++) {
  20761. unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
  20762. if (unicode !== -1) {
  20763. toFontChar[i] = unicode;
  20764. }
  20765. }
  20766. for (const charCode in differences) {
  20767. unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
  20768. if (unicode !== -1) {
  20769. toFontChar[+charCode] = unicode;
  20770. }
  20771. }
  20772. return toFontChar;
  20773. }
  20774. function convertCidString(charCode, cid, shouldThrow = false) {
  20775. switch (cid.length) {
  20776. case 1:
  20777. return cid.charCodeAt(0);
  20778. case 2:
  20779. return cid.charCodeAt(0) << 8 | cid.charCodeAt(1);
  20780. }
  20781. const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`;
  20782. if (shouldThrow) {
  20783. throw new _util.FormatError(msg);
  20784. }
  20785. (0, _util.warn)(msg);
  20786. return cid;
  20787. }
  20788. function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId, toUnicode) {
  20789. const newMap = Object.create(null);
  20790. const toUnicodeExtraMap = new Map();
  20791. const toFontChar = [];
  20792. const usedGlyphIds = new Set();
  20793. let privateUseAreaIndex = 0;
  20794. const privateUseOffetStart = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  20795. let nextAvailableFontCharCode = privateUseOffetStart;
  20796. let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  20797. for (let originalCharCode in charCodeToGlyphId) {
  20798. originalCharCode |= 0;
  20799. let glyphId = charCodeToGlyphId[originalCharCode];
  20800. if (!hasGlyph(glyphId)) {
  20801. continue;
  20802. }
  20803. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  20804. privateUseAreaIndex++;
  20805. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  20806. (0, _util.warn)("Ran out of space in font private use area.");
  20807. break;
  20808. }
  20809. nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  20810. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  20811. }
  20812. const fontCharCode = nextAvailableFontCharCode++;
  20813. if (glyphId === 0) {
  20814. glyphId = newGlyphZeroId;
  20815. }
  20816. let unicode = toUnicode.get(originalCharCode);
  20817. if (typeof unicode === "string") {
  20818. unicode = unicode.codePointAt(0);
  20819. }
  20820. if (unicode && unicode < privateUseOffetStart && !usedGlyphIds.has(glyphId)) {
  20821. toUnicodeExtraMap.set(unicode, glyphId);
  20822. usedGlyphIds.add(glyphId);
  20823. }
  20824. newMap[fontCharCode] = glyphId;
  20825. toFontChar[originalCharCode] = fontCharCode;
  20826. }
  20827. return {
  20828. toFontChar,
  20829. charCodeToGlyphId: newMap,
  20830. toUnicodeExtraMap,
  20831. nextAvailableFontCharCode
  20832. };
  20833. }
  20834. function getRanges(glyphs, toUnicodeExtraMap, numGlyphs) {
  20835. const codes = [];
  20836. for (const charCode in glyphs) {
  20837. if (glyphs[charCode] >= numGlyphs) {
  20838. continue;
  20839. }
  20840. codes.push({
  20841. fontCharCode: charCode | 0,
  20842. glyphId: glyphs[charCode]
  20843. });
  20844. }
  20845. if (toUnicodeExtraMap) {
  20846. for (const [unicode, glyphId] of toUnicodeExtraMap) {
  20847. if (glyphId >= numGlyphs) {
  20848. continue;
  20849. }
  20850. codes.push({
  20851. fontCharCode: unicode,
  20852. glyphId
  20853. });
  20854. }
  20855. }
  20856. if (codes.length === 0) {
  20857. codes.push({
  20858. fontCharCode: 0,
  20859. glyphId: 0
  20860. });
  20861. }
  20862. codes.sort(function fontGetRangesSort(a, b) {
  20863. return a.fontCharCode - b.fontCharCode;
  20864. });
  20865. const ranges = [];
  20866. const length = codes.length;
  20867. for (let n = 0; n < length;) {
  20868. const start = codes[n].fontCharCode;
  20869. const codeIndices = [codes[n].glyphId];
  20870. ++n;
  20871. let end = start;
  20872. while (n < length && end + 1 === codes[n].fontCharCode) {
  20873. codeIndices.push(codes[n].glyphId);
  20874. ++end;
  20875. ++n;
  20876. if (end === 0xffff) {
  20877. break;
  20878. }
  20879. }
  20880. ranges.push([start, end, codeIndices]);
  20881. }
  20882. return ranges;
  20883. }
  20884. function createCmapTable(glyphs, toUnicodeExtraMap, numGlyphs) {
  20885. const ranges = getRanges(glyphs, toUnicodeExtraMap, numGlyphs);
  20886. const numTables = ranges.at(-1)[1] > 0xffff ? 2 : 1;
  20887. let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8);
  20888. let i, ii, j, jj;
  20889. for (i = ranges.length - 1; i >= 0; --i) {
  20890. if (ranges[i][0] <= 0xffff) {
  20891. break;
  20892. }
  20893. }
  20894. const bmpLength = i + 1;
  20895. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  20896. ranges[i][1] = 0xfffe;
  20897. }
  20898. const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  20899. const segCount = bmpLength + trailingRangesCount;
  20900. const searchParams = _opentype_file_builder.OpenTypeFileBuilder.getSearchParams(segCount, 2);
  20901. let startCount = "";
  20902. let endCount = "";
  20903. let idDeltas = "";
  20904. let idRangeOffsets = "";
  20905. let glyphsIds = "";
  20906. let bias = 0;
  20907. let range, start, end, codes;
  20908. for (i = 0, ii = bmpLength; i < ii; i++) {
  20909. range = ranges[i];
  20910. start = range[0];
  20911. end = range[1];
  20912. startCount += string16(start);
  20913. endCount += string16(end);
  20914. codes = range[2];
  20915. let contiguous = true;
  20916. for (j = 1, jj = codes.length; j < jj; ++j) {
  20917. if (codes[j] !== codes[j - 1] + 1) {
  20918. contiguous = false;
  20919. break;
  20920. }
  20921. }
  20922. if (!contiguous) {
  20923. const offset = (segCount - i) * 2 + bias * 2;
  20924. bias += end - start + 1;
  20925. idDeltas += string16(0);
  20926. idRangeOffsets += string16(offset);
  20927. for (j = 0, jj = codes.length; j < jj; ++j) {
  20928. glyphsIds += string16(codes[j]);
  20929. }
  20930. } else {
  20931. const startCode = codes[0];
  20932. idDeltas += string16(startCode - start & 0xffff);
  20933. idRangeOffsets += string16(0);
  20934. }
  20935. }
  20936. if (trailingRangesCount > 0) {
  20937. endCount += "\xFF\xFF";
  20938. startCount += "\xFF\xFF";
  20939. idDeltas += "\x00\x01";
  20940. idRangeOffsets += "\x00\x00";
  20941. }
  20942. const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
  20943. let format31012 = "";
  20944. let header31012 = "";
  20945. if (numTables > 1) {
  20946. cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
  20947. format31012 = "";
  20948. for (i = 0, ii = ranges.length; i < ii; i++) {
  20949. range = ranges[i];
  20950. start = range[0];
  20951. codes = range[2];
  20952. let code = codes[0];
  20953. for (j = 1, jj = codes.length; j < jj; ++j) {
  20954. if (codes[j] !== codes[j - 1] + 1) {
  20955. end = range[0] + j - 1;
  20956. format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
  20957. start = end + 1;
  20958. code = codes[j];
  20959. }
  20960. }
  20961. format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
  20962. }
  20963. header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12);
  20964. }
  20965. return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
  20966. }
  20967. function validateOS2Table(os2, file) {
  20968. file.pos = (file.start || 0) + os2.offset;
  20969. const version = file.getUint16();
  20970. file.skip(60);
  20971. const selection = file.getUint16();
  20972. if (version < 4 && selection & 0x0300) {
  20973. return false;
  20974. }
  20975. const firstChar = file.getUint16();
  20976. const lastChar = file.getUint16();
  20977. if (firstChar > lastChar) {
  20978. return false;
  20979. }
  20980. file.skip(6);
  20981. const usWinAscent = file.getUint16();
  20982. if (usWinAscent === 0) {
  20983. return false;
  20984. }
  20985. os2.data[8] = os2.data[9] = 0;
  20986. return true;
  20987. }
  20988. function createOS2Table(properties, charstrings, override) {
  20989. override = override || {
  20990. unitsPerEm: 0,
  20991. yMax: 0,
  20992. yMin: 0,
  20993. ascent: 0,
  20994. descent: 0
  20995. };
  20996. let ulUnicodeRange1 = 0;
  20997. let ulUnicodeRange2 = 0;
  20998. let ulUnicodeRange3 = 0;
  20999. let ulUnicodeRange4 = 0;
  21000. let firstCharIndex = null;
  21001. let lastCharIndex = 0;
  21002. if (charstrings) {
  21003. for (let code in charstrings) {
  21004. code |= 0;
  21005. if (firstCharIndex > code || !firstCharIndex) {
  21006. firstCharIndex = code;
  21007. }
  21008. if (lastCharIndex < code) {
  21009. lastCharIndex = code;
  21010. }
  21011. const position = (0, _unicode.getUnicodeRangeFor)(code);
  21012. if (position < 32) {
  21013. ulUnicodeRange1 |= 1 << position;
  21014. } else if (position < 64) {
  21015. ulUnicodeRange2 |= 1 << position - 32;
  21016. } else if (position < 96) {
  21017. ulUnicodeRange3 |= 1 << position - 64;
  21018. } else if (position < 123) {
  21019. ulUnicodeRange4 |= 1 << position - 96;
  21020. } else {
  21021. throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
  21022. }
  21023. }
  21024. if (lastCharIndex > 0xffff) {
  21025. lastCharIndex = 0xffff;
  21026. }
  21027. } else {
  21028. firstCharIndex = 0;
  21029. lastCharIndex = 255;
  21030. }
  21031. const bbox = properties.bbox || [0, 0, 0, 0];
  21032. const unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  21033. const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  21034. const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  21035. let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  21036. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  21037. typoDescent = -typoDescent;
  21038. }
  21039. const winAscent = override.yMax || typoAscent;
  21040. const winDescent = -override.yMin || -typoDescent;
  21041. return "\x00\x03" + "\x02\x24" + "\x01\xF4" + "\x00\x05" + "\x00\x00" + "\x02\x8A" + "\x02\xBB" + "\x00\x00" + "\x00\x8C" + "\x02\x8A" + "\x02\xBB" + "\x00\x00" + "\x01\xDF" + "\x00\x31" + "\x01\x02" + "\x00\x00" + "\x00\x00\x06" + String.fromCharCode(properties.fixedPitch ? 0x09 : 0x00) + "\x00\x00\x00\x00\x00\x00" + (0, _util.string32)(ulUnicodeRange1) + (0, _util.string32)(ulUnicodeRange2) + (0, _util.string32)(ulUnicodeRange3) + (0, _util.string32)(ulUnicodeRange4) + "\x2A\x32\x31\x2A" + string16(properties.italicAngle ? 1 : 0) + string16(firstCharIndex || properties.firstChar) + string16(lastCharIndex || properties.lastChar) + string16(typoAscent) + string16(typoDescent) + "\x00\x64" + string16(winAscent) + string16(winDescent) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + string16(properties.xHeight) + string16(properties.capHeight) + string16(0) + string16(firstCharIndex || properties.firstChar) + "\x00\x03";
  21042. }
  21043. function createPostTable(properties) {
  21044. const angle = Math.floor(properties.italicAngle * 2 ** 16);
  21045. return "\x00\x03\x00\x00" + (0, _util.string32)(angle) + "\x00\x00" + "\x00\x00" + (0, _util.string32)(properties.fixedPitch ? 1 : 0) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00";
  21046. }
  21047. function createPostscriptName(name) {
  21048. return name.replace(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63);
  21049. }
  21050. function createNameTable(name, proto) {
  21051. if (!proto) {
  21052. proto = [[], []];
  21053. }
  21054. const strings = [proto[0][0] || "Original licence", proto[0][1] || name, proto[0][2] || "Unknown", proto[0][3] || "uniqueID", proto[0][4] || name, proto[0][5] || "Version 0.11", proto[0][6] || createPostscriptName(name), proto[0][7] || "Unknown", proto[0][8] || "Unknown", proto[0][9] || "Unknown"];
  21055. const stringsUnicode = [];
  21056. let i, ii, j, jj, str;
  21057. for (i = 0, ii = strings.length; i < ii; i++) {
  21058. str = proto[1][i] || strings[i];
  21059. const strBufUnicode = [];
  21060. for (j = 0, jj = str.length; j < jj; j++) {
  21061. strBufUnicode.push(string16(str.charCodeAt(j)));
  21062. }
  21063. stringsUnicode.push(strBufUnicode.join(""));
  21064. }
  21065. const names = [strings, stringsUnicode];
  21066. const platforms = ["\x00\x01", "\x00\x03"];
  21067. const encodings = ["\x00\x00", "\x00\x01"];
  21068. const languages = ["\x00\x00", "\x04\x09"];
  21069. const namesRecordCount = strings.length * platforms.length;
  21070. let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  21071. let strOffset = 0;
  21072. for (i = 0, ii = platforms.length; i < ii; i++) {
  21073. const strs = names[i];
  21074. for (j = 0, jj = strs.length; j < jj; j++) {
  21075. str = strs[j];
  21076. const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  21077. nameTable += nameRecord;
  21078. strOffset += str.length;
  21079. }
  21080. }
  21081. nameTable += strings.join("") + stringsUnicode.join("");
  21082. return nameTable;
  21083. }
  21084. class Font {
  21085. constructor(name, file, properties) {
  21086. this.name = name;
  21087. this.psName = null;
  21088. this.mimetype = null;
  21089. this.disableFontFace = false;
  21090. this.loadedName = properties.loadedName;
  21091. this.isType3Font = properties.isType3Font;
  21092. this.missingFile = false;
  21093. this.cssFontInfo = properties.cssFontInfo;
  21094. this._charsCache = Object.create(null);
  21095. this._glyphCache = Object.create(null);
  21096. let isSerifFont = !!(properties.flags & _fonts_utils.FontFlags.Serif);
  21097. if (!isSerifFont && !properties.isSimulatedFlags) {
  21098. const baseName = name.replace(/[,_]/g, "-").split("-")[0],
  21099. serifFonts = (0, _standard_fonts.getSerifFonts)();
  21100. for (const namePart of baseName.split("+")) {
  21101. if (serifFonts[namePart]) {
  21102. isSerifFont = true;
  21103. break;
  21104. }
  21105. }
  21106. }
  21107. this.isSerifFont = isSerifFont;
  21108. this.isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  21109. this.isMonospace = !!(properties.flags & _fonts_utils.FontFlags.FixedPitch);
  21110. let type = properties.type;
  21111. let subtype = properties.subtype;
  21112. this.type = type;
  21113. this.subtype = subtype;
  21114. const matches = name.match(/^InvalidPDFjsFont_(.*)_\d+$/);
  21115. this.isInvalidPDFjsFont = !!matches;
  21116. if (this.isInvalidPDFjsFont) {
  21117. this.fallbackName = matches[1];
  21118. } else if (this.isMonospace) {
  21119. this.fallbackName = "monospace";
  21120. } else if (this.isSerifFont) {
  21121. this.fallbackName = "serif";
  21122. } else {
  21123. this.fallbackName = "sans-serif";
  21124. }
  21125. this.differences = properties.differences;
  21126. this.widths = properties.widths;
  21127. this.defaultWidth = properties.defaultWidth;
  21128. this.composite = properties.composite;
  21129. this.cMap = properties.cMap;
  21130. this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
  21131. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  21132. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  21133. this.lineHeight = this.ascent - this.descent;
  21134. this.fontMatrix = properties.fontMatrix;
  21135. this.bbox = properties.bbox;
  21136. this.defaultEncoding = properties.defaultEncoding;
  21137. this.toUnicode = properties.toUnicode;
  21138. this.toFontChar = [];
  21139. if (properties.type === "Type3") {
  21140. for (let charCode = 0; charCode < 256; charCode++) {
  21141. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  21142. }
  21143. this.fontType = _util.FontType.TYPE3;
  21144. return;
  21145. }
  21146. this.cidEncoding = properties.cidEncoding || "";
  21147. this.vertical = !!properties.vertical;
  21148. if (this.vertical) {
  21149. this.vmetrics = properties.vmetrics;
  21150. this.defaultVMetrics = properties.defaultVMetrics;
  21151. }
  21152. if (!file || file.isEmpty) {
  21153. if (file) {
  21154. (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")");
  21155. }
  21156. this.fallbackToSystemFont(properties);
  21157. return;
  21158. }
  21159. [type, subtype] = getFontFileType(file, properties);
  21160. if (type !== this.type || subtype !== this.subtype) {
  21161. (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
  21162. }
  21163. let data;
  21164. try {
  21165. switch (type) {
  21166. case "MMType1":
  21167. (0, _util.info)("MMType1 font (" + name + "), falling back to Type1.");
  21168. case "Type1":
  21169. case "CIDFontType0":
  21170. this.mimetype = "font/opentype";
  21171. const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new _cff_font.CFFFont(file, properties) : new _type1_font.Type1Font(name, file, properties);
  21172. adjustWidths(properties);
  21173. data = this.convert(name, cff, properties);
  21174. break;
  21175. case "OpenType":
  21176. case "TrueType":
  21177. case "CIDFontType2":
  21178. this.mimetype = "font/opentype";
  21179. data = this.checkAndRepair(name, file, properties);
  21180. if (this.isOpenType) {
  21181. adjustWidths(properties);
  21182. type = "OpenType";
  21183. }
  21184. break;
  21185. default:
  21186. throw new _util.FormatError(`Font ${type} is not supported`);
  21187. }
  21188. } catch (e) {
  21189. (0, _util.warn)(e);
  21190. this.fallbackToSystemFont(properties);
  21191. return;
  21192. }
  21193. amendFallbackToUnicode(properties);
  21194. this.data = data;
  21195. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  21196. this.fontMatrix = properties.fontMatrix;
  21197. this.widths = properties.widths;
  21198. this.defaultWidth = properties.defaultWidth;
  21199. this.toUnicode = properties.toUnicode;
  21200. this.seacMap = properties.seacMap;
  21201. }
  21202. get renderer() {
  21203. const renderer = _font_renderer.FontRendererFactory.create(this, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  21204. return (0, _util.shadow)(this, "renderer", renderer);
  21205. }
  21206. exportData(extraProperties = false) {
  21207. const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
  21208. const data = Object.create(null);
  21209. let property, value;
  21210. for (property of exportDataProperties) {
  21211. value = this[property];
  21212. if (value !== undefined) {
  21213. data[property] = value;
  21214. }
  21215. }
  21216. return data;
  21217. }
  21218. fallbackToSystemFont(properties) {
  21219. this.missingFile = true;
  21220. const name = this.name;
  21221. const type = this.type;
  21222. const subtype = this.subtype;
  21223. let fontName = (0, _fonts_utils.normalizeFontName)(name);
  21224. const stdFontMap = (0, _standard_fonts.getStdFontMap)(),
  21225. nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
  21226. const isStandardFont = !!stdFontMap[fontName];
  21227. const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  21228. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  21229. const fontBasicMetricsMap = (0, _metrics.getFontBasicMetrics)();
  21230. const metrics = fontBasicMetricsMap[fontName];
  21231. if (metrics) {
  21232. if (isNaN(this.ascent)) {
  21233. this.ascent = metrics.ascent / PDF_GLYPH_SPACE_UNITS;
  21234. }
  21235. if (isNaN(this.descent)) {
  21236. this.descent = metrics.descent / PDF_GLYPH_SPACE_UNITS;
  21237. }
  21238. if (isNaN(this.capHeight)) {
  21239. this.capHeight = metrics.capHeight / PDF_GLYPH_SPACE_UNITS;
  21240. }
  21241. }
  21242. this.bold = /bold/gi.test(fontName);
  21243. this.italic = /oblique|italic/gi.test(fontName);
  21244. this.black = /Black/g.test(name);
  21245. const isNarrow = /Narrow/g.test(name);
  21246. this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
  21247. if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
  21248. const cidToGidMap = properties.cidToGidMap;
  21249. const map = [];
  21250. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  21251. if (/Arial-?Black/i.test(name)) {
  21252. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)());
  21253. } else if (/Calibri/i.test(name)) {
  21254. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForCalibri)());
  21255. }
  21256. if (cidToGidMap) {
  21257. for (const charCode in map) {
  21258. const cid = map[charCode];
  21259. if (cidToGidMap[cid] !== undefined) {
  21260. map[+charCode] = cidToGidMap[cid];
  21261. }
  21262. }
  21263. if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  21264. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  21265. const cid = map[charCode];
  21266. if (cidToGidMap[cid] === undefined) {
  21267. map[+charCode] = unicodeCharCode;
  21268. }
  21269. });
  21270. }
  21271. }
  21272. if (!(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  21273. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  21274. map[+charCode] = unicodeCharCode;
  21275. });
  21276. }
  21277. this.toFontChar = map;
  21278. this.toUnicode = new _to_unicode_map.ToUnicodeMap(map);
  21279. } else if (/Symbol/i.test(fontName)) {
  21280. this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  21281. } else if (/Dingbats/i.test(fontName)) {
  21282. if (/Wingdings/i.test(name)) {
  21283. (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats.");
  21284. }
  21285. this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
  21286. } else if (isStandardFont) {
  21287. const map = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  21288. if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  21289. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  21290. map[+charCode] = unicodeCharCode;
  21291. });
  21292. }
  21293. this.toFontChar = map;
  21294. } else {
  21295. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  21296. const map = [];
  21297. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  21298. if (!this.composite) {
  21299. const glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
  21300. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  21301. if (unicode !== -1) {
  21302. unicodeCharCode = unicode;
  21303. }
  21304. }
  21305. map[+charCode] = unicodeCharCode;
  21306. });
  21307. if (this.composite && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  21308. if (/Tahoma|Verdana/i.test(name)) {
  21309. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  21310. }
  21311. }
  21312. this.toFontChar = map;
  21313. }
  21314. amendFallbackToUnicode(properties);
  21315. this.loadedName = fontName.split("-")[0];
  21316. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  21317. }
  21318. checkAndRepair(name, font, properties) {
  21319. const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
  21320. function readTables(file, numTables) {
  21321. const tables = Object.create(null);
  21322. tables["OS/2"] = null;
  21323. tables.cmap = null;
  21324. tables.head = null;
  21325. tables.hhea = null;
  21326. tables.hmtx = null;
  21327. tables.maxp = null;
  21328. tables.name = null;
  21329. tables.post = null;
  21330. for (let i = 0; i < numTables; i++) {
  21331. const table = readTableEntry(file);
  21332. if (!VALID_TABLES.includes(table.tag)) {
  21333. continue;
  21334. }
  21335. if (table.length === 0) {
  21336. continue;
  21337. }
  21338. tables[table.tag] = table;
  21339. }
  21340. return tables;
  21341. }
  21342. function readTableEntry(file) {
  21343. const tag = file.getString(4);
  21344. const checksum = file.getInt32() >>> 0;
  21345. const offset = file.getInt32() >>> 0;
  21346. const length = file.getInt32() >>> 0;
  21347. const previousPosition = file.pos;
  21348. file.pos = file.start || 0;
  21349. file.skip(offset);
  21350. const data = file.getBytes(length);
  21351. file.pos = previousPosition;
  21352. if (tag === "head") {
  21353. data[8] = data[9] = data[10] = data[11] = 0;
  21354. data[17] |= 0x20;
  21355. }
  21356. return {
  21357. tag,
  21358. checksum,
  21359. length,
  21360. offset,
  21361. data
  21362. };
  21363. }
  21364. function readOpenTypeHeader(ttf) {
  21365. return {
  21366. version: ttf.getString(4),
  21367. numTables: ttf.getUint16(),
  21368. searchRange: ttf.getUint16(),
  21369. entrySelector: ttf.getUint16(),
  21370. rangeShift: ttf.getUint16()
  21371. };
  21372. }
  21373. function readTrueTypeCollectionHeader(ttc) {
  21374. const ttcTag = ttc.getString(4);
  21375. (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font.");
  21376. const majorVersion = ttc.getUint16();
  21377. const minorVersion = ttc.getUint16();
  21378. const numFonts = ttc.getInt32() >>> 0;
  21379. const offsetTable = [];
  21380. for (let i = 0; i < numFonts; i++) {
  21381. offsetTable.push(ttc.getInt32() >>> 0);
  21382. }
  21383. const header = {
  21384. ttcTag,
  21385. majorVersion,
  21386. minorVersion,
  21387. numFonts,
  21388. offsetTable
  21389. };
  21390. switch (majorVersion) {
  21391. case 1:
  21392. return header;
  21393. case 2:
  21394. header.dsigTag = ttc.getInt32() >>> 0;
  21395. header.dsigLength = ttc.getInt32() >>> 0;
  21396. header.dsigOffset = ttc.getInt32() >>> 0;
  21397. return header;
  21398. }
  21399. throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
  21400. }
  21401. function readTrueTypeCollectionData(ttc, fontName) {
  21402. const {
  21403. numFonts,
  21404. offsetTable
  21405. } = readTrueTypeCollectionHeader(ttc);
  21406. const fontNameParts = fontName.split("+");
  21407. let fallbackData;
  21408. for (let i = 0; i < numFonts; i++) {
  21409. ttc.pos = (ttc.start || 0) + offsetTable[i];
  21410. const potentialHeader = readOpenTypeHeader(ttc);
  21411. const potentialTables = readTables(ttc, potentialHeader.numTables);
  21412. if (!potentialTables.name) {
  21413. throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
  21414. }
  21415. const nameTable = readNameTable(potentialTables.name);
  21416. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  21417. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  21418. const nameEntry = nameTable[j][k] && nameTable[j][k].replace(/\s/g, "");
  21419. if (!nameEntry) {
  21420. continue;
  21421. }
  21422. if (nameEntry === fontName) {
  21423. return {
  21424. header: potentialHeader,
  21425. tables: potentialTables
  21426. };
  21427. }
  21428. if (fontNameParts.length < 2) {
  21429. continue;
  21430. }
  21431. for (const part of fontNameParts) {
  21432. if (nameEntry === part) {
  21433. fallbackData = {
  21434. name: part,
  21435. header: potentialHeader,
  21436. tables: potentialTables
  21437. };
  21438. }
  21439. }
  21440. }
  21441. }
  21442. }
  21443. if (fallbackData) {
  21444. (0, _util.warn)(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`);
  21445. return {
  21446. header: fallbackData.header,
  21447. tables: fallbackData.tables
  21448. };
  21449. }
  21450. throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`);
  21451. }
  21452. function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
  21453. if (!cmap) {
  21454. (0, _util.warn)("No cmap table available.");
  21455. return {
  21456. platformId: -1,
  21457. encodingId: -1,
  21458. mappings: [],
  21459. hasShortCmap: false
  21460. };
  21461. }
  21462. let segment;
  21463. let start = (file.start || 0) + cmap.offset;
  21464. file.pos = start;
  21465. file.skip(2);
  21466. const numTables = file.getUint16();
  21467. let potentialTable;
  21468. let canBreak = false;
  21469. for (let i = 0; i < numTables; i++) {
  21470. const platformId = file.getUint16();
  21471. const encodingId = file.getUint16();
  21472. const offset = file.getInt32() >>> 0;
  21473. let useTable = false;
  21474. if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) {
  21475. continue;
  21476. }
  21477. if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
  21478. useTable = true;
  21479. } else if (platformId === 1 && encodingId === 0) {
  21480. useTable = true;
  21481. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  21482. useTable = true;
  21483. if (!isSymbolicFont) {
  21484. canBreak = true;
  21485. }
  21486. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  21487. useTable = true;
  21488. let correctlySorted = true;
  21489. if (i < numTables - 1) {
  21490. const nextBytes = file.peekBytes(2),
  21491. nextPlatformId = int16(nextBytes[0], nextBytes[1]);
  21492. if (nextPlatformId < platformId) {
  21493. correctlySorted = false;
  21494. }
  21495. }
  21496. if (correctlySorted) {
  21497. canBreak = true;
  21498. }
  21499. }
  21500. if (useTable) {
  21501. potentialTable = {
  21502. platformId,
  21503. encodingId,
  21504. offset
  21505. };
  21506. }
  21507. if (canBreak) {
  21508. break;
  21509. }
  21510. }
  21511. if (potentialTable) {
  21512. file.pos = start + potentialTable.offset;
  21513. }
  21514. if (!potentialTable || file.peekByte() === -1) {
  21515. (0, _util.warn)("Could not find a preferred cmap table.");
  21516. return {
  21517. platformId: -1,
  21518. encodingId: -1,
  21519. mappings: [],
  21520. hasShortCmap: false
  21521. };
  21522. }
  21523. const format = file.getUint16();
  21524. let hasShortCmap = false;
  21525. const mappings = [];
  21526. let j, glyphId;
  21527. if (format === 0) {
  21528. file.skip(2 + 2);
  21529. for (j = 0; j < 256; j++) {
  21530. const index = file.getByte();
  21531. if (!index) {
  21532. continue;
  21533. }
  21534. mappings.push({
  21535. charCode: j,
  21536. glyphId: index
  21537. });
  21538. }
  21539. hasShortCmap = true;
  21540. } else if (format === 2) {
  21541. file.skip(2 + 2);
  21542. const subHeaderKeys = [];
  21543. let maxSubHeaderKey = 0;
  21544. for (let i = 0; i < 256; i++) {
  21545. const subHeaderKey = file.getUint16() >> 3;
  21546. subHeaderKeys.push(subHeaderKey);
  21547. maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey);
  21548. }
  21549. const subHeaders = [];
  21550. for (let i = 0; i <= maxSubHeaderKey; i++) {
  21551. subHeaders.push({
  21552. firstCode: file.getUint16(),
  21553. entryCount: file.getUint16(),
  21554. idDelta: signedInt16(file.getByte(), file.getByte()),
  21555. idRangePos: file.pos + file.getUint16()
  21556. });
  21557. }
  21558. for (let i = 0; i < 256; i++) {
  21559. if (subHeaderKeys[i] === 0) {
  21560. file.pos = subHeaders[0].idRangePos + 2 * i;
  21561. glyphId = file.getUint16();
  21562. mappings.push({
  21563. charCode: i,
  21564. glyphId
  21565. });
  21566. } else {
  21567. const s = subHeaders[subHeaderKeys[i]];
  21568. for (j = 0; j < s.entryCount; j++) {
  21569. const charCode = (i << 8) + j + s.firstCode;
  21570. file.pos = s.idRangePos + 2 * j;
  21571. glyphId = file.getUint16();
  21572. if (glyphId !== 0) {
  21573. glyphId = (glyphId + s.idDelta) % 65536;
  21574. }
  21575. mappings.push({
  21576. charCode,
  21577. glyphId
  21578. });
  21579. }
  21580. }
  21581. }
  21582. } else if (format === 4) {
  21583. file.skip(2 + 2);
  21584. const segCount = file.getUint16() >> 1;
  21585. file.skip(6);
  21586. const segments = [];
  21587. let segIndex;
  21588. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21589. segments.push({
  21590. end: file.getUint16()
  21591. });
  21592. }
  21593. file.skip(2);
  21594. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21595. segments[segIndex].start = file.getUint16();
  21596. }
  21597. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21598. segments[segIndex].delta = file.getUint16();
  21599. }
  21600. let offsetsCount = 0,
  21601. offsetIndex;
  21602. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21603. segment = segments[segIndex];
  21604. const rangeOffset = file.getUint16();
  21605. if (!rangeOffset) {
  21606. segment.offsetIndex = -1;
  21607. continue;
  21608. }
  21609. offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  21610. segment.offsetIndex = offsetIndex;
  21611. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  21612. }
  21613. const offsets = [];
  21614. for (j = 0; j < offsetsCount; j++) {
  21615. offsets.push(file.getUint16());
  21616. }
  21617. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21618. segment = segments[segIndex];
  21619. start = segment.start;
  21620. const end = segment.end;
  21621. const delta = segment.delta;
  21622. offsetIndex = segment.offsetIndex;
  21623. for (j = start; j <= end; j++) {
  21624. if (j === 0xffff) {
  21625. continue;
  21626. }
  21627. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  21628. glyphId = glyphId + delta & 0xffff;
  21629. mappings.push({
  21630. charCode: j,
  21631. glyphId
  21632. });
  21633. }
  21634. }
  21635. } else if (format === 6) {
  21636. file.skip(2 + 2);
  21637. const firstCode = file.getUint16();
  21638. const entryCount = file.getUint16();
  21639. for (j = 0; j < entryCount; j++) {
  21640. glyphId = file.getUint16();
  21641. const charCode = firstCode + j;
  21642. mappings.push({
  21643. charCode,
  21644. glyphId
  21645. });
  21646. }
  21647. } else if (format === 12) {
  21648. file.skip(2 + 4 + 4);
  21649. const nGroups = file.getInt32() >>> 0;
  21650. for (j = 0; j < nGroups; j++) {
  21651. const startCharCode = file.getInt32() >>> 0;
  21652. const endCharCode = file.getInt32() >>> 0;
  21653. let glyphCode = file.getInt32() >>> 0;
  21654. for (let charCode = startCharCode; charCode <= endCharCode; charCode++) {
  21655. mappings.push({
  21656. charCode,
  21657. glyphId: glyphCode++
  21658. });
  21659. }
  21660. }
  21661. } else {
  21662. (0, _util.warn)("cmap table has unsupported format: " + format);
  21663. return {
  21664. platformId: -1,
  21665. encodingId: -1,
  21666. mappings: [],
  21667. hasShortCmap: false
  21668. };
  21669. }
  21670. mappings.sort(function (a, b) {
  21671. return a.charCode - b.charCode;
  21672. });
  21673. for (let i = 1; i < mappings.length; i++) {
  21674. if (mappings[i - 1].charCode === mappings[i].charCode) {
  21675. mappings.splice(i, 1);
  21676. i--;
  21677. }
  21678. }
  21679. return {
  21680. platformId: potentialTable.platformId,
  21681. encodingId: potentialTable.encodingId,
  21682. mappings,
  21683. hasShortCmap
  21684. };
  21685. }
  21686. function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) {
  21687. if (!header) {
  21688. if (metrics) {
  21689. metrics.data = null;
  21690. }
  21691. return;
  21692. }
  21693. file.pos = (file.start || 0) + header.offset;
  21694. file.pos += 4;
  21695. file.pos += 2;
  21696. file.pos += 2;
  21697. file.pos += 2;
  21698. file.pos += 2;
  21699. file.pos += 2;
  21700. file.pos += 2;
  21701. file.pos += 2;
  21702. file.pos += 2;
  21703. file.pos += 2;
  21704. const caretOffset = file.getUint16();
  21705. file.pos += 8;
  21706. file.pos += 2;
  21707. let numOfMetrics = file.getUint16();
  21708. if (caretOffset !== 0) {
  21709. const macStyle = int16(headTable.data[44], headTable.data[45]);
  21710. if (!(macStyle & 2)) {
  21711. header.data[22] = 0;
  21712. header.data[23] = 0;
  21713. }
  21714. }
  21715. if (numOfMetrics > numGlyphs) {
  21716. (0, _util.info)(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`);
  21717. numOfMetrics = numGlyphs;
  21718. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  21719. header.data[35] = numOfMetrics & 0x00ff;
  21720. }
  21721. const numOfSidebearings = numGlyphs - numOfMetrics;
  21722. const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  21723. if (numMissing > 0) {
  21724. const entries = new Uint8Array(metrics.length + numMissing * 2);
  21725. entries.set(metrics.data);
  21726. if (dupFirstEntry) {
  21727. entries[metrics.length] = metrics.data[2];
  21728. entries[metrics.length + 1] = metrics.data[3];
  21729. }
  21730. metrics.data = entries;
  21731. }
  21732. }
  21733. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  21734. const glyphProfile = {
  21735. length: 0,
  21736. sizeOfInstructions: 0
  21737. };
  21738. if (sourceEnd - sourceStart <= 12) {
  21739. return glyphProfile;
  21740. }
  21741. const glyf = source.subarray(sourceStart, sourceEnd);
  21742. let contoursCount = signedInt16(glyf[0], glyf[1]);
  21743. if (contoursCount < 0) {
  21744. contoursCount = -1;
  21745. writeSignedInt16(glyf, 0, contoursCount);
  21746. dest.set(glyf, destStart);
  21747. glyphProfile.length = glyf.length;
  21748. return glyphProfile;
  21749. }
  21750. let i,
  21751. j = 10,
  21752. flagsCount = 0;
  21753. for (i = 0; i < contoursCount; i++) {
  21754. const endPoint = glyf[j] << 8 | glyf[j + 1];
  21755. flagsCount = endPoint + 1;
  21756. j += 2;
  21757. }
  21758. const instructionsStart = j;
  21759. const instructionsLength = glyf[j] << 8 | glyf[j + 1];
  21760. glyphProfile.sizeOfInstructions = instructionsLength;
  21761. j += 2 + instructionsLength;
  21762. const instructionsEnd = j;
  21763. let coordinatesLength = 0;
  21764. for (i = 0; i < flagsCount; i++) {
  21765. const flag = glyf[j++];
  21766. if (flag & 0xc0) {
  21767. glyf[j - 1] = flag & 0x3f;
  21768. }
  21769. let xLength = 2;
  21770. if (flag & 2) {
  21771. xLength = 1;
  21772. } else if (flag & 16) {
  21773. xLength = 0;
  21774. }
  21775. let yLength = 2;
  21776. if (flag & 4) {
  21777. yLength = 1;
  21778. } else if (flag & 32) {
  21779. yLength = 0;
  21780. }
  21781. const xyLength = xLength + yLength;
  21782. coordinatesLength += xyLength;
  21783. if (flag & 8) {
  21784. const repeat = glyf[j++];
  21785. i += repeat;
  21786. coordinatesLength += repeat * xyLength;
  21787. }
  21788. }
  21789. if (coordinatesLength === 0) {
  21790. return glyphProfile;
  21791. }
  21792. let glyphDataLength = j + coordinatesLength;
  21793. if (glyphDataLength > glyf.length) {
  21794. return glyphProfile;
  21795. }
  21796. if (!hintsValid && instructionsLength > 0) {
  21797. dest.set(glyf.subarray(0, instructionsStart), destStart);
  21798. dest.set([0, 0], destStart + instructionsStart);
  21799. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  21800. glyphDataLength -= instructionsLength;
  21801. if (glyf.length - glyphDataLength > 3) {
  21802. glyphDataLength = glyphDataLength + 3 & ~3;
  21803. }
  21804. glyphProfile.length = glyphDataLength;
  21805. return glyphProfile;
  21806. }
  21807. if (glyf.length - glyphDataLength > 3) {
  21808. glyphDataLength = glyphDataLength + 3 & ~3;
  21809. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  21810. glyphProfile.length = glyphDataLength;
  21811. return glyphProfile;
  21812. }
  21813. dest.set(glyf, destStart);
  21814. glyphProfile.length = glyf.length;
  21815. return glyphProfile;
  21816. }
  21817. function sanitizeHead(head, numGlyphs, locaLength) {
  21818. const data = head.data;
  21819. const version = int32(data[0], data[1], data[2], data[3]);
  21820. if (version >> 16 !== 1) {
  21821. (0, _util.info)("Attempting to fix invalid version in head table: " + version);
  21822. data[0] = 0;
  21823. data[1] = 1;
  21824. data[2] = 0;
  21825. data[3] = 0;
  21826. }
  21827. const indexToLocFormat = int16(data[50], data[51]);
  21828. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  21829. (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
  21830. const numGlyphsPlusOne = numGlyphs + 1;
  21831. if (locaLength === numGlyphsPlusOne << 1) {
  21832. data[50] = 0;
  21833. data[51] = 0;
  21834. } else if (locaLength === numGlyphsPlusOne << 2) {
  21835. data[50] = 0;
  21836. data[51] = 1;
  21837. } else {
  21838. throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
  21839. }
  21840. }
  21841. }
  21842. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
  21843. let itemSize, itemDecode, itemEncode;
  21844. if (isGlyphLocationsLong) {
  21845. itemSize = 4;
  21846. itemDecode = function fontItemDecodeLong(data, offset) {
  21847. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  21848. };
  21849. itemEncode = function fontItemEncodeLong(data, offset, value) {
  21850. data[offset] = value >>> 24 & 0xff;
  21851. data[offset + 1] = value >> 16 & 0xff;
  21852. data[offset + 2] = value >> 8 & 0xff;
  21853. data[offset + 3] = value & 0xff;
  21854. };
  21855. } else {
  21856. itemSize = 2;
  21857. itemDecode = function fontItemDecode(data, offset) {
  21858. return data[offset] << 9 | data[offset + 1] << 1;
  21859. };
  21860. itemEncode = function fontItemEncode(data, offset, value) {
  21861. data[offset] = value >> 9 & 0xff;
  21862. data[offset + 1] = value >> 1 & 0xff;
  21863. };
  21864. }
  21865. const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  21866. const locaDataSize = itemSize * (1 + numGlyphsOut);
  21867. const locaData = new Uint8Array(locaDataSize);
  21868. locaData.set(loca.data.subarray(0, locaDataSize));
  21869. loca.data = locaData;
  21870. const oldGlyfData = glyf.data;
  21871. const oldGlyfDataLength = oldGlyfData.length;
  21872. const newGlyfData = new Uint8Array(oldGlyfDataLength);
  21873. let i, j;
  21874. const locaEntries = [];
  21875. for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
  21876. let offset = itemDecode(locaData, j);
  21877. if (offset > oldGlyfDataLength) {
  21878. offset = oldGlyfDataLength;
  21879. }
  21880. locaEntries.push({
  21881. index: i,
  21882. offset,
  21883. endOffset: 0
  21884. });
  21885. }
  21886. locaEntries.sort((a, b) => {
  21887. return a.offset - b.offset;
  21888. });
  21889. for (i = 0; i < numGlyphs; i++) {
  21890. locaEntries[i].endOffset = locaEntries[i + 1].offset;
  21891. }
  21892. locaEntries.sort((a, b) => {
  21893. return a.index - b.index;
  21894. });
  21895. for (i = 0; i < numGlyphs; i++) {
  21896. const {
  21897. offset,
  21898. endOffset
  21899. } = locaEntries[i];
  21900. if (offset !== 0 || endOffset !== 0) {
  21901. break;
  21902. }
  21903. const nextOffset = locaEntries[i + 1].offset;
  21904. if (nextOffset === 0) {
  21905. continue;
  21906. }
  21907. locaEntries[i].endOffset = nextOffset;
  21908. break;
  21909. }
  21910. const missingGlyphs = Object.create(null);
  21911. let writeOffset = 0;
  21912. itemEncode(locaData, 0, writeOffset);
  21913. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  21914. const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
  21915. const newLength = glyphProfile.length;
  21916. if (newLength === 0) {
  21917. missingGlyphs[i] = true;
  21918. }
  21919. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  21920. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  21921. }
  21922. writeOffset += newLength;
  21923. itemEncode(locaData, j, writeOffset);
  21924. }
  21925. if (writeOffset === 0) {
  21926. const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  21927. for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
  21928. itemEncode(locaData, j, simpleGlyph.length);
  21929. }
  21930. glyf.data = simpleGlyph;
  21931. } else if (dupFirstEntry) {
  21932. const firstEntryLength = itemDecode(locaData, itemSize);
  21933. if (newGlyfData.length > firstEntryLength + writeOffset) {
  21934. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  21935. } else {
  21936. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  21937. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  21938. }
  21939. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  21940. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  21941. } else {
  21942. glyf.data = newGlyfData.subarray(0, writeOffset);
  21943. }
  21944. return {
  21945. missingGlyphs,
  21946. maxSizeOfInstructions
  21947. };
  21948. }
  21949. function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
  21950. const start = (font.start || 0) + post.offset;
  21951. font.pos = start;
  21952. const length = post.length,
  21953. end = start + length;
  21954. const version = font.getInt32();
  21955. font.skip(28);
  21956. let glyphNames;
  21957. let valid = true;
  21958. let i;
  21959. switch (version) {
  21960. case 0x00010000:
  21961. glyphNames = _fonts_utils.MacStandardGlyphOrdering;
  21962. break;
  21963. case 0x00020000:
  21964. const numGlyphs = font.getUint16();
  21965. if (numGlyphs !== maxpNumGlyphs) {
  21966. valid = false;
  21967. break;
  21968. }
  21969. const glyphNameIndexes = [];
  21970. for (i = 0; i < numGlyphs; ++i) {
  21971. const index = font.getUint16();
  21972. if (index >= 32768) {
  21973. valid = false;
  21974. break;
  21975. }
  21976. glyphNameIndexes.push(index);
  21977. }
  21978. if (!valid) {
  21979. break;
  21980. }
  21981. const customNames = [],
  21982. strBuf = [];
  21983. while (font.pos < end) {
  21984. const stringLength = font.getByte();
  21985. strBuf.length = stringLength;
  21986. for (i = 0; i < stringLength; ++i) {
  21987. strBuf[i] = String.fromCharCode(font.getByte());
  21988. }
  21989. customNames.push(strBuf.join(""));
  21990. }
  21991. glyphNames = [];
  21992. for (i = 0; i < numGlyphs; ++i) {
  21993. const j = glyphNameIndexes[i];
  21994. if (j < 258) {
  21995. glyphNames.push(_fonts_utils.MacStandardGlyphOrdering[j]);
  21996. continue;
  21997. }
  21998. glyphNames.push(customNames[j - 258]);
  21999. }
  22000. break;
  22001. case 0x00030000:
  22002. break;
  22003. default:
  22004. (0, _util.warn)("Unknown/unsupported post table version " + version);
  22005. valid = false;
  22006. if (propertiesObj.defaultEncoding) {
  22007. glyphNames = propertiesObj.defaultEncoding;
  22008. }
  22009. break;
  22010. }
  22011. propertiesObj.glyphNames = glyphNames;
  22012. return valid;
  22013. }
  22014. function readNameTable(nameTable) {
  22015. const start = (font.start || 0) + nameTable.offset;
  22016. font.pos = start;
  22017. const names = [[], []];
  22018. const length = nameTable.length,
  22019. end = start + length;
  22020. const format = font.getUint16();
  22021. const FORMAT_0_HEADER_LENGTH = 6;
  22022. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  22023. return names;
  22024. }
  22025. const numRecords = font.getUint16();
  22026. const stringsStart = font.getUint16();
  22027. const records = [];
  22028. const NAME_RECORD_LENGTH = 12;
  22029. let i, ii;
  22030. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  22031. const r = {
  22032. platform: font.getUint16(),
  22033. encoding: font.getUint16(),
  22034. language: font.getUint16(),
  22035. name: font.getUint16(),
  22036. length: font.getUint16(),
  22037. offset: font.getUint16()
  22038. };
  22039. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  22040. records.push(r);
  22041. }
  22042. }
  22043. for (i = 0, ii = records.length; i < ii; i++) {
  22044. const record = records[i];
  22045. if (record.length <= 0) {
  22046. continue;
  22047. }
  22048. const pos = start + stringsStart + record.offset;
  22049. if (pos + record.length > end) {
  22050. continue;
  22051. }
  22052. font.pos = pos;
  22053. const nameIndex = record.name;
  22054. if (record.encoding) {
  22055. let str = "";
  22056. for (let j = 0, jj = record.length; j < jj; j += 2) {
  22057. str += String.fromCharCode(font.getUint16());
  22058. }
  22059. names[1][nameIndex] = str;
  22060. } else {
  22061. names[0][nameIndex] = font.getString(record.length);
  22062. }
  22063. }
  22064. return names;
  22065. }
  22066. const TTOpsStackDeltas = [0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, 0, 0, -2, -5, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -1, -1, 1, -1, -999, 0, 1, 0, -1, -2, 0, -1, -2, -1, -1, 0, -1, -1, 0, 0, -999, -999, -1, -1, -1, -1, -2, -999, -2, -2, -999, 0, -2, -2, 0, 0, -2, 0, -2, 0, 0, 0, -2, -1, -1, 1, 1, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, 0, -999, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -999, -999, -999, -999, -999, -1, -1, -2, -2, 0, 0, 0, 0, -1, -1, -999, -2, -2, 0, 0, -1, -2, -2, 0, 0, 0, -1, -1, -1, -2];
  22067. function sanitizeTTProgram(table, ttContext) {
  22068. let data = table.data;
  22069. let i = 0,
  22070. j,
  22071. n,
  22072. b,
  22073. funcId,
  22074. pc,
  22075. lastEndf = 0,
  22076. lastDeff = 0;
  22077. const stack = [];
  22078. const callstack = [];
  22079. const functionsCalled = [];
  22080. let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  22081. let inFDEF = false,
  22082. ifLevel = 0,
  22083. inELSE = 0;
  22084. for (let ii = data.length; i < ii;) {
  22085. const op = data[i++];
  22086. if (op === 0x40) {
  22087. n = data[i++];
  22088. if (inFDEF || inELSE) {
  22089. i += n;
  22090. } else {
  22091. for (j = 0; j < n; j++) {
  22092. stack.push(data[i++]);
  22093. }
  22094. }
  22095. } else if (op === 0x41) {
  22096. n = data[i++];
  22097. if (inFDEF || inELSE) {
  22098. i += n * 2;
  22099. } else {
  22100. for (j = 0; j < n; j++) {
  22101. b = data[i++];
  22102. stack.push(b << 8 | data[i++]);
  22103. }
  22104. }
  22105. } else if ((op & 0xf8) === 0xb0) {
  22106. n = op - 0xb0 + 1;
  22107. if (inFDEF || inELSE) {
  22108. i += n;
  22109. } else {
  22110. for (j = 0; j < n; j++) {
  22111. stack.push(data[i++]);
  22112. }
  22113. }
  22114. } else if ((op & 0xf8) === 0xb8) {
  22115. n = op - 0xb8 + 1;
  22116. if (inFDEF || inELSE) {
  22117. i += n * 2;
  22118. } else {
  22119. for (j = 0; j < n; j++) {
  22120. b = data[i++];
  22121. stack.push(b << 8 | data[i++]);
  22122. }
  22123. }
  22124. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  22125. if (!inFDEF && !inELSE) {
  22126. funcId = stack.at(-1);
  22127. if (isNaN(funcId)) {
  22128. (0, _util.info)("TT: CALL empty stack (or invalid entry).");
  22129. } else {
  22130. ttContext.functionsUsed[funcId] = true;
  22131. if (funcId in ttContext.functionsStackDeltas) {
  22132. const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
  22133. if (newStackLength < 0) {
  22134. (0, _util.warn)("TT: CALL invalid functions stack delta.");
  22135. ttContext.hintsValid = false;
  22136. return;
  22137. }
  22138. stack.length = newStackLength;
  22139. } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
  22140. callstack.push({
  22141. data,
  22142. i,
  22143. stackTop: stack.length - 1
  22144. });
  22145. functionsCalled.push(funcId);
  22146. pc = ttContext.functionsDefined[funcId];
  22147. if (!pc) {
  22148. (0, _util.warn)("TT: CALL non-existent function");
  22149. ttContext.hintsValid = false;
  22150. return;
  22151. }
  22152. data = pc.data;
  22153. i = pc.i;
  22154. }
  22155. }
  22156. }
  22157. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  22158. if (inFDEF || inELSE) {
  22159. (0, _util.warn)("TT: nested FDEFs not allowed");
  22160. tooComplexToFollowFunctions = true;
  22161. }
  22162. inFDEF = true;
  22163. lastDeff = i;
  22164. funcId = stack.pop();
  22165. ttContext.functionsDefined[funcId] = {
  22166. data,
  22167. i
  22168. };
  22169. } else if (op === 0x2d) {
  22170. if (inFDEF) {
  22171. inFDEF = false;
  22172. lastEndf = i;
  22173. } else {
  22174. pc = callstack.pop();
  22175. if (!pc) {
  22176. (0, _util.warn)("TT: ENDF bad stack");
  22177. ttContext.hintsValid = false;
  22178. return;
  22179. }
  22180. funcId = functionsCalled.pop();
  22181. data = pc.data;
  22182. i = pc.i;
  22183. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  22184. }
  22185. } else if (op === 0x89) {
  22186. if (inFDEF || inELSE) {
  22187. (0, _util.warn)("TT: nested IDEFs not allowed");
  22188. tooComplexToFollowFunctions = true;
  22189. }
  22190. inFDEF = true;
  22191. lastDeff = i;
  22192. } else if (op === 0x58) {
  22193. ++ifLevel;
  22194. } else if (op === 0x1b) {
  22195. inELSE = ifLevel;
  22196. } else if (op === 0x59) {
  22197. if (inELSE === ifLevel) {
  22198. inELSE = 0;
  22199. }
  22200. --ifLevel;
  22201. } else if (op === 0x1c) {
  22202. if (!inFDEF && !inELSE) {
  22203. const offset = stack.at(-1);
  22204. if (offset > 0) {
  22205. i += offset - 1;
  22206. }
  22207. }
  22208. }
  22209. if (!inFDEF && !inELSE) {
  22210. let stackDelta = 0;
  22211. if (op <= 0x8e) {
  22212. stackDelta = TTOpsStackDeltas[op];
  22213. } else if (op >= 0xc0 && op <= 0xdf) {
  22214. stackDelta = -1;
  22215. } else if (op >= 0xe0) {
  22216. stackDelta = -2;
  22217. }
  22218. if (op >= 0x71 && op <= 0x75) {
  22219. n = stack.pop();
  22220. if (!isNaN(n)) {
  22221. stackDelta = -n * 2;
  22222. }
  22223. }
  22224. while (stackDelta < 0 && stack.length > 0) {
  22225. stack.pop();
  22226. stackDelta++;
  22227. }
  22228. while (stackDelta > 0) {
  22229. stack.push(NaN);
  22230. stackDelta--;
  22231. }
  22232. }
  22233. }
  22234. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  22235. const content = [data];
  22236. if (i > data.length) {
  22237. content.push(new Uint8Array(i - data.length));
  22238. }
  22239. if (lastDeff > lastEndf) {
  22240. (0, _util.warn)("TT: complementing a missing function tail");
  22241. content.push(new Uint8Array([0x22, 0x2d]));
  22242. }
  22243. foldTTTable(table, content);
  22244. }
  22245. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  22246. if (ttContext.tooComplexToFollowFunctions) {
  22247. return;
  22248. }
  22249. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  22250. (0, _util.warn)("TT: more functions defined than expected");
  22251. ttContext.hintsValid = false;
  22252. return;
  22253. }
  22254. for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  22255. if (j > maxFunctionDefs) {
  22256. (0, _util.warn)("TT: invalid function id: " + j);
  22257. ttContext.hintsValid = false;
  22258. return;
  22259. }
  22260. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  22261. (0, _util.warn)("TT: undefined function: " + j);
  22262. ttContext.hintsValid = false;
  22263. return;
  22264. }
  22265. }
  22266. }
  22267. function foldTTTable(table, content) {
  22268. if (content.length > 1) {
  22269. let newLength = 0;
  22270. let j, jj;
  22271. for (j = 0, jj = content.length; j < jj; j++) {
  22272. newLength += content[j].length;
  22273. }
  22274. newLength = newLength + 3 & ~3;
  22275. const result = new Uint8Array(newLength);
  22276. let pos = 0;
  22277. for (j = 0, jj = content.length; j < jj; j++) {
  22278. result.set(content[j], pos);
  22279. pos += content[j].length;
  22280. }
  22281. table.data = result;
  22282. table.length = newLength;
  22283. }
  22284. }
  22285. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  22286. const ttContext = {
  22287. functionsDefined: [],
  22288. functionsUsed: [],
  22289. functionsStackDeltas: [],
  22290. tooComplexToFollowFunctions: false,
  22291. hintsValid: true
  22292. };
  22293. if (fpgm) {
  22294. sanitizeTTProgram(fpgm, ttContext);
  22295. }
  22296. if (prep) {
  22297. sanitizeTTProgram(prep, ttContext);
  22298. }
  22299. if (fpgm) {
  22300. checkInvalidFunctions(ttContext, maxFunctionDefs);
  22301. }
  22302. if (cvt && cvt.length & 1) {
  22303. const cvtData = new Uint8Array(cvt.length + 1);
  22304. cvtData.set(cvt.data);
  22305. cvt.data = cvtData;
  22306. }
  22307. return ttContext.hintsValid;
  22308. }
  22309. font = new _stream.Stream(new Uint8Array(font.getBytes()));
  22310. let header, tables;
  22311. if (isTrueTypeCollectionFile(font)) {
  22312. const ttcData = readTrueTypeCollectionData(font, this.name);
  22313. header = ttcData.header;
  22314. tables = ttcData.tables;
  22315. } else {
  22316. header = readOpenTypeHeader(font);
  22317. tables = readTables(font, header.numTables);
  22318. }
  22319. let cff, cffFile;
  22320. const isTrueType = !tables["CFF "];
  22321. if (!isTrueType) {
  22322. const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
  22323. if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
  22324. cffFile = new _stream.Stream(tables["CFF "].data);
  22325. cff = new _cff_font.CFFFont(cffFile, properties);
  22326. adjustWidths(properties);
  22327. return this.convert(name, cff, properties);
  22328. }
  22329. delete tables.glyf;
  22330. delete tables.loca;
  22331. delete tables.fpgm;
  22332. delete tables.prep;
  22333. delete tables["cvt "];
  22334. this.isOpenType = true;
  22335. } else {
  22336. if (!tables.loca) {
  22337. throw new _util.FormatError('Required "loca" table is not found');
  22338. }
  22339. if (!tables.glyf) {
  22340. (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
  22341. tables.glyf = {
  22342. tag: "glyf",
  22343. data: new Uint8Array(0)
  22344. };
  22345. }
  22346. this.isOpenType = false;
  22347. }
  22348. if (!tables.maxp) {
  22349. throw new _util.FormatError('Required "maxp" table is not found');
  22350. }
  22351. font.pos = (font.start || 0) + tables.maxp.offset;
  22352. const version = font.getInt32();
  22353. const numGlyphs = font.getUint16();
  22354. if (properties.scaleFactors && properties.scaleFactors.length === numGlyphs && isTrueType) {
  22355. const {
  22356. scaleFactors
  22357. } = properties;
  22358. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  22359. const glyphs = new _glyf.GlyfTable({
  22360. glyfTable: tables.glyf.data,
  22361. isGlyphLocationsLong,
  22362. locaTable: tables.loca.data,
  22363. numGlyphs
  22364. });
  22365. glyphs.scale(scaleFactors);
  22366. const {
  22367. glyf,
  22368. loca,
  22369. isLocationLong
  22370. } = glyphs.write();
  22371. tables.glyf.data = glyf;
  22372. tables.loca.data = loca;
  22373. if (isLocationLong !== !!isGlyphLocationsLong) {
  22374. tables.head.data[50] = 0;
  22375. tables.head.data[51] = isLocationLong ? 1 : 0;
  22376. }
  22377. const metrics = tables.hmtx.data;
  22378. for (let i = 0; i < numGlyphs; i++) {
  22379. const j = 4 * i;
  22380. const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1]));
  22381. metrics[j] = advanceWidth >> 8 & 0xff;
  22382. metrics[j + 1] = advanceWidth & 0xff;
  22383. const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3]));
  22384. writeSignedInt16(metrics, j + 2, lsb);
  22385. }
  22386. }
  22387. let numGlyphsOut = numGlyphs + 1;
  22388. let dupFirstEntry = true;
  22389. if (numGlyphsOut > 0xffff) {
  22390. dupFirstEntry = false;
  22391. numGlyphsOut = numGlyphs;
  22392. (0, _util.warn)("Not enough space in glyfs to duplicate first glyph.");
  22393. }
  22394. let maxFunctionDefs = 0;
  22395. let maxSizeOfInstructions = 0;
  22396. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  22397. font.pos += 8;
  22398. const maxZones = font.getUint16();
  22399. if (maxZones > 2) {
  22400. tables.maxp.data[14] = 0;
  22401. tables.maxp.data[15] = 2;
  22402. }
  22403. font.pos += 4;
  22404. maxFunctionDefs = font.getUint16();
  22405. font.pos += 4;
  22406. maxSizeOfInstructions = font.getUint16();
  22407. }
  22408. tables.maxp.data[4] = numGlyphsOut >> 8;
  22409. tables.maxp.data[5] = numGlyphsOut & 255;
  22410. const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
  22411. if (!hintsValid) {
  22412. delete tables.fpgm;
  22413. delete tables.prep;
  22414. delete tables["cvt "];
  22415. }
  22416. sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry);
  22417. if (!tables.head) {
  22418. throw new _util.FormatError('Required "head" table is not found');
  22419. }
  22420. sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
  22421. let missingGlyphs = Object.create(null);
  22422. if (isTrueType) {
  22423. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  22424. const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
  22425. missingGlyphs = glyphsInfo.missingGlyphs;
  22426. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  22427. tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  22428. tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  22429. }
  22430. }
  22431. if (!tables.hhea) {
  22432. throw new _util.FormatError('Required "hhea" table is not found');
  22433. }
  22434. if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
  22435. tables.hhea.data[10] = 0xff;
  22436. tables.hhea.data[11] = 0xff;
  22437. }
  22438. const metricsOverride = {
  22439. unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
  22440. yMax: int16(tables.head.data[42], tables.head.data[43]),
  22441. yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
  22442. ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]),
  22443. descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]),
  22444. lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9])
  22445. };
  22446. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  22447. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  22448. this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm;
  22449. if (this.cssFontInfo && this.cssFontInfo.lineHeight) {
  22450. this.lineHeight = this.cssFontInfo.metrics.lineHeight;
  22451. this.lineGap = this.cssFontInfo.metrics.lineGap;
  22452. } else {
  22453. this.lineHeight = this.ascent - this.descent + this.lineGap;
  22454. }
  22455. if (tables.post) {
  22456. readPostScriptTable(tables.post, properties, numGlyphs);
  22457. }
  22458. tables.post = {
  22459. tag: "post",
  22460. data: createPostTable(properties)
  22461. };
  22462. const charCodeToGlyphId = [];
  22463. function hasGlyph(glyphId) {
  22464. return !missingGlyphs[glyphId];
  22465. }
  22466. if (properties.composite) {
  22467. const cidToGidMap = properties.cidToGidMap || [];
  22468. const isCidToGidMapEmpty = cidToGidMap.length === 0;
  22469. properties.cMap.forEach(function (charCode, cid) {
  22470. if (typeof cid === "string") {
  22471. cid = convertCidString(charCode, cid, true);
  22472. }
  22473. if (cid > 0xffff) {
  22474. throw new _util.FormatError("Max size of CID is 65,535");
  22475. }
  22476. let glyphId = -1;
  22477. if (isCidToGidMapEmpty) {
  22478. glyphId = cid;
  22479. } else if (cidToGidMap[cid] !== undefined) {
  22480. glyphId = cidToGidMap[cid];
  22481. }
  22482. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  22483. charCodeToGlyphId[charCode] = glyphId;
  22484. }
  22485. });
  22486. } else {
  22487. const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
  22488. const cmapPlatformId = cmapTable.platformId;
  22489. const cmapEncodingId = cmapTable.encodingId;
  22490. const cmapMappings = cmapTable.mappings;
  22491. let baseEncoding = [],
  22492. forcePostTable = false;
  22493. if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) {
  22494. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  22495. }
  22496. if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) {
  22497. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  22498. for (let charCode = 0; charCode < 256; charCode++) {
  22499. let glyphName;
  22500. if (this.differences[charCode] !== undefined) {
  22501. glyphName = this.differences[charCode];
  22502. } else if (baseEncoding.length && baseEncoding[charCode] !== "") {
  22503. glyphName = baseEncoding[charCode];
  22504. } else {
  22505. glyphName = _encodings.StandardEncoding[charCode];
  22506. }
  22507. if (!glyphName) {
  22508. continue;
  22509. }
  22510. const standardGlyphName = (0, _fonts_utils.recoverGlyphName)(glyphName, glyphsUnicodeMap);
  22511. let unicodeOrCharCode;
  22512. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  22513. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  22514. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  22515. unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
  22516. }
  22517. if (unicodeOrCharCode === undefined) {
  22518. if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  22519. const unicode = this.toUnicode.get(charCode);
  22520. if (unicode) {
  22521. unicodeOrCharCode = unicode.codePointAt(0);
  22522. }
  22523. }
  22524. if (unicodeOrCharCode === undefined) {
  22525. continue;
  22526. }
  22527. }
  22528. for (const mapping of cmapMappings) {
  22529. if (mapping.charCode !== unicodeOrCharCode) {
  22530. continue;
  22531. }
  22532. charCodeToGlyphId[charCode] = mapping.glyphId;
  22533. break;
  22534. }
  22535. }
  22536. } else if (cmapPlatformId === 0) {
  22537. for (const mapping of cmapMappings) {
  22538. charCodeToGlyphId[mapping.charCode] = mapping.glyphId;
  22539. }
  22540. forcePostTable = true;
  22541. } else {
  22542. for (const mapping of cmapMappings) {
  22543. let charCode = mapping.charCode;
  22544. if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) {
  22545. charCode &= 0xff;
  22546. }
  22547. charCodeToGlyphId[charCode] = mapping.glyphId;
  22548. }
  22549. }
  22550. if (properties.glyphNames && (baseEncoding.length || this.differences.length)) {
  22551. for (let i = 0; i < 256; ++i) {
  22552. if (!forcePostTable && charCodeToGlyphId[i] !== undefined) {
  22553. continue;
  22554. }
  22555. const glyphName = this.differences[i] || baseEncoding[i];
  22556. if (!glyphName) {
  22557. continue;
  22558. }
  22559. const glyphId = properties.glyphNames.indexOf(glyphName);
  22560. if (glyphId > 0 && hasGlyph(glyphId)) {
  22561. charCodeToGlyphId[i] = glyphId;
  22562. }
  22563. }
  22564. }
  22565. }
  22566. if (charCodeToGlyphId.length === 0) {
  22567. charCodeToGlyphId[0] = 0;
  22568. }
  22569. let glyphZeroId = numGlyphsOut - 1;
  22570. if (!dupFirstEntry) {
  22571. glyphZeroId = 0;
  22572. }
  22573. if (!properties.cssFontInfo) {
  22574. const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId, this.toUnicode);
  22575. this.toFontChar = newMapping.toFontChar;
  22576. tables.cmap = {
  22577. tag: "cmap",
  22578. data: createCmapTable(newMapping.charCodeToGlyphId, newMapping.toUnicodeExtraMap, numGlyphsOut)
  22579. };
  22580. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
  22581. tables["OS/2"] = {
  22582. tag: "OS/2",
  22583. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  22584. };
  22585. }
  22586. }
  22587. if (!isTrueType) {
  22588. try {
  22589. cffFile = new _stream.Stream(tables["CFF "].data);
  22590. const parser = new _cff_parser.CFFParser(cffFile, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  22591. cff = parser.parse();
  22592. cff.duplicateFirstGlyph();
  22593. const compiler = new _cff_parser.CFFCompiler(cff);
  22594. tables["CFF "].data = compiler.compile();
  22595. } catch (e) {
  22596. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  22597. }
  22598. }
  22599. if (!tables.name) {
  22600. tables.name = {
  22601. tag: "name",
  22602. data: createNameTable(this.name)
  22603. };
  22604. } else {
  22605. const namePrototype = readNameTable(tables.name);
  22606. tables.name.data = createNameTable(name, namePrototype);
  22607. this.psName = namePrototype[0][6] || null;
  22608. }
  22609. const builder = new _opentype_file_builder.OpenTypeFileBuilder(header.version);
  22610. for (const tableTag in tables) {
  22611. builder.addTable(tableTag, tables[tableTag].data);
  22612. }
  22613. return builder.toArray();
  22614. }
  22615. convert(fontName, font, properties) {
  22616. properties.fixedPitch = false;
  22617. if (properties.builtInEncoding) {
  22618. adjustToUnicode(properties, properties.builtInEncoding);
  22619. }
  22620. let glyphZeroId = 1;
  22621. if (font instanceof _cff_font.CFFFont) {
  22622. glyphZeroId = font.numGlyphs - 1;
  22623. }
  22624. const mapping = font.getGlyphMapping(properties);
  22625. let newMapping = null;
  22626. let newCharCodeToGlyphId = mapping;
  22627. let toUnicodeExtraMap = null;
  22628. if (!properties.cssFontInfo) {
  22629. newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId, this.toUnicode);
  22630. this.toFontChar = newMapping.toFontChar;
  22631. newCharCodeToGlyphId = newMapping.charCodeToGlyphId;
  22632. toUnicodeExtraMap = newMapping.toUnicodeExtraMap;
  22633. }
  22634. const numGlyphs = font.numGlyphs;
  22635. function getCharCodes(charCodeToGlyphId, glyphId) {
  22636. let charCodes = null;
  22637. for (const charCode in charCodeToGlyphId) {
  22638. if (glyphId === charCodeToGlyphId[charCode]) {
  22639. if (!charCodes) {
  22640. charCodes = [];
  22641. }
  22642. charCodes.push(charCode | 0);
  22643. }
  22644. }
  22645. return charCodes;
  22646. }
  22647. function createCharCode(charCodeToGlyphId, glyphId) {
  22648. for (const charCode in charCodeToGlyphId) {
  22649. if (glyphId === charCodeToGlyphId[charCode]) {
  22650. return charCode | 0;
  22651. }
  22652. }
  22653. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  22654. return newMapping.nextAvailableFontCharCode++;
  22655. }
  22656. const seacs = font.seacs;
  22657. if (newMapping && _fonts_utils.SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  22658. const matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  22659. const charset = font.getCharset();
  22660. const seacMap = Object.create(null);
  22661. for (let glyphId in seacs) {
  22662. glyphId |= 0;
  22663. const seac = seacs[glyphId];
  22664. const baseGlyphName = _encodings.StandardEncoding[seac[2]];
  22665. const accentGlyphName = _encodings.StandardEncoding[seac[3]];
  22666. const baseGlyphId = charset.indexOf(baseGlyphName);
  22667. const accentGlyphId = charset.indexOf(accentGlyphName);
  22668. if (baseGlyphId < 0 || accentGlyphId < 0) {
  22669. continue;
  22670. }
  22671. const accentOffset = {
  22672. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  22673. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  22674. };
  22675. const charCodes = getCharCodes(mapping, glyphId);
  22676. if (!charCodes) {
  22677. continue;
  22678. }
  22679. for (const charCode of charCodes) {
  22680. const charCodeToGlyphId = newMapping.charCodeToGlyphId;
  22681. const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  22682. const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  22683. seacMap[charCode] = {
  22684. baseFontCharCode,
  22685. accentFontCharCode,
  22686. accentOffset
  22687. };
  22688. }
  22689. }
  22690. properties.seacMap = seacMap;
  22691. }
  22692. const unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  22693. const builder = new _opentype_file_builder.OpenTypeFileBuilder("\x4F\x54\x54\x4F");
  22694. builder.addTable("CFF ", font.data);
  22695. builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId));
  22696. builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, toUnicodeExtraMap, numGlyphs));
  22697. builder.addTable("head", "\x00\x01\x00\x00" + "\x00\x00\x10\x00" + "\x00\x00\x00\x00" + "\x5F\x0F\x3C\xF5" + "\x00\x00" + safeString16(unitsPerEm) + "\x00\x00\x00\x00\x9e\x0b\x7e\x27" + "\x00\x00\x00\x00\x9e\x0b\x7e\x27" + "\x00\x00" + safeString16(properties.descent) + "\x0F\xFF" + safeString16(properties.ascent) + string16(properties.italicAngle ? 2 : 0) + "\x00\x11" + "\x00\x00" + "\x00\x00" + "\x00\x00");
  22698. builder.addTable("hhea", "\x00\x01\x00\x00" + safeString16(properties.ascent) + safeString16(properties.descent) + "\x00\x00" + "\xFF\xFF" + "\x00\x00" + "\x00\x00" + "\x00\x00" + safeString16(properties.capHeight) + safeString16(Math.tan(properties.italicAngle) * properties.xHeight) + "\x00\x00" + "\x00\x00" + "\x00\x00" + "\x00\x00" + "\x00\x00" + "\x00\x00" + string16(numGlyphs));
  22699. builder.addTable("hmtx", function fontFieldsHmtx() {
  22700. const charstrings = font.charstrings;
  22701. const cffWidths = font.cff ? font.cff.widths : null;
  22702. let hmtx = "\x00\x00\x00\x00";
  22703. for (let i = 1, ii = numGlyphs; i < ii; i++) {
  22704. let width = 0;
  22705. if (charstrings) {
  22706. const charstring = charstrings[i - 1];
  22707. width = "width" in charstring ? charstring.width : 0;
  22708. } else if (cffWidths) {
  22709. width = Math.ceil(cffWidths[i] || 0);
  22710. }
  22711. hmtx += string16(width) + string16(0);
  22712. }
  22713. return hmtx;
  22714. }());
  22715. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  22716. builder.addTable("name", createNameTable(fontName));
  22717. builder.addTable("post", createPostTable(properties));
  22718. return builder.toArray();
  22719. }
  22720. get spaceWidth() {
  22721. const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
  22722. let width;
  22723. for (const glyphName of possibleSpaceReplacements) {
  22724. if (glyphName in this.widths) {
  22725. width = this.widths[glyphName];
  22726. break;
  22727. }
  22728. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  22729. const glyphUnicode = glyphsUnicodeMap[glyphName];
  22730. let charcode = 0;
  22731. if (this.composite && this.cMap.contains(glyphUnicode)) {
  22732. charcode = this.cMap.lookup(glyphUnicode);
  22733. if (typeof charcode === "string") {
  22734. charcode = convertCidString(glyphUnicode, charcode);
  22735. }
  22736. }
  22737. if (!charcode && this.toUnicode) {
  22738. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  22739. }
  22740. if (charcode <= 0) {
  22741. charcode = glyphUnicode;
  22742. }
  22743. width = this.widths[charcode];
  22744. if (width) {
  22745. break;
  22746. }
  22747. }
  22748. width = width || this.defaultWidth;
  22749. return (0, _util.shadow)(this, "spaceWidth", width);
  22750. }
  22751. _charToGlyph(charcode, isSpace = false) {
  22752. let glyph = this._glyphCache[charcode];
  22753. if (glyph && glyph.isSpace === isSpace) {
  22754. return glyph;
  22755. }
  22756. let fontCharCode, width, operatorListId;
  22757. let widthCode = charcode;
  22758. if (this.cMap && this.cMap.contains(charcode)) {
  22759. widthCode = this.cMap.lookup(charcode);
  22760. if (typeof widthCode === "string") {
  22761. widthCode = convertCidString(charcode, widthCode);
  22762. }
  22763. }
  22764. width = this.widths[widthCode];
  22765. if (typeof width !== "number") {
  22766. width = this.defaultWidth;
  22767. }
  22768. const vmetric = this.vmetrics && this.vmetrics[widthCode];
  22769. let unicode = this.toUnicode.get(charcode) || charcode;
  22770. if (typeof unicode === "number") {
  22771. unicode = String.fromCharCode(unicode);
  22772. }
  22773. let isInFont = this.toFontChar[charcode] !== undefined;
  22774. fontCharCode = this.toFontChar[charcode] || charcode;
  22775. if (this.missingFile) {
  22776. const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
  22777. if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
  22778. fontCharCode = 0x20;
  22779. }
  22780. fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
  22781. }
  22782. if (this.isType3Font) {
  22783. operatorListId = fontCharCode;
  22784. }
  22785. let accent = null;
  22786. if (this.seacMap && this.seacMap[charcode]) {
  22787. isInFont = true;
  22788. const seac = this.seacMap[charcode];
  22789. fontCharCode = seac.baseFontCharCode;
  22790. accent = {
  22791. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  22792. offset: seac.accentOffset
  22793. };
  22794. }
  22795. let fontChar = "";
  22796. if (typeof fontCharCode === "number") {
  22797. if (fontCharCode <= 0x10ffff) {
  22798. fontChar = String.fromCodePoint(fontCharCode);
  22799. } else {
  22800. (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
  22801. }
  22802. }
  22803. glyph = new Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  22804. return this._glyphCache[charcode] = glyph;
  22805. }
  22806. charsToGlyphs(chars) {
  22807. let glyphs = this._charsCache[chars];
  22808. if (glyphs) {
  22809. return glyphs;
  22810. }
  22811. glyphs = [];
  22812. if (this.cMap) {
  22813. const c = Object.create(null),
  22814. ii = chars.length;
  22815. let i = 0;
  22816. while (i < ii) {
  22817. this.cMap.readCharCode(chars, i, c);
  22818. const {
  22819. charcode,
  22820. length
  22821. } = c;
  22822. i += length;
  22823. const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20);
  22824. glyphs.push(glyph);
  22825. }
  22826. } else {
  22827. for (let i = 0, ii = chars.length; i < ii; ++i) {
  22828. const charcode = chars.charCodeAt(i);
  22829. const glyph = this._charToGlyph(charcode, charcode === 0x20);
  22830. glyphs.push(glyph);
  22831. }
  22832. }
  22833. return this._charsCache[chars] = glyphs;
  22834. }
  22835. getCharPositions(chars) {
  22836. const positions = [];
  22837. if (this.cMap) {
  22838. const c = Object.create(null);
  22839. let i = 0;
  22840. while (i < chars.length) {
  22841. this.cMap.readCharCode(chars, i, c);
  22842. const length = c.length;
  22843. positions.push([i, i + length]);
  22844. i += length;
  22845. }
  22846. } else {
  22847. for (let i = 0, ii = chars.length; i < ii; ++i) {
  22848. positions.push([i, i + 1]);
  22849. }
  22850. }
  22851. return positions;
  22852. }
  22853. get glyphCacheValues() {
  22854. return Object.values(this._glyphCache);
  22855. }
  22856. encodeString(str) {
  22857. const buffers = [];
  22858. const currentBuf = [];
  22859. const hasCurrentBufErrors = () => buffers.length % 2 === 1;
  22860. const getCharCode = this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode));
  22861. for (let i = 0, ii = str.length; i < ii; i++) {
  22862. const unicode = str.codePointAt(i);
  22863. if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
  22864. i++;
  22865. }
  22866. if (this.toUnicode) {
  22867. const charCode = getCharCode(unicode);
  22868. if (charCode !== -1) {
  22869. if (hasCurrentBufErrors()) {
  22870. buffers.push(currentBuf.join(""));
  22871. currentBuf.length = 0;
  22872. }
  22873. const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
  22874. for (let j = charCodeLength - 1; j >= 0; j--) {
  22875. currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
  22876. }
  22877. continue;
  22878. }
  22879. }
  22880. if (!hasCurrentBufErrors()) {
  22881. buffers.push(currentBuf.join(""));
  22882. currentBuf.length = 0;
  22883. }
  22884. currentBuf.push(String.fromCodePoint(unicode));
  22885. }
  22886. buffers.push(currentBuf.join(""));
  22887. return buffers;
  22888. }
  22889. }
  22890. exports.Font = Font;
  22891. class ErrorFont {
  22892. constructor(error) {
  22893. this.error = error;
  22894. this.loadedName = "g_font_error";
  22895. this.missingFile = true;
  22896. }
  22897. charsToGlyphs() {
  22898. return [];
  22899. }
  22900. encodeString(chars) {
  22901. return [chars];
  22902. }
  22903. exportData(extraProperties = false) {
  22904. return {
  22905. error: this.error
  22906. };
  22907. }
  22908. }
  22909. exports.ErrorFont = ErrorFont;
  22910. /***/ }),
  22911. /* 33 */
  22912. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  22913. Object.defineProperty(exports, "__esModule", ({
  22914. value: true
  22915. }));
  22916. exports.CFFTopDict = exports.CFFStrings = exports.CFFStandardStrings = exports.CFFPrivateDict = exports.CFFParser = exports.CFFIndex = exports.CFFHeader = exports.CFFFDSelect = exports.CFFCompiler = exports.CFFCharset = exports.CFF = void 0;
  22917. var _util = __w_pdfjs_require__(2);
  22918. var _charsets = __w_pdfjs_require__(34);
  22919. var _encodings = __w_pdfjs_require__(35);
  22920. const MAX_SUBR_NESTING = 10;
  22921. const CFFStandardStrings = [".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodcentered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall", "001.000", "001.001", "001.002", "001.003", "Black", "Bold", "Book", "Light", "Medium", "Regular", "Roman", "Semibold"];
  22922. exports.CFFStandardStrings = CFFStandardStrings;
  22923. const NUM_STANDARD_CFF_STRINGS = 391;
  22924. const CharstringValidationData = [null, {
  22925. id: "hstem",
  22926. min: 2,
  22927. stackClearing: true,
  22928. stem: true
  22929. }, null, {
  22930. id: "vstem",
  22931. min: 2,
  22932. stackClearing: true,
  22933. stem: true
  22934. }, {
  22935. id: "vmoveto",
  22936. min: 1,
  22937. stackClearing: true
  22938. }, {
  22939. id: "rlineto",
  22940. min: 2,
  22941. resetStack: true
  22942. }, {
  22943. id: "hlineto",
  22944. min: 1,
  22945. resetStack: true
  22946. }, {
  22947. id: "vlineto",
  22948. min: 1,
  22949. resetStack: true
  22950. }, {
  22951. id: "rrcurveto",
  22952. min: 6,
  22953. resetStack: true
  22954. }, null, {
  22955. id: "callsubr",
  22956. min: 1,
  22957. undefStack: true
  22958. }, {
  22959. id: "return",
  22960. min: 0,
  22961. undefStack: true
  22962. }, null, null, {
  22963. id: "endchar",
  22964. min: 0,
  22965. stackClearing: true
  22966. }, null, null, null, {
  22967. id: "hstemhm",
  22968. min: 2,
  22969. stackClearing: true,
  22970. stem: true
  22971. }, {
  22972. id: "hintmask",
  22973. min: 0,
  22974. stackClearing: true
  22975. }, {
  22976. id: "cntrmask",
  22977. min: 0,
  22978. stackClearing: true
  22979. }, {
  22980. id: "rmoveto",
  22981. min: 2,
  22982. stackClearing: true
  22983. }, {
  22984. id: "hmoveto",
  22985. min: 1,
  22986. stackClearing: true
  22987. }, {
  22988. id: "vstemhm",
  22989. min: 2,
  22990. stackClearing: true,
  22991. stem: true
  22992. }, {
  22993. id: "rcurveline",
  22994. min: 8,
  22995. resetStack: true
  22996. }, {
  22997. id: "rlinecurve",
  22998. min: 8,
  22999. resetStack: true
  23000. }, {
  23001. id: "vvcurveto",
  23002. min: 4,
  23003. resetStack: true
  23004. }, {
  23005. id: "hhcurveto",
  23006. min: 4,
  23007. resetStack: true
  23008. }, null, {
  23009. id: "callgsubr",
  23010. min: 1,
  23011. undefStack: true
  23012. }, {
  23013. id: "vhcurveto",
  23014. min: 4,
  23015. resetStack: true
  23016. }, {
  23017. id: "hvcurveto",
  23018. min: 4,
  23019. resetStack: true
  23020. }];
  23021. const CharstringValidationData12 = [null, null, null, {
  23022. id: "and",
  23023. min: 2,
  23024. stackDelta: -1
  23025. }, {
  23026. id: "or",
  23027. min: 2,
  23028. stackDelta: -1
  23029. }, {
  23030. id: "not",
  23031. min: 1,
  23032. stackDelta: 0
  23033. }, null, null, null, {
  23034. id: "abs",
  23035. min: 1,
  23036. stackDelta: 0
  23037. }, {
  23038. id: "add",
  23039. min: 2,
  23040. stackDelta: -1,
  23041. stackFn(stack, index) {
  23042. stack[index - 2] = stack[index - 2] + stack[index - 1];
  23043. }
  23044. }, {
  23045. id: "sub",
  23046. min: 2,
  23047. stackDelta: -1,
  23048. stackFn(stack, index) {
  23049. stack[index - 2] = stack[index - 2] - stack[index - 1];
  23050. }
  23051. }, {
  23052. id: "div",
  23053. min: 2,
  23054. stackDelta: -1,
  23055. stackFn(stack, index) {
  23056. stack[index - 2] = stack[index - 2] / stack[index - 1];
  23057. }
  23058. }, null, {
  23059. id: "neg",
  23060. min: 1,
  23061. stackDelta: 0,
  23062. stackFn(stack, index) {
  23063. stack[index - 1] = -stack[index - 1];
  23064. }
  23065. }, {
  23066. id: "eq",
  23067. min: 2,
  23068. stackDelta: -1
  23069. }, null, null, {
  23070. id: "drop",
  23071. min: 1,
  23072. stackDelta: -1
  23073. }, null, {
  23074. id: "put",
  23075. min: 2,
  23076. stackDelta: -2
  23077. }, {
  23078. id: "get",
  23079. min: 1,
  23080. stackDelta: 0
  23081. }, {
  23082. id: "ifelse",
  23083. min: 4,
  23084. stackDelta: -3
  23085. }, {
  23086. id: "random",
  23087. min: 0,
  23088. stackDelta: 1
  23089. }, {
  23090. id: "mul",
  23091. min: 2,
  23092. stackDelta: -1,
  23093. stackFn(stack, index) {
  23094. stack[index - 2] = stack[index - 2] * stack[index - 1];
  23095. }
  23096. }, null, {
  23097. id: "sqrt",
  23098. min: 1,
  23099. stackDelta: 0
  23100. }, {
  23101. id: "dup",
  23102. min: 1,
  23103. stackDelta: 1
  23104. }, {
  23105. id: "exch",
  23106. min: 2,
  23107. stackDelta: 0
  23108. }, {
  23109. id: "index",
  23110. min: 2,
  23111. stackDelta: 0
  23112. }, {
  23113. id: "roll",
  23114. min: 3,
  23115. stackDelta: -2
  23116. }, null, null, null, {
  23117. id: "hflex",
  23118. min: 7,
  23119. resetStack: true
  23120. }, {
  23121. id: "flex",
  23122. min: 13,
  23123. resetStack: true
  23124. }, {
  23125. id: "hflex1",
  23126. min: 9,
  23127. resetStack: true
  23128. }, {
  23129. id: "flex1",
  23130. min: 11,
  23131. resetStack: true
  23132. }];
  23133. class CFFParser {
  23134. constructor(file, properties, seacAnalysisEnabled) {
  23135. this.bytes = file.getBytes();
  23136. this.properties = properties;
  23137. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  23138. }
  23139. parse() {
  23140. const properties = this.properties;
  23141. const cff = new CFF();
  23142. this.cff = cff;
  23143. const header = this.parseHeader();
  23144. const nameIndex = this.parseIndex(header.endPos);
  23145. const topDictIndex = this.parseIndex(nameIndex.endPos);
  23146. const stringIndex = this.parseIndex(topDictIndex.endPos);
  23147. const globalSubrIndex = this.parseIndex(stringIndex.endPos);
  23148. const topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  23149. const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  23150. cff.header = header.obj;
  23151. cff.names = this.parseNameIndex(nameIndex.obj);
  23152. cff.strings = this.parseStringIndex(stringIndex.obj);
  23153. cff.topDict = topDict;
  23154. cff.globalSubrIndex = globalSubrIndex.obj;
  23155. this.parsePrivateDict(cff.topDict);
  23156. cff.isCIDFont = topDict.hasName("ROS");
  23157. const charStringOffset = topDict.getByName("CharStrings");
  23158. const charStringIndex = this.parseIndex(charStringOffset).obj;
  23159. const fontMatrix = topDict.getByName("FontMatrix");
  23160. if (fontMatrix) {
  23161. properties.fontMatrix = fontMatrix;
  23162. }
  23163. const fontBBox = topDict.getByName("FontBBox");
  23164. if (fontBBox) {
  23165. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  23166. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  23167. properties.ascentScaled = true;
  23168. }
  23169. let charset, encoding;
  23170. if (cff.isCIDFont) {
  23171. const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
  23172. for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  23173. const dictRaw = fdArrayIndex.get(i);
  23174. const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  23175. this.parsePrivateDict(fontDict);
  23176. cff.fdArray.push(fontDict);
  23177. }
  23178. encoding = null;
  23179. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
  23180. cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
  23181. } else {
  23182. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
  23183. encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
  23184. }
  23185. cff.charset = charset;
  23186. cff.encoding = encoding;
  23187. const charStringsAndSeacs = this.parseCharStrings({
  23188. charStrings: charStringIndex,
  23189. localSubrIndex: topDict.privateDict.subrsIndex,
  23190. globalSubrIndex: globalSubrIndex.obj,
  23191. fdSelect: cff.fdSelect,
  23192. fdArray: cff.fdArray,
  23193. privateDict: topDict.privateDict
  23194. });
  23195. cff.charStrings = charStringsAndSeacs.charStrings;
  23196. cff.seacs = charStringsAndSeacs.seacs;
  23197. cff.widths = charStringsAndSeacs.widths;
  23198. return cff;
  23199. }
  23200. parseHeader() {
  23201. let bytes = this.bytes;
  23202. const bytesLength = bytes.length;
  23203. let offset = 0;
  23204. while (offset < bytesLength && bytes[offset] !== 1) {
  23205. ++offset;
  23206. }
  23207. if (offset >= bytesLength) {
  23208. throw new _util.FormatError("Invalid CFF header");
  23209. }
  23210. if (offset !== 0) {
  23211. (0, _util.info)("cff data is shifted");
  23212. bytes = bytes.subarray(offset);
  23213. this.bytes = bytes;
  23214. }
  23215. const major = bytes[0];
  23216. const minor = bytes[1];
  23217. const hdrSize = bytes[2];
  23218. const offSize = bytes[3];
  23219. const header = new CFFHeader(major, minor, hdrSize, offSize);
  23220. return {
  23221. obj: header,
  23222. endPos: hdrSize
  23223. };
  23224. }
  23225. parseDict(dict) {
  23226. let pos = 0;
  23227. function parseOperand() {
  23228. let value = dict[pos++];
  23229. if (value === 30) {
  23230. return parseFloatOperand();
  23231. } else if (value === 28) {
  23232. value = dict[pos++];
  23233. value = (value << 24 | dict[pos++] << 16) >> 16;
  23234. return value;
  23235. } else if (value === 29) {
  23236. value = dict[pos++];
  23237. value = value << 8 | dict[pos++];
  23238. value = value << 8 | dict[pos++];
  23239. value = value << 8 | dict[pos++];
  23240. return value;
  23241. } else if (value >= 32 && value <= 246) {
  23242. return value - 139;
  23243. } else if (value >= 247 && value <= 250) {
  23244. return (value - 247) * 256 + dict[pos++] + 108;
  23245. } else if (value >= 251 && value <= 254) {
  23246. return -((value - 251) * 256) - dict[pos++] - 108;
  23247. }
  23248. (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
  23249. return NaN;
  23250. }
  23251. function parseFloatOperand() {
  23252. let str = "";
  23253. const eof = 15;
  23254. const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
  23255. const length = dict.length;
  23256. while (pos < length) {
  23257. const b = dict[pos++];
  23258. const b1 = b >> 4;
  23259. const b2 = b & 15;
  23260. if (b1 === eof) {
  23261. break;
  23262. }
  23263. str += lookup[b1];
  23264. if (b2 === eof) {
  23265. break;
  23266. }
  23267. str += lookup[b2];
  23268. }
  23269. return parseFloat(str);
  23270. }
  23271. let operands = [];
  23272. const entries = [];
  23273. pos = 0;
  23274. const end = dict.length;
  23275. while (pos < end) {
  23276. let b = dict[pos];
  23277. if (b <= 21) {
  23278. if (b === 12) {
  23279. b = b << 8 | dict[++pos];
  23280. }
  23281. entries.push([b, operands]);
  23282. operands = [];
  23283. ++pos;
  23284. } else {
  23285. operands.push(parseOperand());
  23286. }
  23287. }
  23288. return entries;
  23289. }
  23290. parseIndex(pos) {
  23291. const cffIndex = new CFFIndex();
  23292. const bytes = this.bytes;
  23293. const count = bytes[pos++] << 8 | bytes[pos++];
  23294. const offsets = [];
  23295. let end = pos;
  23296. let i, ii;
  23297. if (count !== 0) {
  23298. const offsetSize = bytes[pos++];
  23299. const startPos = pos + (count + 1) * offsetSize - 1;
  23300. for (i = 0, ii = count + 1; i < ii; ++i) {
  23301. let offset = 0;
  23302. for (let j = 0; j < offsetSize; ++j) {
  23303. offset <<= 8;
  23304. offset += bytes[pos++];
  23305. }
  23306. offsets.push(startPos + offset);
  23307. }
  23308. end = offsets[count];
  23309. }
  23310. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  23311. const offsetStart = offsets[i];
  23312. const offsetEnd = offsets[i + 1];
  23313. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  23314. }
  23315. return {
  23316. obj: cffIndex,
  23317. endPos: end
  23318. };
  23319. }
  23320. parseNameIndex(index) {
  23321. const names = [];
  23322. for (let i = 0, ii = index.count; i < ii; ++i) {
  23323. const name = index.get(i);
  23324. names.push((0, _util.bytesToString)(name));
  23325. }
  23326. return names;
  23327. }
  23328. parseStringIndex(index) {
  23329. const strings = new CFFStrings();
  23330. for (let i = 0, ii = index.count; i < ii; ++i) {
  23331. const data = index.get(i);
  23332. strings.add((0, _util.bytesToString)(data));
  23333. }
  23334. return strings;
  23335. }
  23336. createDict(Type, dict, strings) {
  23337. const cffDict = new Type(strings);
  23338. for (const [key, value] of dict) {
  23339. cffDict.setByKey(key, value);
  23340. }
  23341. return cffDict;
  23342. }
  23343. parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  23344. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  23345. return false;
  23346. }
  23347. let stackSize = state.stackSize;
  23348. const stack = state.stack;
  23349. let length = data.length;
  23350. for (let j = 0; j < length;) {
  23351. const value = data[j++];
  23352. let validationCommand = null;
  23353. if (value === 12) {
  23354. const q = data[j++];
  23355. if (q === 0) {
  23356. data[j - 2] = 139;
  23357. data[j - 1] = 22;
  23358. stackSize = 0;
  23359. } else {
  23360. validationCommand = CharstringValidationData12[q];
  23361. }
  23362. } else if (value === 28) {
  23363. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  23364. j += 2;
  23365. stackSize++;
  23366. } else if (value === 14) {
  23367. if (stackSize >= 4) {
  23368. stackSize -= 4;
  23369. if (this.seacAnalysisEnabled) {
  23370. state.seac = stack.slice(stackSize, stackSize + 4);
  23371. return false;
  23372. }
  23373. }
  23374. validationCommand = CharstringValidationData[value];
  23375. } else if (value >= 32 && value <= 246) {
  23376. stack[stackSize] = value - 139;
  23377. stackSize++;
  23378. } else if (value >= 247 && value <= 254) {
  23379. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  23380. j++;
  23381. stackSize++;
  23382. } else if (value === 255) {
  23383. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  23384. j += 4;
  23385. stackSize++;
  23386. } else if (value === 19 || value === 20) {
  23387. state.hints += stackSize >> 1;
  23388. j += state.hints + 7 >> 3;
  23389. stackSize %= 2;
  23390. validationCommand = CharstringValidationData[value];
  23391. } else if (value === 10 || value === 29) {
  23392. let subrsIndex;
  23393. if (value === 10) {
  23394. subrsIndex = localSubrIndex;
  23395. } else {
  23396. subrsIndex = globalSubrIndex;
  23397. }
  23398. if (!subrsIndex) {
  23399. validationCommand = CharstringValidationData[value];
  23400. (0, _util.warn)("Missing subrsIndex for " + validationCommand.id);
  23401. return false;
  23402. }
  23403. let bias = 32768;
  23404. if (subrsIndex.count < 1240) {
  23405. bias = 107;
  23406. } else if (subrsIndex.count < 33900) {
  23407. bias = 1131;
  23408. }
  23409. const subrNumber = stack[--stackSize] + bias;
  23410. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  23411. validationCommand = CharstringValidationData[value];
  23412. (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id);
  23413. return false;
  23414. }
  23415. state.stackSize = stackSize;
  23416. state.callDepth++;
  23417. const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  23418. if (!valid) {
  23419. return false;
  23420. }
  23421. state.callDepth--;
  23422. stackSize = state.stackSize;
  23423. continue;
  23424. } else if (value === 11) {
  23425. state.stackSize = stackSize;
  23426. return true;
  23427. } else if (value === 0 && j === data.length) {
  23428. data[j - 1] = 14;
  23429. validationCommand = CharstringValidationData[14];
  23430. } else if (value === 9) {
  23431. data.copyWithin(j - 1, j, -1);
  23432. j -= 1;
  23433. length -= 1;
  23434. continue;
  23435. } else {
  23436. validationCommand = CharstringValidationData[value];
  23437. }
  23438. if (validationCommand) {
  23439. if (validationCommand.stem) {
  23440. state.hints += stackSize >> 1;
  23441. if (value === 3 || value === 23) {
  23442. state.hasVStems = true;
  23443. } else if (state.hasVStems && (value === 1 || value === 18)) {
  23444. (0, _util.warn)("CFF stem hints are in wrong order");
  23445. data[j - 1] = value === 1 ? 3 : 23;
  23446. }
  23447. }
  23448. if ("min" in validationCommand) {
  23449. if (!state.undefStack && stackSize < validationCommand.min) {
  23450. (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
  23451. if (stackSize === 0) {
  23452. data[j - 1] = 14;
  23453. return true;
  23454. }
  23455. return false;
  23456. }
  23457. }
  23458. if (state.firstStackClearing && validationCommand.stackClearing) {
  23459. state.firstStackClearing = false;
  23460. stackSize -= validationCommand.min;
  23461. if (stackSize >= 2 && validationCommand.stem) {
  23462. stackSize %= 2;
  23463. } else if (stackSize > 1) {
  23464. (0, _util.warn)("Found too many parameters for stack-clearing command");
  23465. }
  23466. if (stackSize > 0) {
  23467. state.width = stack[stackSize - 1];
  23468. }
  23469. }
  23470. if ("stackDelta" in validationCommand) {
  23471. if ("stackFn" in validationCommand) {
  23472. validationCommand.stackFn(stack, stackSize);
  23473. }
  23474. stackSize += validationCommand.stackDelta;
  23475. } else if (validationCommand.stackClearing) {
  23476. stackSize = 0;
  23477. } else if (validationCommand.resetStack) {
  23478. stackSize = 0;
  23479. state.undefStack = false;
  23480. } else if (validationCommand.undefStack) {
  23481. stackSize = 0;
  23482. state.undefStack = true;
  23483. state.firstStackClearing = false;
  23484. }
  23485. }
  23486. }
  23487. if (length < data.length) {
  23488. data.fill(14, length);
  23489. }
  23490. state.stackSize = stackSize;
  23491. return true;
  23492. }
  23493. parseCharStrings({
  23494. charStrings,
  23495. localSubrIndex,
  23496. globalSubrIndex,
  23497. fdSelect,
  23498. fdArray,
  23499. privateDict
  23500. }) {
  23501. const seacs = [];
  23502. const widths = [];
  23503. const count = charStrings.count;
  23504. for (let i = 0; i < count; i++) {
  23505. const charstring = charStrings.get(i);
  23506. const state = {
  23507. callDepth: 0,
  23508. stackSize: 0,
  23509. stack: [],
  23510. undefStack: true,
  23511. hints: 0,
  23512. firstStackClearing: true,
  23513. seac: null,
  23514. width: null,
  23515. hasVStems: false
  23516. };
  23517. let valid = true;
  23518. let localSubrToUse = null;
  23519. let privateDictToUse = privateDict;
  23520. if (fdSelect && fdArray.length) {
  23521. const fdIndex = fdSelect.getFDIndex(i);
  23522. if (fdIndex === -1) {
  23523. (0, _util.warn)("Glyph index is not in fd select.");
  23524. valid = false;
  23525. }
  23526. if (fdIndex >= fdArray.length) {
  23527. (0, _util.warn)("Invalid fd index for glyph index.");
  23528. valid = false;
  23529. }
  23530. if (valid) {
  23531. privateDictToUse = fdArray[fdIndex].privateDict;
  23532. localSubrToUse = privateDictToUse.subrsIndex;
  23533. }
  23534. } else if (localSubrIndex) {
  23535. localSubrToUse = localSubrIndex;
  23536. }
  23537. if (valid) {
  23538. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  23539. }
  23540. if (state.width !== null) {
  23541. const nominalWidth = privateDictToUse.getByName("nominalWidthX");
  23542. widths[i] = nominalWidth + state.width;
  23543. } else {
  23544. const defaultWidth = privateDictToUse.getByName("defaultWidthX");
  23545. widths[i] = defaultWidth;
  23546. }
  23547. if (state.seac !== null) {
  23548. seacs[i] = state.seac;
  23549. }
  23550. if (!valid) {
  23551. charStrings.set(i, new Uint8Array([14]));
  23552. }
  23553. }
  23554. return {
  23555. charStrings,
  23556. seacs,
  23557. widths
  23558. };
  23559. }
  23560. emptyPrivateDictionary(parentDict) {
  23561. const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  23562. parentDict.setByKey(18, [0, 0]);
  23563. parentDict.privateDict = privateDict;
  23564. }
  23565. parsePrivateDict(parentDict) {
  23566. if (!parentDict.hasName("Private")) {
  23567. this.emptyPrivateDictionary(parentDict);
  23568. return;
  23569. }
  23570. const privateOffset = parentDict.getByName("Private");
  23571. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  23572. parentDict.removeByName("Private");
  23573. return;
  23574. }
  23575. const size = privateOffset[0];
  23576. const offset = privateOffset[1];
  23577. if (size === 0 || offset >= this.bytes.length) {
  23578. this.emptyPrivateDictionary(parentDict);
  23579. return;
  23580. }
  23581. const privateDictEnd = offset + size;
  23582. const dictData = this.bytes.subarray(offset, privateDictEnd);
  23583. const dict = this.parseDict(dictData);
  23584. const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  23585. parentDict.privateDict = privateDict;
  23586. if (!privateDict.getByName("Subrs")) {
  23587. return;
  23588. }
  23589. const subrsOffset = privateDict.getByName("Subrs");
  23590. const relativeOffset = offset + subrsOffset;
  23591. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  23592. this.emptyPrivateDictionary(parentDict);
  23593. return;
  23594. }
  23595. const subrsIndex = this.parseIndex(relativeOffset);
  23596. privateDict.subrsIndex = subrsIndex.obj;
  23597. }
  23598. parseCharsets(pos, length, strings, cid) {
  23599. if (pos === 0) {
  23600. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
  23601. } else if (pos === 1) {
  23602. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
  23603. } else if (pos === 2) {
  23604. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
  23605. }
  23606. const bytes = this.bytes;
  23607. const start = pos;
  23608. const format = bytes[pos++];
  23609. const charset = [cid ? 0 : ".notdef"];
  23610. let id, count, i;
  23611. length -= 1;
  23612. switch (format) {
  23613. case 0:
  23614. for (i = 0; i < length; i++) {
  23615. id = bytes[pos++] << 8 | bytes[pos++];
  23616. charset.push(cid ? id : strings.get(id));
  23617. }
  23618. break;
  23619. case 1:
  23620. while (charset.length <= length) {
  23621. id = bytes[pos++] << 8 | bytes[pos++];
  23622. count = bytes[pos++];
  23623. for (i = 0; i <= count; i++) {
  23624. charset.push(cid ? id++ : strings.get(id++));
  23625. }
  23626. }
  23627. break;
  23628. case 2:
  23629. while (charset.length <= length) {
  23630. id = bytes[pos++] << 8 | bytes[pos++];
  23631. count = bytes[pos++] << 8 | bytes[pos++];
  23632. for (i = 0; i <= count; i++) {
  23633. charset.push(cid ? id++ : strings.get(id++));
  23634. }
  23635. }
  23636. break;
  23637. default:
  23638. throw new _util.FormatError("Unknown charset format");
  23639. }
  23640. const end = pos;
  23641. const raw = bytes.subarray(start, end);
  23642. return new CFFCharset(false, format, charset, raw);
  23643. }
  23644. parseEncoding(pos, properties, strings, charset) {
  23645. const encoding = Object.create(null);
  23646. const bytes = this.bytes;
  23647. let predefined = false;
  23648. let format, i, ii;
  23649. let raw = null;
  23650. function readSupplement() {
  23651. const supplementsCount = bytes[pos++];
  23652. for (i = 0; i < supplementsCount; i++) {
  23653. const code = bytes[pos++];
  23654. const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  23655. encoding[code] = charset.indexOf(strings.get(sid));
  23656. }
  23657. }
  23658. if (pos === 0 || pos === 1) {
  23659. predefined = true;
  23660. format = pos;
  23661. const baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
  23662. for (i = 0, ii = charset.length; i < ii; i++) {
  23663. const index = baseEncoding.indexOf(charset[i]);
  23664. if (index !== -1) {
  23665. encoding[index] = i;
  23666. }
  23667. }
  23668. } else {
  23669. const dataStart = pos;
  23670. format = bytes[pos++];
  23671. switch (format & 0x7f) {
  23672. case 0:
  23673. const glyphsCount = bytes[pos++];
  23674. for (i = 1; i <= glyphsCount; i++) {
  23675. encoding[bytes[pos++]] = i;
  23676. }
  23677. break;
  23678. case 1:
  23679. const rangesCount = bytes[pos++];
  23680. let gid = 1;
  23681. for (i = 0; i < rangesCount; i++) {
  23682. const start = bytes[pos++];
  23683. const left = bytes[pos++];
  23684. for (let j = start; j <= start + left; j++) {
  23685. encoding[j] = gid++;
  23686. }
  23687. }
  23688. break;
  23689. default:
  23690. throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
  23691. }
  23692. const dataEnd = pos;
  23693. if (format & 0x80) {
  23694. bytes[dataStart] &= 0x7f;
  23695. readSupplement();
  23696. }
  23697. raw = bytes.subarray(dataStart, dataEnd);
  23698. }
  23699. format &= 0x7f;
  23700. return new CFFEncoding(predefined, format, encoding, raw);
  23701. }
  23702. parseFDSelect(pos, length) {
  23703. const bytes = this.bytes;
  23704. const format = bytes[pos++];
  23705. const fdSelect = [];
  23706. let i;
  23707. switch (format) {
  23708. case 0:
  23709. for (i = 0; i < length; ++i) {
  23710. const id = bytes[pos++];
  23711. fdSelect.push(id);
  23712. }
  23713. break;
  23714. case 3:
  23715. const rangesCount = bytes[pos++] << 8 | bytes[pos++];
  23716. for (i = 0; i < rangesCount; ++i) {
  23717. let first = bytes[pos++] << 8 | bytes[pos++];
  23718. if (i === 0 && first !== 0) {
  23719. (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
  23720. first = 0;
  23721. }
  23722. const fdIndex = bytes[pos++];
  23723. const next = bytes[pos] << 8 | bytes[pos + 1];
  23724. for (let j = first; j < next; ++j) {
  23725. fdSelect.push(fdIndex);
  23726. }
  23727. }
  23728. pos += 2;
  23729. break;
  23730. default:
  23731. throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
  23732. }
  23733. if (fdSelect.length !== length) {
  23734. throw new _util.FormatError("parseFDSelect: Invalid font data.");
  23735. }
  23736. return new CFFFDSelect(format, fdSelect);
  23737. }
  23738. }
  23739. exports.CFFParser = CFFParser;
  23740. class CFF {
  23741. constructor() {
  23742. this.header = null;
  23743. this.names = [];
  23744. this.topDict = null;
  23745. this.strings = new CFFStrings();
  23746. this.globalSubrIndex = null;
  23747. this.encoding = null;
  23748. this.charset = null;
  23749. this.charStrings = null;
  23750. this.fdArray = [];
  23751. this.fdSelect = null;
  23752. this.isCIDFont = false;
  23753. }
  23754. duplicateFirstGlyph() {
  23755. if (this.charStrings.count >= 65535) {
  23756. (0, _util.warn)("Not enough space in charstrings to duplicate first glyph.");
  23757. return;
  23758. }
  23759. const glyphZero = this.charStrings.get(0);
  23760. this.charStrings.add(glyphZero);
  23761. if (this.isCIDFont) {
  23762. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  23763. }
  23764. }
  23765. hasGlyphId(id) {
  23766. if (id < 0 || id >= this.charStrings.count) {
  23767. return false;
  23768. }
  23769. const glyph = this.charStrings.get(id);
  23770. return glyph.length > 0;
  23771. }
  23772. }
  23773. exports.CFF = CFF;
  23774. class CFFHeader {
  23775. constructor(major, minor, hdrSize, offSize) {
  23776. this.major = major;
  23777. this.minor = minor;
  23778. this.hdrSize = hdrSize;
  23779. this.offSize = offSize;
  23780. }
  23781. }
  23782. exports.CFFHeader = CFFHeader;
  23783. class CFFStrings {
  23784. constructor() {
  23785. this.strings = [];
  23786. }
  23787. get(index) {
  23788. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  23789. return CFFStandardStrings[index];
  23790. }
  23791. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  23792. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  23793. }
  23794. return CFFStandardStrings[0];
  23795. }
  23796. getSID(str) {
  23797. let index = CFFStandardStrings.indexOf(str);
  23798. if (index !== -1) {
  23799. return index;
  23800. }
  23801. index = this.strings.indexOf(str);
  23802. if (index !== -1) {
  23803. return index + NUM_STANDARD_CFF_STRINGS;
  23804. }
  23805. return -1;
  23806. }
  23807. add(value) {
  23808. this.strings.push(value);
  23809. }
  23810. get count() {
  23811. return this.strings.length;
  23812. }
  23813. }
  23814. exports.CFFStrings = CFFStrings;
  23815. class CFFIndex {
  23816. constructor() {
  23817. this.objects = [];
  23818. this.length = 0;
  23819. }
  23820. add(data) {
  23821. this.length += data.length;
  23822. this.objects.push(data);
  23823. }
  23824. set(index, data) {
  23825. this.length += data.length - this.objects[index].length;
  23826. this.objects[index] = data;
  23827. }
  23828. get(index) {
  23829. return this.objects[index];
  23830. }
  23831. get count() {
  23832. return this.objects.length;
  23833. }
  23834. }
  23835. exports.CFFIndex = CFFIndex;
  23836. class CFFDict {
  23837. constructor(tables, strings) {
  23838. this.keyToNameMap = tables.keyToNameMap;
  23839. this.nameToKeyMap = tables.nameToKeyMap;
  23840. this.defaults = tables.defaults;
  23841. this.types = tables.types;
  23842. this.opcodes = tables.opcodes;
  23843. this.order = tables.order;
  23844. this.strings = strings;
  23845. this.values = Object.create(null);
  23846. }
  23847. setByKey(key, value) {
  23848. if (!(key in this.keyToNameMap)) {
  23849. return false;
  23850. }
  23851. if (value.length === 0) {
  23852. return true;
  23853. }
  23854. for (const val of value) {
  23855. if (isNaN(val)) {
  23856. (0, _util.warn)(`Invalid CFFDict value: "${value}" for key "${key}".`);
  23857. return true;
  23858. }
  23859. }
  23860. const type = this.types[key];
  23861. if (type === "num" || type === "sid" || type === "offset") {
  23862. value = value[0];
  23863. }
  23864. this.values[key] = value;
  23865. return true;
  23866. }
  23867. setByName(name, value) {
  23868. if (!(name in this.nameToKeyMap)) {
  23869. throw new _util.FormatError(`Invalid dictionary name "${name}"`);
  23870. }
  23871. this.values[this.nameToKeyMap[name]] = value;
  23872. }
  23873. hasName(name) {
  23874. return this.nameToKeyMap[name] in this.values;
  23875. }
  23876. getByName(name) {
  23877. if (!(name in this.nameToKeyMap)) {
  23878. throw new _util.FormatError(`Invalid dictionary name ${name}"`);
  23879. }
  23880. const key = this.nameToKeyMap[name];
  23881. if (!(key in this.values)) {
  23882. return this.defaults[key];
  23883. }
  23884. return this.values[key];
  23885. }
  23886. removeByName(name) {
  23887. delete this.values[this.nameToKeyMap[name]];
  23888. }
  23889. static createTables(layout) {
  23890. const tables = {
  23891. keyToNameMap: {},
  23892. nameToKeyMap: {},
  23893. defaults: {},
  23894. types: {},
  23895. opcodes: {},
  23896. order: []
  23897. };
  23898. for (const entry of layout) {
  23899. const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  23900. tables.keyToNameMap[key] = entry[1];
  23901. tables.nameToKeyMap[entry[1]] = key;
  23902. tables.types[key] = entry[2];
  23903. tables.defaults[key] = entry[3];
  23904. tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
  23905. tables.order.push(key);
  23906. }
  23907. return tables;
  23908. }
  23909. }
  23910. const CFFTopDictLayout = [[[12, 30], "ROS", ["sid", "sid", "num"], null], [[12, 20], "SyntheticBase", "num", null], [0, "version", "sid", null], [1, "Notice", "sid", null], [[12, 0], "Copyright", "sid", null], [2, "FullName", "sid", null], [3, "FamilyName", "sid", null], [4, "Weight", "sid", null], [[12, 1], "isFixedPitch", "num", 0], [[12, 2], "ItalicAngle", "num", 0], [[12, 3], "UnderlinePosition", "num", -100], [[12, 4], "UnderlineThickness", "num", 50], [[12, 5], "PaintType", "num", 0], [[12, 6], "CharstringType", "num", 2], [[12, 7], "FontMatrix", ["num", "num", "num", "num", "num", "num"], [0.001, 0, 0, 0.001, 0, 0]], [13, "UniqueID", "num", null], [5, "FontBBox", ["num", "num", "num", "num"], [0, 0, 0, 0]], [[12, 8], "StrokeWidth", "num", 0], [14, "XUID", "array", null], [15, "charset", "offset", 0], [16, "Encoding", "offset", 0], [17, "CharStrings", "offset", 0], [18, "Private", ["offset", "offset"], null], [[12, 21], "PostScript", "sid", null], [[12, 22], "BaseFontName", "sid", null], [[12, 23], "BaseFontBlend", "delta", null], [[12, 31], "CIDFontVersion", "num", 0], [[12, 32], "CIDFontRevision", "num", 0], [[12, 33], "CIDFontType", "num", 0], [[12, 34], "CIDCount", "num", 8720], [[12, 35], "UIDBase", "num", null], [[12, 37], "FDSelect", "offset", null], [[12, 36], "FDArray", "offset", null], [[12, 38], "FontName", "sid", null]];
  23911. class CFFTopDict extends CFFDict {
  23912. static get tables() {
  23913. return (0, _util.shadow)(this, "tables", this.createTables(CFFTopDictLayout));
  23914. }
  23915. constructor(strings) {
  23916. super(CFFTopDict.tables, strings);
  23917. this.privateDict = null;
  23918. }
  23919. }
  23920. exports.CFFTopDict = CFFTopDict;
  23921. const CFFPrivateDictLayout = [[6, "BlueValues", "delta", null], [7, "OtherBlues", "delta", null], [8, "FamilyBlues", "delta", null], [9, "FamilyOtherBlues", "delta", null], [[12, 9], "BlueScale", "num", 0.039625], [[12, 10], "BlueShift", "num", 7], [[12, 11], "BlueFuzz", "num", 1], [10, "StdHW", "num", null], [11, "StdVW", "num", null], [[12, 12], "StemSnapH", "delta", null], [[12, 13], "StemSnapV", "delta", null], [[12, 14], "ForceBold", "num", 0], [[12, 17], "LanguageGroup", "num", 0], [[12, 18], "ExpansionFactor", "num", 0.06], [[12, 19], "initialRandomSeed", "num", 0], [20, "defaultWidthX", "num", 0], [21, "nominalWidthX", "num", 0], [19, "Subrs", "offset", null]];
  23922. class CFFPrivateDict extends CFFDict {
  23923. static get tables() {
  23924. return (0, _util.shadow)(this, "tables", this.createTables(CFFPrivateDictLayout));
  23925. }
  23926. constructor(strings) {
  23927. super(CFFPrivateDict.tables, strings);
  23928. this.subrsIndex = null;
  23929. }
  23930. }
  23931. exports.CFFPrivateDict = CFFPrivateDict;
  23932. const CFFCharsetPredefinedTypes = {
  23933. ISO_ADOBE: 0,
  23934. EXPERT: 1,
  23935. EXPERT_SUBSET: 2
  23936. };
  23937. class CFFCharset {
  23938. constructor(predefined, format, charset, raw) {
  23939. this.predefined = predefined;
  23940. this.format = format;
  23941. this.charset = charset;
  23942. this.raw = raw;
  23943. }
  23944. }
  23945. exports.CFFCharset = CFFCharset;
  23946. class CFFEncoding {
  23947. constructor(predefined, format, encoding, raw) {
  23948. this.predefined = predefined;
  23949. this.format = format;
  23950. this.encoding = encoding;
  23951. this.raw = raw;
  23952. }
  23953. }
  23954. class CFFFDSelect {
  23955. constructor(format, fdSelect) {
  23956. this.format = format;
  23957. this.fdSelect = fdSelect;
  23958. }
  23959. getFDIndex(glyphIndex) {
  23960. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  23961. return -1;
  23962. }
  23963. return this.fdSelect[glyphIndex];
  23964. }
  23965. }
  23966. exports.CFFFDSelect = CFFFDSelect;
  23967. class CFFOffsetTracker {
  23968. constructor() {
  23969. this.offsets = Object.create(null);
  23970. }
  23971. isTracking(key) {
  23972. return key in this.offsets;
  23973. }
  23974. track(key, location) {
  23975. if (key in this.offsets) {
  23976. throw new _util.FormatError(`Already tracking location of ${key}`);
  23977. }
  23978. this.offsets[key] = location;
  23979. }
  23980. offset(value) {
  23981. for (const key in this.offsets) {
  23982. this.offsets[key] += value;
  23983. }
  23984. }
  23985. setEntryLocation(key, values, output) {
  23986. if (!(key in this.offsets)) {
  23987. throw new _util.FormatError(`Not tracking location of ${key}`);
  23988. }
  23989. const data = output.data;
  23990. const dataOffset = this.offsets[key];
  23991. const size = 5;
  23992. for (let i = 0, ii = values.length; i < ii; ++i) {
  23993. const offset0 = i * size + dataOffset;
  23994. const offset1 = offset0 + 1;
  23995. const offset2 = offset0 + 2;
  23996. const offset3 = offset0 + 3;
  23997. const offset4 = offset0 + 4;
  23998. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  23999. throw new _util.FormatError("writing to an offset that is not empty");
  24000. }
  24001. const value = values[i];
  24002. data[offset0] = 0x1d;
  24003. data[offset1] = value >> 24 & 0xff;
  24004. data[offset2] = value >> 16 & 0xff;
  24005. data[offset3] = value >> 8 & 0xff;
  24006. data[offset4] = value & 0xff;
  24007. }
  24008. }
  24009. }
  24010. class CFFCompiler {
  24011. constructor(cff) {
  24012. this.cff = cff;
  24013. }
  24014. compile() {
  24015. const cff = this.cff;
  24016. const output = {
  24017. data: [],
  24018. length: 0,
  24019. add(data) {
  24020. this.data = this.data.concat(data);
  24021. this.length = this.data.length;
  24022. }
  24023. };
  24024. const header = this.compileHeader(cff.header);
  24025. output.add(header);
  24026. const nameIndex = this.compileNameIndex(cff.names);
  24027. output.add(nameIndex);
  24028. if (cff.isCIDFont) {
  24029. if (cff.topDict.hasName("FontMatrix")) {
  24030. const base = cff.topDict.getByName("FontMatrix");
  24031. cff.topDict.removeByName("FontMatrix");
  24032. for (const subDict of cff.fdArray) {
  24033. let matrix = base.slice(0);
  24034. if (subDict.hasName("FontMatrix")) {
  24035. matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix"));
  24036. }
  24037. subDict.setByName("FontMatrix", matrix);
  24038. }
  24039. }
  24040. }
  24041. const xuid = cff.topDict.getByName("XUID");
  24042. if (xuid && xuid.length > 16) {
  24043. cff.topDict.removeByName("XUID");
  24044. }
  24045. cff.topDict.setByName("charset", 0);
  24046. let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  24047. output.add(compiled.output);
  24048. const topDictTracker = compiled.trackers[0];
  24049. const stringIndex = this.compileStringIndex(cff.strings.strings);
  24050. output.add(stringIndex);
  24051. const globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  24052. output.add(globalSubrIndex);
  24053. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  24054. if (cff.encoding.predefined) {
  24055. topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
  24056. } else {
  24057. const encoding = this.compileEncoding(cff.encoding);
  24058. topDictTracker.setEntryLocation("Encoding", [output.length], output);
  24059. output.add(encoding);
  24060. }
  24061. }
  24062. const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
  24063. topDictTracker.setEntryLocation("charset", [output.length], output);
  24064. output.add(charset);
  24065. const charStrings = this.compileCharStrings(cff.charStrings);
  24066. topDictTracker.setEntryLocation("CharStrings", [output.length], output);
  24067. output.add(charStrings);
  24068. if (cff.isCIDFont) {
  24069. topDictTracker.setEntryLocation("FDSelect", [output.length], output);
  24070. const fdSelect = this.compileFDSelect(cff.fdSelect);
  24071. output.add(fdSelect);
  24072. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  24073. topDictTracker.setEntryLocation("FDArray", [output.length], output);
  24074. output.add(compiled.output);
  24075. const fontDictTrackers = compiled.trackers;
  24076. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  24077. }
  24078. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  24079. output.add([0]);
  24080. return output.data;
  24081. }
  24082. encodeNumber(value) {
  24083. if (Number.isInteger(value)) {
  24084. return this.encodeInteger(value);
  24085. }
  24086. return this.encodeFloat(value);
  24087. }
  24088. static get EncodeFloatRegExp() {
  24089. return (0, _util.shadow)(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/);
  24090. }
  24091. encodeFloat(num) {
  24092. let value = num.toString();
  24093. const m = CFFCompiler.EncodeFloatRegExp.exec(value);
  24094. if (m) {
  24095. const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
  24096. value = (Math.round(num * epsilon) / epsilon).toString();
  24097. }
  24098. let nibbles = "";
  24099. let i, ii;
  24100. for (i = 0, ii = value.length; i < ii; ++i) {
  24101. const a = value[i];
  24102. if (a === "e") {
  24103. nibbles += value[++i] === "-" ? "c" : "b";
  24104. } else if (a === ".") {
  24105. nibbles += "a";
  24106. } else if (a === "-") {
  24107. nibbles += "e";
  24108. } else {
  24109. nibbles += a;
  24110. }
  24111. }
  24112. nibbles += nibbles.length & 1 ? "f" : "ff";
  24113. const out = [30];
  24114. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  24115. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  24116. }
  24117. return out;
  24118. }
  24119. encodeInteger(value) {
  24120. let code;
  24121. if (value >= -107 && value <= 107) {
  24122. code = [value + 139];
  24123. } else if (value >= 108 && value <= 1131) {
  24124. value -= 108;
  24125. code = [(value >> 8) + 247, value & 0xff];
  24126. } else if (value >= -1131 && value <= -108) {
  24127. value = -value - 108;
  24128. code = [(value >> 8) + 251, value & 0xff];
  24129. } else if (value >= -32768 && value <= 32767) {
  24130. code = [0x1c, value >> 8 & 0xff, value & 0xff];
  24131. } else {
  24132. code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
  24133. }
  24134. return code;
  24135. }
  24136. compileHeader(header) {
  24137. return [header.major, header.minor, 4, header.offSize];
  24138. }
  24139. compileNameIndex(names) {
  24140. const nameIndex = new CFFIndex();
  24141. for (const name of names) {
  24142. const length = Math.min(name.length, 127);
  24143. let sanitizedName = new Array(length);
  24144. for (let j = 0; j < length; j++) {
  24145. let char = name[j];
  24146. if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
  24147. char = "_";
  24148. }
  24149. sanitizedName[j] = char;
  24150. }
  24151. sanitizedName = sanitizedName.join("");
  24152. if (sanitizedName === "") {
  24153. sanitizedName = "Bad_Font_Name";
  24154. }
  24155. nameIndex.add((0, _util.stringToBytes)(sanitizedName));
  24156. }
  24157. return this.compileIndex(nameIndex);
  24158. }
  24159. compileTopDicts(dicts, length, removeCidKeys) {
  24160. const fontDictTrackers = [];
  24161. let fdArrayIndex = new CFFIndex();
  24162. for (const fontDict of dicts) {
  24163. if (removeCidKeys) {
  24164. fontDict.removeByName("CIDFontVersion");
  24165. fontDict.removeByName("CIDFontRevision");
  24166. fontDict.removeByName("CIDFontType");
  24167. fontDict.removeByName("CIDCount");
  24168. fontDict.removeByName("UIDBase");
  24169. }
  24170. const fontDictTracker = new CFFOffsetTracker();
  24171. const fontDictData = this.compileDict(fontDict, fontDictTracker);
  24172. fontDictTrackers.push(fontDictTracker);
  24173. fdArrayIndex.add(fontDictData);
  24174. fontDictTracker.offset(length);
  24175. }
  24176. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  24177. return {
  24178. trackers: fontDictTrackers,
  24179. output: fdArrayIndex
  24180. };
  24181. }
  24182. compilePrivateDicts(dicts, trackers, output) {
  24183. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  24184. const fontDict = dicts[i];
  24185. const privateDict = fontDict.privateDict;
  24186. if (!privateDict || !fontDict.hasName("Private")) {
  24187. throw new _util.FormatError("There must be a private dictionary.");
  24188. }
  24189. const privateDictTracker = new CFFOffsetTracker();
  24190. const privateDictData = this.compileDict(privateDict, privateDictTracker);
  24191. let outputLength = output.length;
  24192. privateDictTracker.offset(outputLength);
  24193. if (!privateDictData.length) {
  24194. outputLength = 0;
  24195. }
  24196. trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
  24197. output.add(privateDictData);
  24198. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  24199. const subrs = this.compileIndex(privateDict.subrsIndex);
  24200. privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
  24201. output.add(subrs);
  24202. }
  24203. }
  24204. }
  24205. compileDict(dict, offsetTracker) {
  24206. const out = [];
  24207. for (const key of dict.order) {
  24208. if (!(key in dict.values)) {
  24209. continue;
  24210. }
  24211. let values = dict.values[key];
  24212. let types = dict.types[key];
  24213. if (!Array.isArray(types)) {
  24214. types = [types];
  24215. }
  24216. if (!Array.isArray(values)) {
  24217. values = [values];
  24218. }
  24219. if (values.length === 0) {
  24220. continue;
  24221. }
  24222. for (let j = 0, jj = types.length; j < jj; ++j) {
  24223. const type = types[j];
  24224. const value = values[j];
  24225. switch (type) {
  24226. case "num":
  24227. case "sid":
  24228. out.push(...this.encodeNumber(value));
  24229. break;
  24230. case "offset":
  24231. const name = dict.keyToNameMap[key];
  24232. if (!offsetTracker.isTracking(name)) {
  24233. offsetTracker.track(name, out.length);
  24234. }
  24235. out.push(0x1d, 0, 0, 0, 0);
  24236. break;
  24237. case "array":
  24238. case "delta":
  24239. out.push(...this.encodeNumber(value));
  24240. for (let k = 1, kk = values.length; k < kk; ++k) {
  24241. out.push(...this.encodeNumber(values[k]));
  24242. }
  24243. break;
  24244. default:
  24245. throw new _util.FormatError(`Unknown data type of ${type}`);
  24246. }
  24247. }
  24248. out.push(...dict.opcodes[key]);
  24249. }
  24250. return out;
  24251. }
  24252. compileStringIndex(strings) {
  24253. const stringIndex = new CFFIndex();
  24254. for (const string of strings) {
  24255. stringIndex.add((0, _util.stringToBytes)(string));
  24256. }
  24257. return this.compileIndex(stringIndex);
  24258. }
  24259. compileGlobalSubrIndex() {
  24260. const globalSubrIndex = this.cff.globalSubrIndex;
  24261. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  24262. }
  24263. compileCharStrings(charStrings) {
  24264. const charStringsIndex = new CFFIndex();
  24265. for (let i = 0; i < charStrings.count; i++) {
  24266. const glyph = charStrings.get(i);
  24267. if (glyph.length === 0) {
  24268. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  24269. continue;
  24270. }
  24271. charStringsIndex.add(glyph);
  24272. }
  24273. return this.compileIndex(charStringsIndex);
  24274. }
  24275. compileCharset(charset, numGlyphs, strings, isCIDFont) {
  24276. let out;
  24277. const numGlyphsLessNotDef = numGlyphs - 1;
  24278. if (isCIDFont) {
  24279. out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
  24280. } else {
  24281. const length = 1 + numGlyphsLessNotDef * 2;
  24282. out = new Uint8Array(length);
  24283. out[0] = 0;
  24284. let charsetIndex = 0;
  24285. const numCharsets = charset.charset.length;
  24286. let warned = false;
  24287. for (let i = 1; i < out.length; i += 2) {
  24288. let sid = 0;
  24289. if (charsetIndex < numCharsets) {
  24290. const name = charset.charset[charsetIndex++];
  24291. sid = strings.getSID(name);
  24292. if (sid === -1) {
  24293. sid = 0;
  24294. if (!warned) {
  24295. warned = true;
  24296. (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
  24297. }
  24298. }
  24299. }
  24300. out[i] = sid >> 8 & 0xff;
  24301. out[i + 1] = sid & 0xff;
  24302. }
  24303. }
  24304. return this.compileTypedArray(out);
  24305. }
  24306. compileEncoding(encoding) {
  24307. return this.compileTypedArray(encoding.raw);
  24308. }
  24309. compileFDSelect(fdSelect) {
  24310. const format = fdSelect.format;
  24311. let out, i;
  24312. switch (format) {
  24313. case 0:
  24314. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  24315. out[0] = format;
  24316. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  24317. out[i + 1] = fdSelect.fdSelect[i];
  24318. }
  24319. break;
  24320. case 3:
  24321. const start = 0;
  24322. let lastFD = fdSelect.fdSelect[0];
  24323. const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
  24324. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  24325. const currentFD = fdSelect.fdSelect[i];
  24326. if (currentFD !== lastFD) {
  24327. ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
  24328. lastFD = currentFD;
  24329. }
  24330. }
  24331. const numRanges = (ranges.length - 3) / 3;
  24332. ranges[1] = numRanges >> 8 & 0xff;
  24333. ranges[2] = numRanges & 0xff;
  24334. ranges.push(i >> 8 & 0xff, i & 0xff);
  24335. out = new Uint8Array(ranges);
  24336. break;
  24337. }
  24338. return this.compileTypedArray(out);
  24339. }
  24340. compileTypedArray(data) {
  24341. const out = [];
  24342. for (let i = 0, ii = data.length; i < ii; ++i) {
  24343. out[i] = data[i];
  24344. }
  24345. return out;
  24346. }
  24347. compileIndex(index, trackers = []) {
  24348. const objects = index.objects;
  24349. const count = objects.length;
  24350. if (count === 0) {
  24351. return [0, 0];
  24352. }
  24353. const data = [count >> 8 & 0xff, count & 0xff];
  24354. let lastOffset = 1,
  24355. i;
  24356. for (i = 0; i < count; ++i) {
  24357. lastOffset += objects[i].length;
  24358. }
  24359. let offsetSize;
  24360. if (lastOffset < 0x100) {
  24361. offsetSize = 1;
  24362. } else if (lastOffset < 0x10000) {
  24363. offsetSize = 2;
  24364. } else if (lastOffset < 0x1000000) {
  24365. offsetSize = 3;
  24366. } else {
  24367. offsetSize = 4;
  24368. }
  24369. data.push(offsetSize);
  24370. let relativeOffset = 1;
  24371. for (i = 0; i < count + 1; i++) {
  24372. if (offsetSize === 1) {
  24373. data.push(relativeOffset & 0xff);
  24374. } else if (offsetSize === 2) {
  24375. data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  24376. } else if (offsetSize === 3) {
  24377. data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  24378. } else {
  24379. data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  24380. }
  24381. if (objects[i]) {
  24382. relativeOffset += objects[i].length;
  24383. }
  24384. }
  24385. for (i = 0; i < count; i++) {
  24386. if (trackers[i]) {
  24387. trackers[i].offset(data.length);
  24388. }
  24389. data.push(...objects[i]);
  24390. }
  24391. return data;
  24392. }
  24393. }
  24394. exports.CFFCompiler = CFFCompiler;
  24395. /***/ }),
  24396. /* 34 */
  24397. /***/ ((__unused_webpack_module, exports) => {
  24398. Object.defineProperty(exports, "__esModule", ({
  24399. value: true
  24400. }));
  24401. exports.ISOAdobeCharset = exports.ExpertSubsetCharset = exports.ExpertCharset = void 0;
  24402. const ISOAdobeCharset = [".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodcentered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron"];
  24403. exports.ISOAdobeCharset = ISOAdobeCharset;
  24404. const ExpertCharset = [".notdef", "space", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "onequarter", "onehalf", "threequarters", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall"];
  24405. exports.ExpertCharset = ExpertCharset;
  24406. const ExpertSubsetCharset = [".notdef", "space", "dollaroldstyle", "dollarsuperior", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "hyphensuperior", "colonmonetary", "onefitted", "rupiah", "centoldstyle", "figuredash", "hypheninferior", "onequarter", "onehalf", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior"];
  24407. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  24408. /***/ }),
  24409. /* 35 */
  24410. /***/ ((__unused_webpack_module, exports) => {
  24411. Object.defineProperty(exports, "__esModule", ({
  24412. value: true
  24413. }));
  24414. exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0;
  24415. exports.getEncoding = getEncoding;
  24416. const ExpertEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclamsmall", "Hungarumlautsmall", "", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "", "", "", "isuperior", "", "", "lsuperior", "msuperior", "nsuperior", "osuperior", "", "", "rsuperior", "ssuperior", "tsuperior", "", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "exclamdownsmall", "centoldstyle", "Lslashsmall", "", "", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "", "Dotaccentsmall", "", "", "Macronsmall", "", "", "figuredash", "hypheninferior", "", "", "Ogoneksmall", "Ringsmall", "Cedillasmall", "", "", "", "onequarter", "onehalf", "threequarters", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "", "", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall"];
  24417. exports.ExpertEncoding = ExpertEncoding;
  24418. const MacExpertEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclamsmall", "Hungarumlautsmall", "centoldstyle", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "", "threequartersemdash", "", "questionsmall", "", "", "", "", "Ethsmall", "", "", "onequarter", "onehalf", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "", "", "", "", "", "", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "", "parenrightinferior", "Circumflexsmall", "hypheninferior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "", "", "asuperior", "centsuperior", "", "", "", "", "Aacutesmall", "Agravesmall", "Acircumflexsmall", "Adieresissmall", "Atildesmall", "Aringsmall", "Ccedillasmall", "Eacutesmall", "Egravesmall", "Ecircumflexsmall", "Edieresissmall", "Iacutesmall", "Igravesmall", "Icircumflexsmall", "Idieresissmall", "Ntildesmall", "Oacutesmall", "Ogravesmall", "Ocircumflexsmall", "Odieresissmall", "Otildesmall", "Uacutesmall", "Ugravesmall", "Ucircumflexsmall", "Udieresissmall", "", "eightsuperior", "fourinferior", "threeinferior", "sixinferior", "eightinferior", "seveninferior", "Scaronsmall", "", "centinferior", "twoinferior", "", "Dieresissmall", "", "Caronsmall", "osuperior", "fiveinferior", "", "commainferior", "periodinferior", "Yacutesmall", "", "dollarinferior", "", "", "Thornsmall", "", "nineinferior", "zeroinferior", "Zcaronsmall", "AEsmall", "Oslashsmall", "questiondownsmall", "oneinferior", "Lslashsmall", "", "", "", "", "", "", "Cedillasmall", "", "", "", "", "", "OEsmall", "figuredash", "hyphensuperior", "", "", "", "", "exclamdownsmall", "", "Ydieresissmall", "", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "ninesuperior", "zerosuperior", "", "esuperior", "rsuperior", "tsuperior", "", "", "isuperior", "ssuperior", "dsuperior", "", "", "", "", "", "lsuperior", "Ogoneksmall", "Brevesmall", "Macronsmall", "bsuperior", "nsuperior", "msuperior", "commasuperior", "periodsuperior", "Dotaccentsmall", "Ringsmall", "", "", "", ""];
  24419. const MacRomanEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "", "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", "section", "bullet", "paragraph", "germandbls", "registered", "copyright", "trademark", "acute", "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", "mu", "partialdiff", "summation", "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", "florin", "approxequal", "Delta", "guillemotleft", "guillemotright", "ellipsis", "space", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron"];
  24420. exports.MacRomanEncoding = MacRomanEncoding;
  24421. const StandardEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "", "endash", "dagger", "daggerdbl", "periodcentered", "", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "", "questiondown", "", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "", "ring", "cedilla", "", "hungarumlaut", "ogonek", "caron", "emdash", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "AE", "", "ordfeminine", "", "", "", "", "Lslash", "Oslash", "OE", "ordmasculine", "", "", "", "", "", "ae", "", "", "", "dotlessi", "", "", "lslash", "oslash", "oe", "germandbls", "", "", "", ""];
  24422. exports.StandardEncoding = StandardEncoding;
  24423. const WinAnsiEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "bullet", "Euro", "bullet", "quotesinglbase", "florin", "quotedblbase", "ellipsis", "dagger", "daggerdbl", "circumflex", "perthousand", "Scaron", "guilsinglleft", "OE", "bullet", "Zcaron", "bullet", "bullet", "quoteleft", "quoteright", "quotedblleft", "quotedblright", "bullet", "endash", "emdash", "tilde", "trademark", "scaron", "guilsinglright", "oe", "bullet", "zcaron", "Ydieresis", "space", "exclamdown", "cent", "sterling", "currency", "yen", "brokenbar", "section", "dieresis", "copyright", "ordfeminine", "guillemotleft", "logicalnot", "hyphen", "registered", "macron", "degree", "plusminus", "twosuperior", "threesuperior", "acute", "mu", "paragraph", "periodcentered", "cedilla", "onesuperior", "ordmasculine", "guillemotright", "onequarter", "onehalf", "threequarters", "questiondown", "Agrave", "Aacute", "Acircumflex", "Atilde", "Adieresis", "Aring", "AE", "Ccedilla", "Egrave", "Eacute", "Ecircumflex", "Edieresis", "Igrave", "Iacute", "Icircumflex", "Idieresis", "Eth", "Ntilde", "Ograve", "Oacute", "Ocircumflex", "Otilde", "Odieresis", "multiply", "Oslash", "Ugrave", "Uacute", "Ucircumflex", "Udieresis", "Yacute", "Thorn", "germandbls", "agrave", "aacute", "acircumflex", "atilde", "adieresis", "aring", "ae", "ccedilla", "egrave", "eacute", "ecircumflex", "edieresis", "igrave", "iacute", "icircumflex", "idieresis", "eth", "ntilde", "ograve", "oacute", "ocircumflex", "otilde", "odieresis", "divide", "oslash", "ugrave", "uacute", "ucircumflex", "udieresis", "yacute", "thorn", "ydieresis"];
  24424. exports.WinAnsiEncoding = WinAnsiEncoding;
  24425. const SymbolSetEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "universal", "numbersign", "existential", "percent", "ampersand", "suchthat", "parenleft", "parenright", "asteriskmath", "plus", "comma", "minus", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "congruent", "Alpha", "Beta", "Chi", "Delta", "Epsilon", "Phi", "Gamma", "Eta", "Iota", "theta1", "Kappa", "Lambda", "Mu", "Nu", "Omicron", "Pi", "Theta", "Rho", "Sigma", "Tau", "Upsilon", "sigma1", "Omega", "Xi", "Psi", "Zeta", "bracketleft", "therefore", "bracketright", "perpendicular", "underscore", "radicalex", "alpha", "beta", "chi", "delta", "epsilon", "phi", "gamma", "eta", "iota", "phi1", "kappa", "lambda", "mu", "nu", "omicron", "pi", "theta", "rho", "sigma", "tau", "upsilon", "omega1", "omega", "xi", "psi", "zeta", "braceleft", "bar", "braceright", "similar", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Euro", "Upsilon1", "minute", "lessequal", "fraction", "infinity", "florin", "club", "diamond", "heart", "spade", "arrowboth", "arrowleft", "arrowup", "arrowright", "arrowdown", "degree", "plusminus", "second", "greaterequal", "multiply", "proportional", "partialdiff", "bullet", "divide", "notequal", "equivalence", "approxequal", "ellipsis", "arrowvertex", "arrowhorizex", "carriagereturn", "aleph", "Ifraktur", "Rfraktur", "weierstrass", "circlemultiply", "circleplus", "emptyset", "intersection", "union", "propersuperset", "reflexsuperset", "notsubset", "propersubset", "reflexsubset", "element", "notelement", "angle", "gradient", "registerserif", "copyrightserif", "trademarkserif", "product", "radical", "dotmath", "logicalnot", "logicaland", "logicalor", "arrowdblboth", "arrowdblleft", "arrowdblup", "arrowdblright", "arrowdbldown", "lozenge", "angleleft", "registersans", "copyrightsans", "trademarksans", "summation", "parenlefttp", "parenleftex", "parenleftbt", "bracketlefttp", "bracketleftex", "bracketleftbt", "bracelefttp", "braceleftmid", "braceleftbt", "braceex", "", "angleright", "integral", "integraltp", "integralex", "integralbt", "parenrighttp", "parenrightex", "parenrightbt", "bracketrighttp", "bracketrightex", "bracketrightbt", "bracerighttp", "bracerightmid", "bracerightbt", ""];
  24426. exports.SymbolSetEncoding = SymbolSetEncoding;
  24427. const ZapfDingbatsEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "a1", "a2", "a202", "a3", "a4", "a5", "a119", "a118", "a117", "a11", "a12", "a13", "a14", "a15", "a16", "a105", "a17", "a18", "a19", "a20", "a21", "a22", "a23", "a24", "a25", "a26", "a27", "a28", "a6", "a7", "a8", "a9", "a10", "a29", "a30", "a31", "a32", "a33", "a34", "a35", "a36", "a37", "a38", "a39", "a40", "a41", "a42", "a43", "a44", "a45", "a46", "a47", "a48", "a49", "a50", "a51", "a52", "a53", "a54", "a55", "a56", "a57", "a58", "a59", "a60", "a61", "a62", "a63", "a64", "a65", "a66", "a67", "a68", "a69", "a70", "a71", "a72", "a73", "a74", "a203", "a75", "a204", "a76", "a77", "a78", "a79", "a81", "a82", "a83", "a84", "a97", "a98", "a99", "a100", "", "a89", "a90", "a93", "a94", "a91", "a92", "a205", "a85", "a206", "a86", "a87", "a88", "a95", "a96", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "a101", "a102", "a103", "a104", "a106", "a107", "a108", "a112", "a111", "a110", "a109", "a120", "a121", "a122", "a123", "a124", "a125", "a126", "a127", "a128", "a129", "a130", "a131", "a132", "a133", "a134", "a135", "a136", "a137", "a138", "a139", "a140", "a141", "a142", "a143", "a144", "a145", "a146", "a147", "a148", "a149", "a150", "a151", "a152", "a153", "a154", "a155", "a156", "a157", "a158", "a159", "a160", "a161", "a163", "a164", "a196", "a165", "a192", "a166", "a167", "a168", "a169", "a170", "a171", "a172", "a173", "a162", "a174", "a175", "a176", "a177", "a178", "a179", "a193", "a180", "a199", "a181", "a200", "a182", "", "a201", "a183", "a184", "a197", "a185", "a194", "a198", "a186", "a195", "a187", "a188", "a189", "a190", "a191", ""];
  24428. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  24429. function getEncoding(encodingName) {
  24430. switch (encodingName) {
  24431. case "WinAnsiEncoding":
  24432. return WinAnsiEncoding;
  24433. case "StandardEncoding":
  24434. return StandardEncoding;
  24435. case "MacRomanEncoding":
  24436. return MacRomanEncoding;
  24437. case "SymbolSetEncoding":
  24438. return SymbolSetEncoding;
  24439. case "ZapfDingbatsEncoding":
  24440. return ZapfDingbatsEncoding;
  24441. case "ExpertEncoding":
  24442. return ExpertEncoding;
  24443. case "MacExpertEncoding":
  24444. return MacExpertEncoding;
  24445. default:
  24446. return null;
  24447. }
  24448. }
  24449. /***/ }),
  24450. /* 36 */
  24451. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  24452. Object.defineProperty(exports, "__esModule", ({
  24453. value: true
  24454. }));
  24455. exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0;
  24456. exports.getFontType = getFontType;
  24457. exports.normalizeFontName = normalizeFontName;
  24458. exports.recoverGlyphName = recoverGlyphName;
  24459. exports.type1FontGlyphMapping = type1FontGlyphMapping;
  24460. var _util = __w_pdfjs_require__(2);
  24461. var _encodings = __w_pdfjs_require__(35);
  24462. var _glyphlist = __w_pdfjs_require__(37);
  24463. var _unicode = __w_pdfjs_require__(38);
  24464. const SEAC_ANALYSIS_ENABLED = true;
  24465. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  24466. const FontFlags = {
  24467. FixedPitch: 1,
  24468. Serif: 2,
  24469. Symbolic: 4,
  24470. Script: 8,
  24471. Nonsymbolic: 32,
  24472. Italic: 64,
  24473. AllCap: 65536,
  24474. SmallCap: 131072,
  24475. ForceBold: 262144
  24476. };
  24477. exports.FontFlags = FontFlags;
  24478. const MacStandardGlyphOrdering = [".notdef", ".null", "nonmarkingreturn", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", "section", "bullet", "paragraph", "germandbls", "registered", "copyright", "trademark", "acute", "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", "mu", "partialdiff", "summation", "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", "florin", "approxequal", "Delta", "guillemotleft", "guillemotright", "ellipsis", "nonbreakingspace", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "Lslash", "lslash", "Scaron", "scaron", "Zcaron", "zcaron", "brokenbar", "Eth", "eth", "Yacute", "yacute", "Thorn", "thorn", "minus", "multiply", "onesuperior", "twosuperior", "threesuperior", "onehalf", "onequarter", "threequarters", "franc", "Gbreve", "gbreve", "Idotaccent", "Scedilla", "scedilla", "Cacute", "cacute", "Ccaron", "ccaron", "dcroat"];
  24479. exports.MacStandardGlyphOrdering = MacStandardGlyphOrdering;
  24480. function getFontType(type, subtype, isStandardFont = false) {
  24481. switch (type) {
  24482. case "Type1":
  24483. if (isStandardFont) {
  24484. return _util.FontType.TYPE1STANDARD;
  24485. }
  24486. return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1;
  24487. case "CIDFontType0":
  24488. return subtype === "CIDFontType0C" ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0;
  24489. case "OpenType":
  24490. return _util.FontType.OPENTYPE;
  24491. case "TrueType":
  24492. return _util.FontType.TRUETYPE;
  24493. case "CIDFontType2":
  24494. return _util.FontType.CIDFONTTYPE2;
  24495. case "MMType1":
  24496. return _util.FontType.MMTYPE1;
  24497. case "Type0":
  24498. return _util.FontType.TYPE0;
  24499. default:
  24500. return _util.FontType.UNKNOWN;
  24501. }
  24502. }
  24503. function recoverGlyphName(name, glyphsUnicodeMap) {
  24504. if (glyphsUnicodeMap[name] !== undefined) {
  24505. return name;
  24506. }
  24507. const unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
  24508. if (unicode !== -1) {
  24509. for (const key in glyphsUnicodeMap) {
  24510. if (glyphsUnicodeMap[key] === unicode) {
  24511. return key;
  24512. }
  24513. }
  24514. }
  24515. (0, _util.info)("Unable to recover a standard glyph name for: " + name);
  24516. return name;
  24517. }
  24518. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  24519. const charCodeToGlyphId = Object.create(null);
  24520. let glyphId, charCode, baseEncoding;
  24521. const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  24522. if (properties.isInternalFont) {
  24523. baseEncoding = builtInEncoding;
  24524. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  24525. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  24526. if (glyphId >= 0) {
  24527. charCodeToGlyphId[charCode] = glyphId;
  24528. } else {
  24529. charCodeToGlyphId[charCode] = 0;
  24530. }
  24531. }
  24532. } else if (properties.baseEncodingName) {
  24533. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  24534. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  24535. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  24536. if (glyphId >= 0) {
  24537. charCodeToGlyphId[charCode] = glyphId;
  24538. } else {
  24539. charCodeToGlyphId[charCode] = 0;
  24540. }
  24541. }
  24542. } else if (isSymbolicFont) {
  24543. for (charCode in builtInEncoding) {
  24544. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  24545. }
  24546. } else {
  24547. baseEncoding = _encodings.StandardEncoding;
  24548. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  24549. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  24550. if (glyphId >= 0) {
  24551. charCodeToGlyphId[charCode] = glyphId;
  24552. } else {
  24553. charCodeToGlyphId[charCode] = 0;
  24554. }
  24555. }
  24556. }
  24557. const differences = properties.differences;
  24558. let glyphsUnicodeMap;
  24559. if (differences) {
  24560. for (charCode in differences) {
  24561. const glyphName = differences[charCode];
  24562. glyphId = glyphNames.indexOf(glyphName);
  24563. if (glyphId === -1) {
  24564. if (!glyphsUnicodeMap) {
  24565. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  24566. }
  24567. const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  24568. if (standardGlyphName !== glyphName) {
  24569. glyphId = glyphNames.indexOf(standardGlyphName);
  24570. }
  24571. }
  24572. if (glyphId >= 0) {
  24573. charCodeToGlyphId[charCode] = glyphId;
  24574. } else {
  24575. charCodeToGlyphId[charCode] = 0;
  24576. }
  24577. }
  24578. }
  24579. return charCodeToGlyphId;
  24580. }
  24581. function normalizeFontName(name) {
  24582. return name.replace(/[,_]/g, "-").replace(/\s/g, "");
  24583. }
  24584. /***/ }),
  24585. /* 37 */
  24586. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  24587. __w_pdfjs_require__.r(__webpack_exports__);
  24588. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  24589. /* harmony export */ "getDingbatsGlyphsUnicode": () => (/* binding */ getDingbatsGlyphsUnicode),
  24590. /* harmony export */ "getGlyphsUnicode": () => (/* binding */ getGlyphsUnicode)
  24591. /* harmony export */ });
  24592. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(4);
  24593. const getGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  24594. return [
  24595. "A",
  24596. 0x0041,
  24597. "AE",
  24598. 0x00c6,
  24599. "AEacute",
  24600. 0x01fc,
  24601. "AEmacron",
  24602. 0x01e2,
  24603. "AEsmall",
  24604. 0xf7e6,
  24605. "Aacute",
  24606. 0x00c1,
  24607. "Aacutesmall",
  24608. 0xf7e1,
  24609. "Abreve",
  24610. 0x0102,
  24611. "Abreveacute",
  24612. 0x1eae,
  24613. "Abrevecyrillic",
  24614. 0x04d0,
  24615. "Abrevedotbelow",
  24616. 0x1eb6,
  24617. "Abrevegrave",
  24618. 0x1eb0,
  24619. "Abrevehookabove",
  24620. 0x1eb2,
  24621. "Abrevetilde",
  24622. 0x1eb4,
  24623. "Acaron",
  24624. 0x01cd,
  24625. "Acircle",
  24626. 0x24b6,
  24627. "Acircumflex",
  24628. 0x00c2,
  24629. "Acircumflexacute",
  24630. 0x1ea4,
  24631. "Acircumflexdotbelow",
  24632. 0x1eac,
  24633. "Acircumflexgrave",
  24634. 0x1ea6,
  24635. "Acircumflexhookabove",
  24636. 0x1ea8,
  24637. "Acircumflexsmall",
  24638. 0xf7e2,
  24639. "Acircumflextilde",
  24640. 0x1eaa,
  24641. "Acute",
  24642. 0xf6c9,
  24643. "Acutesmall",
  24644. 0xf7b4,
  24645. "Acyrillic",
  24646. 0x0410,
  24647. "Adblgrave",
  24648. 0x0200,
  24649. "Adieresis",
  24650. 0x00c4,
  24651. "Adieresiscyrillic",
  24652. 0x04d2,
  24653. "Adieresismacron",
  24654. 0x01de,
  24655. "Adieresissmall",
  24656. 0xf7e4,
  24657. "Adotbelow",
  24658. 0x1ea0,
  24659. "Adotmacron",
  24660. 0x01e0,
  24661. "Agrave",
  24662. 0x00c0,
  24663. "Agravesmall",
  24664. 0xf7e0,
  24665. "Ahookabove",
  24666. 0x1ea2,
  24667. "Aiecyrillic",
  24668. 0x04d4,
  24669. "Ainvertedbreve",
  24670. 0x0202,
  24671. "Alpha",
  24672. 0x0391,
  24673. "Alphatonos",
  24674. 0x0386,
  24675. "Amacron",
  24676. 0x0100,
  24677. "Amonospace",
  24678. 0xff21,
  24679. "Aogonek",
  24680. 0x0104,
  24681. "Aring",
  24682. 0x00c5,
  24683. "Aringacute",
  24684. 0x01fa,
  24685. "Aringbelow",
  24686. 0x1e00,
  24687. "Aringsmall",
  24688. 0xf7e5,
  24689. "Asmall",
  24690. 0xf761,
  24691. "Atilde",
  24692. 0x00c3,
  24693. "Atildesmall",
  24694. 0xf7e3,
  24695. "Aybarmenian",
  24696. 0x0531,
  24697. "B",
  24698. 0x0042,
  24699. "Bcircle",
  24700. 0x24b7,
  24701. "Bdotaccent",
  24702. 0x1e02,
  24703. "Bdotbelow",
  24704. 0x1e04,
  24705. "Becyrillic",
  24706. 0x0411,
  24707. "Benarmenian",
  24708. 0x0532,
  24709. "Beta",
  24710. 0x0392,
  24711. "Bhook",
  24712. 0x0181,
  24713. "Blinebelow",
  24714. 0x1e06,
  24715. "Bmonospace",
  24716. 0xff22,
  24717. "Brevesmall",
  24718. 0xf6f4,
  24719. "Bsmall",
  24720. 0xf762,
  24721. "Btopbar",
  24722. 0x0182,
  24723. "C",
  24724. 0x0043,
  24725. "Caarmenian",
  24726. 0x053e,
  24727. "Cacute",
  24728. 0x0106,
  24729. "Caron",
  24730. 0xf6ca,
  24731. "Caronsmall",
  24732. 0xf6f5,
  24733. "Ccaron",
  24734. 0x010c,
  24735. "Ccedilla",
  24736. 0x00c7,
  24737. "Ccedillaacute",
  24738. 0x1e08,
  24739. "Ccedillasmall",
  24740. 0xf7e7,
  24741. "Ccircle",
  24742. 0x24b8,
  24743. "Ccircumflex",
  24744. 0x0108,
  24745. "Cdot",
  24746. 0x010a,
  24747. "Cdotaccent",
  24748. 0x010a,
  24749. "Cedillasmall",
  24750. 0xf7b8,
  24751. "Chaarmenian",
  24752. 0x0549,
  24753. "Cheabkhasiancyrillic",
  24754. 0x04bc,
  24755. "Checyrillic",
  24756. 0x0427,
  24757. "Chedescenderabkhasiancyrillic",
  24758. 0x04be,
  24759. "Chedescendercyrillic",
  24760. 0x04b6,
  24761. "Chedieresiscyrillic",
  24762. 0x04f4,
  24763. "Cheharmenian",
  24764. 0x0543,
  24765. "Chekhakassiancyrillic",
  24766. 0x04cb,
  24767. "Cheverticalstrokecyrillic",
  24768. 0x04b8,
  24769. "Chi",
  24770. 0x03a7,
  24771. "Chook",
  24772. 0x0187,
  24773. "Circumflexsmall",
  24774. 0xf6f6,
  24775. "Cmonospace",
  24776. 0xff23,
  24777. "Coarmenian",
  24778. 0x0551,
  24779. "Csmall",
  24780. 0xf763,
  24781. "D",
  24782. 0x0044,
  24783. "DZ",
  24784. 0x01f1,
  24785. "DZcaron",
  24786. 0x01c4,
  24787. "Daarmenian",
  24788. 0x0534,
  24789. "Dafrican",
  24790. 0x0189,
  24791. "Dcaron",
  24792. 0x010e,
  24793. "Dcedilla",
  24794. 0x1e10,
  24795. "Dcircle",
  24796. 0x24b9,
  24797. "Dcircumflexbelow",
  24798. 0x1e12,
  24799. "Dcroat",
  24800. 0x0110,
  24801. "Ddotaccent",
  24802. 0x1e0a,
  24803. "Ddotbelow",
  24804. 0x1e0c,
  24805. "Decyrillic",
  24806. 0x0414,
  24807. "Deicoptic",
  24808. 0x03ee,
  24809. "Delta",
  24810. 0x2206,
  24811. "Deltagreek",
  24812. 0x0394,
  24813. "Dhook",
  24814. 0x018a,
  24815. "Dieresis",
  24816. 0xf6cb,
  24817. "DieresisAcute",
  24818. 0xf6cc,
  24819. "DieresisGrave",
  24820. 0xf6cd,
  24821. "Dieresissmall",
  24822. 0xf7a8,
  24823. "Digammagreek",
  24824. 0x03dc,
  24825. "Djecyrillic",
  24826. 0x0402,
  24827. "Dlinebelow",
  24828. 0x1e0e,
  24829. "Dmonospace",
  24830. 0xff24,
  24831. "Dotaccentsmall",
  24832. 0xf6f7,
  24833. "Dslash",
  24834. 0x0110,
  24835. "Dsmall",
  24836. 0xf764,
  24837. "Dtopbar",
  24838. 0x018b,
  24839. "Dz",
  24840. 0x01f2,
  24841. "Dzcaron",
  24842. 0x01c5,
  24843. "Dzeabkhasiancyrillic",
  24844. 0x04e0,
  24845. "Dzecyrillic",
  24846. 0x0405,
  24847. "Dzhecyrillic",
  24848. 0x040f,
  24849. "E",
  24850. 0x0045,
  24851. "Eacute",
  24852. 0x00c9,
  24853. "Eacutesmall",
  24854. 0xf7e9,
  24855. "Ebreve",
  24856. 0x0114,
  24857. "Ecaron",
  24858. 0x011a,
  24859. "Ecedillabreve",
  24860. 0x1e1c,
  24861. "Echarmenian",
  24862. 0x0535,
  24863. "Ecircle",
  24864. 0x24ba,
  24865. "Ecircumflex",
  24866. 0x00ca,
  24867. "Ecircumflexacute",
  24868. 0x1ebe,
  24869. "Ecircumflexbelow",
  24870. 0x1e18,
  24871. "Ecircumflexdotbelow",
  24872. 0x1ec6,
  24873. "Ecircumflexgrave",
  24874. 0x1ec0,
  24875. "Ecircumflexhookabove",
  24876. 0x1ec2,
  24877. "Ecircumflexsmall",
  24878. 0xf7ea,
  24879. "Ecircumflextilde",
  24880. 0x1ec4,
  24881. "Ecyrillic",
  24882. 0x0404,
  24883. "Edblgrave",
  24884. 0x0204,
  24885. "Edieresis",
  24886. 0x00cb,
  24887. "Edieresissmall",
  24888. 0xf7eb,
  24889. "Edot",
  24890. 0x0116,
  24891. "Edotaccent",
  24892. 0x0116,
  24893. "Edotbelow",
  24894. 0x1eb8,
  24895. "Efcyrillic",
  24896. 0x0424,
  24897. "Egrave",
  24898. 0x00c8,
  24899. "Egravesmall",
  24900. 0xf7e8,
  24901. "Eharmenian",
  24902. 0x0537,
  24903. "Ehookabove",
  24904. 0x1eba,
  24905. "Eightroman",
  24906. 0x2167,
  24907. "Einvertedbreve",
  24908. 0x0206,
  24909. "Eiotifiedcyrillic",
  24910. 0x0464,
  24911. "Elcyrillic",
  24912. 0x041b,
  24913. "Elevenroman",
  24914. 0x216a,
  24915. "Emacron",
  24916. 0x0112,
  24917. "Emacronacute",
  24918. 0x1e16,
  24919. "Emacrongrave",
  24920. 0x1e14,
  24921. "Emcyrillic",
  24922. 0x041c,
  24923. "Emonospace",
  24924. 0xff25,
  24925. "Encyrillic",
  24926. 0x041d,
  24927. "Endescendercyrillic",
  24928. 0x04a2,
  24929. "Eng",
  24930. 0x014a,
  24931. "Enghecyrillic",
  24932. 0x04a4,
  24933. "Enhookcyrillic",
  24934. 0x04c7,
  24935. "Eogonek",
  24936. 0x0118,
  24937. "Eopen",
  24938. 0x0190,
  24939. "Epsilon",
  24940. 0x0395,
  24941. "Epsilontonos",
  24942. 0x0388,
  24943. "Ercyrillic",
  24944. 0x0420,
  24945. "Ereversed",
  24946. 0x018e,
  24947. "Ereversedcyrillic",
  24948. 0x042d,
  24949. "Escyrillic",
  24950. 0x0421,
  24951. "Esdescendercyrillic",
  24952. 0x04aa,
  24953. "Esh",
  24954. 0x01a9,
  24955. "Esmall",
  24956. 0xf765,
  24957. "Eta",
  24958. 0x0397,
  24959. "Etarmenian",
  24960. 0x0538,
  24961. "Etatonos",
  24962. 0x0389,
  24963. "Eth",
  24964. 0x00d0,
  24965. "Ethsmall",
  24966. 0xf7f0,
  24967. "Etilde",
  24968. 0x1ebc,
  24969. "Etildebelow",
  24970. 0x1e1a,
  24971. "Euro",
  24972. 0x20ac,
  24973. "Ezh",
  24974. 0x01b7,
  24975. "Ezhcaron",
  24976. 0x01ee,
  24977. "Ezhreversed",
  24978. 0x01b8,
  24979. "F",
  24980. 0x0046,
  24981. "Fcircle",
  24982. 0x24bb,
  24983. "Fdotaccent",
  24984. 0x1e1e,
  24985. "Feharmenian",
  24986. 0x0556,
  24987. "Feicoptic",
  24988. 0x03e4,
  24989. "Fhook",
  24990. 0x0191,
  24991. "Fitacyrillic",
  24992. 0x0472,
  24993. "Fiveroman",
  24994. 0x2164,
  24995. "Fmonospace",
  24996. 0xff26,
  24997. "Fourroman",
  24998. 0x2163,
  24999. "Fsmall",
  25000. 0xf766,
  25001. "G",
  25002. 0x0047,
  25003. "GBsquare",
  25004. 0x3387,
  25005. "Gacute",
  25006. 0x01f4,
  25007. "Gamma",
  25008. 0x0393,
  25009. "Gammaafrican",
  25010. 0x0194,
  25011. "Gangiacoptic",
  25012. 0x03ea,
  25013. "Gbreve",
  25014. 0x011e,
  25015. "Gcaron",
  25016. 0x01e6,
  25017. "Gcedilla",
  25018. 0x0122,
  25019. "Gcircle",
  25020. 0x24bc,
  25021. "Gcircumflex",
  25022. 0x011c,
  25023. "Gcommaaccent",
  25024. 0x0122,
  25025. "Gdot",
  25026. 0x0120,
  25027. "Gdotaccent",
  25028. 0x0120,
  25029. "Gecyrillic",
  25030. 0x0413,
  25031. "Ghadarmenian",
  25032. 0x0542,
  25033. "Ghemiddlehookcyrillic",
  25034. 0x0494,
  25035. "Ghestrokecyrillic",
  25036. 0x0492,
  25037. "Gheupturncyrillic",
  25038. 0x0490,
  25039. "Ghook",
  25040. 0x0193,
  25041. "Gimarmenian",
  25042. 0x0533,
  25043. "Gjecyrillic",
  25044. 0x0403,
  25045. "Gmacron",
  25046. 0x1e20,
  25047. "Gmonospace",
  25048. 0xff27,
  25049. "Grave",
  25050. 0xf6ce,
  25051. "Gravesmall",
  25052. 0xf760,
  25053. "Gsmall",
  25054. 0xf767,
  25055. "Gsmallhook",
  25056. 0x029b,
  25057. "Gstroke",
  25058. 0x01e4,
  25059. "H",
  25060. 0x0048,
  25061. "H18533",
  25062. 0x25cf,
  25063. "H18543",
  25064. 0x25aa,
  25065. "H18551",
  25066. 0x25ab,
  25067. "H22073",
  25068. 0x25a1,
  25069. "HPsquare",
  25070. 0x33cb,
  25071. "Haabkhasiancyrillic",
  25072. 0x04a8,
  25073. "Hadescendercyrillic",
  25074. 0x04b2,
  25075. "Hardsigncyrillic",
  25076. 0x042a,
  25077. "Hbar",
  25078. 0x0126,
  25079. "Hbrevebelow",
  25080. 0x1e2a,
  25081. "Hcedilla",
  25082. 0x1e28,
  25083. "Hcircle",
  25084. 0x24bd,
  25085. "Hcircumflex",
  25086. 0x0124,
  25087. "Hdieresis",
  25088. 0x1e26,
  25089. "Hdotaccent",
  25090. 0x1e22,
  25091. "Hdotbelow",
  25092. 0x1e24,
  25093. "Hmonospace",
  25094. 0xff28,
  25095. "Hoarmenian",
  25096. 0x0540,
  25097. "Horicoptic",
  25098. 0x03e8,
  25099. "Hsmall",
  25100. 0xf768,
  25101. "Hungarumlaut",
  25102. 0xf6cf,
  25103. "Hungarumlautsmall",
  25104. 0xf6f8,
  25105. "Hzsquare",
  25106. 0x3390,
  25107. "I",
  25108. 0x0049,
  25109. "IAcyrillic",
  25110. 0x042f,
  25111. "IJ",
  25112. 0x0132,
  25113. "IUcyrillic",
  25114. 0x042e,
  25115. "Iacute",
  25116. 0x00cd,
  25117. "Iacutesmall",
  25118. 0xf7ed,
  25119. "Ibreve",
  25120. 0x012c,
  25121. "Icaron",
  25122. 0x01cf,
  25123. "Icircle",
  25124. 0x24be,
  25125. "Icircumflex",
  25126. 0x00ce,
  25127. "Icircumflexsmall",
  25128. 0xf7ee,
  25129. "Icyrillic",
  25130. 0x0406,
  25131. "Idblgrave",
  25132. 0x0208,
  25133. "Idieresis",
  25134. 0x00cf,
  25135. "Idieresisacute",
  25136. 0x1e2e,
  25137. "Idieresiscyrillic",
  25138. 0x04e4,
  25139. "Idieresissmall",
  25140. 0xf7ef,
  25141. "Idot",
  25142. 0x0130,
  25143. "Idotaccent",
  25144. 0x0130,
  25145. "Idotbelow",
  25146. 0x1eca,
  25147. "Iebrevecyrillic",
  25148. 0x04d6,
  25149. "Iecyrillic",
  25150. 0x0415,
  25151. "Ifraktur",
  25152. 0x2111,
  25153. "Igrave",
  25154. 0x00cc,
  25155. "Igravesmall",
  25156. 0xf7ec,
  25157. "Ihookabove",
  25158. 0x1ec8,
  25159. "Iicyrillic",
  25160. 0x0418,
  25161. "Iinvertedbreve",
  25162. 0x020a,
  25163. "Iishortcyrillic",
  25164. 0x0419,
  25165. "Imacron",
  25166. 0x012a,
  25167. "Imacroncyrillic",
  25168. 0x04e2,
  25169. "Imonospace",
  25170. 0xff29,
  25171. "Iniarmenian",
  25172. 0x053b,
  25173. "Iocyrillic",
  25174. 0x0401,
  25175. "Iogonek",
  25176. 0x012e,
  25177. "Iota",
  25178. 0x0399,
  25179. "Iotaafrican",
  25180. 0x0196,
  25181. "Iotadieresis",
  25182. 0x03aa,
  25183. "Iotatonos",
  25184. 0x038a,
  25185. "Ismall",
  25186. 0xf769,
  25187. "Istroke",
  25188. 0x0197,
  25189. "Itilde",
  25190. 0x0128,
  25191. "Itildebelow",
  25192. 0x1e2c,
  25193. "Izhitsacyrillic",
  25194. 0x0474,
  25195. "Izhitsadblgravecyrillic",
  25196. 0x0476,
  25197. "J",
  25198. 0x004a,
  25199. "Jaarmenian",
  25200. 0x0541,
  25201. "Jcircle",
  25202. 0x24bf,
  25203. "Jcircumflex",
  25204. 0x0134,
  25205. "Jecyrillic",
  25206. 0x0408,
  25207. "Jheharmenian",
  25208. 0x054b,
  25209. "Jmonospace",
  25210. 0xff2a,
  25211. "Jsmall",
  25212. 0xf76a,
  25213. "K",
  25214. 0x004b,
  25215. "KBsquare",
  25216. 0x3385,
  25217. "KKsquare",
  25218. 0x33cd,
  25219. "Kabashkircyrillic",
  25220. 0x04a0,
  25221. "Kacute",
  25222. 0x1e30,
  25223. "Kacyrillic",
  25224. 0x041a,
  25225. "Kadescendercyrillic",
  25226. 0x049a,
  25227. "Kahookcyrillic",
  25228. 0x04c3,
  25229. "Kappa",
  25230. 0x039a,
  25231. "Kastrokecyrillic",
  25232. 0x049e,
  25233. "Kaverticalstrokecyrillic",
  25234. 0x049c,
  25235. "Kcaron",
  25236. 0x01e8,
  25237. "Kcedilla",
  25238. 0x0136,
  25239. "Kcircle",
  25240. 0x24c0,
  25241. "Kcommaaccent",
  25242. 0x0136,
  25243. "Kdotbelow",
  25244. 0x1e32,
  25245. "Keharmenian",
  25246. 0x0554,
  25247. "Kenarmenian",
  25248. 0x053f,
  25249. "Khacyrillic",
  25250. 0x0425,
  25251. "Kheicoptic",
  25252. 0x03e6,
  25253. "Khook",
  25254. 0x0198,
  25255. "Kjecyrillic",
  25256. 0x040c,
  25257. "Klinebelow",
  25258. 0x1e34,
  25259. "Kmonospace",
  25260. 0xff2b,
  25261. "Koppacyrillic",
  25262. 0x0480,
  25263. "Koppagreek",
  25264. 0x03de,
  25265. "Ksicyrillic",
  25266. 0x046e,
  25267. "Ksmall",
  25268. 0xf76b,
  25269. "L",
  25270. 0x004c,
  25271. "LJ",
  25272. 0x01c7,
  25273. "LL",
  25274. 0xf6bf,
  25275. "Lacute",
  25276. 0x0139,
  25277. "Lambda",
  25278. 0x039b,
  25279. "Lcaron",
  25280. 0x013d,
  25281. "Lcedilla",
  25282. 0x013b,
  25283. "Lcircle",
  25284. 0x24c1,
  25285. "Lcircumflexbelow",
  25286. 0x1e3c,
  25287. "Lcommaaccent",
  25288. 0x013b,
  25289. "Ldot",
  25290. 0x013f,
  25291. "Ldotaccent",
  25292. 0x013f,
  25293. "Ldotbelow",
  25294. 0x1e36,
  25295. "Ldotbelowmacron",
  25296. 0x1e38,
  25297. "Liwnarmenian",
  25298. 0x053c,
  25299. "Lj",
  25300. 0x01c8,
  25301. "Ljecyrillic",
  25302. 0x0409,
  25303. "Llinebelow",
  25304. 0x1e3a,
  25305. "Lmonospace",
  25306. 0xff2c,
  25307. "Lslash",
  25308. 0x0141,
  25309. "Lslashsmall",
  25310. 0xf6f9,
  25311. "Lsmall",
  25312. 0xf76c,
  25313. "M",
  25314. 0x004d,
  25315. "MBsquare",
  25316. 0x3386,
  25317. "Macron",
  25318. 0xf6d0,
  25319. "Macronsmall",
  25320. 0xf7af,
  25321. "Macute",
  25322. 0x1e3e,
  25323. "Mcircle",
  25324. 0x24c2,
  25325. "Mdotaccent",
  25326. 0x1e40,
  25327. "Mdotbelow",
  25328. 0x1e42,
  25329. "Menarmenian",
  25330. 0x0544,
  25331. "Mmonospace",
  25332. 0xff2d,
  25333. "Msmall",
  25334. 0xf76d,
  25335. "Mturned",
  25336. 0x019c,
  25337. "Mu",
  25338. 0x039c,
  25339. "N",
  25340. 0x004e,
  25341. "NJ",
  25342. 0x01ca,
  25343. "Nacute",
  25344. 0x0143,
  25345. "Ncaron",
  25346. 0x0147,
  25347. "Ncedilla",
  25348. 0x0145,
  25349. "Ncircle",
  25350. 0x24c3,
  25351. "Ncircumflexbelow",
  25352. 0x1e4a,
  25353. "Ncommaaccent",
  25354. 0x0145,
  25355. "Ndotaccent",
  25356. 0x1e44,
  25357. "Ndotbelow",
  25358. 0x1e46,
  25359. "Nhookleft",
  25360. 0x019d,
  25361. "Nineroman",
  25362. 0x2168,
  25363. "Nj",
  25364. 0x01cb,
  25365. "Njecyrillic",
  25366. 0x040a,
  25367. "Nlinebelow",
  25368. 0x1e48,
  25369. "Nmonospace",
  25370. 0xff2e,
  25371. "Nowarmenian",
  25372. 0x0546,
  25373. "Nsmall",
  25374. 0xf76e,
  25375. "Ntilde",
  25376. 0x00d1,
  25377. "Ntildesmall",
  25378. 0xf7f1,
  25379. "Nu",
  25380. 0x039d,
  25381. "O",
  25382. 0x004f,
  25383. "OE",
  25384. 0x0152,
  25385. "OEsmall",
  25386. 0xf6fa,
  25387. "Oacute",
  25388. 0x00d3,
  25389. "Oacutesmall",
  25390. 0xf7f3,
  25391. "Obarredcyrillic",
  25392. 0x04e8,
  25393. "Obarreddieresiscyrillic",
  25394. 0x04ea,
  25395. "Obreve",
  25396. 0x014e,
  25397. "Ocaron",
  25398. 0x01d1,
  25399. "Ocenteredtilde",
  25400. 0x019f,
  25401. "Ocircle",
  25402. 0x24c4,
  25403. "Ocircumflex",
  25404. 0x00d4,
  25405. "Ocircumflexacute",
  25406. 0x1ed0,
  25407. "Ocircumflexdotbelow",
  25408. 0x1ed8,
  25409. "Ocircumflexgrave",
  25410. 0x1ed2,
  25411. "Ocircumflexhookabove",
  25412. 0x1ed4,
  25413. "Ocircumflexsmall",
  25414. 0xf7f4,
  25415. "Ocircumflextilde",
  25416. 0x1ed6,
  25417. "Ocyrillic",
  25418. 0x041e,
  25419. "Odblacute",
  25420. 0x0150,
  25421. "Odblgrave",
  25422. 0x020c,
  25423. "Odieresis",
  25424. 0x00d6,
  25425. "Odieresiscyrillic",
  25426. 0x04e6,
  25427. "Odieresissmall",
  25428. 0xf7f6,
  25429. "Odotbelow",
  25430. 0x1ecc,
  25431. "Ogoneksmall",
  25432. 0xf6fb,
  25433. "Ograve",
  25434. 0x00d2,
  25435. "Ogravesmall",
  25436. 0xf7f2,
  25437. "Oharmenian",
  25438. 0x0555,
  25439. "Ohm",
  25440. 0x2126,
  25441. "Ohookabove",
  25442. 0x1ece,
  25443. "Ohorn",
  25444. 0x01a0,
  25445. "Ohornacute",
  25446. 0x1eda,
  25447. "Ohorndotbelow",
  25448. 0x1ee2,
  25449. "Ohorngrave",
  25450. 0x1edc,
  25451. "Ohornhookabove",
  25452. 0x1ede,
  25453. "Ohorntilde",
  25454. 0x1ee0,
  25455. "Ohungarumlaut",
  25456. 0x0150,
  25457. "Oi",
  25458. 0x01a2,
  25459. "Oinvertedbreve",
  25460. 0x020e,
  25461. "Omacron",
  25462. 0x014c,
  25463. "Omacronacute",
  25464. 0x1e52,
  25465. "Omacrongrave",
  25466. 0x1e50,
  25467. "Omega",
  25468. 0x2126,
  25469. "Omegacyrillic",
  25470. 0x0460,
  25471. "Omegagreek",
  25472. 0x03a9,
  25473. "Omegaroundcyrillic",
  25474. 0x047a,
  25475. "Omegatitlocyrillic",
  25476. 0x047c,
  25477. "Omegatonos",
  25478. 0x038f,
  25479. "Omicron",
  25480. 0x039f,
  25481. "Omicrontonos",
  25482. 0x038c,
  25483. "Omonospace",
  25484. 0xff2f,
  25485. "Oneroman",
  25486. 0x2160,
  25487. "Oogonek",
  25488. 0x01ea,
  25489. "Oogonekmacron",
  25490. 0x01ec,
  25491. "Oopen",
  25492. 0x0186,
  25493. "Oslash",
  25494. 0x00d8,
  25495. "Oslashacute",
  25496. 0x01fe,
  25497. "Oslashsmall",
  25498. 0xf7f8,
  25499. "Osmall",
  25500. 0xf76f,
  25501. "Ostrokeacute",
  25502. 0x01fe,
  25503. "Otcyrillic",
  25504. 0x047e,
  25505. "Otilde",
  25506. 0x00d5,
  25507. "Otildeacute",
  25508. 0x1e4c,
  25509. "Otildedieresis",
  25510. 0x1e4e,
  25511. "Otildesmall",
  25512. 0xf7f5,
  25513. "P",
  25514. 0x0050,
  25515. "Pacute",
  25516. 0x1e54,
  25517. "Pcircle",
  25518. 0x24c5,
  25519. "Pdotaccent",
  25520. 0x1e56,
  25521. "Pecyrillic",
  25522. 0x041f,
  25523. "Peharmenian",
  25524. 0x054a,
  25525. "Pemiddlehookcyrillic",
  25526. 0x04a6,
  25527. "Phi",
  25528. 0x03a6,
  25529. "Phook",
  25530. 0x01a4,
  25531. "Pi",
  25532. 0x03a0,
  25533. "Piwrarmenian",
  25534. 0x0553,
  25535. "Pmonospace",
  25536. 0xff30,
  25537. "Psi",
  25538. 0x03a8,
  25539. "Psicyrillic",
  25540. 0x0470,
  25541. "Psmall",
  25542. 0xf770,
  25543. "Q",
  25544. 0x0051,
  25545. "Qcircle",
  25546. 0x24c6,
  25547. "Qmonospace",
  25548. 0xff31,
  25549. "Qsmall",
  25550. 0xf771,
  25551. "R",
  25552. 0x0052,
  25553. "Raarmenian",
  25554. 0x054c,
  25555. "Racute",
  25556. 0x0154,
  25557. "Rcaron",
  25558. 0x0158,
  25559. "Rcedilla",
  25560. 0x0156,
  25561. "Rcircle",
  25562. 0x24c7,
  25563. "Rcommaaccent",
  25564. 0x0156,
  25565. "Rdblgrave",
  25566. 0x0210,
  25567. "Rdotaccent",
  25568. 0x1e58,
  25569. "Rdotbelow",
  25570. 0x1e5a,
  25571. "Rdotbelowmacron",
  25572. 0x1e5c,
  25573. "Reharmenian",
  25574. 0x0550,
  25575. "Rfraktur",
  25576. 0x211c,
  25577. "Rho",
  25578. 0x03a1,
  25579. "Ringsmall",
  25580. 0xf6fc,
  25581. "Rinvertedbreve",
  25582. 0x0212,
  25583. "Rlinebelow",
  25584. 0x1e5e,
  25585. "Rmonospace",
  25586. 0xff32,
  25587. "Rsmall",
  25588. 0xf772,
  25589. "Rsmallinverted",
  25590. 0x0281,
  25591. "Rsmallinvertedsuperior",
  25592. 0x02b6,
  25593. "S",
  25594. 0x0053,
  25595. "SF010000",
  25596. 0x250c,
  25597. "SF020000",
  25598. 0x2514,
  25599. "SF030000",
  25600. 0x2510,
  25601. "SF040000",
  25602. 0x2518,
  25603. "SF050000",
  25604. 0x253c,
  25605. "SF060000",
  25606. 0x252c,
  25607. "SF070000",
  25608. 0x2534,
  25609. "SF080000",
  25610. 0x251c,
  25611. "SF090000",
  25612. 0x2524,
  25613. "SF100000",
  25614. 0x2500,
  25615. "SF110000",
  25616. 0x2502,
  25617. "SF190000",
  25618. 0x2561,
  25619. "SF200000",
  25620. 0x2562,
  25621. "SF210000",
  25622. 0x2556,
  25623. "SF220000",
  25624. 0x2555,
  25625. "SF230000",
  25626. 0x2563,
  25627. "SF240000",
  25628. 0x2551,
  25629. "SF250000",
  25630. 0x2557,
  25631. "SF260000",
  25632. 0x255d,
  25633. "SF270000",
  25634. 0x255c,
  25635. "SF280000",
  25636. 0x255b,
  25637. "SF360000",
  25638. 0x255e,
  25639. "SF370000",
  25640. 0x255f,
  25641. "SF380000",
  25642. 0x255a,
  25643. "SF390000",
  25644. 0x2554,
  25645. "SF400000",
  25646. 0x2569,
  25647. "SF410000",
  25648. 0x2566,
  25649. "SF420000",
  25650. 0x2560,
  25651. "SF430000",
  25652. 0x2550,
  25653. "SF440000",
  25654. 0x256c,
  25655. "SF450000",
  25656. 0x2567,
  25657. "SF460000",
  25658. 0x2568,
  25659. "SF470000",
  25660. 0x2564,
  25661. "SF480000",
  25662. 0x2565,
  25663. "SF490000",
  25664. 0x2559,
  25665. "SF500000",
  25666. 0x2558,
  25667. "SF510000",
  25668. 0x2552,
  25669. "SF520000",
  25670. 0x2553,
  25671. "SF530000",
  25672. 0x256b,
  25673. "SF540000",
  25674. 0x256a,
  25675. "Sacute",
  25676. 0x015a,
  25677. "Sacutedotaccent",
  25678. 0x1e64,
  25679. "Sampigreek",
  25680. 0x03e0,
  25681. "Scaron",
  25682. 0x0160,
  25683. "Scarondotaccent",
  25684. 0x1e66,
  25685. "Scaronsmall",
  25686. 0xf6fd,
  25687. "Scedilla",
  25688. 0x015e,
  25689. "Schwa",
  25690. 0x018f,
  25691. "Schwacyrillic",
  25692. 0x04d8,
  25693. "Schwadieresiscyrillic",
  25694. 0x04da,
  25695. "Scircle",
  25696. 0x24c8,
  25697. "Scircumflex",
  25698. 0x015c,
  25699. "Scommaaccent",
  25700. 0x0218,
  25701. "Sdotaccent",
  25702. 0x1e60,
  25703. "Sdotbelow",
  25704. 0x1e62,
  25705. "Sdotbelowdotaccent",
  25706. 0x1e68,
  25707. "Seharmenian",
  25708. 0x054d,
  25709. "Sevenroman",
  25710. 0x2166,
  25711. "Shaarmenian",
  25712. 0x0547,
  25713. "Shacyrillic",
  25714. 0x0428,
  25715. "Shchacyrillic",
  25716. 0x0429,
  25717. "Sheicoptic",
  25718. 0x03e2,
  25719. "Shhacyrillic",
  25720. 0x04ba,
  25721. "Shimacoptic",
  25722. 0x03ec,
  25723. "Sigma",
  25724. 0x03a3,
  25725. "Sixroman",
  25726. 0x2165,
  25727. "Smonospace",
  25728. 0xff33,
  25729. "Softsigncyrillic",
  25730. 0x042c,
  25731. "Ssmall",
  25732. 0xf773,
  25733. "Stigmagreek",
  25734. 0x03da,
  25735. "T",
  25736. 0x0054,
  25737. "Tau",
  25738. 0x03a4,
  25739. "Tbar",
  25740. 0x0166,
  25741. "Tcaron",
  25742. 0x0164,
  25743. "Tcedilla",
  25744. 0x0162,
  25745. "Tcircle",
  25746. 0x24c9,
  25747. "Tcircumflexbelow",
  25748. 0x1e70,
  25749. "Tcommaaccent",
  25750. 0x0162,
  25751. "Tdotaccent",
  25752. 0x1e6a,
  25753. "Tdotbelow",
  25754. 0x1e6c,
  25755. "Tecyrillic",
  25756. 0x0422,
  25757. "Tedescendercyrillic",
  25758. 0x04ac,
  25759. "Tenroman",
  25760. 0x2169,
  25761. "Tetsecyrillic",
  25762. 0x04b4,
  25763. "Theta",
  25764. 0x0398,
  25765. "Thook",
  25766. 0x01ac,
  25767. "Thorn",
  25768. 0x00de,
  25769. "Thornsmall",
  25770. 0xf7fe,
  25771. "Threeroman",
  25772. 0x2162,
  25773. "Tildesmall",
  25774. 0xf6fe,
  25775. "Tiwnarmenian",
  25776. 0x054f,
  25777. "Tlinebelow",
  25778. 0x1e6e,
  25779. "Tmonospace",
  25780. 0xff34,
  25781. "Toarmenian",
  25782. 0x0539,
  25783. "Tonefive",
  25784. 0x01bc,
  25785. "Tonesix",
  25786. 0x0184,
  25787. "Tonetwo",
  25788. 0x01a7,
  25789. "Tretroflexhook",
  25790. 0x01ae,
  25791. "Tsecyrillic",
  25792. 0x0426,
  25793. "Tshecyrillic",
  25794. 0x040b,
  25795. "Tsmall",
  25796. 0xf774,
  25797. "Twelveroman",
  25798. 0x216b,
  25799. "Tworoman",
  25800. 0x2161,
  25801. "U",
  25802. 0x0055,
  25803. "Uacute",
  25804. 0x00da,
  25805. "Uacutesmall",
  25806. 0xf7fa,
  25807. "Ubreve",
  25808. 0x016c,
  25809. "Ucaron",
  25810. 0x01d3,
  25811. "Ucircle",
  25812. 0x24ca,
  25813. "Ucircumflex",
  25814. 0x00db,
  25815. "Ucircumflexbelow",
  25816. 0x1e76,
  25817. "Ucircumflexsmall",
  25818. 0xf7fb,
  25819. "Ucyrillic",
  25820. 0x0423,
  25821. "Udblacute",
  25822. 0x0170,
  25823. "Udblgrave",
  25824. 0x0214,
  25825. "Udieresis",
  25826. 0x00dc,
  25827. "Udieresisacute",
  25828. 0x01d7,
  25829. "Udieresisbelow",
  25830. 0x1e72,
  25831. "Udieresiscaron",
  25832. 0x01d9,
  25833. "Udieresiscyrillic",
  25834. 0x04f0,
  25835. "Udieresisgrave",
  25836. 0x01db,
  25837. "Udieresismacron",
  25838. 0x01d5,
  25839. "Udieresissmall",
  25840. 0xf7fc,
  25841. "Udotbelow",
  25842. 0x1ee4,
  25843. "Ugrave",
  25844. 0x00d9,
  25845. "Ugravesmall",
  25846. 0xf7f9,
  25847. "Uhookabove",
  25848. 0x1ee6,
  25849. "Uhorn",
  25850. 0x01af,
  25851. "Uhornacute",
  25852. 0x1ee8,
  25853. "Uhorndotbelow",
  25854. 0x1ef0,
  25855. "Uhorngrave",
  25856. 0x1eea,
  25857. "Uhornhookabove",
  25858. 0x1eec,
  25859. "Uhorntilde",
  25860. 0x1eee,
  25861. "Uhungarumlaut",
  25862. 0x0170,
  25863. "Uhungarumlautcyrillic",
  25864. 0x04f2,
  25865. "Uinvertedbreve",
  25866. 0x0216,
  25867. "Ukcyrillic",
  25868. 0x0478,
  25869. "Umacron",
  25870. 0x016a,
  25871. "Umacroncyrillic",
  25872. 0x04ee,
  25873. "Umacrondieresis",
  25874. 0x1e7a,
  25875. "Umonospace",
  25876. 0xff35,
  25877. "Uogonek",
  25878. 0x0172,
  25879. "Upsilon",
  25880. 0x03a5,
  25881. "Upsilon1",
  25882. 0x03d2,
  25883. "Upsilonacutehooksymbolgreek",
  25884. 0x03d3,
  25885. "Upsilonafrican",
  25886. 0x01b1,
  25887. "Upsilondieresis",
  25888. 0x03ab,
  25889. "Upsilondieresishooksymbolgreek",
  25890. 0x03d4,
  25891. "Upsilonhooksymbol",
  25892. 0x03d2,
  25893. "Upsilontonos",
  25894. 0x038e,
  25895. "Uring",
  25896. 0x016e,
  25897. "Ushortcyrillic",
  25898. 0x040e,
  25899. "Usmall",
  25900. 0xf775,
  25901. "Ustraightcyrillic",
  25902. 0x04ae,
  25903. "Ustraightstrokecyrillic",
  25904. 0x04b0,
  25905. "Utilde",
  25906. 0x0168,
  25907. "Utildeacute",
  25908. 0x1e78,
  25909. "Utildebelow",
  25910. 0x1e74,
  25911. "V",
  25912. 0x0056,
  25913. "Vcircle",
  25914. 0x24cb,
  25915. "Vdotbelow",
  25916. 0x1e7e,
  25917. "Vecyrillic",
  25918. 0x0412,
  25919. "Vewarmenian",
  25920. 0x054e,
  25921. "Vhook",
  25922. 0x01b2,
  25923. "Vmonospace",
  25924. 0xff36,
  25925. "Voarmenian",
  25926. 0x0548,
  25927. "Vsmall",
  25928. 0xf776,
  25929. "Vtilde",
  25930. 0x1e7c,
  25931. "W",
  25932. 0x0057,
  25933. "Wacute",
  25934. 0x1e82,
  25935. "Wcircle",
  25936. 0x24cc,
  25937. "Wcircumflex",
  25938. 0x0174,
  25939. "Wdieresis",
  25940. 0x1e84,
  25941. "Wdotaccent",
  25942. 0x1e86,
  25943. "Wdotbelow",
  25944. 0x1e88,
  25945. "Wgrave",
  25946. 0x1e80,
  25947. "Wmonospace",
  25948. 0xff37,
  25949. "Wsmall",
  25950. 0xf777,
  25951. "X",
  25952. 0x0058,
  25953. "Xcircle",
  25954. 0x24cd,
  25955. "Xdieresis",
  25956. 0x1e8c,
  25957. "Xdotaccent",
  25958. 0x1e8a,
  25959. "Xeharmenian",
  25960. 0x053d,
  25961. "Xi",
  25962. 0x039e,
  25963. "Xmonospace",
  25964. 0xff38,
  25965. "Xsmall",
  25966. 0xf778,
  25967. "Y",
  25968. 0x0059,
  25969. "Yacute",
  25970. 0x00dd,
  25971. "Yacutesmall",
  25972. 0xf7fd,
  25973. "Yatcyrillic",
  25974. 0x0462,
  25975. "Ycircle",
  25976. 0x24ce,
  25977. "Ycircumflex",
  25978. 0x0176,
  25979. "Ydieresis",
  25980. 0x0178,
  25981. "Ydieresissmall",
  25982. 0xf7ff,
  25983. "Ydotaccent",
  25984. 0x1e8e,
  25985. "Ydotbelow",
  25986. 0x1ef4,
  25987. "Yericyrillic",
  25988. 0x042b,
  25989. "Yerudieresiscyrillic",
  25990. 0x04f8,
  25991. "Ygrave",
  25992. 0x1ef2,
  25993. "Yhook",
  25994. 0x01b3,
  25995. "Yhookabove",
  25996. 0x1ef6,
  25997. "Yiarmenian",
  25998. 0x0545,
  25999. "Yicyrillic",
  26000. 0x0407,
  26001. "Yiwnarmenian",
  26002. 0x0552,
  26003. "Ymonospace",
  26004. 0xff39,
  26005. "Ysmall",
  26006. 0xf779,
  26007. "Ytilde",
  26008. 0x1ef8,
  26009. "Yusbigcyrillic",
  26010. 0x046a,
  26011. "Yusbigiotifiedcyrillic",
  26012. 0x046c,
  26013. "Yuslittlecyrillic",
  26014. 0x0466,
  26015. "Yuslittleiotifiedcyrillic",
  26016. 0x0468,
  26017. "Z",
  26018. 0x005a,
  26019. "Zaarmenian",
  26020. 0x0536,
  26021. "Zacute",
  26022. 0x0179,
  26023. "Zcaron",
  26024. 0x017d,
  26025. "Zcaronsmall",
  26026. 0xf6ff,
  26027. "Zcircle",
  26028. 0x24cf,
  26029. "Zcircumflex",
  26030. 0x1e90,
  26031. "Zdot",
  26032. 0x017b,
  26033. "Zdotaccent",
  26034. 0x017b,
  26035. "Zdotbelow",
  26036. 0x1e92,
  26037. "Zecyrillic",
  26038. 0x0417,
  26039. "Zedescendercyrillic",
  26040. 0x0498,
  26041. "Zedieresiscyrillic",
  26042. 0x04de,
  26043. "Zeta",
  26044. 0x0396,
  26045. "Zhearmenian",
  26046. 0x053a,
  26047. "Zhebrevecyrillic",
  26048. 0x04c1,
  26049. "Zhecyrillic",
  26050. 0x0416,
  26051. "Zhedescendercyrillic",
  26052. 0x0496,
  26053. "Zhedieresiscyrillic",
  26054. 0x04dc,
  26055. "Zlinebelow",
  26056. 0x1e94,
  26057. "Zmonospace",
  26058. 0xff3a,
  26059. "Zsmall",
  26060. 0xf77a,
  26061. "Zstroke",
  26062. 0x01b5,
  26063. "a",
  26064. 0x0061,
  26065. "aabengali",
  26066. 0x0986,
  26067. "aacute",
  26068. 0x00e1,
  26069. "aadeva",
  26070. 0x0906,
  26071. "aagujarati",
  26072. 0x0a86,
  26073. "aagurmukhi",
  26074. 0x0a06,
  26075. "aamatragurmukhi",
  26076. 0x0a3e,
  26077. "aarusquare",
  26078. 0x3303,
  26079. "aavowelsignbengali",
  26080. 0x09be,
  26081. "aavowelsigndeva",
  26082. 0x093e,
  26083. "aavowelsigngujarati",
  26084. 0x0abe,
  26085. "abbreviationmarkarmenian",
  26086. 0x055f,
  26087. "abbreviationsigndeva",
  26088. 0x0970,
  26089. "abengali",
  26090. 0x0985,
  26091. "abopomofo",
  26092. 0x311a,
  26093. "abreve",
  26094. 0x0103,
  26095. "abreveacute",
  26096. 0x1eaf,
  26097. "abrevecyrillic",
  26098. 0x04d1,
  26099. "abrevedotbelow",
  26100. 0x1eb7,
  26101. "abrevegrave",
  26102. 0x1eb1,
  26103. "abrevehookabove",
  26104. 0x1eb3,
  26105. "abrevetilde",
  26106. 0x1eb5,
  26107. "acaron",
  26108. 0x01ce,
  26109. "acircle",
  26110. 0x24d0,
  26111. "acircumflex",
  26112. 0x00e2,
  26113. "acircumflexacute",
  26114. 0x1ea5,
  26115. "acircumflexdotbelow",
  26116. 0x1ead,
  26117. "acircumflexgrave",
  26118. 0x1ea7,
  26119. "acircumflexhookabove",
  26120. 0x1ea9,
  26121. "acircumflextilde",
  26122. 0x1eab,
  26123. "acute",
  26124. 0x00b4,
  26125. "acutebelowcmb",
  26126. 0x0317,
  26127. "acutecmb",
  26128. 0x0301,
  26129. "acutecomb",
  26130. 0x0301,
  26131. "acutedeva",
  26132. 0x0954,
  26133. "acutelowmod",
  26134. 0x02cf,
  26135. "acutetonecmb",
  26136. 0x0341,
  26137. "acyrillic",
  26138. 0x0430,
  26139. "adblgrave",
  26140. 0x0201,
  26141. "addakgurmukhi",
  26142. 0x0a71,
  26143. "adeva",
  26144. 0x0905,
  26145. "adieresis",
  26146. 0x00e4,
  26147. "adieresiscyrillic",
  26148. 0x04d3,
  26149. "adieresismacron",
  26150. 0x01df,
  26151. "adotbelow",
  26152. 0x1ea1,
  26153. "adotmacron",
  26154. 0x01e1,
  26155. "ae",
  26156. 0x00e6,
  26157. "aeacute",
  26158. 0x01fd,
  26159. "aekorean",
  26160. 0x3150,
  26161. "aemacron",
  26162. 0x01e3,
  26163. "afii00208",
  26164. 0x2015,
  26165. "afii08941",
  26166. 0x20a4,
  26167. "afii10017",
  26168. 0x0410,
  26169. "afii10018",
  26170. 0x0411,
  26171. "afii10019",
  26172. 0x0412,
  26173. "afii10020",
  26174. 0x0413,
  26175. "afii10021",
  26176. 0x0414,
  26177. "afii10022",
  26178. 0x0415,
  26179. "afii10023",
  26180. 0x0401,
  26181. "afii10024",
  26182. 0x0416,
  26183. "afii10025",
  26184. 0x0417,
  26185. "afii10026",
  26186. 0x0418,
  26187. "afii10027",
  26188. 0x0419,
  26189. "afii10028",
  26190. 0x041a,
  26191. "afii10029",
  26192. 0x041b,
  26193. "afii10030",
  26194. 0x041c,
  26195. "afii10031",
  26196. 0x041d,
  26197. "afii10032",
  26198. 0x041e,
  26199. "afii10033",
  26200. 0x041f,
  26201. "afii10034",
  26202. 0x0420,
  26203. "afii10035",
  26204. 0x0421,
  26205. "afii10036",
  26206. 0x0422,
  26207. "afii10037",
  26208. 0x0423,
  26209. "afii10038",
  26210. 0x0424,
  26211. "afii10039",
  26212. 0x0425,
  26213. "afii10040",
  26214. 0x0426,
  26215. "afii10041",
  26216. 0x0427,
  26217. "afii10042",
  26218. 0x0428,
  26219. "afii10043",
  26220. 0x0429,
  26221. "afii10044",
  26222. 0x042a,
  26223. "afii10045",
  26224. 0x042b,
  26225. "afii10046",
  26226. 0x042c,
  26227. "afii10047",
  26228. 0x042d,
  26229. "afii10048",
  26230. 0x042e,
  26231. "afii10049",
  26232. 0x042f,
  26233. "afii10050",
  26234. 0x0490,
  26235. "afii10051",
  26236. 0x0402,
  26237. "afii10052",
  26238. 0x0403,
  26239. "afii10053",
  26240. 0x0404,
  26241. "afii10054",
  26242. 0x0405,
  26243. "afii10055",
  26244. 0x0406,
  26245. "afii10056",
  26246. 0x0407,
  26247. "afii10057",
  26248. 0x0408,
  26249. "afii10058",
  26250. 0x0409,
  26251. "afii10059",
  26252. 0x040a,
  26253. "afii10060",
  26254. 0x040b,
  26255. "afii10061",
  26256. 0x040c,
  26257. "afii10062",
  26258. 0x040e,
  26259. "afii10063",
  26260. 0xf6c4,
  26261. "afii10064",
  26262. 0xf6c5,
  26263. "afii10065",
  26264. 0x0430,
  26265. "afii10066",
  26266. 0x0431,
  26267. "afii10067",
  26268. 0x0432,
  26269. "afii10068",
  26270. 0x0433,
  26271. "afii10069",
  26272. 0x0434,
  26273. "afii10070",
  26274. 0x0435,
  26275. "afii10071",
  26276. 0x0451,
  26277. "afii10072",
  26278. 0x0436,
  26279. "afii10073",
  26280. 0x0437,
  26281. "afii10074",
  26282. 0x0438,
  26283. "afii10075",
  26284. 0x0439,
  26285. "afii10076",
  26286. 0x043a,
  26287. "afii10077",
  26288. 0x043b,
  26289. "afii10078",
  26290. 0x043c,
  26291. "afii10079",
  26292. 0x043d,
  26293. "afii10080",
  26294. 0x043e,
  26295. "afii10081",
  26296. 0x043f,
  26297. "afii10082",
  26298. 0x0440,
  26299. "afii10083",
  26300. 0x0441,
  26301. "afii10084",
  26302. 0x0442,
  26303. "afii10085",
  26304. 0x0443,
  26305. "afii10086",
  26306. 0x0444,
  26307. "afii10087",
  26308. 0x0445,
  26309. "afii10088",
  26310. 0x0446,
  26311. "afii10089",
  26312. 0x0447,
  26313. "afii10090",
  26314. 0x0448,
  26315. "afii10091",
  26316. 0x0449,
  26317. "afii10092",
  26318. 0x044a,
  26319. "afii10093",
  26320. 0x044b,
  26321. "afii10094",
  26322. 0x044c,
  26323. "afii10095",
  26324. 0x044d,
  26325. "afii10096",
  26326. 0x044e,
  26327. "afii10097",
  26328. 0x044f,
  26329. "afii10098",
  26330. 0x0491,
  26331. "afii10099",
  26332. 0x0452,
  26333. "afii10100",
  26334. 0x0453,
  26335. "afii10101",
  26336. 0x0454,
  26337. "afii10102",
  26338. 0x0455,
  26339. "afii10103",
  26340. 0x0456,
  26341. "afii10104",
  26342. 0x0457,
  26343. "afii10105",
  26344. 0x0458,
  26345. "afii10106",
  26346. 0x0459,
  26347. "afii10107",
  26348. 0x045a,
  26349. "afii10108",
  26350. 0x045b,
  26351. "afii10109",
  26352. 0x045c,
  26353. "afii10110",
  26354. 0x045e,
  26355. "afii10145",
  26356. 0x040f,
  26357. "afii10146",
  26358. 0x0462,
  26359. "afii10147",
  26360. 0x0472,
  26361. "afii10148",
  26362. 0x0474,
  26363. "afii10192",
  26364. 0xf6c6,
  26365. "afii10193",
  26366. 0x045f,
  26367. "afii10194",
  26368. 0x0463,
  26369. "afii10195",
  26370. 0x0473,
  26371. "afii10196",
  26372. 0x0475,
  26373. "afii10831",
  26374. 0xf6c7,
  26375. "afii10832",
  26376. 0xf6c8,
  26377. "afii10846",
  26378. 0x04d9,
  26379. "afii299",
  26380. 0x200e,
  26381. "afii300",
  26382. 0x200f,
  26383. "afii301",
  26384. 0x200d,
  26385. "afii57381",
  26386. 0x066a,
  26387. "afii57388",
  26388. 0x060c,
  26389. "afii57392",
  26390. 0x0660,
  26391. "afii57393",
  26392. 0x0661,
  26393. "afii57394",
  26394. 0x0662,
  26395. "afii57395",
  26396. 0x0663,
  26397. "afii57396",
  26398. 0x0664,
  26399. "afii57397",
  26400. 0x0665,
  26401. "afii57398",
  26402. 0x0666,
  26403. "afii57399",
  26404. 0x0667,
  26405. "afii57400",
  26406. 0x0668,
  26407. "afii57401",
  26408. 0x0669,
  26409. "afii57403",
  26410. 0x061b,
  26411. "afii57407",
  26412. 0x061f,
  26413. "afii57409",
  26414. 0x0621,
  26415. "afii57410",
  26416. 0x0622,
  26417. "afii57411",
  26418. 0x0623,
  26419. "afii57412",
  26420. 0x0624,
  26421. "afii57413",
  26422. 0x0625,
  26423. "afii57414",
  26424. 0x0626,
  26425. "afii57415",
  26426. 0x0627,
  26427. "afii57416",
  26428. 0x0628,
  26429. "afii57417",
  26430. 0x0629,
  26431. "afii57418",
  26432. 0x062a,
  26433. "afii57419",
  26434. 0x062b,
  26435. "afii57420",
  26436. 0x062c,
  26437. "afii57421",
  26438. 0x062d,
  26439. "afii57422",
  26440. 0x062e,
  26441. "afii57423",
  26442. 0x062f,
  26443. "afii57424",
  26444. 0x0630,
  26445. "afii57425",
  26446. 0x0631,
  26447. "afii57426",
  26448. 0x0632,
  26449. "afii57427",
  26450. 0x0633,
  26451. "afii57428",
  26452. 0x0634,
  26453. "afii57429",
  26454. 0x0635,
  26455. "afii57430",
  26456. 0x0636,
  26457. "afii57431",
  26458. 0x0637,
  26459. "afii57432",
  26460. 0x0638,
  26461. "afii57433",
  26462. 0x0639,
  26463. "afii57434",
  26464. 0x063a,
  26465. "afii57440",
  26466. 0x0640,
  26467. "afii57441",
  26468. 0x0641,
  26469. "afii57442",
  26470. 0x0642,
  26471. "afii57443",
  26472. 0x0643,
  26473. "afii57444",
  26474. 0x0644,
  26475. "afii57445",
  26476. 0x0645,
  26477. "afii57446",
  26478. 0x0646,
  26479. "afii57448",
  26480. 0x0648,
  26481. "afii57449",
  26482. 0x0649,
  26483. "afii57450",
  26484. 0x064a,
  26485. "afii57451",
  26486. 0x064b,
  26487. "afii57452",
  26488. 0x064c,
  26489. "afii57453",
  26490. 0x064d,
  26491. "afii57454",
  26492. 0x064e,
  26493. "afii57455",
  26494. 0x064f,
  26495. "afii57456",
  26496. 0x0650,
  26497. "afii57457",
  26498. 0x0651,
  26499. "afii57458",
  26500. 0x0652,
  26501. "afii57470",
  26502. 0x0647,
  26503. "afii57505",
  26504. 0x06a4,
  26505. "afii57506",
  26506. 0x067e,
  26507. "afii57507",
  26508. 0x0686,
  26509. "afii57508",
  26510. 0x0698,
  26511. "afii57509",
  26512. 0x06af,
  26513. "afii57511",
  26514. 0x0679,
  26515. "afii57512",
  26516. 0x0688,
  26517. "afii57513",
  26518. 0x0691,
  26519. "afii57514",
  26520. 0x06ba,
  26521. "afii57519",
  26522. 0x06d2,
  26523. "afii57534",
  26524. 0x06d5,
  26525. "afii57636",
  26526. 0x20aa,
  26527. "afii57645",
  26528. 0x05be,
  26529. "afii57658",
  26530. 0x05c3,
  26531. "afii57664",
  26532. 0x05d0,
  26533. "afii57665",
  26534. 0x05d1,
  26535. "afii57666",
  26536. 0x05d2,
  26537. "afii57667",
  26538. 0x05d3,
  26539. "afii57668",
  26540. 0x05d4,
  26541. "afii57669",
  26542. 0x05d5,
  26543. "afii57670",
  26544. 0x05d6,
  26545. "afii57671",
  26546. 0x05d7,
  26547. "afii57672",
  26548. 0x05d8,
  26549. "afii57673",
  26550. 0x05d9,
  26551. "afii57674",
  26552. 0x05da,
  26553. "afii57675",
  26554. 0x05db,
  26555. "afii57676",
  26556. 0x05dc,
  26557. "afii57677",
  26558. 0x05dd,
  26559. "afii57678",
  26560. 0x05de,
  26561. "afii57679",
  26562. 0x05df,
  26563. "afii57680",
  26564. 0x05e0,
  26565. "afii57681",
  26566. 0x05e1,
  26567. "afii57682",
  26568. 0x05e2,
  26569. "afii57683",
  26570. 0x05e3,
  26571. "afii57684",
  26572. 0x05e4,
  26573. "afii57685",
  26574. 0x05e5,
  26575. "afii57686",
  26576. 0x05e6,
  26577. "afii57687",
  26578. 0x05e7,
  26579. "afii57688",
  26580. 0x05e8,
  26581. "afii57689",
  26582. 0x05e9,
  26583. "afii57690",
  26584. 0x05ea,
  26585. "afii57694",
  26586. 0xfb2a,
  26587. "afii57695",
  26588. 0xfb2b,
  26589. "afii57700",
  26590. 0xfb4b,
  26591. "afii57705",
  26592. 0xfb1f,
  26593. "afii57716",
  26594. 0x05f0,
  26595. "afii57717",
  26596. 0x05f1,
  26597. "afii57718",
  26598. 0x05f2,
  26599. "afii57723",
  26600. 0xfb35,
  26601. "afii57793",
  26602. 0x05b4,
  26603. "afii57794",
  26604. 0x05b5,
  26605. "afii57795",
  26606. 0x05b6,
  26607. "afii57796",
  26608. 0x05bb,
  26609. "afii57797",
  26610. 0x05b8,
  26611. "afii57798",
  26612. 0x05b7,
  26613. "afii57799",
  26614. 0x05b0,
  26615. "afii57800",
  26616. 0x05b2,
  26617. "afii57801",
  26618. 0x05b1,
  26619. "afii57802",
  26620. 0x05b3,
  26621. "afii57803",
  26622. 0x05c2,
  26623. "afii57804",
  26624. 0x05c1,
  26625. "afii57806",
  26626. 0x05b9,
  26627. "afii57807",
  26628. 0x05bc,
  26629. "afii57839",
  26630. 0x05bd,
  26631. "afii57841",
  26632. 0x05bf,
  26633. "afii57842",
  26634. 0x05c0,
  26635. "afii57929",
  26636. 0x02bc,
  26637. "afii61248",
  26638. 0x2105,
  26639. "afii61289",
  26640. 0x2113,
  26641. "afii61352",
  26642. 0x2116,
  26643. "afii61573",
  26644. 0x202c,
  26645. "afii61574",
  26646. 0x202d,
  26647. "afii61575",
  26648. 0x202e,
  26649. "afii61664",
  26650. 0x200c,
  26651. "afii63167",
  26652. 0x066d,
  26653. "afii64937",
  26654. 0x02bd,
  26655. "agrave",
  26656. 0x00e0,
  26657. "agujarati",
  26658. 0x0a85,
  26659. "agurmukhi",
  26660. 0x0a05,
  26661. "ahiragana",
  26662. 0x3042,
  26663. "ahookabove",
  26664. 0x1ea3,
  26665. "aibengali",
  26666. 0x0990,
  26667. "aibopomofo",
  26668. 0x311e,
  26669. "aideva",
  26670. 0x0910,
  26671. "aiecyrillic",
  26672. 0x04d5,
  26673. "aigujarati",
  26674. 0x0a90,
  26675. "aigurmukhi",
  26676. 0x0a10,
  26677. "aimatragurmukhi",
  26678. 0x0a48,
  26679. "ainarabic",
  26680. 0x0639,
  26681. "ainfinalarabic",
  26682. 0xfeca,
  26683. "aininitialarabic",
  26684. 0xfecb,
  26685. "ainmedialarabic",
  26686. 0xfecc,
  26687. "ainvertedbreve",
  26688. 0x0203,
  26689. "aivowelsignbengali",
  26690. 0x09c8,
  26691. "aivowelsigndeva",
  26692. 0x0948,
  26693. "aivowelsigngujarati",
  26694. 0x0ac8,
  26695. "akatakana",
  26696. 0x30a2,
  26697. "akatakanahalfwidth",
  26698. 0xff71,
  26699. "akorean",
  26700. 0x314f,
  26701. "alef",
  26702. 0x05d0,
  26703. "alefarabic",
  26704. 0x0627,
  26705. "alefdageshhebrew",
  26706. 0xfb30,
  26707. "aleffinalarabic",
  26708. 0xfe8e,
  26709. "alefhamzaabovearabic",
  26710. 0x0623,
  26711. "alefhamzaabovefinalarabic",
  26712. 0xfe84,
  26713. "alefhamzabelowarabic",
  26714. 0x0625,
  26715. "alefhamzabelowfinalarabic",
  26716. 0xfe88,
  26717. "alefhebrew",
  26718. 0x05d0,
  26719. "aleflamedhebrew",
  26720. 0xfb4f,
  26721. "alefmaddaabovearabic",
  26722. 0x0622,
  26723. "alefmaddaabovefinalarabic",
  26724. 0xfe82,
  26725. "alefmaksuraarabic",
  26726. 0x0649,
  26727. "alefmaksurafinalarabic",
  26728. 0xfef0,
  26729. "alefmaksurainitialarabic",
  26730. 0xfef3,
  26731. "alefmaksuramedialarabic",
  26732. 0xfef4,
  26733. "alefpatahhebrew",
  26734. 0xfb2e,
  26735. "alefqamatshebrew",
  26736. 0xfb2f,
  26737. "aleph",
  26738. 0x2135,
  26739. "allequal",
  26740. 0x224c,
  26741. "alpha",
  26742. 0x03b1,
  26743. "alphatonos",
  26744. 0x03ac,
  26745. "amacron",
  26746. 0x0101,
  26747. "amonospace",
  26748. 0xff41,
  26749. "ampersand",
  26750. 0x0026,
  26751. "ampersandmonospace",
  26752. 0xff06,
  26753. "ampersandsmall",
  26754. 0xf726,
  26755. "amsquare",
  26756. 0x33c2,
  26757. "anbopomofo",
  26758. 0x3122,
  26759. "angbopomofo",
  26760. 0x3124,
  26761. "angbracketleft",
  26762. 0x3008,
  26763. "angbracketright",
  26764. 0x3009,
  26765. "angkhankhuthai",
  26766. 0x0e5a,
  26767. "angle",
  26768. 0x2220,
  26769. "anglebracketleft",
  26770. 0x3008,
  26771. "anglebracketleftvertical",
  26772. 0xfe3f,
  26773. "anglebracketright",
  26774. 0x3009,
  26775. "anglebracketrightvertical",
  26776. 0xfe40,
  26777. "angleleft",
  26778. 0x2329,
  26779. "angleright",
  26780. 0x232a,
  26781. "angstrom",
  26782. 0x212b,
  26783. "anoteleia",
  26784. 0x0387,
  26785. "anudattadeva",
  26786. 0x0952,
  26787. "anusvarabengali",
  26788. 0x0982,
  26789. "anusvaradeva",
  26790. 0x0902,
  26791. "anusvaragujarati",
  26792. 0x0a82,
  26793. "aogonek",
  26794. 0x0105,
  26795. "apaatosquare",
  26796. 0x3300,
  26797. "aparen",
  26798. 0x249c,
  26799. "apostrophearmenian",
  26800. 0x055a,
  26801. "apostrophemod",
  26802. 0x02bc,
  26803. "apple",
  26804. 0xf8ff,
  26805. "approaches",
  26806. 0x2250,
  26807. "approxequal",
  26808. 0x2248,
  26809. "approxequalorimage",
  26810. 0x2252,
  26811. "approximatelyequal",
  26812. 0x2245,
  26813. "araeaekorean",
  26814. 0x318e,
  26815. "araeakorean",
  26816. 0x318d,
  26817. "arc",
  26818. 0x2312,
  26819. "arighthalfring",
  26820. 0x1e9a,
  26821. "aring",
  26822. 0x00e5,
  26823. "aringacute",
  26824. 0x01fb,
  26825. "aringbelow",
  26826. 0x1e01,
  26827. "arrowboth",
  26828. 0x2194,
  26829. "arrowdashdown",
  26830. 0x21e3,
  26831. "arrowdashleft",
  26832. 0x21e0,
  26833. "arrowdashright",
  26834. 0x21e2,
  26835. "arrowdashup",
  26836. 0x21e1,
  26837. "arrowdblboth",
  26838. 0x21d4,
  26839. "arrowdbldown",
  26840. 0x21d3,
  26841. "arrowdblleft",
  26842. 0x21d0,
  26843. "arrowdblright",
  26844. 0x21d2,
  26845. "arrowdblup",
  26846. 0x21d1,
  26847. "arrowdown",
  26848. 0x2193,
  26849. "arrowdownleft",
  26850. 0x2199,
  26851. "arrowdownright",
  26852. 0x2198,
  26853. "arrowdownwhite",
  26854. 0x21e9,
  26855. "arrowheaddownmod",
  26856. 0x02c5,
  26857. "arrowheadleftmod",
  26858. 0x02c2,
  26859. "arrowheadrightmod",
  26860. 0x02c3,
  26861. "arrowheadupmod",
  26862. 0x02c4,
  26863. "arrowhorizex",
  26864. 0xf8e7,
  26865. "arrowleft",
  26866. 0x2190,
  26867. "arrowleftdbl",
  26868. 0x21d0,
  26869. "arrowleftdblstroke",
  26870. 0x21cd,
  26871. "arrowleftoverright",
  26872. 0x21c6,
  26873. "arrowleftwhite",
  26874. 0x21e6,
  26875. "arrowright",
  26876. 0x2192,
  26877. "arrowrightdblstroke",
  26878. 0x21cf,
  26879. "arrowrightheavy",
  26880. 0x279e,
  26881. "arrowrightoverleft",
  26882. 0x21c4,
  26883. "arrowrightwhite",
  26884. 0x21e8,
  26885. "arrowtableft",
  26886. 0x21e4,
  26887. "arrowtabright",
  26888. 0x21e5,
  26889. "arrowup",
  26890. 0x2191,
  26891. "arrowupdn",
  26892. 0x2195,
  26893. "arrowupdnbse",
  26894. 0x21a8,
  26895. "arrowupdownbase",
  26896. 0x21a8,
  26897. "arrowupleft",
  26898. 0x2196,
  26899. "arrowupleftofdown",
  26900. 0x21c5,
  26901. "arrowupright",
  26902. 0x2197,
  26903. "arrowupwhite",
  26904. 0x21e7,
  26905. "arrowvertex",
  26906. 0xf8e6,
  26907. "asciicircum",
  26908. 0x005e,
  26909. "asciicircummonospace",
  26910. 0xff3e,
  26911. "asciitilde",
  26912. 0x007e,
  26913. "asciitildemonospace",
  26914. 0xff5e,
  26915. "ascript",
  26916. 0x0251,
  26917. "ascriptturned",
  26918. 0x0252,
  26919. "asmallhiragana",
  26920. 0x3041,
  26921. "asmallkatakana",
  26922. 0x30a1,
  26923. "asmallkatakanahalfwidth",
  26924. 0xff67,
  26925. "asterisk",
  26926. 0x002a,
  26927. "asteriskaltonearabic",
  26928. 0x066d,
  26929. "asteriskarabic",
  26930. 0x066d,
  26931. "asteriskmath",
  26932. 0x2217,
  26933. "asteriskmonospace",
  26934. 0xff0a,
  26935. "asterisksmall",
  26936. 0xfe61,
  26937. "asterism",
  26938. 0x2042,
  26939. "asuperior",
  26940. 0xf6e9,
  26941. "asymptoticallyequal",
  26942. 0x2243,
  26943. "at",
  26944. 0x0040,
  26945. "atilde",
  26946. 0x00e3,
  26947. "atmonospace",
  26948. 0xff20,
  26949. "atsmall",
  26950. 0xfe6b,
  26951. "aturned",
  26952. 0x0250,
  26953. "aubengali",
  26954. 0x0994,
  26955. "aubopomofo",
  26956. 0x3120,
  26957. "audeva",
  26958. 0x0914,
  26959. "augujarati",
  26960. 0x0a94,
  26961. "augurmukhi",
  26962. 0x0a14,
  26963. "aulengthmarkbengali",
  26964. 0x09d7,
  26965. "aumatragurmukhi",
  26966. 0x0a4c,
  26967. "auvowelsignbengali",
  26968. 0x09cc,
  26969. "auvowelsigndeva",
  26970. 0x094c,
  26971. "auvowelsigngujarati",
  26972. 0x0acc,
  26973. "avagrahadeva",
  26974. 0x093d,
  26975. "aybarmenian",
  26976. 0x0561,
  26977. "ayin",
  26978. 0x05e2,
  26979. "ayinaltonehebrew",
  26980. 0xfb20,
  26981. "ayinhebrew",
  26982. 0x05e2,
  26983. "b",
  26984. 0x0062,
  26985. "babengali",
  26986. 0x09ac,
  26987. "backslash",
  26988. 0x005c,
  26989. "backslashmonospace",
  26990. 0xff3c,
  26991. "badeva",
  26992. 0x092c,
  26993. "bagujarati",
  26994. 0x0aac,
  26995. "bagurmukhi",
  26996. 0x0a2c,
  26997. "bahiragana",
  26998. 0x3070,
  26999. "bahtthai",
  27000. 0x0e3f,
  27001. "bakatakana",
  27002. 0x30d0,
  27003. "bar",
  27004. 0x007c,
  27005. "barmonospace",
  27006. 0xff5c,
  27007. "bbopomofo",
  27008. 0x3105,
  27009. "bcircle",
  27010. 0x24d1,
  27011. "bdotaccent",
  27012. 0x1e03,
  27013. "bdotbelow",
  27014. 0x1e05,
  27015. "beamedsixteenthnotes",
  27016. 0x266c,
  27017. "because",
  27018. 0x2235,
  27019. "becyrillic",
  27020. 0x0431,
  27021. "beharabic",
  27022. 0x0628,
  27023. "behfinalarabic",
  27024. 0xfe90,
  27025. "behinitialarabic",
  27026. 0xfe91,
  27027. "behiragana",
  27028. 0x3079,
  27029. "behmedialarabic",
  27030. 0xfe92,
  27031. "behmeeminitialarabic",
  27032. 0xfc9f,
  27033. "behmeemisolatedarabic",
  27034. 0xfc08,
  27035. "behnoonfinalarabic",
  27036. 0xfc6d,
  27037. "bekatakana",
  27038. 0x30d9,
  27039. "benarmenian",
  27040. 0x0562,
  27041. "bet",
  27042. 0x05d1,
  27043. "beta",
  27044. 0x03b2,
  27045. "betasymbolgreek",
  27046. 0x03d0,
  27047. "betdagesh",
  27048. 0xfb31,
  27049. "betdageshhebrew",
  27050. 0xfb31,
  27051. "bethebrew",
  27052. 0x05d1,
  27053. "betrafehebrew",
  27054. 0xfb4c,
  27055. "bhabengali",
  27056. 0x09ad,
  27057. "bhadeva",
  27058. 0x092d,
  27059. "bhagujarati",
  27060. 0x0aad,
  27061. "bhagurmukhi",
  27062. 0x0a2d,
  27063. "bhook",
  27064. 0x0253,
  27065. "bihiragana",
  27066. 0x3073,
  27067. "bikatakana",
  27068. 0x30d3,
  27069. "bilabialclick",
  27070. 0x0298,
  27071. "bindigurmukhi",
  27072. 0x0a02,
  27073. "birusquare",
  27074. 0x3331,
  27075. "blackcircle",
  27076. 0x25cf,
  27077. "blackdiamond",
  27078. 0x25c6,
  27079. "blackdownpointingtriangle",
  27080. 0x25bc,
  27081. "blackleftpointingpointer",
  27082. 0x25c4,
  27083. "blackleftpointingtriangle",
  27084. 0x25c0,
  27085. "blacklenticularbracketleft",
  27086. 0x3010,
  27087. "blacklenticularbracketleftvertical",
  27088. 0xfe3b,
  27089. "blacklenticularbracketright",
  27090. 0x3011,
  27091. "blacklenticularbracketrightvertical",
  27092. 0xfe3c,
  27093. "blacklowerlefttriangle",
  27094. 0x25e3,
  27095. "blacklowerrighttriangle",
  27096. 0x25e2,
  27097. "blackrectangle",
  27098. 0x25ac,
  27099. "blackrightpointingpointer",
  27100. 0x25ba,
  27101. "blackrightpointingtriangle",
  27102. 0x25b6,
  27103. "blacksmallsquare",
  27104. 0x25aa,
  27105. "blacksmilingface",
  27106. 0x263b,
  27107. "blacksquare",
  27108. 0x25a0,
  27109. "blackstar",
  27110. 0x2605,
  27111. "blackupperlefttriangle",
  27112. 0x25e4,
  27113. "blackupperrighttriangle",
  27114. 0x25e5,
  27115. "blackuppointingsmalltriangle",
  27116. 0x25b4,
  27117. "blackuppointingtriangle",
  27118. 0x25b2,
  27119. "blank",
  27120. 0x2423,
  27121. "blinebelow",
  27122. 0x1e07,
  27123. "block",
  27124. 0x2588,
  27125. "bmonospace",
  27126. 0xff42,
  27127. "bobaimaithai",
  27128. 0x0e1a,
  27129. "bohiragana",
  27130. 0x307c,
  27131. "bokatakana",
  27132. 0x30dc,
  27133. "bparen",
  27134. 0x249d,
  27135. "bqsquare",
  27136. 0x33c3,
  27137. "braceex",
  27138. 0xf8f4,
  27139. "braceleft",
  27140. 0x007b,
  27141. "braceleftbt",
  27142. 0xf8f3,
  27143. "braceleftmid",
  27144. 0xf8f2,
  27145. "braceleftmonospace",
  27146. 0xff5b,
  27147. "braceleftsmall",
  27148. 0xfe5b,
  27149. "bracelefttp",
  27150. 0xf8f1,
  27151. "braceleftvertical",
  27152. 0xfe37,
  27153. "braceright",
  27154. 0x007d,
  27155. "bracerightbt",
  27156. 0xf8fe,
  27157. "bracerightmid",
  27158. 0xf8fd,
  27159. "bracerightmonospace",
  27160. 0xff5d,
  27161. "bracerightsmall",
  27162. 0xfe5c,
  27163. "bracerighttp",
  27164. 0xf8fc,
  27165. "bracerightvertical",
  27166. 0xfe38,
  27167. "bracketleft",
  27168. 0x005b,
  27169. "bracketleftbt",
  27170. 0xf8f0,
  27171. "bracketleftex",
  27172. 0xf8ef,
  27173. "bracketleftmonospace",
  27174. 0xff3b,
  27175. "bracketlefttp",
  27176. 0xf8ee,
  27177. "bracketright",
  27178. 0x005d,
  27179. "bracketrightbt",
  27180. 0xf8fb,
  27181. "bracketrightex",
  27182. 0xf8fa,
  27183. "bracketrightmonospace",
  27184. 0xff3d,
  27185. "bracketrighttp",
  27186. 0xf8f9,
  27187. "breve",
  27188. 0x02d8,
  27189. "brevebelowcmb",
  27190. 0x032e,
  27191. "brevecmb",
  27192. 0x0306,
  27193. "breveinvertedbelowcmb",
  27194. 0x032f,
  27195. "breveinvertedcmb",
  27196. 0x0311,
  27197. "breveinverteddoublecmb",
  27198. 0x0361,
  27199. "bridgebelowcmb",
  27200. 0x032a,
  27201. "bridgeinvertedbelowcmb",
  27202. 0x033a,
  27203. "brokenbar",
  27204. 0x00a6,
  27205. "bstroke",
  27206. 0x0180,
  27207. "bsuperior",
  27208. 0xf6ea,
  27209. "btopbar",
  27210. 0x0183,
  27211. "buhiragana",
  27212. 0x3076,
  27213. "bukatakana",
  27214. 0x30d6,
  27215. "bullet",
  27216. 0x2022,
  27217. "bulletinverse",
  27218. 0x25d8,
  27219. "bulletoperator",
  27220. 0x2219,
  27221. "bullseye",
  27222. 0x25ce,
  27223. "c",
  27224. 0x0063,
  27225. "caarmenian",
  27226. 0x056e,
  27227. "cabengali",
  27228. 0x099a,
  27229. "cacute",
  27230. 0x0107,
  27231. "cadeva",
  27232. 0x091a,
  27233. "cagujarati",
  27234. 0x0a9a,
  27235. "cagurmukhi",
  27236. 0x0a1a,
  27237. "calsquare",
  27238. 0x3388,
  27239. "candrabindubengali",
  27240. 0x0981,
  27241. "candrabinducmb",
  27242. 0x0310,
  27243. "candrabindudeva",
  27244. 0x0901,
  27245. "candrabindugujarati",
  27246. 0x0a81,
  27247. "capslock",
  27248. 0x21ea,
  27249. "careof",
  27250. 0x2105,
  27251. "caron",
  27252. 0x02c7,
  27253. "caronbelowcmb",
  27254. 0x032c,
  27255. "caroncmb",
  27256. 0x030c,
  27257. "carriagereturn",
  27258. 0x21b5,
  27259. "cbopomofo",
  27260. 0x3118,
  27261. "ccaron",
  27262. 0x010d,
  27263. "ccedilla",
  27264. 0x00e7,
  27265. "ccedillaacute",
  27266. 0x1e09,
  27267. "ccircle",
  27268. 0x24d2,
  27269. "ccircumflex",
  27270. 0x0109,
  27271. "ccurl",
  27272. 0x0255,
  27273. "cdot",
  27274. 0x010b,
  27275. "cdotaccent",
  27276. 0x010b,
  27277. "cdsquare",
  27278. 0x33c5,
  27279. "cedilla",
  27280. 0x00b8,
  27281. "cedillacmb",
  27282. 0x0327,
  27283. "cent",
  27284. 0x00a2,
  27285. "centigrade",
  27286. 0x2103,
  27287. "centinferior",
  27288. 0xf6df,
  27289. "centmonospace",
  27290. 0xffe0,
  27291. "centoldstyle",
  27292. 0xf7a2,
  27293. "centsuperior",
  27294. 0xf6e0,
  27295. "chaarmenian",
  27296. 0x0579,
  27297. "chabengali",
  27298. 0x099b,
  27299. "chadeva",
  27300. 0x091b,
  27301. "chagujarati",
  27302. 0x0a9b,
  27303. "chagurmukhi",
  27304. 0x0a1b,
  27305. "chbopomofo",
  27306. 0x3114,
  27307. "cheabkhasiancyrillic",
  27308. 0x04bd,
  27309. "checkmark",
  27310. 0x2713,
  27311. "checyrillic",
  27312. 0x0447,
  27313. "chedescenderabkhasiancyrillic",
  27314. 0x04bf,
  27315. "chedescendercyrillic",
  27316. 0x04b7,
  27317. "chedieresiscyrillic",
  27318. 0x04f5,
  27319. "cheharmenian",
  27320. 0x0573,
  27321. "chekhakassiancyrillic",
  27322. 0x04cc,
  27323. "cheverticalstrokecyrillic",
  27324. 0x04b9,
  27325. "chi",
  27326. 0x03c7,
  27327. "chieuchacirclekorean",
  27328. 0x3277,
  27329. "chieuchaparenkorean",
  27330. 0x3217,
  27331. "chieuchcirclekorean",
  27332. 0x3269,
  27333. "chieuchkorean",
  27334. 0x314a,
  27335. "chieuchparenkorean",
  27336. 0x3209,
  27337. "chochangthai",
  27338. 0x0e0a,
  27339. "chochanthai",
  27340. 0x0e08,
  27341. "chochingthai",
  27342. 0x0e09,
  27343. "chochoethai",
  27344. 0x0e0c,
  27345. "chook",
  27346. 0x0188,
  27347. "cieucacirclekorean",
  27348. 0x3276,
  27349. "cieucaparenkorean",
  27350. 0x3216,
  27351. "cieuccirclekorean",
  27352. 0x3268,
  27353. "cieuckorean",
  27354. 0x3148,
  27355. "cieucparenkorean",
  27356. 0x3208,
  27357. "cieucuparenkorean",
  27358. 0x321c,
  27359. "circle",
  27360. 0x25cb,
  27361. "circlecopyrt",
  27362. 0x00a9,
  27363. "circlemultiply",
  27364. 0x2297,
  27365. "circleot",
  27366. 0x2299,
  27367. "circleplus",
  27368. 0x2295,
  27369. "circlepostalmark",
  27370. 0x3036,
  27371. "circlewithlefthalfblack",
  27372. 0x25d0,
  27373. "circlewithrighthalfblack",
  27374. 0x25d1,
  27375. "circumflex",
  27376. 0x02c6,
  27377. "circumflexbelowcmb",
  27378. 0x032d,
  27379. "circumflexcmb",
  27380. 0x0302,
  27381. "clear",
  27382. 0x2327,
  27383. "clickalveolar",
  27384. 0x01c2,
  27385. "clickdental",
  27386. 0x01c0,
  27387. "clicklateral",
  27388. 0x01c1,
  27389. "clickretroflex",
  27390. 0x01c3,
  27391. "club",
  27392. 0x2663,
  27393. "clubsuitblack",
  27394. 0x2663,
  27395. "clubsuitwhite",
  27396. 0x2667,
  27397. "cmcubedsquare",
  27398. 0x33a4,
  27399. "cmonospace",
  27400. 0xff43,
  27401. "cmsquaredsquare",
  27402. 0x33a0,
  27403. "coarmenian",
  27404. 0x0581,
  27405. "colon",
  27406. 0x003a,
  27407. "colonmonetary",
  27408. 0x20a1,
  27409. "colonmonospace",
  27410. 0xff1a,
  27411. "colonsign",
  27412. 0x20a1,
  27413. "colonsmall",
  27414. 0xfe55,
  27415. "colontriangularhalfmod",
  27416. 0x02d1,
  27417. "colontriangularmod",
  27418. 0x02d0,
  27419. "comma",
  27420. 0x002c,
  27421. "commaabovecmb",
  27422. 0x0313,
  27423. "commaaboverightcmb",
  27424. 0x0315,
  27425. "commaaccent",
  27426. 0xf6c3,
  27427. "commaarabic",
  27428. 0x060c,
  27429. "commaarmenian",
  27430. 0x055d,
  27431. "commainferior",
  27432. 0xf6e1,
  27433. "commamonospace",
  27434. 0xff0c,
  27435. "commareversedabovecmb",
  27436. 0x0314,
  27437. "commareversedmod",
  27438. 0x02bd,
  27439. "commasmall",
  27440. 0xfe50,
  27441. "commasuperior",
  27442. 0xf6e2,
  27443. "commaturnedabovecmb",
  27444. 0x0312,
  27445. "commaturnedmod",
  27446. 0x02bb,
  27447. "compass",
  27448. 0x263c,
  27449. "congruent",
  27450. 0x2245,
  27451. "contourintegral",
  27452. 0x222e,
  27453. "control",
  27454. 0x2303,
  27455. "controlACK",
  27456. 0x0006,
  27457. "controlBEL",
  27458. 0x0007,
  27459. "controlBS",
  27460. 0x0008,
  27461. "controlCAN",
  27462. 0x0018,
  27463. "controlCR",
  27464. 0x000d,
  27465. "controlDC1",
  27466. 0x0011,
  27467. "controlDC2",
  27468. 0x0012,
  27469. "controlDC3",
  27470. 0x0013,
  27471. "controlDC4",
  27472. 0x0014,
  27473. "controlDEL",
  27474. 0x007f,
  27475. "controlDLE",
  27476. 0x0010,
  27477. "controlEM",
  27478. 0x0019,
  27479. "controlENQ",
  27480. 0x0005,
  27481. "controlEOT",
  27482. 0x0004,
  27483. "controlESC",
  27484. 0x001b,
  27485. "controlETB",
  27486. 0x0017,
  27487. "controlETX",
  27488. 0x0003,
  27489. "controlFF",
  27490. 0x000c,
  27491. "controlFS",
  27492. 0x001c,
  27493. "controlGS",
  27494. 0x001d,
  27495. "controlHT",
  27496. 0x0009,
  27497. "controlLF",
  27498. 0x000a,
  27499. "controlNAK",
  27500. 0x0015,
  27501. "controlNULL",
  27502. 0x0000,
  27503. "controlRS",
  27504. 0x001e,
  27505. "controlSI",
  27506. 0x000f,
  27507. "controlSO",
  27508. 0x000e,
  27509. "controlSOT",
  27510. 0x0002,
  27511. "controlSTX",
  27512. 0x0001,
  27513. "controlSUB",
  27514. 0x001a,
  27515. "controlSYN",
  27516. 0x0016,
  27517. "controlUS",
  27518. 0x001f,
  27519. "controlVT",
  27520. 0x000b,
  27521. "copyright",
  27522. 0x00a9,
  27523. "copyrightsans",
  27524. 0xf8e9,
  27525. "copyrightserif",
  27526. 0xf6d9,
  27527. "cornerbracketleft",
  27528. 0x300c,
  27529. "cornerbracketlefthalfwidth",
  27530. 0xff62,
  27531. "cornerbracketleftvertical",
  27532. 0xfe41,
  27533. "cornerbracketright",
  27534. 0x300d,
  27535. "cornerbracketrighthalfwidth",
  27536. 0xff63,
  27537. "cornerbracketrightvertical",
  27538. 0xfe42,
  27539. "corporationsquare",
  27540. 0x337f,
  27541. "cosquare",
  27542. 0x33c7,
  27543. "coverkgsquare",
  27544. 0x33c6,
  27545. "cparen",
  27546. 0x249e,
  27547. "cruzeiro",
  27548. 0x20a2,
  27549. "cstretched",
  27550. 0x0297,
  27551. "curlyand",
  27552. 0x22cf,
  27553. "curlyor",
  27554. 0x22ce,
  27555. "currency",
  27556. 0x00a4,
  27557. "cyrBreve",
  27558. 0xf6d1,
  27559. "cyrFlex",
  27560. 0xf6d2,
  27561. "cyrbreve",
  27562. 0xf6d4,
  27563. "cyrflex",
  27564. 0xf6d5,
  27565. "d",
  27566. 0x0064,
  27567. "daarmenian",
  27568. 0x0564,
  27569. "dabengali",
  27570. 0x09a6,
  27571. "dadarabic",
  27572. 0x0636,
  27573. "dadeva",
  27574. 0x0926,
  27575. "dadfinalarabic",
  27576. 0xfebe,
  27577. "dadinitialarabic",
  27578. 0xfebf,
  27579. "dadmedialarabic",
  27580. 0xfec0,
  27581. "dagesh",
  27582. 0x05bc,
  27583. "dageshhebrew",
  27584. 0x05bc,
  27585. "dagger",
  27586. 0x2020,
  27587. "daggerdbl",
  27588. 0x2021,
  27589. "dagujarati",
  27590. 0x0aa6,
  27591. "dagurmukhi",
  27592. 0x0a26,
  27593. "dahiragana",
  27594. 0x3060,
  27595. "dakatakana",
  27596. 0x30c0,
  27597. "dalarabic",
  27598. 0x062f,
  27599. "dalet",
  27600. 0x05d3,
  27601. "daletdagesh",
  27602. 0xfb33,
  27603. "daletdageshhebrew",
  27604. 0xfb33,
  27605. "dalethebrew",
  27606. 0x05d3,
  27607. "dalfinalarabic",
  27608. 0xfeaa,
  27609. "dammaarabic",
  27610. 0x064f,
  27611. "dammalowarabic",
  27612. 0x064f,
  27613. "dammatanaltonearabic",
  27614. 0x064c,
  27615. "dammatanarabic",
  27616. 0x064c,
  27617. "danda",
  27618. 0x0964,
  27619. "dargahebrew",
  27620. 0x05a7,
  27621. "dargalefthebrew",
  27622. 0x05a7,
  27623. "dasiapneumatacyrilliccmb",
  27624. 0x0485,
  27625. "dblGrave",
  27626. 0xf6d3,
  27627. "dblanglebracketleft",
  27628. 0x300a,
  27629. "dblanglebracketleftvertical",
  27630. 0xfe3d,
  27631. "dblanglebracketright",
  27632. 0x300b,
  27633. "dblanglebracketrightvertical",
  27634. 0xfe3e,
  27635. "dblarchinvertedbelowcmb",
  27636. 0x032b,
  27637. "dblarrowleft",
  27638. 0x21d4,
  27639. "dblarrowright",
  27640. 0x21d2,
  27641. "dbldanda",
  27642. 0x0965,
  27643. "dblgrave",
  27644. 0xf6d6,
  27645. "dblgravecmb",
  27646. 0x030f,
  27647. "dblintegral",
  27648. 0x222c,
  27649. "dbllowline",
  27650. 0x2017,
  27651. "dbllowlinecmb",
  27652. 0x0333,
  27653. "dbloverlinecmb",
  27654. 0x033f,
  27655. "dblprimemod",
  27656. 0x02ba,
  27657. "dblverticalbar",
  27658. 0x2016,
  27659. "dblverticallineabovecmb",
  27660. 0x030e,
  27661. "dbopomofo",
  27662. 0x3109,
  27663. "dbsquare",
  27664. 0x33c8,
  27665. "dcaron",
  27666. 0x010f,
  27667. "dcedilla",
  27668. 0x1e11,
  27669. "dcircle",
  27670. 0x24d3,
  27671. "dcircumflexbelow",
  27672. 0x1e13,
  27673. "dcroat",
  27674. 0x0111,
  27675. "ddabengali",
  27676. 0x09a1,
  27677. "ddadeva",
  27678. 0x0921,
  27679. "ddagujarati",
  27680. 0x0aa1,
  27681. "ddagurmukhi",
  27682. 0x0a21,
  27683. "ddalarabic",
  27684. 0x0688,
  27685. "ddalfinalarabic",
  27686. 0xfb89,
  27687. "dddhadeva",
  27688. 0x095c,
  27689. "ddhabengali",
  27690. 0x09a2,
  27691. "ddhadeva",
  27692. 0x0922,
  27693. "ddhagujarati",
  27694. 0x0aa2,
  27695. "ddhagurmukhi",
  27696. 0x0a22,
  27697. "ddotaccent",
  27698. 0x1e0b,
  27699. "ddotbelow",
  27700. 0x1e0d,
  27701. "decimalseparatorarabic",
  27702. 0x066b,
  27703. "decimalseparatorpersian",
  27704. 0x066b,
  27705. "decyrillic",
  27706. 0x0434,
  27707. "degree",
  27708. 0x00b0,
  27709. "dehihebrew",
  27710. 0x05ad,
  27711. "dehiragana",
  27712. 0x3067,
  27713. "deicoptic",
  27714. 0x03ef,
  27715. "dekatakana",
  27716. 0x30c7,
  27717. "deleteleft",
  27718. 0x232b,
  27719. "deleteright",
  27720. 0x2326,
  27721. "delta",
  27722. 0x03b4,
  27723. "deltaturned",
  27724. 0x018d,
  27725. "denominatorminusonenumeratorbengali",
  27726. 0x09f8,
  27727. "dezh",
  27728. 0x02a4,
  27729. "dhabengali",
  27730. 0x09a7,
  27731. "dhadeva",
  27732. 0x0927,
  27733. "dhagujarati",
  27734. 0x0aa7,
  27735. "dhagurmukhi",
  27736. 0x0a27,
  27737. "dhook",
  27738. 0x0257,
  27739. "dialytikatonos",
  27740. 0x0385,
  27741. "dialytikatonoscmb",
  27742. 0x0344,
  27743. "diamond",
  27744. 0x2666,
  27745. "diamondsuitwhite",
  27746. 0x2662,
  27747. "dieresis",
  27748. 0x00a8,
  27749. "dieresisacute",
  27750. 0xf6d7,
  27751. "dieresisbelowcmb",
  27752. 0x0324,
  27753. "dieresiscmb",
  27754. 0x0308,
  27755. "dieresisgrave",
  27756. 0xf6d8,
  27757. "dieresistonos",
  27758. 0x0385,
  27759. "dihiragana",
  27760. 0x3062,
  27761. "dikatakana",
  27762. 0x30c2,
  27763. "dittomark",
  27764. 0x3003,
  27765. "divide",
  27766. 0x00f7,
  27767. "divides",
  27768. 0x2223,
  27769. "divisionslash",
  27770. 0x2215,
  27771. "djecyrillic",
  27772. 0x0452,
  27773. "dkshade",
  27774. 0x2593,
  27775. "dlinebelow",
  27776. 0x1e0f,
  27777. "dlsquare",
  27778. 0x3397,
  27779. "dmacron",
  27780. 0x0111,
  27781. "dmonospace",
  27782. 0xff44,
  27783. "dnblock",
  27784. 0x2584,
  27785. "dochadathai",
  27786. 0x0e0e,
  27787. "dodekthai",
  27788. 0x0e14,
  27789. "dohiragana",
  27790. 0x3069,
  27791. "dokatakana",
  27792. 0x30c9,
  27793. "dollar",
  27794. 0x0024,
  27795. "dollarinferior",
  27796. 0xf6e3,
  27797. "dollarmonospace",
  27798. 0xff04,
  27799. "dollaroldstyle",
  27800. 0xf724,
  27801. "dollarsmall",
  27802. 0xfe69,
  27803. "dollarsuperior",
  27804. 0xf6e4,
  27805. "dong",
  27806. 0x20ab,
  27807. "dorusquare",
  27808. 0x3326,
  27809. "dotaccent",
  27810. 0x02d9,
  27811. "dotaccentcmb",
  27812. 0x0307,
  27813. "dotbelowcmb",
  27814. 0x0323,
  27815. "dotbelowcomb",
  27816. 0x0323,
  27817. "dotkatakana",
  27818. 0x30fb,
  27819. "dotlessi",
  27820. 0x0131,
  27821. "dotlessj",
  27822. 0xf6be,
  27823. "dotlessjstrokehook",
  27824. 0x0284,
  27825. "dotmath",
  27826. 0x22c5,
  27827. "dottedcircle",
  27828. 0x25cc,
  27829. "doubleyodpatah",
  27830. 0xfb1f,
  27831. "doubleyodpatahhebrew",
  27832. 0xfb1f,
  27833. "downtackbelowcmb",
  27834. 0x031e,
  27835. "downtackmod",
  27836. 0x02d5,
  27837. "dparen",
  27838. 0x249f,
  27839. "dsuperior",
  27840. 0xf6eb,
  27841. "dtail",
  27842. 0x0256,
  27843. "dtopbar",
  27844. 0x018c,
  27845. "duhiragana",
  27846. 0x3065,
  27847. "dukatakana",
  27848. 0x30c5,
  27849. "dz",
  27850. 0x01f3,
  27851. "dzaltone",
  27852. 0x02a3,
  27853. "dzcaron",
  27854. 0x01c6,
  27855. "dzcurl",
  27856. 0x02a5,
  27857. "dzeabkhasiancyrillic",
  27858. 0x04e1,
  27859. "dzecyrillic",
  27860. 0x0455,
  27861. "dzhecyrillic",
  27862. 0x045f,
  27863. "e",
  27864. 0x0065,
  27865. "eacute",
  27866. 0x00e9,
  27867. "earth",
  27868. 0x2641,
  27869. "ebengali",
  27870. 0x098f,
  27871. "ebopomofo",
  27872. 0x311c,
  27873. "ebreve",
  27874. 0x0115,
  27875. "ecandradeva",
  27876. 0x090d,
  27877. "ecandragujarati",
  27878. 0x0a8d,
  27879. "ecandravowelsigndeva",
  27880. 0x0945,
  27881. "ecandravowelsigngujarati",
  27882. 0x0ac5,
  27883. "ecaron",
  27884. 0x011b,
  27885. "ecedillabreve",
  27886. 0x1e1d,
  27887. "echarmenian",
  27888. 0x0565,
  27889. "echyiwnarmenian",
  27890. 0x0587,
  27891. "ecircle",
  27892. 0x24d4,
  27893. "ecircumflex",
  27894. 0x00ea,
  27895. "ecircumflexacute",
  27896. 0x1ebf,
  27897. "ecircumflexbelow",
  27898. 0x1e19,
  27899. "ecircumflexdotbelow",
  27900. 0x1ec7,
  27901. "ecircumflexgrave",
  27902. 0x1ec1,
  27903. "ecircumflexhookabove",
  27904. 0x1ec3,
  27905. "ecircumflextilde",
  27906. 0x1ec5,
  27907. "ecyrillic",
  27908. 0x0454,
  27909. "edblgrave",
  27910. 0x0205,
  27911. "edeva",
  27912. 0x090f,
  27913. "edieresis",
  27914. 0x00eb,
  27915. "edot",
  27916. 0x0117,
  27917. "edotaccent",
  27918. 0x0117,
  27919. "edotbelow",
  27920. 0x1eb9,
  27921. "eegurmukhi",
  27922. 0x0a0f,
  27923. "eematragurmukhi",
  27924. 0x0a47,
  27925. "efcyrillic",
  27926. 0x0444,
  27927. "egrave",
  27928. 0x00e8,
  27929. "egujarati",
  27930. 0x0a8f,
  27931. "eharmenian",
  27932. 0x0567,
  27933. "ehbopomofo",
  27934. 0x311d,
  27935. "ehiragana",
  27936. 0x3048,
  27937. "ehookabove",
  27938. 0x1ebb,
  27939. "eibopomofo",
  27940. 0x311f,
  27941. "eight",
  27942. 0x0038,
  27943. "eightarabic",
  27944. 0x0668,
  27945. "eightbengali",
  27946. 0x09ee,
  27947. "eightcircle",
  27948. 0x2467,
  27949. "eightcircleinversesansserif",
  27950. 0x2791,
  27951. "eightdeva",
  27952. 0x096e,
  27953. "eighteencircle",
  27954. 0x2471,
  27955. "eighteenparen",
  27956. 0x2485,
  27957. "eighteenperiod",
  27958. 0x2499,
  27959. "eightgujarati",
  27960. 0x0aee,
  27961. "eightgurmukhi",
  27962. 0x0a6e,
  27963. "eighthackarabic",
  27964. 0x0668,
  27965. "eighthangzhou",
  27966. 0x3028,
  27967. "eighthnotebeamed",
  27968. 0x266b,
  27969. "eightideographicparen",
  27970. 0x3227,
  27971. "eightinferior",
  27972. 0x2088,
  27973. "eightmonospace",
  27974. 0xff18,
  27975. "eightoldstyle",
  27976. 0xf738,
  27977. "eightparen",
  27978. 0x247b,
  27979. "eightperiod",
  27980. 0x248f,
  27981. "eightpersian",
  27982. 0x06f8,
  27983. "eightroman",
  27984. 0x2177,
  27985. "eightsuperior",
  27986. 0x2078,
  27987. "eightthai",
  27988. 0x0e58,
  27989. "einvertedbreve",
  27990. 0x0207,
  27991. "eiotifiedcyrillic",
  27992. 0x0465,
  27993. "ekatakana",
  27994. 0x30a8,
  27995. "ekatakanahalfwidth",
  27996. 0xff74,
  27997. "ekonkargurmukhi",
  27998. 0x0a74,
  27999. "ekorean",
  28000. 0x3154,
  28001. "elcyrillic",
  28002. 0x043b,
  28003. "element",
  28004. 0x2208,
  28005. "elevencircle",
  28006. 0x246a,
  28007. "elevenparen",
  28008. 0x247e,
  28009. "elevenperiod",
  28010. 0x2492,
  28011. "elevenroman",
  28012. 0x217a,
  28013. "ellipsis",
  28014. 0x2026,
  28015. "ellipsisvertical",
  28016. 0x22ee,
  28017. "emacron",
  28018. 0x0113,
  28019. "emacronacute",
  28020. 0x1e17,
  28021. "emacrongrave",
  28022. 0x1e15,
  28023. "emcyrillic",
  28024. 0x043c,
  28025. "emdash",
  28026. 0x2014,
  28027. "emdashvertical",
  28028. 0xfe31,
  28029. "emonospace",
  28030. 0xff45,
  28031. "emphasismarkarmenian",
  28032. 0x055b,
  28033. "emptyset",
  28034. 0x2205,
  28035. "enbopomofo",
  28036. 0x3123,
  28037. "encyrillic",
  28038. 0x043d,
  28039. "endash",
  28040. 0x2013,
  28041. "endashvertical",
  28042. 0xfe32,
  28043. "endescendercyrillic",
  28044. 0x04a3,
  28045. "eng",
  28046. 0x014b,
  28047. "engbopomofo",
  28048. 0x3125,
  28049. "enghecyrillic",
  28050. 0x04a5,
  28051. "enhookcyrillic",
  28052. 0x04c8,
  28053. "enspace",
  28054. 0x2002,
  28055. "eogonek",
  28056. 0x0119,
  28057. "eokorean",
  28058. 0x3153,
  28059. "eopen",
  28060. 0x025b,
  28061. "eopenclosed",
  28062. 0x029a,
  28063. "eopenreversed",
  28064. 0x025c,
  28065. "eopenreversedclosed",
  28066. 0x025e,
  28067. "eopenreversedhook",
  28068. 0x025d,
  28069. "eparen",
  28070. 0x24a0,
  28071. "epsilon",
  28072. 0x03b5,
  28073. "epsilontonos",
  28074. 0x03ad,
  28075. "equal",
  28076. 0x003d,
  28077. "equalmonospace",
  28078. 0xff1d,
  28079. "equalsmall",
  28080. 0xfe66,
  28081. "equalsuperior",
  28082. 0x207c,
  28083. "equivalence",
  28084. 0x2261,
  28085. "erbopomofo",
  28086. 0x3126,
  28087. "ercyrillic",
  28088. 0x0440,
  28089. "ereversed",
  28090. 0x0258,
  28091. "ereversedcyrillic",
  28092. 0x044d,
  28093. "escyrillic",
  28094. 0x0441,
  28095. "esdescendercyrillic",
  28096. 0x04ab,
  28097. "esh",
  28098. 0x0283,
  28099. "eshcurl",
  28100. 0x0286,
  28101. "eshortdeva",
  28102. 0x090e,
  28103. "eshortvowelsigndeva",
  28104. 0x0946,
  28105. "eshreversedloop",
  28106. 0x01aa,
  28107. "eshsquatreversed",
  28108. 0x0285,
  28109. "esmallhiragana",
  28110. 0x3047,
  28111. "esmallkatakana",
  28112. 0x30a7,
  28113. "esmallkatakanahalfwidth",
  28114. 0xff6a,
  28115. "estimated",
  28116. 0x212e,
  28117. "esuperior",
  28118. 0xf6ec,
  28119. "eta",
  28120. 0x03b7,
  28121. "etarmenian",
  28122. 0x0568,
  28123. "etatonos",
  28124. 0x03ae,
  28125. "eth",
  28126. 0x00f0,
  28127. "etilde",
  28128. 0x1ebd,
  28129. "etildebelow",
  28130. 0x1e1b,
  28131. "etnahtafoukhhebrew",
  28132. 0x0591,
  28133. "etnahtafoukhlefthebrew",
  28134. 0x0591,
  28135. "etnahtahebrew",
  28136. 0x0591,
  28137. "etnahtalefthebrew",
  28138. 0x0591,
  28139. "eturned",
  28140. 0x01dd,
  28141. "eukorean",
  28142. 0x3161,
  28143. "euro",
  28144. 0x20ac,
  28145. "evowelsignbengali",
  28146. 0x09c7,
  28147. "evowelsigndeva",
  28148. 0x0947,
  28149. "evowelsigngujarati",
  28150. 0x0ac7,
  28151. "exclam",
  28152. 0x0021,
  28153. "exclamarmenian",
  28154. 0x055c,
  28155. "exclamdbl",
  28156. 0x203c,
  28157. "exclamdown",
  28158. 0x00a1,
  28159. "exclamdownsmall",
  28160. 0xf7a1,
  28161. "exclammonospace",
  28162. 0xff01,
  28163. "exclamsmall",
  28164. 0xf721,
  28165. "existential",
  28166. 0x2203,
  28167. "ezh",
  28168. 0x0292,
  28169. "ezhcaron",
  28170. 0x01ef,
  28171. "ezhcurl",
  28172. 0x0293,
  28173. "ezhreversed",
  28174. 0x01b9,
  28175. "ezhtail",
  28176. 0x01ba,
  28177. "f",
  28178. 0x0066,
  28179. "fadeva",
  28180. 0x095e,
  28181. "fagurmukhi",
  28182. 0x0a5e,
  28183. "fahrenheit",
  28184. 0x2109,
  28185. "fathaarabic",
  28186. 0x064e,
  28187. "fathalowarabic",
  28188. 0x064e,
  28189. "fathatanarabic",
  28190. 0x064b,
  28191. "fbopomofo",
  28192. 0x3108,
  28193. "fcircle",
  28194. 0x24d5,
  28195. "fdotaccent",
  28196. 0x1e1f,
  28197. "feharabic",
  28198. 0x0641,
  28199. "feharmenian",
  28200. 0x0586,
  28201. "fehfinalarabic",
  28202. 0xfed2,
  28203. "fehinitialarabic",
  28204. 0xfed3,
  28205. "fehmedialarabic",
  28206. 0xfed4,
  28207. "feicoptic",
  28208. 0x03e5,
  28209. "female",
  28210. 0x2640,
  28211. "ff",
  28212. 0xfb00,
  28213. "f_f",
  28214. 0xfb00,
  28215. "ffi",
  28216. 0xfb03,
  28217. "f_f_i",
  28218. 0xfb03,
  28219. "ffl",
  28220. 0xfb04,
  28221. "f_f_l",
  28222. 0xfb04,
  28223. "fi",
  28224. 0xfb01,
  28225. "f_i",
  28226. 0xfb01,
  28227. "fifteencircle",
  28228. 0x246e,
  28229. "fifteenparen",
  28230. 0x2482,
  28231. "fifteenperiod",
  28232. 0x2496,
  28233. "figuredash",
  28234. 0x2012,
  28235. "filledbox",
  28236. 0x25a0,
  28237. "filledrect",
  28238. 0x25ac,
  28239. "finalkaf",
  28240. 0x05da,
  28241. "finalkafdagesh",
  28242. 0xfb3a,
  28243. "finalkafdageshhebrew",
  28244. 0xfb3a,
  28245. "finalkafhebrew",
  28246. 0x05da,
  28247. "finalmem",
  28248. 0x05dd,
  28249. "finalmemhebrew",
  28250. 0x05dd,
  28251. "finalnun",
  28252. 0x05df,
  28253. "finalnunhebrew",
  28254. 0x05df,
  28255. "finalpe",
  28256. 0x05e3,
  28257. "finalpehebrew",
  28258. 0x05e3,
  28259. "finaltsadi",
  28260. 0x05e5,
  28261. "finaltsadihebrew",
  28262. 0x05e5,
  28263. "firsttonechinese",
  28264. 0x02c9,
  28265. "fisheye",
  28266. 0x25c9,
  28267. "fitacyrillic",
  28268. 0x0473,
  28269. "five",
  28270. 0x0035,
  28271. "fivearabic",
  28272. 0x0665,
  28273. "fivebengali",
  28274. 0x09eb,
  28275. "fivecircle",
  28276. 0x2464,
  28277. "fivecircleinversesansserif",
  28278. 0x278e,
  28279. "fivedeva",
  28280. 0x096b,
  28281. "fiveeighths",
  28282. 0x215d,
  28283. "fivegujarati",
  28284. 0x0aeb,
  28285. "fivegurmukhi",
  28286. 0x0a6b,
  28287. "fivehackarabic",
  28288. 0x0665,
  28289. "fivehangzhou",
  28290. 0x3025,
  28291. "fiveideographicparen",
  28292. 0x3224,
  28293. "fiveinferior",
  28294. 0x2085,
  28295. "fivemonospace",
  28296. 0xff15,
  28297. "fiveoldstyle",
  28298. 0xf735,
  28299. "fiveparen",
  28300. 0x2478,
  28301. "fiveperiod",
  28302. 0x248c,
  28303. "fivepersian",
  28304. 0x06f5,
  28305. "fiveroman",
  28306. 0x2174,
  28307. "fivesuperior",
  28308. 0x2075,
  28309. "fivethai",
  28310. 0x0e55,
  28311. "fl",
  28312. 0xfb02,
  28313. "f_l",
  28314. 0xfb02,
  28315. "florin",
  28316. 0x0192,
  28317. "fmonospace",
  28318. 0xff46,
  28319. "fmsquare",
  28320. 0x3399,
  28321. "fofanthai",
  28322. 0x0e1f,
  28323. "fofathai",
  28324. 0x0e1d,
  28325. "fongmanthai",
  28326. 0x0e4f,
  28327. "forall",
  28328. 0x2200,
  28329. "four",
  28330. 0x0034,
  28331. "fourarabic",
  28332. 0x0664,
  28333. "fourbengali",
  28334. 0x09ea,
  28335. "fourcircle",
  28336. 0x2463,
  28337. "fourcircleinversesansserif",
  28338. 0x278d,
  28339. "fourdeva",
  28340. 0x096a,
  28341. "fourgujarati",
  28342. 0x0aea,
  28343. "fourgurmukhi",
  28344. 0x0a6a,
  28345. "fourhackarabic",
  28346. 0x0664,
  28347. "fourhangzhou",
  28348. 0x3024,
  28349. "fourideographicparen",
  28350. 0x3223,
  28351. "fourinferior",
  28352. 0x2084,
  28353. "fourmonospace",
  28354. 0xff14,
  28355. "fournumeratorbengali",
  28356. 0x09f7,
  28357. "fouroldstyle",
  28358. 0xf734,
  28359. "fourparen",
  28360. 0x2477,
  28361. "fourperiod",
  28362. 0x248b,
  28363. "fourpersian",
  28364. 0x06f4,
  28365. "fourroman",
  28366. 0x2173,
  28367. "foursuperior",
  28368. 0x2074,
  28369. "fourteencircle",
  28370. 0x246d,
  28371. "fourteenparen",
  28372. 0x2481,
  28373. "fourteenperiod",
  28374. 0x2495,
  28375. "fourthai",
  28376. 0x0e54,
  28377. "fourthtonechinese",
  28378. 0x02cb,
  28379. "fparen",
  28380. 0x24a1,
  28381. "fraction",
  28382. 0x2044,
  28383. "franc",
  28384. 0x20a3,
  28385. "g",
  28386. 0x0067,
  28387. "gabengali",
  28388. 0x0997,
  28389. "gacute",
  28390. 0x01f5,
  28391. "gadeva",
  28392. 0x0917,
  28393. "gafarabic",
  28394. 0x06af,
  28395. "gaffinalarabic",
  28396. 0xfb93,
  28397. "gafinitialarabic",
  28398. 0xfb94,
  28399. "gafmedialarabic",
  28400. 0xfb95,
  28401. "gagujarati",
  28402. 0x0a97,
  28403. "gagurmukhi",
  28404. 0x0a17,
  28405. "gahiragana",
  28406. 0x304c,
  28407. "gakatakana",
  28408. 0x30ac,
  28409. "gamma",
  28410. 0x03b3,
  28411. "gammalatinsmall",
  28412. 0x0263,
  28413. "gammasuperior",
  28414. 0x02e0,
  28415. "gangiacoptic",
  28416. 0x03eb,
  28417. "gbopomofo",
  28418. 0x310d,
  28419. "gbreve",
  28420. 0x011f,
  28421. "gcaron",
  28422. 0x01e7,
  28423. "gcedilla",
  28424. 0x0123,
  28425. "gcircle",
  28426. 0x24d6,
  28427. "gcircumflex",
  28428. 0x011d,
  28429. "gcommaaccent",
  28430. 0x0123,
  28431. "gdot",
  28432. 0x0121,
  28433. "gdotaccent",
  28434. 0x0121,
  28435. "gecyrillic",
  28436. 0x0433,
  28437. "gehiragana",
  28438. 0x3052,
  28439. "gekatakana",
  28440. 0x30b2,
  28441. "geometricallyequal",
  28442. 0x2251,
  28443. "gereshaccenthebrew",
  28444. 0x059c,
  28445. "gereshhebrew",
  28446. 0x05f3,
  28447. "gereshmuqdamhebrew",
  28448. 0x059d,
  28449. "germandbls",
  28450. 0x00df,
  28451. "gershayimaccenthebrew",
  28452. 0x059e,
  28453. "gershayimhebrew",
  28454. 0x05f4,
  28455. "getamark",
  28456. 0x3013,
  28457. "ghabengali",
  28458. 0x0998,
  28459. "ghadarmenian",
  28460. 0x0572,
  28461. "ghadeva",
  28462. 0x0918,
  28463. "ghagujarati",
  28464. 0x0a98,
  28465. "ghagurmukhi",
  28466. 0x0a18,
  28467. "ghainarabic",
  28468. 0x063a,
  28469. "ghainfinalarabic",
  28470. 0xfece,
  28471. "ghaininitialarabic",
  28472. 0xfecf,
  28473. "ghainmedialarabic",
  28474. 0xfed0,
  28475. "ghemiddlehookcyrillic",
  28476. 0x0495,
  28477. "ghestrokecyrillic",
  28478. 0x0493,
  28479. "gheupturncyrillic",
  28480. 0x0491,
  28481. "ghhadeva",
  28482. 0x095a,
  28483. "ghhagurmukhi",
  28484. 0x0a5a,
  28485. "ghook",
  28486. 0x0260,
  28487. "ghzsquare",
  28488. 0x3393,
  28489. "gihiragana",
  28490. 0x304e,
  28491. "gikatakana",
  28492. 0x30ae,
  28493. "gimarmenian",
  28494. 0x0563,
  28495. "gimel",
  28496. 0x05d2,
  28497. "gimeldagesh",
  28498. 0xfb32,
  28499. "gimeldageshhebrew",
  28500. 0xfb32,
  28501. "gimelhebrew",
  28502. 0x05d2,
  28503. "gjecyrillic",
  28504. 0x0453,
  28505. "glottalinvertedstroke",
  28506. 0x01be,
  28507. "glottalstop",
  28508. 0x0294,
  28509. "glottalstopinverted",
  28510. 0x0296,
  28511. "glottalstopmod",
  28512. 0x02c0,
  28513. "glottalstopreversed",
  28514. 0x0295,
  28515. "glottalstopreversedmod",
  28516. 0x02c1,
  28517. "glottalstopreversedsuperior",
  28518. 0x02e4,
  28519. "glottalstopstroke",
  28520. 0x02a1,
  28521. "glottalstopstrokereversed",
  28522. 0x02a2,
  28523. "gmacron",
  28524. 0x1e21,
  28525. "gmonospace",
  28526. 0xff47,
  28527. "gohiragana",
  28528. 0x3054,
  28529. "gokatakana",
  28530. 0x30b4,
  28531. "gparen",
  28532. 0x24a2,
  28533. "gpasquare",
  28534. 0x33ac,
  28535. "gradient",
  28536. 0x2207,
  28537. "grave",
  28538. 0x0060,
  28539. "gravebelowcmb",
  28540. 0x0316,
  28541. "gravecmb",
  28542. 0x0300,
  28543. "gravecomb",
  28544. 0x0300,
  28545. "gravedeva",
  28546. 0x0953,
  28547. "gravelowmod",
  28548. 0x02ce,
  28549. "gravemonospace",
  28550. 0xff40,
  28551. "gravetonecmb",
  28552. 0x0340,
  28553. "greater",
  28554. 0x003e,
  28555. "greaterequal",
  28556. 0x2265,
  28557. "greaterequalorless",
  28558. 0x22db,
  28559. "greatermonospace",
  28560. 0xff1e,
  28561. "greaterorequivalent",
  28562. 0x2273,
  28563. "greaterorless",
  28564. 0x2277,
  28565. "greateroverequal",
  28566. 0x2267,
  28567. "greatersmall",
  28568. 0xfe65,
  28569. "gscript",
  28570. 0x0261,
  28571. "gstroke",
  28572. 0x01e5,
  28573. "guhiragana",
  28574. 0x3050,
  28575. "guillemotleft",
  28576. 0x00ab,
  28577. "guillemotright",
  28578. 0x00bb,
  28579. "guilsinglleft",
  28580. 0x2039,
  28581. "guilsinglright",
  28582. 0x203a,
  28583. "gukatakana",
  28584. 0x30b0,
  28585. "guramusquare",
  28586. 0x3318,
  28587. "gysquare",
  28588. 0x33c9,
  28589. "h",
  28590. 0x0068,
  28591. "haabkhasiancyrillic",
  28592. 0x04a9,
  28593. "haaltonearabic",
  28594. 0x06c1,
  28595. "habengali",
  28596. 0x09b9,
  28597. "hadescendercyrillic",
  28598. 0x04b3,
  28599. "hadeva",
  28600. 0x0939,
  28601. "hagujarati",
  28602. 0x0ab9,
  28603. "hagurmukhi",
  28604. 0x0a39,
  28605. "haharabic",
  28606. 0x062d,
  28607. "hahfinalarabic",
  28608. 0xfea2,
  28609. "hahinitialarabic",
  28610. 0xfea3,
  28611. "hahiragana",
  28612. 0x306f,
  28613. "hahmedialarabic",
  28614. 0xfea4,
  28615. "haitusquare",
  28616. 0x332a,
  28617. "hakatakana",
  28618. 0x30cf,
  28619. "hakatakanahalfwidth",
  28620. 0xff8a,
  28621. "halantgurmukhi",
  28622. 0x0a4d,
  28623. "hamzaarabic",
  28624. 0x0621,
  28625. "hamzalowarabic",
  28626. 0x0621,
  28627. "hangulfiller",
  28628. 0x3164,
  28629. "hardsigncyrillic",
  28630. 0x044a,
  28631. "harpoonleftbarbup",
  28632. 0x21bc,
  28633. "harpoonrightbarbup",
  28634. 0x21c0,
  28635. "hasquare",
  28636. 0x33ca,
  28637. "hatafpatah",
  28638. 0x05b2,
  28639. "hatafpatah16",
  28640. 0x05b2,
  28641. "hatafpatah23",
  28642. 0x05b2,
  28643. "hatafpatah2f",
  28644. 0x05b2,
  28645. "hatafpatahhebrew",
  28646. 0x05b2,
  28647. "hatafpatahnarrowhebrew",
  28648. 0x05b2,
  28649. "hatafpatahquarterhebrew",
  28650. 0x05b2,
  28651. "hatafpatahwidehebrew",
  28652. 0x05b2,
  28653. "hatafqamats",
  28654. 0x05b3,
  28655. "hatafqamats1b",
  28656. 0x05b3,
  28657. "hatafqamats28",
  28658. 0x05b3,
  28659. "hatafqamats34",
  28660. 0x05b3,
  28661. "hatafqamatshebrew",
  28662. 0x05b3,
  28663. "hatafqamatsnarrowhebrew",
  28664. 0x05b3,
  28665. "hatafqamatsquarterhebrew",
  28666. 0x05b3,
  28667. "hatafqamatswidehebrew",
  28668. 0x05b3,
  28669. "hatafsegol",
  28670. 0x05b1,
  28671. "hatafsegol17",
  28672. 0x05b1,
  28673. "hatafsegol24",
  28674. 0x05b1,
  28675. "hatafsegol30",
  28676. 0x05b1,
  28677. "hatafsegolhebrew",
  28678. 0x05b1,
  28679. "hatafsegolnarrowhebrew",
  28680. 0x05b1,
  28681. "hatafsegolquarterhebrew",
  28682. 0x05b1,
  28683. "hatafsegolwidehebrew",
  28684. 0x05b1,
  28685. "hbar",
  28686. 0x0127,
  28687. "hbopomofo",
  28688. 0x310f,
  28689. "hbrevebelow",
  28690. 0x1e2b,
  28691. "hcedilla",
  28692. 0x1e29,
  28693. "hcircle",
  28694. 0x24d7,
  28695. "hcircumflex",
  28696. 0x0125,
  28697. "hdieresis",
  28698. 0x1e27,
  28699. "hdotaccent",
  28700. 0x1e23,
  28701. "hdotbelow",
  28702. 0x1e25,
  28703. "he",
  28704. 0x05d4,
  28705. "heart",
  28706. 0x2665,
  28707. "heartsuitblack",
  28708. 0x2665,
  28709. "heartsuitwhite",
  28710. 0x2661,
  28711. "hedagesh",
  28712. 0xfb34,
  28713. "hedageshhebrew",
  28714. 0xfb34,
  28715. "hehaltonearabic",
  28716. 0x06c1,
  28717. "heharabic",
  28718. 0x0647,
  28719. "hehebrew",
  28720. 0x05d4,
  28721. "hehfinalaltonearabic",
  28722. 0xfba7,
  28723. "hehfinalalttwoarabic",
  28724. 0xfeea,
  28725. "hehfinalarabic",
  28726. 0xfeea,
  28727. "hehhamzaabovefinalarabic",
  28728. 0xfba5,
  28729. "hehhamzaaboveisolatedarabic",
  28730. 0xfba4,
  28731. "hehinitialaltonearabic",
  28732. 0xfba8,
  28733. "hehinitialarabic",
  28734. 0xfeeb,
  28735. "hehiragana",
  28736. 0x3078,
  28737. "hehmedialaltonearabic",
  28738. 0xfba9,
  28739. "hehmedialarabic",
  28740. 0xfeec,
  28741. "heiseierasquare",
  28742. 0x337b,
  28743. "hekatakana",
  28744. 0x30d8,
  28745. "hekatakanahalfwidth",
  28746. 0xff8d,
  28747. "hekutaarusquare",
  28748. 0x3336,
  28749. "henghook",
  28750. 0x0267,
  28751. "herutusquare",
  28752. 0x3339,
  28753. "het",
  28754. 0x05d7,
  28755. "hethebrew",
  28756. 0x05d7,
  28757. "hhook",
  28758. 0x0266,
  28759. "hhooksuperior",
  28760. 0x02b1,
  28761. "hieuhacirclekorean",
  28762. 0x327b,
  28763. "hieuhaparenkorean",
  28764. 0x321b,
  28765. "hieuhcirclekorean",
  28766. 0x326d,
  28767. "hieuhkorean",
  28768. 0x314e,
  28769. "hieuhparenkorean",
  28770. 0x320d,
  28771. "hihiragana",
  28772. 0x3072,
  28773. "hikatakana",
  28774. 0x30d2,
  28775. "hikatakanahalfwidth",
  28776. 0xff8b,
  28777. "hiriq",
  28778. 0x05b4,
  28779. "hiriq14",
  28780. 0x05b4,
  28781. "hiriq21",
  28782. 0x05b4,
  28783. "hiriq2d",
  28784. 0x05b4,
  28785. "hiriqhebrew",
  28786. 0x05b4,
  28787. "hiriqnarrowhebrew",
  28788. 0x05b4,
  28789. "hiriqquarterhebrew",
  28790. 0x05b4,
  28791. "hiriqwidehebrew",
  28792. 0x05b4,
  28793. "hlinebelow",
  28794. 0x1e96,
  28795. "hmonospace",
  28796. 0xff48,
  28797. "hoarmenian",
  28798. 0x0570,
  28799. "hohipthai",
  28800. 0x0e2b,
  28801. "hohiragana",
  28802. 0x307b,
  28803. "hokatakana",
  28804. 0x30db,
  28805. "hokatakanahalfwidth",
  28806. 0xff8e,
  28807. "holam",
  28808. 0x05b9,
  28809. "holam19",
  28810. 0x05b9,
  28811. "holam26",
  28812. 0x05b9,
  28813. "holam32",
  28814. 0x05b9,
  28815. "holamhebrew",
  28816. 0x05b9,
  28817. "holamnarrowhebrew",
  28818. 0x05b9,
  28819. "holamquarterhebrew",
  28820. 0x05b9,
  28821. "holamwidehebrew",
  28822. 0x05b9,
  28823. "honokhukthai",
  28824. 0x0e2e,
  28825. "hookabovecomb",
  28826. 0x0309,
  28827. "hookcmb",
  28828. 0x0309,
  28829. "hookpalatalizedbelowcmb",
  28830. 0x0321,
  28831. "hookretroflexbelowcmb",
  28832. 0x0322,
  28833. "hoonsquare",
  28834. 0x3342,
  28835. "horicoptic",
  28836. 0x03e9,
  28837. "horizontalbar",
  28838. 0x2015,
  28839. "horncmb",
  28840. 0x031b,
  28841. "hotsprings",
  28842. 0x2668,
  28843. "house",
  28844. 0x2302,
  28845. "hparen",
  28846. 0x24a3,
  28847. "hsuperior",
  28848. 0x02b0,
  28849. "hturned",
  28850. 0x0265,
  28851. "huhiragana",
  28852. 0x3075,
  28853. "huiitosquare",
  28854. 0x3333,
  28855. "hukatakana",
  28856. 0x30d5,
  28857. "hukatakanahalfwidth",
  28858. 0xff8c,
  28859. "hungarumlaut",
  28860. 0x02dd,
  28861. "hungarumlautcmb",
  28862. 0x030b,
  28863. "hv",
  28864. 0x0195,
  28865. "hyphen",
  28866. 0x002d,
  28867. "hypheninferior",
  28868. 0xf6e5,
  28869. "hyphenmonospace",
  28870. 0xff0d,
  28871. "hyphensmall",
  28872. 0xfe63,
  28873. "hyphensuperior",
  28874. 0xf6e6,
  28875. "hyphentwo",
  28876. 0x2010,
  28877. "i",
  28878. 0x0069,
  28879. "iacute",
  28880. 0x00ed,
  28881. "iacyrillic",
  28882. 0x044f,
  28883. "ibengali",
  28884. 0x0987,
  28885. "ibopomofo",
  28886. 0x3127,
  28887. "ibreve",
  28888. 0x012d,
  28889. "icaron",
  28890. 0x01d0,
  28891. "icircle",
  28892. 0x24d8,
  28893. "icircumflex",
  28894. 0x00ee,
  28895. "icyrillic",
  28896. 0x0456,
  28897. "idblgrave",
  28898. 0x0209,
  28899. "ideographearthcircle",
  28900. 0x328f,
  28901. "ideographfirecircle",
  28902. 0x328b,
  28903. "ideographicallianceparen",
  28904. 0x323f,
  28905. "ideographiccallparen",
  28906. 0x323a,
  28907. "ideographiccentrecircle",
  28908. 0x32a5,
  28909. "ideographicclose",
  28910. 0x3006,
  28911. "ideographiccomma",
  28912. 0x3001,
  28913. "ideographiccommaleft",
  28914. 0xff64,
  28915. "ideographiccongratulationparen",
  28916. 0x3237,
  28917. "ideographiccorrectcircle",
  28918. 0x32a3,
  28919. "ideographicearthparen",
  28920. 0x322f,
  28921. "ideographicenterpriseparen",
  28922. 0x323d,
  28923. "ideographicexcellentcircle",
  28924. 0x329d,
  28925. "ideographicfestivalparen",
  28926. 0x3240,
  28927. "ideographicfinancialcircle",
  28928. 0x3296,
  28929. "ideographicfinancialparen",
  28930. 0x3236,
  28931. "ideographicfireparen",
  28932. 0x322b,
  28933. "ideographichaveparen",
  28934. 0x3232,
  28935. "ideographichighcircle",
  28936. 0x32a4,
  28937. "ideographiciterationmark",
  28938. 0x3005,
  28939. "ideographiclaborcircle",
  28940. 0x3298,
  28941. "ideographiclaborparen",
  28942. 0x3238,
  28943. "ideographicleftcircle",
  28944. 0x32a7,
  28945. "ideographiclowcircle",
  28946. 0x32a6,
  28947. "ideographicmedicinecircle",
  28948. 0x32a9,
  28949. "ideographicmetalparen",
  28950. 0x322e,
  28951. "ideographicmoonparen",
  28952. 0x322a,
  28953. "ideographicnameparen",
  28954. 0x3234,
  28955. "ideographicperiod",
  28956. 0x3002,
  28957. "ideographicprintcircle",
  28958. 0x329e,
  28959. "ideographicreachparen",
  28960. 0x3243,
  28961. "ideographicrepresentparen",
  28962. 0x3239,
  28963. "ideographicresourceparen",
  28964. 0x323e,
  28965. "ideographicrightcircle",
  28966. 0x32a8,
  28967. "ideographicsecretcircle",
  28968. 0x3299,
  28969. "ideographicselfparen",
  28970. 0x3242,
  28971. "ideographicsocietyparen",
  28972. 0x3233,
  28973. "ideographicspace",
  28974. 0x3000,
  28975. "ideographicspecialparen",
  28976. 0x3235,
  28977. "ideographicstockparen",
  28978. 0x3231,
  28979. "ideographicstudyparen",
  28980. 0x323b,
  28981. "ideographicsunparen",
  28982. 0x3230,
  28983. "ideographicsuperviseparen",
  28984. 0x323c,
  28985. "ideographicwaterparen",
  28986. 0x322c,
  28987. "ideographicwoodparen",
  28988. 0x322d,
  28989. "ideographiczero",
  28990. 0x3007,
  28991. "ideographmetalcircle",
  28992. 0x328e,
  28993. "ideographmooncircle",
  28994. 0x328a,
  28995. "ideographnamecircle",
  28996. 0x3294,
  28997. "ideographsuncircle",
  28998. 0x3290,
  28999. "ideographwatercircle",
  29000. 0x328c,
  29001. "ideographwoodcircle",
  29002. 0x328d,
  29003. "ideva",
  29004. 0x0907,
  29005. "idieresis",
  29006. 0x00ef,
  29007. "idieresisacute",
  29008. 0x1e2f,
  29009. "idieresiscyrillic",
  29010. 0x04e5,
  29011. "idotbelow",
  29012. 0x1ecb,
  29013. "iebrevecyrillic",
  29014. 0x04d7,
  29015. "iecyrillic",
  29016. 0x0435,
  29017. "ieungacirclekorean",
  29018. 0x3275,
  29019. "ieungaparenkorean",
  29020. 0x3215,
  29021. "ieungcirclekorean",
  29022. 0x3267,
  29023. "ieungkorean",
  29024. 0x3147,
  29025. "ieungparenkorean",
  29026. 0x3207,
  29027. "igrave",
  29028. 0x00ec,
  29029. "igujarati",
  29030. 0x0a87,
  29031. "igurmukhi",
  29032. 0x0a07,
  29033. "ihiragana",
  29034. 0x3044,
  29035. "ihookabove",
  29036. 0x1ec9,
  29037. "iibengali",
  29038. 0x0988,
  29039. "iicyrillic",
  29040. 0x0438,
  29041. "iideva",
  29042. 0x0908,
  29043. "iigujarati",
  29044. 0x0a88,
  29045. "iigurmukhi",
  29046. 0x0a08,
  29047. "iimatragurmukhi",
  29048. 0x0a40,
  29049. "iinvertedbreve",
  29050. 0x020b,
  29051. "iishortcyrillic",
  29052. 0x0439,
  29053. "iivowelsignbengali",
  29054. 0x09c0,
  29055. "iivowelsigndeva",
  29056. 0x0940,
  29057. "iivowelsigngujarati",
  29058. 0x0ac0,
  29059. "ij",
  29060. 0x0133,
  29061. "ikatakana",
  29062. 0x30a4,
  29063. "ikatakanahalfwidth",
  29064. 0xff72,
  29065. "ikorean",
  29066. 0x3163,
  29067. "ilde",
  29068. 0x02dc,
  29069. "iluyhebrew",
  29070. 0x05ac,
  29071. "imacron",
  29072. 0x012b,
  29073. "imacroncyrillic",
  29074. 0x04e3,
  29075. "imageorapproximatelyequal",
  29076. 0x2253,
  29077. "imatragurmukhi",
  29078. 0x0a3f,
  29079. "imonospace",
  29080. 0xff49,
  29081. "increment",
  29082. 0x2206,
  29083. "infinity",
  29084. 0x221e,
  29085. "iniarmenian",
  29086. 0x056b,
  29087. "integral",
  29088. 0x222b,
  29089. "integralbottom",
  29090. 0x2321,
  29091. "integralbt",
  29092. 0x2321,
  29093. "integralex",
  29094. 0xf8f5,
  29095. "integraltop",
  29096. 0x2320,
  29097. "integraltp",
  29098. 0x2320,
  29099. "intersection",
  29100. 0x2229,
  29101. "intisquare",
  29102. 0x3305,
  29103. "invbullet",
  29104. 0x25d8,
  29105. "invcircle",
  29106. 0x25d9,
  29107. "invsmileface",
  29108. 0x263b,
  29109. "iocyrillic",
  29110. 0x0451,
  29111. "iogonek",
  29112. 0x012f,
  29113. "iota",
  29114. 0x03b9,
  29115. "iotadieresis",
  29116. 0x03ca,
  29117. "iotadieresistonos",
  29118. 0x0390,
  29119. "iotalatin",
  29120. 0x0269,
  29121. "iotatonos",
  29122. 0x03af,
  29123. "iparen",
  29124. 0x24a4,
  29125. "irigurmukhi",
  29126. 0x0a72,
  29127. "ismallhiragana",
  29128. 0x3043,
  29129. "ismallkatakana",
  29130. 0x30a3,
  29131. "ismallkatakanahalfwidth",
  29132. 0xff68,
  29133. "issharbengali",
  29134. 0x09fa,
  29135. "istroke",
  29136. 0x0268,
  29137. "isuperior",
  29138. 0xf6ed,
  29139. "iterationhiragana",
  29140. 0x309d,
  29141. "iterationkatakana",
  29142. 0x30fd,
  29143. "itilde",
  29144. 0x0129,
  29145. "itildebelow",
  29146. 0x1e2d,
  29147. "iubopomofo",
  29148. 0x3129,
  29149. "iucyrillic",
  29150. 0x044e,
  29151. "ivowelsignbengali",
  29152. 0x09bf,
  29153. "ivowelsigndeva",
  29154. 0x093f,
  29155. "ivowelsigngujarati",
  29156. 0x0abf,
  29157. "izhitsacyrillic",
  29158. 0x0475,
  29159. "izhitsadblgravecyrillic",
  29160. 0x0477,
  29161. "j",
  29162. 0x006a,
  29163. "jaarmenian",
  29164. 0x0571,
  29165. "jabengali",
  29166. 0x099c,
  29167. "jadeva",
  29168. 0x091c,
  29169. "jagujarati",
  29170. 0x0a9c,
  29171. "jagurmukhi",
  29172. 0x0a1c,
  29173. "jbopomofo",
  29174. 0x3110,
  29175. "jcaron",
  29176. 0x01f0,
  29177. "jcircle",
  29178. 0x24d9,
  29179. "jcircumflex",
  29180. 0x0135,
  29181. "jcrossedtail",
  29182. 0x029d,
  29183. "jdotlessstroke",
  29184. 0x025f,
  29185. "jecyrillic",
  29186. 0x0458,
  29187. "jeemarabic",
  29188. 0x062c,
  29189. "jeemfinalarabic",
  29190. 0xfe9e,
  29191. "jeeminitialarabic",
  29192. 0xfe9f,
  29193. "jeemmedialarabic",
  29194. 0xfea0,
  29195. "jeharabic",
  29196. 0x0698,
  29197. "jehfinalarabic",
  29198. 0xfb8b,
  29199. "jhabengali",
  29200. 0x099d,
  29201. "jhadeva",
  29202. 0x091d,
  29203. "jhagujarati",
  29204. 0x0a9d,
  29205. "jhagurmukhi",
  29206. 0x0a1d,
  29207. "jheharmenian",
  29208. 0x057b,
  29209. "jis",
  29210. 0x3004,
  29211. "jmonospace",
  29212. 0xff4a,
  29213. "jparen",
  29214. 0x24a5,
  29215. "jsuperior",
  29216. 0x02b2,
  29217. "k",
  29218. 0x006b,
  29219. "kabashkircyrillic",
  29220. 0x04a1,
  29221. "kabengali",
  29222. 0x0995,
  29223. "kacute",
  29224. 0x1e31,
  29225. "kacyrillic",
  29226. 0x043a,
  29227. "kadescendercyrillic",
  29228. 0x049b,
  29229. "kadeva",
  29230. 0x0915,
  29231. "kaf",
  29232. 0x05db,
  29233. "kafarabic",
  29234. 0x0643,
  29235. "kafdagesh",
  29236. 0xfb3b,
  29237. "kafdageshhebrew",
  29238. 0xfb3b,
  29239. "kaffinalarabic",
  29240. 0xfeda,
  29241. "kafhebrew",
  29242. 0x05db,
  29243. "kafinitialarabic",
  29244. 0xfedb,
  29245. "kafmedialarabic",
  29246. 0xfedc,
  29247. "kafrafehebrew",
  29248. 0xfb4d,
  29249. "kagujarati",
  29250. 0x0a95,
  29251. "kagurmukhi",
  29252. 0x0a15,
  29253. "kahiragana",
  29254. 0x304b,
  29255. "kahookcyrillic",
  29256. 0x04c4,
  29257. "kakatakana",
  29258. 0x30ab,
  29259. "kakatakanahalfwidth",
  29260. 0xff76,
  29261. "kappa",
  29262. 0x03ba,
  29263. "kappasymbolgreek",
  29264. 0x03f0,
  29265. "kapyeounmieumkorean",
  29266. 0x3171,
  29267. "kapyeounphieuphkorean",
  29268. 0x3184,
  29269. "kapyeounpieupkorean",
  29270. 0x3178,
  29271. "kapyeounssangpieupkorean",
  29272. 0x3179,
  29273. "karoriisquare",
  29274. 0x330d,
  29275. "kashidaautoarabic",
  29276. 0x0640,
  29277. "kashidaautonosidebearingarabic",
  29278. 0x0640,
  29279. "kasmallkatakana",
  29280. 0x30f5,
  29281. "kasquare",
  29282. 0x3384,
  29283. "kasraarabic",
  29284. 0x0650,
  29285. "kasratanarabic",
  29286. 0x064d,
  29287. "kastrokecyrillic",
  29288. 0x049f,
  29289. "katahiraprolongmarkhalfwidth",
  29290. 0xff70,
  29291. "kaverticalstrokecyrillic",
  29292. 0x049d,
  29293. "kbopomofo",
  29294. 0x310e,
  29295. "kcalsquare",
  29296. 0x3389,
  29297. "kcaron",
  29298. 0x01e9,
  29299. "kcedilla",
  29300. 0x0137,
  29301. "kcircle",
  29302. 0x24da,
  29303. "kcommaaccent",
  29304. 0x0137,
  29305. "kdotbelow",
  29306. 0x1e33,
  29307. "keharmenian",
  29308. 0x0584,
  29309. "kehiragana",
  29310. 0x3051,
  29311. "kekatakana",
  29312. 0x30b1,
  29313. "kekatakanahalfwidth",
  29314. 0xff79,
  29315. "kenarmenian",
  29316. 0x056f,
  29317. "kesmallkatakana",
  29318. 0x30f6,
  29319. "kgreenlandic",
  29320. 0x0138,
  29321. "khabengali",
  29322. 0x0996,
  29323. "khacyrillic",
  29324. 0x0445,
  29325. "khadeva",
  29326. 0x0916,
  29327. "khagujarati",
  29328. 0x0a96,
  29329. "khagurmukhi",
  29330. 0x0a16,
  29331. "khaharabic",
  29332. 0x062e,
  29333. "khahfinalarabic",
  29334. 0xfea6,
  29335. "khahinitialarabic",
  29336. 0xfea7,
  29337. "khahmedialarabic",
  29338. 0xfea8,
  29339. "kheicoptic",
  29340. 0x03e7,
  29341. "khhadeva",
  29342. 0x0959,
  29343. "khhagurmukhi",
  29344. 0x0a59,
  29345. "khieukhacirclekorean",
  29346. 0x3278,
  29347. "khieukhaparenkorean",
  29348. 0x3218,
  29349. "khieukhcirclekorean",
  29350. 0x326a,
  29351. "khieukhkorean",
  29352. 0x314b,
  29353. "khieukhparenkorean",
  29354. 0x320a,
  29355. "khokhaithai",
  29356. 0x0e02,
  29357. "khokhonthai",
  29358. 0x0e05,
  29359. "khokhuatthai",
  29360. 0x0e03,
  29361. "khokhwaithai",
  29362. 0x0e04,
  29363. "khomutthai",
  29364. 0x0e5b,
  29365. "khook",
  29366. 0x0199,
  29367. "khorakhangthai",
  29368. 0x0e06,
  29369. "khzsquare",
  29370. 0x3391,
  29371. "kihiragana",
  29372. 0x304d,
  29373. "kikatakana",
  29374. 0x30ad,
  29375. "kikatakanahalfwidth",
  29376. 0xff77,
  29377. "kiroguramusquare",
  29378. 0x3315,
  29379. "kiromeetorusquare",
  29380. 0x3316,
  29381. "kirosquare",
  29382. 0x3314,
  29383. "kiyeokacirclekorean",
  29384. 0x326e,
  29385. "kiyeokaparenkorean",
  29386. 0x320e,
  29387. "kiyeokcirclekorean",
  29388. 0x3260,
  29389. "kiyeokkorean",
  29390. 0x3131,
  29391. "kiyeokparenkorean",
  29392. 0x3200,
  29393. "kiyeoksioskorean",
  29394. 0x3133,
  29395. "kjecyrillic",
  29396. 0x045c,
  29397. "klinebelow",
  29398. 0x1e35,
  29399. "klsquare",
  29400. 0x3398,
  29401. "kmcubedsquare",
  29402. 0x33a6,
  29403. "kmonospace",
  29404. 0xff4b,
  29405. "kmsquaredsquare",
  29406. 0x33a2,
  29407. "kohiragana",
  29408. 0x3053,
  29409. "kohmsquare",
  29410. 0x33c0,
  29411. "kokaithai",
  29412. 0x0e01,
  29413. "kokatakana",
  29414. 0x30b3,
  29415. "kokatakanahalfwidth",
  29416. 0xff7a,
  29417. "kooposquare",
  29418. 0x331e,
  29419. "koppacyrillic",
  29420. 0x0481,
  29421. "koreanstandardsymbol",
  29422. 0x327f,
  29423. "koroniscmb",
  29424. 0x0343,
  29425. "kparen",
  29426. 0x24a6,
  29427. "kpasquare",
  29428. 0x33aa,
  29429. "ksicyrillic",
  29430. 0x046f,
  29431. "ktsquare",
  29432. 0x33cf,
  29433. "kturned",
  29434. 0x029e,
  29435. "kuhiragana",
  29436. 0x304f,
  29437. "kukatakana",
  29438. 0x30af,
  29439. "kukatakanahalfwidth",
  29440. 0xff78,
  29441. "kvsquare",
  29442. 0x33b8,
  29443. "kwsquare",
  29444. 0x33be,
  29445. "l",
  29446. 0x006c,
  29447. "labengali",
  29448. 0x09b2,
  29449. "lacute",
  29450. 0x013a,
  29451. "ladeva",
  29452. 0x0932,
  29453. "lagujarati",
  29454. 0x0ab2,
  29455. "lagurmukhi",
  29456. 0x0a32,
  29457. "lakkhangyaothai",
  29458. 0x0e45,
  29459. "lamaleffinalarabic",
  29460. 0xfefc,
  29461. "lamalefhamzaabovefinalarabic",
  29462. 0xfef8,
  29463. "lamalefhamzaaboveisolatedarabic",
  29464. 0xfef7,
  29465. "lamalefhamzabelowfinalarabic",
  29466. 0xfefa,
  29467. "lamalefhamzabelowisolatedarabic",
  29468. 0xfef9,
  29469. "lamalefisolatedarabic",
  29470. 0xfefb,
  29471. "lamalefmaddaabovefinalarabic",
  29472. 0xfef6,
  29473. "lamalefmaddaaboveisolatedarabic",
  29474. 0xfef5,
  29475. "lamarabic",
  29476. 0x0644,
  29477. "lambda",
  29478. 0x03bb,
  29479. "lambdastroke",
  29480. 0x019b,
  29481. "lamed",
  29482. 0x05dc,
  29483. "lameddagesh",
  29484. 0xfb3c,
  29485. "lameddageshhebrew",
  29486. 0xfb3c,
  29487. "lamedhebrew",
  29488. 0x05dc,
  29489. "lamfinalarabic",
  29490. 0xfede,
  29491. "lamhahinitialarabic",
  29492. 0xfcca,
  29493. "laminitialarabic",
  29494. 0xfedf,
  29495. "lamjeeminitialarabic",
  29496. 0xfcc9,
  29497. "lamkhahinitialarabic",
  29498. 0xfccb,
  29499. "lamlamhehisolatedarabic",
  29500. 0xfdf2,
  29501. "lammedialarabic",
  29502. 0xfee0,
  29503. "lammeemhahinitialarabic",
  29504. 0xfd88,
  29505. "lammeeminitialarabic",
  29506. 0xfccc,
  29507. "largecircle",
  29508. 0x25ef,
  29509. "lbar",
  29510. 0x019a,
  29511. "lbelt",
  29512. 0x026c,
  29513. "lbopomofo",
  29514. 0x310c,
  29515. "lcaron",
  29516. 0x013e,
  29517. "lcedilla",
  29518. 0x013c,
  29519. "lcircle",
  29520. 0x24db,
  29521. "lcircumflexbelow",
  29522. 0x1e3d,
  29523. "lcommaaccent",
  29524. 0x013c,
  29525. "ldot",
  29526. 0x0140,
  29527. "ldotaccent",
  29528. 0x0140,
  29529. "ldotbelow",
  29530. 0x1e37,
  29531. "ldotbelowmacron",
  29532. 0x1e39,
  29533. "leftangleabovecmb",
  29534. 0x031a,
  29535. "lefttackbelowcmb",
  29536. 0x0318,
  29537. "less",
  29538. 0x003c,
  29539. "lessequal",
  29540. 0x2264,
  29541. "lessequalorgreater",
  29542. 0x22da,
  29543. "lessmonospace",
  29544. 0xff1c,
  29545. "lessorequivalent",
  29546. 0x2272,
  29547. "lessorgreater",
  29548. 0x2276,
  29549. "lessoverequal",
  29550. 0x2266,
  29551. "lesssmall",
  29552. 0xfe64,
  29553. "lezh",
  29554. 0x026e,
  29555. "lfblock",
  29556. 0x258c,
  29557. "lhookretroflex",
  29558. 0x026d,
  29559. "lira",
  29560. 0x20a4,
  29561. "liwnarmenian",
  29562. 0x056c,
  29563. "lj",
  29564. 0x01c9,
  29565. "ljecyrillic",
  29566. 0x0459,
  29567. "ll",
  29568. 0xf6c0,
  29569. "lladeva",
  29570. 0x0933,
  29571. "llagujarati",
  29572. 0x0ab3,
  29573. "llinebelow",
  29574. 0x1e3b,
  29575. "llladeva",
  29576. 0x0934,
  29577. "llvocalicbengali",
  29578. 0x09e1,
  29579. "llvocalicdeva",
  29580. 0x0961,
  29581. "llvocalicvowelsignbengali",
  29582. 0x09e3,
  29583. "llvocalicvowelsigndeva",
  29584. 0x0963,
  29585. "lmiddletilde",
  29586. 0x026b,
  29587. "lmonospace",
  29588. 0xff4c,
  29589. "lmsquare",
  29590. 0x33d0,
  29591. "lochulathai",
  29592. 0x0e2c,
  29593. "logicaland",
  29594. 0x2227,
  29595. "logicalnot",
  29596. 0x00ac,
  29597. "logicalnotreversed",
  29598. 0x2310,
  29599. "logicalor",
  29600. 0x2228,
  29601. "lolingthai",
  29602. 0x0e25,
  29603. "longs",
  29604. 0x017f,
  29605. "lowlinecenterline",
  29606. 0xfe4e,
  29607. "lowlinecmb",
  29608. 0x0332,
  29609. "lowlinedashed",
  29610. 0xfe4d,
  29611. "lozenge",
  29612. 0x25ca,
  29613. "lparen",
  29614. 0x24a7,
  29615. "lslash",
  29616. 0x0142,
  29617. "lsquare",
  29618. 0x2113,
  29619. "lsuperior",
  29620. 0xf6ee,
  29621. "ltshade",
  29622. 0x2591,
  29623. "luthai",
  29624. 0x0e26,
  29625. "lvocalicbengali",
  29626. 0x098c,
  29627. "lvocalicdeva",
  29628. 0x090c,
  29629. "lvocalicvowelsignbengali",
  29630. 0x09e2,
  29631. "lvocalicvowelsigndeva",
  29632. 0x0962,
  29633. "lxsquare",
  29634. 0x33d3,
  29635. "m",
  29636. 0x006d,
  29637. "mabengali",
  29638. 0x09ae,
  29639. "macron",
  29640. 0x00af,
  29641. "macronbelowcmb",
  29642. 0x0331,
  29643. "macroncmb",
  29644. 0x0304,
  29645. "macronlowmod",
  29646. 0x02cd,
  29647. "macronmonospace",
  29648. 0xffe3,
  29649. "macute",
  29650. 0x1e3f,
  29651. "madeva",
  29652. 0x092e,
  29653. "magujarati",
  29654. 0x0aae,
  29655. "magurmukhi",
  29656. 0x0a2e,
  29657. "mahapakhhebrew",
  29658. 0x05a4,
  29659. "mahapakhlefthebrew",
  29660. 0x05a4,
  29661. "mahiragana",
  29662. 0x307e,
  29663. "maichattawalowleftthai",
  29664. 0xf895,
  29665. "maichattawalowrightthai",
  29666. 0xf894,
  29667. "maichattawathai",
  29668. 0x0e4b,
  29669. "maichattawaupperleftthai",
  29670. 0xf893,
  29671. "maieklowleftthai",
  29672. 0xf88c,
  29673. "maieklowrightthai",
  29674. 0xf88b,
  29675. "maiekthai",
  29676. 0x0e48,
  29677. "maiekupperleftthai",
  29678. 0xf88a,
  29679. "maihanakatleftthai",
  29680. 0xf884,
  29681. "maihanakatthai",
  29682. 0x0e31,
  29683. "maitaikhuleftthai",
  29684. 0xf889,
  29685. "maitaikhuthai",
  29686. 0x0e47,
  29687. "maitholowleftthai",
  29688. 0xf88f,
  29689. "maitholowrightthai",
  29690. 0xf88e,
  29691. "maithothai",
  29692. 0x0e49,
  29693. "maithoupperleftthai",
  29694. 0xf88d,
  29695. "maitrilowleftthai",
  29696. 0xf892,
  29697. "maitrilowrightthai",
  29698. 0xf891,
  29699. "maitrithai",
  29700. 0x0e4a,
  29701. "maitriupperleftthai",
  29702. 0xf890,
  29703. "maiyamokthai",
  29704. 0x0e46,
  29705. "makatakana",
  29706. 0x30de,
  29707. "makatakanahalfwidth",
  29708. 0xff8f,
  29709. "male",
  29710. 0x2642,
  29711. "mansyonsquare",
  29712. 0x3347,
  29713. "maqafhebrew",
  29714. 0x05be,
  29715. "mars",
  29716. 0x2642,
  29717. "masoracirclehebrew",
  29718. 0x05af,
  29719. "masquare",
  29720. 0x3383,
  29721. "mbopomofo",
  29722. 0x3107,
  29723. "mbsquare",
  29724. 0x33d4,
  29725. "mcircle",
  29726. 0x24dc,
  29727. "mcubedsquare",
  29728. 0x33a5,
  29729. "mdotaccent",
  29730. 0x1e41,
  29731. "mdotbelow",
  29732. 0x1e43,
  29733. "meemarabic",
  29734. 0x0645,
  29735. "meemfinalarabic",
  29736. 0xfee2,
  29737. "meeminitialarabic",
  29738. 0xfee3,
  29739. "meemmedialarabic",
  29740. 0xfee4,
  29741. "meemmeeminitialarabic",
  29742. 0xfcd1,
  29743. "meemmeemisolatedarabic",
  29744. 0xfc48,
  29745. "meetorusquare",
  29746. 0x334d,
  29747. "mehiragana",
  29748. 0x3081,
  29749. "meizierasquare",
  29750. 0x337e,
  29751. "mekatakana",
  29752. 0x30e1,
  29753. "mekatakanahalfwidth",
  29754. 0xff92,
  29755. "mem",
  29756. 0x05de,
  29757. "memdagesh",
  29758. 0xfb3e,
  29759. "memdageshhebrew",
  29760. 0xfb3e,
  29761. "memhebrew",
  29762. 0x05de,
  29763. "menarmenian",
  29764. 0x0574,
  29765. "merkhahebrew",
  29766. 0x05a5,
  29767. "merkhakefulahebrew",
  29768. 0x05a6,
  29769. "merkhakefulalefthebrew",
  29770. 0x05a6,
  29771. "merkhalefthebrew",
  29772. 0x05a5,
  29773. "mhook",
  29774. 0x0271,
  29775. "mhzsquare",
  29776. 0x3392,
  29777. "middledotkatakanahalfwidth",
  29778. 0xff65,
  29779. "middot",
  29780. 0x00b7,
  29781. "mieumacirclekorean",
  29782. 0x3272,
  29783. "mieumaparenkorean",
  29784. 0x3212,
  29785. "mieumcirclekorean",
  29786. 0x3264,
  29787. "mieumkorean",
  29788. 0x3141,
  29789. "mieumpansioskorean",
  29790. 0x3170,
  29791. "mieumparenkorean",
  29792. 0x3204,
  29793. "mieumpieupkorean",
  29794. 0x316e,
  29795. "mieumsioskorean",
  29796. 0x316f,
  29797. "mihiragana",
  29798. 0x307f,
  29799. "mikatakana",
  29800. 0x30df,
  29801. "mikatakanahalfwidth",
  29802. 0xff90,
  29803. "minus",
  29804. 0x2212,
  29805. "minusbelowcmb",
  29806. 0x0320,
  29807. "minuscircle",
  29808. 0x2296,
  29809. "minusmod",
  29810. 0x02d7,
  29811. "minusplus",
  29812. 0x2213,
  29813. "minute",
  29814. 0x2032,
  29815. "miribaarusquare",
  29816. 0x334a,
  29817. "mirisquare",
  29818. 0x3349,
  29819. "mlonglegturned",
  29820. 0x0270,
  29821. "mlsquare",
  29822. 0x3396,
  29823. "mmcubedsquare",
  29824. 0x33a3,
  29825. "mmonospace",
  29826. 0xff4d,
  29827. "mmsquaredsquare",
  29828. 0x339f,
  29829. "mohiragana",
  29830. 0x3082,
  29831. "mohmsquare",
  29832. 0x33c1,
  29833. "mokatakana",
  29834. 0x30e2,
  29835. "mokatakanahalfwidth",
  29836. 0xff93,
  29837. "molsquare",
  29838. 0x33d6,
  29839. "momathai",
  29840. 0x0e21,
  29841. "moverssquare",
  29842. 0x33a7,
  29843. "moverssquaredsquare",
  29844. 0x33a8,
  29845. "mparen",
  29846. 0x24a8,
  29847. "mpasquare",
  29848. 0x33ab,
  29849. "mssquare",
  29850. 0x33b3,
  29851. "msuperior",
  29852. 0xf6ef,
  29853. "mturned",
  29854. 0x026f,
  29855. "mu",
  29856. 0x00b5,
  29857. "mu1",
  29858. 0x00b5,
  29859. "muasquare",
  29860. 0x3382,
  29861. "muchgreater",
  29862. 0x226b,
  29863. "muchless",
  29864. 0x226a,
  29865. "mufsquare",
  29866. 0x338c,
  29867. "mugreek",
  29868. 0x03bc,
  29869. "mugsquare",
  29870. 0x338d,
  29871. "muhiragana",
  29872. 0x3080,
  29873. "mukatakana",
  29874. 0x30e0,
  29875. "mukatakanahalfwidth",
  29876. 0xff91,
  29877. "mulsquare",
  29878. 0x3395,
  29879. "multiply",
  29880. 0x00d7,
  29881. "mumsquare",
  29882. 0x339b,
  29883. "munahhebrew",
  29884. 0x05a3,
  29885. "munahlefthebrew",
  29886. 0x05a3,
  29887. "musicalnote",
  29888. 0x266a,
  29889. "musicalnotedbl",
  29890. 0x266b,
  29891. "musicflatsign",
  29892. 0x266d,
  29893. "musicsharpsign",
  29894. 0x266f,
  29895. "mussquare",
  29896. 0x33b2,
  29897. "muvsquare",
  29898. 0x33b6,
  29899. "muwsquare",
  29900. 0x33bc,
  29901. "mvmegasquare",
  29902. 0x33b9,
  29903. "mvsquare",
  29904. 0x33b7,
  29905. "mwmegasquare",
  29906. 0x33bf,
  29907. "mwsquare",
  29908. 0x33bd,
  29909. "n",
  29910. 0x006e,
  29911. "nabengali",
  29912. 0x09a8,
  29913. "nabla",
  29914. 0x2207,
  29915. "nacute",
  29916. 0x0144,
  29917. "nadeva",
  29918. 0x0928,
  29919. "nagujarati",
  29920. 0x0aa8,
  29921. "nagurmukhi",
  29922. 0x0a28,
  29923. "nahiragana",
  29924. 0x306a,
  29925. "nakatakana",
  29926. 0x30ca,
  29927. "nakatakanahalfwidth",
  29928. 0xff85,
  29929. "napostrophe",
  29930. 0x0149,
  29931. "nasquare",
  29932. 0x3381,
  29933. "nbopomofo",
  29934. 0x310b,
  29935. "nbspace",
  29936. 0x00a0,
  29937. "ncaron",
  29938. 0x0148,
  29939. "ncedilla",
  29940. 0x0146,
  29941. "ncircle",
  29942. 0x24dd,
  29943. "ncircumflexbelow",
  29944. 0x1e4b,
  29945. "ncommaaccent",
  29946. 0x0146,
  29947. "ndotaccent",
  29948. 0x1e45,
  29949. "ndotbelow",
  29950. 0x1e47,
  29951. "nehiragana",
  29952. 0x306d,
  29953. "nekatakana",
  29954. 0x30cd,
  29955. "nekatakanahalfwidth",
  29956. 0xff88,
  29957. "newsheqelsign",
  29958. 0x20aa,
  29959. "nfsquare",
  29960. 0x338b,
  29961. "ngabengali",
  29962. 0x0999,
  29963. "ngadeva",
  29964. 0x0919,
  29965. "ngagujarati",
  29966. 0x0a99,
  29967. "ngagurmukhi",
  29968. 0x0a19,
  29969. "ngonguthai",
  29970. 0x0e07,
  29971. "nhiragana",
  29972. 0x3093,
  29973. "nhookleft",
  29974. 0x0272,
  29975. "nhookretroflex",
  29976. 0x0273,
  29977. "nieunacirclekorean",
  29978. 0x326f,
  29979. "nieunaparenkorean",
  29980. 0x320f,
  29981. "nieuncieuckorean",
  29982. 0x3135,
  29983. "nieuncirclekorean",
  29984. 0x3261,
  29985. "nieunhieuhkorean",
  29986. 0x3136,
  29987. "nieunkorean",
  29988. 0x3134,
  29989. "nieunpansioskorean",
  29990. 0x3168,
  29991. "nieunparenkorean",
  29992. 0x3201,
  29993. "nieunsioskorean",
  29994. 0x3167,
  29995. "nieuntikeutkorean",
  29996. 0x3166,
  29997. "nihiragana",
  29998. 0x306b,
  29999. "nikatakana",
  30000. 0x30cb,
  30001. "nikatakanahalfwidth",
  30002. 0xff86,
  30003. "nikhahitleftthai",
  30004. 0xf899,
  30005. "nikhahitthai",
  30006. 0x0e4d,
  30007. "nine",
  30008. 0x0039,
  30009. "ninearabic",
  30010. 0x0669,
  30011. "ninebengali",
  30012. 0x09ef,
  30013. "ninecircle",
  30014. 0x2468,
  30015. "ninecircleinversesansserif",
  30016. 0x2792,
  30017. "ninedeva",
  30018. 0x096f,
  30019. "ninegujarati",
  30020. 0x0aef,
  30021. "ninegurmukhi",
  30022. 0x0a6f,
  30023. "ninehackarabic",
  30024. 0x0669,
  30025. "ninehangzhou",
  30026. 0x3029,
  30027. "nineideographicparen",
  30028. 0x3228,
  30029. "nineinferior",
  30030. 0x2089,
  30031. "ninemonospace",
  30032. 0xff19,
  30033. "nineoldstyle",
  30034. 0xf739,
  30035. "nineparen",
  30036. 0x247c,
  30037. "nineperiod",
  30038. 0x2490,
  30039. "ninepersian",
  30040. 0x06f9,
  30041. "nineroman",
  30042. 0x2178,
  30043. "ninesuperior",
  30044. 0x2079,
  30045. "nineteencircle",
  30046. 0x2472,
  30047. "nineteenparen",
  30048. 0x2486,
  30049. "nineteenperiod",
  30050. 0x249a,
  30051. "ninethai",
  30052. 0x0e59,
  30053. "nj",
  30054. 0x01cc,
  30055. "njecyrillic",
  30056. 0x045a,
  30057. "nkatakana",
  30058. 0x30f3,
  30059. "nkatakanahalfwidth",
  30060. 0xff9d,
  30061. "nlegrightlong",
  30062. 0x019e,
  30063. "nlinebelow",
  30064. 0x1e49,
  30065. "nmonospace",
  30066. 0xff4e,
  30067. "nmsquare",
  30068. 0x339a,
  30069. "nnabengali",
  30070. 0x09a3,
  30071. "nnadeva",
  30072. 0x0923,
  30073. "nnagujarati",
  30074. 0x0aa3,
  30075. "nnagurmukhi",
  30076. 0x0a23,
  30077. "nnnadeva",
  30078. 0x0929,
  30079. "nohiragana",
  30080. 0x306e,
  30081. "nokatakana",
  30082. 0x30ce,
  30083. "nokatakanahalfwidth",
  30084. 0xff89,
  30085. "nonbreakingspace",
  30086. 0x00a0,
  30087. "nonenthai",
  30088. 0x0e13,
  30089. "nonuthai",
  30090. 0x0e19,
  30091. "noonarabic",
  30092. 0x0646,
  30093. "noonfinalarabic",
  30094. 0xfee6,
  30095. "noonghunnaarabic",
  30096. 0x06ba,
  30097. "noonghunnafinalarabic",
  30098. 0xfb9f,
  30099. "nooninitialarabic",
  30100. 0xfee7,
  30101. "noonjeeminitialarabic",
  30102. 0xfcd2,
  30103. "noonjeemisolatedarabic",
  30104. 0xfc4b,
  30105. "noonmedialarabic",
  30106. 0xfee8,
  30107. "noonmeeminitialarabic",
  30108. 0xfcd5,
  30109. "noonmeemisolatedarabic",
  30110. 0xfc4e,
  30111. "noonnoonfinalarabic",
  30112. 0xfc8d,
  30113. "notcontains",
  30114. 0x220c,
  30115. "notelement",
  30116. 0x2209,
  30117. "notelementof",
  30118. 0x2209,
  30119. "notequal",
  30120. 0x2260,
  30121. "notgreater",
  30122. 0x226f,
  30123. "notgreaternorequal",
  30124. 0x2271,
  30125. "notgreaternorless",
  30126. 0x2279,
  30127. "notidentical",
  30128. 0x2262,
  30129. "notless",
  30130. 0x226e,
  30131. "notlessnorequal",
  30132. 0x2270,
  30133. "notparallel",
  30134. 0x2226,
  30135. "notprecedes",
  30136. 0x2280,
  30137. "notsubset",
  30138. 0x2284,
  30139. "notsucceeds",
  30140. 0x2281,
  30141. "notsuperset",
  30142. 0x2285,
  30143. "nowarmenian",
  30144. 0x0576,
  30145. "nparen",
  30146. 0x24a9,
  30147. "nssquare",
  30148. 0x33b1,
  30149. "nsuperior",
  30150. 0x207f,
  30151. "ntilde",
  30152. 0x00f1,
  30153. "nu",
  30154. 0x03bd,
  30155. "nuhiragana",
  30156. 0x306c,
  30157. "nukatakana",
  30158. 0x30cc,
  30159. "nukatakanahalfwidth",
  30160. 0xff87,
  30161. "nuktabengali",
  30162. 0x09bc,
  30163. "nuktadeva",
  30164. 0x093c,
  30165. "nuktagujarati",
  30166. 0x0abc,
  30167. "nuktagurmukhi",
  30168. 0x0a3c,
  30169. "numbersign",
  30170. 0x0023,
  30171. "numbersignmonospace",
  30172. 0xff03,
  30173. "numbersignsmall",
  30174. 0xfe5f,
  30175. "numeralsigngreek",
  30176. 0x0374,
  30177. "numeralsignlowergreek",
  30178. 0x0375,
  30179. "numero",
  30180. 0x2116,
  30181. "nun",
  30182. 0x05e0,
  30183. "nundagesh",
  30184. 0xfb40,
  30185. "nundageshhebrew",
  30186. 0xfb40,
  30187. "nunhebrew",
  30188. 0x05e0,
  30189. "nvsquare",
  30190. 0x33b5,
  30191. "nwsquare",
  30192. 0x33bb,
  30193. "nyabengali",
  30194. 0x099e,
  30195. "nyadeva",
  30196. 0x091e,
  30197. "nyagujarati",
  30198. 0x0a9e,
  30199. "nyagurmukhi",
  30200. 0x0a1e,
  30201. "o",
  30202. 0x006f,
  30203. "oacute",
  30204. 0x00f3,
  30205. "oangthai",
  30206. 0x0e2d,
  30207. "obarred",
  30208. 0x0275,
  30209. "obarredcyrillic",
  30210. 0x04e9,
  30211. "obarreddieresiscyrillic",
  30212. 0x04eb,
  30213. "obengali",
  30214. 0x0993,
  30215. "obopomofo",
  30216. 0x311b,
  30217. "obreve",
  30218. 0x014f,
  30219. "ocandradeva",
  30220. 0x0911,
  30221. "ocandragujarati",
  30222. 0x0a91,
  30223. "ocandravowelsigndeva",
  30224. 0x0949,
  30225. "ocandravowelsigngujarati",
  30226. 0x0ac9,
  30227. "ocaron",
  30228. 0x01d2,
  30229. "ocircle",
  30230. 0x24de,
  30231. "ocircumflex",
  30232. 0x00f4,
  30233. "ocircumflexacute",
  30234. 0x1ed1,
  30235. "ocircumflexdotbelow",
  30236. 0x1ed9,
  30237. "ocircumflexgrave",
  30238. 0x1ed3,
  30239. "ocircumflexhookabove",
  30240. 0x1ed5,
  30241. "ocircumflextilde",
  30242. 0x1ed7,
  30243. "ocyrillic",
  30244. 0x043e,
  30245. "odblacute",
  30246. 0x0151,
  30247. "odblgrave",
  30248. 0x020d,
  30249. "odeva",
  30250. 0x0913,
  30251. "odieresis",
  30252. 0x00f6,
  30253. "odieresiscyrillic",
  30254. 0x04e7,
  30255. "odotbelow",
  30256. 0x1ecd,
  30257. "oe",
  30258. 0x0153,
  30259. "oekorean",
  30260. 0x315a,
  30261. "ogonek",
  30262. 0x02db,
  30263. "ogonekcmb",
  30264. 0x0328,
  30265. "ograve",
  30266. 0x00f2,
  30267. "ogujarati",
  30268. 0x0a93,
  30269. "oharmenian",
  30270. 0x0585,
  30271. "ohiragana",
  30272. 0x304a,
  30273. "ohookabove",
  30274. 0x1ecf,
  30275. "ohorn",
  30276. 0x01a1,
  30277. "ohornacute",
  30278. 0x1edb,
  30279. "ohorndotbelow",
  30280. 0x1ee3,
  30281. "ohorngrave",
  30282. 0x1edd,
  30283. "ohornhookabove",
  30284. 0x1edf,
  30285. "ohorntilde",
  30286. 0x1ee1,
  30287. "ohungarumlaut",
  30288. 0x0151,
  30289. "oi",
  30290. 0x01a3,
  30291. "oinvertedbreve",
  30292. 0x020f,
  30293. "okatakana",
  30294. 0x30aa,
  30295. "okatakanahalfwidth",
  30296. 0xff75,
  30297. "okorean",
  30298. 0x3157,
  30299. "olehebrew",
  30300. 0x05ab,
  30301. "omacron",
  30302. 0x014d,
  30303. "omacronacute",
  30304. 0x1e53,
  30305. "omacrongrave",
  30306. 0x1e51,
  30307. "omdeva",
  30308. 0x0950,
  30309. "omega",
  30310. 0x03c9,
  30311. "omega1",
  30312. 0x03d6,
  30313. "omegacyrillic",
  30314. 0x0461,
  30315. "omegalatinclosed",
  30316. 0x0277,
  30317. "omegaroundcyrillic",
  30318. 0x047b,
  30319. "omegatitlocyrillic",
  30320. 0x047d,
  30321. "omegatonos",
  30322. 0x03ce,
  30323. "omgujarati",
  30324. 0x0ad0,
  30325. "omicron",
  30326. 0x03bf,
  30327. "omicrontonos",
  30328. 0x03cc,
  30329. "omonospace",
  30330. 0xff4f,
  30331. "one",
  30332. 0x0031,
  30333. "onearabic",
  30334. 0x0661,
  30335. "onebengali",
  30336. 0x09e7,
  30337. "onecircle",
  30338. 0x2460,
  30339. "onecircleinversesansserif",
  30340. 0x278a,
  30341. "onedeva",
  30342. 0x0967,
  30343. "onedotenleader",
  30344. 0x2024,
  30345. "oneeighth",
  30346. 0x215b,
  30347. "onefitted",
  30348. 0xf6dc,
  30349. "onegujarati",
  30350. 0x0ae7,
  30351. "onegurmukhi",
  30352. 0x0a67,
  30353. "onehackarabic",
  30354. 0x0661,
  30355. "onehalf",
  30356. 0x00bd,
  30357. "onehangzhou",
  30358. 0x3021,
  30359. "oneideographicparen",
  30360. 0x3220,
  30361. "oneinferior",
  30362. 0x2081,
  30363. "onemonospace",
  30364. 0xff11,
  30365. "onenumeratorbengali",
  30366. 0x09f4,
  30367. "oneoldstyle",
  30368. 0xf731,
  30369. "oneparen",
  30370. 0x2474,
  30371. "oneperiod",
  30372. 0x2488,
  30373. "onepersian",
  30374. 0x06f1,
  30375. "onequarter",
  30376. 0x00bc,
  30377. "oneroman",
  30378. 0x2170,
  30379. "onesuperior",
  30380. 0x00b9,
  30381. "onethai",
  30382. 0x0e51,
  30383. "onethird",
  30384. 0x2153,
  30385. "oogonek",
  30386. 0x01eb,
  30387. "oogonekmacron",
  30388. 0x01ed,
  30389. "oogurmukhi",
  30390. 0x0a13,
  30391. "oomatragurmukhi",
  30392. 0x0a4b,
  30393. "oopen",
  30394. 0x0254,
  30395. "oparen",
  30396. 0x24aa,
  30397. "openbullet",
  30398. 0x25e6,
  30399. "option",
  30400. 0x2325,
  30401. "ordfeminine",
  30402. 0x00aa,
  30403. "ordmasculine",
  30404. 0x00ba,
  30405. "orthogonal",
  30406. 0x221f,
  30407. "oshortdeva",
  30408. 0x0912,
  30409. "oshortvowelsigndeva",
  30410. 0x094a,
  30411. "oslash",
  30412. 0x00f8,
  30413. "oslashacute",
  30414. 0x01ff,
  30415. "osmallhiragana",
  30416. 0x3049,
  30417. "osmallkatakana",
  30418. 0x30a9,
  30419. "osmallkatakanahalfwidth",
  30420. 0xff6b,
  30421. "ostrokeacute",
  30422. 0x01ff,
  30423. "osuperior",
  30424. 0xf6f0,
  30425. "otcyrillic",
  30426. 0x047f,
  30427. "otilde",
  30428. 0x00f5,
  30429. "otildeacute",
  30430. 0x1e4d,
  30431. "otildedieresis",
  30432. 0x1e4f,
  30433. "oubopomofo",
  30434. 0x3121,
  30435. "overline",
  30436. 0x203e,
  30437. "overlinecenterline",
  30438. 0xfe4a,
  30439. "overlinecmb",
  30440. 0x0305,
  30441. "overlinedashed",
  30442. 0xfe49,
  30443. "overlinedblwavy",
  30444. 0xfe4c,
  30445. "overlinewavy",
  30446. 0xfe4b,
  30447. "overscore",
  30448. 0x00af,
  30449. "ovowelsignbengali",
  30450. 0x09cb,
  30451. "ovowelsigndeva",
  30452. 0x094b,
  30453. "ovowelsigngujarati",
  30454. 0x0acb,
  30455. "p",
  30456. 0x0070,
  30457. "paampssquare",
  30458. 0x3380,
  30459. "paasentosquare",
  30460. 0x332b,
  30461. "pabengali",
  30462. 0x09aa,
  30463. "pacute",
  30464. 0x1e55,
  30465. "padeva",
  30466. 0x092a,
  30467. "pagedown",
  30468. 0x21df,
  30469. "pageup",
  30470. 0x21de,
  30471. "pagujarati",
  30472. 0x0aaa,
  30473. "pagurmukhi",
  30474. 0x0a2a,
  30475. "pahiragana",
  30476. 0x3071,
  30477. "paiyannoithai",
  30478. 0x0e2f,
  30479. "pakatakana",
  30480. 0x30d1,
  30481. "palatalizationcyrilliccmb",
  30482. 0x0484,
  30483. "palochkacyrillic",
  30484. 0x04c0,
  30485. "pansioskorean",
  30486. 0x317f,
  30487. "paragraph",
  30488. 0x00b6,
  30489. "parallel",
  30490. 0x2225,
  30491. "parenleft",
  30492. 0x0028,
  30493. "parenleftaltonearabic",
  30494. 0xfd3e,
  30495. "parenleftbt",
  30496. 0xf8ed,
  30497. "parenleftex",
  30498. 0xf8ec,
  30499. "parenleftinferior",
  30500. 0x208d,
  30501. "parenleftmonospace",
  30502. 0xff08,
  30503. "parenleftsmall",
  30504. 0xfe59,
  30505. "parenleftsuperior",
  30506. 0x207d,
  30507. "parenlefttp",
  30508. 0xf8eb,
  30509. "parenleftvertical",
  30510. 0xfe35,
  30511. "parenright",
  30512. 0x0029,
  30513. "parenrightaltonearabic",
  30514. 0xfd3f,
  30515. "parenrightbt",
  30516. 0xf8f8,
  30517. "parenrightex",
  30518. 0xf8f7,
  30519. "parenrightinferior",
  30520. 0x208e,
  30521. "parenrightmonospace",
  30522. 0xff09,
  30523. "parenrightsmall",
  30524. 0xfe5a,
  30525. "parenrightsuperior",
  30526. 0x207e,
  30527. "parenrighttp",
  30528. 0xf8f6,
  30529. "parenrightvertical",
  30530. 0xfe36,
  30531. "partialdiff",
  30532. 0x2202,
  30533. "paseqhebrew",
  30534. 0x05c0,
  30535. "pashtahebrew",
  30536. 0x0599,
  30537. "pasquare",
  30538. 0x33a9,
  30539. "patah",
  30540. 0x05b7,
  30541. "patah11",
  30542. 0x05b7,
  30543. "patah1d",
  30544. 0x05b7,
  30545. "patah2a",
  30546. 0x05b7,
  30547. "patahhebrew",
  30548. 0x05b7,
  30549. "patahnarrowhebrew",
  30550. 0x05b7,
  30551. "patahquarterhebrew",
  30552. 0x05b7,
  30553. "patahwidehebrew",
  30554. 0x05b7,
  30555. "pazerhebrew",
  30556. 0x05a1,
  30557. "pbopomofo",
  30558. 0x3106,
  30559. "pcircle",
  30560. 0x24df,
  30561. "pdotaccent",
  30562. 0x1e57,
  30563. "pe",
  30564. 0x05e4,
  30565. "pecyrillic",
  30566. 0x043f,
  30567. "pedagesh",
  30568. 0xfb44,
  30569. "pedageshhebrew",
  30570. 0xfb44,
  30571. "peezisquare",
  30572. 0x333b,
  30573. "pefinaldageshhebrew",
  30574. 0xfb43,
  30575. "peharabic",
  30576. 0x067e,
  30577. "peharmenian",
  30578. 0x057a,
  30579. "pehebrew",
  30580. 0x05e4,
  30581. "pehfinalarabic",
  30582. 0xfb57,
  30583. "pehinitialarabic",
  30584. 0xfb58,
  30585. "pehiragana",
  30586. 0x307a,
  30587. "pehmedialarabic",
  30588. 0xfb59,
  30589. "pekatakana",
  30590. 0x30da,
  30591. "pemiddlehookcyrillic",
  30592. 0x04a7,
  30593. "perafehebrew",
  30594. 0xfb4e,
  30595. "percent",
  30596. 0x0025,
  30597. "percentarabic",
  30598. 0x066a,
  30599. "percentmonospace",
  30600. 0xff05,
  30601. "percentsmall",
  30602. 0xfe6a,
  30603. "period",
  30604. 0x002e,
  30605. "periodarmenian",
  30606. 0x0589,
  30607. "periodcentered",
  30608. 0x00b7,
  30609. "periodhalfwidth",
  30610. 0xff61,
  30611. "periodinferior",
  30612. 0xf6e7,
  30613. "periodmonospace",
  30614. 0xff0e,
  30615. "periodsmall",
  30616. 0xfe52,
  30617. "periodsuperior",
  30618. 0xf6e8,
  30619. "perispomenigreekcmb",
  30620. 0x0342,
  30621. "perpendicular",
  30622. 0x22a5,
  30623. "perthousand",
  30624. 0x2030,
  30625. "peseta",
  30626. 0x20a7,
  30627. "pfsquare",
  30628. 0x338a,
  30629. "phabengali",
  30630. 0x09ab,
  30631. "phadeva",
  30632. 0x092b,
  30633. "phagujarati",
  30634. 0x0aab,
  30635. "phagurmukhi",
  30636. 0x0a2b,
  30637. "phi",
  30638. 0x03c6,
  30639. "phi1",
  30640. 0x03d5,
  30641. "phieuphacirclekorean",
  30642. 0x327a,
  30643. "phieuphaparenkorean",
  30644. 0x321a,
  30645. "phieuphcirclekorean",
  30646. 0x326c,
  30647. "phieuphkorean",
  30648. 0x314d,
  30649. "phieuphparenkorean",
  30650. 0x320c,
  30651. "philatin",
  30652. 0x0278,
  30653. "phinthuthai",
  30654. 0x0e3a,
  30655. "phisymbolgreek",
  30656. 0x03d5,
  30657. "phook",
  30658. 0x01a5,
  30659. "phophanthai",
  30660. 0x0e1e,
  30661. "phophungthai",
  30662. 0x0e1c,
  30663. "phosamphaothai",
  30664. 0x0e20,
  30665. "pi",
  30666. 0x03c0,
  30667. "pieupacirclekorean",
  30668. 0x3273,
  30669. "pieupaparenkorean",
  30670. 0x3213,
  30671. "pieupcieuckorean",
  30672. 0x3176,
  30673. "pieupcirclekorean",
  30674. 0x3265,
  30675. "pieupkiyeokkorean",
  30676. 0x3172,
  30677. "pieupkorean",
  30678. 0x3142,
  30679. "pieupparenkorean",
  30680. 0x3205,
  30681. "pieupsioskiyeokkorean",
  30682. 0x3174,
  30683. "pieupsioskorean",
  30684. 0x3144,
  30685. "pieupsiostikeutkorean",
  30686. 0x3175,
  30687. "pieupthieuthkorean",
  30688. 0x3177,
  30689. "pieuptikeutkorean",
  30690. 0x3173,
  30691. "pihiragana",
  30692. 0x3074,
  30693. "pikatakana",
  30694. 0x30d4,
  30695. "pisymbolgreek",
  30696. 0x03d6,
  30697. "piwrarmenian",
  30698. 0x0583,
  30699. "plus",
  30700. 0x002b,
  30701. "plusbelowcmb",
  30702. 0x031f,
  30703. "pluscircle",
  30704. 0x2295,
  30705. "plusminus",
  30706. 0x00b1,
  30707. "plusmod",
  30708. 0x02d6,
  30709. "plusmonospace",
  30710. 0xff0b,
  30711. "plussmall",
  30712. 0xfe62,
  30713. "plussuperior",
  30714. 0x207a,
  30715. "pmonospace",
  30716. 0xff50,
  30717. "pmsquare",
  30718. 0x33d8,
  30719. "pohiragana",
  30720. 0x307d,
  30721. "pointingindexdownwhite",
  30722. 0x261f,
  30723. "pointingindexleftwhite",
  30724. 0x261c,
  30725. "pointingindexrightwhite",
  30726. 0x261e,
  30727. "pointingindexupwhite",
  30728. 0x261d,
  30729. "pokatakana",
  30730. 0x30dd,
  30731. "poplathai",
  30732. 0x0e1b,
  30733. "postalmark",
  30734. 0x3012,
  30735. "postalmarkface",
  30736. 0x3020,
  30737. "pparen",
  30738. 0x24ab,
  30739. "precedes",
  30740. 0x227a,
  30741. "prescription",
  30742. 0x211e,
  30743. "primemod",
  30744. 0x02b9,
  30745. "primereversed",
  30746. 0x2035,
  30747. "product",
  30748. 0x220f,
  30749. "projective",
  30750. 0x2305,
  30751. "prolongedkana",
  30752. 0x30fc,
  30753. "propellor",
  30754. 0x2318,
  30755. "propersubset",
  30756. 0x2282,
  30757. "propersuperset",
  30758. 0x2283,
  30759. "proportion",
  30760. 0x2237,
  30761. "proportional",
  30762. 0x221d,
  30763. "psi",
  30764. 0x03c8,
  30765. "psicyrillic",
  30766. 0x0471,
  30767. "psilipneumatacyrilliccmb",
  30768. 0x0486,
  30769. "pssquare",
  30770. 0x33b0,
  30771. "puhiragana",
  30772. 0x3077,
  30773. "pukatakana",
  30774. 0x30d7,
  30775. "pvsquare",
  30776. 0x33b4,
  30777. "pwsquare",
  30778. 0x33ba,
  30779. "q",
  30780. 0x0071,
  30781. "qadeva",
  30782. 0x0958,
  30783. "qadmahebrew",
  30784. 0x05a8,
  30785. "qafarabic",
  30786. 0x0642,
  30787. "qaffinalarabic",
  30788. 0xfed6,
  30789. "qafinitialarabic",
  30790. 0xfed7,
  30791. "qafmedialarabic",
  30792. 0xfed8,
  30793. "qamats",
  30794. 0x05b8,
  30795. "qamats10",
  30796. 0x05b8,
  30797. "qamats1a",
  30798. 0x05b8,
  30799. "qamats1c",
  30800. 0x05b8,
  30801. "qamats27",
  30802. 0x05b8,
  30803. "qamats29",
  30804. 0x05b8,
  30805. "qamats33",
  30806. 0x05b8,
  30807. "qamatsde",
  30808. 0x05b8,
  30809. "qamatshebrew",
  30810. 0x05b8,
  30811. "qamatsnarrowhebrew",
  30812. 0x05b8,
  30813. "qamatsqatanhebrew",
  30814. 0x05b8,
  30815. "qamatsqatannarrowhebrew",
  30816. 0x05b8,
  30817. "qamatsqatanquarterhebrew",
  30818. 0x05b8,
  30819. "qamatsqatanwidehebrew",
  30820. 0x05b8,
  30821. "qamatsquarterhebrew",
  30822. 0x05b8,
  30823. "qamatswidehebrew",
  30824. 0x05b8,
  30825. "qarneyparahebrew",
  30826. 0x059f,
  30827. "qbopomofo",
  30828. 0x3111,
  30829. "qcircle",
  30830. 0x24e0,
  30831. "qhook",
  30832. 0x02a0,
  30833. "qmonospace",
  30834. 0xff51,
  30835. "qof",
  30836. 0x05e7,
  30837. "qofdagesh",
  30838. 0xfb47,
  30839. "qofdageshhebrew",
  30840. 0xfb47,
  30841. "qofhebrew",
  30842. 0x05e7,
  30843. "qparen",
  30844. 0x24ac,
  30845. "quarternote",
  30846. 0x2669,
  30847. "qubuts",
  30848. 0x05bb,
  30849. "qubuts18",
  30850. 0x05bb,
  30851. "qubuts25",
  30852. 0x05bb,
  30853. "qubuts31",
  30854. 0x05bb,
  30855. "qubutshebrew",
  30856. 0x05bb,
  30857. "qubutsnarrowhebrew",
  30858. 0x05bb,
  30859. "qubutsquarterhebrew",
  30860. 0x05bb,
  30861. "qubutswidehebrew",
  30862. 0x05bb,
  30863. "question",
  30864. 0x003f,
  30865. "questionarabic",
  30866. 0x061f,
  30867. "questionarmenian",
  30868. 0x055e,
  30869. "questiondown",
  30870. 0x00bf,
  30871. "questiondownsmall",
  30872. 0xf7bf,
  30873. "questiongreek",
  30874. 0x037e,
  30875. "questionmonospace",
  30876. 0xff1f,
  30877. "questionsmall",
  30878. 0xf73f,
  30879. "quotedbl",
  30880. 0x0022,
  30881. "quotedblbase",
  30882. 0x201e,
  30883. "quotedblleft",
  30884. 0x201c,
  30885. "quotedblmonospace",
  30886. 0xff02,
  30887. "quotedblprime",
  30888. 0x301e,
  30889. "quotedblprimereversed",
  30890. 0x301d,
  30891. "quotedblright",
  30892. 0x201d,
  30893. "quoteleft",
  30894. 0x2018,
  30895. "quoteleftreversed",
  30896. 0x201b,
  30897. "quotereversed",
  30898. 0x201b,
  30899. "quoteright",
  30900. 0x2019,
  30901. "quoterightn",
  30902. 0x0149,
  30903. "quotesinglbase",
  30904. 0x201a,
  30905. "quotesingle",
  30906. 0x0027,
  30907. "quotesinglemonospace",
  30908. 0xff07,
  30909. "r",
  30910. 0x0072,
  30911. "raarmenian",
  30912. 0x057c,
  30913. "rabengali",
  30914. 0x09b0,
  30915. "racute",
  30916. 0x0155,
  30917. "radeva",
  30918. 0x0930,
  30919. "radical",
  30920. 0x221a,
  30921. "radicalex",
  30922. 0xf8e5,
  30923. "radoverssquare",
  30924. 0x33ae,
  30925. "radoverssquaredsquare",
  30926. 0x33af,
  30927. "radsquare",
  30928. 0x33ad,
  30929. "rafe",
  30930. 0x05bf,
  30931. "rafehebrew",
  30932. 0x05bf,
  30933. "ragujarati",
  30934. 0x0ab0,
  30935. "ragurmukhi",
  30936. 0x0a30,
  30937. "rahiragana",
  30938. 0x3089,
  30939. "rakatakana",
  30940. 0x30e9,
  30941. "rakatakanahalfwidth",
  30942. 0xff97,
  30943. "ralowerdiagonalbengali",
  30944. 0x09f1,
  30945. "ramiddlediagonalbengali",
  30946. 0x09f0,
  30947. "ramshorn",
  30948. 0x0264,
  30949. "ratio",
  30950. 0x2236,
  30951. "rbopomofo",
  30952. 0x3116,
  30953. "rcaron",
  30954. 0x0159,
  30955. "rcedilla",
  30956. 0x0157,
  30957. "rcircle",
  30958. 0x24e1,
  30959. "rcommaaccent",
  30960. 0x0157,
  30961. "rdblgrave",
  30962. 0x0211,
  30963. "rdotaccent",
  30964. 0x1e59,
  30965. "rdotbelow",
  30966. 0x1e5b,
  30967. "rdotbelowmacron",
  30968. 0x1e5d,
  30969. "referencemark",
  30970. 0x203b,
  30971. "reflexsubset",
  30972. 0x2286,
  30973. "reflexsuperset",
  30974. 0x2287,
  30975. "registered",
  30976. 0x00ae,
  30977. "registersans",
  30978. 0xf8e8,
  30979. "registerserif",
  30980. 0xf6da,
  30981. "reharabic",
  30982. 0x0631,
  30983. "reharmenian",
  30984. 0x0580,
  30985. "rehfinalarabic",
  30986. 0xfeae,
  30987. "rehiragana",
  30988. 0x308c,
  30989. "rekatakana",
  30990. 0x30ec,
  30991. "rekatakanahalfwidth",
  30992. 0xff9a,
  30993. "resh",
  30994. 0x05e8,
  30995. "reshdageshhebrew",
  30996. 0xfb48,
  30997. "reshhebrew",
  30998. 0x05e8,
  30999. "reversedtilde",
  31000. 0x223d,
  31001. "reviahebrew",
  31002. 0x0597,
  31003. "reviamugrashhebrew",
  31004. 0x0597,
  31005. "revlogicalnot",
  31006. 0x2310,
  31007. "rfishhook",
  31008. 0x027e,
  31009. "rfishhookreversed",
  31010. 0x027f,
  31011. "rhabengali",
  31012. 0x09dd,
  31013. "rhadeva",
  31014. 0x095d,
  31015. "rho",
  31016. 0x03c1,
  31017. "rhook",
  31018. 0x027d,
  31019. "rhookturned",
  31020. 0x027b,
  31021. "rhookturnedsuperior",
  31022. 0x02b5,
  31023. "rhosymbolgreek",
  31024. 0x03f1,
  31025. "rhotichookmod",
  31026. 0x02de,
  31027. "rieulacirclekorean",
  31028. 0x3271,
  31029. "rieulaparenkorean",
  31030. 0x3211,
  31031. "rieulcirclekorean",
  31032. 0x3263,
  31033. "rieulhieuhkorean",
  31034. 0x3140,
  31035. "rieulkiyeokkorean",
  31036. 0x313a,
  31037. "rieulkiyeoksioskorean",
  31038. 0x3169,
  31039. "rieulkorean",
  31040. 0x3139,
  31041. "rieulmieumkorean",
  31042. 0x313b,
  31043. "rieulpansioskorean",
  31044. 0x316c,
  31045. "rieulparenkorean",
  31046. 0x3203,
  31047. "rieulphieuphkorean",
  31048. 0x313f,
  31049. "rieulpieupkorean",
  31050. 0x313c,
  31051. "rieulpieupsioskorean",
  31052. 0x316b,
  31053. "rieulsioskorean",
  31054. 0x313d,
  31055. "rieulthieuthkorean",
  31056. 0x313e,
  31057. "rieultikeutkorean",
  31058. 0x316a,
  31059. "rieulyeorinhieuhkorean",
  31060. 0x316d,
  31061. "rightangle",
  31062. 0x221f,
  31063. "righttackbelowcmb",
  31064. 0x0319,
  31065. "righttriangle",
  31066. 0x22bf,
  31067. "rihiragana",
  31068. 0x308a,
  31069. "rikatakana",
  31070. 0x30ea,
  31071. "rikatakanahalfwidth",
  31072. 0xff98,
  31073. "ring",
  31074. 0x02da,
  31075. "ringbelowcmb",
  31076. 0x0325,
  31077. "ringcmb",
  31078. 0x030a,
  31079. "ringhalfleft",
  31080. 0x02bf,
  31081. "ringhalfleftarmenian",
  31082. 0x0559,
  31083. "ringhalfleftbelowcmb",
  31084. 0x031c,
  31085. "ringhalfleftcentered",
  31086. 0x02d3,
  31087. "ringhalfright",
  31088. 0x02be,
  31089. "ringhalfrightbelowcmb",
  31090. 0x0339,
  31091. "ringhalfrightcentered",
  31092. 0x02d2,
  31093. "rinvertedbreve",
  31094. 0x0213,
  31095. "rittorusquare",
  31096. 0x3351,
  31097. "rlinebelow",
  31098. 0x1e5f,
  31099. "rlongleg",
  31100. 0x027c,
  31101. "rlonglegturned",
  31102. 0x027a,
  31103. "rmonospace",
  31104. 0xff52,
  31105. "rohiragana",
  31106. 0x308d,
  31107. "rokatakana",
  31108. 0x30ed,
  31109. "rokatakanahalfwidth",
  31110. 0xff9b,
  31111. "roruathai",
  31112. 0x0e23,
  31113. "rparen",
  31114. 0x24ad,
  31115. "rrabengali",
  31116. 0x09dc,
  31117. "rradeva",
  31118. 0x0931,
  31119. "rragurmukhi",
  31120. 0x0a5c,
  31121. "rreharabic",
  31122. 0x0691,
  31123. "rrehfinalarabic",
  31124. 0xfb8d,
  31125. "rrvocalicbengali",
  31126. 0x09e0,
  31127. "rrvocalicdeva",
  31128. 0x0960,
  31129. "rrvocalicgujarati",
  31130. 0x0ae0,
  31131. "rrvocalicvowelsignbengali",
  31132. 0x09c4,
  31133. "rrvocalicvowelsigndeva",
  31134. 0x0944,
  31135. "rrvocalicvowelsigngujarati",
  31136. 0x0ac4,
  31137. "rsuperior",
  31138. 0xf6f1,
  31139. "rtblock",
  31140. 0x2590,
  31141. "rturned",
  31142. 0x0279,
  31143. "rturnedsuperior",
  31144. 0x02b4,
  31145. "ruhiragana",
  31146. 0x308b,
  31147. "rukatakana",
  31148. 0x30eb,
  31149. "rukatakanahalfwidth",
  31150. 0xff99,
  31151. "rupeemarkbengali",
  31152. 0x09f2,
  31153. "rupeesignbengali",
  31154. 0x09f3,
  31155. "rupiah",
  31156. 0xf6dd,
  31157. "ruthai",
  31158. 0x0e24,
  31159. "rvocalicbengali",
  31160. 0x098b,
  31161. "rvocalicdeva",
  31162. 0x090b,
  31163. "rvocalicgujarati",
  31164. 0x0a8b,
  31165. "rvocalicvowelsignbengali",
  31166. 0x09c3,
  31167. "rvocalicvowelsigndeva",
  31168. 0x0943,
  31169. "rvocalicvowelsigngujarati",
  31170. 0x0ac3,
  31171. "s",
  31172. 0x0073,
  31173. "sabengali",
  31174. 0x09b8,
  31175. "sacute",
  31176. 0x015b,
  31177. "sacutedotaccent",
  31178. 0x1e65,
  31179. "sadarabic",
  31180. 0x0635,
  31181. "sadeva",
  31182. 0x0938,
  31183. "sadfinalarabic",
  31184. 0xfeba,
  31185. "sadinitialarabic",
  31186. 0xfebb,
  31187. "sadmedialarabic",
  31188. 0xfebc,
  31189. "sagujarati",
  31190. 0x0ab8,
  31191. "sagurmukhi",
  31192. 0x0a38,
  31193. "sahiragana",
  31194. 0x3055,
  31195. "sakatakana",
  31196. 0x30b5,
  31197. "sakatakanahalfwidth",
  31198. 0xff7b,
  31199. "sallallahoualayhewasallamarabic",
  31200. 0xfdfa,
  31201. "samekh",
  31202. 0x05e1,
  31203. "samekhdagesh",
  31204. 0xfb41,
  31205. "samekhdageshhebrew",
  31206. 0xfb41,
  31207. "samekhhebrew",
  31208. 0x05e1,
  31209. "saraaathai",
  31210. 0x0e32,
  31211. "saraaethai",
  31212. 0x0e41,
  31213. "saraaimaimalaithai",
  31214. 0x0e44,
  31215. "saraaimaimuanthai",
  31216. 0x0e43,
  31217. "saraamthai",
  31218. 0x0e33,
  31219. "saraathai",
  31220. 0x0e30,
  31221. "saraethai",
  31222. 0x0e40,
  31223. "saraiileftthai",
  31224. 0xf886,
  31225. "saraiithai",
  31226. 0x0e35,
  31227. "saraileftthai",
  31228. 0xf885,
  31229. "saraithai",
  31230. 0x0e34,
  31231. "saraothai",
  31232. 0x0e42,
  31233. "saraueeleftthai",
  31234. 0xf888,
  31235. "saraueethai",
  31236. 0x0e37,
  31237. "saraueleftthai",
  31238. 0xf887,
  31239. "sarauethai",
  31240. 0x0e36,
  31241. "sarauthai",
  31242. 0x0e38,
  31243. "sarauuthai",
  31244. 0x0e39,
  31245. "sbopomofo",
  31246. 0x3119,
  31247. "scaron",
  31248. 0x0161,
  31249. "scarondotaccent",
  31250. 0x1e67,
  31251. "scedilla",
  31252. 0x015f,
  31253. "schwa",
  31254. 0x0259,
  31255. "schwacyrillic",
  31256. 0x04d9,
  31257. "schwadieresiscyrillic",
  31258. 0x04db,
  31259. "schwahook",
  31260. 0x025a,
  31261. "scircle",
  31262. 0x24e2,
  31263. "scircumflex",
  31264. 0x015d,
  31265. "scommaaccent",
  31266. 0x0219,
  31267. "sdotaccent",
  31268. 0x1e61,
  31269. "sdotbelow",
  31270. 0x1e63,
  31271. "sdotbelowdotaccent",
  31272. 0x1e69,
  31273. "seagullbelowcmb",
  31274. 0x033c,
  31275. "second",
  31276. 0x2033,
  31277. "secondtonechinese",
  31278. 0x02ca,
  31279. "section",
  31280. 0x00a7,
  31281. "seenarabic",
  31282. 0x0633,
  31283. "seenfinalarabic",
  31284. 0xfeb2,
  31285. "seeninitialarabic",
  31286. 0xfeb3,
  31287. "seenmedialarabic",
  31288. 0xfeb4,
  31289. "segol",
  31290. 0x05b6,
  31291. "segol13",
  31292. 0x05b6,
  31293. "segol1f",
  31294. 0x05b6,
  31295. "segol2c",
  31296. 0x05b6,
  31297. "segolhebrew",
  31298. 0x05b6,
  31299. "segolnarrowhebrew",
  31300. 0x05b6,
  31301. "segolquarterhebrew",
  31302. 0x05b6,
  31303. "segoltahebrew",
  31304. 0x0592,
  31305. "segolwidehebrew",
  31306. 0x05b6,
  31307. "seharmenian",
  31308. 0x057d,
  31309. "sehiragana",
  31310. 0x305b,
  31311. "sekatakana",
  31312. 0x30bb,
  31313. "sekatakanahalfwidth",
  31314. 0xff7e,
  31315. "semicolon",
  31316. 0x003b,
  31317. "semicolonarabic",
  31318. 0x061b,
  31319. "semicolonmonospace",
  31320. 0xff1b,
  31321. "semicolonsmall",
  31322. 0xfe54,
  31323. "semivoicedmarkkana",
  31324. 0x309c,
  31325. "semivoicedmarkkanahalfwidth",
  31326. 0xff9f,
  31327. "sentisquare",
  31328. 0x3322,
  31329. "sentosquare",
  31330. 0x3323,
  31331. "seven",
  31332. 0x0037,
  31333. "sevenarabic",
  31334. 0x0667,
  31335. "sevenbengali",
  31336. 0x09ed,
  31337. "sevencircle",
  31338. 0x2466,
  31339. "sevencircleinversesansserif",
  31340. 0x2790,
  31341. "sevendeva",
  31342. 0x096d,
  31343. "seveneighths",
  31344. 0x215e,
  31345. "sevengujarati",
  31346. 0x0aed,
  31347. "sevengurmukhi",
  31348. 0x0a6d,
  31349. "sevenhackarabic",
  31350. 0x0667,
  31351. "sevenhangzhou",
  31352. 0x3027,
  31353. "sevenideographicparen",
  31354. 0x3226,
  31355. "seveninferior",
  31356. 0x2087,
  31357. "sevenmonospace",
  31358. 0xff17,
  31359. "sevenoldstyle",
  31360. 0xf737,
  31361. "sevenparen",
  31362. 0x247a,
  31363. "sevenperiod",
  31364. 0x248e,
  31365. "sevenpersian",
  31366. 0x06f7,
  31367. "sevenroman",
  31368. 0x2176,
  31369. "sevensuperior",
  31370. 0x2077,
  31371. "seventeencircle",
  31372. 0x2470,
  31373. "seventeenparen",
  31374. 0x2484,
  31375. "seventeenperiod",
  31376. 0x2498,
  31377. "seventhai",
  31378. 0x0e57,
  31379. "sfthyphen",
  31380. 0x00ad,
  31381. "shaarmenian",
  31382. 0x0577,
  31383. "shabengali",
  31384. 0x09b6,
  31385. "shacyrillic",
  31386. 0x0448,
  31387. "shaddaarabic",
  31388. 0x0651,
  31389. "shaddadammaarabic",
  31390. 0xfc61,
  31391. "shaddadammatanarabic",
  31392. 0xfc5e,
  31393. "shaddafathaarabic",
  31394. 0xfc60,
  31395. "shaddakasraarabic",
  31396. 0xfc62,
  31397. "shaddakasratanarabic",
  31398. 0xfc5f,
  31399. "shade",
  31400. 0x2592,
  31401. "shadedark",
  31402. 0x2593,
  31403. "shadelight",
  31404. 0x2591,
  31405. "shademedium",
  31406. 0x2592,
  31407. "shadeva",
  31408. 0x0936,
  31409. "shagujarati",
  31410. 0x0ab6,
  31411. "shagurmukhi",
  31412. 0x0a36,
  31413. "shalshelethebrew",
  31414. 0x0593,
  31415. "shbopomofo",
  31416. 0x3115,
  31417. "shchacyrillic",
  31418. 0x0449,
  31419. "sheenarabic",
  31420. 0x0634,
  31421. "sheenfinalarabic",
  31422. 0xfeb6,
  31423. "sheeninitialarabic",
  31424. 0xfeb7,
  31425. "sheenmedialarabic",
  31426. 0xfeb8,
  31427. "sheicoptic",
  31428. 0x03e3,
  31429. "sheqel",
  31430. 0x20aa,
  31431. "sheqelhebrew",
  31432. 0x20aa,
  31433. "sheva",
  31434. 0x05b0,
  31435. "sheva115",
  31436. 0x05b0,
  31437. "sheva15",
  31438. 0x05b0,
  31439. "sheva22",
  31440. 0x05b0,
  31441. "sheva2e",
  31442. 0x05b0,
  31443. "shevahebrew",
  31444. 0x05b0,
  31445. "shevanarrowhebrew",
  31446. 0x05b0,
  31447. "shevaquarterhebrew",
  31448. 0x05b0,
  31449. "shevawidehebrew",
  31450. 0x05b0,
  31451. "shhacyrillic",
  31452. 0x04bb,
  31453. "shimacoptic",
  31454. 0x03ed,
  31455. "shin",
  31456. 0x05e9,
  31457. "shindagesh",
  31458. 0xfb49,
  31459. "shindageshhebrew",
  31460. 0xfb49,
  31461. "shindageshshindot",
  31462. 0xfb2c,
  31463. "shindageshshindothebrew",
  31464. 0xfb2c,
  31465. "shindageshsindot",
  31466. 0xfb2d,
  31467. "shindageshsindothebrew",
  31468. 0xfb2d,
  31469. "shindothebrew",
  31470. 0x05c1,
  31471. "shinhebrew",
  31472. 0x05e9,
  31473. "shinshindot",
  31474. 0xfb2a,
  31475. "shinshindothebrew",
  31476. 0xfb2a,
  31477. "shinsindot",
  31478. 0xfb2b,
  31479. "shinsindothebrew",
  31480. 0xfb2b,
  31481. "shook",
  31482. 0x0282,
  31483. "sigma",
  31484. 0x03c3,
  31485. "sigma1",
  31486. 0x03c2,
  31487. "sigmafinal",
  31488. 0x03c2,
  31489. "sigmalunatesymbolgreek",
  31490. 0x03f2,
  31491. "sihiragana",
  31492. 0x3057,
  31493. "sikatakana",
  31494. 0x30b7,
  31495. "sikatakanahalfwidth",
  31496. 0xff7c,
  31497. "siluqhebrew",
  31498. 0x05bd,
  31499. "siluqlefthebrew",
  31500. 0x05bd,
  31501. "similar",
  31502. 0x223c,
  31503. "sindothebrew",
  31504. 0x05c2,
  31505. "siosacirclekorean",
  31506. 0x3274,
  31507. "siosaparenkorean",
  31508. 0x3214,
  31509. "sioscieuckorean",
  31510. 0x317e,
  31511. "sioscirclekorean",
  31512. 0x3266,
  31513. "sioskiyeokkorean",
  31514. 0x317a,
  31515. "sioskorean",
  31516. 0x3145,
  31517. "siosnieunkorean",
  31518. 0x317b,
  31519. "siosparenkorean",
  31520. 0x3206,
  31521. "siospieupkorean",
  31522. 0x317d,
  31523. "siostikeutkorean",
  31524. 0x317c,
  31525. "six",
  31526. 0x0036,
  31527. "sixarabic",
  31528. 0x0666,
  31529. "sixbengali",
  31530. 0x09ec,
  31531. "sixcircle",
  31532. 0x2465,
  31533. "sixcircleinversesansserif",
  31534. 0x278f,
  31535. "sixdeva",
  31536. 0x096c,
  31537. "sixgujarati",
  31538. 0x0aec,
  31539. "sixgurmukhi",
  31540. 0x0a6c,
  31541. "sixhackarabic",
  31542. 0x0666,
  31543. "sixhangzhou",
  31544. 0x3026,
  31545. "sixideographicparen",
  31546. 0x3225,
  31547. "sixinferior",
  31548. 0x2086,
  31549. "sixmonospace",
  31550. 0xff16,
  31551. "sixoldstyle",
  31552. 0xf736,
  31553. "sixparen",
  31554. 0x2479,
  31555. "sixperiod",
  31556. 0x248d,
  31557. "sixpersian",
  31558. 0x06f6,
  31559. "sixroman",
  31560. 0x2175,
  31561. "sixsuperior",
  31562. 0x2076,
  31563. "sixteencircle",
  31564. 0x246f,
  31565. "sixteencurrencydenominatorbengali",
  31566. 0x09f9,
  31567. "sixteenparen",
  31568. 0x2483,
  31569. "sixteenperiod",
  31570. 0x2497,
  31571. "sixthai",
  31572. 0x0e56,
  31573. "slash",
  31574. 0x002f,
  31575. "slashmonospace",
  31576. 0xff0f,
  31577. "slong",
  31578. 0x017f,
  31579. "slongdotaccent",
  31580. 0x1e9b,
  31581. "smileface",
  31582. 0x263a,
  31583. "smonospace",
  31584. 0xff53,
  31585. "sofpasuqhebrew",
  31586. 0x05c3,
  31587. "softhyphen",
  31588. 0x00ad,
  31589. "softsigncyrillic",
  31590. 0x044c,
  31591. "sohiragana",
  31592. 0x305d,
  31593. "sokatakana",
  31594. 0x30bd,
  31595. "sokatakanahalfwidth",
  31596. 0xff7f,
  31597. "soliduslongoverlaycmb",
  31598. 0x0338,
  31599. "solidusshortoverlaycmb",
  31600. 0x0337,
  31601. "sorusithai",
  31602. 0x0e29,
  31603. "sosalathai",
  31604. 0x0e28,
  31605. "sosothai",
  31606. 0x0e0b,
  31607. "sosuathai",
  31608. 0x0e2a,
  31609. "space",
  31610. 0x0020,
  31611. "spacehackarabic",
  31612. 0x0020,
  31613. "spade",
  31614. 0x2660,
  31615. "spadesuitblack",
  31616. 0x2660,
  31617. "spadesuitwhite",
  31618. 0x2664,
  31619. "sparen",
  31620. 0x24ae,
  31621. "squarebelowcmb",
  31622. 0x033b,
  31623. "squarecc",
  31624. 0x33c4,
  31625. "squarecm",
  31626. 0x339d,
  31627. "squarediagonalcrosshatchfill",
  31628. 0x25a9,
  31629. "squarehorizontalfill",
  31630. 0x25a4,
  31631. "squarekg",
  31632. 0x338f,
  31633. "squarekm",
  31634. 0x339e,
  31635. "squarekmcapital",
  31636. 0x33ce,
  31637. "squareln",
  31638. 0x33d1,
  31639. "squarelog",
  31640. 0x33d2,
  31641. "squaremg",
  31642. 0x338e,
  31643. "squaremil",
  31644. 0x33d5,
  31645. "squaremm",
  31646. 0x339c,
  31647. "squaremsquared",
  31648. 0x33a1,
  31649. "squareorthogonalcrosshatchfill",
  31650. 0x25a6,
  31651. "squareupperlefttolowerrightfill",
  31652. 0x25a7,
  31653. "squareupperrighttolowerleftfill",
  31654. 0x25a8,
  31655. "squareverticalfill",
  31656. 0x25a5,
  31657. "squarewhitewithsmallblack",
  31658. 0x25a3,
  31659. "srsquare",
  31660. 0x33db,
  31661. "ssabengali",
  31662. 0x09b7,
  31663. "ssadeva",
  31664. 0x0937,
  31665. "ssagujarati",
  31666. 0x0ab7,
  31667. "ssangcieuckorean",
  31668. 0x3149,
  31669. "ssanghieuhkorean",
  31670. 0x3185,
  31671. "ssangieungkorean",
  31672. 0x3180,
  31673. "ssangkiyeokkorean",
  31674. 0x3132,
  31675. "ssangnieunkorean",
  31676. 0x3165,
  31677. "ssangpieupkorean",
  31678. 0x3143,
  31679. "ssangsioskorean",
  31680. 0x3146,
  31681. "ssangtikeutkorean",
  31682. 0x3138,
  31683. "ssuperior",
  31684. 0xf6f2,
  31685. "sterling",
  31686. 0x00a3,
  31687. "sterlingmonospace",
  31688. 0xffe1,
  31689. "strokelongoverlaycmb",
  31690. 0x0336,
  31691. "strokeshortoverlaycmb",
  31692. 0x0335,
  31693. "subset",
  31694. 0x2282,
  31695. "subsetnotequal",
  31696. 0x228a,
  31697. "subsetorequal",
  31698. 0x2286,
  31699. "succeeds",
  31700. 0x227b,
  31701. "suchthat",
  31702. 0x220b,
  31703. "suhiragana",
  31704. 0x3059,
  31705. "sukatakana",
  31706. 0x30b9,
  31707. "sukatakanahalfwidth",
  31708. 0xff7d,
  31709. "sukunarabic",
  31710. 0x0652,
  31711. "summation",
  31712. 0x2211,
  31713. "sun",
  31714. 0x263c,
  31715. "superset",
  31716. 0x2283,
  31717. "supersetnotequal",
  31718. 0x228b,
  31719. "supersetorequal",
  31720. 0x2287,
  31721. "svsquare",
  31722. 0x33dc,
  31723. "syouwaerasquare",
  31724. 0x337c,
  31725. "t",
  31726. 0x0074,
  31727. "tabengali",
  31728. 0x09a4,
  31729. "tackdown",
  31730. 0x22a4,
  31731. "tackleft",
  31732. 0x22a3,
  31733. "tadeva",
  31734. 0x0924,
  31735. "tagujarati",
  31736. 0x0aa4,
  31737. "tagurmukhi",
  31738. 0x0a24,
  31739. "taharabic",
  31740. 0x0637,
  31741. "tahfinalarabic",
  31742. 0xfec2,
  31743. "tahinitialarabic",
  31744. 0xfec3,
  31745. "tahiragana",
  31746. 0x305f,
  31747. "tahmedialarabic",
  31748. 0xfec4,
  31749. "taisyouerasquare",
  31750. 0x337d,
  31751. "takatakana",
  31752. 0x30bf,
  31753. "takatakanahalfwidth",
  31754. 0xff80,
  31755. "tatweelarabic",
  31756. 0x0640,
  31757. "tau",
  31758. 0x03c4,
  31759. "tav",
  31760. 0x05ea,
  31761. "tavdages",
  31762. 0xfb4a,
  31763. "tavdagesh",
  31764. 0xfb4a,
  31765. "tavdageshhebrew",
  31766. 0xfb4a,
  31767. "tavhebrew",
  31768. 0x05ea,
  31769. "tbar",
  31770. 0x0167,
  31771. "tbopomofo",
  31772. 0x310a,
  31773. "tcaron",
  31774. 0x0165,
  31775. "tccurl",
  31776. 0x02a8,
  31777. "tcedilla",
  31778. 0x0163,
  31779. "tcheharabic",
  31780. 0x0686,
  31781. "tchehfinalarabic",
  31782. 0xfb7b,
  31783. "tchehinitialarabic",
  31784. 0xfb7c,
  31785. "tchehmedialarabic",
  31786. 0xfb7d,
  31787. "tcircle",
  31788. 0x24e3,
  31789. "tcircumflexbelow",
  31790. 0x1e71,
  31791. "tcommaaccent",
  31792. 0x0163,
  31793. "tdieresis",
  31794. 0x1e97,
  31795. "tdotaccent",
  31796. 0x1e6b,
  31797. "tdotbelow",
  31798. 0x1e6d,
  31799. "tecyrillic",
  31800. 0x0442,
  31801. "tedescendercyrillic",
  31802. 0x04ad,
  31803. "teharabic",
  31804. 0x062a,
  31805. "tehfinalarabic",
  31806. 0xfe96,
  31807. "tehhahinitialarabic",
  31808. 0xfca2,
  31809. "tehhahisolatedarabic",
  31810. 0xfc0c,
  31811. "tehinitialarabic",
  31812. 0xfe97,
  31813. "tehiragana",
  31814. 0x3066,
  31815. "tehjeeminitialarabic",
  31816. 0xfca1,
  31817. "tehjeemisolatedarabic",
  31818. 0xfc0b,
  31819. "tehmarbutaarabic",
  31820. 0x0629,
  31821. "tehmarbutafinalarabic",
  31822. 0xfe94,
  31823. "tehmedialarabic",
  31824. 0xfe98,
  31825. "tehmeeminitialarabic",
  31826. 0xfca4,
  31827. "tehmeemisolatedarabic",
  31828. 0xfc0e,
  31829. "tehnoonfinalarabic",
  31830. 0xfc73,
  31831. "tekatakana",
  31832. 0x30c6,
  31833. "tekatakanahalfwidth",
  31834. 0xff83,
  31835. "telephone",
  31836. 0x2121,
  31837. "telephoneblack",
  31838. 0x260e,
  31839. "telishagedolahebrew",
  31840. 0x05a0,
  31841. "telishaqetanahebrew",
  31842. 0x05a9,
  31843. "tencircle",
  31844. 0x2469,
  31845. "tenideographicparen",
  31846. 0x3229,
  31847. "tenparen",
  31848. 0x247d,
  31849. "tenperiod",
  31850. 0x2491,
  31851. "tenroman",
  31852. 0x2179,
  31853. "tesh",
  31854. 0x02a7,
  31855. "tet",
  31856. 0x05d8,
  31857. "tetdagesh",
  31858. 0xfb38,
  31859. "tetdageshhebrew",
  31860. 0xfb38,
  31861. "tethebrew",
  31862. 0x05d8,
  31863. "tetsecyrillic",
  31864. 0x04b5,
  31865. "tevirhebrew",
  31866. 0x059b,
  31867. "tevirlefthebrew",
  31868. 0x059b,
  31869. "thabengali",
  31870. 0x09a5,
  31871. "thadeva",
  31872. 0x0925,
  31873. "thagujarati",
  31874. 0x0aa5,
  31875. "thagurmukhi",
  31876. 0x0a25,
  31877. "thalarabic",
  31878. 0x0630,
  31879. "thalfinalarabic",
  31880. 0xfeac,
  31881. "thanthakhatlowleftthai",
  31882. 0xf898,
  31883. "thanthakhatlowrightthai",
  31884. 0xf897,
  31885. "thanthakhatthai",
  31886. 0x0e4c,
  31887. "thanthakhatupperleftthai",
  31888. 0xf896,
  31889. "theharabic",
  31890. 0x062b,
  31891. "thehfinalarabic",
  31892. 0xfe9a,
  31893. "thehinitialarabic",
  31894. 0xfe9b,
  31895. "thehmedialarabic",
  31896. 0xfe9c,
  31897. "thereexists",
  31898. 0x2203,
  31899. "therefore",
  31900. 0x2234,
  31901. "theta",
  31902. 0x03b8,
  31903. "theta1",
  31904. 0x03d1,
  31905. "thetasymbolgreek",
  31906. 0x03d1,
  31907. "thieuthacirclekorean",
  31908. 0x3279,
  31909. "thieuthaparenkorean",
  31910. 0x3219,
  31911. "thieuthcirclekorean",
  31912. 0x326b,
  31913. "thieuthkorean",
  31914. 0x314c,
  31915. "thieuthparenkorean",
  31916. 0x320b,
  31917. "thirteencircle",
  31918. 0x246c,
  31919. "thirteenparen",
  31920. 0x2480,
  31921. "thirteenperiod",
  31922. 0x2494,
  31923. "thonangmonthothai",
  31924. 0x0e11,
  31925. "thook",
  31926. 0x01ad,
  31927. "thophuthaothai",
  31928. 0x0e12,
  31929. "thorn",
  31930. 0x00fe,
  31931. "thothahanthai",
  31932. 0x0e17,
  31933. "thothanthai",
  31934. 0x0e10,
  31935. "thothongthai",
  31936. 0x0e18,
  31937. "thothungthai",
  31938. 0x0e16,
  31939. "thousandcyrillic",
  31940. 0x0482,
  31941. "thousandsseparatorarabic",
  31942. 0x066c,
  31943. "thousandsseparatorpersian",
  31944. 0x066c,
  31945. "three",
  31946. 0x0033,
  31947. "threearabic",
  31948. 0x0663,
  31949. "threebengali",
  31950. 0x09e9,
  31951. "threecircle",
  31952. 0x2462,
  31953. "threecircleinversesansserif",
  31954. 0x278c,
  31955. "threedeva",
  31956. 0x0969,
  31957. "threeeighths",
  31958. 0x215c,
  31959. "threegujarati",
  31960. 0x0ae9,
  31961. "threegurmukhi",
  31962. 0x0a69,
  31963. "threehackarabic",
  31964. 0x0663,
  31965. "threehangzhou",
  31966. 0x3023,
  31967. "threeideographicparen",
  31968. 0x3222,
  31969. "threeinferior",
  31970. 0x2083,
  31971. "threemonospace",
  31972. 0xff13,
  31973. "threenumeratorbengali",
  31974. 0x09f6,
  31975. "threeoldstyle",
  31976. 0xf733,
  31977. "threeparen",
  31978. 0x2476,
  31979. "threeperiod",
  31980. 0x248a,
  31981. "threepersian",
  31982. 0x06f3,
  31983. "threequarters",
  31984. 0x00be,
  31985. "threequartersemdash",
  31986. 0xf6de,
  31987. "threeroman",
  31988. 0x2172,
  31989. "threesuperior",
  31990. 0x00b3,
  31991. "threethai",
  31992. 0x0e53,
  31993. "thzsquare",
  31994. 0x3394,
  31995. "tihiragana",
  31996. 0x3061,
  31997. "tikatakana",
  31998. 0x30c1,
  31999. "tikatakanahalfwidth",
  32000. 0xff81,
  32001. "tikeutacirclekorean",
  32002. 0x3270,
  32003. "tikeutaparenkorean",
  32004. 0x3210,
  32005. "tikeutcirclekorean",
  32006. 0x3262,
  32007. "tikeutkorean",
  32008. 0x3137,
  32009. "tikeutparenkorean",
  32010. 0x3202,
  32011. "tilde",
  32012. 0x02dc,
  32013. "tildebelowcmb",
  32014. 0x0330,
  32015. "tildecmb",
  32016. 0x0303,
  32017. "tildecomb",
  32018. 0x0303,
  32019. "tildedoublecmb",
  32020. 0x0360,
  32021. "tildeoperator",
  32022. 0x223c,
  32023. "tildeoverlaycmb",
  32024. 0x0334,
  32025. "tildeverticalcmb",
  32026. 0x033e,
  32027. "timescircle",
  32028. 0x2297,
  32029. "tipehahebrew",
  32030. 0x0596,
  32031. "tipehalefthebrew",
  32032. 0x0596,
  32033. "tippigurmukhi",
  32034. 0x0a70,
  32035. "titlocyrilliccmb",
  32036. 0x0483,
  32037. "tiwnarmenian",
  32038. 0x057f,
  32039. "tlinebelow",
  32040. 0x1e6f,
  32041. "tmonospace",
  32042. 0xff54,
  32043. "toarmenian",
  32044. 0x0569,
  32045. "tohiragana",
  32046. 0x3068,
  32047. "tokatakana",
  32048. 0x30c8,
  32049. "tokatakanahalfwidth",
  32050. 0xff84,
  32051. "tonebarextrahighmod",
  32052. 0x02e5,
  32053. "tonebarextralowmod",
  32054. 0x02e9,
  32055. "tonebarhighmod",
  32056. 0x02e6,
  32057. "tonebarlowmod",
  32058. 0x02e8,
  32059. "tonebarmidmod",
  32060. 0x02e7,
  32061. "tonefive",
  32062. 0x01bd,
  32063. "tonesix",
  32064. 0x0185,
  32065. "tonetwo",
  32066. 0x01a8,
  32067. "tonos",
  32068. 0x0384,
  32069. "tonsquare",
  32070. 0x3327,
  32071. "topatakthai",
  32072. 0x0e0f,
  32073. "tortoiseshellbracketleft",
  32074. 0x3014,
  32075. "tortoiseshellbracketleftsmall",
  32076. 0xfe5d,
  32077. "tortoiseshellbracketleftvertical",
  32078. 0xfe39,
  32079. "tortoiseshellbracketright",
  32080. 0x3015,
  32081. "tortoiseshellbracketrightsmall",
  32082. 0xfe5e,
  32083. "tortoiseshellbracketrightvertical",
  32084. 0xfe3a,
  32085. "totaothai",
  32086. 0x0e15,
  32087. "tpalatalhook",
  32088. 0x01ab,
  32089. "tparen",
  32090. 0x24af,
  32091. "trademark",
  32092. 0x2122,
  32093. "trademarksans",
  32094. 0xf8ea,
  32095. "trademarkserif",
  32096. 0xf6db,
  32097. "tretroflexhook",
  32098. 0x0288,
  32099. "triagdn",
  32100. 0x25bc,
  32101. "triaglf",
  32102. 0x25c4,
  32103. "triagrt",
  32104. 0x25ba,
  32105. "triagup",
  32106. 0x25b2,
  32107. "ts",
  32108. 0x02a6,
  32109. "tsadi",
  32110. 0x05e6,
  32111. "tsadidagesh",
  32112. 0xfb46,
  32113. "tsadidageshhebrew",
  32114. 0xfb46,
  32115. "tsadihebrew",
  32116. 0x05e6,
  32117. "tsecyrillic",
  32118. 0x0446,
  32119. "tsere",
  32120. 0x05b5,
  32121. "tsere12",
  32122. 0x05b5,
  32123. "tsere1e",
  32124. 0x05b5,
  32125. "tsere2b",
  32126. 0x05b5,
  32127. "tserehebrew",
  32128. 0x05b5,
  32129. "tserenarrowhebrew",
  32130. 0x05b5,
  32131. "tserequarterhebrew",
  32132. 0x05b5,
  32133. "tserewidehebrew",
  32134. 0x05b5,
  32135. "tshecyrillic",
  32136. 0x045b,
  32137. "tsuperior",
  32138. 0xf6f3,
  32139. "ttabengali",
  32140. 0x099f,
  32141. "ttadeva",
  32142. 0x091f,
  32143. "ttagujarati",
  32144. 0x0a9f,
  32145. "ttagurmukhi",
  32146. 0x0a1f,
  32147. "tteharabic",
  32148. 0x0679,
  32149. "ttehfinalarabic",
  32150. 0xfb67,
  32151. "ttehinitialarabic",
  32152. 0xfb68,
  32153. "ttehmedialarabic",
  32154. 0xfb69,
  32155. "tthabengali",
  32156. 0x09a0,
  32157. "tthadeva",
  32158. 0x0920,
  32159. "tthagujarati",
  32160. 0x0aa0,
  32161. "tthagurmukhi",
  32162. 0x0a20,
  32163. "tturned",
  32164. 0x0287,
  32165. "tuhiragana",
  32166. 0x3064,
  32167. "tukatakana",
  32168. 0x30c4,
  32169. "tukatakanahalfwidth",
  32170. 0xff82,
  32171. "tusmallhiragana",
  32172. 0x3063,
  32173. "tusmallkatakana",
  32174. 0x30c3,
  32175. "tusmallkatakanahalfwidth",
  32176. 0xff6f,
  32177. "twelvecircle",
  32178. 0x246b,
  32179. "twelveparen",
  32180. 0x247f,
  32181. "twelveperiod",
  32182. 0x2493,
  32183. "twelveroman",
  32184. 0x217b,
  32185. "twentycircle",
  32186. 0x2473,
  32187. "twentyhangzhou",
  32188. 0x5344,
  32189. "twentyparen",
  32190. 0x2487,
  32191. "twentyperiod",
  32192. 0x249b,
  32193. "two",
  32194. 0x0032,
  32195. "twoarabic",
  32196. 0x0662,
  32197. "twobengali",
  32198. 0x09e8,
  32199. "twocircle",
  32200. 0x2461,
  32201. "twocircleinversesansserif",
  32202. 0x278b,
  32203. "twodeva",
  32204. 0x0968,
  32205. "twodotenleader",
  32206. 0x2025,
  32207. "twodotleader",
  32208. 0x2025,
  32209. "twodotleadervertical",
  32210. 0xfe30,
  32211. "twogujarati",
  32212. 0x0ae8,
  32213. "twogurmukhi",
  32214. 0x0a68,
  32215. "twohackarabic",
  32216. 0x0662,
  32217. "twohangzhou",
  32218. 0x3022,
  32219. "twoideographicparen",
  32220. 0x3221,
  32221. "twoinferior",
  32222. 0x2082,
  32223. "twomonospace",
  32224. 0xff12,
  32225. "twonumeratorbengali",
  32226. 0x09f5,
  32227. "twooldstyle",
  32228. 0xf732,
  32229. "twoparen",
  32230. 0x2475,
  32231. "twoperiod",
  32232. 0x2489,
  32233. "twopersian",
  32234. 0x06f2,
  32235. "tworoman",
  32236. 0x2171,
  32237. "twostroke",
  32238. 0x01bb,
  32239. "twosuperior",
  32240. 0x00b2,
  32241. "twothai",
  32242. 0x0e52,
  32243. "twothirds",
  32244. 0x2154,
  32245. "u",
  32246. 0x0075,
  32247. "uacute",
  32248. 0x00fa,
  32249. "ubar",
  32250. 0x0289,
  32251. "ubengali",
  32252. 0x0989,
  32253. "ubopomofo",
  32254. 0x3128,
  32255. "ubreve",
  32256. 0x016d,
  32257. "ucaron",
  32258. 0x01d4,
  32259. "ucircle",
  32260. 0x24e4,
  32261. "ucircumflex",
  32262. 0x00fb,
  32263. "ucircumflexbelow",
  32264. 0x1e77,
  32265. "ucyrillic",
  32266. 0x0443,
  32267. "udattadeva",
  32268. 0x0951,
  32269. "udblacute",
  32270. 0x0171,
  32271. "udblgrave",
  32272. 0x0215,
  32273. "udeva",
  32274. 0x0909,
  32275. "udieresis",
  32276. 0x00fc,
  32277. "udieresisacute",
  32278. 0x01d8,
  32279. "udieresisbelow",
  32280. 0x1e73,
  32281. "udieresiscaron",
  32282. 0x01da,
  32283. "udieresiscyrillic",
  32284. 0x04f1,
  32285. "udieresisgrave",
  32286. 0x01dc,
  32287. "udieresismacron",
  32288. 0x01d6,
  32289. "udotbelow",
  32290. 0x1ee5,
  32291. "ugrave",
  32292. 0x00f9,
  32293. "ugujarati",
  32294. 0x0a89,
  32295. "ugurmukhi",
  32296. 0x0a09,
  32297. "uhiragana",
  32298. 0x3046,
  32299. "uhookabove",
  32300. 0x1ee7,
  32301. "uhorn",
  32302. 0x01b0,
  32303. "uhornacute",
  32304. 0x1ee9,
  32305. "uhorndotbelow",
  32306. 0x1ef1,
  32307. "uhorngrave",
  32308. 0x1eeb,
  32309. "uhornhookabove",
  32310. 0x1eed,
  32311. "uhorntilde",
  32312. 0x1eef,
  32313. "uhungarumlaut",
  32314. 0x0171,
  32315. "uhungarumlautcyrillic",
  32316. 0x04f3,
  32317. "uinvertedbreve",
  32318. 0x0217,
  32319. "ukatakana",
  32320. 0x30a6,
  32321. "ukatakanahalfwidth",
  32322. 0xff73,
  32323. "ukcyrillic",
  32324. 0x0479,
  32325. "ukorean",
  32326. 0x315c,
  32327. "umacron",
  32328. 0x016b,
  32329. "umacroncyrillic",
  32330. 0x04ef,
  32331. "umacrondieresis",
  32332. 0x1e7b,
  32333. "umatragurmukhi",
  32334. 0x0a41,
  32335. "umonospace",
  32336. 0xff55,
  32337. "underscore",
  32338. 0x005f,
  32339. "underscoredbl",
  32340. 0x2017,
  32341. "underscoremonospace",
  32342. 0xff3f,
  32343. "underscorevertical",
  32344. 0xfe33,
  32345. "underscorewavy",
  32346. 0xfe4f,
  32347. "union",
  32348. 0x222a,
  32349. "universal",
  32350. 0x2200,
  32351. "uogonek",
  32352. 0x0173,
  32353. "uparen",
  32354. 0x24b0,
  32355. "upblock",
  32356. 0x2580,
  32357. "upperdothebrew",
  32358. 0x05c4,
  32359. "upsilon",
  32360. 0x03c5,
  32361. "upsilondieresis",
  32362. 0x03cb,
  32363. "upsilondieresistonos",
  32364. 0x03b0,
  32365. "upsilonlatin",
  32366. 0x028a,
  32367. "upsilontonos",
  32368. 0x03cd,
  32369. "uptackbelowcmb",
  32370. 0x031d,
  32371. "uptackmod",
  32372. 0x02d4,
  32373. "uragurmukhi",
  32374. 0x0a73,
  32375. "uring",
  32376. 0x016f,
  32377. "ushortcyrillic",
  32378. 0x045e,
  32379. "usmallhiragana",
  32380. 0x3045,
  32381. "usmallkatakana",
  32382. 0x30a5,
  32383. "usmallkatakanahalfwidth",
  32384. 0xff69,
  32385. "ustraightcyrillic",
  32386. 0x04af,
  32387. "ustraightstrokecyrillic",
  32388. 0x04b1,
  32389. "utilde",
  32390. 0x0169,
  32391. "utildeacute",
  32392. 0x1e79,
  32393. "utildebelow",
  32394. 0x1e75,
  32395. "uubengali",
  32396. 0x098a,
  32397. "uudeva",
  32398. 0x090a,
  32399. "uugujarati",
  32400. 0x0a8a,
  32401. "uugurmukhi",
  32402. 0x0a0a,
  32403. "uumatragurmukhi",
  32404. 0x0a42,
  32405. "uuvowelsignbengali",
  32406. 0x09c2,
  32407. "uuvowelsigndeva",
  32408. 0x0942,
  32409. "uuvowelsigngujarati",
  32410. 0x0ac2,
  32411. "uvowelsignbengali",
  32412. 0x09c1,
  32413. "uvowelsigndeva",
  32414. 0x0941,
  32415. "uvowelsigngujarati",
  32416. 0x0ac1,
  32417. "v",
  32418. 0x0076,
  32419. "vadeva",
  32420. 0x0935,
  32421. "vagujarati",
  32422. 0x0ab5,
  32423. "vagurmukhi",
  32424. 0x0a35,
  32425. "vakatakana",
  32426. 0x30f7,
  32427. "vav",
  32428. 0x05d5,
  32429. "vavdagesh",
  32430. 0xfb35,
  32431. "vavdagesh65",
  32432. 0xfb35,
  32433. "vavdageshhebrew",
  32434. 0xfb35,
  32435. "vavhebrew",
  32436. 0x05d5,
  32437. "vavholam",
  32438. 0xfb4b,
  32439. "vavholamhebrew",
  32440. 0xfb4b,
  32441. "vavvavhebrew",
  32442. 0x05f0,
  32443. "vavyodhebrew",
  32444. 0x05f1,
  32445. "vcircle",
  32446. 0x24e5,
  32447. "vdotbelow",
  32448. 0x1e7f,
  32449. "vecyrillic",
  32450. 0x0432,
  32451. "veharabic",
  32452. 0x06a4,
  32453. "vehfinalarabic",
  32454. 0xfb6b,
  32455. "vehinitialarabic",
  32456. 0xfb6c,
  32457. "vehmedialarabic",
  32458. 0xfb6d,
  32459. "vekatakana",
  32460. 0x30f9,
  32461. "venus",
  32462. 0x2640,
  32463. "verticalbar",
  32464. 0x007c,
  32465. "verticallineabovecmb",
  32466. 0x030d,
  32467. "verticallinebelowcmb",
  32468. 0x0329,
  32469. "verticallinelowmod",
  32470. 0x02cc,
  32471. "verticallinemod",
  32472. 0x02c8,
  32473. "vewarmenian",
  32474. 0x057e,
  32475. "vhook",
  32476. 0x028b,
  32477. "vikatakana",
  32478. 0x30f8,
  32479. "viramabengali",
  32480. 0x09cd,
  32481. "viramadeva",
  32482. 0x094d,
  32483. "viramagujarati",
  32484. 0x0acd,
  32485. "visargabengali",
  32486. 0x0983,
  32487. "visargadeva",
  32488. 0x0903,
  32489. "visargagujarati",
  32490. 0x0a83,
  32491. "vmonospace",
  32492. 0xff56,
  32493. "voarmenian",
  32494. 0x0578,
  32495. "voicediterationhiragana",
  32496. 0x309e,
  32497. "voicediterationkatakana",
  32498. 0x30fe,
  32499. "voicedmarkkana",
  32500. 0x309b,
  32501. "voicedmarkkanahalfwidth",
  32502. 0xff9e,
  32503. "vokatakana",
  32504. 0x30fa,
  32505. "vparen",
  32506. 0x24b1,
  32507. "vtilde",
  32508. 0x1e7d,
  32509. "vturned",
  32510. 0x028c,
  32511. "vuhiragana",
  32512. 0x3094,
  32513. "vukatakana",
  32514. 0x30f4,
  32515. "w",
  32516. 0x0077,
  32517. "wacute",
  32518. 0x1e83,
  32519. "waekorean",
  32520. 0x3159,
  32521. "wahiragana",
  32522. 0x308f,
  32523. "wakatakana",
  32524. 0x30ef,
  32525. "wakatakanahalfwidth",
  32526. 0xff9c,
  32527. "wakorean",
  32528. 0x3158,
  32529. "wasmallhiragana",
  32530. 0x308e,
  32531. "wasmallkatakana",
  32532. 0x30ee,
  32533. "wattosquare",
  32534. 0x3357,
  32535. "wavedash",
  32536. 0x301c,
  32537. "wavyunderscorevertical",
  32538. 0xfe34,
  32539. "wawarabic",
  32540. 0x0648,
  32541. "wawfinalarabic",
  32542. 0xfeee,
  32543. "wawhamzaabovearabic",
  32544. 0x0624,
  32545. "wawhamzaabovefinalarabic",
  32546. 0xfe86,
  32547. "wbsquare",
  32548. 0x33dd,
  32549. "wcircle",
  32550. 0x24e6,
  32551. "wcircumflex",
  32552. 0x0175,
  32553. "wdieresis",
  32554. 0x1e85,
  32555. "wdotaccent",
  32556. 0x1e87,
  32557. "wdotbelow",
  32558. 0x1e89,
  32559. "wehiragana",
  32560. 0x3091,
  32561. "weierstrass",
  32562. 0x2118,
  32563. "wekatakana",
  32564. 0x30f1,
  32565. "wekorean",
  32566. 0x315e,
  32567. "weokorean",
  32568. 0x315d,
  32569. "wgrave",
  32570. 0x1e81,
  32571. "whitebullet",
  32572. 0x25e6,
  32573. "whitecircle",
  32574. 0x25cb,
  32575. "whitecircleinverse",
  32576. 0x25d9,
  32577. "whitecornerbracketleft",
  32578. 0x300e,
  32579. "whitecornerbracketleftvertical",
  32580. 0xfe43,
  32581. "whitecornerbracketright",
  32582. 0x300f,
  32583. "whitecornerbracketrightvertical",
  32584. 0xfe44,
  32585. "whitediamond",
  32586. 0x25c7,
  32587. "whitediamondcontainingblacksmalldiamond",
  32588. 0x25c8,
  32589. "whitedownpointingsmalltriangle",
  32590. 0x25bf,
  32591. "whitedownpointingtriangle",
  32592. 0x25bd,
  32593. "whiteleftpointingsmalltriangle",
  32594. 0x25c3,
  32595. "whiteleftpointingtriangle",
  32596. 0x25c1,
  32597. "whitelenticularbracketleft",
  32598. 0x3016,
  32599. "whitelenticularbracketright",
  32600. 0x3017,
  32601. "whiterightpointingsmalltriangle",
  32602. 0x25b9,
  32603. "whiterightpointingtriangle",
  32604. 0x25b7,
  32605. "whitesmallsquare",
  32606. 0x25ab,
  32607. "whitesmilingface",
  32608. 0x263a,
  32609. "whitesquare",
  32610. 0x25a1,
  32611. "whitestar",
  32612. 0x2606,
  32613. "whitetelephone",
  32614. 0x260f,
  32615. "whitetortoiseshellbracketleft",
  32616. 0x3018,
  32617. "whitetortoiseshellbracketright",
  32618. 0x3019,
  32619. "whiteuppointingsmalltriangle",
  32620. 0x25b5,
  32621. "whiteuppointingtriangle",
  32622. 0x25b3,
  32623. "wihiragana",
  32624. 0x3090,
  32625. "wikatakana",
  32626. 0x30f0,
  32627. "wikorean",
  32628. 0x315f,
  32629. "wmonospace",
  32630. 0xff57,
  32631. "wohiragana",
  32632. 0x3092,
  32633. "wokatakana",
  32634. 0x30f2,
  32635. "wokatakanahalfwidth",
  32636. 0xff66,
  32637. "won",
  32638. 0x20a9,
  32639. "wonmonospace",
  32640. 0xffe6,
  32641. "wowaenthai",
  32642. 0x0e27,
  32643. "wparen",
  32644. 0x24b2,
  32645. "wring",
  32646. 0x1e98,
  32647. "wsuperior",
  32648. 0x02b7,
  32649. "wturned",
  32650. 0x028d,
  32651. "wynn",
  32652. 0x01bf,
  32653. "x",
  32654. 0x0078,
  32655. "xabovecmb",
  32656. 0x033d,
  32657. "xbopomofo",
  32658. 0x3112,
  32659. "xcircle",
  32660. 0x24e7,
  32661. "xdieresis",
  32662. 0x1e8d,
  32663. "xdotaccent",
  32664. 0x1e8b,
  32665. "xeharmenian",
  32666. 0x056d,
  32667. "xi",
  32668. 0x03be,
  32669. "xmonospace",
  32670. 0xff58,
  32671. "xparen",
  32672. 0x24b3,
  32673. "xsuperior",
  32674. 0x02e3,
  32675. "y",
  32676. 0x0079,
  32677. "yaadosquare",
  32678. 0x334e,
  32679. "yabengali",
  32680. 0x09af,
  32681. "yacute",
  32682. 0x00fd,
  32683. "yadeva",
  32684. 0x092f,
  32685. "yaekorean",
  32686. 0x3152,
  32687. "yagujarati",
  32688. 0x0aaf,
  32689. "yagurmukhi",
  32690. 0x0a2f,
  32691. "yahiragana",
  32692. 0x3084,
  32693. "yakatakana",
  32694. 0x30e4,
  32695. "yakatakanahalfwidth",
  32696. 0xff94,
  32697. "yakorean",
  32698. 0x3151,
  32699. "yamakkanthai",
  32700. 0x0e4e,
  32701. "yasmallhiragana",
  32702. 0x3083,
  32703. "yasmallkatakana",
  32704. 0x30e3,
  32705. "yasmallkatakanahalfwidth",
  32706. 0xff6c,
  32707. "yatcyrillic",
  32708. 0x0463,
  32709. "ycircle",
  32710. 0x24e8,
  32711. "ycircumflex",
  32712. 0x0177,
  32713. "ydieresis",
  32714. 0x00ff,
  32715. "ydotaccent",
  32716. 0x1e8f,
  32717. "ydotbelow",
  32718. 0x1ef5,
  32719. "yeharabic",
  32720. 0x064a,
  32721. "yehbarreearabic",
  32722. 0x06d2,
  32723. "yehbarreefinalarabic",
  32724. 0xfbaf,
  32725. "yehfinalarabic",
  32726. 0xfef2,
  32727. "yehhamzaabovearabic",
  32728. 0x0626,
  32729. "yehhamzaabovefinalarabic",
  32730. 0xfe8a,
  32731. "yehhamzaaboveinitialarabic",
  32732. 0xfe8b,
  32733. "yehhamzaabovemedialarabic",
  32734. 0xfe8c,
  32735. "yehinitialarabic",
  32736. 0xfef3,
  32737. "yehmedialarabic",
  32738. 0xfef4,
  32739. "yehmeeminitialarabic",
  32740. 0xfcdd,
  32741. "yehmeemisolatedarabic",
  32742. 0xfc58,
  32743. "yehnoonfinalarabic",
  32744. 0xfc94,
  32745. "yehthreedotsbelowarabic",
  32746. 0x06d1,
  32747. "yekorean",
  32748. 0x3156,
  32749. "yen",
  32750. 0x00a5,
  32751. "yenmonospace",
  32752. 0xffe5,
  32753. "yeokorean",
  32754. 0x3155,
  32755. "yeorinhieuhkorean",
  32756. 0x3186,
  32757. "yerahbenyomohebrew",
  32758. 0x05aa,
  32759. "yerahbenyomolefthebrew",
  32760. 0x05aa,
  32761. "yericyrillic",
  32762. 0x044b,
  32763. "yerudieresiscyrillic",
  32764. 0x04f9,
  32765. "yesieungkorean",
  32766. 0x3181,
  32767. "yesieungpansioskorean",
  32768. 0x3183,
  32769. "yesieungsioskorean",
  32770. 0x3182,
  32771. "yetivhebrew",
  32772. 0x059a,
  32773. "ygrave",
  32774. 0x1ef3,
  32775. "yhook",
  32776. 0x01b4,
  32777. "yhookabove",
  32778. 0x1ef7,
  32779. "yiarmenian",
  32780. 0x0575,
  32781. "yicyrillic",
  32782. 0x0457,
  32783. "yikorean",
  32784. 0x3162,
  32785. "yinyang",
  32786. 0x262f,
  32787. "yiwnarmenian",
  32788. 0x0582,
  32789. "ymonospace",
  32790. 0xff59,
  32791. "yod",
  32792. 0x05d9,
  32793. "yoddagesh",
  32794. 0xfb39,
  32795. "yoddageshhebrew",
  32796. 0xfb39,
  32797. "yodhebrew",
  32798. 0x05d9,
  32799. "yodyodhebrew",
  32800. 0x05f2,
  32801. "yodyodpatahhebrew",
  32802. 0xfb1f,
  32803. "yohiragana",
  32804. 0x3088,
  32805. "yoikorean",
  32806. 0x3189,
  32807. "yokatakana",
  32808. 0x30e8,
  32809. "yokatakanahalfwidth",
  32810. 0xff96,
  32811. "yokorean",
  32812. 0x315b,
  32813. "yosmallhiragana",
  32814. 0x3087,
  32815. "yosmallkatakana",
  32816. 0x30e7,
  32817. "yosmallkatakanahalfwidth",
  32818. 0xff6e,
  32819. "yotgreek",
  32820. 0x03f3,
  32821. "yoyaekorean",
  32822. 0x3188,
  32823. "yoyakorean",
  32824. 0x3187,
  32825. "yoyakthai",
  32826. 0x0e22,
  32827. "yoyingthai",
  32828. 0x0e0d,
  32829. "yparen",
  32830. 0x24b4,
  32831. "ypogegrammeni",
  32832. 0x037a,
  32833. "ypogegrammenigreekcmb",
  32834. 0x0345,
  32835. "yr",
  32836. 0x01a6,
  32837. "yring",
  32838. 0x1e99,
  32839. "ysuperior",
  32840. 0x02b8,
  32841. "ytilde",
  32842. 0x1ef9,
  32843. "yturned",
  32844. 0x028e,
  32845. "yuhiragana",
  32846. 0x3086,
  32847. "yuikorean",
  32848. 0x318c,
  32849. "yukatakana",
  32850. 0x30e6,
  32851. "yukatakanahalfwidth",
  32852. 0xff95,
  32853. "yukorean",
  32854. 0x3160,
  32855. "yusbigcyrillic",
  32856. 0x046b,
  32857. "yusbigiotifiedcyrillic",
  32858. 0x046d,
  32859. "yuslittlecyrillic",
  32860. 0x0467,
  32861. "yuslittleiotifiedcyrillic",
  32862. 0x0469,
  32863. "yusmallhiragana",
  32864. 0x3085,
  32865. "yusmallkatakana",
  32866. 0x30e5,
  32867. "yusmallkatakanahalfwidth",
  32868. 0xff6d,
  32869. "yuyekorean",
  32870. 0x318b,
  32871. "yuyeokorean",
  32872. 0x318a,
  32873. "yyabengali",
  32874. 0x09df,
  32875. "yyadeva",
  32876. 0x095f,
  32877. "z",
  32878. 0x007a,
  32879. "zaarmenian",
  32880. 0x0566,
  32881. "zacute",
  32882. 0x017a,
  32883. "zadeva",
  32884. 0x095b,
  32885. "zagurmukhi",
  32886. 0x0a5b,
  32887. "zaharabic",
  32888. 0x0638,
  32889. "zahfinalarabic",
  32890. 0xfec6,
  32891. "zahinitialarabic",
  32892. 0xfec7,
  32893. "zahiragana",
  32894. 0x3056,
  32895. "zahmedialarabic",
  32896. 0xfec8,
  32897. "zainarabic",
  32898. 0x0632,
  32899. "zainfinalarabic",
  32900. 0xfeb0,
  32901. "zakatakana",
  32902. 0x30b6,
  32903. "zaqefgadolhebrew",
  32904. 0x0595,
  32905. "zaqefqatanhebrew",
  32906. 0x0594,
  32907. "zarqahebrew",
  32908. 0x0598,
  32909. "zayin",
  32910. 0x05d6,
  32911. "zayindagesh",
  32912. 0xfb36,
  32913. "zayindageshhebrew",
  32914. 0xfb36,
  32915. "zayinhebrew",
  32916. 0x05d6,
  32917. "zbopomofo",
  32918. 0x3117,
  32919. "zcaron",
  32920. 0x017e,
  32921. "zcircle",
  32922. 0x24e9,
  32923. "zcircumflex",
  32924. 0x1e91,
  32925. "zcurl",
  32926. 0x0291,
  32927. "zdot",
  32928. 0x017c,
  32929. "zdotaccent",
  32930. 0x017c,
  32931. "zdotbelow",
  32932. 0x1e93,
  32933. "zecyrillic",
  32934. 0x0437,
  32935. "zedescendercyrillic",
  32936. 0x0499,
  32937. "zedieresiscyrillic",
  32938. 0x04df,
  32939. "zehiragana",
  32940. 0x305c,
  32941. "zekatakana",
  32942. 0x30bc,
  32943. "zero",
  32944. 0x0030,
  32945. "zeroarabic",
  32946. 0x0660,
  32947. "zerobengali",
  32948. 0x09e6,
  32949. "zerodeva",
  32950. 0x0966,
  32951. "zerogujarati",
  32952. 0x0ae6,
  32953. "zerogurmukhi",
  32954. 0x0a66,
  32955. "zerohackarabic",
  32956. 0x0660,
  32957. "zeroinferior",
  32958. 0x2080,
  32959. "zeromonospace",
  32960. 0xff10,
  32961. "zerooldstyle",
  32962. 0xf730,
  32963. "zeropersian",
  32964. 0x06f0,
  32965. "zerosuperior",
  32966. 0x2070,
  32967. "zerothai",
  32968. 0x0e50,
  32969. "zerowidthjoiner",
  32970. 0xfeff,
  32971. "zerowidthnonjoiner",
  32972. 0x200c,
  32973. "zerowidthspace",
  32974. 0x200b,
  32975. "zeta",
  32976. 0x03b6,
  32977. "zhbopomofo",
  32978. 0x3113,
  32979. "zhearmenian",
  32980. 0x056a,
  32981. "zhebrevecyrillic",
  32982. 0x04c2,
  32983. "zhecyrillic",
  32984. 0x0436,
  32985. "zhedescendercyrillic",
  32986. 0x0497,
  32987. "zhedieresiscyrillic",
  32988. 0x04dd,
  32989. "zihiragana",
  32990. 0x3058,
  32991. "zikatakana",
  32992. 0x30b8,
  32993. "zinorhebrew",
  32994. 0x05ae,
  32995. "zlinebelow",
  32996. 0x1e95,
  32997. "zmonospace",
  32998. 0xff5a,
  32999. "zohiragana",
  33000. 0x305e,
  33001. "zokatakana",
  33002. 0x30be,
  33003. "zparen",
  33004. 0x24b5,
  33005. "zretroflexhook",
  33006. 0x0290,
  33007. "zstroke",
  33008. 0x01b6,
  33009. "zuhiragana",
  33010. 0x305a,
  33011. "zukatakana",
  33012. 0x30ba,
  33013. ".notdef",
  33014. 0x0000,
  33015. "angbracketleftbig",
  33016. 0x2329,
  33017. "angbracketleftBig",
  33018. 0x2329,
  33019. "angbracketleftbigg",
  33020. 0x2329,
  33021. "angbracketleftBigg",
  33022. 0x2329,
  33023. "angbracketrightBig",
  33024. 0x232a,
  33025. "angbracketrightbig",
  33026. 0x232a,
  33027. "angbracketrightBigg",
  33028. 0x232a,
  33029. "angbracketrightbigg",
  33030. 0x232a,
  33031. "arrowhookleft",
  33032. 0x21aa,
  33033. "arrowhookright",
  33034. 0x21a9,
  33035. "arrowlefttophalf",
  33036. 0x21bc,
  33037. "arrowleftbothalf",
  33038. 0x21bd,
  33039. "arrownortheast",
  33040. 0x2197,
  33041. "arrownorthwest",
  33042. 0x2196,
  33043. "arrowrighttophalf",
  33044. 0x21c0,
  33045. "arrowrightbothalf",
  33046. 0x21c1,
  33047. "arrowsoutheast",
  33048. 0x2198,
  33049. "arrowsouthwest",
  33050. 0x2199,
  33051. "backslashbig",
  33052. 0x2216,
  33053. "backslashBig",
  33054. 0x2216,
  33055. "backslashBigg",
  33056. 0x2216,
  33057. "backslashbigg",
  33058. 0x2216,
  33059. "bardbl",
  33060. 0x2016,
  33061. "bracehtipdownleft",
  33062. 0xfe37,
  33063. "bracehtipdownright",
  33064. 0xfe37,
  33065. "bracehtipupleft",
  33066. 0xfe38,
  33067. "bracehtipupright",
  33068. 0xfe38,
  33069. "braceleftBig",
  33070. 0x007b,
  33071. "braceleftbig",
  33072. 0x007b,
  33073. "braceleftbigg",
  33074. 0x007b,
  33075. "braceleftBigg",
  33076. 0x007b,
  33077. "bracerightBig",
  33078. 0x007d,
  33079. "bracerightbig",
  33080. 0x007d,
  33081. "bracerightbigg",
  33082. 0x007d,
  33083. "bracerightBigg",
  33084. 0x007d,
  33085. "bracketleftbig",
  33086. 0x005b,
  33087. "bracketleftBig",
  33088. 0x005b,
  33089. "bracketleftbigg",
  33090. 0x005b,
  33091. "bracketleftBigg",
  33092. 0x005b,
  33093. "bracketrightBig",
  33094. 0x005d,
  33095. "bracketrightbig",
  33096. 0x005d,
  33097. "bracketrightbigg",
  33098. 0x005d,
  33099. "bracketrightBigg",
  33100. 0x005d,
  33101. "ceilingleftbig",
  33102. 0x2308,
  33103. "ceilingleftBig",
  33104. 0x2308,
  33105. "ceilingleftBigg",
  33106. 0x2308,
  33107. "ceilingleftbigg",
  33108. 0x2308,
  33109. "ceilingrightbig",
  33110. 0x2309,
  33111. "ceilingrightBig",
  33112. 0x2309,
  33113. "ceilingrightbigg",
  33114. 0x2309,
  33115. "ceilingrightBigg",
  33116. 0x2309,
  33117. "circledotdisplay",
  33118. 0x2299,
  33119. "circledottext",
  33120. 0x2299,
  33121. "circlemultiplydisplay",
  33122. 0x2297,
  33123. "circlemultiplytext",
  33124. 0x2297,
  33125. "circleplusdisplay",
  33126. 0x2295,
  33127. "circleplustext",
  33128. 0x2295,
  33129. "contintegraldisplay",
  33130. 0x222e,
  33131. "contintegraltext",
  33132. 0x222e,
  33133. "coproductdisplay",
  33134. 0x2210,
  33135. "coproducttext",
  33136. 0x2210,
  33137. "floorleftBig",
  33138. 0x230a,
  33139. "floorleftbig",
  33140. 0x230a,
  33141. "floorleftbigg",
  33142. 0x230a,
  33143. "floorleftBigg",
  33144. 0x230a,
  33145. "floorrightbig",
  33146. 0x230b,
  33147. "floorrightBig",
  33148. 0x230b,
  33149. "floorrightBigg",
  33150. 0x230b,
  33151. "floorrightbigg",
  33152. 0x230b,
  33153. "hatwide",
  33154. 0x0302,
  33155. "hatwider",
  33156. 0x0302,
  33157. "hatwidest",
  33158. 0x0302,
  33159. "intercal",
  33160. 0x1d40,
  33161. "integraldisplay",
  33162. 0x222b,
  33163. "integraltext",
  33164. 0x222b,
  33165. "intersectiondisplay",
  33166. 0x22c2,
  33167. "intersectiontext",
  33168. 0x22c2,
  33169. "logicalanddisplay",
  33170. 0x2227,
  33171. "logicalandtext",
  33172. 0x2227,
  33173. "logicalordisplay",
  33174. 0x2228,
  33175. "logicalortext",
  33176. 0x2228,
  33177. "parenleftBig",
  33178. 0x0028,
  33179. "parenleftbig",
  33180. 0x0028,
  33181. "parenleftBigg",
  33182. 0x0028,
  33183. "parenleftbigg",
  33184. 0x0028,
  33185. "parenrightBig",
  33186. 0x0029,
  33187. "parenrightbig",
  33188. 0x0029,
  33189. "parenrightBigg",
  33190. 0x0029,
  33191. "parenrightbigg",
  33192. 0x0029,
  33193. "prime",
  33194. 0x2032,
  33195. "productdisplay",
  33196. 0x220f,
  33197. "producttext",
  33198. 0x220f,
  33199. "radicalbig",
  33200. 0x221a,
  33201. "radicalBig",
  33202. 0x221a,
  33203. "radicalBigg",
  33204. 0x221a,
  33205. "radicalbigg",
  33206. 0x221a,
  33207. "radicalbt",
  33208. 0x221a,
  33209. "radicaltp",
  33210. 0x221a,
  33211. "radicalvertex",
  33212. 0x221a,
  33213. "slashbig",
  33214. 0x002f,
  33215. "slashBig",
  33216. 0x002f,
  33217. "slashBigg",
  33218. 0x002f,
  33219. "slashbigg",
  33220. 0x002f,
  33221. "summationdisplay",
  33222. 0x2211,
  33223. "summationtext",
  33224. 0x2211,
  33225. "tildewide",
  33226. 0x02dc,
  33227. "tildewider",
  33228. 0x02dc,
  33229. "tildewidest",
  33230. 0x02dc,
  33231. "uniondisplay",
  33232. 0x22c3,
  33233. "unionmultidisplay",
  33234. 0x228e,
  33235. "unionmultitext",
  33236. 0x228e,
  33237. "unionsqdisplay",
  33238. 0x2294,
  33239. "unionsqtext",
  33240. 0x2294,
  33241. "uniontext",
  33242. 0x22c3,
  33243. "vextenddouble",
  33244. 0x2225,
  33245. "vextendsingle",
  33246. 0x2223
  33247. ];
  33248. });
  33249. const getDingbatsGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  33250. return [
  33251. "space",
  33252. 0x0020,
  33253. "a1",
  33254. 0x2701,
  33255. "a2",
  33256. 0x2702,
  33257. "a202",
  33258. 0x2703,
  33259. "a3",
  33260. 0x2704,
  33261. "a4",
  33262. 0x260e,
  33263. "a5",
  33264. 0x2706,
  33265. "a119",
  33266. 0x2707,
  33267. "a118",
  33268. 0x2708,
  33269. "a117",
  33270. 0x2709,
  33271. "a11",
  33272. 0x261b,
  33273. "a12",
  33274. 0x261e,
  33275. "a13",
  33276. 0x270c,
  33277. "a14",
  33278. 0x270d,
  33279. "a15",
  33280. 0x270e,
  33281. "a16",
  33282. 0x270f,
  33283. "a105",
  33284. 0x2710,
  33285. "a17",
  33286. 0x2711,
  33287. "a18",
  33288. 0x2712,
  33289. "a19",
  33290. 0x2713,
  33291. "a20",
  33292. 0x2714,
  33293. "a21",
  33294. 0x2715,
  33295. "a22",
  33296. 0x2716,
  33297. "a23",
  33298. 0x2717,
  33299. "a24",
  33300. 0x2718,
  33301. "a25",
  33302. 0x2719,
  33303. "a26",
  33304. 0x271a,
  33305. "a27",
  33306. 0x271b,
  33307. "a28",
  33308. 0x271c,
  33309. "a6",
  33310. 0x271d,
  33311. "a7",
  33312. 0x271e,
  33313. "a8",
  33314. 0x271f,
  33315. "a9",
  33316. 0x2720,
  33317. "a10",
  33318. 0x2721,
  33319. "a29",
  33320. 0x2722,
  33321. "a30",
  33322. 0x2723,
  33323. "a31",
  33324. 0x2724,
  33325. "a32",
  33326. 0x2725,
  33327. "a33",
  33328. 0x2726,
  33329. "a34",
  33330. 0x2727,
  33331. "a35",
  33332. 0x2605,
  33333. "a36",
  33334. 0x2729,
  33335. "a37",
  33336. 0x272a,
  33337. "a38",
  33338. 0x272b,
  33339. "a39",
  33340. 0x272c,
  33341. "a40",
  33342. 0x272d,
  33343. "a41",
  33344. 0x272e,
  33345. "a42",
  33346. 0x272f,
  33347. "a43",
  33348. 0x2730,
  33349. "a44",
  33350. 0x2731,
  33351. "a45",
  33352. 0x2732,
  33353. "a46",
  33354. 0x2733,
  33355. "a47",
  33356. 0x2734,
  33357. "a48",
  33358. 0x2735,
  33359. "a49",
  33360. 0x2736,
  33361. "a50",
  33362. 0x2737,
  33363. "a51",
  33364. 0x2738,
  33365. "a52",
  33366. 0x2739,
  33367. "a53",
  33368. 0x273a,
  33369. "a54",
  33370. 0x273b,
  33371. "a55",
  33372. 0x273c,
  33373. "a56",
  33374. 0x273d,
  33375. "a57",
  33376. 0x273e,
  33377. "a58",
  33378. 0x273f,
  33379. "a59",
  33380. 0x2740,
  33381. "a60",
  33382. 0x2741,
  33383. "a61",
  33384. 0x2742,
  33385. "a62",
  33386. 0x2743,
  33387. "a63",
  33388. 0x2744,
  33389. "a64",
  33390. 0x2745,
  33391. "a65",
  33392. 0x2746,
  33393. "a66",
  33394. 0x2747,
  33395. "a67",
  33396. 0x2748,
  33397. "a68",
  33398. 0x2749,
  33399. "a69",
  33400. 0x274a,
  33401. "a70",
  33402. 0x274b,
  33403. "a71",
  33404. 0x25cf,
  33405. "a72",
  33406. 0x274d,
  33407. "a73",
  33408. 0x25a0,
  33409. "a74",
  33410. 0x274f,
  33411. "a203",
  33412. 0x2750,
  33413. "a75",
  33414. 0x2751,
  33415. "a204",
  33416. 0x2752,
  33417. "a76",
  33418. 0x25b2,
  33419. "a77",
  33420. 0x25bc,
  33421. "a78",
  33422. 0x25c6,
  33423. "a79",
  33424. 0x2756,
  33425. "a81",
  33426. 0x25d7,
  33427. "a82",
  33428. 0x2758,
  33429. "a83",
  33430. 0x2759,
  33431. "a84",
  33432. 0x275a,
  33433. "a97",
  33434. 0x275b,
  33435. "a98",
  33436. 0x275c,
  33437. "a99",
  33438. 0x275d,
  33439. "a100",
  33440. 0x275e,
  33441. "a101",
  33442. 0x2761,
  33443. "a102",
  33444. 0x2762,
  33445. "a103",
  33446. 0x2763,
  33447. "a104",
  33448. 0x2764,
  33449. "a106",
  33450. 0x2765,
  33451. "a107",
  33452. 0x2766,
  33453. "a108",
  33454. 0x2767,
  33455. "a112",
  33456. 0x2663,
  33457. "a111",
  33458. 0x2666,
  33459. "a110",
  33460. 0x2665,
  33461. "a109",
  33462. 0x2660,
  33463. "a120",
  33464. 0x2460,
  33465. "a121",
  33466. 0x2461,
  33467. "a122",
  33468. 0x2462,
  33469. "a123",
  33470. 0x2463,
  33471. "a124",
  33472. 0x2464,
  33473. "a125",
  33474. 0x2465,
  33475. "a126",
  33476. 0x2466,
  33477. "a127",
  33478. 0x2467,
  33479. "a128",
  33480. 0x2468,
  33481. "a129",
  33482. 0x2469,
  33483. "a130",
  33484. 0x2776,
  33485. "a131",
  33486. 0x2777,
  33487. "a132",
  33488. 0x2778,
  33489. "a133",
  33490. 0x2779,
  33491. "a134",
  33492. 0x277a,
  33493. "a135",
  33494. 0x277b,
  33495. "a136",
  33496. 0x277c,
  33497. "a137",
  33498. 0x277d,
  33499. "a138",
  33500. 0x277e,
  33501. "a139",
  33502. 0x277f,
  33503. "a140",
  33504. 0x2780,
  33505. "a141",
  33506. 0x2781,
  33507. "a142",
  33508. 0x2782,
  33509. "a143",
  33510. 0x2783,
  33511. "a144",
  33512. 0x2784,
  33513. "a145",
  33514. 0x2785,
  33515. "a146",
  33516. 0x2786,
  33517. "a147",
  33518. 0x2787,
  33519. "a148",
  33520. 0x2788,
  33521. "a149",
  33522. 0x2789,
  33523. "a150",
  33524. 0x278a,
  33525. "a151",
  33526. 0x278b,
  33527. "a152",
  33528. 0x278c,
  33529. "a153",
  33530. 0x278d,
  33531. "a154",
  33532. 0x278e,
  33533. "a155",
  33534. 0x278f,
  33535. "a156",
  33536. 0x2790,
  33537. "a157",
  33538. 0x2791,
  33539. "a158",
  33540. 0x2792,
  33541. "a159",
  33542. 0x2793,
  33543. "a160",
  33544. 0x2794,
  33545. "a161",
  33546. 0x2192,
  33547. "a163",
  33548. 0x2194,
  33549. "a164",
  33550. 0x2195,
  33551. "a196",
  33552. 0x2798,
  33553. "a165",
  33554. 0x2799,
  33555. "a192",
  33556. 0x279a,
  33557. "a166",
  33558. 0x279b,
  33559. "a167",
  33560. 0x279c,
  33561. "a168",
  33562. 0x279d,
  33563. "a169",
  33564. 0x279e,
  33565. "a170",
  33566. 0x279f,
  33567. "a171",
  33568. 0x27a0,
  33569. "a172",
  33570. 0x27a1,
  33571. "a173",
  33572. 0x27a2,
  33573. "a162",
  33574. 0x27a3,
  33575. "a174",
  33576. 0x27a4,
  33577. "a175",
  33578. 0x27a5,
  33579. "a176",
  33580. 0x27a6,
  33581. "a177",
  33582. 0x27a7,
  33583. "a178",
  33584. 0x27a8,
  33585. "a179",
  33586. 0x27a9,
  33587. "a193",
  33588. 0x27aa,
  33589. "a180",
  33590. 0x27ab,
  33591. "a199",
  33592. 0x27ac,
  33593. "a181",
  33594. 0x27ad,
  33595. "a200",
  33596. 0x27ae,
  33597. "a182",
  33598. 0x27af,
  33599. "a201",
  33600. 0x27b1,
  33601. "a183",
  33602. 0x27b2,
  33603. "a184",
  33604. 0x27b3,
  33605. "a197",
  33606. 0x27b4,
  33607. "a185",
  33608. 0x27b5,
  33609. "a194",
  33610. 0x27b6,
  33611. "a198",
  33612. 0x27b7,
  33613. "a186",
  33614. 0x27b8,
  33615. "a195",
  33616. 0x27b9,
  33617. "a187",
  33618. 0x27ba,
  33619. "a188",
  33620. 0x27bb,
  33621. "a189",
  33622. 0x27bc,
  33623. "a190",
  33624. 0x27bd,
  33625. "a191",
  33626. 0x27be,
  33627. "a89",
  33628. 0x2768,
  33629. "a90",
  33630. 0x2769,
  33631. "a93",
  33632. 0x276a,
  33633. "a94",
  33634. 0x276b,
  33635. "a91",
  33636. 0x276c,
  33637. "a92",
  33638. 0x276d,
  33639. "a205",
  33640. 0x276e,
  33641. "a85",
  33642. 0x276f,
  33643. "a206",
  33644. 0x2770,
  33645. "a86",
  33646. 0x2771,
  33647. "a87",
  33648. 0x2772,
  33649. "a88",
  33650. 0x2773,
  33651. "a95",
  33652. 0x2774,
  33653. "a96",
  33654. 0x2775,
  33655. ".notdef",
  33656. 0x0000
  33657. ];
  33658. });
  33659. /***/ }),
  33660. /* 38 */
  33661. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  33662. __w_pdfjs_require__.r(__webpack_exports__);
  33663. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  33664. /* harmony export */ "clearUnicodeCaches": () => (/* binding */ clearUnicodeCaches),
  33665. /* harmony export */ "getCharUnicodeCategory": () => (/* binding */ getCharUnicodeCategory),
  33666. /* harmony export */ "getNormalizedUnicodes": () => (/* binding */ getNormalizedUnicodes),
  33667. /* harmony export */ "getUnicodeForGlyph": () => (/* binding */ getUnicodeForGlyph),
  33668. /* harmony export */ "getUnicodeRangeFor": () => (/* binding */ getUnicodeRangeFor),
  33669. /* harmony export */ "mapSpecialUnicodeValues": () => (/* binding */ mapSpecialUnicodeValues),
  33670. /* harmony export */ "reverseIfRtl": () => (/* binding */ reverseIfRtl)
  33671. /* harmony export */ });
  33672. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(4);
  33673. const getSpecialPUASymbols = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getLookupTableFactory)(function (t) {
  33674. t[63721] = 0x00a9;
  33675. t[63193] = 0x00a9;
  33676. t[63720] = 0x00ae;
  33677. t[63194] = 0x00ae;
  33678. t[63722] = 0x2122;
  33679. t[63195] = 0x2122;
  33680. t[63729] = 0x23a7;
  33681. t[63730] = 0x23a8;
  33682. t[63731] = 0x23a9;
  33683. t[63740] = 0x23ab;
  33684. t[63741] = 0x23ac;
  33685. t[63742] = 0x23ad;
  33686. t[63726] = 0x23a1;
  33687. t[63727] = 0x23a2;
  33688. t[63728] = 0x23a3;
  33689. t[63737] = 0x23a4;
  33690. t[63738] = 0x23a5;
  33691. t[63739] = 0x23a6;
  33692. t[63723] = 0x239b;
  33693. t[63724] = 0x239c;
  33694. t[63725] = 0x239d;
  33695. t[63734] = 0x239e;
  33696. t[63735] = 0x239f;
  33697. t[63736] = 0x23a0;
  33698. });
  33699. function mapSpecialUnicodeValues(code) {
  33700. if (code >= 0xfff0 && code <= 0xffff) {
  33701. return 0;
  33702. } else if (code >= 0xf600 && code <= 0xf8ff) {
  33703. return getSpecialPUASymbols()[code] || code;
  33704. } else if (code === 0x00ad) {
  33705. return 0x002d;
  33706. }
  33707. return code;
  33708. }
  33709. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  33710. let unicode = glyphsUnicodeMap[name];
  33711. if (unicode !== undefined) {
  33712. return unicode;
  33713. }
  33714. if (!name) {
  33715. return -1;
  33716. }
  33717. if (name[0] === "u") {
  33718. const nameLen = name.length;
  33719. let hexStr;
  33720. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  33721. hexStr = name.substring(3);
  33722. } else if (nameLen >= 5 && nameLen <= 7) {
  33723. hexStr = name.substring(1);
  33724. } else {
  33725. return -1;
  33726. }
  33727. if (hexStr === hexStr.toUpperCase()) {
  33728. unicode = parseInt(hexStr, 16);
  33729. if (unicode >= 0) {
  33730. return unicode;
  33731. }
  33732. }
  33733. }
  33734. return -1;
  33735. }
  33736. const UnicodeRanges = [
  33737. {
  33738. begin: 0x0000,
  33739. end: 0x007f
  33740. },
  33741. {
  33742. begin: 0x0080,
  33743. end: 0x00ff
  33744. },
  33745. {
  33746. begin: 0x0100,
  33747. end: 0x017f
  33748. },
  33749. {
  33750. begin: 0x0180,
  33751. end: 0x024f
  33752. },
  33753. {
  33754. begin: 0x0250,
  33755. end: 0x02af
  33756. },
  33757. {
  33758. begin: 0x02b0,
  33759. end: 0x02ff
  33760. },
  33761. {
  33762. begin: 0x0300,
  33763. end: 0x036f
  33764. },
  33765. {
  33766. begin: 0x0370,
  33767. end: 0x03ff
  33768. },
  33769. {
  33770. begin: 0x2c80,
  33771. end: 0x2cff
  33772. },
  33773. {
  33774. begin: 0x0400,
  33775. end: 0x04ff
  33776. },
  33777. {
  33778. begin: 0x0530,
  33779. end: 0x058f
  33780. },
  33781. {
  33782. begin: 0x0590,
  33783. end: 0x05ff
  33784. },
  33785. {
  33786. begin: 0xa500,
  33787. end: 0xa63f
  33788. },
  33789. {
  33790. begin: 0x0600,
  33791. end: 0x06ff
  33792. },
  33793. {
  33794. begin: 0x07c0,
  33795. end: 0x07ff
  33796. },
  33797. {
  33798. begin: 0x0900,
  33799. end: 0x097f
  33800. },
  33801. {
  33802. begin: 0x0980,
  33803. end: 0x09ff
  33804. },
  33805. {
  33806. begin: 0x0a00,
  33807. end: 0x0a7f
  33808. },
  33809. {
  33810. begin: 0x0a80,
  33811. end: 0x0aff
  33812. },
  33813. {
  33814. begin: 0x0b00,
  33815. end: 0x0b7f
  33816. },
  33817. {
  33818. begin: 0x0b80,
  33819. end: 0x0bff
  33820. },
  33821. {
  33822. begin: 0x0c00,
  33823. end: 0x0c7f
  33824. },
  33825. {
  33826. begin: 0x0c80,
  33827. end: 0x0cff
  33828. },
  33829. {
  33830. begin: 0x0d00,
  33831. end: 0x0d7f
  33832. },
  33833. {
  33834. begin: 0x0e00,
  33835. end: 0x0e7f
  33836. },
  33837. {
  33838. begin: 0x0e80,
  33839. end: 0x0eff
  33840. },
  33841. {
  33842. begin: 0x10a0,
  33843. end: 0x10ff
  33844. },
  33845. {
  33846. begin: 0x1b00,
  33847. end: 0x1b7f
  33848. },
  33849. {
  33850. begin: 0x1100,
  33851. end: 0x11ff
  33852. },
  33853. {
  33854. begin: 0x1e00,
  33855. end: 0x1eff
  33856. },
  33857. {
  33858. begin: 0x1f00,
  33859. end: 0x1fff
  33860. },
  33861. {
  33862. begin: 0x2000,
  33863. end: 0x206f
  33864. },
  33865. {
  33866. begin: 0x2070,
  33867. end: 0x209f
  33868. },
  33869. {
  33870. begin: 0x20a0,
  33871. end: 0x20cf
  33872. },
  33873. {
  33874. begin: 0x20d0,
  33875. end: 0x20ff
  33876. },
  33877. {
  33878. begin: 0x2100,
  33879. end: 0x214f
  33880. },
  33881. {
  33882. begin: 0x2150,
  33883. end: 0x218f
  33884. },
  33885. {
  33886. begin: 0x2190,
  33887. end: 0x21ff
  33888. },
  33889. {
  33890. begin: 0x2200,
  33891. end: 0x22ff
  33892. },
  33893. {
  33894. begin: 0x2300,
  33895. end: 0x23ff
  33896. },
  33897. {
  33898. begin: 0x2400,
  33899. end: 0x243f
  33900. },
  33901. {
  33902. begin: 0x2440,
  33903. end: 0x245f
  33904. },
  33905. {
  33906. begin: 0x2460,
  33907. end: 0x24ff
  33908. },
  33909. {
  33910. begin: 0x2500,
  33911. end: 0x257f
  33912. },
  33913. {
  33914. begin: 0x2580,
  33915. end: 0x259f
  33916. },
  33917. {
  33918. begin: 0x25a0,
  33919. end: 0x25ff
  33920. },
  33921. {
  33922. begin: 0x2600,
  33923. end: 0x26ff
  33924. },
  33925. {
  33926. begin: 0x2700,
  33927. end: 0x27bf
  33928. },
  33929. {
  33930. begin: 0x3000,
  33931. end: 0x303f
  33932. },
  33933. {
  33934. begin: 0x3040,
  33935. end: 0x309f
  33936. },
  33937. {
  33938. begin: 0x30a0,
  33939. end: 0x30ff
  33940. },
  33941. {
  33942. begin: 0x3100,
  33943. end: 0x312f
  33944. },
  33945. {
  33946. begin: 0x3130,
  33947. end: 0x318f
  33948. },
  33949. {
  33950. begin: 0xa840,
  33951. end: 0xa87f
  33952. },
  33953. {
  33954. begin: 0x3200,
  33955. end: 0x32ff
  33956. },
  33957. {
  33958. begin: 0x3300,
  33959. end: 0x33ff
  33960. },
  33961. {
  33962. begin: 0xac00,
  33963. end: 0xd7af
  33964. },
  33965. {
  33966. begin: 0xd800,
  33967. end: 0xdfff
  33968. },
  33969. {
  33970. begin: 0x10900,
  33971. end: 0x1091f
  33972. },
  33973. {
  33974. begin: 0x4e00,
  33975. end: 0x9fff
  33976. },
  33977. {
  33978. begin: 0xe000,
  33979. end: 0xf8ff
  33980. },
  33981. {
  33982. begin: 0x31c0,
  33983. end: 0x31ef
  33984. },
  33985. {
  33986. begin: 0xfb00,
  33987. end: 0xfb4f
  33988. },
  33989. {
  33990. begin: 0xfb50,
  33991. end: 0xfdff
  33992. },
  33993. {
  33994. begin: 0xfe20,
  33995. end: 0xfe2f
  33996. },
  33997. {
  33998. begin: 0xfe10,
  33999. end: 0xfe1f
  34000. },
  34001. {
  34002. begin: 0xfe50,
  34003. end: 0xfe6f
  34004. },
  34005. {
  34006. begin: 0xfe70,
  34007. end: 0xfeff
  34008. },
  34009. {
  34010. begin: 0xff00,
  34011. end: 0xffef
  34012. },
  34013. {
  34014. begin: 0xfff0,
  34015. end: 0xffff
  34016. },
  34017. {
  34018. begin: 0x0f00,
  34019. end: 0x0fff
  34020. },
  34021. {
  34022. begin: 0x0700,
  34023. end: 0x074f
  34024. },
  34025. {
  34026. begin: 0x0780,
  34027. end: 0x07bf
  34028. },
  34029. {
  34030. begin: 0x0d80,
  34031. end: 0x0dff
  34032. },
  34033. {
  34034. begin: 0x1000,
  34035. end: 0x109f
  34036. },
  34037. {
  34038. begin: 0x1200,
  34039. end: 0x137f
  34040. },
  34041. {
  34042. begin: 0x13a0,
  34043. end: 0x13ff
  34044. },
  34045. {
  34046. begin: 0x1400,
  34047. end: 0x167f
  34048. },
  34049. {
  34050. begin: 0x1680,
  34051. end: 0x169f
  34052. },
  34053. {
  34054. begin: 0x16a0,
  34055. end: 0x16ff
  34056. },
  34057. {
  34058. begin: 0x1780,
  34059. end: 0x17ff
  34060. },
  34061. {
  34062. begin: 0x1800,
  34063. end: 0x18af
  34064. },
  34065. {
  34066. begin: 0x2800,
  34067. end: 0x28ff
  34068. },
  34069. {
  34070. begin: 0xa000,
  34071. end: 0xa48f
  34072. },
  34073. {
  34074. begin: 0x1700,
  34075. end: 0x171f
  34076. },
  34077. {
  34078. begin: 0x10300,
  34079. end: 0x1032f
  34080. },
  34081. {
  34082. begin: 0x10330,
  34083. end: 0x1034f
  34084. },
  34085. {
  34086. begin: 0x10400,
  34087. end: 0x1044f
  34088. },
  34089. {
  34090. begin: 0x1d000,
  34091. end: 0x1d0ff
  34092. },
  34093. {
  34094. begin: 0x1d400,
  34095. end: 0x1d7ff
  34096. },
  34097. {
  34098. begin: 0xff000,
  34099. end: 0xffffd
  34100. },
  34101. {
  34102. begin: 0xfe00,
  34103. end: 0xfe0f
  34104. },
  34105. {
  34106. begin: 0xe0000,
  34107. end: 0xe007f
  34108. },
  34109. {
  34110. begin: 0x1900,
  34111. end: 0x194f
  34112. },
  34113. {
  34114. begin: 0x1950,
  34115. end: 0x197f
  34116. },
  34117. {
  34118. begin: 0x1980,
  34119. end: 0x19df
  34120. },
  34121. {
  34122. begin: 0x1a00,
  34123. end: 0x1a1f
  34124. },
  34125. {
  34126. begin: 0x2c00,
  34127. end: 0x2c5f
  34128. },
  34129. {
  34130. begin: 0x2d30,
  34131. end: 0x2d7f
  34132. },
  34133. {
  34134. begin: 0x4dc0,
  34135. end: 0x4dff
  34136. },
  34137. {
  34138. begin: 0xa800,
  34139. end: 0xa82f
  34140. },
  34141. {
  34142. begin: 0x10000,
  34143. end: 0x1007f
  34144. },
  34145. {
  34146. begin: 0x10140,
  34147. end: 0x1018f
  34148. },
  34149. {
  34150. begin: 0x10380,
  34151. end: 0x1039f
  34152. },
  34153. {
  34154. begin: 0x103a0,
  34155. end: 0x103df
  34156. },
  34157. {
  34158. begin: 0x10450,
  34159. end: 0x1047f
  34160. },
  34161. {
  34162. begin: 0x10480,
  34163. end: 0x104af
  34164. },
  34165. {
  34166. begin: 0x10800,
  34167. end: 0x1083f
  34168. },
  34169. {
  34170. begin: 0x10a00,
  34171. end: 0x10a5f
  34172. },
  34173. {
  34174. begin: 0x1d300,
  34175. end: 0x1d35f
  34176. },
  34177. {
  34178. begin: 0x12000,
  34179. end: 0x123ff
  34180. },
  34181. {
  34182. begin: 0x1d360,
  34183. end: 0x1d37f
  34184. },
  34185. {
  34186. begin: 0x1b80,
  34187. end: 0x1bbf
  34188. },
  34189. {
  34190. begin: 0x1c00,
  34191. end: 0x1c4f
  34192. },
  34193. {
  34194. begin: 0x1c50,
  34195. end: 0x1c7f
  34196. },
  34197. {
  34198. begin: 0xa880,
  34199. end: 0xa8df
  34200. },
  34201. {
  34202. begin: 0xa900,
  34203. end: 0xa92f
  34204. },
  34205. {
  34206. begin: 0xa930,
  34207. end: 0xa95f
  34208. },
  34209. {
  34210. begin: 0xaa00,
  34211. end: 0xaa5f
  34212. },
  34213. {
  34214. begin: 0x10190,
  34215. end: 0x101cf
  34216. },
  34217. {
  34218. begin: 0x101d0,
  34219. end: 0x101ff
  34220. },
  34221. {
  34222. begin: 0x102a0,
  34223. end: 0x102df
  34224. },
  34225. {
  34226. begin: 0x1f030,
  34227. end: 0x1f09f
  34228. }
  34229. ];
  34230. function getUnicodeRangeFor(value) {
  34231. for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  34232. const range = UnicodeRanges[i];
  34233. if (value >= range.begin && value < range.end) {
  34234. return i;
  34235. }
  34236. }
  34237. return -1;
  34238. }
  34239. function isRTLRangeFor(value) {
  34240. let range = UnicodeRanges[13];
  34241. if (value >= range.begin && value < range.end) {
  34242. return true;
  34243. }
  34244. range = UnicodeRanges[11];
  34245. if (value >= range.begin && value < range.end) {
  34246. return true;
  34247. }
  34248. return false;
  34249. }
  34250. const getNormalizedUnicodes = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  34251. return [
  34252. "\u00A8",
  34253. "\u0020\u0308",
  34254. "\u00AF",
  34255. "\u0020\u0304",
  34256. "\u00B4",
  34257. "\u0020\u0301",
  34258. "\u00B5",
  34259. "\u03BC",
  34260. "\u00B8",
  34261. "\u0020\u0327",
  34262. "\u0132",
  34263. "\u0049\u004A",
  34264. "\u0133",
  34265. "\u0069\u006A",
  34266. "\u013F",
  34267. "\u004C\u00B7",
  34268. "\u0140",
  34269. "\u006C\u00B7",
  34270. "\u0149",
  34271. "\u02BC\u006E",
  34272. "\u017F",
  34273. "\u0073",
  34274. "\u01C4",
  34275. "\u0044\u017D",
  34276. "\u01C5",
  34277. "\u0044\u017E",
  34278. "\u01C6",
  34279. "\u0064\u017E",
  34280. "\u01C7",
  34281. "\u004C\u004A",
  34282. "\u01C8",
  34283. "\u004C\u006A",
  34284. "\u01C9",
  34285. "\u006C\u006A",
  34286. "\u01CA",
  34287. "\u004E\u004A",
  34288. "\u01CB",
  34289. "\u004E\u006A",
  34290. "\u01CC",
  34291. "\u006E\u006A",
  34292. "\u01F1",
  34293. "\u0044\u005A",
  34294. "\u01F2",
  34295. "\u0044\u007A",
  34296. "\u01F3",
  34297. "\u0064\u007A",
  34298. "\u02D8",
  34299. "\u0020\u0306",
  34300. "\u02D9",
  34301. "\u0020\u0307",
  34302. "\u02DA",
  34303. "\u0020\u030A",
  34304. "\u02DB",
  34305. "\u0020\u0328",
  34306. "\u02DC",
  34307. "\u0020\u0303",
  34308. "\u02DD",
  34309. "\u0020\u030B",
  34310. "\u037A",
  34311. "\u0020\u0345",
  34312. "\u0384",
  34313. "\u0020\u0301",
  34314. "\u03D0",
  34315. "\u03B2",
  34316. "\u03D1",
  34317. "\u03B8",
  34318. "\u03D2",
  34319. "\u03A5",
  34320. "\u03D5",
  34321. "\u03C6",
  34322. "\u03D6",
  34323. "\u03C0",
  34324. "\u03F0",
  34325. "\u03BA",
  34326. "\u03F1",
  34327. "\u03C1",
  34328. "\u03F2",
  34329. "\u03C2",
  34330. "\u03F4",
  34331. "\u0398",
  34332. "\u03F5",
  34333. "\u03B5",
  34334. "\u03F9",
  34335. "\u03A3",
  34336. "\u0587",
  34337. "\u0565\u0582",
  34338. "\u0675",
  34339. "\u0627\u0674",
  34340. "\u0676",
  34341. "\u0648\u0674",
  34342. "\u0677",
  34343. "\u06C7\u0674",
  34344. "\u0678",
  34345. "\u064A\u0674",
  34346. "\u0E33",
  34347. "\u0E4D\u0E32",
  34348. "\u0EB3",
  34349. "\u0ECD\u0EB2",
  34350. "\u0EDC",
  34351. "\u0EAB\u0E99",
  34352. "\u0EDD",
  34353. "\u0EAB\u0EA1",
  34354. "\u0F77",
  34355. "\u0FB2\u0F81",
  34356. "\u0F79",
  34357. "\u0FB3\u0F81",
  34358. "\u1E9A",
  34359. "\u0061\u02BE",
  34360. "\u1FBD",
  34361. "\u0020\u0313",
  34362. "\u1FBF",
  34363. "\u0020\u0313",
  34364. "\u1FC0",
  34365. "\u0020\u0342",
  34366. "\u1FFE",
  34367. "\u0020\u0314",
  34368. "\u2002",
  34369. "\u0020",
  34370. "\u2003",
  34371. "\u0020",
  34372. "\u2004",
  34373. "\u0020",
  34374. "\u2005",
  34375. "\u0020",
  34376. "\u2006",
  34377. "\u0020",
  34378. "\u2008",
  34379. "\u0020",
  34380. "\u2009",
  34381. "\u0020",
  34382. "\u200A",
  34383. "\u0020",
  34384. "\u2017",
  34385. "\u0020\u0333",
  34386. "\u2024",
  34387. "\u002E",
  34388. "\u2025",
  34389. "\u002E\u002E",
  34390. "\u2026",
  34391. "\u002E\u002E\u002E",
  34392. "\u2033",
  34393. "\u2032\u2032",
  34394. "\u2034",
  34395. "\u2032\u2032\u2032",
  34396. "\u2036",
  34397. "\u2035\u2035",
  34398. "\u2037",
  34399. "\u2035\u2035\u2035",
  34400. "\u203C",
  34401. "\u0021\u0021",
  34402. "\u203E",
  34403. "\u0020\u0305",
  34404. "\u2047",
  34405. "\u003F\u003F",
  34406. "\u2048",
  34407. "\u003F\u0021",
  34408. "\u2049",
  34409. "\u0021\u003F",
  34410. "\u2057",
  34411. "\u2032\u2032\u2032\u2032",
  34412. "\u205F",
  34413. "\u0020",
  34414. "\u20A8",
  34415. "\u0052\u0073",
  34416. "\u2100",
  34417. "\u0061\u002F\u0063",
  34418. "\u2101",
  34419. "\u0061\u002F\u0073",
  34420. "\u2103",
  34421. "\u00B0\u0043",
  34422. "\u2105",
  34423. "\u0063\u002F\u006F",
  34424. "\u2106",
  34425. "\u0063\u002F\u0075",
  34426. "\u2107",
  34427. "\u0190",
  34428. "\u2109",
  34429. "\u00B0\u0046",
  34430. "\u2116",
  34431. "\u004E\u006F",
  34432. "\u2121",
  34433. "\u0054\u0045\u004C",
  34434. "\u2135",
  34435. "\u05D0",
  34436. "\u2136",
  34437. "\u05D1",
  34438. "\u2137",
  34439. "\u05D2",
  34440. "\u2138",
  34441. "\u05D3",
  34442. "\u213B",
  34443. "\u0046\u0041\u0058",
  34444. "\u2160",
  34445. "\u0049",
  34446. "\u2161",
  34447. "\u0049\u0049",
  34448. "\u2162",
  34449. "\u0049\u0049\u0049",
  34450. "\u2163",
  34451. "\u0049\u0056",
  34452. "\u2164",
  34453. "\u0056",
  34454. "\u2165",
  34455. "\u0056\u0049",
  34456. "\u2166",
  34457. "\u0056\u0049\u0049",
  34458. "\u2167",
  34459. "\u0056\u0049\u0049\u0049",
  34460. "\u2168",
  34461. "\u0049\u0058",
  34462. "\u2169",
  34463. "\u0058",
  34464. "\u216A",
  34465. "\u0058\u0049",
  34466. "\u216B",
  34467. "\u0058\u0049\u0049",
  34468. "\u216C",
  34469. "\u004C",
  34470. "\u216D",
  34471. "\u0043",
  34472. "\u216E",
  34473. "\u0044",
  34474. "\u216F",
  34475. "\u004D",
  34476. "\u2170",
  34477. "\u0069",
  34478. "\u2171",
  34479. "\u0069\u0069",
  34480. "\u2172",
  34481. "\u0069\u0069\u0069",
  34482. "\u2173",
  34483. "\u0069\u0076",
  34484. "\u2174",
  34485. "\u0076",
  34486. "\u2175",
  34487. "\u0076\u0069",
  34488. "\u2176",
  34489. "\u0076\u0069\u0069",
  34490. "\u2177",
  34491. "\u0076\u0069\u0069\u0069",
  34492. "\u2178",
  34493. "\u0069\u0078",
  34494. "\u2179",
  34495. "\u0078",
  34496. "\u217A",
  34497. "\u0078\u0069",
  34498. "\u217B",
  34499. "\u0078\u0069\u0069",
  34500. "\u217C",
  34501. "\u006C",
  34502. "\u217D",
  34503. "\u0063",
  34504. "\u217E",
  34505. "\u0064",
  34506. "\u217F",
  34507. "\u006D",
  34508. "\u222C",
  34509. "\u222B\u222B",
  34510. "\u222D",
  34511. "\u222B\u222B\u222B",
  34512. "\u222F",
  34513. "\u222E\u222E",
  34514. "\u2230",
  34515. "\u222E\u222E\u222E",
  34516. "\u2474",
  34517. "\u0028\u0031\u0029",
  34518. "\u2475",
  34519. "\u0028\u0032\u0029",
  34520. "\u2476",
  34521. "\u0028\u0033\u0029",
  34522. "\u2477",
  34523. "\u0028\u0034\u0029",
  34524. "\u2478",
  34525. "\u0028\u0035\u0029",
  34526. "\u2479",
  34527. "\u0028\u0036\u0029",
  34528. "\u247A",
  34529. "\u0028\u0037\u0029",
  34530. "\u247B",
  34531. "\u0028\u0038\u0029",
  34532. "\u247C",
  34533. "\u0028\u0039\u0029",
  34534. "\u247D",
  34535. "\u0028\u0031\u0030\u0029",
  34536. "\u247E",
  34537. "\u0028\u0031\u0031\u0029",
  34538. "\u247F",
  34539. "\u0028\u0031\u0032\u0029",
  34540. "\u2480",
  34541. "\u0028\u0031\u0033\u0029",
  34542. "\u2481",
  34543. "\u0028\u0031\u0034\u0029",
  34544. "\u2482",
  34545. "\u0028\u0031\u0035\u0029",
  34546. "\u2483",
  34547. "\u0028\u0031\u0036\u0029",
  34548. "\u2484",
  34549. "\u0028\u0031\u0037\u0029",
  34550. "\u2485",
  34551. "\u0028\u0031\u0038\u0029",
  34552. "\u2486",
  34553. "\u0028\u0031\u0039\u0029",
  34554. "\u2487",
  34555. "\u0028\u0032\u0030\u0029",
  34556. "\u2488",
  34557. "\u0031\u002E",
  34558. "\u2489",
  34559. "\u0032\u002E",
  34560. "\u248A",
  34561. "\u0033\u002E",
  34562. "\u248B",
  34563. "\u0034\u002E",
  34564. "\u248C",
  34565. "\u0035\u002E",
  34566. "\u248D",
  34567. "\u0036\u002E",
  34568. "\u248E",
  34569. "\u0037\u002E",
  34570. "\u248F",
  34571. "\u0038\u002E",
  34572. "\u2490",
  34573. "\u0039\u002E",
  34574. "\u2491",
  34575. "\u0031\u0030\u002E",
  34576. "\u2492",
  34577. "\u0031\u0031\u002E",
  34578. "\u2493",
  34579. "\u0031\u0032\u002E",
  34580. "\u2494",
  34581. "\u0031\u0033\u002E",
  34582. "\u2495",
  34583. "\u0031\u0034\u002E",
  34584. "\u2496",
  34585. "\u0031\u0035\u002E",
  34586. "\u2497",
  34587. "\u0031\u0036\u002E",
  34588. "\u2498",
  34589. "\u0031\u0037\u002E",
  34590. "\u2499",
  34591. "\u0031\u0038\u002E",
  34592. "\u249A",
  34593. "\u0031\u0039\u002E",
  34594. "\u249B",
  34595. "\u0032\u0030\u002E",
  34596. "\u249C",
  34597. "\u0028\u0061\u0029",
  34598. "\u249D",
  34599. "\u0028\u0062\u0029",
  34600. "\u249E",
  34601. "\u0028\u0063\u0029",
  34602. "\u249F",
  34603. "\u0028\u0064\u0029",
  34604. "\u24A0",
  34605. "\u0028\u0065\u0029",
  34606. "\u24A1",
  34607. "\u0028\u0066\u0029",
  34608. "\u24A2",
  34609. "\u0028\u0067\u0029",
  34610. "\u24A3",
  34611. "\u0028\u0068\u0029",
  34612. "\u24A4",
  34613. "\u0028\u0069\u0029",
  34614. "\u24A5",
  34615. "\u0028\u006A\u0029",
  34616. "\u24A6",
  34617. "\u0028\u006B\u0029",
  34618. "\u24A7",
  34619. "\u0028\u006C\u0029",
  34620. "\u24A8",
  34621. "\u0028\u006D\u0029",
  34622. "\u24A9",
  34623. "\u0028\u006E\u0029",
  34624. "\u24AA",
  34625. "\u0028\u006F\u0029",
  34626. "\u24AB",
  34627. "\u0028\u0070\u0029",
  34628. "\u24AC",
  34629. "\u0028\u0071\u0029",
  34630. "\u24AD",
  34631. "\u0028\u0072\u0029",
  34632. "\u24AE",
  34633. "\u0028\u0073\u0029",
  34634. "\u24AF",
  34635. "\u0028\u0074\u0029",
  34636. "\u24B0",
  34637. "\u0028\u0075\u0029",
  34638. "\u24B1",
  34639. "\u0028\u0076\u0029",
  34640. "\u24B2",
  34641. "\u0028\u0077\u0029",
  34642. "\u24B3",
  34643. "\u0028\u0078\u0029",
  34644. "\u24B4",
  34645. "\u0028\u0079\u0029",
  34646. "\u24B5",
  34647. "\u0028\u007A\u0029",
  34648. "\u2A0C",
  34649. "\u222B\u222B\u222B\u222B",
  34650. "\u2A74",
  34651. "\u003A\u003A\u003D",
  34652. "\u2A75",
  34653. "\u003D\u003D",
  34654. "\u2A76",
  34655. "\u003D\u003D\u003D",
  34656. "\u2E9F",
  34657. "\u6BCD",
  34658. "\u2EF3",
  34659. "\u9F9F",
  34660. "\u2F00",
  34661. "\u4E00",
  34662. "\u2F01",
  34663. "\u4E28",
  34664. "\u2F02",
  34665. "\u4E36",
  34666. "\u2F03",
  34667. "\u4E3F",
  34668. "\u2F04",
  34669. "\u4E59",
  34670. "\u2F05",
  34671. "\u4E85",
  34672. "\u2F06",
  34673. "\u4E8C",
  34674. "\u2F07",
  34675. "\u4EA0",
  34676. "\u2F08",
  34677. "\u4EBA",
  34678. "\u2F09",
  34679. "\u513F",
  34680. "\u2F0A",
  34681. "\u5165",
  34682. "\u2F0B",
  34683. "\u516B",
  34684. "\u2F0C",
  34685. "\u5182",
  34686. "\u2F0D",
  34687. "\u5196",
  34688. "\u2F0E",
  34689. "\u51AB",
  34690. "\u2F0F",
  34691. "\u51E0",
  34692. "\u2F10",
  34693. "\u51F5",
  34694. "\u2F11",
  34695. "\u5200",
  34696. "\u2F12",
  34697. "\u529B",
  34698. "\u2F13",
  34699. "\u52F9",
  34700. "\u2F14",
  34701. "\u5315",
  34702. "\u2F15",
  34703. "\u531A",
  34704. "\u2F16",
  34705. "\u5338",
  34706. "\u2F17",
  34707. "\u5341",
  34708. "\u2F18",
  34709. "\u535C",
  34710. "\u2F19",
  34711. "\u5369",
  34712. "\u2F1A",
  34713. "\u5382",
  34714. "\u2F1B",
  34715. "\u53B6",
  34716. "\u2F1C",
  34717. "\u53C8",
  34718. "\u2F1D",
  34719. "\u53E3",
  34720. "\u2F1E",
  34721. "\u56D7",
  34722. "\u2F1F",
  34723. "\u571F",
  34724. "\u2F20",
  34725. "\u58EB",
  34726. "\u2F21",
  34727. "\u5902",
  34728. "\u2F22",
  34729. "\u590A",
  34730. "\u2F23",
  34731. "\u5915",
  34732. "\u2F24",
  34733. "\u5927",
  34734. "\u2F25",
  34735. "\u5973",
  34736. "\u2F26",
  34737. "\u5B50",
  34738. "\u2F27",
  34739. "\u5B80",
  34740. "\u2F28",
  34741. "\u5BF8",
  34742. "\u2F29",
  34743. "\u5C0F",
  34744. "\u2F2A",
  34745. "\u5C22",
  34746. "\u2F2B",
  34747. "\u5C38",
  34748. "\u2F2C",
  34749. "\u5C6E",
  34750. "\u2F2D",
  34751. "\u5C71",
  34752. "\u2F2E",
  34753. "\u5DDB",
  34754. "\u2F2F",
  34755. "\u5DE5",
  34756. "\u2F30",
  34757. "\u5DF1",
  34758. "\u2F31",
  34759. "\u5DFE",
  34760. "\u2F32",
  34761. "\u5E72",
  34762. "\u2F33",
  34763. "\u5E7A",
  34764. "\u2F34",
  34765. "\u5E7F",
  34766. "\u2F35",
  34767. "\u5EF4",
  34768. "\u2F36",
  34769. "\u5EFE",
  34770. "\u2F37",
  34771. "\u5F0B",
  34772. "\u2F38",
  34773. "\u5F13",
  34774. "\u2F39",
  34775. "\u5F50",
  34776. "\u2F3A",
  34777. "\u5F61",
  34778. "\u2F3B",
  34779. "\u5F73",
  34780. "\u2F3C",
  34781. "\u5FC3",
  34782. "\u2F3D",
  34783. "\u6208",
  34784. "\u2F3E",
  34785. "\u6236",
  34786. "\u2F3F",
  34787. "\u624B",
  34788. "\u2F40",
  34789. "\u652F",
  34790. "\u2F41",
  34791. "\u6534",
  34792. "\u2F42",
  34793. "\u6587",
  34794. "\u2F43",
  34795. "\u6597",
  34796. "\u2F44",
  34797. "\u65A4",
  34798. "\u2F45",
  34799. "\u65B9",
  34800. "\u2F46",
  34801. "\u65E0",
  34802. "\u2F47",
  34803. "\u65E5",
  34804. "\u2F48",
  34805. "\u66F0",
  34806. "\u2F49",
  34807. "\u6708",
  34808. "\u2F4A",
  34809. "\u6728",
  34810. "\u2F4B",
  34811. "\u6B20",
  34812. "\u2F4C",
  34813. "\u6B62",
  34814. "\u2F4D",
  34815. "\u6B79",
  34816. "\u2F4E",
  34817. "\u6BB3",
  34818. "\u2F4F",
  34819. "\u6BCB",
  34820. "\u2F50",
  34821. "\u6BD4",
  34822. "\u2F51",
  34823. "\u6BDB",
  34824. "\u2F52",
  34825. "\u6C0F",
  34826. "\u2F53",
  34827. "\u6C14",
  34828. "\u2F54",
  34829. "\u6C34",
  34830. "\u2F55",
  34831. "\u706B",
  34832. "\u2F56",
  34833. "\u722A",
  34834. "\u2F57",
  34835. "\u7236",
  34836. "\u2F58",
  34837. "\u723B",
  34838. "\u2F59",
  34839. "\u723F",
  34840. "\u2F5A",
  34841. "\u7247",
  34842. "\u2F5B",
  34843. "\u7259",
  34844. "\u2F5C",
  34845. "\u725B",
  34846. "\u2F5D",
  34847. "\u72AC",
  34848. "\u2F5E",
  34849. "\u7384",
  34850. "\u2F5F",
  34851. "\u7389",
  34852. "\u2F60",
  34853. "\u74DC",
  34854. "\u2F61",
  34855. "\u74E6",
  34856. "\u2F62",
  34857. "\u7518",
  34858. "\u2F63",
  34859. "\u751F",
  34860. "\u2F64",
  34861. "\u7528",
  34862. "\u2F65",
  34863. "\u7530",
  34864. "\u2F66",
  34865. "\u758B",
  34866. "\u2F67",
  34867. "\u7592",
  34868. "\u2F68",
  34869. "\u7676",
  34870. "\u2F69",
  34871. "\u767D",
  34872. "\u2F6A",
  34873. "\u76AE",
  34874. "\u2F6B",
  34875. "\u76BF",
  34876. "\u2F6C",
  34877. "\u76EE",
  34878. "\u2F6D",
  34879. "\u77DB",
  34880. "\u2F6E",
  34881. "\u77E2",
  34882. "\u2F6F",
  34883. "\u77F3",
  34884. "\u2F70",
  34885. "\u793A",
  34886. "\u2F71",
  34887. "\u79B8",
  34888. "\u2F72",
  34889. "\u79BE",
  34890. "\u2F73",
  34891. "\u7A74",
  34892. "\u2F74",
  34893. "\u7ACB",
  34894. "\u2F75",
  34895. "\u7AF9",
  34896. "\u2F76",
  34897. "\u7C73",
  34898. "\u2F77",
  34899. "\u7CF8",
  34900. "\u2F78",
  34901. "\u7F36",
  34902. "\u2F79",
  34903. "\u7F51",
  34904. "\u2F7A",
  34905. "\u7F8A",
  34906. "\u2F7B",
  34907. "\u7FBD",
  34908. "\u2F7C",
  34909. "\u8001",
  34910. "\u2F7D",
  34911. "\u800C",
  34912. "\u2F7E",
  34913. "\u8012",
  34914. "\u2F7F",
  34915. "\u8033",
  34916. "\u2F80",
  34917. "\u807F",
  34918. "\u2F81",
  34919. "\u8089",
  34920. "\u2F82",
  34921. "\u81E3",
  34922. "\u2F83",
  34923. "\u81EA",
  34924. "\u2F84",
  34925. "\u81F3",
  34926. "\u2F85",
  34927. "\u81FC",
  34928. "\u2F86",
  34929. "\u820C",
  34930. "\u2F87",
  34931. "\u821B",
  34932. "\u2F88",
  34933. "\u821F",
  34934. "\u2F89",
  34935. "\u826E",
  34936. "\u2F8A",
  34937. "\u8272",
  34938. "\u2F8B",
  34939. "\u8278",
  34940. "\u2F8C",
  34941. "\u864D",
  34942. "\u2F8D",
  34943. "\u866B",
  34944. "\u2F8E",
  34945. "\u8840",
  34946. "\u2F8F",
  34947. "\u884C",
  34948. "\u2F90",
  34949. "\u8863",
  34950. "\u2F91",
  34951. "\u897E",
  34952. "\u2F92",
  34953. "\u898B",
  34954. "\u2F93",
  34955. "\u89D2",
  34956. "\u2F94",
  34957. "\u8A00",
  34958. "\u2F95",
  34959. "\u8C37",
  34960. "\u2F96",
  34961. "\u8C46",
  34962. "\u2F97",
  34963. "\u8C55",
  34964. "\u2F98",
  34965. "\u8C78",
  34966. "\u2F99",
  34967. "\u8C9D",
  34968. "\u2F9A",
  34969. "\u8D64",
  34970. "\u2F9B",
  34971. "\u8D70",
  34972. "\u2F9C",
  34973. "\u8DB3",
  34974. "\u2F9D",
  34975. "\u8EAB",
  34976. "\u2F9E",
  34977. "\u8ECA",
  34978. "\u2F9F",
  34979. "\u8F9B",
  34980. "\u2FA0",
  34981. "\u8FB0",
  34982. "\u2FA1",
  34983. "\u8FB5",
  34984. "\u2FA2",
  34985. "\u9091",
  34986. "\u2FA3",
  34987. "\u9149",
  34988. "\u2FA4",
  34989. "\u91C6",
  34990. "\u2FA5",
  34991. "\u91CC",
  34992. "\u2FA6",
  34993. "\u91D1",
  34994. "\u2FA7",
  34995. "\u9577",
  34996. "\u2FA8",
  34997. "\u9580",
  34998. "\u2FA9",
  34999. "\u961C",
  35000. "\u2FAA",
  35001. "\u96B6",
  35002. "\u2FAB",
  35003. "\u96B9",
  35004. "\u2FAC",
  35005. "\u96E8",
  35006. "\u2FAD",
  35007. "\u9751",
  35008. "\u2FAE",
  35009. "\u975E",
  35010. "\u2FAF",
  35011. "\u9762",
  35012. "\u2FB0",
  35013. "\u9769",
  35014. "\u2FB1",
  35015. "\u97CB",
  35016. "\u2FB2",
  35017. "\u97ED",
  35018. "\u2FB3",
  35019. "\u97F3",
  35020. "\u2FB4",
  35021. "\u9801",
  35022. "\u2FB5",
  35023. "\u98A8",
  35024. "\u2FB6",
  35025. "\u98DB",
  35026. "\u2FB7",
  35027. "\u98DF",
  35028. "\u2FB8",
  35029. "\u9996",
  35030. "\u2FB9",
  35031. "\u9999",
  35032. "\u2FBA",
  35033. "\u99AC",
  35034. "\u2FBB",
  35035. "\u9AA8",
  35036. "\u2FBC",
  35037. "\u9AD8",
  35038. "\u2FBD",
  35039. "\u9ADF",
  35040. "\u2FBE",
  35041. "\u9B25",
  35042. "\u2FBF",
  35043. "\u9B2F",
  35044. "\u2FC0",
  35045. "\u9B32",
  35046. "\u2FC1",
  35047. "\u9B3C",
  35048. "\u2FC2",
  35049. "\u9B5A",
  35050. "\u2FC3",
  35051. "\u9CE5",
  35052. "\u2FC4",
  35053. "\u9E75",
  35054. "\u2FC5",
  35055. "\u9E7F",
  35056. "\u2FC6",
  35057. "\u9EA5",
  35058. "\u2FC7",
  35059. "\u9EBB",
  35060. "\u2FC8",
  35061. "\u9EC3",
  35062. "\u2FC9",
  35063. "\u9ECD",
  35064. "\u2FCA",
  35065. "\u9ED1",
  35066. "\u2FCB",
  35067. "\u9EF9",
  35068. "\u2FCC",
  35069. "\u9EFD",
  35070. "\u2FCD",
  35071. "\u9F0E",
  35072. "\u2FCE",
  35073. "\u9F13",
  35074. "\u2FCF",
  35075. "\u9F20",
  35076. "\u2FD0",
  35077. "\u9F3B",
  35078. "\u2FD1",
  35079. "\u9F4A",
  35080. "\u2FD2",
  35081. "\u9F52",
  35082. "\u2FD3",
  35083. "\u9F8D",
  35084. "\u2FD4",
  35085. "\u9F9C",
  35086. "\u2FD5",
  35087. "\u9FA0",
  35088. "\u3036",
  35089. "\u3012",
  35090. "\u3038",
  35091. "\u5341",
  35092. "\u3039",
  35093. "\u5344",
  35094. "\u303A",
  35095. "\u5345",
  35096. "\u309B",
  35097. "\u0020\u3099",
  35098. "\u309C",
  35099. "\u0020\u309A",
  35100. "\u3131",
  35101. "\u1100",
  35102. "\u3132",
  35103. "\u1101",
  35104. "\u3133",
  35105. "\u11AA",
  35106. "\u3134",
  35107. "\u1102",
  35108. "\u3135",
  35109. "\u11AC",
  35110. "\u3136",
  35111. "\u11AD",
  35112. "\u3137",
  35113. "\u1103",
  35114. "\u3138",
  35115. "\u1104",
  35116. "\u3139",
  35117. "\u1105",
  35118. "\u313A",
  35119. "\u11B0",
  35120. "\u313B",
  35121. "\u11B1",
  35122. "\u313C",
  35123. "\u11B2",
  35124. "\u313D",
  35125. "\u11B3",
  35126. "\u313E",
  35127. "\u11B4",
  35128. "\u313F",
  35129. "\u11B5",
  35130. "\u3140",
  35131. "\u111A",
  35132. "\u3141",
  35133. "\u1106",
  35134. "\u3142",
  35135. "\u1107",
  35136. "\u3143",
  35137. "\u1108",
  35138. "\u3144",
  35139. "\u1121",
  35140. "\u3145",
  35141. "\u1109",
  35142. "\u3146",
  35143. "\u110A",
  35144. "\u3147",
  35145. "\u110B",
  35146. "\u3148",
  35147. "\u110C",
  35148. "\u3149",
  35149. "\u110D",
  35150. "\u314A",
  35151. "\u110E",
  35152. "\u314B",
  35153. "\u110F",
  35154. "\u314C",
  35155. "\u1110",
  35156. "\u314D",
  35157. "\u1111",
  35158. "\u314E",
  35159. "\u1112",
  35160. "\u314F",
  35161. "\u1161",
  35162. "\u3150",
  35163. "\u1162",
  35164. "\u3151",
  35165. "\u1163",
  35166. "\u3152",
  35167. "\u1164",
  35168. "\u3153",
  35169. "\u1165",
  35170. "\u3154",
  35171. "\u1166",
  35172. "\u3155",
  35173. "\u1167",
  35174. "\u3156",
  35175. "\u1168",
  35176. "\u3157",
  35177. "\u1169",
  35178. "\u3158",
  35179. "\u116A",
  35180. "\u3159",
  35181. "\u116B",
  35182. "\u315A",
  35183. "\u116C",
  35184. "\u315B",
  35185. "\u116D",
  35186. "\u315C",
  35187. "\u116E",
  35188. "\u315D",
  35189. "\u116F",
  35190. "\u315E",
  35191. "\u1170",
  35192. "\u315F",
  35193. "\u1171",
  35194. "\u3160",
  35195. "\u1172",
  35196. "\u3161",
  35197. "\u1173",
  35198. "\u3162",
  35199. "\u1174",
  35200. "\u3163",
  35201. "\u1175",
  35202. "\u3164",
  35203. "\u1160",
  35204. "\u3165",
  35205. "\u1114",
  35206. "\u3166",
  35207. "\u1115",
  35208. "\u3167",
  35209. "\u11C7",
  35210. "\u3168",
  35211. "\u11C8",
  35212. "\u3169",
  35213. "\u11CC",
  35214. "\u316A",
  35215. "\u11CE",
  35216. "\u316B",
  35217. "\u11D3",
  35218. "\u316C",
  35219. "\u11D7",
  35220. "\u316D",
  35221. "\u11D9",
  35222. "\u316E",
  35223. "\u111C",
  35224. "\u316F",
  35225. "\u11DD",
  35226. "\u3170",
  35227. "\u11DF",
  35228. "\u3171",
  35229. "\u111D",
  35230. "\u3172",
  35231. "\u111E",
  35232. "\u3173",
  35233. "\u1120",
  35234. "\u3174",
  35235. "\u1122",
  35236. "\u3175",
  35237. "\u1123",
  35238. "\u3176",
  35239. "\u1127",
  35240. "\u3177",
  35241. "\u1129",
  35242. "\u3178",
  35243. "\u112B",
  35244. "\u3179",
  35245. "\u112C",
  35246. "\u317A",
  35247. "\u112D",
  35248. "\u317B",
  35249. "\u112E",
  35250. "\u317C",
  35251. "\u112F",
  35252. "\u317D",
  35253. "\u1132",
  35254. "\u317E",
  35255. "\u1136",
  35256. "\u317F",
  35257. "\u1140",
  35258. "\u3180",
  35259. "\u1147",
  35260. "\u3181",
  35261. "\u114C",
  35262. "\u3182",
  35263. "\u11F1",
  35264. "\u3183",
  35265. "\u11F2",
  35266. "\u3184",
  35267. "\u1157",
  35268. "\u3185",
  35269. "\u1158",
  35270. "\u3186",
  35271. "\u1159",
  35272. "\u3187",
  35273. "\u1184",
  35274. "\u3188",
  35275. "\u1185",
  35276. "\u3189",
  35277. "\u1188",
  35278. "\u318A",
  35279. "\u1191",
  35280. "\u318B",
  35281. "\u1192",
  35282. "\u318C",
  35283. "\u1194",
  35284. "\u318D",
  35285. "\u119E",
  35286. "\u318E",
  35287. "\u11A1",
  35288. "\u3200",
  35289. "\u0028\u1100\u0029",
  35290. "\u3201",
  35291. "\u0028\u1102\u0029",
  35292. "\u3202",
  35293. "\u0028\u1103\u0029",
  35294. "\u3203",
  35295. "\u0028\u1105\u0029",
  35296. "\u3204",
  35297. "\u0028\u1106\u0029",
  35298. "\u3205",
  35299. "\u0028\u1107\u0029",
  35300. "\u3206",
  35301. "\u0028\u1109\u0029",
  35302. "\u3207",
  35303. "\u0028\u110B\u0029",
  35304. "\u3208",
  35305. "\u0028\u110C\u0029",
  35306. "\u3209",
  35307. "\u0028\u110E\u0029",
  35308. "\u320A",
  35309. "\u0028\u110F\u0029",
  35310. "\u320B",
  35311. "\u0028\u1110\u0029",
  35312. "\u320C",
  35313. "\u0028\u1111\u0029",
  35314. "\u320D",
  35315. "\u0028\u1112\u0029",
  35316. "\u320E",
  35317. "\u0028\u1100\u1161\u0029",
  35318. "\u320F",
  35319. "\u0028\u1102\u1161\u0029",
  35320. "\u3210",
  35321. "\u0028\u1103\u1161\u0029",
  35322. "\u3211",
  35323. "\u0028\u1105\u1161\u0029",
  35324. "\u3212",
  35325. "\u0028\u1106\u1161\u0029",
  35326. "\u3213",
  35327. "\u0028\u1107\u1161\u0029",
  35328. "\u3214",
  35329. "\u0028\u1109\u1161\u0029",
  35330. "\u3215",
  35331. "\u0028\u110B\u1161\u0029",
  35332. "\u3216",
  35333. "\u0028\u110C\u1161\u0029",
  35334. "\u3217",
  35335. "\u0028\u110E\u1161\u0029",
  35336. "\u3218",
  35337. "\u0028\u110F\u1161\u0029",
  35338. "\u3219",
  35339. "\u0028\u1110\u1161\u0029",
  35340. "\u321A",
  35341. "\u0028\u1111\u1161\u0029",
  35342. "\u321B",
  35343. "\u0028\u1112\u1161\u0029",
  35344. "\u321C",
  35345. "\u0028\u110C\u116E\u0029",
  35346. "\u321D",
  35347. "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029",
  35348. "\u321E",
  35349. "\u0028\u110B\u1169\u1112\u116E\u0029",
  35350. "\u3220",
  35351. "\u0028\u4E00\u0029",
  35352. "\u3221",
  35353. "\u0028\u4E8C\u0029",
  35354. "\u3222",
  35355. "\u0028\u4E09\u0029",
  35356. "\u3223",
  35357. "\u0028\u56DB\u0029",
  35358. "\u3224",
  35359. "\u0028\u4E94\u0029",
  35360. "\u3225",
  35361. "\u0028\u516D\u0029",
  35362. "\u3226",
  35363. "\u0028\u4E03\u0029",
  35364. "\u3227",
  35365. "\u0028\u516B\u0029",
  35366. "\u3228",
  35367. "\u0028\u4E5D\u0029",
  35368. "\u3229",
  35369. "\u0028\u5341\u0029",
  35370. "\u322A",
  35371. "\u0028\u6708\u0029",
  35372. "\u322B",
  35373. "\u0028\u706B\u0029",
  35374. "\u322C",
  35375. "\u0028\u6C34\u0029",
  35376. "\u322D",
  35377. "\u0028\u6728\u0029",
  35378. "\u322E",
  35379. "\u0028\u91D1\u0029",
  35380. "\u322F",
  35381. "\u0028\u571F\u0029",
  35382. "\u3230",
  35383. "\u0028\u65E5\u0029",
  35384. "\u3231",
  35385. "\u0028\u682A\u0029",
  35386. "\u3232",
  35387. "\u0028\u6709\u0029",
  35388. "\u3233",
  35389. "\u0028\u793E\u0029",
  35390. "\u3234",
  35391. "\u0028\u540D\u0029",
  35392. "\u3235",
  35393. "\u0028\u7279\u0029",
  35394. "\u3236",
  35395. "\u0028\u8CA1\u0029",
  35396. "\u3237",
  35397. "\u0028\u795D\u0029",
  35398. "\u3238",
  35399. "\u0028\u52B4\u0029",
  35400. "\u3239",
  35401. "\u0028\u4EE3\u0029",
  35402. "\u323A",
  35403. "\u0028\u547C\u0029",
  35404. "\u323B",
  35405. "\u0028\u5B66\u0029",
  35406. "\u323C",
  35407. "\u0028\u76E3\u0029",
  35408. "\u323D",
  35409. "\u0028\u4F01\u0029",
  35410. "\u323E",
  35411. "\u0028\u8CC7\u0029",
  35412. "\u323F",
  35413. "\u0028\u5354\u0029",
  35414. "\u3240",
  35415. "\u0028\u796D\u0029",
  35416. "\u3241",
  35417. "\u0028\u4F11\u0029",
  35418. "\u3242",
  35419. "\u0028\u81EA\u0029",
  35420. "\u3243",
  35421. "\u0028\u81F3\u0029",
  35422. "\u32C0",
  35423. "\u0031\u6708",
  35424. "\u32C1",
  35425. "\u0032\u6708",
  35426. "\u32C2",
  35427. "\u0033\u6708",
  35428. "\u32C3",
  35429. "\u0034\u6708",
  35430. "\u32C4",
  35431. "\u0035\u6708",
  35432. "\u32C5",
  35433. "\u0036\u6708",
  35434. "\u32C6",
  35435. "\u0037\u6708",
  35436. "\u32C7",
  35437. "\u0038\u6708",
  35438. "\u32C8",
  35439. "\u0039\u6708",
  35440. "\u32C9",
  35441. "\u0031\u0030\u6708",
  35442. "\u32CA",
  35443. "\u0031\u0031\u6708",
  35444. "\u32CB",
  35445. "\u0031\u0032\u6708",
  35446. "\u3358",
  35447. "\u0030\u70B9",
  35448. "\u3359",
  35449. "\u0031\u70B9",
  35450. "\u335A",
  35451. "\u0032\u70B9",
  35452. "\u335B",
  35453. "\u0033\u70B9",
  35454. "\u335C",
  35455. "\u0034\u70B9",
  35456. "\u335D",
  35457. "\u0035\u70B9",
  35458. "\u335E",
  35459. "\u0036\u70B9",
  35460. "\u335F",
  35461. "\u0037\u70B9",
  35462. "\u3360",
  35463. "\u0038\u70B9",
  35464. "\u3361",
  35465. "\u0039\u70B9",
  35466. "\u3362",
  35467. "\u0031\u0030\u70B9",
  35468. "\u3363",
  35469. "\u0031\u0031\u70B9",
  35470. "\u3364",
  35471. "\u0031\u0032\u70B9",
  35472. "\u3365",
  35473. "\u0031\u0033\u70B9",
  35474. "\u3366",
  35475. "\u0031\u0034\u70B9",
  35476. "\u3367",
  35477. "\u0031\u0035\u70B9",
  35478. "\u3368",
  35479. "\u0031\u0036\u70B9",
  35480. "\u3369",
  35481. "\u0031\u0037\u70B9",
  35482. "\u336A",
  35483. "\u0031\u0038\u70B9",
  35484. "\u336B",
  35485. "\u0031\u0039\u70B9",
  35486. "\u336C",
  35487. "\u0032\u0030\u70B9",
  35488. "\u336D",
  35489. "\u0032\u0031\u70B9",
  35490. "\u336E",
  35491. "\u0032\u0032\u70B9",
  35492. "\u336F",
  35493. "\u0032\u0033\u70B9",
  35494. "\u3370",
  35495. "\u0032\u0034\u70B9",
  35496. "\u33E0",
  35497. "\u0031\u65E5",
  35498. "\u33E1",
  35499. "\u0032\u65E5",
  35500. "\u33E2",
  35501. "\u0033\u65E5",
  35502. "\u33E3",
  35503. "\u0034\u65E5",
  35504. "\u33E4",
  35505. "\u0035\u65E5",
  35506. "\u33E5",
  35507. "\u0036\u65E5",
  35508. "\u33E6",
  35509. "\u0037\u65E5",
  35510. "\u33E7",
  35511. "\u0038\u65E5",
  35512. "\u33E8",
  35513. "\u0039\u65E5",
  35514. "\u33E9",
  35515. "\u0031\u0030\u65E5",
  35516. "\u33EA",
  35517. "\u0031\u0031\u65E5",
  35518. "\u33EB",
  35519. "\u0031\u0032\u65E5",
  35520. "\u33EC",
  35521. "\u0031\u0033\u65E5",
  35522. "\u33ED",
  35523. "\u0031\u0034\u65E5",
  35524. "\u33EE",
  35525. "\u0031\u0035\u65E5",
  35526. "\u33EF",
  35527. "\u0031\u0036\u65E5",
  35528. "\u33F0",
  35529. "\u0031\u0037\u65E5",
  35530. "\u33F1",
  35531. "\u0031\u0038\u65E5",
  35532. "\u33F2",
  35533. "\u0031\u0039\u65E5",
  35534. "\u33F3",
  35535. "\u0032\u0030\u65E5",
  35536. "\u33F4",
  35537. "\u0032\u0031\u65E5",
  35538. "\u33F5",
  35539. "\u0032\u0032\u65E5",
  35540. "\u33F6",
  35541. "\u0032\u0033\u65E5",
  35542. "\u33F7",
  35543. "\u0032\u0034\u65E5",
  35544. "\u33F8",
  35545. "\u0032\u0035\u65E5",
  35546. "\u33F9",
  35547. "\u0032\u0036\u65E5",
  35548. "\u33FA",
  35549. "\u0032\u0037\u65E5",
  35550. "\u33FB",
  35551. "\u0032\u0038\u65E5",
  35552. "\u33FC",
  35553. "\u0032\u0039\u65E5",
  35554. "\u33FD",
  35555. "\u0033\u0030\u65E5",
  35556. "\u33FE",
  35557. "\u0033\u0031\u65E5",
  35558. "\uFB00",
  35559. "\u0066\u0066",
  35560. "\uFB01",
  35561. "\u0066\u0069",
  35562. "\uFB02",
  35563. "\u0066\u006C",
  35564. "\uFB03",
  35565. "\u0066\u0066\u0069",
  35566. "\uFB04",
  35567. "\u0066\u0066\u006C",
  35568. "\uFB05",
  35569. "\u017F\u0074",
  35570. "\uFB06",
  35571. "\u0073\u0074",
  35572. "\uFB13",
  35573. "\u0574\u0576",
  35574. "\uFB14",
  35575. "\u0574\u0565",
  35576. "\uFB15",
  35577. "\u0574\u056B",
  35578. "\uFB16",
  35579. "\u057E\u0576",
  35580. "\uFB17",
  35581. "\u0574\u056D",
  35582. "\uFB4F",
  35583. "\u05D0\u05DC",
  35584. "\uFB50",
  35585. "\u0671",
  35586. "\uFB51",
  35587. "\u0671",
  35588. "\uFB52",
  35589. "\u067B",
  35590. "\uFB53",
  35591. "\u067B",
  35592. "\uFB54",
  35593. "\u067B",
  35594. "\uFB55",
  35595. "\u067B",
  35596. "\uFB56",
  35597. "\u067E",
  35598. "\uFB57",
  35599. "\u067E",
  35600. "\uFB58",
  35601. "\u067E",
  35602. "\uFB59",
  35603. "\u067E",
  35604. "\uFB5A",
  35605. "\u0680",
  35606. "\uFB5B",
  35607. "\u0680",
  35608. "\uFB5C",
  35609. "\u0680",
  35610. "\uFB5D",
  35611. "\u0680",
  35612. "\uFB5E",
  35613. "\u067A",
  35614. "\uFB5F",
  35615. "\u067A",
  35616. "\uFB60",
  35617. "\u067A",
  35618. "\uFB61",
  35619. "\u067A",
  35620. "\uFB62",
  35621. "\u067F",
  35622. "\uFB63",
  35623. "\u067F",
  35624. "\uFB64",
  35625. "\u067F",
  35626. "\uFB65",
  35627. "\u067F",
  35628. "\uFB66",
  35629. "\u0679",
  35630. "\uFB67",
  35631. "\u0679",
  35632. "\uFB68",
  35633. "\u0679",
  35634. "\uFB69",
  35635. "\u0679",
  35636. "\uFB6A",
  35637. "\u06A4",
  35638. "\uFB6B",
  35639. "\u06A4",
  35640. "\uFB6C",
  35641. "\u06A4",
  35642. "\uFB6D",
  35643. "\u06A4",
  35644. "\uFB6E",
  35645. "\u06A6",
  35646. "\uFB6F",
  35647. "\u06A6",
  35648. "\uFB70",
  35649. "\u06A6",
  35650. "\uFB71",
  35651. "\u06A6",
  35652. "\uFB72",
  35653. "\u0684",
  35654. "\uFB73",
  35655. "\u0684",
  35656. "\uFB74",
  35657. "\u0684",
  35658. "\uFB75",
  35659. "\u0684",
  35660. "\uFB76",
  35661. "\u0683",
  35662. "\uFB77",
  35663. "\u0683",
  35664. "\uFB78",
  35665. "\u0683",
  35666. "\uFB79",
  35667. "\u0683",
  35668. "\uFB7A",
  35669. "\u0686",
  35670. "\uFB7B",
  35671. "\u0686",
  35672. "\uFB7C",
  35673. "\u0686",
  35674. "\uFB7D",
  35675. "\u0686",
  35676. "\uFB7E",
  35677. "\u0687",
  35678. "\uFB7F",
  35679. "\u0687",
  35680. "\uFB80",
  35681. "\u0687",
  35682. "\uFB81",
  35683. "\u0687",
  35684. "\uFB82",
  35685. "\u068D",
  35686. "\uFB83",
  35687. "\u068D",
  35688. "\uFB84",
  35689. "\u068C",
  35690. "\uFB85",
  35691. "\u068C",
  35692. "\uFB86",
  35693. "\u068E",
  35694. "\uFB87",
  35695. "\u068E",
  35696. "\uFB88",
  35697. "\u0688",
  35698. "\uFB89",
  35699. "\u0688",
  35700. "\uFB8A",
  35701. "\u0698",
  35702. "\uFB8B",
  35703. "\u0698",
  35704. "\uFB8C",
  35705. "\u0691",
  35706. "\uFB8D",
  35707. "\u0691",
  35708. "\uFB8E",
  35709. "\u06A9",
  35710. "\uFB8F",
  35711. "\u06A9",
  35712. "\uFB90",
  35713. "\u06A9",
  35714. "\uFB91",
  35715. "\u06A9",
  35716. "\uFB92",
  35717. "\u06AF",
  35718. "\uFB93",
  35719. "\u06AF",
  35720. "\uFB94",
  35721. "\u06AF",
  35722. "\uFB95",
  35723. "\u06AF",
  35724. "\uFB96",
  35725. "\u06B3",
  35726. "\uFB97",
  35727. "\u06B3",
  35728. "\uFB98",
  35729. "\u06B3",
  35730. "\uFB99",
  35731. "\u06B3",
  35732. "\uFB9A",
  35733. "\u06B1",
  35734. "\uFB9B",
  35735. "\u06B1",
  35736. "\uFB9C",
  35737. "\u06B1",
  35738. "\uFB9D",
  35739. "\u06B1",
  35740. "\uFB9E",
  35741. "\u06BA",
  35742. "\uFB9F",
  35743. "\u06BA",
  35744. "\uFBA0",
  35745. "\u06BB",
  35746. "\uFBA1",
  35747. "\u06BB",
  35748. "\uFBA2",
  35749. "\u06BB",
  35750. "\uFBA3",
  35751. "\u06BB",
  35752. "\uFBA4",
  35753. "\u06C0",
  35754. "\uFBA5",
  35755. "\u06C0",
  35756. "\uFBA6",
  35757. "\u06C1",
  35758. "\uFBA7",
  35759. "\u06C1",
  35760. "\uFBA8",
  35761. "\u06C1",
  35762. "\uFBA9",
  35763. "\u06C1",
  35764. "\uFBAA",
  35765. "\u06BE",
  35766. "\uFBAB",
  35767. "\u06BE",
  35768. "\uFBAC",
  35769. "\u06BE",
  35770. "\uFBAD",
  35771. "\u06BE",
  35772. "\uFBAE",
  35773. "\u06D2",
  35774. "\uFBAF",
  35775. "\u06D2",
  35776. "\uFBB0",
  35777. "\u06D3",
  35778. "\uFBB1",
  35779. "\u06D3",
  35780. "\uFBD3",
  35781. "\u06AD",
  35782. "\uFBD4",
  35783. "\u06AD",
  35784. "\uFBD5",
  35785. "\u06AD",
  35786. "\uFBD6",
  35787. "\u06AD",
  35788. "\uFBD7",
  35789. "\u06C7",
  35790. "\uFBD8",
  35791. "\u06C7",
  35792. "\uFBD9",
  35793. "\u06C6",
  35794. "\uFBDA",
  35795. "\u06C6",
  35796. "\uFBDB",
  35797. "\u06C8",
  35798. "\uFBDC",
  35799. "\u06C8",
  35800. "\uFBDD",
  35801. "\u0677",
  35802. "\uFBDE",
  35803. "\u06CB",
  35804. "\uFBDF",
  35805. "\u06CB",
  35806. "\uFBE0",
  35807. "\u06C5",
  35808. "\uFBE1",
  35809. "\u06C5",
  35810. "\uFBE2",
  35811. "\u06C9",
  35812. "\uFBE3",
  35813. "\u06C9",
  35814. "\uFBE4",
  35815. "\u06D0",
  35816. "\uFBE5",
  35817. "\u06D0",
  35818. "\uFBE6",
  35819. "\u06D0",
  35820. "\uFBE7",
  35821. "\u06D0",
  35822. "\uFBE8",
  35823. "\u0649",
  35824. "\uFBE9",
  35825. "\u0649",
  35826. "\uFBEA",
  35827. "\u0626\u0627",
  35828. "\uFBEB",
  35829. "\u0626\u0627",
  35830. "\uFBEC",
  35831. "\u0626\u06D5",
  35832. "\uFBED",
  35833. "\u0626\u06D5",
  35834. "\uFBEE",
  35835. "\u0626\u0648",
  35836. "\uFBEF",
  35837. "\u0626\u0648",
  35838. "\uFBF0",
  35839. "\u0626\u06C7",
  35840. "\uFBF1",
  35841. "\u0626\u06C7",
  35842. "\uFBF2",
  35843. "\u0626\u06C6",
  35844. "\uFBF3",
  35845. "\u0626\u06C6",
  35846. "\uFBF4",
  35847. "\u0626\u06C8",
  35848. "\uFBF5",
  35849. "\u0626\u06C8",
  35850. "\uFBF6",
  35851. "\u0626\u06D0",
  35852. "\uFBF7",
  35853. "\u0626\u06D0",
  35854. "\uFBF8",
  35855. "\u0626\u06D0",
  35856. "\uFBF9",
  35857. "\u0626\u0649",
  35858. "\uFBFA",
  35859. "\u0626\u0649",
  35860. "\uFBFB",
  35861. "\u0626\u0649",
  35862. "\uFBFC",
  35863. "\u06CC",
  35864. "\uFBFD",
  35865. "\u06CC",
  35866. "\uFBFE",
  35867. "\u06CC",
  35868. "\uFBFF",
  35869. "\u06CC",
  35870. "\uFC00",
  35871. "\u0626\u062C",
  35872. "\uFC01",
  35873. "\u0626\u062D",
  35874. "\uFC02",
  35875. "\u0626\u0645",
  35876. "\uFC03",
  35877. "\u0626\u0649",
  35878. "\uFC04",
  35879. "\u0626\u064A",
  35880. "\uFC05",
  35881. "\u0628\u062C",
  35882. "\uFC06",
  35883. "\u0628\u062D",
  35884. "\uFC07",
  35885. "\u0628\u062E",
  35886. "\uFC08",
  35887. "\u0628\u0645",
  35888. "\uFC09",
  35889. "\u0628\u0649",
  35890. "\uFC0A",
  35891. "\u0628\u064A",
  35892. "\uFC0B",
  35893. "\u062A\u062C",
  35894. "\uFC0C",
  35895. "\u062A\u062D",
  35896. "\uFC0D",
  35897. "\u062A\u062E",
  35898. "\uFC0E",
  35899. "\u062A\u0645",
  35900. "\uFC0F",
  35901. "\u062A\u0649",
  35902. "\uFC10",
  35903. "\u062A\u064A",
  35904. "\uFC11",
  35905. "\u062B\u062C",
  35906. "\uFC12",
  35907. "\u062B\u0645",
  35908. "\uFC13",
  35909. "\u062B\u0649",
  35910. "\uFC14",
  35911. "\u062B\u064A",
  35912. "\uFC15",
  35913. "\u062C\u062D",
  35914. "\uFC16",
  35915. "\u062C\u0645",
  35916. "\uFC17",
  35917. "\u062D\u062C",
  35918. "\uFC18",
  35919. "\u062D\u0645",
  35920. "\uFC19",
  35921. "\u062E\u062C",
  35922. "\uFC1A",
  35923. "\u062E\u062D",
  35924. "\uFC1B",
  35925. "\u062E\u0645",
  35926. "\uFC1C",
  35927. "\u0633\u062C",
  35928. "\uFC1D",
  35929. "\u0633\u062D",
  35930. "\uFC1E",
  35931. "\u0633\u062E",
  35932. "\uFC1F",
  35933. "\u0633\u0645",
  35934. "\uFC20",
  35935. "\u0635\u062D",
  35936. "\uFC21",
  35937. "\u0635\u0645",
  35938. "\uFC22",
  35939. "\u0636\u062C",
  35940. "\uFC23",
  35941. "\u0636\u062D",
  35942. "\uFC24",
  35943. "\u0636\u062E",
  35944. "\uFC25",
  35945. "\u0636\u0645",
  35946. "\uFC26",
  35947. "\u0637\u062D",
  35948. "\uFC27",
  35949. "\u0637\u0645",
  35950. "\uFC28",
  35951. "\u0638\u0645",
  35952. "\uFC29",
  35953. "\u0639\u062C",
  35954. "\uFC2A",
  35955. "\u0639\u0645",
  35956. "\uFC2B",
  35957. "\u063A\u062C",
  35958. "\uFC2C",
  35959. "\u063A\u0645",
  35960. "\uFC2D",
  35961. "\u0641\u062C",
  35962. "\uFC2E",
  35963. "\u0641\u062D",
  35964. "\uFC2F",
  35965. "\u0641\u062E",
  35966. "\uFC30",
  35967. "\u0641\u0645",
  35968. "\uFC31",
  35969. "\u0641\u0649",
  35970. "\uFC32",
  35971. "\u0641\u064A",
  35972. "\uFC33",
  35973. "\u0642\u062D",
  35974. "\uFC34",
  35975. "\u0642\u0645",
  35976. "\uFC35",
  35977. "\u0642\u0649",
  35978. "\uFC36",
  35979. "\u0642\u064A",
  35980. "\uFC37",
  35981. "\u0643\u0627",
  35982. "\uFC38",
  35983. "\u0643\u062C",
  35984. "\uFC39",
  35985. "\u0643\u062D",
  35986. "\uFC3A",
  35987. "\u0643\u062E",
  35988. "\uFC3B",
  35989. "\u0643\u0644",
  35990. "\uFC3C",
  35991. "\u0643\u0645",
  35992. "\uFC3D",
  35993. "\u0643\u0649",
  35994. "\uFC3E",
  35995. "\u0643\u064A",
  35996. "\uFC3F",
  35997. "\u0644\u062C",
  35998. "\uFC40",
  35999. "\u0644\u062D",
  36000. "\uFC41",
  36001. "\u0644\u062E",
  36002. "\uFC42",
  36003. "\u0644\u0645",
  36004. "\uFC43",
  36005. "\u0644\u0649",
  36006. "\uFC44",
  36007. "\u0644\u064A",
  36008. "\uFC45",
  36009. "\u0645\u062C",
  36010. "\uFC46",
  36011. "\u0645\u062D",
  36012. "\uFC47",
  36013. "\u0645\u062E",
  36014. "\uFC48",
  36015. "\u0645\u0645",
  36016. "\uFC49",
  36017. "\u0645\u0649",
  36018. "\uFC4A",
  36019. "\u0645\u064A",
  36020. "\uFC4B",
  36021. "\u0646\u062C",
  36022. "\uFC4C",
  36023. "\u0646\u062D",
  36024. "\uFC4D",
  36025. "\u0646\u062E",
  36026. "\uFC4E",
  36027. "\u0646\u0645",
  36028. "\uFC4F",
  36029. "\u0646\u0649",
  36030. "\uFC50",
  36031. "\u0646\u064A",
  36032. "\uFC51",
  36033. "\u0647\u062C",
  36034. "\uFC52",
  36035. "\u0647\u0645",
  36036. "\uFC53",
  36037. "\u0647\u0649",
  36038. "\uFC54",
  36039. "\u0647\u064A",
  36040. "\uFC55",
  36041. "\u064A\u062C",
  36042. "\uFC56",
  36043. "\u064A\u062D",
  36044. "\uFC57",
  36045. "\u064A\u062E",
  36046. "\uFC58",
  36047. "\u064A\u0645",
  36048. "\uFC59",
  36049. "\u064A\u0649",
  36050. "\uFC5A",
  36051. "\u064A\u064A",
  36052. "\uFC5B",
  36053. "\u0630\u0670",
  36054. "\uFC5C",
  36055. "\u0631\u0670",
  36056. "\uFC5D",
  36057. "\u0649\u0670",
  36058. "\uFC5E",
  36059. "\u0020\u064C\u0651",
  36060. "\uFC5F",
  36061. "\u0020\u064D\u0651",
  36062. "\uFC60",
  36063. "\u0020\u064E\u0651",
  36064. "\uFC61",
  36065. "\u0020\u064F\u0651",
  36066. "\uFC62",
  36067. "\u0020\u0650\u0651",
  36068. "\uFC63",
  36069. "\u0020\u0651\u0670",
  36070. "\uFC64",
  36071. "\u0626\u0631",
  36072. "\uFC65",
  36073. "\u0626\u0632",
  36074. "\uFC66",
  36075. "\u0626\u0645",
  36076. "\uFC67",
  36077. "\u0626\u0646",
  36078. "\uFC68",
  36079. "\u0626\u0649",
  36080. "\uFC69",
  36081. "\u0626\u064A",
  36082. "\uFC6A",
  36083. "\u0628\u0631",
  36084. "\uFC6B",
  36085. "\u0628\u0632",
  36086. "\uFC6C",
  36087. "\u0628\u0645",
  36088. "\uFC6D",
  36089. "\u0628\u0646",
  36090. "\uFC6E",
  36091. "\u0628\u0649",
  36092. "\uFC6F",
  36093. "\u0628\u064A",
  36094. "\uFC70",
  36095. "\u062A\u0631",
  36096. "\uFC71",
  36097. "\u062A\u0632",
  36098. "\uFC72",
  36099. "\u062A\u0645",
  36100. "\uFC73",
  36101. "\u062A\u0646",
  36102. "\uFC74",
  36103. "\u062A\u0649",
  36104. "\uFC75",
  36105. "\u062A\u064A",
  36106. "\uFC76",
  36107. "\u062B\u0631",
  36108. "\uFC77",
  36109. "\u062B\u0632",
  36110. "\uFC78",
  36111. "\u062B\u0645",
  36112. "\uFC79",
  36113. "\u062B\u0646",
  36114. "\uFC7A",
  36115. "\u062B\u0649",
  36116. "\uFC7B",
  36117. "\u062B\u064A",
  36118. "\uFC7C",
  36119. "\u0641\u0649",
  36120. "\uFC7D",
  36121. "\u0641\u064A",
  36122. "\uFC7E",
  36123. "\u0642\u0649",
  36124. "\uFC7F",
  36125. "\u0642\u064A",
  36126. "\uFC80",
  36127. "\u0643\u0627",
  36128. "\uFC81",
  36129. "\u0643\u0644",
  36130. "\uFC82",
  36131. "\u0643\u0645",
  36132. "\uFC83",
  36133. "\u0643\u0649",
  36134. "\uFC84",
  36135. "\u0643\u064A",
  36136. "\uFC85",
  36137. "\u0644\u0645",
  36138. "\uFC86",
  36139. "\u0644\u0649",
  36140. "\uFC87",
  36141. "\u0644\u064A",
  36142. "\uFC88",
  36143. "\u0645\u0627",
  36144. "\uFC89",
  36145. "\u0645\u0645",
  36146. "\uFC8A",
  36147. "\u0646\u0631",
  36148. "\uFC8B",
  36149. "\u0646\u0632",
  36150. "\uFC8C",
  36151. "\u0646\u0645",
  36152. "\uFC8D",
  36153. "\u0646\u0646",
  36154. "\uFC8E",
  36155. "\u0646\u0649",
  36156. "\uFC8F",
  36157. "\u0646\u064A",
  36158. "\uFC90",
  36159. "\u0649\u0670",
  36160. "\uFC91",
  36161. "\u064A\u0631",
  36162. "\uFC92",
  36163. "\u064A\u0632",
  36164. "\uFC93",
  36165. "\u064A\u0645",
  36166. "\uFC94",
  36167. "\u064A\u0646",
  36168. "\uFC95",
  36169. "\u064A\u0649",
  36170. "\uFC96",
  36171. "\u064A\u064A",
  36172. "\uFC97",
  36173. "\u0626\u062C",
  36174. "\uFC98",
  36175. "\u0626\u062D",
  36176. "\uFC99",
  36177. "\u0626\u062E",
  36178. "\uFC9A",
  36179. "\u0626\u0645",
  36180. "\uFC9B",
  36181. "\u0626\u0647",
  36182. "\uFC9C",
  36183. "\u0628\u062C",
  36184. "\uFC9D",
  36185. "\u0628\u062D",
  36186. "\uFC9E",
  36187. "\u0628\u062E",
  36188. "\uFC9F",
  36189. "\u0628\u0645",
  36190. "\uFCA0",
  36191. "\u0628\u0647",
  36192. "\uFCA1",
  36193. "\u062A\u062C",
  36194. "\uFCA2",
  36195. "\u062A\u062D",
  36196. "\uFCA3",
  36197. "\u062A\u062E",
  36198. "\uFCA4",
  36199. "\u062A\u0645",
  36200. "\uFCA5",
  36201. "\u062A\u0647",
  36202. "\uFCA6",
  36203. "\u062B\u0645",
  36204. "\uFCA7",
  36205. "\u062C\u062D",
  36206. "\uFCA8",
  36207. "\u062C\u0645",
  36208. "\uFCA9",
  36209. "\u062D\u062C",
  36210. "\uFCAA",
  36211. "\u062D\u0645",
  36212. "\uFCAB",
  36213. "\u062E\u062C",
  36214. "\uFCAC",
  36215. "\u062E\u0645",
  36216. "\uFCAD",
  36217. "\u0633\u062C",
  36218. "\uFCAE",
  36219. "\u0633\u062D",
  36220. "\uFCAF",
  36221. "\u0633\u062E",
  36222. "\uFCB0",
  36223. "\u0633\u0645",
  36224. "\uFCB1",
  36225. "\u0635\u062D",
  36226. "\uFCB2",
  36227. "\u0635\u062E",
  36228. "\uFCB3",
  36229. "\u0635\u0645",
  36230. "\uFCB4",
  36231. "\u0636\u062C",
  36232. "\uFCB5",
  36233. "\u0636\u062D",
  36234. "\uFCB6",
  36235. "\u0636\u062E",
  36236. "\uFCB7",
  36237. "\u0636\u0645",
  36238. "\uFCB8",
  36239. "\u0637\u062D",
  36240. "\uFCB9",
  36241. "\u0638\u0645",
  36242. "\uFCBA",
  36243. "\u0639\u062C",
  36244. "\uFCBB",
  36245. "\u0639\u0645",
  36246. "\uFCBC",
  36247. "\u063A\u062C",
  36248. "\uFCBD",
  36249. "\u063A\u0645",
  36250. "\uFCBE",
  36251. "\u0641\u062C",
  36252. "\uFCBF",
  36253. "\u0641\u062D",
  36254. "\uFCC0",
  36255. "\u0641\u062E",
  36256. "\uFCC1",
  36257. "\u0641\u0645",
  36258. "\uFCC2",
  36259. "\u0642\u062D",
  36260. "\uFCC3",
  36261. "\u0642\u0645",
  36262. "\uFCC4",
  36263. "\u0643\u062C",
  36264. "\uFCC5",
  36265. "\u0643\u062D",
  36266. "\uFCC6",
  36267. "\u0643\u062E",
  36268. "\uFCC7",
  36269. "\u0643\u0644",
  36270. "\uFCC8",
  36271. "\u0643\u0645",
  36272. "\uFCC9",
  36273. "\u0644\u062C",
  36274. "\uFCCA",
  36275. "\u0644\u062D",
  36276. "\uFCCB",
  36277. "\u0644\u062E",
  36278. "\uFCCC",
  36279. "\u0644\u0645",
  36280. "\uFCCD",
  36281. "\u0644\u0647",
  36282. "\uFCCE",
  36283. "\u0645\u062C",
  36284. "\uFCCF",
  36285. "\u0645\u062D",
  36286. "\uFCD0",
  36287. "\u0645\u062E",
  36288. "\uFCD1",
  36289. "\u0645\u0645",
  36290. "\uFCD2",
  36291. "\u0646\u062C",
  36292. "\uFCD3",
  36293. "\u0646\u062D",
  36294. "\uFCD4",
  36295. "\u0646\u062E",
  36296. "\uFCD5",
  36297. "\u0646\u0645",
  36298. "\uFCD6",
  36299. "\u0646\u0647",
  36300. "\uFCD7",
  36301. "\u0647\u062C",
  36302. "\uFCD8",
  36303. "\u0647\u0645",
  36304. "\uFCD9",
  36305. "\u0647\u0670",
  36306. "\uFCDA",
  36307. "\u064A\u062C",
  36308. "\uFCDB",
  36309. "\u064A\u062D",
  36310. "\uFCDC",
  36311. "\u064A\u062E",
  36312. "\uFCDD",
  36313. "\u064A\u0645",
  36314. "\uFCDE",
  36315. "\u064A\u0647",
  36316. "\uFCDF",
  36317. "\u0626\u0645",
  36318. "\uFCE0",
  36319. "\u0626\u0647",
  36320. "\uFCE1",
  36321. "\u0628\u0645",
  36322. "\uFCE2",
  36323. "\u0628\u0647",
  36324. "\uFCE3",
  36325. "\u062A\u0645",
  36326. "\uFCE4",
  36327. "\u062A\u0647",
  36328. "\uFCE5",
  36329. "\u062B\u0645",
  36330. "\uFCE6",
  36331. "\u062B\u0647",
  36332. "\uFCE7",
  36333. "\u0633\u0645",
  36334. "\uFCE8",
  36335. "\u0633\u0647",
  36336. "\uFCE9",
  36337. "\u0634\u0645",
  36338. "\uFCEA",
  36339. "\u0634\u0647",
  36340. "\uFCEB",
  36341. "\u0643\u0644",
  36342. "\uFCEC",
  36343. "\u0643\u0645",
  36344. "\uFCED",
  36345. "\u0644\u0645",
  36346. "\uFCEE",
  36347. "\u0646\u0645",
  36348. "\uFCEF",
  36349. "\u0646\u0647",
  36350. "\uFCF0",
  36351. "\u064A\u0645",
  36352. "\uFCF1",
  36353. "\u064A\u0647",
  36354. "\uFCF2",
  36355. "\u0640\u064E\u0651",
  36356. "\uFCF3",
  36357. "\u0640\u064F\u0651",
  36358. "\uFCF4",
  36359. "\u0640\u0650\u0651",
  36360. "\uFCF5",
  36361. "\u0637\u0649",
  36362. "\uFCF6",
  36363. "\u0637\u064A",
  36364. "\uFCF7",
  36365. "\u0639\u0649",
  36366. "\uFCF8",
  36367. "\u0639\u064A",
  36368. "\uFCF9",
  36369. "\u063A\u0649",
  36370. "\uFCFA",
  36371. "\u063A\u064A",
  36372. "\uFCFB",
  36373. "\u0633\u0649",
  36374. "\uFCFC",
  36375. "\u0633\u064A",
  36376. "\uFCFD",
  36377. "\u0634\u0649",
  36378. "\uFCFE",
  36379. "\u0634\u064A",
  36380. "\uFCFF",
  36381. "\u062D\u0649",
  36382. "\uFD00",
  36383. "\u062D\u064A",
  36384. "\uFD01",
  36385. "\u062C\u0649",
  36386. "\uFD02",
  36387. "\u062C\u064A",
  36388. "\uFD03",
  36389. "\u062E\u0649",
  36390. "\uFD04",
  36391. "\u062E\u064A",
  36392. "\uFD05",
  36393. "\u0635\u0649",
  36394. "\uFD06",
  36395. "\u0635\u064A",
  36396. "\uFD07",
  36397. "\u0636\u0649",
  36398. "\uFD08",
  36399. "\u0636\u064A",
  36400. "\uFD09",
  36401. "\u0634\u062C",
  36402. "\uFD0A",
  36403. "\u0634\u062D",
  36404. "\uFD0B",
  36405. "\u0634\u062E",
  36406. "\uFD0C",
  36407. "\u0634\u0645",
  36408. "\uFD0D",
  36409. "\u0634\u0631",
  36410. "\uFD0E",
  36411. "\u0633\u0631",
  36412. "\uFD0F",
  36413. "\u0635\u0631",
  36414. "\uFD10",
  36415. "\u0636\u0631",
  36416. "\uFD11",
  36417. "\u0637\u0649",
  36418. "\uFD12",
  36419. "\u0637\u064A",
  36420. "\uFD13",
  36421. "\u0639\u0649",
  36422. "\uFD14",
  36423. "\u0639\u064A",
  36424. "\uFD15",
  36425. "\u063A\u0649",
  36426. "\uFD16",
  36427. "\u063A\u064A",
  36428. "\uFD17",
  36429. "\u0633\u0649",
  36430. "\uFD18",
  36431. "\u0633\u064A",
  36432. "\uFD19",
  36433. "\u0634\u0649",
  36434. "\uFD1A",
  36435. "\u0634\u064A",
  36436. "\uFD1B",
  36437. "\u062D\u0649",
  36438. "\uFD1C",
  36439. "\u062D\u064A",
  36440. "\uFD1D",
  36441. "\u062C\u0649",
  36442. "\uFD1E",
  36443. "\u062C\u064A",
  36444. "\uFD1F",
  36445. "\u062E\u0649",
  36446. "\uFD20",
  36447. "\u062E\u064A",
  36448. "\uFD21",
  36449. "\u0635\u0649",
  36450. "\uFD22",
  36451. "\u0635\u064A",
  36452. "\uFD23",
  36453. "\u0636\u0649",
  36454. "\uFD24",
  36455. "\u0636\u064A",
  36456. "\uFD25",
  36457. "\u0634\u062C",
  36458. "\uFD26",
  36459. "\u0634\u062D",
  36460. "\uFD27",
  36461. "\u0634\u062E",
  36462. "\uFD28",
  36463. "\u0634\u0645",
  36464. "\uFD29",
  36465. "\u0634\u0631",
  36466. "\uFD2A",
  36467. "\u0633\u0631",
  36468. "\uFD2B",
  36469. "\u0635\u0631",
  36470. "\uFD2C",
  36471. "\u0636\u0631",
  36472. "\uFD2D",
  36473. "\u0634\u062C",
  36474. "\uFD2E",
  36475. "\u0634\u062D",
  36476. "\uFD2F",
  36477. "\u0634\u062E",
  36478. "\uFD30",
  36479. "\u0634\u0645",
  36480. "\uFD31",
  36481. "\u0633\u0647",
  36482. "\uFD32",
  36483. "\u0634\u0647",
  36484. "\uFD33",
  36485. "\u0637\u0645",
  36486. "\uFD34",
  36487. "\u0633\u062C",
  36488. "\uFD35",
  36489. "\u0633\u062D",
  36490. "\uFD36",
  36491. "\u0633\u062E",
  36492. "\uFD37",
  36493. "\u0634\u062C",
  36494. "\uFD38",
  36495. "\u0634\u062D",
  36496. "\uFD39",
  36497. "\u0634\u062E",
  36498. "\uFD3A",
  36499. "\u0637\u0645",
  36500. "\uFD3B",
  36501. "\u0638\u0645",
  36502. "\uFD3C",
  36503. "\u0627\u064B",
  36504. "\uFD3D",
  36505. "\u0627\u064B",
  36506. "\uFD50",
  36507. "\u062A\u062C\u0645",
  36508. "\uFD51",
  36509. "\u062A\u062D\u062C",
  36510. "\uFD52",
  36511. "\u062A\u062D\u062C",
  36512. "\uFD53",
  36513. "\u062A\u062D\u0645",
  36514. "\uFD54",
  36515. "\u062A\u062E\u0645",
  36516. "\uFD55",
  36517. "\u062A\u0645\u062C",
  36518. "\uFD56",
  36519. "\u062A\u0645\u062D",
  36520. "\uFD57",
  36521. "\u062A\u0645\u062E",
  36522. "\uFD58",
  36523. "\u062C\u0645\u062D",
  36524. "\uFD59",
  36525. "\u062C\u0645\u062D",
  36526. "\uFD5A",
  36527. "\u062D\u0645\u064A",
  36528. "\uFD5B",
  36529. "\u062D\u0645\u0649",
  36530. "\uFD5C",
  36531. "\u0633\u062D\u062C",
  36532. "\uFD5D",
  36533. "\u0633\u062C\u062D",
  36534. "\uFD5E",
  36535. "\u0633\u062C\u0649",
  36536. "\uFD5F",
  36537. "\u0633\u0645\u062D",
  36538. "\uFD60",
  36539. "\u0633\u0645\u062D",
  36540. "\uFD61",
  36541. "\u0633\u0645\u062C",
  36542. "\uFD62",
  36543. "\u0633\u0645\u0645",
  36544. "\uFD63",
  36545. "\u0633\u0645\u0645",
  36546. "\uFD64",
  36547. "\u0635\u062D\u062D",
  36548. "\uFD65",
  36549. "\u0635\u062D\u062D",
  36550. "\uFD66",
  36551. "\u0635\u0645\u0645",
  36552. "\uFD67",
  36553. "\u0634\u062D\u0645",
  36554. "\uFD68",
  36555. "\u0634\u062D\u0645",
  36556. "\uFD69",
  36557. "\u0634\u062C\u064A",
  36558. "\uFD6A",
  36559. "\u0634\u0645\u062E",
  36560. "\uFD6B",
  36561. "\u0634\u0645\u062E",
  36562. "\uFD6C",
  36563. "\u0634\u0645\u0645",
  36564. "\uFD6D",
  36565. "\u0634\u0645\u0645",
  36566. "\uFD6E",
  36567. "\u0636\u062D\u0649",
  36568. "\uFD6F",
  36569. "\u0636\u062E\u0645",
  36570. "\uFD70",
  36571. "\u0636\u062E\u0645",
  36572. "\uFD71",
  36573. "\u0637\u0645\u062D",
  36574. "\uFD72",
  36575. "\u0637\u0645\u062D",
  36576. "\uFD73",
  36577. "\u0637\u0645\u0645",
  36578. "\uFD74",
  36579. "\u0637\u0645\u064A",
  36580. "\uFD75",
  36581. "\u0639\u062C\u0645",
  36582. "\uFD76",
  36583. "\u0639\u0645\u0645",
  36584. "\uFD77",
  36585. "\u0639\u0645\u0645",
  36586. "\uFD78",
  36587. "\u0639\u0645\u0649",
  36588. "\uFD79",
  36589. "\u063A\u0645\u0645",
  36590. "\uFD7A",
  36591. "\u063A\u0645\u064A",
  36592. "\uFD7B",
  36593. "\u063A\u0645\u0649",
  36594. "\uFD7C",
  36595. "\u0641\u062E\u0645",
  36596. "\uFD7D",
  36597. "\u0641\u062E\u0645",
  36598. "\uFD7E",
  36599. "\u0642\u0645\u062D",
  36600. "\uFD7F",
  36601. "\u0642\u0645\u0645",
  36602. "\uFD80",
  36603. "\u0644\u062D\u0645",
  36604. "\uFD81",
  36605. "\u0644\u062D\u064A",
  36606. "\uFD82",
  36607. "\u0644\u062D\u0649",
  36608. "\uFD83",
  36609. "\u0644\u062C\u062C",
  36610. "\uFD84",
  36611. "\u0644\u062C\u062C",
  36612. "\uFD85",
  36613. "\u0644\u062E\u0645",
  36614. "\uFD86",
  36615. "\u0644\u062E\u0645",
  36616. "\uFD87",
  36617. "\u0644\u0645\u062D",
  36618. "\uFD88",
  36619. "\u0644\u0645\u062D",
  36620. "\uFD89",
  36621. "\u0645\u062D\u062C",
  36622. "\uFD8A",
  36623. "\u0645\u062D\u0645",
  36624. "\uFD8B",
  36625. "\u0645\u062D\u064A",
  36626. "\uFD8C",
  36627. "\u0645\u062C\u062D",
  36628. "\uFD8D",
  36629. "\u0645\u062C\u0645",
  36630. "\uFD8E",
  36631. "\u0645\u062E\u062C",
  36632. "\uFD8F",
  36633. "\u0645\u062E\u0645",
  36634. "\uFD92",
  36635. "\u0645\u062C\u062E",
  36636. "\uFD93",
  36637. "\u0647\u0645\u062C",
  36638. "\uFD94",
  36639. "\u0647\u0645\u0645",
  36640. "\uFD95",
  36641. "\u0646\u062D\u0645",
  36642. "\uFD96",
  36643. "\u0646\u062D\u0649",
  36644. "\uFD97",
  36645. "\u0646\u062C\u0645",
  36646. "\uFD98",
  36647. "\u0646\u062C\u0645",
  36648. "\uFD99",
  36649. "\u0646\u062C\u0649",
  36650. "\uFD9A",
  36651. "\u0646\u0645\u064A",
  36652. "\uFD9B",
  36653. "\u0646\u0645\u0649",
  36654. "\uFD9C",
  36655. "\u064A\u0645\u0645",
  36656. "\uFD9D",
  36657. "\u064A\u0645\u0645",
  36658. "\uFD9E",
  36659. "\u0628\u062E\u064A",
  36660. "\uFD9F",
  36661. "\u062A\u062C\u064A",
  36662. "\uFDA0",
  36663. "\u062A\u062C\u0649",
  36664. "\uFDA1",
  36665. "\u062A\u062E\u064A",
  36666. "\uFDA2",
  36667. "\u062A\u062E\u0649",
  36668. "\uFDA3",
  36669. "\u062A\u0645\u064A",
  36670. "\uFDA4",
  36671. "\u062A\u0645\u0649",
  36672. "\uFDA5",
  36673. "\u062C\u0645\u064A",
  36674. "\uFDA6",
  36675. "\u062C\u062D\u0649",
  36676. "\uFDA7",
  36677. "\u062C\u0645\u0649",
  36678. "\uFDA8",
  36679. "\u0633\u062E\u0649",
  36680. "\uFDA9",
  36681. "\u0635\u062D\u064A",
  36682. "\uFDAA",
  36683. "\u0634\u062D\u064A",
  36684. "\uFDAB",
  36685. "\u0636\u062D\u064A",
  36686. "\uFDAC",
  36687. "\u0644\u062C\u064A",
  36688. "\uFDAD",
  36689. "\u0644\u0645\u064A",
  36690. "\uFDAE",
  36691. "\u064A\u062D\u064A",
  36692. "\uFDAF",
  36693. "\u064A\u062C\u064A",
  36694. "\uFDB0",
  36695. "\u064A\u0645\u064A",
  36696. "\uFDB1",
  36697. "\u0645\u0645\u064A",
  36698. "\uFDB2",
  36699. "\u0642\u0645\u064A",
  36700. "\uFDB3",
  36701. "\u0646\u062D\u064A",
  36702. "\uFDB4",
  36703. "\u0642\u0645\u062D",
  36704. "\uFDB5",
  36705. "\u0644\u062D\u0645",
  36706. "\uFDB6",
  36707. "\u0639\u0645\u064A",
  36708. "\uFDB7",
  36709. "\u0643\u0645\u064A",
  36710. "\uFDB8",
  36711. "\u0646\u062C\u062D",
  36712. "\uFDB9",
  36713. "\u0645\u062E\u064A",
  36714. "\uFDBA",
  36715. "\u0644\u062C\u0645",
  36716. "\uFDBB",
  36717. "\u0643\u0645\u0645",
  36718. "\uFDBC",
  36719. "\u0644\u062C\u0645",
  36720. "\uFDBD",
  36721. "\u0646\u062C\u062D",
  36722. "\uFDBE",
  36723. "\u062C\u062D\u064A",
  36724. "\uFDBF",
  36725. "\u062D\u062C\u064A",
  36726. "\uFDC0",
  36727. "\u0645\u062C\u064A",
  36728. "\uFDC1",
  36729. "\u0641\u0645\u064A",
  36730. "\uFDC2",
  36731. "\u0628\u062D\u064A",
  36732. "\uFDC3",
  36733. "\u0643\u0645\u0645",
  36734. "\uFDC4",
  36735. "\u0639\u062C\u0645",
  36736. "\uFDC5",
  36737. "\u0635\u0645\u0645",
  36738. "\uFDC6",
  36739. "\u0633\u062E\u064A",
  36740. "\uFDC7",
  36741. "\u0646\u062C\u064A",
  36742. "\uFE49",
  36743. "\u203E",
  36744. "\uFE4A",
  36745. "\u203E",
  36746. "\uFE4B",
  36747. "\u203E",
  36748. "\uFE4C",
  36749. "\u203E",
  36750. "\uFE4D",
  36751. "\u005F",
  36752. "\uFE4E",
  36753. "\u005F",
  36754. "\uFE4F",
  36755. "\u005F",
  36756. "\uFE80",
  36757. "\u0621",
  36758. "\uFE81",
  36759. "\u0622",
  36760. "\uFE82",
  36761. "\u0622",
  36762. "\uFE83",
  36763. "\u0623",
  36764. "\uFE84",
  36765. "\u0623",
  36766. "\uFE85",
  36767. "\u0624",
  36768. "\uFE86",
  36769. "\u0624",
  36770. "\uFE87",
  36771. "\u0625",
  36772. "\uFE88",
  36773. "\u0625",
  36774. "\uFE89",
  36775. "\u0626",
  36776. "\uFE8A",
  36777. "\u0626",
  36778. "\uFE8B",
  36779. "\u0626",
  36780. "\uFE8C",
  36781. "\u0626",
  36782. "\uFE8D",
  36783. "\u0627",
  36784. "\uFE8E",
  36785. "\u0627",
  36786. "\uFE8F",
  36787. "\u0628",
  36788. "\uFE90",
  36789. "\u0628",
  36790. "\uFE91",
  36791. "\u0628",
  36792. "\uFE92",
  36793. "\u0628",
  36794. "\uFE93",
  36795. "\u0629",
  36796. "\uFE94",
  36797. "\u0629",
  36798. "\uFE95",
  36799. "\u062A",
  36800. "\uFE96",
  36801. "\u062A",
  36802. "\uFE97",
  36803. "\u062A",
  36804. "\uFE98",
  36805. "\u062A",
  36806. "\uFE99",
  36807. "\u062B",
  36808. "\uFE9A",
  36809. "\u062B",
  36810. "\uFE9B",
  36811. "\u062B",
  36812. "\uFE9C",
  36813. "\u062B",
  36814. "\uFE9D",
  36815. "\u062C",
  36816. "\uFE9E",
  36817. "\u062C",
  36818. "\uFE9F",
  36819. "\u062C",
  36820. "\uFEA0",
  36821. "\u062C",
  36822. "\uFEA1",
  36823. "\u062D",
  36824. "\uFEA2",
  36825. "\u062D",
  36826. "\uFEA3",
  36827. "\u062D",
  36828. "\uFEA4",
  36829. "\u062D",
  36830. "\uFEA5",
  36831. "\u062E",
  36832. "\uFEA6",
  36833. "\u062E",
  36834. "\uFEA7",
  36835. "\u062E",
  36836. "\uFEA8",
  36837. "\u062E",
  36838. "\uFEA9",
  36839. "\u062F",
  36840. "\uFEAA",
  36841. "\u062F",
  36842. "\uFEAB",
  36843. "\u0630",
  36844. "\uFEAC",
  36845. "\u0630",
  36846. "\uFEAD",
  36847. "\u0631",
  36848. "\uFEAE",
  36849. "\u0631",
  36850. "\uFEAF",
  36851. "\u0632",
  36852. "\uFEB0",
  36853. "\u0632",
  36854. "\uFEB1",
  36855. "\u0633",
  36856. "\uFEB2",
  36857. "\u0633",
  36858. "\uFEB3",
  36859. "\u0633",
  36860. "\uFEB4",
  36861. "\u0633",
  36862. "\uFEB5",
  36863. "\u0634",
  36864. "\uFEB6",
  36865. "\u0634",
  36866. "\uFEB7",
  36867. "\u0634",
  36868. "\uFEB8",
  36869. "\u0634",
  36870. "\uFEB9",
  36871. "\u0635",
  36872. "\uFEBA",
  36873. "\u0635",
  36874. "\uFEBB",
  36875. "\u0635",
  36876. "\uFEBC",
  36877. "\u0635",
  36878. "\uFEBD",
  36879. "\u0636",
  36880. "\uFEBE",
  36881. "\u0636",
  36882. "\uFEBF",
  36883. "\u0636",
  36884. "\uFEC0",
  36885. "\u0636",
  36886. "\uFEC1",
  36887. "\u0637",
  36888. "\uFEC2",
  36889. "\u0637",
  36890. "\uFEC3",
  36891. "\u0637",
  36892. "\uFEC4",
  36893. "\u0637",
  36894. "\uFEC5",
  36895. "\u0638",
  36896. "\uFEC6",
  36897. "\u0638",
  36898. "\uFEC7",
  36899. "\u0638",
  36900. "\uFEC8",
  36901. "\u0638",
  36902. "\uFEC9",
  36903. "\u0639",
  36904. "\uFECA",
  36905. "\u0639",
  36906. "\uFECB",
  36907. "\u0639",
  36908. "\uFECC",
  36909. "\u0639",
  36910. "\uFECD",
  36911. "\u063A",
  36912. "\uFECE",
  36913. "\u063A",
  36914. "\uFECF",
  36915. "\u063A",
  36916. "\uFED0",
  36917. "\u063A",
  36918. "\uFED1",
  36919. "\u0641",
  36920. "\uFED2",
  36921. "\u0641",
  36922. "\uFED3",
  36923. "\u0641",
  36924. "\uFED4",
  36925. "\u0641",
  36926. "\uFED5",
  36927. "\u0642",
  36928. "\uFED6",
  36929. "\u0642",
  36930. "\uFED7",
  36931. "\u0642",
  36932. "\uFED8",
  36933. "\u0642",
  36934. "\uFED9",
  36935. "\u0643",
  36936. "\uFEDA",
  36937. "\u0643",
  36938. "\uFEDB",
  36939. "\u0643",
  36940. "\uFEDC",
  36941. "\u0643",
  36942. "\uFEDD",
  36943. "\u0644",
  36944. "\uFEDE",
  36945. "\u0644",
  36946. "\uFEDF",
  36947. "\u0644",
  36948. "\uFEE0",
  36949. "\u0644",
  36950. "\uFEE1",
  36951. "\u0645",
  36952. "\uFEE2",
  36953. "\u0645",
  36954. "\uFEE3",
  36955. "\u0645",
  36956. "\uFEE4",
  36957. "\u0645",
  36958. "\uFEE5",
  36959. "\u0646",
  36960. "\uFEE6",
  36961. "\u0646",
  36962. "\uFEE7",
  36963. "\u0646",
  36964. "\uFEE8",
  36965. "\u0646",
  36966. "\uFEE9",
  36967. "\u0647",
  36968. "\uFEEA",
  36969. "\u0647",
  36970. "\uFEEB",
  36971. "\u0647",
  36972. "\uFEEC",
  36973. "\u0647",
  36974. "\uFEED",
  36975. "\u0648",
  36976. "\uFEEE",
  36977. "\u0648",
  36978. "\uFEEF",
  36979. "\u0649",
  36980. "\uFEF0",
  36981. "\u0649",
  36982. "\uFEF1",
  36983. "\u064A",
  36984. "\uFEF2",
  36985. "\u064A",
  36986. "\uFEF3",
  36987. "\u064A",
  36988. "\uFEF4",
  36989. "\u064A",
  36990. "\uFEF5",
  36991. "\u0644\u0622",
  36992. "\uFEF6",
  36993. "\u0644\u0622",
  36994. "\uFEF7",
  36995. "\u0644\u0623",
  36996. "\uFEF8",
  36997. "\u0644\u0623",
  36998. "\uFEF9",
  36999. "\u0644\u0625",
  37000. "\uFEFA",
  37001. "\u0644\u0625",
  37002. "\uFEFB",
  37003. "\u0644\u0627",
  37004. "\uFEFC",
  37005. "\u0644\u0627"
  37006. ];
  37007. });
  37008. function reverseIfRtl(chars) {
  37009. const charsLength = chars.length;
  37010. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  37011. return chars;
  37012. }
  37013. const buf = [];
  37014. for (let ii = charsLength - 1; ii >= 0; ii--) {
  37015. buf.push(chars[ii]);
  37016. }
  37017. return buf.join("");
  37018. }
  37019. const SpecialCharRegExp = new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$", "u");
  37020. const CategoryCache = new Map();
  37021. function getCharUnicodeCategory(char) {
  37022. const cachedCategory = CategoryCache.get(char);
  37023. if (cachedCategory) {
  37024. return cachedCategory;
  37025. }
  37026. const groups = char.match(SpecialCharRegExp);
  37027. const category = {
  37028. isWhitespace: !!(groups && groups[1]),
  37029. isZeroWidthDiacritic: !!(groups && groups[2]),
  37030. isInvisibleFormatMark: !!(groups && groups[3])
  37031. };
  37032. CategoryCache.set(char, category);
  37033. return category;
  37034. }
  37035. function clearUnicodeCaches() {
  37036. CategoryCache.clear();
  37037. }
  37038. /***/ }),
  37039. /* 39 */
  37040. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37041. Object.defineProperty(exports, "__esModule", ({
  37042. value: true
  37043. }));
  37044. exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = exports.getFontNameToFileMap = void 0;
  37045. exports.getStandardFontName = getStandardFontName;
  37046. exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = void 0;
  37047. var _core_utils = __w_pdfjs_require__(4);
  37048. var _fonts_utils = __w_pdfjs_require__(36);
  37049. const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  37050. t["Times-Roman"] = "Times-Roman";
  37051. t.Helvetica = "Helvetica";
  37052. t.Courier = "Courier";
  37053. t.Symbol = "Symbol";
  37054. t["Times-Bold"] = "Times-Bold";
  37055. t["Helvetica-Bold"] = "Helvetica-Bold";
  37056. t["Courier-Bold"] = "Courier-Bold";
  37057. t.ZapfDingbats = "ZapfDingbats";
  37058. t["Times-Italic"] = "Times-Italic";
  37059. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  37060. t["Courier-Oblique"] = "Courier-Oblique";
  37061. t["Times-BoldItalic"] = "Times-BoldItalic";
  37062. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  37063. t["Courier-BoldOblique"] = "Courier-BoldOblique";
  37064. t.ArialNarrow = "Helvetica";
  37065. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  37066. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  37067. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  37068. t.ArialBlack = "Helvetica";
  37069. t["ArialBlack-Bold"] = "Helvetica-Bold";
  37070. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  37071. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  37072. t["Arial-Black"] = "Helvetica";
  37073. t["Arial-Black-Bold"] = "Helvetica-Bold";
  37074. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  37075. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  37076. t.Arial = "Helvetica";
  37077. t["Arial-Bold"] = "Helvetica-Bold";
  37078. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  37079. t["Arial-Italic"] = "Helvetica-Oblique";
  37080. t.ArialMT = "Helvetica";
  37081. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  37082. t["Arial-BoldMT"] = "Helvetica-Bold";
  37083. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  37084. t.ArialUnicodeMS = "Helvetica";
  37085. t["ArialUnicodeMS-Bold"] = "Helvetica-Bold";
  37086. t["ArialUnicodeMS-BoldItalic"] = "Helvetica-BoldOblique";
  37087. t["ArialUnicodeMS-Italic"] = "Helvetica-Oblique";
  37088. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  37089. t["Courier-Italic"] = "Courier-Oblique";
  37090. t.CourierNew = "Courier";
  37091. t["CourierNew-Bold"] = "Courier-Bold";
  37092. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  37093. t["CourierNew-Italic"] = "Courier-Oblique";
  37094. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  37095. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  37096. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  37097. t.CourierNewPSMT = "Courier";
  37098. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  37099. t["Helvetica-Italic"] = "Helvetica-Oblique";
  37100. t["Symbol-Bold"] = "Symbol";
  37101. t["Symbol-BoldItalic"] = "Symbol";
  37102. t["Symbol-Italic"] = "Symbol";
  37103. t.TimesNewRoman = "Times-Roman";
  37104. t["TimesNewRoman-Bold"] = "Times-Bold";
  37105. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  37106. t["TimesNewRoman-Italic"] = "Times-Italic";
  37107. t.TimesNewRomanPS = "Times-Roman";
  37108. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  37109. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  37110. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  37111. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  37112. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  37113. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  37114. t.TimesNewRomanPSMT = "Times-Roman";
  37115. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  37116. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  37117. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  37118. });
  37119. exports.getStdFontMap = getStdFontMap;
  37120. const getFontNameToFileMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  37121. t.Courier = "FoxitFixed.pfb";
  37122. t["Courier-Bold"] = "FoxitFixedBold.pfb";
  37123. t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb";
  37124. t["Courier-Oblique"] = "FoxitFixedItalic.pfb";
  37125. t.Helvetica = "FoxitSans.pfb";
  37126. t["Helvetica-Bold"] = "FoxitSansBold.pfb";
  37127. t["Helvetica-BoldOblique"] = "FoxitSansBoldItalic.pfb";
  37128. t["Helvetica-Oblique"] = "FoxitSansItalic.pfb";
  37129. t["Times-Roman"] = "FoxitSerif.pfb";
  37130. t["Times-Bold"] = "FoxitSerifBold.pfb";
  37131. t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb";
  37132. t["Times-Italic"] = "FoxitSerifItalic.pfb";
  37133. t.Symbol = "FoxitSymbol.pfb";
  37134. t.ZapfDingbats = "FoxitDingbats.pfb";
  37135. t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf";
  37136. t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf";
  37137. t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf";
  37138. t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf";
  37139. });
  37140. exports.getFontNameToFileMap = getFontNameToFileMap;
  37141. const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  37142. t.Calibri = "Helvetica";
  37143. t["Calibri-Bold"] = "Helvetica-Bold";
  37144. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  37145. t["Calibri-Italic"] = "Helvetica-Oblique";
  37146. t.CenturyGothic = "Helvetica";
  37147. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  37148. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  37149. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  37150. t.ComicSansMS = "Comic Sans MS";
  37151. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  37152. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  37153. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  37154. t["ItcSymbol-Bold"] = "Helvetica-Bold";
  37155. t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique";
  37156. t["ItcSymbol-Book"] = "Helvetica";
  37157. t["ItcSymbol-BookItalic"] = "Helvetica-Oblique";
  37158. t["ItcSymbol-Medium"] = "Helvetica";
  37159. t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique";
  37160. t.LucidaConsole = "Courier";
  37161. t["LucidaConsole-Bold"] = "Courier-Bold";
  37162. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  37163. t["LucidaConsole-Italic"] = "Courier-Oblique";
  37164. t["LucidaSans-Demi"] = "Helvetica-Bold";
  37165. t["MS-Gothic"] = "MS Gothic";
  37166. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  37167. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  37168. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  37169. t["MS-Mincho"] = "MS Mincho";
  37170. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  37171. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  37172. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  37173. t["MS-PGothic"] = "MS PGothic";
  37174. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  37175. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  37176. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  37177. t["MS-PMincho"] = "MS PMincho";
  37178. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  37179. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  37180. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  37181. t.NuptialScript = "Times-Italic";
  37182. t.SegoeUISymbol = "Helvetica";
  37183. t.Wingdings = "ZapfDingbats";
  37184. t["Wingdings-Regular"] = "ZapfDingbats";
  37185. });
  37186. exports.getNonStdFontMap = getNonStdFontMap;
  37187. const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  37188. t["Adobe Jenson"] = true;
  37189. t["Adobe Text"] = true;
  37190. t.Albertus = true;
  37191. t.Aldus = true;
  37192. t.Alexandria = true;
  37193. t.Algerian = true;
  37194. t["American Typewriter"] = true;
  37195. t.Antiqua = true;
  37196. t.Apex = true;
  37197. t.Arno = true;
  37198. t.Aster = true;
  37199. t.Aurora = true;
  37200. t.Baskerville = true;
  37201. t.Bell = true;
  37202. t.Bembo = true;
  37203. t["Bembo Schoolbook"] = true;
  37204. t.Benguiat = true;
  37205. t["Berkeley Old Style"] = true;
  37206. t["Bernhard Modern"] = true;
  37207. t["Berthold City"] = true;
  37208. t.Bodoni = true;
  37209. t["Bauer Bodoni"] = true;
  37210. t["Book Antiqua"] = true;
  37211. t.Bookman = true;
  37212. t["Bordeaux Roman"] = true;
  37213. t["Californian FB"] = true;
  37214. t.Calisto = true;
  37215. t.Calvert = true;
  37216. t.Capitals = true;
  37217. t.Cambria = true;
  37218. t.Cartier = true;
  37219. t.Caslon = true;
  37220. t.Catull = true;
  37221. t.Centaur = true;
  37222. t["Century Old Style"] = true;
  37223. t["Century Schoolbook"] = true;
  37224. t.Chaparral = true;
  37225. t["Charis SIL"] = true;
  37226. t.Cheltenham = true;
  37227. t["Cholla Slab"] = true;
  37228. t.Clarendon = true;
  37229. t.Clearface = true;
  37230. t.Cochin = true;
  37231. t.Colonna = true;
  37232. t["Computer Modern"] = true;
  37233. t["Concrete Roman"] = true;
  37234. t.Constantia = true;
  37235. t["Cooper Black"] = true;
  37236. t.Corona = true;
  37237. t.Ecotype = true;
  37238. t.Egyptienne = true;
  37239. t.Elephant = true;
  37240. t.Excelsior = true;
  37241. t.Fairfield = true;
  37242. t["FF Scala"] = true;
  37243. t.Folkard = true;
  37244. t.Footlight = true;
  37245. t.FreeSerif = true;
  37246. t["Friz Quadrata"] = true;
  37247. t.Garamond = true;
  37248. t.Gentium = true;
  37249. t.Georgia = true;
  37250. t.Gloucester = true;
  37251. t["Goudy Old Style"] = true;
  37252. t["Goudy Schoolbook"] = true;
  37253. t["Goudy Pro Font"] = true;
  37254. t.Granjon = true;
  37255. t["Guardian Egyptian"] = true;
  37256. t.Heather = true;
  37257. t.Hercules = true;
  37258. t["High Tower Text"] = true;
  37259. t.Hiroshige = true;
  37260. t["Hoefler Text"] = true;
  37261. t["Humana Serif"] = true;
  37262. t.Imprint = true;
  37263. t["Ionic No. 5"] = true;
  37264. t.Janson = true;
  37265. t.Joanna = true;
  37266. t.Korinna = true;
  37267. t.Lexicon = true;
  37268. t.LiberationSerif = true;
  37269. t["Liberation Serif"] = true;
  37270. t["Linux Libertine"] = true;
  37271. t.Literaturnaya = true;
  37272. t.Lucida = true;
  37273. t["Lucida Bright"] = true;
  37274. t.Melior = true;
  37275. t.Memphis = true;
  37276. t.Miller = true;
  37277. t.Minion = true;
  37278. t.Modern = true;
  37279. t["Mona Lisa"] = true;
  37280. t["Mrs Eaves"] = true;
  37281. t["MS Serif"] = true;
  37282. t["Museo Slab"] = true;
  37283. t["New York"] = true;
  37284. t["Nimbus Roman"] = true;
  37285. t["NPS Rawlinson Roadway"] = true;
  37286. t.NuptialScript = true;
  37287. t.Palatino = true;
  37288. t.Perpetua = true;
  37289. t.Plantin = true;
  37290. t["Plantin Schoolbook"] = true;
  37291. t.Playbill = true;
  37292. t["Poor Richard"] = true;
  37293. t["Rawlinson Roadway"] = true;
  37294. t.Renault = true;
  37295. t.Requiem = true;
  37296. t.Rockwell = true;
  37297. t.Roman = true;
  37298. t["Rotis Serif"] = true;
  37299. t.Sabon = true;
  37300. t.Scala = true;
  37301. t.Seagull = true;
  37302. t.Sistina = true;
  37303. t.Souvenir = true;
  37304. t.STIX = true;
  37305. t["Stone Informal"] = true;
  37306. t["Stone Serif"] = true;
  37307. t.Sylfaen = true;
  37308. t.Times = true;
  37309. t.Trajan = true;
  37310. t["Trinité"] = true;
  37311. t["Trump Mediaeval"] = true;
  37312. t.Utopia = true;
  37313. t["Vale Type"] = true;
  37314. t["Bitstream Vera"] = true;
  37315. t["Vera Serif"] = true;
  37316. t.Versailles = true;
  37317. t.Wanted = true;
  37318. t.Weiss = true;
  37319. t["Wide Latin"] = true;
  37320. t.Windsor = true;
  37321. t.XITS = true;
  37322. });
  37323. exports.getSerifFonts = getSerifFonts;
  37324. const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  37325. t.Dingbats = true;
  37326. t.Symbol = true;
  37327. t.ZapfDingbats = true;
  37328. });
  37329. exports.getSymbolsFonts = getSymbolsFonts;
  37330. const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  37331. t[2] = 10;
  37332. t[3] = 32;
  37333. t[4] = 33;
  37334. t[5] = 34;
  37335. t[6] = 35;
  37336. t[7] = 36;
  37337. t[8] = 37;
  37338. t[9] = 38;
  37339. t[10] = 39;
  37340. t[11] = 40;
  37341. t[12] = 41;
  37342. t[13] = 42;
  37343. t[14] = 43;
  37344. t[15] = 44;
  37345. t[16] = 45;
  37346. t[17] = 46;
  37347. t[18] = 47;
  37348. t[19] = 48;
  37349. t[20] = 49;
  37350. t[21] = 50;
  37351. t[22] = 51;
  37352. t[23] = 52;
  37353. t[24] = 53;
  37354. t[25] = 54;
  37355. t[26] = 55;
  37356. t[27] = 56;
  37357. t[28] = 57;
  37358. t[29] = 58;
  37359. t[30] = 894;
  37360. t[31] = 60;
  37361. t[32] = 61;
  37362. t[33] = 62;
  37363. t[34] = 63;
  37364. t[35] = 64;
  37365. t[36] = 65;
  37366. t[37] = 66;
  37367. t[38] = 67;
  37368. t[39] = 68;
  37369. t[40] = 69;
  37370. t[41] = 70;
  37371. t[42] = 71;
  37372. t[43] = 72;
  37373. t[44] = 73;
  37374. t[45] = 74;
  37375. t[46] = 75;
  37376. t[47] = 76;
  37377. t[48] = 77;
  37378. t[49] = 78;
  37379. t[50] = 79;
  37380. t[51] = 80;
  37381. t[52] = 81;
  37382. t[53] = 82;
  37383. t[54] = 83;
  37384. t[55] = 84;
  37385. t[56] = 85;
  37386. t[57] = 86;
  37387. t[58] = 87;
  37388. t[59] = 88;
  37389. t[60] = 89;
  37390. t[61] = 90;
  37391. t[62] = 91;
  37392. t[63] = 92;
  37393. t[64] = 93;
  37394. t[65] = 94;
  37395. t[66] = 95;
  37396. t[67] = 96;
  37397. t[68] = 97;
  37398. t[69] = 98;
  37399. t[70] = 99;
  37400. t[71] = 100;
  37401. t[72] = 101;
  37402. t[73] = 102;
  37403. t[74] = 103;
  37404. t[75] = 104;
  37405. t[76] = 105;
  37406. t[77] = 106;
  37407. t[78] = 107;
  37408. t[79] = 108;
  37409. t[80] = 109;
  37410. t[81] = 110;
  37411. t[82] = 111;
  37412. t[83] = 112;
  37413. t[84] = 113;
  37414. t[85] = 114;
  37415. t[86] = 115;
  37416. t[87] = 116;
  37417. t[88] = 117;
  37418. t[89] = 118;
  37419. t[90] = 119;
  37420. t[91] = 120;
  37421. t[92] = 121;
  37422. t[93] = 122;
  37423. t[94] = 123;
  37424. t[95] = 124;
  37425. t[96] = 125;
  37426. t[97] = 126;
  37427. t[98] = 196;
  37428. t[99] = 197;
  37429. t[100] = 199;
  37430. t[101] = 201;
  37431. t[102] = 209;
  37432. t[103] = 214;
  37433. t[104] = 220;
  37434. t[105] = 225;
  37435. t[106] = 224;
  37436. t[107] = 226;
  37437. t[108] = 228;
  37438. t[109] = 227;
  37439. t[110] = 229;
  37440. t[111] = 231;
  37441. t[112] = 233;
  37442. t[113] = 232;
  37443. t[114] = 234;
  37444. t[115] = 235;
  37445. t[116] = 237;
  37446. t[117] = 236;
  37447. t[118] = 238;
  37448. t[119] = 239;
  37449. t[120] = 241;
  37450. t[121] = 243;
  37451. t[122] = 242;
  37452. t[123] = 244;
  37453. t[124] = 246;
  37454. t[125] = 245;
  37455. t[126] = 250;
  37456. t[127] = 249;
  37457. t[128] = 251;
  37458. t[129] = 252;
  37459. t[130] = 8224;
  37460. t[131] = 176;
  37461. t[132] = 162;
  37462. t[133] = 163;
  37463. t[134] = 167;
  37464. t[135] = 8226;
  37465. t[136] = 182;
  37466. t[137] = 223;
  37467. t[138] = 174;
  37468. t[139] = 169;
  37469. t[140] = 8482;
  37470. t[141] = 180;
  37471. t[142] = 168;
  37472. t[143] = 8800;
  37473. t[144] = 198;
  37474. t[145] = 216;
  37475. t[146] = 8734;
  37476. t[147] = 177;
  37477. t[148] = 8804;
  37478. t[149] = 8805;
  37479. t[150] = 165;
  37480. t[151] = 181;
  37481. t[152] = 8706;
  37482. t[153] = 8721;
  37483. t[154] = 8719;
  37484. t[156] = 8747;
  37485. t[157] = 170;
  37486. t[158] = 186;
  37487. t[159] = 8486;
  37488. t[160] = 230;
  37489. t[161] = 248;
  37490. t[162] = 191;
  37491. t[163] = 161;
  37492. t[164] = 172;
  37493. t[165] = 8730;
  37494. t[166] = 402;
  37495. t[167] = 8776;
  37496. t[168] = 8710;
  37497. t[169] = 171;
  37498. t[170] = 187;
  37499. t[171] = 8230;
  37500. t[179] = 8220;
  37501. t[180] = 8221;
  37502. t[181] = 8216;
  37503. t[182] = 8217;
  37504. t[200] = 193;
  37505. t[203] = 205;
  37506. t[210] = 218;
  37507. t[223] = 711;
  37508. t[224] = 321;
  37509. t[225] = 322;
  37510. t[226] = 352;
  37511. t[227] = 353;
  37512. t[228] = 381;
  37513. t[229] = 382;
  37514. t[233] = 221;
  37515. t[234] = 253;
  37516. t[252] = 263;
  37517. t[253] = 268;
  37518. t[254] = 269;
  37519. t[258] = 258;
  37520. t[260] = 260;
  37521. t[261] = 261;
  37522. t[265] = 280;
  37523. t[266] = 281;
  37524. t[267] = 282;
  37525. t[268] = 283;
  37526. t[269] = 313;
  37527. t[275] = 323;
  37528. t[276] = 324;
  37529. t[278] = 328;
  37530. t[283] = 344;
  37531. t[284] = 345;
  37532. t[285] = 346;
  37533. t[286] = 347;
  37534. t[292] = 367;
  37535. t[295] = 377;
  37536. t[296] = 378;
  37537. t[298] = 380;
  37538. t[305] = 963;
  37539. t[306] = 964;
  37540. t[307] = 966;
  37541. t[308] = 8215;
  37542. t[309] = 8252;
  37543. t[310] = 8319;
  37544. t[311] = 8359;
  37545. t[312] = 8592;
  37546. t[313] = 8593;
  37547. t[337] = 9552;
  37548. t[493] = 1039;
  37549. t[494] = 1040;
  37550. t[672] = 1488;
  37551. t[673] = 1489;
  37552. t[674] = 1490;
  37553. t[675] = 1491;
  37554. t[676] = 1492;
  37555. t[677] = 1493;
  37556. t[678] = 1494;
  37557. t[679] = 1495;
  37558. t[680] = 1496;
  37559. t[681] = 1497;
  37560. t[682] = 1498;
  37561. t[683] = 1499;
  37562. t[684] = 1500;
  37563. t[685] = 1501;
  37564. t[686] = 1502;
  37565. t[687] = 1503;
  37566. t[688] = 1504;
  37567. t[689] = 1505;
  37568. t[690] = 1506;
  37569. t[691] = 1507;
  37570. t[692] = 1508;
  37571. t[693] = 1509;
  37572. t[694] = 1510;
  37573. t[695] = 1511;
  37574. t[696] = 1512;
  37575. t[697] = 1513;
  37576. t[698] = 1514;
  37577. t[705] = 1524;
  37578. t[706] = 8362;
  37579. t[710] = 64288;
  37580. t[711] = 64298;
  37581. t[759] = 1617;
  37582. t[761] = 1776;
  37583. t[763] = 1778;
  37584. t[775] = 1652;
  37585. t[777] = 1764;
  37586. t[778] = 1780;
  37587. t[779] = 1781;
  37588. t[780] = 1782;
  37589. t[782] = 771;
  37590. t[783] = 64726;
  37591. t[786] = 8363;
  37592. t[788] = 8532;
  37593. t[790] = 768;
  37594. t[791] = 769;
  37595. t[792] = 768;
  37596. t[795] = 803;
  37597. t[797] = 64336;
  37598. t[798] = 64337;
  37599. t[799] = 64342;
  37600. t[800] = 64343;
  37601. t[801] = 64344;
  37602. t[802] = 64345;
  37603. t[803] = 64362;
  37604. t[804] = 64363;
  37605. t[805] = 64364;
  37606. t[2424] = 7821;
  37607. t[2425] = 7822;
  37608. t[2426] = 7823;
  37609. t[2427] = 7824;
  37610. t[2428] = 7825;
  37611. t[2429] = 7826;
  37612. t[2430] = 7827;
  37613. t[2433] = 7682;
  37614. t[2678] = 8045;
  37615. t[2679] = 8046;
  37616. t[2830] = 1552;
  37617. t[2838] = 686;
  37618. t[2840] = 751;
  37619. t[2842] = 753;
  37620. t[2843] = 754;
  37621. t[2844] = 755;
  37622. t[2846] = 757;
  37623. t[2856] = 767;
  37624. t[2857] = 848;
  37625. t[2858] = 849;
  37626. t[2862] = 853;
  37627. t[2863] = 854;
  37628. t[2864] = 855;
  37629. t[2865] = 861;
  37630. t[2866] = 862;
  37631. t[2906] = 7460;
  37632. t[2908] = 7462;
  37633. t[2909] = 7463;
  37634. t[2910] = 7464;
  37635. t[2912] = 7466;
  37636. t[2913] = 7467;
  37637. t[2914] = 7468;
  37638. t[2916] = 7470;
  37639. t[2917] = 7471;
  37640. t[2918] = 7472;
  37641. t[2920] = 7474;
  37642. t[2921] = 7475;
  37643. t[2922] = 7476;
  37644. t[2924] = 7478;
  37645. t[2925] = 7479;
  37646. t[2926] = 7480;
  37647. t[2928] = 7482;
  37648. t[2929] = 7483;
  37649. t[2930] = 7484;
  37650. t[2932] = 7486;
  37651. t[2933] = 7487;
  37652. t[2934] = 7488;
  37653. t[2936] = 7490;
  37654. t[2937] = 7491;
  37655. t[2938] = 7492;
  37656. t[2940] = 7494;
  37657. t[2941] = 7495;
  37658. t[2942] = 7496;
  37659. t[2944] = 7498;
  37660. t[2946] = 7500;
  37661. t[2948] = 7502;
  37662. t[2950] = 7504;
  37663. t[2951] = 7505;
  37664. t[2952] = 7506;
  37665. t[2954] = 7508;
  37666. t[2955] = 7509;
  37667. t[2956] = 7510;
  37668. t[2958] = 7512;
  37669. t[2959] = 7513;
  37670. t[2960] = 7514;
  37671. t[2962] = 7516;
  37672. t[2963] = 7517;
  37673. t[2964] = 7518;
  37674. t[2966] = 7520;
  37675. t[2967] = 7521;
  37676. t[2968] = 7522;
  37677. t[2970] = 7524;
  37678. t[2971] = 7525;
  37679. t[2972] = 7526;
  37680. t[2974] = 7528;
  37681. t[2975] = 7529;
  37682. t[2976] = 7530;
  37683. t[2978] = 1537;
  37684. t[2979] = 1538;
  37685. t[2980] = 1539;
  37686. t[2982] = 1549;
  37687. t[2983] = 1551;
  37688. t[2984] = 1552;
  37689. t[2986] = 1554;
  37690. t[2987] = 1555;
  37691. t[2988] = 1556;
  37692. t[2990] = 1623;
  37693. t[2991] = 1624;
  37694. t[2995] = 1775;
  37695. t[2999] = 1791;
  37696. t[3002] = 64290;
  37697. t[3003] = 64291;
  37698. t[3004] = 64292;
  37699. t[3006] = 64294;
  37700. t[3007] = 64295;
  37701. t[3008] = 64296;
  37702. t[3011] = 1900;
  37703. t[3014] = 8223;
  37704. t[3015] = 8244;
  37705. t[3017] = 7532;
  37706. t[3018] = 7533;
  37707. t[3019] = 7534;
  37708. t[3075] = 7590;
  37709. t[3076] = 7591;
  37710. t[3079] = 7594;
  37711. t[3080] = 7595;
  37712. t[3083] = 7598;
  37713. t[3084] = 7599;
  37714. t[3087] = 7602;
  37715. t[3088] = 7603;
  37716. t[3091] = 7606;
  37717. t[3092] = 7607;
  37718. t[3095] = 7610;
  37719. t[3096] = 7611;
  37720. t[3099] = 7614;
  37721. t[3100] = 7615;
  37722. t[3103] = 7618;
  37723. t[3104] = 7619;
  37724. t[3107] = 8337;
  37725. t[3108] = 8338;
  37726. t[3116] = 1884;
  37727. t[3119] = 1885;
  37728. t[3120] = 1885;
  37729. t[3123] = 1886;
  37730. t[3124] = 1886;
  37731. t[3127] = 1887;
  37732. t[3128] = 1887;
  37733. t[3131] = 1888;
  37734. t[3132] = 1888;
  37735. t[3135] = 1889;
  37736. t[3136] = 1889;
  37737. t[3139] = 1890;
  37738. t[3140] = 1890;
  37739. t[3143] = 1891;
  37740. t[3144] = 1891;
  37741. t[3147] = 1892;
  37742. t[3148] = 1892;
  37743. t[3153] = 580;
  37744. t[3154] = 581;
  37745. t[3157] = 584;
  37746. t[3158] = 585;
  37747. t[3161] = 588;
  37748. t[3162] = 589;
  37749. t[3165] = 891;
  37750. t[3166] = 892;
  37751. t[3169] = 1274;
  37752. t[3170] = 1275;
  37753. t[3173] = 1278;
  37754. t[3174] = 1279;
  37755. t[3181] = 7622;
  37756. t[3182] = 7623;
  37757. t[3282] = 11799;
  37758. t[3316] = 578;
  37759. t[3379] = 42785;
  37760. t[3393] = 1159;
  37761. t[3416] = 8377;
  37762. });
  37763. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  37764. const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
  37765. t[227] = 322;
  37766. t[264] = 261;
  37767. t[291] = 346;
  37768. });
  37769. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  37770. const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
  37771. t[1] = 32;
  37772. t[4] = 65;
  37773. t[5] = 192;
  37774. t[6] = 193;
  37775. t[9] = 196;
  37776. t[17] = 66;
  37777. t[18] = 67;
  37778. t[21] = 268;
  37779. t[24] = 68;
  37780. t[28] = 69;
  37781. t[29] = 200;
  37782. t[30] = 201;
  37783. t[32] = 282;
  37784. t[38] = 70;
  37785. t[39] = 71;
  37786. t[44] = 72;
  37787. t[47] = 73;
  37788. t[48] = 204;
  37789. t[49] = 205;
  37790. t[58] = 74;
  37791. t[60] = 75;
  37792. t[62] = 76;
  37793. t[68] = 77;
  37794. t[69] = 78;
  37795. t[75] = 79;
  37796. t[76] = 210;
  37797. t[80] = 214;
  37798. t[87] = 80;
  37799. t[89] = 81;
  37800. t[90] = 82;
  37801. t[92] = 344;
  37802. t[94] = 83;
  37803. t[97] = 352;
  37804. t[100] = 84;
  37805. t[104] = 85;
  37806. t[109] = 220;
  37807. t[115] = 86;
  37808. t[116] = 87;
  37809. t[121] = 88;
  37810. t[122] = 89;
  37811. t[124] = 221;
  37812. t[127] = 90;
  37813. t[129] = 381;
  37814. t[258] = 97;
  37815. t[259] = 224;
  37816. t[260] = 225;
  37817. t[263] = 228;
  37818. t[268] = 261;
  37819. t[271] = 98;
  37820. t[272] = 99;
  37821. t[273] = 263;
  37822. t[275] = 269;
  37823. t[282] = 100;
  37824. t[286] = 101;
  37825. t[287] = 232;
  37826. t[288] = 233;
  37827. t[290] = 283;
  37828. t[295] = 281;
  37829. t[296] = 102;
  37830. t[336] = 103;
  37831. t[346] = 104;
  37832. t[349] = 105;
  37833. t[350] = 236;
  37834. t[351] = 237;
  37835. t[361] = 106;
  37836. t[364] = 107;
  37837. t[367] = 108;
  37838. t[371] = 322;
  37839. t[373] = 109;
  37840. t[374] = 110;
  37841. t[381] = 111;
  37842. t[382] = 242;
  37843. t[383] = 243;
  37844. t[386] = 246;
  37845. t[393] = 112;
  37846. t[395] = 113;
  37847. t[396] = 114;
  37848. t[398] = 345;
  37849. t[400] = 115;
  37850. t[401] = 347;
  37851. t[403] = 353;
  37852. t[410] = 116;
  37853. t[437] = 117;
  37854. t[442] = 252;
  37855. t[448] = 118;
  37856. t[449] = 119;
  37857. t[454] = 120;
  37858. t[455] = 121;
  37859. t[457] = 253;
  37860. t[460] = 122;
  37861. t[462] = 382;
  37862. t[463] = 380;
  37863. t[853] = 44;
  37864. t[855] = 58;
  37865. t[856] = 46;
  37866. t[876] = 47;
  37867. t[878] = 45;
  37868. t[882] = 45;
  37869. t[894] = 40;
  37870. t[895] = 41;
  37871. t[896] = 91;
  37872. t[897] = 93;
  37873. t[923] = 64;
  37874. t[1004] = 48;
  37875. t[1005] = 49;
  37876. t[1006] = 50;
  37877. t[1007] = 51;
  37878. t[1008] = 52;
  37879. t[1009] = 53;
  37880. t[1010] = 54;
  37881. t[1011] = 55;
  37882. t[1012] = 56;
  37883. t[1013] = 57;
  37884. t[1081] = 37;
  37885. t[1085] = 43;
  37886. t[1086] = 45;
  37887. });
  37888. exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
  37889. function getStandardFontName(name) {
  37890. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  37891. const stdFontMap = getStdFontMap();
  37892. return stdFontMap[fontName];
  37893. }
  37894. /***/ }),
  37895. /* 40 */
  37896. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37897. Object.defineProperty(exports, "__esModule", ({
  37898. value: true
  37899. }));
  37900. exports.ToUnicodeMap = exports.IdentityToUnicodeMap = void 0;
  37901. var _util = __w_pdfjs_require__(2);
  37902. class ToUnicodeMap {
  37903. constructor(cmap = []) {
  37904. this._map = cmap;
  37905. }
  37906. get length() {
  37907. return this._map.length;
  37908. }
  37909. forEach(callback) {
  37910. for (const charCode in this._map) {
  37911. callback(charCode, this._map[charCode].charCodeAt(0));
  37912. }
  37913. }
  37914. has(i) {
  37915. return this._map[i] !== undefined;
  37916. }
  37917. get(i) {
  37918. return this._map[i];
  37919. }
  37920. charCodeOf(value) {
  37921. const map = this._map;
  37922. if (map.length <= 0x10000) {
  37923. return map.indexOf(value);
  37924. }
  37925. for (const charCode in map) {
  37926. if (map[charCode] === value) {
  37927. return charCode | 0;
  37928. }
  37929. }
  37930. return -1;
  37931. }
  37932. amend(map) {
  37933. for (const charCode in map) {
  37934. this._map[charCode] = map[charCode];
  37935. }
  37936. }
  37937. }
  37938. exports.ToUnicodeMap = ToUnicodeMap;
  37939. class IdentityToUnicodeMap {
  37940. constructor(firstChar, lastChar) {
  37941. this.firstChar = firstChar;
  37942. this.lastChar = lastChar;
  37943. }
  37944. get length() {
  37945. return this.lastChar + 1 - this.firstChar;
  37946. }
  37947. forEach(callback) {
  37948. for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  37949. callback(i, i);
  37950. }
  37951. }
  37952. has(i) {
  37953. return this.firstChar <= i && i <= this.lastChar;
  37954. }
  37955. get(i) {
  37956. if (this.firstChar <= i && i <= this.lastChar) {
  37957. return String.fromCharCode(i);
  37958. }
  37959. return undefined;
  37960. }
  37961. charCodeOf(v) {
  37962. return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  37963. }
  37964. amend(map) {
  37965. (0, _util.unreachable)("Should not call amend()");
  37966. }
  37967. }
  37968. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  37969. /***/ }),
  37970. /* 41 */
  37971. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37972. Object.defineProperty(exports, "__esModule", ({
  37973. value: true
  37974. }));
  37975. exports.CFFFont = void 0;
  37976. var _cff_parser = __w_pdfjs_require__(33);
  37977. var _fonts_utils = __w_pdfjs_require__(36);
  37978. var _util = __w_pdfjs_require__(2);
  37979. class CFFFont {
  37980. constructor(file, properties) {
  37981. this.properties = properties;
  37982. const parser = new _cff_parser.CFFParser(file, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  37983. this.cff = parser.parse();
  37984. this.cff.duplicateFirstGlyph();
  37985. const compiler = new _cff_parser.CFFCompiler(this.cff);
  37986. this.seacs = this.cff.seacs;
  37987. try {
  37988. this.data = compiler.compile();
  37989. } catch (e) {
  37990. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  37991. this.data = file;
  37992. }
  37993. this._createBuiltInEncoding();
  37994. }
  37995. get numGlyphs() {
  37996. return this.cff.charStrings.count;
  37997. }
  37998. getCharset() {
  37999. return this.cff.charset.charset;
  38000. }
  38001. getGlyphMapping() {
  38002. const cff = this.cff;
  38003. const properties = this.properties;
  38004. const {
  38005. cidToGidMap,
  38006. cMap
  38007. } = properties;
  38008. const charsets = cff.charset.charset;
  38009. let charCodeToGlyphId;
  38010. let glyphId;
  38011. if (properties.composite) {
  38012. let invCidToGidMap;
  38013. if (cidToGidMap && cidToGidMap.length > 0) {
  38014. invCidToGidMap = Object.create(null);
  38015. for (let i = 0, ii = cidToGidMap.length; i < ii; i++) {
  38016. const gid = cidToGidMap[i];
  38017. if (gid !== undefined) {
  38018. invCidToGidMap[gid] = i;
  38019. }
  38020. }
  38021. }
  38022. charCodeToGlyphId = Object.create(null);
  38023. let charCode;
  38024. if (cff.isCIDFont) {
  38025. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  38026. const cid = charsets[glyphId];
  38027. charCode = cMap.charCodeOf(cid);
  38028. if (invCidToGidMap && invCidToGidMap[charCode] !== undefined) {
  38029. charCode = invCidToGidMap[charCode];
  38030. }
  38031. charCodeToGlyphId[charCode] = glyphId;
  38032. }
  38033. } else {
  38034. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  38035. charCode = cMap.charCodeOf(glyphId);
  38036. charCodeToGlyphId[charCode] = glyphId;
  38037. }
  38038. }
  38039. return charCodeToGlyphId;
  38040. }
  38041. let encoding = cff.encoding ? cff.encoding.encoding : null;
  38042. if (properties.isInternalFont) {
  38043. encoding = properties.defaultEncoding;
  38044. }
  38045. charCodeToGlyphId = (0, _fonts_utils.type1FontGlyphMapping)(properties, encoding, charsets);
  38046. return charCodeToGlyphId;
  38047. }
  38048. hasGlyphId(id) {
  38049. return this.cff.hasGlyphId(id);
  38050. }
  38051. _createBuiltInEncoding() {
  38052. const {
  38053. charset,
  38054. encoding
  38055. } = this.cff;
  38056. if (!charset || !encoding) {
  38057. return;
  38058. }
  38059. const charsets = charset.charset,
  38060. encodings = encoding.encoding;
  38061. const map = [];
  38062. for (const charCode in encodings) {
  38063. const glyphId = encodings[charCode];
  38064. if (glyphId >= 0) {
  38065. const glyphName = charsets[glyphId];
  38066. if (glyphName) {
  38067. map[charCode] = glyphName;
  38068. }
  38069. }
  38070. }
  38071. if (map.length > 0) {
  38072. this.properties.builtInEncoding = map;
  38073. }
  38074. }
  38075. }
  38076. exports.CFFFont = CFFFont;
  38077. /***/ }),
  38078. /* 42 */
  38079. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38080. Object.defineProperty(exports, "__esModule", ({
  38081. value: true
  38082. }));
  38083. exports.FontRendererFactory = void 0;
  38084. var _util = __w_pdfjs_require__(2);
  38085. var _cff_parser = __w_pdfjs_require__(33);
  38086. var _glyphlist = __w_pdfjs_require__(37);
  38087. var _encodings = __w_pdfjs_require__(35);
  38088. var _stream = __w_pdfjs_require__(8);
  38089. function getUint32(data, offset) {
  38090. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  38091. }
  38092. function getUint16(data, offset) {
  38093. return data[offset] << 8 | data[offset + 1];
  38094. }
  38095. function getInt16(data, offset) {
  38096. return (data[offset] << 24 | data[offset + 1] << 16) >> 16;
  38097. }
  38098. function getInt8(data, offset) {
  38099. return data[offset] << 24 >> 24;
  38100. }
  38101. function getFloat214(data, offset) {
  38102. return getInt16(data, offset) / 16384;
  38103. }
  38104. function getSubroutineBias(subrs) {
  38105. const numSubrs = subrs.length;
  38106. let bias = 32768;
  38107. if (numSubrs < 1240) {
  38108. bias = 107;
  38109. } else if (numSubrs < 33900) {
  38110. bias = 1131;
  38111. }
  38112. return bias;
  38113. }
  38114. function parseCmap(data, start, end) {
  38115. const offset = getUint16(data, start + 2) === 1 ? getUint32(data, start + 8) : getUint32(data, start + 16);
  38116. const format = getUint16(data, start + offset);
  38117. let ranges, p, i;
  38118. if (format === 4) {
  38119. getUint16(data, start + offset + 2);
  38120. const segCount = getUint16(data, start + offset + 6) >> 1;
  38121. p = start + offset + 14;
  38122. ranges = [];
  38123. for (i = 0; i < segCount; i++, p += 2) {
  38124. ranges[i] = {
  38125. end: getUint16(data, p)
  38126. };
  38127. }
  38128. p += 2;
  38129. for (i = 0; i < segCount; i++, p += 2) {
  38130. ranges[i].start = getUint16(data, p);
  38131. }
  38132. for (i = 0; i < segCount; i++, p += 2) {
  38133. ranges[i].idDelta = getUint16(data, p);
  38134. }
  38135. for (i = 0; i < segCount; i++, p += 2) {
  38136. let idOffset = getUint16(data, p);
  38137. if (idOffset === 0) {
  38138. continue;
  38139. }
  38140. ranges[i].ids = [];
  38141. for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  38142. ranges[i].ids[j] = getUint16(data, p + idOffset);
  38143. idOffset += 2;
  38144. }
  38145. }
  38146. return ranges;
  38147. } else if (format === 12) {
  38148. const groups = getUint32(data, start + offset + 12);
  38149. p = start + offset + 16;
  38150. ranges = [];
  38151. for (i = 0; i < groups; i++) {
  38152. start = getUint32(data, p);
  38153. ranges.push({
  38154. start,
  38155. end: getUint32(data, p + 4),
  38156. idDelta: getUint32(data, p + 8) - start
  38157. });
  38158. p += 12;
  38159. }
  38160. return ranges;
  38161. }
  38162. throw new _util.FormatError(`unsupported cmap: ${format}`);
  38163. }
  38164. function parseCff(data, start, end, seacAnalysisEnabled) {
  38165. const properties = {};
  38166. const parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
  38167. const cff = parser.parse();
  38168. return {
  38169. glyphs: cff.charStrings.objects,
  38170. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  38171. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
  38172. isCFFCIDFont: cff.isCIDFont,
  38173. fdSelect: cff.fdSelect,
  38174. fdArray: cff.fdArray
  38175. };
  38176. }
  38177. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  38178. let itemSize, itemDecode;
  38179. if (isGlyphLocationsLong) {
  38180. itemSize = 4;
  38181. itemDecode = getUint32;
  38182. } else {
  38183. itemSize = 2;
  38184. itemDecode = (data, offset) => 2 * getUint16(data, offset);
  38185. }
  38186. const glyphs = [];
  38187. let startOffset = itemDecode(loca, 0);
  38188. for (let j = itemSize; j < loca.length; j += itemSize) {
  38189. const endOffset = itemDecode(loca, j);
  38190. glyphs.push(glyf.subarray(startOffset, endOffset));
  38191. startOffset = endOffset;
  38192. }
  38193. return glyphs;
  38194. }
  38195. function lookupCmap(ranges, unicode) {
  38196. const code = unicode.codePointAt(0);
  38197. let gid = 0,
  38198. l = 0,
  38199. r = ranges.length - 1;
  38200. while (l < r) {
  38201. const c = l + r + 1 >> 1;
  38202. if (code < ranges[c].start) {
  38203. r = c - 1;
  38204. } else {
  38205. l = c;
  38206. }
  38207. }
  38208. if (ranges[l].start <= code && code <= ranges[l].end) {
  38209. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
  38210. }
  38211. return {
  38212. charCode: code,
  38213. glyphId: gid
  38214. };
  38215. }
  38216. function compileGlyf(code, cmds, font) {
  38217. function moveTo(x, y) {
  38218. cmds.push({
  38219. cmd: "moveTo",
  38220. args: [x, y]
  38221. });
  38222. }
  38223. function lineTo(x, y) {
  38224. cmds.push({
  38225. cmd: "lineTo",
  38226. args: [x, y]
  38227. });
  38228. }
  38229. function quadraticCurveTo(xa, ya, x, y) {
  38230. cmds.push({
  38231. cmd: "quadraticCurveTo",
  38232. args: [xa, ya, x, y]
  38233. });
  38234. }
  38235. let i = 0;
  38236. const numberOfContours = getInt16(code, i);
  38237. let flags;
  38238. let x = 0,
  38239. y = 0;
  38240. i += 10;
  38241. if (numberOfContours < 0) {
  38242. do {
  38243. flags = getUint16(code, i);
  38244. const glyphIndex = getUint16(code, i + 2);
  38245. i += 4;
  38246. let arg1, arg2;
  38247. if (flags & 0x01) {
  38248. if (flags & 0x02) {
  38249. arg1 = getInt16(code, i);
  38250. arg2 = getInt16(code, i + 2);
  38251. } else {
  38252. arg1 = getUint16(code, i);
  38253. arg2 = getUint16(code, i + 2);
  38254. }
  38255. i += 4;
  38256. } else {
  38257. if (flags & 0x02) {
  38258. arg1 = getInt8(code, i++);
  38259. arg2 = getInt8(code, i++);
  38260. } else {
  38261. arg1 = code[i++];
  38262. arg2 = code[i++];
  38263. }
  38264. }
  38265. if (flags & 0x02) {
  38266. x = arg1;
  38267. y = arg2;
  38268. } else {
  38269. x = 0;
  38270. y = 0;
  38271. }
  38272. let scaleX = 1,
  38273. scaleY = 1,
  38274. scale01 = 0,
  38275. scale10 = 0;
  38276. if (flags & 0x08) {
  38277. scaleX = scaleY = getFloat214(code, i);
  38278. i += 2;
  38279. } else if (flags & 0x40) {
  38280. scaleX = getFloat214(code, i);
  38281. scaleY = getFloat214(code, i + 2);
  38282. i += 4;
  38283. } else if (flags & 0x80) {
  38284. scaleX = getFloat214(code, i);
  38285. scale01 = getFloat214(code, i + 2);
  38286. scale10 = getFloat214(code, i + 4);
  38287. scaleY = getFloat214(code, i + 6);
  38288. i += 8;
  38289. }
  38290. const subglyph = font.glyphs[glyphIndex];
  38291. if (subglyph) {
  38292. cmds.push({
  38293. cmd: "save"
  38294. }, {
  38295. cmd: "transform",
  38296. args: [scaleX, scale01, scale10, scaleY, x, y]
  38297. });
  38298. if (!(flags & 0x02)) {}
  38299. compileGlyf(subglyph, cmds, font);
  38300. cmds.push({
  38301. cmd: "restore"
  38302. });
  38303. }
  38304. } while (flags & 0x20);
  38305. } else {
  38306. const endPtsOfContours = [];
  38307. let j, jj;
  38308. for (j = 0; j < numberOfContours; j++) {
  38309. endPtsOfContours.push(getUint16(code, i));
  38310. i += 2;
  38311. }
  38312. const instructionLength = getUint16(code, i);
  38313. i += 2 + instructionLength;
  38314. const numberOfPoints = endPtsOfContours.at(-1) + 1;
  38315. const points = [];
  38316. while (points.length < numberOfPoints) {
  38317. flags = code[i++];
  38318. let repeat = 1;
  38319. if (flags & 0x08) {
  38320. repeat += code[i++];
  38321. }
  38322. while (repeat-- > 0) {
  38323. points.push({
  38324. flags
  38325. });
  38326. }
  38327. }
  38328. for (j = 0; j < numberOfPoints; j++) {
  38329. switch (points[j].flags & 0x12) {
  38330. case 0x00:
  38331. x += getInt16(code, i);
  38332. i += 2;
  38333. break;
  38334. case 0x02:
  38335. x -= code[i++];
  38336. break;
  38337. case 0x12:
  38338. x += code[i++];
  38339. break;
  38340. }
  38341. points[j].x = x;
  38342. }
  38343. for (j = 0; j < numberOfPoints; j++) {
  38344. switch (points[j].flags & 0x24) {
  38345. case 0x00:
  38346. y += getInt16(code, i);
  38347. i += 2;
  38348. break;
  38349. case 0x04:
  38350. y -= code[i++];
  38351. break;
  38352. case 0x24:
  38353. y += code[i++];
  38354. break;
  38355. }
  38356. points[j].y = y;
  38357. }
  38358. let startPoint = 0;
  38359. for (i = 0; i < numberOfContours; i++) {
  38360. const endPoint = endPtsOfContours[i];
  38361. const contour = points.slice(startPoint, endPoint + 1);
  38362. if (contour[0].flags & 1) {
  38363. contour.push(contour[0]);
  38364. } else if (contour.at(-1).flags & 1) {
  38365. contour.unshift(contour.at(-1));
  38366. } else {
  38367. const p = {
  38368. flags: 1,
  38369. x: (contour[0].x + contour.at(-1).x) / 2,
  38370. y: (contour[0].y + contour.at(-1).y) / 2
  38371. };
  38372. contour.unshift(p);
  38373. contour.push(p);
  38374. }
  38375. moveTo(contour[0].x, contour[0].y);
  38376. for (j = 1, jj = contour.length; j < jj; j++) {
  38377. if (contour[j].flags & 1) {
  38378. lineTo(contour[j].x, contour[j].y);
  38379. } else if (contour[j + 1].flags & 1) {
  38380. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  38381. j++;
  38382. } else {
  38383. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  38384. }
  38385. }
  38386. startPoint = endPoint + 1;
  38387. }
  38388. }
  38389. }
  38390. function compileCharString(charStringCode, cmds, font, glyphId) {
  38391. function moveTo(x, y) {
  38392. cmds.push({
  38393. cmd: "moveTo",
  38394. args: [x, y]
  38395. });
  38396. }
  38397. function lineTo(x, y) {
  38398. cmds.push({
  38399. cmd: "lineTo",
  38400. args: [x, y]
  38401. });
  38402. }
  38403. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  38404. cmds.push({
  38405. cmd: "bezierCurveTo",
  38406. args: [x1, y1, x2, y2, x, y]
  38407. });
  38408. }
  38409. const stack = [];
  38410. let x = 0,
  38411. y = 0;
  38412. let stems = 0;
  38413. function parse(code) {
  38414. let i = 0;
  38415. while (i < code.length) {
  38416. let stackClean = false;
  38417. let v = code[i++];
  38418. let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  38419. switch (v) {
  38420. case 1:
  38421. stems += stack.length >> 1;
  38422. stackClean = true;
  38423. break;
  38424. case 3:
  38425. stems += stack.length >> 1;
  38426. stackClean = true;
  38427. break;
  38428. case 4:
  38429. y += stack.pop();
  38430. moveTo(x, y);
  38431. stackClean = true;
  38432. break;
  38433. case 5:
  38434. while (stack.length > 0) {
  38435. x += stack.shift();
  38436. y += stack.shift();
  38437. lineTo(x, y);
  38438. }
  38439. break;
  38440. case 6:
  38441. while (stack.length > 0) {
  38442. x += stack.shift();
  38443. lineTo(x, y);
  38444. if (stack.length === 0) {
  38445. break;
  38446. }
  38447. y += stack.shift();
  38448. lineTo(x, y);
  38449. }
  38450. break;
  38451. case 7:
  38452. while (stack.length > 0) {
  38453. y += stack.shift();
  38454. lineTo(x, y);
  38455. if (stack.length === 0) {
  38456. break;
  38457. }
  38458. x += stack.shift();
  38459. lineTo(x, y);
  38460. }
  38461. break;
  38462. case 8:
  38463. while (stack.length > 0) {
  38464. xa = x + stack.shift();
  38465. ya = y + stack.shift();
  38466. xb = xa + stack.shift();
  38467. yb = ya + stack.shift();
  38468. x = xb + stack.shift();
  38469. y = yb + stack.shift();
  38470. bezierCurveTo(xa, ya, xb, yb, x, y);
  38471. }
  38472. break;
  38473. case 10:
  38474. n = stack.pop();
  38475. subrCode = null;
  38476. if (font.isCFFCIDFont) {
  38477. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  38478. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  38479. const fontDict = font.fdArray[fdIndex];
  38480. let subrs;
  38481. if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
  38482. subrs = fontDict.privateDict.subrsIndex.objects;
  38483. }
  38484. if (subrs) {
  38485. n += getSubroutineBias(subrs);
  38486. subrCode = subrs[n];
  38487. }
  38488. } else {
  38489. (0, _util.warn)("Invalid fd index for glyph index.");
  38490. }
  38491. } else {
  38492. subrCode = font.subrs[n + font.subrsBias];
  38493. }
  38494. if (subrCode) {
  38495. parse(subrCode);
  38496. }
  38497. break;
  38498. case 11:
  38499. return;
  38500. case 12:
  38501. v = code[i++];
  38502. switch (v) {
  38503. case 34:
  38504. xa = x + stack.shift();
  38505. xb = xa + stack.shift();
  38506. y1 = y + stack.shift();
  38507. x = xb + stack.shift();
  38508. bezierCurveTo(xa, y, xb, y1, x, y1);
  38509. xa = x + stack.shift();
  38510. xb = xa + stack.shift();
  38511. x = xb + stack.shift();
  38512. bezierCurveTo(xa, y1, xb, y, x, y);
  38513. break;
  38514. case 35:
  38515. xa = x + stack.shift();
  38516. ya = y + stack.shift();
  38517. xb = xa + stack.shift();
  38518. yb = ya + stack.shift();
  38519. x = xb + stack.shift();
  38520. y = yb + stack.shift();
  38521. bezierCurveTo(xa, ya, xb, yb, x, y);
  38522. xa = x + stack.shift();
  38523. ya = y + stack.shift();
  38524. xb = xa + stack.shift();
  38525. yb = ya + stack.shift();
  38526. x = xb + stack.shift();
  38527. y = yb + stack.shift();
  38528. bezierCurveTo(xa, ya, xb, yb, x, y);
  38529. stack.pop();
  38530. break;
  38531. case 36:
  38532. xa = x + stack.shift();
  38533. y1 = y + stack.shift();
  38534. xb = xa + stack.shift();
  38535. y2 = y1 + stack.shift();
  38536. x = xb + stack.shift();
  38537. bezierCurveTo(xa, y1, xb, y2, x, y2);
  38538. xa = x + stack.shift();
  38539. xb = xa + stack.shift();
  38540. y3 = y2 + stack.shift();
  38541. x = xb + stack.shift();
  38542. bezierCurveTo(xa, y2, xb, y3, x, y);
  38543. break;
  38544. case 37:
  38545. const x0 = x,
  38546. y0 = y;
  38547. xa = x + stack.shift();
  38548. ya = y + stack.shift();
  38549. xb = xa + stack.shift();
  38550. yb = ya + stack.shift();
  38551. x = xb + stack.shift();
  38552. y = yb + stack.shift();
  38553. bezierCurveTo(xa, ya, xb, yb, x, y);
  38554. xa = x + stack.shift();
  38555. ya = y + stack.shift();
  38556. xb = xa + stack.shift();
  38557. yb = ya + stack.shift();
  38558. x = xb;
  38559. y = yb;
  38560. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  38561. x += stack.shift();
  38562. } else {
  38563. y += stack.shift();
  38564. }
  38565. bezierCurveTo(xa, ya, xb, yb, x, y);
  38566. break;
  38567. default:
  38568. throw new _util.FormatError(`unknown operator: 12 ${v}`);
  38569. }
  38570. break;
  38571. case 14:
  38572. if (stack.length >= 4) {
  38573. const achar = stack.pop();
  38574. const bchar = stack.pop();
  38575. y = stack.pop();
  38576. x = stack.pop();
  38577. cmds.push({
  38578. cmd: "save"
  38579. }, {
  38580. cmd: "translate",
  38581. args: [x, y]
  38582. });
  38583. let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
  38584. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  38585. cmds.push({
  38586. cmd: "restore"
  38587. });
  38588. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
  38589. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  38590. }
  38591. return;
  38592. case 18:
  38593. stems += stack.length >> 1;
  38594. stackClean = true;
  38595. break;
  38596. case 19:
  38597. stems += stack.length >> 1;
  38598. i += stems + 7 >> 3;
  38599. stackClean = true;
  38600. break;
  38601. case 20:
  38602. stems += stack.length >> 1;
  38603. i += stems + 7 >> 3;
  38604. stackClean = true;
  38605. break;
  38606. case 21:
  38607. y += stack.pop();
  38608. x += stack.pop();
  38609. moveTo(x, y);
  38610. stackClean = true;
  38611. break;
  38612. case 22:
  38613. x += stack.pop();
  38614. moveTo(x, y);
  38615. stackClean = true;
  38616. break;
  38617. case 23:
  38618. stems += stack.length >> 1;
  38619. stackClean = true;
  38620. break;
  38621. case 24:
  38622. while (stack.length > 2) {
  38623. xa = x + stack.shift();
  38624. ya = y + stack.shift();
  38625. xb = xa + stack.shift();
  38626. yb = ya + stack.shift();
  38627. x = xb + stack.shift();
  38628. y = yb + stack.shift();
  38629. bezierCurveTo(xa, ya, xb, yb, x, y);
  38630. }
  38631. x += stack.shift();
  38632. y += stack.shift();
  38633. lineTo(x, y);
  38634. break;
  38635. case 25:
  38636. while (stack.length > 6) {
  38637. x += stack.shift();
  38638. y += stack.shift();
  38639. lineTo(x, y);
  38640. }
  38641. xa = x + stack.shift();
  38642. ya = y + stack.shift();
  38643. xb = xa + stack.shift();
  38644. yb = ya + stack.shift();
  38645. x = xb + stack.shift();
  38646. y = yb + stack.shift();
  38647. bezierCurveTo(xa, ya, xb, yb, x, y);
  38648. break;
  38649. case 26:
  38650. if (stack.length % 2) {
  38651. x += stack.shift();
  38652. }
  38653. while (stack.length > 0) {
  38654. xa = x;
  38655. ya = y + stack.shift();
  38656. xb = xa + stack.shift();
  38657. yb = ya + stack.shift();
  38658. x = xb;
  38659. y = yb + stack.shift();
  38660. bezierCurveTo(xa, ya, xb, yb, x, y);
  38661. }
  38662. break;
  38663. case 27:
  38664. if (stack.length % 2) {
  38665. y += stack.shift();
  38666. }
  38667. while (stack.length > 0) {
  38668. xa = x + stack.shift();
  38669. ya = y;
  38670. xb = xa + stack.shift();
  38671. yb = ya + stack.shift();
  38672. x = xb + stack.shift();
  38673. y = yb;
  38674. bezierCurveTo(xa, ya, xb, yb, x, y);
  38675. }
  38676. break;
  38677. case 28:
  38678. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  38679. i += 2;
  38680. break;
  38681. case 29:
  38682. n = stack.pop() + font.gsubrsBias;
  38683. subrCode = font.gsubrs[n];
  38684. if (subrCode) {
  38685. parse(subrCode);
  38686. }
  38687. break;
  38688. case 30:
  38689. while (stack.length > 0) {
  38690. xa = x;
  38691. ya = y + stack.shift();
  38692. xb = xa + stack.shift();
  38693. yb = ya + stack.shift();
  38694. x = xb + stack.shift();
  38695. y = yb + (stack.length === 1 ? stack.shift() : 0);
  38696. bezierCurveTo(xa, ya, xb, yb, x, y);
  38697. if (stack.length === 0) {
  38698. break;
  38699. }
  38700. xa = x + stack.shift();
  38701. ya = y;
  38702. xb = xa + stack.shift();
  38703. yb = ya + stack.shift();
  38704. y = yb + stack.shift();
  38705. x = xb + (stack.length === 1 ? stack.shift() : 0);
  38706. bezierCurveTo(xa, ya, xb, yb, x, y);
  38707. }
  38708. break;
  38709. case 31:
  38710. while (stack.length > 0) {
  38711. xa = x + stack.shift();
  38712. ya = y;
  38713. xb = xa + stack.shift();
  38714. yb = ya + stack.shift();
  38715. y = yb + stack.shift();
  38716. x = xb + (stack.length === 1 ? stack.shift() : 0);
  38717. bezierCurveTo(xa, ya, xb, yb, x, y);
  38718. if (stack.length === 0) {
  38719. break;
  38720. }
  38721. xa = x;
  38722. ya = y + stack.shift();
  38723. xb = xa + stack.shift();
  38724. yb = ya + stack.shift();
  38725. x = xb + stack.shift();
  38726. y = yb + (stack.length === 1 ? stack.shift() : 0);
  38727. bezierCurveTo(xa, ya, xb, yb, x, y);
  38728. }
  38729. break;
  38730. default:
  38731. if (v < 32) {
  38732. throw new _util.FormatError(`unknown operator: ${v}`);
  38733. }
  38734. if (v < 247) {
  38735. stack.push(v - 139);
  38736. } else if (v < 251) {
  38737. stack.push((v - 247) * 256 + code[i++] + 108);
  38738. } else if (v < 255) {
  38739. stack.push(-(v - 251) * 256 - code[i++] - 108);
  38740. } else {
  38741. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  38742. i += 4;
  38743. }
  38744. break;
  38745. }
  38746. if (stackClean) {
  38747. stack.length = 0;
  38748. }
  38749. }
  38750. }
  38751. parse(charStringCode);
  38752. }
  38753. const NOOP = [];
  38754. class CompiledFont {
  38755. constructor(fontMatrix) {
  38756. if (this.constructor === CompiledFont) {
  38757. (0, _util.unreachable)("Cannot initialize CompiledFont.");
  38758. }
  38759. this.fontMatrix = fontMatrix;
  38760. this.compiledGlyphs = Object.create(null);
  38761. this.compiledCharCodeToGlyphId = Object.create(null);
  38762. }
  38763. getPathJs(unicode) {
  38764. const {
  38765. charCode,
  38766. glyphId
  38767. } = lookupCmap(this.cmap, unicode);
  38768. let fn = this.compiledGlyphs[glyphId];
  38769. if (!fn) {
  38770. try {
  38771. fn = this.compileGlyph(this.glyphs[glyphId], glyphId);
  38772. this.compiledGlyphs[glyphId] = fn;
  38773. } catch (ex) {
  38774. this.compiledGlyphs[glyphId] = NOOP;
  38775. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  38776. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  38777. }
  38778. throw ex;
  38779. }
  38780. }
  38781. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  38782. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  38783. }
  38784. return fn;
  38785. }
  38786. compileGlyph(code, glyphId) {
  38787. if (!code || code.length === 0 || code[0] === 14) {
  38788. return NOOP;
  38789. }
  38790. let fontMatrix = this.fontMatrix;
  38791. if (this.isCFFCIDFont) {
  38792. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  38793. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  38794. const fontDict = this.fdArray[fdIndex];
  38795. fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
  38796. } else {
  38797. (0, _util.warn)("Invalid fd index for glyph index.");
  38798. }
  38799. }
  38800. const cmds = [{
  38801. cmd: "save"
  38802. }, {
  38803. cmd: "transform",
  38804. args: fontMatrix.slice()
  38805. }, {
  38806. cmd: "scale",
  38807. args: ["size", "-size"]
  38808. }];
  38809. this.compileGlyphImpl(code, cmds, glyphId);
  38810. cmds.push({
  38811. cmd: "restore"
  38812. });
  38813. return cmds;
  38814. }
  38815. compileGlyphImpl() {
  38816. (0, _util.unreachable)("Children classes should implement this.");
  38817. }
  38818. hasBuiltPath(unicode) {
  38819. const {
  38820. charCode,
  38821. glyphId
  38822. } = lookupCmap(this.cmap, unicode);
  38823. return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined;
  38824. }
  38825. }
  38826. class TrueTypeCompiled extends CompiledFont {
  38827. constructor(glyphs, cmap, fontMatrix) {
  38828. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  38829. this.glyphs = glyphs;
  38830. this.cmap = cmap;
  38831. }
  38832. compileGlyphImpl(code, cmds) {
  38833. compileGlyf(code, cmds, this);
  38834. }
  38835. }
  38836. class Type2Compiled extends CompiledFont {
  38837. constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
  38838. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  38839. this.glyphs = cffInfo.glyphs;
  38840. this.gsubrs = cffInfo.gsubrs || [];
  38841. this.subrs = cffInfo.subrs || [];
  38842. this.cmap = cmap;
  38843. this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
  38844. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  38845. this.subrsBias = getSubroutineBias(this.subrs);
  38846. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  38847. this.fdSelect = cffInfo.fdSelect;
  38848. this.fdArray = cffInfo.fdArray;
  38849. }
  38850. compileGlyphImpl(code, cmds, glyphId) {
  38851. compileCharString(code, cmds, this, glyphId);
  38852. }
  38853. }
  38854. class FontRendererFactory {
  38855. static create(font, seacAnalysisEnabled) {
  38856. const data = new Uint8Array(font.data);
  38857. let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  38858. const numTables = getUint16(data, 4);
  38859. for (let i = 0, p = 12; i < numTables; i++, p += 16) {
  38860. const tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
  38861. const offset = getUint32(data, p + 8);
  38862. const length = getUint32(data, p + 12);
  38863. switch (tag) {
  38864. case "cmap":
  38865. cmap = parseCmap(data, offset, offset + length);
  38866. break;
  38867. case "glyf":
  38868. glyf = data.subarray(offset, offset + length);
  38869. break;
  38870. case "loca":
  38871. loca = data.subarray(offset, offset + length);
  38872. break;
  38873. case "head":
  38874. unitsPerEm = getUint16(data, offset + 18);
  38875. indexToLocFormat = getUint16(data, offset + 50);
  38876. break;
  38877. case "CFF ":
  38878. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  38879. break;
  38880. }
  38881. }
  38882. if (glyf) {
  38883. const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  38884. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  38885. }
  38886. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  38887. }
  38888. }
  38889. exports.FontRendererFactory = FontRendererFactory;
  38890. /***/ }),
  38891. /* 43 */
  38892. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38893. Object.defineProperty(exports, "__esModule", ({
  38894. value: true
  38895. }));
  38896. exports.getMetrics = exports.getFontBasicMetrics = void 0;
  38897. var _core_utils = __w_pdfjs_require__(4);
  38898. const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  38899. t.Courier = 600;
  38900. t["Courier-Bold"] = 600;
  38901. t["Courier-BoldOblique"] = 600;
  38902. t["Courier-Oblique"] = 600;
  38903. t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) {
  38904. t.space = 278;
  38905. t.exclam = 278;
  38906. t.quotedbl = 355;
  38907. t.numbersign = 556;
  38908. t.dollar = 556;
  38909. t.percent = 889;
  38910. t.ampersand = 667;
  38911. t.quoteright = 222;
  38912. t.parenleft = 333;
  38913. t.parenright = 333;
  38914. t.asterisk = 389;
  38915. t.plus = 584;
  38916. t.comma = 278;
  38917. t.hyphen = 333;
  38918. t.period = 278;
  38919. t.slash = 278;
  38920. t.zero = 556;
  38921. t.one = 556;
  38922. t.two = 556;
  38923. t.three = 556;
  38924. t.four = 556;
  38925. t.five = 556;
  38926. t.six = 556;
  38927. t.seven = 556;
  38928. t.eight = 556;
  38929. t.nine = 556;
  38930. t.colon = 278;
  38931. t.semicolon = 278;
  38932. t.less = 584;
  38933. t.equal = 584;
  38934. t.greater = 584;
  38935. t.question = 556;
  38936. t.at = 1015;
  38937. t.A = 667;
  38938. t.B = 667;
  38939. t.C = 722;
  38940. t.D = 722;
  38941. t.E = 667;
  38942. t.F = 611;
  38943. t.G = 778;
  38944. t.H = 722;
  38945. t.I = 278;
  38946. t.J = 500;
  38947. t.K = 667;
  38948. t.L = 556;
  38949. t.M = 833;
  38950. t.N = 722;
  38951. t.O = 778;
  38952. t.P = 667;
  38953. t.Q = 778;
  38954. t.R = 722;
  38955. t.S = 667;
  38956. t.T = 611;
  38957. t.U = 722;
  38958. t.V = 667;
  38959. t.W = 944;
  38960. t.X = 667;
  38961. t.Y = 667;
  38962. t.Z = 611;
  38963. t.bracketleft = 278;
  38964. t.backslash = 278;
  38965. t.bracketright = 278;
  38966. t.asciicircum = 469;
  38967. t.underscore = 556;
  38968. t.quoteleft = 222;
  38969. t.a = 556;
  38970. t.b = 556;
  38971. t.c = 500;
  38972. t.d = 556;
  38973. t.e = 556;
  38974. t.f = 278;
  38975. t.g = 556;
  38976. t.h = 556;
  38977. t.i = 222;
  38978. t.j = 222;
  38979. t.k = 500;
  38980. t.l = 222;
  38981. t.m = 833;
  38982. t.n = 556;
  38983. t.o = 556;
  38984. t.p = 556;
  38985. t.q = 556;
  38986. t.r = 333;
  38987. t.s = 500;
  38988. t.t = 278;
  38989. t.u = 556;
  38990. t.v = 500;
  38991. t.w = 722;
  38992. t.x = 500;
  38993. t.y = 500;
  38994. t.z = 500;
  38995. t.braceleft = 334;
  38996. t.bar = 260;
  38997. t.braceright = 334;
  38998. t.asciitilde = 584;
  38999. t.exclamdown = 333;
  39000. t.cent = 556;
  39001. t.sterling = 556;
  39002. t.fraction = 167;
  39003. t.yen = 556;
  39004. t.florin = 556;
  39005. t.section = 556;
  39006. t.currency = 556;
  39007. t.quotesingle = 191;
  39008. t.quotedblleft = 333;
  39009. t.guillemotleft = 556;
  39010. t.guilsinglleft = 333;
  39011. t.guilsinglright = 333;
  39012. t.fi = 500;
  39013. t.fl = 500;
  39014. t.endash = 556;
  39015. t.dagger = 556;
  39016. t.daggerdbl = 556;
  39017. t.periodcentered = 278;
  39018. t.paragraph = 537;
  39019. t.bullet = 350;
  39020. t.quotesinglbase = 222;
  39021. t.quotedblbase = 333;
  39022. t.quotedblright = 333;
  39023. t.guillemotright = 556;
  39024. t.ellipsis = 1000;
  39025. t.perthousand = 1000;
  39026. t.questiondown = 611;
  39027. t.grave = 333;
  39028. t.acute = 333;
  39029. t.circumflex = 333;
  39030. t.tilde = 333;
  39031. t.macron = 333;
  39032. t.breve = 333;
  39033. t.dotaccent = 333;
  39034. t.dieresis = 333;
  39035. t.ring = 333;
  39036. t.cedilla = 333;
  39037. t.hungarumlaut = 333;
  39038. t.ogonek = 333;
  39039. t.caron = 333;
  39040. t.emdash = 1000;
  39041. t.AE = 1000;
  39042. t.ordfeminine = 370;
  39043. t.Lslash = 556;
  39044. t.Oslash = 778;
  39045. t.OE = 1000;
  39046. t.ordmasculine = 365;
  39047. t.ae = 889;
  39048. t.dotlessi = 278;
  39049. t.lslash = 222;
  39050. t.oslash = 611;
  39051. t.oe = 944;
  39052. t.germandbls = 611;
  39053. t.Idieresis = 278;
  39054. t.eacute = 556;
  39055. t.abreve = 556;
  39056. t.uhungarumlaut = 556;
  39057. t.ecaron = 556;
  39058. t.Ydieresis = 667;
  39059. t.divide = 584;
  39060. t.Yacute = 667;
  39061. t.Acircumflex = 667;
  39062. t.aacute = 556;
  39063. t.Ucircumflex = 722;
  39064. t.yacute = 500;
  39065. t.scommaaccent = 500;
  39066. t.ecircumflex = 556;
  39067. t.Uring = 722;
  39068. t.Udieresis = 722;
  39069. t.aogonek = 556;
  39070. t.Uacute = 722;
  39071. t.uogonek = 556;
  39072. t.Edieresis = 667;
  39073. t.Dcroat = 722;
  39074. t.commaaccent = 250;
  39075. t.copyright = 737;
  39076. t.Emacron = 667;
  39077. t.ccaron = 500;
  39078. t.aring = 556;
  39079. t.Ncommaaccent = 722;
  39080. t.lacute = 222;
  39081. t.agrave = 556;
  39082. t.Tcommaaccent = 611;
  39083. t.Cacute = 722;
  39084. t.atilde = 556;
  39085. t.Edotaccent = 667;
  39086. t.scaron = 500;
  39087. t.scedilla = 500;
  39088. t.iacute = 278;
  39089. t.lozenge = 471;
  39090. t.Rcaron = 722;
  39091. t.Gcommaaccent = 778;
  39092. t.ucircumflex = 556;
  39093. t.acircumflex = 556;
  39094. t.Amacron = 667;
  39095. t.rcaron = 333;
  39096. t.ccedilla = 500;
  39097. t.Zdotaccent = 611;
  39098. t.Thorn = 667;
  39099. t.Omacron = 778;
  39100. t.Racute = 722;
  39101. t.Sacute = 667;
  39102. t.dcaron = 643;
  39103. t.Umacron = 722;
  39104. t.uring = 556;
  39105. t.threesuperior = 333;
  39106. t.Ograve = 778;
  39107. t.Agrave = 667;
  39108. t.Abreve = 667;
  39109. t.multiply = 584;
  39110. t.uacute = 556;
  39111. t.Tcaron = 611;
  39112. t.partialdiff = 476;
  39113. t.ydieresis = 500;
  39114. t.Nacute = 722;
  39115. t.icircumflex = 278;
  39116. t.Ecircumflex = 667;
  39117. t.adieresis = 556;
  39118. t.edieresis = 556;
  39119. t.cacute = 500;
  39120. t.nacute = 556;
  39121. t.umacron = 556;
  39122. t.Ncaron = 722;
  39123. t.Iacute = 278;
  39124. t.plusminus = 584;
  39125. t.brokenbar = 260;
  39126. t.registered = 737;
  39127. t.Gbreve = 778;
  39128. t.Idotaccent = 278;
  39129. t.summation = 600;
  39130. t.Egrave = 667;
  39131. t.racute = 333;
  39132. t.omacron = 556;
  39133. t.Zacute = 611;
  39134. t.Zcaron = 611;
  39135. t.greaterequal = 549;
  39136. t.Eth = 722;
  39137. t.Ccedilla = 722;
  39138. t.lcommaaccent = 222;
  39139. t.tcaron = 317;
  39140. t.eogonek = 556;
  39141. t.Uogonek = 722;
  39142. t.Aacute = 667;
  39143. t.Adieresis = 667;
  39144. t.egrave = 556;
  39145. t.zacute = 500;
  39146. t.iogonek = 222;
  39147. t.Oacute = 778;
  39148. t.oacute = 556;
  39149. t.amacron = 556;
  39150. t.sacute = 500;
  39151. t.idieresis = 278;
  39152. t.Ocircumflex = 778;
  39153. t.Ugrave = 722;
  39154. t.Delta = 612;
  39155. t.thorn = 556;
  39156. t.twosuperior = 333;
  39157. t.Odieresis = 778;
  39158. t.mu = 556;
  39159. t.igrave = 278;
  39160. t.ohungarumlaut = 556;
  39161. t.Eogonek = 667;
  39162. t.dcroat = 556;
  39163. t.threequarters = 834;
  39164. t.Scedilla = 667;
  39165. t.lcaron = 299;
  39166. t.Kcommaaccent = 667;
  39167. t.Lacute = 556;
  39168. t.trademark = 1000;
  39169. t.edotaccent = 556;
  39170. t.Igrave = 278;
  39171. t.Imacron = 278;
  39172. t.Lcaron = 556;
  39173. t.onehalf = 834;
  39174. t.lessequal = 549;
  39175. t.ocircumflex = 556;
  39176. t.ntilde = 556;
  39177. t.Uhungarumlaut = 722;
  39178. t.Eacute = 667;
  39179. t.emacron = 556;
  39180. t.gbreve = 556;
  39181. t.onequarter = 834;
  39182. t.Scaron = 667;
  39183. t.Scommaaccent = 667;
  39184. t.Ohungarumlaut = 778;
  39185. t.degree = 400;
  39186. t.ograve = 556;
  39187. t.Ccaron = 722;
  39188. t.ugrave = 556;
  39189. t.radical = 453;
  39190. t.Dcaron = 722;
  39191. t.rcommaaccent = 333;
  39192. t.Ntilde = 722;
  39193. t.otilde = 556;
  39194. t.Rcommaaccent = 722;
  39195. t.Lcommaaccent = 556;
  39196. t.Atilde = 667;
  39197. t.Aogonek = 667;
  39198. t.Aring = 667;
  39199. t.Otilde = 778;
  39200. t.zdotaccent = 500;
  39201. t.Ecaron = 667;
  39202. t.Iogonek = 278;
  39203. t.kcommaaccent = 500;
  39204. t.minus = 584;
  39205. t.Icircumflex = 278;
  39206. t.ncaron = 556;
  39207. t.tcommaaccent = 278;
  39208. t.logicalnot = 584;
  39209. t.odieresis = 556;
  39210. t.udieresis = 556;
  39211. t.notequal = 549;
  39212. t.gcommaaccent = 556;
  39213. t.eth = 556;
  39214. t.zcaron = 500;
  39215. t.ncommaaccent = 556;
  39216. t.onesuperior = 333;
  39217. t.imacron = 278;
  39218. t.Euro = 556;
  39219. });
  39220. t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39221. t.space = 278;
  39222. t.exclam = 333;
  39223. t.quotedbl = 474;
  39224. t.numbersign = 556;
  39225. t.dollar = 556;
  39226. t.percent = 889;
  39227. t.ampersand = 722;
  39228. t.quoteright = 278;
  39229. t.parenleft = 333;
  39230. t.parenright = 333;
  39231. t.asterisk = 389;
  39232. t.plus = 584;
  39233. t.comma = 278;
  39234. t.hyphen = 333;
  39235. t.period = 278;
  39236. t.slash = 278;
  39237. t.zero = 556;
  39238. t.one = 556;
  39239. t.two = 556;
  39240. t.three = 556;
  39241. t.four = 556;
  39242. t.five = 556;
  39243. t.six = 556;
  39244. t.seven = 556;
  39245. t.eight = 556;
  39246. t.nine = 556;
  39247. t.colon = 333;
  39248. t.semicolon = 333;
  39249. t.less = 584;
  39250. t.equal = 584;
  39251. t.greater = 584;
  39252. t.question = 611;
  39253. t.at = 975;
  39254. t.A = 722;
  39255. t.B = 722;
  39256. t.C = 722;
  39257. t.D = 722;
  39258. t.E = 667;
  39259. t.F = 611;
  39260. t.G = 778;
  39261. t.H = 722;
  39262. t.I = 278;
  39263. t.J = 556;
  39264. t.K = 722;
  39265. t.L = 611;
  39266. t.M = 833;
  39267. t.N = 722;
  39268. t.O = 778;
  39269. t.P = 667;
  39270. t.Q = 778;
  39271. t.R = 722;
  39272. t.S = 667;
  39273. t.T = 611;
  39274. t.U = 722;
  39275. t.V = 667;
  39276. t.W = 944;
  39277. t.X = 667;
  39278. t.Y = 667;
  39279. t.Z = 611;
  39280. t.bracketleft = 333;
  39281. t.backslash = 278;
  39282. t.bracketright = 333;
  39283. t.asciicircum = 584;
  39284. t.underscore = 556;
  39285. t.quoteleft = 278;
  39286. t.a = 556;
  39287. t.b = 611;
  39288. t.c = 556;
  39289. t.d = 611;
  39290. t.e = 556;
  39291. t.f = 333;
  39292. t.g = 611;
  39293. t.h = 611;
  39294. t.i = 278;
  39295. t.j = 278;
  39296. t.k = 556;
  39297. t.l = 278;
  39298. t.m = 889;
  39299. t.n = 611;
  39300. t.o = 611;
  39301. t.p = 611;
  39302. t.q = 611;
  39303. t.r = 389;
  39304. t.s = 556;
  39305. t.t = 333;
  39306. t.u = 611;
  39307. t.v = 556;
  39308. t.w = 778;
  39309. t.x = 556;
  39310. t.y = 556;
  39311. t.z = 500;
  39312. t.braceleft = 389;
  39313. t.bar = 280;
  39314. t.braceright = 389;
  39315. t.asciitilde = 584;
  39316. t.exclamdown = 333;
  39317. t.cent = 556;
  39318. t.sterling = 556;
  39319. t.fraction = 167;
  39320. t.yen = 556;
  39321. t.florin = 556;
  39322. t.section = 556;
  39323. t.currency = 556;
  39324. t.quotesingle = 238;
  39325. t.quotedblleft = 500;
  39326. t.guillemotleft = 556;
  39327. t.guilsinglleft = 333;
  39328. t.guilsinglright = 333;
  39329. t.fi = 611;
  39330. t.fl = 611;
  39331. t.endash = 556;
  39332. t.dagger = 556;
  39333. t.daggerdbl = 556;
  39334. t.periodcentered = 278;
  39335. t.paragraph = 556;
  39336. t.bullet = 350;
  39337. t.quotesinglbase = 278;
  39338. t.quotedblbase = 500;
  39339. t.quotedblright = 500;
  39340. t.guillemotright = 556;
  39341. t.ellipsis = 1000;
  39342. t.perthousand = 1000;
  39343. t.questiondown = 611;
  39344. t.grave = 333;
  39345. t.acute = 333;
  39346. t.circumflex = 333;
  39347. t.tilde = 333;
  39348. t.macron = 333;
  39349. t.breve = 333;
  39350. t.dotaccent = 333;
  39351. t.dieresis = 333;
  39352. t.ring = 333;
  39353. t.cedilla = 333;
  39354. t.hungarumlaut = 333;
  39355. t.ogonek = 333;
  39356. t.caron = 333;
  39357. t.emdash = 1000;
  39358. t.AE = 1000;
  39359. t.ordfeminine = 370;
  39360. t.Lslash = 611;
  39361. t.Oslash = 778;
  39362. t.OE = 1000;
  39363. t.ordmasculine = 365;
  39364. t.ae = 889;
  39365. t.dotlessi = 278;
  39366. t.lslash = 278;
  39367. t.oslash = 611;
  39368. t.oe = 944;
  39369. t.germandbls = 611;
  39370. t.Idieresis = 278;
  39371. t.eacute = 556;
  39372. t.abreve = 556;
  39373. t.uhungarumlaut = 611;
  39374. t.ecaron = 556;
  39375. t.Ydieresis = 667;
  39376. t.divide = 584;
  39377. t.Yacute = 667;
  39378. t.Acircumflex = 722;
  39379. t.aacute = 556;
  39380. t.Ucircumflex = 722;
  39381. t.yacute = 556;
  39382. t.scommaaccent = 556;
  39383. t.ecircumflex = 556;
  39384. t.Uring = 722;
  39385. t.Udieresis = 722;
  39386. t.aogonek = 556;
  39387. t.Uacute = 722;
  39388. t.uogonek = 611;
  39389. t.Edieresis = 667;
  39390. t.Dcroat = 722;
  39391. t.commaaccent = 250;
  39392. t.copyright = 737;
  39393. t.Emacron = 667;
  39394. t.ccaron = 556;
  39395. t.aring = 556;
  39396. t.Ncommaaccent = 722;
  39397. t.lacute = 278;
  39398. t.agrave = 556;
  39399. t.Tcommaaccent = 611;
  39400. t.Cacute = 722;
  39401. t.atilde = 556;
  39402. t.Edotaccent = 667;
  39403. t.scaron = 556;
  39404. t.scedilla = 556;
  39405. t.iacute = 278;
  39406. t.lozenge = 494;
  39407. t.Rcaron = 722;
  39408. t.Gcommaaccent = 778;
  39409. t.ucircumflex = 611;
  39410. t.acircumflex = 556;
  39411. t.Amacron = 722;
  39412. t.rcaron = 389;
  39413. t.ccedilla = 556;
  39414. t.Zdotaccent = 611;
  39415. t.Thorn = 667;
  39416. t.Omacron = 778;
  39417. t.Racute = 722;
  39418. t.Sacute = 667;
  39419. t.dcaron = 743;
  39420. t.Umacron = 722;
  39421. t.uring = 611;
  39422. t.threesuperior = 333;
  39423. t.Ograve = 778;
  39424. t.Agrave = 722;
  39425. t.Abreve = 722;
  39426. t.multiply = 584;
  39427. t.uacute = 611;
  39428. t.Tcaron = 611;
  39429. t.partialdiff = 494;
  39430. t.ydieresis = 556;
  39431. t.Nacute = 722;
  39432. t.icircumflex = 278;
  39433. t.Ecircumflex = 667;
  39434. t.adieresis = 556;
  39435. t.edieresis = 556;
  39436. t.cacute = 556;
  39437. t.nacute = 611;
  39438. t.umacron = 611;
  39439. t.Ncaron = 722;
  39440. t.Iacute = 278;
  39441. t.plusminus = 584;
  39442. t.brokenbar = 280;
  39443. t.registered = 737;
  39444. t.Gbreve = 778;
  39445. t.Idotaccent = 278;
  39446. t.summation = 600;
  39447. t.Egrave = 667;
  39448. t.racute = 389;
  39449. t.omacron = 611;
  39450. t.Zacute = 611;
  39451. t.Zcaron = 611;
  39452. t.greaterequal = 549;
  39453. t.Eth = 722;
  39454. t.Ccedilla = 722;
  39455. t.lcommaaccent = 278;
  39456. t.tcaron = 389;
  39457. t.eogonek = 556;
  39458. t.Uogonek = 722;
  39459. t.Aacute = 722;
  39460. t.Adieresis = 722;
  39461. t.egrave = 556;
  39462. t.zacute = 500;
  39463. t.iogonek = 278;
  39464. t.Oacute = 778;
  39465. t.oacute = 611;
  39466. t.amacron = 556;
  39467. t.sacute = 556;
  39468. t.idieresis = 278;
  39469. t.Ocircumflex = 778;
  39470. t.Ugrave = 722;
  39471. t.Delta = 612;
  39472. t.thorn = 611;
  39473. t.twosuperior = 333;
  39474. t.Odieresis = 778;
  39475. t.mu = 611;
  39476. t.igrave = 278;
  39477. t.ohungarumlaut = 611;
  39478. t.Eogonek = 667;
  39479. t.dcroat = 611;
  39480. t.threequarters = 834;
  39481. t.Scedilla = 667;
  39482. t.lcaron = 400;
  39483. t.Kcommaaccent = 722;
  39484. t.Lacute = 611;
  39485. t.trademark = 1000;
  39486. t.edotaccent = 556;
  39487. t.Igrave = 278;
  39488. t.Imacron = 278;
  39489. t.Lcaron = 611;
  39490. t.onehalf = 834;
  39491. t.lessequal = 549;
  39492. t.ocircumflex = 611;
  39493. t.ntilde = 611;
  39494. t.Uhungarumlaut = 722;
  39495. t.Eacute = 667;
  39496. t.emacron = 556;
  39497. t.gbreve = 611;
  39498. t.onequarter = 834;
  39499. t.Scaron = 667;
  39500. t.Scommaaccent = 667;
  39501. t.Ohungarumlaut = 778;
  39502. t.degree = 400;
  39503. t.ograve = 611;
  39504. t.Ccaron = 722;
  39505. t.ugrave = 611;
  39506. t.radical = 549;
  39507. t.Dcaron = 722;
  39508. t.rcommaaccent = 389;
  39509. t.Ntilde = 722;
  39510. t.otilde = 611;
  39511. t.Rcommaaccent = 722;
  39512. t.Lcommaaccent = 611;
  39513. t.Atilde = 722;
  39514. t.Aogonek = 722;
  39515. t.Aring = 722;
  39516. t.Otilde = 778;
  39517. t.zdotaccent = 500;
  39518. t.Ecaron = 667;
  39519. t.Iogonek = 278;
  39520. t.kcommaaccent = 556;
  39521. t.minus = 584;
  39522. t.Icircumflex = 278;
  39523. t.ncaron = 611;
  39524. t.tcommaaccent = 333;
  39525. t.logicalnot = 584;
  39526. t.odieresis = 611;
  39527. t.udieresis = 611;
  39528. t.notequal = 549;
  39529. t.gcommaaccent = 611;
  39530. t.eth = 611;
  39531. t.zcaron = 500;
  39532. t.ncommaaccent = 611;
  39533. t.onesuperior = 333;
  39534. t.imacron = 278;
  39535. t.Euro = 556;
  39536. });
  39537. t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39538. t.space = 278;
  39539. t.exclam = 333;
  39540. t.quotedbl = 474;
  39541. t.numbersign = 556;
  39542. t.dollar = 556;
  39543. t.percent = 889;
  39544. t.ampersand = 722;
  39545. t.quoteright = 278;
  39546. t.parenleft = 333;
  39547. t.parenright = 333;
  39548. t.asterisk = 389;
  39549. t.plus = 584;
  39550. t.comma = 278;
  39551. t.hyphen = 333;
  39552. t.period = 278;
  39553. t.slash = 278;
  39554. t.zero = 556;
  39555. t.one = 556;
  39556. t.two = 556;
  39557. t.three = 556;
  39558. t.four = 556;
  39559. t.five = 556;
  39560. t.six = 556;
  39561. t.seven = 556;
  39562. t.eight = 556;
  39563. t.nine = 556;
  39564. t.colon = 333;
  39565. t.semicolon = 333;
  39566. t.less = 584;
  39567. t.equal = 584;
  39568. t.greater = 584;
  39569. t.question = 611;
  39570. t.at = 975;
  39571. t.A = 722;
  39572. t.B = 722;
  39573. t.C = 722;
  39574. t.D = 722;
  39575. t.E = 667;
  39576. t.F = 611;
  39577. t.G = 778;
  39578. t.H = 722;
  39579. t.I = 278;
  39580. t.J = 556;
  39581. t.K = 722;
  39582. t.L = 611;
  39583. t.M = 833;
  39584. t.N = 722;
  39585. t.O = 778;
  39586. t.P = 667;
  39587. t.Q = 778;
  39588. t.R = 722;
  39589. t.S = 667;
  39590. t.T = 611;
  39591. t.U = 722;
  39592. t.V = 667;
  39593. t.W = 944;
  39594. t.X = 667;
  39595. t.Y = 667;
  39596. t.Z = 611;
  39597. t.bracketleft = 333;
  39598. t.backslash = 278;
  39599. t.bracketright = 333;
  39600. t.asciicircum = 584;
  39601. t.underscore = 556;
  39602. t.quoteleft = 278;
  39603. t.a = 556;
  39604. t.b = 611;
  39605. t.c = 556;
  39606. t.d = 611;
  39607. t.e = 556;
  39608. t.f = 333;
  39609. t.g = 611;
  39610. t.h = 611;
  39611. t.i = 278;
  39612. t.j = 278;
  39613. t.k = 556;
  39614. t.l = 278;
  39615. t.m = 889;
  39616. t.n = 611;
  39617. t.o = 611;
  39618. t.p = 611;
  39619. t.q = 611;
  39620. t.r = 389;
  39621. t.s = 556;
  39622. t.t = 333;
  39623. t.u = 611;
  39624. t.v = 556;
  39625. t.w = 778;
  39626. t.x = 556;
  39627. t.y = 556;
  39628. t.z = 500;
  39629. t.braceleft = 389;
  39630. t.bar = 280;
  39631. t.braceright = 389;
  39632. t.asciitilde = 584;
  39633. t.exclamdown = 333;
  39634. t.cent = 556;
  39635. t.sterling = 556;
  39636. t.fraction = 167;
  39637. t.yen = 556;
  39638. t.florin = 556;
  39639. t.section = 556;
  39640. t.currency = 556;
  39641. t.quotesingle = 238;
  39642. t.quotedblleft = 500;
  39643. t.guillemotleft = 556;
  39644. t.guilsinglleft = 333;
  39645. t.guilsinglright = 333;
  39646. t.fi = 611;
  39647. t.fl = 611;
  39648. t.endash = 556;
  39649. t.dagger = 556;
  39650. t.daggerdbl = 556;
  39651. t.periodcentered = 278;
  39652. t.paragraph = 556;
  39653. t.bullet = 350;
  39654. t.quotesinglbase = 278;
  39655. t.quotedblbase = 500;
  39656. t.quotedblright = 500;
  39657. t.guillemotright = 556;
  39658. t.ellipsis = 1000;
  39659. t.perthousand = 1000;
  39660. t.questiondown = 611;
  39661. t.grave = 333;
  39662. t.acute = 333;
  39663. t.circumflex = 333;
  39664. t.tilde = 333;
  39665. t.macron = 333;
  39666. t.breve = 333;
  39667. t.dotaccent = 333;
  39668. t.dieresis = 333;
  39669. t.ring = 333;
  39670. t.cedilla = 333;
  39671. t.hungarumlaut = 333;
  39672. t.ogonek = 333;
  39673. t.caron = 333;
  39674. t.emdash = 1000;
  39675. t.AE = 1000;
  39676. t.ordfeminine = 370;
  39677. t.Lslash = 611;
  39678. t.Oslash = 778;
  39679. t.OE = 1000;
  39680. t.ordmasculine = 365;
  39681. t.ae = 889;
  39682. t.dotlessi = 278;
  39683. t.lslash = 278;
  39684. t.oslash = 611;
  39685. t.oe = 944;
  39686. t.germandbls = 611;
  39687. t.Idieresis = 278;
  39688. t.eacute = 556;
  39689. t.abreve = 556;
  39690. t.uhungarumlaut = 611;
  39691. t.ecaron = 556;
  39692. t.Ydieresis = 667;
  39693. t.divide = 584;
  39694. t.Yacute = 667;
  39695. t.Acircumflex = 722;
  39696. t.aacute = 556;
  39697. t.Ucircumflex = 722;
  39698. t.yacute = 556;
  39699. t.scommaaccent = 556;
  39700. t.ecircumflex = 556;
  39701. t.Uring = 722;
  39702. t.Udieresis = 722;
  39703. t.aogonek = 556;
  39704. t.Uacute = 722;
  39705. t.uogonek = 611;
  39706. t.Edieresis = 667;
  39707. t.Dcroat = 722;
  39708. t.commaaccent = 250;
  39709. t.copyright = 737;
  39710. t.Emacron = 667;
  39711. t.ccaron = 556;
  39712. t.aring = 556;
  39713. t.Ncommaaccent = 722;
  39714. t.lacute = 278;
  39715. t.agrave = 556;
  39716. t.Tcommaaccent = 611;
  39717. t.Cacute = 722;
  39718. t.atilde = 556;
  39719. t.Edotaccent = 667;
  39720. t.scaron = 556;
  39721. t.scedilla = 556;
  39722. t.iacute = 278;
  39723. t.lozenge = 494;
  39724. t.Rcaron = 722;
  39725. t.Gcommaaccent = 778;
  39726. t.ucircumflex = 611;
  39727. t.acircumflex = 556;
  39728. t.Amacron = 722;
  39729. t.rcaron = 389;
  39730. t.ccedilla = 556;
  39731. t.Zdotaccent = 611;
  39732. t.Thorn = 667;
  39733. t.Omacron = 778;
  39734. t.Racute = 722;
  39735. t.Sacute = 667;
  39736. t.dcaron = 743;
  39737. t.Umacron = 722;
  39738. t.uring = 611;
  39739. t.threesuperior = 333;
  39740. t.Ograve = 778;
  39741. t.Agrave = 722;
  39742. t.Abreve = 722;
  39743. t.multiply = 584;
  39744. t.uacute = 611;
  39745. t.Tcaron = 611;
  39746. t.partialdiff = 494;
  39747. t.ydieresis = 556;
  39748. t.Nacute = 722;
  39749. t.icircumflex = 278;
  39750. t.Ecircumflex = 667;
  39751. t.adieresis = 556;
  39752. t.edieresis = 556;
  39753. t.cacute = 556;
  39754. t.nacute = 611;
  39755. t.umacron = 611;
  39756. t.Ncaron = 722;
  39757. t.Iacute = 278;
  39758. t.plusminus = 584;
  39759. t.brokenbar = 280;
  39760. t.registered = 737;
  39761. t.Gbreve = 778;
  39762. t.Idotaccent = 278;
  39763. t.summation = 600;
  39764. t.Egrave = 667;
  39765. t.racute = 389;
  39766. t.omacron = 611;
  39767. t.Zacute = 611;
  39768. t.Zcaron = 611;
  39769. t.greaterequal = 549;
  39770. t.Eth = 722;
  39771. t.Ccedilla = 722;
  39772. t.lcommaaccent = 278;
  39773. t.tcaron = 389;
  39774. t.eogonek = 556;
  39775. t.Uogonek = 722;
  39776. t.Aacute = 722;
  39777. t.Adieresis = 722;
  39778. t.egrave = 556;
  39779. t.zacute = 500;
  39780. t.iogonek = 278;
  39781. t.Oacute = 778;
  39782. t.oacute = 611;
  39783. t.amacron = 556;
  39784. t.sacute = 556;
  39785. t.idieresis = 278;
  39786. t.Ocircumflex = 778;
  39787. t.Ugrave = 722;
  39788. t.Delta = 612;
  39789. t.thorn = 611;
  39790. t.twosuperior = 333;
  39791. t.Odieresis = 778;
  39792. t.mu = 611;
  39793. t.igrave = 278;
  39794. t.ohungarumlaut = 611;
  39795. t.Eogonek = 667;
  39796. t.dcroat = 611;
  39797. t.threequarters = 834;
  39798. t.Scedilla = 667;
  39799. t.lcaron = 400;
  39800. t.Kcommaaccent = 722;
  39801. t.Lacute = 611;
  39802. t.trademark = 1000;
  39803. t.edotaccent = 556;
  39804. t.Igrave = 278;
  39805. t.Imacron = 278;
  39806. t.Lcaron = 611;
  39807. t.onehalf = 834;
  39808. t.lessequal = 549;
  39809. t.ocircumflex = 611;
  39810. t.ntilde = 611;
  39811. t.Uhungarumlaut = 722;
  39812. t.Eacute = 667;
  39813. t.emacron = 556;
  39814. t.gbreve = 611;
  39815. t.onequarter = 834;
  39816. t.Scaron = 667;
  39817. t.Scommaaccent = 667;
  39818. t.Ohungarumlaut = 778;
  39819. t.degree = 400;
  39820. t.ograve = 611;
  39821. t.Ccaron = 722;
  39822. t.ugrave = 611;
  39823. t.radical = 549;
  39824. t.Dcaron = 722;
  39825. t.rcommaaccent = 389;
  39826. t.Ntilde = 722;
  39827. t.otilde = 611;
  39828. t.Rcommaaccent = 722;
  39829. t.Lcommaaccent = 611;
  39830. t.Atilde = 722;
  39831. t.Aogonek = 722;
  39832. t.Aring = 722;
  39833. t.Otilde = 778;
  39834. t.zdotaccent = 500;
  39835. t.Ecaron = 667;
  39836. t.Iogonek = 278;
  39837. t.kcommaaccent = 556;
  39838. t.minus = 584;
  39839. t.Icircumflex = 278;
  39840. t.ncaron = 611;
  39841. t.tcommaaccent = 333;
  39842. t.logicalnot = 584;
  39843. t.odieresis = 611;
  39844. t.udieresis = 611;
  39845. t.notequal = 549;
  39846. t.gcommaaccent = 611;
  39847. t.eth = 611;
  39848. t.zcaron = 500;
  39849. t.ncommaaccent = 611;
  39850. t.onesuperior = 333;
  39851. t.imacron = 278;
  39852. t.Euro = 556;
  39853. });
  39854. t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39855. t.space = 278;
  39856. t.exclam = 278;
  39857. t.quotedbl = 355;
  39858. t.numbersign = 556;
  39859. t.dollar = 556;
  39860. t.percent = 889;
  39861. t.ampersand = 667;
  39862. t.quoteright = 222;
  39863. t.parenleft = 333;
  39864. t.parenright = 333;
  39865. t.asterisk = 389;
  39866. t.plus = 584;
  39867. t.comma = 278;
  39868. t.hyphen = 333;
  39869. t.period = 278;
  39870. t.slash = 278;
  39871. t.zero = 556;
  39872. t.one = 556;
  39873. t.two = 556;
  39874. t.three = 556;
  39875. t.four = 556;
  39876. t.five = 556;
  39877. t.six = 556;
  39878. t.seven = 556;
  39879. t.eight = 556;
  39880. t.nine = 556;
  39881. t.colon = 278;
  39882. t.semicolon = 278;
  39883. t.less = 584;
  39884. t.equal = 584;
  39885. t.greater = 584;
  39886. t.question = 556;
  39887. t.at = 1015;
  39888. t.A = 667;
  39889. t.B = 667;
  39890. t.C = 722;
  39891. t.D = 722;
  39892. t.E = 667;
  39893. t.F = 611;
  39894. t.G = 778;
  39895. t.H = 722;
  39896. t.I = 278;
  39897. t.J = 500;
  39898. t.K = 667;
  39899. t.L = 556;
  39900. t.M = 833;
  39901. t.N = 722;
  39902. t.O = 778;
  39903. t.P = 667;
  39904. t.Q = 778;
  39905. t.R = 722;
  39906. t.S = 667;
  39907. t.T = 611;
  39908. t.U = 722;
  39909. t.V = 667;
  39910. t.W = 944;
  39911. t.X = 667;
  39912. t.Y = 667;
  39913. t.Z = 611;
  39914. t.bracketleft = 278;
  39915. t.backslash = 278;
  39916. t.bracketright = 278;
  39917. t.asciicircum = 469;
  39918. t.underscore = 556;
  39919. t.quoteleft = 222;
  39920. t.a = 556;
  39921. t.b = 556;
  39922. t.c = 500;
  39923. t.d = 556;
  39924. t.e = 556;
  39925. t.f = 278;
  39926. t.g = 556;
  39927. t.h = 556;
  39928. t.i = 222;
  39929. t.j = 222;
  39930. t.k = 500;
  39931. t.l = 222;
  39932. t.m = 833;
  39933. t.n = 556;
  39934. t.o = 556;
  39935. t.p = 556;
  39936. t.q = 556;
  39937. t.r = 333;
  39938. t.s = 500;
  39939. t.t = 278;
  39940. t.u = 556;
  39941. t.v = 500;
  39942. t.w = 722;
  39943. t.x = 500;
  39944. t.y = 500;
  39945. t.z = 500;
  39946. t.braceleft = 334;
  39947. t.bar = 260;
  39948. t.braceright = 334;
  39949. t.asciitilde = 584;
  39950. t.exclamdown = 333;
  39951. t.cent = 556;
  39952. t.sterling = 556;
  39953. t.fraction = 167;
  39954. t.yen = 556;
  39955. t.florin = 556;
  39956. t.section = 556;
  39957. t.currency = 556;
  39958. t.quotesingle = 191;
  39959. t.quotedblleft = 333;
  39960. t.guillemotleft = 556;
  39961. t.guilsinglleft = 333;
  39962. t.guilsinglright = 333;
  39963. t.fi = 500;
  39964. t.fl = 500;
  39965. t.endash = 556;
  39966. t.dagger = 556;
  39967. t.daggerdbl = 556;
  39968. t.periodcentered = 278;
  39969. t.paragraph = 537;
  39970. t.bullet = 350;
  39971. t.quotesinglbase = 222;
  39972. t.quotedblbase = 333;
  39973. t.quotedblright = 333;
  39974. t.guillemotright = 556;
  39975. t.ellipsis = 1000;
  39976. t.perthousand = 1000;
  39977. t.questiondown = 611;
  39978. t.grave = 333;
  39979. t.acute = 333;
  39980. t.circumflex = 333;
  39981. t.tilde = 333;
  39982. t.macron = 333;
  39983. t.breve = 333;
  39984. t.dotaccent = 333;
  39985. t.dieresis = 333;
  39986. t.ring = 333;
  39987. t.cedilla = 333;
  39988. t.hungarumlaut = 333;
  39989. t.ogonek = 333;
  39990. t.caron = 333;
  39991. t.emdash = 1000;
  39992. t.AE = 1000;
  39993. t.ordfeminine = 370;
  39994. t.Lslash = 556;
  39995. t.Oslash = 778;
  39996. t.OE = 1000;
  39997. t.ordmasculine = 365;
  39998. t.ae = 889;
  39999. t.dotlessi = 278;
  40000. t.lslash = 222;
  40001. t.oslash = 611;
  40002. t.oe = 944;
  40003. t.germandbls = 611;
  40004. t.Idieresis = 278;
  40005. t.eacute = 556;
  40006. t.abreve = 556;
  40007. t.uhungarumlaut = 556;
  40008. t.ecaron = 556;
  40009. t.Ydieresis = 667;
  40010. t.divide = 584;
  40011. t.Yacute = 667;
  40012. t.Acircumflex = 667;
  40013. t.aacute = 556;
  40014. t.Ucircumflex = 722;
  40015. t.yacute = 500;
  40016. t.scommaaccent = 500;
  40017. t.ecircumflex = 556;
  40018. t.Uring = 722;
  40019. t.Udieresis = 722;
  40020. t.aogonek = 556;
  40021. t.Uacute = 722;
  40022. t.uogonek = 556;
  40023. t.Edieresis = 667;
  40024. t.Dcroat = 722;
  40025. t.commaaccent = 250;
  40026. t.copyright = 737;
  40027. t.Emacron = 667;
  40028. t.ccaron = 500;
  40029. t.aring = 556;
  40030. t.Ncommaaccent = 722;
  40031. t.lacute = 222;
  40032. t.agrave = 556;
  40033. t.Tcommaaccent = 611;
  40034. t.Cacute = 722;
  40035. t.atilde = 556;
  40036. t.Edotaccent = 667;
  40037. t.scaron = 500;
  40038. t.scedilla = 500;
  40039. t.iacute = 278;
  40040. t.lozenge = 471;
  40041. t.Rcaron = 722;
  40042. t.Gcommaaccent = 778;
  40043. t.ucircumflex = 556;
  40044. t.acircumflex = 556;
  40045. t.Amacron = 667;
  40046. t.rcaron = 333;
  40047. t.ccedilla = 500;
  40048. t.Zdotaccent = 611;
  40049. t.Thorn = 667;
  40050. t.Omacron = 778;
  40051. t.Racute = 722;
  40052. t.Sacute = 667;
  40053. t.dcaron = 643;
  40054. t.Umacron = 722;
  40055. t.uring = 556;
  40056. t.threesuperior = 333;
  40057. t.Ograve = 778;
  40058. t.Agrave = 667;
  40059. t.Abreve = 667;
  40060. t.multiply = 584;
  40061. t.uacute = 556;
  40062. t.Tcaron = 611;
  40063. t.partialdiff = 476;
  40064. t.ydieresis = 500;
  40065. t.Nacute = 722;
  40066. t.icircumflex = 278;
  40067. t.Ecircumflex = 667;
  40068. t.adieresis = 556;
  40069. t.edieresis = 556;
  40070. t.cacute = 500;
  40071. t.nacute = 556;
  40072. t.umacron = 556;
  40073. t.Ncaron = 722;
  40074. t.Iacute = 278;
  40075. t.plusminus = 584;
  40076. t.brokenbar = 260;
  40077. t.registered = 737;
  40078. t.Gbreve = 778;
  40079. t.Idotaccent = 278;
  40080. t.summation = 600;
  40081. t.Egrave = 667;
  40082. t.racute = 333;
  40083. t.omacron = 556;
  40084. t.Zacute = 611;
  40085. t.Zcaron = 611;
  40086. t.greaterequal = 549;
  40087. t.Eth = 722;
  40088. t.Ccedilla = 722;
  40089. t.lcommaaccent = 222;
  40090. t.tcaron = 317;
  40091. t.eogonek = 556;
  40092. t.Uogonek = 722;
  40093. t.Aacute = 667;
  40094. t.Adieresis = 667;
  40095. t.egrave = 556;
  40096. t.zacute = 500;
  40097. t.iogonek = 222;
  40098. t.Oacute = 778;
  40099. t.oacute = 556;
  40100. t.amacron = 556;
  40101. t.sacute = 500;
  40102. t.idieresis = 278;
  40103. t.Ocircumflex = 778;
  40104. t.Ugrave = 722;
  40105. t.Delta = 612;
  40106. t.thorn = 556;
  40107. t.twosuperior = 333;
  40108. t.Odieresis = 778;
  40109. t.mu = 556;
  40110. t.igrave = 278;
  40111. t.ohungarumlaut = 556;
  40112. t.Eogonek = 667;
  40113. t.dcroat = 556;
  40114. t.threequarters = 834;
  40115. t.Scedilla = 667;
  40116. t.lcaron = 299;
  40117. t.Kcommaaccent = 667;
  40118. t.Lacute = 556;
  40119. t.trademark = 1000;
  40120. t.edotaccent = 556;
  40121. t.Igrave = 278;
  40122. t.Imacron = 278;
  40123. t.Lcaron = 556;
  40124. t.onehalf = 834;
  40125. t.lessequal = 549;
  40126. t.ocircumflex = 556;
  40127. t.ntilde = 556;
  40128. t.Uhungarumlaut = 722;
  40129. t.Eacute = 667;
  40130. t.emacron = 556;
  40131. t.gbreve = 556;
  40132. t.onequarter = 834;
  40133. t.Scaron = 667;
  40134. t.Scommaaccent = 667;
  40135. t.Ohungarumlaut = 778;
  40136. t.degree = 400;
  40137. t.ograve = 556;
  40138. t.Ccaron = 722;
  40139. t.ugrave = 556;
  40140. t.radical = 453;
  40141. t.Dcaron = 722;
  40142. t.rcommaaccent = 333;
  40143. t.Ntilde = 722;
  40144. t.otilde = 556;
  40145. t.Rcommaaccent = 722;
  40146. t.Lcommaaccent = 556;
  40147. t.Atilde = 667;
  40148. t.Aogonek = 667;
  40149. t.Aring = 667;
  40150. t.Otilde = 778;
  40151. t.zdotaccent = 500;
  40152. t.Ecaron = 667;
  40153. t.Iogonek = 278;
  40154. t.kcommaaccent = 500;
  40155. t.minus = 584;
  40156. t.Icircumflex = 278;
  40157. t.ncaron = 556;
  40158. t.tcommaaccent = 278;
  40159. t.logicalnot = 584;
  40160. t.odieresis = 556;
  40161. t.udieresis = 556;
  40162. t.notequal = 549;
  40163. t.gcommaaccent = 556;
  40164. t.eth = 556;
  40165. t.zcaron = 500;
  40166. t.ncommaaccent = 556;
  40167. t.onesuperior = 333;
  40168. t.imacron = 278;
  40169. t.Euro = 556;
  40170. });
  40171. t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) {
  40172. t.space = 250;
  40173. t.exclam = 333;
  40174. t.universal = 713;
  40175. t.numbersign = 500;
  40176. t.existential = 549;
  40177. t.percent = 833;
  40178. t.ampersand = 778;
  40179. t.suchthat = 439;
  40180. t.parenleft = 333;
  40181. t.parenright = 333;
  40182. t.asteriskmath = 500;
  40183. t.plus = 549;
  40184. t.comma = 250;
  40185. t.minus = 549;
  40186. t.period = 250;
  40187. t.slash = 278;
  40188. t.zero = 500;
  40189. t.one = 500;
  40190. t.two = 500;
  40191. t.three = 500;
  40192. t.four = 500;
  40193. t.five = 500;
  40194. t.six = 500;
  40195. t.seven = 500;
  40196. t.eight = 500;
  40197. t.nine = 500;
  40198. t.colon = 278;
  40199. t.semicolon = 278;
  40200. t.less = 549;
  40201. t.equal = 549;
  40202. t.greater = 549;
  40203. t.question = 444;
  40204. t.congruent = 549;
  40205. t.Alpha = 722;
  40206. t.Beta = 667;
  40207. t.Chi = 722;
  40208. t.Delta = 612;
  40209. t.Epsilon = 611;
  40210. t.Phi = 763;
  40211. t.Gamma = 603;
  40212. t.Eta = 722;
  40213. t.Iota = 333;
  40214. t.theta1 = 631;
  40215. t.Kappa = 722;
  40216. t.Lambda = 686;
  40217. t.Mu = 889;
  40218. t.Nu = 722;
  40219. t.Omicron = 722;
  40220. t.Pi = 768;
  40221. t.Theta = 741;
  40222. t.Rho = 556;
  40223. t.Sigma = 592;
  40224. t.Tau = 611;
  40225. t.Upsilon = 690;
  40226. t.sigma1 = 439;
  40227. t.Omega = 768;
  40228. t.Xi = 645;
  40229. t.Psi = 795;
  40230. t.Zeta = 611;
  40231. t.bracketleft = 333;
  40232. t.therefore = 863;
  40233. t.bracketright = 333;
  40234. t.perpendicular = 658;
  40235. t.underscore = 500;
  40236. t.radicalex = 500;
  40237. t.alpha = 631;
  40238. t.beta = 549;
  40239. t.chi = 549;
  40240. t.delta = 494;
  40241. t.epsilon = 439;
  40242. t.phi = 521;
  40243. t.gamma = 411;
  40244. t.eta = 603;
  40245. t.iota = 329;
  40246. t.phi1 = 603;
  40247. t.kappa = 549;
  40248. t.lambda = 549;
  40249. t.mu = 576;
  40250. t.nu = 521;
  40251. t.omicron = 549;
  40252. t.pi = 549;
  40253. t.theta = 521;
  40254. t.rho = 549;
  40255. t.sigma = 603;
  40256. t.tau = 439;
  40257. t.upsilon = 576;
  40258. t.omega1 = 713;
  40259. t.omega = 686;
  40260. t.xi = 493;
  40261. t.psi = 686;
  40262. t.zeta = 494;
  40263. t.braceleft = 480;
  40264. t.bar = 200;
  40265. t.braceright = 480;
  40266. t.similar = 549;
  40267. t.Euro = 750;
  40268. t.Upsilon1 = 620;
  40269. t.minute = 247;
  40270. t.lessequal = 549;
  40271. t.fraction = 167;
  40272. t.infinity = 713;
  40273. t.florin = 500;
  40274. t.club = 753;
  40275. t.diamond = 753;
  40276. t.heart = 753;
  40277. t.spade = 753;
  40278. t.arrowboth = 1042;
  40279. t.arrowleft = 987;
  40280. t.arrowup = 603;
  40281. t.arrowright = 987;
  40282. t.arrowdown = 603;
  40283. t.degree = 400;
  40284. t.plusminus = 549;
  40285. t.second = 411;
  40286. t.greaterequal = 549;
  40287. t.multiply = 549;
  40288. t.proportional = 713;
  40289. t.partialdiff = 494;
  40290. t.bullet = 460;
  40291. t.divide = 549;
  40292. t.notequal = 549;
  40293. t.equivalence = 549;
  40294. t.approxequal = 549;
  40295. t.ellipsis = 1000;
  40296. t.arrowvertex = 603;
  40297. t.arrowhorizex = 1000;
  40298. t.carriagereturn = 658;
  40299. t.aleph = 823;
  40300. t.Ifraktur = 686;
  40301. t.Rfraktur = 795;
  40302. t.weierstrass = 987;
  40303. t.circlemultiply = 768;
  40304. t.circleplus = 768;
  40305. t.emptyset = 823;
  40306. t.intersection = 768;
  40307. t.union = 768;
  40308. t.propersuperset = 713;
  40309. t.reflexsuperset = 713;
  40310. t.notsubset = 713;
  40311. t.propersubset = 713;
  40312. t.reflexsubset = 713;
  40313. t.element = 713;
  40314. t.notelement = 713;
  40315. t.angle = 768;
  40316. t.gradient = 713;
  40317. t.registerserif = 790;
  40318. t.copyrightserif = 790;
  40319. t.trademarkserif = 890;
  40320. t.product = 823;
  40321. t.radical = 549;
  40322. t.dotmath = 250;
  40323. t.logicalnot = 713;
  40324. t.logicaland = 603;
  40325. t.logicalor = 603;
  40326. t.arrowdblboth = 1042;
  40327. t.arrowdblleft = 987;
  40328. t.arrowdblup = 603;
  40329. t.arrowdblright = 987;
  40330. t.arrowdbldown = 603;
  40331. t.lozenge = 494;
  40332. t.angleleft = 329;
  40333. t.registersans = 790;
  40334. t.copyrightsans = 790;
  40335. t.trademarksans = 786;
  40336. t.summation = 713;
  40337. t.parenlefttp = 384;
  40338. t.parenleftex = 384;
  40339. t.parenleftbt = 384;
  40340. t.bracketlefttp = 384;
  40341. t.bracketleftex = 384;
  40342. t.bracketleftbt = 384;
  40343. t.bracelefttp = 494;
  40344. t.braceleftmid = 494;
  40345. t.braceleftbt = 494;
  40346. t.braceex = 494;
  40347. t.angleright = 329;
  40348. t.integral = 274;
  40349. t.integraltp = 686;
  40350. t.integralex = 686;
  40351. t.integralbt = 686;
  40352. t.parenrighttp = 384;
  40353. t.parenrightex = 384;
  40354. t.parenrightbt = 384;
  40355. t.bracketrighttp = 384;
  40356. t.bracketrightex = 384;
  40357. t.bracketrightbt = 384;
  40358. t.bracerighttp = 494;
  40359. t.bracerightmid = 494;
  40360. t.bracerightbt = 494;
  40361. t.apple = 790;
  40362. });
  40363. t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40364. t.space = 250;
  40365. t.exclam = 333;
  40366. t.quotedbl = 408;
  40367. t.numbersign = 500;
  40368. t.dollar = 500;
  40369. t.percent = 833;
  40370. t.ampersand = 778;
  40371. t.quoteright = 333;
  40372. t.parenleft = 333;
  40373. t.parenright = 333;
  40374. t.asterisk = 500;
  40375. t.plus = 564;
  40376. t.comma = 250;
  40377. t.hyphen = 333;
  40378. t.period = 250;
  40379. t.slash = 278;
  40380. t.zero = 500;
  40381. t.one = 500;
  40382. t.two = 500;
  40383. t.three = 500;
  40384. t.four = 500;
  40385. t.five = 500;
  40386. t.six = 500;
  40387. t.seven = 500;
  40388. t.eight = 500;
  40389. t.nine = 500;
  40390. t.colon = 278;
  40391. t.semicolon = 278;
  40392. t.less = 564;
  40393. t.equal = 564;
  40394. t.greater = 564;
  40395. t.question = 444;
  40396. t.at = 921;
  40397. t.A = 722;
  40398. t.B = 667;
  40399. t.C = 667;
  40400. t.D = 722;
  40401. t.E = 611;
  40402. t.F = 556;
  40403. t.G = 722;
  40404. t.H = 722;
  40405. t.I = 333;
  40406. t.J = 389;
  40407. t.K = 722;
  40408. t.L = 611;
  40409. t.M = 889;
  40410. t.N = 722;
  40411. t.O = 722;
  40412. t.P = 556;
  40413. t.Q = 722;
  40414. t.R = 667;
  40415. t.S = 556;
  40416. t.T = 611;
  40417. t.U = 722;
  40418. t.V = 722;
  40419. t.W = 944;
  40420. t.X = 722;
  40421. t.Y = 722;
  40422. t.Z = 611;
  40423. t.bracketleft = 333;
  40424. t.backslash = 278;
  40425. t.bracketright = 333;
  40426. t.asciicircum = 469;
  40427. t.underscore = 500;
  40428. t.quoteleft = 333;
  40429. t.a = 444;
  40430. t.b = 500;
  40431. t.c = 444;
  40432. t.d = 500;
  40433. t.e = 444;
  40434. t.f = 333;
  40435. t.g = 500;
  40436. t.h = 500;
  40437. t.i = 278;
  40438. t.j = 278;
  40439. t.k = 500;
  40440. t.l = 278;
  40441. t.m = 778;
  40442. t.n = 500;
  40443. t.o = 500;
  40444. t.p = 500;
  40445. t.q = 500;
  40446. t.r = 333;
  40447. t.s = 389;
  40448. t.t = 278;
  40449. t.u = 500;
  40450. t.v = 500;
  40451. t.w = 722;
  40452. t.x = 500;
  40453. t.y = 500;
  40454. t.z = 444;
  40455. t.braceleft = 480;
  40456. t.bar = 200;
  40457. t.braceright = 480;
  40458. t.asciitilde = 541;
  40459. t.exclamdown = 333;
  40460. t.cent = 500;
  40461. t.sterling = 500;
  40462. t.fraction = 167;
  40463. t.yen = 500;
  40464. t.florin = 500;
  40465. t.section = 500;
  40466. t.currency = 500;
  40467. t.quotesingle = 180;
  40468. t.quotedblleft = 444;
  40469. t.guillemotleft = 500;
  40470. t.guilsinglleft = 333;
  40471. t.guilsinglright = 333;
  40472. t.fi = 556;
  40473. t.fl = 556;
  40474. t.endash = 500;
  40475. t.dagger = 500;
  40476. t.daggerdbl = 500;
  40477. t.periodcentered = 250;
  40478. t.paragraph = 453;
  40479. t.bullet = 350;
  40480. t.quotesinglbase = 333;
  40481. t.quotedblbase = 444;
  40482. t.quotedblright = 444;
  40483. t.guillemotright = 500;
  40484. t.ellipsis = 1000;
  40485. t.perthousand = 1000;
  40486. t.questiondown = 444;
  40487. t.grave = 333;
  40488. t.acute = 333;
  40489. t.circumflex = 333;
  40490. t.tilde = 333;
  40491. t.macron = 333;
  40492. t.breve = 333;
  40493. t.dotaccent = 333;
  40494. t.dieresis = 333;
  40495. t.ring = 333;
  40496. t.cedilla = 333;
  40497. t.hungarumlaut = 333;
  40498. t.ogonek = 333;
  40499. t.caron = 333;
  40500. t.emdash = 1000;
  40501. t.AE = 889;
  40502. t.ordfeminine = 276;
  40503. t.Lslash = 611;
  40504. t.Oslash = 722;
  40505. t.OE = 889;
  40506. t.ordmasculine = 310;
  40507. t.ae = 667;
  40508. t.dotlessi = 278;
  40509. t.lslash = 278;
  40510. t.oslash = 500;
  40511. t.oe = 722;
  40512. t.germandbls = 500;
  40513. t.Idieresis = 333;
  40514. t.eacute = 444;
  40515. t.abreve = 444;
  40516. t.uhungarumlaut = 500;
  40517. t.ecaron = 444;
  40518. t.Ydieresis = 722;
  40519. t.divide = 564;
  40520. t.Yacute = 722;
  40521. t.Acircumflex = 722;
  40522. t.aacute = 444;
  40523. t.Ucircumflex = 722;
  40524. t.yacute = 500;
  40525. t.scommaaccent = 389;
  40526. t.ecircumflex = 444;
  40527. t.Uring = 722;
  40528. t.Udieresis = 722;
  40529. t.aogonek = 444;
  40530. t.Uacute = 722;
  40531. t.uogonek = 500;
  40532. t.Edieresis = 611;
  40533. t.Dcroat = 722;
  40534. t.commaaccent = 250;
  40535. t.copyright = 760;
  40536. t.Emacron = 611;
  40537. t.ccaron = 444;
  40538. t.aring = 444;
  40539. t.Ncommaaccent = 722;
  40540. t.lacute = 278;
  40541. t.agrave = 444;
  40542. t.Tcommaaccent = 611;
  40543. t.Cacute = 667;
  40544. t.atilde = 444;
  40545. t.Edotaccent = 611;
  40546. t.scaron = 389;
  40547. t.scedilla = 389;
  40548. t.iacute = 278;
  40549. t.lozenge = 471;
  40550. t.Rcaron = 667;
  40551. t.Gcommaaccent = 722;
  40552. t.ucircumflex = 500;
  40553. t.acircumflex = 444;
  40554. t.Amacron = 722;
  40555. t.rcaron = 333;
  40556. t.ccedilla = 444;
  40557. t.Zdotaccent = 611;
  40558. t.Thorn = 556;
  40559. t.Omacron = 722;
  40560. t.Racute = 667;
  40561. t.Sacute = 556;
  40562. t.dcaron = 588;
  40563. t.Umacron = 722;
  40564. t.uring = 500;
  40565. t.threesuperior = 300;
  40566. t.Ograve = 722;
  40567. t.Agrave = 722;
  40568. t.Abreve = 722;
  40569. t.multiply = 564;
  40570. t.uacute = 500;
  40571. t.Tcaron = 611;
  40572. t.partialdiff = 476;
  40573. t.ydieresis = 500;
  40574. t.Nacute = 722;
  40575. t.icircumflex = 278;
  40576. t.Ecircumflex = 611;
  40577. t.adieresis = 444;
  40578. t.edieresis = 444;
  40579. t.cacute = 444;
  40580. t.nacute = 500;
  40581. t.umacron = 500;
  40582. t.Ncaron = 722;
  40583. t.Iacute = 333;
  40584. t.plusminus = 564;
  40585. t.brokenbar = 200;
  40586. t.registered = 760;
  40587. t.Gbreve = 722;
  40588. t.Idotaccent = 333;
  40589. t.summation = 600;
  40590. t.Egrave = 611;
  40591. t.racute = 333;
  40592. t.omacron = 500;
  40593. t.Zacute = 611;
  40594. t.Zcaron = 611;
  40595. t.greaterequal = 549;
  40596. t.Eth = 722;
  40597. t.Ccedilla = 667;
  40598. t.lcommaaccent = 278;
  40599. t.tcaron = 326;
  40600. t.eogonek = 444;
  40601. t.Uogonek = 722;
  40602. t.Aacute = 722;
  40603. t.Adieresis = 722;
  40604. t.egrave = 444;
  40605. t.zacute = 444;
  40606. t.iogonek = 278;
  40607. t.Oacute = 722;
  40608. t.oacute = 500;
  40609. t.amacron = 444;
  40610. t.sacute = 389;
  40611. t.idieresis = 278;
  40612. t.Ocircumflex = 722;
  40613. t.Ugrave = 722;
  40614. t.Delta = 612;
  40615. t.thorn = 500;
  40616. t.twosuperior = 300;
  40617. t.Odieresis = 722;
  40618. t.mu = 500;
  40619. t.igrave = 278;
  40620. t.ohungarumlaut = 500;
  40621. t.Eogonek = 611;
  40622. t.dcroat = 500;
  40623. t.threequarters = 750;
  40624. t.Scedilla = 556;
  40625. t.lcaron = 344;
  40626. t.Kcommaaccent = 722;
  40627. t.Lacute = 611;
  40628. t.trademark = 980;
  40629. t.edotaccent = 444;
  40630. t.Igrave = 333;
  40631. t.Imacron = 333;
  40632. t.Lcaron = 611;
  40633. t.onehalf = 750;
  40634. t.lessequal = 549;
  40635. t.ocircumflex = 500;
  40636. t.ntilde = 500;
  40637. t.Uhungarumlaut = 722;
  40638. t.Eacute = 611;
  40639. t.emacron = 444;
  40640. t.gbreve = 500;
  40641. t.onequarter = 750;
  40642. t.Scaron = 556;
  40643. t.Scommaaccent = 556;
  40644. t.Ohungarumlaut = 722;
  40645. t.degree = 400;
  40646. t.ograve = 500;
  40647. t.Ccaron = 667;
  40648. t.ugrave = 500;
  40649. t.radical = 453;
  40650. t.Dcaron = 722;
  40651. t.rcommaaccent = 333;
  40652. t.Ntilde = 722;
  40653. t.otilde = 500;
  40654. t.Rcommaaccent = 667;
  40655. t.Lcommaaccent = 611;
  40656. t.Atilde = 722;
  40657. t.Aogonek = 722;
  40658. t.Aring = 722;
  40659. t.Otilde = 722;
  40660. t.zdotaccent = 444;
  40661. t.Ecaron = 611;
  40662. t.Iogonek = 333;
  40663. t.kcommaaccent = 500;
  40664. t.minus = 564;
  40665. t.Icircumflex = 333;
  40666. t.ncaron = 500;
  40667. t.tcommaaccent = 278;
  40668. t.logicalnot = 564;
  40669. t.odieresis = 500;
  40670. t.udieresis = 500;
  40671. t.notequal = 549;
  40672. t.gcommaaccent = 500;
  40673. t.eth = 500;
  40674. t.zcaron = 444;
  40675. t.ncommaaccent = 500;
  40676. t.onesuperior = 300;
  40677. t.imacron = 278;
  40678. t.Euro = 500;
  40679. });
  40680. t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40681. t.space = 250;
  40682. t.exclam = 333;
  40683. t.quotedbl = 555;
  40684. t.numbersign = 500;
  40685. t.dollar = 500;
  40686. t.percent = 1000;
  40687. t.ampersand = 833;
  40688. t.quoteright = 333;
  40689. t.parenleft = 333;
  40690. t.parenright = 333;
  40691. t.asterisk = 500;
  40692. t.plus = 570;
  40693. t.comma = 250;
  40694. t.hyphen = 333;
  40695. t.period = 250;
  40696. t.slash = 278;
  40697. t.zero = 500;
  40698. t.one = 500;
  40699. t.two = 500;
  40700. t.three = 500;
  40701. t.four = 500;
  40702. t.five = 500;
  40703. t.six = 500;
  40704. t.seven = 500;
  40705. t.eight = 500;
  40706. t.nine = 500;
  40707. t.colon = 333;
  40708. t.semicolon = 333;
  40709. t.less = 570;
  40710. t.equal = 570;
  40711. t.greater = 570;
  40712. t.question = 500;
  40713. t.at = 930;
  40714. t.A = 722;
  40715. t.B = 667;
  40716. t.C = 722;
  40717. t.D = 722;
  40718. t.E = 667;
  40719. t.F = 611;
  40720. t.G = 778;
  40721. t.H = 778;
  40722. t.I = 389;
  40723. t.J = 500;
  40724. t.K = 778;
  40725. t.L = 667;
  40726. t.M = 944;
  40727. t.N = 722;
  40728. t.O = 778;
  40729. t.P = 611;
  40730. t.Q = 778;
  40731. t.R = 722;
  40732. t.S = 556;
  40733. t.T = 667;
  40734. t.U = 722;
  40735. t.V = 722;
  40736. t.W = 1000;
  40737. t.X = 722;
  40738. t.Y = 722;
  40739. t.Z = 667;
  40740. t.bracketleft = 333;
  40741. t.backslash = 278;
  40742. t.bracketright = 333;
  40743. t.asciicircum = 581;
  40744. t.underscore = 500;
  40745. t.quoteleft = 333;
  40746. t.a = 500;
  40747. t.b = 556;
  40748. t.c = 444;
  40749. t.d = 556;
  40750. t.e = 444;
  40751. t.f = 333;
  40752. t.g = 500;
  40753. t.h = 556;
  40754. t.i = 278;
  40755. t.j = 333;
  40756. t.k = 556;
  40757. t.l = 278;
  40758. t.m = 833;
  40759. t.n = 556;
  40760. t.o = 500;
  40761. t.p = 556;
  40762. t.q = 556;
  40763. t.r = 444;
  40764. t.s = 389;
  40765. t.t = 333;
  40766. t.u = 556;
  40767. t.v = 500;
  40768. t.w = 722;
  40769. t.x = 500;
  40770. t.y = 500;
  40771. t.z = 444;
  40772. t.braceleft = 394;
  40773. t.bar = 220;
  40774. t.braceright = 394;
  40775. t.asciitilde = 520;
  40776. t.exclamdown = 333;
  40777. t.cent = 500;
  40778. t.sterling = 500;
  40779. t.fraction = 167;
  40780. t.yen = 500;
  40781. t.florin = 500;
  40782. t.section = 500;
  40783. t.currency = 500;
  40784. t.quotesingle = 278;
  40785. t.quotedblleft = 500;
  40786. t.guillemotleft = 500;
  40787. t.guilsinglleft = 333;
  40788. t.guilsinglright = 333;
  40789. t.fi = 556;
  40790. t.fl = 556;
  40791. t.endash = 500;
  40792. t.dagger = 500;
  40793. t.daggerdbl = 500;
  40794. t.periodcentered = 250;
  40795. t.paragraph = 540;
  40796. t.bullet = 350;
  40797. t.quotesinglbase = 333;
  40798. t.quotedblbase = 500;
  40799. t.quotedblright = 500;
  40800. t.guillemotright = 500;
  40801. t.ellipsis = 1000;
  40802. t.perthousand = 1000;
  40803. t.questiondown = 500;
  40804. t.grave = 333;
  40805. t.acute = 333;
  40806. t.circumflex = 333;
  40807. t.tilde = 333;
  40808. t.macron = 333;
  40809. t.breve = 333;
  40810. t.dotaccent = 333;
  40811. t.dieresis = 333;
  40812. t.ring = 333;
  40813. t.cedilla = 333;
  40814. t.hungarumlaut = 333;
  40815. t.ogonek = 333;
  40816. t.caron = 333;
  40817. t.emdash = 1000;
  40818. t.AE = 1000;
  40819. t.ordfeminine = 300;
  40820. t.Lslash = 667;
  40821. t.Oslash = 778;
  40822. t.OE = 1000;
  40823. t.ordmasculine = 330;
  40824. t.ae = 722;
  40825. t.dotlessi = 278;
  40826. t.lslash = 278;
  40827. t.oslash = 500;
  40828. t.oe = 722;
  40829. t.germandbls = 556;
  40830. t.Idieresis = 389;
  40831. t.eacute = 444;
  40832. t.abreve = 500;
  40833. t.uhungarumlaut = 556;
  40834. t.ecaron = 444;
  40835. t.Ydieresis = 722;
  40836. t.divide = 570;
  40837. t.Yacute = 722;
  40838. t.Acircumflex = 722;
  40839. t.aacute = 500;
  40840. t.Ucircumflex = 722;
  40841. t.yacute = 500;
  40842. t.scommaaccent = 389;
  40843. t.ecircumflex = 444;
  40844. t.Uring = 722;
  40845. t.Udieresis = 722;
  40846. t.aogonek = 500;
  40847. t.Uacute = 722;
  40848. t.uogonek = 556;
  40849. t.Edieresis = 667;
  40850. t.Dcroat = 722;
  40851. t.commaaccent = 250;
  40852. t.copyright = 747;
  40853. t.Emacron = 667;
  40854. t.ccaron = 444;
  40855. t.aring = 500;
  40856. t.Ncommaaccent = 722;
  40857. t.lacute = 278;
  40858. t.agrave = 500;
  40859. t.Tcommaaccent = 667;
  40860. t.Cacute = 722;
  40861. t.atilde = 500;
  40862. t.Edotaccent = 667;
  40863. t.scaron = 389;
  40864. t.scedilla = 389;
  40865. t.iacute = 278;
  40866. t.lozenge = 494;
  40867. t.Rcaron = 722;
  40868. t.Gcommaaccent = 778;
  40869. t.ucircumflex = 556;
  40870. t.acircumflex = 500;
  40871. t.Amacron = 722;
  40872. t.rcaron = 444;
  40873. t.ccedilla = 444;
  40874. t.Zdotaccent = 667;
  40875. t.Thorn = 611;
  40876. t.Omacron = 778;
  40877. t.Racute = 722;
  40878. t.Sacute = 556;
  40879. t.dcaron = 672;
  40880. t.Umacron = 722;
  40881. t.uring = 556;
  40882. t.threesuperior = 300;
  40883. t.Ograve = 778;
  40884. t.Agrave = 722;
  40885. t.Abreve = 722;
  40886. t.multiply = 570;
  40887. t.uacute = 556;
  40888. t.Tcaron = 667;
  40889. t.partialdiff = 494;
  40890. t.ydieresis = 500;
  40891. t.Nacute = 722;
  40892. t.icircumflex = 278;
  40893. t.Ecircumflex = 667;
  40894. t.adieresis = 500;
  40895. t.edieresis = 444;
  40896. t.cacute = 444;
  40897. t.nacute = 556;
  40898. t.umacron = 556;
  40899. t.Ncaron = 722;
  40900. t.Iacute = 389;
  40901. t.plusminus = 570;
  40902. t.brokenbar = 220;
  40903. t.registered = 747;
  40904. t.Gbreve = 778;
  40905. t.Idotaccent = 389;
  40906. t.summation = 600;
  40907. t.Egrave = 667;
  40908. t.racute = 444;
  40909. t.omacron = 500;
  40910. t.Zacute = 667;
  40911. t.Zcaron = 667;
  40912. t.greaterequal = 549;
  40913. t.Eth = 722;
  40914. t.Ccedilla = 722;
  40915. t.lcommaaccent = 278;
  40916. t.tcaron = 416;
  40917. t.eogonek = 444;
  40918. t.Uogonek = 722;
  40919. t.Aacute = 722;
  40920. t.Adieresis = 722;
  40921. t.egrave = 444;
  40922. t.zacute = 444;
  40923. t.iogonek = 278;
  40924. t.Oacute = 778;
  40925. t.oacute = 500;
  40926. t.amacron = 500;
  40927. t.sacute = 389;
  40928. t.idieresis = 278;
  40929. t.Ocircumflex = 778;
  40930. t.Ugrave = 722;
  40931. t.Delta = 612;
  40932. t.thorn = 556;
  40933. t.twosuperior = 300;
  40934. t.Odieresis = 778;
  40935. t.mu = 556;
  40936. t.igrave = 278;
  40937. t.ohungarumlaut = 500;
  40938. t.Eogonek = 667;
  40939. t.dcroat = 556;
  40940. t.threequarters = 750;
  40941. t.Scedilla = 556;
  40942. t.lcaron = 394;
  40943. t.Kcommaaccent = 778;
  40944. t.Lacute = 667;
  40945. t.trademark = 1000;
  40946. t.edotaccent = 444;
  40947. t.Igrave = 389;
  40948. t.Imacron = 389;
  40949. t.Lcaron = 667;
  40950. t.onehalf = 750;
  40951. t.lessequal = 549;
  40952. t.ocircumflex = 500;
  40953. t.ntilde = 556;
  40954. t.Uhungarumlaut = 722;
  40955. t.Eacute = 667;
  40956. t.emacron = 444;
  40957. t.gbreve = 500;
  40958. t.onequarter = 750;
  40959. t.Scaron = 556;
  40960. t.Scommaaccent = 556;
  40961. t.Ohungarumlaut = 778;
  40962. t.degree = 400;
  40963. t.ograve = 500;
  40964. t.Ccaron = 722;
  40965. t.ugrave = 556;
  40966. t.radical = 549;
  40967. t.Dcaron = 722;
  40968. t.rcommaaccent = 444;
  40969. t.Ntilde = 722;
  40970. t.otilde = 500;
  40971. t.Rcommaaccent = 722;
  40972. t.Lcommaaccent = 667;
  40973. t.Atilde = 722;
  40974. t.Aogonek = 722;
  40975. t.Aring = 722;
  40976. t.Otilde = 778;
  40977. t.zdotaccent = 444;
  40978. t.Ecaron = 667;
  40979. t.Iogonek = 389;
  40980. t.kcommaaccent = 556;
  40981. t.minus = 570;
  40982. t.Icircumflex = 389;
  40983. t.ncaron = 556;
  40984. t.tcommaaccent = 333;
  40985. t.logicalnot = 570;
  40986. t.odieresis = 500;
  40987. t.udieresis = 556;
  40988. t.notequal = 549;
  40989. t.gcommaaccent = 500;
  40990. t.eth = 500;
  40991. t.zcaron = 444;
  40992. t.ncommaaccent = 556;
  40993. t.onesuperior = 300;
  40994. t.imacron = 278;
  40995. t.Euro = 500;
  40996. });
  40997. t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40998. t.space = 250;
  40999. t.exclam = 389;
  41000. t.quotedbl = 555;
  41001. t.numbersign = 500;
  41002. t.dollar = 500;
  41003. t.percent = 833;
  41004. t.ampersand = 778;
  41005. t.quoteright = 333;
  41006. t.parenleft = 333;
  41007. t.parenright = 333;
  41008. t.asterisk = 500;
  41009. t.plus = 570;
  41010. t.comma = 250;
  41011. t.hyphen = 333;
  41012. t.period = 250;
  41013. t.slash = 278;
  41014. t.zero = 500;
  41015. t.one = 500;
  41016. t.two = 500;
  41017. t.three = 500;
  41018. t.four = 500;
  41019. t.five = 500;
  41020. t.six = 500;
  41021. t.seven = 500;
  41022. t.eight = 500;
  41023. t.nine = 500;
  41024. t.colon = 333;
  41025. t.semicolon = 333;
  41026. t.less = 570;
  41027. t.equal = 570;
  41028. t.greater = 570;
  41029. t.question = 500;
  41030. t.at = 832;
  41031. t.A = 667;
  41032. t.B = 667;
  41033. t.C = 667;
  41034. t.D = 722;
  41035. t.E = 667;
  41036. t.F = 667;
  41037. t.G = 722;
  41038. t.H = 778;
  41039. t.I = 389;
  41040. t.J = 500;
  41041. t.K = 667;
  41042. t.L = 611;
  41043. t.M = 889;
  41044. t.N = 722;
  41045. t.O = 722;
  41046. t.P = 611;
  41047. t.Q = 722;
  41048. t.R = 667;
  41049. t.S = 556;
  41050. t.T = 611;
  41051. t.U = 722;
  41052. t.V = 667;
  41053. t.W = 889;
  41054. t.X = 667;
  41055. t.Y = 611;
  41056. t.Z = 611;
  41057. t.bracketleft = 333;
  41058. t.backslash = 278;
  41059. t.bracketright = 333;
  41060. t.asciicircum = 570;
  41061. t.underscore = 500;
  41062. t.quoteleft = 333;
  41063. t.a = 500;
  41064. t.b = 500;
  41065. t.c = 444;
  41066. t.d = 500;
  41067. t.e = 444;
  41068. t.f = 333;
  41069. t.g = 500;
  41070. t.h = 556;
  41071. t.i = 278;
  41072. t.j = 278;
  41073. t.k = 500;
  41074. t.l = 278;
  41075. t.m = 778;
  41076. t.n = 556;
  41077. t.o = 500;
  41078. t.p = 500;
  41079. t.q = 500;
  41080. t.r = 389;
  41081. t.s = 389;
  41082. t.t = 278;
  41083. t.u = 556;
  41084. t.v = 444;
  41085. t.w = 667;
  41086. t.x = 500;
  41087. t.y = 444;
  41088. t.z = 389;
  41089. t.braceleft = 348;
  41090. t.bar = 220;
  41091. t.braceright = 348;
  41092. t.asciitilde = 570;
  41093. t.exclamdown = 389;
  41094. t.cent = 500;
  41095. t.sterling = 500;
  41096. t.fraction = 167;
  41097. t.yen = 500;
  41098. t.florin = 500;
  41099. t.section = 500;
  41100. t.currency = 500;
  41101. t.quotesingle = 278;
  41102. t.quotedblleft = 500;
  41103. t.guillemotleft = 500;
  41104. t.guilsinglleft = 333;
  41105. t.guilsinglright = 333;
  41106. t.fi = 556;
  41107. t.fl = 556;
  41108. t.endash = 500;
  41109. t.dagger = 500;
  41110. t.daggerdbl = 500;
  41111. t.periodcentered = 250;
  41112. t.paragraph = 500;
  41113. t.bullet = 350;
  41114. t.quotesinglbase = 333;
  41115. t.quotedblbase = 500;
  41116. t.quotedblright = 500;
  41117. t.guillemotright = 500;
  41118. t.ellipsis = 1000;
  41119. t.perthousand = 1000;
  41120. t.questiondown = 500;
  41121. t.grave = 333;
  41122. t.acute = 333;
  41123. t.circumflex = 333;
  41124. t.tilde = 333;
  41125. t.macron = 333;
  41126. t.breve = 333;
  41127. t.dotaccent = 333;
  41128. t.dieresis = 333;
  41129. t.ring = 333;
  41130. t.cedilla = 333;
  41131. t.hungarumlaut = 333;
  41132. t.ogonek = 333;
  41133. t.caron = 333;
  41134. t.emdash = 1000;
  41135. t.AE = 944;
  41136. t.ordfeminine = 266;
  41137. t.Lslash = 611;
  41138. t.Oslash = 722;
  41139. t.OE = 944;
  41140. t.ordmasculine = 300;
  41141. t.ae = 722;
  41142. t.dotlessi = 278;
  41143. t.lslash = 278;
  41144. t.oslash = 500;
  41145. t.oe = 722;
  41146. t.germandbls = 500;
  41147. t.Idieresis = 389;
  41148. t.eacute = 444;
  41149. t.abreve = 500;
  41150. t.uhungarumlaut = 556;
  41151. t.ecaron = 444;
  41152. t.Ydieresis = 611;
  41153. t.divide = 570;
  41154. t.Yacute = 611;
  41155. t.Acircumflex = 667;
  41156. t.aacute = 500;
  41157. t.Ucircumflex = 722;
  41158. t.yacute = 444;
  41159. t.scommaaccent = 389;
  41160. t.ecircumflex = 444;
  41161. t.Uring = 722;
  41162. t.Udieresis = 722;
  41163. t.aogonek = 500;
  41164. t.Uacute = 722;
  41165. t.uogonek = 556;
  41166. t.Edieresis = 667;
  41167. t.Dcroat = 722;
  41168. t.commaaccent = 250;
  41169. t.copyright = 747;
  41170. t.Emacron = 667;
  41171. t.ccaron = 444;
  41172. t.aring = 500;
  41173. t.Ncommaaccent = 722;
  41174. t.lacute = 278;
  41175. t.agrave = 500;
  41176. t.Tcommaaccent = 611;
  41177. t.Cacute = 667;
  41178. t.atilde = 500;
  41179. t.Edotaccent = 667;
  41180. t.scaron = 389;
  41181. t.scedilla = 389;
  41182. t.iacute = 278;
  41183. t.lozenge = 494;
  41184. t.Rcaron = 667;
  41185. t.Gcommaaccent = 722;
  41186. t.ucircumflex = 556;
  41187. t.acircumflex = 500;
  41188. t.Amacron = 667;
  41189. t.rcaron = 389;
  41190. t.ccedilla = 444;
  41191. t.Zdotaccent = 611;
  41192. t.Thorn = 611;
  41193. t.Omacron = 722;
  41194. t.Racute = 667;
  41195. t.Sacute = 556;
  41196. t.dcaron = 608;
  41197. t.Umacron = 722;
  41198. t.uring = 556;
  41199. t.threesuperior = 300;
  41200. t.Ograve = 722;
  41201. t.Agrave = 667;
  41202. t.Abreve = 667;
  41203. t.multiply = 570;
  41204. t.uacute = 556;
  41205. t.Tcaron = 611;
  41206. t.partialdiff = 494;
  41207. t.ydieresis = 444;
  41208. t.Nacute = 722;
  41209. t.icircumflex = 278;
  41210. t.Ecircumflex = 667;
  41211. t.adieresis = 500;
  41212. t.edieresis = 444;
  41213. t.cacute = 444;
  41214. t.nacute = 556;
  41215. t.umacron = 556;
  41216. t.Ncaron = 722;
  41217. t.Iacute = 389;
  41218. t.plusminus = 570;
  41219. t.brokenbar = 220;
  41220. t.registered = 747;
  41221. t.Gbreve = 722;
  41222. t.Idotaccent = 389;
  41223. t.summation = 600;
  41224. t.Egrave = 667;
  41225. t.racute = 389;
  41226. t.omacron = 500;
  41227. t.Zacute = 611;
  41228. t.Zcaron = 611;
  41229. t.greaterequal = 549;
  41230. t.Eth = 722;
  41231. t.Ccedilla = 667;
  41232. t.lcommaaccent = 278;
  41233. t.tcaron = 366;
  41234. t.eogonek = 444;
  41235. t.Uogonek = 722;
  41236. t.Aacute = 667;
  41237. t.Adieresis = 667;
  41238. t.egrave = 444;
  41239. t.zacute = 389;
  41240. t.iogonek = 278;
  41241. t.Oacute = 722;
  41242. t.oacute = 500;
  41243. t.amacron = 500;
  41244. t.sacute = 389;
  41245. t.idieresis = 278;
  41246. t.Ocircumflex = 722;
  41247. t.Ugrave = 722;
  41248. t.Delta = 612;
  41249. t.thorn = 500;
  41250. t.twosuperior = 300;
  41251. t.Odieresis = 722;
  41252. t.mu = 576;
  41253. t.igrave = 278;
  41254. t.ohungarumlaut = 500;
  41255. t.Eogonek = 667;
  41256. t.dcroat = 500;
  41257. t.threequarters = 750;
  41258. t.Scedilla = 556;
  41259. t.lcaron = 382;
  41260. t.Kcommaaccent = 667;
  41261. t.Lacute = 611;
  41262. t.trademark = 1000;
  41263. t.edotaccent = 444;
  41264. t.Igrave = 389;
  41265. t.Imacron = 389;
  41266. t.Lcaron = 611;
  41267. t.onehalf = 750;
  41268. t.lessequal = 549;
  41269. t.ocircumflex = 500;
  41270. t.ntilde = 556;
  41271. t.Uhungarumlaut = 722;
  41272. t.Eacute = 667;
  41273. t.emacron = 444;
  41274. t.gbreve = 500;
  41275. t.onequarter = 750;
  41276. t.Scaron = 556;
  41277. t.Scommaaccent = 556;
  41278. t.Ohungarumlaut = 722;
  41279. t.degree = 400;
  41280. t.ograve = 500;
  41281. t.Ccaron = 667;
  41282. t.ugrave = 556;
  41283. t.radical = 549;
  41284. t.Dcaron = 722;
  41285. t.rcommaaccent = 389;
  41286. t.Ntilde = 722;
  41287. t.otilde = 500;
  41288. t.Rcommaaccent = 667;
  41289. t.Lcommaaccent = 611;
  41290. t.Atilde = 667;
  41291. t.Aogonek = 667;
  41292. t.Aring = 667;
  41293. t.Otilde = 722;
  41294. t.zdotaccent = 389;
  41295. t.Ecaron = 667;
  41296. t.Iogonek = 389;
  41297. t.kcommaaccent = 500;
  41298. t.minus = 606;
  41299. t.Icircumflex = 389;
  41300. t.ncaron = 556;
  41301. t.tcommaaccent = 278;
  41302. t.logicalnot = 606;
  41303. t.odieresis = 500;
  41304. t.udieresis = 556;
  41305. t.notequal = 549;
  41306. t.gcommaaccent = 500;
  41307. t.eth = 500;
  41308. t.zcaron = 389;
  41309. t.ncommaaccent = 556;
  41310. t.onesuperior = 300;
  41311. t.imacron = 278;
  41312. t.Euro = 500;
  41313. });
  41314. t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  41315. t.space = 250;
  41316. t.exclam = 333;
  41317. t.quotedbl = 420;
  41318. t.numbersign = 500;
  41319. t.dollar = 500;
  41320. t.percent = 833;
  41321. t.ampersand = 778;
  41322. t.quoteright = 333;
  41323. t.parenleft = 333;
  41324. t.parenright = 333;
  41325. t.asterisk = 500;
  41326. t.plus = 675;
  41327. t.comma = 250;
  41328. t.hyphen = 333;
  41329. t.period = 250;
  41330. t.slash = 278;
  41331. t.zero = 500;
  41332. t.one = 500;
  41333. t.two = 500;
  41334. t.three = 500;
  41335. t.four = 500;
  41336. t.five = 500;
  41337. t.six = 500;
  41338. t.seven = 500;
  41339. t.eight = 500;
  41340. t.nine = 500;
  41341. t.colon = 333;
  41342. t.semicolon = 333;
  41343. t.less = 675;
  41344. t.equal = 675;
  41345. t.greater = 675;
  41346. t.question = 500;
  41347. t.at = 920;
  41348. t.A = 611;
  41349. t.B = 611;
  41350. t.C = 667;
  41351. t.D = 722;
  41352. t.E = 611;
  41353. t.F = 611;
  41354. t.G = 722;
  41355. t.H = 722;
  41356. t.I = 333;
  41357. t.J = 444;
  41358. t.K = 667;
  41359. t.L = 556;
  41360. t.M = 833;
  41361. t.N = 667;
  41362. t.O = 722;
  41363. t.P = 611;
  41364. t.Q = 722;
  41365. t.R = 611;
  41366. t.S = 500;
  41367. t.T = 556;
  41368. t.U = 722;
  41369. t.V = 611;
  41370. t.W = 833;
  41371. t.X = 611;
  41372. t.Y = 556;
  41373. t.Z = 556;
  41374. t.bracketleft = 389;
  41375. t.backslash = 278;
  41376. t.bracketright = 389;
  41377. t.asciicircum = 422;
  41378. t.underscore = 500;
  41379. t.quoteleft = 333;
  41380. t.a = 500;
  41381. t.b = 500;
  41382. t.c = 444;
  41383. t.d = 500;
  41384. t.e = 444;
  41385. t.f = 278;
  41386. t.g = 500;
  41387. t.h = 500;
  41388. t.i = 278;
  41389. t.j = 278;
  41390. t.k = 444;
  41391. t.l = 278;
  41392. t.m = 722;
  41393. t.n = 500;
  41394. t.o = 500;
  41395. t.p = 500;
  41396. t.q = 500;
  41397. t.r = 389;
  41398. t.s = 389;
  41399. t.t = 278;
  41400. t.u = 500;
  41401. t.v = 444;
  41402. t.w = 667;
  41403. t.x = 444;
  41404. t.y = 444;
  41405. t.z = 389;
  41406. t.braceleft = 400;
  41407. t.bar = 275;
  41408. t.braceright = 400;
  41409. t.asciitilde = 541;
  41410. t.exclamdown = 389;
  41411. t.cent = 500;
  41412. t.sterling = 500;
  41413. t.fraction = 167;
  41414. t.yen = 500;
  41415. t.florin = 500;
  41416. t.section = 500;
  41417. t.currency = 500;
  41418. t.quotesingle = 214;
  41419. t.quotedblleft = 556;
  41420. t.guillemotleft = 500;
  41421. t.guilsinglleft = 333;
  41422. t.guilsinglright = 333;
  41423. t.fi = 500;
  41424. t.fl = 500;
  41425. t.endash = 500;
  41426. t.dagger = 500;
  41427. t.daggerdbl = 500;
  41428. t.periodcentered = 250;
  41429. t.paragraph = 523;
  41430. t.bullet = 350;
  41431. t.quotesinglbase = 333;
  41432. t.quotedblbase = 556;
  41433. t.quotedblright = 556;
  41434. t.guillemotright = 500;
  41435. t.ellipsis = 889;
  41436. t.perthousand = 1000;
  41437. t.questiondown = 500;
  41438. t.grave = 333;
  41439. t.acute = 333;
  41440. t.circumflex = 333;
  41441. t.tilde = 333;
  41442. t.macron = 333;
  41443. t.breve = 333;
  41444. t.dotaccent = 333;
  41445. t.dieresis = 333;
  41446. t.ring = 333;
  41447. t.cedilla = 333;
  41448. t.hungarumlaut = 333;
  41449. t.ogonek = 333;
  41450. t.caron = 333;
  41451. t.emdash = 889;
  41452. t.AE = 889;
  41453. t.ordfeminine = 276;
  41454. t.Lslash = 556;
  41455. t.Oslash = 722;
  41456. t.OE = 944;
  41457. t.ordmasculine = 310;
  41458. t.ae = 667;
  41459. t.dotlessi = 278;
  41460. t.lslash = 278;
  41461. t.oslash = 500;
  41462. t.oe = 667;
  41463. t.germandbls = 500;
  41464. t.Idieresis = 333;
  41465. t.eacute = 444;
  41466. t.abreve = 500;
  41467. t.uhungarumlaut = 500;
  41468. t.ecaron = 444;
  41469. t.Ydieresis = 556;
  41470. t.divide = 675;
  41471. t.Yacute = 556;
  41472. t.Acircumflex = 611;
  41473. t.aacute = 500;
  41474. t.Ucircumflex = 722;
  41475. t.yacute = 444;
  41476. t.scommaaccent = 389;
  41477. t.ecircumflex = 444;
  41478. t.Uring = 722;
  41479. t.Udieresis = 722;
  41480. t.aogonek = 500;
  41481. t.Uacute = 722;
  41482. t.uogonek = 500;
  41483. t.Edieresis = 611;
  41484. t.Dcroat = 722;
  41485. t.commaaccent = 250;
  41486. t.copyright = 760;
  41487. t.Emacron = 611;
  41488. t.ccaron = 444;
  41489. t.aring = 500;
  41490. t.Ncommaaccent = 667;
  41491. t.lacute = 278;
  41492. t.agrave = 500;
  41493. t.Tcommaaccent = 556;
  41494. t.Cacute = 667;
  41495. t.atilde = 500;
  41496. t.Edotaccent = 611;
  41497. t.scaron = 389;
  41498. t.scedilla = 389;
  41499. t.iacute = 278;
  41500. t.lozenge = 471;
  41501. t.Rcaron = 611;
  41502. t.Gcommaaccent = 722;
  41503. t.ucircumflex = 500;
  41504. t.acircumflex = 500;
  41505. t.Amacron = 611;
  41506. t.rcaron = 389;
  41507. t.ccedilla = 444;
  41508. t.Zdotaccent = 556;
  41509. t.Thorn = 611;
  41510. t.Omacron = 722;
  41511. t.Racute = 611;
  41512. t.Sacute = 500;
  41513. t.dcaron = 544;
  41514. t.Umacron = 722;
  41515. t.uring = 500;
  41516. t.threesuperior = 300;
  41517. t.Ograve = 722;
  41518. t.Agrave = 611;
  41519. t.Abreve = 611;
  41520. t.multiply = 675;
  41521. t.uacute = 500;
  41522. t.Tcaron = 556;
  41523. t.partialdiff = 476;
  41524. t.ydieresis = 444;
  41525. t.Nacute = 667;
  41526. t.icircumflex = 278;
  41527. t.Ecircumflex = 611;
  41528. t.adieresis = 500;
  41529. t.edieresis = 444;
  41530. t.cacute = 444;
  41531. t.nacute = 500;
  41532. t.umacron = 500;
  41533. t.Ncaron = 667;
  41534. t.Iacute = 333;
  41535. t.plusminus = 675;
  41536. t.brokenbar = 275;
  41537. t.registered = 760;
  41538. t.Gbreve = 722;
  41539. t.Idotaccent = 333;
  41540. t.summation = 600;
  41541. t.Egrave = 611;
  41542. t.racute = 389;
  41543. t.omacron = 500;
  41544. t.Zacute = 556;
  41545. t.Zcaron = 556;
  41546. t.greaterequal = 549;
  41547. t.Eth = 722;
  41548. t.Ccedilla = 667;
  41549. t.lcommaaccent = 278;
  41550. t.tcaron = 300;
  41551. t.eogonek = 444;
  41552. t.Uogonek = 722;
  41553. t.Aacute = 611;
  41554. t.Adieresis = 611;
  41555. t.egrave = 444;
  41556. t.zacute = 389;
  41557. t.iogonek = 278;
  41558. t.Oacute = 722;
  41559. t.oacute = 500;
  41560. t.amacron = 500;
  41561. t.sacute = 389;
  41562. t.idieresis = 278;
  41563. t.Ocircumflex = 722;
  41564. t.Ugrave = 722;
  41565. t.Delta = 612;
  41566. t.thorn = 500;
  41567. t.twosuperior = 300;
  41568. t.Odieresis = 722;
  41569. t.mu = 500;
  41570. t.igrave = 278;
  41571. t.ohungarumlaut = 500;
  41572. t.Eogonek = 611;
  41573. t.dcroat = 500;
  41574. t.threequarters = 750;
  41575. t.Scedilla = 500;
  41576. t.lcaron = 300;
  41577. t.Kcommaaccent = 667;
  41578. t.Lacute = 556;
  41579. t.trademark = 980;
  41580. t.edotaccent = 444;
  41581. t.Igrave = 333;
  41582. t.Imacron = 333;
  41583. t.Lcaron = 611;
  41584. t.onehalf = 750;
  41585. t.lessequal = 549;
  41586. t.ocircumflex = 500;
  41587. t.ntilde = 500;
  41588. t.Uhungarumlaut = 722;
  41589. t.Eacute = 611;
  41590. t.emacron = 444;
  41591. t.gbreve = 500;
  41592. t.onequarter = 750;
  41593. t.Scaron = 500;
  41594. t.Scommaaccent = 500;
  41595. t.Ohungarumlaut = 722;
  41596. t.degree = 400;
  41597. t.ograve = 500;
  41598. t.Ccaron = 667;
  41599. t.ugrave = 500;
  41600. t.radical = 453;
  41601. t.Dcaron = 722;
  41602. t.rcommaaccent = 389;
  41603. t.Ntilde = 667;
  41604. t.otilde = 500;
  41605. t.Rcommaaccent = 611;
  41606. t.Lcommaaccent = 556;
  41607. t.Atilde = 611;
  41608. t.Aogonek = 611;
  41609. t.Aring = 611;
  41610. t.Otilde = 722;
  41611. t.zdotaccent = 389;
  41612. t.Ecaron = 611;
  41613. t.Iogonek = 333;
  41614. t.kcommaaccent = 444;
  41615. t.minus = 675;
  41616. t.Icircumflex = 333;
  41617. t.ncaron = 500;
  41618. t.tcommaaccent = 278;
  41619. t.logicalnot = 675;
  41620. t.odieresis = 500;
  41621. t.udieresis = 500;
  41622. t.notequal = 549;
  41623. t.gcommaaccent = 500;
  41624. t.eth = 500;
  41625. t.zcaron = 389;
  41626. t.ncommaaccent = 500;
  41627. t.onesuperior = 300;
  41628. t.imacron = 278;
  41629. t.Euro = 500;
  41630. });
  41631. t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) {
  41632. t.space = 278;
  41633. t.a1 = 974;
  41634. t.a2 = 961;
  41635. t.a202 = 974;
  41636. t.a3 = 980;
  41637. t.a4 = 719;
  41638. t.a5 = 789;
  41639. t.a119 = 790;
  41640. t.a118 = 791;
  41641. t.a117 = 690;
  41642. t.a11 = 960;
  41643. t.a12 = 939;
  41644. t.a13 = 549;
  41645. t.a14 = 855;
  41646. t.a15 = 911;
  41647. t.a16 = 933;
  41648. t.a105 = 911;
  41649. t.a17 = 945;
  41650. t.a18 = 974;
  41651. t.a19 = 755;
  41652. t.a20 = 846;
  41653. t.a21 = 762;
  41654. t.a22 = 761;
  41655. t.a23 = 571;
  41656. t.a24 = 677;
  41657. t.a25 = 763;
  41658. t.a26 = 760;
  41659. t.a27 = 759;
  41660. t.a28 = 754;
  41661. t.a6 = 494;
  41662. t.a7 = 552;
  41663. t.a8 = 537;
  41664. t.a9 = 577;
  41665. t.a10 = 692;
  41666. t.a29 = 786;
  41667. t.a30 = 788;
  41668. t.a31 = 788;
  41669. t.a32 = 790;
  41670. t.a33 = 793;
  41671. t.a34 = 794;
  41672. t.a35 = 816;
  41673. t.a36 = 823;
  41674. t.a37 = 789;
  41675. t.a38 = 841;
  41676. t.a39 = 823;
  41677. t.a40 = 833;
  41678. t.a41 = 816;
  41679. t.a42 = 831;
  41680. t.a43 = 923;
  41681. t.a44 = 744;
  41682. t.a45 = 723;
  41683. t.a46 = 749;
  41684. t.a47 = 790;
  41685. t.a48 = 792;
  41686. t.a49 = 695;
  41687. t.a50 = 776;
  41688. t.a51 = 768;
  41689. t.a52 = 792;
  41690. t.a53 = 759;
  41691. t.a54 = 707;
  41692. t.a55 = 708;
  41693. t.a56 = 682;
  41694. t.a57 = 701;
  41695. t.a58 = 826;
  41696. t.a59 = 815;
  41697. t.a60 = 789;
  41698. t.a61 = 789;
  41699. t.a62 = 707;
  41700. t.a63 = 687;
  41701. t.a64 = 696;
  41702. t.a65 = 689;
  41703. t.a66 = 786;
  41704. t.a67 = 787;
  41705. t.a68 = 713;
  41706. t.a69 = 791;
  41707. t.a70 = 785;
  41708. t.a71 = 791;
  41709. t.a72 = 873;
  41710. t.a73 = 761;
  41711. t.a74 = 762;
  41712. t.a203 = 762;
  41713. t.a75 = 759;
  41714. t.a204 = 759;
  41715. t.a76 = 892;
  41716. t.a77 = 892;
  41717. t.a78 = 788;
  41718. t.a79 = 784;
  41719. t.a81 = 438;
  41720. t.a82 = 138;
  41721. t.a83 = 277;
  41722. t.a84 = 415;
  41723. t.a97 = 392;
  41724. t.a98 = 392;
  41725. t.a99 = 668;
  41726. t.a100 = 668;
  41727. t.a89 = 390;
  41728. t.a90 = 390;
  41729. t.a93 = 317;
  41730. t.a94 = 317;
  41731. t.a91 = 276;
  41732. t.a92 = 276;
  41733. t.a205 = 509;
  41734. t.a85 = 509;
  41735. t.a206 = 410;
  41736. t.a86 = 410;
  41737. t.a87 = 234;
  41738. t.a88 = 234;
  41739. t.a95 = 334;
  41740. t.a96 = 334;
  41741. t.a101 = 732;
  41742. t.a102 = 544;
  41743. t.a103 = 544;
  41744. t.a104 = 910;
  41745. t.a106 = 667;
  41746. t.a107 = 760;
  41747. t.a108 = 760;
  41748. t.a112 = 776;
  41749. t.a111 = 595;
  41750. t.a110 = 694;
  41751. t.a109 = 626;
  41752. t.a120 = 788;
  41753. t.a121 = 788;
  41754. t.a122 = 788;
  41755. t.a123 = 788;
  41756. t.a124 = 788;
  41757. t.a125 = 788;
  41758. t.a126 = 788;
  41759. t.a127 = 788;
  41760. t.a128 = 788;
  41761. t.a129 = 788;
  41762. t.a130 = 788;
  41763. t.a131 = 788;
  41764. t.a132 = 788;
  41765. t.a133 = 788;
  41766. t.a134 = 788;
  41767. t.a135 = 788;
  41768. t.a136 = 788;
  41769. t.a137 = 788;
  41770. t.a138 = 788;
  41771. t.a139 = 788;
  41772. t.a140 = 788;
  41773. t.a141 = 788;
  41774. t.a142 = 788;
  41775. t.a143 = 788;
  41776. t.a144 = 788;
  41777. t.a145 = 788;
  41778. t.a146 = 788;
  41779. t.a147 = 788;
  41780. t.a148 = 788;
  41781. t.a149 = 788;
  41782. t.a150 = 788;
  41783. t.a151 = 788;
  41784. t.a152 = 788;
  41785. t.a153 = 788;
  41786. t.a154 = 788;
  41787. t.a155 = 788;
  41788. t.a156 = 788;
  41789. t.a157 = 788;
  41790. t.a158 = 788;
  41791. t.a159 = 788;
  41792. t.a160 = 894;
  41793. t.a161 = 838;
  41794. t.a163 = 1016;
  41795. t.a164 = 458;
  41796. t.a196 = 748;
  41797. t.a165 = 924;
  41798. t.a192 = 748;
  41799. t.a166 = 918;
  41800. t.a167 = 927;
  41801. t.a168 = 928;
  41802. t.a169 = 928;
  41803. t.a170 = 834;
  41804. t.a171 = 873;
  41805. t.a172 = 828;
  41806. t.a173 = 924;
  41807. t.a162 = 924;
  41808. t.a174 = 917;
  41809. t.a175 = 930;
  41810. t.a176 = 931;
  41811. t.a177 = 463;
  41812. t.a178 = 883;
  41813. t.a179 = 836;
  41814. t.a193 = 836;
  41815. t.a180 = 867;
  41816. t.a199 = 867;
  41817. t.a181 = 696;
  41818. t.a200 = 696;
  41819. t.a182 = 874;
  41820. t.a201 = 874;
  41821. t.a183 = 760;
  41822. t.a184 = 946;
  41823. t.a197 = 771;
  41824. t.a185 = 865;
  41825. t.a194 = 771;
  41826. t.a198 = 888;
  41827. t.a186 = 967;
  41828. t.a195 = 888;
  41829. t.a187 = 831;
  41830. t.a188 = 873;
  41831. t.a189 = 927;
  41832. t.a190 = 970;
  41833. t.a191 = 918;
  41834. });
  41835. });
  41836. exports.getMetrics = getMetrics;
  41837. const getFontBasicMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  41838. t.Courier = {
  41839. ascent: 629,
  41840. descent: -157,
  41841. capHeight: 562,
  41842. xHeight: -426
  41843. };
  41844. t["Courier-Bold"] = {
  41845. ascent: 629,
  41846. descent: -157,
  41847. capHeight: 562,
  41848. xHeight: 439
  41849. };
  41850. t["Courier-Oblique"] = {
  41851. ascent: 629,
  41852. descent: -157,
  41853. capHeight: 562,
  41854. xHeight: 426
  41855. };
  41856. t["Courier-BoldOblique"] = {
  41857. ascent: 629,
  41858. descent: -157,
  41859. capHeight: 562,
  41860. xHeight: 426
  41861. };
  41862. t.Helvetica = {
  41863. ascent: 718,
  41864. descent: -207,
  41865. capHeight: 718,
  41866. xHeight: 523
  41867. };
  41868. t["Helvetica-Bold"] = {
  41869. ascent: 718,
  41870. descent: -207,
  41871. capHeight: 718,
  41872. xHeight: 532
  41873. };
  41874. t["Helvetica-Oblique"] = {
  41875. ascent: 718,
  41876. descent: -207,
  41877. capHeight: 718,
  41878. xHeight: 523
  41879. };
  41880. t["Helvetica-BoldOblique"] = {
  41881. ascent: 718,
  41882. descent: -207,
  41883. capHeight: 718,
  41884. xHeight: 532
  41885. };
  41886. t["Times-Roman"] = {
  41887. ascent: 683,
  41888. descent: -217,
  41889. capHeight: 662,
  41890. xHeight: 450
  41891. };
  41892. t["Times-Bold"] = {
  41893. ascent: 683,
  41894. descent: -217,
  41895. capHeight: 676,
  41896. xHeight: 461
  41897. };
  41898. t["Times-Italic"] = {
  41899. ascent: 683,
  41900. descent: -217,
  41901. capHeight: 653,
  41902. xHeight: 441
  41903. };
  41904. t["Times-BoldItalic"] = {
  41905. ascent: 683,
  41906. descent: -217,
  41907. capHeight: 669,
  41908. xHeight: 462
  41909. };
  41910. t.Symbol = {
  41911. ascent: Math.NaN,
  41912. descent: Math.NaN,
  41913. capHeight: Math.NaN,
  41914. xHeight: Math.NaN
  41915. };
  41916. t.ZapfDingbats = {
  41917. ascent: Math.NaN,
  41918. descent: Math.NaN,
  41919. capHeight: Math.NaN,
  41920. xHeight: Math.NaN
  41921. };
  41922. });
  41923. exports.getFontBasicMetrics = getFontBasicMetrics;
  41924. /***/ }),
  41925. /* 44 */
  41926. /***/ ((__unused_webpack_module, exports) => {
  41927. Object.defineProperty(exports, "__esModule", ({
  41928. value: true
  41929. }));
  41930. exports.GlyfTable = void 0;
  41931. const ON_CURVE_POINT = 1 << 0;
  41932. const X_SHORT_VECTOR = 1 << 1;
  41933. const Y_SHORT_VECTOR = 1 << 2;
  41934. const REPEAT_FLAG = 1 << 3;
  41935. const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4;
  41936. const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5;
  41937. const OVERLAP_SIMPLE = 1 << 6;
  41938. const ARG_1_AND_2_ARE_WORDS = 1 << 0;
  41939. const ARGS_ARE_XY_VALUES = 1 << 1;
  41940. const WE_HAVE_A_SCALE = 1 << 3;
  41941. const MORE_COMPONENTS = 1 << 5;
  41942. const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6;
  41943. const WE_HAVE_A_TWO_BY_TWO = 1 << 7;
  41944. const WE_HAVE_INSTRUCTIONS = 1 << 8;
  41945. class GlyfTable {
  41946. constructor({
  41947. glyfTable,
  41948. isGlyphLocationsLong,
  41949. locaTable,
  41950. numGlyphs
  41951. }) {
  41952. this.glyphs = [];
  41953. const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength);
  41954. const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength);
  41955. const offsetSize = isGlyphLocationsLong ? 4 : 2;
  41956. let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0);
  41957. let pos = 0;
  41958. for (let i = 0; i < numGlyphs; i++) {
  41959. pos += offsetSize;
  41960. const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos);
  41961. if (next === prev) {
  41962. this.glyphs.push(new Glyph({}));
  41963. continue;
  41964. }
  41965. const glyph = Glyph.parse(prev, glyf);
  41966. this.glyphs.push(glyph);
  41967. prev = next;
  41968. }
  41969. }
  41970. getSize() {
  41971. return this.glyphs.reduce((a, g) => {
  41972. const size = g.getSize();
  41973. return a + (size + 3 & ~3);
  41974. }, 0);
  41975. }
  41976. write() {
  41977. const totalSize = this.getSize();
  41978. const glyfTable = new DataView(new ArrayBuffer(totalSize));
  41979. const isLocationLong = totalSize > 0x1fffe;
  41980. const offsetSize = isLocationLong ? 4 : 2;
  41981. const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize));
  41982. if (isLocationLong) {
  41983. locaTable.setUint32(0, 0);
  41984. } else {
  41985. locaTable.setUint16(0, 0);
  41986. }
  41987. let pos = 0;
  41988. let locaIndex = 0;
  41989. for (const glyph of this.glyphs) {
  41990. pos += glyph.write(pos, glyfTable);
  41991. pos = pos + 3 & ~3;
  41992. locaIndex += offsetSize;
  41993. if (isLocationLong) {
  41994. locaTable.setUint32(locaIndex, pos);
  41995. } else {
  41996. locaTable.setUint16(locaIndex, pos >> 1);
  41997. }
  41998. }
  41999. return {
  42000. isLocationLong,
  42001. loca: new Uint8Array(locaTable.buffer),
  42002. glyf: new Uint8Array(glyfTable.buffer)
  42003. };
  42004. }
  42005. scale(factors) {
  42006. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  42007. this.glyphs[i].scale(factors[i]);
  42008. }
  42009. }
  42010. }
  42011. exports.GlyfTable = GlyfTable;
  42012. class Glyph {
  42013. constructor({
  42014. header = null,
  42015. simple = null,
  42016. composites = null
  42017. }) {
  42018. this.header = header;
  42019. this.simple = simple;
  42020. this.composites = composites;
  42021. }
  42022. static parse(pos, glyf) {
  42023. const [read, header] = GlyphHeader.parse(pos, glyf);
  42024. pos += read;
  42025. if (header.numberOfContours < 0) {
  42026. const composites = [];
  42027. while (true) {
  42028. const [n, composite] = CompositeGlyph.parse(pos, glyf);
  42029. pos += n;
  42030. composites.push(composite);
  42031. if (!(composite.flags & MORE_COMPONENTS)) {
  42032. break;
  42033. }
  42034. }
  42035. return new Glyph({
  42036. header,
  42037. composites
  42038. });
  42039. }
  42040. const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours);
  42041. return new Glyph({
  42042. header,
  42043. simple
  42044. });
  42045. }
  42046. getSize() {
  42047. if (!this.header) {
  42048. return 0;
  42049. }
  42050. const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0);
  42051. return this.header.getSize() + size;
  42052. }
  42053. write(pos, buf) {
  42054. if (!this.header) {
  42055. return 0;
  42056. }
  42057. const spos = pos;
  42058. pos += this.header.write(pos, buf);
  42059. if (this.simple) {
  42060. pos += this.simple.write(pos, buf);
  42061. } else {
  42062. for (const composite of this.composites) {
  42063. pos += composite.write(pos, buf);
  42064. }
  42065. }
  42066. return pos - spos;
  42067. }
  42068. scale(factor) {
  42069. if (!this.header) {
  42070. return;
  42071. }
  42072. const xMiddle = (this.header.xMin + this.header.xMax) / 2;
  42073. this.header.scale(xMiddle, factor);
  42074. if (this.simple) {
  42075. this.simple.scale(xMiddle, factor);
  42076. } else {
  42077. for (const composite of this.composites) {
  42078. composite.scale(xMiddle, factor);
  42079. }
  42080. }
  42081. }
  42082. }
  42083. class GlyphHeader {
  42084. constructor({
  42085. numberOfContours,
  42086. xMin,
  42087. yMin,
  42088. xMax,
  42089. yMax
  42090. }) {
  42091. this.numberOfContours = numberOfContours;
  42092. this.xMin = xMin;
  42093. this.yMin = yMin;
  42094. this.xMax = xMax;
  42095. this.yMax = yMax;
  42096. }
  42097. static parse(pos, glyf) {
  42098. return [10, new GlyphHeader({
  42099. numberOfContours: glyf.getInt16(pos),
  42100. xMin: glyf.getInt16(pos + 2),
  42101. yMin: glyf.getInt16(pos + 4),
  42102. xMax: glyf.getInt16(pos + 6),
  42103. yMax: glyf.getInt16(pos + 8)
  42104. })];
  42105. }
  42106. getSize() {
  42107. return 10;
  42108. }
  42109. write(pos, buf) {
  42110. buf.setInt16(pos, this.numberOfContours);
  42111. buf.setInt16(pos + 2, this.xMin);
  42112. buf.setInt16(pos + 4, this.yMin);
  42113. buf.setInt16(pos + 6, this.xMax);
  42114. buf.setInt16(pos + 8, this.yMax);
  42115. return 10;
  42116. }
  42117. scale(x, factor) {
  42118. this.xMin = Math.round(x + (this.xMin - x) * factor);
  42119. this.xMax = Math.round(x + (this.xMax - x) * factor);
  42120. }
  42121. }
  42122. class Contour {
  42123. constructor({
  42124. flags,
  42125. xCoordinates,
  42126. yCoordinates
  42127. }) {
  42128. this.xCoordinates = xCoordinates;
  42129. this.yCoordinates = yCoordinates;
  42130. this.flags = flags;
  42131. }
  42132. }
  42133. class SimpleGlyph {
  42134. constructor({
  42135. contours,
  42136. instructions
  42137. }) {
  42138. this.contours = contours;
  42139. this.instructions = instructions;
  42140. }
  42141. static parse(pos, glyf, numberOfContours) {
  42142. const endPtsOfContours = [];
  42143. for (let i = 0; i < numberOfContours; i++) {
  42144. const endPt = glyf.getUint16(pos);
  42145. pos += 2;
  42146. endPtsOfContours.push(endPt);
  42147. }
  42148. const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1;
  42149. const instructionLength = glyf.getUint16(pos);
  42150. pos += 2;
  42151. const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  42152. pos += instructionLength;
  42153. const flags = [];
  42154. for (let i = 0; i < numberOfPt; pos++, i++) {
  42155. let flag = glyf.getUint8(pos);
  42156. flags.push(flag);
  42157. if (flag & REPEAT_FLAG) {
  42158. const count = glyf.getUint8(++pos);
  42159. flag ^= REPEAT_FLAG;
  42160. for (let m = 0; m < count; m++) {
  42161. flags.push(flag);
  42162. }
  42163. i += count;
  42164. }
  42165. }
  42166. const allXCoordinates = [];
  42167. let xCoordinates = [];
  42168. let yCoordinates = [];
  42169. let pointFlags = [];
  42170. const contours = [];
  42171. let endPtsOfContoursIndex = 0;
  42172. let lastCoordinate = 0;
  42173. for (let i = 0; i < numberOfPt; i++) {
  42174. const flag = flags[i];
  42175. if (flag & X_SHORT_VECTOR) {
  42176. const x = glyf.getUint8(pos++);
  42177. lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x;
  42178. xCoordinates.push(lastCoordinate);
  42179. } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) {
  42180. xCoordinates.push(lastCoordinate);
  42181. } else {
  42182. lastCoordinate += glyf.getInt16(pos);
  42183. pos += 2;
  42184. xCoordinates.push(lastCoordinate);
  42185. }
  42186. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  42187. endPtsOfContoursIndex++;
  42188. allXCoordinates.push(xCoordinates);
  42189. xCoordinates = [];
  42190. }
  42191. }
  42192. lastCoordinate = 0;
  42193. endPtsOfContoursIndex = 0;
  42194. for (let i = 0; i < numberOfPt; i++) {
  42195. const flag = flags[i];
  42196. if (flag & Y_SHORT_VECTOR) {
  42197. const y = glyf.getUint8(pos++);
  42198. lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y;
  42199. yCoordinates.push(lastCoordinate);
  42200. } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) {
  42201. yCoordinates.push(lastCoordinate);
  42202. } else {
  42203. lastCoordinate += glyf.getInt16(pos);
  42204. pos += 2;
  42205. yCoordinates.push(lastCoordinate);
  42206. }
  42207. pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE);
  42208. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  42209. xCoordinates = allXCoordinates[endPtsOfContoursIndex];
  42210. endPtsOfContoursIndex++;
  42211. contours.push(new Contour({
  42212. flags: pointFlags,
  42213. xCoordinates,
  42214. yCoordinates
  42215. }));
  42216. yCoordinates = [];
  42217. pointFlags = [];
  42218. }
  42219. }
  42220. return new SimpleGlyph({
  42221. contours,
  42222. instructions
  42223. });
  42224. }
  42225. getSize() {
  42226. let size = this.contours.length * 2 + 2 + this.instructions.length;
  42227. let lastX = 0;
  42228. let lastY = 0;
  42229. for (const contour of this.contours) {
  42230. size += contour.flags.length;
  42231. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  42232. const x = contour.xCoordinates[i];
  42233. const y = contour.yCoordinates[i];
  42234. let abs = Math.abs(x - lastX);
  42235. if (abs > 255) {
  42236. size += 2;
  42237. } else if (abs > 0) {
  42238. size += 1;
  42239. }
  42240. lastX = x;
  42241. abs = Math.abs(y - lastY);
  42242. if (abs > 255) {
  42243. size += 2;
  42244. } else if (abs > 0) {
  42245. size += 1;
  42246. }
  42247. lastY = y;
  42248. }
  42249. }
  42250. return size;
  42251. }
  42252. write(pos, buf) {
  42253. const spos = pos;
  42254. const xCoordinates = [];
  42255. const yCoordinates = [];
  42256. const flags = [];
  42257. let lastX = 0;
  42258. let lastY = 0;
  42259. for (const contour of this.contours) {
  42260. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  42261. let flag = contour.flags[i];
  42262. const x = contour.xCoordinates[i];
  42263. let delta = x - lastX;
  42264. if (delta === 0) {
  42265. flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR;
  42266. xCoordinates.push(0);
  42267. } else {
  42268. const abs = Math.abs(delta);
  42269. if (abs <= 255) {
  42270. flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR;
  42271. xCoordinates.push(abs);
  42272. } else {
  42273. xCoordinates.push(delta);
  42274. }
  42275. }
  42276. lastX = x;
  42277. const y = contour.yCoordinates[i];
  42278. delta = y - lastY;
  42279. if (delta === 0) {
  42280. flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR;
  42281. yCoordinates.push(0);
  42282. } else {
  42283. const abs = Math.abs(delta);
  42284. if (abs <= 255) {
  42285. flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR;
  42286. yCoordinates.push(abs);
  42287. } else {
  42288. yCoordinates.push(delta);
  42289. }
  42290. }
  42291. lastY = y;
  42292. flags.push(flag);
  42293. }
  42294. buf.setUint16(pos, xCoordinates.length - 1);
  42295. pos += 2;
  42296. }
  42297. buf.setUint16(pos, this.instructions.length);
  42298. pos += 2;
  42299. if (this.instructions.length) {
  42300. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  42301. pos += this.instructions.length;
  42302. }
  42303. for (const flag of flags) {
  42304. buf.setUint8(pos++, flag);
  42305. }
  42306. for (let i = 0, ii = xCoordinates.length; i < ii; i++) {
  42307. const x = xCoordinates[i];
  42308. const flag = flags[i];
  42309. if (flag & X_SHORT_VECTOR) {
  42310. buf.setUint8(pos++, x);
  42311. } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) {
  42312. buf.setInt16(pos, x);
  42313. pos += 2;
  42314. }
  42315. }
  42316. for (let i = 0, ii = yCoordinates.length; i < ii; i++) {
  42317. const y = yCoordinates[i];
  42318. const flag = flags[i];
  42319. if (flag & Y_SHORT_VECTOR) {
  42320. buf.setUint8(pos++, y);
  42321. } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) {
  42322. buf.setInt16(pos, y);
  42323. pos += 2;
  42324. }
  42325. }
  42326. return pos - spos;
  42327. }
  42328. scale(x, factor) {
  42329. for (const contour of this.contours) {
  42330. if (contour.xCoordinates.length === 0) {
  42331. continue;
  42332. }
  42333. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  42334. contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor);
  42335. }
  42336. }
  42337. }
  42338. }
  42339. class CompositeGlyph {
  42340. constructor({
  42341. flags,
  42342. glyphIndex,
  42343. argument1,
  42344. argument2,
  42345. transf,
  42346. instructions
  42347. }) {
  42348. this.flags = flags;
  42349. this.glyphIndex = glyphIndex;
  42350. this.argument1 = argument1;
  42351. this.argument2 = argument2;
  42352. this.transf = transf;
  42353. this.instructions = instructions;
  42354. }
  42355. static parse(pos, glyf) {
  42356. const spos = pos;
  42357. const transf = [];
  42358. let flags = glyf.getUint16(pos);
  42359. const glyphIndex = glyf.getUint16(pos + 2);
  42360. pos += 4;
  42361. let argument1, argument2;
  42362. if (flags & ARG_1_AND_2_ARE_WORDS) {
  42363. if (flags & ARGS_ARE_XY_VALUES) {
  42364. argument1 = glyf.getInt16(pos);
  42365. argument2 = glyf.getInt16(pos + 2);
  42366. } else {
  42367. argument1 = glyf.getUint16(pos);
  42368. argument2 = glyf.getUint16(pos + 2);
  42369. }
  42370. pos += 4;
  42371. flags ^= ARG_1_AND_2_ARE_WORDS;
  42372. } else {
  42373. if (flags & ARGS_ARE_XY_VALUES) {
  42374. argument1 = glyf.getInt8(pos);
  42375. argument2 = glyf.getInt8(pos + 1);
  42376. } else {
  42377. argument1 = glyf.getUint8(pos);
  42378. argument2 = glyf.getUint8(pos + 1);
  42379. }
  42380. pos += 2;
  42381. }
  42382. if (flags & WE_HAVE_A_SCALE) {
  42383. transf.push(glyf.getUint16(pos));
  42384. pos += 2;
  42385. } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
  42386. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2));
  42387. pos += 4;
  42388. } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
  42389. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6));
  42390. pos += 8;
  42391. }
  42392. let instructions = null;
  42393. if (flags & WE_HAVE_INSTRUCTIONS) {
  42394. const instructionLength = glyf.getUint16(pos);
  42395. pos += 2;
  42396. instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  42397. pos += instructionLength;
  42398. }
  42399. return [pos - spos, new CompositeGlyph({
  42400. flags,
  42401. glyphIndex,
  42402. argument1,
  42403. argument2,
  42404. transf,
  42405. instructions
  42406. })];
  42407. }
  42408. getSize() {
  42409. let size = 2 + 2 + this.transf.length * 2;
  42410. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  42411. size += 2 + this.instructions.length;
  42412. }
  42413. size += 2;
  42414. if (this.flags & 2) {
  42415. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  42416. size += 2;
  42417. }
  42418. } else {
  42419. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  42420. size += 2;
  42421. }
  42422. }
  42423. return size;
  42424. }
  42425. write(pos, buf) {
  42426. const spos = pos;
  42427. if (this.flags & ARGS_ARE_XY_VALUES) {
  42428. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  42429. this.flags |= ARG_1_AND_2_ARE_WORDS;
  42430. }
  42431. } else {
  42432. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  42433. this.flags |= ARG_1_AND_2_ARE_WORDS;
  42434. }
  42435. }
  42436. buf.setUint16(pos, this.flags);
  42437. buf.setUint16(pos + 2, this.glyphIndex);
  42438. pos += 4;
  42439. if (this.flags & ARG_1_AND_2_ARE_WORDS) {
  42440. if (this.flags & ARGS_ARE_XY_VALUES) {
  42441. buf.setInt16(pos, this.argument1);
  42442. buf.setInt16(pos + 2, this.argument2);
  42443. } else {
  42444. buf.setUint16(pos, this.argument1);
  42445. buf.setUint16(pos + 2, this.argument2);
  42446. }
  42447. pos += 4;
  42448. } else {
  42449. buf.setUint8(pos, this.argument1);
  42450. buf.setUint8(pos + 1, this.argument2);
  42451. pos += 2;
  42452. }
  42453. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  42454. buf.setUint16(pos, this.instructions.length);
  42455. pos += 2;
  42456. if (this.instructions.length) {
  42457. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  42458. pos += this.instructions.length;
  42459. }
  42460. }
  42461. return pos - spos;
  42462. }
  42463. scale(x, factor) {}
  42464. }
  42465. /***/ }),
  42466. /* 45 */
  42467. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42468. Object.defineProperty(exports, "__esModule", ({
  42469. value: true
  42470. }));
  42471. exports.OpenTypeFileBuilder = void 0;
  42472. var _core_utils = __w_pdfjs_require__(4);
  42473. var _util = __w_pdfjs_require__(2);
  42474. function writeInt16(dest, offset, num) {
  42475. dest[offset] = num >> 8 & 0xff;
  42476. dest[offset + 1] = num & 0xff;
  42477. }
  42478. function writeInt32(dest, offset, num) {
  42479. dest[offset] = num >> 24 & 0xff;
  42480. dest[offset + 1] = num >> 16 & 0xff;
  42481. dest[offset + 2] = num >> 8 & 0xff;
  42482. dest[offset + 3] = num & 0xff;
  42483. }
  42484. function writeData(dest, offset, data) {
  42485. if (data instanceof Uint8Array) {
  42486. dest.set(data, offset);
  42487. } else if (typeof data === "string") {
  42488. for (let i = 0, ii = data.length; i < ii; i++) {
  42489. dest[offset++] = data.charCodeAt(i) & 0xff;
  42490. }
  42491. } else {
  42492. for (const num of data) {
  42493. dest[offset++] = num & 0xff;
  42494. }
  42495. }
  42496. }
  42497. const OTF_HEADER_SIZE = 12;
  42498. const OTF_TABLE_ENTRY_SIZE = 16;
  42499. class OpenTypeFileBuilder {
  42500. constructor(sfnt) {
  42501. this.sfnt = sfnt;
  42502. this.tables = Object.create(null);
  42503. }
  42504. static getSearchParams(entriesCount, entrySize) {
  42505. let maxPower2 = 1,
  42506. log2 = 0;
  42507. while ((maxPower2 ^ entriesCount) > maxPower2) {
  42508. maxPower2 <<= 1;
  42509. log2++;
  42510. }
  42511. const searchRange = maxPower2 * entrySize;
  42512. return {
  42513. range: searchRange,
  42514. entry: log2,
  42515. rangeShift: entrySize * entriesCount - searchRange
  42516. };
  42517. }
  42518. toArray() {
  42519. let sfnt = this.sfnt;
  42520. const tables = this.tables;
  42521. const tablesNames = Object.keys(tables);
  42522. tablesNames.sort();
  42523. const numTables = tablesNames.length;
  42524. let i, j, jj, table, tableName;
  42525. let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  42526. const tableOffsets = [offset];
  42527. for (i = 0; i < numTables; i++) {
  42528. table = tables[tablesNames[i]];
  42529. const paddedLength = (table.length + 3 & ~3) >>> 0;
  42530. offset += paddedLength;
  42531. tableOffsets.push(offset);
  42532. }
  42533. const file = new Uint8Array(offset);
  42534. for (i = 0; i < numTables; i++) {
  42535. table = tables[tablesNames[i]];
  42536. writeData(file, tableOffsets[i], table);
  42537. }
  42538. if (sfnt === "true") {
  42539. sfnt = (0, _util.string32)(0x00010000);
  42540. }
  42541. file[0] = sfnt.charCodeAt(0) & 0xff;
  42542. file[1] = sfnt.charCodeAt(1) & 0xff;
  42543. file[2] = sfnt.charCodeAt(2) & 0xff;
  42544. file[3] = sfnt.charCodeAt(3) & 0xff;
  42545. writeInt16(file, 4, numTables);
  42546. const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  42547. writeInt16(file, 6, searchParams.range);
  42548. writeInt16(file, 8, searchParams.entry);
  42549. writeInt16(file, 10, searchParams.rangeShift);
  42550. offset = OTF_HEADER_SIZE;
  42551. for (i = 0; i < numTables; i++) {
  42552. tableName = tablesNames[i];
  42553. file[offset] = tableName.charCodeAt(0) & 0xff;
  42554. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  42555. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  42556. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  42557. let checksum = 0;
  42558. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  42559. const quad = (0, _core_utils.readUint32)(file, j);
  42560. checksum = checksum + quad >>> 0;
  42561. }
  42562. writeInt32(file, offset + 4, checksum);
  42563. writeInt32(file, offset + 8, tableOffsets[i]);
  42564. writeInt32(file, offset + 12, tables[tableName].length);
  42565. offset += OTF_TABLE_ENTRY_SIZE;
  42566. }
  42567. return file;
  42568. }
  42569. addTable(tag, data) {
  42570. if (tag in this.tables) {
  42571. throw new Error("Table " + tag + " already exists");
  42572. }
  42573. this.tables[tag] = data;
  42574. }
  42575. }
  42576. exports.OpenTypeFileBuilder = OpenTypeFileBuilder;
  42577. /***/ }),
  42578. /* 46 */
  42579. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42580. Object.defineProperty(exports, "__esModule", ({
  42581. value: true
  42582. }));
  42583. exports.Type1Font = void 0;
  42584. var _cff_parser = __w_pdfjs_require__(33);
  42585. var _util = __w_pdfjs_require__(2);
  42586. var _fonts_utils = __w_pdfjs_require__(36);
  42587. var _core_utils = __w_pdfjs_require__(4);
  42588. var _stream = __w_pdfjs_require__(8);
  42589. var _type1_parser = __w_pdfjs_require__(47);
  42590. function findBlock(streamBytes, signature, startIndex) {
  42591. const streamBytesLength = streamBytes.length;
  42592. const signatureLength = signature.length;
  42593. const scanLength = streamBytesLength - signatureLength;
  42594. let i = startIndex,
  42595. found = false;
  42596. while (i < scanLength) {
  42597. let j = 0;
  42598. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  42599. j++;
  42600. }
  42601. if (j >= signatureLength) {
  42602. i += j;
  42603. while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) {
  42604. i++;
  42605. }
  42606. found = true;
  42607. break;
  42608. }
  42609. i++;
  42610. }
  42611. return {
  42612. found,
  42613. length: i
  42614. };
  42615. }
  42616. function getHeaderBlock(stream, suggestedLength) {
  42617. const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  42618. const streamStartPos = stream.pos;
  42619. let headerBytes, headerBytesLength, block;
  42620. try {
  42621. headerBytes = stream.getBytes(suggestedLength);
  42622. headerBytesLength = headerBytes.length;
  42623. } catch (ex) {}
  42624. if (headerBytesLength === suggestedLength) {
  42625. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  42626. if (block.found && block.length === suggestedLength) {
  42627. return {
  42628. stream: new _stream.Stream(headerBytes),
  42629. length: suggestedLength
  42630. };
  42631. }
  42632. }
  42633. (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
  42634. stream.pos = streamStartPos;
  42635. const SCAN_BLOCK_LENGTH = 2048;
  42636. let actualLength;
  42637. while (true) {
  42638. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  42639. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  42640. if (block.length === 0) {
  42641. break;
  42642. }
  42643. stream.pos += block.length;
  42644. if (block.found) {
  42645. actualLength = stream.pos - streamStartPos;
  42646. break;
  42647. }
  42648. }
  42649. stream.pos = streamStartPos;
  42650. if (actualLength) {
  42651. return {
  42652. stream: new _stream.Stream(stream.getBytes(actualLength)),
  42653. length: actualLength
  42654. };
  42655. }
  42656. (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
  42657. return {
  42658. stream: new _stream.Stream(stream.getBytes(suggestedLength)),
  42659. length: suggestedLength
  42660. };
  42661. }
  42662. function getEexecBlock(stream, suggestedLength) {
  42663. const eexecBytes = stream.getBytes();
  42664. if (eexecBytes.length === 0) {
  42665. throw new _util.FormatError("getEexecBlock - no font program found.");
  42666. }
  42667. return {
  42668. stream: new _stream.Stream(eexecBytes),
  42669. length: eexecBytes.length
  42670. };
  42671. }
  42672. class Type1Font {
  42673. constructor(name, file, properties) {
  42674. const PFB_HEADER_SIZE = 6;
  42675. let headerBlockLength = properties.length1;
  42676. let eexecBlockLength = properties.length2;
  42677. let pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  42678. const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  42679. if (pfbHeaderPresent) {
  42680. file.skip(PFB_HEADER_SIZE);
  42681. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  42682. }
  42683. const headerBlock = getHeaderBlock(file, headerBlockLength);
  42684. const headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  42685. headerBlockParser.extractFontHeader(properties);
  42686. if (pfbHeaderPresent) {
  42687. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  42688. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  42689. }
  42690. const eexecBlock = getEexecBlock(file, eexecBlockLength);
  42691. const eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  42692. const data = eexecBlockParser.extractFontProgram(properties);
  42693. for (const key in data.properties) {
  42694. properties[key] = data.properties[key];
  42695. }
  42696. const charstrings = data.charstrings;
  42697. const type2Charstrings = this.getType2Charstrings(charstrings);
  42698. const subrs = this.getType2Subrs(data.subrs);
  42699. this.charstrings = charstrings;
  42700. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  42701. this.seacs = this.getSeacs(data.charstrings);
  42702. }
  42703. get numGlyphs() {
  42704. return this.charstrings.length + 1;
  42705. }
  42706. getCharset() {
  42707. const charset = [".notdef"];
  42708. for (const {
  42709. glyphName
  42710. } of this.charstrings) {
  42711. charset.push(glyphName);
  42712. }
  42713. return charset;
  42714. }
  42715. getGlyphMapping(properties) {
  42716. const charstrings = this.charstrings;
  42717. if (properties.composite) {
  42718. const charCodeToGlyphId = Object.create(null);
  42719. for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
  42720. const charCode = properties.cMap.charCodeOf(glyphId);
  42721. charCodeToGlyphId[charCode] = glyphId + 1;
  42722. }
  42723. return charCodeToGlyphId;
  42724. }
  42725. const glyphNames = [".notdef"];
  42726. let builtInEncoding, glyphId;
  42727. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  42728. glyphNames.push(charstrings[glyphId].glyphName);
  42729. }
  42730. const encoding = properties.builtInEncoding;
  42731. if (encoding) {
  42732. builtInEncoding = Object.create(null);
  42733. for (const charCode in encoding) {
  42734. glyphId = glyphNames.indexOf(encoding[charCode]);
  42735. if (glyphId >= 0) {
  42736. builtInEncoding[charCode] = glyphId;
  42737. }
  42738. }
  42739. }
  42740. return (0, _fonts_utils.type1FontGlyphMapping)(properties, builtInEncoding, glyphNames);
  42741. }
  42742. hasGlyphId(id) {
  42743. if (id < 0 || id >= this.numGlyphs) {
  42744. return false;
  42745. }
  42746. if (id === 0) {
  42747. return true;
  42748. }
  42749. const glyph = this.charstrings[id - 1];
  42750. return glyph.charstring.length > 0;
  42751. }
  42752. getSeacs(charstrings) {
  42753. const seacMap = [];
  42754. for (let i = 0, ii = charstrings.length; i < ii; i++) {
  42755. const charstring = charstrings[i];
  42756. if (charstring.seac) {
  42757. seacMap[i + 1] = charstring.seac;
  42758. }
  42759. }
  42760. return seacMap;
  42761. }
  42762. getType2Charstrings(type1Charstrings) {
  42763. const type2Charstrings = [];
  42764. for (const type1Charstring of type1Charstrings) {
  42765. type2Charstrings.push(type1Charstring.charstring);
  42766. }
  42767. return type2Charstrings;
  42768. }
  42769. getType2Subrs(type1Subrs) {
  42770. let bias = 0;
  42771. const count = type1Subrs.length;
  42772. if (count < 1133) {
  42773. bias = 107;
  42774. } else if (count < 33769) {
  42775. bias = 1131;
  42776. } else {
  42777. bias = 32768;
  42778. }
  42779. const type2Subrs = [];
  42780. let i;
  42781. for (i = 0; i < bias; i++) {
  42782. type2Subrs.push([0x0b]);
  42783. }
  42784. for (i = 0; i < count; i++) {
  42785. type2Subrs.push(type1Subrs[i]);
  42786. }
  42787. return type2Subrs;
  42788. }
  42789. wrap(name, glyphs, charstrings, subrs, properties) {
  42790. const cff = new _cff_parser.CFF();
  42791. cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
  42792. cff.names = [name];
  42793. const topDict = new _cff_parser.CFFTopDict();
  42794. topDict.setByName("version", 391);
  42795. topDict.setByName("Notice", 392);
  42796. topDict.setByName("FullName", 393);
  42797. topDict.setByName("FamilyName", 394);
  42798. topDict.setByName("Weight", 395);
  42799. topDict.setByName("Encoding", null);
  42800. topDict.setByName("FontMatrix", properties.fontMatrix);
  42801. topDict.setByName("FontBBox", properties.bbox);
  42802. topDict.setByName("charset", null);
  42803. topDict.setByName("CharStrings", null);
  42804. topDict.setByName("Private", null);
  42805. cff.topDict = topDict;
  42806. const strings = new _cff_parser.CFFStrings();
  42807. strings.add("Version 0.11");
  42808. strings.add("See original notice");
  42809. strings.add(name);
  42810. strings.add(name);
  42811. strings.add("Medium");
  42812. cff.strings = strings;
  42813. cff.globalSubrIndex = new _cff_parser.CFFIndex();
  42814. const count = glyphs.length;
  42815. const charsetArray = [".notdef"];
  42816. let i, ii;
  42817. for (i = 0; i < count; i++) {
  42818. const glyphName = charstrings[i].glyphName;
  42819. const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
  42820. if (index === -1) {
  42821. strings.add(glyphName);
  42822. }
  42823. charsetArray.push(glyphName);
  42824. }
  42825. cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
  42826. const charStringsIndex = new _cff_parser.CFFIndex();
  42827. charStringsIndex.add([0x8b, 0x0e]);
  42828. for (i = 0; i < count; i++) {
  42829. charStringsIndex.add(glyphs[i]);
  42830. }
  42831. cff.charStrings = charStringsIndex;
  42832. const privateDict = new _cff_parser.CFFPrivateDict();
  42833. privateDict.setByName("Subrs", null);
  42834. const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
  42835. for (i = 0, ii = fields.length; i < ii; i++) {
  42836. const field = fields[i];
  42837. if (!(field in properties.privateData)) {
  42838. continue;
  42839. }
  42840. const value = properties.privateData[field];
  42841. if (Array.isArray(value)) {
  42842. for (let j = value.length - 1; j > 0; j--) {
  42843. value[j] -= value[j - 1];
  42844. }
  42845. }
  42846. privateDict.setByName(field, value);
  42847. }
  42848. cff.topDict.privateDict = privateDict;
  42849. const subrIndex = new _cff_parser.CFFIndex();
  42850. for (i = 0, ii = subrs.length; i < ii; i++) {
  42851. subrIndex.add(subrs[i]);
  42852. }
  42853. privateDict.subrsIndex = subrIndex;
  42854. const compiler = new _cff_parser.CFFCompiler(cff);
  42855. return compiler.compile();
  42856. }
  42857. }
  42858. exports.Type1Font = Type1Font;
  42859. /***/ }),
  42860. /* 47 */
  42861. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42862. Object.defineProperty(exports, "__esModule", ({
  42863. value: true
  42864. }));
  42865. exports.Type1Parser = void 0;
  42866. var _encodings = __w_pdfjs_require__(35);
  42867. var _core_utils = __w_pdfjs_require__(4);
  42868. var _stream = __w_pdfjs_require__(8);
  42869. var _util = __w_pdfjs_require__(2);
  42870. const HINTING_ENABLED = false;
  42871. const COMMAND_MAP = {
  42872. hstem: [1],
  42873. vstem: [3],
  42874. vmoveto: [4],
  42875. rlineto: [5],
  42876. hlineto: [6],
  42877. vlineto: [7],
  42878. rrcurveto: [8],
  42879. callsubr: [10],
  42880. flex: [12, 35],
  42881. drop: [12, 18],
  42882. endchar: [14],
  42883. rmoveto: [21],
  42884. hmoveto: [22],
  42885. vhcurveto: [30],
  42886. hvcurveto: [31]
  42887. };
  42888. class Type1CharString {
  42889. constructor() {
  42890. this.width = 0;
  42891. this.lsb = 0;
  42892. this.flexing = false;
  42893. this.output = [];
  42894. this.stack = [];
  42895. }
  42896. convert(encoded, subrs, seacAnalysisEnabled) {
  42897. const count = encoded.length;
  42898. let error = false;
  42899. let wx, sbx, subrNumber;
  42900. for (let i = 0; i < count; i++) {
  42901. let value = encoded[i];
  42902. if (value < 32) {
  42903. if (value === 12) {
  42904. value = (value << 8) + encoded[++i];
  42905. }
  42906. switch (value) {
  42907. case 1:
  42908. if (!HINTING_ENABLED) {
  42909. this.stack = [];
  42910. break;
  42911. }
  42912. error = this.executeCommand(2, COMMAND_MAP.hstem);
  42913. break;
  42914. case 3:
  42915. if (!HINTING_ENABLED) {
  42916. this.stack = [];
  42917. break;
  42918. }
  42919. error = this.executeCommand(2, COMMAND_MAP.vstem);
  42920. break;
  42921. case 4:
  42922. if (this.flexing) {
  42923. if (this.stack.length < 1) {
  42924. error = true;
  42925. break;
  42926. }
  42927. const dy = this.stack.pop();
  42928. this.stack.push(0, dy);
  42929. break;
  42930. }
  42931. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  42932. break;
  42933. case 5:
  42934. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  42935. break;
  42936. case 6:
  42937. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  42938. break;
  42939. case 7:
  42940. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  42941. break;
  42942. case 8:
  42943. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  42944. break;
  42945. case 9:
  42946. this.stack = [];
  42947. break;
  42948. case 10:
  42949. if (this.stack.length < 1) {
  42950. error = true;
  42951. break;
  42952. }
  42953. subrNumber = this.stack.pop();
  42954. if (!subrs[subrNumber]) {
  42955. error = true;
  42956. break;
  42957. }
  42958. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  42959. break;
  42960. case 11:
  42961. return error;
  42962. case 13:
  42963. if (this.stack.length < 2) {
  42964. error = true;
  42965. break;
  42966. }
  42967. wx = this.stack.pop();
  42968. sbx = this.stack.pop();
  42969. this.lsb = sbx;
  42970. this.width = wx;
  42971. this.stack.push(wx, sbx);
  42972. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  42973. break;
  42974. case 14:
  42975. this.output.push(COMMAND_MAP.endchar[0]);
  42976. break;
  42977. case 21:
  42978. if (this.flexing) {
  42979. break;
  42980. }
  42981. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  42982. break;
  42983. case 22:
  42984. if (this.flexing) {
  42985. this.stack.push(0);
  42986. break;
  42987. }
  42988. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  42989. break;
  42990. case 30:
  42991. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  42992. break;
  42993. case 31:
  42994. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  42995. break;
  42996. case (12 << 8) + 0:
  42997. this.stack = [];
  42998. break;
  42999. case (12 << 8) + 1:
  43000. if (!HINTING_ENABLED) {
  43001. this.stack = [];
  43002. break;
  43003. }
  43004. error = this.executeCommand(2, COMMAND_MAP.vstem);
  43005. break;
  43006. case (12 << 8) + 2:
  43007. if (!HINTING_ENABLED) {
  43008. this.stack = [];
  43009. break;
  43010. }
  43011. error = this.executeCommand(2, COMMAND_MAP.hstem);
  43012. break;
  43013. case (12 << 8) + 6:
  43014. if (seacAnalysisEnabled) {
  43015. const asb = this.stack.at(-5);
  43016. this.seac = this.stack.splice(-4, 4);
  43017. this.seac[0] += this.lsb - asb;
  43018. error = this.executeCommand(0, COMMAND_MAP.endchar);
  43019. } else {
  43020. error = this.executeCommand(4, COMMAND_MAP.endchar);
  43021. }
  43022. break;
  43023. case (12 << 8) + 7:
  43024. if (this.stack.length < 4) {
  43025. error = true;
  43026. break;
  43027. }
  43028. this.stack.pop();
  43029. wx = this.stack.pop();
  43030. const sby = this.stack.pop();
  43031. sbx = this.stack.pop();
  43032. this.lsb = sbx;
  43033. this.width = wx;
  43034. this.stack.push(wx, sbx, sby);
  43035. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  43036. break;
  43037. case (12 << 8) + 12:
  43038. if (this.stack.length < 2) {
  43039. error = true;
  43040. break;
  43041. }
  43042. const num2 = this.stack.pop();
  43043. const num1 = this.stack.pop();
  43044. this.stack.push(num1 / num2);
  43045. break;
  43046. case (12 << 8) + 16:
  43047. if (this.stack.length < 2) {
  43048. error = true;
  43049. break;
  43050. }
  43051. subrNumber = this.stack.pop();
  43052. const numArgs = this.stack.pop();
  43053. if (subrNumber === 0 && numArgs === 3) {
  43054. const flexArgs = this.stack.splice(this.stack.length - 17, 17);
  43055. this.stack.push(flexArgs[2] + flexArgs[0], flexArgs[3] + flexArgs[1], flexArgs[4], flexArgs[5], flexArgs[6], flexArgs[7], flexArgs[8], flexArgs[9], flexArgs[10], flexArgs[11], flexArgs[12], flexArgs[13], flexArgs[14]);
  43056. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  43057. this.flexing = false;
  43058. this.stack.push(flexArgs[15], flexArgs[16]);
  43059. } else if (subrNumber === 1 && numArgs === 0) {
  43060. this.flexing = true;
  43061. }
  43062. break;
  43063. case (12 << 8) + 17:
  43064. break;
  43065. case (12 << 8) + 33:
  43066. this.stack = [];
  43067. break;
  43068. default:
  43069. (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
  43070. break;
  43071. }
  43072. if (error) {
  43073. break;
  43074. }
  43075. continue;
  43076. } else if (value <= 246) {
  43077. value -= 139;
  43078. } else if (value <= 250) {
  43079. value = (value - 247) * 256 + encoded[++i] + 108;
  43080. } else if (value <= 254) {
  43081. value = -((value - 251) * 256) - encoded[++i] - 108;
  43082. } else {
  43083. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  43084. }
  43085. this.stack.push(value);
  43086. }
  43087. return error;
  43088. }
  43089. executeCommand(howManyArgs, command, keepStack) {
  43090. const stackLength = this.stack.length;
  43091. if (howManyArgs > stackLength) {
  43092. return true;
  43093. }
  43094. const start = stackLength - howManyArgs;
  43095. for (let i = start; i < stackLength; i++) {
  43096. let value = this.stack[i];
  43097. if (Number.isInteger(value)) {
  43098. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  43099. } else {
  43100. value = 65536 * value | 0;
  43101. this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  43102. }
  43103. }
  43104. this.output.push(...command);
  43105. if (keepStack) {
  43106. this.stack.splice(start, howManyArgs);
  43107. } else {
  43108. this.stack.length = 0;
  43109. }
  43110. return false;
  43111. }
  43112. }
  43113. const EEXEC_ENCRYPT_KEY = 55665;
  43114. const CHAR_STRS_ENCRYPT_KEY = 4330;
  43115. function isHexDigit(code) {
  43116. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  43117. }
  43118. function decrypt(data, key, discardNumber) {
  43119. if (discardNumber >= data.length) {
  43120. return new Uint8Array(0);
  43121. }
  43122. const c1 = 52845,
  43123. c2 = 22719;
  43124. let r = key | 0,
  43125. i,
  43126. j;
  43127. for (i = 0; i < discardNumber; i++) {
  43128. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  43129. }
  43130. const count = data.length - discardNumber;
  43131. const decrypted = new Uint8Array(count);
  43132. for (i = discardNumber, j = 0; j < count; i++, j++) {
  43133. const value = data[i];
  43134. decrypted[j] = value ^ r >> 8;
  43135. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  43136. }
  43137. return decrypted;
  43138. }
  43139. function decryptAscii(data, key, discardNumber) {
  43140. const c1 = 52845,
  43141. c2 = 22719;
  43142. let r = key | 0;
  43143. const count = data.length,
  43144. maybeLength = count >>> 1;
  43145. const decrypted = new Uint8Array(maybeLength);
  43146. let i, j;
  43147. for (i = 0, j = 0; i < count; i++) {
  43148. const digit1 = data[i];
  43149. if (!isHexDigit(digit1)) {
  43150. continue;
  43151. }
  43152. i++;
  43153. let digit2;
  43154. while (i < count && !isHexDigit(digit2 = data[i])) {
  43155. i++;
  43156. }
  43157. if (i < count) {
  43158. const value = parseInt(String.fromCharCode(digit1, digit2), 16);
  43159. decrypted[j++] = value ^ r >> 8;
  43160. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  43161. }
  43162. }
  43163. return decrypted.slice(discardNumber, j);
  43164. }
  43165. function isSpecial(c) {
  43166. return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
  43167. }
  43168. class Type1Parser {
  43169. constructor(stream, encrypted, seacAnalysisEnabled) {
  43170. if (encrypted) {
  43171. const data = stream.getBytes();
  43172. const isBinary = !((isHexDigit(data[0]) || (0, _core_utils.isWhiteSpace)(data[0])) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]) && isHexDigit(data[4]) && isHexDigit(data[5]) && isHexDigit(data[6]) && isHexDigit(data[7]));
  43173. stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  43174. }
  43175. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  43176. this.stream = stream;
  43177. this.nextChar();
  43178. }
  43179. readNumberArray() {
  43180. this.getToken();
  43181. const array = [];
  43182. while (true) {
  43183. const token = this.getToken();
  43184. if (token === null || token === "]" || token === "}") {
  43185. break;
  43186. }
  43187. array.push(parseFloat(token || 0));
  43188. }
  43189. return array;
  43190. }
  43191. readNumber() {
  43192. const token = this.getToken();
  43193. return parseFloat(token || 0);
  43194. }
  43195. readInt() {
  43196. const token = this.getToken();
  43197. return parseInt(token || 0, 10) | 0;
  43198. }
  43199. readBoolean() {
  43200. const token = this.getToken();
  43201. return token === "true" ? 1 : 0;
  43202. }
  43203. nextChar() {
  43204. return this.currentChar = this.stream.getByte();
  43205. }
  43206. prevChar() {
  43207. this.stream.skip(-2);
  43208. return this.currentChar = this.stream.getByte();
  43209. }
  43210. getToken() {
  43211. let comment = false;
  43212. let ch = this.currentChar;
  43213. while (true) {
  43214. if (ch === -1) {
  43215. return null;
  43216. }
  43217. if (comment) {
  43218. if (ch === 0x0a || ch === 0x0d) {
  43219. comment = false;
  43220. }
  43221. } else if (ch === 0x25) {
  43222. comment = true;
  43223. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  43224. break;
  43225. }
  43226. ch = this.nextChar();
  43227. }
  43228. if (isSpecial(ch)) {
  43229. this.nextChar();
  43230. return String.fromCharCode(ch);
  43231. }
  43232. let token = "";
  43233. do {
  43234. token += String.fromCharCode(ch);
  43235. ch = this.nextChar();
  43236. } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch));
  43237. return token;
  43238. }
  43239. readCharStrings(bytes, lenIV) {
  43240. if (lenIV === -1) {
  43241. return bytes;
  43242. }
  43243. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  43244. }
  43245. extractFontProgram(properties) {
  43246. const stream = this.stream;
  43247. const subrs = [],
  43248. charstrings = [];
  43249. const privateData = Object.create(null);
  43250. privateData.lenIV = 4;
  43251. const program = {
  43252. subrs: [],
  43253. charstrings: [],
  43254. properties: {
  43255. privateData
  43256. }
  43257. };
  43258. let token, length, data, lenIV;
  43259. while ((token = this.getToken()) !== null) {
  43260. if (token !== "/") {
  43261. continue;
  43262. }
  43263. token = this.getToken();
  43264. switch (token) {
  43265. case "CharStrings":
  43266. this.getToken();
  43267. this.getToken();
  43268. this.getToken();
  43269. this.getToken();
  43270. while (true) {
  43271. token = this.getToken();
  43272. if (token === null || token === "end") {
  43273. break;
  43274. }
  43275. if (token !== "/") {
  43276. continue;
  43277. }
  43278. const glyph = this.getToken();
  43279. length = this.readInt();
  43280. this.getToken();
  43281. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  43282. lenIV = program.properties.privateData.lenIV;
  43283. const encoded = this.readCharStrings(data, lenIV);
  43284. this.nextChar();
  43285. token = this.getToken();
  43286. if (token === "noaccess") {
  43287. this.getToken();
  43288. } else if (token === "/") {
  43289. this.prevChar();
  43290. }
  43291. charstrings.push({
  43292. glyph,
  43293. encoded
  43294. });
  43295. }
  43296. break;
  43297. case "Subrs":
  43298. this.readInt();
  43299. this.getToken();
  43300. while (this.getToken() === "dup") {
  43301. const index = this.readInt();
  43302. length = this.readInt();
  43303. this.getToken();
  43304. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  43305. lenIV = program.properties.privateData.lenIV;
  43306. const encoded = this.readCharStrings(data, lenIV);
  43307. this.nextChar();
  43308. token = this.getToken();
  43309. if (token === "noaccess") {
  43310. this.getToken();
  43311. }
  43312. subrs[index] = encoded;
  43313. }
  43314. break;
  43315. case "BlueValues":
  43316. case "OtherBlues":
  43317. case "FamilyBlues":
  43318. case "FamilyOtherBlues":
  43319. const blueArray = this.readNumberArray();
  43320. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  43321. program.properties.privateData[token] = blueArray;
  43322. }
  43323. break;
  43324. case "StemSnapH":
  43325. case "StemSnapV":
  43326. program.properties.privateData[token] = this.readNumberArray();
  43327. break;
  43328. case "StdHW":
  43329. case "StdVW":
  43330. program.properties.privateData[token] = this.readNumberArray()[0];
  43331. break;
  43332. case "BlueShift":
  43333. case "lenIV":
  43334. case "BlueFuzz":
  43335. case "BlueScale":
  43336. case "LanguageGroup":
  43337. case "ExpansionFactor":
  43338. program.properties.privateData[token] = this.readNumber();
  43339. break;
  43340. case "ForceBold":
  43341. program.properties.privateData[token] = this.readBoolean();
  43342. break;
  43343. }
  43344. }
  43345. for (const {
  43346. encoded,
  43347. glyph
  43348. } of charstrings) {
  43349. const charString = new Type1CharString();
  43350. const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  43351. let output = charString.output;
  43352. if (error) {
  43353. output = [14];
  43354. }
  43355. const charStringObject = {
  43356. glyphName: glyph,
  43357. charstring: output,
  43358. width: charString.width,
  43359. lsb: charString.lsb,
  43360. seac: charString.seac
  43361. };
  43362. if (glyph === ".notdef") {
  43363. program.charstrings.unshift(charStringObject);
  43364. } else {
  43365. program.charstrings.push(charStringObject);
  43366. }
  43367. if (properties.builtInEncoding) {
  43368. const index = properties.builtInEncoding.indexOf(glyph);
  43369. if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
  43370. properties.widths[index] = charString.width;
  43371. }
  43372. }
  43373. }
  43374. return program;
  43375. }
  43376. extractFontHeader(properties) {
  43377. let token;
  43378. while ((token = this.getToken()) !== null) {
  43379. if (token !== "/") {
  43380. continue;
  43381. }
  43382. token = this.getToken();
  43383. switch (token) {
  43384. case "FontMatrix":
  43385. const matrix = this.readNumberArray();
  43386. properties.fontMatrix = matrix;
  43387. break;
  43388. case "Encoding":
  43389. const encodingArg = this.getToken();
  43390. let encoding;
  43391. if (!/^\d+$/.test(encodingArg)) {
  43392. encoding = (0, _encodings.getEncoding)(encodingArg);
  43393. } else {
  43394. encoding = [];
  43395. const size = parseInt(encodingArg, 10) | 0;
  43396. this.getToken();
  43397. for (let j = 0; j < size; j++) {
  43398. token = this.getToken();
  43399. while (token !== "dup" && token !== "def") {
  43400. token = this.getToken();
  43401. if (token === null) {
  43402. return;
  43403. }
  43404. }
  43405. if (token === "def") {
  43406. break;
  43407. }
  43408. const index = this.readInt();
  43409. this.getToken();
  43410. const glyph = this.getToken();
  43411. encoding[index] = glyph;
  43412. this.getToken();
  43413. }
  43414. }
  43415. properties.builtInEncoding = encoding;
  43416. break;
  43417. case "FontBBox":
  43418. const fontBBox = this.readNumberArray();
  43419. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  43420. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  43421. properties.ascentScaled = true;
  43422. break;
  43423. }
  43424. }
  43425. }
  43426. }
  43427. exports.Type1Parser = Type1Parser;
  43428. /***/ }),
  43429. /* 48 */
  43430. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  43431. Object.defineProperty(exports, "__esModule", ({
  43432. value: true
  43433. }));
  43434. exports.Pattern = void 0;
  43435. exports.getTilingPatternIR = getTilingPatternIR;
  43436. var _util = __w_pdfjs_require__(2);
  43437. var _base_stream = __w_pdfjs_require__(5);
  43438. var _colorspace = __w_pdfjs_require__(12);
  43439. var _core_utils = __w_pdfjs_require__(4);
  43440. const ShadingType = {
  43441. FUNCTION_BASED: 1,
  43442. AXIAL: 2,
  43443. RADIAL: 3,
  43444. FREE_FORM_MESH: 4,
  43445. LATTICE_FORM_MESH: 5,
  43446. COONS_PATCH_MESH: 6,
  43447. TENSOR_PATCH_MESH: 7
  43448. };
  43449. class Pattern {
  43450. constructor() {
  43451. (0, _util.unreachable)("Cannot initialize Pattern.");
  43452. }
  43453. static parseShading(shading, xref, res, handler, pdfFunctionFactory, localColorSpaceCache) {
  43454. const dict = shading instanceof _base_stream.BaseStream ? shading.dict : shading;
  43455. const type = dict.get("ShadingType");
  43456. try {
  43457. switch (type) {
  43458. case ShadingType.AXIAL:
  43459. case ShadingType.RADIAL:
  43460. return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, localColorSpaceCache);
  43461. case ShadingType.FREE_FORM_MESH:
  43462. case ShadingType.LATTICE_FORM_MESH:
  43463. case ShadingType.COONS_PATCH_MESH:
  43464. case ShadingType.TENSOR_PATCH_MESH:
  43465. return new MeshShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache);
  43466. default:
  43467. throw new _util.FormatError("Unsupported ShadingType: " + type);
  43468. }
  43469. } catch (ex) {
  43470. if (ex instanceof _core_utils.MissingDataException) {
  43471. throw ex;
  43472. }
  43473. handler.send("UnsupportedFeature", {
  43474. featureId: _util.UNSUPPORTED_FEATURES.shadingPattern
  43475. });
  43476. (0, _util.warn)(ex);
  43477. return new DummyShading();
  43478. }
  43479. }
  43480. }
  43481. exports.Pattern = Pattern;
  43482. class BaseShading {
  43483. static get SMALL_NUMBER() {
  43484. return (0, _util.shadow)(this, "SMALL_NUMBER", 1e-6);
  43485. }
  43486. constructor() {
  43487. if (this.constructor === BaseShading) {
  43488. (0, _util.unreachable)("Cannot initialize BaseShading.");
  43489. }
  43490. }
  43491. getIR() {
  43492. (0, _util.unreachable)("Abstract method `getIR` called.");
  43493. }
  43494. }
  43495. class RadialAxialShading extends BaseShading {
  43496. constructor(dict, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  43497. super();
  43498. this.coordsArr = dict.getArray("Coords");
  43499. this.shadingType = dict.get("ShadingType");
  43500. const cs = _colorspace.ColorSpace.parse({
  43501. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  43502. xref,
  43503. resources,
  43504. pdfFunctionFactory,
  43505. localColorSpaceCache
  43506. });
  43507. const bbox = dict.getArray("BBox");
  43508. if (Array.isArray(bbox) && bbox.length === 4) {
  43509. this.bbox = _util.Util.normalizeRect(bbox);
  43510. } else {
  43511. this.bbox = null;
  43512. }
  43513. let t0 = 0.0,
  43514. t1 = 1.0;
  43515. if (dict.has("Domain")) {
  43516. const domainArr = dict.getArray("Domain");
  43517. t0 = domainArr[0];
  43518. t1 = domainArr[1];
  43519. }
  43520. let extendStart = false,
  43521. extendEnd = false;
  43522. if (dict.has("Extend")) {
  43523. const extendArr = dict.getArray("Extend");
  43524. extendStart = extendArr[0];
  43525. extendEnd = extendArr[1];
  43526. }
  43527. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  43528. const [x1, y1, r1, x2, y2, r2] = this.coordsArr;
  43529. const distance = Math.hypot(x1 - x2, y1 - y2);
  43530. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  43531. (0, _util.warn)("Unsupported radial gradient.");
  43532. }
  43533. }
  43534. this.extendStart = extendStart;
  43535. this.extendEnd = extendEnd;
  43536. const fnObj = dict.getRaw("Function");
  43537. const fn = pdfFunctionFactory.createFromArray(fnObj);
  43538. const NUMBER_OF_SAMPLES = 10;
  43539. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  43540. const colorStops = this.colorStops = [];
  43541. if (t0 >= t1 || step <= 0) {
  43542. (0, _util.info)("Bad shading domain.");
  43543. return;
  43544. }
  43545. const color = new Float32Array(cs.numComps),
  43546. ratio = new Float32Array(1);
  43547. let rgbColor;
  43548. for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
  43549. ratio[0] = t0 + i * step;
  43550. fn(ratio, 0, color, 0);
  43551. rgbColor = cs.getRgb(color, 0);
  43552. const cssColor = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  43553. colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
  43554. }
  43555. let background = "transparent";
  43556. if (dict.has("Background")) {
  43557. rgbColor = cs.getRgb(dict.get("Background"), 0);
  43558. background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  43559. }
  43560. if (!extendStart) {
  43561. colorStops.unshift([0, background]);
  43562. colorStops[1][0] += BaseShading.SMALL_NUMBER;
  43563. }
  43564. if (!extendEnd) {
  43565. colorStops.at(-1)[0] -= BaseShading.SMALL_NUMBER;
  43566. colorStops.push([1, background]);
  43567. }
  43568. this.colorStops = colorStops;
  43569. }
  43570. getIR() {
  43571. const coordsArr = this.coordsArr;
  43572. const shadingType = this.shadingType;
  43573. let type, p0, p1, r0, r1;
  43574. if (shadingType === ShadingType.AXIAL) {
  43575. p0 = [coordsArr[0], coordsArr[1]];
  43576. p1 = [coordsArr[2], coordsArr[3]];
  43577. r0 = null;
  43578. r1 = null;
  43579. type = "axial";
  43580. } else if (shadingType === ShadingType.RADIAL) {
  43581. p0 = [coordsArr[0], coordsArr[1]];
  43582. p1 = [coordsArr[3], coordsArr[4]];
  43583. r0 = coordsArr[2];
  43584. r1 = coordsArr[5];
  43585. type = "radial";
  43586. } else {
  43587. (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
  43588. }
  43589. return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
  43590. }
  43591. }
  43592. class MeshStreamReader {
  43593. constructor(stream, context) {
  43594. this.stream = stream;
  43595. this.context = context;
  43596. this.buffer = 0;
  43597. this.bufferLength = 0;
  43598. const numComps = context.numComps;
  43599. this.tmpCompsBuf = new Float32Array(numComps);
  43600. const csNumComps = context.colorSpace.numComps;
  43601. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  43602. }
  43603. get hasData() {
  43604. if (this.stream.end) {
  43605. return this.stream.pos < this.stream.end;
  43606. }
  43607. if (this.bufferLength > 0) {
  43608. return true;
  43609. }
  43610. const nextByte = this.stream.getByte();
  43611. if (nextByte < 0) {
  43612. return false;
  43613. }
  43614. this.buffer = nextByte;
  43615. this.bufferLength = 8;
  43616. return true;
  43617. }
  43618. readBits(n) {
  43619. let buffer = this.buffer;
  43620. let bufferLength = this.bufferLength;
  43621. if (n === 32) {
  43622. if (bufferLength === 0) {
  43623. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  43624. }
  43625. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  43626. const nextByte = this.stream.getByte();
  43627. this.buffer = nextByte & (1 << bufferLength) - 1;
  43628. return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
  43629. }
  43630. if (n === 8 && bufferLength === 0) {
  43631. return this.stream.getByte();
  43632. }
  43633. while (bufferLength < n) {
  43634. buffer = buffer << 8 | this.stream.getByte();
  43635. bufferLength += 8;
  43636. }
  43637. bufferLength -= n;
  43638. this.bufferLength = bufferLength;
  43639. this.buffer = buffer & (1 << bufferLength) - 1;
  43640. return buffer >> bufferLength;
  43641. }
  43642. align() {
  43643. this.buffer = 0;
  43644. this.bufferLength = 0;
  43645. }
  43646. readFlag() {
  43647. return this.readBits(this.context.bitsPerFlag);
  43648. }
  43649. readCoordinate() {
  43650. const bitsPerCoordinate = this.context.bitsPerCoordinate;
  43651. const xi = this.readBits(bitsPerCoordinate);
  43652. const yi = this.readBits(bitsPerCoordinate);
  43653. const decode = this.context.decode;
  43654. const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  43655. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  43656. }
  43657. readComponents() {
  43658. const numComps = this.context.numComps;
  43659. const bitsPerComponent = this.context.bitsPerComponent;
  43660. const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  43661. const decode = this.context.decode;
  43662. const components = this.tmpCompsBuf;
  43663. for (let i = 0, j = 4; i < numComps; i++, j += 2) {
  43664. const ci = this.readBits(bitsPerComponent);
  43665. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  43666. }
  43667. const color = this.tmpCsCompsBuf;
  43668. if (this.context.colorFn) {
  43669. this.context.colorFn(components, 0, color, 0);
  43670. }
  43671. return this.context.colorSpace.getRgb(color, 0);
  43672. }
  43673. }
  43674. const getB = function getBClosure() {
  43675. function buildB(count) {
  43676. const lut = [];
  43677. for (let i = 0; i <= count; i++) {
  43678. const t = i / count,
  43679. t_ = 1 - t;
  43680. lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
  43681. }
  43682. return lut;
  43683. }
  43684. const cache = [];
  43685. return function (count) {
  43686. if (!cache[count]) {
  43687. cache[count] = buildB(count);
  43688. }
  43689. return cache[count];
  43690. };
  43691. }();
  43692. class MeshShading extends BaseShading {
  43693. static get MIN_SPLIT_PATCH_CHUNKS_AMOUNT() {
  43694. return (0, _util.shadow)(this, "MIN_SPLIT_PATCH_CHUNKS_AMOUNT", 3);
  43695. }
  43696. static get MAX_SPLIT_PATCH_CHUNKS_AMOUNT() {
  43697. return (0, _util.shadow)(this, "MAX_SPLIT_PATCH_CHUNKS_AMOUNT", 20);
  43698. }
  43699. static get TRIANGLE_DENSITY() {
  43700. return (0, _util.shadow)(this, "TRIANGLE_DENSITY", 20);
  43701. }
  43702. constructor(stream, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  43703. super();
  43704. if (!(stream instanceof _base_stream.BaseStream)) {
  43705. throw new _util.FormatError("Mesh data is not a stream");
  43706. }
  43707. const dict = stream.dict;
  43708. this.shadingType = dict.get("ShadingType");
  43709. const bbox = dict.getArray("BBox");
  43710. if (Array.isArray(bbox) && bbox.length === 4) {
  43711. this.bbox = _util.Util.normalizeRect(bbox);
  43712. } else {
  43713. this.bbox = null;
  43714. }
  43715. const cs = _colorspace.ColorSpace.parse({
  43716. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  43717. xref,
  43718. resources,
  43719. pdfFunctionFactory,
  43720. localColorSpaceCache
  43721. });
  43722. this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
  43723. const fnObj = dict.getRaw("Function");
  43724. const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  43725. this.coords = [];
  43726. this.colors = [];
  43727. this.figures = [];
  43728. const decodeContext = {
  43729. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  43730. bitsPerComponent: dict.get("BitsPerComponent"),
  43731. bitsPerFlag: dict.get("BitsPerFlag"),
  43732. decode: dict.getArray("Decode"),
  43733. colorFn: fn,
  43734. colorSpace: cs,
  43735. numComps: fn ? 1 : cs.numComps
  43736. };
  43737. const reader = new MeshStreamReader(stream, decodeContext);
  43738. let patchMesh = false;
  43739. switch (this.shadingType) {
  43740. case ShadingType.FREE_FORM_MESH:
  43741. this._decodeType4Shading(reader);
  43742. break;
  43743. case ShadingType.LATTICE_FORM_MESH:
  43744. const verticesPerRow = dict.get("VerticesPerRow") | 0;
  43745. if (verticesPerRow < 2) {
  43746. throw new _util.FormatError("Invalid VerticesPerRow");
  43747. }
  43748. this._decodeType5Shading(reader, verticesPerRow);
  43749. break;
  43750. case ShadingType.COONS_PATCH_MESH:
  43751. this._decodeType6Shading(reader);
  43752. patchMesh = true;
  43753. break;
  43754. case ShadingType.TENSOR_PATCH_MESH:
  43755. this._decodeType7Shading(reader);
  43756. patchMesh = true;
  43757. break;
  43758. default:
  43759. (0, _util.unreachable)("Unsupported mesh type.");
  43760. break;
  43761. }
  43762. if (patchMesh) {
  43763. this._updateBounds();
  43764. for (let i = 0, ii = this.figures.length; i < ii; i++) {
  43765. this._buildFigureFromPatch(i);
  43766. }
  43767. }
  43768. this._updateBounds();
  43769. this._packData();
  43770. }
  43771. _decodeType4Shading(reader) {
  43772. const coords = this.coords;
  43773. const colors = this.colors;
  43774. const operators = [];
  43775. const ps = [];
  43776. let verticesLeft = 0;
  43777. while (reader.hasData) {
  43778. const f = reader.readFlag();
  43779. const coord = reader.readCoordinate();
  43780. const color = reader.readComponents();
  43781. if (verticesLeft === 0) {
  43782. if (!(0 <= f && f <= 2)) {
  43783. throw new _util.FormatError("Unknown type4 flag");
  43784. }
  43785. switch (f) {
  43786. case 0:
  43787. verticesLeft = 3;
  43788. break;
  43789. case 1:
  43790. ps.push(ps.at(-2), ps.at(-1));
  43791. verticesLeft = 1;
  43792. break;
  43793. case 2:
  43794. ps.push(ps.at(-3), ps.at(-1));
  43795. verticesLeft = 1;
  43796. break;
  43797. }
  43798. operators.push(f);
  43799. }
  43800. ps.push(coords.length);
  43801. coords.push(coord);
  43802. colors.push(color);
  43803. verticesLeft--;
  43804. reader.align();
  43805. }
  43806. this.figures.push({
  43807. type: "triangles",
  43808. coords: new Int32Array(ps),
  43809. colors: new Int32Array(ps)
  43810. });
  43811. }
  43812. _decodeType5Shading(reader, verticesPerRow) {
  43813. const coords = this.coords;
  43814. const colors = this.colors;
  43815. const ps = [];
  43816. while (reader.hasData) {
  43817. const coord = reader.readCoordinate();
  43818. const color = reader.readComponents();
  43819. ps.push(coords.length);
  43820. coords.push(coord);
  43821. colors.push(color);
  43822. }
  43823. this.figures.push({
  43824. type: "lattice",
  43825. coords: new Int32Array(ps),
  43826. colors: new Int32Array(ps),
  43827. verticesPerRow
  43828. });
  43829. }
  43830. _decodeType6Shading(reader) {
  43831. const coords = this.coords;
  43832. const colors = this.colors;
  43833. const ps = new Int32Array(16);
  43834. const cs = new Int32Array(4);
  43835. while (reader.hasData) {
  43836. const f = reader.readFlag();
  43837. if (!(0 <= f && f <= 3)) {
  43838. throw new _util.FormatError("Unknown type6 flag");
  43839. }
  43840. const pi = coords.length;
  43841. for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  43842. coords.push(reader.readCoordinate());
  43843. }
  43844. const ci = colors.length;
  43845. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  43846. colors.push(reader.readComponents());
  43847. }
  43848. let tmp1, tmp2, tmp3, tmp4;
  43849. switch (f) {
  43850. case 0:
  43851. ps[12] = pi + 3;
  43852. ps[13] = pi + 4;
  43853. ps[14] = pi + 5;
  43854. ps[15] = pi + 6;
  43855. ps[8] = pi + 2;
  43856. ps[11] = pi + 7;
  43857. ps[4] = pi + 1;
  43858. ps[7] = pi + 8;
  43859. ps[0] = pi;
  43860. ps[1] = pi + 11;
  43861. ps[2] = pi + 10;
  43862. ps[3] = pi + 9;
  43863. cs[2] = ci + 1;
  43864. cs[3] = ci + 2;
  43865. cs[0] = ci;
  43866. cs[1] = ci + 3;
  43867. break;
  43868. case 1:
  43869. tmp1 = ps[12];
  43870. tmp2 = ps[13];
  43871. tmp3 = ps[14];
  43872. tmp4 = ps[15];
  43873. ps[12] = tmp4;
  43874. ps[13] = pi + 0;
  43875. ps[14] = pi + 1;
  43876. ps[15] = pi + 2;
  43877. ps[8] = tmp3;
  43878. ps[11] = pi + 3;
  43879. ps[4] = tmp2;
  43880. ps[7] = pi + 4;
  43881. ps[0] = tmp1;
  43882. ps[1] = pi + 7;
  43883. ps[2] = pi + 6;
  43884. ps[3] = pi + 5;
  43885. tmp1 = cs[2];
  43886. tmp2 = cs[3];
  43887. cs[2] = tmp2;
  43888. cs[3] = ci;
  43889. cs[0] = tmp1;
  43890. cs[1] = ci + 1;
  43891. break;
  43892. case 2:
  43893. tmp1 = ps[15];
  43894. tmp2 = ps[11];
  43895. ps[12] = ps[3];
  43896. ps[13] = pi + 0;
  43897. ps[14] = pi + 1;
  43898. ps[15] = pi + 2;
  43899. ps[8] = ps[7];
  43900. ps[11] = pi + 3;
  43901. ps[4] = tmp2;
  43902. ps[7] = pi + 4;
  43903. ps[0] = tmp1;
  43904. ps[1] = pi + 7;
  43905. ps[2] = pi + 6;
  43906. ps[3] = pi + 5;
  43907. tmp1 = cs[3];
  43908. cs[2] = cs[1];
  43909. cs[3] = ci;
  43910. cs[0] = tmp1;
  43911. cs[1] = ci + 1;
  43912. break;
  43913. case 3:
  43914. ps[12] = ps[0];
  43915. ps[13] = pi + 0;
  43916. ps[14] = pi + 1;
  43917. ps[15] = pi + 2;
  43918. ps[8] = ps[1];
  43919. ps[11] = pi + 3;
  43920. ps[4] = ps[2];
  43921. ps[7] = pi + 4;
  43922. ps[0] = ps[3];
  43923. ps[1] = pi + 7;
  43924. ps[2] = pi + 6;
  43925. ps[3] = pi + 5;
  43926. cs[2] = cs[0];
  43927. cs[3] = ci;
  43928. cs[0] = cs[1];
  43929. cs[1] = ci + 1;
  43930. break;
  43931. }
  43932. ps[5] = coords.length;
  43933. coords.push([(-4 * coords[ps[0]][0] - coords[ps[15]][0] + 6 * (coords[ps[4]][0] + coords[ps[1]][0]) - 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + 3 * (coords[ps[13]][0] + coords[ps[7]][0])) / 9, (-4 * coords[ps[0]][1] - coords[ps[15]][1] + 6 * (coords[ps[4]][1] + coords[ps[1]][1]) - 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + 3 * (coords[ps[13]][1] + coords[ps[7]][1])) / 9]);
  43934. ps[6] = coords.length;
  43935. coords.push([(-4 * coords[ps[3]][0] - coords[ps[12]][0] + 6 * (coords[ps[2]][0] + coords[ps[7]][0]) - 2 * (coords[ps[0]][0] + coords[ps[15]][0]) + 3 * (coords[ps[4]][0] + coords[ps[14]][0])) / 9, (-4 * coords[ps[3]][1] - coords[ps[12]][1] + 6 * (coords[ps[2]][1] + coords[ps[7]][1]) - 2 * (coords[ps[0]][1] + coords[ps[15]][1]) + 3 * (coords[ps[4]][1] + coords[ps[14]][1])) / 9]);
  43936. ps[9] = coords.length;
  43937. coords.push([(-4 * coords[ps[12]][0] - coords[ps[3]][0] + 6 * (coords[ps[8]][0] + coords[ps[13]][0]) - 2 * (coords[ps[0]][0] + coords[ps[15]][0]) + 3 * (coords[ps[11]][0] + coords[ps[1]][0])) / 9, (-4 * coords[ps[12]][1] - coords[ps[3]][1] + 6 * (coords[ps[8]][1] + coords[ps[13]][1]) - 2 * (coords[ps[0]][1] + coords[ps[15]][1]) + 3 * (coords[ps[11]][1] + coords[ps[1]][1])) / 9]);
  43938. ps[10] = coords.length;
  43939. coords.push([(-4 * coords[ps[15]][0] - coords[ps[0]][0] + 6 * (coords[ps[11]][0] + coords[ps[14]][0]) - 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + 3 * (coords[ps[2]][0] + coords[ps[8]][0])) / 9, (-4 * coords[ps[15]][1] - coords[ps[0]][1] + 6 * (coords[ps[11]][1] + coords[ps[14]][1]) - 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + 3 * (coords[ps[2]][1] + coords[ps[8]][1])) / 9]);
  43940. this.figures.push({
  43941. type: "patch",
  43942. coords: new Int32Array(ps),
  43943. colors: new Int32Array(cs)
  43944. });
  43945. }
  43946. }
  43947. _decodeType7Shading(reader) {
  43948. const coords = this.coords;
  43949. const colors = this.colors;
  43950. const ps = new Int32Array(16);
  43951. const cs = new Int32Array(4);
  43952. while (reader.hasData) {
  43953. const f = reader.readFlag();
  43954. if (!(0 <= f && f <= 3)) {
  43955. throw new _util.FormatError("Unknown type7 flag");
  43956. }
  43957. const pi = coords.length;
  43958. for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  43959. coords.push(reader.readCoordinate());
  43960. }
  43961. const ci = colors.length;
  43962. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  43963. colors.push(reader.readComponents());
  43964. }
  43965. let tmp1, tmp2, tmp3, tmp4;
  43966. switch (f) {
  43967. case 0:
  43968. ps[12] = pi + 3;
  43969. ps[13] = pi + 4;
  43970. ps[14] = pi + 5;
  43971. ps[15] = pi + 6;
  43972. ps[8] = pi + 2;
  43973. ps[9] = pi + 13;
  43974. ps[10] = pi + 14;
  43975. ps[11] = pi + 7;
  43976. ps[4] = pi + 1;
  43977. ps[5] = pi + 12;
  43978. ps[6] = pi + 15;
  43979. ps[7] = pi + 8;
  43980. ps[0] = pi;
  43981. ps[1] = pi + 11;
  43982. ps[2] = pi + 10;
  43983. ps[3] = pi + 9;
  43984. cs[2] = ci + 1;
  43985. cs[3] = ci + 2;
  43986. cs[0] = ci;
  43987. cs[1] = ci + 3;
  43988. break;
  43989. case 1:
  43990. tmp1 = ps[12];
  43991. tmp2 = ps[13];
  43992. tmp3 = ps[14];
  43993. tmp4 = ps[15];
  43994. ps[12] = tmp4;
  43995. ps[13] = pi + 0;
  43996. ps[14] = pi + 1;
  43997. ps[15] = pi + 2;
  43998. ps[8] = tmp3;
  43999. ps[9] = pi + 9;
  44000. ps[10] = pi + 10;
  44001. ps[11] = pi + 3;
  44002. ps[4] = tmp2;
  44003. ps[5] = pi + 8;
  44004. ps[6] = pi + 11;
  44005. ps[7] = pi + 4;
  44006. ps[0] = tmp1;
  44007. ps[1] = pi + 7;
  44008. ps[2] = pi + 6;
  44009. ps[3] = pi + 5;
  44010. tmp1 = cs[2];
  44011. tmp2 = cs[3];
  44012. cs[2] = tmp2;
  44013. cs[3] = ci;
  44014. cs[0] = tmp1;
  44015. cs[1] = ci + 1;
  44016. break;
  44017. case 2:
  44018. tmp1 = ps[15];
  44019. tmp2 = ps[11];
  44020. ps[12] = ps[3];
  44021. ps[13] = pi + 0;
  44022. ps[14] = pi + 1;
  44023. ps[15] = pi + 2;
  44024. ps[8] = ps[7];
  44025. ps[9] = pi + 9;
  44026. ps[10] = pi + 10;
  44027. ps[11] = pi + 3;
  44028. ps[4] = tmp2;
  44029. ps[5] = pi + 8;
  44030. ps[6] = pi + 11;
  44031. ps[7] = pi + 4;
  44032. ps[0] = tmp1;
  44033. ps[1] = pi + 7;
  44034. ps[2] = pi + 6;
  44035. ps[3] = pi + 5;
  44036. tmp1 = cs[3];
  44037. cs[2] = cs[1];
  44038. cs[3] = ci;
  44039. cs[0] = tmp1;
  44040. cs[1] = ci + 1;
  44041. break;
  44042. case 3:
  44043. ps[12] = ps[0];
  44044. ps[13] = pi + 0;
  44045. ps[14] = pi + 1;
  44046. ps[15] = pi + 2;
  44047. ps[8] = ps[1];
  44048. ps[9] = pi + 9;
  44049. ps[10] = pi + 10;
  44050. ps[11] = pi + 3;
  44051. ps[4] = ps[2];
  44052. ps[5] = pi + 8;
  44053. ps[6] = pi + 11;
  44054. ps[7] = pi + 4;
  44055. ps[0] = ps[3];
  44056. ps[1] = pi + 7;
  44057. ps[2] = pi + 6;
  44058. ps[3] = pi + 5;
  44059. cs[2] = cs[0];
  44060. cs[3] = ci;
  44061. cs[0] = cs[1];
  44062. cs[1] = ci + 1;
  44063. break;
  44064. }
  44065. this.figures.push({
  44066. type: "patch",
  44067. coords: new Int32Array(ps),
  44068. colors: new Int32Array(cs)
  44069. });
  44070. }
  44071. }
  44072. _buildFigureFromPatch(index) {
  44073. const figure = this.figures[index];
  44074. (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure");
  44075. const coords = this.coords,
  44076. colors = this.colors;
  44077. const pi = figure.coords;
  44078. const ci = figure.colors;
  44079. const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  44080. const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  44081. const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  44082. const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  44083. let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0]));
  44084. splitXBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  44085. let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1]));
  44086. splitYBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  44087. const verticesPerRow = splitXBy + 1;
  44088. const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  44089. const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  44090. let k = 0;
  44091. const cl = new Uint8Array(3),
  44092. cr = new Uint8Array(3);
  44093. const c0 = colors[ci[0]],
  44094. c1 = colors[ci[1]],
  44095. c2 = colors[ci[2]],
  44096. c3 = colors[ci[3]];
  44097. const bRow = getB(splitYBy),
  44098. bCol = getB(splitXBy);
  44099. for (let row = 0; row <= splitYBy; row++) {
  44100. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  44101. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  44102. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  44103. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  44104. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  44105. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  44106. for (let col = 0; col <= splitXBy; col++, k++) {
  44107. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  44108. continue;
  44109. }
  44110. let x = 0,
  44111. y = 0;
  44112. let q = 0;
  44113. for (let i = 0; i <= 3; i++) {
  44114. for (let j = 0; j <= 3; j++, q++) {
  44115. const m = bRow[row][i] * bCol[col][j];
  44116. x += coords[pi[q]][0] * m;
  44117. y += coords[pi[q]][1] * m;
  44118. }
  44119. }
  44120. figureCoords[k] = coords.length;
  44121. coords.push([x, y]);
  44122. figureColors[k] = colors.length;
  44123. const newColor = new Uint8Array(3);
  44124. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  44125. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  44126. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  44127. colors.push(newColor);
  44128. }
  44129. }
  44130. figureCoords[0] = pi[0];
  44131. figureColors[0] = ci[0];
  44132. figureCoords[splitXBy] = pi[3];
  44133. figureColors[splitXBy] = ci[1];
  44134. figureCoords[verticesPerRow * splitYBy] = pi[12];
  44135. figureColors[verticesPerRow * splitYBy] = ci[2];
  44136. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  44137. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  44138. this.figures[index] = {
  44139. type: "lattice",
  44140. coords: figureCoords,
  44141. colors: figureColors,
  44142. verticesPerRow
  44143. };
  44144. }
  44145. _updateBounds() {
  44146. let minX = this.coords[0][0],
  44147. minY = this.coords[0][1],
  44148. maxX = minX,
  44149. maxY = minY;
  44150. for (let i = 1, ii = this.coords.length; i < ii; i++) {
  44151. const x = this.coords[i][0],
  44152. y = this.coords[i][1];
  44153. minX = minX > x ? x : minX;
  44154. minY = minY > y ? y : minY;
  44155. maxX = maxX < x ? x : maxX;
  44156. maxY = maxY < y ? y : maxY;
  44157. }
  44158. this.bounds = [minX, minY, maxX, maxY];
  44159. }
  44160. _packData() {
  44161. let i, ii, j, jj;
  44162. const coords = this.coords;
  44163. const coordsPacked = new Float32Array(coords.length * 2);
  44164. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  44165. const xy = coords[i];
  44166. coordsPacked[j++] = xy[0];
  44167. coordsPacked[j++] = xy[1];
  44168. }
  44169. this.coords = coordsPacked;
  44170. const colors = this.colors;
  44171. const colorsPacked = new Uint8Array(colors.length * 3);
  44172. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  44173. const c = colors[i];
  44174. colorsPacked[j++] = c[0];
  44175. colorsPacked[j++] = c[1];
  44176. colorsPacked[j++] = c[2];
  44177. }
  44178. this.colors = colorsPacked;
  44179. const figures = this.figures;
  44180. for (i = 0, ii = figures.length; i < ii; i++) {
  44181. const figure = figures[i],
  44182. ps = figure.coords,
  44183. cs = figure.colors;
  44184. for (j = 0, jj = ps.length; j < jj; j++) {
  44185. ps[j] *= 2;
  44186. cs[j] *= 3;
  44187. }
  44188. }
  44189. }
  44190. getIR() {
  44191. return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.bbox, this.background];
  44192. }
  44193. }
  44194. class DummyShading extends BaseShading {
  44195. getIR() {
  44196. return ["Dummy"];
  44197. }
  44198. }
  44199. function getTilingPatternIR(operatorList, dict, color) {
  44200. const matrix = dict.getArray("Matrix");
  44201. const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
  44202. const xstep = dict.get("XStep");
  44203. const ystep = dict.get("YStep");
  44204. const paintType = dict.get("PaintType");
  44205. const tilingType = dict.get("TilingType");
  44206. if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  44207. throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
  44208. }
  44209. return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  44210. }
  44211. /***/ }),
  44212. /* 49 */
  44213. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44214. Object.defineProperty(exports, "__esModule", ({
  44215. value: true
  44216. }));
  44217. exports.getXfaFontDict = getXfaFontDict;
  44218. exports.getXfaFontName = getXfaFontName;
  44219. var _calibri_factors = __w_pdfjs_require__(50);
  44220. var _primitives = __w_pdfjs_require__(3);
  44221. var _helvetica_factors = __w_pdfjs_require__(51);
  44222. var _liberationsans_widths = __w_pdfjs_require__(52);
  44223. var _myriadpro_factors = __w_pdfjs_require__(53);
  44224. var _segoeui_factors = __w_pdfjs_require__(54);
  44225. var _core_utils = __w_pdfjs_require__(4);
  44226. var _fonts_utils = __w_pdfjs_require__(36);
  44227. const getXFAFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  44228. t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = {
  44229. name: "LiberationSans-Regular",
  44230. factors: _myriadpro_factors.MyriadProRegularFactors,
  44231. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  44232. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  44233. metrics: _myriadpro_factors.MyriadProRegularMetrics
  44234. };
  44235. t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = {
  44236. name: "LiberationSans-Bold",
  44237. factors: _myriadpro_factors.MyriadProBoldFactors,
  44238. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  44239. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  44240. metrics: _myriadpro_factors.MyriadProBoldMetrics
  44241. };
  44242. t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = {
  44243. name: "LiberationSans-Italic",
  44244. factors: _myriadpro_factors.MyriadProItalicFactors,
  44245. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  44246. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  44247. metrics: _myriadpro_factors.MyriadProItalicMetrics
  44248. };
  44249. t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = {
  44250. name: "LiberationSans-BoldItalic",
  44251. factors: _myriadpro_factors.MyriadProBoldItalicFactors,
  44252. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  44253. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  44254. metrics: _myriadpro_factors.MyriadProBoldItalicMetrics
  44255. };
  44256. t.ArialMT = t.Arial = t["Arial-Regular"] = {
  44257. name: "LiberationSans-Regular",
  44258. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  44259. baseMapping: _liberationsans_widths.LiberationSansRegularMapping
  44260. };
  44261. t["Arial-BoldMT"] = t["Arial-Bold"] = {
  44262. name: "LiberationSans-Bold",
  44263. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  44264. baseMapping: _liberationsans_widths.LiberationSansBoldMapping
  44265. };
  44266. t["Arial-ItalicMT"] = t["Arial-Italic"] = {
  44267. name: "LiberationSans-Italic",
  44268. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  44269. baseMapping: _liberationsans_widths.LiberationSansItalicMapping
  44270. };
  44271. t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = {
  44272. name: "LiberationSans-BoldItalic",
  44273. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  44274. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping
  44275. };
  44276. t["Calibri-Regular"] = {
  44277. name: "LiberationSans-Regular",
  44278. factors: _calibri_factors.CalibriRegularFactors,
  44279. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  44280. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  44281. metrics: _calibri_factors.CalibriRegularMetrics
  44282. };
  44283. t["Calibri-Bold"] = {
  44284. name: "LiberationSans-Bold",
  44285. factors: _calibri_factors.CalibriBoldFactors,
  44286. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  44287. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  44288. metrics: _calibri_factors.CalibriBoldMetrics
  44289. };
  44290. t["Calibri-Italic"] = {
  44291. name: "LiberationSans-Italic",
  44292. factors: _calibri_factors.CalibriItalicFactors,
  44293. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  44294. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  44295. metrics: _calibri_factors.CalibriItalicMetrics
  44296. };
  44297. t["Calibri-BoldItalic"] = {
  44298. name: "LiberationSans-BoldItalic",
  44299. factors: _calibri_factors.CalibriBoldItalicFactors,
  44300. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  44301. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  44302. metrics: _calibri_factors.CalibriBoldItalicMetrics
  44303. };
  44304. t["Segoeui-Regular"] = {
  44305. name: "LiberationSans-Regular",
  44306. factors: _segoeui_factors.SegoeuiRegularFactors,
  44307. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  44308. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  44309. metrics: _segoeui_factors.SegoeuiRegularMetrics
  44310. };
  44311. t["Segoeui-Bold"] = {
  44312. name: "LiberationSans-Bold",
  44313. factors: _segoeui_factors.SegoeuiBoldFactors,
  44314. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  44315. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  44316. metrics: _segoeui_factors.SegoeuiBoldMetrics
  44317. };
  44318. t["Segoeui-Italic"] = {
  44319. name: "LiberationSans-Italic",
  44320. factors: _segoeui_factors.SegoeuiItalicFactors,
  44321. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  44322. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  44323. metrics: _segoeui_factors.SegoeuiItalicMetrics
  44324. };
  44325. t["Segoeui-BoldItalic"] = {
  44326. name: "LiberationSans-BoldItalic",
  44327. factors: _segoeui_factors.SegoeuiBoldItalicFactors,
  44328. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  44329. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  44330. metrics: _segoeui_factors.SegoeuiBoldItalicMetrics
  44331. };
  44332. t["Helvetica-Regular"] = t.Helvetica = {
  44333. name: "LiberationSans-Regular",
  44334. factors: _helvetica_factors.HelveticaRegularFactors,
  44335. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  44336. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  44337. metrics: _helvetica_factors.HelveticaRegularMetrics
  44338. };
  44339. t["Helvetica-Bold"] = {
  44340. name: "LiberationSans-Bold",
  44341. factors: _helvetica_factors.HelveticaBoldFactors,
  44342. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  44343. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  44344. metrics: _helvetica_factors.HelveticaBoldMetrics
  44345. };
  44346. t["Helvetica-Italic"] = {
  44347. name: "LiberationSans-Italic",
  44348. factors: _helvetica_factors.HelveticaItalicFactors,
  44349. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  44350. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  44351. metrics: _helvetica_factors.HelveticaItalicMetrics
  44352. };
  44353. t["Helvetica-BoldItalic"] = {
  44354. name: "LiberationSans-BoldItalic",
  44355. factors: _helvetica_factors.HelveticaBoldItalicFactors,
  44356. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  44357. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  44358. metrics: _helvetica_factors.HelveticaBoldItalicMetrics
  44359. };
  44360. });
  44361. function getXfaFontName(name) {
  44362. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  44363. const fontMap = getXFAFontMap();
  44364. return fontMap[fontName];
  44365. }
  44366. function getXfaFontWidths(name) {
  44367. const info = getXfaFontName(name);
  44368. if (!info) {
  44369. return null;
  44370. }
  44371. const {
  44372. baseWidths,
  44373. baseMapping,
  44374. factors
  44375. } = info;
  44376. let rescaledBaseWidths;
  44377. if (!factors) {
  44378. rescaledBaseWidths = baseWidths;
  44379. } else {
  44380. rescaledBaseWidths = baseWidths.map((w, i) => w * factors[i]);
  44381. }
  44382. let currentCode = -2;
  44383. let currentArray;
  44384. const newWidths = [];
  44385. for (const [unicode, glyphIndex] of baseMapping.map((charUnicode, index) => [charUnicode, index]).sort(([unicode1], [unicode2]) => unicode1 - unicode2)) {
  44386. if (unicode === -1) {
  44387. continue;
  44388. }
  44389. if (unicode === currentCode + 1) {
  44390. currentArray.push(rescaledBaseWidths[glyphIndex]);
  44391. currentCode += 1;
  44392. } else {
  44393. currentCode = unicode;
  44394. currentArray = [rescaledBaseWidths[glyphIndex]];
  44395. newWidths.push(unicode, currentArray);
  44396. }
  44397. }
  44398. return newWidths;
  44399. }
  44400. function getXfaFontDict(name) {
  44401. const widths = getXfaFontWidths(name);
  44402. const dict = new _primitives.Dict(null);
  44403. dict.set("BaseFont", _primitives.Name.get(name));
  44404. dict.set("Type", _primitives.Name.get("Font"));
  44405. dict.set("Subtype", _primitives.Name.get("CIDFontType2"));
  44406. dict.set("Encoding", _primitives.Name.get("Identity-H"));
  44407. dict.set("CIDToGIDMap", _primitives.Name.get("Identity"));
  44408. dict.set("W", widths);
  44409. dict.set("FirstChar", widths[0]);
  44410. dict.set("LastChar", widths.at(-2) + widths.at(-1).length - 1);
  44411. const descriptor = new _primitives.Dict(null);
  44412. dict.set("FontDescriptor", descriptor);
  44413. const systemInfo = new _primitives.Dict(null);
  44414. systemInfo.set("Ordering", "Identity");
  44415. systemInfo.set("Registry", "Adobe");
  44416. systemInfo.set("Supplement", 0);
  44417. dict.set("CIDSystemInfo", systemInfo);
  44418. return dict;
  44419. }
  44420. /***/ }),
  44421. /* 50 */
  44422. /***/ ((__unused_webpack_module, exports) => {
  44423. Object.defineProperty(exports, "__esModule", ({
  44424. value: true
  44425. }));
  44426. exports.CalibriRegularMetrics = exports.CalibriRegularFactors = exports.CalibriItalicMetrics = exports.CalibriItalicFactors = exports.CalibriBoldMetrics = exports.CalibriBoldItalicMetrics = exports.CalibriBoldItalicFactors = exports.CalibriBoldFactors = void 0;
  44427. const CalibriBoldFactors = [1.3877, 1, 1, 1, 0.97801, 0.92482, 0.89552, 0.91133, 0.81988, 0.97566, 0.98152, 0.93548, 0.93548, 1.2798, 0.85284, 0.92794, 1, 0.96134, 1.54657, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.82845, 0.82845, 0.85284, 0.85284, 0.85284, 0.75859, 0.92138, 0.83908, 0.7762, 0.73293, 0.87289, 0.73133, 0.7514, 0.81921, 0.87356, 0.95958, 0.59526, 0.75727, 0.69225, 1.04924, 0.9121, 0.86943, 0.79795, 0.88198, 0.77958, 0.70864, 0.81055, 0.90399, 0.88653, 0.96017, 0.82577, 0.77892, 0.78257, 0.97507, 1.54657, 0.97507, 0.85284, 0.89552, 0.90176, 0.88762, 0.8785, 0.75241, 0.8785, 0.90518, 0.95015, 0.77618, 0.8785, 0.88401, 0.91916, 0.86304, 0.88401, 0.91488, 0.8785, 0.8801, 0.8785, 0.8785, 0.91343, 0.7173, 1.04106, 0.8785, 0.85075, 0.95794, 0.82616, 0.85162, 0.79492, 0.88331, 1.69808, 0.88331, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.7801, 0.89552, 1.24487, 1.13254, 1.12401, 0.96839, 0.85284, 0.68787, 0.70645, 0.85592, 0.90747, 1.01466, 1.0088, 0.90323, 1, 1.07463, 1, 0.91056, 0.75806, 1.19118, 0.96839, 0.78864, 0.82845, 0.84133, 0.75859, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.77539, 0.73293, 0.73133, 0.73133, 0.73133, 0.73133, 0.95958, 0.95958, 0.95958, 0.95958, 0.88506, 0.9121, 0.86943, 0.86943, 0.86943, 0.86943, 0.86943, 0.85284, 0.87508, 0.90399, 0.90399, 0.90399, 0.90399, 0.77892, 0.79795, 0.90807, 0.88762, 0.88762, 0.88762, 0.88762, 0.88762, 0.88762, 0.8715, 0.75241, 0.90518, 0.90518, 0.90518, 0.90518, 0.88401, 0.88401, 0.88401, 0.88401, 0.8785, 0.8785, 0.8801, 0.8801, 0.8801, 0.8801, 0.8801, 0.90747, 0.89049, 0.8785, 0.8785, 0.8785, 0.8785, 0.85162, 0.8785, 0.85162, 0.83908, 0.88762, 0.83908, 0.88762, 0.83908, 0.88762, 0.73293, 0.75241, 0.73293, 0.75241, 0.73293, 0.75241, 0.73293, 0.75241, 0.87289, 0.83016, 0.88506, 0.93125, 0.73133, 0.90518, 0.73133, 0.90518, 0.73133, 0.90518, 0.73133, 0.90518, 0.73133, 0.90518, 0.81921, 0.77618, 0.81921, 0.77618, 0.81921, 0.77618, 1, 1, 0.87356, 0.8785, 0.91075, 0.89608, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.76229, 0.90167, 0.59526, 0.91916, 1, 1, 0.86304, 0.69225, 0.88401, 1, 1, 0.70424, 0.79468, 0.91926, 0.88175, 0.70823, 0.94903, 0.9121, 0.8785, 1, 1, 0.9121, 0.8785, 0.87802, 0.88656, 0.8785, 0.86943, 0.8801, 0.86943, 0.8801, 0.86943, 0.8801, 0.87402, 0.89291, 0.77958, 0.91343, 1, 1, 0.77958, 0.91343, 0.70864, 0.7173, 0.70864, 0.7173, 0.70864, 0.7173, 0.70864, 0.7173, 1, 1, 0.81055, 0.75841, 0.81055, 1.06452, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.96017, 0.95794, 0.77892, 0.85162, 0.77892, 0.78257, 0.79492, 0.78257, 0.79492, 0.78257, 0.79492, 0.9297, 0.56892, 0.83908, 0.88762, 0.77539, 0.8715, 0.87508, 0.89049, 1, 1, 0.81055, 1.04106, 1.20528, 1.20528, 1, 1.15543, 0.70674, 0.98387, 0.94721, 1.33431, 1.45894, 0.95161, 1.06303, 0.83908, 0.80352, 0.57184, 0.6965, 0.56289, 0.82001, 0.56029, 0.81235, 1.02988, 0.83908, 0.7762, 0.68156, 0.80367, 0.73133, 0.78257, 0.87356, 0.86943, 0.95958, 0.75727, 0.89019, 1.04924, 0.9121, 0.7648, 0.86943, 0.87356, 0.79795, 0.78275, 0.81055, 0.77892, 0.9762, 0.82577, 0.99819, 0.84896, 0.95958, 0.77892, 0.96108, 1.01407, 0.89049, 1.02988, 0.94211, 0.96108, 0.8936, 0.84021, 0.87842, 0.96399, 0.79109, 0.89049, 1.00813, 1.02988, 0.86077, 0.87445, 0.92099, 0.84723, 0.86513, 0.8801, 0.75638, 0.85714, 0.78216, 0.79586, 0.87965, 0.94211, 0.97747, 0.78287, 0.97926, 0.84971, 1.02988, 0.94211, 0.8801, 0.94211, 0.84971, 0.73133, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90264, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90518, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90548, 1, 1, 1, 1, 1, 1, 0.96017, 0.95794, 0.96017, 0.95794, 0.96017, 0.95794, 0.77892, 0.85162, 1, 1, 0.89552, 0.90527, 1, 0.90363, 0.92794, 0.92794, 0.92794, 0.92794, 0.87012, 0.87012, 0.87012, 0.89552, 0.89552, 1.42259, 0.71143, 1.06152, 1, 1, 1.03372, 1.03372, 0.97171, 1.4956, 2.2807, 0.93835, 0.83406, 0.91133, 0.84107, 0.91133, 1, 1, 1, 0.72021, 1, 1.23108, 0.83489, 0.88525, 0.88525, 0.81499, 0.90527, 1.81055, 0.90527, 1.81055, 1.31006, 1.53711, 0.94434, 1.08696, 1, 0.95018, 0.77192, 0.85284, 0.90747, 1.17534, 0.69825, 0.9716, 1.37077, 0.90747, 0.90747, 0.85356, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.08004, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90727, 0.90727, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  44428. exports.CalibriBoldFactors = CalibriBoldFactors;
  44429. const CalibriBoldMetrics = {
  44430. lineHeight: 1.2207,
  44431. lineGap: 0.2207
  44432. };
  44433. exports.CalibriBoldMetrics = CalibriBoldMetrics;
  44434. const CalibriBoldItalicFactors = [1.3877, 1, 1, 1, 0.97801, 0.92482, 0.89552, 0.91133, 0.81988, 0.97566, 0.98152, 0.93548, 0.93548, 1.2798, 0.85284, 0.92794, 1, 0.96134, 1.56239, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.82845, 0.82845, 0.85284, 0.85284, 0.85284, 0.75859, 0.92138, 0.83908, 0.7762, 0.71805, 0.87289, 0.73133, 0.7514, 0.81921, 0.87356, 0.95958, 0.59526, 0.75727, 0.69225, 1.04924, 0.90872, 0.85938, 0.79795, 0.87068, 0.77958, 0.69766, 0.81055, 0.90399, 0.88653, 0.96068, 0.82577, 0.77892, 0.78257, 0.97507, 1.529, 0.97507, 0.85284, 0.89552, 0.90176, 0.94908, 0.86411, 0.74012, 0.86411, 0.88323, 0.95015, 0.86411, 0.86331, 0.88401, 0.91916, 0.86304, 0.88401, 0.9039, 0.86331, 0.86331, 0.86411, 0.86411, 0.90464, 0.70852, 1.04106, 0.86331, 0.84372, 0.95794, 0.82616, 0.84548, 0.79492, 0.88331, 1.69808, 0.88331, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.7801, 0.89552, 1.24487, 1.13254, 1.19129, 0.96839, 0.85284, 0.68787, 0.70645, 0.85592, 0.90747, 1.01466, 1.0088, 0.90323, 1, 1.07463, 1, 0.91056, 0.75806, 1.19118, 0.96839, 0.78864, 0.82845, 0.84133, 0.75859, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.77539, 0.71805, 0.73133, 0.73133, 0.73133, 0.73133, 0.95958, 0.95958, 0.95958, 0.95958, 0.88506, 0.90872, 0.85938, 0.85938, 0.85938, 0.85938, 0.85938, 0.85284, 0.87068, 0.90399, 0.90399, 0.90399, 0.90399, 0.77892, 0.79795, 0.90807, 0.94908, 0.94908, 0.94908, 0.94908, 0.94908, 0.94908, 0.85887, 0.74012, 0.88323, 0.88323, 0.88323, 0.88323, 0.88401, 0.88401, 0.88401, 0.88401, 0.8785, 0.86331, 0.86331, 0.86331, 0.86331, 0.86331, 0.86331, 0.90747, 0.89049, 0.86331, 0.86331, 0.86331, 0.86331, 0.84548, 0.86411, 0.84548, 0.83908, 0.94908, 0.83908, 0.94908, 0.83908, 0.94908, 0.71805, 0.74012, 0.71805, 0.74012, 0.71805, 0.74012, 0.71805, 0.74012, 0.87289, 0.79538, 0.88506, 0.92726, 0.73133, 0.88323, 0.73133, 0.88323, 0.73133, 0.88323, 0.73133, 0.88323, 0.73133, 0.88323, 0.81921, 0.86411, 0.81921, 0.86411, 0.81921, 0.86411, 1, 1, 0.87356, 0.86331, 0.91075, 0.8777, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.76467, 0.90167, 0.59526, 0.91916, 1, 1, 0.86304, 0.69225, 0.88401, 1, 1, 0.70424, 0.77312, 0.91926, 0.88175, 0.70823, 0.94903, 0.90872, 0.86331, 1, 1, 0.90872, 0.86331, 0.86906, 0.88116, 0.86331, 0.85938, 0.86331, 0.85938, 0.86331, 0.85938, 0.86331, 0.87402, 0.86549, 0.77958, 0.90464, 1, 1, 0.77958, 0.90464, 0.69766, 0.70852, 0.69766, 0.70852, 0.69766, 0.70852, 0.69766, 0.70852, 1, 1, 0.81055, 0.75841, 0.81055, 1.06452, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.96068, 0.95794, 0.77892, 0.84548, 0.77892, 0.78257, 0.79492, 0.78257, 0.79492, 0.78257, 0.79492, 0.9297, 0.56892, 0.83908, 0.94908, 0.77539, 0.85887, 0.87068, 0.89049, 1, 1, 0.81055, 1.04106, 1.20528, 1.20528, 1, 1.15543, 0.70088, 0.98387, 0.94721, 1.33431, 1.45894, 0.95161, 1.48387, 0.83908, 0.80352, 0.57118, 0.6965, 0.56347, 0.79179, 0.55853, 0.80346, 1.02988, 0.83908, 0.7762, 0.67174, 0.86036, 0.73133, 0.78257, 0.87356, 0.86441, 0.95958, 0.75727, 0.89019, 1.04924, 0.90872, 0.74889, 0.85938, 0.87891, 0.79795, 0.7957, 0.81055, 0.77892, 0.97447, 0.82577, 0.97466, 0.87179, 0.95958, 0.77892, 0.94252, 0.95612, 0.8753, 1.02988, 0.92733, 0.94252, 0.87411, 0.84021, 0.8728, 0.95612, 0.74081, 0.8753, 1.02189, 1.02988, 0.84814, 0.87445, 0.91822, 0.84723, 0.85668, 0.86331, 0.81344, 0.87581, 0.76422, 0.82046, 0.96057, 0.92733, 0.99375, 0.78022, 0.95452, 0.86015, 1.02988, 0.92733, 0.86331, 0.92733, 0.86015, 0.73133, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90631, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.88323, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.85174, 1, 1, 1, 1, 1, 1, 0.96068, 0.95794, 0.96068, 0.95794, 0.96068, 0.95794, 0.77892, 0.84548, 1, 1, 0.89552, 0.90527, 1, 0.90363, 0.92794, 0.92794, 0.92794, 0.89807, 0.87012, 0.87012, 0.87012, 0.89552, 0.89552, 1.42259, 0.71094, 1.06152, 1, 1, 1.03372, 1.03372, 0.97171, 1.4956, 2.2807, 0.92972, 0.83406, 0.91133, 0.83326, 0.91133, 1, 1, 1, 0.72021, 1, 1.23108, 0.83489, 0.88525, 0.88525, 0.81499, 0.90616, 1.81055, 0.90527, 1.81055, 1.3107, 1.53711, 0.94434, 1.08696, 1, 0.95018, 0.77192, 0.85284, 0.90747, 1.17534, 0.69825, 0.9716, 1.37077, 0.90747, 0.90747, 0.85356, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.08004, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90727, 0.90727, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  44435. exports.CalibriBoldItalicFactors = CalibriBoldItalicFactors;
  44436. const CalibriBoldItalicMetrics = {
  44437. lineHeight: 1.2207,
  44438. lineGap: 0.2207
  44439. };
  44440. exports.CalibriBoldItalicMetrics = CalibriBoldItalicMetrics;
  44441. const CalibriItalicFactors = [1.3877, 1, 1, 1, 1.17223, 1.1293, 0.89552, 0.91133, 0.80395, 1.02269, 1.15601, 0.91056, 0.91056, 1.2798, 0.85284, 0.89807, 1, 0.90861, 1.39543, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.96309, 0.96309, 0.85284, 0.85284, 0.85284, 0.83319, 0.88071, 0.8675, 0.81552, 0.72346, 0.85193, 0.73206, 0.7522, 0.81105, 0.86275, 0.90685, 0.6377, 0.77892, 0.75593, 1.02638, 0.89249, 0.84118, 0.77452, 0.85374, 0.75186, 0.67789, 0.79776, 0.88844, 0.85066, 0.94309, 0.77818, 0.7306, 0.76659, 1.10369, 1.38313, 1.10369, 1.06139, 0.89552, 0.8739, 0.9245, 0.9245, 0.83203, 0.9245, 0.85865, 1.09842, 0.9245, 0.9245, 1.03297, 1.07692, 0.90918, 1.03297, 0.94959, 0.9245, 0.92274, 0.9245, 0.9245, 1.02933, 0.77832, 1.20562, 0.9245, 0.8916, 0.98986, 0.86621, 0.89453, 0.79004, 0.94152, 1.77256, 0.94152, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.91729, 0.89552, 1.17889, 1.13254, 1.16359, 0.92098, 0.85284, 0.68787, 0.71353, 0.84737, 0.90747, 1.0088, 1.0044, 0.87683, 1, 1.09091, 1, 0.92229, 0.739, 1.15642, 0.92098, 0.76288, 0.80504, 0.80972, 0.75859, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.76318, 0.72346, 0.73206, 0.73206, 0.73206, 0.73206, 0.90685, 0.90685, 0.90685, 0.90685, 0.86477, 0.89249, 0.84118, 0.84118, 0.84118, 0.84118, 0.84118, 0.85284, 0.84557, 0.88844, 0.88844, 0.88844, 0.88844, 0.7306, 0.77452, 0.86331, 0.9245, 0.9245, 0.9245, 0.9245, 0.9245, 0.9245, 0.84843, 0.83203, 0.85865, 0.85865, 0.85865, 0.85865, 0.82601, 0.82601, 0.82601, 0.82601, 0.94469, 0.9245, 0.92274, 0.92274, 0.92274, 0.92274, 0.92274, 0.90747, 0.86651, 0.9245, 0.9245, 0.9245, 0.9245, 0.89453, 0.9245, 0.89453, 0.8675, 0.9245, 0.8675, 0.9245, 0.8675, 0.9245, 0.72346, 0.83203, 0.72346, 0.83203, 0.72346, 0.83203, 0.72346, 0.83203, 0.85193, 0.8875, 0.86477, 0.99034, 0.73206, 0.85865, 0.73206, 0.85865, 0.73206, 0.85865, 0.73206, 0.85865, 0.73206, 0.85865, 0.81105, 0.9245, 0.81105, 0.9245, 0.81105, 0.9245, 1, 1, 0.86275, 0.9245, 0.90872, 0.93591, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 1.03297, 0.90685, 0.82601, 0.77896, 1.05611, 0.6377, 1.07692, 1, 1, 0.90918, 0.75593, 1.03297, 1, 1, 0.76032, 0.9375, 0.98156, 0.93407, 0.77261, 1.11429, 0.89249, 0.9245, 1, 1, 0.89249, 0.9245, 0.92534, 0.86698, 0.9245, 0.84118, 0.92274, 0.84118, 0.92274, 0.84118, 0.92274, 0.8667, 0.86291, 0.75186, 1.02933, 1, 1, 0.75186, 1.02933, 0.67789, 0.77832, 0.67789, 0.77832, 0.67789, 0.77832, 0.67789, 0.77832, 1, 1, 0.79776, 0.97655, 0.79776, 1.23023, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.94309, 0.98986, 0.7306, 0.89453, 0.7306, 0.76659, 0.79004, 0.76659, 0.79004, 0.76659, 0.79004, 1.09231, 0.54873, 0.8675, 0.9245, 0.76318, 0.84843, 0.84557, 0.86651, 1, 1, 0.79776, 1.20562, 1.18622, 1.18622, 1, 1.1437, 0.67009, 0.96334, 0.93695, 1.35191, 1.40909, 0.95161, 1.48387, 0.8675, 0.90861, 0.6192, 0.7363, 0.64824, 0.82411, 0.56321, 0.85696, 1.23516, 0.8675, 0.81552, 0.7286, 0.84134, 0.73206, 0.76659, 0.86275, 0.84369, 0.90685, 0.77892, 0.85871, 1.02638, 0.89249, 0.75828, 0.84118, 0.85984, 0.77452, 0.76466, 0.79776, 0.7306, 0.90782, 0.77818, 0.903, 0.87291, 0.90685, 0.7306, 0.99058, 1.03667, 0.94635, 1.23516, 0.9849, 0.99058, 0.92393, 0.8916, 0.942, 1.03667, 0.75026, 0.94635, 1.0297, 1.23516, 0.90918, 0.94048, 0.98217, 0.89746, 0.84153, 0.92274, 0.82507, 0.88832, 0.84438, 0.88178, 1.03525, 0.9849, 1.00225, 0.78086, 0.97248, 0.89404, 1.23516, 0.9849, 0.92274, 0.9849, 0.89404, 0.73206, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.89693, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.85865, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90933, 1, 1, 1, 1, 1, 1, 0.94309, 0.98986, 0.94309, 0.98986, 0.94309, 0.98986, 0.7306, 0.89453, 1, 1, 0.89552, 0.90527, 1, 0.90186, 1.12308, 1.12308, 1.12308, 1.12308, 1.2566, 1.2566, 1.2566, 0.89552, 0.89552, 1.42259, 0.68994, 1.03809, 1, 1, 1.0176, 1.0176, 1.11523, 1.4956, 2.01462, 0.97858, 0.82616, 0.91133, 0.83437, 0.91133, 1, 1, 1, 0.70508, 1, 1.23108, 0.79801, 0.84426, 0.84426, 0.774, 0.90572, 1.81055, 0.90749, 1.81055, 1.28809, 1.55469, 0.94434, 1.07806, 1, 0.97094, 0.7589, 0.85284, 0.90747, 1.19658, 0.69825, 0.97622, 1.33512, 0.90747, 0.90747, 0.85284, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.0336, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05859, 1.05859, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  44442. exports.CalibriItalicFactors = CalibriItalicFactors;
  44443. const CalibriItalicMetrics = {
  44444. lineHeight: 1.2207,
  44445. lineGap: 0.2207
  44446. };
  44447. exports.CalibriItalicMetrics = CalibriItalicMetrics;
  44448. const CalibriRegularFactors = [1.3877, 1, 1, 1, 1.17223, 1.1293, 0.89552, 0.91133, 0.80395, 1.02269, 1.15601, 0.91056, 0.91056, 1.2798, 0.85284, 0.89807, 1, 0.90861, 1.39016, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.96309, 0.96309, 0.85284, 0.85284, 0.85284, 0.83319, 0.88071, 0.8675, 0.81552, 0.73834, 0.85193, 0.73206, 0.7522, 0.81105, 0.86275, 0.90685, 0.6377, 0.77892, 0.75593, 1.02638, 0.89385, 0.85122, 0.77452, 0.86503, 0.75186, 0.68887, 0.79776, 0.88844, 0.85066, 0.94258, 0.77818, 0.7306, 0.76659, 1.10369, 1.39016, 1.10369, 1.06139, 0.89552, 0.8739, 0.86128, 0.94469, 0.8457, 0.94469, 0.89464, 1.09842, 0.84636, 0.94469, 1.03297, 1.07692, 0.90918, 1.03297, 0.95897, 0.94469, 0.9482, 0.94469, 0.94469, 1.04692, 0.78223, 1.20562, 0.94469, 0.90332, 0.98986, 0.86621, 0.90527, 0.79004, 0.94152, 1.77256, 0.94152, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.91729, 0.89552, 1.17889, 1.13254, 1.08707, 0.92098, 0.85284, 0.68787, 0.71353, 0.84737, 0.90747, 1.0088, 1.0044, 0.87683, 1, 1.09091, 1, 0.92229, 0.739, 1.15642, 0.92098, 0.76288, 0.80504, 0.80972, 0.75859, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.76318, 0.73834, 0.73206, 0.73206, 0.73206, 0.73206, 0.90685, 0.90685, 0.90685, 0.90685, 0.86477, 0.89385, 0.85122, 0.85122, 0.85122, 0.85122, 0.85122, 0.85284, 0.85311, 0.88844, 0.88844, 0.88844, 0.88844, 0.7306, 0.77452, 0.86331, 0.86128, 0.86128, 0.86128, 0.86128, 0.86128, 0.86128, 0.8693, 0.8457, 0.89464, 0.89464, 0.89464, 0.89464, 0.82601, 0.82601, 0.82601, 0.82601, 0.94469, 0.94469, 0.9482, 0.9482, 0.9482, 0.9482, 0.9482, 0.90747, 0.86651, 0.94469, 0.94469, 0.94469, 0.94469, 0.90527, 0.94469, 0.90527, 0.8675, 0.86128, 0.8675, 0.86128, 0.8675, 0.86128, 0.73834, 0.8457, 0.73834, 0.8457, 0.73834, 0.8457, 0.73834, 0.8457, 0.85193, 0.92454, 0.86477, 0.9921, 0.73206, 0.89464, 0.73206, 0.89464, 0.73206, 0.89464, 0.73206, 0.89464, 0.73206, 0.89464, 0.81105, 0.84636, 0.81105, 0.84636, 0.81105, 0.84636, 1, 1, 0.86275, 0.94469, 0.90872, 0.95786, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 1.03297, 0.90685, 0.82601, 0.77741, 1.05611, 0.6377, 1.07692, 1, 1, 0.90918, 0.75593, 1.03297, 1, 1, 0.76032, 0.90452, 0.98156, 1.11842, 0.77261, 1.11429, 0.89385, 0.94469, 1, 1, 0.89385, 0.94469, 0.95877, 0.86901, 0.94469, 0.85122, 0.9482, 0.85122, 0.9482, 0.85122, 0.9482, 0.8667, 0.90016, 0.75186, 1.04692, 1, 1, 0.75186, 1.04692, 0.68887, 0.78223, 0.68887, 0.78223, 0.68887, 0.78223, 0.68887, 0.78223, 1, 1, 0.79776, 0.92188, 0.79776, 1.23023, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.94258, 0.98986, 0.7306, 0.90527, 0.7306, 0.76659, 0.79004, 0.76659, 0.79004, 0.76659, 0.79004, 1.09231, 0.54873, 0.8675, 0.86128, 0.76318, 0.8693, 0.85311, 0.86651, 1, 1, 0.79776, 1.20562, 1.18622, 1.18622, 1, 1.1437, 0.67742, 0.96334, 0.93695, 1.35191, 1.40909, 0.95161, 1.48387, 0.86686, 0.90861, 0.62267, 0.74359, 0.65649, 0.85498, 0.56963, 0.88254, 1.23516, 0.8675, 0.81552, 0.75443, 0.84503, 0.73206, 0.76659, 0.86275, 0.85122, 0.90685, 0.77892, 0.85746, 1.02638, 0.89385, 0.75657, 0.85122, 0.86275, 0.77452, 0.74171, 0.79776, 0.7306, 0.95165, 0.77818, 0.89772, 0.88831, 0.90685, 0.7306, 0.98142, 1.02191, 0.96576, 1.23516, 0.99018, 0.98142, 0.9236, 0.89258, 0.94035, 1.02191, 0.78848, 0.96576, 0.9561, 1.23516, 0.90918, 0.92578, 0.95424, 0.89746, 0.83969, 0.9482, 0.80113, 0.89442, 0.85208, 0.86155, 0.98022, 0.99018, 1.00452, 0.81209, 0.99247, 0.89181, 1.23516, 0.99018, 0.9482, 0.99018, 0.89181, 0.73206, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.88844, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.89464, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.96766, 1, 1, 1, 1, 1, 1, 0.94258, 0.98986, 0.94258, 0.98986, 0.94258, 0.98986, 0.7306, 0.90527, 1, 1, 0.89552, 0.90527, 1, 0.90186, 1.12308, 1.12308, 1.12308, 1.12308, 1.2566, 1.2566, 1.2566, 0.89552, 0.89552, 1.42259, 0.69043, 1.03809, 1, 1, 1.0176, 1.0176, 1.11523, 1.4956, 2.01462, 0.99331, 0.82616, 0.91133, 0.84286, 0.91133, 1, 1, 1, 0.70508, 1, 1.23108, 0.79801, 0.84426, 0.84426, 0.774, 0.90527, 1.81055, 0.90527, 1.81055, 1.28809, 1.55469, 0.94434, 1.07806, 1, 0.97094, 0.7589, 0.85284, 0.90747, 1.19658, 0.69825, 0.97622, 1.33512, 0.90747, 0.90747, 0.85356, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.0336, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05859, 1.05859, 1, 1, 1, 1.07185, 0.99413, 0.96334, 1.08065, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  44449. exports.CalibriRegularFactors = CalibriRegularFactors;
  44450. const CalibriRegularMetrics = {
  44451. lineHeight: 1.2207,
  44452. lineGap: 0.2207
  44453. };
  44454. exports.CalibriRegularMetrics = CalibriRegularMetrics;
  44455. /***/ }),
  44456. /* 51 */
  44457. /***/ ((__unused_webpack_module, exports) => {
  44458. Object.defineProperty(exports, "__esModule", ({
  44459. value: true
  44460. }));
  44461. exports.HelveticaRegularMetrics = exports.HelveticaRegularFactors = exports.HelveticaItalicMetrics = exports.HelveticaItalicFactors = exports.HelveticaBoldMetrics = exports.HelveticaBoldItalicMetrics = exports.HelveticaBoldItalicFactors = exports.HelveticaBoldFactors = void 0;
  44462. const HelveticaBoldFactors = [0.76116, 1, 1, 1.0006, 0.99998, 0.99974, 0.99973, 0.99973, 0.99982, 0.99977, 1.00087, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.00003, 1.00003, 1.00003, 1.00026, 0.9999, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 0.99973, 0.99977, 1.00026, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 0.99998, 1.0006, 0.99998, 1.00003, 0.99973, 0.99998, 0.99973, 1.00026, 0.99973, 1.00026, 0.99973, 0.99998, 1.00026, 1.00026, 1.0006, 1.0006, 0.99973, 1.0006, 0.99982, 1.00026, 1.00026, 1.00026, 1.00026, 0.99959, 0.99973, 0.99998, 1.00026, 0.99973, 1.00022, 0.99973, 0.99973, 1, 0.99959, 1.00077, 0.99959, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.00077, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.99973, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.06409, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 1.00026, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 1.03374, 0.99977, 1.00026, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.00042, 0.99973, 0.99973, 1.0006, 0.99977, 0.99973, 0.99973, 1.00026, 1.0006, 1.00026, 1.0006, 1.00026, 1.03828, 1.00026, 0.99999, 1.00026, 1.0006, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.9993, 0.9998, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1, 1.00016, 0.99977, 0.99959, 0.99977, 0.99959, 0.99977, 0.99959, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00026, 0.99998, 1.00026, 0.8121, 1.00026, 0.99998, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.00016, 1.00022, 1.00001, 0.99973, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 1.0006, 0.99973, 0.99977, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 0.99973, 1.00026, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 1.00034, 0.99977, 1, 0.99997, 1.00026, 1.00078, 1.00036, 0.99973, 1.00013, 1.0006, 0.99977, 0.99977, 0.99988, 0.85148, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 0.99977, 1.00001, 0.99999, 0.99977, 1.00069, 1.00022, 0.99977, 1.00001, 0.99984, 1.00026, 1.00001, 1.00024, 1.00001, 0.9999, 1, 1.0006, 1.00001, 1.00041, 0.99962, 1.00026, 1.0006, 0.99995, 1.00041, 0.99942, 0.99973, 0.99927, 1.00082, 0.99902, 1.00026, 1.00087, 1.0006, 1.00069, 0.99973, 0.99867, 0.99973, 0.9993, 1.00026, 1.00049, 1.00056, 1, 0.99988, 0.99935, 0.99995, 0.99954, 1.00055, 0.99945, 1.00032, 1.0006, 0.99995, 1.00026, 0.99995, 1.00032, 1.00001, 1.00008, 0.99971, 1.00019, 0.9994, 1.00001, 1.0006, 1.00044, 0.99973, 1.00023, 1.00047, 1, 0.99942, 0.99561, 0.99989, 1.00035, 0.99977, 1.00035, 0.99977, 1.00019, 0.99944, 1.00001, 1.00021, 0.99926, 1.00035, 1.00035, 0.99942, 1.00048, 0.99999, 0.99977, 1.00022, 1.00035, 1.00001, 0.99977, 1.00026, 0.99989, 1.00057, 1.00001, 0.99936, 1.00052, 1.00012, 0.99996, 1.00043, 1, 1.00035, 0.9994, 0.99976, 1.00035, 0.99973, 1.00052, 1.00041, 1.00119, 1.00037, 0.99973, 1.00002, 0.99986, 1.00041, 1.00041, 0.99902, 0.9996, 1.00034, 0.99999, 1.00026, 0.99999, 1.00026, 0.99973, 1.00052, 0.99973, 1, 0.99973, 1.00041, 1.00075, 0.9994, 1.0003, 0.99999, 1, 1.00041, 0.99955, 1, 0.99915, 0.99973, 0.99973, 1.00026, 1.00119, 0.99955, 0.99973, 1.0006, 0.99911, 1.0006, 1.00026, 0.99972, 1.00026, 0.99902, 1.00041, 0.99973, 0.99999, 1, 1, 1.00038, 1.0005, 1.00016, 1.00022, 1.00016, 1.00022, 1.00016, 1.00022, 1.00001, 0.99973, 1, 1, 0.99973, 1, 1, 0.99955, 1.0006, 1.0006, 1.0006, 1.0006, 1, 1, 1, 0.99973, 0.99973, 0.99972, 1, 1, 1.00106, 0.99999, 0.99998, 0.99998, 0.99999, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1.00023, 0.99973, 0.99971, 1.00047, 1.00023, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1, 1, 1, 1, 1, 1, 1, 0.99972, 1, 1.20985, 1.39713, 1.00003, 1.00031, 1.00015, 1, 0.99561, 1.00027, 1.00031, 1.00031, 0.99915, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99972, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 0.99998, 0.99998, 0.99998, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  44463. exports.HelveticaBoldFactors = HelveticaBoldFactors;
  44464. const HelveticaBoldMetrics = {
  44465. lineHeight: 1.2,
  44466. lineGap: 0.2
  44467. };
  44468. exports.HelveticaBoldMetrics = HelveticaBoldMetrics;
  44469. const HelveticaBoldItalicFactors = [0.76116, 1, 1, 1.0006, 0.99998, 0.99974, 0.99973, 0.99973, 0.99982, 0.99977, 1.00087, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.00003, 1.00003, 1.00003, 1.00026, 0.9999, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 0.99973, 0.99977, 1.00026, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 0.99998, 1.0006, 0.99998, 1.00003, 0.99973, 0.99998, 0.99973, 1.00026, 0.99973, 1.00026, 0.99973, 0.99998, 1.00026, 1.00026, 1.0006, 1.0006, 0.99973, 1.0006, 0.99982, 1.00026, 1.00026, 1.00026, 1.00026, 0.99959, 0.99973, 0.99998, 1.00026, 0.99973, 1.00022, 0.99973, 0.99973, 1, 0.99959, 1.00077, 0.99959, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.00077, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.99973, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.06409, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 1.00026, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 1.0044, 0.99977, 1.00026, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99971, 0.99973, 0.99973, 1.0006, 0.99977, 0.99973, 0.99973, 1.00026, 1.0006, 1.00026, 1.0006, 1.00026, 1.01011, 1.00026, 0.99999, 1.00026, 1.0006, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.9993, 0.9998, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1, 1.00016, 0.99977, 0.99959, 0.99977, 0.99959, 0.99977, 0.99959, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00026, 0.99998, 1.00026, 0.8121, 1.00026, 0.99998, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.00016, 1.00022, 1.00001, 0.99973, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 1.0006, 0.99973, 0.99977, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 0.99973, 1.00026, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99977, 1, 1, 1.00026, 0.99969, 0.99972, 0.99981, 0.9998, 1.0006, 0.99977, 0.99977, 1.00022, 0.91155, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 0.99977, 1.00001, 0.99999, 0.99977, 0.99966, 1.00022, 1.00032, 1.00001, 0.99944, 1.00026, 1.00001, 0.99968, 1.00001, 1.00047, 1, 1.0006, 1.00001, 0.99981, 1.00101, 1.00026, 1.0006, 0.99948, 0.99981, 1.00064, 0.99973, 0.99942, 1.00101, 1.00061, 1.00026, 1.00069, 1.0006, 1.00014, 0.99973, 1.01322, 0.99973, 1.00065, 1.00026, 1.00012, 0.99923, 1, 1.00064, 1.00076, 0.99948, 1.00055, 1.00063, 1.00007, 0.99943, 1.0006, 0.99948, 1.00026, 0.99948, 0.99943, 1.00001, 1.00001, 1.00029, 1.00038, 1.00035, 1.00001, 1.0006, 1.0006, 0.99973, 0.99978, 1.00001, 1.00057, 0.99989, 0.99967, 0.99964, 0.99967, 0.99977, 0.99999, 0.99977, 1.00038, 0.99977, 1.00001, 0.99973, 1.00066, 0.99967, 0.99967, 1.00041, 0.99998, 0.99999, 0.99977, 1.00022, 0.99967, 1.00001, 0.99977, 1.00026, 0.99964, 1.00031, 1.00001, 0.99999, 0.99999, 1, 1.00023, 1, 1, 0.99999, 1.00035, 1.00001, 0.99999, 0.99973, 0.99977, 0.99999, 1.00058, 0.99973, 0.99973, 0.99955, 0.9995, 1.00026, 1.00026, 1.00032, 0.99989, 1.00034, 0.99999, 1.00026, 1.00026, 1.00026, 0.99973, 0.45998, 0.99973, 1.00026, 0.99973, 1.00001, 0.99999, 0.99982, 0.99994, 0.99996, 1, 1.00042, 1.00044, 1.00029, 1.00023, 0.99973, 0.99973, 1.00026, 0.99949, 1.00002, 0.99973, 1.0006, 1.0006, 1.0006, 0.99975, 1.00026, 1.00026, 1.00032, 0.98685, 0.99973, 1.00026, 1, 1, 0.99966, 1.00044, 1.00016, 1.00022, 1.00016, 1.00022, 1.00016, 1.00022, 1.00001, 0.99973, 1, 1, 0.99973, 1, 1, 0.99955, 1.0006, 1.0006, 1.0006, 1.0006, 1, 1, 1, 0.99973, 0.99973, 0.99972, 1, 1, 1.00106, 0.99999, 0.99998, 0.99998, 0.99999, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1, 0.99973, 0.99971, 0.99978, 1, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1.00098, 1, 1, 1, 1.00049, 1, 1, 0.99972, 1, 1.20985, 1.39713, 1.00003, 1.00031, 1.00015, 1, 0.99561, 1.00027, 1.00031, 1.00031, 0.99915, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99972, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 0.99998, 0.99998, 0.99998, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  44470. exports.HelveticaBoldItalicFactors = HelveticaBoldItalicFactors;
  44471. const HelveticaBoldItalicMetrics = {
  44472. lineHeight: 1.35,
  44473. lineGap: 0.2
  44474. };
  44475. exports.HelveticaBoldItalicMetrics = HelveticaBoldItalicMetrics;
  44476. const HelveticaItalicFactors = [0.76116, 1, 1, 1.0006, 1.0006, 1.00006, 0.99973, 0.99973, 0.99982, 1.00001, 1.00043, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1, 1.00003, 1.00003, 1.00003, 0.99973, 0.99987, 1.00001, 1.00001, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 1, 1.00001, 0.99973, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 1.0006, 1.0006, 1.0006, 0.99949, 0.99973, 0.99998, 0.99973, 0.99973, 1, 0.99973, 0.99973, 1.0006, 0.99973, 0.99973, 0.99924, 0.99924, 1, 0.99924, 0.99999, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.0006, 0.99973, 1, 0.99977, 1, 1, 1, 1.00005, 1.0009, 1.00005, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.0009, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.9998, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 1, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.06409, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 1, 0.99973, 1, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1.0288, 0.99977, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99924, 1.0006, 1.0006, 0.99946, 1.00034, 1, 0.99924, 1.00001, 1, 1, 0.99973, 0.99924, 0.99973, 0.99924, 0.99973, 1.06311, 0.99973, 1.00024, 0.99973, 0.99924, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.00041, 0.9998, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1, 1.00016, 0.99977, 0.99998, 0.99977, 0.99998, 0.99977, 0.99998, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00026, 1.0006, 1.00026, 0.89547, 1.00026, 1.0006, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.00016, 0.99977, 1.00001, 1, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 0.99924, 0.99973, 1.00001, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 1, 1.00026, 1.0006, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 1.00001, 1, 1.00054, 0.99977, 1.00084, 1.00007, 0.99973, 1.00013, 0.99924, 1.00001, 1.00001, 0.99945, 0.91221, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 1.00001, 1.00001, 0.99999, 0.99977, 0.99933, 1.00022, 1.00054, 1.00001, 1.00065, 1.00026, 1.00001, 1.0001, 1.00001, 1.00052, 1, 1.0006, 1.00001, 0.99945, 0.99897, 0.99968, 0.99924, 1.00036, 0.99945, 0.99949, 1, 1.0006, 0.99897, 0.99918, 0.99968, 0.99911, 0.99924, 1, 0.99962, 1.01487, 1, 1.0005, 0.99973, 1.00012, 1.00043, 1, 0.99995, 0.99994, 1.00036, 0.99947, 1.00019, 1.00063, 1.00025, 0.99924, 1.00036, 0.99973, 1.00036, 1.00025, 1.00001, 1.00001, 1.00027, 1.0001, 1.00068, 1.00001, 1.0006, 1.0006, 1, 1.00008, 0.99957, 0.99972, 0.9994, 0.99954, 0.99975, 1.00051, 1.00001, 1.00019, 1.00001, 1.0001, 0.99986, 1.00001, 1.00001, 1.00038, 0.99954, 0.99954, 0.9994, 1.00066, 0.99999, 0.99977, 1.00022, 1.00054, 1.00001, 0.99977, 1.00026, 0.99975, 1.0001, 1.00001, 0.99993, 0.9995, 0.99955, 1.00016, 0.99978, 0.99974, 1.00019, 1.00022, 0.99955, 1.00053, 0.99973, 1.00089, 1.00005, 0.99967, 1.00048, 0.99973, 1.00002, 1.00034, 0.99973, 0.99973, 0.99964, 1.00006, 1.00066, 0.99947, 0.99973, 0.98894, 0.99973, 1, 0.44898, 1, 0.99946, 1, 1.00039, 1.00082, 0.99991, 0.99991, 0.99985, 1.00022, 1.00023, 1.00061, 1.00006, 0.99966, 0.99973, 0.99973, 0.99973, 1.00019, 1.0008, 1, 0.99924, 0.99924, 0.99924, 0.99983, 1.00044, 0.99973, 0.99964, 0.98332, 1, 0.99973, 1, 1, 0.99962, 0.99895, 1.00016, 0.99977, 1.00016, 0.99977, 1.00016, 0.99977, 1.00001, 1, 1, 1, 0.99973, 1, 1, 0.99955, 0.99924, 0.99924, 0.99924, 0.99924, 0.99998, 0.99998, 0.99998, 0.99973, 0.99973, 0.99972, 1, 1, 1.00267, 0.99999, 0.99998, 0.99998, 1, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1.00023, 0.99973, 1.00423, 0.99925, 0.99999, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1.00049, 1, 1.00245, 1, 1, 1, 1, 0.96329, 1, 1.20985, 1.39713, 1.00003, 0.8254, 1.00015, 1, 1.00035, 1.00027, 1.00031, 1.00031, 1.00003, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.95317, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 0.99998, 0.99998, 0.99998, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  44477. exports.HelveticaItalicFactors = HelveticaItalicFactors;
  44478. const HelveticaItalicMetrics = {
  44479. lineHeight: 1.35,
  44480. lineGap: 0.2
  44481. };
  44482. exports.HelveticaItalicMetrics = HelveticaItalicMetrics;
  44483. const HelveticaRegularFactors = [0.76116, 1, 1, 1.0006, 1.0006, 1.00006, 0.99973, 0.99973, 0.99982, 1.00001, 1.00043, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1, 1.00003, 1.00003, 1.00003, 0.99973, 0.99987, 1.00001, 1.00001, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 1, 1.00001, 0.99973, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 1.0006, 1.0006, 1.0006, 0.99949, 0.99973, 0.99998, 0.99973, 0.99973, 1, 0.99973, 0.99973, 1.0006, 0.99973, 0.99973, 0.99924, 0.99924, 1, 0.99924, 0.99999, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.0006, 0.99973, 1, 0.99977, 1, 1, 1, 1.00005, 1.0009, 1.00005, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.0009, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.9998, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 1, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.06409, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 1, 0.99973, 1, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1.04596, 0.99977, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99924, 1.0006, 1.0006, 1.00019, 1.00034, 1, 0.99924, 1.00001, 1, 1, 0.99973, 0.99924, 0.99973, 0.99924, 0.99973, 1.02572, 0.99973, 1.00005, 0.99973, 0.99924, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99999, 0.9998, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1, 1.00016, 0.99977, 0.99998, 0.99977, 0.99998, 0.99977, 0.99998, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00026, 1.0006, 1.00026, 0.84533, 1.00026, 1.0006, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.00016, 0.99977, 1.00001, 1, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 0.99924, 0.99973, 1.00001, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 1, 1.00026, 1.0006, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99928, 1, 0.99977, 1.00013, 1.00055, 0.99947, 0.99945, 0.99941, 0.99924, 1.00001, 1.00001, 1.0004, 0.91621, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 1.00001, 1.00005, 0.99999, 0.99977, 1.00015, 1.00022, 0.99977, 1.00001, 0.99973, 1.00026, 1.00001, 1.00019, 1.00001, 0.99946, 1, 1.0006, 1.00001, 0.99978, 1.00045, 0.99973, 0.99924, 1.00023, 0.99978, 0.99966, 1, 1.00065, 1.00045, 1.00019, 0.99973, 0.99973, 0.99924, 1, 1, 0.96499, 1, 1.00055, 0.99973, 1.00008, 1.00027, 1, 0.9997, 0.99995, 1.00023, 0.99933, 1.00019, 1.00015, 1.00031, 0.99924, 1.00023, 0.99973, 1.00023, 1.00031, 1.00001, 0.99928, 1.00029, 1.00092, 1.00035, 1.00001, 1.0006, 1.0006, 1, 0.99988, 0.99975, 1, 1.00082, 0.99561, 0.9996, 1.00035, 1.00001, 0.99962, 1.00001, 1.00092, 0.99964, 1.00001, 0.99963, 0.99999, 1.00035, 1.00035, 1.00082, 0.99962, 0.99999, 0.99977, 1.00022, 1.00035, 1.00001, 0.99977, 1.00026, 0.9996, 0.99967, 1.00001, 1.00034, 1.00074, 1.00054, 1.00053, 1.00063, 0.99971, 0.99962, 1.00035, 0.99975, 0.99977, 0.99973, 1.00043, 0.99953, 1.0007, 0.99915, 0.99973, 1.00008, 0.99892, 1.00073, 1.00073, 1.00114, 0.99915, 1.00073, 0.99955, 0.99973, 1.00092, 0.99973, 1, 0.99998, 1, 1.0003, 1, 1.00043, 1.00001, 0.99969, 1.0003, 1, 1.00035, 1.00001, 0.9995, 1, 1.00092, 0.99973, 0.99973, 0.99973, 1.0007, 0.9995, 1, 0.99924, 1.0006, 0.99924, 0.99972, 1.00062, 0.99973, 1.00114, 1.00073, 1, 0.99955, 1, 1, 1.00047, 0.99968, 1.00016, 0.99977, 1.00016, 0.99977, 1.00016, 0.99977, 1.00001, 1, 1, 1, 0.99973, 1, 1, 0.99955, 0.99924, 0.99924, 0.99924, 0.99924, 0.99998, 0.99998, 0.99998, 0.99973, 0.99973, 0.99972, 1, 1, 1.00267, 0.99999, 0.99998, 0.99998, 1, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1.00023, 0.99973, 0.99971, 0.99925, 1.00023, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1, 1, 1, 1, 1, 1, 1, 0.96329, 1, 1.20985, 1.39713, 1.00003, 0.8254, 1.00015, 1, 1.00035, 1.00027, 1.00031, 1.00031, 0.99915, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.95317, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  44484. exports.HelveticaRegularFactors = HelveticaRegularFactors;
  44485. const HelveticaRegularMetrics = {
  44486. lineHeight: 1.2,
  44487. lineGap: 0.2
  44488. };
  44489. exports.HelveticaRegularMetrics = HelveticaRegularMetrics;
  44490. /***/ }),
  44491. /* 52 */
  44492. /***/ ((__unused_webpack_module, exports) => {
  44493. Object.defineProperty(exports, "__esModule", ({
  44494. value: true
  44495. }));
  44496. exports.LiberationSansRegularWidths = exports.LiberationSansRegularMapping = exports.LiberationSansItalicWidths = exports.LiberationSansItalicMapping = exports.LiberationSansBoldWidths = exports.LiberationSansBoldMapping = exports.LiberationSansBoldItalicWidths = exports.LiberationSansBoldItalicMapping = void 0;
  44497. const LiberationSansBoldWidths = [365, 0, 333, 278, 333, 474, 556, 556, 889, 722, 238, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 333, 584, 584, 584, 611, 975, 722, 722, 722, 722, 667, 611, 778, 722, 278, 556, 722, 611, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 333, 278, 333, 584, 556, 333, 556, 611, 556, 611, 556, 333, 611, 611, 278, 278, 556, 278, 889, 611, 611, 611, 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389, 584, 333, 556, 556, 556, 556, 280, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 556, 278, 333, 333, 365, 556, 834, 834, 834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 556, 556, 556, 556, 556, 278, 278, 278, 278, 611, 611, 611, 611, 611, 611, 611, 549, 611, 611, 611, 611, 611, 556, 611, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 719, 722, 611, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 611, 778, 611, 778, 611, 778, 611, 722, 611, 722, 611, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 785, 556, 556, 278, 722, 556, 556, 611, 278, 611, 278, 611, 385, 611, 479, 611, 278, 722, 611, 722, 611, 722, 611, 708, 723, 611, 778, 611, 778, 611, 778, 611, 1000, 944, 722, 389, 722, 389, 722, 389, 667, 556, 667, 556, 667, 556, 667, 556, 611, 333, 611, 479, 611, 333, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 944, 778, 667, 556, 667, 611, 500, 611, 500, 611, 500, 278, 556, 722, 556, 1000, 889, 778, 611, 667, 556, 611, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 465, 722, 333, 853, 906, 474, 825, 927, 838, 278, 722, 722, 601, 719, 667, 611, 722, 778, 278, 722, 667, 833, 722, 644, 778, 722, 667, 600, 611, 667, 821, 667, 809, 802, 278, 667, 615, 451, 611, 278, 582, 615, 610, 556, 606, 475, 460, 611, 541, 278, 558, 556, 612, 556, 445, 611, 766, 619, 520, 684, 446, 582, 715, 576, 753, 845, 278, 582, 611, 582, 845, 667, 669, 885, 567, 711, 667, 278, 276, 556, 1094, 1062, 875, 610, 722, 622, 719, 722, 719, 722, 567, 712, 667, 904, 626, 719, 719, 610, 702, 833, 722, 778, 719, 667, 722, 611, 622, 854, 667, 730, 703, 1005, 1019, 870, 979, 719, 711, 1031, 719, 556, 618, 615, 417, 635, 556, 709, 497, 615, 615, 500, 635, 740, 604, 611, 604, 611, 556, 490, 556, 875, 556, 615, 581, 833, 844, 729, 854, 615, 552, 854, 583, 556, 556, 611, 417, 552, 556, 278, 281, 278, 969, 906, 611, 500, 615, 556, 604, 778, 611, 487, 447, 944, 778, 944, 778, 944, 778, 667, 556, 333, 333, 556, 1000, 1000, 552, 278, 278, 278, 278, 500, 500, 500, 556, 556, 350, 1000, 1000, 240, 479, 333, 333, 604, 333, 167, 396, 556, 556, 1094, 556, 885, 489, 1115, 1000, 768, 600, 834, 834, 834, 834, 1000, 500, 1000, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 722, 274, 549, 549, 583, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 611, 611, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 333, 333, 333, 333, 333, 333, 333, 333];
  44498. exports.LiberationSansBoldWidths = LiberationSansBoldWidths;
  44499. const LiberationSansBoldMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
  44500. exports.LiberationSansBoldMapping = LiberationSansBoldMapping;
  44501. const LiberationSansBoldItalicWidths = [365, 0, 333, 278, 333, 474, 556, 556, 889, 722, 238, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 333, 584, 584, 584, 611, 975, 722, 722, 722, 722, 667, 611, 778, 722, 278, 556, 722, 611, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 333, 278, 333, 584, 556, 333, 556, 611, 556, 611, 556, 333, 611, 611, 278, 278, 556, 278, 889, 611, 611, 611, 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389, 584, 333, 556, 556, 556, 556, 280, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 556, 278, 333, 333, 365, 556, 834, 834, 834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 556, 556, 556, 556, 556, 278, 278, 278, 278, 611, 611, 611, 611, 611, 611, 611, 549, 611, 611, 611, 611, 611, 556, 611, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 740, 722, 611, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 611, 778, 611, 778, 611, 778, 611, 722, 611, 722, 611, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 782, 556, 556, 278, 722, 556, 556, 611, 278, 611, 278, 611, 396, 611, 479, 611, 278, 722, 611, 722, 611, 722, 611, 708, 723, 611, 778, 611, 778, 611, 778, 611, 1000, 944, 722, 389, 722, 389, 722, 389, 667, 556, 667, 556, 667, 556, 667, 556, 611, 333, 611, 479, 611, 333, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 944, 778, 667, 556, 667, 611, 500, 611, 500, 611, 500, 278, 556, 722, 556, 1000, 889, 778, 611, 667, 556, 611, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 722, 333, 854, 906, 473, 844, 930, 847, 278, 722, 722, 610, 671, 667, 611, 722, 778, 278, 722, 667, 833, 722, 657, 778, 718, 667, 590, 611, 667, 822, 667, 829, 781, 278, 667, 620, 479, 611, 278, 591, 620, 621, 556, 610, 479, 492, 611, 558, 278, 566, 556, 603, 556, 450, 611, 712, 605, 532, 664, 409, 591, 704, 578, 773, 834, 278, 591, 611, 591, 834, 667, 667, 886, 614, 719, 667, 278, 278, 556, 1094, 1042, 854, 622, 719, 677, 719, 722, 708, 722, 614, 722, 667, 927, 643, 719, 719, 615, 687, 833, 722, 778, 719, 667, 722, 611, 677, 781, 667, 729, 708, 979, 989, 854, 1000, 708, 719, 1042, 729, 556, 619, 604, 534, 618, 556, 736, 510, 611, 611, 507, 622, 740, 604, 611, 611, 611, 556, 889, 556, 885, 556, 646, 583, 889, 935, 707, 854, 594, 552, 865, 589, 556, 556, 611, 469, 563, 556, 278, 278, 278, 969, 906, 611, 507, 619, 556, 611, 778, 611, 575, 467, 944, 778, 944, 778, 944, 778, 667, 556, 333, 333, 556, 1000, 1000, 552, 278, 278, 278, 278, 500, 500, 500, 556, 556, 350, 1000, 1000, 240, 479, 333, 333, 604, 333, 167, 396, 556, 556, 1104, 556, 885, 516, 1146, 1000, 768, 600, 834, 834, 834, 834, 999, 500, 1000, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 722, 274, 549, 549, 583, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 611, 611, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 333, 333, 333, 333, 333, 333, 333, 333];
  44502. exports.LiberationSansBoldItalicWidths = LiberationSansBoldItalicWidths;
  44503. const LiberationSansBoldItalicMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
  44504. exports.LiberationSansBoldItalicMapping = LiberationSansBoldItalicMapping;
  44505. const LiberationSansItalicWidths = [365, 0, 333, 278, 278, 355, 556, 556, 889, 667, 191, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 278, 278, 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, 611, 778, 722, 278, 500, 667, 556, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, 333, 556, 556, 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, 556, 556, 556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334, 584, 333, 556, 556, 556, 556, 260, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 537, 278, 333, 333, 365, 556, 834, 834, 834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 500, 556, 556, 556, 556, 278, 278, 278, 278, 556, 556, 556, 556, 556, 556, 556, 549, 611, 556, 556, 556, 556, 500, 556, 500, 667, 556, 667, 556, 667, 556, 722, 500, 722, 500, 722, 500, 722, 500, 722, 625, 722, 556, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 556, 778, 556, 778, 556, 778, 556, 722, 556, 722, 556, 278, 278, 278, 278, 278, 278, 278, 222, 278, 278, 733, 444, 500, 222, 667, 500, 500, 556, 222, 556, 222, 556, 281, 556, 400, 556, 222, 722, 556, 722, 556, 722, 556, 615, 723, 556, 778, 556, 778, 556, 778, 556, 1000, 944, 722, 333, 722, 333, 722, 333, 667, 500, 667, 500, 667, 500, 667, 500, 611, 278, 611, 354, 611, 278, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 944, 722, 667, 500, 667, 611, 500, 611, 500, 611, 500, 222, 556, 667, 556, 1000, 889, 778, 611, 667, 500, 611, 278, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 667, 278, 789, 846, 389, 794, 865, 775, 222, 667, 667, 570, 671, 667, 611, 722, 778, 278, 667, 667, 833, 722, 648, 778, 725, 667, 600, 611, 667, 837, 667, 831, 761, 278, 667, 570, 439, 555, 222, 550, 570, 571, 500, 556, 439, 463, 555, 542, 222, 500, 492, 548, 500, 447, 556, 670, 573, 486, 603, 374, 550, 652, 546, 728, 779, 222, 550, 556, 550, 779, 667, 667, 843, 544, 708, 667, 278, 278, 500, 1066, 982, 844, 589, 715, 639, 724, 667, 651, 667, 544, 704, 667, 917, 614, 715, 715, 589, 686, 833, 722, 778, 725, 667, 722, 611, 639, 795, 667, 727, 673, 920, 923, 805, 886, 651, 694, 1022, 682, 556, 562, 522, 493, 553, 556, 688, 465, 556, 556, 472, 564, 686, 550, 556, 556, 556, 500, 833, 500, 835, 500, 572, 518, 830, 851, 621, 736, 526, 492, 752, 534, 556, 556, 556, 378, 496, 500, 222, 222, 222, 910, 828, 556, 472, 565, 500, 556, 778, 556, 492, 339, 944, 722, 944, 722, 944, 722, 667, 500, 333, 333, 556, 1000, 1000, 552, 222, 222, 222, 222, 333, 333, 333, 556, 556, 350, 1000, 1000, 188, 354, 333, 333, 500, 333, 167, 365, 556, 556, 1094, 556, 885, 323, 1083, 1000, 768, 600, 834, 834, 834, 834, 1000, 500, 998, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 719, 274, 549, 549, 584, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 500, 500, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 294, 294, 324, 324, 316, 328, 398, 285];
  44506. exports.LiberationSansItalicWidths = LiberationSansItalicWidths;
  44507. const LiberationSansItalicMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
  44508. exports.LiberationSansItalicMapping = LiberationSansItalicMapping;
  44509. const LiberationSansRegularWidths = [365, 0, 333, 278, 278, 355, 556, 556, 889, 667, 191, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 278, 278, 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, 611, 778, 722, 278, 500, 667, 556, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, 333, 556, 556, 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, 556, 556, 556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334, 584, 333, 556, 556, 556, 556, 260, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 537, 278, 333, 333, 365, 556, 834, 834, 834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 500, 556, 556, 556, 556, 278, 278, 278, 278, 556, 556, 556, 556, 556, 556, 556, 549, 611, 556, 556, 556, 556, 500, 556, 500, 667, 556, 667, 556, 667, 556, 722, 500, 722, 500, 722, 500, 722, 500, 722, 615, 722, 556, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 556, 778, 556, 778, 556, 778, 556, 722, 556, 722, 556, 278, 278, 278, 278, 278, 278, 278, 222, 278, 278, 735, 444, 500, 222, 667, 500, 500, 556, 222, 556, 222, 556, 292, 556, 334, 556, 222, 722, 556, 722, 556, 722, 556, 604, 723, 556, 778, 556, 778, 556, 778, 556, 1000, 944, 722, 333, 722, 333, 722, 333, 667, 500, 667, 500, 667, 500, 667, 500, 611, 278, 611, 375, 611, 278, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 944, 722, 667, 500, 667, 611, 500, 611, 500, 611, 500, 222, 556, 667, 556, 1000, 889, 778, 611, 667, 500, 611, 278, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 667, 278, 784, 838, 384, 774, 855, 752, 222, 667, 667, 551, 668, 667, 611, 722, 778, 278, 667, 668, 833, 722, 650, 778, 722, 667, 618, 611, 667, 798, 667, 835, 748, 278, 667, 578, 446, 556, 222, 547, 578, 575, 500, 557, 446, 441, 556, 556, 222, 500, 500, 576, 500, 448, 556, 690, 569, 482, 617, 395, 547, 648, 525, 713, 781, 222, 547, 556, 547, 781, 667, 667, 865, 542, 719, 667, 278, 278, 500, 1057, 1010, 854, 583, 722, 635, 719, 667, 656, 667, 542, 677, 667, 923, 604, 719, 719, 583, 656, 833, 722, 778, 719, 667, 722, 611, 635, 760, 667, 740, 667, 917, 938, 792, 885, 656, 719, 1010, 722, 556, 573, 531, 365, 583, 556, 669, 458, 559, 559, 438, 583, 688, 552, 556, 542, 556, 500, 458, 500, 823, 500, 573, 521, 802, 823, 625, 719, 521, 510, 750, 542, 556, 556, 556, 365, 510, 500, 222, 278, 222, 906, 812, 556, 438, 559, 500, 552, 778, 556, 489, 411, 944, 722, 944, 722, 944, 722, 667, 500, 333, 333, 556, 1000, 1000, 552, 222, 222, 222, 222, 333, 333, 333, 556, 556, 350, 1000, 1000, 188, 354, 333, 333, 500, 333, 167, 365, 556, 556, 1094, 556, 885, 323, 1073, 1000, 768, 600, 834, 834, 834, 834, 1000, 500, 1000, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 719, 274, 549, 549, 583, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 500, 500, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 294, 294, 324, 324, 316, 328, 398, 285];
  44510. exports.LiberationSansRegularWidths = LiberationSansRegularWidths;
  44511. const LiberationSansRegularMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
  44512. exports.LiberationSansRegularMapping = LiberationSansRegularMapping;
  44513. /***/ }),
  44514. /* 53 */
  44515. /***/ ((__unused_webpack_module, exports) => {
  44516. Object.defineProperty(exports, "__esModule", ({
  44517. value: true
  44518. }));
  44519. exports.MyriadProRegularMetrics = exports.MyriadProRegularFactors = exports.MyriadProItalicMetrics = exports.MyriadProItalicFactors = exports.MyriadProBoldMetrics = exports.MyriadProBoldItalicMetrics = exports.MyriadProBoldItalicFactors = exports.MyriadProBoldFactors = void 0;
  44520. const MyriadProBoldFactors = [1.36898, 1, 1, 0.72706, 0.80479, 0.83734, 0.98894, 0.99793, 0.9897, 0.93884, 0.86209, 0.94292, 0.94292, 1.16661, 1.02058, 0.93582, 0.96694, 0.93582, 1.19137, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.78076, 0.78076, 1.02058, 1.02058, 1.02058, 0.72851, 0.78966, 0.90838, 0.83637, 0.82391, 0.96376, 0.80061, 0.86275, 0.8768, 0.95407, 1.0258, 0.73901, 0.85022, 0.83655, 1.0156, 0.95546, 0.92179, 0.87107, 0.92179, 0.82114, 0.8096, 0.89713, 0.94438, 0.95353, 0.94083, 0.91905, 0.90406, 0.9446, 0.94292, 1.18777, 0.94292, 1.02058, 0.89903, 0.90088, 0.94938, 0.97898, 0.81093, 0.97571, 0.94938, 1.024, 0.9577, 0.95933, 0.98621, 1.0474, 0.97455, 0.98981, 0.9672, 0.95933, 0.9446, 0.97898, 0.97407, 0.97646, 0.78036, 1.10208, 0.95442, 0.95298, 0.97579, 0.9332, 0.94039, 0.938, 0.80687, 1.01149, 0.80687, 1.02058, 0.80479, 0.99793, 0.99793, 0.99793, 0.99793, 1.01149, 1.00872, 0.90088, 0.91882, 1.0213, 0.8361, 1.02058, 0.62295, 0.54324, 0.89022, 1.08595, 1, 1, 0.90088, 1, 0.97455, 0.93582, 0.90088, 1, 1.05686, 0.8361, 0.99642, 0.99642, 0.99642, 0.72851, 0.90838, 0.90838, 0.90838, 0.90838, 0.90838, 0.90838, 0.868, 0.82391, 0.80061, 0.80061, 0.80061, 0.80061, 1.0258, 1.0258, 1.0258, 1.0258, 0.97484, 0.95546, 0.92179, 0.92179, 0.92179, 0.92179, 0.92179, 1.02058, 0.92179, 0.94438, 0.94438, 0.94438, 0.94438, 0.90406, 0.86958, 0.98225, 0.94938, 0.94938, 0.94938, 0.94938, 0.94938, 0.94938, 0.9031, 0.81093, 0.94938, 0.94938, 0.94938, 0.94938, 0.98621, 0.98621, 0.98621, 0.98621, 0.93969, 0.95933, 0.9446, 0.9446, 0.9446, 0.9446, 0.9446, 1.08595, 0.9446, 0.95442, 0.95442, 0.95442, 0.95442, 0.94039, 0.97898, 0.94039, 0.90838, 0.94938, 0.90838, 0.94938, 0.90838, 0.94938, 0.82391, 0.81093, 0.82391, 0.81093, 0.82391, 0.81093, 0.82391, 0.81093, 0.96376, 0.84313, 0.97484, 0.97571, 0.80061, 0.94938, 0.80061, 0.94938, 0.80061, 0.94938, 0.80061, 0.94938, 0.80061, 0.94938, 0.8768, 0.9577, 0.8768, 0.9577, 0.8768, 0.9577, 1, 1, 0.95407, 0.95933, 0.97069, 0.95933, 1.0258, 0.98621, 1.0258, 0.98621, 1.0258, 0.98621, 1.0258, 0.98621, 1.0258, 0.98621, 0.887, 1.01591, 0.73901, 1.0474, 1, 1, 0.97455, 0.83655, 0.98981, 1, 1, 0.83655, 0.73977, 0.83655, 0.73903, 0.84638, 1.033, 0.95546, 0.95933, 1, 1, 0.95546, 0.95933, 0.8271, 0.95417, 0.95933, 0.92179, 0.9446, 0.92179, 0.9446, 0.92179, 0.9446, 0.936, 0.91964, 0.82114, 0.97646, 1, 1, 0.82114, 0.97646, 0.8096, 0.78036, 0.8096, 0.78036, 1, 1, 0.8096, 0.78036, 1, 1, 0.89713, 0.77452, 0.89713, 1.10208, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94083, 0.97579, 0.90406, 0.94039, 0.90406, 0.9446, 0.938, 0.9446, 0.938, 0.9446, 0.938, 1, 0.99793, 0.90838, 0.94938, 0.868, 0.9031, 0.92179, 0.9446, 1, 1, 0.89713, 1.10208, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90989, 0.9358, 0.91945, 0.83181, 0.75261, 0.87992, 0.82976, 0.96034, 0.83689, 0.97268, 1.0078, 0.90838, 0.83637, 0.8019, 0.90157, 0.80061, 0.9446, 0.95407, 0.92436, 1.0258, 0.85022, 0.97153, 1.0156, 0.95546, 0.89192, 0.92179, 0.92361, 0.87107, 0.96318, 0.89713, 0.93704, 0.95638, 0.91905, 0.91709, 0.92796, 1.0258, 0.93704, 0.94836, 1.0373, 0.95933, 1.0078, 0.95871, 0.94836, 0.96174, 0.92601, 0.9498, 0.98607, 0.95776, 0.95933, 1.05453, 1.0078, 0.98275, 0.9314, 0.95617, 0.91701, 1.05993, 0.9446, 0.78367, 0.9553, 1, 0.86832, 1.0128, 0.95871, 0.99394, 0.87548, 0.96361, 0.86774, 1.0078, 0.95871, 0.9446, 0.95871, 0.86774, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.94083, 0.97579, 0.94083, 0.97579, 0.94083, 0.97579, 0.90406, 0.94039, 0.96694, 1, 0.89903, 1, 1, 1, 0.93582, 0.93582, 0.93582, 1, 0.908, 0.908, 0.918, 0.94219, 0.94219, 0.96544, 1, 1.285, 1, 1, 0.81079, 0.81079, 1, 1, 0.74854, 1, 1, 1, 1, 0.99793, 1, 1, 1, 0.65, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.17173, 1, 0.80535, 0.76169, 1.02058, 1.0732, 1.05486, 1, 1, 1.30692, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.16161, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  44521. exports.MyriadProBoldFactors = MyriadProBoldFactors;
  44522. const MyriadProBoldMetrics = {
  44523. lineHeight: 1.2,
  44524. lineGap: 0.2
  44525. };
  44526. exports.MyriadProBoldMetrics = MyriadProBoldMetrics;
  44527. const MyriadProBoldItalicFactors = [1.36898, 1, 1, 0.66227, 0.80779, 0.81625, 0.97276, 0.97276, 0.97733, 0.92222, 0.83266, 0.94292, 0.94292, 1.16148, 1.02058, 0.93582, 0.96694, 0.93582, 1.17337, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.78076, 0.78076, 1.02058, 1.02058, 1.02058, 0.71541, 0.76813, 0.85576, 0.80591, 0.80729, 0.94299, 0.77512, 0.83655, 0.86523, 0.92222, 0.98621, 0.71743, 0.81698, 0.79726, 0.98558, 0.92222, 0.90637, 0.83809, 0.90637, 0.80729, 0.76463, 0.86275, 0.90699, 0.91605, 0.9154, 0.85308, 0.85458, 0.90531, 0.94292, 1.21296, 0.94292, 1.02058, 0.89903, 1.18616, 0.99613, 0.91677, 0.78216, 0.91677, 0.90083, 0.98796, 0.9135, 0.92168, 0.95381, 0.98981, 0.95298, 0.95381, 0.93459, 0.92168, 0.91513, 0.92004, 0.91677, 0.95077, 0.748, 1.04502, 0.91677, 0.92061, 0.94236, 0.89544, 0.89364, 0.9, 0.80687, 0.8578, 0.80687, 1.02058, 0.80779, 0.97276, 0.97276, 0.97276, 0.97276, 0.8578, 0.99973, 1.18616, 0.91339, 1.08074, 0.82891, 1.02058, 0.55509, 0.71526, 0.89022, 1.08595, 1, 1, 1.18616, 1, 0.96736, 0.93582, 1.18616, 1, 1.04864, 0.82711, 0.99043, 0.99043, 0.99043, 0.71541, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.845, 0.80729, 0.77512, 0.77512, 0.77512, 0.77512, 0.98621, 0.98621, 0.98621, 0.98621, 0.95961, 0.92222, 0.90637, 0.90637, 0.90637, 0.90637, 0.90637, 1.02058, 0.90251, 0.90699, 0.90699, 0.90699, 0.90699, 0.85458, 0.83659, 0.94951, 0.99613, 0.99613, 0.99613, 0.99613, 0.99613, 0.99613, 0.85811, 0.78216, 0.90083, 0.90083, 0.90083, 0.90083, 0.95381, 0.95381, 0.95381, 0.95381, 0.9135, 0.92168, 0.91513, 0.91513, 0.91513, 0.91513, 0.91513, 1.08595, 0.91677, 0.91677, 0.91677, 0.91677, 0.91677, 0.89364, 0.92332, 0.89364, 0.85576, 0.99613, 0.85576, 0.99613, 0.85576, 0.99613, 0.80729, 0.78216, 0.80729, 0.78216, 0.80729, 0.78216, 0.80729, 0.78216, 0.94299, 0.76783, 0.95961, 0.91677, 0.77512, 0.90083, 0.77512, 0.90083, 0.77512, 0.90083, 0.77512, 0.90083, 0.77512, 0.90083, 0.86523, 0.9135, 0.86523, 0.9135, 0.86523, 0.9135, 1, 1, 0.92222, 0.92168, 0.92222, 0.92168, 0.98621, 0.95381, 0.98621, 0.95381, 0.98621, 0.95381, 0.98621, 0.95381, 0.98621, 0.95381, 0.86036, 0.97096, 0.71743, 0.98981, 1, 1, 0.95298, 0.79726, 0.95381, 1, 1, 0.79726, 0.6894, 0.79726, 0.74321, 0.81691, 1.0006, 0.92222, 0.92168, 1, 1, 0.92222, 0.92168, 0.79464, 0.92098, 0.92168, 0.90637, 0.91513, 0.90637, 0.91513, 0.90637, 0.91513, 0.909, 0.87514, 0.80729, 0.95077, 1, 1, 0.80729, 0.95077, 0.76463, 0.748, 0.76463, 0.748, 1, 1, 0.76463, 0.748, 1, 1, 0.86275, 0.72651, 0.86275, 1.04502, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.9154, 0.94236, 0.85458, 0.89364, 0.85458, 0.90531, 0.9, 0.90531, 0.9, 0.90531, 0.9, 1, 0.97276, 0.85576, 0.99613, 0.845, 0.85811, 0.90251, 0.91677, 1, 1, 0.86275, 1.04502, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.00899, 1.30628, 0.85576, 0.80178, 0.66862, 0.7927, 0.69323, 0.88127, 0.72459, 0.89711, 0.95381, 0.85576, 0.80591, 0.7805, 0.94729, 0.77512, 0.90531, 0.92222, 0.90637, 0.98621, 0.81698, 0.92655, 0.98558, 0.92222, 0.85359, 0.90637, 0.90976, 0.83809, 0.94523, 0.86275, 0.83509, 0.93157, 0.85308, 0.83392, 0.92346, 0.98621, 0.83509, 0.92886, 0.91324, 0.92168, 0.95381, 0.90646, 0.92886, 0.90557, 0.86847, 0.90276, 0.91324, 0.86842, 0.92168, 0.99531, 0.95381, 0.9224, 0.85408, 0.92699, 0.86847, 1.0051, 0.91513, 0.80487, 0.93481, 1, 0.88159, 1.05214, 0.90646, 0.97355, 0.81539, 0.89398, 0.85923, 0.95381, 0.90646, 0.91513, 0.90646, 0.85923, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9154, 0.94236, 0.9154, 0.94236, 0.9154, 0.94236, 0.85458, 0.89364, 0.96694, 1, 0.89903, 1, 1, 1, 0.91782, 0.91782, 0.91782, 1, 0.896, 0.896, 0.896, 0.9332, 0.9332, 0.95973, 1, 1.26, 1, 1, 0.80479, 0.80178, 1, 1, 0.85633, 1, 1, 1, 1, 0.97276, 1, 1, 1, 0.698, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.14542, 1, 0.79199, 0.78694, 1.02058, 1.03493, 1.05486, 1, 1, 1.23026, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.20006, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  44528. exports.MyriadProBoldItalicFactors = MyriadProBoldItalicFactors;
  44529. const MyriadProBoldItalicMetrics = {
  44530. lineHeight: 1.2,
  44531. lineGap: 0.2
  44532. };
  44533. exports.MyriadProBoldItalicMetrics = MyriadProBoldItalicMetrics;
  44534. const MyriadProItalicFactors = [1.36898, 1, 1, 0.65507, 0.84943, 0.85639, 0.88465, 0.88465, 0.86936, 0.88307, 0.86948, 0.85283, 0.85283, 1.06383, 1.02058, 0.75945, 0.9219, 0.75945, 1.17337, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.75945, 0.75945, 1.02058, 1.02058, 1.02058, 0.69046, 0.70926, 0.85158, 0.77812, 0.76852, 0.89591, 0.70466, 0.76125, 0.80094, 0.86822, 0.83864, 0.728, 0.77212, 0.79475, 0.93637, 0.87514, 0.8588, 0.76013, 0.8588, 0.72421, 0.69866, 0.77598, 0.85991, 0.80811, 0.87832, 0.78112, 0.77512, 0.8562, 1.0222, 1.18417, 1.0222, 1.27014, 0.89903, 1.15012, 0.93859, 0.94399, 0.846, 0.94399, 0.81453, 1.0186, 0.94219, 0.96017, 1.03075, 1.02175, 0.912, 1.03075, 0.96998, 0.96017, 0.93859, 0.94399, 0.94399, 0.95493, 0.746, 1.12658, 0.94578, 0.91, 0.979, 0.882, 0.882, 0.83, 0.85034, 0.83537, 0.85034, 1.02058, 0.70869, 0.88465, 0.88465, 0.88465, 0.88465, 0.83537, 0.90083, 1.15012, 0.9161, 0.94565, 0.73541, 1.02058, 0.53609, 0.69353, 0.79519, 1.08595, 1, 1, 1.15012, 1, 0.91974, 0.75945, 1.15012, 1, 0.9446, 0.73361, 0.9005, 0.9005, 0.9005, 0.62864, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.773, 0.76852, 0.70466, 0.70466, 0.70466, 0.70466, 0.83864, 0.83864, 0.83864, 0.83864, 0.90561, 0.87514, 0.8588, 0.8588, 0.8588, 0.8588, 0.8588, 1.02058, 0.85751, 0.85991, 0.85991, 0.85991, 0.85991, 0.77512, 0.76013, 0.88075, 0.93859, 0.93859, 0.93859, 0.93859, 0.93859, 0.93859, 0.8075, 0.846, 0.81453, 0.81453, 0.81453, 0.81453, 0.82424, 0.82424, 0.82424, 0.82424, 0.9278, 0.96017, 0.93859, 0.93859, 0.93859, 0.93859, 0.93859, 1.08595, 0.8562, 0.94578, 0.94578, 0.94578, 0.94578, 0.882, 0.94578, 0.882, 0.85158, 0.93859, 0.85158, 0.93859, 0.85158, 0.93859, 0.76852, 0.846, 0.76852, 0.846, 0.76852, 0.846, 0.76852, 0.846, 0.89591, 0.8544, 0.90561, 0.94399, 0.70466, 0.81453, 0.70466, 0.81453, 0.70466, 0.81453, 0.70466, 0.81453, 0.70466, 0.81453, 0.80094, 0.94219, 0.80094, 0.94219, 0.80094, 0.94219, 1, 1, 0.86822, 0.96017, 0.86822, 0.96017, 0.83864, 0.82424, 0.83864, 0.82424, 0.83864, 0.82424, 0.83864, 1.03075, 0.83864, 0.82424, 0.81402, 1.02738, 0.728, 1.02175, 1, 1, 0.912, 0.79475, 1.03075, 1, 1, 0.79475, 0.83911, 0.79475, 0.66266, 0.80553, 1.06676, 0.87514, 0.96017, 1, 1, 0.87514, 0.96017, 0.86865, 0.87396, 0.96017, 0.8588, 0.93859, 0.8588, 0.93859, 0.8588, 0.93859, 0.867, 0.84759, 0.72421, 0.95493, 1, 1, 0.72421, 0.95493, 0.69866, 0.746, 0.69866, 0.746, 1, 1, 0.69866, 0.746, 1, 1, 0.77598, 0.88417, 0.77598, 1.12658, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.87832, 0.979, 0.77512, 0.882, 0.77512, 0.8562, 0.83, 0.8562, 0.83, 0.8562, 0.83, 1, 0.88465, 0.85158, 0.93859, 0.773, 0.8075, 0.85751, 0.8562, 1, 1, 0.77598, 1.12658, 1.15012, 1.15012, 1.15012, 1.15012, 1.15012, 1.15313, 1.15012, 1.15012, 1.15012, 1.08106, 1.03901, 0.85158, 0.77025, 0.62264, 0.7646, 0.65351, 0.86026, 0.69461, 0.89947, 1.03075, 0.85158, 0.77812, 0.76449, 0.88836, 0.70466, 0.8562, 0.86822, 0.8588, 0.83864, 0.77212, 0.85308, 0.93637, 0.87514, 0.82352, 0.8588, 0.85701, 0.76013, 0.89058, 0.77598, 0.8156, 0.82565, 0.78112, 0.77899, 0.89386, 0.83864, 0.8156, 0.9486, 0.92388, 0.96186, 1.03075, 0.91123, 0.9486, 0.93298, 0.878, 0.93942, 0.92388, 0.84596, 0.96186, 0.95119, 1.03075, 0.922, 0.88787, 0.95829, 0.88, 0.93559, 0.93859, 0.78815, 0.93758, 1, 0.89217, 1.03737, 0.91123, 0.93969, 0.77487, 0.85769, 0.86799, 1.03075, 0.91123, 0.93859, 0.91123, 0.86799, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.87832, 0.979, 0.87832, 0.979, 0.87832, 0.979, 0.77512, 0.882, 0.9219, 1, 0.89903, 1, 1, 1, 0.87321, 0.87321, 0.87321, 1, 1.027, 1.027, 1.027, 0.86847, 0.86847, 0.79121, 1, 1.124, 1, 1, 0.73572, 0.73572, 1, 1, 0.85034, 1, 1, 1, 1, 0.88465, 1, 1, 1, 0.669, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.04828, 1, 0.74948, 0.75187, 1.02058, 0.98391, 1.02119, 1, 1, 1.06233, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05233, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  44535. exports.MyriadProItalicFactors = MyriadProItalicFactors;
  44536. const MyriadProItalicMetrics = {
  44537. lineHeight: 1.2,
  44538. lineGap: 0.2
  44539. };
  44540. exports.MyriadProItalicMetrics = MyriadProItalicMetrics;
  44541. const MyriadProRegularFactors = [1.36898, 1, 1, 0.76305, 0.82784, 0.94935, 0.89364, 0.92241, 0.89073, 0.90706, 0.98472, 0.85283, 0.85283, 1.0664, 1.02058, 0.74505, 0.9219, 0.74505, 1.23456, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.74505, 0.74505, 1.02058, 1.02058, 1.02058, 0.73002, 0.72601, 0.91755, 0.8126, 0.80314, 0.92222, 0.73764, 0.79726, 0.83051, 0.90284, 0.86023, 0.74, 0.8126, 0.84869, 0.96518, 0.91115, 0.8858, 0.79761, 0.8858, 0.74498, 0.73914, 0.81363, 0.89591, 0.83659, 0.89633, 0.85608, 0.8111, 0.90531, 1.0222, 1.22736, 1.0222, 1.27014, 0.89903, 0.90088, 0.86667, 1.0231, 0.896, 1.01411, 0.90083, 1.05099, 1.00512, 0.99793, 1.05326, 1.09377, 0.938, 1.06226, 1.00119, 0.99793, 0.98714, 1.0231, 1.01231, 0.98196, 0.792, 1.19137, 0.99074, 0.962, 1.01915, 0.926, 0.942, 0.856, 0.85034, 0.92006, 0.85034, 1.02058, 0.69067, 0.92241, 0.92241, 0.92241, 0.92241, 0.92006, 0.9332, 0.90088, 0.91882, 0.93484, 0.75339, 1.02058, 0.56866, 0.54324, 0.79519, 1.08595, 1, 1, 0.90088, 1, 0.95325, 0.74505, 0.90088, 1, 0.97198, 0.75339, 0.91009, 0.91009, 0.91009, 0.66466, 0.91755, 0.91755, 0.91755, 0.91755, 0.91755, 0.91755, 0.788, 0.80314, 0.73764, 0.73764, 0.73764, 0.73764, 0.86023, 0.86023, 0.86023, 0.86023, 0.92915, 0.91115, 0.8858, 0.8858, 0.8858, 0.8858, 0.8858, 1.02058, 0.8858, 0.89591, 0.89591, 0.89591, 0.89591, 0.8111, 0.79611, 0.89713, 0.86667, 0.86667, 0.86667, 0.86667, 0.86667, 0.86667, 0.86936, 0.896, 0.90083, 0.90083, 0.90083, 0.90083, 0.84224, 0.84224, 0.84224, 0.84224, 0.97276, 0.99793, 0.98714, 0.98714, 0.98714, 0.98714, 0.98714, 1.08595, 0.89876, 0.99074, 0.99074, 0.99074, 0.99074, 0.942, 1.0231, 0.942, 0.91755, 0.86667, 0.91755, 0.86667, 0.91755, 0.86667, 0.80314, 0.896, 0.80314, 0.896, 0.80314, 0.896, 0.80314, 0.896, 0.92222, 0.93372, 0.92915, 1.01411, 0.73764, 0.90083, 0.73764, 0.90083, 0.73764, 0.90083, 0.73764, 0.90083, 0.73764, 0.90083, 0.83051, 1.00512, 0.83051, 1.00512, 0.83051, 1.00512, 1, 1, 0.90284, 0.99793, 0.90976, 0.99793, 0.86023, 0.84224, 0.86023, 0.84224, 0.86023, 0.84224, 0.86023, 1.05326, 0.86023, 0.84224, 0.82873, 1.07469, 0.74, 1.09377, 1, 1, 0.938, 0.84869, 1.06226, 1, 1, 0.84869, 0.83704, 0.84869, 0.81441, 0.85588, 1.08927, 0.91115, 0.99793, 1, 1, 0.91115, 0.99793, 0.91887, 0.90991, 0.99793, 0.8858, 0.98714, 0.8858, 0.98714, 0.8858, 0.98714, 0.894, 0.91434, 0.74498, 0.98196, 1, 1, 0.74498, 0.98196, 0.73914, 0.792, 0.73914, 0.792, 1, 1, 0.73914, 0.792, 1, 1, 0.81363, 0.904, 0.81363, 1.19137, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89633, 1.01915, 0.8111, 0.942, 0.8111, 0.90531, 0.856, 0.90531, 0.856, 0.90531, 0.856, 1, 0.92241, 0.91755, 0.86667, 0.788, 0.86936, 0.8858, 0.89876, 1, 1, 0.81363, 1.19137, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90388, 1.03901, 0.92138, 0.78105, 0.7154, 0.86169, 0.80513, 0.94007, 0.82528, 0.98612, 1.06226, 0.91755, 0.8126, 0.81884, 0.92819, 0.73764, 0.90531, 0.90284, 0.8858, 0.86023, 0.8126, 0.91172, 0.96518, 0.91115, 0.83089, 0.8858, 0.87791, 0.79761, 0.89297, 0.81363, 0.88157, 0.89992, 0.85608, 0.81992, 0.94307, 0.86023, 0.88157, 0.95308, 0.98699, 0.99793, 1.06226, 0.95817, 0.95308, 0.97358, 0.928, 0.98088, 0.98699, 0.92761, 0.99793, 0.96017, 1.06226, 0.986, 0.944, 0.95978, 0.938, 0.96705, 0.98714, 0.80442, 0.98972, 1, 0.89762, 1.04552, 0.95817, 0.99007, 0.87064, 0.91879, 0.88888, 1.06226, 0.95817, 0.98714, 0.95817, 0.88888, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.89633, 1.01915, 0.89633, 1.01915, 0.89633, 1.01915, 0.8111, 0.942, 0.9219, 1, 0.89903, 1, 1, 1, 0.93173, 0.93173, 0.93173, 1, 1.06304, 1.06304, 1.06904, 0.89903, 0.89903, 0.80549, 1, 1.156, 1, 1, 0.76575, 0.76575, 1, 1, 0.72458, 1, 1, 1, 1, 0.92241, 1, 1, 1, 0.619, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.07257, 1, 0.74705, 0.71119, 1.02058, 1.024, 1.02119, 1, 1, 1.1536, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05638, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  44542. exports.MyriadProRegularFactors = MyriadProRegularFactors;
  44543. const MyriadProRegularMetrics = {
  44544. lineHeight: 1.2,
  44545. lineGap: 0.2
  44546. };
  44547. exports.MyriadProRegularMetrics = MyriadProRegularMetrics;
  44548. /***/ }),
  44549. /* 54 */
  44550. /***/ ((__unused_webpack_module, exports) => {
  44551. Object.defineProperty(exports, "__esModule", ({
  44552. value: true
  44553. }));
  44554. exports.SegoeuiRegularMetrics = exports.SegoeuiRegularFactors = exports.SegoeuiItalicMetrics = exports.SegoeuiItalicFactors = exports.SegoeuiBoldMetrics = exports.SegoeuiBoldItalicMetrics = exports.SegoeuiBoldItalicFactors = exports.SegoeuiBoldFactors = void 0;
  44555. const SegoeuiBoldFactors = [1.76738, 1, 1, 0.99297, 0.9824, 1.04016, 1.06497, 1.03424, 0.97529, 1.17647, 1.23203, 1.1085, 1.1085, 1.16939, 1.2107, 0.9754, 1.21408, 0.9754, 1.59578, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 0.81378, 0.81378, 1.2107, 1.2107, 1.2107, 0.71703, 0.97847, 0.97363, 0.88776, 0.8641, 1.02096, 0.79795, 0.85132, 0.914, 1.06085, 1.1406, 0.8007, 0.89858, 0.83693, 1.14889, 1.09398, 0.97489, 0.92094, 0.97489, 0.90399, 0.84041, 0.95923, 1.00135, 1, 1.06467, 0.98243, 0.90996, 0.99361, 1.1085, 1.56942, 1.1085, 1.2107, 0.74627, 0.94282, 0.96752, 1.01519, 0.86304, 1.01359, 0.97278, 1.15103, 1.01359, 0.98561, 1.02285, 1.02285, 1.00527, 1.02285, 1.0302, 0.99041, 1.0008, 1.01519, 1.01359, 1.02258, 0.79104, 1.16862, 0.99041, 0.97454, 1.02511, 0.99298, 0.96752, 0.95801, 0.94856, 1.16579, 0.94856, 1.2107, 0.9824, 1.03424, 1.03424, 1, 1.03424, 1.16579, 0.8727, 1.3871, 1.18622, 1.10818, 1.04478, 1.2107, 1.18622, 0.75155, 0.94994, 1.28826, 1.21408, 1.21408, 0.91056, 1, 0.91572, 0.9754, 0.64663, 1.18328, 1.24866, 1.04478, 1.14169, 1.15749, 1.17389, 0.71703, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.93506, 0.8641, 0.79795, 0.79795, 0.79795, 0.79795, 1.1406, 1.1406, 1.1406, 1.1406, 1.02096, 1.09398, 0.97426, 0.97426, 0.97426, 0.97426, 0.97426, 1.2107, 0.97489, 1.00135, 1.00135, 1.00135, 1.00135, 0.90996, 0.92094, 1.02798, 0.96752, 0.96752, 0.96752, 0.96752, 0.96752, 0.96752, 0.93136, 0.86304, 0.97278, 0.97278, 0.97278, 0.97278, 1.02285, 1.02285, 1.02285, 1.02285, 0.97122, 0.99041, 1, 1, 1, 1, 1, 1.28826, 1.0008, 0.99041, 0.99041, 0.99041, 0.99041, 0.96752, 1.01519, 0.96752, 0.97363, 0.96752, 0.97363, 0.96752, 0.97363, 0.96752, 0.8641, 0.86304, 0.8641, 0.86304, 0.8641, 0.86304, 0.8641, 0.86304, 1.02096, 1.03057, 1.02096, 1.03517, 0.79795, 0.97278, 0.79795, 0.97278, 0.79795, 0.97278, 0.79795, 0.97278, 0.79795, 0.97278, 0.914, 1.01359, 0.914, 1.01359, 0.914, 1.01359, 1, 1, 1.06085, 0.98561, 1.06085, 1.00879, 1.1406, 1.02285, 1.1406, 1.02285, 1.1406, 1.02285, 1.1406, 1.02285, 1.1406, 1.02285, 0.97138, 1.08692, 0.8007, 1.02285, 1, 1, 1.00527, 0.83693, 1.02285, 1, 1, 0.83693, 0.9455, 0.83693, 0.90418, 0.83693, 1.13005, 1.09398, 0.99041, 1, 1, 1.09398, 0.99041, 0.96692, 1.09251, 0.99041, 0.97489, 1.0008, 0.97489, 1.0008, 0.97489, 1.0008, 0.93994, 0.97931, 0.90399, 1.02258, 1, 1, 0.90399, 1.02258, 0.84041, 0.79104, 0.84041, 0.79104, 0.84041, 0.79104, 0.84041, 0.79104, 1, 1, 0.95923, 1.07034, 0.95923, 1.16862, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.06467, 1.02511, 0.90996, 0.96752, 0.90996, 0.99361, 0.95801, 0.99361, 0.95801, 0.99361, 0.95801, 1.07733, 1.03424, 0.97363, 0.96752, 0.93506, 0.93136, 0.97489, 1.0008, 1, 1, 0.95923, 1.16862, 1.15103, 1.15103, 1.01173, 1.03959, 0.75953, 0.81378, 0.79912, 1.15103, 1.21994, 0.95161, 0.87815, 1.01149, 0.81525, 0.7676, 0.98167, 1.01134, 1.02546, 0.84097, 1.03089, 1.18102, 0.97363, 0.88776, 0.85134, 0.97826, 0.79795, 0.99361, 1.06085, 0.97489, 1.1406, 0.89858, 1.0388, 1.14889, 1.09398, 0.86039, 0.97489, 1.0595, 0.92094, 0.94793, 0.95923, 0.90996, 0.99346, 0.98243, 1.02112, 0.95493, 1.1406, 0.90996, 1.03574, 1.02597, 1.0008, 1.18102, 1.06628, 1.03574, 1.0192, 1.01932, 1.00886, 0.97531, 1.0106, 1.0008, 1.13189, 1.18102, 1.02277, 0.98683, 1.0016, 0.99561, 1.07237, 1.0008, 0.90434, 0.99921, 0.93803, 0.8965, 1.23085, 1.06628, 1.04983, 0.96268, 1.0499, 0.98439, 1.18102, 1.06628, 1.0008, 1.06628, 0.98439, 0.79795, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.09466, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.97278, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.02065, 1, 1, 1, 1, 1, 1, 1.06467, 1.02511, 1.06467, 1.02511, 1.06467, 1.02511, 0.90996, 0.96752, 1, 1.21408, 0.89903, 1, 1, 0.75155, 1.04394, 1.04394, 1.04394, 1.04394, 0.98633, 0.98633, 0.98633, 0.73047, 0.73047, 1.20642, 0.91211, 1.25635, 1.222, 1.02956, 1.03372, 1.03372, 0.96039, 1.24633, 1, 1.12454, 0.93503, 1.03424, 1.19687, 1.03424, 1, 1, 1, 0.771, 1, 1, 1.15749, 1.15749, 1.15749, 1.10948, 0.86279, 0.94434, 0.86279, 0.94434, 0.86182, 1, 1, 1.16897, 1, 0.96085, 0.90137, 1.2107, 1.18416, 1.13973, 0.69825, 0.9716, 2.10339, 1.29004, 1.29004, 1.21172, 1.29004, 1.29004, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.18874, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.09193, 1.09193, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  44556. exports.SegoeuiBoldFactors = SegoeuiBoldFactors;
  44557. const SegoeuiBoldMetrics = {
  44558. lineHeight: 1.33008,
  44559. lineGap: 0
  44560. };
  44561. exports.SegoeuiBoldMetrics = SegoeuiBoldMetrics;
  44562. const SegoeuiBoldItalicFactors = [1.76738, 1, 1, 0.98946, 1.03959, 1.04016, 1.02809, 1.036, 0.97639, 1.10953, 1.23203, 1.11144, 1.11144, 1.16939, 1.21237, 0.9754, 1.21261, 0.9754, 1.59754, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 0.81378, 0.81378, 1.21237, 1.21237, 1.21237, 0.73541, 0.97847, 0.97363, 0.89723, 0.87897, 1.0426, 0.79429, 0.85292, 0.91149, 1.05815, 1.1406, 0.79631, 0.90128, 0.83853, 1.04396, 1.10615, 0.97552, 0.94436, 0.97552, 0.88641, 0.80527, 0.96083, 1.00135, 1, 1.06777, 0.9817, 0.91142, 0.99361, 1.11144, 1.57293, 1.11144, 1.21237, 0.74627, 1.31818, 1.06585, 0.97042, 0.83055, 0.97042, 0.93503, 1.1261, 0.97042, 0.97922, 1.14236, 0.94552, 1.01054, 1.14236, 1.02471, 0.97922, 0.94165, 0.97042, 0.97042, 1.0276, 0.78929, 1.1261, 0.97922, 0.95874, 1.02197, 0.98507, 0.96752, 0.97168, 0.95107, 1.16579, 0.95107, 1.21237, 1.03959, 1.036, 1.036, 1, 1.036, 1.16579, 0.87357, 1.31818, 1.18754, 1.26781, 1.05356, 1.21237, 1.18622, 0.79487, 0.94994, 1.29004, 1.24047, 1.24047, 1.31818, 1, 0.91484, 0.9754, 1.31818, 1.1349, 1.24866, 1.05356, 1.13934, 1.15574, 1.17389, 0.73541, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.94385, 0.87897, 0.79429, 0.79429, 0.79429, 0.79429, 1.1406, 1.1406, 1.1406, 1.1406, 1.0426, 1.10615, 0.97552, 0.97552, 0.97552, 0.97552, 0.97552, 1.21237, 0.97552, 1.00135, 1.00135, 1.00135, 1.00135, 0.91142, 0.94436, 0.98721, 1.06585, 1.06585, 1.06585, 1.06585, 1.06585, 1.06585, 0.96705, 0.83055, 0.93503, 0.93503, 0.93503, 0.93503, 1.14236, 1.14236, 1.14236, 1.14236, 0.93125, 0.97922, 0.94165, 0.94165, 0.94165, 0.94165, 0.94165, 1.29004, 0.94165, 0.97922, 0.97922, 0.97922, 0.97922, 0.96752, 0.97042, 0.96752, 0.97363, 1.06585, 0.97363, 1.06585, 0.97363, 1.06585, 0.87897, 0.83055, 0.87897, 0.83055, 0.87897, 0.83055, 0.87897, 0.83055, 1.0426, 1.0033, 1.0426, 0.97042, 0.79429, 0.93503, 0.79429, 0.93503, 0.79429, 0.93503, 0.79429, 0.93503, 0.79429, 0.93503, 0.91149, 0.97042, 0.91149, 0.97042, 0.91149, 0.97042, 1, 1, 1.05815, 0.97922, 1.05815, 0.97922, 1.1406, 1.14236, 1.1406, 1.14236, 1.1406, 1.14236, 1.1406, 1.14236, 1.1406, 1.14236, 0.97441, 1.04302, 0.79631, 1.01582, 1, 1, 1.01054, 0.83853, 1.14236, 1, 1, 0.83853, 1.09125, 0.83853, 0.90418, 0.83853, 1.19508, 1.10615, 0.97922, 1, 1, 1.10615, 0.97922, 1.01034, 1.10466, 0.97922, 0.97552, 0.94165, 0.97552, 0.94165, 0.97552, 0.94165, 0.91602, 0.91981, 0.88641, 1.0276, 1, 1, 0.88641, 1.0276, 0.80527, 0.78929, 0.80527, 0.78929, 0.80527, 0.78929, 0.80527, 0.78929, 1, 1, 0.96083, 1.05403, 0.95923, 1.16862, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.06777, 1.02197, 0.91142, 0.96752, 0.91142, 0.99361, 0.97168, 0.99361, 0.97168, 0.99361, 0.97168, 1.23199, 1.036, 0.97363, 1.06585, 0.94385, 0.96705, 0.97552, 0.94165, 1, 1, 0.96083, 1.1261, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 0.95161, 1.27126, 1.00811, 0.83284, 0.77702, 0.99137, 0.95253, 1.0347, 0.86142, 1.07205, 1.14236, 0.97363, 0.89723, 0.86869, 1.09818, 0.79429, 0.99361, 1.05815, 0.97552, 1.1406, 0.90128, 1.06662, 1.04396, 1.10615, 0.84918, 0.97552, 1.04694, 0.94436, 0.98015, 0.96083, 0.91142, 1.00356, 0.9817, 1.01945, 0.98999, 1.1406, 0.91142, 1.04961, 0.9898, 1.00639, 1.14236, 1.07514, 1.04961, 0.99607, 1.02897, 1.008, 0.9898, 0.95134, 1.00639, 1.11121, 1.14236, 1.00518, 0.97981, 1.02186, 1, 1.08578, 0.94165, 0.99314, 0.98387, 0.93028, 0.93377, 1.35125, 1.07514, 1.10687, 0.93491, 1.04232, 1.00351, 1.14236, 1.07514, 0.94165, 1.07514, 1.00351, 0.79429, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.09097, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.93503, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.96609, 1, 1, 1, 1, 1, 1, 1.06777, 1.02197, 1.06777, 1.02197, 1.06777, 1.02197, 0.91142, 0.96752, 1, 1.21261, 0.89903, 1, 1, 0.75155, 1.04745, 1.04745, 1.04745, 1.04394, 0.98633, 0.98633, 0.98633, 0.72959, 0.72959, 1.20502, 0.91406, 1.26514, 1.222, 1.02956, 1.03372, 1.03372, 0.96039, 1.24633, 1, 1.09125, 0.93327, 1.03336, 1.16541, 1.036, 1, 1, 1, 0.771, 1, 1, 1.15574, 1.15574, 1.15574, 1.15574, 0.86364, 0.94434, 0.86279, 0.94434, 0.86224, 1, 1, 1.16798, 1, 0.96085, 0.90068, 1.21237, 1.18416, 1.13904, 0.69825, 0.9716, 2.10339, 1.29004, 1.29004, 1.21339, 1.29004, 1.29004, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.18775, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.13269, 1.13269, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  44563. exports.SegoeuiBoldItalicFactors = SegoeuiBoldItalicFactors;
  44564. const SegoeuiBoldItalicMetrics = {
  44565. lineHeight: 1.33008,
  44566. lineGap: 0
  44567. };
  44568. exports.SegoeuiBoldItalicMetrics = SegoeuiBoldItalicMetrics;
  44569. const SegoeuiItalicFactors = [1.76738, 1, 1, 0.98946, 1.14763, 1.05365, 1.06234, 0.96927, 0.92586, 1.15373, 1.18414, 0.91349, 0.91349, 1.07403, 1.17308, 0.78383, 1.20088, 0.78383, 1.42531, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.78383, 0.78383, 1.17308, 1.17308, 1.17308, 0.77349, 0.94565, 0.94729, 0.85944, 0.88506, 0.9858, 0.74817, 0.80016, 0.88449, 0.98039, 0.95782, 0.69238, 0.89898, 0.83231, 0.98183, 1.03989, 0.96924, 0.86237, 0.96924, 0.80595, 0.74524, 0.86091, 0.95402, 0.94143, 0.98448, 0.8858, 0.83089, 0.93285, 1.0949, 1.39016, 1.0949, 1.45994, 0.74627, 1.04839, 0.97454, 0.97454, 0.87207, 0.97454, 0.87533, 1.06151, 0.97454, 1.00176, 1.16484, 1.08132, 0.98047, 1.16484, 1.02989, 1.01054, 0.96225, 0.97454, 0.97454, 1.06598, 0.79004, 1.16344, 1.00351, 0.94629, 0.9973, 0.91016, 0.96777, 0.9043, 0.91082, 0.92481, 0.91082, 1.17308, 0.95748, 0.96927, 0.96927, 1, 0.96927, 0.92481, 0.80597, 1.04839, 1.23393, 1.1781, 0.9245, 1.17308, 1.20808, 0.63218, 0.94261, 1.24822, 1.09971, 1.09971, 1.04839, 1, 0.85273, 0.78032, 1.04839, 1.09971, 1.22326, 0.9245, 1.09836, 1.13525, 1.15222, 0.70424, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.85498, 0.88506, 0.74817, 0.74817, 0.74817, 0.74817, 0.95782, 0.95782, 0.95782, 0.95782, 0.9858, 1.03989, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 1.17308, 0.96924, 0.95402, 0.95402, 0.95402, 0.95402, 0.83089, 0.86237, 0.88409, 0.97454, 0.97454, 0.97454, 0.97454, 0.97454, 0.97454, 0.92916, 0.87207, 0.87533, 0.87533, 0.87533, 0.87533, 0.93146, 0.93146, 0.93146, 0.93146, 0.93854, 1.01054, 0.96225, 0.96225, 0.96225, 0.96225, 0.96225, 1.24822, 0.8761, 1.00351, 1.00351, 1.00351, 1.00351, 0.96777, 0.97454, 0.96777, 0.94729, 0.97454, 0.94729, 0.97454, 0.94729, 0.97454, 0.88506, 0.87207, 0.88506, 0.87207, 0.88506, 0.87207, 0.88506, 0.87207, 0.9858, 0.95391, 0.9858, 0.97454, 0.74817, 0.87533, 0.74817, 0.87533, 0.74817, 0.87533, 0.74817, 0.87533, 0.74817, 0.87533, 0.88449, 0.97454, 0.88449, 0.97454, 0.88449, 0.97454, 1, 1, 0.98039, 1.00176, 0.98039, 1.00176, 0.95782, 0.93146, 0.95782, 0.93146, 0.95782, 0.93146, 0.95782, 1.16484, 0.95782, 0.93146, 0.84421, 1.12761, 0.69238, 1.08132, 1, 1, 0.98047, 0.83231, 1.16484, 1, 1, 0.84723, 1.04861, 0.84723, 0.78755, 0.83231, 1.23736, 1.03989, 1.01054, 1, 1, 1.03989, 1.01054, 0.9857, 1.03849, 1.01054, 0.96924, 0.96225, 0.96924, 0.96225, 0.96924, 0.96225, 0.92383, 0.90171, 0.80595, 1.06598, 1, 1, 0.80595, 1.06598, 0.74524, 0.79004, 0.74524, 0.79004, 0.74524, 0.79004, 0.74524, 0.79004, 1, 1, 0.86091, 1.02759, 0.85771, 1.16344, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.98448, 0.9973, 0.83089, 0.96777, 0.83089, 0.93285, 0.9043, 0.93285, 0.9043, 0.93285, 0.9043, 1.31868, 0.96927, 0.94729, 0.97454, 0.85498, 0.92916, 0.96924, 0.8761, 1, 1, 0.86091, 1.16344, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 0.81965, 0.81965, 0.94729, 0.78032, 0.71022, 0.90883, 0.84171, 0.99877, 0.77596, 1.05734, 1.2, 0.94729, 0.85944, 0.82791, 0.9607, 0.74817, 0.93285, 0.98039, 0.96924, 0.95782, 0.89898, 0.98316, 0.98183, 1.03989, 0.78614, 0.96924, 0.97642, 0.86237, 0.86075, 0.86091, 0.83089, 0.90082, 0.8858, 0.97296, 1.01284, 0.95782, 0.83089, 1.0976, 1.04, 1.03342, 1.2, 1.0675, 1.0976, 0.98205, 1.03809, 1.05097, 1.04, 0.95364, 1.03342, 1.05401, 1.2, 1.02148, 1.0119, 1.04724, 1.0127, 1.02732, 0.96225, 0.8965, 0.97783, 0.93574, 0.94818, 1.30679, 1.0675, 1.11826, 0.99821, 1.0557, 1.0326, 1.2, 1.0675, 0.96225, 1.0675, 1.0326, 0.74817, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.03754, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.87533, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.98705, 1, 1, 1, 1, 1, 1, 0.98448, 0.9973, 0.98448, 0.9973, 0.98448, 0.9973, 0.83089, 0.96777, 1, 1.20088, 0.89903, 1, 1, 0.75155, 0.94945, 0.94945, 0.94945, 0.94945, 1.12317, 1.12317, 1.12317, 0.67603, 0.67603, 1.15621, 0.73584, 1.21191, 1.22135, 1.06483, 0.94868, 0.94868, 0.95996, 1.24633, 1, 1.07497, 0.87709, 0.96927, 1.01473, 0.96927, 1, 1, 1, 0.77295, 1, 1, 1.09836, 1.09836, 1.09836, 1.01522, 0.86321, 0.94434, 0.8649, 0.94434, 0.86182, 1, 1, 1.083, 1, 0.91578, 0.86438, 1.17308, 1.18416, 1.14589, 0.69825, 0.97622, 1.96791, 1.24822, 1.24822, 1.17308, 1.24822, 1.24822, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.17984, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.10742, 1.10742, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  44570. exports.SegoeuiItalicFactors = SegoeuiItalicFactors;
  44571. const SegoeuiItalicMetrics = {
  44572. lineHeight: 1.33008,
  44573. lineGap: 0
  44574. };
  44575. exports.SegoeuiItalicMetrics = SegoeuiItalicMetrics;
  44576. const SegoeuiRegularFactors = [1.76738, 1, 1, 0.98594, 1.02285, 1.10454, 1.06234, 0.96927, 0.92037, 1.19985, 1.2046, 0.90616, 0.90616, 1.07152, 1.1714, 0.78032, 1.20088, 0.78032, 1.40246, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.78032, 0.78032, 1.1714, 1.1714, 1.1714, 0.80597, 0.94084, 0.96706, 0.85944, 0.85734, 0.97093, 0.75842, 0.79936, 0.88198, 0.9831, 0.95782, 0.71387, 0.86969, 0.84636, 1.07796, 1.03584, 0.96924, 0.83968, 0.96924, 0.82826, 0.79649, 0.85771, 0.95132, 0.93119, 0.98965, 0.88433, 0.8287, 0.93365, 1.08612, 1.3638, 1.08612, 1.45786, 0.74627, 0.80499, 0.91484, 1.05707, 0.92383, 1.05882, 0.9403, 1.12654, 1.05882, 1.01756, 1.09011, 1.09011, 0.99414, 1.09011, 1.034, 1.01756, 1.05356, 1.05707, 1.05882, 1.04399, 0.84863, 1.21968, 1.01756, 0.95801, 1.00068, 0.91797, 0.96777, 0.9043, 0.90351, 0.92105, 0.90351, 1.1714, 0.85337, 0.96927, 0.96927, 0.99912, 0.96927, 0.92105, 0.80597, 1.2434, 1.20808, 1.05937, 0.90957, 1.1714, 1.20808, 0.75155, 0.94261, 1.24644, 1.09971, 1.09971, 0.84751, 1, 0.85273, 0.78032, 0.61584, 1.05425, 1.17914, 0.90957, 1.08665, 1.11593, 1.14169, 0.73381, 0.96706, 0.96706, 0.96706, 0.96706, 0.96706, 0.96706, 0.86035, 0.85734, 0.75842, 0.75842, 0.75842, 0.75842, 0.95782, 0.95782, 0.95782, 0.95782, 0.97093, 1.03584, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 1.1714, 0.96924, 0.95132, 0.95132, 0.95132, 0.95132, 0.8287, 0.83968, 0.89049, 0.91484, 0.91484, 0.91484, 0.91484, 0.91484, 0.91484, 0.93575, 0.92383, 0.9403, 0.9403, 0.9403, 0.9403, 0.8717, 0.8717, 0.8717, 0.8717, 1.00527, 1.01756, 1.05356, 1.05356, 1.05356, 1.05356, 1.05356, 1.24644, 0.95923, 1.01756, 1.01756, 1.01756, 1.01756, 0.96777, 1.05707, 0.96777, 0.96706, 0.91484, 0.96706, 0.91484, 0.96706, 0.91484, 0.85734, 0.92383, 0.85734, 0.92383, 0.85734, 0.92383, 0.85734, 0.92383, 0.97093, 1.0969, 0.97093, 1.05882, 0.75842, 0.9403, 0.75842, 0.9403, 0.75842, 0.9403, 0.75842, 0.9403, 0.75842, 0.9403, 0.88198, 1.05882, 0.88198, 1.05882, 0.88198, 1.05882, 1, 1, 0.9831, 1.01756, 0.9831, 1.01756, 0.95782, 0.8717, 0.95782, 0.8717, 0.95782, 0.8717, 0.95782, 1.09011, 0.95782, 0.8717, 0.84784, 1.11551, 0.71387, 1.09011, 1, 1, 0.99414, 0.84636, 1.09011, 1, 1, 0.84636, 1.0536, 0.84636, 0.94298, 0.84636, 1.23297, 1.03584, 1.01756, 1, 1, 1.03584, 1.01756, 1.00323, 1.03444, 1.01756, 0.96924, 1.05356, 0.96924, 1.05356, 0.96924, 1.05356, 0.93066, 0.98293, 0.82826, 1.04399, 1, 1, 0.82826, 1.04399, 0.79649, 0.84863, 0.79649, 0.84863, 0.79649, 0.84863, 0.79649, 0.84863, 1, 1, 0.85771, 1.17318, 0.85771, 1.21968, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.98965, 1.00068, 0.8287, 0.96777, 0.8287, 0.93365, 0.9043, 0.93365, 0.9043, 0.93365, 0.9043, 1.08571, 0.96927, 0.96706, 0.91484, 0.86035, 0.93575, 0.96924, 0.95923, 1, 1, 0.85771, 1.21968, 1.11437, 1.11437, 0.93109, 0.91202, 0.60411, 0.84164, 0.55572, 1.01173, 0.97361, 0.81818, 0.81818, 0.96635, 0.78032, 0.72727, 0.92366, 0.98601, 1.03405, 0.77968, 1.09799, 1.2, 0.96706, 0.85944, 0.85638, 0.96491, 0.75842, 0.93365, 0.9831, 0.96924, 0.95782, 0.86969, 0.94152, 1.07796, 1.03584, 0.78437, 0.96924, 0.98715, 0.83968, 0.83491, 0.85771, 0.8287, 0.94492, 0.88433, 0.9287, 1.0098, 0.95782, 0.8287, 1.0625, 0.98248, 1.03424, 1.2, 1.01071, 1.0625, 0.95246, 1.03809, 1.04912, 0.98248, 1.00221, 1.03424, 1.05443, 1.2, 1.04785, 0.99609, 1.00169, 1.05176, 0.99346, 1.05356, 0.9087, 1.03004, 0.95542, 0.93117, 1.23362, 1.01071, 1.07831, 1.02512, 1.05205, 1.03502, 1.2, 1.01071, 1.05356, 1.01071, 1.03502, 0.75842, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.03719, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9403, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.04021, 1, 1, 1, 1, 1, 1, 0.98965, 1.00068, 0.98965, 1.00068, 0.98965, 1.00068, 0.8287, 0.96777, 1, 1.20088, 0.89903, 1, 1, 0.75155, 1.03077, 1.03077, 1.03077, 1.03077, 1.13196, 1.13196, 1.13196, 0.67428, 0.67428, 1.16039, 0.73291, 1.20996, 1.22135, 1.06483, 0.94868, 0.94868, 0.95996, 1.24633, 1, 1.07497, 0.87796, 0.96927, 1.01518, 0.96927, 1, 1, 1, 0.77295, 1, 1, 1.10539, 1.10539, 1.11358, 1.06967, 0.86279, 0.94434, 0.86279, 0.94434, 0.86182, 1, 1, 1.083, 1, 0.91578, 0.86507, 1.1714, 1.18416, 1.14589, 0.69825, 0.97622, 1.9697, 1.24822, 1.24822, 1.17238, 1.24822, 1.24822, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.18083, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.10938, 1.10938, 1, 1, 1, 1.05425, 1.09971, 1.09971, 1.09971, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  44577. exports.SegoeuiRegularFactors = SegoeuiRegularFactors;
  44578. const SegoeuiRegularMetrics = {
  44579. lineHeight: 1.33008,
  44580. lineGap: 0
  44581. };
  44582. exports.SegoeuiRegularMetrics = SegoeuiRegularMetrics;
  44583. /***/ }),
  44584. /* 55 */
  44585. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44586. Object.defineProperty(exports, "__esModule", ({
  44587. value: true
  44588. }));
  44589. exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0;
  44590. exports.isPDFFunction = isPDFFunction;
  44591. var _primitives = __w_pdfjs_require__(3);
  44592. var _util = __w_pdfjs_require__(2);
  44593. var _ps_parser = __w_pdfjs_require__(56);
  44594. var _base_stream = __w_pdfjs_require__(5);
  44595. var _image_utils = __w_pdfjs_require__(57);
  44596. class PDFFunctionFactory {
  44597. constructor({
  44598. xref,
  44599. isEvalSupported = true
  44600. }) {
  44601. this.xref = xref;
  44602. this.isEvalSupported = isEvalSupported !== false;
  44603. }
  44604. create(fn) {
  44605. const cachedFunction = this.getCached(fn);
  44606. if (cachedFunction) {
  44607. return cachedFunction;
  44608. }
  44609. const parsedFunction = PDFFunction.parse({
  44610. xref: this.xref,
  44611. isEvalSupported: this.isEvalSupported,
  44612. fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn
  44613. });
  44614. this._cache(fn, parsedFunction);
  44615. return parsedFunction;
  44616. }
  44617. createFromArray(fnObj) {
  44618. const cachedFunction = this.getCached(fnObj);
  44619. if (cachedFunction) {
  44620. return cachedFunction;
  44621. }
  44622. const parsedFunction = PDFFunction.parseArray({
  44623. xref: this.xref,
  44624. isEvalSupported: this.isEvalSupported,
  44625. fnObj: fnObj instanceof _primitives.Ref ? this.xref.fetch(fnObj) : fnObj
  44626. });
  44627. this._cache(fnObj, parsedFunction);
  44628. return parsedFunction;
  44629. }
  44630. getCached(cacheKey) {
  44631. let fnRef;
  44632. if (cacheKey instanceof _primitives.Ref) {
  44633. fnRef = cacheKey;
  44634. } else if (cacheKey instanceof _primitives.Dict) {
  44635. fnRef = cacheKey.objId;
  44636. } else if (cacheKey instanceof _base_stream.BaseStream) {
  44637. fnRef = cacheKey.dict && cacheKey.dict.objId;
  44638. }
  44639. if (fnRef) {
  44640. const localFunction = this._localFunctionCache.getByRef(fnRef);
  44641. if (localFunction) {
  44642. return localFunction;
  44643. }
  44644. }
  44645. return null;
  44646. }
  44647. _cache(cacheKey, parsedFunction) {
  44648. if (!parsedFunction) {
  44649. throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.');
  44650. }
  44651. let fnRef;
  44652. if (cacheKey instanceof _primitives.Ref) {
  44653. fnRef = cacheKey;
  44654. } else if (cacheKey instanceof _primitives.Dict) {
  44655. fnRef = cacheKey.objId;
  44656. } else if (cacheKey instanceof _base_stream.BaseStream) {
  44657. fnRef = cacheKey.dict && cacheKey.dict.objId;
  44658. }
  44659. if (fnRef) {
  44660. this._localFunctionCache.set(null, fnRef, parsedFunction);
  44661. }
  44662. }
  44663. get _localFunctionCache() {
  44664. return (0, _util.shadow)(this, "_localFunctionCache", new _image_utils.LocalFunctionCache());
  44665. }
  44666. }
  44667. exports.PDFFunctionFactory = PDFFunctionFactory;
  44668. function toNumberArray(arr) {
  44669. if (!Array.isArray(arr)) {
  44670. return null;
  44671. }
  44672. const length = arr.length;
  44673. for (let i = 0; i < length; i++) {
  44674. if (typeof arr[i] !== "number") {
  44675. const result = new Array(length);
  44676. for (let j = 0; j < length; j++) {
  44677. result[j] = +arr[j];
  44678. }
  44679. return result;
  44680. }
  44681. }
  44682. return arr;
  44683. }
  44684. class PDFFunction {
  44685. static getSampleArray(size, outputSize, bps, stream) {
  44686. let i, ii;
  44687. let length = 1;
  44688. for (i = 0, ii = size.length; i < ii; i++) {
  44689. length *= size[i];
  44690. }
  44691. length *= outputSize;
  44692. const array = new Array(length);
  44693. let codeSize = 0;
  44694. let codeBuf = 0;
  44695. const sampleMul = 1.0 / (2.0 ** bps - 1);
  44696. const strBytes = stream.getBytes((length * bps + 7) / 8);
  44697. let strIdx = 0;
  44698. for (i = 0; i < length; i++) {
  44699. while (codeSize < bps) {
  44700. codeBuf <<= 8;
  44701. codeBuf |= strBytes[strIdx++];
  44702. codeSize += 8;
  44703. }
  44704. codeSize -= bps;
  44705. array[i] = (codeBuf >> codeSize) * sampleMul;
  44706. codeBuf &= (1 << codeSize) - 1;
  44707. }
  44708. return array;
  44709. }
  44710. static parse({
  44711. xref,
  44712. isEvalSupported,
  44713. fn
  44714. }) {
  44715. const dict = fn.dict || fn;
  44716. const typeNum = dict.get("FunctionType");
  44717. switch (typeNum) {
  44718. case 0:
  44719. return this.constructSampled({
  44720. xref,
  44721. isEvalSupported,
  44722. fn,
  44723. dict
  44724. });
  44725. case 1:
  44726. break;
  44727. case 2:
  44728. return this.constructInterpolated({
  44729. xref,
  44730. isEvalSupported,
  44731. dict
  44732. });
  44733. case 3:
  44734. return this.constructStiched({
  44735. xref,
  44736. isEvalSupported,
  44737. dict
  44738. });
  44739. case 4:
  44740. return this.constructPostScript({
  44741. xref,
  44742. isEvalSupported,
  44743. fn,
  44744. dict
  44745. });
  44746. }
  44747. throw new _util.FormatError("Unknown type of function");
  44748. }
  44749. static parseArray({
  44750. xref,
  44751. isEvalSupported,
  44752. fnObj
  44753. }) {
  44754. if (!Array.isArray(fnObj)) {
  44755. return this.parse({
  44756. xref,
  44757. isEvalSupported,
  44758. fn: fnObj
  44759. });
  44760. }
  44761. const fnArray = [];
  44762. for (const fn of fnObj) {
  44763. fnArray.push(this.parse({
  44764. xref,
  44765. isEvalSupported,
  44766. fn: xref.fetchIfRef(fn)
  44767. }));
  44768. }
  44769. return function (src, srcOffset, dest, destOffset) {
  44770. for (let i = 0, ii = fnArray.length; i < ii; i++) {
  44771. fnArray[i](src, srcOffset, dest, destOffset + i);
  44772. }
  44773. };
  44774. }
  44775. static constructSampled({
  44776. xref,
  44777. isEvalSupported,
  44778. fn,
  44779. dict
  44780. }) {
  44781. function toMultiArray(arr) {
  44782. const inputLength = arr.length;
  44783. const out = [];
  44784. let index = 0;
  44785. for (let i = 0; i < inputLength; i += 2) {
  44786. out[index++] = [arr[i], arr[i + 1]];
  44787. }
  44788. return out;
  44789. }
  44790. function interpolate(x, xmin, xmax, ymin, ymax) {
  44791. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  44792. }
  44793. let domain = toNumberArray(dict.getArray("Domain"));
  44794. let range = toNumberArray(dict.getArray("Range"));
  44795. if (!domain || !range) {
  44796. throw new _util.FormatError("No domain or range");
  44797. }
  44798. const inputSize = domain.length / 2;
  44799. const outputSize = range.length / 2;
  44800. domain = toMultiArray(domain);
  44801. range = toMultiArray(range);
  44802. const size = toNumberArray(dict.getArray("Size"));
  44803. const bps = dict.get("BitsPerSample");
  44804. const order = dict.get("Order") || 1;
  44805. if (order !== 1) {
  44806. (0, _util.info)("No support for cubic spline interpolation: " + order);
  44807. }
  44808. let encode = toNumberArray(dict.getArray("Encode"));
  44809. if (!encode) {
  44810. encode = [];
  44811. for (let i = 0; i < inputSize; ++i) {
  44812. encode.push([0, size[i] - 1]);
  44813. }
  44814. } else {
  44815. encode = toMultiArray(encode);
  44816. }
  44817. let decode = toNumberArray(dict.getArray("Decode"));
  44818. if (!decode) {
  44819. decode = range;
  44820. } else {
  44821. decode = toMultiArray(decode);
  44822. }
  44823. const samples = this.getSampleArray(size, outputSize, bps, fn);
  44824. return function constructSampledFn(src, srcOffset, dest, destOffset) {
  44825. const cubeVertices = 1 << inputSize;
  44826. const cubeN = new Float64Array(cubeVertices);
  44827. const cubeVertex = new Uint32Array(cubeVertices);
  44828. let i, j;
  44829. for (j = 0; j < cubeVertices; j++) {
  44830. cubeN[j] = 1;
  44831. }
  44832. let k = outputSize,
  44833. pos = 1;
  44834. for (i = 0; i < inputSize; ++i) {
  44835. const domain_2i = domain[i][0];
  44836. const domain_2i_1 = domain[i][1];
  44837. const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  44838. let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  44839. const size_i = size[i];
  44840. e = Math.min(Math.max(e, 0), size_i - 1);
  44841. const e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  44842. const n0 = e0 + 1 - e;
  44843. const n1 = e - e0;
  44844. const offset0 = e0 * k;
  44845. const offset1 = offset0 + k;
  44846. for (j = 0; j < cubeVertices; j++) {
  44847. if (j & pos) {
  44848. cubeN[j] *= n1;
  44849. cubeVertex[j] += offset1;
  44850. } else {
  44851. cubeN[j] *= n0;
  44852. cubeVertex[j] += offset0;
  44853. }
  44854. }
  44855. k *= size_i;
  44856. pos <<= 1;
  44857. }
  44858. for (j = 0; j < outputSize; ++j) {
  44859. let rj = 0;
  44860. for (i = 0; i < cubeVertices; i++) {
  44861. rj += samples[cubeVertex[i] + j] * cubeN[i];
  44862. }
  44863. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  44864. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  44865. }
  44866. };
  44867. }
  44868. static constructInterpolated({
  44869. xref,
  44870. isEvalSupported,
  44871. dict
  44872. }) {
  44873. const c0 = toNumberArray(dict.getArray("C0")) || [0];
  44874. const c1 = toNumberArray(dict.getArray("C1")) || [1];
  44875. const n = dict.get("N");
  44876. const diff = [];
  44877. for (let i = 0, ii = c0.length; i < ii; ++i) {
  44878. diff.push(c1[i] - c0[i]);
  44879. }
  44880. const length = diff.length;
  44881. return function constructInterpolatedFn(src, srcOffset, dest, destOffset) {
  44882. const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  44883. for (let j = 0; j < length; ++j) {
  44884. dest[destOffset + j] = c0[j] + x * diff[j];
  44885. }
  44886. };
  44887. }
  44888. static constructStiched({
  44889. xref,
  44890. isEvalSupported,
  44891. dict
  44892. }) {
  44893. const domain = toNumberArray(dict.getArray("Domain"));
  44894. if (!domain) {
  44895. throw new _util.FormatError("No domain");
  44896. }
  44897. const inputSize = domain.length / 2;
  44898. if (inputSize !== 1) {
  44899. throw new _util.FormatError("Bad domain for stiched function");
  44900. }
  44901. const fns = [];
  44902. for (const fn of dict.get("Functions")) {
  44903. fns.push(this.parse({
  44904. xref,
  44905. isEvalSupported,
  44906. fn: xref.fetchIfRef(fn)
  44907. }));
  44908. }
  44909. const bounds = toNumberArray(dict.getArray("Bounds"));
  44910. const encode = toNumberArray(dict.getArray("Encode"));
  44911. const tmpBuf = new Float32Array(1);
  44912. return function constructStichedFn(src, srcOffset, dest, destOffset) {
  44913. const clip = function constructStichedFromIRClip(v, min, max) {
  44914. if (v > max) {
  44915. v = max;
  44916. } else if (v < min) {
  44917. v = min;
  44918. }
  44919. return v;
  44920. };
  44921. const v = clip(src[srcOffset], domain[0], domain[1]);
  44922. const length = bounds.length;
  44923. let i;
  44924. for (i = 0; i < length; ++i) {
  44925. if (v < bounds[i]) {
  44926. break;
  44927. }
  44928. }
  44929. let dmin = domain[0];
  44930. if (i > 0) {
  44931. dmin = bounds[i - 1];
  44932. }
  44933. let dmax = domain[1];
  44934. if (i < bounds.length) {
  44935. dmax = bounds[i];
  44936. }
  44937. const rmin = encode[2 * i];
  44938. const rmax = encode[2 * i + 1];
  44939. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  44940. fns[i](tmpBuf, 0, dest, destOffset);
  44941. };
  44942. }
  44943. static constructPostScript({
  44944. xref,
  44945. isEvalSupported,
  44946. fn,
  44947. dict
  44948. }) {
  44949. const domain = toNumberArray(dict.getArray("Domain"));
  44950. const range = toNumberArray(dict.getArray("Range"));
  44951. if (!domain) {
  44952. throw new _util.FormatError("No domain.");
  44953. }
  44954. if (!range) {
  44955. throw new _util.FormatError("No range.");
  44956. }
  44957. const lexer = new _ps_parser.PostScriptLexer(fn);
  44958. const parser = new _ps_parser.PostScriptParser(lexer);
  44959. const code = parser.parse();
  44960. if (isEvalSupported && _util.FeatureTest.isEvalSupported) {
  44961. const compiled = new PostScriptCompiler().compile(code, domain, range);
  44962. if (compiled) {
  44963. return new Function("src", "srcOffset", "dest", "destOffset", compiled);
  44964. }
  44965. }
  44966. (0, _util.info)("Unable to compile PS function");
  44967. const numOutputs = range.length >> 1;
  44968. const numInputs = domain.length >> 1;
  44969. const evaluator = new PostScriptEvaluator(code);
  44970. const cache = Object.create(null);
  44971. const MAX_CACHE_SIZE = 2048 * 4;
  44972. let cache_available = MAX_CACHE_SIZE;
  44973. const tmpBuf = new Float32Array(numInputs);
  44974. return function constructPostScriptFn(src, srcOffset, dest, destOffset) {
  44975. let i, value;
  44976. let key = "";
  44977. const input = tmpBuf;
  44978. for (i = 0; i < numInputs; i++) {
  44979. value = src[srcOffset + i];
  44980. input[i] = value;
  44981. key += value + "_";
  44982. }
  44983. const cachedValue = cache[key];
  44984. if (cachedValue !== undefined) {
  44985. dest.set(cachedValue, destOffset);
  44986. return;
  44987. }
  44988. const output = new Float32Array(numOutputs);
  44989. const stack = evaluator.execute(input);
  44990. const stackIndex = stack.length - numOutputs;
  44991. for (i = 0; i < numOutputs; i++) {
  44992. value = stack[stackIndex + i];
  44993. let bound = range[i * 2];
  44994. if (value < bound) {
  44995. value = bound;
  44996. } else {
  44997. bound = range[i * 2 + 1];
  44998. if (value > bound) {
  44999. value = bound;
  45000. }
  45001. }
  45002. output[i] = value;
  45003. }
  45004. if (cache_available > 0) {
  45005. cache_available--;
  45006. cache[key] = output;
  45007. }
  45008. dest.set(output, destOffset);
  45009. };
  45010. }
  45011. }
  45012. function isPDFFunction(v) {
  45013. let fnDict;
  45014. if (typeof v !== "object") {
  45015. return false;
  45016. } else if (v instanceof _primitives.Dict) {
  45017. fnDict = v;
  45018. } else if (v instanceof _base_stream.BaseStream) {
  45019. fnDict = v.dict;
  45020. } else {
  45021. return false;
  45022. }
  45023. return fnDict.has("FunctionType");
  45024. }
  45025. class PostScriptStack {
  45026. static get MAX_STACK_SIZE() {
  45027. return (0, _util.shadow)(this, "MAX_STACK_SIZE", 100);
  45028. }
  45029. constructor(initialStack) {
  45030. this.stack = initialStack ? Array.from(initialStack) : [];
  45031. }
  45032. push(value) {
  45033. if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) {
  45034. throw new Error("PostScript function stack overflow.");
  45035. }
  45036. this.stack.push(value);
  45037. }
  45038. pop() {
  45039. if (this.stack.length <= 0) {
  45040. throw new Error("PostScript function stack underflow.");
  45041. }
  45042. return this.stack.pop();
  45043. }
  45044. copy(n) {
  45045. if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) {
  45046. throw new Error("PostScript function stack overflow.");
  45047. }
  45048. const stack = this.stack;
  45049. for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  45050. stack.push(stack[i]);
  45051. }
  45052. }
  45053. index(n) {
  45054. this.push(this.stack[this.stack.length - n - 1]);
  45055. }
  45056. roll(n, p) {
  45057. const stack = this.stack;
  45058. const l = stack.length - n;
  45059. const r = stack.length - 1;
  45060. const c = l + (p - Math.floor(p / n) * n);
  45061. for (let i = l, j = r; i < j; i++, j--) {
  45062. const t = stack[i];
  45063. stack[i] = stack[j];
  45064. stack[j] = t;
  45065. }
  45066. for (let i = l, j = c - 1; i < j; i++, j--) {
  45067. const t = stack[i];
  45068. stack[i] = stack[j];
  45069. stack[j] = t;
  45070. }
  45071. for (let i = c, j = r; i < j; i++, j--) {
  45072. const t = stack[i];
  45073. stack[i] = stack[j];
  45074. stack[j] = t;
  45075. }
  45076. }
  45077. }
  45078. class PostScriptEvaluator {
  45079. constructor(operators) {
  45080. this.operators = operators;
  45081. }
  45082. execute(initialStack) {
  45083. const stack = new PostScriptStack(initialStack);
  45084. let counter = 0;
  45085. const operators = this.operators;
  45086. const length = operators.length;
  45087. let operator, a, b;
  45088. while (counter < length) {
  45089. operator = operators[counter++];
  45090. if (typeof operator === "number") {
  45091. stack.push(operator);
  45092. continue;
  45093. }
  45094. switch (operator) {
  45095. case "jz":
  45096. b = stack.pop();
  45097. a = stack.pop();
  45098. if (!a) {
  45099. counter = b;
  45100. }
  45101. break;
  45102. case "j":
  45103. a = stack.pop();
  45104. counter = a;
  45105. break;
  45106. case "abs":
  45107. a = stack.pop();
  45108. stack.push(Math.abs(a));
  45109. break;
  45110. case "add":
  45111. b = stack.pop();
  45112. a = stack.pop();
  45113. stack.push(a + b);
  45114. break;
  45115. case "and":
  45116. b = stack.pop();
  45117. a = stack.pop();
  45118. if (typeof a === "boolean" && typeof b === "boolean") {
  45119. stack.push(a && b);
  45120. } else {
  45121. stack.push(a & b);
  45122. }
  45123. break;
  45124. case "atan":
  45125. a = stack.pop();
  45126. stack.push(Math.atan(a));
  45127. break;
  45128. case "bitshift":
  45129. b = stack.pop();
  45130. a = stack.pop();
  45131. if (a > 0) {
  45132. stack.push(a << b);
  45133. } else {
  45134. stack.push(a >> b);
  45135. }
  45136. break;
  45137. case "ceiling":
  45138. a = stack.pop();
  45139. stack.push(Math.ceil(a));
  45140. break;
  45141. case "copy":
  45142. a = stack.pop();
  45143. stack.copy(a);
  45144. break;
  45145. case "cos":
  45146. a = stack.pop();
  45147. stack.push(Math.cos(a));
  45148. break;
  45149. case "cvi":
  45150. a = stack.pop() | 0;
  45151. stack.push(a);
  45152. break;
  45153. case "cvr":
  45154. break;
  45155. case "div":
  45156. b = stack.pop();
  45157. a = stack.pop();
  45158. stack.push(a / b);
  45159. break;
  45160. case "dup":
  45161. stack.copy(1);
  45162. break;
  45163. case "eq":
  45164. b = stack.pop();
  45165. a = stack.pop();
  45166. stack.push(a === b);
  45167. break;
  45168. case "exch":
  45169. stack.roll(2, 1);
  45170. break;
  45171. case "exp":
  45172. b = stack.pop();
  45173. a = stack.pop();
  45174. stack.push(a ** b);
  45175. break;
  45176. case "false":
  45177. stack.push(false);
  45178. break;
  45179. case "floor":
  45180. a = stack.pop();
  45181. stack.push(Math.floor(a));
  45182. break;
  45183. case "ge":
  45184. b = stack.pop();
  45185. a = stack.pop();
  45186. stack.push(a >= b);
  45187. break;
  45188. case "gt":
  45189. b = stack.pop();
  45190. a = stack.pop();
  45191. stack.push(a > b);
  45192. break;
  45193. case "idiv":
  45194. b = stack.pop();
  45195. a = stack.pop();
  45196. stack.push(a / b | 0);
  45197. break;
  45198. case "index":
  45199. a = stack.pop();
  45200. stack.index(a);
  45201. break;
  45202. case "le":
  45203. b = stack.pop();
  45204. a = stack.pop();
  45205. stack.push(a <= b);
  45206. break;
  45207. case "ln":
  45208. a = stack.pop();
  45209. stack.push(Math.log(a));
  45210. break;
  45211. case "log":
  45212. a = stack.pop();
  45213. stack.push(Math.log(a) / Math.LN10);
  45214. break;
  45215. case "lt":
  45216. b = stack.pop();
  45217. a = stack.pop();
  45218. stack.push(a < b);
  45219. break;
  45220. case "mod":
  45221. b = stack.pop();
  45222. a = stack.pop();
  45223. stack.push(a % b);
  45224. break;
  45225. case "mul":
  45226. b = stack.pop();
  45227. a = stack.pop();
  45228. stack.push(a * b);
  45229. break;
  45230. case "ne":
  45231. b = stack.pop();
  45232. a = stack.pop();
  45233. stack.push(a !== b);
  45234. break;
  45235. case "neg":
  45236. a = stack.pop();
  45237. stack.push(-a);
  45238. break;
  45239. case "not":
  45240. a = stack.pop();
  45241. if (typeof a === "boolean") {
  45242. stack.push(!a);
  45243. } else {
  45244. stack.push(~a);
  45245. }
  45246. break;
  45247. case "or":
  45248. b = stack.pop();
  45249. a = stack.pop();
  45250. if (typeof a === "boolean" && typeof b === "boolean") {
  45251. stack.push(a || b);
  45252. } else {
  45253. stack.push(a | b);
  45254. }
  45255. break;
  45256. case "pop":
  45257. stack.pop();
  45258. break;
  45259. case "roll":
  45260. b = stack.pop();
  45261. a = stack.pop();
  45262. stack.roll(a, b);
  45263. break;
  45264. case "round":
  45265. a = stack.pop();
  45266. stack.push(Math.round(a));
  45267. break;
  45268. case "sin":
  45269. a = stack.pop();
  45270. stack.push(Math.sin(a));
  45271. break;
  45272. case "sqrt":
  45273. a = stack.pop();
  45274. stack.push(Math.sqrt(a));
  45275. break;
  45276. case "sub":
  45277. b = stack.pop();
  45278. a = stack.pop();
  45279. stack.push(a - b);
  45280. break;
  45281. case "true":
  45282. stack.push(true);
  45283. break;
  45284. case "truncate":
  45285. a = stack.pop();
  45286. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  45287. stack.push(a);
  45288. break;
  45289. case "xor":
  45290. b = stack.pop();
  45291. a = stack.pop();
  45292. if (typeof a === "boolean" && typeof b === "boolean") {
  45293. stack.push(a !== b);
  45294. } else {
  45295. stack.push(a ^ b);
  45296. }
  45297. break;
  45298. default:
  45299. throw new _util.FormatError(`Unknown operator ${operator}`);
  45300. }
  45301. }
  45302. return stack.stack;
  45303. }
  45304. }
  45305. exports.PostScriptEvaluator = PostScriptEvaluator;
  45306. class AstNode {
  45307. constructor(type) {
  45308. this.type = type;
  45309. }
  45310. visit(visitor) {
  45311. (0, _util.unreachable)("abstract method");
  45312. }
  45313. }
  45314. class AstArgument extends AstNode {
  45315. constructor(index, min, max) {
  45316. super("args");
  45317. this.index = index;
  45318. this.min = min;
  45319. this.max = max;
  45320. }
  45321. visit(visitor) {
  45322. visitor.visitArgument(this);
  45323. }
  45324. }
  45325. class AstLiteral extends AstNode {
  45326. constructor(number) {
  45327. super("literal");
  45328. this.number = number;
  45329. this.min = number;
  45330. this.max = number;
  45331. }
  45332. visit(visitor) {
  45333. visitor.visitLiteral(this);
  45334. }
  45335. }
  45336. class AstBinaryOperation extends AstNode {
  45337. constructor(op, arg1, arg2, min, max) {
  45338. super("binary");
  45339. this.op = op;
  45340. this.arg1 = arg1;
  45341. this.arg2 = arg2;
  45342. this.min = min;
  45343. this.max = max;
  45344. }
  45345. visit(visitor) {
  45346. visitor.visitBinaryOperation(this);
  45347. }
  45348. }
  45349. class AstMin extends AstNode {
  45350. constructor(arg, max) {
  45351. super("max");
  45352. this.arg = arg;
  45353. this.min = arg.min;
  45354. this.max = max;
  45355. }
  45356. visit(visitor) {
  45357. visitor.visitMin(this);
  45358. }
  45359. }
  45360. class AstVariable extends AstNode {
  45361. constructor(index, min, max) {
  45362. super("var");
  45363. this.index = index;
  45364. this.min = min;
  45365. this.max = max;
  45366. }
  45367. visit(visitor) {
  45368. visitor.visitVariable(this);
  45369. }
  45370. }
  45371. class AstVariableDefinition extends AstNode {
  45372. constructor(variable, arg) {
  45373. super("definition");
  45374. this.variable = variable;
  45375. this.arg = arg;
  45376. }
  45377. visit(visitor) {
  45378. visitor.visitVariableDefinition(this);
  45379. }
  45380. }
  45381. class ExpressionBuilderVisitor {
  45382. constructor() {
  45383. this.parts = [];
  45384. }
  45385. visitArgument(arg) {
  45386. this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
  45387. }
  45388. visitVariable(variable) {
  45389. this.parts.push("v", variable.index);
  45390. }
  45391. visitLiteral(literal) {
  45392. this.parts.push(literal.number);
  45393. }
  45394. visitBinaryOperation(operation) {
  45395. this.parts.push("(");
  45396. operation.arg1.visit(this);
  45397. this.parts.push(" ", operation.op, " ");
  45398. operation.arg2.visit(this);
  45399. this.parts.push(")");
  45400. }
  45401. visitVariableDefinition(definition) {
  45402. this.parts.push("var ");
  45403. definition.variable.visit(this);
  45404. this.parts.push(" = ");
  45405. definition.arg.visit(this);
  45406. this.parts.push(";");
  45407. }
  45408. visitMin(max) {
  45409. this.parts.push("Math.min(");
  45410. max.arg.visit(this);
  45411. this.parts.push(", ", max.max, ")");
  45412. }
  45413. toString() {
  45414. return this.parts.join("");
  45415. }
  45416. }
  45417. function buildAddOperation(num1, num2) {
  45418. if (num2.type === "literal" && num2.number === 0) {
  45419. return num1;
  45420. }
  45421. if (num1.type === "literal" && num1.number === 0) {
  45422. return num2;
  45423. }
  45424. if (num2.type === "literal" && num1.type === "literal") {
  45425. return new AstLiteral(num1.number + num2.number);
  45426. }
  45427. return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
  45428. }
  45429. function buildMulOperation(num1, num2) {
  45430. if (num2.type === "literal") {
  45431. if (num2.number === 0) {
  45432. return new AstLiteral(0);
  45433. } else if (num2.number === 1) {
  45434. return num1;
  45435. } else if (num1.type === "literal") {
  45436. return new AstLiteral(num1.number * num2.number);
  45437. }
  45438. }
  45439. if (num1.type === "literal") {
  45440. if (num1.number === 0) {
  45441. return new AstLiteral(0);
  45442. } else if (num1.number === 1) {
  45443. return num2;
  45444. }
  45445. }
  45446. const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  45447. const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  45448. return new AstBinaryOperation("*", num1, num2, min, max);
  45449. }
  45450. function buildSubOperation(num1, num2) {
  45451. if (num2.type === "literal") {
  45452. if (num2.number === 0) {
  45453. return num1;
  45454. } else if (num1.type === "literal") {
  45455. return new AstLiteral(num1.number - num2.number);
  45456. }
  45457. }
  45458. if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
  45459. return num2.arg2;
  45460. }
  45461. return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
  45462. }
  45463. function buildMinOperation(num1, max) {
  45464. if (num1.min >= max) {
  45465. return new AstLiteral(max);
  45466. } else if (num1.max <= max) {
  45467. return num1;
  45468. }
  45469. return new AstMin(num1, max);
  45470. }
  45471. class PostScriptCompiler {
  45472. compile(code, domain, range) {
  45473. const stack = [];
  45474. const instructions = [];
  45475. const inputSize = domain.length >> 1,
  45476. outputSize = range.length >> 1;
  45477. let lastRegister = 0;
  45478. let n, j;
  45479. let num1, num2, ast1, ast2, tmpVar, item;
  45480. for (let i = 0; i < inputSize; i++) {
  45481. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  45482. }
  45483. for (let i = 0, ii = code.length; i < ii; i++) {
  45484. item = code[i];
  45485. if (typeof item === "number") {
  45486. stack.push(new AstLiteral(item));
  45487. continue;
  45488. }
  45489. switch (item) {
  45490. case "add":
  45491. if (stack.length < 2) {
  45492. return null;
  45493. }
  45494. num2 = stack.pop();
  45495. num1 = stack.pop();
  45496. stack.push(buildAddOperation(num1, num2));
  45497. break;
  45498. case "cvr":
  45499. if (stack.length < 1) {
  45500. return null;
  45501. }
  45502. break;
  45503. case "mul":
  45504. if (stack.length < 2) {
  45505. return null;
  45506. }
  45507. num2 = stack.pop();
  45508. num1 = stack.pop();
  45509. stack.push(buildMulOperation(num1, num2));
  45510. break;
  45511. case "sub":
  45512. if (stack.length < 2) {
  45513. return null;
  45514. }
  45515. num2 = stack.pop();
  45516. num1 = stack.pop();
  45517. stack.push(buildSubOperation(num1, num2));
  45518. break;
  45519. case "exch":
  45520. if (stack.length < 2) {
  45521. return null;
  45522. }
  45523. ast1 = stack.pop();
  45524. ast2 = stack.pop();
  45525. stack.push(ast1, ast2);
  45526. break;
  45527. case "pop":
  45528. if (stack.length < 1) {
  45529. return null;
  45530. }
  45531. stack.pop();
  45532. break;
  45533. case "index":
  45534. if (stack.length < 1) {
  45535. return null;
  45536. }
  45537. num1 = stack.pop();
  45538. if (num1.type !== "literal") {
  45539. return null;
  45540. }
  45541. n = num1.number;
  45542. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  45543. return null;
  45544. }
  45545. ast1 = stack[stack.length - n - 1];
  45546. if (ast1.type === "literal" || ast1.type === "var") {
  45547. stack.push(ast1);
  45548. break;
  45549. }
  45550. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  45551. stack[stack.length - n - 1] = tmpVar;
  45552. stack.push(tmpVar);
  45553. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  45554. break;
  45555. case "dup":
  45556. if (stack.length < 1) {
  45557. return null;
  45558. }
  45559. if (typeof code[i + 1] === "number" && code[i + 2] === "gt" && code[i + 3] === i + 7 && code[i + 4] === "jz" && code[i + 5] === "pop" && code[i + 6] === code[i + 1]) {
  45560. num1 = stack.pop();
  45561. stack.push(buildMinOperation(num1, code[i + 1]));
  45562. i += 6;
  45563. break;
  45564. }
  45565. ast1 = stack.at(-1);
  45566. if (ast1.type === "literal" || ast1.type === "var") {
  45567. stack.push(ast1);
  45568. break;
  45569. }
  45570. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  45571. stack[stack.length - 1] = tmpVar;
  45572. stack.push(tmpVar);
  45573. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  45574. break;
  45575. case "roll":
  45576. if (stack.length < 2) {
  45577. return null;
  45578. }
  45579. num2 = stack.pop();
  45580. num1 = stack.pop();
  45581. if (num2.type !== "literal" || num1.type !== "literal") {
  45582. return null;
  45583. }
  45584. j = num2.number;
  45585. n = num1.number;
  45586. if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
  45587. return null;
  45588. }
  45589. j = (j % n + n) % n;
  45590. if (j === 0) {
  45591. break;
  45592. }
  45593. stack.push(...stack.splice(stack.length - n, n - j));
  45594. break;
  45595. default:
  45596. return null;
  45597. }
  45598. }
  45599. if (stack.length !== outputSize) {
  45600. return null;
  45601. }
  45602. const result = [];
  45603. for (const instruction of instructions) {
  45604. const statementBuilder = new ExpressionBuilderVisitor();
  45605. instruction.visit(statementBuilder);
  45606. result.push(statementBuilder.toString());
  45607. }
  45608. for (let i = 0, ii = stack.length; i < ii; i++) {
  45609. const expr = stack[i],
  45610. statementBuilder = new ExpressionBuilderVisitor();
  45611. expr.visit(statementBuilder);
  45612. const min = range[i * 2],
  45613. max = range[i * 2 + 1];
  45614. const out = [statementBuilder.toString()];
  45615. if (min > expr.min) {
  45616. out.unshift("Math.max(", min, ", ");
  45617. out.push(")");
  45618. }
  45619. if (max < expr.max) {
  45620. out.unshift("Math.min(", max, ", ");
  45621. out.push(")");
  45622. }
  45623. out.unshift("dest[destOffset + ", i, "] = ");
  45624. out.push(";");
  45625. result.push(out.join(""));
  45626. }
  45627. return result.join("\n");
  45628. }
  45629. }
  45630. exports.PostScriptCompiler = PostScriptCompiler;
  45631. /***/ }),
  45632. /* 56 */
  45633. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45634. Object.defineProperty(exports, "__esModule", ({
  45635. value: true
  45636. }));
  45637. exports.PostScriptParser = exports.PostScriptLexer = void 0;
  45638. var _util = __w_pdfjs_require__(2);
  45639. var _primitives = __w_pdfjs_require__(3);
  45640. var _core_utils = __w_pdfjs_require__(4);
  45641. class PostScriptParser {
  45642. constructor(lexer) {
  45643. this.lexer = lexer;
  45644. this.operators = [];
  45645. this.token = null;
  45646. this.prev = null;
  45647. }
  45648. nextToken() {
  45649. this.prev = this.token;
  45650. this.token = this.lexer.getToken();
  45651. }
  45652. accept(type) {
  45653. if (this.token.type === type) {
  45654. this.nextToken();
  45655. return true;
  45656. }
  45657. return false;
  45658. }
  45659. expect(type) {
  45660. if (this.accept(type)) {
  45661. return true;
  45662. }
  45663. throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
  45664. }
  45665. parse() {
  45666. this.nextToken();
  45667. this.expect(PostScriptTokenTypes.LBRACE);
  45668. this.parseBlock();
  45669. this.expect(PostScriptTokenTypes.RBRACE);
  45670. return this.operators;
  45671. }
  45672. parseBlock() {
  45673. while (true) {
  45674. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  45675. this.operators.push(this.prev.value);
  45676. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  45677. this.operators.push(this.prev.value);
  45678. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  45679. this.parseCondition();
  45680. } else {
  45681. return;
  45682. }
  45683. }
  45684. }
  45685. parseCondition() {
  45686. const conditionLocation = this.operators.length;
  45687. this.operators.push(null, null);
  45688. this.parseBlock();
  45689. this.expect(PostScriptTokenTypes.RBRACE);
  45690. if (this.accept(PostScriptTokenTypes.IF)) {
  45691. this.operators[conditionLocation] = this.operators.length;
  45692. this.operators[conditionLocation + 1] = "jz";
  45693. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  45694. const jumpLocation = this.operators.length;
  45695. this.operators.push(null, null);
  45696. const endOfTrue = this.operators.length;
  45697. this.parseBlock();
  45698. this.expect(PostScriptTokenTypes.RBRACE);
  45699. this.expect(PostScriptTokenTypes.IFELSE);
  45700. this.operators[jumpLocation] = this.operators.length;
  45701. this.operators[jumpLocation + 1] = "j";
  45702. this.operators[conditionLocation] = endOfTrue;
  45703. this.operators[conditionLocation + 1] = "jz";
  45704. } else {
  45705. throw new _util.FormatError("PS Function: error parsing conditional.");
  45706. }
  45707. }
  45708. }
  45709. exports.PostScriptParser = PostScriptParser;
  45710. const PostScriptTokenTypes = {
  45711. LBRACE: 0,
  45712. RBRACE: 1,
  45713. NUMBER: 2,
  45714. OPERATOR: 3,
  45715. IF: 4,
  45716. IFELSE: 5
  45717. };
  45718. class PostScriptToken {
  45719. static get opCache() {
  45720. return (0, _util.shadow)(this, "opCache", Object.create(null));
  45721. }
  45722. constructor(type, value) {
  45723. this.type = type;
  45724. this.value = value;
  45725. }
  45726. static getOperator(op) {
  45727. const opValue = PostScriptToken.opCache[op];
  45728. if (opValue) {
  45729. return opValue;
  45730. }
  45731. return PostScriptToken.opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  45732. }
  45733. static get LBRACE() {
  45734. return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
  45735. }
  45736. static get RBRACE() {
  45737. return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
  45738. }
  45739. static get IF() {
  45740. return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
  45741. }
  45742. static get IFELSE() {
  45743. return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
  45744. }
  45745. }
  45746. class PostScriptLexer {
  45747. constructor(stream) {
  45748. this.stream = stream;
  45749. this.nextChar();
  45750. this.strBuf = [];
  45751. }
  45752. nextChar() {
  45753. return this.currentChar = this.stream.getByte();
  45754. }
  45755. getToken() {
  45756. let comment = false;
  45757. let ch = this.currentChar;
  45758. while (true) {
  45759. if (ch < 0) {
  45760. return _primitives.EOF;
  45761. }
  45762. if (comment) {
  45763. if (ch === 0x0a || ch === 0x0d) {
  45764. comment = false;
  45765. }
  45766. } else if (ch === 0x25) {
  45767. comment = true;
  45768. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  45769. break;
  45770. }
  45771. ch = this.nextChar();
  45772. }
  45773. switch (ch | 0) {
  45774. case 0x30:
  45775. case 0x31:
  45776. case 0x32:
  45777. case 0x33:
  45778. case 0x34:
  45779. case 0x35:
  45780. case 0x36:
  45781. case 0x37:
  45782. case 0x38:
  45783. case 0x39:
  45784. case 0x2b:
  45785. case 0x2d:
  45786. case 0x2e:
  45787. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  45788. case 0x7b:
  45789. this.nextChar();
  45790. return PostScriptToken.LBRACE;
  45791. case 0x7d:
  45792. this.nextChar();
  45793. return PostScriptToken.RBRACE;
  45794. }
  45795. const strBuf = this.strBuf;
  45796. strBuf.length = 0;
  45797. strBuf[0] = String.fromCharCode(ch);
  45798. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
  45799. strBuf.push(String.fromCharCode(ch));
  45800. }
  45801. const str = strBuf.join("");
  45802. switch (str.toLowerCase()) {
  45803. case "if":
  45804. return PostScriptToken.IF;
  45805. case "ifelse":
  45806. return PostScriptToken.IFELSE;
  45807. default:
  45808. return PostScriptToken.getOperator(str);
  45809. }
  45810. }
  45811. getNumber() {
  45812. let ch = this.currentChar;
  45813. const strBuf = this.strBuf;
  45814. strBuf.length = 0;
  45815. strBuf[0] = String.fromCharCode(ch);
  45816. while ((ch = this.nextChar()) >= 0) {
  45817. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
  45818. strBuf.push(String.fromCharCode(ch));
  45819. } else {
  45820. break;
  45821. }
  45822. }
  45823. const value = parseFloat(strBuf.join(""));
  45824. if (isNaN(value)) {
  45825. throw new _util.FormatError(`Invalid floating point number: ${value}`);
  45826. }
  45827. return value;
  45828. }
  45829. }
  45830. exports.PostScriptLexer = PostScriptLexer;
  45831. /***/ }),
  45832. /* 57 */
  45833. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45834. Object.defineProperty(exports, "__esModule", ({
  45835. value: true
  45836. }));
  45837. exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0;
  45838. var _util = __w_pdfjs_require__(2);
  45839. var _primitives = __w_pdfjs_require__(3);
  45840. class BaseLocalCache {
  45841. constructor(options) {
  45842. if (this.constructor === BaseLocalCache) {
  45843. (0, _util.unreachable)("Cannot initialize BaseLocalCache.");
  45844. }
  45845. this._onlyRefs = (options && options.onlyRefs) === true;
  45846. if (!this._onlyRefs) {
  45847. this._nameRefMap = new Map();
  45848. this._imageMap = new Map();
  45849. }
  45850. this._imageCache = new _primitives.RefSetCache();
  45851. }
  45852. getByName(name) {
  45853. if (this._onlyRefs) {
  45854. (0, _util.unreachable)("Should not call `getByName` method.");
  45855. }
  45856. const ref = this._nameRefMap.get(name);
  45857. if (ref) {
  45858. return this.getByRef(ref);
  45859. }
  45860. return this._imageMap.get(name) || null;
  45861. }
  45862. getByRef(ref) {
  45863. return this._imageCache.get(ref) || null;
  45864. }
  45865. set(name, ref, data) {
  45866. (0, _util.unreachable)("Abstract method `set` called.");
  45867. }
  45868. }
  45869. class LocalImageCache extends BaseLocalCache {
  45870. set(name, ref = null, data) {
  45871. if (typeof name !== "string") {
  45872. throw new Error('LocalImageCache.set - expected "name" argument.');
  45873. }
  45874. if (ref) {
  45875. if (this._imageCache.has(ref)) {
  45876. return;
  45877. }
  45878. this._nameRefMap.set(name, ref);
  45879. this._imageCache.put(ref, data);
  45880. return;
  45881. }
  45882. if (this._imageMap.has(name)) {
  45883. return;
  45884. }
  45885. this._imageMap.set(name, data);
  45886. }
  45887. }
  45888. exports.LocalImageCache = LocalImageCache;
  45889. class LocalColorSpaceCache extends BaseLocalCache {
  45890. set(name = null, ref = null, data) {
  45891. if (typeof name !== "string" && !ref) {
  45892. throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');
  45893. }
  45894. if (ref) {
  45895. if (this._imageCache.has(ref)) {
  45896. return;
  45897. }
  45898. if (name !== null) {
  45899. this._nameRefMap.set(name, ref);
  45900. }
  45901. this._imageCache.put(ref, data);
  45902. return;
  45903. }
  45904. if (this._imageMap.has(name)) {
  45905. return;
  45906. }
  45907. this._imageMap.set(name, data);
  45908. }
  45909. }
  45910. exports.LocalColorSpaceCache = LocalColorSpaceCache;
  45911. class LocalFunctionCache extends BaseLocalCache {
  45912. constructor(options) {
  45913. super({
  45914. onlyRefs: true
  45915. });
  45916. }
  45917. set(name = null, ref, data) {
  45918. if (!ref) {
  45919. throw new Error('LocalFunctionCache.set - expected "ref" argument.');
  45920. }
  45921. if (this._imageCache.has(ref)) {
  45922. return;
  45923. }
  45924. this._imageCache.put(ref, data);
  45925. }
  45926. }
  45927. exports.LocalFunctionCache = LocalFunctionCache;
  45928. class LocalGStateCache extends BaseLocalCache {
  45929. set(name, ref = null, data) {
  45930. if (typeof name !== "string") {
  45931. throw new Error('LocalGStateCache.set - expected "name" argument.');
  45932. }
  45933. if (ref) {
  45934. if (this._imageCache.has(ref)) {
  45935. return;
  45936. }
  45937. this._nameRefMap.set(name, ref);
  45938. this._imageCache.put(ref, data);
  45939. return;
  45940. }
  45941. if (this._imageMap.has(name)) {
  45942. return;
  45943. }
  45944. this._imageMap.set(name, data);
  45945. }
  45946. }
  45947. exports.LocalGStateCache = LocalGStateCache;
  45948. class LocalTilingPatternCache extends BaseLocalCache {
  45949. constructor(options) {
  45950. super({
  45951. onlyRefs: true
  45952. });
  45953. }
  45954. set(name = null, ref, data) {
  45955. if (!ref) {
  45956. throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');
  45957. }
  45958. if (this._imageCache.has(ref)) {
  45959. return;
  45960. }
  45961. this._imageCache.put(ref, data);
  45962. }
  45963. }
  45964. exports.LocalTilingPatternCache = LocalTilingPatternCache;
  45965. class GlobalImageCache {
  45966. static get NUM_PAGES_THRESHOLD() {
  45967. return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
  45968. }
  45969. static get MIN_IMAGES_TO_CACHE() {
  45970. return (0, _util.shadow)(this, "MIN_IMAGES_TO_CACHE", 10);
  45971. }
  45972. static get MAX_BYTE_SIZE() {
  45973. return (0, _util.shadow)(this, "MAX_BYTE_SIZE", 40e6);
  45974. }
  45975. constructor() {
  45976. this._refCache = new _primitives.RefSetCache();
  45977. this._imageCache = new _primitives.RefSetCache();
  45978. }
  45979. get _byteSize() {
  45980. let byteSize = 0;
  45981. for (const imageData of this._imageCache) {
  45982. byteSize += imageData.byteSize;
  45983. }
  45984. return byteSize;
  45985. }
  45986. get _cacheLimitReached() {
  45987. if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) {
  45988. return false;
  45989. }
  45990. if (this._byteSize < GlobalImageCache.MAX_BYTE_SIZE) {
  45991. return false;
  45992. }
  45993. return true;
  45994. }
  45995. shouldCache(ref, pageIndex) {
  45996. const pageIndexSet = this._refCache.get(ref);
  45997. const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1;
  45998. if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  45999. return false;
  46000. }
  46001. if (!this._imageCache.has(ref) && this._cacheLimitReached) {
  46002. return false;
  46003. }
  46004. return true;
  46005. }
  46006. addPageIndex(ref, pageIndex) {
  46007. let pageIndexSet = this._refCache.get(ref);
  46008. if (!pageIndexSet) {
  46009. pageIndexSet = new Set();
  46010. this._refCache.put(ref, pageIndexSet);
  46011. }
  46012. pageIndexSet.add(pageIndex);
  46013. }
  46014. addByteSize(ref, byteSize) {
  46015. const imageData = this._imageCache.get(ref);
  46016. if (!imageData) {
  46017. return;
  46018. }
  46019. if (imageData.byteSize) {
  46020. return;
  46021. }
  46022. imageData.byteSize = byteSize;
  46023. }
  46024. getData(ref, pageIndex) {
  46025. const pageIndexSet = this._refCache.get(ref);
  46026. if (!pageIndexSet) {
  46027. return null;
  46028. }
  46029. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  46030. return null;
  46031. }
  46032. const imageData = this._imageCache.get(ref);
  46033. if (!imageData) {
  46034. return null;
  46035. }
  46036. pageIndexSet.add(pageIndex);
  46037. return imageData;
  46038. }
  46039. setData(ref, data) {
  46040. if (!this._refCache.has(ref)) {
  46041. throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.');
  46042. }
  46043. if (this._imageCache.has(ref)) {
  46044. return;
  46045. }
  46046. if (this._cacheLimitReached) {
  46047. (0, _util.warn)("GlobalImageCache.setData - cache limit reached.");
  46048. return;
  46049. }
  46050. this._imageCache.put(ref, data);
  46051. }
  46052. clear(onlyData = false) {
  46053. if (!onlyData) {
  46054. this._refCache.clear();
  46055. }
  46056. this._imageCache.clear();
  46057. }
  46058. }
  46059. exports.GlobalImageCache = GlobalImageCache;
  46060. /***/ }),
  46061. /* 58 */
  46062. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46063. Object.defineProperty(exports, "__esModule", ({
  46064. value: true
  46065. }));
  46066. exports.bidi = bidi;
  46067. var _util = __w_pdfjs_require__(2);
  46068. const baseTypes = ["BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "S", "B", "S", "WS", "B", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "B", "B", "B", "S", "WS", "ON", "ON", "ET", "ET", "ET", "ON", "ON", "ON", "ON", "ON", "ES", "CS", "ES", "CS", "CS", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "CS", "ON", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "ON", "ON", "ON", "BN", "BN", "BN", "BN", "BN", "BN", "B", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "CS", "ON", "ET", "ET", "ET", "ET", "ON", "ON", "ON", "ON", "L", "ON", "ON", "BN", "ON", "ON", "ET", "ET", "EN", "EN", "ON", "L", "ON", "ON", "ON", "EN", "L", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "L", "L", "L", "L", "L", "L", "L", "L"];
  46069. const arabicTypes = ["AN", "AN", "AN", "AN", "AN", "AN", "ON", "ON", "AL", "ET", "ET", "AL", "CS", "AL", "ON", "ON", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "ET", "AN", "AN", "AL", "AL", "AL", "NSM", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AN", "ON", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "NSM", "NSM", "ON", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "AL", "AL", "AL", "AL", "AL", "AL"];
  46070. function isOdd(i) {
  46071. return (i & 1) !== 0;
  46072. }
  46073. function isEven(i) {
  46074. return (i & 1) === 0;
  46075. }
  46076. function findUnequal(arr, start, value) {
  46077. let j, jj;
  46078. for (j = start, jj = arr.length; j < jj; ++j) {
  46079. if (arr[j] !== value) {
  46080. return j;
  46081. }
  46082. }
  46083. return j;
  46084. }
  46085. function setValues(arr, start, end, value) {
  46086. for (let j = start; j < end; ++j) {
  46087. arr[j] = value;
  46088. }
  46089. }
  46090. function reverseValues(arr, start, end) {
  46091. for (let i = start, j = end - 1; i < j; ++i, --j) {
  46092. const temp = arr[i];
  46093. arr[i] = arr[j];
  46094. arr[j] = temp;
  46095. }
  46096. }
  46097. function createBidiText(str, isLTR, vertical = false) {
  46098. let dir = "ltr";
  46099. if (vertical) {
  46100. dir = "ttb";
  46101. } else if (!isLTR) {
  46102. dir = "rtl";
  46103. }
  46104. return {
  46105. str,
  46106. dir
  46107. };
  46108. }
  46109. const chars = [];
  46110. const types = [];
  46111. function bidi(str, startLevel = -1, vertical = false) {
  46112. let isLTR = true;
  46113. const strLength = str.length;
  46114. if (strLength === 0 || vertical) {
  46115. return createBidiText(str, isLTR, vertical);
  46116. }
  46117. chars.length = strLength;
  46118. types.length = strLength;
  46119. let numBidi = 0;
  46120. let i, ii;
  46121. for (i = 0; i < strLength; ++i) {
  46122. chars[i] = str.charAt(i);
  46123. const charCode = str.charCodeAt(i);
  46124. let charType = "L";
  46125. if (charCode <= 0x00ff) {
  46126. charType = baseTypes[charCode];
  46127. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  46128. charType = "R";
  46129. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  46130. charType = arabicTypes[charCode & 0xff];
  46131. if (!charType) {
  46132. (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16));
  46133. }
  46134. } else if (0x0700 <= charCode && charCode <= 0x08ac) {
  46135. charType = "AL";
  46136. }
  46137. if (charType === "R" || charType === "AL" || charType === "AN") {
  46138. numBidi++;
  46139. }
  46140. types[i] = charType;
  46141. }
  46142. if (numBidi === 0) {
  46143. isLTR = true;
  46144. return createBidiText(str, isLTR);
  46145. }
  46146. if (startLevel === -1) {
  46147. if (numBidi / strLength < 0.3 && strLength > 4) {
  46148. isLTR = true;
  46149. startLevel = 0;
  46150. } else {
  46151. isLTR = false;
  46152. startLevel = 1;
  46153. }
  46154. }
  46155. const levels = [];
  46156. for (i = 0; i < strLength; ++i) {
  46157. levels[i] = startLevel;
  46158. }
  46159. const e = isOdd(startLevel) ? "R" : "L";
  46160. const sor = e;
  46161. const eor = sor;
  46162. let lastType = sor;
  46163. for (i = 0; i < strLength; ++i) {
  46164. if (types[i] === "NSM") {
  46165. types[i] = lastType;
  46166. } else {
  46167. lastType = types[i];
  46168. }
  46169. }
  46170. lastType = sor;
  46171. let t;
  46172. for (i = 0; i < strLength; ++i) {
  46173. t = types[i];
  46174. if (t === "EN") {
  46175. types[i] = lastType === "AL" ? "AN" : "EN";
  46176. } else if (t === "R" || t === "L" || t === "AL") {
  46177. lastType = t;
  46178. }
  46179. }
  46180. for (i = 0; i < strLength; ++i) {
  46181. t = types[i];
  46182. if (t === "AL") {
  46183. types[i] = "R";
  46184. }
  46185. }
  46186. for (i = 1; i < strLength - 1; ++i) {
  46187. if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
  46188. types[i] = "EN";
  46189. }
  46190. if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
  46191. types[i] = types[i - 1];
  46192. }
  46193. }
  46194. for (i = 0; i < strLength; ++i) {
  46195. if (types[i] === "EN") {
  46196. for (let j = i - 1; j >= 0; --j) {
  46197. if (types[j] !== "ET") {
  46198. break;
  46199. }
  46200. types[j] = "EN";
  46201. }
  46202. for (let j = i + 1; j < strLength; ++j) {
  46203. if (types[j] !== "ET") {
  46204. break;
  46205. }
  46206. types[j] = "EN";
  46207. }
  46208. }
  46209. }
  46210. for (i = 0; i < strLength; ++i) {
  46211. t = types[i];
  46212. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  46213. types[i] = "ON";
  46214. }
  46215. }
  46216. lastType = sor;
  46217. for (i = 0; i < strLength; ++i) {
  46218. t = types[i];
  46219. if (t === "EN") {
  46220. types[i] = lastType === "L" ? "L" : "EN";
  46221. } else if (t === "R" || t === "L") {
  46222. lastType = t;
  46223. }
  46224. }
  46225. for (i = 0; i < strLength; ++i) {
  46226. if (types[i] === "ON") {
  46227. const end = findUnequal(types, i + 1, "ON");
  46228. let before = sor;
  46229. if (i > 0) {
  46230. before = types[i - 1];
  46231. }
  46232. let after = eor;
  46233. if (end + 1 < strLength) {
  46234. after = types[end + 1];
  46235. }
  46236. if (before !== "L") {
  46237. before = "R";
  46238. }
  46239. if (after !== "L") {
  46240. after = "R";
  46241. }
  46242. if (before === after) {
  46243. setValues(types, i, end, before);
  46244. }
  46245. i = end - 1;
  46246. }
  46247. }
  46248. for (i = 0; i < strLength; ++i) {
  46249. if (types[i] === "ON") {
  46250. types[i] = e;
  46251. }
  46252. }
  46253. for (i = 0; i < strLength; ++i) {
  46254. t = types[i];
  46255. if (isEven(levels[i])) {
  46256. if (t === "R") {
  46257. levels[i] += 1;
  46258. } else if (t === "AN" || t === "EN") {
  46259. levels[i] += 2;
  46260. }
  46261. } else {
  46262. if (t === "L" || t === "AN" || t === "EN") {
  46263. levels[i] += 1;
  46264. }
  46265. }
  46266. }
  46267. let highestLevel = -1;
  46268. let lowestOddLevel = 99;
  46269. let level;
  46270. for (i = 0, ii = levels.length; i < ii; ++i) {
  46271. level = levels[i];
  46272. if (highestLevel < level) {
  46273. highestLevel = level;
  46274. }
  46275. if (lowestOddLevel > level && isOdd(level)) {
  46276. lowestOddLevel = level;
  46277. }
  46278. }
  46279. for (level = highestLevel; level >= lowestOddLevel; --level) {
  46280. let start = -1;
  46281. for (i = 0, ii = levels.length; i < ii; ++i) {
  46282. if (levels[i] < level) {
  46283. if (start >= 0) {
  46284. reverseValues(chars, start, i);
  46285. start = -1;
  46286. }
  46287. } else if (start < 0) {
  46288. start = i;
  46289. }
  46290. }
  46291. if (start >= 0) {
  46292. reverseValues(chars, start, levels.length);
  46293. }
  46294. }
  46295. for (i = 0, ii = chars.length; i < ii; ++i) {
  46296. const ch = chars[i];
  46297. if (ch === "<" || ch === ">") {
  46298. chars[i] = "";
  46299. }
  46300. }
  46301. return createBidiText(chars.join(""), isLTR);
  46302. }
  46303. /***/ }),
  46304. /* 59 */
  46305. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46306. Object.defineProperty(exports, "__esModule", ({
  46307. value: true
  46308. }));
  46309. exports.MurmurHash3_64 = void 0;
  46310. var _util = __w_pdfjs_require__(2);
  46311. const SEED = 0xc3d2e1f0;
  46312. const MASK_HIGH = 0xffff0000;
  46313. const MASK_LOW = 0xffff;
  46314. class MurmurHash3_64 {
  46315. constructor(seed) {
  46316. this.h1 = seed ? seed & 0xffffffff : SEED;
  46317. this.h2 = seed ? seed & 0xffffffff : SEED;
  46318. }
  46319. update(input) {
  46320. let data, length;
  46321. if (typeof input === "string") {
  46322. data = new Uint8Array(input.length * 2);
  46323. length = 0;
  46324. for (let i = 0, ii = input.length; i < ii; i++) {
  46325. const code = input.charCodeAt(i);
  46326. if (code <= 0xff) {
  46327. data[length++] = code;
  46328. } else {
  46329. data[length++] = code >>> 8;
  46330. data[length++] = code & 0xff;
  46331. }
  46332. }
  46333. } else if ((0, _util.isArrayBuffer)(input)) {
  46334. data = input.slice();
  46335. length = data.byteLength;
  46336. } else {
  46337. throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
  46338. }
  46339. const blockCounts = length >> 2;
  46340. const tailLength = length - blockCounts * 4;
  46341. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  46342. let k1 = 0,
  46343. k2 = 0;
  46344. let h1 = this.h1,
  46345. h2 = this.h2;
  46346. const C1 = 0xcc9e2d51,
  46347. C2 = 0x1b873593;
  46348. const C1_LOW = C1 & MASK_LOW,
  46349. C2_LOW = C2 & MASK_LOW;
  46350. for (let i = 0; i < blockCounts; i++) {
  46351. if (i & 1) {
  46352. k1 = dataUint32[i];
  46353. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  46354. k1 = k1 << 15 | k1 >>> 17;
  46355. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  46356. h1 ^= k1;
  46357. h1 = h1 << 13 | h1 >>> 19;
  46358. h1 = h1 * 5 + 0xe6546b64;
  46359. } else {
  46360. k2 = dataUint32[i];
  46361. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  46362. k2 = k2 << 15 | k2 >>> 17;
  46363. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  46364. h2 ^= k2;
  46365. h2 = h2 << 13 | h2 >>> 19;
  46366. h2 = h2 * 5 + 0xe6546b64;
  46367. }
  46368. }
  46369. k1 = 0;
  46370. switch (tailLength) {
  46371. case 3:
  46372. k1 ^= data[blockCounts * 4 + 2] << 16;
  46373. case 2:
  46374. k1 ^= data[blockCounts * 4 + 1] << 8;
  46375. case 1:
  46376. k1 ^= data[blockCounts * 4];
  46377. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  46378. k1 = k1 << 15 | k1 >>> 17;
  46379. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  46380. if (blockCounts & 1) {
  46381. h1 ^= k1;
  46382. } else {
  46383. h2 ^= k1;
  46384. }
  46385. }
  46386. this.h1 = h1;
  46387. this.h2 = h2;
  46388. }
  46389. hexdigest() {
  46390. let h1 = this.h1,
  46391. h2 = this.h2;
  46392. h1 ^= h2 >>> 1;
  46393. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  46394. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  46395. h1 ^= h2 >>> 1;
  46396. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  46397. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  46398. h1 ^= h2 >>> 1;
  46399. return (h1 >>> 0).toString(16).padStart(8, "0") + (h2 >>> 0).toString(16).padStart(8, "0");
  46400. }
  46401. }
  46402. exports.MurmurHash3_64 = MurmurHash3_64;
  46403. /***/ }),
  46404. /* 60 */
  46405. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46406. Object.defineProperty(exports, "__esModule", ({
  46407. value: true
  46408. }));
  46409. exports.OperatorList = void 0;
  46410. var _util = __w_pdfjs_require__(2);
  46411. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  46412. let state = parentState;
  46413. for (let i = 0, ii = pattern.length - 1; i < ii; i++) {
  46414. const item = pattern[i];
  46415. state = state[item] || (state[item] = []);
  46416. }
  46417. state[pattern.at(-1)] = {
  46418. checkFn,
  46419. iterateFn,
  46420. processFn
  46421. };
  46422. }
  46423. const InitialState = [];
  46424. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
  46425. const fnArray = context.fnArray;
  46426. const iFirstSave = context.iCurr - 3;
  46427. const pos = (i - iFirstSave) % 4;
  46428. switch (pos) {
  46429. case 0:
  46430. return fnArray[i] === _util.OPS.save;
  46431. case 1:
  46432. return fnArray[i] === _util.OPS.transform;
  46433. case 2:
  46434. return fnArray[i] === _util.OPS.paintInlineImageXObject;
  46435. case 3:
  46436. return fnArray[i] === _util.OPS.restore;
  46437. }
  46438. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  46439. }, function foundInlineImageGroup(context, i) {
  46440. const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  46441. const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  46442. const MAX_WIDTH = 1000;
  46443. const IMAGE_PADDING = 1;
  46444. const fnArray = context.fnArray,
  46445. argsArray = context.argsArray;
  46446. const curr = context.iCurr;
  46447. const iFirstSave = curr - 3;
  46448. const iFirstTransform = curr - 2;
  46449. const iFirstPIIXO = curr - 1;
  46450. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  46451. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  46452. return i - (i - iFirstSave) % 4;
  46453. }
  46454. let maxX = 0;
  46455. const map = [];
  46456. let maxLineHeight = 0;
  46457. let currentX = IMAGE_PADDING,
  46458. currentY = IMAGE_PADDING;
  46459. for (let q = 0; q < count; q++) {
  46460. const transform = argsArray[iFirstTransform + (q << 2)];
  46461. const img = argsArray[iFirstPIIXO + (q << 2)][0];
  46462. if (currentX + img.width > MAX_WIDTH) {
  46463. maxX = Math.max(maxX, currentX);
  46464. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  46465. currentX = 0;
  46466. maxLineHeight = 0;
  46467. }
  46468. map.push({
  46469. transform,
  46470. x: currentX,
  46471. y: currentY,
  46472. w: img.width,
  46473. h: img.height
  46474. });
  46475. currentX += img.width + 2 * IMAGE_PADDING;
  46476. maxLineHeight = Math.max(maxLineHeight, img.height);
  46477. }
  46478. const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  46479. const imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  46480. const imgData = new Uint8Array(imgWidth * imgHeight * 4);
  46481. const imgRowSize = imgWidth << 2;
  46482. for (let q = 0; q < count; q++) {
  46483. const data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  46484. const rowSize = map[q].w << 2;
  46485. let dataOffset = 0;
  46486. let offset = map[q].x + map[q].y * imgWidth << 2;
  46487. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  46488. for (let k = 0, kk = map[q].h; k < kk; k++) {
  46489. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  46490. dataOffset += rowSize;
  46491. offset += imgRowSize;
  46492. }
  46493. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  46494. while (offset >= 0) {
  46495. data[offset - 4] = data[offset];
  46496. data[offset - 3] = data[offset + 1];
  46497. data[offset - 2] = data[offset + 2];
  46498. data[offset - 1] = data[offset + 3];
  46499. data[offset + rowSize] = data[offset + rowSize - 4];
  46500. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  46501. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  46502. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  46503. offset -= imgRowSize;
  46504. }
  46505. }
  46506. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
  46507. argsArray.splice(iFirstSave, count * 4, [{
  46508. width: imgWidth,
  46509. height: imgHeight,
  46510. kind: _util.ImageKind.RGBA_32BPP,
  46511. data: imgData
  46512. }, map]);
  46513. return iFirstSave + 1;
  46514. });
  46515. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
  46516. const fnArray = context.fnArray;
  46517. const iFirstSave = context.iCurr - 3;
  46518. const pos = (i - iFirstSave) % 4;
  46519. switch (pos) {
  46520. case 0:
  46521. return fnArray[i] === _util.OPS.save;
  46522. case 1:
  46523. return fnArray[i] === _util.OPS.transform;
  46524. case 2:
  46525. return fnArray[i] === _util.OPS.paintImageMaskXObject;
  46526. case 3:
  46527. return fnArray[i] === _util.OPS.restore;
  46528. }
  46529. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  46530. }, function foundImageMaskGroup(context, i) {
  46531. const MIN_IMAGES_IN_MASKS_BLOCK = 10;
  46532. const MAX_IMAGES_IN_MASKS_BLOCK = 100;
  46533. const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  46534. const fnArray = context.fnArray,
  46535. argsArray = context.argsArray;
  46536. const curr = context.iCurr;
  46537. const iFirstSave = curr - 3;
  46538. const iFirstTransform = curr - 2;
  46539. const iFirstPIMXO = curr - 1;
  46540. let count = Math.floor((i - iFirstSave) / 4);
  46541. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  46542. return i - (i - iFirstSave) % 4;
  46543. }
  46544. let isSameImage = false;
  46545. let iTransform, transformArgs;
  46546. const firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  46547. const firstTransformArg0 = argsArray[iFirstTransform][0],
  46548. firstTransformArg1 = argsArray[iFirstTransform][1],
  46549. firstTransformArg2 = argsArray[iFirstTransform][2],
  46550. firstTransformArg3 = argsArray[iFirstTransform][3];
  46551. if (firstTransformArg1 === firstTransformArg2) {
  46552. isSameImage = true;
  46553. iTransform = iFirstTransform + 4;
  46554. let iPIMXO = iFirstPIMXO + 4;
  46555. for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  46556. transformArgs = argsArray[iTransform];
  46557. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) {
  46558. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  46559. isSameImage = false;
  46560. } else {
  46561. count = q;
  46562. }
  46563. break;
  46564. }
  46565. }
  46566. }
  46567. if (isSameImage) {
  46568. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  46569. const positions = new Float32Array(count * 2);
  46570. iTransform = iFirstTransform;
  46571. for (let q = 0; q < count; q++, iTransform += 4) {
  46572. transformArgs = argsArray[iTransform];
  46573. positions[q << 1] = transformArgs[4];
  46574. positions[(q << 1) + 1] = transformArgs[5];
  46575. }
  46576. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
  46577. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]);
  46578. } else {
  46579. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  46580. const images = [];
  46581. for (let q = 0; q < count; q++) {
  46582. transformArgs = argsArray[iFirstTransform + (q << 2)];
  46583. const maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  46584. images.push({
  46585. data: maskParams.data,
  46586. width: maskParams.width,
  46587. height: maskParams.height,
  46588. interpolate: maskParams.interpolate,
  46589. count: maskParams.count,
  46590. transform: transformArgs
  46591. });
  46592. }
  46593. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
  46594. argsArray.splice(iFirstSave, count * 4, [images]);
  46595. }
  46596. return iFirstSave + 1;
  46597. });
  46598. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
  46599. const argsArray = context.argsArray;
  46600. const iFirstTransform = context.iCurr - 2;
  46601. return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
  46602. }, function iterateImageGroup(context, i) {
  46603. const fnArray = context.fnArray,
  46604. argsArray = context.argsArray;
  46605. const iFirstSave = context.iCurr - 3;
  46606. const pos = (i - iFirstSave) % 4;
  46607. switch (pos) {
  46608. case 0:
  46609. return fnArray[i] === _util.OPS.save;
  46610. case 1:
  46611. if (fnArray[i] !== _util.OPS.transform) {
  46612. return false;
  46613. }
  46614. const iFirstTransform = context.iCurr - 2;
  46615. const firstTransformArg0 = argsArray[iFirstTransform][0];
  46616. const firstTransformArg3 = argsArray[iFirstTransform][3];
  46617. if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
  46618. return false;
  46619. }
  46620. return true;
  46621. case 2:
  46622. if (fnArray[i] !== _util.OPS.paintImageXObject) {
  46623. return false;
  46624. }
  46625. const iFirstPIXO = context.iCurr - 1;
  46626. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  46627. if (argsArray[i][0] !== firstPIXOArg0) {
  46628. return false;
  46629. }
  46630. return true;
  46631. case 3:
  46632. return fnArray[i] === _util.OPS.restore;
  46633. }
  46634. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  46635. }, function (context, i) {
  46636. const MIN_IMAGES_IN_BLOCK = 3;
  46637. const MAX_IMAGES_IN_BLOCK = 1000;
  46638. const fnArray = context.fnArray,
  46639. argsArray = context.argsArray;
  46640. const curr = context.iCurr;
  46641. const iFirstSave = curr - 3;
  46642. const iFirstTransform = curr - 2;
  46643. const iFirstPIXO = curr - 1;
  46644. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  46645. const firstTransformArg0 = argsArray[iFirstTransform][0];
  46646. const firstTransformArg3 = argsArray[iFirstTransform][3];
  46647. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
  46648. if (count < MIN_IMAGES_IN_BLOCK) {
  46649. return i - (i - iFirstSave) % 4;
  46650. }
  46651. const positions = new Float32Array(count * 2);
  46652. let iTransform = iFirstTransform;
  46653. for (let q = 0; q < count; q++, iTransform += 4) {
  46654. const transformArgs = argsArray[iTransform];
  46655. positions[q << 1] = transformArgs[4];
  46656. positions[(q << 1) + 1] = transformArgs[5];
  46657. }
  46658. const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  46659. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
  46660. argsArray.splice(iFirstSave, count * 4, args);
  46661. return iFirstSave + 1;
  46662. });
  46663. addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
  46664. const fnArray = context.fnArray,
  46665. argsArray = context.argsArray;
  46666. const iFirstSave = context.iCurr - 4;
  46667. const pos = (i - iFirstSave) % 5;
  46668. switch (pos) {
  46669. case 0:
  46670. return fnArray[i] === _util.OPS.beginText;
  46671. case 1:
  46672. return fnArray[i] === _util.OPS.setFont;
  46673. case 2:
  46674. return fnArray[i] === _util.OPS.setTextMatrix;
  46675. case 3:
  46676. if (fnArray[i] !== _util.OPS.showText) {
  46677. return false;
  46678. }
  46679. const iFirstSetFont = context.iCurr - 3;
  46680. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  46681. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  46682. if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
  46683. return false;
  46684. }
  46685. return true;
  46686. case 4:
  46687. return fnArray[i] === _util.OPS.endText;
  46688. }
  46689. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  46690. }, function (context, i) {
  46691. const MIN_CHARS_IN_BLOCK = 3;
  46692. const MAX_CHARS_IN_BLOCK = 1000;
  46693. const fnArray = context.fnArray,
  46694. argsArray = context.argsArray;
  46695. const curr = context.iCurr;
  46696. const iFirstBeginText = curr - 4;
  46697. const iFirstSetFont = curr - 3;
  46698. const iFirstSetTextMatrix = curr - 2;
  46699. const iFirstShowText = curr - 1;
  46700. const iFirstEndText = curr;
  46701. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  46702. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  46703. let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
  46704. if (count < MIN_CHARS_IN_BLOCK) {
  46705. return i - (i - iFirstBeginText) % 5;
  46706. }
  46707. let iFirst = iFirstBeginText;
  46708. if (iFirstBeginText >= 4 && fnArray[iFirstBeginText - 4] === fnArray[iFirstSetFont] && fnArray[iFirstBeginText - 3] === fnArray[iFirstSetTextMatrix] && fnArray[iFirstBeginText - 2] === fnArray[iFirstShowText] && fnArray[iFirstBeginText - 1] === fnArray[iFirstEndText] && argsArray[iFirstBeginText - 4][0] === firstSetFontArg0 && argsArray[iFirstBeginText - 4][1] === firstSetFontArg1) {
  46709. count++;
  46710. iFirst -= 5;
  46711. }
  46712. let iEndText = iFirst + 4;
  46713. for (let q = 1; q < count; q++) {
  46714. fnArray.splice(iEndText, 3);
  46715. argsArray.splice(iEndText, 3);
  46716. iEndText += 2;
  46717. }
  46718. return iEndText + 1;
  46719. });
  46720. class NullOptimizer {
  46721. constructor(queue) {
  46722. this.queue = queue;
  46723. }
  46724. _optimize() {}
  46725. push(fn, args) {
  46726. this.queue.fnArray.push(fn);
  46727. this.queue.argsArray.push(args);
  46728. this._optimize();
  46729. }
  46730. flush() {}
  46731. reset() {}
  46732. }
  46733. class QueueOptimizer extends NullOptimizer {
  46734. constructor(queue) {
  46735. super(queue);
  46736. this.state = null;
  46737. this.context = {
  46738. iCurr: 0,
  46739. fnArray: queue.fnArray,
  46740. argsArray: queue.argsArray
  46741. };
  46742. this.match = null;
  46743. this.lastProcessed = 0;
  46744. }
  46745. _optimize() {
  46746. const fnArray = this.queue.fnArray;
  46747. let i = this.lastProcessed,
  46748. ii = fnArray.length;
  46749. let state = this.state;
  46750. let match = this.match;
  46751. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  46752. this.lastProcessed = ii;
  46753. return;
  46754. }
  46755. const context = this.context;
  46756. while (i < ii) {
  46757. if (match) {
  46758. const iterate = (0, match.iterateFn)(context, i);
  46759. if (iterate) {
  46760. i++;
  46761. continue;
  46762. }
  46763. i = (0, match.processFn)(context, i + 1);
  46764. ii = fnArray.length;
  46765. match = null;
  46766. state = null;
  46767. if (i >= ii) {
  46768. break;
  46769. }
  46770. }
  46771. state = (state || InitialState)[fnArray[i]];
  46772. if (!state || Array.isArray(state)) {
  46773. i++;
  46774. continue;
  46775. }
  46776. context.iCurr = i;
  46777. i++;
  46778. if (state.checkFn && !(0, state.checkFn)(context)) {
  46779. state = null;
  46780. continue;
  46781. }
  46782. match = state;
  46783. state = null;
  46784. }
  46785. this.state = state;
  46786. this.match = match;
  46787. this.lastProcessed = i;
  46788. }
  46789. flush() {
  46790. while (this.match) {
  46791. const length = this.queue.fnArray.length;
  46792. this.lastProcessed = (0, this.match.processFn)(this.context, length);
  46793. this.match = null;
  46794. this.state = null;
  46795. this._optimize();
  46796. }
  46797. }
  46798. reset() {
  46799. this.state = null;
  46800. this.match = null;
  46801. this.lastProcessed = 0;
  46802. }
  46803. }
  46804. class OperatorList {
  46805. static get CHUNK_SIZE() {
  46806. return (0, _util.shadow)(this, "CHUNK_SIZE", 1000);
  46807. }
  46808. static get CHUNK_SIZE_ABOUT() {
  46809. return (0, _util.shadow)(this, "CHUNK_SIZE_ABOUT", this.CHUNK_SIZE - 5);
  46810. }
  46811. constructor(intent = 0, streamSink) {
  46812. this._streamSink = streamSink;
  46813. this.fnArray = [];
  46814. this.argsArray = [];
  46815. if (streamSink && !(intent & _util.RenderingIntentFlag.OPLIST)) {
  46816. this.optimizer = new QueueOptimizer(this);
  46817. } else {
  46818. this.optimizer = new NullOptimizer(this);
  46819. }
  46820. this.dependencies = new Set();
  46821. this._totalLength = 0;
  46822. this.weight = 0;
  46823. this._resolved = streamSink ? null : Promise.resolve();
  46824. }
  46825. get length() {
  46826. return this.argsArray.length;
  46827. }
  46828. get ready() {
  46829. return this._resolved || this._streamSink.ready;
  46830. }
  46831. get totalLength() {
  46832. return this._totalLength + this.length;
  46833. }
  46834. addOp(fn, args) {
  46835. this.optimizer.push(fn, args);
  46836. this.weight++;
  46837. if (this._streamSink) {
  46838. if (this.weight >= OperatorList.CHUNK_SIZE) {
  46839. this.flush();
  46840. } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
  46841. this.flush();
  46842. }
  46843. }
  46844. }
  46845. addImageOps(fn, args, optionalContent) {
  46846. if (optionalContent !== undefined) {
  46847. this.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  46848. }
  46849. this.addOp(fn, args);
  46850. if (optionalContent !== undefined) {
  46851. this.addOp(_util.OPS.endMarkedContent, []);
  46852. }
  46853. }
  46854. addDependency(dependency) {
  46855. if (this.dependencies.has(dependency)) {
  46856. return;
  46857. }
  46858. this.dependencies.add(dependency);
  46859. this.addOp(_util.OPS.dependency, [dependency]);
  46860. }
  46861. addDependencies(dependencies) {
  46862. for (const dependency of dependencies) {
  46863. this.addDependency(dependency);
  46864. }
  46865. }
  46866. addOpList(opList) {
  46867. if (!(opList instanceof OperatorList)) {
  46868. (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
  46869. return;
  46870. }
  46871. for (const dependency of opList.dependencies) {
  46872. this.dependencies.add(dependency);
  46873. }
  46874. for (let i = 0, ii = opList.length; i < ii; i++) {
  46875. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  46876. }
  46877. }
  46878. getIR() {
  46879. return {
  46880. fnArray: this.fnArray,
  46881. argsArray: this.argsArray,
  46882. length: this.length
  46883. };
  46884. }
  46885. get _transfers() {
  46886. const transfers = [];
  46887. const {
  46888. fnArray,
  46889. argsArray,
  46890. length
  46891. } = this;
  46892. for (let i = 0; i < length; i++) {
  46893. switch (fnArray[i]) {
  46894. case _util.OPS.paintInlineImageXObject:
  46895. case _util.OPS.paintInlineImageXObjectGroup:
  46896. case _util.OPS.paintImageMaskXObject:
  46897. const arg = argsArray[i][0];
  46898. if (!arg.cached && arg.data && arg.data.buffer instanceof ArrayBuffer) {
  46899. transfers.push(arg.data.buffer);
  46900. }
  46901. break;
  46902. }
  46903. }
  46904. return transfers;
  46905. }
  46906. flush(lastChunk = false, separateAnnots = null) {
  46907. this.optimizer.flush();
  46908. const length = this.length;
  46909. this._totalLength += length;
  46910. this._streamSink.enqueue({
  46911. fnArray: this.fnArray,
  46912. argsArray: this.argsArray,
  46913. lastChunk,
  46914. separateAnnots,
  46915. length
  46916. }, 1, this._transfers);
  46917. this.dependencies.clear();
  46918. this.fnArray.length = 0;
  46919. this.argsArray.length = 0;
  46920. this.weight = 0;
  46921. this.optimizer.reset();
  46922. }
  46923. }
  46924. exports.OperatorList = OperatorList;
  46925. /***/ }),
  46926. /* 61 */
  46927. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46928. Object.defineProperty(exports, "__esModule", ({
  46929. value: true
  46930. }));
  46931. exports.PDFImage = void 0;
  46932. var _util = __w_pdfjs_require__(2);
  46933. var _image_utils = __w_pdfjs_require__(62);
  46934. var _base_stream = __w_pdfjs_require__(5);
  46935. var _colorspace = __w_pdfjs_require__(12);
  46936. var _decode_stream = __w_pdfjs_require__(17);
  46937. var _jpeg_stream = __w_pdfjs_require__(25);
  46938. var _jpx = __w_pdfjs_require__(28);
  46939. var _primitives = __w_pdfjs_require__(3);
  46940. function decodeAndClamp(value, addend, coefficient, max) {
  46941. value = addend + value * coefficient;
  46942. if (value < 0) {
  46943. value = 0;
  46944. } else if (value > max) {
  46945. value = max;
  46946. }
  46947. return value;
  46948. }
  46949. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  46950. const length = w2 * h2;
  46951. let dest;
  46952. if (bpc <= 8) {
  46953. dest = new Uint8Array(length);
  46954. } else if (bpc <= 16) {
  46955. dest = new Uint16Array(length);
  46956. } else {
  46957. dest = new Uint32Array(length);
  46958. }
  46959. const xRatio = w1 / w2;
  46960. const yRatio = h1 / h2;
  46961. let i,
  46962. j,
  46963. py,
  46964. newIndex = 0,
  46965. oldIndex;
  46966. const xScaled = new Uint16Array(w2);
  46967. const w1Scanline = w1;
  46968. for (i = 0; i < w2; i++) {
  46969. xScaled[i] = Math.floor(i * xRatio);
  46970. }
  46971. for (i = 0; i < h2; i++) {
  46972. py = Math.floor(i * yRatio) * w1Scanline;
  46973. for (j = 0; j < w2; j++) {
  46974. oldIndex = py + xScaled[j];
  46975. dest[newIndex++] = src[oldIndex];
  46976. }
  46977. }
  46978. return dest;
  46979. }
  46980. class PDFImage {
  46981. constructor({
  46982. xref,
  46983. res,
  46984. image,
  46985. isInline = false,
  46986. smask = null,
  46987. mask = null,
  46988. isMask = false,
  46989. pdfFunctionFactory,
  46990. localColorSpaceCache
  46991. }) {
  46992. this.image = image;
  46993. const dict = image.dict;
  46994. const filter = dict.get("F", "Filter");
  46995. let filterName;
  46996. if (filter instanceof _primitives.Name) {
  46997. filterName = filter.name;
  46998. } else if (Array.isArray(filter)) {
  46999. const filterZero = xref.fetchIfRef(filter[0]);
  47000. if (filterZero instanceof _primitives.Name) {
  47001. filterName = filterZero.name;
  47002. }
  47003. }
  47004. switch (filterName) {
  47005. case "JPXDecode":
  47006. const jpxImage = new _jpx.JpxImage();
  47007. jpxImage.parseImageProperties(image.stream);
  47008. image.stream.reset();
  47009. image.width = jpxImage.width;
  47010. image.height = jpxImage.height;
  47011. image.bitsPerComponent = jpxImage.bitsPerComponent;
  47012. image.numComps = jpxImage.componentsCount;
  47013. break;
  47014. case "JBIG2Decode":
  47015. image.bitsPerComponent = 1;
  47016. image.numComps = 1;
  47017. break;
  47018. }
  47019. let width = dict.get("W", "Width");
  47020. let height = dict.get("H", "Height");
  47021. if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
  47022. (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
  47023. width = image.width;
  47024. height = image.height;
  47025. }
  47026. if (width < 1 || height < 1) {
  47027. throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`);
  47028. }
  47029. this.width = width;
  47030. this.height = height;
  47031. this.interpolate = dict.get("I", "Interpolate");
  47032. this.imageMask = dict.get("IM", "ImageMask") || false;
  47033. this.matte = dict.get("Matte") || false;
  47034. let bitsPerComponent = image.bitsPerComponent;
  47035. if (!bitsPerComponent) {
  47036. bitsPerComponent = dict.get("BPC", "BitsPerComponent");
  47037. if (!bitsPerComponent) {
  47038. if (this.imageMask) {
  47039. bitsPerComponent = 1;
  47040. } else {
  47041. throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`);
  47042. }
  47043. }
  47044. }
  47045. this.bpc = bitsPerComponent;
  47046. if (!this.imageMask) {
  47047. let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace");
  47048. if (!colorSpace) {
  47049. (0, _util.info)("JPX images (which do not require color spaces)");
  47050. switch (image.numComps) {
  47051. case 1:
  47052. colorSpace = _primitives.Name.get("DeviceGray");
  47053. break;
  47054. case 3:
  47055. colorSpace = _primitives.Name.get("DeviceRGB");
  47056. break;
  47057. case 4:
  47058. colorSpace = _primitives.Name.get("DeviceCMYK");
  47059. break;
  47060. default:
  47061. throw new Error(`JPX images with ${image.numComps} color components not supported.`);
  47062. }
  47063. }
  47064. this.colorSpace = _colorspace.ColorSpace.parse({
  47065. cs: colorSpace,
  47066. xref,
  47067. resources: isInline ? res : null,
  47068. pdfFunctionFactory,
  47069. localColorSpaceCache
  47070. });
  47071. this.numComps = this.colorSpace.numComps;
  47072. }
  47073. this.decode = dict.getArray("D", "Decode");
  47074. this.needsDecode = false;
  47075. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
  47076. this.needsDecode = true;
  47077. const max = (1 << bitsPerComponent) - 1;
  47078. this.decodeCoefficients = [];
  47079. this.decodeAddends = [];
  47080. const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed";
  47081. for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  47082. const dmin = this.decode[i];
  47083. const dmax = this.decode[i + 1];
  47084. this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
  47085. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  47086. }
  47087. }
  47088. if (smask) {
  47089. this.smask = new PDFImage({
  47090. xref,
  47091. res,
  47092. image: smask,
  47093. isInline,
  47094. pdfFunctionFactory,
  47095. localColorSpaceCache
  47096. });
  47097. } else if (mask) {
  47098. if (mask instanceof _base_stream.BaseStream) {
  47099. const maskDict = mask.dict,
  47100. imageMask = maskDict.get("IM", "ImageMask");
  47101. if (!imageMask) {
  47102. (0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
  47103. } else {
  47104. this.mask = new PDFImage({
  47105. xref,
  47106. res,
  47107. image: mask,
  47108. isInline,
  47109. isMask: true,
  47110. pdfFunctionFactory,
  47111. localColorSpaceCache
  47112. });
  47113. }
  47114. } else {
  47115. this.mask = mask;
  47116. }
  47117. }
  47118. }
  47119. static async buildImage({
  47120. xref,
  47121. res,
  47122. image,
  47123. isInline = false,
  47124. pdfFunctionFactory,
  47125. localColorSpaceCache
  47126. }) {
  47127. const imageData = image;
  47128. let smaskData = null;
  47129. let maskData = null;
  47130. const smask = image.dict.get("SMask");
  47131. const mask = image.dict.get("Mask");
  47132. if (smask) {
  47133. if (smask instanceof _base_stream.BaseStream) {
  47134. smaskData = smask;
  47135. } else {
  47136. (0, _util.warn)("Unsupported /SMask format.");
  47137. }
  47138. } else if (mask) {
  47139. if (mask instanceof _base_stream.BaseStream || Array.isArray(mask)) {
  47140. maskData = mask;
  47141. } else {
  47142. (0, _util.warn)("Unsupported /Mask format.");
  47143. }
  47144. }
  47145. return new PDFImage({
  47146. xref,
  47147. res,
  47148. image: imageData,
  47149. isInline,
  47150. smask: smaskData,
  47151. mask: maskData,
  47152. pdfFunctionFactory,
  47153. localColorSpaceCache
  47154. });
  47155. }
  47156. static createRawMask({
  47157. imgArray,
  47158. width,
  47159. height,
  47160. imageIsFromDecodeStream,
  47161. inverseDecode,
  47162. interpolate
  47163. }) {
  47164. const computedLength = (width + 7 >> 3) * height;
  47165. const actualLength = imgArray.byteLength;
  47166. const haveFullData = computedLength === actualLength;
  47167. let data, i;
  47168. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  47169. data = imgArray;
  47170. } else if (!inverseDecode) {
  47171. data = new Uint8Array(imgArray);
  47172. } else {
  47173. data = new Uint8Array(computedLength);
  47174. data.set(imgArray);
  47175. data.fill(0xff, actualLength);
  47176. }
  47177. if (inverseDecode) {
  47178. for (i = 0; i < actualLength; i++) {
  47179. data[i] ^= 0xff;
  47180. }
  47181. }
  47182. return {
  47183. data,
  47184. width,
  47185. height,
  47186. interpolate
  47187. };
  47188. }
  47189. static createMask({
  47190. imgArray,
  47191. width,
  47192. height,
  47193. imageIsFromDecodeStream,
  47194. inverseDecode,
  47195. interpolate,
  47196. isOffscreenCanvasSupported = true
  47197. }) {
  47198. const isSingleOpaquePixel = width === 1 && height === 1 && inverseDecode === (imgArray.length === 0 || !!(imgArray[0] & 128));
  47199. if (isSingleOpaquePixel) {
  47200. return {
  47201. isSingleOpaquePixel
  47202. };
  47203. }
  47204. if (isOffscreenCanvasSupported && _util.FeatureTest.isOffscreenCanvasSupported) {
  47205. const canvas = new OffscreenCanvas(width, height);
  47206. const ctx = canvas.getContext("2d");
  47207. const imgData = ctx.createImageData(width, height);
  47208. (0, _image_utils.applyMaskImageData)({
  47209. src: imgArray,
  47210. dest: imgData.data,
  47211. width,
  47212. height,
  47213. inverseDecode
  47214. });
  47215. ctx.putImageData(imgData, 0, 0);
  47216. const bitmap = canvas.transferToImageBitmap();
  47217. return {
  47218. data: null,
  47219. width,
  47220. height,
  47221. interpolate,
  47222. bitmap
  47223. };
  47224. }
  47225. return this.createRawMask({
  47226. imgArray,
  47227. width,
  47228. height,
  47229. inverseDecode,
  47230. imageIsFromDecodeStream,
  47231. interpolate
  47232. });
  47233. }
  47234. get drawWidth() {
  47235. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  47236. }
  47237. get drawHeight() {
  47238. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  47239. }
  47240. decodeBuffer(buffer) {
  47241. const bpc = this.bpc;
  47242. const numComps = this.numComps;
  47243. const decodeAddends = this.decodeAddends;
  47244. const decodeCoefficients = this.decodeCoefficients;
  47245. const max = (1 << bpc) - 1;
  47246. let i, ii;
  47247. if (bpc === 1) {
  47248. for (i = 0, ii = buffer.length; i < ii; i++) {
  47249. buffer[i] = +!buffer[i];
  47250. }
  47251. return;
  47252. }
  47253. let index = 0;
  47254. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  47255. for (let j = 0; j < numComps; j++) {
  47256. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  47257. index++;
  47258. }
  47259. }
  47260. }
  47261. getComponents(buffer) {
  47262. const bpc = this.bpc;
  47263. if (bpc === 8) {
  47264. return buffer;
  47265. }
  47266. const width = this.width;
  47267. const height = this.height;
  47268. const numComps = this.numComps;
  47269. const length = width * height * numComps;
  47270. let bufferPos = 0;
  47271. let output;
  47272. if (bpc <= 8) {
  47273. output = new Uint8Array(length);
  47274. } else if (bpc <= 16) {
  47275. output = new Uint16Array(length);
  47276. } else {
  47277. output = new Uint32Array(length);
  47278. }
  47279. const rowComps = width * numComps;
  47280. const max = (1 << bpc) - 1;
  47281. let i = 0,
  47282. ii,
  47283. buf;
  47284. if (bpc === 1) {
  47285. let mask, loop1End, loop2End;
  47286. for (let j = 0; j < height; j++) {
  47287. loop1End = i + (rowComps & ~7);
  47288. loop2End = i + rowComps;
  47289. while (i < loop1End) {
  47290. buf = buffer[bufferPos++];
  47291. output[i] = buf >> 7 & 1;
  47292. output[i + 1] = buf >> 6 & 1;
  47293. output[i + 2] = buf >> 5 & 1;
  47294. output[i + 3] = buf >> 4 & 1;
  47295. output[i + 4] = buf >> 3 & 1;
  47296. output[i + 5] = buf >> 2 & 1;
  47297. output[i + 6] = buf >> 1 & 1;
  47298. output[i + 7] = buf & 1;
  47299. i += 8;
  47300. }
  47301. if (i < loop2End) {
  47302. buf = buffer[bufferPos++];
  47303. mask = 128;
  47304. while (i < loop2End) {
  47305. output[i++] = +!!(buf & mask);
  47306. mask >>= 1;
  47307. }
  47308. }
  47309. }
  47310. } else {
  47311. let bits = 0;
  47312. buf = 0;
  47313. for (i = 0, ii = length; i < ii; ++i) {
  47314. if (i % rowComps === 0) {
  47315. buf = 0;
  47316. bits = 0;
  47317. }
  47318. while (bits < bpc) {
  47319. buf = buf << 8 | buffer[bufferPos++];
  47320. bits += 8;
  47321. }
  47322. const remainingBits = bits - bpc;
  47323. let value = buf >> remainingBits;
  47324. if (value < 0) {
  47325. value = 0;
  47326. } else if (value > max) {
  47327. value = max;
  47328. }
  47329. output[i] = value;
  47330. buf &= (1 << remainingBits) - 1;
  47331. bits = remainingBits;
  47332. }
  47333. }
  47334. return output;
  47335. }
  47336. fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  47337. const smask = this.smask;
  47338. const mask = this.mask;
  47339. let alphaBuf, sw, sh, i, ii, j;
  47340. if (smask) {
  47341. sw = smask.width;
  47342. sh = smask.height;
  47343. alphaBuf = new Uint8ClampedArray(sw * sh);
  47344. smask.fillGrayBuffer(alphaBuf);
  47345. if (sw !== width || sh !== height) {
  47346. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  47347. }
  47348. } else if (mask) {
  47349. if (mask instanceof PDFImage) {
  47350. sw = mask.width;
  47351. sh = mask.height;
  47352. alphaBuf = new Uint8ClampedArray(sw * sh);
  47353. mask.numComps = 1;
  47354. mask.fillGrayBuffer(alphaBuf);
  47355. for (i = 0, ii = sw * sh; i < ii; ++i) {
  47356. alphaBuf[i] = 255 - alphaBuf[i];
  47357. }
  47358. if (sw !== width || sh !== height) {
  47359. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  47360. }
  47361. } else if (Array.isArray(mask)) {
  47362. alphaBuf = new Uint8ClampedArray(width * height);
  47363. const numComps = this.numComps;
  47364. for (i = 0, ii = width * height; i < ii; ++i) {
  47365. let opacity = 0;
  47366. const imageOffset = i * numComps;
  47367. for (j = 0; j < numComps; ++j) {
  47368. const color = image[imageOffset + j];
  47369. const maskOffset = j * 2;
  47370. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  47371. opacity = 255;
  47372. break;
  47373. }
  47374. }
  47375. alphaBuf[i] = opacity;
  47376. }
  47377. } else {
  47378. throw new _util.FormatError("Unknown mask format.");
  47379. }
  47380. }
  47381. if (alphaBuf) {
  47382. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  47383. rgbaBuf[j] = alphaBuf[i];
  47384. }
  47385. } else {
  47386. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  47387. rgbaBuf[j] = 255;
  47388. }
  47389. }
  47390. }
  47391. undoPreblend(buffer, width, height) {
  47392. const matte = this.smask && this.smask.matte;
  47393. if (!matte) {
  47394. return;
  47395. }
  47396. const matteRgb = this.colorSpace.getRgb(matte, 0);
  47397. const matteR = matteRgb[0];
  47398. const matteG = matteRgb[1];
  47399. const matteB = matteRgb[2];
  47400. const length = width * height * 4;
  47401. for (let i = 0; i < length; i += 4) {
  47402. const alpha = buffer[i + 3];
  47403. if (alpha === 0) {
  47404. buffer[i] = 255;
  47405. buffer[i + 1] = 255;
  47406. buffer[i + 2] = 255;
  47407. continue;
  47408. }
  47409. const k = 255 / alpha;
  47410. buffer[i] = (buffer[i] - matteR) * k + matteR;
  47411. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  47412. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  47413. }
  47414. }
  47415. createImageData(forceRGBA = false) {
  47416. const drawWidth = this.drawWidth;
  47417. const drawHeight = this.drawHeight;
  47418. const imgData = {
  47419. width: drawWidth,
  47420. height: drawHeight,
  47421. interpolate: this.interpolate,
  47422. kind: 0,
  47423. data: null
  47424. };
  47425. const numComps = this.numComps;
  47426. const originalWidth = this.width;
  47427. const originalHeight = this.height;
  47428. const bpc = this.bpc;
  47429. const rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  47430. if (!forceRGBA) {
  47431. let kind;
  47432. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  47433. kind = _util.ImageKind.GRAYSCALE_1BPP;
  47434. } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
  47435. kind = _util.ImageKind.RGB_24BPP;
  47436. }
  47437. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  47438. imgData.kind = kind;
  47439. imgData.data = this.getImageBytes(originalHeight * rowBytes, {});
  47440. if (this.needsDecode) {
  47441. (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
  47442. const buffer = imgData.data;
  47443. for (let i = 0, ii = buffer.length; i < ii; i++) {
  47444. buffer[i] ^= 0xff;
  47445. }
  47446. }
  47447. return imgData;
  47448. }
  47449. if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
  47450. let imageLength = originalHeight * rowBytes;
  47451. switch (this.colorSpace.name) {
  47452. case "DeviceGray":
  47453. imageLength *= 3;
  47454. case "DeviceRGB":
  47455. case "DeviceCMYK":
  47456. imgData.kind = _util.ImageKind.RGB_24BPP;
  47457. imgData.data = this.getImageBytes(imageLength, {
  47458. drawWidth,
  47459. drawHeight,
  47460. forceRGB: true
  47461. });
  47462. return imgData;
  47463. }
  47464. }
  47465. }
  47466. const imgArray = this.getImageBytes(originalHeight * rowBytes, {
  47467. internal: true
  47468. });
  47469. const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  47470. const comps = this.getComponents(imgArray);
  47471. let alpha01, maybeUndoPreblend;
  47472. if (!forceRGBA && !this.smask && !this.mask) {
  47473. imgData.kind = _util.ImageKind.RGB_24BPP;
  47474. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  47475. alpha01 = 0;
  47476. maybeUndoPreblend = false;
  47477. } else {
  47478. imgData.kind = _util.ImageKind.RGBA_32BPP;
  47479. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  47480. alpha01 = 1;
  47481. maybeUndoPreblend = true;
  47482. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  47483. }
  47484. if (this.needsDecode) {
  47485. this.decodeBuffer(comps);
  47486. }
  47487. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  47488. if (maybeUndoPreblend) {
  47489. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  47490. }
  47491. return imgData;
  47492. }
  47493. fillGrayBuffer(buffer) {
  47494. const numComps = this.numComps;
  47495. if (numComps !== 1) {
  47496. throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`);
  47497. }
  47498. const width = this.width;
  47499. const height = this.height;
  47500. const bpc = this.bpc;
  47501. const rowBytes = width * numComps * bpc + 7 >> 3;
  47502. const imgArray = this.getImageBytes(height * rowBytes, {
  47503. internal: true
  47504. });
  47505. const comps = this.getComponents(imgArray);
  47506. let i, length;
  47507. if (bpc === 1) {
  47508. length = width * height;
  47509. if (this.needsDecode) {
  47510. for (i = 0; i < length; ++i) {
  47511. buffer[i] = comps[i] - 1 & 255;
  47512. }
  47513. } else {
  47514. for (i = 0; i < length; ++i) {
  47515. buffer[i] = -comps[i] & 255;
  47516. }
  47517. }
  47518. return;
  47519. }
  47520. if (this.needsDecode) {
  47521. this.decodeBuffer(comps);
  47522. }
  47523. length = width * height;
  47524. const scale = 255 / ((1 << bpc) - 1);
  47525. for (i = 0; i < length; ++i) {
  47526. buffer[i] = scale * comps[i];
  47527. }
  47528. }
  47529. getImageBytes(length, {
  47530. drawWidth,
  47531. drawHeight,
  47532. forceRGB = false,
  47533. internal = false
  47534. }) {
  47535. this.image.reset();
  47536. this.image.drawWidth = drawWidth || this.width;
  47537. this.image.drawHeight = drawHeight || this.height;
  47538. this.image.forceRGB = !!forceRGB;
  47539. const imageBytes = this.image.getBytes(length);
  47540. if (internal || this.image instanceof _decode_stream.DecodeStream) {
  47541. return imageBytes;
  47542. }
  47543. (0, _util.assert)(imageBytes instanceof Uint8Array, 'PDFImage.getImageBytes: Unsupported "imageBytes" type.');
  47544. return new Uint8Array(imageBytes);
  47545. }
  47546. }
  47547. exports.PDFImage = PDFImage;
  47548. /***/ }),
  47549. /* 62 */
  47550. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47551. Object.defineProperty(exports, "__esModule", ({
  47552. value: true
  47553. }));
  47554. exports.applyMaskImageData = applyMaskImageData;
  47555. var _util = __w_pdfjs_require__(2);
  47556. function applyMaskImageData({
  47557. src,
  47558. srcPos = 0,
  47559. dest,
  47560. destPos = 0,
  47561. width,
  47562. height,
  47563. inverseDecode = false
  47564. }) {
  47565. const opaque = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
  47566. const [zeroMapping, oneMapping] = !inverseDecode ? [opaque, 0] : [0, opaque];
  47567. const widthInSource = width >> 3;
  47568. const widthRemainder = width & 7;
  47569. const srcLength = src.length;
  47570. dest = new Uint32Array(dest.buffer);
  47571. for (let i = 0; i < height; i++) {
  47572. for (const max = srcPos + widthInSource; srcPos < max; srcPos++) {
  47573. const elem = srcPos < srcLength ? src[srcPos] : 255;
  47574. dest[destPos++] = elem & 0b10000000 ? oneMapping : zeroMapping;
  47575. dest[destPos++] = elem & 0b1000000 ? oneMapping : zeroMapping;
  47576. dest[destPos++] = elem & 0b100000 ? oneMapping : zeroMapping;
  47577. dest[destPos++] = elem & 0b10000 ? oneMapping : zeroMapping;
  47578. dest[destPos++] = elem & 0b1000 ? oneMapping : zeroMapping;
  47579. dest[destPos++] = elem & 0b100 ? oneMapping : zeroMapping;
  47580. dest[destPos++] = elem & 0b10 ? oneMapping : zeroMapping;
  47581. dest[destPos++] = elem & 0b1 ? oneMapping : zeroMapping;
  47582. }
  47583. if (widthRemainder === 0) {
  47584. continue;
  47585. }
  47586. const elem = srcPos < srcLength ? src[srcPos++] : 255;
  47587. for (let j = 0; j < widthRemainder; j++) {
  47588. dest[destPos++] = elem & 1 << 7 - j ? oneMapping : zeroMapping;
  47589. }
  47590. }
  47591. return {
  47592. srcPos,
  47593. destPos
  47594. };
  47595. }
  47596. /***/ }),
  47597. /* 63 */
  47598. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47599. Object.defineProperty(exports, "__esModule", ({
  47600. value: true
  47601. }));
  47602. exports.incrementalUpdate = incrementalUpdate;
  47603. exports.writeDict = writeDict;
  47604. exports.writeObject = writeObject;
  47605. var _util = __w_pdfjs_require__(2);
  47606. var _primitives = __w_pdfjs_require__(3);
  47607. var _core_utils = __w_pdfjs_require__(4);
  47608. var _xml_parser = __w_pdfjs_require__(64);
  47609. var _base_stream = __w_pdfjs_require__(5);
  47610. var _crypto = __w_pdfjs_require__(65);
  47611. function writeObject(ref, obj, buffer, transform) {
  47612. buffer.push(`${ref.num} ${ref.gen} obj\n`);
  47613. if (obj instanceof _primitives.Dict) {
  47614. writeDict(obj, buffer, transform);
  47615. } else if (obj instanceof _base_stream.BaseStream) {
  47616. writeStream(obj, buffer, transform);
  47617. }
  47618. buffer.push("\nendobj\n");
  47619. }
  47620. function writeDict(dict, buffer, transform) {
  47621. buffer.push("<<");
  47622. for (const key of dict.getKeys()) {
  47623. buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `);
  47624. writeValue(dict.getRaw(key), buffer, transform);
  47625. }
  47626. buffer.push(">>");
  47627. }
  47628. function writeStream(stream, buffer, transform) {
  47629. writeDict(stream.dict, buffer, transform);
  47630. buffer.push(" stream\n");
  47631. let string = stream.getString();
  47632. if (transform !== null) {
  47633. string = transform.encryptString(string);
  47634. }
  47635. buffer.push(string, "\nendstream");
  47636. }
  47637. function writeArray(array, buffer, transform) {
  47638. buffer.push("[");
  47639. let first = true;
  47640. for (const val of array) {
  47641. if (!first) {
  47642. buffer.push(" ");
  47643. } else {
  47644. first = false;
  47645. }
  47646. writeValue(val, buffer, transform);
  47647. }
  47648. buffer.push("]");
  47649. }
  47650. function writeValue(value, buffer, transform) {
  47651. if (value instanceof _primitives.Name) {
  47652. buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`);
  47653. } else if (value instanceof _primitives.Ref) {
  47654. buffer.push(`${value.num} ${value.gen} R`);
  47655. } else if (Array.isArray(value)) {
  47656. writeArray(value, buffer, transform);
  47657. } else if (typeof value === "string") {
  47658. if (transform !== null) {
  47659. value = transform.encryptString(value);
  47660. }
  47661. buffer.push(`(${(0, _core_utils.escapeString)(value)})`);
  47662. } else if (typeof value === "number") {
  47663. buffer.push((0, _core_utils.numberToString)(value));
  47664. } else if (typeof value === "boolean") {
  47665. buffer.push(value.toString());
  47666. } else if (value instanceof _primitives.Dict) {
  47667. writeDict(value, buffer, transform);
  47668. } else if (value instanceof _base_stream.BaseStream) {
  47669. writeStream(value, buffer, transform);
  47670. } else if (value === null) {
  47671. buffer.push("null");
  47672. } else {
  47673. (0, _util.warn)(`Unhandled value in writer: ${typeof value}, please file a bug.`);
  47674. }
  47675. }
  47676. function writeInt(number, size, offset, buffer) {
  47677. for (let i = size + offset - 1; i > offset - 1; i--) {
  47678. buffer[i] = number & 0xff;
  47679. number >>= 8;
  47680. }
  47681. return offset + size;
  47682. }
  47683. function writeString(string, offset, buffer) {
  47684. for (let i = 0, len = string.length; i < len; i++) {
  47685. buffer[offset + i] = string.charCodeAt(i) & 0xff;
  47686. }
  47687. }
  47688. function computeMD5(filesize, xrefInfo) {
  47689. const time = Math.floor(Date.now() / 1000);
  47690. const filename = xrefInfo.filename || "";
  47691. const md5Buffer = [time.toString(), filename, filesize.toString()];
  47692. let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0);
  47693. for (const value of Object.values(xrefInfo.info)) {
  47694. md5Buffer.push(value);
  47695. md5BufferLen += value.length;
  47696. }
  47697. const array = new Uint8Array(md5BufferLen);
  47698. let offset = 0;
  47699. for (const str of md5Buffer) {
  47700. writeString(str, offset, array);
  47701. offset += str.length;
  47702. }
  47703. return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array));
  47704. }
  47705. function writeXFADataForAcroform(str, newRefs) {
  47706. const xml = new _xml_parser.SimpleXMLParser({
  47707. hasAttributes: true
  47708. }).parseFromString(str);
  47709. for (const {
  47710. xfa
  47711. } of newRefs) {
  47712. if (!xfa) {
  47713. continue;
  47714. }
  47715. const {
  47716. path,
  47717. value
  47718. } = xfa;
  47719. if (!path) {
  47720. continue;
  47721. }
  47722. const node = xml.documentElement.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  47723. if (node) {
  47724. if (Array.isArray(value)) {
  47725. node.childNodes = value.map(val => new _xml_parser.SimpleDOMNode("value", val));
  47726. } else {
  47727. node.childNodes = [new _xml_parser.SimpleDOMNode("#text", value)];
  47728. }
  47729. } else {
  47730. (0, _util.warn)(`Node not found for path: ${path}`);
  47731. }
  47732. }
  47733. const buffer = [];
  47734. xml.documentElement.dump(buffer);
  47735. return buffer.join("");
  47736. }
  47737. function updateAcroform({
  47738. xref,
  47739. acroForm,
  47740. acroFormRef,
  47741. hasXfa,
  47742. hasXfaDatasetsEntry,
  47743. xfaDatasetsRef,
  47744. needAppearances,
  47745. newRefs
  47746. }) {
  47747. if (hasXfa && !hasXfaDatasetsEntry && !xfaDatasetsRef) {
  47748. (0, _util.warn)("XFA - Cannot save it");
  47749. }
  47750. if (!needAppearances && (!hasXfa || !xfaDatasetsRef)) {
  47751. return;
  47752. }
  47753. const dict = new _primitives.Dict(xref);
  47754. for (const key of acroForm.getKeys()) {
  47755. dict.set(key, acroForm.getRaw(key));
  47756. }
  47757. if (hasXfa && !hasXfaDatasetsEntry) {
  47758. const newXfa = acroForm.get("XFA").slice();
  47759. newXfa.splice(2, 0, "datasets");
  47760. newXfa.splice(3, 0, xfaDatasetsRef);
  47761. dict.set("XFA", newXfa);
  47762. }
  47763. if (needAppearances) {
  47764. dict.set("NeedAppearances", true);
  47765. }
  47766. const encrypt = xref.encrypt;
  47767. let transform = null;
  47768. if (encrypt) {
  47769. transform = encrypt.createCipherTransform(acroFormRef.num, acroFormRef.gen);
  47770. }
  47771. const buffer = [];
  47772. writeObject(acroFormRef, dict, buffer, transform);
  47773. newRefs.push({
  47774. ref: acroFormRef,
  47775. data: buffer.join("")
  47776. });
  47777. }
  47778. function updateXFA({
  47779. xfaData,
  47780. xfaDatasetsRef,
  47781. newRefs,
  47782. xref
  47783. }) {
  47784. if (xfaData === null) {
  47785. const datasets = xref.fetchIfRef(xfaDatasetsRef);
  47786. xfaData = writeXFADataForAcroform(datasets.getString(), newRefs);
  47787. }
  47788. const encrypt = xref.encrypt;
  47789. if (encrypt) {
  47790. const transform = encrypt.createCipherTransform(xfaDatasetsRef.num, xfaDatasetsRef.gen);
  47791. xfaData = transform.encryptString(xfaData);
  47792. }
  47793. const data = `${xfaDatasetsRef.num} ${xfaDatasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n";
  47794. newRefs.push({
  47795. ref: xfaDatasetsRef,
  47796. data
  47797. });
  47798. }
  47799. function incrementalUpdate({
  47800. originalData,
  47801. xrefInfo,
  47802. newRefs,
  47803. xref = null,
  47804. hasXfa = false,
  47805. xfaDatasetsRef = null,
  47806. hasXfaDatasetsEntry = false,
  47807. needAppearances,
  47808. acroFormRef = null,
  47809. acroForm = null,
  47810. xfaData = null
  47811. }) {
  47812. updateAcroform({
  47813. xref,
  47814. acroForm,
  47815. acroFormRef,
  47816. hasXfa,
  47817. hasXfaDatasetsEntry,
  47818. xfaDatasetsRef,
  47819. needAppearances,
  47820. newRefs
  47821. });
  47822. if (hasXfa) {
  47823. updateXFA({
  47824. xfaData,
  47825. xfaDatasetsRef,
  47826. newRefs,
  47827. xref
  47828. });
  47829. }
  47830. const newXref = new _primitives.Dict(null);
  47831. const refForXrefTable = xrefInfo.newRef;
  47832. let buffer, baseOffset;
  47833. const lastByte = originalData.at(-1);
  47834. if (lastByte === 0x0a || lastByte === 0x0d) {
  47835. buffer = [];
  47836. baseOffset = originalData.length;
  47837. } else {
  47838. buffer = ["\n"];
  47839. baseOffset = originalData.length + 1;
  47840. }
  47841. newXref.set("Size", refForXrefTable.num + 1);
  47842. newXref.set("Prev", xrefInfo.startXRef);
  47843. newXref.set("Type", _primitives.Name.get("XRef"));
  47844. if (xrefInfo.rootRef !== null) {
  47845. newXref.set("Root", xrefInfo.rootRef);
  47846. }
  47847. if (xrefInfo.infoRef !== null) {
  47848. newXref.set("Info", xrefInfo.infoRef);
  47849. }
  47850. if (xrefInfo.encryptRef !== null) {
  47851. newXref.set("Encrypt", xrefInfo.encryptRef);
  47852. }
  47853. newRefs.push({
  47854. ref: refForXrefTable,
  47855. data: ""
  47856. });
  47857. newRefs = newRefs.sort((a, b) => {
  47858. return a.ref.num - b.ref.num;
  47859. });
  47860. const xrefTableData = [[0, 1, 0xffff]];
  47861. const indexes = [0, 1];
  47862. let maxOffset = 0;
  47863. for (const {
  47864. ref,
  47865. data
  47866. } of newRefs) {
  47867. maxOffset = Math.max(maxOffset, baseOffset);
  47868. xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]);
  47869. baseOffset += data.length;
  47870. indexes.push(ref.num, 1);
  47871. buffer.push(data);
  47872. }
  47873. newXref.set("Index", indexes);
  47874. if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) {
  47875. const md5 = computeMD5(baseOffset, xrefInfo);
  47876. newXref.set("ID", [xrefInfo.fileIds[0], md5]);
  47877. }
  47878. const offsetSize = Math.ceil(Math.log2(maxOffset) / 8);
  47879. const sizes = [1, offsetSize, 2];
  47880. const structSize = sizes[0] + sizes[1] + sizes[2];
  47881. const tableLength = structSize * xrefTableData.length;
  47882. newXref.set("W", sizes);
  47883. newXref.set("Length", tableLength);
  47884. buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`);
  47885. writeDict(newXref, buffer, null);
  47886. buffer.push(" stream\n");
  47887. const bufferLen = buffer.reduce((a, str) => a + str.length, 0);
  47888. const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`;
  47889. const array = new Uint8Array(originalData.length + bufferLen + tableLength + footer.length);
  47890. array.set(originalData);
  47891. let offset = originalData.length;
  47892. for (const str of buffer) {
  47893. writeString(str, offset, array);
  47894. offset += str.length;
  47895. }
  47896. for (const [type, objOffset, gen] of xrefTableData) {
  47897. offset = writeInt(type, sizes[0], offset, array);
  47898. offset = writeInt(objOffset, sizes[1], offset, array);
  47899. offset = writeInt(gen, sizes[2], offset, array);
  47900. }
  47901. writeString(footer, offset, array);
  47902. return array;
  47903. }
  47904. /***/ }),
  47905. /* 64 */
  47906. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47907. Object.defineProperty(exports, "__esModule", ({
  47908. value: true
  47909. }));
  47910. exports.XMLParserErrorCode = exports.XMLParserBase = exports.SimpleXMLParser = exports.SimpleDOMNode = void 0;
  47911. var _core_utils = __w_pdfjs_require__(4);
  47912. const XMLParserErrorCode = {
  47913. NoError: 0,
  47914. EndOfDocument: -1,
  47915. UnterminatedCdat: -2,
  47916. UnterminatedXmlDeclaration: -3,
  47917. UnterminatedDoctypeDeclaration: -4,
  47918. UnterminatedComment: -5,
  47919. MalformedElement: -6,
  47920. OutOfMemory: -7,
  47921. UnterminatedAttributeValue: -8,
  47922. UnterminatedElement: -9,
  47923. ElementNeverBegun: -10
  47924. };
  47925. exports.XMLParserErrorCode = XMLParserErrorCode;
  47926. function isWhitespace(s, index) {
  47927. const ch = s[index];
  47928. return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
  47929. }
  47930. function isWhitespaceString(s) {
  47931. for (let i = 0, ii = s.length; i < ii; i++) {
  47932. if (!isWhitespace(s, i)) {
  47933. return false;
  47934. }
  47935. }
  47936. return true;
  47937. }
  47938. class XMLParserBase {
  47939. _resolveEntities(s) {
  47940. return s.replace(/&([^;]+);/g, (all, entity) => {
  47941. if (entity.substring(0, 2) === "#x") {
  47942. return String.fromCodePoint(parseInt(entity.substring(2), 16));
  47943. } else if (entity.substring(0, 1) === "#") {
  47944. return String.fromCodePoint(parseInt(entity.substring(1), 10));
  47945. }
  47946. switch (entity) {
  47947. case "lt":
  47948. return "<";
  47949. case "gt":
  47950. return ">";
  47951. case "amp":
  47952. return "&";
  47953. case "quot":
  47954. return '"';
  47955. case "apos":
  47956. return "'";
  47957. }
  47958. return this.onResolveEntity(entity);
  47959. });
  47960. }
  47961. _parseContent(s, start) {
  47962. const attributes = [];
  47963. let pos = start;
  47964. function skipWs() {
  47965. while (pos < s.length && isWhitespace(s, pos)) {
  47966. ++pos;
  47967. }
  47968. }
  47969. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  47970. ++pos;
  47971. }
  47972. const name = s.substring(start, pos);
  47973. skipWs();
  47974. while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
  47975. skipWs();
  47976. let attrName = "",
  47977. attrValue = "";
  47978. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
  47979. attrName += s[pos];
  47980. ++pos;
  47981. }
  47982. skipWs();
  47983. if (s[pos] !== "=") {
  47984. return null;
  47985. }
  47986. ++pos;
  47987. skipWs();
  47988. const attrEndChar = s[pos];
  47989. if (attrEndChar !== '"' && attrEndChar !== "'") {
  47990. return null;
  47991. }
  47992. const attrEndIndex = s.indexOf(attrEndChar, ++pos);
  47993. if (attrEndIndex < 0) {
  47994. return null;
  47995. }
  47996. attrValue = s.substring(pos, attrEndIndex);
  47997. attributes.push({
  47998. name: attrName,
  47999. value: this._resolveEntities(attrValue)
  48000. });
  48001. pos = attrEndIndex + 1;
  48002. skipWs();
  48003. }
  48004. return {
  48005. name,
  48006. attributes,
  48007. parsed: pos - start
  48008. };
  48009. }
  48010. _parseProcessingInstruction(s, start) {
  48011. let pos = start;
  48012. function skipWs() {
  48013. while (pos < s.length && isWhitespace(s, pos)) {
  48014. ++pos;
  48015. }
  48016. }
  48017. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") {
  48018. ++pos;
  48019. }
  48020. const name = s.substring(start, pos);
  48021. skipWs();
  48022. const attrStart = pos;
  48023. while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
  48024. ++pos;
  48025. }
  48026. const value = s.substring(attrStart, pos);
  48027. return {
  48028. name,
  48029. value,
  48030. parsed: pos - start
  48031. };
  48032. }
  48033. parseXml(s) {
  48034. let i = 0;
  48035. while (i < s.length) {
  48036. const ch = s[i];
  48037. let j = i;
  48038. if (ch === "<") {
  48039. ++j;
  48040. const ch2 = s[j];
  48041. let q;
  48042. switch (ch2) {
  48043. case "/":
  48044. ++j;
  48045. q = s.indexOf(">", j);
  48046. if (q < 0) {
  48047. this.onError(XMLParserErrorCode.UnterminatedElement);
  48048. return;
  48049. }
  48050. this.onEndElement(s.substring(j, q));
  48051. j = q + 1;
  48052. break;
  48053. case "?":
  48054. ++j;
  48055. const pi = this._parseProcessingInstruction(s, j);
  48056. if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
  48057. this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
  48058. return;
  48059. }
  48060. this.onPi(pi.name, pi.value);
  48061. j += pi.parsed + 2;
  48062. break;
  48063. case "!":
  48064. if (s.substring(j + 1, j + 3) === "--") {
  48065. q = s.indexOf("-->", j + 3);
  48066. if (q < 0) {
  48067. this.onError(XMLParserErrorCode.UnterminatedComment);
  48068. return;
  48069. }
  48070. this.onComment(s.substring(j + 3, q));
  48071. j = q + 3;
  48072. } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
  48073. q = s.indexOf("]]>", j + 8);
  48074. if (q < 0) {
  48075. this.onError(XMLParserErrorCode.UnterminatedCdat);
  48076. return;
  48077. }
  48078. this.onCdata(s.substring(j + 8, q));
  48079. j = q + 3;
  48080. } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
  48081. const q2 = s.indexOf("[", j + 8);
  48082. let complexDoctype = false;
  48083. q = s.indexOf(">", j + 8);
  48084. if (q < 0) {
  48085. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  48086. return;
  48087. }
  48088. if (q2 > 0 && q > q2) {
  48089. q = s.indexOf("]>", j + 8);
  48090. if (q < 0) {
  48091. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  48092. return;
  48093. }
  48094. complexDoctype = true;
  48095. }
  48096. const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
  48097. this.onDoctype(doctypeContent);
  48098. j = q + (complexDoctype ? 2 : 1);
  48099. } else {
  48100. this.onError(XMLParserErrorCode.MalformedElement);
  48101. return;
  48102. }
  48103. break;
  48104. default:
  48105. const content = this._parseContent(s, j);
  48106. if (content === null) {
  48107. this.onError(XMLParserErrorCode.MalformedElement);
  48108. return;
  48109. }
  48110. let isClosed = false;
  48111. if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
  48112. isClosed = true;
  48113. } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
  48114. this.onError(XMLParserErrorCode.UnterminatedElement);
  48115. return;
  48116. }
  48117. this.onBeginElement(content.name, content.attributes, isClosed);
  48118. j += content.parsed + (isClosed ? 2 : 1);
  48119. break;
  48120. }
  48121. } else {
  48122. while (j < s.length && s[j] !== "<") {
  48123. j++;
  48124. }
  48125. const text = s.substring(i, j);
  48126. this.onText(this._resolveEntities(text));
  48127. }
  48128. i = j;
  48129. }
  48130. }
  48131. onResolveEntity(name) {
  48132. return `&${name};`;
  48133. }
  48134. onPi(name, value) {}
  48135. onComment(text) {}
  48136. onCdata(text) {}
  48137. onDoctype(doctypeContent) {}
  48138. onText(text) {}
  48139. onBeginElement(name, attributes, isEmpty) {}
  48140. onEndElement(name) {}
  48141. onError(code) {}
  48142. }
  48143. exports.XMLParserBase = XMLParserBase;
  48144. class SimpleDOMNode {
  48145. constructor(nodeName, nodeValue) {
  48146. this.nodeName = nodeName;
  48147. this.nodeValue = nodeValue;
  48148. Object.defineProperty(this, "parentNode", {
  48149. value: null,
  48150. writable: true
  48151. });
  48152. }
  48153. get firstChild() {
  48154. return this.childNodes && this.childNodes[0];
  48155. }
  48156. get nextSibling() {
  48157. const childNodes = this.parentNode.childNodes;
  48158. if (!childNodes) {
  48159. return undefined;
  48160. }
  48161. const index = childNodes.indexOf(this);
  48162. if (index === -1) {
  48163. return undefined;
  48164. }
  48165. return childNodes[index + 1];
  48166. }
  48167. get textContent() {
  48168. if (!this.childNodes) {
  48169. return this.nodeValue || "";
  48170. }
  48171. return this.childNodes.map(function (child) {
  48172. return child.textContent;
  48173. }).join("");
  48174. }
  48175. get children() {
  48176. return this.childNodes || [];
  48177. }
  48178. hasChildNodes() {
  48179. return this.childNodes && this.childNodes.length > 0;
  48180. }
  48181. searchNode(paths, pos) {
  48182. if (pos >= paths.length) {
  48183. return this;
  48184. }
  48185. const component = paths[pos];
  48186. const stack = [];
  48187. let node = this;
  48188. while (true) {
  48189. if (component.name === node.nodeName) {
  48190. if (component.pos === 0) {
  48191. const res = node.searchNode(paths, pos + 1);
  48192. if (res !== null) {
  48193. return res;
  48194. }
  48195. } else if (stack.length === 0) {
  48196. return null;
  48197. } else {
  48198. const [parent] = stack.pop();
  48199. let siblingPos = 0;
  48200. for (const child of parent.childNodes) {
  48201. if (component.name === child.nodeName) {
  48202. if (siblingPos === component.pos) {
  48203. return child.searchNode(paths, pos + 1);
  48204. }
  48205. siblingPos++;
  48206. }
  48207. }
  48208. return node.searchNode(paths, pos + 1);
  48209. }
  48210. }
  48211. if (node.childNodes && node.childNodes.length !== 0) {
  48212. stack.push([node, 0]);
  48213. node = node.childNodes[0];
  48214. } else if (stack.length === 0) {
  48215. return null;
  48216. } else {
  48217. while (stack.length !== 0) {
  48218. const [parent, currentPos] = stack.pop();
  48219. const newPos = currentPos + 1;
  48220. if (newPos < parent.childNodes.length) {
  48221. stack.push([parent, newPos]);
  48222. node = parent.childNodes[newPos];
  48223. break;
  48224. }
  48225. }
  48226. if (stack.length === 0) {
  48227. return null;
  48228. }
  48229. }
  48230. }
  48231. }
  48232. dump(buffer) {
  48233. if (this.nodeName === "#text") {
  48234. buffer.push((0, _core_utils.encodeToXmlString)(this.nodeValue));
  48235. return;
  48236. }
  48237. buffer.push(`<${this.nodeName}`);
  48238. if (this.attributes) {
  48239. for (const attribute of this.attributes) {
  48240. buffer.push(` ${attribute.name}="${(0, _core_utils.encodeToXmlString)(attribute.value)}"`);
  48241. }
  48242. }
  48243. if (this.hasChildNodes()) {
  48244. buffer.push(">");
  48245. for (const child of this.childNodes) {
  48246. child.dump(buffer);
  48247. }
  48248. buffer.push(`</${this.nodeName}>`);
  48249. } else if (this.nodeValue) {
  48250. buffer.push(`>${(0, _core_utils.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`);
  48251. } else {
  48252. buffer.push("/>");
  48253. }
  48254. }
  48255. }
  48256. exports.SimpleDOMNode = SimpleDOMNode;
  48257. class SimpleXMLParser extends XMLParserBase {
  48258. constructor({
  48259. hasAttributes = false,
  48260. lowerCaseName = false
  48261. }) {
  48262. super();
  48263. this._currentFragment = null;
  48264. this._stack = null;
  48265. this._errorCode = XMLParserErrorCode.NoError;
  48266. this._hasAttributes = hasAttributes;
  48267. this._lowerCaseName = lowerCaseName;
  48268. }
  48269. parseFromString(data) {
  48270. this._currentFragment = [];
  48271. this._stack = [];
  48272. this._errorCode = XMLParserErrorCode.NoError;
  48273. this.parseXml(data);
  48274. if (this._errorCode !== XMLParserErrorCode.NoError) {
  48275. return undefined;
  48276. }
  48277. const [documentElement] = this._currentFragment;
  48278. if (!documentElement) {
  48279. return undefined;
  48280. }
  48281. return {
  48282. documentElement
  48283. };
  48284. }
  48285. onText(text) {
  48286. if (isWhitespaceString(text)) {
  48287. return;
  48288. }
  48289. const node = new SimpleDOMNode("#text", text);
  48290. this._currentFragment.push(node);
  48291. }
  48292. onCdata(text) {
  48293. const node = new SimpleDOMNode("#text", text);
  48294. this._currentFragment.push(node);
  48295. }
  48296. onBeginElement(name, attributes, isEmpty) {
  48297. if (this._lowerCaseName) {
  48298. name = name.toLowerCase();
  48299. }
  48300. const node = new SimpleDOMNode(name);
  48301. node.childNodes = [];
  48302. if (this._hasAttributes) {
  48303. node.attributes = attributes;
  48304. }
  48305. this._currentFragment.push(node);
  48306. if (isEmpty) {
  48307. return;
  48308. }
  48309. this._stack.push(this._currentFragment);
  48310. this._currentFragment = node.childNodes;
  48311. }
  48312. onEndElement(name) {
  48313. this._currentFragment = this._stack.pop() || [];
  48314. const lastElement = this._currentFragment.at(-1);
  48315. if (!lastElement) {
  48316. return null;
  48317. }
  48318. for (const childNode of lastElement.childNodes) {
  48319. childNode.parentNode = lastElement;
  48320. }
  48321. return lastElement;
  48322. }
  48323. onError(code) {
  48324. this._errorCode = code;
  48325. }
  48326. }
  48327. exports.SimpleXMLParser = SimpleXMLParser;
  48328. /***/ }),
  48329. /* 65 */
  48330. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48331. Object.defineProperty(exports, "__esModule", ({
  48332. value: true
  48333. }));
  48334. exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
  48335. exports.calculateSHA384 = calculateSHA384;
  48336. exports.calculateSHA512 = void 0;
  48337. var _util = __w_pdfjs_require__(2);
  48338. var _primitives = __w_pdfjs_require__(3);
  48339. var _decrypt_stream = __w_pdfjs_require__(66);
  48340. class ARCFourCipher {
  48341. constructor(key) {
  48342. this.a = 0;
  48343. this.b = 0;
  48344. const s = new Uint8Array(256);
  48345. const keyLength = key.length;
  48346. for (let i = 0; i < 256; ++i) {
  48347. s[i] = i;
  48348. }
  48349. for (let i = 0, j = 0; i < 256; ++i) {
  48350. const tmp = s[i];
  48351. j = j + tmp + key[i % keyLength] & 0xff;
  48352. s[i] = s[j];
  48353. s[j] = tmp;
  48354. }
  48355. this.s = s;
  48356. }
  48357. encryptBlock(data) {
  48358. let a = this.a,
  48359. b = this.b;
  48360. const s = this.s;
  48361. const n = data.length;
  48362. const output = new Uint8Array(n);
  48363. for (let i = 0; i < n; ++i) {
  48364. a = a + 1 & 0xff;
  48365. const tmp = s[a];
  48366. b = b + tmp & 0xff;
  48367. const tmp2 = s[b];
  48368. s[a] = tmp2;
  48369. s[b] = tmp;
  48370. output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
  48371. }
  48372. this.a = a;
  48373. this.b = b;
  48374. return output;
  48375. }
  48376. decryptBlock(data) {
  48377. return this.encryptBlock(data);
  48378. }
  48379. encrypt(data) {
  48380. return this.encryptBlock(data);
  48381. }
  48382. }
  48383. exports.ARCFourCipher = ARCFourCipher;
  48384. const calculateMD5 = function calculateMD5Closure() {
  48385. const r = new Uint8Array([7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21]);
  48386. const k = new Int32Array([-680876936, -389564586, 606105819, -1044525330, -176418897, 1200080426, -1473231341, -45705983, 1770035416, -1958414417, -42063, -1990404162, 1804603682, -40341101, -1502002290, 1236535329, -165796510, -1069501632, 643717713, -373897302, -701558691, 38016083, -660478335, -405537848, 568446438, -1019803690, -187363961, 1163531501, -1444681467, -51403784, 1735328473, -1926607734, -378558, -2022574463, 1839030562, -35309556, -1530992060, 1272893353, -155497632, -1094730640, 681279174, -358537222, -722521979, 76029189, -640364487, -421815835, 530742520, -995338651, -198630844, 1126891415, -1416354905, -57434055, 1700485571, -1894986606, -1051523, -2054922799, 1873313359, -30611744, -1560198380, 1309151649, -145523070, -1120210379, 718787259, -343485551]);
  48387. function hash(data, offset, length) {
  48388. let h0 = 1732584193,
  48389. h1 = -271733879,
  48390. h2 = -1732584194,
  48391. h3 = 271733878;
  48392. const paddedLength = length + 72 & ~63;
  48393. const padded = new Uint8Array(paddedLength);
  48394. let i, j;
  48395. for (i = 0; i < length; ++i) {
  48396. padded[i] = data[offset++];
  48397. }
  48398. padded[i++] = 0x80;
  48399. const n = paddedLength - 8;
  48400. while (i < n) {
  48401. padded[i++] = 0;
  48402. }
  48403. padded[i++] = length << 3 & 0xff;
  48404. padded[i++] = length >> 5 & 0xff;
  48405. padded[i++] = length >> 13 & 0xff;
  48406. padded[i++] = length >> 21 & 0xff;
  48407. padded[i++] = length >>> 29 & 0xff;
  48408. padded[i++] = 0;
  48409. padded[i++] = 0;
  48410. padded[i++] = 0;
  48411. const w = new Int32Array(16);
  48412. for (i = 0; i < paddedLength;) {
  48413. for (j = 0; j < 16; ++j, i += 4) {
  48414. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  48415. }
  48416. let a = h0,
  48417. b = h1,
  48418. c = h2,
  48419. d = h3,
  48420. f,
  48421. g;
  48422. for (j = 0; j < 64; ++j) {
  48423. if (j < 16) {
  48424. f = b & c | ~b & d;
  48425. g = j;
  48426. } else if (j < 32) {
  48427. f = d & b | ~d & c;
  48428. g = 5 * j + 1 & 15;
  48429. } else if (j < 48) {
  48430. f = b ^ c ^ d;
  48431. g = 3 * j + 5 & 15;
  48432. } else {
  48433. f = c ^ (b | ~d);
  48434. g = 7 * j & 15;
  48435. }
  48436. const tmp = d,
  48437. rotateArg = a + f + k[j] + w[g] | 0,
  48438. rotate = r[j];
  48439. d = c;
  48440. c = b;
  48441. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  48442. a = tmp;
  48443. }
  48444. h0 = h0 + a | 0;
  48445. h1 = h1 + b | 0;
  48446. h2 = h2 + c | 0;
  48447. h3 = h3 + d | 0;
  48448. }
  48449. return new Uint8Array([h0 & 0xFF, h0 >> 8 & 0xFF, h0 >> 16 & 0xFF, h0 >>> 24 & 0xFF, h1 & 0xFF, h1 >> 8 & 0xFF, h1 >> 16 & 0xFF, h1 >>> 24 & 0xFF, h2 & 0xFF, h2 >> 8 & 0xFF, h2 >> 16 & 0xFF, h2 >>> 24 & 0xFF, h3 & 0xFF, h3 >> 8 & 0xFF, h3 >> 16 & 0xFF, h3 >>> 24 & 0xFF]);
  48450. }
  48451. return hash;
  48452. }();
  48453. exports.calculateMD5 = calculateMD5;
  48454. class Word64 {
  48455. constructor(highInteger, lowInteger) {
  48456. this.high = highInteger | 0;
  48457. this.low = lowInteger | 0;
  48458. }
  48459. and(word) {
  48460. this.high &= word.high;
  48461. this.low &= word.low;
  48462. }
  48463. xor(word) {
  48464. this.high ^= word.high;
  48465. this.low ^= word.low;
  48466. }
  48467. or(word) {
  48468. this.high |= word.high;
  48469. this.low |= word.low;
  48470. }
  48471. shiftRight(places) {
  48472. if (places >= 32) {
  48473. this.low = this.high >>> places - 32 | 0;
  48474. this.high = 0;
  48475. } else {
  48476. this.low = this.low >>> places | this.high << 32 - places;
  48477. this.high = this.high >>> places | 0;
  48478. }
  48479. }
  48480. shiftLeft(places) {
  48481. if (places >= 32) {
  48482. this.high = this.low << places - 32;
  48483. this.low = 0;
  48484. } else {
  48485. this.high = this.high << places | this.low >>> 32 - places;
  48486. this.low <<= places;
  48487. }
  48488. }
  48489. rotateRight(places) {
  48490. let low, high;
  48491. if (places & 32) {
  48492. high = this.low;
  48493. low = this.high;
  48494. } else {
  48495. low = this.low;
  48496. high = this.high;
  48497. }
  48498. places &= 31;
  48499. this.low = low >>> places | high << 32 - places;
  48500. this.high = high >>> places | low << 32 - places;
  48501. }
  48502. not() {
  48503. this.high = ~this.high;
  48504. this.low = ~this.low;
  48505. }
  48506. add(word) {
  48507. const lowAdd = (this.low >>> 0) + (word.low >>> 0);
  48508. let highAdd = (this.high >>> 0) + (word.high >>> 0);
  48509. if (lowAdd > 0xffffffff) {
  48510. highAdd += 1;
  48511. }
  48512. this.low = lowAdd | 0;
  48513. this.high = highAdd | 0;
  48514. }
  48515. copyTo(bytes, offset) {
  48516. bytes[offset] = this.high >>> 24 & 0xff;
  48517. bytes[offset + 1] = this.high >> 16 & 0xff;
  48518. bytes[offset + 2] = this.high >> 8 & 0xff;
  48519. bytes[offset + 3] = this.high & 0xff;
  48520. bytes[offset + 4] = this.low >>> 24 & 0xff;
  48521. bytes[offset + 5] = this.low >> 16 & 0xff;
  48522. bytes[offset + 6] = this.low >> 8 & 0xff;
  48523. bytes[offset + 7] = this.low & 0xff;
  48524. }
  48525. assign(word) {
  48526. this.high = word.high;
  48527. this.low = word.low;
  48528. }
  48529. }
  48530. const calculateSHA256 = function calculateSHA256Closure() {
  48531. function rotr(x, n) {
  48532. return x >>> n | x << 32 - n;
  48533. }
  48534. function ch(x, y, z) {
  48535. return x & y ^ ~x & z;
  48536. }
  48537. function maj(x, y, z) {
  48538. return x & y ^ x & z ^ y & z;
  48539. }
  48540. function sigma(x) {
  48541. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  48542. }
  48543. function sigmaPrime(x) {
  48544. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  48545. }
  48546. function littleSigma(x) {
  48547. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  48548. }
  48549. function littleSigmaPrime(x) {
  48550. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  48551. }
  48552. const k = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2];
  48553. function hash(data, offset, length) {
  48554. let h0 = 0x6a09e667,
  48555. h1 = 0xbb67ae85,
  48556. h2 = 0x3c6ef372,
  48557. h3 = 0xa54ff53a,
  48558. h4 = 0x510e527f,
  48559. h5 = 0x9b05688c,
  48560. h6 = 0x1f83d9ab,
  48561. h7 = 0x5be0cd19;
  48562. const paddedLength = Math.ceil((length + 9) / 64) * 64;
  48563. const padded = new Uint8Array(paddedLength);
  48564. let i, j;
  48565. for (i = 0; i < length; ++i) {
  48566. padded[i] = data[offset++];
  48567. }
  48568. padded[i++] = 0x80;
  48569. const n = paddedLength - 8;
  48570. while (i < n) {
  48571. padded[i++] = 0;
  48572. }
  48573. padded[i++] = 0;
  48574. padded[i++] = 0;
  48575. padded[i++] = 0;
  48576. padded[i++] = length >>> 29 & 0xff;
  48577. padded[i++] = length >> 21 & 0xff;
  48578. padded[i++] = length >> 13 & 0xff;
  48579. padded[i++] = length >> 5 & 0xff;
  48580. padded[i++] = length << 3 & 0xff;
  48581. const w = new Uint32Array(64);
  48582. for (i = 0; i < paddedLength;) {
  48583. for (j = 0; j < 16; ++j) {
  48584. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  48585. i += 4;
  48586. }
  48587. for (j = 16; j < 64; ++j) {
  48588. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  48589. }
  48590. let a = h0,
  48591. b = h1,
  48592. c = h2,
  48593. d = h3,
  48594. e = h4,
  48595. f = h5,
  48596. g = h6,
  48597. h = h7,
  48598. t1,
  48599. t2;
  48600. for (j = 0; j < 64; ++j) {
  48601. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  48602. t2 = sigma(a) + maj(a, b, c);
  48603. h = g;
  48604. g = f;
  48605. f = e;
  48606. e = d + t1 | 0;
  48607. d = c;
  48608. c = b;
  48609. b = a;
  48610. a = t1 + t2 | 0;
  48611. }
  48612. h0 = h0 + a | 0;
  48613. h1 = h1 + b | 0;
  48614. h2 = h2 + c | 0;
  48615. h3 = h3 + d | 0;
  48616. h4 = h4 + e | 0;
  48617. h5 = h5 + f | 0;
  48618. h6 = h6 + g | 0;
  48619. h7 = h7 + h | 0;
  48620. }
  48621. return new Uint8Array([h0 >> 24 & 0xFF, h0 >> 16 & 0xFF, h0 >> 8 & 0xFF, h0 & 0xFF, h1 >> 24 & 0xFF, h1 >> 16 & 0xFF, h1 >> 8 & 0xFF, h1 & 0xFF, h2 >> 24 & 0xFF, h2 >> 16 & 0xFF, h2 >> 8 & 0xFF, h2 & 0xFF, h3 >> 24 & 0xFF, h3 >> 16 & 0xFF, h3 >> 8 & 0xFF, h3 & 0xFF, h4 >> 24 & 0xFF, h4 >> 16 & 0xFF, h4 >> 8 & 0xFF, h4 & 0xFF, h5 >> 24 & 0xFF, h5 >> 16 & 0xFF, h5 >> 8 & 0xFF, h5 & 0xFF, h6 >> 24 & 0xFF, h6 >> 16 & 0xFF, h6 >> 8 & 0xFF, h6 & 0xFF, h7 >> 24 & 0xFF, h7 >> 16 & 0xFF, h7 >> 8 & 0xFF, h7 & 0xFF]);
  48622. }
  48623. return hash;
  48624. }();
  48625. exports.calculateSHA256 = calculateSHA256;
  48626. const calculateSHA512 = function calculateSHA512Closure() {
  48627. function ch(result, x, y, z, tmp) {
  48628. result.assign(x);
  48629. result.and(y);
  48630. tmp.assign(x);
  48631. tmp.not();
  48632. tmp.and(z);
  48633. result.xor(tmp);
  48634. }
  48635. function maj(result, x, y, z, tmp) {
  48636. result.assign(x);
  48637. result.and(y);
  48638. tmp.assign(x);
  48639. tmp.and(z);
  48640. result.xor(tmp);
  48641. tmp.assign(y);
  48642. tmp.and(z);
  48643. result.xor(tmp);
  48644. }
  48645. function sigma(result, x, tmp) {
  48646. result.assign(x);
  48647. result.rotateRight(28);
  48648. tmp.assign(x);
  48649. tmp.rotateRight(34);
  48650. result.xor(tmp);
  48651. tmp.assign(x);
  48652. tmp.rotateRight(39);
  48653. result.xor(tmp);
  48654. }
  48655. function sigmaPrime(result, x, tmp) {
  48656. result.assign(x);
  48657. result.rotateRight(14);
  48658. tmp.assign(x);
  48659. tmp.rotateRight(18);
  48660. result.xor(tmp);
  48661. tmp.assign(x);
  48662. tmp.rotateRight(41);
  48663. result.xor(tmp);
  48664. }
  48665. function littleSigma(result, x, tmp) {
  48666. result.assign(x);
  48667. result.rotateRight(1);
  48668. tmp.assign(x);
  48669. tmp.rotateRight(8);
  48670. result.xor(tmp);
  48671. tmp.assign(x);
  48672. tmp.shiftRight(7);
  48673. result.xor(tmp);
  48674. }
  48675. function littleSigmaPrime(result, x, tmp) {
  48676. result.assign(x);
  48677. result.rotateRight(19);
  48678. tmp.assign(x);
  48679. tmp.rotateRight(61);
  48680. result.xor(tmp);
  48681. tmp.assign(x);
  48682. tmp.shiftRight(6);
  48683. result.xor(tmp);
  48684. }
  48685. const k = [new Word64(0x428a2f98, 0xd728ae22), new Word64(0x71374491, 0x23ef65cd), new Word64(0xb5c0fbcf, 0xec4d3b2f), new Word64(0xe9b5dba5, 0x8189dbbc), new Word64(0x3956c25b, 0xf348b538), new Word64(0x59f111f1, 0xb605d019), new Word64(0x923f82a4, 0xaf194f9b), new Word64(0xab1c5ed5, 0xda6d8118), new Word64(0xd807aa98, 0xa3030242), new Word64(0x12835b01, 0x45706fbe), new Word64(0x243185be, 0x4ee4b28c), new Word64(0x550c7dc3, 0xd5ffb4e2), new Word64(0x72be5d74, 0xf27b896f), new Word64(0x80deb1fe, 0x3b1696b1), new Word64(0x9bdc06a7, 0x25c71235), new Word64(0xc19bf174, 0xcf692694), new Word64(0xe49b69c1, 0x9ef14ad2), new Word64(0xefbe4786, 0x384f25e3), new Word64(0x0fc19dc6, 0x8b8cd5b5), new Word64(0x240ca1cc, 0x77ac9c65), new Word64(0x2de92c6f, 0x592b0275), new Word64(0x4a7484aa, 0x6ea6e483), new Word64(0x5cb0a9dc, 0xbd41fbd4), new Word64(0x76f988da, 0x831153b5), new Word64(0x983e5152, 0xee66dfab), new Word64(0xa831c66d, 0x2db43210), new Word64(0xb00327c8, 0x98fb213f), new Word64(0xbf597fc7, 0xbeef0ee4), new Word64(0xc6e00bf3, 0x3da88fc2), new Word64(0xd5a79147, 0x930aa725), new Word64(0x06ca6351, 0xe003826f), new Word64(0x14292967, 0x0a0e6e70), new Word64(0x27b70a85, 0x46d22ffc), new Word64(0x2e1b2138, 0x5c26c926), new Word64(0x4d2c6dfc, 0x5ac42aed), new Word64(0x53380d13, 0x9d95b3df), new Word64(0x650a7354, 0x8baf63de), new Word64(0x766a0abb, 0x3c77b2a8), new Word64(0x81c2c92e, 0x47edaee6), new Word64(0x92722c85, 0x1482353b), new Word64(0xa2bfe8a1, 0x4cf10364), new Word64(0xa81a664b, 0xbc423001), new Word64(0xc24b8b70, 0xd0f89791), new Word64(0xc76c51a3, 0x0654be30), new Word64(0xd192e819, 0xd6ef5218), new Word64(0xd6990624, 0x5565a910), new Word64(0xf40e3585, 0x5771202a), new Word64(0x106aa070, 0x32bbd1b8), new Word64(0x19a4c116, 0xb8d2d0c8), new Word64(0x1e376c08, 0x5141ab53), new Word64(0x2748774c, 0xdf8eeb99), new Word64(0x34b0bcb5, 0xe19b48a8), new Word64(0x391c0cb3, 0xc5c95a63), new Word64(0x4ed8aa4a, 0xe3418acb), new Word64(0x5b9cca4f, 0x7763e373), new Word64(0x682e6ff3, 0xd6b2b8a3), new Word64(0x748f82ee, 0x5defb2fc), new Word64(0x78a5636f, 0x43172f60), new Word64(0x84c87814, 0xa1f0ab72), new Word64(0x8cc70208, 0x1a6439ec), new Word64(0x90befffa, 0x23631e28), new Word64(0xa4506ceb, 0xde82bde9), new Word64(0xbef9a3f7, 0xb2c67915), new Word64(0xc67178f2, 0xe372532b), new Word64(0xca273ece, 0xea26619c), new Word64(0xd186b8c7, 0x21c0c207), new Word64(0xeada7dd6, 0xcde0eb1e), new Word64(0xf57d4f7f, 0xee6ed178), new Word64(0x06f067aa, 0x72176fba), new Word64(0x0a637dc5, 0xa2c898a6), new Word64(0x113f9804, 0xbef90dae), new Word64(0x1b710b35, 0x131c471b), new Word64(0x28db77f5, 0x23047d84), new Word64(0x32caab7b, 0x40c72493), new Word64(0x3c9ebe0a, 0x15c9bebc), new Word64(0x431d67c4, 0x9c100d4c), new Word64(0x4cc5d4be, 0xcb3e42b6), new Word64(0x597f299c, 0xfc657e2a), new Word64(0x5fcb6fab, 0x3ad6faec), new Word64(0x6c44198c, 0x4a475817)];
  48686. function hash(data, offset, length, mode384 = false) {
  48687. let h0, h1, h2, h3, h4, h5, h6, h7;
  48688. if (!mode384) {
  48689. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  48690. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  48691. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  48692. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  48693. h4 = new Word64(0x510e527f, 0xade682d1);
  48694. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  48695. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  48696. h7 = new Word64(0x5be0cd19, 0x137e2179);
  48697. } else {
  48698. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  48699. h1 = new Word64(0x629a292a, 0x367cd507);
  48700. h2 = new Word64(0x9159015a, 0x3070dd17);
  48701. h3 = new Word64(0x152fecd8, 0xf70e5939);
  48702. h4 = new Word64(0x67332667, 0xffc00b31);
  48703. h5 = new Word64(0x8eb44a87, 0x68581511);
  48704. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  48705. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  48706. }
  48707. const paddedLength = Math.ceil((length + 17) / 128) * 128;
  48708. const padded = new Uint8Array(paddedLength);
  48709. let i, j;
  48710. for (i = 0; i < length; ++i) {
  48711. padded[i] = data[offset++];
  48712. }
  48713. padded[i++] = 0x80;
  48714. const n = paddedLength - 16;
  48715. while (i < n) {
  48716. padded[i++] = 0;
  48717. }
  48718. padded[i++] = 0;
  48719. padded[i++] = 0;
  48720. padded[i++] = 0;
  48721. padded[i++] = 0;
  48722. padded[i++] = 0;
  48723. padded[i++] = 0;
  48724. padded[i++] = 0;
  48725. padded[i++] = 0;
  48726. padded[i++] = 0;
  48727. padded[i++] = 0;
  48728. padded[i++] = 0;
  48729. padded[i++] = length >>> 29 & 0xff;
  48730. padded[i++] = length >> 21 & 0xff;
  48731. padded[i++] = length >> 13 & 0xff;
  48732. padded[i++] = length >> 5 & 0xff;
  48733. padded[i++] = length << 3 & 0xff;
  48734. const w = new Array(80);
  48735. for (i = 0; i < 80; i++) {
  48736. w[i] = new Word64(0, 0);
  48737. }
  48738. let a = new Word64(0, 0),
  48739. b = new Word64(0, 0),
  48740. c = new Word64(0, 0);
  48741. let d = new Word64(0, 0),
  48742. e = new Word64(0, 0),
  48743. f = new Word64(0, 0);
  48744. let g = new Word64(0, 0),
  48745. h = new Word64(0, 0);
  48746. const t1 = new Word64(0, 0),
  48747. t2 = new Word64(0, 0);
  48748. const tmp1 = new Word64(0, 0),
  48749. tmp2 = new Word64(0, 0);
  48750. let tmp3;
  48751. for (i = 0; i < paddedLength;) {
  48752. for (j = 0; j < 16; ++j) {
  48753. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  48754. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  48755. i += 8;
  48756. }
  48757. for (j = 16; j < 80; ++j) {
  48758. tmp3 = w[j];
  48759. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  48760. tmp3.add(w[j - 7]);
  48761. littleSigma(tmp1, w[j - 15], tmp2);
  48762. tmp3.add(tmp1);
  48763. tmp3.add(w[j - 16]);
  48764. }
  48765. a.assign(h0);
  48766. b.assign(h1);
  48767. c.assign(h2);
  48768. d.assign(h3);
  48769. e.assign(h4);
  48770. f.assign(h5);
  48771. g.assign(h6);
  48772. h.assign(h7);
  48773. for (j = 0; j < 80; ++j) {
  48774. t1.assign(h);
  48775. sigmaPrime(tmp1, e, tmp2);
  48776. t1.add(tmp1);
  48777. ch(tmp1, e, f, g, tmp2);
  48778. t1.add(tmp1);
  48779. t1.add(k[j]);
  48780. t1.add(w[j]);
  48781. sigma(t2, a, tmp2);
  48782. maj(tmp1, a, b, c, tmp2);
  48783. t2.add(tmp1);
  48784. tmp3 = h;
  48785. h = g;
  48786. g = f;
  48787. f = e;
  48788. d.add(t1);
  48789. e = d;
  48790. d = c;
  48791. c = b;
  48792. b = a;
  48793. tmp3.assign(t1);
  48794. tmp3.add(t2);
  48795. a = tmp3;
  48796. }
  48797. h0.add(a);
  48798. h1.add(b);
  48799. h2.add(c);
  48800. h3.add(d);
  48801. h4.add(e);
  48802. h5.add(f);
  48803. h6.add(g);
  48804. h7.add(h);
  48805. }
  48806. let result;
  48807. if (!mode384) {
  48808. result = new Uint8Array(64);
  48809. h0.copyTo(result, 0);
  48810. h1.copyTo(result, 8);
  48811. h2.copyTo(result, 16);
  48812. h3.copyTo(result, 24);
  48813. h4.copyTo(result, 32);
  48814. h5.copyTo(result, 40);
  48815. h6.copyTo(result, 48);
  48816. h7.copyTo(result, 56);
  48817. } else {
  48818. result = new Uint8Array(48);
  48819. h0.copyTo(result, 0);
  48820. h1.copyTo(result, 8);
  48821. h2.copyTo(result, 16);
  48822. h3.copyTo(result, 24);
  48823. h4.copyTo(result, 32);
  48824. h5.copyTo(result, 40);
  48825. }
  48826. return result;
  48827. }
  48828. return hash;
  48829. }();
  48830. exports.calculateSHA512 = calculateSHA512;
  48831. function calculateSHA384(data, offset, length) {
  48832. return calculateSHA512(data, offset, length, true);
  48833. }
  48834. class NullCipher {
  48835. decryptBlock(data) {
  48836. return data;
  48837. }
  48838. encrypt(data) {
  48839. return data;
  48840. }
  48841. }
  48842. class AESBaseCipher {
  48843. constructor() {
  48844. if (this.constructor === AESBaseCipher) {
  48845. (0, _util.unreachable)("Cannot initialize AESBaseCipher.");
  48846. }
  48847. this._s = new Uint8Array([0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16]);
  48848. this._inv_s = new Uint8Array([0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d]);
  48849. this._mix = new Uint32Array([0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]);
  48850. this._mixCol = new Uint8Array(256);
  48851. for (let i = 0; i < 256; i++) {
  48852. if (i < 128) {
  48853. this._mixCol[i] = i << 1;
  48854. } else {
  48855. this._mixCol[i] = i << 1 ^ 0x1b;
  48856. }
  48857. }
  48858. this.buffer = new Uint8Array(16);
  48859. this.bufferPosition = 0;
  48860. }
  48861. _expandKey(cipherKey) {
  48862. (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
  48863. }
  48864. _decrypt(input, key) {
  48865. let t, u, v;
  48866. const state = new Uint8Array(16);
  48867. state.set(input);
  48868. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  48869. state[j] ^= key[k];
  48870. }
  48871. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  48872. t = state[13];
  48873. state[13] = state[9];
  48874. state[9] = state[5];
  48875. state[5] = state[1];
  48876. state[1] = t;
  48877. t = state[14];
  48878. u = state[10];
  48879. state[14] = state[6];
  48880. state[10] = state[2];
  48881. state[6] = t;
  48882. state[2] = u;
  48883. t = state[15];
  48884. u = state[11];
  48885. v = state[7];
  48886. state[15] = state[3];
  48887. state[11] = t;
  48888. state[7] = u;
  48889. state[3] = v;
  48890. for (let j = 0; j < 16; ++j) {
  48891. state[j] = this._inv_s[state[j]];
  48892. }
  48893. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  48894. state[j] ^= key[k];
  48895. }
  48896. for (let j = 0; j < 16; j += 4) {
  48897. const s0 = this._mix[state[j]];
  48898. const s1 = this._mix[state[j + 1]];
  48899. const s2 = this._mix[state[j + 2]];
  48900. const s3 = this._mix[state[j + 3]];
  48901. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  48902. state[j] = t >>> 24 & 0xff;
  48903. state[j + 1] = t >> 16 & 0xff;
  48904. state[j + 2] = t >> 8 & 0xff;
  48905. state[j + 3] = t & 0xff;
  48906. }
  48907. }
  48908. t = state[13];
  48909. state[13] = state[9];
  48910. state[9] = state[5];
  48911. state[5] = state[1];
  48912. state[1] = t;
  48913. t = state[14];
  48914. u = state[10];
  48915. state[14] = state[6];
  48916. state[10] = state[2];
  48917. state[6] = t;
  48918. state[2] = u;
  48919. t = state[15];
  48920. u = state[11];
  48921. v = state[7];
  48922. state[15] = state[3];
  48923. state[11] = t;
  48924. state[7] = u;
  48925. state[3] = v;
  48926. for (let j = 0; j < 16; ++j) {
  48927. state[j] = this._inv_s[state[j]];
  48928. state[j] ^= key[j];
  48929. }
  48930. return state;
  48931. }
  48932. _encrypt(input, key) {
  48933. const s = this._s;
  48934. let t, u, v;
  48935. const state = new Uint8Array(16);
  48936. state.set(input);
  48937. for (let j = 0; j < 16; ++j) {
  48938. state[j] ^= key[j];
  48939. }
  48940. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  48941. for (let j = 0; j < 16; ++j) {
  48942. state[j] = s[state[j]];
  48943. }
  48944. v = state[1];
  48945. state[1] = state[5];
  48946. state[5] = state[9];
  48947. state[9] = state[13];
  48948. state[13] = v;
  48949. v = state[2];
  48950. u = state[6];
  48951. state[2] = state[10];
  48952. state[6] = state[14];
  48953. state[10] = v;
  48954. state[14] = u;
  48955. v = state[3];
  48956. u = state[7];
  48957. t = state[11];
  48958. state[3] = state[15];
  48959. state[7] = v;
  48960. state[11] = u;
  48961. state[15] = t;
  48962. for (let j = 0; j < 16; j += 4) {
  48963. const s0 = state[j + 0];
  48964. const s1 = state[j + 1];
  48965. const s2 = state[j + 2];
  48966. const s3 = state[j + 3];
  48967. t = s0 ^ s1 ^ s2 ^ s3;
  48968. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  48969. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  48970. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  48971. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  48972. }
  48973. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  48974. state[j] ^= key[k];
  48975. }
  48976. }
  48977. for (let j = 0; j < 16; ++j) {
  48978. state[j] = s[state[j]];
  48979. }
  48980. v = state[1];
  48981. state[1] = state[5];
  48982. state[5] = state[9];
  48983. state[9] = state[13];
  48984. state[13] = v;
  48985. v = state[2];
  48986. u = state[6];
  48987. state[2] = state[10];
  48988. state[6] = state[14];
  48989. state[10] = v;
  48990. state[14] = u;
  48991. v = state[3];
  48992. u = state[7];
  48993. t = state[11];
  48994. state[3] = state[15];
  48995. state[7] = v;
  48996. state[11] = u;
  48997. state[15] = t;
  48998. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  48999. state[j] ^= key[k];
  49000. }
  49001. return state;
  49002. }
  49003. _decryptBlock2(data, finalize) {
  49004. const sourceLength = data.length;
  49005. let buffer = this.buffer,
  49006. bufferLength = this.bufferPosition;
  49007. const result = [];
  49008. let iv = this.iv;
  49009. for (let i = 0; i < sourceLength; ++i) {
  49010. buffer[bufferLength] = data[i];
  49011. ++bufferLength;
  49012. if (bufferLength < 16) {
  49013. continue;
  49014. }
  49015. const plain = this._decrypt(buffer, this._key);
  49016. for (let j = 0; j < 16; ++j) {
  49017. plain[j] ^= iv[j];
  49018. }
  49019. iv = buffer;
  49020. result.push(plain);
  49021. buffer = new Uint8Array(16);
  49022. bufferLength = 0;
  49023. }
  49024. this.buffer = buffer;
  49025. this.bufferLength = bufferLength;
  49026. this.iv = iv;
  49027. if (result.length === 0) {
  49028. return new Uint8Array(0);
  49029. }
  49030. let outputLength = 16 * result.length;
  49031. if (finalize) {
  49032. const lastBlock = result.at(-1);
  49033. let psLen = lastBlock[15];
  49034. if (psLen <= 16) {
  49035. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  49036. if (lastBlock[i] !== psLen) {
  49037. psLen = 0;
  49038. break;
  49039. }
  49040. }
  49041. outputLength -= psLen;
  49042. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  49043. }
  49044. }
  49045. const output = new Uint8Array(outputLength);
  49046. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  49047. output.set(result[i], j);
  49048. }
  49049. return output;
  49050. }
  49051. decryptBlock(data, finalize, iv = null) {
  49052. const sourceLength = data.length;
  49053. const buffer = this.buffer;
  49054. let bufferLength = this.bufferPosition;
  49055. if (iv) {
  49056. this.iv = iv;
  49057. } else {
  49058. for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  49059. buffer[bufferLength] = data[i];
  49060. }
  49061. if (bufferLength < 16) {
  49062. this.bufferLength = bufferLength;
  49063. return new Uint8Array(0);
  49064. }
  49065. this.iv = buffer;
  49066. data = data.subarray(16);
  49067. }
  49068. this.buffer = new Uint8Array(16);
  49069. this.bufferLength = 0;
  49070. this.decryptBlock = this._decryptBlock2;
  49071. return this.decryptBlock(data, finalize);
  49072. }
  49073. encrypt(data, iv) {
  49074. const sourceLength = data.length;
  49075. let buffer = this.buffer,
  49076. bufferLength = this.bufferPosition;
  49077. const result = [];
  49078. if (!iv) {
  49079. iv = new Uint8Array(16);
  49080. }
  49081. for (let i = 0; i < sourceLength; ++i) {
  49082. buffer[bufferLength] = data[i];
  49083. ++bufferLength;
  49084. if (bufferLength < 16) {
  49085. continue;
  49086. }
  49087. for (let j = 0; j < 16; ++j) {
  49088. buffer[j] ^= iv[j];
  49089. }
  49090. const cipher = this._encrypt(buffer, this._key);
  49091. iv = cipher;
  49092. result.push(cipher);
  49093. buffer = new Uint8Array(16);
  49094. bufferLength = 0;
  49095. }
  49096. this.buffer = buffer;
  49097. this.bufferLength = bufferLength;
  49098. this.iv = iv;
  49099. if (result.length === 0) {
  49100. return new Uint8Array(0);
  49101. }
  49102. const outputLength = 16 * result.length;
  49103. const output = new Uint8Array(outputLength);
  49104. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  49105. output.set(result[i], j);
  49106. }
  49107. return output;
  49108. }
  49109. }
  49110. class AES128Cipher extends AESBaseCipher {
  49111. constructor(key) {
  49112. super();
  49113. this._cyclesOfRepetition = 10;
  49114. this._keySize = 160;
  49115. this._rcon = new Uint8Array([0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d]);
  49116. this._key = this._expandKey(key);
  49117. }
  49118. _expandKey(cipherKey) {
  49119. const b = 176;
  49120. const s = this._s;
  49121. const rcon = this._rcon;
  49122. const result = new Uint8Array(b);
  49123. result.set(cipherKey);
  49124. for (let j = 16, i = 1; j < b; ++i) {
  49125. let t1 = result[j - 3];
  49126. let t2 = result[j - 2];
  49127. let t3 = result[j - 1];
  49128. let t4 = result[j - 4];
  49129. t1 = s[t1];
  49130. t2 = s[t2];
  49131. t3 = s[t3];
  49132. t4 = s[t4];
  49133. t1 ^= rcon[i];
  49134. for (let n = 0; n < 4; ++n) {
  49135. result[j] = t1 ^= result[j - 16];
  49136. j++;
  49137. result[j] = t2 ^= result[j - 16];
  49138. j++;
  49139. result[j] = t3 ^= result[j - 16];
  49140. j++;
  49141. result[j] = t4 ^= result[j - 16];
  49142. j++;
  49143. }
  49144. }
  49145. return result;
  49146. }
  49147. }
  49148. exports.AES128Cipher = AES128Cipher;
  49149. class AES256Cipher extends AESBaseCipher {
  49150. constructor(key) {
  49151. super();
  49152. this._cyclesOfRepetition = 14;
  49153. this._keySize = 224;
  49154. this._key = this._expandKey(key);
  49155. }
  49156. _expandKey(cipherKey) {
  49157. const b = 240;
  49158. const s = this._s;
  49159. const result = new Uint8Array(b);
  49160. result.set(cipherKey);
  49161. let r = 1;
  49162. let t1, t2, t3, t4;
  49163. for (let j = 32, i = 1; j < b; ++i) {
  49164. if (j % 32 === 16) {
  49165. t1 = s[t1];
  49166. t2 = s[t2];
  49167. t3 = s[t3];
  49168. t4 = s[t4];
  49169. } else if (j % 32 === 0) {
  49170. t1 = result[j - 3];
  49171. t2 = result[j - 2];
  49172. t3 = result[j - 1];
  49173. t4 = result[j - 4];
  49174. t1 = s[t1];
  49175. t2 = s[t2];
  49176. t3 = s[t3];
  49177. t4 = s[t4];
  49178. t1 ^= r;
  49179. if ((r <<= 1) >= 256) {
  49180. r = (r ^ 0x1b) & 0xff;
  49181. }
  49182. }
  49183. for (let n = 0; n < 4; ++n) {
  49184. result[j] = t1 ^= result[j - 32];
  49185. j++;
  49186. result[j] = t2 ^= result[j - 32];
  49187. j++;
  49188. result[j] = t3 ^= result[j - 32];
  49189. j++;
  49190. result[j] = t4 ^= result[j - 32];
  49191. j++;
  49192. }
  49193. }
  49194. return result;
  49195. }
  49196. }
  49197. exports.AES256Cipher = AES256Cipher;
  49198. class PDF17 {
  49199. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  49200. const hashData = new Uint8Array(password.length + 56);
  49201. hashData.set(password, 0);
  49202. hashData.set(ownerValidationSalt, password.length);
  49203. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  49204. const result = calculateSHA256(hashData, 0, hashData.length);
  49205. return (0, _util.isArrayEqual)(result, ownerPassword);
  49206. }
  49207. checkUserPassword(password, userValidationSalt, userPassword) {
  49208. const hashData = new Uint8Array(password.length + 8);
  49209. hashData.set(password, 0);
  49210. hashData.set(userValidationSalt, password.length);
  49211. const result = calculateSHA256(hashData, 0, hashData.length);
  49212. return (0, _util.isArrayEqual)(result, userPassword);
  49213. }
  49214. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  49215. const hashData = new Uint8Array(password.length + 56);
  49216. hashData.set(password, 0);
  49217. hashData.set(ownerKeySalt, password.length);
  49218. hashData.set(userBytes, password.length + ownerKeySalt.length);
  49219. const key = calculateSHA256(hashData, 0, hashData.length);
  49220. const cipher = new AES256Cipher(key);
  49221. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  49222. }
  49223. getUserKey(password, userKeySalt, userEncryption) {
  49224. const hashData = new Uint8Array(password.length + 8);
  49225. hashData.set(password, 0);
  49226. hashData.set(userKeySalt, password.length);
  49227. const key = calculateSHA256(hashData, 0, hashData.length);
  49228. const cipher = new AES256Cipher(key);
  49229. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  49230. }
  49231. }
  49232. exports.PDF17 = PDF17;
  49233. const PDF20 = function PDF20Closure() {
  49234. function calculatePDF20Hash(password, input, userBytes) {
  49235. let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  49236. let e = [0];
  49237. let i = 0;
  49238. while (i < 64 || e.at(-1) > i - 32) {
  49239. const combinedLength = password.length + k.length + userBytes.length,
  49240. combinedArray = new Uint8Array(combinedLength);
  49241. let writeOffset = 0;
  49242. combinedArray.set(password, writeOffset);
  49243. writeOffset += password.length;
  49244. combinedArray.set(k, writeOffset);
  49245. writeOffset += k.length;
  49246. combinedArray.set(userBytes, writeOffset);
  49247. const k1 = new Uint8Array(combinedLength * 64);
  49248. for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) {
  49249. k1.set(combinedArray, pos);
  49250. }
  49251. const cipher = new AES128Cipher(k.subarray(0, 16));
  49252. e = cipher.encrypt(k1, k.subarray(16, 32));
  49253. const remainder = e.slice(0, 16).reduce((a, b) => a + b, 0) % 3;
  49254. if (remainder === 0) {
  49255. k = calculateSHA256(e, 0, e.length);
  49256. } else if (remainder === 1) {
  49257. k = calculateSHA384(e, 0, e.length);
  49258. } else if (remainder === 2) {
  49259. k = calculateSHA512(e, 0, e.length);
  49260. }
  49261. i++;
  49262. }
  49263. return k.subarray(0, 32);
  49264. }
  49265. class PDF20 {
  49266. hash(password, concatBytes, userBytes) {
  49267. return calculatePDF20Hash(password, concatBytes, userBytes);
  49268. }
  49269. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  49270. const hashData = new Uint8Array(password.length + 56);
  49271. hashData.set(password, 0);
  49272. hashData.set(ownerValidationSalt, password.length);
  49273. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  49274. const result = calculatePDF20Hash(password, hashData, userBytes);
  49275. return (0, _util.isArrayEqual)(result, ownerPassword);
  49276. }
  49277. checkUserPassword(password, userValidationSalt, userPassword) {
  49278. const hashData = new Uint8Array(password.length + 8);
  49279. hashData.set(password, 0);
  49280. hashData.set(userValidationSalt, password.length);
  49281. const result = calculatePDF20Hash(password, hashData, []);
  49282. return (0, _util.isArrayEqual)(result, userPassword);
  49283. }
  49284. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  49285. const hashData = new Uint8Array(password.length + 56);
  49286. hashData.set(password, 0);
  49287. hashData.set(ownerKeySalt, password.length);
  49288. hashData.set(userBytes, password.length + ownerKeySalt.length);
  49289. const key = calculatePDF20Hash(password, hashData, userBytes);
  49290. const cipher = new AES256Cipher(key);
  49291. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  49292. }
  49293. getUserKey(password, userKeySalt, userEncryption) {
  49294. const hashData = new Uint8Array(password.length + 8);
  49295. hashData.set(password, 0);
  49296. hashData.set(userKeySalt, password.length);
  49297. const key = calculatePDF20Hash(password, hashData, []);
  49298. const cipher = new AES256Cipher(key);
  49299. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  49300. }
  49301. }
  49302. return PDF20;
  49303. }();
  49304. exports.PDF20 = PDF20;
  49305. class CipherTransform {
  49306. constructor(stringCipherConstructor, streamCipherConstructor) {
  49307. this.StringCipherConstructor = stringCipherConstructor;
  49308. this.StreamCipherConstructor = streamCipherConstructor;
  49309. }
  49310. createStream(stream, length) {
  49311. const cipher = new this.StreamCipherConstructor();
  49312. return new _decrypt_stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  49313. return cipher.decryptBlock(data, finalize);
  49314. });
  49315. }
  49316. decryptString(s) {
  49317. const cipher = new this.StringCipherConstructor();
  49318. let data = (0, _util.stringToBytes)(s);
  49319. data = cipher.decryptBlock(data, true);
  49320. return (0, _util.bytesToString)(data);
  49321. }
  49322. encryptString(s) {
  49323. const cipher = new this.StringCipherConstructor();
  49324. if (cipher instanceof AESBaseCipher) {
  49325. const strLen = s.length;
  49326. const pad = 16 - strLen % 16;
  49327. s += String.fromCharCode(pad).repeat(pad);
  49328. const iv = new Uint8Array(16);
  49329. if (typeof crypto !== "undefined") {
  49330. crypto.getRandomValues(iv);
  49331. } else {
  49332. for (let i = 0; i < 16; i++) {
  49333. iv[i] = Math.floor(256 * Math.random());
  49334. }
  49335. }
  49336. let data = (0, _util.stringToBytes)(s);
  49337. data = cipher.encrypt(data, iv);
  49338. const buf = new Uint8Array(16 + data.length);
  49339. buf.set(iv);
  49340. buf.set(data, 16);
  49341. return (0, _util.bytesToString)(buf);
  49342. }
  49343. let data = (0, _util.stringToBytes)(s);
  49344. data = cipher.encrypt(data);
  49345. return (0, _util.bytesToString)(data);
  49346. }
  49347. }
  49348. const CipherTransformFactory = function CipherTransformFactoryClosure() {
  49349. const defaultPasswordBytes = new Uint8Array([0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x64, 0x00, 0x4e, 0x56, 0xff, 0xfa, 0x01, 0x08, 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80, 0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a]);
  49350. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  49351. if (password) {
  49352. const passwordLength = Math.min(127, password.length);
  49353. password = password.subarray(0, passwordLength);
  49354. } else {
  49355. password = [];
  49356. }
  49357. let pdfAlgorithm;
  49358. if (revision === 6) {
  49359. pdfAlgorithm = new PDF20();
  49360. } else {
  49361. pdfAlgorithm = new PDF17();
  49362. }
  49363. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  49364. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  49365. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  49366. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  49367. }
  49368. return null;
  49369. }
  49370. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  49371. const hashDataSize = 40 + ownerPassword.length + fileId.length;
  49372. const hashData = new Uint8Array(hashDataSize);
  49373. let i = 0,
  49374. j,
  49375. n;
  49376. if (password) {
  49377. n = Math.min(32, password.length);
  49378. for (; i < n; ++i) {
  49379. hashData[i] = password[i];
  49380. }
  49381. }
  49382. j = 0;
  49383. while (i < 32) {
  49384. hashData[i++] = defaultPasswordBytes[j++];
  49385. }
  49386. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  49387. hashData[i++] = ownerPassword[j];
  49388. }
  49389. hashData[i++] = flags & 0xff;
  49390. hashData[i++] = flags >> 8 & 0xff;
  49391. hashData[i++] = flags >> 16 & 0xff;
  49392. hashData[i++] = flags >>> 24 & 0xff;
  49393. for (j = 0, n = fileId.length; j < n; ++j) {
  49394. hashData[i++] = fileId[j];
  49395. }
  49396. if (revision >= 4 && !encryptMetadata) {
  49397. hashData[i++] = 0xff;
  49398. hashData[i++] = 0xff;
  49399. hashData[i++] = 0xff;
  49400. hashData[i++] = 0xff;
  49401. }
  49402. let hash = calculateMD5(hashData, 0, i);
  49403. const keyLengthInBytes = keyLength >> 3;
  49404. if (revision >= 3) {
  49405. for (j = 0; j < 50; ++j) {
  49406. hash = calculateMD5(hash, 0, keyLengthInBytes);
  49407. }
  49408. }
  49409. const encryptionKey = hash.subarray(0, keyLengthInBytes);
  49410. let cipher, checkData;
  49411. if (revision >= 3) {
  49412. for (i = 0; i < 32; ++i) {
  49413. hashData[i] = defaultPasswordBytes[i];
  49414. }
  49415. for (j = 0, n = fileId.length; j < n; ++j) {
  49416. hashData[i++] = fileId[j];
  49417. }
  49418. cipher = new ARCFourCipher(encryptionKey);
  49419. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  49420. n = encryptionKey.length;
  49421. const derivedKey = new Uint8Array(n);
  49422. for (j = 1; j <= 19; ++j) {
  49423. for (let k = 0; k < n; ++k) {
  49424. derivedKey[k] = encryptionKey[k] ^ j;
  49425. }
  49426. cipher = new ARCFourCipher(derivedKey);
  49427. checkData = cipher.encryptBlock(checkData);
  49428. }
  49429. for (j = 0, n = checkData.length; j < n; ++j) {
  49430. if (userPassword[j] !== checkData[j]) {
  49431. return null;
  49432. }
  49433. }
  49434. } else {
  49435. cipher = new ARCFourCipher(encryptionKey);
  49436. checkData = cipher.encryptBlock(defaultPasswordBytes);
  49437. for (j = 0, n = checkData.length; j < n; ++j) {
  49438. if (userPassword[j] !== checkData[j]) {
  49439. return null;
  49440. }
  49441. }
  49442. }
  49443. return encryptionKey;
  49444. }
  49445. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  49446. const hashData = new Uint8Array(32);
  49447. let i = 0;
  49448. const n = Math.min(32, password.length);
  49449. for (; i < n; ++i) {
  49450. hashData[i] = password[i];
  49451. }
  49452. let j = 0;
  49453. while (i < 32) {
  49454. hashData[i++] = defaultPasswordBytes[j++];
  49455. }
  49456. let hash = calculateMD5(hashData, 0, i);
  49457. const keyLengthInBytes = keyLength >> 3;
  49458. if (revision >= 3) {
  49459. for (j = 0; j < 50; ++j) {
  49460. hash = calculateMD5(hash, 0, hash.length);
  49461. }
  49462. }
  49463. let cipher, userPassword;
  49464. if (revision >= 3) {
  49465. userPassword = ownerPassword;
  49466. const derivedKey = new Uint8Array(keyLengthInBytes);
  49467. for (j = 19; j >= 0; j--) {
  49468. for (let k = 0; k < keyLengthInBytes; ++k) {
  49469. derivedKey[k] = hash[k] ^ j;
  49470. }
  49471. cipher = new ARCFourCipher(derivedKey);
  49472. userPassword = cipher.encryptBlock(userPassword);
  49473. }
  49474. } else {
  49475. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  49476. userPassword = cipher.encryptBlock(ownerPassword);
  49477. }
  49478. return userPassword;
  49479. }
  49480. const identityName = _primitives.Name.get("Identity");
  49481. function buildObjectKey(num, gen, encryptionKey, isAes = false) {
  49482. const key = new Uint8Array(encryptionKey.length + 9);
  49483. const n = encryptionKey.length;
  49484. let i;
  49485. for (i = 0; i < n; ++i) {
  49486. key[i] = encryptionKey[i];
  49487. }
  49488. key[i++] = num & 0xff;
  49489. key[i++] = num >> 8 & 0xff;
  49490. key[i++] = num >> 16 & 0xff;
  49491. key[i++] = gen & 0xff;
  49492. key[i++] = gen >> 8 & 0xff;
  49493. if (isAes) {
  49494. key[i++] = 0x73;
  49495. key[i++] = 0x41;
  49496. key[i++] = 0x6c;
  49497. key[i++] = 0x54;
  49498. }
  49499. const hash = calculateMD5(key, 0, i);
  49500. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  49501. }
  49502. function buildCipherConstructor(cf, name, num, gen, key) {
  49503. if (!(name instanceof _primitives.Name)) {
  49504. throw new _util.FormatError("Invalid crypt filter name.");
  49505. }
  49506. const cryptFilter = cf.get(name.name);
  49507. let cfm;
  49508. if (cryptFilter !== null && cryptFilter !== undefined) {
  49509. cfm = cryptFilter.get("CFM");
  49510. }
  49511. if (!cfm || cfm.name === "None") {
  49512. return function cipherTransformFactoryBuildCipherConstructorNone() {
  49513. return new NullCipher();
  49514. };
  49515. }
  49516. if (cfm.name === "V2") {
  49517. return function cipherTransformFactoryBuildCipherConstructorV2() {
  49518. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  49519. };
  49520. }
  49521. if (cfm.name === "AESV2") {
  49522. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  49523. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  49524. };
  49525. }
  49526. if (cfm.name === "AESV3") {
  49527. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  49528. return new AES256Cipher(key);
  49529. };
  49530. }
  49531. throw new _util.FormatError("Unknown crypto method");
  49532. }
  49533. class CipherTransformFactory {
  49534. constructor(dict, fileId, password) {
  49535. const filter = dict.get("Filter");
  49536. if (!(0, _primitives.isName)(filter, "Standard")) {
  49537. throw new _util.FormatError("unknown encryption method");
  49538. }
  49539. this.filterName = filter.name;
  49540. this.dict = dict;
  49541. const algorithm = dict.get("V");
  49542. if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  49543. throw new _util.FormatError("unsupported encryption algorithm");
  49544. }
  49545. this.algorithm = algorithm;
  49546. let keyLength = dict.get("Length");
  49547. if (!keyLength) {
  49548. if (algorithm <= 3) {
  49549. keyLength = 40;
  49550. } else {
  49551. const cfDict = dict.get("CF");
  49552. const streamCryptoName = dict.get("StmF");
  49553. if (cfDict instanceof _primitives.Dict && streamCryptoName instanceof _primitives.Name) {
  49554. cfDict.suppressEncryption = true;
  49555. const handlerDict = cfDict.get(streamCryptoName.name);
  49556. keyLength = handlerDict && handlerDict.get("Length") || 128;
  49557. if (keyLength < 40) {
  49558. keyLength <<= 3;
  49559. }
  49560. }
  49561. }
  49562. }
  49563. if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  49564. throw new _util.FormatError("invalid key length");
  49565. }
  49566. const ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32);
  49567. const userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32);
  49568. const flags = dict.get("P");
  49569. const revision = dict.get("R");
  49570. const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
  49571. this.encryptMetadata = encryptMetadata;
  49572. const fileIdBytes = (0, _util.stringToBytes)(fileId);
  49573. let passwordBytes;
  49574. if (password) {
  49575. if (revision === 6) {
  49576. try {
  49577. password = (0, _util.utf8StringToString)(password);
  49578. } catch (ex) {
  49579. (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password.");
  49580. }
  49581. }
  49582. passwordBytes = (0, _util.stringToBytes)(password);
  49583. }
  49584. let encryptionKey;
  49585. if (algorithm !== 5) {
  49586. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  49587. } else {
  49588. const ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40);
  49589. const ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48);
  49590. const uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48);
  49591. const userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40);
  49592. const userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48);
  49593. const ownerEncryption = (0, _util.stringToBytes)(dict.get("OE"));
  49594. const userEncryption = (0, _util.stringToBytes)(dict.get("UE"));
  49595. const perms = (0, _util.stringToBytes)(dict.get("Perms"));
  49596. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  49597. }
  49598. if (!encryptionKey && !password) {
  49599. throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD);
  49600. } else if (!encryptionKey && password) {
  49601. const decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  49602. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  49603. }
  49604. if (!encryptionKey) {
  49605. throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD);
  49606. }
  49607. this.encryptionKey = encryptionKey;
  49608. if (algorithm >= 4) {
  49609. const cf = dict.get("CF");
  49610. if (cf instanceof _primitives.Dict) {
  49611. cf.suppressEncryption = true;
  49612. }
  49613. this.cf = cf;
  49614. this.stmf = dict.get("StmF") || identityName;
  49615. this.strf = dict.get("StrF") || identityName;
  49616. this.eff = dict.get("EFF") || this.stmf;
  49617. }
  49618. }
  49619. createCipherTransform(num, gen) {
  49620. if (this.algorithm === 4 || this.algorithm === 5) {
  49621. return new CipherTransform(buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey));
  49622. }
  49623. const key = buildObjectKey(num, gen, this.encryptionKey, false);
  49624. const cipherConstructor = function buildCipherCipherConstructor() {
  49625. return new ARCFourCipher(key);
  49626. };
  49627. return new CipherTransform(cipherConstructor, cipherConstructor);
  49628. }
  49629. }
  49630. return CipherTransformFactory;
  49631. }();
  49632. exports.CipherTransformFactory = CipherTransformFactory;
  49633. /***/ }),
  49634. /* 66 */
  49635. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49636. Object.defineProperty(exports, "__esModule", ({
  49637. value: true
  49638. }));
  49639. exports.DecryptStream = void 0;
  49640. var _decode_stream = __w_pdfjs_require__(17);
  49641. const chunkSize = 512;
  49642. class DecryptStream extends _decode_stream.DecodeStream {
  49643. constructor(str, maybeLength, decrypt) {
  49644. super(maybeLength);
  49645. this.str = str;
  49646. this.dict = str.dict;
  49647. this.decrypt = decrypt;
  49648. this.nextChunk = null;
  49649. this.initialized = false;
  49650. }
  49651. readBlock() {
  49652. let chunk;
  49653. if (this.initialized) {
  49654. chunk = this.nextChunk;
  49655. } else {
  49656. chunk = this.str.getBytes(chunkSize);
  49657. this.initialized = true;
  49658. }
  49659. if (!chunk || chunk.length === 0) {
  49660. this.eof = true;
  49661. return;
  49662. }
  49663. this.nextChunk = this.str.getBytes(chunkSize);
  49664. const hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  49665. const decrypt = this.decrypt;
  49666. chunk = decrypt(chunk, !hasMoreData);
  49667. const bufferLength = this.bufferLength,
  49668. newLength = bufferLength + chunk.length,
  49669. buffer = this.ensureBuffer(newLength);
  49670. buffer.set(chunk, bufferLength);
  49671. this.bufferLength = newLength;
  49672. }
  49673. }
  49674. exports.DecryptStream = DecryptStream;
  49675. /***/ }),
  49676. /* 67 */
  49677. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49678. Object.defineProperty(exports, "__esModule", ({
  49679. value: true
  49680. }));
  49681. exports.Catalog = void 0;
  49682. var _core_utils = __w_pdfjs_require__(4);
  49683. var _util = __w_pdfjs_require__(2);
  49684. var _primitives = __w_pdfjs_require__(3);
  49685. var _name_number_tree = __w_pdfjs_require__(68);
  49686. var _base_stream = __w_pdfjs_require__(5);
  49687. var _cleanup_helper = __w_pdfjs_require__(69);
  49688. var _colorspace = __w_pdfjs_require__(12);
  49689. var _file_spec = __w_pdfjs_require__(70);
  49690. var _image_utils = __w_pdfjs_require__(57);
  49691. var _metadata_parser = __w_pdfjs_require__(71);
  49692. var _struct_tree = __w_pdfjs_require__(72);
  49693. function fetchDestination(dest) {
  49694. if (dest instanceof _primitives.Dict) {
  49695. dest = dest.get("D");
  49696. }
  49697. return Array.isArray(dest) ? dest : null;
  49698. }
  49699. class Catalog {
  49700. constructor(pdfManager, xref) {
  49701. this.pdfManager = pdfManager;
  49702. this.xref = xref;
  49703. this._catDict = xref.getCatalogObj();
  49704. if (!(this._catDict instanceof _primitives.Dict)) {
  49705. throw new _util.FormatError("Catalog object is not a dictionary.");
  49706. }
  49707. this.toplevelPagesDict;
  49708. this._actualNumPages = null;
  49709. this.fontCache = new _primitives.RefSetCache();
  49710. this.builtInCMapCache = new Map();
  49711. this.standardFontDataCache = new Map();
  49712. this.globalImageCache = new _image_utils.GlobalImageCache();
  49713. this.pageKidsCountCache = new _primitives.RefSetCache();
  49714. this.pageIndexCache = new _primitives.RefSetCache();
  49715. this.nonBlendModesSet = new _primitives.RefSet();
  49716. }
  49717. get version() {
  49718. const version = this._catDict.get("Version");
  49719. if (version instanceof _primitives.Name) {
  49720. if (_core_utils.PDF_VERSION_REGEXP.test(version.name)) {
  49721. return (0, _util.shadow)(this, "version", version.name);
  49722. }
  49723. (0, _util.warn)(`Invalid PDF catalog version: ${version.name}`);
  49724. }
  49725. return (0, _util.shadow)(this, "version", null);
  49726. }
  49727. get lang() {
  49728. const lang = this._catDict.get("Lang");
  49729. return (0, _util.shadow)(this, "lang", typeof lang === "string" ? (0, _util.stringToPDFString)(lang) : null);
  49730. }
  49731. get needsRendering() {
  49732. const needsRendering = this._catDict.get("NeedsRendering");
  49733. return (0, _util.shadow)(this, "needsRendering", typeof needsRendering === "boolean" ? needsRendering : false);
  49734. }
  49735. get collection() {
  49736. let collection = null;
  49737. try {
  49738. const obj = this._catDict.get("Collection");
  49739. if (obj instanceof _primitives.Dict && obj.size > 0) {
  49740. collection = obj;
  49741. }
  49742. } catch (ex) {
  49743. if (ex instanceof _core_utils.MissingDataException) {
  49744. throw ex;
  49745. }
  49746. (0, _util.info)("Cannot fetch Collection entry; assuming no collection is present.");
  49747. }
  49748. return (0, _util.shadow)(this, "collection", collection);
  49749. }
  49750. get acroForm() {
  49751. let acroForm = null;
  49752. try {
  49753. const obj = this._catDict.get("AcroForm");
  49754. if (obj instanceof _primitives.Dict && obj.size > 0) {
  49755. acroForm = obj;
  49756. }
  49757. } catch (ex) {
  49758. if (ex instanceof _core_utils.MissingDataException) {
  49759. throw ex;
  49760. }
  49761. (0, _util.info)("Cannot fetch AcroForm entry; assuming no forms are present.");
  49762. }
  49763. return (0, _util.shadow)(this, "acroForm", acroForm);
  49764. }
  49765. get acroFormRef() {
  49766. const value = this._catDict.getRaw("AcroForm");
  49767. return (0, _util.shadow)(this, "acroFormRef", value instanceof _primitives.Ref ? value : null);
  49768. }
  49769. get metadata() {
  49770. const streamRef = this._catDict.getRaw("Metadata");
  49771. if (!(streamRef instanceof _primitives.Ref)) {
  49772. return (0, _util.shadow)(this, "metadata", null);
  49773. }
  49774. let metadata = null;
  49775. try {
  49776. const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
  49777. const stream = this.xref.fetch(streamRef, suppressEncryption);
  49778. if (stream instanceof _base_stream.BaseStream && stream.dict instanceof _primitives.Dict) {
  49779. const type = stream.dict.get("Type");
  49780. const subtype = stream.dict.get("Subtype");
  49781. if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
  49782. const data = (0, _util.stringToUTF8String)(stream.getString());
  49783. if (data) {
  49784. metadata = new _metadata_parser.MetadataParser(data).serializable;
  49785. }
  49786. }
  49787. }
  49788. } catch (ex) {
  49789. if (ex instanceof _core_utils.MissingDataException) {
  49790. throw ex;
  49791. }
  49792. (0, _util.info)(`Skipping invalid Metadata: "${ex}".`);
  49793. }
  49794. return (0, _util.shadow)(this, "metadata", metadata);
  49795. }
  49796. get markInfo() {
  49797. let markInfo = null;
  49798. try {
  49799. markInfo = this._readMarkInfo();
  49800. } catch (ex) {
  49801. if (ex instanceof _core_utils.MissingDataException) {
  49802. throw ex;
  49803. }
  49804. (0, _util.warn)("Unable to read mark info.");
  49805. }
  49806. return (0, _util.shadow)(this, "markInfo", markInfo);
  49807. }
  49808. _readMarkInfo() {
  49809. const obj = this._catDict.get("MarkInfo");
  49810. if (!(obj instanceof _primitives.Dict)) {
  49811. return null;
  49812. }
  49813. const markInfo = {
  49814. Marked: false,
  49815. UserProperties: false,
  49816. Suspects: false
  49817. };
  49818. for (const key in markInfo) {
  49819. const value = obj.get(key);
  49820. if (typeof value === "boolean") {
  49821. markInfo[key] = value;
  49822. }
  49823. }
  49824. return markInfo;
  49825. }
  49826. get structTreeRoot() {
  49827. let structTree = null;
  49828. try {
  49829. structTree = this._readStructTreeRoot();
  49830. } catch (ex) {
  49831. if (ex instanceof _core_utils.MissingDataException) {
  49832. throw ex;
  49833. }
  49834. (0, _util.warn)("Unable read to structTreeRoot info.");
  49835. }
  49836. return (0, _util.shadow)(this, "structTreeRoot", structTree);
  49837. }
  49838. _readStructTreeRoot() {
  49839. const obj = this._catDict.get("StructTreeRoot");
  49840. if (!(obj instanceof _primitives.Dict)) {
  49841. return null;
  49842. }
  49843. const root = new _struct_tree.StructTreeRoot(obj);
  49844. root.init();
  49845. return root;
  49846. }
  49847. get toplevelPagesDict() {
  49848. const pagesObj = this._catDict.get("Pages");
  49849. if (!(pagesObj instanceof _primitives.Dict)) {
  49850. throw new _util.FormatError("Invalid top-level pages dictionary.");
  49851. }
  49852. return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
  49853. }
  49854. get documentOutline() {
  49855. let obj = null;
  49856. try {
  49857. obj = this._readDocumentOutline();
  49858. } catch (ex) {
  49859. if (ex instanceof _core_utils.MissingDataException) {
  49860. throw ex;
  49861. }
  49862. (0, _util.warn)("Unable to read document outline.");
  49863. }
  49864. return (0, _util.shadow)(this, "documentOutline", obj);
  49865. }
  49866. _readDocumentOutline() {
  49867. let obj = this._catDict.get("Outlines");
  49868. if (!(obj instanceof _primitives.Dict)) {
  49869. return null;
  49870. }
  49871. obj = obj.getRaw("First");
  49872. if (!(obj instanceof _primitives.Ref)) {
  49873. return null;
  49874. }
  49875. const root = {
  49876. items: []
  49877. };
  49878. const queue = [{
  49879. obj,
  49880. parent: root
  49881. }];
  49882. const processed = new _primitives.RefSet();
  49883. processed.put(obj);
  49884. const xref = this.xref,
  49885. blackColor = new Uint8ClampedArray(3);
  49886. while (queue.length > 0) {
  49887. const i = queue.shift();
  49888. const outlineDict = xref.fetchIfRef(i.obj);
  49889. if (outlineDict === null) {
  49890. continue;
  49891. }
  49892. if (!outlineDict.has("Title")) {
  49893. throw new _util.FormatError("Invalid outline item encountered.");
  49894. }
  49895. const data = {
  49896. url: null,
  49897. dest: null,
  49898. action: null
  49899. };
  49900. Catalog.parseDestDictionary({
  49901. destDict: outlineDict,
  49902. resultObj: data,
  49903. docBaseUrl: this.pdfManager.docBaseUrl,
  49904. docAttachments: this.attachments
  49905. });
  49906. const title = outlineDict.get("Title");
  49907. const flags = outlineDict.get("F") || 0;
  49908. const color = outlineDict.getArray("C");
  49909. const count = outlineDict.get("Count");
  49910. let rgbColor = blackColor;
  49911. if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  49912. rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
  49913. }
  49914. const outlineItem = {
  49915. action: data.action,
  49916. attachment: data.attachment,
  49917. dest: data.dest,
  49918. url: data.url,
  49919. unsafeUrl: data.unsafeUrl,
  49920. newWindow: data.newWindow,
  49921. setOCGState: data.setOCGState,
  49922. title: (0, _util.stringToPDFString)(title),
  49923. color: rgbColor,
  49924. count: Number.isInteger(count) ? count : undefined,
  49925. bold: !!(flags & 2),
  49926. italic: !!(flags & 1),
  49927. items: []
  49928. };
  49929. i.parent.items.push(outlineItem);
  49930. obj = outlineDict.getRaw("First");
  49931. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  49932. queue.push({
  49933. obj,
  49934. parent: outlineItem
  49935. });
  49936. processed.put(obj);
  49937. }
  49938. obj = outlineDict.getRaw("Next");
  49939. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  49940. queue.push({
  49941. obj,
  49942. parent: i.parent
  49943. });
  49944. processed.put(obj);
  49945. }
  49946. }
  49947. return root.items.length > 0 ? root.items : null;
  49948. }
  49949. get permissions() {
  49950. let permissions = null;
  49951. try {
  49952. permissions = this._readPermissions();
  49953. } catch (ex) {
  49954. if (ex instanceof _core_utils.MissingDataException) {
  49955. throw ex;
  49956. }
  49957. (0, _util.warn)("Unable to read permissions.");
  49958. }
  49959. return (0, _util.shadow)(this, "permissions", permissions);
  49960. }
  49961. _readPermissions() {
  49962. const encrypt = this.xref.trailer.get("Encrypt");
  49963. if (!(encrypt instanceof _primitives.Dict)) {
  49964. return null;
  49965. }
  49966. let flags = encrypt.get("P");
  49967. if (typeof flags !== "number") {
  49968. return null;
  49969. }
  49970. flags += 2 ** 32;
  49971. const permissions = [];
  49972. for (const key in _util.PermissionFlag) {
  49973. const value = _util.PermissionFlag[key];
  49974. if (flags & value) {
  49975. permissions.push(value);
  49976. }
  49977. }
  49978. return permissions;
  49979. }
  49980. get optionalContentConfig() {
  49981. let config = null;
  49982. try {
  49983. const properties = this._catDict.get("OCProperties");
  49984. if (!properties) {
  49985. return (0, _util.shadow)(this, "optionalContentConfig", null);
  49986. }
  49987. const defaultConfig = properties.get("D");
  49988. if (!defaultConfig) {
  49989. return (0, _util.shadow)(this, "optionalContentConfig", null);
  49990. }
  49991. const groupsData = properties.get("OCGs");
  49992. if (!Array.isArray(groupsData)) {
  49993. return (0, _util.shadow)(this, "optionalContentConfig", null);
  49994. }
  49995. const groups = [];
  49996. const groupRefs = [];
  49997. for (const groupRef of groupsData) {
  49998. if (!(groupRef instanceof _primitives.Ref)) {
  49999. continue;
  50000. }
  50001. groupRefs.push(groupRef);
  50002. const group = this.xref.fetchIfRef(groupRef);
  50003. groups.push({
  50004. id: groupRef.toString(),
  50005. name: typeof group.get("Name") === "string" ? (0, _util.stringToPDFString)(group.get("Name")) : null,
  50006. intent: typeof group.get("Intent") === "string" ? (0, _util.stringToPDFString)(group.get("Intent")) : null
  50007. });
  50008. }
  50009. config = this._readOptionalContentConfig(defaultConfig, groupRefs);
  50010. config.groups = groups;
  50011. } catch (ex) {
  50012. if (ex instanceof _core_utils.MissingDataException) {
  50013. throw ex;
  50014. }
  50015. (0, _util.warn)(`Unable to read optional content config: ${ex}`);
  50016. }
  50017. return (0, _util.shadow)(this, "optionalContentConfig", config);
  50018. }
  50019. _readOptionalContentConfig(config, contentGroupRefs) {
  50020. function parseOnOff(refs) {
  50021. const onParsed = [];
  50022. if (Array.isArray(refs)) {
  50023. for (const value of refs) {
  50024. if (!(value instanceof _primitives.Ref)) {
  50025. continue;
  50026. }
  50027. if (contentGroupRefs.includes(value)) {
  50028. onParsed.push(value.toString());
  50029. }
  50030. }
  50031. }
  50032. return onParsed;
  50033. }
  50034. function parseOrder(refs, nestedLevels = 0) {
  50035. if (!Array.isArray(refs)) {
  50036. return null;
  50037. }
  50038. const order = [];
  50039. for (const value of refs) {
  50040. if (value instanceof _primitives.Ref && contentGroupRefs.includes(value)) {
  50041. parsedOrderRefs.put(value);
  50042. order.push(value.toString());
  50043. continue;
  50044. }
  50045. const nestedOrder = parseNestedOrder(value, nestedLevels);
  50046. if (nestedOrder) {
  50047. order.push(nestedOrder);
  50048. }
  50049. }
  50050. if (nestedLevels > 0) {
  50051. return order;
  50052. }
  50053. const hiddenGroups = [];
  50054. for (const groupRef of contentGroupRefs) {
  50055. if (parsedOrderRefs.has(groupRef)) {
  50056. continue;
  50057. }
  50058. hiddenGroups.push(groupRef.toString());
  50059. }
  50060. if (hiddenGroups.length) {
  50061. order.push({
  50062. name: null,
  50063. order: hiddenGroups
  50064. });
  50065. }
  50066. return order;
  50067. }
  50068. function parseNestedOrder(ref, nestedLevels) {
  50069. if (++nestedLevels > MAX_NESTED_LEVELS) {
  50070. (0, _util.warn)("parseNestedOrder - reached MAX_NESTED_LEVELS.");
  50071. return null;
  50072. }
  50073. const value = xref.fetchIfRef(ref);
  50074. if (!Array.isArray(value)) {
  50075. return null;
  50076. }
  50077. const nestedName = xref.fetchIfRef(value[0]);
  50078. if (typeof nestedName !== "string") {
  50079. return null;
  50080. }
  50081. const nestedOrder = parseOrder(value.slice(1), nestedLevels);
  50082. if (!nestedOrder || !nestedOrder.length) {
  50083. return null;
  50084. }
  50085. return {
  50086. name: (0, _util.stringToPDFString)(nestedName),
  50087. order: nestedOrder
  50088. };
  50089. }
  50090. const xref = this.xref,
  50091. parsedOrderRefs = new _primitives.RefSet(),
  50092. MAX_NESTED_LEVELS = 10;
  50093. return {
  50094. name: typeof config.get("Name") === "string" ? (0, _util.stringToPDFString)(config.get("Name")) : null,
  50095. creator: typeof config.get("Creator") === "string" ? (0, _util.stringToPDFString)(config.get("Creator")) : null,
  50096. baseState: config.get("BaseState") instanceof _primitives.Name ? config.get("BaseState").name : null,
  50097. on: parseOnOff(config.get("ON")),
  50098. off: parseOnOff(config.get("OFF")),
  50099. order: parseOrder(config.get("Order")),
  50100. groups: null
  50101. };
  50102. }
  50103. setActualNumPages(num = null) {
  50104. this._actualNumPages = num;
  50105. }
  50106. get hasActualNumPages() {
  50107. return this._actualNumPages !== null;
  50108. }
  50109. get _pagesCount() {
  50110. const obj = this.toplevelPagesDict.get("Count");
  50111. if (!Number.isInteger(obj)) {
  50112. throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
  50113. }
  50114. return (0, _util.shadow)(this, "_pagesCount", obj);
  50115. }
  50116. get numPages() {
  50117. return this.hasActualNumPages ? this._actualNumPages : this._pagesCount;
  50118. }
  50119. get destinations() {
  50120. const obj = this._readDests(),
  50121. dests = Object.create(null);
  50122. if (obj instanceof _name_number_tree.NameTree) {
  50123. for (const [key, value] of obj.getAll()) {
  50124. const dest = fetchDestination(value);
  50125. if (dest) {
  50126. dests[(0, _util.stringToPDFString)(key)] = dest;
  50127. }
  50128. }
  50129. } else if (obj instanceof _primitives.Dict) {
  50130. obj.forEach(function (key, value) {
  50131. const dest = fetchDestination(value);
  50132. if (dest) {
  50133. dests[key] = dest;
  50134. }
  50135. });
  50136. }
  50137. return (0, _util.shadow)(this, "destinations", dests);
  50138. }
  50139. getDestination(id) {
  50140. const obj = this._readDests();
  50141. if (obj instanceof _name_number_tree.NameTree) {
  50142. const dest = fetchDestination(obj.get(id));
  50143. if (dest) {
  50144. return dest;
  50145. }
  50146. const allDest = this.destinations[id];
  50147. if (allDest) {
  50148. (0, _util.warn)(`Found "${id}" at an incorrect position in the NameTree.`);
  50149. return allDest;
  50150. }
  50151. } else if (obj instanceof _primitives.Dict) {
  50152. const dest = fetchDestination(obj.get(id));
  50153. if (dest) {
  50154. return dest;
  50155. }
  50156. }
  50157. return null;
  50158. }
  50159. _readDests() {
  50160. const obj = this._catDict.get("Names");
  50161. if (obj && obj.has("Dests")) {
  50162. return new _name_number_tree.NameTree(obj.getRaw("Dests"), this.xref);
  50163. } else if (this._catDict.has("Dests")) {
  50164. return this._catDict.get("Dests");
  50165. }
  50166. return undefined;
  50167. }
  50168. get pageLabels() {
  50169. let obj = null;
  50170. try {
  50171. obj = this._readPageLabels();
  50172. } catch (ex) {
  50173. if (ex instanceof _core_utils.MissingDataException) {
  50174. throw ex;
  50175. }
  50176. (0, _util.warn)("Unable to read page labels.");
  50177. }
  50178. return (0, _util.shadow)(this, "pageLabels", obj);
  50179. }
  50180. _readPageLabels() {
  50181. const obj = this._catDict.getRaw("PageLabels");
  50182. if (!obj) {
  50183. return null;
  50184. }
  50185. const pageLabels = new Array(this.numPages);
  50186. let style = null,
  50187. prefix = "";
  50188. const numberTree = new _name_number_tree.NumberTree(obj, this.xref);
  50189. const nums = numberTree.getAll();
  50190. let currentLabel = "",
  50191. currentIndex = 1;
  50192. for (let i = 0, ii = this.numPages; i < ii; i++) {
  50193. const labelDict = nums.get(i);
  50194. if (labelDict !== undefined) {
  50195. if (!(labelDict instanceof _primitives.Dict)) {
  50196. throw new _util.FormatError("PageLabel is not a dictionary.");
  50197. }
  50198. if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
  50199. throw new _util.FormatError("Invalid type in PageLabel dictionary.");
  50200. }
  50201. if (labelDict.has("S")) {
  50202. const s = labelDict.get("S");
  50203. if (!(s instanceof _primitives.Name)) {
  50204. throw new _util.FormatError("Invalid style in PageLabel dictionary.");
  50205. }
  50206. style = s.name;
  50207. } else {
  50208. style = null;
  50209. }
  50210. if (labelDict.has("P")) {
  50211. const p = labelDict.get("P");
  50212. if (typeof p !== "string") {
  50213. throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
  50214. }
  50215. prefix = (0, _util.stringToPDFString)(p);
  50216. } else {
  50217. prefix = "";
  50218. }
  50219. if (labelDict.has("St")) {
  50220. const st = labelDict.get("St");
  50221. if (!(Number.isInteger(st) && st >= 1)) {
  50222. throw new _util.FormatError("Invalid start in PageLabel dictionary.");
  50223. }
  50224. currentIndex = st;
  50225. } else {
  50226. currentIndex = 1;
  50227. }
  50228. }
  50229. switch (style) {
  50230. case "D":
  50231. currentLabel = currentIndex;
  50232. break;
  50233. case "R":
  50234. case "r":
  50235. currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
  50236. break;
  50237. case "A":
  50238. case "a":
  50239. const LIMIT = 26;
  50240. const A_UPPER_CASE = 0x41,
  50241. A_LOWER_CASE = 0x61;
  50242. const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  50243. const letterIndex = currentIndex - 1;
  50244. const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  50245. currentLabel = character.repeat(Math.floor(letterIndex / LIMIT) + 1);
  50246. break;
  50247. default:
  50248. if (style) {
  50249. throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
  50250. }
  50251. currentLabel = "";
  50252. }
  50253. pageLabels[i] = prefix + currentLabel;
  50254. currentIndex++;
  50255. }
  50256. return pageLabels;
  50257. }
  50258. get pageLayout() {
  50259. const obj = this._catDict.get("PageLayout");
  50260. let pageLayout = "";
  50261. if (obj instanceof _primitives.Name) {
  50262. switch (obj.name) {
  50263. case "SinglePage":
  50264. case "OneColumn":
  50265. case "TwoColumnLeft":
  50266. case "TwoColumnRight":
  50267. case "TwoPageLeft":
  50268. case "TwoPageRight":
  50269. pageLayout = obj.name;
  50270. }
  50271. }
  50272. return (0, _util.shadow)(this, "pageLayout", pageLayout);
  50273. }
  50274. get pageMode() {
  50275. const obj = this._catDict.get("PageMode");
  50276. let pageMode = "UseNone";
  50277. if (obj instanceof _primitives.Name) {
  50278. switch (obj.name) {
  50279. case "UseNone":
  50280. case "UseOutlines":
  50281. case "UseThumbs":
  50282. case "FullScreen":
  50283. case "UseOC":
  50284. case "UseAttachments":
  50285. pageMode = obj.name;
  50286. }
  50287. }
  50288. return (0, _util.shadow)(this, "pageMode", pageMode);
  50289. }
  50290. get viewerPreferences() {
  50291. const obj = this._catDict.get("ViewerPreferences");
  50292. if (!(obj instanceof _primitives.Dict)) {
  50293. return (0, _util.shadow)(this, "viewerPreferences", null);
  50294. }
  50295. let prefs = null;
  50296. for (const key of obj.getKeys()) {
  50297. const value = obj.get(key);
  50298. let prefValue;
  50299. switch (key) {
  50300. case "HideToolbar":
  50301. case "HideMenubar":
  50302. case "HideWindowUI":
  50303. case "FitWindow":
  50304. case "CenterWindow":
  50305. case "DisplayDocTitle":
  50306. case "PickTrayByPDFSize":
  50307. if (typeof value === "boolean") {
  50308. prefValue = value;
  50309. }
  50310. break;
  50311. case "NonFullScreenPageMode":
  50312. if (value instanceof _primitives.Name) {
  50313. switch (value.name) {
  50314. case "UseNone":
  50315. case "UseOutlines":
  50316. case "UseThumbs":
  50317. case "UseOC":
  50318. prefValue = value.name;
  50319. break;
  50320. default:
  50321. prefValue = "UseNone";
  50322. }
  50323. }
  50324. break;
  50325. case "Direction":
  50326. if (value instanceof _primitives.Name) {
  50327. switch (value.name) {
  50328. case "L2R":
  50329. case "R2L":
  50330. prefValue = value.name;
  50331. break;
  50332. default:
  50333. prefValue = "L2R";
  50334. }
  50335. }
  50336. break;
  50337. case "ViewArea":
  50338. case "ViewClip":
  50339. case "PrintArea":
  50340. case "PrintClip":
  50341. if (value instanceof _primitives.Name) {
  50342. switch (value.name) {
  50343. case "MediaBox":
  50344. case "CropBox":
  50345. case "BleedBox":
  50346. case "TrimBox":
  50347. case "ArtBox":
  50348. prefValue = value.name;
  50349. break;
  50350. default:
  50351. prefValue = "CropBox";
  50352. }
  50353. }
  50354. break;
  50355. case "PrintScaling":
  50356. if (value instanceof _primitives.Name) {
  50357. switch (value.name) {
  50358. case "None":
  50359. case "AppDefault":
  50360. prefValue = value.name;
  50361. break;
  50362. default:
  50363. prefValue = "AppDefault";
  50364. }
  50365. }
  50366. break;
  50367. case "Duplex":
  50368. if (value instanceof _primitives.Name) {
  50369. switch (value.name) {
  50370. case "Simplex":
  50371. case "DuplexFlipShortEdge":
  50372. case "DuplexFlipLongEdge":
  50373. prefValue = value.name;
  50374. break;
  50375. default:
  50376. prefValue = "None";
  50377. }
  50378. }
  50379. break;
  50380. case "PrintPageRange":
  50381. if (Array.isArray(value) && value.length % 2 === 0) {
  50382. const isValid = value.every((page, i, arr) => {
  50383. return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;
  50384. });
  50385. if (isValid) {
  50386. prefValue = value;
  50387. }
  50388. }
  50389. break;
  50390. case "NumCopies":
  50391. if (Number.isInteger(value) && value > 0) {
  50392. prefValue = value;
  50393. }
  50394. break;
  50395. default:
  50396. (0, _util.warn)(`Ignoring non-standard key in ViewerPreferences: ${key}.`);
  50397. continue;
  50398. }
  50399. if (prefValue === undefined) {
  50400. (0, _util.warn)(`Bad value, for key "${key}", in ViewerPreferences: ${value}.`);
  50401. continue;
  50402. }
  50403. if (!prefs) {
  50404. prefs = Object.create(null);
  50405. }
  50406. prefs[key] = prefValue;
  50407. }
  50408. return (0, _util.shadow)(this, "viewerPreferences", prefs);
  50409. }
  50410. get openAction() {
  50411. const obj = this._catDict.get("OpenAction");
  50412. const openAction = Object.create(null);
  50413. if (obj instanceof _primitives.Dict) {
  50414. const destDict = new _primitives.Dict(this.xref);
  50415. destDict.set("A", obj);
  50416. const resultObj = {
  50417. url: null,
  50418. dest: null,
  50419. action: null
  50420. };
  50421. Catalog.parseDestDictionary({
  50422. destDict,
  50423. resultObj
  50424. });
  50425. if (Array.isArray(resultObj.dest)) {
  50426. openAction.dest = resultObj.dest;
  50427. } else if (resultObj.action) {
  50428. openAction.action = resultObj.action;
  50429. }
  50430. } else if (Array.isArray(obj)) {
  50431. openAction.dest = obj;
  50432. }
  50433. return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null);
  50434. }
  50435. get attachments() {
  50436. const obj = this._catDict.get("Names");
  50437. let attachments = null;
  50438. if (obj instanceof _primitives.Dict && obj.has("EmbeddedFiles")) {
  50439. const nameTree = new _name_number_tree.NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
  50440. for (const [key, value] of nameTree.getAll()) {
  50441. const fs = new _file_spec.FileSpec(value, this.xref);
  50442. if (!attachments) {
  50443. attachments = Object.create(null);
  50444. }
  50445. attachments[(0, _util.stringToPDFString)(key)] = fs.serializable;
  50446. }
  50447. }
  50448. return (0, _util.shadow)(this, "attachments", attachments);
  50449. }
  50450. get xfaImages() {
  50451. const obj = this._catDict.get("Names");
  50452. let xfaImages = null;
  50453. if (obj instanceof _primitives.Dict && obj.has("XFAImages")) {
  50454. const nameTree = new _name_number_tree.NameTree(obj.getRaw("XFAImages"), this.xref);
  50455. for (const [key, value] of nameTree.getAll()) {
  50456. if (!xfaImages) {
  50457. xfaImages = new _primitives.Dict(this.xref);
  50458. }
  50459. xfaImages.set((0, _util.stringToPDFString)(key), value);
  50460. }
  50461. }
  50462. return (0, _util.shadow)(this, "xfaImages", xfaImages);
  50463. }
  50464. _collectJavaScript() {
  50465. const obj = this._catDict.get("Names");
  50466. let javaScript = null;
  50467. function appendIfJavaScriptDict(name, jsDict) {
  50468. if (!(jsDict instanceof _primitives.Dict)) {
  50469. return;
  50470. }
  50471. if (!(0, _primitives.isName)(jsDict.get("S"), "JavaScript")) {
  50472. return;
  50473. }
  50474. let js = jsDict.get("JS");
  50475. if (js instanceof _base_stream.BaseStream) {
  50476. js = js.getString();
  50477. } else if (typeof js !== "string") {
  50478. return;
  50479. }
  50480. if (javaScript === null) {
  50481. javaScript = new Map();
  50482. }
  50483. js = (0, _util.stringToPDFString)(js).replace(/\u0000/g, "");
  50484. javaScript.set(name, js);
  50485. }
  50486. if (obj instanceof _primitives.Dict && obj.has("JavaScript")) {
  50487. const nameTree = new _name_number_tree.NameTree(obj.getRaw("JavaScript"), this.xref);
  50488. for (const [key, value] of nameTree.getAll()) {
  50489. appendIfJavaScriptDict((0, _util.stringToPDFString)(key), value);
  50490. }
  50491. }
  50492. const openAction = this._catDict.get("OpenAction");
  50493. if (openAction) {
  50494. appendIfJavaScriptDict("OpenAction", openAction);
  50495. }
  50496. return javaScript;
  50497. }
  50498. get javaScript() {
  50499. const javaScript = this._collectJavaScript();
  50500. return (0, _util.shadow)(this, "javaScript", javaScript ? [...javaScript.values()] : null);
  50501. }
  50502. get jsActions() {
  50503. const javaScript = this._collectJavaScript();
  50504. let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType);
  50505. if (javaScript) {
  50506. if (!actions) {
  50507. actions = Object.create(null);
  50508. }
  50509. for (const [key, val] of javaScript) {
  50510. if (key in actions) {
  50511. actions[key].push(val);
  50512. } else {
  50513. actions[key] = [val];
  50514. }
  50515. }
  50516. }
  50517. return (0, _util.shadow)(this, "jsActions", actions);
  50518. }
  50519. async fontFallback(id, handler) {
  50520. const translatedFonts = await Promise.all(this.fontCache);
  50521. for (const translatedFont of translatedFonts) {
  50522. if (translatedFont.loadedName === id) {
  50523. translatedFont.fallback(handler);
  50524. return;
  50525. }
  50526. }
  50527. }
  50528. async cleanup(manuallyTriggered = false) {
  50529. (0, _cleanup_helper.clearGlobalCaches)();
  50530. this.globalImageCache.clear(manuallyTriggered);
  50531. this.pageKidsCountCache.clear();
  50532. this.pageIndexCache.clear();
  50533. this.nonBlendModesSet.clear();
  50534. const translatedFonts = await Promise.all(this.fontCache);
  50535. for (const {
  50536. dict
  50537. } of translatedFonts) {
  50538. delete dict.cacheKey;
  50539. }
  50540. this.fontCache.clear();
  50541. this.builtInCMapCache.clear();
  50542. this.standardFontDataCache.clear();
  50543. }
  50544. async getPageDict(pageIndex) {
  50545. const nodesToVisit = [this.toplevelPagesDict];
  50546. const visitedNodes = new _primitives.RefSet();
  50547. const pagesRef = this._catDict.getRaw("Pages");
  50548. if (pagesRef instanceof _primitives.Ref) {
  50549. visitedNodes.put(pagesRef);
  50550. }
  50551. const xref = this.xref,
  50552. pageKidsCountCache = this.pageKidsCountCache,
  50553. pageIndexCache = this.pageIndexCache;
  50554. let currentPageIndex = 0;
  50555. while (nodesToVisit.length) {
  50556. const currentNode = nodesToVisit.pop();
  50557. if (currentNode instanceof _primitives.Ref) {
  50558. const count = pageKidsCountCache.get(currentNode);
  50559. if (count >= 0 && currentPageIndex + count <= pageIndex) {
  50560. currentPageIndex += count;
  50561. continue;
  50562. }
  50563. if (visitedNodes.has(currentNode)) {
  50564. throw new _util.FormatError("Pages tree contains circular reference.");
  50565. }
  50566. visitedNodes.put(currentNode);
  50567. const obj = await xref.fetchAsync(currentNode);
  50568. if (obj instanceof _primitives.Dict) {
  50569. let type = obj.getRaw("Type");
  50570. if (type instanceof _primitives.Ref) {
  50571. type = await xref.fetchAsync(type);
  50572. }
  50573. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  50574. if (!pageKidsCountCache.has(currentNode)) {
  50575. pageKidsCountCache.put(currentNode, 1);
  50576. }
  50577. if (!pageIndexCache.has(currentNode)) {
  50578. pageIndexCache.put(currentNode, currentPageIndex);
  50579. }
  50580. if (currentPageIndex === pageIndex) {
  50581. return [obj, currentNode];
  50582. }
  50583. currentPageIndex++;
  50584. continue;
  50585. }
  50586. }
  50587. nodesToVisit.push(obj);
  50588. continue;
  50589. }
  50590. if (!(currentNode instanceof _primitives.Dict)) {
  50591. throw new _util.FormatError("Page dictionary kid reference points to wrong type of object.");
  50592. }
  50593. const {
  50594. objId
  50595. } = currentNode;
  50596. let count = currentNode.getRaw("Count");
  50597. if (count instanceof _primitives.Ref) {
  50598. count = await xref.fetchAsync(count);
  50599. }
  50600. if (Number.isInteger(count) && count >= 0) {
  50601. if (objId && !pageKidsCountCache.has(objId)) {
  50602. pageKidsCountCache.put(objId, count);
  50603. }
  50604. if (currentPageIndex + count <= pageIndex) {
  50605. currentPageIndex += count;
  50606. continue;
  50607. }
  50608. }
  50609. let kids = currentNode.getRaw("Kids");
  50610. if (kids instanceof _primitives.Ref) {
  50611. kids = await xref.fetchAsync(kids);
  50612. }
  50613. if (!Array.isArray(kids)) {
  50614. let type = currentNode.getRaw("Type");
  50615. if (type instanceof _primitives.Ref) {
  50616. type = await xref.fetchAsync(type);
  50617. }
  50618. if ((0, _primitives.isName)(type, "Page") || !currentNode.has("Kids")) {
  50619. if (currentPageIndex === pageIndex) {
  50620. return [currentNode, null];
  50621. }
  50622. currentPageIndex++;
  50623. continue;
  50624. }
  50625. throw new _util.FormatError("Page dictionary kids object is not an array.");
  50626. }
  50627. for (let last = kids.length - 1; last >= 0; last--) {
  50628. nodesToVisit.push(kids[last]);
  50629. }
  50630. }
  50631. throw new Error(`Page index ${pageIndex} not found.`);
  50632. }
  50633. async getAllPageDicts(recoveryMode = false) {
  50634. const {
  50635. ignoreErrors
  50636. } = this.pdfManager.evaluatorOptions;
  50637. const queue = [{
  50638. currentNode: this.toplevelPagesDict,
  50639. posInKids: 0
  50640. }];
  50641. const visitedNodes = new _primitives.RefSet();
  50642. const pagesRef = this._catDict.getRaw("Pages");
  50643. if (pagesRef instanceof _primitives.Ref) {
  50644. visitedNodes.put(pagesRef);
  50645. }
  50646. const map = new Map(),
  50647. xref = this.xref,
  50648. pageIndexCache = this.pageIndexCache;
  50649. let pageIndex = 0;
  50650. function addPageDict(pageDict, pageRef) {
  50651. if (pageRef && !pageIndexCache.has(pageRef)) {
  50652. pageIndexCache.put(pageRef, pageIndex);
  50653. }
  50654. map.set(pageIndex++, [pageDict, pageRef]);
  50655. }
  50656. function addPageError(error) {
  50657. if (error instanceof _core_utils.XRefEntryException && !recoveryMode) {
  50658. throw error;
  50659. }
  50660. if (recoveryMode && ignoreErrors && pageIndex === 0) {
  50661. (0, _util.warn)(`getAllPageDicts - Skipping invalid first page: "${error}".`);
  50662. error = _primitives.Dict.empty;
  50663. }
  50664. map.set(pageIndex++, [error, null]);
  50665. }
  50666. while (queue.length > 0) {
  50667. const queueItem = queue.at(-1);
  50668. const {
  50669. currentNode,
  50670. posInKids
  50671. } = queueItem;
  50672. let kids = currentNode.getRaw("Kids");
  50673. if (kids instanceof _primitives.Ref) {
  50674. try {
  50675. kids = await xref.fetchAsync(kids);
  50676. } catch (ex) {
  50677. addPageError(ex);
  50678. break;
  50679. }
  50680. }
  50681. if (!Array.isArray(kids)) {
  50682. addPageError(new _util.FormatError("Page dictionary kids object is not an array."));
  50683. break;
  50684. }
  50685. if (posInKids >= kids.length) {
  50686. queue.pop();
  50687. continue;
  50688. }
  50689. const kidObj = kids[posInKids];
  50690. let obj;
  50691. if (kidObj instanceof _primitives.Ref) {
  50692. if (visitedNodes.has(kidObj)) {
  50693. addPageError(new _util.FormatError("Pages tree contains circular reference."));
  50694. break;
  50695. }
  50696. visitedNodes.put(kidObj);
  50697. try {
  50698. obj = await xref.fetchAsync(kidObj);
  50699. } catch (ex) {
  50700. addPageError(ex);
  50701. break;
  50702. }
  50703. } else {
  50704. obj = kidObj;
  50705. }
  50706. if (!(obj instanceof _primitives.Dict)) {
  50707. addPageError(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
  50708. break;
  50709. }
  50710. let type = obj.getRaw("Type");
  50711. if (type instanceof _primitives.Ref) {
  50712. try {
  50713. type = await xref.fetchAsync(type);
  50714. } catch (ex) {
  50715. addPageError(ex);
  50716. break;
  50717. }
  50718. }
  50719. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  50720. addPageDict(obj, kidObj instanceof _primitives.Ref ? kidObj : null);
  50721. } else {
  50722. queue.push({
  50723. currentNode: obj,
  50724. posInKids: 0
  50725. });
  50726. }
  50727. queueItem.posInKids++;
  50728. }
  50729. return map;
  50730. }
  50731. getPageIndex(pageRef) {
  50732. const cachedPageIndex = this.pageIndexCache.get(pageRef);
  50733. if (cachedPageIndex !== undefined) {
  50734. return Promise.resolve(cachedPageIndex);
  50735. }
  50736. const xref = this.xref;
  50737. function pagesBeforeRef(kidRef) {
  50738. let total = 0,
  50739. parentRef;
  50740. return xref.fetchAsync(kidRef).then(function (node) {
  50741. if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !(node instanceof _primitives.Dict && !node.has("Type") && node.has("Contents"))) {
  50742. throw new _util.FormatError("The reference does not point to a /Page dictionary.");
  50743. }
  50744. if (!node) {
  50745. return null;
  50746. }
  50747. if (!(node instanceof _primitives.Dict)) {
  50748. throw new _util.FormatError("Node must be a dictionary.");
  50749. }
  50750. parentRef = node.getRaw("Parent");
  50751. return node.getAsync("Parent");
  50752. }).then(function (parent) {
  50753. if (!parent) {
  50754. return null;
  50755. }
  50756. if (!(parent instanceof _primitives.Dict)) {
  50757. throw new _util.FormatError("Parent must be a dictionary.");
  50758. }
  50759. return parent.getAsync("Kids");
  50760. }).then(function (kids) {
  50761. if (!kids) {
  50762. return null;
  50763. }
  50764. const kidPromises = [];
  50765. let found = false;
  50766. for (const kid of kids) {
  50767. if (!(kid instanceof _primitives.Ref)) {
  50768. throw new _util.FormatError("Kid must be a reference.");
  50769. }
  50770. if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
  50771. found = true;
  50772. break;
  50773. }
  50774. kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
  50775. if (!(obj instanceof _primitives.Dict)) {
  50776. throw new _util.FormatError("Kid node must be a dictionary.");
  50777. }
  50778. if (obj.has("Count")) {
  50779. total += obj.get("Count");
  50780. } else {
  50781. total++;
  50782. }
  50783. }));
  50784. }
  50785. if (!found) {
  50786. throw new _util.FormatError("Kid reference not found in parent's kids.");
  50787. }
  50788. return Promise.all(kidPromises).then(function () {
  50789. return [total, parentRef];
  50790. });
  50791. });
  50792. }
  50793. let total = 0;
  50794. const next = ref => pagesBeforeRef(ref).then(args => {
  50795. if (!args) {
  50796. this.pageIndexCache.put(pageRef, total);
  50797. return total;
  50798. }
  50799. const [count, parentRef] = args;
  50800. total += count;
  50801. return next(parentRef);
  50802. });
  50803. return next(pageRef);
  50804. }
  50805. get baseUrl() {
  50806. const uri = this._catDict.get("URI");
  50807. if (uri instanceof _primitives.Dict) {
  50808. const base = uri.get("Base");
  50809. if (typeof base === "string") {
  50810. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(base, null, {
  50811. tryConvertEncoding: true
  50812. });
  50813. if (absoluteUrl) {
  50814. return (0, _util.shadow)(this, "baseUrl", absoluteUrl.href);
  50815. }
  50816. }
  50817. }
  50818. return (0, _util.shadow)(this, "baseUrl", null);
  50819. }
  50820. static parseDestDictionary(params) {
  50821. const destDict = params.destDict;
  50822. if (!(destDict instanceof _primitives.Dict)) {
  50823. (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
  50824. return;
  50825. }
  50826. const resultObj = params.resultObj;
  50827. if (typeof resultObj !== "object") {
  50828. (0, _util.warn)("parseDestDictionary: `resultObj` must be an object.");
  50829. return;
  50830. }
  50831. const docBaseUrl = params.docBaseUrl || null;
  50832. const docAttachments = params.docAttachments || null;
  50833. let action = destDict.get("A"),
  50834. url,
  50835. dest;
  50836. if (!(action instanceof _primitives.Dict)) {
  50837. if (destDict.has("Dest")) {
  50838. action = destDict.get("Dest");
  50839. } else {
  50840. action = destDict.get("AA");
  50841. if (action instanceof _primitives.Dict) {
  50842. if (action.has("D")) {
  50843. action = action.get("D");
  50844. } else if (action.has("U")) {
  50845. action = action.get("U");
  50846. }
  50847. }
  50848. }
  50849. }
  50850. if (action instanceof _primitives.Dict) {
  50851. const actionType = action.get("S");
  50852. if (!(actionType instanceof _primitives.Name)) {
  50853. (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
  50854. return;
  50855. }
  50856. const actionName = actionType.name;
  50857. switch (actionName) {
  50858. case "ResetForm":
  50859. const flags = action.get("Flags");
  50860. const include = ((typeof flags === "number" ? flags : 0) & 1) === 0;
  50861. const fields = [];
  50862. const refs = [];
  50863. for (const obj of action.get("Fields") || []) {
  50864. if (obj instanceof _primitives.Ref) {
  50865. refs.push(obj.toString());
  50866. } else if (typeof obj === "string") {
  50867. fields.push((0, _util.stringToPDFString)(obj));
  50868. }
  50869. }
  50870. resultObj.resetForm = {
  50871. fields,
  50872. refs,
  50873. include
  50874. };
  50875. break;
  50876. case "URI":
  50877. url = action.get("URI");
  50878. if (url instanceof _primitives.Name) {
  50879. url = "/" + url.name;
  50880. }
  50881. break;
  50882. case "GoTo":
  50883. dest = action.get("D");
  50884. break;
  50885. case "Launch":
  50886. case "GoToR":
  50887. const urlDict = action.get("F");
  50888. if (urlDict instanceof _primitives.Dict) {
  50889. url = urlDict.get("F") || null;
  50890. } else if (typeof urlDict === "string") {
  50891. url = urlDict;
  50892. }
  50893. let remoteDest = action.get("D");
  50894. if (remoteDest) {
  50895. if (remoteDest instanceof _primitives.Name) {
  50896. remoteDest = remoteDest.name;
  50897. }
  50898. if (typeof url === "string") {
  50899. const baseUrl = url.split("#")[0];
  50900. if (typeof remoteDest === "string") {
  50901. url = baseUrl + "#" + remoteDest;
  50902. } else if (Array.isArray(remoteDest)) {
  50903. url = baseUrl + "#" + JSON.stringify(remoteDest);
  50904. }
  50905. }
  50906. }
  50907. const newWindow = action.get("NewWindow");
  50908. if (typeof newWindow === "boolean") {
  50909. resultObj.newWindow = newWindow;
  50910. }
  50911. break;
  50912. case "GoToE":
  50913. const target = action.get("T");
  50914. let attachment;
  50915. if (docAttachments && target instanceof _primitives.Dict) {
  50916. const relationship = target.get("R");
  50917. const name = target.get("N");
  50918. if ((0, _primitives.isName)(relationship, "C") && typeof name === "string") {
  50919. attachment = docAttachments[(0, _util.stringToPDFString)(name)];
  50920. }
  50921. }
  50922. if (attachment) {
  50923. resultObj.attachment = attachment;
  50924. } else {
  50925. (0, _util.warn)(`parseDestDictionary - unimplemented "GoToE" action.`);
  50926. }
  50927. break;
  50928. case "Named":
  50929. const namedAction = action.get("N");
  50930. if (namedAction instanceof _primitives.Name) {
  50931. resultObj.action = namedAction.name;
  50932. }
  50933. break;
  50934. case "SetOCGState":
  50935. const state = action.get("State");
  50936. const preserveRB = action.get("PreserveRB");
  50937. if (!Array.isArray(state) || state.length === 0) {
  50938. break;
  50939. }
  50940. const stateArr = [];
  50941. for (const elem of state) {
  50942. if (elem instanceof _primitives.Name) {
  50943. switch (elem.name) {
  50944. case "ON":
  50945. case "OFF":
  50946. case "Toggle":
  50947. stateArr.push(elem.name);
  50948. break;
  50949. }
  50950. } else if (elem instanceof _primitives.Ref) {
  50951. stateArr.push(elem.toString());
  50952. }
  50953. }
  50954. if (stateArr.length !== state.length) {
  50955. break;
  50956. }
  50957. resultObj.setOCGState = {
  50958. state: stateArr,
  50959. preserveRB: typeof preserveRB === "boolean" ? preserveRB : true
  50960. };
  50961. break;
  50962. case "JavaScript":
  50963. const jsAction = action.get("JS");
  50964. let js;
  50965. if (jsAction instanceof _base_stream.BaseStream) {
  50966. js = jsAction.getString();
  50967. } else if (typeof jsAction === "string") {
  50968. js = jsAction;
  50969. }
  50970. const jsURL = js && (0, _core_utils.recoverJsURL)((0, _util.stringToPDFString)(js));
  50971. if (jsURL) {
  50972. url = jsURL.url;
  50973. resultObj.newWindow = jsURL.newWindow;
  50974. break;
  50975. }
  50976. default:
  50977. if (actionName === "JavaScript" || actionName === "SubmitForm") {
  50978. break;
  50979. }
  50980. (0, _util.warn)(`parseDestDictionary - unsupported action: "${actionName}".`);
  50981. break;
  50982. }
  50983. } else if (destDict.has("Dest")) {
  50984. dest = destDict.get("Dest");
  50985. }
  50986. if (typeof url === "string") {
  50987. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl, {
  50988. addDefaultProtocol: true,
  50989. tryConvertEncoding: true
  50990. });
  50991. if (absoluteUrl) {
  50992. resultObj.url = absoluteUrl.href;
  50993. }
  50994. resultObj.unsafeUrl = url;
  50995. }
  50996. if (dest) {
  50997. if (dest instanceof _primitives.Name) {
  50998. dest = dest.name;
  50999. }
  51000. if (typeof dest === "string") {
  51001. resultObj.dest = (0, _util.stringToPDFString)(dest);
  51002. } else if (Array.isArray(dest)) {
  51003. resultObj.dest = dest;
  51004. }
  51005. }
  51006. }
  51007. }
  51008. exports.Catalog = Catalog;
  51009. /***/ }),
  51010. /* 68 */
  51011. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51012. Object.defineProperty(exports, "__esModule", ({
  51013. value: true
  51014. }));
  51015. exports.NumberTree = exports.NameTree = void 0;
  51016. var _primitives = __w_pdfjs_require__(3);
  51017. var _util = __w_pdfjs_require__(2);
  51018. class NameOrNumberTree {
  51019. constructor(root, xref, type) {
  51020. if (this.constructor === NameOrNumberTree) {
  51021. (0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
  51022. }
  51023. this.root = root;
  51024. this.xref = xref;
  51025. this._type = type;
  51026. }
  51027. getAll() {
  51028. const map = new Map();
  51029. if (!this.root) {
  51030. return map;
  51031. }
  51032. const xref = this.xref;
  51033. const processed = new _primitives.RefSet();
  51034. processed.put(this.root);
  51035. const queue = [this.root];
  51036. while (queue.length > 0) {
  51037. const obj = xref.fetchIfRef(queue.shift());
  51038. if (!(obj instanceof _primitives.Dict)) {
  51039. continue;
  51040. }
  51041. if (obj.has("Kids")) {
  51042. const kids = obj.get("Kids");
  51043. if (!Array.isArray(kids)) {
  51044. continue;
  51045. }
  51046. for (const kid of kids) {
  51047. if (processed.has(kid)) {
  51048. throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`);
  51049. }
  51050. queue.push(kid);
  51051. processed.put(kid);
  51052. }
  51053. continue;
  51054. }
  51055. const entries = obj.get(this._type);
  51056. if (!Array.isArray(entries)) {
  51057. continue;
  51058. }
  51059. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  51060. map.set(xref.fetchIfRef(entries[i]), xref.fetchIfRef(entries[i + 1]));
  51061. }
  51062. }
  51063. return map;
  51064. }
  51065. get(key) {
  51066. if (!this.root) {
  51067. return null;
  51068. }
  51069. const xref = this.xref;
  51070. let kidsOrEntries = xref.fetchIfRef(this.root);
  51071. let loopCount = 0;
  51072. const MAX_LEVELS = 10;
  51073. while (kidsOrEntries.has("Kids")) {
  51074. if (++loopCount > MAX_LEVELS) {
  51075. (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`);
  51076. return null;
  51077. }
  51078. const kids = kidsOrEntries.get("Kids");
  51079. if (!Array.isArray(kids)) {
  51080. return null;
  51081. }
  51082. let l = 0,
  51083. r = kids.length - 1;
  51084. while (l <= r) {
  51085. const m = l + r >> 1;
  51086. const kid = xref.fetchIfRef(kids[m]);
  51087. const limits = kid.get("Limits");
  51088. if (key < xref.fetchIfRef(limits[0])) {
  51089. r = m - 1;
  51090. } else if (key > xref.fetchIfRef(limits[1])) {
  51091. l = m + 1;
  51092. } else {
  51093. kidsOrEntries = kid;
  51094. break;
  51095. }
  51096. }
  51097. if (l > r) {
  51098. return null;
  51099. }
  51100. }
  51101. const entries = kidsOrEntries.get(this._type);
  51102. if (Array.isArray(entries)) {
  51103. let l = 0,
  51104. r = entries.length - 2;
  51105. while (l <= r) {
  51106. const tmp = l + r >> 1,
  51107. m = tmp + (tmp & 1);
  51108. const currentKey = xref.fetchIfRef(entries[m]);
  51109. if (key < currentKey) {
  51110. r = m - 2;
  51111. } else if (key > currentKey) {
  51112. l = m + 2;
  51113. } else {
  51114. return xref.fetchIfRef(entries[m + 1]);
  51115. }
  51116. }
  51117. }
  51118. return null;
  51119. }
  51120. }
  51121. class NameTree extends NameOrNumberTree {
  51122. constructor(root, xref) {
  51123. super(root, xref, "Names");
  51124. }
  51125. }
  51126. exports.NameTree = NameTree;
  51127. class NumberTree extends NameOrNumberTree {
  51128. constructor(root, xref) {
  51129. super(root, xref, "Nums");
  51130. }
  51131. }
  51132. exports.NumberTree = NumberTree;
  51133. /***/ }),
  51134. /* 69 */
  51135. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51136. Object.defineProperty(exports, "__esModule", ({
  51137. value: true
  51138. }));
  51139. exports.clearGlobalCaches = clearGlobalCaches;
  51140. var _primitives = __w_pdfjs_require__(3);
  51141. var _unicode = __w_pdfjs_require__(38);
  51142. function clearGlobalCaches() {
  51143. (0, _primitives.clearPrimitiveCaches)();
  51144. (0, _unicode.clearUnicodeCaches)();
  51145. }
  51146. /***/ }),
  51147. /* 70 */
  51148. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51149. Object.defineProperty(exports, "__esModule", ({
  51150. value: true
  51151. }));
  51152. exports.FileSpec = void 0;
  51153. var _util = __w_pdfjs_require__(2);
  51154. var _base_stream = __w_pdfjs_require__(5);
  51155. var _primitives = __w_pdfjs_require__(3);
  51156. function pickPlatformItem(dict) {
  51157. if (dict.has("UF")) {
  51158. return dict.get("UF");
  51159. } else if (dict.has("F")) {
  51160. return dict.get("F");
  51161. } else if (dict.has("Unix")) {
  51162. return dict.get("Unix");
  51163. } else if (dict.has("Mac")) {
  51164. return dict.get("Mac");
  51165. } else if (dict.has("DOS")) {
  51166. return dict.get("DOS");
  51167. }
  51168. return null;
  51169. }
  51170. class FileSpec {
  51171. constructor(root, xref) {
  51172. if (!(root instanceof _primitives.Dict)) {
  51173. return;
  51174. }
  51175. this.xref = xref;
  51176. this.root = root;
  51177. if (root.has("FS")) {
  51178. this.fs = root.get("FS");
  51179. }
  51180. this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : "";
  51181. if (root.has("RF")) {
  51182. (0, _util.warn)("Related file specifications are not supported");
  51183. }
  51184. this.contentAvailable = true;
  51185. if (!root.has("EF")) {
  51186. this.contentAvailable = false;
  51187. (0, _util.warn)("Non-embedded file specifications are not supported");
  51188. }
  51189. }
  51190. get filename() {
  51191. if (!this._filename && this.root) {
  51192. const filename = pickPlatformItem(this.root) || "unnamed";
  51193. this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/");
  51194. }
  51195. return this._filename;
  51196. }
  51197. get content() {
  51198. if (!this.contentAvailable) {
  51199. return null;
  51200. }
  51201. if (!this.contentRef && this.root) {
  51202. this.contentRef = pickPlatformItem(this.root.get("EF"));
  51203. }
  51204. let content = null;
  51205. if (this.contentRef) {
  51206. const fileObj = this.xref.fetchIfRef(this.contentRef);
  51207. if (fileObj instanceof _base_stream.BaseStream) {
  51208. content = fileObj.getBytes();
  51209. } else {
  51210. (0, _util.warn)("Embedded file specification points to non-existing/invalid content");
  51211. }
  51212. } else {
  51213. (0, _util.warn)("Embedded file specification does not have a content");
  51214. }
  51215. return content;
  51216. }
  51217. get serializable() {
  51218. return {
  51219. filename: this.filename,
  51220. content: this.content
  51221. };
  51222. }
  51223. }
  51224. exports.FileSpec = FileSpec;
  51225. /***/ }),
  51226. /* 71 */
  51227. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51228. Object.defineProperty(exports, "__esModule", ({
  51229. value: true
  51230. }));
  51231. exports.MetadataParser = void 0;
  51232. var _xml_parser = __w_pdfjs_require__(64);
  51233. class MetadataParser {
  51234. constructor(data) {
  51235. data = this._repair(data);
  51236. const parser = new _xml_parser.SimpleXMLParser({
  51237. lowerCaseName: true
  51238. });
  51239. const xmlDocument = parser.parseFromString(data);
  51240. this._metadataMap = new Map();
  51241. this._data = data;
  51242. if (xmlDocument) {
  51243. this._parse(xmlDocument);
  51244. }
  51245. }
  51246. _repair(data) {
  51247. return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) {
  51248. const bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
  51249. return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
  51250. }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
  51251. switch (name) {
  51252. case "amp":
  51253. return "&";
  51254. case "apos":
  51255. return "'";
  51256. case "gt":
  51257. return ">";
  51258. case "lt":
  51259. return "<";
  51260. case "quot":
  51261. return '"';
  51262. }
  51263. throw new Error(`_repair: ${name} isn't defined.`);
  51264. });
  51265. const charBuf = [];
  51266. for (let i = 0, ii = bytes.length; i < ii; i += 2) {
  51267. const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
  51268. if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
  51269. charBuf.push(String.fromCharCode(code));
  51270. } else {
  51271. charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";");
  51272. }
  51273. }
  51274. return ">" + charBuf.join("");
  51275. });
  51276. }
  51277. _getSequence(entry) {
  51278. const name = entry.nodeName;
  51279. if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") {
  51280. return null;
  51281. }
  51282. return entry.childNodes.filter(node => node.nodeName === "rdf:li");
  51283. }
  51284. _parseArray(entry) {
  51285. if (!entry.hasChildNodes()) {
  51286. return;
  51287. }
  51288. const [seqNode] = entry.childNodes;
  51289. const sequence = this._getSequence(seqNode) || [];
  51290. this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim()));
  51291. }
  51292. _parse(xmlDocument) {
  51293. let rdf = xmlDocument.documentElement;
  51294. if (rdf.nodeName !== "rdf:rdf") {
  51295. rdf = rdf.firstChild;
  51296. while (rdf && rdf.nodeName !== "rdf:rdf") {
  51297. rdf = rdf.nextSibling;
  51298. }
  51299. }
  51300. if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
  51301. return;
  51302. }
  51303. for (const desc of rdf.childNodes) {
  51304. if (desc.nodeName !== "rdf:description") {
  51305. continue;
  51306. }
  51307. for (const entry of desc.childNodes) {
  51308. const name = entry.nodeName;
  51309. switch (name) {
  51310. case "#text":
  51311. continue;
  51312. case "dc:creator":
  51313. case "dc:subject":
  51314. this._parseArray(entry);
  51315. continue;
  51316. }
  51317. this._metadataMap.set(name, entry.textContent.trim());
  51318. }
  51319. }
  51320. }
  51321. get serializable() {
  51322. return {
  51323. parsedData: this._metadataMap,
  51324. rawData: this._data
  51325. };
  51326. }
  51327. }
  51328. exports.MetadataParser = MetadataParser;
  51329. /***/ }),
  51330. /* 72 */
  51331. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51332. Object.defineProperty(exports, "__esModule", ({
  51333. value: true
  51334. }));
  51335. exports.StructTreeRoot = exports.StructTreePage = void 0;
  51336. var _primitives = __w_pdfjs_require__(3);
  51337. var _util = __w_pdfjs_require__(2);
  51338. var _name_number_tree = __w_pdfjs_require__(68);
  51339. const MAX_DEPTH = 40;
  51340. const StructElementType = {
  51341. PAGE_CONTENT: "PAGE_CONTENT",
  51342. STREAM_CONTENT: "STREAM_CONTENT",
  51343. OBJECT: "OBJECT",
  51344. ELEMENT: "ELEMENT"
  51345. };
  51346. class StructTreeRoot {
  51347. constructor(rootDict) {
  51348. this.dict = rootDict;
  51349. this.roleMap = new Map();
  51350. }
  51351. init() {
  51352. this.readRoleMap();
  51353. }
  51354. readRoleMap() {
  51355. const roleMapDict = this.dict.get("RoleMap");
  51356. if (!(roleMapDict instanceof _primitives.Dict)) {
  51357. return;
  51358. }
  51359. roleMapDict.forEach((key, value) => {
  51360. if (!(value instanceof _primitives.Name)) {
  51361. return;
  51362. }
  51363. this.roleMap.set(key, value.name);
  51364. });
  51365. }
  51366. }
  51367. exports.StructTreeRoot = StructTreeRoot;
  51368. class StructElementNode {
  51369. constructor(tree, dict) {
  51370. this.tree = tree;
  51371. this.dict = dict;
  51372. this.kids = [];
  51373. this.parseKids();
  51374. }
  51375. get role() {
  51376. const nameObj = this.dict.get("S");
  51377. const name = nameObj instanceof _primitives.Name ? nameObj.name : "";
  51378. const {
  51379. root
  51380. } = this.tree;
  51381. if (root.roleMap.has(name)) {
  51382. return root.roleMap.get(name);
  51383. }
  51384. return name;
  51385. }
  51386. parseKids() {
  51387. let pageObjId = null;
  51388. const objRef = this.dict.getRaw("Pg");
  51389. if (objRef instanceof _primitives.Ref) {
  51390. pageObjId = objRef.toString();
  51391. }
  51392. const kids = this.dict.get("K");
  51393. if (Array.isArray(kids)) {
  51394. for (const kid of kids) {
  51395. const element = this.parseKid(pageObjId, kid);
  51396. if (element) {
  51397. this.kids.push(element);
  51398. }
  51399. }
  51400. } else {
  51401. const element = this.parseKid(pageObjId, kids);
  51402. if (element) {
  51403. this.kids.push(element);
  51404. }
  51405. }
  51406. }
  51407. parseKid(pageObjId, kid) {
  51408. if (Number.isInteger(kid)) {
  51409. if (this.tree.pageDict.objId !== pageObjId) {
  51410. return null;
  51411. }
  51412. return new StructElement({
  51413. type: StructElementType.PAGE_CONTENT,
  51414. mcid: kid,
  51415. pageObjId
  51416. });
  51417. }
  51418. let kidDict = null;
  51419. if (kid instanceof _primitives.Ref) {
  51420. kidDict = this.dict.xref.fetch(kid);
  51421. } else if (kid instanceof _primitives.Dict) {
  51422. kidDict = kid;
  51423. }
  51424. if (!kidDict) {
  51425. return null;
  51426. }
  51427. const pageRef = kidDict.getRaw("Pg");
  51428. if (pageRef instanceof _primitives.Ref) {
  51429. pageObjId = pageRef.toString();
  51430. }
  51431. const type = kidDict.get("Type") instanceof _primitives.Name ? kidDict.get("Type").name : null;
  51432. if (type === "MCR") {
  51433. if (this.tree.pageDict.objId !== pageObjId) {
  51434. return null;
  51435. }
  51436. return new StructElement({
  51437. type: StructElementType.STREAM_CONTENT,
  51438. refObjId: kidDict.getRaw("Stm") instanceof _primitives.Ref ? kidDict.getRaw("Stm").toString() : null,
  51439. pageObjId,
  51440. mcid: kidDict.get("MCID")
  51441. });
  51442. }
  51443. if (type === "OBJR") {
  51444. if (this.tree.pageDict.objId !== pageObjId) {
  51445. return null;
  51446. }
  51447. return new StructElement({
  51448. type: StructElementType.OBJECT,
  51449. refObjId: kidDict.getRaw("Obj") instanceof _primitives.Ref ? kidDict.getRaw("Obj").toString() : null,
  51450. pageObjId
  51451. });
  51452. }
  51453. return new StructElement({
  51454. type: StructElementType.ELEMENT,
  51455. dict: kidDict
  51456. });
  51457. }
  51458. }
  51459. class StructElement {
  51460. constructor({
  51461. type,
  51462. dict = null,
  51463. mcid = null,
  51464. pageObjId = null,
  51465. refObjId = null
  51466. }) {
  51467. this.type = type;
  51468. this.dict = dict;
  51469. this.mcid = mcid;
  51470. this.pageObjId = pageObjId;
  51471. this.refObjId = refObjId;
  51472. this.parentNode = null;
  51473. }
  51474. }
  51475. class StructTreePage {
  51476. constructor(structTreeRoot, pageDict) {
  51477. this.root = structTreeRoot;
  51478. this.rootDict = structTreeRoot ? structTreeRoot.dict : null;
  51479. this.pageDict = pageDict;
  51480. this.nodes = [];
  51481. }
  51482. parse() {
  51483. if (!this.root || !this.rootDict) {
  51484. return;
  51485. }
  51486. const parentTree = this.rootDict.get("ParentTree");
  51487. if (!parentTree) {
  51488. return;
  51489. }
  51490. const id = this.pageDict.get("StructParents");
  51491. if (!Number.isInteger(id)) {
  51492. return;
  51493. }
  51494. const numberTree = new _name_number_tree.NumberTree(parentTree, this.rootDict.xref);
  51495. const parentArray = numberTree.get(id);
  51496. if (!Array.isArray(parentArray)) {
  51497. return;
  51498. }
  51499. const map = new Map();
  51500. for (const ref of parentArray) {
  51501. if (ref instanceof _primitives.Ref) {
  51502. this.addNode(this.rootDict.xref.fetch(ref), map);
  51503. }
  51504. }
  51505. }
  51506. addNode(dict, map, level = 0) {
  51507. if (level > MAX_DEPTH) {
  51508. (0, _util.warn)("StructTree MAX_DEPTH reached.");
  51509. return null;
  51510. }
  51511. if (map.has(dict)) {
  51512. return map.get(dict);
  51513. }
  51514. const element = new StructElementNode(this, dict);
  51515. map.set(dict, element);
  51516. const parent = dict.get("P");
  51517. if (!parent || (0, _primitives.isName)(parent.get("Type"), "StructTreeRoot")) {
  51518. if (!this.addTopLevelNode(dict, element)) {
  51519. map.delete(dict);
  51520. }
  51521. return element;
  51522. }
  51523. const parentNode = this.addNode(parent, map, level + 1);
  51524. if (!parentNode) {
  51525. return element;
  51526. }
  51527. let save = false;
  51528. for (const kid of parentNode.kids) {
  51529. if (kid.type === StructElementType.ELEMENT && kid.dict === dict) {
  51530. kid.parentNode = element;
  51531. save = true;
  51532. }
  51533. }
  51534. if (!save) {
  51535. map.delete(dict);
  51536. }
  51537. return element;
  51538. }
  51539. addTopLevelNode(dict, element) {
  51540. const obj = this.rootDict.get("K");
  51541. if (!obj) {
  51542. return false;
  51543. }
  51544. if (obj instanceof _primitives.Dict) {
  51545. if (obj.objId !== dict.objId) {
  51546. return false;
  51547. }
  51548. this.nodes[0] = element;
  51549. return true;
  51550. }
  51551. if (!Array.isArray(obj)) {
  51552. return true;
  51553. }
  51554. let save = false;
  51555. for (let i = 0; i < obj.length; i++) {
  51556. const kidRef = obj[i];
  51557. if (kidRef && kidRef.toString() === dict.objId) {
  51558. this.nodes[i] = element;
  51559. save = true;
  51560. }
  51561. }
  51562. return save;
  51563. }
  51564. get serializable() {
  51565. function nodeToSerializable(node, parent, level = 0) {
  51566. if (level > MAX_DEPTH) {
  51567. (0, _util.warn)("StructTree too deep to be fully serialized.");
  51568. return;
  51569. }
  51570. const obj = Object.create(null);
  51571. obj.role = node.role;
  51572. obj.children = [];
  51573. parent.children.push(obj);
  51574. const alt = node.dict.get("Alt");
  51575. if (typeof alt === "string") {
  51576. obj.alt = (0, _util.stringToPDFString)(alt);
  51577. }
  51578. const lang = node.dict.get("Lang");
  51579. if (typeof lang === "string") {
  51580. obj.lang = (0, _util.stringToPDFString)(lang);
  51581. }
  51582. for (const kid of node.kids) {
  51583. const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null;
  51584. if (kidElement) {
  51585. nodeToSerializable(kidElement, obj, level + 1);
  51586. continue;
  51587. } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) {
  51588. obj.children.push({
  51589. type: "content",
  51590. id: `page${kid.pageObjId}_mcid${kid.mcid}`
  51591. });
  51592. } else if (kid.type === StructElementType.OBJECT) {
  51593. obj.children.push({
  51594. type: "object",
  51595. id: kid.refObjId
  51596. });
  51597. }
  51598. }
  51599. }
  51600. const root = Object.create(null);
  51601. root.children = [];
  51602. root.role = "Root";
  51603. for (const child of this.nodes) {
  51604. if (!child) {
  51605. continue;
  51606. }
  51607. nodeToSerializable(child, root);
  51608. }
  51609. return root;
  51610. }
  51611. }
  51612. exports.StructTreePage = StructTreePage;
  51613. /***/ }),
  51614. /* 73 */
  51615. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51616. Object.defineProperty(exports, "__esModule", ({
  51617. value: true
  51618. }));
  51619. exports.ObjectLoader = void 0;
  51620. var _primitives = __w_pdfjs_require__(3);
  51621. var _base_stream = __w_pdfjs_require__(5);
  51622. var _core_utils = __w_pdfjs_require__(4);
  51623. var _util = __w_pdfjs_require__(2);
  51624. function mayHaveChildren(value) {
  51625. return value instanceof _primitives.Ref || value instanceof _primitives.Dict || value instanceof _base_stream.BaseStream || Array.isArray(value);
  51626. }
  51627. function addChildren(node, nodesToVisit) {
  51628. if (node instanceof _primitives.Dict) {
  51629. node = node.getRawValues();
  51630. } else if (node instanceof _base_stream.BaseStream) {
  51631. node = node.dict.getRawValues();
  51632. } else if (!Array.isArray(node)) {
  51633. return;
  51634. }
  51635. for (const rawValue of node) {
  51636. if (mayHaveChildren(rawValue)) {
  51637. nodesToVisit.push(rawValue);
  51638. }
  51639. }
  51640. }
  51641. class ObjectLoader {
  51642. constructor(dict, keys, xref) {
  51643. this.dict = dict;
  51644. this.keys = keys;
  51645. this.xref = xref;
  51646. this.refSet = null;
  51647. }
  51648. async load() {
  51649. if (this.xref.stream.isDataLoaded) {
  51650. return undefined;
  51651. }
  51652. const {
  51653. keys,
  51654. dict
  51655. } = this;
  51656. this.refSet = new _primitives.RefSet();
  51657. const nodesToVisit = [];
  51658. for (const key of keys) {
  51659. const rawValue = dict.getRaw(key);
  51660. if (rawValue !== undefined) {
  51661. nodesToVisit.push(rawValue);
  51662. }
  51663. }
  51664. return this._walk(nodesToVisit);
  51665. }
  51666. async _walk(nodesToVisit) {
  51667. const nodesToRevisit = [];
  51668. const pendingRequests = [];
  51669. while (nodesToVisit.length) {
  51670. let currentNode = nodesToVisit.pop();
  51671. if (currentNode instanceof _primitives.Ref) {
  51672. if (this.refSet.has(currentNode)) {
  51673. continue;
  51674. }
  51675. try {
  51676. this.refSet.put(currentNode);
  51677. currentNode = this.xref.fetch(currentNode);
  51678. } catch (ex) {
  51679. if (!(ex instanceof _core_utils.MissingDataException)) {
  51680. (0, _util.warn)(`ObjectLoader._walk - requesting all data: "${ex}".`);
  51681. this.refSet = null;
  51682. const {
  51683. manager
  51684. } = this.xref.stream;
  51685. return manager.requestAllChunks();
  51686. }
  51687. nodesToRevisit.push(currentNode);
  51688. pendingRequests.push({
  51689. begin: ex.begin,
  51690. end: ex.end
  51691. });
  51692. }
  51693. }
  51694. if (currentNode instanceof _base_stream.BaseStream) {
  51695. const baseStreams = currentNode.getBaseStreams();
  51696. if (baseStreams) {
  51697. let foundMissingData = false;
  51698. for (const stream of baseStreams) {
  51699. if (stream.isDataLoaded) {
  51700. continue;
  51701. }
  51702. foundMissingData = true;
  51703. pendingRequests.push({
  51704. begin: stream.start,
  51705. end: stream.end
  51706. });
  51707. }
  51708. if (foundMissingData) {
  51709. nodesToRevisit.push(currentNode);
  51710. }
  51711. }
  51712. }
  51713. addChildren(currentNode, nodesToVisit);
  51714. }
  51715. if (pendingRequests.length) {
  51716. await this.xref.stream.manager.requestRanges(pendingRequests);
  51717. for (const node of nodesToRevisit) {
  51718. if (node instanceof _primitives.Ref) {
  51719. this.refSet.remove(node);
  51720. }
  51721. }
  51722. return this._walk(nodesToRevisit);
  51723. }
  51724. this.refSet = null;
  51725. return undefined;
  51726. }
  51727. }
  51728. exports.ObjectLoader = ObjectLoader;
  51729. /***/ }),
  51730. /* 74 */
  51731. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51732. Object.defineProperty(exports, "__esModule", ({
  51733. value: true
  51734. }));
  51735. exports.XFAFactory = void 0;
  51736. var _xfa_object = __w_pdfjs_require__(75);
  51737. var _bind = __w_pdfjs_require__(79);
  51738. var _data = __w_pdfjs_require__(85);
  51739. var _fonts = __w_pdfjs_require__(83);
  51740. var _utils = __w_pdfjs_require__(76);
  51741. var _util = __w_pdfjs_require__(2);
  51742. var _parser = __w_pdfjs_require__(86);
  51743. var _xhtml = __w_pdfjs_require__(96);
  51744. class XFAFactory {
  51745. constructor(data) {
  51746. try {
  51747. this.root = new _parser.XFAParser().parse(XFAFactory._createDocument(data));
  51748. const binder = new _bind.Binder(this.root);
  51749. this.form = binder.bind();
  51750. this.dataHandler = new _data.DataHandler(this.root, binder.getData());
  51751. this.form[_xfa_object.$globalData].template = this.form;
  51752. } catch (e) {
  51753. (0, _util.warn)(`XFA - an error occurred during parsing and binding: ${e}`);
  51754. }
  51755. }
  51756. isValid() {
  51757. return this.root && this.form;
  51758. }
  51759. _createPagesHelper() {
  51760. const iterator = this.form[_xfa_object.$toPages]();
  51761. return new Promise((resolve, reject) => {
  51762. const nextIteration = () => {
  51763. try {
  51764. const value = iterator.next();
  51765. if (value.done) {
  51766. resolve(value.value);
  51767. } else {
  51768. setTimeout(nextIteration, 0);
  51769. }
  51770. } catch (e) {
  51771. reject(e);
  51772. }
  51773. };
  51774. setTimeout(nextIteration, 0);
  51775. });
  51776. }
  51777. async _createPages() {
  51778. try {
  51779. this.pages = await this._createPagesHelper();
  51780. this.dims = this.pages.children.map(c => {
  51781. const {
  51782. width,
  51783. height
  51784. } = c.attributes.style;
  51785. return [0, 0, parseInt(width), parseInt(height)];
  51786. });
  51787. } catch (e) {
  51788. (0, _util.warn)(`XFA - an error occurred during layout: ${e}`);
  51789. }
  51790. }
  51791. getBoundingBox(pageIndex) {
  51792. return this.dims[pageIndex];
  51793. }
  51794. async getNumPages() {
  51795. if (!this.pages) {
  51796. await this._createPages();
  51797. }
  51798. return this.dims.length;
  51799. }
  51800. setImages(images) {
  51801. this.form[_xfa_object.$globalData].images = images;
  51802. }
  51803. setFonts(fonts) {
  51804. this.form[_xfa_object.$globalData].fontFinder = new _fonts.FontFinder(fonts);
  51805. const missingFonts = [];
  51806. for (let typeface of this.form[_xfa_object.$globalData].usedTypefaces) {
  51807. typeface = (0, _utils.stripQuotes)(typeface);
  51808. const font = this.form[_xfa_object.$globalData].fontFinder.find(typeface);
  51809. if (!font) {
  51810. missingFonts.push(typeface);
  51811. }
  51812. }
  51813. if (missingFonts.length > 0) {
  51814. return missingFonts;
  51815. }
  51816. return null;
  51817. }
  51818. appendFonts(fonts, reallyMissingFonts) {
  51819. this.form[_xfa_object.$globalData].fontFinder.add(fonts, reallyMissingFonts);
  51820. }
  51821. async getPages() {
  51822. if (!this.pages) {
  51823. await this._createPages();
  51824. }
  51825. const pages = this.pages;
  51826. this.pages = null;
  51827. return pages;
  51828. }
  51829. serializeData(storage) {
  51830. return this.dataHandler.serialize(storage);
  51831. }
  51832. static _createDocument(data) {
  51833. if (!data["/xdp:xdp"]) {
  51834. return data["xdp:xdp"];
  51835. }
  51836. return Object.values(data).join("");
  51837. }
  51838. static getRichTextAsHtml(rc) {
  51839. if (!rc || typeof rc !== "string") {
  51840. return null;
  51841. }
  51842. try {
  51843. let root = new _parser.XFAParser(_xhtml.XhtmlNamespace, true).parse(rc);
  51844. if (!["body", "xhtml"].includes(root[_xfa_object.$nodeName])) {
  51845. const newRoot = _xhtml.XhtmlNamespace.body({});
  51846. newRoot[_xfa_object.$appendChild](root);
  51847. root = newRoot;
  51848. }
  51849. const result = root[_xfa_object.$toHTML]();
  51850. if (!result.success) {
  51851. return null;
  51852. }
  51853. const {
  51854. html
  51855. } = result;
  51856. const {
  51857. attributes
  51858. } = html;
  51859. if (attributes) {
  51860. if (attributes.class) {
  51861. attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa"));
  51862. }
  51863. attributes.dir = "auto";
  51864. }
  51865. return {
  51866. html,
  51867. str: root[_xfa_object.$text]()
  51868. };
  51869. } catch (e) {
  51870. (0, _util.warn)(`XFA - an error occurred during parsing of rich text: ${e}`);
  51871. }
  51872. return null;
  51873. }
  51874. }
  51875. exports.XFAFactory = XFAFactory;
  51876. /***/ }),
  51877. /* 75 */
  51878. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51879. Object.defineProperty(exports, "__esModule", ({
  51880. value: true
  51881. }));
  51882. exports.XmlObject = exports.XFAObjectArray = exports.XFAObject = exports.XFAAttribute = exports.StringObject = exports.OptionObject = exports.Option10 = exports.Option01 = exports.IntegerObject = exports.ContentObject = exports.$uid = exports.$toStyle = exports.$toString = exports.$toPages = exports.$toHTML = exports.$text = exports.$tabIndex = exports.$setValue = exports.$setSetAttributes = exports.$setId = exports.$searchNode = exports.$root = exports.$resolvePrototypes = exports.$removeChild = exports.$pushPara = exports.$pushGlyphs = exports.$popPara = exports.$onText = exports.$onChildCheck = exports.$onChild = exports.$nsAttributes = exports.$nodeName = exports.$namespaceId = exports.$isUsable = exports.$isTransparent = exports.$isThereMoreWidth = exports.$isSplittable = exports.$isNsAgnostic = exports.$isDescendent = exports.$isDataValue = exports.$isCDATAXml = exports.$isBindable = exports.$insertAt = exports.$indexOf = exports.$ids = exports.$hasSettableValue = exports.$globalData = exports.$getTemplateRoot = exports.$getSubformParent = exports.$getRealChildrenByNameIt = exports.$getParent = exports.$getNextPage = exports.$getExtra = exports.$getDataValue = exports.$getContainedChildren = exports.$getChildrenByNameIt = exports.$getChildrenByName = exports.$getChildrenByClass = exports.$getChildren = exports.$getAvailableSpace = exports.$getAttributes = exports.$getAttributeIt = exports.$flushHTML = exports.$finalize = exports.$extra = exports.$dump = exports.$data = exports.$content = exports.$consumed = exports.$clone = exports.$cleanup = exports.$cleanPage = exports.$clean = exports.$childrenToHTML = exports.$appendChild = exports.$addHTML = exports.$acceptWhitespace = void 0;
  51883. var _utils = __w_pdfjs_require__(76);
  51884. var _util = __w_pdfjs_require__(2);
  51885. var _core_utils = __w_pdfjs_require__(4);
  51886. var _namespaces = __w_pdfjs_require__(77);
  51887. var _som = __w_pdfjs_require__(78);
  51888. const $acceptWhitespace = Symbol();
  51889. exports.$acceptWhitespace = $acceptWhitespace;
  51890. const $addHTML = Symbol();
  51891. exports.$addHTML = $addHTML;
  51892. const $appendChild = Symbol();
  51893. exports.$appendChild = $appendChild;
  51894. const $childrenToHTML = Symbol();
  51895. exports.$childrenToHTML = $childrenToHTML;
  51896. const $clean = Symbol();
  51897. exports.$clean = $clean;
  51898. const $cleanPage = Symbol();
  51899. exports.$cleanPage = $cleanPage;
  51900. const $cleanup = Symbol();
  51901. exports.$cleanup = $cleanup;
  51902. const $clone = Symbol();
  51903. exports.$clone = $clone;
  51904. const $consumed = Symbol();
  51905. exports.$consumed = $consumed;
  51906. const $content = Symbol("content");
  51907. exports.$content = $content;
  51908. const $data = Symbol("data");
  51909. exports.$data = $data;
  51910. const $dump = Symbol();
  51911. exports.$dump = $dump;
  51912. const $extra = Symbol("extra");
  51913. exports.$extra = $extra;
  51914. const $finalize = Symbol();
  51915. exports.$finalize = $finalize;
  51916. const $flushHTML = Symbol();
  51917. exports.$flushHTML = $flushHTML;
  51918. const $getAttributeIt = Symbol();
  51919. exports.$getAttributeIt = $getAttributeIt;
  51920. const $getAttributes = Symbol();
  51921. exports.$getAttributes = $getAttributes;
  51922. const $getAvailableSpace = Symbol();
  51923. exports.$getAvailableSpace = $getAvailableSpace;
  51924. const $getChildrenByClass = Symbol();
  51925. exports.$getChildrenByClass = $getChildrenByClass;
  51926. const $getChildrenByName = Symbol();
  51927. exports.$getChildrenByName = $getChildrenByName;
  51928. const $getChildrenByNameIt = Symbol();
  51929. exports.$getChildrenByNameIt = $getChildrenByNameIt;
  51930. const $getDataValue = Symbol();
  51931. exports.$getDataValue = $getDataValue;
  51932. const $getExtra = Symbol();
  51933. exports.$getExtra = $getExtra;
  51934. const $getRealChildrenByNameIt = Symbol();
  51935. exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt;
  51936. const $getChildren = Symbol();
  51937. exports.$getChildren = $getChildren;
  51938. const $getContainedChildren = Symbol();
  51939. exports.$getContainedChildren = $getContainedChildren;
  51940. const $getNextPage = Symbol();
  51941. exports.$getNextPage = $getNextPage;
  51942. const $getSubformParent = Symbol();
  51943. exports.$getSubformParent = $getSubformParent;
  51944. const $getParent = Symbol();
  51945. exports.$getParent = $getParent;
  51946. const $getTemplateRoot = Symbol();
  51947. exports.$getTemplateRoot = $getTemplateRoot;
  51948. const $globalData = Symbol();
  51949. exports.$globalData = $globalData;
  51950. const $hasSettableValue = Symbol();
  51951. exports.$hasSettableValue = $hasSettableValue;
  51952. const $ids = Symbol();
  51953. exports.$ids = $ids;
  51954. const $indexOf = Symbol();
  51955. exports.$indexOf = $indexOf;
  51956. const $insertAt = Symbol();
  51957. exports.$insertAt = $insertAt;
  51958. const $isCDATAXml = Symbol();
  51959. exports.$isCDATAXml = $isCDATAXml;
  51960. const $isBindable = Symbol();
  51961. exports.$isBindable = $isBindable;
  51962. const $isDataValue = Symbol();
  51963. exports.$isDataValue = $isDataValue;
  51964. const $isDescendent = Symbol();
  51965. exports.$isDescendent = $isDescendent;
  51966. const $isNsAgnostic = Symbol();
  51967. exports.$isNsAgnostic = $isNsAgnostic;
  51968. const $isSplittable = Symbol();
  51969. exports.$isSplittable = $isSplittable;
  51970. const $isThereMoreWidth = Symbol();
  51971. exports.$isThereMoreWidth = $isThereMoreWidth;
  51972. const $isTransparent = Symbol();
  51973. exports.$isTransparent = $isTransparent;
  51974. const $isUsable = Symbol();
  51975. exports.$isUsable = $isUsable;
  51976. const $lastAttribute = Symbol();
  51977. const $namespaceId = Symbol("namespaceId");
  51978. exports.$namespaceId = $namespaceId;
  51979. const $nodeName = Symbol("nodeName");
  51980. exports.$nodeName = $nodeName;
  51981. const $nsAttributes = Symbol();
  51982. exports.$nsAttributes = $nsAttributes;
  51983. const $onChild = Symbol();
  51984. exports.$onChild = $onChild;
  51985. const $onChildCheck = Symbol();
  51986. exports.$onChildCheck = $onChildCheck;
  51987. const $onText = Symbol();
  51988. exports.$onText = $onText;
  51989. const $pushGlyphs = Symbol();
  51990. exports.$pushGlyphs = $pushGlyphs;
  51991. const $popPara = Symbol();
  51992. exports.$popPara = $popPara;
  51993. const $pushPara = Symbol();
  51994. exports.$pushPara = $pushPara;
  51995. const $removeChild = Symbol();
  51996. exports.$removeChild = $removeChild;
  51997. const $root = Symbol("root");
  51998. exports.$root = $root;
  51999. const $resolvePrototypes = Symbol();
  52000. exports.$resolvePrototypes = $resolvePrototypes;
  52001. const $searchNode = Symbol();
  52002. exports.$searchNode = $searchNode;
  52003. const $setId = Symbol();
  52004. exports.$setId = $setId;
  52005. const $setSetAttributes = Symbol();
  52006. exports.$setSetAttributes = $setSetAttributes;
  52007. const $setValue = Symbol();
  52008. exports.$setValue = $setValue;
  52009. const $tabIndex = Symbol();
  52010. exports.$tabIndex = $tabIndex;
  52011. const $text = Symbol();
  52012. exports.$text = $text;
  52013. const $toPages = Symbol();
  52014. exports.$toPages = $toPages;
  52015. const $toHTML = Symbol();
  52016. exports.$toHTML = $toHTML;
  52017. const $toString = Symbol();
  52018. exports.$toString = $toString;
  52019. const $toStyle = Symbol();
  52020. exports.$toStyle = $toStyle;
  52021. const $uid = Symbol("uid");
  52022. exports.$uid = $uid;
  52023. const _applyPrototype = Symbol();
  52024. const _attributes = Symbol();
  52025. const _attributeNames = Symbol();
  52026. const _children = Symbol("_children");
  52027. const _cloneAttribute = Symbol();
  52028. const _dataValue = Symbol();
  52029. const _defaultValue = Symbol();
  52030. const _filteredChildrenGenerator = Symbol();
  52031. const _getPrototype = Symbol();
  52032. const _getUnsetAttributes = Symbol();
  52033. const _hasChildren = Symbol();
  52034. const _max = Symbol();
  52035. const _options = Symbol();
  52036. const _parent = Symbol("parent");
  52037. const _resolvePrototypesHelper = Symbol();
  52038. const _setAttributes = Symbol();
  52039. const _validator = Symbol();
  52040. let uid = 0;
  52041. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  52042. class XFAObject {
  52043. constructor(nsId, name, hasChildren = false) {
  52044. this[$namespaceId] = nsId;
  52045. this[$nodeName] = name;
  52046. this[_hasChildren] = hasChildren;
  52047. this[_parent] = null;
  52048. this[_children] = [];
  52049. this[$uid] = `${name}${uid++}`;
  52050. this[$globalData] = null;
  52051. }
  52052. [$onChild](child) {
  52053. if (!this[_hasChildren] || !this[$onChildCheck](child)) {
  52054. return false;
  52055. }
  52056. const name = child[$nodeName];
  52057. const node = this[name];
  52058. if (node instanceof XFAObjectArray) {
  52059. if (node.push(child)) {
  52060. this[$appendChild](child);
  52061. return true;
  52062. }
  52063. } else {
  52064. if (node !== null) {
  52065. this[$removeChild](node);
  52066. }
  52067. this[name] = child;
  52068. this[$appendChild](child);
  52069. return true;
  52070. }
  52071. let id = "";
  52072. if (this.id) {
  52073. id = ` (id: ${this.id})`;
  52074. } else if (this.name) {
  52075. id = ` (name: ${this.name} ${this.h.value})`;
  52076. }
  52077. (0, _util.warn)(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`);
  52078. return false;
  52079. }
  52080. [$onChildCheck](child) {
  52081. return this.hasOwnProperty(child[$nodeName]) && child[$namespaceId] === this[$namespaceId];
  52082. }
  52083. [$isNsAgnostic]() {
  52084. return false;
  52085. }
  52086. [$acceptWhitespace]() {
  52087. return false;
  52088. }
  52089. [$isCDATAXml]() {
  52090. return false;
  52091. }
  52092. [$isBindable]() {
  52093. return false;
  52094. }
  52095. [$popPara]() {
  52096. if (this.para) {
  52097. this[$getTemplateRoot]()[$extra].paraStack.pop();
  52098. }
  52099. }
  52100. [$pushPara]() {
  52101. this[$getTemplateRoot]()[$extra].paraStack.push(this.para);
  52102. }
  52103. [$setId](ids) {
  52104. if (this.id && this[$namespaceId] === _namespaces.NamespaceIds.template.id) {
  52105. ids.set(this.id, this);
  52106. }
  52107. }
  52108. [$getTemplateRoot]() {
  52109. return this[$globalData].template;
  52110. }
  52111. [$isSplittable]() {
  52112. return false;
  52113. }
  52114. [$isThereMoreWidth]() {
  52115. return false;
  52116. }
  52117. [$appendChild](child) {
  52118. child[_parent] = this;
  52119. this[_children].push(child);
  52120. if (!child[$globalData] && this[$globalData]) {
  52121. child[$globalData] = this[$globalData];
  52122. }
  52123. }
  52124. [$removeChild](child) {
  52125. const i = this[_children].indexOf(child);
  52126. this[_children].splice(i, 1);
  52127. }
  52128. [$hasSettableValue]() {
  52129. return this.hasOwnProperty("value");
  52130. }
  52131. [$setValue](_) {}
  52132. [$onText](_) {}
  52133. [$finalize]() {}
  52134. [$clean](builder) {
  52135. delete this[_hasChildren];
  52136. if (this[$cleanup]) {
  52137. builder.clean(this[$cleanup]);
  52138. delete this[$cleanup];
  52139. }
  52140. }
  52141. [$indexOf](child) {
  52142. return this[_children].indexOf(child);
  52143. }
  52144. [$insertAt](i, child) {
  52145. child[_parent] = this;
  52146. this[_children].splice(i, 0, child);
  52147. if (!child[$globalData] && this[$globalData]) {
  52148. child[$globalData] = this[$globalData];
  52149. }
  52150. }
  52151. [$isTransparent]() {
  52152. return !this.name;
  52153. }
  52154. [$lastAttribute]() {
  52155. return "";
  52156. }
  52157. [$text]() {
  52158. if (this[_children].length === 0) {
  52159. return this[$content];
  52160. }
  52161. return this[_children].map(c => c[$text]()).join("");
  52162. }
  52163. get [_attributeNames]() {
  52164. const proto = Object.getPrototypeOf(this);
  52165. if (!proto._attributes) {
  52166. const attributes = proto._attributes = new Set();
  52167. for (const name of Object.getOwnPropertyNames(this)) {
  52168. if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) {
  52169. break;
  52170. }
  52171. attributes.add(name);
  52172. }
  52173. }
  52174. return (0, _util.shadow)(this, _attributeNames, proto._attributes);
  52175. }
  52176. [$isDescendent](parent) {
  52177. let node = this;
  52178. while (node) {
  52179. if (node === parent) {
  52180. return true;
  52181. }
  52182. node = node[$getParent]();
  52183. }
  52184. return false;
  52185. }
  52186. [$getParent]() {
  52187. return this[_parent];
  52188. }
  52189. [$getSubformParent]() {
  52190. return this[$getParent]();
  52191. }
  52192. [$getChildren](name = null) {
  52193. if (!name) {
  52194. return this[_children];
  52195. }
  52196. return this[name];
  52197. }
  52198. [$dump]() {
  52199. const dumped = Object.create(null);
  52200. if (this[$content]) {
  52201. dumped.$content = this[$content];
  52202. }
  52203. for (const name of Object.getOwnPropertyNames(this)) {
  52204. const value = this[name];
  52205. if (value === null) {
  52206. continue;
  52207. }
  52208. if (value instanceof XFAObject) {
  52209. dumped[name] = value[$dump]();
  52210. } else if (value instanceof XFAObjectArray) {
  52211. if (!value.isEmpty()) {
  52212. dumped[name] = value.dump();
  52213. }
  52214. } else {
  52215. dumped[name] = value;
  52216. }
  52217. }
  52218. return dumped;
  52219. }
  52220. [$toStyle]() {
  52221. return null;
  52222. }
  52223. [$toHTML]() {
  52224. return _utils.HTMLResult.EMPTY;
  52225. }
  52226. *[$getContainedChildren]() {
  52227. for (const node of this[$getChildren]()) {
  52228. yield node;
  52229. }
  52230. }
  52231. *[_filteredChildrenGenerator](filter, include) {
  52232. for (const node of this[$getContainedChildren]()) {
  52233. if (!filter || include === filter.has(node[$nodeName])) {
  52234. const availableSpace = this[$getAvailableSpace]();
  52235. const res = node[$toHTML](availableSpace);
  52236. if (!res.success) {
  52237. this[$extra].failingNode = node;
  52238. }
  52239. yield res;
  52240. }
  52241. }
  52242. }
  52243. [$flushHTML]() {
  52244. return null;
  52245. }
  52246. [$addHTML](html, bbox) {
  52247. this[$extra].children.push(html);
  52248. }
  52249. [$getAvailableSpace]() {}
  52250. [$childrenToHTML]({
  52251. filter = null,
  52252. include = true
  52253. }) {
  52254. if (!this[$extra].generator) {
  52255. this[$extra].generator = this[_filteredChildrenGenerator](filter, include);
  52256. } else {
  52257. const availableSpace = this[$getAvailableSpace]();
  52258. const res = this[$extra].failingNode[$toHTML](availableSpace);
  52259. if (!res.success) {
  52260. return res;
  52261. }
  52262. if (res.html) {
  52263. this[$addHTML](res.html, res.bbox);
  52264. }
  52265. delete this[$extra].failingNode;
  52266. }
  52267. while (true) {
  52268. const gen = this[$extra].generator.next();
  52269. if (gen.done) {
  52270. break;
  52271. }
  52272. const res = gen.value;
  52273. if (!res.success) {
  52274. return res;
  52275. }
  52276. if (res.html) {
  52277. this[$addHTML](res.html, res.bbox);
  52278. }
  52279. }
  52280. this[$extra].generator = null;
  52281. return _utils.HTMLResult.EMPTY;
  52282. }
  52283. [$setSetAttributes](attributes) {
  52284. this[_setAttributes] = new Set(Object.keys(attributes));
  52285. }
  52286. [_getUnsetAttributes](protoAttributes) {
  52287. const allAttr = this[_attributeNames];
  52288. const setAttr = this[_setAttributes];
  52289. return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x));
  52290. }
  52291. [$resolvePrototypes](ids, ancestors = new Set()) {
  52292. for (const child of this[_children]) {
  52293. child[_resolvePrototypesHelper](ids, ancestors);
  52294. }
  52295. }
  52296. [_resolvePrototypesHelper](ids, ancestors) {
  52297. const proto = this[_getPrototype](ids, ancestors);
  52298. if (proto) {
  52299. this[_applyPrototype](proto, ids, ancestors);
  52300. } else {
  52301. this[$resolvePrototypes](ids, ancestors);
  52302. }
  52303. }
  52304. [_getPrototype](ids, ancestors) {
  52305. const {
  52306. use,
  52307. usehref
  52308. } = this;
  52309. if (!use && !usehref) {
  52310. return null;
  52311. }
  52312. let proto = null;
  52313. let somExpression = null;
  52314. let id = null;
  52315. let ref = use;
  52316. if (usehref) {
  52317. ref = usehref;
  52318. if (usehref.startsWith("#som(") && usehref.endsWith(")")) {
  52319. somExpression = usehref.slice("#som(".length, usehref.length - 1);
  52320. } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) {
  52321. somExpression = usehref.slice(".#som(".length, usehref.length - 1);
  52322. } else if (usehref.startsWith("#")) {
  52323. id = usehref.slice(1);
  52324. } else if (usehref.startsWith(".#")) {
  52325. id = usehref.slice(2);
  52326. }
  52327. } else if (use.startsWith("#")) {
  52328. id = use.slice(1);
  52329. } else {
  52330. somExpression = use;
  52331. }
  52332. this.use = this.usehref = "";
  52333. if (id) {
  52334. proto = ids.get(id);
  52335. } else {
  52336. proto = (0, _som.searchNode)(ids.get($root), this, somExpression, true, false);
  52337. if (proto) {
  52338. proto = proto[0];
  52339. }
  52340. }
  52341. if (!proto) {
  52342. (0, _util.warn)(`XFA - Invalid prototype reference: ${ref}.`);
  52343. return null;
  52344. }
  52345. if (proto[$nodeName] !== this[$nodeName]) {
  52346. (0, _util.warn)(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`);
  52347. return null;
  52348. }
  52349. if (ancestors.has(proto)) {
  52350. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  52351. return null;
  52352. }
  52353. ancestors.add(proto);
  52354. const protoProto = proto[_getPrototype](ids, ancestors);
  52355. if (protoProto) {
  52356. proto[_applyPrototype](protoProto, ids, ancestors);
  52357. }
  52358. proto[$resolvePrototypes](ids, ancestors);
  52359. ancestors.delete(proto);
  52360. return proto;
  52361. }
  52362. [_applyPrototype](proto, ids, ancestors) {
  52363. if (ancestors.has(proto)) {
  52364. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  52365. return;
  52366. }
  52367. if (!this[$content] && proto[$content]) {
  52368. this[$content] = proto[$content];
  52369. }
  52370. const newAncestors = new Set(ancestors);
  52371. newAncestors.add(proto);
  52372. for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) {
  52373. this[unsetAttrName] = proto[unsetAttrName];
  52374. if (this[_setAttributes]) {
  52375. this[_setAttributes].add(unsetAttrName);
  52376. }
  52377. }
  52378. for (const name of Object.getOwnPropertyNames(this)) {
  52379. if (this[_attributeNames].has(name)) {
  52380. continue;
  52381. }
  52382. const value = this[name];
  52383. const protoValue = proto[name];
  52384. if (value instanceof XFAObjectArray) {
  52385. for (const child of value[_children]) {
  52386. child[_resolvePrototypesHelper](ids, ancestors);
  52387. }
  52388. for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) {
  52389. const child = proto[_children][i][$clone]();
  52390. if (value.push(child)) {
  52391. child[_parent] = this;
  52392. this[_children].push(child);
  52393. child[_resolvePrototypesHelper](ids, ancestors);
  52394. } else {
  52395. break;
  52396. }
  52397. }
  52398. continue;
  52399. }
  52400. if (value !== null) {
  52401. value[$resolvePrototypes](ids, ancestors);
  52402. if (protoValue) {
  52403. value[_applyPrototype](protoValue, ids, ancestors);
  52404. }
  52405. continue;
  52406. }
  52407. if (protoValue !== null) {
  52408. const child = protoValue[$clone]();
  52409. child[_parent] = this;
  52410. this[name] = child;
  52411. this[_children].push(child);
  52412. child[_resolvePrototypesHelper](ids, ancestors);
  52413. }
  52414. }
  52415. }
  52416. static [_cloneAttribute](obj) {
  52417. if (Array.isArray(obj)) {
  52418. return obj.map(x => XFAObject[_cloneAttribute](x));
  52419. }
  52420. if (typeof obj === "object" && obj !== null) {
  52421. return Object.assign({}, obj);
  52422. }
  52423. return obj;
  52424. }
  52425. [$clone]() {
  52426. const clone = Object.create(Object.getPrototypeOf(this));
  52427. for (const $symbol of Object.getOwnPropertySymbols(this)) {
  52428. try {
  52429. clone[$symbol] = this[$symbol];
  52430. } catch (_) {
  52431. (0, _util.shadow)(clone, $symbol, this[$symbol]);
  52432. }
  52433. }
  52434. clone[$uid] = `${clone[$nodeName]}${uid++}`;
  52435. clone[_children] = [];
  52436. for (const name of Object.getOwnPropertyNames(this)) {
  52437. if (this[_attributeNames].has(name)) {
  52438. clone[name] = XFAObject[_cloneAttribute](this[name]);
  52439. continue;
  52440. }
  52441. const value = this[name];
  52442. if (value instanceof XFAObjectArray) {
  52443. clone[name] = new XFAObjectArray(value[_max]);
  52444. } else {
  52445. clone[name] = null;
  52446. }
  52447. }
  52448. for (const child of this[_children]) {
  52449. const name = child[$nodeName];
  52450. const clonedChild = child[$clone]();
  52451. clone[_children].push(clonedChild);
  52452. clonedChild[_parent] = clone;
  52453. if (clone[name] === null) {
  52454. clone[name] = clonedChild;
  52455. } else {
  52456. clone[name][_children].push(clonedChild);
  52457. }
  52458. }
  52459. return clone;
  52460. }
  52461. [$getChildren](name = null) {
  52462. if (!name) {
  52463. return this[_children];
  52464. }
  52465. return this[_children].filter(c => c[$nodeName] === name);
  52466. }
  52467. [$getChildrenByClass](name) {
  52468. return this[name];
  52469. }
  52470. [$getChildrenByName](name, allTransparent, first = true) {
  52471. return Array.from(this[$getChildrenByNameIt](name, allTransparent, first));
  52472. }
  52473. *[$getChildrenByNameIt](name, allTransparent, first = true) {
  52474. if (name === "parent") {
  52475. yield this[_parent];
  52476. return;
  52477. }
  52478. for (const child of this[_children]) {
  52479. if (child[$nodeName] === name) {
  52480. yield child;
  52481. }
  52482. if (child.name === name) {
  52483. yield child;
  52484. }
  52485. if (allTransparent || child[$isTransparent]()) {
  52486. yield* child[$getChildrenByNameIt](name, allTransparent, false);
  52487. }
  52488. }
  52489. if (first && this[_attributeNames].has(name)) {
  52490. yield new XFAAttribute(this, name, this[name]);
  52491. }
  52492. }
  52493. }
  52494. exports.XFAObject = XFAObject;
  52495. class XFAObjectArray {
  52496. constructor(max = Infinity) {
  52497. this[_max] = max;
  52498. this[_children] = [];
  52499. }
  52500. push(child) {
  52501. const len = this[_children].length;
  52502. if (len <= this[_max]) {
  52503. this[_children].push(child);
  52504. return true;
  52505. }
  52506. (0, _util.warn)(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`);
  52507. return false;
  52508. }
  52509. isEmpty() {
  52510. return this[_children].length === 0;
  52511. }
  52512. dump() {
  52513. return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]());
  52514. }
  52515. [$clone]() {
  52516. const clone = new XFAObjectArray(this[_max]);
  52517. clone[_children] = this[_children].map(c => c[$clone]());
  52518. return clone;
  52519. }
  52520. get children() {
  52521. return this[_children];
  52522. }
  52523. clear() {
  52524. this[_children].length = 0;
  52525. }
  52526. }
  52527. exports.XFAObjectArray = XFAObjectArray;
  52528. class XFAAttribute {
  52529. constructor(node, name, value) {
  52530. this[_parent] = node;
  52531. this[$nodeName] = name;
  52532. this[$content] = value;
  52533. this[$consumed] = false;
  52534. this[$uid] = `attribute${uid++}`;
  52535. }
  52536. [$getParent]() {
  52537. return this[_parent];
  52538. }
  52539. [$isDataValue]() {
  52540. return true;
  52541. }
  52542. [$getDataValue]() {
  52543. return this[$content].trim();
  52544. }
  52545. [$setValue](value) {
  52546. value = value.value || "";
  52547. this[$content] = value.toString();
  52548. }
  52549. [$text]() {
  52550. return this[$content];
  52551. }
  52552. [$isDescendent](parent) {
  52553. return this[_parent] === parent || this[_parent][$isDescendent](parent);
  52554. }
  52555. }
  52556. exports.XFAAttribute = XFAAttribute;
  52557. class XmlObject extends XFAObject {
  52558. constructor(nsId, name, attributes = {}) {
  52559. super(nsId, name);
  52560. this[$content] = "";
  52561. this[_dataValue] = null;
  52562. if (name !== "#text") {
  52563. const map = new Map();
  52564. this[_attributes] = map;
  52565. for (const [attrName, value] of Object.entries(attributes)) {
  52566. map.set(attrName, new XFAAttribute(this, attrName, value));
  52567. }
  52568. if (attributes.hasOwnProperty($nsAttributes)) {
  52569. const dataNode = attributes[$nsAttributes].xfa.dataNode;
  52570. if (dataNode !== undefined) {
  52571. if (dataNode === "dataGroup") {
  52572. this[_dataValue] = false;
  52573. } else if (dataNode === "dataValue") {
  52574. this[_dataValue] = true;
  52575. }
  52576. }
  52577. }
  52578. }
  52579. this[$consumed] = false;
  52580. }
  52581. [$toString](buf) {
  52582. const tagName = this[$nodeName];
  52583. if (tagName === "#text") {
  52584. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  52585. return;
  52586. }
  52587. const utf8TagName = (0, _util.utf8StringToString)(tagName);
  52588. const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : "";
  52589. buf.push(`<${prefix}${utf8TagName}`);
  52590. for (const [name, value] of this[_attributes].entries()) {
  52591. const utf8Name = (0, _util.utf8StringToString)(name);
  52592. buf.push(` ${utf8Name}="${(0, _core_utils.encodeToXmlString)(value[$content])}"`);
  52593. }
  52594. if (this[_dataValue] !== null) {
  52595. if (this[_dataValue]) {
  52596. buf.push(` xfa:dataNode="dataValue"`);
  52597. } else {
  52598. buf.push(` xfa:dataNode="dataGroup"`);
  52599. }
  52600. }
  52601. if (!this[$content] && this[_children].length === 0) {
  52602. buf.push("/>");
  52603. return;
  52604. }
  52605. buf.push(">");
  52606. if (this[$content]) {
  52607. if (typeof this[$content] === "string") {
  52608. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  52609. } else {
  52610. this[$content][$toString](buf);
  52611. }
  52612. } else {
  52613. for (const child of this[_children]) {
  52614. child[$toString](buf);
  52615. }
  52616. }
  52617. buf.push(`</${prefix}${utf8TagName}>`);
  52618. }
  52619. [$onChild](child) {
  52620. if (this[$content]) {
  52621. const node = new XmlObject(this[$namespaceId], "#text");
  52622. this[$appendChild](node);
  52623. node[$content] = this[$content];
  52624. this[$content] = "";
  52625. }
  52626. this[$appendChild](child);
  52627. return true;
  52628. }
  52629. [$onText](str) {
  52630. this[$content] += str;
  52631. }
  52632. [$finalize]() {
  52633. if (this[$content] && this[_children].length > 0) {
  52634. const node = new XmlObject(this[$namespaceId], "#text");
  52635. this[$appendChild](node);
  52636. node[$content] = this[$content];
  52637. delete this[$content];
  52638. }
  52639. }
  52640. [$toHTML]() {
  52641. if (this[$nodeName] === "#text") {
  52642. return _utils.HTMLResult.success({
  52643. name: "#text",
  52644. value: this[$content]
  52645. });
  52646. }
  52647. return _utils.HTMLResult.EMPTY;
  52648. }
  52649. [$getChildren](name = null) {
  52650. if (!name) {
  52651. return this[_children];
  52652. }
  52653. return this[_children].filter(c => c[$nodeName] === name);
  52654. }
  52655. [$getAttributes]() {
  52656. return this[_attributes];
  52657. }
  52658. [$getChildrenByClass](name) {
  52659. const value = this[_attributes].get(name);
  52660. if (value !== undefined) {
  52661. return value;
  52662. }
  52663. return this[$getChildren](name);
  52664. }
  52665. *[$getChildrenByNameIt](name, allTransparent) {
  52666. const value = this[_attributes].get(name);
  52667. if (value) {
  52668. yield value;
  52669. }
  52670. for (const child of this[_children]) {
  52671. if (child[$nodeName] === name) {
  52672. yield child;
  52673. }
  52674. if (allTransparent) {
  52675. yield* child[$getChildrenByNameIt](name, allTransparent);
  52676. }
  52677. }
  52678. }
  52679. *[$getAttributeIt](name, skipConsumed) {
  52680. const value = this[_attributes].get(name);
  52681. if (value && (!skipConsumed || !value[$consumed])) {
  52682. yield value;
  52683. }
  52684. for (const child of this[_children]) {
  52685. yield* child[$getAttributeIt](name, skipConsumed);
  52686. }
  52687. }
  52688. *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {
  52689. for (const child of this[_children]) {
  52690. if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) {
  52691. yield child;
  52692. }
  52693. if (allTransparent) {
  52694. yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed);
  52695. }
  52696. }
  52697. }
  52698. [$isDataValue]() {
  52699. if (this[_dataValue] === null) {
  52700. return this[_children].length === 0 || this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id;
  52701. }
  52702. return this[_dataValue];
  52703. }
  52704. [$getDataValue]() {
  52705. if (this[_dataValue] === null) {
  52706. if (this[_children].length === 0) {
  52707. return this[$content].trim();
  52708. }
  52709. if (this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  52710. return this[_children][0][$text]().trim();
  52711. }
  52712. return null;
  52713. }
  52714. return this[$content].trim();
  52715. }
  52716. [$setValue](value) {
  52717. value = value.value || "";
  52718. this[$content] = value.toString();
  52719. }
  52720. [$dump](hasNS = false) {
  52721. const dumped = Object.create(null);
  52722. if (hasNS) {
  52723. dumped.$ns = this[$namespaceId];
  52724. }
  52725. if (this[$content]) {
  52726. dumped.$content = this[$content];
  52727. }
  52728. dumped.$name = this[$nodeName];
  52729. dumped.children = [];
  52730. for (const child of this[_children]) {
  52731. dumped.children.push(child[$dump](hasNS));
  52732. }
  52733. dumped.attributes = Object.create(null);
  52734. for (const [name, value] of this[_attributes]) {
  52735. dumped.attributes[name] = value[$content];
  52736. }
  52737. return dumped;
  52738. }
  52739. }
  52740. exports.XmlObject = XmlObject;
  52741. class ContentObject extends XFAObject {
  52742. constructor(nsId, name) {
  52743. super(nsId, name);
  52744. this[$content] = "";
  52745. }
  52746. [$onText](text) {
  52747. this[$content] += text;
  52748. }
  52749. [$finalize]() {}
  52750. }
  52751. exports.ContentObject = ContentObject;
  52752. class OptionObject extends ContentObject {
  52753. constructor(nsId, name, options) {
  52754. super(nsId, name);
  52755. this[_options] = options;
  52756. }
  52757. [$finalize]() {
  52758. this[$content] = (0, _utils.getKeyword)({
  52759. data: this[$content],
  52760. defaultValue: this[_options][0],
  52761. validate: k => this[_options].includes(k)
  52762. });
  52763. }
  52764. [$clean](builder) {
  52765. super[$clean](builder);
  52766. delete this[_options];
  52767. }
  52768. }
  52769. exports.OptionObject = OptionObject;
  52770. class StringObject extends ContentObject {
  52771. [$finalize]() {
  52772. this[$content] = this[$content].trim();
  52773. }
  52774. }
  52775. exports.StringObject = StringObject;
  52776. class IntegerObject extends ContentObject {
  52777. constructor(nsId, name, defaultValue, validator) {
  52778. super(nsId, name);
  52779. this[_defaultValue] = defaultValue;
  52780. this[_validator] = validator;
  52781. }
  52782. [$finalize]() {
  52783. this[$content] = (0, _utils.getInteger)({
  52784. data: this[$content],
  52785. defaultValue: this[_defaultValue],
  52786. validate: this[_validator]
  52787. });
  52788. }
  52789. [$clean](builder) {
  52790. super[$clean](builder);
  52791. delete this[_defaultValue];
  52792. delete this[_validator];
  52793. }
  52794. }
  52795. exports.IntegerObject = IntegerObject;
  52796. class Option01 extends IntegerObject {
  52797. constructor(nsId, name) {
  52798. super(nsId, name, 0, n => n === 1);
  52799. }
  52800. }
  52801. exports.Option01 = Option01;
  52802. class Option10 extends IntegerObject {
  52803. constructor(nsId, name) {
  52804. super(nsId, name, 1, n => n === 0);
  52805. }
  52806. }
  52807. exports.Option10 = Option10;
  52808. /***/ }),
  52809. /* 76 */
  52810. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52811. Object.defineProperty(exports, "__esModule", ({
  52812. value: true
  52813. }));
  52814. exports.HTMLResult = void 0;
  52815. exports.getBBox = getBBox;
  52816. exports.getColor = getColor;
  52817. exports.getFloat = getFloat;
  52818. exports.getInteger = getInteger;
  52819. exports.getKeyword = getKeyword;
  52820. exports.getMeasurement = getMeasurement;
  52821. exports.getRatio = getRatio;
  52822. exports.getRelevant = getRelevant;
  52823. exports.getStringOption = getStringOption;
  52824. exports.stripQuotes = stripQuotes;
  52825. var _util = __w_pdfjs_require__(2);
  52826. const dimConverters = {
  52827. pt: x => x,
  52828. cm: x => x / 2.54 * 72,
  52829. mm: x => x / (10 * 2.54) * 72,
  52830. in: x => x * 72,
  52831. px: x => x
  52832. };
  52833. const measurementPattern = /([+-]?\d+\.?\d*)(.*)/;
  52834. function stripQuotes(str) {
  52835. if (str.startsWith("'") || str.startsWith('"')) {
  52836. return str.slice(1, str.length - 1);
  52837. }
  52838. return str;
  52839. }
  52840. function getInteger({
  52841. data,
  52842. defaultValue,
  52843. validate
  52844. }) {
  52845. if (!data) {
  52846. return defaultValue;
  52847. }
  52848. data = data.trim();
  52849. const n = parseInt(data, 10);
  52850. if (!isNaN(n) && validate(n)) {
  52851. return n;
  52852. }
  52853. return defaultValue;
  52854. }
  52855. function getFloat({
  52856. data,
  52857. defaultValue,
  52858. validate
  52859. }) {
  52860. if (!data) {
  52861. return defaultValue;
  52862. }
  52863. data = data.trim();
  52864. const n = parseFloat(data);
  52865. if (!isNaN(n) && validate(n)) {
  52866. return n;
  52867. }
  52868. return defaultValue;
  52869. }
  52870. function getKeyword({
  52871. data,
  52872. defaultValue,
  52873. validate
  52874. }) {
  52875. if (!data) {
  52876. return defaultValue;
  52877. }
  52878. data = data.trim();
  52879. if (validate(data)) {
  52880. return data;
  52881. }
  52882. return defaultValue;
  52883. }
  52884. function getStringOption(data, options) {
  52885. return getKeyword({
  52886. data,
  52887. defaultValue: options[0],
  52888. validate: k => options.includes(k)
  52889. });
  52890. }
  52891. function getMeasurement(str, def = "0") {
  52892. def = def || "0";
  52893. if (!str) {
  52894. return getMeasurement(def);
  52895. }
  52896. const match = str.trim().match(measurementPattern);
  52897. if (!match) {
  52898. return getMeasurement(def);
  52899. }
  52900. const [, valueStr, unit] = match;
  52901. const value = parseFloat(valueStr);
  52902. if (isNaN(value)) {
  52903. return getMeasurement(def);
  52904. }
  52905. if (value === 0) {
  52906. return 0;
  52907. }
  52908. const conv = dimConverters[unit];
  52909. if (conv) {
  52910. return conv(value);
  52911. }
  52912. return value;
  52913. }
  52914. function getRatio(data) {
  52915. if (!data) {
  52916. return {
  52917. num: 1,
  52918. den: 1
  52919. };
  52920. }
  52921. const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x));
  52922. if (ratio.length === 1) {
  52923. ratio.push(1);
  52924. }
  52925. if (ratio.length === 0) {
  52926. return {
  52927. num: 1,
  52928. den: 1
  52929. };
  52930. }
  52931. const [num, den] = ratio;
  52932. return {
  52933. num,
  52934. den
  52935. };
  52936. }
  52937. function getRelevant(data) {
  52938. if (!data) {
  52939. return [];
  52940. }
  52941. return data.trim().split(/\s+/).map(e => {
  52942. return {
  52943. excluded: e[0] === "-",
  52944. viewname: e.substring(1)
  52945. };
  52946. });
  52947. }
  52948. function getColor(data, def = [0, 0, 0]) {
  52949. let [r, g, b] = def;
  52950. if (!data) {
  52951. return {
  52952. r,
  52953. g,
  52954. b
  52955. };
  52956. }
  52957. const color = data.trim().split(/\s*,\s*/).map(c => Math.min(Math.max(0, parseInt(c.trim(), 10)), 255)).map(c => isNaN(c) ? 0 : c);
  52958. if (color.length < 3) {
  52959. return {
  52960. r,
  52961. g,
  52962. b
  52963. };
  52964. }
  52965. [r, g, b] = color;
  52966. return {
  52967. r,
  52968. g,
  52969. b
  52970. };
  52971. }
  52972. function getBBox(data) {
  52973. const def = -1;
  52974. if (!data) {
  52975. return {
  52976. x: def,
  52977. y: def,
  52978. width: def,
  52979. height: def
  52980. };
  52981. }
  52982. const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1"));
  52983. if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {
  52984. return {
  52985. x: def,
  52986. y: def,
  52987. width: def,
  52988. height: def
  52989. };
  52990. }
  52991. const [x, y, width, height] = bbox;
  52992. return {
  52993. x,
  52994. y,
  52995. width,
  52996. height
  52997. };
  52998. }
  52999. class HTMLResult {
  53000. static get FAILURE() {
  53001. return (0, _util.shadow)(this, "FAILURE", new HTMLResult(false, null, null, null));
  53002. }
  53003. static get EMPTY() {
  53004. return (0, _util.shadow)(this, "EMPTY", new HTMLResult(true, null, null, null));
  53005. }
  53006. constructor(success, html, bbox, breakNode) {
  53007. this.success = success;
  53008. this.html = html;
  53009. this.bbox = bbox;
  53010. this.breakNode = breakNode;
  53011. }
  53012. isBreak() {
  53013. return !!this.breakNode;
  53014. }
  53015. static breakNode(node) {
  53016. return new HTMLResult(false, null, null, node);
  53017. }
  53018. static success(html, bbox = null) {
  53019. return new HTMLResult(true, html, bbox, null);
  53020. }
  53021. }
  53022. exports.HTMLResult = HTMLResult;
  53023. /***/ }),
  53024. /* 77 */
  53025. /***/ ((__unused_webpack_module, exports) => {
  53026. Object.defineProperty(exports, "__esModule", ({
  53027. value: true
  53028. }));
  53029. exports.NamespaceIds = exports.$buildXFAObject = void 0;
  53030. const $buildXFAObject = Symbol();
  53031. exports.$buildXFAObject = $buildXFAObject;
  53032. const NamespaceIds = {
  53033. config: {
  53034. id: 0,
  53035. check: ns => ns.startsWith("http://www.xfa.org/schema/xci/")
  53036. },
  53037. connectionSet: {
  53038. id: 1,
  53039. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/")
  53040. },
  53041. datasets: {
  53042. id: 2,
  53043. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/")
  53044. },
  53045. form: {
  53046. id: 3,
  53047. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/")
  53048. },
  53049. localeSet: {
  53050. id: 4,
  53051. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/")
  53052. },
  53053. pdf: {
  53054. id: 5,
  53055. check: ns => ns === "http://ns.adobe.com/xdp/pdf/"
  53056. },
  53057. signature: {
  53058. id: 6,
  53059. check: ns => ns === "http://www.w3.org/2000/09/xmldsig#"
  53060. },
  53061. sourceSet: {
  53062. id: 7,
  53063. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/")
  53064. },
  53065. stylesheet: {
  53066. id: 8,
  53067. check: ns => ns === "http://www.w3.org/1999/XSL/Transform"
  53068. },
  53069. template: {
  53070. id: 9,
  53071. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/")
  53072. },
  53073. xdc: {
  53074. id: 10,
  53075. check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/")
  53076. },
  53077. xdp: {
  53078. id: 11,
  53079. check: ns => ns === "http://ns.adobe.com/xdp/"
  53080. },
  53081. xfdf: {
  53082. id: 12,
  53083. check: ns => ns === "http://ns.adobe.com/xfdf/"
  53084. },
  53085. xhtml: {
  53086. id: 13,
  53087. check: ns => ns === "http://www.w3.org/1999/xhtml"
  53088. },
  53089. xmpmeta: {
  53090. id: 14,
  53091. check: ns => ns === "http://ns.adobe.com/xmpmeta/"
  53092. }
  53093. };
  53094. exports.NamespaceIds = NamespaceIds;
  53095. /***/ }),
  53096. /* 78 */
  53097. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  53098. Object.defineProperty(exports, "__esModule", ({
  53099. value: true
  53100. }));
  53101. exports.createDataNode = createDataNode;
  53102. exports.searchNode = searchNode;
  53103. var _xfa_object = __w_pdfjs_require__(75);
  53104. var _namespaces = __w_pdfjs_require__(77);
  53105. var _util = __w_pdfjs_require__(2);
  53106. const namePattern = /^[^.[]+/;
  53107. const indexPattern = /^[^\]]+/;
  53108. const operators = {
  53109. dot: 0,
  53110. dotDot: 1,
  53111. dotHash: 2,
  53112. dotBracket: 3,
  53113. dotParen: 4
  53114. };
  53115. const shortcuts = new Map([["$data", (root, current) => root.datasets ? root.datasets.data : root], ["$record", (root, current) => (root.datasets ? root.datasets.data : root)[_xfa_object.$getChildren]()[0]], ["$template", (root, current) => root.template], ["$connectionSet", (root, current) => root.connectionSet], ["$form", (root, current) => root.form], ["$layout", (root, current) => root.layout], ["$host", (root, current) => root.host], ["$dataWindow", (root, current) => root.dataWindow], ["$event", (root, current) => root.event], ["!", (root, current) => root.datasets], ["$xfa", (root, current) => root], ["xfa", (root, current) => root], ["$", (root, current) => current]]);
  53116. const somCache = new WeakMap();
  53117. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  53118. function parseIndex(index) {
  53119. index = index.trim();
  53120. if (index === "*") {
  53121. return Infinity;
  53122. }
  53123. return parseInt(index, 10) || 0;
  53124. }
  53125. function parseExpression(expr, dotDotAllowed, noExpr = true) {
  53126. let match = expr.match(namePattern);
  53127. if (!match) {
  53128. return null;
  53129. }
  53130. let [name] = match;
  53131. const parsed = [{
  53132. name,
  53133. cacheName: "." + name,
  53134. index: 0,
  53135. js: null,
  53136. formCalc: null,
  53137. operator: operators.dot
  53138. }];
  53139. let pos = name.length;
  53140. while (pos < expr.length) {
  53141. const spos = pos;
  53142. const char = expr.charAt(pos++);
  53143. if (char === "[") {
  53144. match = expr.slice(pos).match(indexPattern);
  53145. if (!match) {
  53146. (0, _util.warn)("XFA - Invalid index in SOM expression");
  53147. return null;
  53148. }
  53149. parsed.at(-1).index = parseIndex(match[0]);
  53150. pos += match[0].length + 1;
  53151. continue;
  53152. }
  53153. let operator;
  53154. switch (expr.charAt(pos)) {
  53155. case ".":
  53156. if (!dotDotAllowed) {
  53157. return null;
  53158. }
  53159. pos++;
  53160. operator = operators.dotDot;
  53161. break;
  53162. case "#":
  53163. pos++;
  53164. operator = operators.dotHash;
  53165. break;
  53166. case "[":
  53167. if (noExpr) {
  53168. (0, _util.warn)("XFA - SOM expression contains a FormCalc subexpression which is not supported for now.");
  53169. return null;
  53170. }
  53171. operator = operators.dotBracket;
  53172. break;
  53173. case "(":
  53174. if (noExpr) {
  53175. (0, _util.warn)("XFA - SOM expression contains a JavaScript subexpression which is not supported for now.");
  53176. return null;
  53177. }
  53178. operator = operators.dotParen;
  53179. break;
  53180. default:
  53181. operator = operators.dot;
  53182. break;
  53183. }
  53184. match = expr.slice(pos).match(namePattern);
  53185. if (!match) {
  53186. break;
  53187. }
  53188. [name] = match;
  53189. pos += name.length;
  53190. parsed.push({
  53191. name,
  53192. cacheName: expr.slice(spos, pos),
  53193. operator,
  53194. index: 0,
  53195. js: null,
  53196. formCalc: null
  53197. });
  53198. }
  53199. return parsed;
  53200. }
  53201. function searchNode(root, container, expr, dotDotAllowed = true, useCache = true) {
  53202. const parsed = parseExpression(expr, dotDotAllowed);
  53203. if (!parsed) {
  53204. return null;
  53205. }
  53206. const fn = shortcuts.get(parsed[0].name);
  53207. let i = 0;
  53208. let isQualified;
  53209. if (fn) {
  53210. isQualified = true;
  53211. root = [fn(root, container)];
  53212. i = 1;
  53213. } else {
  53214. isQualified = container === null;
  53215. root = [container || root];
  53216. }
  53217. for (let ii = parsed.length; i < ii; i++) {
  53218. const {
  53219. name,
  53220. cacheName,
  53221. operator,
  53222. index
  53223. } = parsed[i];
  53224. const nodes = [];
  53225. for (const node of root) {
  53226. if (!(node instanceof _xfa_object.XFAObject)) {
  53227. continue;
  53228. }
  53229. let children, cached;
  53230. if (useCache) {
  53231. cached = somCache.get(node);
  53232. if (!cached) {
  53233. cached = new Map();
  53234. somCache.set(node, cached);
  53235. }
  53236. children = cached.get(cacheName);
  53237. }
  53238. if (!children) {
  53239. switch (operator) {
  53240. case operators.dot:
  53241. children = node[_xfa_object.$getChildrenByName](name, false);
  53242. break;
  53243. case operators.dotDot:
  53244. children = node[_xfa_object.$getChildrenByName](name, true);
  53245. break;
  53246. case operators.dotHash:
  53247. children = node[_xfa_object.$getChildrenByClass](name);
  53248. if (children instanceof _xfa_object.XFAObjectArray) {
  53249. children = children.children;
  53250. } else {
  53251. children = [children];
  53252. }
  53253. break;
  53254. default:
  53255. break;
  53256. }
  53257. if (useCache) {
  53258. cached.set(cacheName, children);
  53259. }
  53260. }
  53261. if (children.length > 0) {
  53262. nodes.push(children);
  53263. }
  53264. }
  53265. if (nodes.length === 0 && !isQualified && i === 0) {
  53266. const parent = container[_xfa_object.$getParent]();
  53267. container = parent;
  53268. if (!container) {
  53269. return null;
  53270. }
  53271. i = -1;
  53272. root = [container];
  53273. continue;
  53274. }
  53275. if (isFinite(index)) {
  53276. root = nodes.filter(node => index < node.length).map(node => node[index]);
  53277. } else {
  53278. root = nodes.flat();
  53279. }
  53280. }
  53281. if (root.length === 0) {
  53282. return null;
  53283. }
  53284. return root;
  53285. }
  53286. function createNodes(root, path) {
  53287. let node = null;
  53288. for (const {
  53289. name,
  53290. index
  53291. } of path) {
  53292. for (let i = 0, ii = !isFinite(index) ? 0 : index; i <= ii; i++) {
  53293. const nsId = root[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : root[_xfa_object.$namespaceId];
  53294. node = new _xfa_object.XmlObject(nsId, name);
  53295. root[_xfa_object.$appendChild](node);
  53296. }
  53297. root = node;
  53298. }
  53299. return node;
  53300. }
  53301. function createDataNode(root, container, expr) {
  53302. const parsed = parseExpression(expr);
  53303. if (!parsed) {
  53304. return null;
  53305. }
  53306. if (parsed.some(x => x.operator === operators.dotDot)) {
  53307. return null;
  53308. }
  53309. const fn = shortcuts.get(parsed[0].name);
  53310. let i = 0;
  53311. if (fn) {
  53312. root = fn(root, container);
  53313. i = 1;
  53314. } else {
  53315. root = container || root;
  53316. }
  53317. for (let ii = parsed.length; i < ii; i++) {
  53318. const {
  53319. name,
  53320. operator,
  53321. index
  53322. } = parsed[i];
  53323. if (!isFinite(index)) {
  53324. parsed[i].index = 0;
  53325. return createNodes(root, parsed.slice(i));
  53326. }
  53327. let children;
  53328. switch (operator) {
  53329. case operators.dot:
  53330. children = root[_xfa_object.$getChildrenByName](name, false);
  53331. break;
  53332. case operators.dotDot:
  53333. children = root[_xfa_object.$getChildrenByName](name, true);
  53334. break;
  53335. case operators.dotHash:
  53336. children = root[_xfa_object.$getChildrenByClass](name);
  53337. if (children instanceof _xfa_object.XFAObjectArray) {
  53338. children = children.children;
  53339. } else {
  53340. children = [children];
  53341. }
  53342. break;
  53343. default:
  53344. break;
  53345. }
  53346. if (children.length === 0) {
  53347. return createNodes(root, parsed.slice(i));
  53348. }
  53349. if (index < children.length) {
  53350. const child = children[index];
  53351. if (!(child instanceof _xfa_object.XFAObject)) {
  53352. (0, _util.warn)(`XFA - Cannot create a node.`);
  53353. return null;
  53354. }
  53355. root = child;
  53356. } else {
  53357. parsed[i].index = index - children.length;
  53358. return createNodes(root, parsed.slice(i));
  53359. }
  53360. }
  53361. return null;
  53362. }
  53363. /***/ }),
  53364. /* 79 */
  53365. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  53366. Object.defineProperty(exports, "__esModule", ({
  53367. value: true
  53368. }));
  53369. exports.Binder = void 0;
  53370. var _xfa_object = __w_pdfjs_require__(75);
  53371. var _template = __w_pdfjs_require__(80);
  53372. var _som = __w_pdfjs_require__(78);
  53373. var _namespaces = __w_pdfjs_require__(77);
  53374. var _util = __w_pdfjs_require__(2);
  53375. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  53376. function createText(content) {
  53377. const node = new _template.Text({});
  53378. node[_xfa_object.$content] = content;
  53379. return node;
  53380. }
  53381. class Binder {
  53382. constructor(root) {
  53383. this.root = root;
  53384. this.datasets = root.datasets;
  53385. if (root.datasets && root.datasets.data) {
  53386. this.data = root.datasets.data;
  53387. } else {
  53388. this.data = new _xfa_object.XmlObject(_namespaces.NamespaceIds.datasets.id, "data");
  53389. }
  53390. this.emptyMerge = this.data[_xfa_object.$getChildren]().length === 0;
  53391. this.root.form = this.form = root.template[_xfa_object.$clone]();
  53392. }
  53393. _isConsumeData() {
  53394. return !this.emptyMerge && this._mergeMode;
  53395. }
  53396. _isMatchTemplate() {
  53397. return !this._isConsumeData();
  53398. }
  53399. bind() {
  53400. this._bindElement(this.form, this.data);
  53401. return this.form;
  53402. }
  53403. getData() {
  53404. return this.data;
  53405. }
  53406. _bindValue(formNode, data, picture) {
  53407. formNode[_xfa_object.$data] = data;
  53408. if (formNode[_xfa_object.$hasSettableValue]()) {
  53409. if (data[_xfa_object.$isDataValue]()) {
  53410. const value = data[_xfa_object.$getDataValue]();
  53411. formNode[_xfa_object.$setValue](createText(value));
  53412. } else if (formNode instanceof _template.Field && formNode.ui && formNode.ui.choiceList && formNode.ui.choiceList.open === "multiSelect") {
  53413. const value = data[_xfa_object.$getChildren]().map(child => child[_xfa_object.$content].trim()).join("\n");
  53414. formNode[_xfa_object.$setValue](createText(value));
  53415. } else if (this._isConsumeData()) {
  53416. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  53417. }
  53418. } else if (!data[_xfa_object.$isDataValue]() || this._isMatchTemplate()) {
  53419. this._bindElement(formNode, data);
  53420. } else {
  53421. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  53422. }
  53423. }
  53424. _findDataByNameToConsume(name, isValue, dataNode, global) {
  53425. if (!name) {
  53426. return null;
  53427. }
  53428. let generator, match;
  53429. for (let i = 0; i < 3; i++) {
  53430. generator = dataNode[_xfa_object.$getRealChildrenByNameIt](name, false, true);
  53431. while (true) {
  53432. match = generator.next().value;
  53433. if (!match) {
  53434. break;
  53435. }
  53436. if (isValue === match[_xfa_object.$isDataValue]()) {
  53437. return match;
  53438. }
  53439. }
  53440. if (dataNode[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.datasets.id && dataNode[_xfa_object.$nodeName] === "data") {
  53441. break;
  53442. }
  53443. dataNode = dataNode[_xfa_object.$getParent]();
  53444. }
  53445. if (!global) {
  53446. return null;
  53447. }
  53448. generator = this.data[_xfa_object.$getRealChildrenByNameIt](name, true, false);
  53449. match = generator.next().value;
  53450. if (match) {
  53451. return match;
  53452. }
  53453. generator = this.data[_xfa_object.$getAttributeIt](name, true);
  53454. match = generator.next().value;
  53455. if (match && match[_xfa_object.$isDataValue]()) {
  53456. return match;
  53457. }
  53458. return null;
  53459. }
  53460. _setProperties(formNode, dataNode) {
  53461. if (!formNode.hasOwnProperty("setProperty")) {
  53462. return;
  53463. }
  53464. for (const {
  53465. ref,
  53466. target,
  53467. connection
  53468. } of formNode.setProperty.children) {
  53469. if (connection) {
  53470. continue;
  53471. }
  53472. if (!ref) {
  53473. continue;
  53474. }
  53475. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  53476. if (!nodes) {
  53477. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  53478. continue;
  53479. }
  53480. const [node] = nodes;
  53481. if (!node[_xfa_object.$isDescendent](this.data)) {
  53482. (0, _util.warn)(`XFA - Invalid node: must be a data node.`);
  53483. continue;
  53484. }
  53485. const targetNodes = (0, _som.searchNode)(this.root, formNode, target, false, false);
  53486. if (!targetNodes) {
  53487. (0, _util.warn)(`XFA - Invalid target: ${target}.`);
  53488. continue;
  53489. }
  53490. const [targetNode] = targetNodes;
  53491. if (!targetNode[_xfa_object.$isDescendent](formNode)) {
  53492. (0, _util.warn)(`XFA - Invalid target: must be a property or subproperty.`);
  53493. continue;
  53494. }
  53495. const targetParent = targetNode[_xfa_object.$getParent]();
  53496. if (targetNode instanceof _template.SetProperty || targetParent instanceof _template.SetProperty) {
  53497. (0, _util.warn)(`XFA - Invalid target: cannot be a setProperty or one of its properties.`);
  53498. continue;
  53499. }
  53500. if (targetNode instanceof _template.BindItems || targetParent instanceof _template.BindItems) {
  53501. (0, _util.warn)(`XFA - Invalid target: cannot be a bindItems or one of its properties.`);
  53502. continue;
  53503. }
  53504. const content = node[_xfa_object.$text]();
  53505. const name = targetNode[_xfa_object.$nodeName];
  53506. if (targetNode instanceof _xfa_object.XFAAttribute) {
  53507. const attrs = Object.create(null);
  53508. attrs[name] = content;
  53509. const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]);
  53510. targetParent[name] = obj[name];
  53511. continue;
  53512. }
  53513. if (!targetNode.hasOwnProperty(_xfa_object.$content)) {
  53514. (0, _util.warn)(`XFA - Invalid node to use in setProperty`);
  53515. continue;
  53516. }
  53517. targetNode[_xfa_object.$data] = node;
  53518. targetNode[_xfa_object.$content] = content;
  53519. targetNode[_xfa_object.$finalize]();
  53520. }
  53521. }
  53522. _bindItems(formNode, dataNode) {
  53523. if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) {
  53524. return;
  53525. }
  53526. for (const item of formNode.items.children) {
  53527. formNode[_xfa_object.$removeChild](item);
  53528. }
  53529. formNode.items.clear();
  53530. const labels = new _template.Items({});
  53531. const values = new _template.Items({});
  53532. formNode[_xfa_object.$appendChild](labels);
  53533. formNode.items.push(labels);
  53534. formNode[_xfa_object.$appendChild](values);
  53535. formNode.items.push(values);
  53536. for (const {
  53537. ref,
  53538. labelRef,
  53539. valueRef,
  53540. connection
  53541. } of formNode.bindItems.children) {
  53542. if (connection) {
  53543. continue;
  53544. }
  53545. if (!ref) {
  53546. continue;
  53547. }
  53548. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  53549. if (!nodes) {
  53550. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  53551. continue;
  53552. }
  53553. for (const node of nodes) {
  53554. if (!node[_xfa_object.$isDescendent](this.datasets)) {
  53555. (0, _util.warn)(`XFA - Invalid ref (${ref}): must be a datasets child.`);
  53556. continue;
  53557. }
  53558. const labelNodes = (0, _som.searchNode)(this.root, node, labelRef, true, false);
  53559. if (!labelNodes) {
  53560. (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`);
  53561. continue;
  53562. }
  53563. const [labelNode] = labelNodes;
  53564. if (!labelNode[_xfa_object.$isDescendent](this.datasets)) {
  53565. (0, _util.warn)(`XFA - Invalid label: must be a datasets child.`);
  53566. continue;
  53567. }
  53568. const valueNodes = (0, _som.searchNode)(this.root, node, valueRef, true, false);
  53569. if (!valueNodes) {
  53570. (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`);
  53571. continue;
  53572. }
  53573. const [valueNode] = valueNodes;
  53574. if (!valueNode[_xfa_object.$isDescendent](this.datasets)) {
  53575. (0, _util.warn)(`XFA - Invalid value: must be a datasets child.`);
  53576. continue;
  53577. }
  53578. const label = createText(labelNode[_xfa_object.$text]());
  53579. const value = createText(valueNode[_xfa_object.$text]());
  53580. labels[_xfa_object.$appendChild](label);
  53581. labels.text.push(label);
  53582. values[_xfa_object.$appendChild](value);
  53583. values.text.push(value);
  53584. }
  53585. }
  53586. }
  53587. _bindOccurrences(formNode, matches, picture) {
  53588. let baseClone;
  53589. if (matches.length > 1) {
  53590. baseClone = formNode[_xfa_object.$clone]();
  53591. baseClone[_xfa_object.$removeChild](baseClone.occur);
  53592. baseClone.occur = null;
  53593. }
  53594. this._bindValue(formNode, matches[0], picture);
  53595. this._setProperties(formNode, matches[0]);
  53596. this._bindItems(formNode, matches[0]);
  53597. if (matches.length === 1) {
  53598. return;
  53599. }
  53600. const parent = formNode[_xfa_object.$getParent]();
  53601. const name = formNode[_xfa_object.$nodeName];
  53602. const pos = parent[_xfa_object.$indexOf](formNode);
  53603. for (let i = 1, ii = matches.length; i < ii; i++) {
  53604. const match = matches[i];
  53605. const clone = baseClone[_xfa_object.$clone]();
  53606. parent[name].push(clone);
  53607. parent[_xfa_object.$insertAt](pos + i, clone);
  53608. this._bindValue(clone, match, picture);
  53609. this._setProperties(clone, match);
  53610. this._bindItems(clone, match);
  53611. }
  53612. }
  53613. _createOccurrences(formNode) {
  53614. if (!this.emptyMerge) {
  53615. return;
  53616. }
  53617. const {
  53618. occur
  53619. } = formNode;
  53620. if (!occur || occur.initial <= 1) {
  53621. return;
  53622. }
  53623. const parent = formNode[_xfa_object.$getParent]();
  53624. const name = formNode[_xfa_object.$nodeName];
  53625. if (!(parent[name] instanceof _xfa_object.XFAObjectArray)) {
  53626. return;
  53627. }
  53628. let currentNumber;
  53629. if (formNode.name) {
  53630. currentNumber = parent[name].children.filter(e => e.name === formNode.name).length;
  53631. } else {
  53632. currentNumber = parent[name].children.length;
  53633. }
  53634. const pos = parent[_xfa_object.$indexOf](formNode) + 1;
  53635. const ii = occur.initial - currentNumber;
  53636. if (ii) {
  53637. const nodeClone = formNode[_xfa_object.$clone]();
  53638. nodeClone[_xfa_object.$removeChild](nodeClone.occur);
  53639. nodeClone.occur = null;
  53640. parent[name].push(nodeClone);
  53641. parent[_xfa_object.$insertAt](pos, nodeClone);
  53642. for (let i = 1; i < ii; i++) {
  53643. const clone = nodeClone[_xfa_object.$clone]();
  53644. parent[name].push(clone);
  53645. parent[_xfa_object.$insertAt](pos + i, clone);
  53646. }
  53647. }
  53648. }
  53649. _getOccurInfo(formNode) {
  53650. const {
  53651. name,
  53652. occur
  53653. } = formNode;
  53654. if (!occur || !name) {
  53655. return [1, 1];
  53656. }
  53657. const max = occur.max === -1 ? Infinity : occur.max;
  53658. return [occur.min, max];
  53659. }
  53660. _setAndBind(formNode, dataNode) {
  53661. this._setProperties(formNode, dataNode);
  53662. this._bindItems(formNode, dataNode);
  53663. this._bindElement(formNode, dataNode);
  53664. }
  53665. _bindElement(formNode, dataNode) {
  53666. const uselessNodes = [];
  53667. this._createOccurrences(formNode);
  53668. for (const child of formNode[_xfa_object.$getChildren]()) {
  53669. if (child[_xfa_object.$data]) {
  53670. continue;
  53671. }
  53672. if (this._mergeMode === undefined && child[_xfa_object.$nodeName] === "subform") {
  53673. this._mergeMode = child.mergeMode === "consumeData";
  53674. const dataChildren = dataNode[_xfa_object.$getChildren]();
  53675. if (dataChildren.length > 0) {
  53676. this._bindOccurrences(child, [dataChildren[0]], null);
  53677. } else if (this.emptyMerge) {
  53678. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  53679. const dataChild = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name || "root");
  53680. dataNode[_xfa_object.$appendChild](dataChild);
  53681. this._bindElement(child, dataChild);
  53682. }
  53683. continue;
  53684. }
  53685. if (!child[_xfa_object.$isBindable]()) {
  53686. continue;
  53687. }
  53688. let global = false;
  53689. let picture = null;
  53690. let ref = null;
  53691. let match = null;
  53692. if (child.bind) {
  53693. switch (child.bind.match) {
  53694. case "none":
  53695. this._setAndBind(child, dataNode);
  53696. continue;
  53697. case "global":
  53698. global = true;
  53699. break;
  53700. case "dataRef":
  53701. if (!child.bind.ref) {
  53702. (0, _util.warn)(`XFA - ref is empty in node ${child[_xfa_object.$nodeName]}.`);
  53703. this._setAndBind(child, dataNode);
  53704. continue;
  53705. }
  53706. ref = child.bind.ref;
  53707. break;
  53708. default:
  53709. break;
  53710. }
  53711. if (child.bind.picture) {
  53712. picture = child.bind.picture[_xfa_object.$content];
  53713. }
  53714. }
  53715. const [min, max] = this._getOccurInfo(child);
  53716. if (ref) {
  53717. match = (0, _som.searchNode)(this.root, dataNode, ref, true, false);
  53718. if (match === null) {
  53719. match = (0, _som.createDataNode)(this.data, dataNode, ref);
  53720. if (!match) {
  53721. continue;
  53722. }
  53723. if (this._isConsumeData()) {
  53724. match[_xfa_object.$consumed] = true;
  53725. }
  53726. this._setAndBind(child, match);
  53727. continue;
  53728. } else {
  53729. if (this._isConsumeData()) {
  53730. match = match.filter(node => !node[_xfa_object.$consumed]);
  53731. }
  53732. if (match.length > max) {
  53733. match = match.slice(0, max);
  53734. } else if (match.length === 0) {
  53735. match = null;
  53736. }
  53737. if (match && this._isConsumeData()) {
  53738. match.forEach(node => {
  53739. node[_xfa_object.$consumed] = true;
  53740. });
  53741. }
  53742. }
  53743. } else {
  53744. if (!child.name) {
  53745. this._setAndBind(child, dataNode);
  53746. continue;
  53747. }
  53748. if (this._isConsumeData()) {
  53749. const matches = [];
  53750. while (matches.length < max) {
  53751. const found = this._findDataByNameToConsume(child.name, child[_xfa_object.$hasSettableValue](), dataNode, global);
  53752. if (!found) {
  53753. break;
  53754. }
  53755. found[_xfa_object.$consumed] = true;
  53756. matches.push(found);
  53757. }
  53758. match = matches.length > 0 ? matches : null;
  53759. } else {
  53760. match = dataNode[_xfa_object.$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value;
  53761. if (!match) {
  53762. if (min === 0) {
  53763. uselessNodes.push(child);
  53764. continue;
  53765. }
  53766. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  53767. match = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name);
  53768. if (this.emptyMerge) {
  53769. match[_xfa_object.$consumed] = true;
  53770. }
  53771. dataNode[_xfa_object.$appendChild](match);
  53772. this._setAndBind(child, match);
  53773. continue;
  53774. }
  53775. if (this.emptyMerge) {
  53776. match[_xfa_object.$consumed] = true;
  53777. }
  53778. match = [match];
  53779. }
  53780. }
  53781. if (match) {
  53782. this._bindOccurrences(child, match, picture);
  53783. } else if (min > 0) {
  53784. this._setAndBind(child, dataNode);
  53785. } else {
  53786. uselessNodes.push(child);
  53787. }
  53788. }
  53789. uselessNodes.forEach(node => node[_xfa_object.$getParent]()[_xfa_object.$removeChild](node));
  53790. }
  53791. }
  53792. exports.Binder = Binder;
  53793. /***/ }),
  53794. /* 80 */
  53795. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  53796. Object.defineProperty(exports, "__esModule", ({
  53797. value: true
  53798. }));
  53799. exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0;
  53800. var _xfa_object = __w_pdfjs_require__(75);
  53801. var _namespaces = __w_pdfjs_require__(77);
  53802. var _layout = __w_pdfjs_require__(81);
  53803. var _html_utils = __w_pdfjs_require__(82);
  53804. var _utils = __w_pdfjs_require__(76);
  53805. var _util = __w_pdfjs_require__(2);
  53806. var _fonts = __w_pdfjs_require__(83);
  53807. var _core_utils = __w_pdfjs_require__(4);
  53808. var _som = __w_pdfjs_require__(78);
  53809. const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id;
  53810. const SVG_NS = "http://www.w3.org/2000/svg";
  53811. const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2;
  53812. const MAX_EMPTY_PAGES = 3;
  53813. const DEFAULT_TAB_INDEX = 5000;
  53814. const HEADING_PATTERN = /^H(\d+)$/;
  53815. const MIMES = new Set(["image/gif", "image/jpeg", "image/jpg", "image/pjpeg", "image/png", "image/apng", "image/x-png", "image/bmp", "image/x-ms-bmp", "image/tiff", "image/tif", "application/octet-stream"]);
  53816. const IMAGES_HEADERS = [[[0x42, 0x4d], "image/bmp"], [[0xff, 0xd8, 0xff], "image/jpeg"], [[0x49, 0x49, 0x2a, 0x00], "image/tiff"], [[0x4d, 0x4d, 0x00, 0x2a], "image/tiff"], [[0x47, 0x49, 0x46, 0x38, 0x39, 0x61], "image/gif"], [[0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a], "image/png"]];
  53817. function getBorderDims(node) {
  53818. if (!node || !node.border) {
  53819. return {
  53820. w: 0,
  53821. h: 0
  53822. };
  53823. }
  53824. const borderExtra = node.border[_xfa_object.$getExtra]();
  53825. if (!borderExtra) {
  53826. return {
  53827. w: 0,
  53828. h: 0
  53829. };
  53830. }
  53831. return {
  53832. w: borderExtra.widths[0] + borderExtra.widths[2] + borderExtra.insets[0] + borderExtra.insets[2],
  53833. h: borderExtra.widths[1] + borderExtra.widths[3] + borderExtra.insets[1] + borderExtra.insets[3]
  53834. };
  53835. }
  53836. function hasMargin(node) {
  53837. return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset);
  53838. }
  53839. function _setValue(templateNode, value) {
  53840. if (!templateNode.value) {
  53841. const nodeValue = new Value({});
  53842. templateNode[_xfa_object.$appendChild](nodeValue);
  53843. templateNode.value = nodeValue;
  53844. }
  53845. templateNode.value[_xfa_object.$setValue](value);
  53846. }
  53847. function* getContainedChildren(node) {
  53848. for (const child of node[_xfa_object.$getChildren]()) {
  53849. if (child instanceof SubformSet) {
  53850. yield* child[_xfa_object.$getContainedChildren]();
  53851. continue;
  53852. }
  53853. yield child;
  53854. }
  53855. }
  53856. function isRequired(node) {
  53857. return node.validate && node.validate.nullTest === "error";
  53858. }
  53859. function setTabIndex(node) {
  53860. while (node) {
  53861. if (!node.traversal) {
  53862. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  53863. return;
  53864. }
  53865. if (node[_xfa_object.$tabIndex]) {
  53866. return;
  53867. }
  53868. let next = null;
  53869. for (const child of node.traversal[_xfa_object.$getChildren]()) {
  53870. if (child.operation === "next") {
  53871. next = child;
  53872. break;
  53873. }
  53874. }
  53875. if (!next || !next.ref) {
  53876. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  53877. return;
  53878. }
  53879. const root = node[_xfa_object.$getTemplateRoot]();
  53880. node[_xfa_object.$tabIndex] = ++root[_xfa_object.$tabIndex];
  53881. const ref = root[_xfa_object.$searchNode](next.ref, node);
  53882. if (!ref) {
  53883. return;
  53884. }
  53885. node = ref[0];
  53886. }
  53887. }
  53888. function applyAssist(obj, attributes) {
  53889. const assist = obj.assist;
  53890. if (assist) {
  53891. const assistTitle = assist[_xfa_object.$toHTML]();
  53892. if (assistTitle) {
  53893. attributes.title = assistTitle;
  53894. }
  53895. const role = assist.role;
  53896. const match = role.match(HEADING_PATTERN);
  53897. if (match) {
  53898. const ariaRole = "heading";
  53899. const ariaLevel = match[1];
  53900. attributes.role = ariaRole;
  53901. attributes["aria-level"] = ariaLevel;
  53902. }
  53903. }
  53904. if (obj.layout === "table") {
  53905. attributes.role = "table";
  53906. } else if (obj.layout === "row") {
  53907. attributes.role = "row";
  53908. } else {
  53909. const parent = obj[_xfa_object.$getParent]();
  53910. if (parent.layout === "row") {
  53911. if (parent.assist && parent.assist.role === "TH") {
  53912. attributes.role = "columnheader";
  53913. } else {
  53914. attributes.role = "cell";
  53915. }
  53916. }
  53917. }
  53918. }
  53919. function ariaLabel(obj) {
  53920. if (!obj.assist) {
  53921. return null;
  53922. }
  53923. const assist = obj.assist;
  53924. if (assist.speak && assist.speak[_xfa_object.$content] !== "") {
  53925. return assist.speak[_xfa_object.$content];
  53926. }
  53927. if (assist.toolTip) {
  53928. return assist.toolTip[_xfa_object.$content];
  53929. }
  53930. return null;
  53931. }
  53932. function valueToHtml(value) {
  53933. return _utils.HTMLResult.success({
  53934. name: "div",
  53935. attributes: {
  53936. class: ["xfaRich"],
  53937. style: Object.create(null)
  53938. },
  53939. children: [{
  53940. name: "span",
  53941. attributes: {
  53942. style: Object.create(null)
  53943. },
  53944. value
  53945. }]
  53946. });
  53947. }
  53948. function setFirstUnsplittable(node) {
  53949. const root = node[_xfa_object.$getTemplateRoot]();
  53950. if (root[_xfa_object.$extra].firstUnsplittable === null) {
  53951. root[_xfa_object.$extra].firstUnsplittable = node;
  53952. root[_xfa_object.$extra].noLayoutFailure = true;
  53953. }
  53954. }
  53955. function unsetFirstUnsplittable(node) {
  53956. const root = node[_xfa_object.$getTemplateRoot]();
  53957. if (root[_xfa_object.$extra].firstUnsplittable === node) {
  53958. root[_xfa_object.$extra].noLayoutFailure = false;
  53959. }
  53960. }
  53961. function handleBreak(node) {
  53962. if (node[_xfa_object.$extra]) {
  53963. return false;
  53964. }
  53965. node[_xfa_object.$extra] = Object.create(null);
  53966. if (node.targetType === "auto") {
  53967. return false;
  53968. }
  53969. const root = node[_xfa_object.$getTemplateRoot]();
  53970. let target = null;
  53971. if (node.target) {
  53972. target = root[_xfa_object.$searchNode](node.target, node[_xfa_object.$getParent]());
  53973. if (!target) {
  53974. return false;
  53975. }
  53976. target = target[0];
  53977. }
  53978. const {
  53979. currentPageArea,
  53980. currentContentArea
  53981. } = root[_xfa_object.$extra];
  53982. if (node.targetType === "pageArea") {
  53983. if (!(target instanceof PageArea)) {
  53984. target = null;
  53985. }
  53986. if (node.startNew) {
  53987. node[_xfa_object.$extra].target = target || currentPageArea;
  53988. return true;
  53989. } else if (target && target !== currentPageArea) {
  53990. node[_xfa_object.$extra].target = target;
  53991. return true;
  53992. }
  53993. return false;
  53994. }
  53995. if (!(target instanceof ContentArea)) {
  53996. target = null;
  53997. }
  53998. const pageArea = target && target[_xfa_object.$getParent]();
  53999. let index;
  54000. let nextPageArea = pageArea;
  54001. if (node.startNew) {
  54002. if (target) {
  54003. const contentAreas = pageArea.contentArea.children;
  54004. const indexForCurrent = contentAreas.indexOf(currentContentArea);
  54005. const indexForTarget = contentAreas.indexOf(target);
  54006. if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) {
  54007. nextPageArea = null;
  54008. }
  54009. index = indexForTarget - 1;
  54010. } else {
  54011. index = currentPageArea.contentArea.children.indexOf(currentContentArea);
  54012. }
  54013. } else if (target && target !== currentContentArea) {
  54014. const contentAreas = pageArea.contentArea.children;
  54015. index = contentAreas.indexOf(target) - 1;
  54016. nextPageArea = pageArea === currentPageArea ? null : pageArea;
  54017. } else {
  54018. return false;
  54019. }
  54020. node[_xfa_object.$extra].target = nextPageArea;
  54021. node[_xfa_object.$extra].index = index;
  54022. return true;
  54023. }
  54024. function handleOverflow(node, extraNode, space) {
  54025. const root = node[_xfa_object.$getTemplateRoot]();
  54026. const saved = root[_xfa_object.$extra].noLayoutFailure;
  54027. const savedMethod = extraNode[_xfa_object.$getSubformParent];
  54028. extraNode[_xfa_object.$getSubformParent] = () => node;
  54029. root[_xfa_object.$extra].noLayoutFailure = true;
  54030. const res = extraNode[_xfa_object.$toHTML](space);
  54031. node[_xfa_object.$addHTML](res.html, res.bbox);
  54032. root[_xfa_object.$extra].noLayoutFailure = saved;
  54033. extraNode[_xfa_object.$getSubformParent] = savedMethod;
  54034. }
  54035. class AppearanceFilter extends _xfa_object.StringObject {
  54036. constructor(attributes) {
  54037. super(TEMPLATE_NS_ID, "appearanceFilter");
  54038. this.id = attributes.id || "";
  54039. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54040. this.use = attributes.use || "";
  54041. this.usehref = attributes.usehref || "";
  54042. }
  54043. }
  54044. class Arc extends _xfa_object.XFAObject {
  54045. constructor(attributes) {
  54046. super(TEMPLATE_NS_ID, "arc", true);
  54047. this.circular = (0, _utils.getInteger)({
  54048. data: attributes.circular,
  54049. defaultValue: 0,
  54050. validate: x => x === 1
  54051. });
  54052. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  54053. this.id = attributes.id || "";
  54054. this.startAngle = (0, _utils.getFloat)({
  54055. data: attributes.startAngle,
  54056. defaultValue: 0,
  54057. validate: x => true
  54058. });
  54059. this.sweepAngle = (0, _utils.getFloat)({
  54060. data: attributes.sweepAngle,
  54061. defaultValue: 360,
  54062. validate: x => true
  54063. });
  54064. this.use = attributes.use || "";
  54065. this.usehref = attributes.usehref || "";
  54066. this.edge = null;
  54067. this.fill = null;
  54068. }
  54069. [_xfa_object.$toHTML]() {
  54070. const edge = this.edge || new Edge({});
  54071. const edgeStyle = edge[_xfa_object.$toStyle]();
  54072. const style = Object.create(null);
  54073. if (this.fill && this.fill.presence === "visible") {
  54074. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  54075. } else {
  54076. style.fill = "transparent";
  54077. }
  54078. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  54079. style.stroke = edgeStyle.color;
  54080. let arc;
  54081. const attributes = {
  54082. xmlns: SVG_NS,
  54083. style: {
  54084. width: "100%",
  54085. height: "100%",
  54086. overflow: "visible"
  54087. }
  54088. };
  54089. if (this.sweepAngle === 360) {
  54090. arc = {
  54091. name: "ellipse",
  54092. attributes: {
  54093. xmlns: SVG_NS,
  54094. cx: "50%",
  54095. cy: "50%",
  54096. rx: "50%",
  54097. ry: "50%",
  54098. style
  54099. }
  54100. };
  54101. } else {
  54102. const startAngle = this.startAngle * Math.PI / 180;
  54103. const sweepAngle = this.sweepAngle * Math.PI / 180;
  54104. const largeArc = this.sweepAngle > 180 ? 1 : 0;
  54105. const [x1, y1, x2, y2] = [50 * (1 + Math.cos(startAngle)), 50 * (1 - Math.sin(startAngle)), 50 * (1 + Math.cos(startAngle + sweepAngle)), 50 * (1 - Math.sin(startAngle + sweepAngle))];
  54106. arc = {
  54107. name: "path",
  54108. attributes: {
  54109. xmlns: SVG_NS,
  54110. d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`,
  54111. vectorEffect: "non-scaling-stroke",
  54112. style
  54113. }
  54114. };
  54115. Object.assign(attributes, {
  54116. viewBox: "0 0 100 100",
  54117. preserveAspectRatio: "none"
  54118. });
  54119. }
  54120. const svg = {
  54121. name: "svg",
  54122. children: [arc],
  54123. attributes
  54124. };
  54125. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  54126. if (hasMargin(parent)) {
  54127. return _utils.HTMLResult.success({
  54128. name: "div",
  54129. attributes: {
  54130. style: {
  54131. display: "inline",
  54132. width: "100%",
  54133. height: "100%"
  54134. }
  54135. },
  54136. children: [svg]
  54137. });
  54138. }
  54139. svg.attributes.style.position = "absolute";
  54140. return _utils.HTMLResult.success(svg);
  54141. }
  54142. }
  54143. class Area extends _xfa_object.XFAObject {
  54144. constructor(attributes) {
  54145. super(TEMPLATE_NS_ID, "area", true);
  54146. this.colSpan = (0, _utils.getInteger)({
  54147. data: attributes.colSpan,
  54148. defaultValue: 1,
  54149. validate: n => n >= 1 || n === -1
  54150. });
  54151. this.id = attributes.id || "";
  54152. this.name = attributes.name || "";
  54153. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54154. this.use = attributes.use || "";
  54155. this.usehref = attributes.usehref || "";
  54156. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  54157. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  54158. this.desc = null;
  54159. this.extras = null;
  54160. this.area = new _xfa_object.XFAObjectArray();
  54161. this.draw = new _xfa_object.XFAObjectArray();
  54162. this.exObject = new _xfa_object.XFAObjectArray();
  54163. this.exclGroup = new _xfa_object.XFAObjectArray();
  54164. this.field = new _xfa_object.XFAObjectArray();
  54165. this.subform = new _xfa_object.XFAObjectArray();
  54166. this.subformSet = new _xfa_object.XFAObjectArray();
  54167. }
  54168. *[_xfa_object.$getContainedChildren]() {
  54169. yield* getContainedChildren(this);
  54170. }
  54171. [_xfa_object.$isTransparent]() {
  54172. return true;
  54173. }
  54174. [_xfa_object.$isBindable]() {
  54175. return true;
  54176. }
  54177. [_xfa_object.$addHTML](html, bbox) {
  54178. const [x, y, w, h] = bbox;
  54179. this[_xfa_object.$extra].width = Math.max(this[_xfa_object.$extra].width, x + w);
  54180. this[_xfa_object.$extra].height = Math.max(this[_xfa_object.$extra].height, y + h);
  54181. this[_xfa_object.$extra].children.push(html);
  54182. }
  54183. [_xfa_object.$getAvailableSpace]() {
  54184. return this[_xfa_object.$extra].availableSpace;
  54185. }
  54186. [_xfa_object.$toHTML](availableSpace) {
  54187. const style = (0, _html_utils.toStyle)(this, "position");
  54188. const attributes = {
  54189. style,
  54190. id: this[_xfa_object.$uid],
  54191. class: ["xfaArea"]
  54192. };
  54193. if ((0, _html_utils.isPrintOnly)(this)) {
  54194. attributes.class.push("xfaPrintOnly");
  54195. }
  54196. if (this.name) {
  54197. attributes.xfaName = this.name;
  54198. }
  54199. const children = [];
  54200. this[_xfa_object.$extra] = {
  54201. children,
  54202. width: 0,
  54203. height: 0,
  54204. availableSpace
  54205. };
  54206. const result = this[_xfa_object.$childrenToHTML]({
  54207. filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]),
  54208. include: true
  54209. });
  54210. if (!result.success) {
  54211. if (result.isBreak()) {
  54212. return result;
  54213. }
  54214. delete this[_xfa_object.$extra];
  54215. return _utils.HTMLResult.FAILURE;
  54216. }
  54217. style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width);
  54218. style.height = (0, _html_utils.measureToString)(this[_xfa_object.$extra].height);
  54219. const html = {
  54220. name: "div",
  54221. attributes,
  54222. children
  54223. };
  54224. const bbox = [this.x, this.y, this[_xfa_object.$extra].width, this[_xfa_object.$extra].height];
  54225. delete this[_xfa_object.$extra];
  54226. return _utils.HTMLResult.success(html, bbox);
  54227. }
  54228. }
  54229. class Assist extends _xfa_object.XFAObject {
  54230. constructor(attributes) {
  54231. super(TEMPLATE_NS_ID, "assist", true);
  54232. this.id = attributes.id || "";
  54233. this.role = attributes.role || "";
  54234. this.use = attributes.use || "";
  54235. this.usehref = attributes.usehref || "";
  54236. this.speak = null;
  54237. this.toolTip = null;
  54238. }
  54239. [_xfa_object.$toHTML]() {
  54240. return this.toolTip && this.toolTip[_xfa_object.$content] ? this.toolTip[_xfa_object.$content] : null;
  54241. }
  54242. }
  54243. class Barcode extends _xfa_object.XFAObject {
  54244. constructor(attributes) {
  54245. super(TEMPLATE_NS_ID, "barcode", true);
  54246. this.charEncoding = (0, _utils.getKeyword)({
  54247. data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "",
  54248. defaultValue: "",
  54249. validate: k => ["utf-8", "big-five", "fontspecific", "gbk", "gb-18030", "gb-2312", "ksc-5601", "none", "shift-jis", "ucs-2", "utf-16"].includes(k) || k.match(/iso-8859-\d{2}/)
  54250. });
  54251. this.checksum = (0, _utils.getStringOption)(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]);
  54252. this.dataColumnCount = (0, _utils.getInteger)({
  54253. data: attributes.dataColumnCount,
  54254. defaultValue: -1,
  54255. validate: x => x >= 0
  54256. });
  54257. this.dataLength = (0, _utils.getInteger)({
  54258. data: attributes.dataLength,
  54259. defaultValue: -1,
  54260. validate: x => x >= 0
  54261. });
  54262. this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, ["none", "flateCompress"]);
  54263. this.dataRowCount = (0, _utils.getInteger)({
  54264. data: attributes.dataRowCount,
  54265. defaultValue: -1,
  54266. validate: x => x >= 0
  54267. });
  54268. this.endChar = attributes.endChar || "";
  54269. this.errorCorrectionLevel = (0, _utils.getInteger)({
  54270. data: attributes.errorCorrectionLevel,
  54271. defaultValue: -1,
  54272. validate: x => x >= 0 && x <= 8
  54273. });
  54274. this.id = attributes.id || "";
  54275. this.moduleHeight = (0, _utils.getMeasurement)(attributes.moduleHeight, "5mm");
  54276. this.moduleWidth = (0, _utils.getMeasurement)(attributes.moduleWidth, "0.25mm");
  54277. this.printCheckDigit = (0, _utils.getInteger)({
  54278. data: attributes.printCheckDigit,
  54279. defaultValue: 0,
  54280. validate: x => x === 1
  54281. });
  54282. this.rowColumnRatio = (0, _utils.getRatio)(attributes.rowColumnRatio);
  54283. this.startChar = attributes.startChar || "";
  54284. this.textLocation = (0, _utils.getStringOption)(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]);
  54285. this.truncate = (0, _utils.getInteger)({
  54286. data: attributes.truncate,
  54287. defaultValue: 0,
  54288. validate: x => x === 1
  54289. });
  54290. this.type = (0, _utils.getStringOption)(attributes.type ? attributes.type.toLowerCase() : "", ["aztec", "codabar", "code2of5industrial", "code2of5interleaved", "code2of5matrix", "code2of5standard", "code3of9", "code3of9extended", "code11", "code49", "code93", "code128", "code128a", "code128b", "code128c", "code128sscc", "datamatrix", "ean8", "ean8add2", "ean8add5", "ean13", "ean13add2", "ean13add5", "ean13pwcd", "fim", "logmars", "maxicode", "msi", "pdf417", "pdf417macro", "plessey", "postauscust2", "postauscust3", "postausreplypaid", "postausstandard", "postukrm4scc", "postusdpbc", "postusimb", "postusstandard", "postus5zip", "qrcode", "rfid", "rss14", "rss14expanded", "rss14limited", "rss14stacked", "rss14stackedomni", "rss14truncated", "telepen", "ucc128", "ucc128random", "ucc128sscc", "upca", "upcaadd2", "upcaadd5", "upcapwcd", "upce", "upceadd2", "upceadd5", "upcean2", "upcean5", "upsmaxicode"]);
  54291. this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]);
  54292. this.use = attributes.use || "";
  54293. this.usehref = attributes.usehref || "";
  54294. this.wideNarrowRatio = (0, _utils.getRatio)(attributes.wideNarrowRatio);
  54295. this.encrypt = null;
  54296. this.extras = null;
  54297. }
  54298. }
  54299. class Bind extends _xfa_object.XFAObject {
  54300. constructor(attributes) {
  54301. super(TEMPLATE_NS_ID, "bind", true);
  54302. this.match = (0, _utils.getStringOption)(attributes.match, ["once", "dataRef", "global", "none"]);
  54303. this.ref = attributes.ref || "";
  54304. this.picture = null;
  54305. }
  54306. }
  54307. class BindItems extends _xfa_object.XFAObject {
  54308. constructor(attributes) {
  54309. super(TEMPLATE_NS_ID, "bindItems");
  54310. this.connection = attributes.connection || "";
  54311. this.labelRef = attributes.labelRef || "";
  54312. this.ref = attributes.ref || "";
  54313. this.valueRef = attributes.valueRef || "";
  54314. }
  54315. }
  54316. exports.BindItems = BindItems;
  54317. class Bookend extends _xfa_object.XFAObject {
  54318. constructor(attributes) {
  54319. super(TEMPLATE_NS_ID, "bookend");
  54320. this.id = attributes.id || "";
  54321. this.leader = attributes.leader || "";
  54322. this.trailer = attributes.trailer || "";
  54323. this.use = attributes.use || "";
  54324. this.usehref = attributes.usehref || "";
  54325. }
  54326. }
  54327. class BooleanElement extends _xfa_object.Option01 {
  54328. constructor(attributes) {
  54329. super(TEMPLATE_NS_ID, "boolean");
  54330. this.id = attributes.id || "";
  54331. this.name = attributes.name || "";
  54332. this.use = attributes.use || "";
  54333. this.usehref = attributes.usehref || "";
  54334. }
  54335. [_xfa_object.$toHTML](availableSpace) {
  54336. return valueToHtml(this[_xfa_object.$content] === 1 ? "1" : "0");
  54337. }
  54338. }
  54339. class Border extends _xfa_object.XFAObject {
  54340. constructor(attributes) {
  54341. super(TEMPLATE_NS_ID, "border", true);
  54342. this.break = (0, _utils.getStringOption)(attributes.break, ["close", "open"]);
  54343. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  54344. this.id = attributes.id || "";
  54345. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54346. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54347. this.use = attributes.use || "";
  54348. this.usehref = attributes.usehref || "";
  54349. this.corner = new _xfa_object.XFAObjectArray(4);
  54350. this.edge = new _xfa_object.XFAObjectArray(4);
  54351. this.extras = null;
  54352. this.fill = null;
  54353. this.margin = null;
  54354. }
  54355. [_xfa_object.$getExtra]() {
  54356. if (!this[_xfa_object.$extra]) {
  54357. const edges = this.edge.children.slice();
  54358. if (edges.length < 4) {
  54359. const defaultEdge = edges.at(-1) || new Edge({});
  54360. for (let i = edges.length; i < 4; i++) {
  54361. edges.push(defaultEdge);
  54362. }
  54363. }
  54364. const widths = edges.map(edge => edge.thickness);
  54365. const insets = [0, 0, 0, 0];
  54366. if (this.margin) {
  54367. insets[0] = this.margin.topInset;
  54368. insets[1] = this.margin.rightInset;
  54369. insets[2] = this.margin.bottomInset;
  54370. insets[3] = this.margin.leftInset;
  54371. }
  54372. this[_xfa_object.$extra] = {
  54373. widths,
  54374. insets,
  54375. edges
  54376. };
  54377. }
  54378. return this[_xfa_object.$extra];
  54379. }
  54380. [_xfa_object.$toStyle]() {
  54381. const {
  54382. edges
  54383. } = this[_xfa_object.$getExtra]();
  54384. const edgeStyles = edges.map(node => {
  54385. const style = node[_xfa_object.$toStyle]();
  54386. style.color = style.color || "#000000";
  54387. return style;
  54388. });
  54389. const style = Object.create(null);
  54390. if (this.margin) {
  54391. Object.assign(style, this.margin[_xfa_object.$toStyle]());
  54392. }
  54393. if (this.fill && this.fill.presence === "visible") {
  54394. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  54395. }
  54396. if (this.corner.children.some(node => node.radius !== 0)) {
  54397. const cornerStyles = this.corner.children.map(node => node[_xfa_object.$toStyle]());
  54398. if (cornerStyles.length === 2 || cornerStyles.length === 3) {
  54399. const last = cornerStyles.at(-1);
  54400. for (let i = cornerStyles.length; i < 4; i++) {
  54401. cornerStyles.push(last);
  54402. }
  54403. }
  54404. style.borderRadius = cornerStyles.map(s => s.radius).join(" ");
  54405. }
  54406. switch (this.presence) {
  54407. case "invisible":
  54408. case "hidden":
  54409. style.borderStyle = "";
  54410. break;
  54411. case "inactive":
  54412. style.borderStyle = "none";
  54413. break;
  54414. default:
  54415. style.borderStyle = edgeStyles.map(s => s.style).join(" ");
  54416. break;
  54417. }
  54418. style.borderWidth = edgeStyles.map(s => s.width).join(" ");
  54419. style.borderColor = edgeStyles.map(s => s.color).join(" ");
  54420. return style;
  54421. }
  54422. }
  54423. class Break extends _xfa_object.XFAObject {
  54424. constructor(attributes) {
  54425. super(TEMPLATE_NS_ID, "break", true);
  54426. this.after = (0, _utils.getStringOption)(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  54427. this.afterTarget = attributes.afterTarget || "";
  54428. this.before = (0, _utils.getStringOption)(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  54429. this.beforeTarget = attributes.beforeTarget || "";
  54430. this.bookendLeader = attributes.bookendLeader || "";
  54431. this.bookendTrailer = attributes.bookendTrailer || "";
  54432. this.id = attributes.id || "";
  54433. this.overflowLeader = attributes.overflowLeader || "";
  54434. this.overflowTarget = attributes.overflowTarget || "";
  54435. this.overflowTrailer = attributes.overflowTrailer || "";
  54436. this.startNew = (0, _utils.getInteger)({
  54437. data: attributes.startNew,
  54438. defaultValue: 0,
  54439. validate: x => x === 1
  54440. });
  54441. this.use = attributes.use || "";
  54442. this.usehref = attributes.usehref || "";
  54443. this.extras = null;
  54444. }
  54445. }
  54446. class BreakAfter extends _xfa_object.XFAObject {
  54447. constructor(attributes) {
  54448. super(TEMPLATE_NS_ID, "breakAfter", true);
  54449. this.id = attributes.id || "";
  54450. this.leader = attributes.leader || "";
  54451. this.startNew = (0, _utils.getInteger)({
  54452. data: attributes.startNew,
  54453. defaultValue: 0,
  54454. validate: x => x === 1
  54455. });
  54456. this.target = attributes.target || "";
  54457. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  54458. this.trailer = attributes.trailer || "";
  54459. this.use = attributes.use || "";
  54460. this.usehref = attributes.usehref || "";
  54461. this.script = null;
  54462. }
  54463. }
  54464. class BreakBefore extends _xfa_object.XFAObject {
  54465. constructor(attributes) {
  54466. super(TEMPLATE_NS_ID, "breakBefore", true);
  54467. this.id = attributes.id || "";
  54468. this.leader = attributes.leader || "";
  54469. this.startNew = (0, _utils.getInteger)({
  54470. data: attributes.startNew,
  54471. defaultValue: 0,
  54472. validate: x => x === 1
  54473. });
  54474. this.target = attributes.target || "";
  54475. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  54476. this.trailer = attributes.trailer || "";
  54477. this.use = attributes.use || "";
  54478. this.usehref = attributes.usehref || "";
  54479. this.script = null;
  54480. }
  54481. [_xfa_object.$toHTML](availableSpace) {
  54482. this[_xfa_object.$extra] = {};
  54483. return _utils.HTMLResult.FAILURE;
  54484. }
  54485. }
  54486. class Button extends _xfa_object.XFAObject {
  54487. constructor(attributes) {
  54488. super(TEMPLATE_NS_ID, "button", true);
  54489. this.highlight = (0, _utils.getStringOption)(attributes.highlight, ["inverted", "none", "outline", "push"]);
  54490. this.id = attributes.id || "";
  54491. this.use = attributes.use || "";
  54492. this.usehref = attributes.usehref || "";
  54493. this.extras = null;
  54494. }
  54495. [_xfa_object.$toHTML](availableSpace) {
  54496. const parent = this[_xfa_object.$getParent]();
  54497. const grandpa = parent[_xfa_object.$getParent]();
  54498. const htmlButton = {
  54499. name: "button",
  54500. attributes: {
  54501. id: this[_xfa_object.$uid],
  54502. class: ["xfaButton"],
  54503. style: {}
  54504. },
  54505. children: []
  54506. };
  54507. for (const event of grandpa.event.children) {
  54508. if (event.activity !== "click" || !event.script) {
  54509. continue;
  54510. }
  54511. const jsURL = (0, _core_utils.recoverJsURL)(event.script[_xfa_object.$content]);
  54512. if (!jsURL) {
  54513. continue;
  54514. }
  54515. const href = (0, _html_utils.fixURL)(jsURL.url);
  54516. if (!href) {
  54517. continue;
  54518. }
  54519. htmlButton.children.push({
  54520. name: "a",
  54521. attributes: {
  54522. id: "link" + this[_xfa_object.$uid],
  54523. href,
  54524. newWindow: jsURL.newWindow,
  54525. class: ["xfaLink"],
  54526. style: {}
  54527. },
  54528. children: []
  54529. });
  54530. }
  54531. return _utils.HTMLResult.success(htmlButton);
  54532. }
  54533. }
  54534. class Calculate extends _xfa_object.XFAObject {
  54535. constructor(attributes) {
  54536. super(TEMPLATE_NS_ID, "calculate", true);
  54537. this.id = attributes.id || "";
  54538. this.override = (0, _utils.getStringOption)(attributes.override, ["disabled", "error", "ignore", "warning"]);
  54539. this.use = attributes.use || "";
  54540. this.usehref = attributes.usehref || "";
  54541. this.extras = null;
  54542. this.message = null;
  54543. this.script = null;
  54544. }
  54545. }
  54546. class Caption extends _xfa_object.XFAObject {
  54547. constructor(attributes) {
  54548. super(TEMPLATE_NS_ID, "caption", true);
  54549. this.id = attributes.id || "";
  54550. this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]);
  54551. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54552. this.reserve = Math.ceil((0, _utils.getMeasurement)(attributes.reserve));
  54553. this.use = attributes.use || "";
  54554. this.usehref = attributes.usehref || "";
  54555. this.extras = null;
  54556. this.font = null;
  54557. this.margin = null;
  54558. this.para = null;
  54559. this.value = null;
  54560. }
  54561. [_xfa_object.$setValue](value) {
  54562. _setValue(this, value);
  54563. }
  54564. [_xfa_object.$getExtra](availableSpace) {
  54565. if (!this[_xfa_object.$extra]) {
  54566. let {
  54567. width,
  54568. height
  54569. } = availableSpace;
  54570. switch (this.placement) {
  54571. case "left":
  54572. case "right":
  54573. case "inline":
  54574. width = this.reserve <= 0 ? width : this.reserve;
  54575. break;
  54576. case "top":
  54577. case "bottom":
  54578. height = this.reserve <= 0 ? height : this.reserve;
  54579. break;
  54580. }
  54581. this[_xfa_object.$extra] = (0, _html_utils.layoutNode)(this, {
  54582. width,
  54583. height
  54584. });
  54585. }
  54586. return this[_xfa_object.$extra];
  54587. }
  54588. [_xfa_object.$toHTML](availableSpace) {
  54589. if (!this.value) {
  54590. return _utils.HTMLResult.EMPTY;
  54591. }
  54592. this[_xfa_object.$pushPara]();
  54593. const value = this.value[_xfa_object.$toHTML](availableSpace).html;
  54594. if (!value) {
  54595. this[_xfa_object.$popPara]();
  54596. return _utils.HTMLResult.EMPTY;
  54597. }
  54598. const savedReserve = this.reserve;
  54599. if (this.reserve <= 0) {
  54600. const {
  54601. w,
  54602. h
  54603. } = this[_xfa_object.$getExtra](availableSpace);
  54604. switch (this.placement) {
  54605. case "left":
  54606. case "right":
  54607. case "inline":
  54608. this.reserve = w;
  54609. break;
  54610. case "top":
  54611. case "bottom":
  54612. this.reserve = h;
  54613. break;
  54614. }
  54615. }
  54616. const children = [];
  54617. if (typeof value === "string") {
  54618. children.push({
  54619. name: "#text",
  54620. value
  54621. });
  54622. } else {
  54623. children.push(value);
  54624. }
  54625. const style = (0, _html_utils.toStyle)(this, "font", "margin", "visibility");
  54626. switch (this.placement) {
  54627. case "left":
  54628. case "right":
  54629. if (this.reserve > 0) {
  54630. style.width = (0, _html_utils.measureToString)(this.reserve);
  54631. }
  54632. break;
  54633. case "top":
  54634. case "bottom":
  54635. if (this.reserve > 0) {
  54636. style.height = (0, _html_utils.measureToString)(this.reserve);
  54637. }
  54638. break;
  54639. }
  54640. (0, _html_utils.setPara)(this, null, value);
  54641. this[_xfa_object.$popPara]();
  54642. this.reserve = savedReserve;
  54643. return _utils.HTMLResult.success({
  54644. name: "div",
  54645. attributes: {
  54646. style,
  54647. class: ["xfaCaption"]
  54648. },
  54649. children
  54650. });
  54651. }
  54652. }
  54653. class Certificate extends _xfa_object.StringObject {
  54654. constructor(attributes) {
  54655. super(TEMPLATE_NS_ID, "certificate");
  54656. this.id = attributes.id || "";
  54657. this.name = attributes.name || "";
  54658. this.use = attributes.use || "";
  54659. this.usehref = attributes.usehref || "";
  54660. }
  54661. }
  54662. class Certificates extends _xfa_object.XFAObject {
  54663. constructor(attributes) {
  54664. super(TEMPLATE_NS_ID, "certificates", true);
  54665. this.credentialServerPolicy = (0, _utils.getStringOption)(attributes.credentialServerPolicy, ["optional", "required"]);
  54666. this.id = attributes.id || "";
  54667. this.url = attributes.url || "";
  54668. this.urlPolicy = attributes.urlPolicy || "";
  54669. this.use = attributes.use || "";
  54670. this.usehref = attributes.usehref || "";
  54671. this.encryption = null;
  54672. this.issuers = null;
  54673. this.keyUsage = null;
  54674. this.oids = null;
  54675. this.signing = null;
  54676. this.subjectDNs = null;
  54677. }
  54678. }
  54679. class CheckButton extends _xfa_object.XFAObject {
  54680. constructor(attributes) {
  54681. super(TEMPLATE_NS_ID, "checkButton", true);
  54682. this.id = attributes.id || "";
  54683. this.mark = (0, _utils.getStringOption)(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]);
  54684. this.shape = (0, _utils.getStringOption)(attributes.shape, ["square", "round"]);
  54685. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  54686. this.use = attributes.use || "";
  54687. this.usehref = attributes.usehref || "";
  54688. this.border = null;
  54689. this.extras = null;
  54690. this.margin = null;
  54691. }
  54692. [_xfa_object.$toHTML](availableSpace) {
  54693. const style = (0, _html_utils.toStyle)("margin");
  54694. const size = (0, _html_utils.measureToString)(this.size);
  54695. style.width = style.height = size;
  54696. let type;
  54697. let className;
  54698. let groupId;
  54699. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  54700. const items = field.items.children.length && field.items.children[0][_xfa_object.$toHTML]().html || [];
  54701. const exportedValue = {
  54702. on: (items[0] !== undefined ? items[0] : "on").toString(),
  54703. off: (items[1] !== undefined ? items[1] : "off").toString()
  54704. };
  54705. const value = field.value && field.value[_xfa_object.$text]() || "off";
  54706. const checked = value === exportedValue.on || undefined;
  54707. const container = field[_xfa_object.$getSubformParent]();
  54708. const fieldId = field[_xfa_object.$uid];
  54709. let dataId;
  54710. if (container instanceof ExclGroup) {
  54711. groupId = container[_xfa_object.$uid];
  54712. type = "radio";
  54713. className = "xfaRadio";
  54714. dataId = container[_xfa_object.$data] && container[_xfa_object.$data][_xfa_object.$uid] || container[_xfa_object.$uid];
  54715. } else {
  54716. type = "checkbox";
  54717. className = "xfaCheckbox";
  54718. dataId = field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid];
  54719. }
  54720. const input = {
  54721. name: "input",
  54722. attributes: {
  54723. class: [className],
  54724. style,
  54725. fieldId,
  54726. dataId,
  54727. type,
  54728. checked,
  54729. xfaOn: exportedValue.on,
  54730. xfaOff: exportedValue.off,
  54731. "aria-label": ariaLabel(field),
  54732. "aria-required": false
  54733. }
  54734. };
  54735. if (groupId) {
  54736. input.attributes.name = groupId;
  54737. }
  54738. if (isRequired(field)) {
  54739. input.attributes["aria-required"] = true;
  54740. input.attributes.required = true;
  54741. }
  54742. return _utils.HTMLResult.success({
  54743. name: "label",
  54744. attributes: {
  54745. class: ["xfaLabel"]
  54746. },
  54747. children: [input]
  54748. });
  54749. }
  54750. }
  54751. class ChoiceList extends _xfa_object.XFAObject {
  54752. constructor(attributes) {
  54753. super(TEMPLATE_NS_ID, "choiceList", true);
  54754. this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, ["select", "exit"]);
  54755. this.id = attributes.id || "";
  54756. this.open = (0, _utils.getStringOption)(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]);
  54757. this.textEntry = (0, _utils.getInteger)({
  54758. data: attributes.textEntry,
  54759. defaultValue: 0,
  54760. validate: x => x === 1
  54761. });
  54762. this.use = attributes.use || "";
  54763. this.usehref = attributes.usehref || "";
  54764. this.border = null;
  54765. this.extras = null;
  54766. this.margin = null;
  54767. }
  54768. [_xfa_object.$toHTML](availableSpace) {
  54769. const style = (0, _html_utils.toStyle)(this, "border", "margin");
  54770. const ui = this[_xfa_object.$getParent]();
  54771. const field = ui[_xfa_object.$getParent]();
  54772. const fontSize = field.font && field.font.size || 10;
  54773. const optionStyle = {
  54774. fontSize: `calc(${fontSize}px * var(--scale-factor))`
  54775. };
  54776. const children = [];
  54777. if (field.items.children.length > 0) {
  54778. const items = field.items;
  54779. let displayedIndex = 0;
  54780. let saveIndex = 0;
  54781. if (items.children.length === 2) {
  54782. displayedIndex = items.children[0].save;
  54783. saveIndex = 1 - displayedIndex;
  54784. }
  54785. const displayed = items.children[displayedIndex][_xfa_object.$toHTML]().html;
  54786. const values = items.children[saveIndex][_xfa_object.$toHTML]().html;
  54787. let selected = false;
  54788. const value = field.value && field.value[_xfa_object.$text]() || "";
  54789. for (let i = 0, ii = displayed.length; i < ii; i++) {
  54790. const option = {
  54791. name: "option",
  54792. attributes: {
  54793. value: values[i] || displayed[i],
  54794. style: optionStyle
  54795. },
  54796. value: displayed[i]
  54797. };
  54798. if (values[i] === value) {
  54799. option.attributes.selected = selected = true;
  54800. }
  54801. children.push(option);
  54802. }
  54803. if (!selected) {
  54804. children.splice(0, 0, {
  54805. name: "option",
  54806. attributes: {
  54807. hidden: true,
  54808. selected: true
  54809. },
  54810. value: " "
  54811. });
  54812. }
  54813. }
  54814. const selectAttributes = {
  54815. class: ["xfaSelect"],
  54816. fieldId: field[_xfa_object.$uid],
  54817. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  54818. style,
  54819. "aria-label": ariaLabel(field),
  54820. "aria-required": false
  54821. };
  54822. if (isRequired(field)) {
  54823. selectAttributes["aria-required"] = true;
  54824. selectAttributes.required = true;
  54825. }
  54826. if (this.open === "multiSelect") {
  54827. selectAttributes.multiple = true;
  54828. }
  54829. return _utils.HTMLResult.success({
  54830. name: "label",
  54831. attributes: {
  54832. class: ["xfaLabel"]
  54833. },
  54834. children: [{
  54835. name: "select",
  54836. children,
  54837. attributes: selectAttributes
  54838. }]
  54839. });
  54840. }
  54841. }
  54842. class Color extends _xfa_object.XFAObject {
  54843. constructor(attributes) {
  54844. super(TEMPLATE_NS_ID, "color", true);
  54845. this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, ["SRGB"]);
  54846. this.id = attributes.id || "";
  54847. this.use = attributes.use || "";
  54848. this.usehref = attributes.usehref || "";
  54849. this.value = attributes.value ? (0, _utils.getColor)(attributes.value) : "";
  54850. this.extras = null;
  54851. }
  54852. [_xfa_object.$hasSettableValue]() {
  54853. return false;
  54854. }
  54855. [_xfa_object.$toStyle]() {
  54856. return this.value ? _util.Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null;
  54857. }
  54858. }
  54859. class Comb extends _xfa_object.XFAObject {
  54860. constructor(attributes) {
  54861. super(TEMPLATE_NS_ID, "comb");
  54862. this.id = attributes.id || "";
  54863. this.numberOfCells = (0, _utils.getInteger)({
  54864. data: attributes.numberOfCells,
  54865. defaultValue: 0,
  54866. validate: x => x >= 0
  54867. });
  54868. this.use = attributes.use || "";
  54869. this.usehref = attributes.usehref || "";
  54870. }
  54871. }
  54872. class Connect extends _xfa_object.XFAObject {
  54873. constructor(attributes) {
  54874. super(TEMPLATE_NS_ID, "connect", true);
  54875. this.connection = attributes.connection || "";
  54876. this.id = attributes.id || "";
  54877. this.ref = attributes.ref || "";
  54878. this.usage = (0, _utils.getStringOption)(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]);
  54879. this.use = attributes.use || "";
  54880. this.usehref = attributes.usehref || "";
  54881. this.picture = null;
  54882. }
  54883. }
  54884. class ContentArea extends _xfa_object.XFAObject {
  54885. constructor(attributes) {
  54886. super(TEMPLATE_NS_ID, "contentArea", true);
  54887. this.h = (0, _utils.getMeasurement)(attributes.h);
  54888. this.id = attributes.id || "";
  54889. this.name = attributes.name || "";
  54890. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54891. this.use = attributes.use || "";
  54892. this.usehref = attributes.usehref || "";
  54893. this.w = (0, _utils.getMeasurement)(attributes.w);
  54894. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  54895. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  54896. this.desc = null;
  54897. this.extras = null;
  54898. }
  54899. [_xfa_object.$toHTML](availableSpace) {
  54900. const left = (0, _html_utils.measureToString)(this.x);
  54901. const top = (0, _html_utils.measureToString)(this.y);
  54902. const style = {
  54903. left,
  54904. top,
  54905. width: (0, _html_utils.measureToString)(this.w),
  54906. height: (0, _html_utils.measureToString)(this.h)
  54907. };
  54908. const classNames = ["xfaContentarea"];
  54909. if ((0, _html_utils.isPrintOnly)(this)) {
  54910. classNames.push("xfaPrintOnly");
  54911. }
  54912. return _utils.HTMLResult.success({
  54913. name: "div",
  54914. children: [],
  54915. attributes: {
  54916. style,
  54917. class: classNames,
  54918. id: this[_xfa_object.$uid]
  54919. }
  54920. });
  54921. }
  54922. }
  54923. class Corner extends _xfa_object.XFAObject {
  54924. constructor(attributes) {
  54925. super(TEMPLATE_NS_ID, "corner", true);
  54926. this.id = attributes.id || "";
  54927. this.inverted = (0, _utils.getInteger)({
  54928. data: attributes.inverted,
  54929. defaultValue: 0,
  54930. validate: x => x === 1
  54931. });
  54932. this.join = (0, _utils.getStringOption)(attributes.join, ["square", "round"]);
  54933. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54934. this.radius = (0, _utils.getMeasurement)(attributes.radius);
  54935. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  54936. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  54937. this.use = attributes.use || "";
  54938. this.usehref = attributes.usehref || "";
  54939. this.color = null;
  54940. this.extras = null;
  54941. }
  54942. [_xfa_object.$toStyle]() {
  54943. const style = (0, _html_utils.toStyle)(this, "visibility");
  54944. style.radius = (0, _html_utils.measureToString)(this.join === "square" ? 0 : this.radius);
  54945. return style;
  54946. }
  54947. }
  54948. class DateElement extends _xfa_object.ContentObject {
  54949. constructor(attributes) {
  54950. super(TEMPLATE_NS_ID, "date");
  54951. this.id = attributes.id || "";
  54952. this.name = attributes.name || "";
  54953. this.use = attributes.use || "";
  54954. this.usehref = attributes.usehref || "";
  54955. }
  54956. [_xfa_object.$finalize]() {
  54957. const date = this[_xfa_object.$content].trim();
  54958. this[_xfa_object.$content] = date ? new Date(date) : null;
  54959. }
  54960. [_xfa_object.$toHTML](availableSpace) {
  54961. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  54962. }
  54963. }
  54964. class DateTime extends _xfa_object.ContentObject {
  54965. constructor(attributes) {
  54966. super(TEMPLATE_NS_ID, "dateTime");
  54967. this.id = attributes.id || "";
  54968. this.name = attributes.name || "";
  54969. this.use = attributes.use || "";
  54970. this.usehref = attributes.usehref || "";
  54971. }
  54972. [_xfa_object.$finalize]() {
  54973. const date = this[_xfa_object.$content].trim();
  54974. this[_xfa_object.$content] = date ? new Date(date) : null;
  54975. }
  54976. [_xfa_object.$toHTML](availableSpace) {
  54977. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  54978. }
  54979. }
  54980. class DateTimeEdit extends _xfa_object.XFAObject {
  54981. constructor(attributes) {
  54982. super(TEMPLATE_NS_ID, "dateTimeEdit", true);
  54983. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  54984. this.id = attributes.id || "";
  54985. this.picker = (0, _utils.getStringOption)(attributes.picker, ["host", "none"]);
  54986. this.use = attributes.use || "";
  54987. this.usehref = attributes.usehref || "";
  54988. this.border = null;
  54989. this.comb = null;
  54990. this.extras = null;
  54991. this.margin = null;
  54992. }
  54993. [_xfa_object.$toHTML](availableSpace) {
  54994. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  54995. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  54996. const html = {
  54997. name: "input",
  54998. attributes: {
  54999. type: "text",
  55000. fieldId: field[_xfa_object.$uid],
  55001. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  55002. class: ["xfaTextfield"],
  55003. style,
  55004. "aria-label": ariaLabel(field),
  55005. "aria-required": false
  55006. }
  55007. };
  55008. if (isRequired(field)) {
  55009. html.attributes["aria-required"] = true;
  55010. html.attributes.required = true;
  55011. }
  55012. return _utils.HTMLResult.success({
  55013. name: "label",
  55014. attributes: {
  55015. class: ["xfaLabel"]
  55016. },
  55017. children: [html]
  55018. });
  55019. }
  55020. }
  55021. class Decimal extends _xfa_object.ContentObject {
  55022. constructor(attributes) {
  55023. super(TEMPLATE_NS_ID, "decimal");
  55024. this.fracDigits = (0, _utils.getInteger)({
  55025. data: attributes.fracDigits,
  55026. defaultValue: 2,
  55027. validate: x => true
  55028. });
  55029. this.id = attributes.id || "";
  55030. this.leadDigits = (0, _utils.getInteger)({
  55031. data: attributes.leadDigits,
  55032. defaultValue: -1,
  55033. validate: x => true
  55034. });
  55035. this.name = attributes.name || "";
  55036. this.use = attributes.use || "";
  55037. this.usehref = attributes.usehref || "";
  55038. }
  55039. [_xfa_object.$finalize]() {
  55040. const number = parseFloat(this[_xfa_object.$content].trim());
  55041. this[_xfa_object.$content] = isNaN(number) ? null : number;
  55042. }
  55043. [_xfa_object.$toHTML](availableSpace) {
  55044. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  55045. }
  55046. }
  55047. class DefaultUi extends _xfa_object.XFAObject {
  55048. constructor(attributes) {
  55049. super(TEMPLATE_NS_ID, "defaultUi", true);
  55050. this.id = attributes.id || "";
  55051. this.use = attributes.use || "";
  55052. this.usehref = attributes.usehref || "";
  55053. this.extras = null;
  55054. }
  55055. }
  55056. class Desc extends _xfa_object.XFAObject {
  55057. constructor(attributes) {
  55058. super(TEMPLATE_NS_ID, "desc", true);
  55059. this.id = attributes.id || "";
  55060. this.use = attributes.use || "";
  55061. this.usehref = attributes.usehref || "";
  55062. this.boolean = new _xfa_object.XFAObjectArray();
  55063. this.date = new _xfa_object.XFAObjectArray();
  55064. this.dateTime = new _xfa_object.XFAObjectArray();
  55065. this.decimal = new _xfa_object.XFAObjectArray();
  55066. this.exData = new _xfa_object.XFAObjectArray();
  55067. this.float = new _xfa_object.XFAObjectArray();
  55068. this.image = new _xfa_object.XFAObjectArray();
  55069. this.integer = new _xfa_object.XFAObjectArray();
  55070. this.text = new _xfa_object.XFAObjectArray();
  55071. this.time = new _xfa_object.XFAObjectArray();
  55072. }
  55073. }
  55074. class DigestMethod extends _xfa_object.OptionObject {
  55075. constructor(attributes) {
  55076. super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]);
  55077. this.id = attributes.id || "";
  55078. this.use = attributes.use || "";
  55079. this.usehref = attributes.usehref || "";
  55080. }
  55081. }
  55082. class DigestMethods extends _xfa_object.XFAObject {
  55083. constructor(attributes) {
  55084. super(TEMPLATE_NS_ID, "digestMethods", true);
  55085. this.id = attributes.id || "";
  55086. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55087. this.use = attributes.use || "";
  55088. this.usehref = attributes.usehref || "";
  55089. this.digestMethod = new _xfa_object.XFAObjectArray();
  55090. }
  55091. }
  55092. class Draw extends _xfa_object.XFAObject {
  55093. constructor(attributes) {
  55094. super(TEMPLATE_NS_ID, "draw", true);
  55095. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  55096. this.colSpan = (0, _utils.getInteger)({
  55097. data: attributes.colSpan,
  55098. defaultValue: 1,
  55099. validate: n => n >= 1 || n === -1
  55100. });
  55101. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  55102. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  55103. this.id = attributes.id || "";
  55104. this.locale = attributes.locale || "";
  55105. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  55106. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  55107. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  55108. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  55109. this.name = attributes.name || "";
  55110. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55111. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55112. this.rotate = (0, _utils.getInteger)({
  55113. data: attributes.rotate,
  55114. defaultValue: 0,
  55115. validate: x => x % 90 === 0
  55116. });
  55117. this.use = attributes.use || "";
  55118. this.usehref = attributes.usehref || "";
  55119. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  55120. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  55121. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  55122. this.assist = null;
  55123. this.border = null;
  55124. this.caption = null;
  55125. this.desc = null;
  55126. this.extras = null;
  55127. this.font = null;
  55128. this.keep = null;
  55129. this.margin = null;
  55130. this.para = null;
  55131. this.traversal = null;
  55132. this.ui = null;
  55133. this.value = null;
  55134. this.setProperty = new _xfa_object.XFAObjectArray();
  55135. }
  55136. [_xfa_object.$setValue](value) {
  55137. _setValue(this, value);
  55138. }
  55139. [_xfa_object.$toHTML](availableSpace) {
  55140. setTabIndex(this);
  55141. if (this.presence === "hidden" || this.presence === "inactive") {
  55142. return _utils.HTMLResult.EMPTY;
  55143. }
  55144. (0, _html_utils.fixDimensions)(this);
  55145. this[_xfa_object.$pushPara]();
  55146. const savedW = this.w;
  55147. const savedH = this.h;
  55148. const {
  55149. w,
  55150. h,
  55151. isBroken
  55152. } = (0, _html_utils.layoutNode)(this, availableSpace);
  55153. if (w && this.w === "") {
  55154. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  55155. this[_xfa_object.$popPara]();
  55156. return _utils.HTMLResult.FAILURE;
  55157. }
  55158. this.w = w;
  55159. }
  55160. if (h && this.h === "") {
  55161. this.h = h;
  55162. }
  55163. setFirstUnsplittable(this);
  55164. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  55165. this.w = savedW;
  55166. this.h = savedH;
  55167. this[_xfa_object.$popPara]();
  55168. return _utils.HTMLResult.FAILURE;
  55169. }
  55170. unsetFirstUnsplittable(this);
  55171. const style = (0, _html_utils.toStyle)(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin");
  55172. (0, _html_utils.setMinMaxDimensions)(this, style);
  55173. if (style.margin) {
  55174. style.padding = style.margin;
  55175. delete style.margin;
  55176. }
  55177. const classNames = ["xfaDraw"];
  55178. if (this.font) {
  55179. classNames.push("xfaFont");
  55180. }
  55181. if ((0, _html_utils.isPrintOnly)(this)) {
  55182. classNames.push("xfaPrintOnly");
  55183. }
  55184. const attributes = {
  55185. style,
  55186. id: this[_xfa_object.$uid],
  55187. class: classNames
  55188. };
  55189. if (this.name) {
  55190. attributes.xfaName = this.name;
  55191. }
  55192. const html = {
  55193. name: "div",
  55194. attributes,
  55195. children: []
  55196. };
  55197. applyAssist(this, attributes);
  55198. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  55199. const value = this.value ? this.value[_xfa_object.$toHTML](availableSpace).html : null;
  55200. if (value === null) {
  55201. this.w = savedW;
  55202. this.h = savedH;
  55203. this[_xfa_object.$popPara]();
  55204. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55205. }
  55206. html.children.push(value);
  55207. (0, _html_utils.setPara)(this, style, value);
  55208. this.w = savedW;
  55209. this.h = savedH;
  55210. this[_xfa_object.$popPara]();
  55211. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55212. }
  55213. }
  55214. class Edge extends _xfa_object.XFAObject {
  55215. constructor(attributes) {
  55216. super(TEMPLATE_NS_ID, "edge", true);
  55217. this.cap = (0, _utils.getStringOption)(attributes.cap, ["square", "butt", "round"]);
  55218. this.id = attributes.id || "";
  55219. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55220. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  55221. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  55222. this.use = attributes.use || "";
  55223. this.usehref = attributes.usehref || "";
  55224. this.color = null;
  55225. this.extras = null;
  55226. }
  55227. [_xfa_object.$toStyle]() {
  55228. const style = (0, _html_utils.toStyle)(this, "visibility");
  55229. Object.assign(style, {
  55230. linecap: this.cap,
  55231. width: (0, _html_utils.measureToString)(this.thickness),
  55232. color: this.color ? this.color[_xfa_object.$toStyle]() : "#000000",
  55233. style: ""
  55234. });
  55235. if (this.presence !== "visible") {
  55236. style.style = "none";
  55237. } else {
  55238. switch (this.stroke) {
  55239. case "solid":
  55240. style.style = "solid";
  55241. break;
  55242. case "dashDot":
  55243. style.style = "dashed";
  55244. break;
  55245. case "dashDotDot":
  55246. style.style = "dashed";
  55247. break;
  55248. case "dashed":
  55249. style.style = "dashed";
  55250. break;
  55251. case "dotted":
  55252. style.style = "dotted";
  55253. break;
  55254. case "embossed":
  55255. style.style = "ridge";
  55256. break;
  55257. case "etched":
  55258. style.style = "groove";
  55259. break;
  55260. case "lowered":
  55261. style.style = "inset";
  55262. break;
  55263. case "raised":
  55264. style.style = "outset";
  55265. break;
  55266. }
  55267. }
  55268. return style;
  55269. }
  55270. }
  55271. class Encoding extends _xfa_object.OptionObject {
  55272. constructor(attributes) {
  55273. super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]);
  55274. this.id = attributes.id || "";
  55275. this.use = attributes.use || "";
  55276. this.usehref = attributes.usehref || "";
  55277. }
  55278. }
  55279. class Encodings extends _xfa_object.XFAObject {
  55280. constructor(attributes) {
  55281. super(TEMPLATE_NS_ID, "encodings", true);
  55282. this.id = attributes.id || "";
  55283. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55284. this.use = attributes.use || "";
  55285. this.usehref = attributes.usehref || "";
  55286. this.encoding = new _xfa_object.XFAObjectArray();
  55287. }
  55288. }
  55289. class Encrypt extends _xfa_object.XFAObject {
  55290. constructor(attributes) {
  55291. super(TEMPLATE_NS_ID, "encrypt", true);
  55292. this.id = attributes.id || "";
  55293. this.use = attributes.use || "";
  55294. this.usehref = attributes.usehref || "";
  55295. this.certificate = null;
  55296. }
  55297. }
  55298. class EncryptData extends _xfa_object.XFAObject {
  55299. constructor(attributes) {
  55300. super(TEMPLATE_NS_ID, "encryptData", true);
  55301. this.id = attributes.id || "";
  55302. this.operation = (0, _utils.getStringOption)(attributes.operation, ["encrypt", "decrypt"]);
  55303. this.target = attributes.target || "";
  55304. this.use = attributes.use || "";
  55305. this.usehref = attributes.usehref || "";
  55306. this.filter = null;
  55307. this.manifest = null;
  55308. }
  55309. }
  55310. class Encryption extends _xfa_object.XFAObject {
  55311. constructor(attributes) {
  55312. super(TEMPLATE_NS_ID, "encryption", true);
  55313. this.id = attributes.id || "";
  55314. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55315. this.use = attributes.use || "";
  55316. this.usehref = attributes.usehref || "";
  55317. this.certificate = new _xfa_object.XFAObjectArray();
  55318. }
  55319. }
  55320. class EncryptionMethod extends _xfa_object.OptionObject {
  55321. constructor(attributes) {
  55322. super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]);
  55323. this.id = attributes.id || "";
  55324. this.use = attributes.use || "";
  55325. this.usehref = attributes.usehref || "";
  55326. }
  55327. }
  55328. class EncryptionMethods extends _xfa_object.XFAObject {
  55329. constructor(attributes) {
  55330. super(TEMPLATE_NS_ID, "encryptionMethods", true);
  55331. this.id = attributes.id || "";
  55332. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55333. this.use = attributes.use || "";
  55334. this.usehref = attributes.usehref || "";
  55335. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  55336. }
  55337. }
  55338. class Event extends _xfa_object.XFAObject {
  55339. constructor(attributes) {
  55340. super(TEMPLATE_NS_ID, "event", true);
  55341. this.activity = (0, _utils.getStringOption)(attributes.activity, ["click", "change", "docClose", "docReady", "enter", "exit", "full", "indexChange", "initialize", "mouseDown", "mouseEnter", "mouseExit", "mouseUp", "postExecute", "postOpen", "postPrint", "postSave", "postSign", "postSubmit", "preExecute", "preOpen", "prePrint", "preSave", "preSign", "preSubmit", "ready", "validationState"]);
  55342. this.id = attributes.id || "";
  55343. this.listen = (0, _utils.getStringOption)(attributes.listen, ["refOnly", "refAndDescendents"]);
  55344. this.name = attributes.name || "";
  55345. this.ref = attributes.ref || "";
  55346. this.use = attributes.use || "";
  55347. this.usehref = attributes.usehref || "";
  55348. this.extras = null;
  55349. this.encryptData = null;
  55350. this.execute = null;
  55351. this.script = null;
  55352. this.signData = null;
  55353. this.submit = null;
  55354. }
  55355. }
  55356. class ExData extends _xfa_object.ContentObject {
  55357. constructor(attributes) {
  55358. super(TEMPLATE_NS_ID, "exData");
  55359. this.contentType = attributes.contentType || "";
  55360. this.href = attributes.href || "";
  55361. this.id = attributes.id || "";
  55362. this.maxLength = (0, _utils.getInteger)({
  55363. data: attributes.maxLength,
  55364. defaultValue: -1,
  55365. validate: x => x >= -1
  55366. });
  55367. this.name = attributes.name || "";
  55368. this.rid = attributes.rid || "";
  55369. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["none", "base64", "package"]);
  55370. this.use = attributes.use || "";
  55371. this.usehref = attributes.usehref || "";
  55372. }
  55373. [_xfa_object.$isCDATAXml]() {
  55374. return this.contentType === "text/html";
  55375. }
  55376. [_xfa_object.$onChild](child) {
  55377. if (this.contentType === "text/html" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  55378. this[_xfa_object.$content] = child;
  55379. return true;
  55380. }
  55381. if (this.contentType === "text/xml") {
  55382. this[_xfa_object.$content] = child;
  55383. return true;
  55384. }
  55385. return false;
  55386. }
  55387. [_xfa_object.$toHTML](availableSpace) {
  55388. if (this.contentType !== "text/html" || !this[_xfa_object.$content]) {
  55389. return _utils.HTMLResult.EMPTY;
  55390. }
  55391. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  55392. }
  55393. }
  55394. class ExObject extends _xfa_object.XFAObject {
  55395. constructor(attributes) {
  55396. super(TEMPLATE_NS_ID, "exObject", true);
  55397. this.archive = attributes.archive || "";
  55398. this.classId = attributes.classId || "";
  55399. this.codeBase = attributes.codeBase || "";
  55400. this.codeType = attributes.codeType || "";
  55401. this.id = attributes.id || "";
  55402. this.name = attributes.name || "";
  55403. this.use = attributes.use || "";
  55404. this.usehref = attributes.usehref || "";
  55405. this.extras = null;
  55406. this.boolean = new _xfa_object.XFAObjectArray();
  55407. this.date = new _xfa_object.XFAObjectArray();
  55408. this.dateTime = new _xfa_object.XFAObjectArray();
  55409. this.decimal = new _xfa_object.XFAObjectArray();
  55410. this.exData = new _xfa_object.XFAObjectArray();
  55411. this.exObject = new _xfa_object.XFAObjectArray();
  55412. this.float = new _xfa_object.XFAObjectArray();
  55413. this.image = new _xfa_object.XFAObjectArray();
  55414. this.integer = new _xfa_object.XFAObjectArray();
  55415. this.text = new _xfa_object.XFAObjectArray();
  55416. this.time = new _xfa_object.XFAObjectArray();
  55417. }
  55418. }
  55419. class ExclGroup extends _xfa_object.XFAObject {
  55420. constructor(attributes) {
  55421. super(TEMPLATE_NS_ID, "exclGroup", true);
  55422. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  55423. this.accessKey = attributes.accessKey || "";
  55424. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  55425. this.colSpan = (0, _utils.getInteger)({
  55426. data: attributes.colSpan,
  55427. defaultValue: 1,
  55428. validate: n => n >= 1 || n === -1
  55429. });
  55430. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  55431. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  55432. this.id = attributes.id || "";
  55433. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  55434. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  55435. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  55436. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  55437. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  55438. this.name = attributes.name || "";
  55439. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55440. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55441. this.use = attributes.use || "";
  55442. this.usehref = attributes.usehref || "";
  55443. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  55444. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  55445. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  55446. this.assist = null;
  55447. this.bind = null;
  55448. this.border = null;
  55449. this.calculate = null;
  55450. this.caption = null;
  55451. this.desc = null;
  55452. this.extras = null;
  55453. this.margin = null;
  55454. this.para = null;
  55455. this.traversal = null;
  55456. this.validate = null;
  55457. this.connect = new _xfa_object.XFAObjectArray();
  55458. this.event = new _xfa_object.XFAObjectArray();
  55459. this.field = new _xfa_object.XFAObjectArray();
  55460. this.setProperty = new _xfa_object.XFAObjectArray();
  55461. }
  55462. [_xfa_object.$isBindable]() {
  55463. return true;
  55464. }
  55465. [_xfa_object.$hasSettableValue]() {
  55466. return true;
  55467. }
  55468. [_xfa_object.$setValue](value) {
  55469. for (const field of this.field.children) {
  55470. if (!field.value) {
  55471. const nodeValue = new Value({});
  55472. field[_xfa_object.$appendChild](nodeValue);
  55473. field.value = nodeValue;
  55474. }
  55475. field.value[_xfa_object.$setValue](value);
  55476. }
  55477. }
  55478. [_xfa_object.$isThereMoreWidth]() {
  55479. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  55480. }
  55481. [_xfa_object.$isSplittable]() {
  55482. const parent = this[_xfa_object.$getSubformParent]();
  55483. if (!parent[_xfa_object.$isSplittable]()) {
  55484. return false;
  55485. }
  55486. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  55487. return this[_xfa_object.$extra]._isSplittable;
  55488. }
  55489. if (this.layout === "position" || this.layout.includes("row")) {
  55490. this[_xfa_object.$extra]._isSplittable = false;
  55491. return false;
  55492. }
  55493. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  55494. return false;
  55495. }
  55496. this[_xfa_object.$extra]._isSplittable = true;
  55497. return true;
  55498. }
  55499. [_xfa_object.$flushHTML]() {
  55500. return (0, _layout.flushHTML)(this);
  55501. }
  55502. [_xfa_object.$addHTML](html, bbox) {
  55503. (0, _layout.addHTML)(this, html, bbox);
  55504. }
  55505. [_xfa_object.$getAvailableSpace]() {
  55506. return (0, _layout.getAvailableSpace)(this);
  55507. }
  55508. [_xfa_object.$toHTML](availableSpace) {
  55509. setTabIndex(this);
  55510. if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  55511. return _utils.HTMLResult.EMPTY;
  55512. }
  55513. (0, _html_utils.fixDimensions)(this);
  55514. const children = [];
  55515. const attributes = {
  55516. id: this[_xfa_object.$uid],
  55517. class: []
  55518. };
  55519. (0, _html_utils.setAccess)(this, attributes.class);
  55520. if (!this[_xfa_object.$extra]) {
  55521. this[_xfa_object.$extra] = Object.create(null);
  55522. }
  55523. Object.assign(this[_xfa_object.$extra], {
  55524. children,
  55525. attributes,
  55526. attempt: 0,
  55527. line: null,
  55528. numberInLine: 0,
  55529. availableSpace: {
  55530. width: Math.min(this.w || Infinity, availableSpace.width),
  55531. height: Math.min(this.h || Infinity, availableSpace.height)
  55532. },
  55533. width: 0,
  55534. height: 0,
  55535. prevHeight: 0,
  55536. currentWidth: 0
  55537. });
  55538. const isSplittable = this[_xfa_object.$isSplittable]();
  55539. if (!isSplittable) {
  55540. setFirstUnsplittable(this);
  55541. }
  55542. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  55543. return _utils.HTMLResult.FAILURE;
  55544. }
  55545. const filter = new Set(["field"]);
  55546. if (this.layout.includes("row")) {
  55547. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  55548. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  55549. this[_xfa_object.$extra].columnWidths = columnWidths;
  55550. this[_xfa_object.$extra].currentColumn = 0;
  55551. }
  55552. }
  55553. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  55554. const classNames = ["xfaExclgroup"];
  55555. const cl = (0, _html_utils.layoutClass)(this);
  55556. if (cl) {
  55557. classNames.push(cl);
  55558. }
  55559. if ((0, _html_utils.isPrintOnly)(this)) {
  55560. classNames.push("xfaPrintOnly");
  55561. }
  55562. attributes.style = style;
  55563. attributes.class = classNames;
  55564. if (this.name) {
  55565. attributes.xfaName = this.name;
  55566. }
  55567. this[_xfa_object.$pushPara]();
  55568. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  55569. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  55570. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  55571. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  55572. this[_xfa_object.$extra].numberInLine = 0;
  55573. }
  55574. const result = this[_xfa_object.$childrenToHTML]({
  55575. filter,
  55576. include: true
  55577. });
  55578. if (result.success) {
  55579. break;
  55580. }
  55581. if (result.isBreak()) {
  55582. this[_xfa_object.$popPara]();
  55583. return result;
  55584. }
  55585. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  55586. this[_xfa_object.$extra].attempt = maxRun;
  55587. break;
  55588. }
  55589. }
  55590. this[_xfa_object.$popPara]();
  55591. if (!isSplittable) {
  55592. unsetFirstUnsplittable(this);
  55593. }
  55594. if (this[_xfa_object.$extra].attempt === maxRun) {
  55595. if (!isSplittable) {
  55596. delete this[_xfa_object.$extra];
  55597. }
  55598. return _utils.HTMLResult.FAILURE;
  55599. }
  55600. let marginH = 0;
  55601. let marginV = 0;
  55602. if (this.margin) {
  55603. marginH = this.margin.leftInset + this.margin.rightInset;
  55604. marginV = this.margin.topInset + this.margin.bottomInset;
  55605. }
  55606. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  55607. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  55608. const bbox = [this.x, this.y, width, height];
  55609. if (this.w === "") {
  55610. style.width = (0, _html_utils.measureToString)(width);
  55611. }
  55612. if (this.h === "") {
  55613. style.height = (0, _html_utils.measureToString)(height);
  55614. }
  55615. const html = {
  55616. name: "div",
  55617. attributes,
  55618. children
  55619. };
  55620. applyAssist(this, attributes);
  55621. delete this[_xfa_object.$extra];
  55622. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55623. }
  55624. }
  55625. class Execute extends _xfa_object.XFAObject {
  55626. constructor(attributes) {
  55627. super(TEMPLATE_NS_ID, "execute");
  55628. this.connection = attributes.connection || "";
  55629. this.executeType = (0, _utils.getStringOption)(attributes.executeType, ["import", "remerge"]);
  55630. this.id = attributes.id || "";
  55631. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  55632. this.use = attributes.use || "";
  55633. this.usehref = attributes.usehref || "";
  55634. }
  55635. }
  55636. class Extras extends _xfa_object.XFAObject {
  55637. constructor(attributes) {
  55638. super(TEMPLATE_NS_ID, "extras", true);
  55639. this.id = attributes.id || "";
  55640. this.name = attributes.name || "";
  55641. this.use = attributes.use || "";
  55642. this.usehref = attributes.usehref || "";
  55643. this.boolean = new _xfa_object.XFAObjectArray();
  55644. this.date = new _xfa_object.XFAObjectArray();
  55645. this.dateTime = new _xfa_object.XFAObjectArray();
  55646. this.decimal = new _xfa_object.XFAObjectArray();
  55647. this.exData = new _xfa_object.XFAObjectArray();
  55648. this.extras = new _xfa_object.XFAObjectArray();
  55649. this.float = new _xfa_object.XFAObjectArray();
  55650. this.image = new _xfa_object.XFAObjectArray();
  55651. this.integer = new _xfa_object.XFAObjectArray();
  55652. this.text = new _xfa_object.XFAObjectArray();
  55653. this.time = new _xfa_object.XFAObjectArray();
  55654. }
  55655. }
  55656. class Field extends _xfa_object.XFAObject {
  55657. constructor(attributes) {
  55658. super(TEMPLATE_NS_ID, "field", true);
  55659. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  55660. this.accessKey = attributes.accessKey || "";
  55661. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  55662. this.colSpan = (0, _utils.getInteger)({
  55663. data: attributes.colSpan,
  55664. defaultValue: 1,
  55665. validate: n => n >= 1 || n === -1
  55666. });
  55667. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  55668. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  55669. this.id = attributes.id || "";
  55670. this.locale = attributes.locale || "";
  55671. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  55672. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  55673. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  55674. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  55675. this.name = attributes.name || "";
  55676. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55677. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55678. this.rotate = (0, _utils.getInteger)({
  55679. data: attributes.rotate,
  55680. defaultValue: 0,
  55681. validate: x => x % 90 === 0
  55682. });
  55683. this.use = attributes.use || "";
  55684. this.usehref = attributes.usehref || "";
  55685. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  55686. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  55687. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  55688. this.assist = null;
  55689. this.bind = null;
  55690. this.border = null;
  55691. this.calculate = null;
  55692. this.caption = null;
  55693. this.desc = null;
  55694. this.extras = null;
  55695. this.font = null;
  55696. this.format = null;
  55697. this.items = new _xfa_object.XFAObjectArray(2);
  55698. this.keep = null;
  55699. this.margin = null;
  55700. this.para = null;
  55701. this.traversal = null;
  55702. this.ui = null;
  55703. this.validate = null;
  55704. this.value = null;
  55705. this.bindItems = new _xfa_object.XFAObjectArray();
  55706. this.connect = new _xfa_object.XFAObjectArray();
  55707. this.event = new _xfa_object.XFAObjectArray();
  55708. this.setProperty = new _xfa_object.XFAObjectArray();
  55709. }
  55710. [_xfa_object.$isBindable]() {
  55711. return true;
  55712. }
  55713. [_xfa_object.$setValue](value) {
  55714. _setValue(this, value);
  55715. }
  55716. [_xfa_object.$toHTML](availableSpace) {
  55717. setTabIndex(this);
  55718. if (!this.ui) {
  55719. this.ui = new Ui({});
  55720. this.ui[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  55721. this[_xfa_object.$appendChild](this.ui);
  55722. let node;
  55723. switch (this.items.children.length) {
  55724. case 0:
  55725. node = new TextEdit({});
  55726. this.ui.textEdit = node;
  55727. break;
  55728. case 1:
  55729. node = new CheckButton({});
  55730. this.ui.checkButton = node;
  55731. break;
  55732. case 2:
  55733. node = new ChoiceList({});
  55734. this.ui.choiceList = node;
  55735. break;
  55736. }
  55737. this.ui[_xfa_object.$appendChild](node);
  55738. }
  55739. if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  55740. return _utils.HTMLResult.EMPTY;
  55741. }
  55742. if (this.caption) {
  55743. delete this.caption[_xfa_object.$extra];
  55744. }
  55745. this[_xfa_object.$pushPara]();
  55746. const caption = this.caption ? this.caption[_xfa_object.$toHTML](availableSpace).html : null;
  55747. const savedW = this.w;
  55748. const savedH = this.h;
  55749. let marginH = 0;
  55750. let marginV = 0;
  55751. if (this.margin) {
  55752. marginH = this.margin.leftInset + this.margin.rightInset;
  55753. marginV = this.margin.topInset + this.margin.bottomInset;
  55754. }
  55755. let borderDims = null;
  55756. if (this.w === "" || this.h === "") {
  55757. let width = null;
  55758. let height = null;
  55759. let uiW = 0;
  55760. let uiH = 0;
  55761. if (this.ui.checkButton) {
  55762. uiW = uiH = this.ui.checkButton.size;
  55763. } else {
  55764. const {
  55765. w,
  55766. h
  55767. } = (0, _html_utils.layoutNode)(this, availableSpace);
  55768. if (w !== null) {
  55769. uiW = w;
  55770. uiH = h;
  55771. } else {
  55772. uiH = (0, _fonts.getMetrics)(this.font, true).lineNoGap;
  55773. }
  55774. }
  55775. borderDims = getBorderDims(this.ui[_xfa_object.$getExtra]());
  55776. uiW += borderDims.w;
  55777. uiH += borderDims.h;
  55778. if (this.caption) {
  55779. const {
  55780. w,
  55781. h,
  55782. isBroken
  55783. } = this.caption[_xfa_object.$getExtra](availableSpace);
  55784. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  55785. this[_xfa_object.$popPara]();
  55786. return _utils.HTMLResult.FAILURE;
  55787. }
  55788. width = w;
  55789. height = h;
  55790. switch (this.caption.placement) {
  55791. case "left":
  55792. case "right":
  55793. case "inline":
  55794. width += uiW;
  55795. break;
  55796. case "top":
  55797. case "bottom":
  55798. height += uiH;
  55799. break;
  55800. }
  55801. } else {
  55802. width = uiW;
  55803. height = uiH;
  55804. }
  55805. if (width && this.w === "") {
  55806. width += marginH;
  55807. this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW);
  55808. }
  55809. if (height && this.h === "") {
  55810. height += marginV;
  55811. this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH);
  55812. }
  55813. }
  55814. this[_xfa_object.$popPara]();
  55815. (0, _html_utils.fixDimensions)(this);
  55816. setFirstUnsplittable(this);
  55817. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  55818. this.w = savedW;
  55819. this.h = savedH;
  55820. this[_xfa_object.$popPara]();
  55821. return _utils.HTMLResult.FAILURE;
  55822. }
  55823. unsetFirstUnsplittable(this);
  55824. const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign");
  55825. (0, _html_utils.setMinMaxDimensions)(this, style);
  55826. const classNames = ["xfaField"];
  55827. if (this.font) {
  55828. classNames.push("xfaFont");
  55829. }
  55830. if ((0, _html_utils.isPrintOnly)(this)) {
  55831. classNames.push("xfaPrintOnly");
  55832. }
  55833. const attributes = {
  55834. style,
  55835. id: this[_xfa_object.$uid],
  55836. class: classNames
  55837. };
  55838. if (style.margin) {
  55839. style.padding = style.margin;
  55840. delete style.margin;
  55841. }
  55842. (0, _html_utils.setAccess)(this, classNames);
  55843. if (this.name) {
  55844. attributes.xfaName = this.name;
  55845. }
  55846. const children = [];
  55847. const html = {
  55848. name: "div",
  55849. attributes,
  55850. children
  55851. };
  55852. applyAssist(this, attributes);
  55853. const borderStyle = this.border ? this.border[_xfa_object.$toStyle]() : null;
  55854. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  55855. const ui = this.ui[_xfa_object.$toHTML]().html;
  55856. if (!ui) {
  55857. Object.assign(style, borderStyle);
  55858. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55859. }
  55860. if (this[_xfa_object.$tabIndex]) {
  55861. if (ui.children && ui.children[0]) {
  55862. ui.children[0].attributes.tabindex = this[_xfa_object.$tabIndex];
  55863. } else {
  55864. ui.attributes.tabindex = this[_xfa_object.$tabIndex];
  55865. }
  55866. }
  55867. if (!ui.attributes.style) {
  55868. ui.attributes.style = Object.create(null);
  55869. }
  55870. let aElement = null;
  55871. if (this.ui.button) {
  55872. if (ui.children.length === 1) {
  55873. [aElement] = ui.children.splice(0, 1);
  55874. }
  55875. Object.assign(ui.attributes.style, borderStyle);
  55876. } else {
  55877. Object.assign(style, borderStyle);
  55878. }
  55879. children.push(ui);
  55880. if (this.value) {
  55881. if (this.ui.imageEdit) {
  55882. ui.children.push(this.value[_xfa_object.$toHTML]().html);
  55883. } else if (!this.ui.button) {
  55884. let value = "";
  55885. if (this.value.exData) {
  55886. value = this.value.exData[_xfa_object.$text]();
  55887. } else if (this.value.text) {
  55888. value = this.value.text[_xfa_object.$getExtra]();
  55889. } else {
  55890. const htmlValue = this.value[_xfa_object.$toHTML]().html;
  55891. if (htmlValue !== null) {
  55892. value = htmlValue.children[0].value;
  55893. }
  55894. }
  55895. if (this.ui.textEdit && this.value.text && this.value.text.maxChars) {
  55896. ui.children[0].attributes.maxLength = this.value.text.maxChars;
  55897. }
  55898. if (value) {
  55899. if (this.ui.numericEdit) {
  55900. value = parseFloat(value);
  55901. value = isNaN(value) ? "" : value.toString();
  55902. }
  55903. if (ui.children[0].name === "textarea") {
  55904. ui.children[0].attributes.textContent = value;
  55905. } else {
  55906. ui.children[0].attributes.value = value;
  55907. }
  55908. }
  55909. }
  55910. }
  55911. if (!this.ui.imageEdit && ui.children && ui.children[0] && this.h) {
  55912. borderDims = borderDims || getBorderDims(this.ui[_xfa_object.$getExtra]());
  55913. let captionHeight = 0;
  55914. if (this.caption && ["top", "bottom"].includes(this.caption.placement)) {
  55915. captionHeight = this.caption.reserve;
  55916. if (captionHeight <= 0) {
  55917. captionHeight = this.caption[_xfa_object.$getExtra](availableSpace).h;
  55918. }
  55919. const inputHeight = this.h - captionHeight - marginV - borderDims.h;
  55920. ui.children[0].attributes.style.height = (0, _html_utils.measureToString)(inputHeight);
  55921. } else {
  55922. ui.children[0].attributes.style.height = "100%";
  55923. }
  55924. }
  55925. if (aElement) {
  55926. ui.children.push(aElement);
  55927. }
  55928. if (!caption) {
  55929. if (ui.attributes.class) {
  55930. ui.attributes.class.push("xfaLeft");
  55931. }
  55932. this.w = savedW;
  55933. this.h = savedH;
  55934. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55935. }
  55936. if (this.ui.button) {
  55937. if (style.padding) {
  55938. delete style.padding;
  55939. }
  55940. if (caption.name === "div") {
  55941. caption.name = "span";
  55942. }
  55943. ui.children.push(caption);
  55944. return _utils.HTMLResult.success(html, bbox);
  55945. } else if (this.ui.checkButton) {
  55946. caption.attributes.class[0] = "xfaCaptionForCheckButton";
  55947. }
  55948. if (!ui.attributes.class) {
  55949. ui.attributes.class = [];
  55950. }
  55951. ui.children.splice(0, 0, caption);
  55952. switch (this.caption.placement) {
  55953. case "left":
  55954. ui.attributes.class.push("xfaLeft");
  55955. break;
  55956. case "right":
  55957. ui.attributes.class.push("xfaRight");
  55958. break;
  55959. case "top":
  55960. ui.attributes.class.push("xfaTop");
  55961. break;
  55962. case "bottom":
  55963. ui.attributes.class.push("xfaBottom");
  55964. break;
  55965. case "inline":
  55966. ui.attributes.class.push("xfaLeft");
  55967. break;
  55968. }
  55969. this.w = savedW;
  55970. this.h = savedH;
  55971. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55972. }
  55973. }
  55974. exports.Field = Field;
  55975. class Fill extends _xfa_object.XFAObject {
  55976. constructor(attributes) {
  55977. super(TEMPLATE_NS_ID, "fill", true);
  55978. this.id = attributes.id || "";
  55979. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55980. this.use = attributes.use || "";
  55981. this.usehref = attributes.usehref || "";
  55982. this.color = null;
  55983. this.extras = null;
  55984. this.linear = null;
  55985. this.pattern = null;
  55986. this.radial = null;
  55987. this.solid = null;
  55988. this.stipple = null;
  55989. }
  55990. [_xfa_object.$toStyle]() {
  55991. const parent = this[_xfa_object.$getParent]();
  55992. const grandpa = parent[_xfa_object.$getParent]();
  55993. const ggrandpa = grandpa[_xfa_object.$getParent]();
  55994. const style = Object.create(null);
  55995. let propName = "color";
  55996. let altPropName = propName;
  55997. if (parent instanceof Border) {
  55998. propName = "background-color";
  55999. altPropName = "background";
  56000. if (ggrandpa instanceof Ui) {
  56001. style.backgroundColor = "white";
  56002. }
  56003. }
  56004. if (parent instanceof Rectangle || parent instanceof Arc) {
  56005. propName = altPropName = "fill";
  56006. style.fill = "white";
  56007. }
  56008. for (const name of Object.getOwnPropertyNames(this)) {
  56009. if (name === "extras" || name === "color") {
  56010. continue;
  56011. }
  56012. const obj = this[name];
  56013. if (!(obj instanceof _xfa_object.XFAObject)) {
  56014. continue;
  56015. }
  56016. const color = obj[_xfa_object.$toStyle](this.color);
  56017. if (color) {
  56018. style[color.startsWith("#") ? propName : altPropName] = color;
  56019. }
  56020. return style;
  56021. }
  56022. if (this.color && this.color.value) {
  56023. const color = this.color[_xfa_object.$toStyle]();
  56024. style[color.startsWith("#") ? propName : altPropName] = color;
  56025. }
  56026. return style;
  56027. }
  56028. }
  56029. class Filter extends _xfa_object.XFAObject {
  56030. constructor(attributes) {
  56031. super(TEMPLATE_NS_ID, "filter", true);
  56032. this.addRevocationInfo = (0, _utils.getStringOption)(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
  56033. this.id = attributes.id || "";
  56034. this.name = attributes.name || "";
  56035. this.use = attributes.use || "";
  56036. this.usehref = attributes.usehref || "";
  56037. this.version = (0, _utils.getInteger)({
  56038. data: this.version,
  56039. defaultValue: 5,
  56040. validate: x => x >= 1 && x <= 5
  56041. });
  56042. this.appearanceFilter = null;
  56043. this.certificates = null;
  56044. this.digestMethods = null;
  56045. this.encodings = null;
  56046. this.encryptionMethods = null;
  56047. this.handler = null;
  56048. this.lockDocument = null;
  56049. this.mdp = null;
  56050. this.reasons = null;
  56051. this.timeStamp = null;
  56052. }
  56053. }
  56054. class Float extends _xfa_object.ContentObject {
  56055. constructor(attributes) {
  56056. super(TEMPLATE_NS_ID, "float");
  56057. this.id = attributes.id || "";
  56058. this.name = attributes.name || "";
  56059. this.use = attributes.use || "";
  56060. this.usehref = attributes.usehref || "";
  56061. }
  56062. [_xfa_object.$finalize]() {
  56063. const number = parseFloat(this[_xfa_object.$content].trim());
  56064. this[_xfa_object.$content] = isNaN(number) ? null : number;
  56065. }
  56066. [_xfa_object.$toHTML](availableSpace) {
  56067. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  56068. }
  56069. }
  56070. class Font extends _xfa_object.XFAObject {
  56071. constructor(attributes) {
  56072. super(TEMPLATE_NS_ID, "font", true);
  56073. this.baselineShift = (0, _utils.getMeasurement)(attributes.baselineShift);
  56074. this.fontHorizontalScale = (0, _utils.getFloat)({
  56075. data: attributes.fontHorizontalScale,
  56076. defaultValue: 100,
  56077. validate: x => x >= 0
  56078. });
  56079. this.fontVerticalScale = (0, _utils.getFloat)({
  56080. data: attributes.fontVerticalScale,
  56081. defaultValue: 100,
  56082. validate: x => x >= 0
  56083. });
  56084. this.id = attributes.id || "";
  56085. this.kerningMode = (0, _utils.getStringOption)(attributes.kerningMode, ["none", "pair"]);
  56086. this.letterSpacing = (0, _utils.getMeasurement)(attributes.letterSpacing, "0");
  56087. this.lineThrough = (0, _utils.getInteger)({
  56088. data: attributes.lineThrough,
  56089. defaultValue: 0,
  56090. validate: x => x === 1 || x === 2
  56091. });
  56092. this.lineThroughPeriod = (0, _utils.getStringOption)(attributes.lineThroughPeriod, ["all", "word"]);
  56093. this.overline = (0, _utils.getInteger)({
  56094. data: attributes.overline,
  56095. defaultValue: 0,
  56096. validate: x => x === 1 || x === 2
  56097. });
  56098. this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]);
  56099. this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]);
  56100. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  56101. this.typeface = attributes.typeface || "Courier";
  56102. this.underline = (0, _utils.getInteger)({
  56103. data: attributes.underline,
  56104. defaultValue: 0,
  56105. validate: x => x === 1 || x === 2
  56106. });
  56107. this.underlinePeriod = (0, _utils.getStringOption)(attributes.underlinePeriod, ["all", "word"]);
  56108. this.use = attributes.use || "";
  56109. this.usehref = attributes.usehref || "";
  56110. this.weight = (0, _utils.getStringOption)(attributes.weight, ["normal", "bold"]);
  56111. this.extras = null;
  56112. this.fill = null;
  56113. }
  56114. [_xfa_object.$clean](builder) {
  56115. super[_xfa_object.$clean](builder);
  56116. this[_xfa_object.$globalData].usedTypefaces.add(this.typeface);
  56117. }
  56118. [_xfa_object.$toStyle]() {
  56119. const style = (0, _html_utils.toStyle)(this, "fill");
  56120. const color = style.color;
  56121. if (color) {
  56122. if (color === "#000000") {
  56123. delete style.color;
  56124. } else if (!color.startsWith("#")) {
  56125. style.background = color;
  56126. style.backgroundClip = "text";
  56127. style.color = "transparent";
  56128. }
  56129. }
  56130. if (this.baselineShift) {
  56131. style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift);
  56132. }
  56133. style.fontKerning = this.kerningMode === "none" ? "none" : "normal";
  56134. style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing);
  56135. if (this.lineThrough !== 0) {
  56136. style.textDecoration = "line-through";
  56137. if (this.lineThrough === 2) {
  56138. style.textDecorationStyle = "double";
  56139. }
  56140. }
  56141. if (this.overline !== 0) {
  56142. style.textDecoration = "overline";
  56143. if (this.overline === 2) {
  56144. style.textDecorationStyle = "double";
  56145. }
  56146. }
  56147. style.fontStyle = this.posture;
  56148. style.fontSize = (0, _html_utils.measureToString)(0.99 * this.size);
  56149. (0, _html_utils.setFontFamily)(this, this, this[_xfa_object.$globalData].fontFinder, style);
  56150. if (this.underline !== 0) {
  56151. style.textDecoration = "underline";
  56152. if (this.underline === 2) {
  56153. style.textDecorationStyle = "double";
  56154. }
  56155. }
  56156. style.fontWeight = this.weight;
  56157. return style;
  56158. }
  56159. }
  56160. class Format extends _xfa_object.XFAObject {
  56161. constructor(attributes) {
  56162. super(TEMPLATE_NS_ID, "format", true);
  56163. this.id = attributes.id || "";
  56164. this.use = attributes.use || "";
  56165. this.usehref = attributes.usehref || "";
  56166. this.extras = null;
  56167. this.picture = null;
  56168. }
  56169. }
  56170. class Handler extends _xfa_object.StringObject {
  56171. constructor(attributes) {
  56172. super(TEMPLATE_NS_ID, "handler");
  56173. this.id = attributes.id || "";
  56174. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56175. this.use = attributes.use || "";
  56176. this.usehref = attributes.usehref || "";
  56177. }
  56178. }
  56179. class Hyphenation extends _xfa_object.XFAObject {
  56180. constructor(attributes) {
  56181. super(TEMPLATE_NS_ID, "hyphenation");
  56182. this.excludeAllCaps = (0, _utils.getInteger)({
  56183. data: attributes.excludeAllCaps,
  56184. defaultValue: 0,
  56185. validate: x => x === 1
  56186. });
  56187. this.excludeInitialCap = (0, _utils.getInteger)({
  56188. data: attributes.excludeInitialCap,
  56189. defaultValue: 0,
  56190. validate: x => x === 1
  56191. });
  56192. this.hyphenate = (0, _utils.getInteger)({
  56193. data: attributes.hyphenate,
  56194. defaultValue: 0,
  56195. validate: x => x === 1
  56196. });
  56197. this.id = attributes.id || "";
  56198. this.pushCharacterCount = (0, _utils.getInteger)({
  56199. data: attributes.pushCharacterCount,
  56200. defaultValue: 3,
  56201. validate: x => x >= 0
  56202. });
  56203. this.remainCharacterCount = (0, _utils.getInteger)({
  56204. data: attributes.remainCharacterCount,
  56205. defaultValue: 3,
  56206. validate: x => x >= 0
  56207. });
  56208. this.use = attributes.use || "";
  56209. this.usehref = attributes.usehref || "";
  56210. this.wordCharacterCount = (0, _utils.getInteger)({
  56211. data: attributes.wordCharacterCount,
  56212. defaultValue: 7,
  56213. validate: x => x >= 0
  56214. });
  56215. }
  56216. }
  56217. class Image extends _xfa_object.StringObject {
  56218. constructor(attributes) {
  56219. super(TEMPLATE_NS_ID, "image");
  56220. this.aspect = (0, _utils.getStringOption)(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
  56221. this.contentType = attributes.contentType || "";
  56222. this.href = attributes.href || "";
  56223. this.id = attributes.id || "";
  56224. this.name = attributes.name || "";
  56225. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["base64", "none", "package"]);
  56226. this.use = attributes.use || "";
  56227. this.usehref = attributes.usehref || "";
  56228. }
  56229. [_xfa_object.$toHTML]() {
  56230. if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) {
  56231. return _utils.HTMLResult.EMPTY;
  56232. }
  56233. let buffer = this[_xfa_object.$globalData].images && this[_xfa_object.$globalData].images.get(this.href);
  56234. if (!buffer && (this.href || !this[_xfa_object.$content])) {
  56235. return _utils.HTMLResult.EMPTY;
  56236. }
  56237. if (!buffer && this.transferEncoding === "base64") {
  56238. buffer = (0, _util.stringToBytes)(atob(this[_xfa_object.$content]));
  56239. }
  56240. if (!buffer) {
  56241. return _utils.HTMLResult.EMPTY;
  56242. }
  56243. if (!this.contentType) {
  56244. for (const [header, type] of IMAGES_HEADERS) {
  56245. if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) {
  56246. this.contentType = type;
  56247. break;
  56248. }
  56249. }
  56250. if (!this.contentType) {
  56251. return _utils.HTMLResult.EMPTY;
  56252. }
  56253. }
  56254. const blob = new Blob([buffer], {
  56255. type: this.contentType
  56256. });
  56257. let style;
  56258. switch (this.aspect) {
  56259. case "fit":
  56260. case "actual":
  56261. break;
  56262. case "height":
  56263. style = {
  56264. height: "100%",
  56265. objectFit: "fill"
  56266. };
  56267. break;
  56268. case "none":
  56269. style = {
  56270. width: "100%",
  56271. height: "100%",
  56272. objectFit: "fill"
  56273. };
  56274. break;
  56275. case "width":
  56276. style = {
  56277. width: "100%",
  56278. objectFit: "fill"
  56279. };
  56280. break;
  56281. }
  56282. const parent = this[_xfa_object.$getParent]();
  56283. return _utils.HTMLResult.success({
  56284. name: "img",
  56285. attributes: {
  56286. class: ["xfaImage"],
  56287. style,
  56288. src: URL.createObjectURL(blob),
  56289. alt: parent ? ariaLabel(parent[_xfa_object.$getParent]()) : null
  56290. }
  56291. });
  56292. }
  56293. }
  56294. class ImageEdit extends _xfa_object.XFAObject {
  56295. constructor(attributes) {
  56296. super(TEMPLATE_NS_ID, "imageEdit", true);
  56297. this.data = (0, _utils.getStringOption)(attributes.data, ["link", "embed"]);
  56298. this.id = attributes.id || "";
  56299. this.use = attributes.use || "";
  56300. this.usehref = attributes.usehref || "";
  56301. this.border = null;
  56302. this.extras = null;
  56303. this.margin = null;
  56304. }
  56305. [_xfa_object.$toHTML](availableSpace) {
  56306. if (this.data === "embed") {
  56307. return _utils.HTMLResult.success({
  56308. name: "div",
  56309. children: [],
  56310. attributes: {}
  56311. });
  56312. }
  56313. return _utils.HTMLResult.EMPTY;
  56314. }
  56315. }
  56316. class Integer extends _xfa_object.ContentObject {
  56317. constructor(attributes) {
  56318. super(TEMPLATE_NS_ID, "integer");
  56319. this.id = attributes.id || "";
  56320. this.name = attributes.name || "";
  56321. this.use = attributes.use || "";
  56322. this.usehref = attributes.usehref || "";
  56323. }
  56324. [_xfa_object.$finalize]() {
  56325. const number = parseInt(this[_xfa_object.$content].trim(), 10);
  56326. this[_xfa_object.$content] = isNaN(number) ? null : number;
  56327. }
  56328. [_xfa_object.$toHTML](availableSpace) {
  56329. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  56330. }
  56331. }
  56332. class Issuers extends _xfa_object.XFAObject {
  56333. constructor(attributes) {
  56334. super(TEMPLATE_NS_ID, "issuers", true);
  56335. this.id = attributes.id || "";
  56336. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56337. this.use = attributes.use || "";
  56338. this.usehref = attributes.usehref || "";
  56339. this.certificate = new _xfa_object.XFAObjectArray();
  56340. }
  56341. }
  56342. class Items extends _xfa_object.XFAObject {
  56343. constructor(attributes) {
  56344. super(TEMPLATE_NS_ID, "items", true);
  56345. this.id = attributes.id || "";
  56346. this.name = attributes.name || "";
  56347. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  56348. this.ref = attributes.ref || "";
  56349. this.save = (0, _utils.getInteger)({
  56350. data: attributes.save,
  56351. defaultValue: 0,
  56352. validate: x => x === 1
  56353. });
  56354. this.use = attributes.use || "";
  56355. this.usehref = attributes.usehref || "";
  56356. this.boolean = new _xfa_object.XFAObjectArray();
  56357. this.date = new _xfa_object.XFAObjectArray();
  56358. this.dateTime = new _xfa_object.XFAObjectArray();
  56359. this.decimal = new _xfa_object.XFAObjectArray();
  56360. this.exData = new _xfa_object.XFAObjectArray();
  56361. this.float = new _xfa_object.XFAObjectArray();
  56362. this.image = new _xfa_object.XFAObjectArray();
  56363. this.integer = new _xfa_object.XFAObjectArray();
  56364. this.text = new _xfa_object.XFAObjectArray();
  56365. this.time = new _xfa_object.XFAObjectArray();
  56366. }
  56367. [_xfa_object.$toHTML]() {
  56368. const output = [];
  56369. for (const child of this[_xfa_object.$getChildren]()) {
  56370. output.push(child[_xfa_object.$text]());
  56371. }
  56372. return _utils.HTMLResult.success(output);
  56373. }
  56374. }
  56375. exports.Items = Items;
  56376. class Keep extends _xfa_object.XFAObject {
  56377. constructor(attributes) {
  56378. super(TEMPLATE_NS_ID, "keep", true);
  56379. this.id = attributes.id || "";
  56380. const options = ["none", "contentArea", "pageArea"];
  56381. this.intact = (0, _utils.getStringOption)(attributes.intact, options);
  56382. this.next = (0, _utils.getStringOption)(attributes.next, options);
  56383. this.previous = (0, _utils.getStringOption)(attributes.previous, options);
  56384. this.use = attributes.use || "";
  56385. this.usehref = attributes.usehref || "";
  56386. this.extras = null;
  56387. }
  56388. }
  56389. class KeyUsage extends _xfa_object.XFAObject {
  56390. constructor(attributes) {
  56391. super(TEMPLATE_NS_ID, "keyUsage");
  56392. const options = ["", "yes", "no"];
  56393. this.crlSign = (0, _utils.getStringOption)(attributes.crlSign, options);
  56394. this.dataEncipherment = (0, _utils.getStringOption)(attributes.dataEncipherment, options);
  56395. this.decipherOnly = (0, _utils.getStringOption)(attributes.decipherOnly, options);
  56396. this.digitalSignature = (0, _utils.getStringOption)(attributes.digitalSignature, options);
  56397. this.encipherOnly = (0, _utils.getStringOption)(attributes.encipherOnly, options);
  56398. this.id = attributes.id || "";
  56399. this.keyAgreement = (0, _utils.getStringOption)(attributes.keyAgreement, options);
  56400. this.keyCertSign = (0, _utils.getStringOption)(attributes.keyCertSign, options);
  56401. this.keyEncipherment = (0, _utils.getStringOption)(attributes.keyEncipherment, options);
  56402. this.nonRepudiation = (0, _utils.getStringOption)(attributes.nonRepudiation, options);
  56403. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56404. this.use = attributes.use || "";
  56405. this.usehref = attributes.usehref || "";
  56406. }
  56407. }
  56408. class Line extends _xfa_object.XFAObject {
  56409. constructor(attributes) {
  56410. super(TEMPLATE_NS_ID, "line", true);
  56411. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  56412. this.id = attributes.id || "";
  56413. this.slope = (0, _utils.getStringOption)(attributes.slope, ["\\", "/"]);
  56414. this.use = attributes.use || "";
  56415. this.usehref = attributes.usehref || "";
  56416. this.edge = null;
  56417. }
  56418. [_xfa_object.$toHTML]() {
  56419. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  56420. const edge = this.edge || new Edge({});
  56421. const edgeStyle = edge[_xfa_object.$toStyle]();
  56422. const style = Object.create(null);
  56423. const thickness = edge.presence === "visible" ? edge.thickness : 0;
  56424. style.strokeWidth = (0, _html_utils.measureToString)(thickness);
  56425. style.stroke = edgeStyle.color;
  56426. let x1, y1, x2, y2;
  56427. let width = "100%";
  56428. let height = "100%";
  56429. if (parent.w <= thickness) {
  56430. [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"];
  56431. width = style.strokeWidth;
  56432. } else if (parent.h <= thickness) {
  56433. [x1, y1, x2, y2] = [0, "50%", "100%", "50%"];
  56434. height = style.strokeWidth;
  56435. } else {
  56436. if (this.slope === "\\") {
  56437. [x1, y1, x2, y2] = [0, 0, "100%", "100%"];
  56438. } else {
  56439. [x1, y1, x2, y2] = [0, "100%", "100%", 0];
  56440. }
  56441. }
  56442. const line = {
  56443. name: "line",
  56444. attributes: {
  56445. xmlns: SVG_NS,
  56446. x1,
  56447. y1,
  56448. x2,
  56449. y2,
  56450. style
  56451. }
  56452. };
  56453. const svg = {
  56454. name: "svg",
  56455. children: [line],
  56456. attributes: {
  56457. xmlns: SVG_NS,
  56458. width,
  56459. height,
  56460. style: {
  56461. overflow: "visible"
  56462. }
  56463. }
  56464. };
  56465. if (hasMargin(parent)) {
  56466. return _utils.HTMLResult.success({
  56467. name: "div",
  56468. attributes: {
  56469. style: {
  56470. display: "inline",
  56471. width: "100%",
  56472. height: "100%"
  56473. }
  56474. },
  56475. children: [svg]
  56476. });
  56477. }
  56478. svg.attributes.style.position = "absolute";
  56479. return _utils.HTMLResult.success(svg);
  56480. }
  56481. }
  56482. class Linear extends _xfa_object.XFAObject {
  56483. constructor(attributes) {
  56484. super(TEMPLATE_NS_ID, "linear", true);
  56485. this.id = attributes.id || "";
  56486. this.type = (0, _utils.getStringOption)(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]);
  56487. this.use = attributes.use || "";
  56488. this.usehref = attributes.usehref || "";
  56489. this.color = null;
  56490. this.extras = null;
  56491. }
  56492. [_xfa_object.$toStyle](startColor) {
  56493. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  56494. const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
  56495. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  56496. return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
  56497. }
  56498. }
  56499. class LockDocument extends _xfa_object.ContentObject {
  56500. constructor(attributes) {
  56501. super(TEMPLATE_NS_ID, "lockDocument");
  56502. this.id = attributes.id || "";
  56503. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56504. this.use = attributes.use || "";
  56505. this.usehref = attributes.usehref || "";
  56506. }
  56507. [_xfa_object.$finalize]() {
  56508. this[_xfa_object.$content] = (0, _utils.getStringOption)(this[_xfa_object.$content], ["auto", "0", "1"]);
  56509. }
  56510. }
  56511. class Manifest extends _xfa_object.XFAObject {
  56512. constructor(attributes) {
  56513. super(TEMPLATE_NS_ID, "manifest", true);
  56514. this.action = (0, _utils.getStringOption)(attributes.action, ["include", "all", "exclude"]);
  56515. this.id = attributes.id || "";
  56516. this.name = attributes.name || "";
  56517. this.use = attributes.use || "";
  56518. this.usehref = attributes.usehref || "";
  56519. this.extras = null;
  56520. this.ref = new _xfa_object.XFAObjectArray();
  56521. }
  56522. }
  56523. class Margin extends _xfa_object.XFAObject {
  56524. constructor(attributes) {
  56525. super(TEMPLATE_NS_ID, "margin", true);
  56526. this.bottomInset = (0, _utils.getMeasurement)(attributes.bottomInset, "0");
  56527. this.id = attributes.id || "";
  56528. this.leftInset = (0, _utils.getMeasurement)(attributes.leftInset, "0");
  56529. this.rightInset = (0, _utils.getMeasurement)(attributes.rightInset, "0");
  56530. this.topInset = (0, _utils.getMeasurement)(attributes.topInset, "0");
  56531. this.use = attributes.use || "";
  56532. this.usehref = attributes.usehref || "";
  56533. this.extras = null;
  56534. }
  56535. [_xfa_object.$toStyle]() {
  56536. return {
  56537. margin: (0, _html_utils.measureToString)(this.topInset) + " " + (0, _html_utils.measureToString)(this.rightInset) + " " + (0, _html_utils.measureToString)(this.bottomInset) + " " + (0, _html_utils.measureToString)(this.leftInset)
  56538. };
  56539. }
  56540. }
  56541. class Mdp extends _xfa_object.XFAObject {
  56542. constructor(attributes) {
  56543. super(TEMPLATE_NS_ID, "mdp");
  56544. this.id = attributes.id || "";
  56545. this.permissions = (0, _utils.getInteger)({
  56546. data: attributes.permissions,
  56547. defaultValue: 2,
  56548. validate: x => x === 1 || x === 3
  56549. });
  56550. this.signatureType = (0, _utils.getStringOption)(attributes.signatureType, ["filler", "author"]);
  56551. this.use = attributes.use || "";
  56552. this.usehref = attributes.usehref || "";
  56553. }
  56554. }
  56555. class Medium extends _xfa_object.XFAObject {
  56556. constructor(attributes) {
  56557. super(TEMPLATE_NS_ID, "medium");
  56558. this.id = attributes.id || "";
  56559. this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox);
  56560. this.long = (0, _utils.getMeasurement)(attributes.long);
  56561. this.orientation = (0, _utils.getStringOption)(attributes.orientation, ["portrait", "landscape"]);
  56562. this.short = (0, _utils.getMeasurement)(attributes.short);
  56563. this.stock = attributes.stock || "";
  56564. this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, ["auto", "delegate", "pageFront"]);
  56565. this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, ["auto", "delegate"]);
  56566. this.use = attributes.use || "";
  56567. this.usehref = attributes.usehref || "";
  56568. }
  56569. }
  56570. class Message extends _xfa_object.XFAObject {
  56571. constructor(attributes) {
  56572. super(TEMPLATE_NS_ID, "message", true);
  56573. this.id = attributes.id || "";
  56574. this.use = attributes.use || "";
  56575. this.usehref = attributes.usehref || "";
  56576. this.text = new _xfa_object.XFAObjectArray();
  56577. }
  56578. }
  56579. class NumericEdit extends _xfa_object.XFAObject {
  56580. constructor(attributes) {
  56581. super(TEMPLATE_NS_ID, "numericEdit", true);
  56582. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  56583. this.id = attributes.id || "";
  56584. this.use = attributes.use || "";
  56585. this.usehref = attributes.usehref || "";
  56586. this.border = null;
  56587. this.comb = null;
  56588. this.extras = null;
  56589. this.margin = null;
  56590. }
  56591. [_xfa_object.$toHTML](availableSpace) {
  56592. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  56593. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  56594. const html = {
  56595. name: "input",
  56596. attributes: {
  56597. type: "text",
  56598. fieldId: field[_xfa_object.$uid],
  56599. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  56600. class: ["xfaTextfield"],
  56601. style,
  56602. "aria-label": ariaLabel(field),
  56603. "aria-required": false
  56604. }
  56605. };
  56606. if (isRequired(field)) {
  56607. html.attributes["aria-required"] = true;
  56608. html.attributes.required = true;
  56609. }
  56610. return _utils.HTMLResult.success({
  56611. name: "label",
  56612. attributes: {
  56613. class: ["xfaLabel"]
  56614. },
  56615. children: [html]
  56616. });
  56617. }
  56618. }
  56619. class Occur extends _xfa_object.XFAObject {
  56620. constructor(attributes) {
  56621. super(TEMPLATE_NS_ID, "occur", true);
  56622. this.id = attributes.id || "";
  56623. this.initial = attributes.initial !== "" ? (0, _utils.getInteger)({
  56624. data: attributes.initial,
  56625. defaultValue: "",
  56626. validate: x => true
  56627. }) : "";
  56628. this.max = attributes.max !== "" ? (0, _utils.getInteger)({
  56629. data: attributes.max,
  56630. defaultValue: 1,
  56631. validate: x => true
  56632. }) : "";
  56633. this.min = attributes.min !== "" ? (0, _utils.getInteger)({
  56634. data: attributes.min,
  56635. defaultValue: 1,
  56636. validate: x => true
  56637. }) : "";
  56638. this.use = attributes.use || "";
  56639. this.usehref = attributes.usehref || "";
  56640. this.extras = null;
  56641. }
  56642. [_xfa_object.$clean]() {
  56643. const parent = this[_xfa_object.$getParent]();
  56644. const originalMin = this.min;
  56645. if (this.min === "") {
  56646. this.min = parent instanceof PageArea || parent instanceof PageSet ? 0 : 1;
  56647. }
  56648. if (this.max === "") {
  56649. if (originalMin === "") {
  56650. this.max = parent instanceof PageArea || parent instanceof PageSet ? -1 : 1;
  56651. } else {
  56652. this.max = this.min;
  56653. }
  56654. }
  56655. if (this.max !== -1 && this.max < this.min) {
  56656. this.max = this.min;
  56657. }
  56658. if (this.initial === "") {
  56659. this.initial = parent instanceof Template ? 1 : this.min;
  56660. }
  56661. }
  56662. }
  56663. class Oid extends _xfa_object.StringObject {
  56664. constructor(attributes) {
  56665. super(TEMPLATE_NS_ID, "oid");
  56666. this.id = attributes.id || "";
  56667. this.name = attributes.name || "";
  56668. this.use = attributes.use || "";
  56669. this.usehref = attributes.usehref || "";
  56670. }
  56671. }
  56672. class Oids extends _xfa_object.XFAObject {
  56673. constructor(attributes) {
  56674. super(TEMPLATE_NS_ID, "oids", true);
  56675. this.id = attributes.id || "";
  56676. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56677. this.use = attributes.use || "";
  56678. this.usehref = attributes.usehref || "";
  56679. this.oid = new _xfa_object.XFAObjectArray();
  56680. }
  56681. }
  56682. class Overflow extends _xfa_object.XFAObject {
  56683. constructor(attributes) {
  56684. super(TEMPLATE_NS_ID, "overflow");
  56685. this.id = attributes.id || "";
  56686. this.leader = attributes.leader || "";
  56687. this.target = attributes.target || "";
  56688. this.trailer = attributes.trailer || "";
  56689. this.use = attributes.use || "";
  56690. this.usehref = attributes.usehref || "";
  56691. }
  56692. [_xfa_object.$getExtra]() {
  56693. if (!this[_xfa_object.$extra]) {
  56694. const parent = this[_xfa_object.$getParent]();
  56695. const root = this[_xfa_object.$getTemplateRoot]();
  56696. const target = root[_xfa_object.$searchNode](this.target, parent);
  56697. const leader = root[_xfa_object.$searchNode](this.leader, parent);
  56698. const trailer = root[_xfa_object.$searchNode](this.trailer, parent);
  56699. this[_xfa_object.$extra] = {
  56700. target: target && target[0] || null,
  56701. leader: leader && leader[0] || null,
  56702. trailer: trailer && trailer[0] || null,
  56703. addLeader: false,
  56704. addTrailer: false
  56705. };
  56706. }
  56707. return this[_xfa_object.$extra];
  56708. }
  56709. }
  56710. class PageArea extends _xfa_object.XFAObject {
  56711. constructor(attributes) {
  56712. super(TEMPLATE_NS_ID, "pageArea", true);
  56713. this.blankOrNotBlank = (0, _utils.getStringOption)(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]);
  56714. this.id = attributes.id || "";
  56715. this.initialNumber = (0, _utils.getInteger)({
  56716. data: attributes.initialNumber,
  56717. defaultValue: 1,
  56718. validate: x => true
  56719. });
  56720. this.name = attributes.name || "";
  56721. this.numbered = (0, _utils.getInteger)({
  56722. data: attributes.numbered,
  56723. defaultValue: 1,
  56724. validate: x => true
  56725. });
  56726. this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, ["any", "even", "odd"]);
  56727. this.pagePosition = (0, _utils.getStringOption)(attributes.pagePosition, ["any", "first", "last", "only", "rest"]);
  56728. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  56729. this.use = attributes.use || "";
  56730. this.usehref = attributes.usehref || "";
  56731. this.desc = null;
  56732. this.extras = null;
  56733. this.medium = null;
  56734. this.occur = null;
  56735. this.area = new _xfa_object.XFAObjectArray();
  56736. this.contentArea = new _xfa_object.XFAObjectArray();
  56737. this.draw = new _xfa_object.XFAObjectArray();
  56738. this.exclGroup = new _xfa_object.XFAObjectArray();
  56739. this.field = new _xfa_object.XFAObjectArray();
  56740. this.subform = new _xfa_object.XFAObjectArray();
  56741. }
  56742. [_xfa_object.$isUsable]() {
  56743. if (!this[_xfa_object.$extra]) {
  56744. this[_xfa_object.$extra] = {
  56745. numberOfUse: 0
  56746. };
  56747. return true;
  56748. }
  56749. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  56750. }
  56751. [_xfa_object.$cleanPage]() {
  56752. delete this[_xfa_object.$extra];
  56753. }
  56754. [_xfa_object.$getNextPage]() {
  56755. if (!this[_xfa_object.$extra]) {
  56756. this[_xfa_object.$extra] = {
  56757. numberOfUse: 0
  56758. };
  56759. }
  56760. const parent = this[_xfa_object.$getParent]();
  56761. if (parent.relation === "orderedOccurrence") {
  56762. if (this[_xfa_object.$isUsable]()) {
  56763. this[_xfa_object.$extra].numberOfUse += 1;
  56764. return this;
  56765. }
  56766. }
  56767. return parent[_xfa_object.$getNextPage]();
  56768. }
  56769. [_xfa_object.$getAvailableSpace]() {
  56770. return this[_xfa_object.$extra].space || {
  56771. width: 0,
  56772. height: 0
  56773. };
  56774. }
  56775. [_xfa_object.$toHTML]() {
  56776. if (!this[_xfa_object.$extra]) {
  56777. this[_xfa_object.$extra] = {
  56778. numberOfUse: 1
  56779. };
  56780. }
  56781. const children = [];
  56782. this[_xfa_object.$extra].children = children;
  56783. const style = Object.create(null);
  56784. if (this.medium && this.medium.short && this.medium.long) {
  56785. style.width = (0, _html_utils.measureToString)(this.medium.short);
  56786. style.height = (0, _html_utils.measureToString)(this.medium.long);
  56787. this[_xfa_object.$extra].space = {
  56788. width: this.medium.short,
  56789. height: this.medium.long
  56790. };
  56791. if (this.medium.orientation === "landscape") {
  56792. const x = style.width;
  56793. style.width = style.height;
  56794. style.height = x;
  56795. this[_xfa_object.$extra].space = {
  56796. width: this.medium.long,
  56797. height: this.medium.short
  56798. };
  56799. }
  56800. } else {
  56801. (0, _util.warn)("XFA - No medium specified in pageArea: please file a bug.");
  56802. }
  56803. this[_xfa_object.$childrenToHTML]({
  56804. filter: new Set(["area", "draw", "field", "subform"]),
  56805. include: true
  56806. });
  56807. this[_xfa_object.$childrenToHTML]({
  56808. filter: new Set(["contentArea"]),
  56809. include: true
  56810. });
  56811. return _utils.HTMLResult.success({
  56812. name: "div",
  56813. children,
  56814. attributes: {
  56815. class: ["xfaPage"],
  56816. id: this[_xfa_object.$uid],
  56817. style,
  56818. xfaName: this.name
  56819. }
  56820. });
  56821. }
  56822. }
  56823. class PageSet extends _xfa_object.XFAObject {
  56824. constructor(attributes) {
  56825. super(TEMPLATE_NS_ID, "pageSet", true);
  56826. this.duplexImposition = (0, _utils.getStringOption)(attributes.duplexImposition, ["longEdge", "shortEdge"]);
  56827. this.id = attributes.id || "";
  56828. this.name = attributes.name || "";
  56829. this.relation = (0, _utils.getStringOption)(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
  56830. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  56831. this.use = attributes.use || "";
  56832. this.usehref = attributes.usehref || "";
  56833. this.extras = null;
  56834. this.occur = null;
  56835. this.pageArea = new _xfa_object.XFAObjectArray();
  56836. this.pageSet = new _xfa_object.XFAObjectArray();
  56837. }
  56838. [_xfa_object.$cleanPage]() {
  56839. for (const page of this.pageArea.children) {
  56840. page[_xfa_object.$cleanPage]();
  56841. }
  56842. for (const page of this.pageSet.children) {
  56843. page[_xfa_object.$cleanPage]();
  56844. }
  56845. }
  56846. [_xfa_object.$isUsable]() {
  56847. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  56848. }
  56849. [_xfa_object.$getNextPage]() {
  56850. if (!this[_xfa_object.$extra]) {
  56851. this[_xfa_object.$extra] = {
  56852. numberOfUse: 1,
  56853. pageIndex: -1,
  56854. pageSetIndex: -1
  56855. };
  56856. }
  56857. if (this.relation === "orderedOccurrence") {
  56858. if (this[_xfa_object.$extra].pageIndex + 1 < this.pageArea.children.length) {
  56859. this[_xfa_object.$extra].pageIndex += 1;
  56860. const pageArea = this.pageArea.children[this[_xfa_object.$extra].pageIndex];
  56861. return pageArea[_xfa_object.$getNextPage]();
  56862. }
  56863. if (this[_xfa_object.$extra].pageSetIndex + 1 < this.pageSet.children.length) {
  56864. this[_xfa_object.$extra].pageSetIndex += 1;
  56865. return this.pageSet.children[this[_xfa_object.$extra].pageSetIndex][_xfa_object.$getNextPage]();
  56866. }
  56867. if (this[_xfa_object.$isUsable]()) {
  56868. this[_xfa_object.$extra].numberOfUse += 1;
  56869. this[_xfa_object.$extra].pageIndex = -1;
  56870. this[_xfa_object.$extra].pageSetIndex = -1;
  56871. return this[_xfa_object.$getNextPage]();
  56872. }
  56873. const parent = this[_xfa_object.$getParent]();
  56874. if (parent instanceof PageSet) {
  56875. return parent[_xfa_object.$getNextPage]();
  56876. }
  56877. this[_xfa_object.$cleanPage]();
  56878. return this[_xfa_object.$getNextPage]();
  56879. }
  56880. const pageNumber = this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].pageNumber;
  56881. const parity = pageNumber % 2 === 0 ? "even" : "odd";
  56882. const position = pageNumber === 0 ? "first" : "rest";
  56883. let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position);
  56884. if (page) {
  56885. return page;
  56886. }
  56887. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position);
  56888. if (page) {
  56889. return page;
  56890. }
  56891. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any");
  56892. if (page) {
  56893. return page;
  56894. }
  56895. return this.pageArea.children[0];
  56896. }
  56897. }
  56898. class Para extends _xfa_object.XFAObject {
  56899. constructor(attributes) {
  56900. super(TEMPLATE_NS_ID, "para", true);
  56901. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  56902. this.id = attributes.id || "";
  56903. this.lineHeight = attributes.lineHeight ? (0, _utils.getMeasurement)(attributes.lineHeight, "0pt") : "";
  56904. this.marginLeft = attributes.marginLeft ? (0, _utils.getMeasurement)(attributes.marginLeft, "0pt") : "";
  56905. this.marginRight = attributes.marginRight ? (0, _utils.getMeasurement)(attributes.marginRight, "0pt") : "";
  56906. this.orphans = (0, _utils.getInteger)({
  56907. data: attributes.orphans,
  56908. defaultValue: 0,
  56909. validate: x => x >= 0
  56910. });
  56911. this.preserve = attributes.preserve || "";
  56912. this.radixOffset = attributes.radixOffset ? (0, _utils.getMeasurement)(attributes.radixOffset, "0pt") : "";
  56913. this.spaceAbove = attributes.spaceAbove ? (0, _utils.getMeasurement)(attributes.spaceAbove, "0pt") : "";
  56914. this.spaceBelow = attributes.spaceBelow ? (0, _utils.getMeasurement)(attributes.spaceBelow, "0pt") : "";
  56915. this.tabDefault = attributes.tabDefault ? (0, _utils.getMeasurement)(this.tabDefault) : "";
  56916. this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x);
  56917. this.textIndent = attributes.textIndent ? (0, _utils.getMeasurement)(attributes.textIndent, "0pt") : "";
  56918. this.use = attributes.use || "";
  56919. this.usehref = attributes.usehref || "";
  56920. this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, ["top", "bottom", "middle"]);
  56921. this.widows = (0, _utils.getInteger)({
  56922. data: attributes.widows,
  56923. defaultValue: 0,
  56924. validate: x => x >= 0
  56925. });
  56926. this.hyphenation = null;
  56927. }
  56928. [_xfa_object.$toStyle]() {
  56929. const style = (0, _html_utils.toStyle)(this, "hAlign");
  56930. if (this.marginLeft !== "") {
  56931. style.paddingLeft = (0, _html_utils.measureToString)(this.marginLeft);
  56932. }
  56933. if (this.marginRight !== "") {
  56934. style.paddingight = (0, _html_utils.measureToString)(this.marginRight);
  56935. }
  56936. if (this.spaceAbove !== "") {
  56937. style.paddingTop = (0, _html_utils.measureToString)(this.spaceAbove);
  56938. }
  56939. if (this.spaceBelow !== "") {
  56940. style.paddingBottom = (0, _html_utils.measureToString)(this.spaceBelow);
  56941. }
  56942. if (this.textIndent !== "") {
  56943. style.textIndent = (0, _html_utils.measureToString)(this.textIndent);
  56944. (0, _html_utils.fixTextIndent)(style);
  56945. }
  56946. if (this.lineHeight > 0) {
  56947. style.lineHeight = (0, _html_utils.measureToString)(this.lineHeight);
  56948. }
  56949. if (this.tabDefault !== "") {
  56950. style.tabSize = (0, _html_utils.measureToString)(this.tabDefault);
  56951. }
  56952. if (this.tabStops.length > 0) {}
  56953. if (this.hyphenatation) {
  56954. Object.assign(style, this.hyphenatation[_xfa_object.$toStyle]());
  56955. }
  56956. return style;
  56957. }
  56958. }
  56959. class PasswordEdit extends _xfa_object.XFAObject {
  56960. constructor(attributes) {
  56961. super(TEMPLATE_NS_ID, "passwordEdit", true);
  56962. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  56963. this.id = attributes.id || "";
  56964. this.passwordChar = attributes.passwordChar || "*";
  56965. this.use = attributes.use || "";
  56966. this.usehref = attributes.usehref || "";
  56967. this.border = null;
  56968. this.extras = null;
  56969. this.margin = null;
  56970. }
  56971. }
  56972. class Pattern extends _xfa_object.XFAObject {
  56973. constructor(attributes) {
  56974. super(TEMPLATE_NS_ID, "pattern", true);
  56975. this.id = attributes.id || "";
  56976. this.type = (0, _utils.getStringOption)(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
  56977. this.use = attributes.use || "";
  56978. this.usehref = attributes.usehref || "";
  56979. this.color = null;
  56980. this.extras = null;
  56981. }
  56982. [_xfa_object.$toStyle](startColor) {
  56983. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  56984. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  56985. const width = 5;
  56986. const cmd = "repeating-linear-gradient";
  56987. const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
  56988. switch (this.type) {
  56989. case "crossHatch":
  56990. return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
  56991. case "crossDiagonal":
  56992. return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
  56993. case "diagonalLeft":
  56994. return `${cmd}(45deg,${colors})`;
  56995. case "diagonalRight":
  56996. return `${cmd}(-45deg,${colors})`;
  56997. case "horizontal":
  56998. return `${cmd}(to top,${colors})`;
  56999. case "vertical":
  57000. return `${cmd}(to right,${colors})`;
  57001. }
  57002. return "";
  57003. }
  57004. }
  57005. class Picture extends _xfa_object.StringObject {
  57006. constructor(attributes) {
  57007. super(TEMPLATE_NS_ID, "picture");
  57008. this.id = attributes.id || "";
  57009. this.use = attributes.use || "";
  57010. this.usehref = attributes.usehref || "";
  57011. }
  57012. }
  57013. class Proto extends _xfa_object.XFAObject {
  57014. constructor(attributes) {
  57015. super(TEMPLATE_NS_ID, "proto", true);
  57016. this.appearanceFilter = new _xfa_object.XFAObjectArray();
  57017. this.arc = new _xfa_object.XFAObjectArray();
  57018. this.area = new _xfa_object.XFAObjectArray();
  57019. this.assist = new _xfa_object.XFAObjectArray();
  57020. this.barcode = new _xfa_object.XFAObjectArray();
  57021. this.bindItems = new _xfa_object.XFAObjectArray();
  57022. this.bookend = new _xfa_object.XFAObjectArray();
  57023. this.boolean = new _xfa_object.XFAObjectArray();
  57024. this.border = new _xfa_object.XFAObjectArray();
  57025. this.break = new _xfa_object.XFAObjectArray();
  57026. this.breakAfter = new _xfa_object.XFAObjectArray();
  57027. this.breakBefore = new _xfa_object.XFAObjectArray();
  57028. this.button = new _xfa_object.XFAObjectArray();
  57029. this.calculate = new _xfa_object.XFAObjectArray();
  57030. this.caption = new _xfa_object.XFAObjectArray();
  57031. this.certificate = new _xfa_object.XFAObjectArray();
  57032. this.certificates = new _xfa_object.XFAObjectArray();
  57033. this.checkButton = new _xfa_object.XFAObjectArray();
  57034. this.choiceList = new _xfa_object.XFAObjectArray();
  57035. this.color = new _xfa_object.XFAObjectArray();
  57036. this.comb = new _xfa_object.XFAObjectArray();
  57037. this.connect = new _xfa_object.XFAObjectArray();
  57038. this.contentArea = new _xfa_object.XFAObjectArray();
  57039. this.corner = new _xfa_object.XFAObjectArray();
  57040. this.date = new _xfa_object.XFAObjectArray();
  57041. this.dateTime = new _xfa_object.XFAObjectArray();
  57042. this.dateTimeEdit = new _xfa_object.XFAObjectArray();
  57043. this.decimal = new _xfa_object.XFAObjectArray();
  57044. this.defaultUi = new _xfa_object.XFAObjectArray();
  57045. this.desc = new _xfa_object.XFAObjectArray();
  57046. this.digestMethod = new _xfa_object.XFAObjectArray();
  57047. this.digestMethods = new _xfa_object.XFAObjectArray();
  57048. this.draw = new _xfa_object.XFAObjectArray();
  57049. this.edge = new _xfa_object.XFAObjectArray();
  57050. this.encoding = new _xfa_object.XFAObjectArray();
  57051. this.encodings = new _xfa_object.XFAObjectArray();
  57052. this.encrypt = new _xfa_object.XFAObjectArray();
  57053. this.encryptData = new _xfa_object.XFAObjectArray();
  57054. this.encryption = new _xfa_object.XFAObjectArray();
  57055. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  57056. this.encryptionMethods = new _xfa_object.XFAObjectArray();
  57057. this.event = new _xfa_object.XFAObjectArray();
  57058. this.exData = new _xfa_object.XFAObjectArray();
  57059. this.exObject = new _xfa_object.XFAObjectArray();
  57060. this.exclGroup = new _xfa_object.XFAObjectArray();
  57061. this.execute = new _xfa_object.XFAObjectArray();
  57062. this.extras = new _xfa_object.XFAObjectArray();
  57063. this.field = new _xfa_object.XFAObjectArray();
  57064. this.fill = new _xfa_object.XFAObjectArray();
  57065. this.filter = new _xfa_object.XFAObjectArray();
  57066. this.float = new _xfa_object.XFAObjectArray();
  57067. this.font = new _xfa_object.XFAObjectArray();
  57068. this.format = new _xfa_object.XFAObjectArray();
  57069. this.handler = new _xfa_object.XFAObjectArray();
  57070. this.hyphenation = new _xfa_object.XFAObjectArray();
  57071. this.image = new _xfa_object.XFAObjectArray();
  57072. this.imageEdit = new _xfa_object.XFAObjectArray();
  57073. this.integer = new _xfa_object.XFAObjectArray();
  57074. this.issuers = new _xfa_object.XFAObjectArray();
  57075. this.items = new _xfa_object.XFAObjectArray();
  57076. this.keep = new _xfa_object.XFAObjectArray();
  57077. this.keyUsage = new _xfa_object.XFAObjectArray();
  57078. this.line = new _xfa_object.XFAObjectArray();
  57079. this.linear = new _xfa_object.XFAObjectArray();
  57080. this.lockDocument = new _xfa_object.XFAObjectArray();
  57081. this.manifest = new _xfa_object.XFAObjectArray();
  57082. this.margin = new _xfa_object.XFAObjectArray();
  57083. this.mdp = new _xfa_object.XFAObjectArray();
  57084. this.medium = new _xfa_object.XFAObjectArray();
  57085. this.message = new _xfa_object.XFAObjectArray();
  57086. this.numericEdit = new _xfa_object.XFAObjectArray();
  57087. this.occur = new _xfa_object.XFAObjectArray();
  57088. this.oid = new _xfa_object.XFAObjectArray();
  57089. this.oids = new _xfa_object.XFAObjectArray();
  57090. this.overflow = new _xfa_object.XFAObjectArray();
  57091. this.pageArea = new _xfa_object.XFAObjectArray();
  57092. this.pageSet = new _xfa_object.XFAObjectArray();
  57093. this.para = new _xfa_object.XFAObjectArray();
  57094. this.passwordEdit = new _xfa_object.XFAObjectArray();
  57095. this.pattern = new _xfa_object.XFAObjectArray();
  57096. this.picture = new _xfa_object.XFAObjectArray();
  57097. this.radial = new _xfa_object.XFAObjectArray();
  57098. this.reason = new _xfa_object.XFAObjectArray();
  57099. this.reasons = new _xfa_object.XFAObjectArray();
  57100. this.rectangle = new _xfa_object.XFAObjectArray();
  57101. this.ref = new _xfa_object.XFAObjectArray();
  57102. this.script = new _xfa_object.XFAObjectArray();
  57103. this.setProperty = new _xfa_object.XFAObjectArray();
  57104. this.signData = new _xfa_object.XFAObjectArray();
  57105. this.signature = new _xfa_object.XFAObjectArray();
  57106. this.signing = new _xfa_object.XFAObjectArray();
  57107. this.solid = new _xfa_object.XFAObjectArray();
  57108. this.speak = new _xfa_object.XFAObjectArray();
  57109. this.stipple = new _xfa_object.XFAObjectArray();
  57110. this.subform = new _xfa_object.XFAObjectArray();
  57111. this.subformSet = new _xfa_object.XFAObjectArray();
  57112. this.subjectDN = new _xfa_object.XFAObjectArray();
  57113. this.subjectDNs = new _xfa_object.XFAObjectArray();
  57114. this.submit = new _xfa_object.XFAObjectArray();
  57115. this.text = new _xfa_object.XFAObjectArray();
  57116. this.textEdit = new _xfa_object.XFAObjectArray();
  57117. this.time = new _xfa_object.XFAObjectArray();
  57118. this.timeStamp = new _xfa_object.XFAObjectArray();
  57119. this.toolTip = new _xfa_object.XFAObjectArray();
  57120. this.traversal = new _xfa_object.XFAObjectArray();
  57121. this.traverse = new _xfa_object.XFAObjectArray();
  57122. this.ui = new _xfa_object.XFAObjectArray();
  57123. this.validate = new _xfa_object.XFAObjectArray();
  57124. this.value = new _xfa_object.XFAObjectArray();
  57125. this.variables = new _xfa_object.XFAObjectArray();
  57126. }
  57127. }
  57128. class Radial extends _xfa_object.XFAObject {
  57129. constructor(attributes) {
  57130. super(TEMPLATE_NS_ID, "radial", true);
  57131. this.id = attributes.id || "";
  57132. this.type = (0, _utils.getStringOption)(attributes.type, ["toEdge", "toCenter"]);
  57133. this.use = attributes.use || "";
  57134. this.usehref = attributes.usehref || "";
  57135. this.color = null;
  57136. this.extras = null;
  57137. }
  57138. [_xfa_object.$toStyle](startColor) {
  57139. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  57140. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  57141. const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
  57142. return `radial-gradient(circle at center, ${colors})`;
  57143. }
  57144. }
  57145. class Reason extends _xfa_object.StringObject {
  57146. constructor(attributes) {
  57147. super(TEMPLATE_NS_ID, "reason");
  57148. this.id = attributes.id || "";
  57149. this.name = attributes.name || "";
  57150. this.use = attributes.use || "";
  57151. this.usehref = attributes.usehref || "";
  57152. }
  57153. }
  57154. class Reasons extends _xfa_object.XFAObject {
  57155. constructor(attributes) {
  57156. super(TEMPLATE_NS_ID, "reasons", true);
  57157. this.id = attributes.id || "";
  57158. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  57159. this.use = attributes.use || "";
  57160. this.usehref = attributes.usehref || "";
  57161. this.reason = new _xfa_object.XFAObjectArray();
  57162. }
  57163. }
  57164. class Rectangle extends _xfa_object.XFAObject {
  57165. constructor(attributes) {
  57166. super(TEMPLATE_NS_ID, "rectangle", true);
  57167. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  57168. this.id = attributes.id || "";
  57169. this.use = attributes.use || "";
  57170. this.usehref = attributes.usehref || "";
  57171. this.corner = new _xfa_object.XFAObjectArray(4);
  57172. this.edge = new _xfa_object.XFAObjectArray(4);
  57173. this.fill = null;
  57174. }
  57175. [_xfa_object.$toHTML]() {
  57176. const edge = this.edge.children.length ? this.edge.children[0] : new Edge({});
  57177. const edgeStyle = edge[_xfa_object.$toStyle]();
  57178. const style = Object.create(null);
  57179. if (this.fill && this.fill.presence === "visible") {
  57180. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  57181. } else {
  57182. style.fill = "transparent";
  57183. }
  57184. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  57185. style.stroke = edgeStyle.color;
  57186. const corner = this.corner.children.length ? this.corner.children[0] : new Corner({});
  57187. const cornerStyle = corner[_xfa_object.$toStyle]();
  57188. const rect = {
  57189. name: "rect",
  57190. attributes: {
  57191. xmlns: SVG_NS,
  57192. width: "100%",
  57193. height: "100%",
  57194. x: 0,
  57195. y: 0,
  57196. rx: cornerStyle.radius,
  57197. ry: cornerStyle.radius,
  57198. style
  57199. }
  57200. };
  57201. const svg = {
  57202. name: "svg",
  57203. children: [rect],
  57204. attributes: {
  57205. xmlns: SVG_NS,
  57206. style: {
  57207. overflow: "visible"
  57208. },
  57209. width: "100%",
  57210. height: "100%"
  57211. }
  57212. };
  57213. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  57214. if (hasMargin(parent)) {
  57215. return _utils.HTMLResult.success({
  57216. name: "div",
  57217. attributes: {
  57218. style: {
  57219. display: "inline",
  57220. width: "100%",
  57221. height: "100%"
  57222. }
  57223. },
  57224. children: [svg]
  57225. });
  57226. }
  57227. svg.attributes.style.position = "absolute";
  57228. return _utils.HTMLResult.success(svg);
  57229. }
  57230. }
  57231. class RefElement extends _xfa_object.StringObject {
  57232. constructor(attributes) {
  57233. super(TEMPLATE_NS_ID, "ref");
  57234. this.id = attributes.id || "";
  57235. this.use = attributes.use || "";
  57236. this.usehref = attributes.usehref || "";
  57237. }
  57238. }
  57239. class Script extends _xfa_object.StringObject {
  57240. constructor(attributes) {
  57241. super(TEMPLATE_NS_ID, "script");
  57242. this.binding = attributes.binding || "";
  57243. this.contentType = attributes.contentType || "";
  57244. this.id = attributes.id || "";
  57245. this.name = attributes.name || "";
  57246. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  57247. this.use = attributes.use || "";
  57248. this.usehref = attributes.usehref || "";
  57249. }
  57250. }
  57251. class SetProperty extends _xfa_object.XFAObject {
  57252. constructor(attributes) {
  57253. super(TEMPLATE_NS_ID, "setProperty");
  57254. this.connection = attributes.connection || "";
  57255. this.ref = attributes.ref || "";
  57256. this.target = attributes.target || "";
  57257. }
  57258. }
  57259. exports.SetProperty = SetProperty;
  57260. class SignData extends _xfa_object.XFAObject {
  57261. constructor(attributes) {
  57262. super(TEMPLATE_NS_ID, "signData", true);
  57263. this.id = attributes.id || "";
  57264. this.operation = (0, _utils.getStringOption)(attributes.operation, ["sign", "clear", "verify"]);
  57265. this.ref = attributes.ref || "";
  57266. this.target = attributes.target || "";
  57267. this.use = attributes.use || "";
  57268. this.usehref = attributes.usehref || "";
  57269. this.filter = null;
  57270. this.manifest = null;
  57271. }
  57272. }
  57273. class Signature extends _xfa_object.XFAObject {
  57274. constructor(attributes) {
  57275. super(TEMPLATE_NS_ID, "signature", true);
  57276. this.id = attributes.id || "";
  57277. this.type = (0, _utils.getStringOption)(attributes.type, ["PDF1.3", "PDF1.6"]);
  57278. this.use = attributes.use || "";
  57279. this.usehref = attributes.usehref || "";
  57280. this.border = null;
  57281. this.extras = null;
  57282. this.filter = null;
  57283. this.manifest = null;
  57284. this.margin = null;
  57285. }
  57286. }
  57287. class Signing extends _xfa_object.XFAObject {
  57288. constructor(attributes) {
  57289. super(TEMPLATE_NS_ID, "signing", true);
  57290. this.id = attributes.id || "";
  57291. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  57292. this.use = attributes.use || "";
  57293. this.usehref = attributes.usehref || "";
  57294. this.certificate = new _xfa_object.XFAObjectArray();
  57295. }
  57296. }
  57297. class Solid extends _xfa_object.XFAObject {
  57298. constructor(attributes) {
  57299. super(TEMPLATE_NS_ID, "solid", true);
  57300. this.id = attributes.id || "";
  57301. this.use = attributes.use || "";
  57302. this.usehref = attributes.usehref || "";
  57303. this.extras = null;
  57304. }
  57305. [_xfa_object.$toStyle](startColor) {
  57306. return startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  57307. }
  57308. }
  57309. class Speak extends _xfa_object.StringObject {
  57310. constructor(attributes) {
  57311. super(TEMPLATE_NS_ID, "speak");
  57312. this.disable = (0, _utils.getInteger)({
  57313. data: attributes.disable,
  57314. defaultValue: 0,
  57315. validate: x => x === 1
  57316. });
  57317. this.id = attributes.id || "";
  57318. this.priority = (0, _utils.getStringOption)(attributes.priority, ["custom", "caption", "name", "toolTip"]);
  57319. this.rid = attributes.rid || "";
  57320. this.use = attributes.use || "";
  57321. this.usehref = attributes.usehref || "";
  57322. }
  57323. }
  57324. class Stipple extends _xfa_object.XFAObject {
  57325. constructor(attributes) {
  57326. super(TEMPLATE_NS_ID, "stipple", true);
  57327. this.id = attributes.id || "";
  57328. this.rate = (0, _utils.getInteger)({
  57329. data: attributes.rate,
  57330. defaultValue: 50,
  57331. validate: x => x >= 0 && x <= 100
  57332. });
  57333. this.use = attributes.use || "";
  57334. this.usehref = attributes.usehref || "";
  57335. this.color = null;
  57336. this.extras = null;
  57337. }
  57338. [_xfa_object.$toStyle](bgColor) {
  57339. const alpha = this.rate / 100;
  57340. return _util.Util.makeHexColor(Math.round(bgColor.value.r * (1 - alpha) + this.value.r * alpha), Math.round(bgColor.value.g * (1 - alpha) + this.value.g * alpha), Math.round(bgColor.value.b * (1 - alpha) + this.value.b * alpha));
  57341. }
  57342. }
  57343. class Subform extends _xfa_object.XFAObject {
  57344. constructor(attributes) {
  57345. super(TEMPLATE_NS_ID, "subform", true);
  57346. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  57347. this.allowMacro = (0, _utils.getInteger)({
  57348. data: attributes.allowMacro,
  57349. defaultValue: 0,
  57350. validate: x => x === 1
  57351. });
  57352. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  57353. this.colSpan = (0, _utils.getInteger)({
  57354. data: attributes.colSpan,
  57355. defaultValue: 1,
  57356. validate: n => n >= 1 || n === -1
  57357. });
  57358. this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : (0, _utils.getMeasurement)(x));
  57359. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  57360. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  57361. this.id = attributes.id || "";
  57362. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  57363. this.locale = attributes.locale || "";
  57364. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  57365. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  57366. this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, ["consumeData", "matchTemplate"]);
  57367. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  57368. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  57369. this.name = attributes.name || "";
  57370. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  57371. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  57372. this.restoreState = (0, _utils.getStringOption)(attributes.restoreState, ["manual", "auto"]);
  57373. this.scope = (0, _utils.getStringOption)(attributes.scope, ["name", "none"]);
  57374. this.use = attributes.use || "";
  57375. this.usehref = attributes.usehref || "";
  57376. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  57377. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  57378. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  57379. this.assist = null;
  57380. this.bind = null;
  57381. this.bookend = null;
  57382. this.border = null;
  57383. this.break = null;
  57384. this.calculate = null;
  57385. this.desc = null;
  57386. this.extras = null;
  57387. this.keep = null;
  57388. this.margin = null;
  57389. this.occur = null;
  57390. this.overflow = null;
  57391. this.pageSet = null;
  57392. this.para = null;
  57393. this.traversal = null;
  57394. this.validate = null;
  57395. this.variables = null;
  57396. this.area = new _xfa_object.XFAObjectArray();
  57397. this.breakAfter = new _xfa_object.XFAObjectArray();
  57398. this.breakBefore = new _xfa_object.XFAObjectArray();
  57399. this.connect = new _xfa_object.XFAObjectArray();
  57400. this.draw = new _xfa_object.XFAObjectArray();
  57401. this.event = new _xfa_object.XFAObjectArray();
  57402. this.exObject = new _xfa_object.XFAObjectArray();
  57403. this.exclGroup = new _xfa_object.XFAObjectArray();
  57404. this.field = new _xfa_object.XFAObjectArray();
  57405. this.proto = new _xfa_object.XFAObjectArray();
  57406. this.setProperty = new _xfa_object.XFAObjectArray();
  57407. this.subform = new _xfa_object.XFAObjectArray();
  57408. this.subformSet = new _xfa_object.XFAObjectArray();
  57409. }
  57410. [_xfa_object.$getSubformParent]() {
  57411. const parent = this[_xfa_object.$getParent]();
  57412. if (parent instanceof SubformSet) {
  57413. return parent[_xfa_object.$getSubformParent]();
  57414. }
  57415. return parent;
  57416. }
  57417. [_xfa_object.$isBindable]() {
  57418. return true;
  57419. }
  57420. [_xfa_object.$isThereMoreWidth]() {
  57421. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  57422. }
  57423. *[_xfa_object.$getContainedChildren]() {
  57424. yield* getContainedChildren(this);
  57425. }
  57426. [_xfa_object.$flushHTML]() {
  57427. return (0, _layout.flushHTML)(this);
  57428. }
  57429. [_xfa_object.$addHTML](html, bbox) {
  57430. (0, _layout.addHTML)(this, html, bbox);
  57431. }
  57432. [_xfa_object.$getAvailableSpace]() {
  57433. return (0, _layout.getAvailableSpace)(this);
  57434. }
  57435. [_xfa_object.$isSplittable]() {
  57436. const parent = this[_xfa_object.$getSubformParent]();
  57437. if (!parent[_xfa_object.$isSplittable]()) {
  57438. return false;
  57439. }
  57440. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  57441. return this[_xfa_object.$extra]._isSplittable;
  57442. }
  57443. if (this.layout === "position" || this.layout.includes("row")) {
  57444. this[_xfa_object.$extra]._isSplittable = false;
  57445. return false;
  57446. }
  57447. if (this.keep && this.keep.intact !== "none") {
  57448. this[_xfa_object.$extra]._isSplittable = false;
  57449. return false;
  57450. }
  57451. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  57452. return false;
  57453. }
  57454. this[_xfa_object.$extra]._isSplittable = true;
  57455. return true;
  57456. }
  57457. [_xfa_object.$toHTML](availableSpace) {
  57458. setTabIndex(this);
  57459. if (this.break) {
  57460. if (this.break.after !== "auto" || this.break.afterTarget !== "") {
  57461. const node = new BreakAfter({
  57462. targetType: this.break.after,
  57463. target: this.break.afterTarget,
  57464. startNew: this.break.startNew.toString()
  57465. });
  57466. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  57467. this[_xfa_object.$appendChild](node);
  57468. this.breakAfter.push(node);
  57469. }
  57470. if (this.break.before !== "auto" || this.break.beforeTarget !== "") {
  57471. const node = new BreakBefore({
  57472. targetType: this.break.before,
  57473. target: this.break.beforeTarget,
  57474. startNew: this.break.startNew.toString()
  57475. });
  57476. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  57477. this[_xfa_object.$appendChild](node);
  57478. this.breakBefore.push(node);
  57479. }
  57480. if (this.break.overflowTarget !== "") {
  57481. const node = new Overflow({
  57482. target: this.break.overflowTarget,
  57483. leader: this.break.overflowLeader,
  57484. trailer: this.break.overflowTrailer
  57485. });
  57486. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  57487. this[_xfa_object.$appendChild](node);
  57488. this.overflow.push(node);
  57489. }
  57490. this[_xfa_object.$removeChild](this.break);
  57491. this.break = null;
  57492. }
  57493. if (this.presence === "hidden" || this.presence === "inactive") {
  57494. return _utils.HTMLResult.EMPTY;
  57495. }
  57496. if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) {
  57497. (0, _util.warn)("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");
  57498. }
  57499. if (this.breakBefore.children.length >= 1) {
  57500. const breakBefore = this.breakBefore.children[0];
  57501. if (handleBreak(breakBefore)) {
  57502. return _utils.HTMLResult.breakNode(breakBefore);
  57503. }
  57504. }
  57505. if (this[_xfa_object.$extra] && this[_xfa_object.$extra].afterBreakAfter) {
  57506. return _utils.HTMLResult.EMPTY;
  57507. }
  57508. (0, _html_utils.fixDimensions)(this);
  57509. const children = [];
  57510. const attributes = {
  57511. id: this[_xfa_object.$uid],
  57512. class: []
  57513. };
  57514. (0, _html_utils.setAccess)(this, attributes.class);
  57515. if (!this[_xfa_object.$extra]) {
  57516. this[_xfa_object.$extra] = Object.create(null);
  57517. }
  57518. Object.assign(this[_xfa_object.$extra], {
  57519. children,
  57520. line: null,
  57521. attributes,
  57522. attempt: 0,
  57523. numberInLine: 0,
  57524. availableSpace: {
  57525. width: Math.min(this.w || Infinity, availableSpace.width),
  57526. height: Math.min(this.h || Infinity, availableSpace.height)
  57527. },
  57528. width: 0,
  57529. height: 0,
  57530. prevHeight: 0,
  57531. currentWidth: 0
  57532. });
  57533. const root = this[_xfa_object.$getTemplateRoot]();
  57534. const savedNoLayoutFailure = root[_xfa_object.$extra].noLayoutFailure;
  57535. const isSplittable = this[_xfa_object.$isSplittable]();
  57536. if (!isSplittable) {
  57537. setFirstUnsplittable(this);
  57538. }
  57539. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  57540. return _utils.HTMLResult.FAILURE;
  57541. }
  57542. const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]);
  57543. if (this.layout.includes("row")) {
  57544. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  57545. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  57546. this[_xfa_object.$extra].columnWidths = columnWidths;
  57547. this[_xfa_object.$extra].currentColumn = 0;
  57548. }
  57549. }
  57550. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  57551. const classNames = ["xfaSubform"];
  57552. const cl = (0, _html_utils.layoutClass)(this);
  57553. if (cl) {
  57554. classNames.push(cl);
  57555. }
  57556. attributes.style = style;
  57557. attributes.class = classNames;
  57558. if (this.name) {
  57559. attributes.xfaName = this.name;
  57560. }
  57561. if (this.overflow) {
  57562. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  57563. if (overflowExtra.addLeader) {
  57564. overflowExtra.addLeader = false;
  57565. handleOverflow(this, overflowExtra.leader, availableSpace);
  57566. }
  57567. }
  57568. this[_xfa_object.$pushPara]();
  57569. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  57570. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  57571. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  57572. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  57573. this[_xfa_object.$extra].numberInLine = 0;
  57574. }
  57575. const result = this[_xfa_object.$childrenToHTML]({
  57576. filter,
  57577. include: true
  57578. });
  57579. if (result.success) {
  57580. break;
  57581. }
  57582. if (result.isBreak()) {
  57583. this[_xfa_object.$popPara]();
  57584. return result;
  57585. }
  57586. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !root[_xfa_object.$extra].noLayoutFailure) {
  57587. this[_xfa_object.$extra].attempt = maxRun;
  57588. break;
  57589. }
  57590. }
  57591. this[_xfa_object.$popPara]();
  57592. if (!isSplittable) {
  57593. unsetFirstUnsplittable(this);
  57594. }
  57595. root[_xfa_object.$extra].noLayoutFailure = savedNoLayoutFailure;
  57596. if (this[_xfa_object.$extra].attempt === maxRun) {
  57597. if (this.overflow) {
  57598. this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].overflowNode = this.overflow;
  57599. }
  57600. if (!isSplittable) {
  57601. delete this[_xfa_object.$extra];
  57602. }
  57603. return _utils.HTMLResult.FAILURE;
  57604. }
  57605. if (this.overflow) {
  57606. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  57607. if (overflowExtra.addTrailer) {
  57608. overflowExtra.addTrailer = false;
  57609. handleOverflow(this, overflowExtra.trailer, availableSpace);
  57610. }
  57611. }
  57612. let marginH = 0;
  57613. let marginV = 0;
  57614. if (this.margin) {
  57615. marginH = this.margin.leftInset + this.margin.rightInset;
  57616. marginV = this.margin.topInset + this.margin.bottomInset;
  57617. }
  57618. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  57619. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  57620. const bbox = [this.x, this.y, width, height];
  57621. if (this.w === "") {
  57622. style.width = (0, _html_utils.measureToString)(width);
  57623. }
  57624. if (this.h === "") {
  57625. style.height = (0, _html_utils.measureToString)(height);
  57626. }
  57627. if ((style.width === "0px" || style.height === "0px") && children.length === 0) {
  57628. return _utils.HTMLResult.EMPTY;
  57629. }
  57630. const html = {
  57631. name: "div",
  57632. attributes,
  57633. children
  57634. };
  57635. applyAssist(this, attributes);
  57636. const result = _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  57637. if (this.breakAfter.children.length >= 1) {
  57638. const breakAfter = this.breakAfter.children[0];
  57639. if (handleBreak(breakAfter)) {
  57640. this[_xfa_object.$extra].afterBreakAfter = result;
  57641. return _utils.HTMLResult.breakNode(breakAfter);
  57642. }
  57643. }
  57644. delete this[_xfa_object.$extra];
  57645. return result;
  57646. }
  57647. }
  57648. class SubformSet extends _xfa_object.XFAObject {
  57649. constructor(attributes) {
  57650. super(TEMPLATE_NS_ID, "subformSet", true);
  57651. this.id = attributes.id || "";
  57652. this.name = attributes.name || "";
  57653. this.relation = (0, _utils.getStringOption)(attributes.relation, ["ordered", "choice", "unordered"]);
  57654. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  57655. this.use = attributes.use || "";
  57656. this.usehref = attributes.usehref || "";
  57657. this.bookend = null;
  57658. this.break = null;
  57659. this.desc = null;
  57660. this.extras = null;
  57661. this.occur = null;
  57662. this.overflow = null;
  57663. this.breakAfter = new _xfa_object.XFAObjectArray();
  57664. this.breakBefore = new _xfa_object.XFAObjectArray();
  57665. this.subform = new _xfa_object.XFAObjectArray();
  57666. this.subformSet = new _xfa_object.XFAObjectArray();
  57667. }
  57668. *[_xfa_object.$getContainedChildren]() {
  57669. yield* getContainedChildren(this);
  57670. }
  57671. [_xfa_object.$getSubformParent]() {
  57672. let parent = this[_xfa_object.$getParent]();
  57673. while (!(parent instanceof Subform)) {
  57674. parent = parent[_xfa_object.$getParent]();
  57675. }
  57676. return parent;
  57677. }
  57678. [_xfa_object.$isBindable]() {
  57679. return true;
  57680. }
  57681. }
  57682. class SubjectDN extends _xfa_object.ContentObject {
  57683. constructor(attributes) {
  57684. super(TEMPLATE_NS_ID, "subjectDN");
  57685. this.delimiter = attributes.delimiter || ",";
  57686. this.id = attributes.id || "";
  57687. this.name = attributes.name || "";
  57688. this.use = attributes.use || "";
  57689. this.usehref = attributes.usehref || "";
  57690. }
  57691. [_xfa_object.$finalize]() {
  57692. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].split(this.delimiter).map(kv => {
  57693. kv = kv.split("=", 2);
  57694. kv[0] = kv[0].trim();
  57695. return kv;
  57696. }));
  57697. }
  57698. }
  57699. class SubjectDNs extends _xfa_object.XFAObject {
  57700. constructor(attributes) {
  57701. super(TEMPLATE_NS_ID, "subjectDNs", true);
  57702. this.id = attributes.id || "";
  57703. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  57704. this.use = attributes.use || "";
  57705. this.usehref = attributes.usehref || "";
  57706. this.subjectDN = new _xfa_object.XFAObjectArray();
  57707. }
  57708. }
  57709. class Submit extends _xfa_object.XFAObject {
  57710. constructor(attributes) {
  57711. super(TEMPLATE_NS_ID, "submit", true);
  57712. this.embedPDF = (0, _utils.getInteger)({
  57713. data: attributes.embedPDF,
  57714. defaultValue: 0,
  57715. validate: x => x === 1
  57716. });
  57717. this.format = (0, _utils.getStringOption)(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]);
  57718. this.id = attributes.id || "";
  57719. this.target = attributes.target || "";
  57720. this.textEncoding = (0, _utils.getKeyword)({
  57721. data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "",
  57722. defaultValue: "",
  57723. validate: k => ["utf-8", "big-five", "fontspecific", "gbk", "gb-18030", "gb-2312", "ksc-5601", "none", "shift-jis", "ucs-2", "utf-16"].includes(k) || k.match(/iso-8859-\d{2}/)
  57724. });
  57725. this.use = attributes.use || "";
  57726. this.usehref = attributes.usehref || "";
  57727. this.xdpContent = attributes.xdpContent || "";
  57728. this.encrypt = null;
  57729. this.encryptData = new _xfa_object.XFAObjectArray();
  57730. this.signData = new _xfa_object.XFAObjectArray();
  57731. }
  57732. }
  57733. class Template extends _xfa_object.XFAObject {
  57734. constructor(attributes) {
  57735. super(TEMPLATE_NS_ID, "template", true);
  57736. this.baseProfile = (0, _utils.getStringOption)(attributes.baseProfile, ["full", "interactiveForms"]);
  57737. this.extras = null;
  57738. this.subform = new _xfa_object.XFAObjectArray();
  57739. }
  57740. [_xfa_object.$finalize]() {
  57741. if (this.subform.children.length === 0) {
  57742. (0, _util.warn)("XFA - No subforms in template node.");
  57743. }
  57744. if (this.subform.children.length >= 2) {
  57745. (0, _util.warn)("XFA - Several subforms in template node: please file a bug.");
  57746. }
  57747. this[_xfa_object.$tabIndex] = DEFAULT_TAB_INDEX;
  57748. }
  57749. [_xfa_object.$isSplittable]() {
  57750. return true;
  57751. }
  57752. [_xfa_object.$searchNode](expr, container) {
  57753. if (expr.startsWith("#")) {
  57754. return [this[_xfa_object.$ids].get(expr.slice(1))];
  57755. }
  57756. return (0, _som.searchNode)(this, container, expr, true, true);
  57757. }
  57758. *[_xfa_object.$toPages]() {
  57759. if (!this.subform.children.length) {
  57760. return _utils.HTMLResult.success({
  57761. name: "div",
  57762. children: []
  57763. });
  57764. }
  57765. this[_xfa_object.$extra] = {
  57766. overflowNode: null,
  57767. firstUnsplittable: null,
  57768. currentContentArea: null,
  57769. currentPageArea: null,
  57770. noLayoutFailure: false,
  57771. pageNumber: 1,
  57772. pagePosition: "first",
  57773. oddOrEven: "odd",
  57774. blankOrNotBlank: "nonBlank",
  57775. paraStack: []
  57776. };
  57777. const root = this.subform.children[0];
  57778. root.pageSet[_xfa_object.$cleanPage]();
  57779. const pageAreas = root.pageSet.pageArea.children;
  57780. const mainHtml = {
  57781. name: "div",
  57782. children: []
  57783. };
  57784. let pageArea = null;
  57785. let breakBefore = null;
  57786. let breakBeforeTarget = null;
  57787. if (root.breakBefore.children.length >= 1) {
  57788. breakBefore = root.breakBefore.children[0];
  57789. breakBeforeTarget = breakBefore.target;
  57790. } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) {
  57791. breakBefore = root.subform.children[0].breakBefore.children[0];
  57792. breakBeforeTarget = breakBefore.target;
  57793. } else if (root.break && root.break.beforeTarget) {
  57794. breakBefore = root.break;
  57795. breakBeforeTarget = breakBefore.beforeTarget;
  57796. } else if (root.subform.children.length >= 1 && root.subform.children[0].break && root.subform.children[0].break.beforeTarget) {
  57797. breakBefore = root.subform.children[0].break;
  57798. breakBeforeTarget = breakBefore.beforeTarget;
  57799. }
  57800. if (breakBefore) {
  57801. const target = this[_xfa_object.$searchNode](breakBeforeTarget, breakBefore[_xfa_object.$getParent]());
  57802. if (target instanceof PageArea) {
  57803. pageArea = target;
  57804. breakBefore[_xfa_object.$extra] = {};
  57805. }
  57806. }
  57807. if (!pageArea) {
  57808. pageArea = pageAreas[0];
  57809. }
  57810. pageArea[_xfa_object.$extra] = {
  57811. numberOfUse: 1
  57812. };
  57813. const pageAreaParent = pageArea[_xfa_object.$getParent]();
  57814. pageAreaParent[_xfa_object.$extra] = {
  57815. numberOfUse: 1,
  57816. pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea),
  57817. pageSetIndex: 0
  57818. };
  57819. let targetPageArea;
  57820. let leader = null;
  57821. let trailer = null;
  57822. let hasSomething = true;
  57823. let hasSomethingCounter = 0;
  57824. let startIndex = 0;
  57825. while (true) {
  57826. if (!hasSomething) {
  57827. mainHtml.children.pop();
  57828. if (++hasSomethingCounter === MAX_EMPTY_PAGES) {
  57829. (0, _util.warn)("XFA - Something goes wrong: please file a bug.");
  57830. return mainHtml;
  57831. }
  57832. } else {
  57833. hasSomethingCounter = 0;
  57834. }
  57835. targetPageArea = null;
  57836. this[_xfa_object.$extra].currentPageArea = pageArea;
  57837. const page = pageArea[_xfa_object.$toHTML]().html;
  57838. mainHtml.children.push(page);
  57839. if (leader) {
  57840. this[_xfa_object.$extra].noLayoutFailure = true;
  57841. page.children.push(leader[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  57842. leader = null;
  57843. }
  57844. if (trailer) {
  57845. this[_xfa_object.$extra].noLayoutFailure = true;
  57846. page.children.push(trailer[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  57847. trailer = null;
  57848. }
  57849. const contentAreas = pageArea.contentArea.children;
  57850. const htmlContentAreas = page.children.filter(node => node.attributes.class.includes("xfaContentarea"));
  57851. hasSomething = false;
  57852. this[_xfa_object.$extra].firstUnsplittable = null;
  57853. this[_xfa_object.$extra].noLayoutFailure = false;
  57854. const flush = index => {
  57855. const html = root[_xfa_object.$flushHTML]();
  57856. if (html) {
  57857. hasSomething = hasSomething || html.children && html.children.length !== 0;
  57858. htmlContentAreas[index].children.push(html);
  57859. }
  57860. };
  57861. for (let i = startIndex, ii = contentAreas.length; i < ii; i++) {
  57862. const contentArea = this[_xfa_object.$extra].currentContentArea = contentAreas[i];
  57863. const space = {
  57864. width: contentArea.w,
  57865. height: contentArea.h
  57866. };
  57867. startIndex = 0;
  57868. if (leader) {
  57869. htmlContentAreas[i].children.push(leader[_xfa_object.$toHTML](space).html);
  57870. leader = null;
  57871. }
  57872. if (trailer) {
  57873. htmlContentAreas[i].children.push(trailer[_xfa_object.$toHTML](space).html);
  57874. trailer = null;
  57875. }
  57876. const html = root[_xfa_object.$toHTML](space);
  57877. if (html.success) {
  57878. if (html.html) {
  57879. hasSomething = hasSomething || html.html.children && html.html.children.length !== 0;
  57880. htmlContentAreas[i].children.push(html.html);
  57881. } else if (!hasSomething && mainHtml.children.length > 1) {
  57882. mainHtml.children.pop();
  57883. }
  57884. return mainHtml;
  57885. }
  57886. if (html.isBreak()) {
  57887. const node = html.breakNode;
  57888. flush(i);
  57889. if (node.targetType === "auto") {
  57890. continue;
  57891. }
  57892. if (node.leader) {
  57893. leader = this[_xfa_object.$searchNode](node.leader, node[_xfa_object.$getParent]());
  57894. leader = leader ? leader[0] : null;
  57895. }
  57896. if (node.trailer) {
  57897. trailer = this[_xfa_object.$searchNode](node.trailer, node[_xfa_object.$getParent]());
  57898. trailer = trailer ? trailer[0] : null;
  57899. }
  57900. if (node.targetType === "pageArea") {
  57901. targetPageArea = node[_xfa_object.$extra].target;
  57902. i = Infinity;
  57903. } else if (!node[_xfa_object.$extra].target) {
  57904. i = node[_xfa_object.$extra].index;
  57905. } else {
  57906. targetPageArea = node[_xfa_object.$extra].target;
  57907. startIndex = node[_xfa_object.$extra].index + 1;
  57908. i = Infinity;
  57909. }
  57910. continue;
  57911. }
  57912. if (this[_xfa_object.$extra].overflowNode) {
  57913. const node = this[_xfa_object.$extra].overflowNode;
  57914. this[_xfa_object.$extra].overflowNode = null;
  57915. const overflowExtra = node[_xfa_object.$getExtra]();
  57916. const target = overflowExtra.target;
  57917. overflowExtra.addLeader = overflowExtra.leader !== null;
  57918. overflowExtra.addTrailer = overflowExtra.trailer !== null;
  57919. flush(i);
  57920. const currentIndex = i;
  57921. i = Infinity;
  57922. if (target instanceof PageArea) {
  57923. targetPageArea = target;
  57924. } else if (target instanceof ContentArea) {
  57925. const index = contentAreas.indexOf(target);
  57926. if (index !== -1) {
  57927. if (index > currentIndex) {
  57928. i = index - 1;
  57929. } else {
  57930. startIndex = index;
  57931. }
  57932. } else {
  57933. targetPageArea = target[_xfa_object.$getParent]();
  57934. startIndex = targetPageArea.contentArea.children.indexOf(target);
  57935. }
  57936. }
  57937. continue;
  57938. }
  57939. flush(i);
  57940. }
  57941. this[_xfa_object.$extra].pageNumber += 1;
  57942. if (targetPageArea) {
  57943. if (targetPageArea[_xfa_object.$isUsable]()) {
  57944. targetPageArea[_xfa_object.$extra].numberOfUse += 1;
  57945. } else {
  57946. targetPageArea = null;
  57947. }
  57948. }
  57949. pageArea = targetPageArea || pageArea[_xfa_object.$getNextPage]();
  57950. yield null;
  57951. }
  57952. }
  57953. }
  57954. exports.Template = Template;
  57955. class Text extends _xfa_object.ContentObject {
  57956. constructor(attributes) {
  57957. super(TEMPLATE_NS_ID, "text");
  57958. this.id = attributes.id || "";
  57959. this.maxChars = (0, _utils.getInteger)({
  57960. data: attributes.maxChars,
  57961. defaultValue: 0,
  57962. validate: x => x >= 0
  57963. });
  57964. this.name = attributes.name || "";
  57965. this.rid = attributes.rid || "";
  57966. this.use = attributes.use || "";
  57967. this.usehref = attributes.usehref || "";
  57968. }
  57969. [_xfa_object.$acceptWhitespace]() {
  57970. return true;
  57971. }
  57972. [_xfa_object.$onChild](child) {
  57973. if (child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  57974. this[_xfa_object.$content] = child;
  57975. return true;
  57976. }
  57977. (0, _util.warn)(`XFA - Invalid content in Text: ${child[_xfa_object.$nodeName]}.`);
  57978. return false;
  57979. }
  57980. [_xfa_object.$onText](str) {
  57981. if (this[_xfa_object.$content] instanceof _xfa_object.XFAObject) {
  57982. return;
  57983. }
  57984. super[_xfa_object.$onText](str);
  57985. }
  57986. [_xfa_object.$finalize]() {
  57987. if (typeof this[_xfa_object.$content] === "string") {
  57988. this[_xfa_object.$content] = this[_xfa_object.$content].replace(/\r\n/g, "\n");
  57989. }
  57990. }
  57991. [_xfa_object.$getExtra]() {
  57992. if (typeof this[_xfa_object.$content] === "string") {
  57993. return this[_xfa_object.$content].split(/[\u2029\u2028\n]/).reduce((acc, line) => {
  57994. if (line) {
  57995. acc.push(line);
  57996. }
  57997. return acc;
  57998. }, []).join("\n");
  57999. }
  58000. return this[_xfa_object.$content][_xfa_object.$text]();
  58001. }
  58002. [_xfa_object.$toHTML](availableSpace) {
  58003. if (typeof this[_xfa_object.$content] === "string") {
  58004. const html = valueToHtml(this[_xfa_object.$content]).html;
  58005. if (this[_xfa_object.$content].includes("\u2029")) {
  58006. html.name = "div";
  58007. html.children = [];
  58008. this[_xfa_object.$content].split("\u2029").map(para => para.split(/[\u2028\n]/).reduce((acc, line) => {
  58009. acc.push({
  58010. name: "span",
  58011. value: line
  58012. }, {
  58013. name: "br"
  58014. });
  58015. return acc;
  58016. }, [])).forEach(lines => {
  58017. html.children.push({
  58018. name: "p",
  58019. children: lines
  58020. });
  58021. });
  58022. } else if (/[\u2028\n]/.test(this[_xfa_object.$content])) {
  58023. html.name = "div";
  58024. html.children = [];
  58025. this[_xfa_object.$content].split(/[\u2028\n]/).forEach(line => {
  58026. html.children.push({
  58027. name: "span",
  58028. value: line
  58029. }, {
  58030. name: "br"
  58031. });
  58032. });
  58033. }
  58034. return _utils.HTMLResult.success(html);
  58035. }
  58036. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  58037. }
  58038. }
  58039. exports.Text = Text;
  58040. class TextEdit extends _xfa_object.XFAObject {
  58041. constructor(attributes) {
  58042. super(TEMPLATE_NS_ID, "textEdit", true);
  58043. this.allowRichText = (0, _utils.getInteger)({
  58044. data: attributes.allowRichText,
  58045. defaultValue: 0,
  58046. validate: x => x === 1
  58047. });
  58048. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  58049. this.id = attributes.id || "";
  58050. this.multiLine = (0, _utils.getInteger)({
  58051. data: attributes.multiLine,
  58052. defaultValue: "",
  58053. validate: x => x === 0 || x === 1
  58054. });
  58055. this.use = attributes.use || "";
  58056. this.usehref = attributes.usehref || "";
  58057. this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]);
  58058. this.border = null;
  58059. this.comb = null;
  58060. this.extras = null;
  58061. this.margin = null;
  58062. }
  58063. [_xfa_object.$toHTML](availableSpace) {
  58064. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  58065. let html;
  58066. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  58067. if (this.multiLine === "") {
  58068. this.multiLine = field instanceof Draw ? 1 : 0;
  58069. }
  58070. if (this.multiLine === 1) {
  58071. html = {
  58072. name: "textarea",
  58073. attributes: {
  58074. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  58075. fieldId: field[_xfa_object.$uid],
  58076. class: ["xfaTextfield"],
  58077. style,
  58078. "aria-label": ariaLabel(field),
  58079. "aria-required": false
  58080. }
  58081. };
  58082. } else {
  58083. html = {
  58084. name: "input",
  58085. attributes: {
  58086. type: "text",
  58087. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  58088. fieldId: field[_xfa_object.$uid],
  58089. class: ["xfaTextfield"],
  58090. style,
  58091. "aria-label": ariaLabel(field),
  58092. "aria-required": false
  58093. }
  58094. };
  58095. }
  58096. if (isRequired(field)) {
  58097. html.attributes["aria-required"] = true;
  58098. html.attributes.required = true;
  58099. }
  58100. return _utils.HTMLResult.success({
  58101. name: "label",
  58102. attributes: {
  58103. class: ["xfaLabel"]
  58104. },
  58105. children: [html]
  58106. });
  58107. }
  58108. }
  58109. class Time extends _xfa_object.StringObject {
  58110. constructor(attributes) {
  58111. super(TEMPLATE_NS_ID, "time");
  58112. this.id = attributes.id || "";
  58113. this.name = attributes.name || "";
  58114. this.use = attributes.use || "";
  58115. this.usehref = attributes.usehref || "";
  58116. }
  58117. [_xfa_object.$finalize]() {
  58118. const date = this[_xfa_object.$content].trim();
  58119. this[_xfa_object.$content] = date ? new Date(date) : null;
  58120. }
  58121. [_xfa_object.$toHTML](availableSpace) {
  58122. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  58123. }
  58124. }
  58125. class TimeStamp extends _xfa_object.XFAObject {
  58126. constructor(attributes) {
  58127. super(TEMPLATE_NS_ID, "timeStamp");
  58128. this.id = attributes.id || "";
  58129. this.server = attributes.server || "";
  58130. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  58131. this.use = attributes.use || "";
  58132. this.usehref = attributes.usehref || "";
  58133. }
  58134. }
  58135. class ToolTip extends _xfa_object.StringObject {
  58136. constructor(attributes) {
  58137. super(TEMPLATE_NS_ID, "toolTip");
  58138. this.id = attributes.id || "";
  58139. this.rid = attributes.rid || "";
  58140. this.use = attributes.use || "";
  58141. this.usehref = attributes.usehref || "";
  58142. }
  58143. }
  58144. class Traversal extends _xfa_object.XFAObject {
  58145. constructor(attributes) {
  58146. super(TEMPLATE_NS_ID, "traversal", true);
  58147. this.id = attributes.id || "";
  58148. this.use = attributes.use || "";
  58149. this.usehref = attributes.usehref || "";
  58150. this.extras = null;
  58151. this.traverse = new _xfa_object.XFAObjectArray();
  58152. }
  58153. }
  58154. class Traverse extends _xfa_object.XFAObject {
  58155. constructor(attributes) {
  58156. super(TEMPLATE_NS_ID, "traverse", true);
  58157. this.id = attributes.id || "";
  58158. this.operation = (0, _utils.getStringOption)(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]);
  58159. this.ref = attributes.ref || "";
  58160. this.use = attributes.use || "";
  58161. this.usehref = attributes.usehref || "";
  58162. this.extras = null;
  58163. this.script = null;
  58164. }
  58165. get name() {
  58166. return this.operation;
  58167. }
  58168. [_xfa_object.$isTransparent]() {
  58169. return false;
  58170. }
  58171. }
  58172. class Ui extends _xfa_object.XFAObject {
  58173. constructor(attributes) {
  58174. super(TEMPLATE_NS_ID, "ui", true);
  58175. this.id = attributes.id || "";
  58176. this.use = attributes.use || "";
  58177. this.usehref = attributes.usehref || "";
  58178. this.extras = null;
  58179. this.picture = null;
  58180. this.barcode = null;
  58181. this.button = null;
  58182. this.checkButton = null;
  58183. this.choiceList = null;
  58184. this.dateTimeEdit = null;
  58185. this.defaultUi = null;
  58186. this.imageEdit = null;
  58187. this.numericEdit = null;
  58188. this.passwordEdit = null;
  58189. this.signature = null;
  58190. this.textEdit = null;
  58191. }
  58192. [_xfa_object.$getExtra]() {
  58193. if (this[_xfa_object.$extra] === undefined) {
  58194. for (const name of Object.getOwnPropertyNames(this)) {
  58195. if (name === "extras" || name === "picture") {
  58196. continue;
  58197. }
  58198. const obj = this[name];
  58199. if (!(obj instanceof _xfa_object.XFAObject)) {
  58200. continue;
  58201. }
  58202. this[_xfa_object.$extra] = obj;
  58203. return obj;
  58204. }
  58205. this[_xfa_object.$extra] = null;
  58206. }
  58207. return this[_xfa_object.$extra];
  58208. }
  58209. [_xfa_object.$toHTML](availableSpace) {
  58210. const obj = this[_xfa_object.$getExtra]();
  58211. if (obj) {
  58212. return obj[_xfa_object.$toHTML](availableSpace);
  58213. }
  58214. return _utils.HTMLResult.EMPTY;
  58215. }
  58216. }
  58217. class Validate extends _xfa_object.XFAObject {
  58218. constructor(attributes) {
  58219. super(TEMPLATE_NS_ID, "validate", true);
  58220. this.formatTest = (0, _utils.getStringOption)(attributes.formatTest, ["warning", "disabled", "error"]);
  58221. this.id = attributes.id || "";
  58222. this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, ["disabled", "error", "warning"]);
  58223. this.scriptTest = (0, _utils.getStringOption)(attributes.scriptTest, ["error", "disabled", "warning"]);
  58224. this.use = attributes.use || "";
  58225. this.usehref = attributes.usehref || "";
  58226. this.extras = null;
  58227. this.message = null;
  58228. this.picture = null;
  58229. this.script = null;
  58230. }
  58231. }
  58232. class Value extends _xfa_object.XFAObject {
  58233. constructor(attributes) {
  58234. super(TEMPLATE_NS_ID, "value", true);
  58235. this.id = attributes.id || "";
  58236. this.override = (0, _utils.getInteger)({
  58237. data: attributes.override,
  58238. defaultValue: 0,
  58239. validate: x => x === 1
  58240. });
  58241. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  58242. this.use = attributes.use || "";
  58243. this.usehref = attributes.usehref || "";
  58244. this.arc = null;
  58245. this.boolean = null;
  58246. this.date = null;
  58247. this.dateTime = null;
  58248. this.decimal = null;
  58249. this.exData = null;
  58250. this.float = null;
  58251. this.image = null;
  58252. this.integer = null;
  58253. this.line = null;
  58254. this.rectangle = null;
  58255. this.text = null;
  58256. this.time = null;
  58257. }
  58258. [_xfa_object.$setValue](value) {
  58259. const parent = this[_xfa_object.$getParent]();
  58260. if (parent instanceof Field) {
  58261. if (parent.ui && parent.ui.imageEdit) {
  58262. if (!this.image) {
  58263. this.image = new Image({});
  58264. this[_xfa_object.$appendChild](this.image);
  58265. }
  58266. this.image[_xfa_object.$content] = value[_xfa_object.$content];
  58267. return;
  58268. }
  58269. }
  58270. const valueName = value[_xfa_object.$nodeName];
  58271. if (this[valueName] !== null) {
  58272. this[valueName][_xfa_object.$content] = value[_xfa_object.$content];
  58273. return;
  58274. }
  58275. for (const name of Object.getOwnPropertyNames(this)) {
  58276. const obj = this[name];
  58277. if (obj instanceof _xfa_object.XFAObject) {
  58278. this[name] = null;
  58279. this[_xfa_object.$removeChild](obj);
  58280. }
  58281. }
  58282. this[value[_xfa_object.$nodeName]] = value;
  58283. this[_xfa_object.$appendChild](value);
  58284. }
  58285. [_xfa_object.$text]() {
  58286. if (this.exData) {
  58287. if (typeof this.exData[_xfa_object.$content] === "string") {
  58288. return this.exData[_xfa_object.$content].trim();
  58289. }
  58290. return this.exData[_xfa_object.$content][_xfa_object.$text]().trim();
  58291. }
  58292. for (const name of Object.getOwnPropertyNames(this)) {
  58293. if (name === "image") {
  58294. continue;
  58295. }
  58296. const obj = this[name];
  58297. if (obj instanceof _xfa_object.XFAObject) {
  58298. return (obj[_xfa_object.$content] || "").toString().trim();
  58299. }
  58300. }
  58301. return null;
  58302. }
  58303. [_xfa_object.$toHTML](availableSpace) {
  58304. for (const name of Object.getOwnPropertyNames(this)) {
  58305. const obj = this[name];
  58306. if (!(obj instanceof _xfa_object.XFAObject)) {
  58307. continue;
  58308. }
  58309. return obj[_xfa_object.$toHTML](availableSpace);
  58310. }
  58311. return _utils.HTMLResult.EMPTY;
  58312. }
  58313. }
  58314. exports.Value = Value;
  58315. class Variables extends _xfa_object.XFAObject {
  58316. constructor(attributes) {
  58317. super(TEMPLATE_NS_ID, "variables", true);
  58318. this.id = attributes.id || "";
  58319. this.use = attributes.use || "";
  58320. this.usehref = attributes.usehref || "";
  58321. this.boolean = new _xfa_object.XFAObjectArray();
  58322. this.date = new _xfa_object.XFAObjectArray();
  58323. this.dateTime = new _xfa_object.XFAObjectArray();
  58324. this.decimal = new _xfa_object.XFAObjectArray();
  58325. this.exData = new _xfa_object.XFAObjectArray();
  58326. this.float = new _xfa_object.XFAObjectArray();
  58327. this.image = new _xfa_object.XFAObjectArray();
  58328. this.integer = new _xfa_object.XFAObjectArray();
  58329. this.manifest = new _xfa_object.XFAObjectArray();
  58330. this.script = new _xfa_object.XFAObjectArray();
  58331. this.text = new _xfa_object.XFAObjectArray();
  58332. this.time = new _xfa_object.XFAObjectArray();
  58333. }
  58334. [_xfa_object.$isTransparent]() {
  58335. return true;
  58336. }
  58337. }
  58338. class TemplateNamespace {
  58339. static [_namespaces.$buildXFAObject](name, attributes) {
  58340. if (TemplateNamespace.hasOwnProperty(name)) {
  58341. const node = TemplateNamespace[name](attributes);
  58342. node[_xfa_object.$setSetAttributes](attributes);
  58343. return node;
  58344. }
  58345. return undefined;
  58346. }
  58347. static appearanceFilter(attrs) {
  58348. return new AppearanceFilter(attrs);
  58349. }
  58350. static arc(attrs) {
  58351. return new Arc(attrs);
  58352. }
  58353. static area(attrs) {
  58354. return new Area(attrs);
  58355. }
  58356. static assist(attrs) {
  58357. return new Assist(attrs);
  58358. }
  58359. static barcode(attrs) {
  58360. return new Barcode(attrs);
  58361. }
  58362. static bind(attrs) {
  58363. return new Bind(attrs);
  58364. }
  58365. static bindItems(attrs) {
  58366. return new BindItems(attrs);
  58367. }
  58368. static bookend(attrs) {
  58369. return new Bookend(attrs);
  58370. }
  58371. static boolean(attrs) {
  58372. return new BooleanElement(attrs);
  58373. }
  58374. static border(attrs) {
  58375. return new Border(attrs);
  58376. }
  58377. static break(attrs) {
  58378. return new Break(attrs);
  58379. }
  58380. static breakAfter(attrs) {
  58381. return new BreakAfter(attrs);
  58382. }
  58383. static breakBefore(attrs) {
  58384. return new BreakBefore(attrs);
  58385. }
  58386. static button(attrs) {
  58387. return new Button(attrs);
  58388. }
  58389. static calculate(attrs) {
  58390. return new Calculate(attrs);
  58391. }
  58392. static caption(attrs) {
  58393. return new Caption(attrs);
  58394. }
  58395. static certificate(attrs) {
  58396. return new Certificate(attrs);
  58397. }
  58398. static certificates(attrs) {
  58399. return new Certificates(attrs);
  58400. }
  58401. static checkButton(attrs) {
  58402. return new CheckButton(attrs);
  58403. }
  58404. static choiceList(attrs) {
  58405. return new ChoiceList(attrs);
  58406. }
  58407. static color(attrs) {
  58408. return new Color(attrs);
  58409. }
  58410. static comb(attrs) {
  58411. return new Comb(attrs);
  58412. }
  58413. static connect(attrs) {
  58414. return new Connect(attrs);
  58415. }
  58416. static contentArea(attrs) {
  58417. return new ContentArea(attrs);
  58418. }
  58419. static corner(attrs) {
  58420. return new Corner(attrs);
  58421. }
  58422. static date(attrs) {
  58423. return new DateElement(attrs);
  58424. }
  58425. static dateTime(attrs) {
  58426. return new DateTime(attrs);
  58427. }
  58428. static dateTimeEdit(attrs) {
  58429. return new DateTimeEdit(attrs);
  58430. }
  58431. static decimal(attrs) {
  58432. return new Decimal(attrs);
  58433. }
  58434. static defaultUi(attrs) {
  58435. return new DefaultUi(attrs);
  58436. }
  58437. static desc(attrs) {
  58438. return new Desc(attrs);
  58439. }
  58440. static digestMethod(attrs) {
  58441. return new DigestMethod(attrs);
  58442. }
  58443. static digestMethods(attrs) {
  58444. return new DigestMethods(attrs);
  58445. }
  58446. static draw(attrs) {
  58447. return new Draw(attrs);
  58448. }
  58449. static edge(attrs) {
  58450. return new Edge(attrs);
  58451. }
  58452. static encoding(attrs) {
  58453. return new Encoding(attrs);
  58454. }
  58455. static encodings(attrs) {
  58456. return new Encodings(attrs);
  58457. }
  58458. static encrypt(attrs) {
  58459. return new Encrypt(attrs);
  58460. }
  58461. static encryptData(attrs) {
  58462. return new EncryptData(attrs);
  58463. }
  58464. static encryption(attrs) {
  58465. return new Encryption(attrs);
  58466. }
  58467. static encryptionMethod(attrs) {
  58468. return new EncryptionMethod(attrs);
  58469. }
  58470. static encryptionMethods(attrs) {
  58471. return new EncryptionMethods(attrs);
  58472. }
  58473. static event(attrs) {
  58474. return new Event(attrs);
  58475. }
  58476. static exData(attrs) {
  58477. return new ExData(attrs);
  58478. }
  58479. static exObject(attrs) {
  58480. return new ExObject(attrs);
  58481. }
  58482. static exclGroup(attrs) {
  58483. return new ExclGroup(attrs);
  58484. }
  58485. static execute(attrs) {
  58486. return new Execute(attrs);
  58487. }
  58488. static extras(attrs) {
  58489. return new Extras(attrs);
  58490. }
  58491. static field(attrs) {
  58492. return new Field(attrs);
  58493. }
  58494. static fill(attrs) {
  58495. return new Fill(attrs);
  58496. }
  58497. static filter(attrs) {
  58498. return new Filter(attrs);
  58499. }
  58500. static float(attrs) {
  58501. return new Float(attrs);
  58502. }
  58503. static font(attrs) {
  58504. return new Font(attrs);
  58505. }
  58506. static format(attrs) {
  58507. return new Format(attrs);
  58508. }
  58509. static handler(attrs) {
  58510. return new Handler(attrs);
  58511. }
  58512. static hyphenation(attrs) {
  58513. return new Hyphenation(attrs);
  58514. }
  58515. static image(attrs) {
  58516. return new Image(attrs);
  58517. }
  58518. static imageEdit(attrs) {
  58519. return new ImageEdit(attrs);
  58520. }
  58521. static integer(attrs) {
  58522. return new Integer(attrs);
  58523. }
  58524. static issuers(attrs) {
  58525. return new Issuers(attrs);
  58526. }
  58527. static items(attrs) {
  58528. return new Items(attrs);
  58529. }
  58530. static keep(attrs) {
  58531. return new Keep(attrs);
  58532. }
  58533. static keyUsage(attrs) {
  58534. return new KeyUsage(attrs);
  58535. }
  58536. static line(attrs) {
  58537. return new Line(attrs);
  58538. }
  58539. static linear(attrs) {
  58540. return new Linear(attrs);
  58541. }
  58542. static lockDocument(attrs) {
  58543. return new LockDocument(attrs);
  58544. }
  58545. static manifest(attrs) {
  58546. return new Manifest(attrs);
  58547. }
  58548. static margin(attrs) {
  58549. return new Margin(attrs);
  58550. }
  58551. static mdp(attrs) {
  58552. return new Mdp(attrs);
  58553. }
  58554. static medium(attrs) {
  58555. return new Medium(attrs);
  58556. }
  58557. static message(attrs) {
  58558. return new Message(attrs);
  58559. }
  58560. static numericEdit(attrs) {
  58561. return new NumericEdit(attrs);
  58562. }
  58563. static occur(attrs) {
  58564. return new Occur(attrs);
  58565. }
  58566. static oid(attrs) {
  58567. return new Oid(attrs);
  58568. }
  58569. static oids(attrs) {
  58570. return new Oids(attrs);
  58571. }
  58572. static overflow(attrs) {
  58573. return new Overflow(attrs);
  58574. }
  58575. static pageArea(attrs) {
  58576. return new PageArea(attrs);
  58577. }
  58578. static pageSet(attrs) {
  58579. return new PageSet(attrs);
  58580. }
  58581. static para(attrs) {
  58582. return new Para(attrs);
  58583. }
  58584. static passwordEdit(attrs) {
  58585. return new PasswordEdit(attrs);
  58586. }
  58587. static pattern(attrs) {
  58588. return new Pattern(attrs);
  58589. }
  58590. static picture(attrs) {
  58591. return new Picture(attrs);
  58592. }
  58593. static proto(attrs) {
  58594. return new Proto(attrs);
  58595. }
  58596. static radial(attrs) {
  58597. return new Radial(attrs);
  58598. }
  58599. static reason(attrs) {
  58600. return new Reason(attrs);
  58601. }
  58602. static reasons(attrs) {
  58603. return new Reasons(attrs);
  58604. }
  58605. static rectangle(attrs) {
  58606. return new Rectangle(attrs);
  58607. }
  58608. static ref(attrs) {
  58609. return new RefElement(attrs);
  58610. }
  58611. static script(attrs) {
  58612. return new Script(attrs);
  58613. }
  58614. static setProperty(attrs) {
  58615. return new SetProperty(attrs);
  58616. }
  58617. static signData(attrs) {
  58618. return new SignData(attrs);
  58619. }
  58620. static signature(attrs) {
  58621. return new Signature(attrs);
  58622. }
  58623. static signing(attrs) {
  58624. return new Signing(attrs);
  58625. }
  58626. static solid(attrs) {
  58627. return new Solid(attrs);
  58628. }
  58629. static speak(attrs) {
  58630. return new Speak(attrs);
  58631. }
  58632. static stipple(attrs) {
  58633. return new Stipple(attrs);
  58634. }
  58635. static subform(attrs) {
  58636. return new Subform(attrs);
  58637. }
  58638. static subformSet(attrs) {
  58639. return new SubformSet(attrs);
  58640. }
  58641. static subjectDN(attrs) {
  58642. return new SubjectDN(attrs);
  58643. }
  58644. static subjectDNs(attrs) {
  58645. return new SubjectDNs(attrs);
  58646. }
  58647. static submit(attrs) {
  58648. return new Submit(attrs);
  58649. }
  58650. static template(attrs) {
  58651. return new Template(attrs);
  58652. }
  58653. static text(attrs) {
  58654. return new Text(attrs);
  58655. }
  58656. static textEdit(attrs) {
  58657. return new TextEdit(attrs);
  58658. }
  58659. static time(attrs) {
  58660. return new Time(attrs);
  58661. }
  58662. static timeStamp(attrs) {
  58663. return new TimeStamp(attrs);
  58664. }
  58665. static toolTip(attrs) {
  58666. return new ToolTip(attrs);
  58667. }
  58668. static traversal(attrs) {
  58669. return new Traversal(attrs);
  58670. }
  58671. static traverse(attrs) {
  58672. return new Traverse(attrs);
  58673. }
  58674. static ui(attrs) {
  58675. return new Ui(attrs);
  58676. }
  58677. static validate(attrs) {
  58678. return new Validate(attrs);
  58679. }
  58680. static value(attrs) {
  58681. return new Value(attrs);
  58682. }
  58683. static variables(attrs) {
  58684. return new Variables(attrs);
  58685. }
  58686. }
  58687. exports.TemplateNamespace = TemplateNamespace;
  58688. /***/ }),
  58689. /* 81 */
  58690. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58691. Object.defineProperty(exports, "__esModule", ({
  58692. value: true
  58693. }));
  58694. exports.addHTML = addHTML;
  58695. exports.checkDimensions = checkDimensions;
  58696. exports.flushHTML = flushHTML;
  58697. exports.getAvailableSpace = getAvailableSpace;
  58698. var _xfa_object = __w_pdfjs_require__(75);
  58699. var _html_utils = __w_pdfjs_require__(82);
  58700. function createLine(node, children) {
  58701. return {
  58702. name: "div",
  58703. attributes: {
  58704. class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"]
  58705. },
  58706. children
  58707. };
  58708. }
  58709. function flushHTML(node) {
  58710. if (!node[_xfa_object.$extra]) {
  58711. return null;
  58712. }
  58713. const attributes = node[_xfa_object.$extra].attributes;
  58714. const html = {
  58715. name: "div",
  58716. attributes,
  58717. children: node[_xfa_object.$extra].children
  58718. };
  58719. if (node[_xfa_object.$extra].failingNode) {
  58720. const htmlFromFailing = node[_xfa_object.$extra].failingNode[_xfa_object.$flushHTML]();
  58721. if (htmlFromFailing) {
  58722. if (node.layout.endsWith("-tb")) {
  58723. html.children.push(createLine(node, [htmlFromFailing]));
  58724. } else {
  58725. html.children.push(htmlFromFailing);
  58726. }
  58727. }
  58728. }
  58729. if (html.children.length === 0) {
  58730. return null;
  58731. }
  58732. return html;
  58733. }
  58734. function addHTML(node, html, bbox) {
  58735. const extra = node[_xfa_object.$extra];
  58736. const availableSpace = extra.availableSpace;
  58737. const [x, y, w, h] = bbox;
  58738. switch (node.layout) {
  58739. case "position":
  58740. {
  58741. extra.width = Math.max(extra.width, x + w);
  58742. extra.height = Math.max(extra.height, y + h);
  58743. extra.children.push(html);
  58744. break;
  58745. }
  58746. case "lr-tb":
  58747. case "rl-tb":
  58748. if (!extra.line || extra.attempt === 1) {
  58749. extra.line = createLine(node, []);
  58750. extra.children.push(extra.line);
  58751. extra.numberInLine = 0;
  58752. }
  58753. extra.numberInLine += 1;
  58754. extra.line.children.push(html);
  58755. if (extra.attempt === 0) {
  58756. extra.currentWidth += w;
  58757. extra.height = Math.max(extra.height, extra.prevHeight + h);
  58758. } else {
  58759. extra.currentWidth = w;
  58760. extra.prevHeight = extra.height;
  58761. extra.height += h;
  58762. extra.attempt = 0;
  58763. }
  58764. extra.width = Math.max(extra.width, extra.currentWidth);
  58765. break;
  58766. case "rl-row":
  58767. case "row":
  58768. {
  58769. extra.children.push(html);
  58770. extra.width += w;
  58771. extra.height = Math.max(extra.height, h);
  58772. const height = (0, _html_utils.measureToString)(extra.height);
  58773. for (const child of extra.children) {
  58774. child.attributes.style.height = height;
  58775. }
  58776. break;
  58777. }
  58778. case "table":
  58779. {
  58780. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  58781. extra.height += h;
  58782. extra.children.push(html);
  58783. break;
  58784. }
  58785. case "tb":
  58786. {
  58787. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  58788. extra.height += h;
  58789. extra.children.push(html);
  58790. break;
  58791. }
  58792. }
  58793. }
  58794. function getAvailableSpace(node) {
  58795. const availableSpace = node[_xfa_object.$extra].availableSpace;
  58796. const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0;
  58797. const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0;
  58798. switch (node.layout) {
  58799. case "lr-tb":
  58800. case "rl-tb":
  58801. if (node[_xfa_object.$extra].attempt === 0) {
  58802. return {
  58803. width: availableSpace.width - marginH - node[_xfa_object.$extra].currentWidth,
  58804. height: availableSpace.height - marginV - node[_xfa_object.$extra].prevHeight
  58805. };
  58806. }
  58807. return {
  58808. width: availableSpace.width - marginH,
  58809. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  58810. };
  58811. case "rl-row":
  58812. case "row":
  58813. const width = node[_xfa_object.$extra].columnWidths.slice(node[_xfa_object.$extra].currentColumn).reduce((a, x) => a + x);
  58814. return {
  58815. width,
  58816. height: availableSpace.height - marginH
  58817. };
  58818. case "table":
  58819. case "tb":
  58820. return {
  58821. width: availableSpace.width - marginH,
  58822. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  58823. };
  58824. case "position":
  58825. default:
  58826. return availableSpace;
  58827. }
  58828. }
  58829. function getTransformedBBox(node) {
  58830. let w = node.w === "" ? NaN : node.w;
  58831. let h = node.h === "" ? NaN : node.h;
  58832. let [centerX, centerY] = [0, 0];
  58833. switch (node.anchorType || "") {
  58834. case "bottomCenter":
  58835. [centerX, centerY] = [w / 2, h];
  58836. break;
  58837. case "bottomLeft":
  58838. [centerX, centerY] = [0, h];
  58839. break;
  58840. case "bottomRight":
  58841. [centerX, centerY] = [w, h];
  58842. break;
  58843. case "middleCenter":
  58844. [centerX, centerY] = [w / 2, h / 2];
  58845. break;
  58846. case "middleLeft":
  58847. [centerX, centerY] = [0, h / 2];
  58848. break;
  58849. case "middleRight":
  58850. [centerX, centerY] = [w, h / 2];
  58851. break;
  58852. case "topCenter":
  58853. [centerX, centerY] = [w / 2, 0];
  58854. break;
  58855. case "topRight":
  58856. [centerX, centerY] = [w, 0];
  58857. break;
  58858. }
  58859. let x, y;
  58860. switch (node.rotate || 0) {
  58861. case 0:
  58862. [x, y] = [-centerX, -centerY];
  58863. break;
  58864. case 90:
  58865. [x, y] = [-centerY, centerX];
  58866. [w, h] = [h, -w];
  58867. break;
  58868. case 180:
  58869. [x, y] = [centerX, centerY];
  58870. [w, h] = [-w, -h];
  58871. break;
  58872. case 270:
  58873. [x, y] = [centerY, -centerX];
  58874. [w, h] = [-h, w];
  58875. break;
  58876. }
  58877. return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)];
  58878. }
  58879. function checkDimensions(node, space) {
  58880. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].firstUnsplittable === null) {
  58881. return true;
  58882. }
  58883. if (node.w === 0 || node.h === 0) {
  58884. return true;
  58885. }
  58886. const ERROR = 2;
  58887. const parent = node[_xfa_object.$getSubformParent]();
  58888. const attempt = parent[_xfa_object.$extra] && parent[_xfa_object.$extra].attempt || 0;
  58889. const [, y, w, h] = getTransformedBBox(node);
  58890. switch (parent.layout) {
  58891. case "lr-tb":
  58892. case "rl-tb":
  58893. if (attempt === 0) {
  58894. if (!node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58895. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  58896. return false;
  58897. }
  58898. if (node.w !== "") {
  58899. if (Math.round(w - space.width) <= ERROR) {
  58900. return true;
  58901. }
  58902. if (parent[_xfa_object.$extra].numberInLine === 0) {
  58903. return space.height > ERROR;
  58904. }
  58905. return false;
  58906. }
  58907. return space.width > ERROR;
  58908. }
  58909. if (node.w !== "") {
  58910. return Math.round(w - space.width) <= ERROR;
  58911. }
  58912. return space.width > ERROR;
  58913. }
  58914. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58915. return true;
  58916. }
  58917. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  58918. return false;
  58919. }
  58920. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  58921. return space.height > ERROR;
  58922. }
  58923. if (parent[_xfa_object.$isThereMoreWidth]()) {
  58924. return false;
  58925. }
  58926. return space.height > ERROR;
  58927. case "table":
  58928. case "tb":
  58929. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58930. return true;
  58931. }
  58932. if (node.h !== "" && !node[_xfa_object.$isSplittable]()) {
  58933. return Math.round(h - space.height) <= ERROR;
  58934. }
  58935. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  58936. return space.height > ERROR;
  58937. }
  58938. if (parent[_xfa_object.$isThereMoreWidth]()) {
  58939. return false;
  58940. }
  58941. return space.height > ERROR;
  58942. case "position":
  58943. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58944. return true;
  58945. }
  58946. if (node.h === "" || Math.round(h + y - space.height) <= ERROR) {
  58947. return true;
  58948. }
  58949. const area = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].currentContentArea;
  58950. return h + y > area.h;
  58951. case "rl-row":
  58952. case "row":
  58953. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58954. return true;
  58955. }
  58956. if (node.h !== "") {
  58957. return Math.round(h - space.height) <= ERROR;
  58958. }
  58959. return true;
  58960. default:
  58961. return true;
  58962. }
  58963. }
  58964. /***/ }),
  58965. /* 82 */
  58966. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58967. Object.defineProperty(exports, "__esModule", ({
  58968. value: true
  58969. }));
  58970. exports.computeBbox = computeBbox;
  58971. exports.createWrapper = createWrapper;
  58972. exports.fixDimensions = fixDimensions;
  58973. exports.fixTextIndent = fixTextIndent;
  58974. exports.fixURL = fixURL;
  58975. exports.isPrintOnly = isPrintOnly;
  58976. exports.layoutClass = layoutClass;
  58977. exports.layoutNode = layoutNode;
  58978. exports.measureToString = measureToString;
  58979. exports.setAccess = setAccess;
  58980. exports.setFontFamily = setFontFamily;
  58981. exports.setMinMaxDimensions = setMinMaxDimensions;
  58982. exports.setPara = setPara;
  58983. exports.toStyle = toStyle;
  58984. var _xfa_object = __w_pdfjs_require__(75);
  58985. var _util = __w_pdfjs_require__(2);
  58986. var _utils = __w_pdfjs_require__(76);
  58987. var _fonts = __w_pdfjs_require__(83);
  58988. var _text = __w_pdfjs_require__(84);
  58989. function measureToString(m) {
  58990. if (typeof m === "string") {
  58991. return "0px";
  58992. }
  58993. return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;
  58994. }
  58995. const converters = {
  58996. anchorType(node, style) {
  58997. const parent = node[_xfa_object.$getSubformParent]();
  58998. if (!parent || parent.layout && parent.layout !== "position") {
  58999. return;
  59000. }
  59001. if (!("transform" in style)) {
  59002. style.transform = "";
  59003. }
  59004. switch (node.anchorType) {
  59005. case "bottomCenter":
  59006. style.transform += "translate(-50%, -100%)";
  59007. break;
  59008. case "bottomLeft":
  59009. style.transform += "translate(0,-100%)";
  59010. break;
  59011. case "bottomRight":
  59012. style.transform += "translate(-100%,-100%)";
  59013. break;
  59014. case "middleCenter":
  59015. style.transform += "translate(-50%,-50%)";
  59016. break;
  59017. case "middleLeft":
  59018. style.transform += "translate(0,-50%)";
  59019. break;
  59020. case "middleRight":
  59021. style.transform += "translate(-100%,-50%)";
  59022. break;
  59023. case "topCenter":
  59024. style.transform += "translate(-50%,0)";
  59025. break;
  59026. case "topRight":
  59027. style.transform += "translate(-100%,0)";
  59028. break;
  59029. }
  59030. },
  59031. dimensions(node, style) {
  59032. const parent = node[_xfa_object.$getSubformParent]();
  59033. let width = node.w;
  59034. const height = node.h;
  59035. if (parent.layout && parent.layout.includes("row")) {
  59036. const extra = parent[_xfa_object.$extra];
  59037. const colSpan = node.colSpan;
  59038. let w;
  59039. if (colSpan === -1) {
  59040. w = extra.columnWidths.slice(extra.currentColumn).reduce((a, x) => a + x, 0);
  59041. extra.currentColumn = 0;
  59042. } else {
  59043. w = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, x) => a + x, 0);
  59044. extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length;
  59045. }
  59046. if (!isNaN(w)) {
  59047. width = node.w = w;
  59048. }
  59049. }
  59050. if (width !== "") {
  59051. style.width = measureToString(width);
  59052. } else {
  59053. style.width = "auto";
  59054. }
  59055. if (height !== "") {
  59056. style.height = measureToString(height);
  59057. } else {
  59058. style.height = "auto";
  59059. }
  59060. },
  59061. position(node, style) {
  59062. const parent = node[_xfa_object.$getSubformParent]();
  59063. if (parent && parent.layout && parent.layout !== "position") {
  59064. return;
  59065. }
  59066. style.position = "absolute";
  59067. style.left = measureToString(node.x);
  59068. style.top = measureToString(node.y);
  59069. },
  59070. rotate(node, style) {
  59071. if (node.rotate) {
  59072. if (!("transform" in style)) {
  59073. style.transform = "";
  59074. }
  59075. style.transform += `rotate(-${node.rotate}deg)`;
  59076. style.transformOrigin = "top left";
  59077. }
  59078. },
  59079. presence(node, style) {
  59080. switch (node.presence) {
  59081. case "invisible":
  59082. style.visibility = "hidden";
  59083. break;
  59084. case "hidden":
  59085. case "inactive":
  59086. style.display = "none";
  59087. break;
  59088. }
  59089. },
  59090. hAlign(node, style) {
  59091. if (node[_xfa_object.$nodeName] === "para") {
  59092. switch (node.hAlign) {
  59093. case "justifyAll":
  59094. style.textAlign = "justify-all";
  59095. break;
  59096. case "radix":
  59097. style.textAlign = "left";
  59098. break;
  59099. default:
  59100. style.textAlign = node.hAlign;
  59101. }
  59102. } else {
  59103. switch (node.hAlign) {
  59104. case "left":
  59105. style.alignSelf = "start";
  59106. break;
  59107. case "center":
  59108. style.alignSelf = "center";
  59109. break;
  59110. case "right":
  59111. style.alignSelf = "end";
  59112. break;
  59113. }
  59114. }
  59115. },
  59116. margin(node, style) {
  59117. if (node.margin) {
  59118. style.margin = node.margin[_xfa_object.$toStyle]().margin;
  59119. }
  59120. }
  59121. };
  59122. function setMinMaxDimensions(node, style) {
  59123. const parent = node[_xfa_object.$getSubformParent]();
  59124. if (parent.layout === "position") {
  59125. if (node.minW > 0) {
  59126. style.minWidth = measureToString(node.minW);
  59127. }
  59128. if (node.maxW > 0) {
  59129. style.maxWidth = measureToString(node.maxW);
  59130. }
  59131. if (node.minH > 0) {
  59132. style.minHeight = measureToString(node.minH);
  59133. }
  59134. if (node.maxH > 0) {
  59135. style.maxHeight = measureToString(node.maxH);
  59136. }
  59137. }
  59138. }
  59139. function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) {
  59140. const measure = new _text.TextMeasure(xfaFont, margin, lineHeight, fontFinder);
  59141. if (typeof text === "string") {
  59142. measure.addString(text);
  59143. } else {
  59144. text[_xfa_object.$pushGlyphs](measure);
  59145. }
  59146. return measure.compute(width);
  59147. }
  59148. function layoutNode(node, availableSpace) {
  59149. let height = null;
  59150. let width = null;
  59151. let isBroken = false;
  59152. if ((!node.w || !node.h) && node.value) {
  59153. let marginH = 0;
  59154. let marginV = 0;
  59155. if (node.margin) {
  59156. marginH = node.margin.leftInset + node.margin.rightInset;
  59157. marginV = node.margin.topInset + node.margin.bottomInset;
  59158. }
  59159. let lineHeight = null;
  59160. let margin = null;
  59161. if (node.para) {
  59162. margin = Object.create(null);
  59163. lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight;
  59164. margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove;
  59165. margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow;
  59166. margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft;
  59167. margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight;
  59168. }
  59169. let font = node.font;
  59170. if (!font) {
  59171. const root = node[_xfa_object.$getTemplateRoot]();
  59172. let parent = node[_xfa_object.$getParent]();
  59173. while (parent && parent !== root) {
  59174. if (parent.font) {
  59175. font = parent.font;
  59176. break;
  59177. }
  59178. parent = parent[_xfa_object.$getParent]();
  59179. }
  59180. }
  59181. const maxWidth = (node.w || availableSpace.width) - marginH;
  59182. const fontFinder = node[_xfa_object.$globalData].fontFinder;
  59183. if (node.value.exData && node.value.exData[_xfa_object.$content] && node.value.exData.contentType === "text/html") {
  59184. const res = layoutText(node.value.exData[_xfa_object.$content], font, margin, lineHeight, fontFinder, maxWidth);
  59185. width = res.width;
  59186. height = res.height;
  59187. isBroken = res.isBroken;
  59188. } else {
  59189. const text = node.value[_xfa_object.$text]();
  59190. if (text) {
  59191. const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth);
  59192. width = res.width;
  59193. height = res.height;
  59194. isBroken = res.isBroken;
  59195. }
  59196. }
  59197. if (width !== null && !node.w) {
  59198. width += marginH;
  59199. }
  59200. if (height !== null && !node.h) {
  59201. height += marginV;
  59202. }
  59203. }
  59204. return {
  59205. w: width,
  59206. h: height,
  59207. isBroken
  59208. };
  59209. }
  59210. function computeBbox(node, html, availableSpace) {
  59211. let bbox;
  59212. if (node.w !== "" && node.h !== "") {
  59213. bbox = [node.x, node.y, node.w, node.h];
  59214. } else {
  59215. if (!availableSpace) {
  59216. return null;
  59217. }
  59218. let width = node.w;
  59219. if (width === "") {
  59220. if (node.maxW === 0) {
  59221. const parent = node[_xfa_object.$getSubformParent]();
  59222. if (parent.layout === "position" && parent.w !== "") {
  59223. width = 0;
  59224. } else {
  59225. width = node.minW;
  59226. }
  59227. } else {
  59228. width = Math.min(node.maxW, availableSpace.width);
  59229. }
  59230. html.attributes.style.width = measureToString(width);
  59231. }
  59232. let height = node.h;
  59233. if (height === "") {
  59234. if (node.maxH === 0) {
  59235. const parent = node[_xfa_object.$getSubformParent]();
  59236. if (parent.layout === "position" && parent.h !== "") {
  59237. height = 0;
  59238. } else {
  59239. height = node.minH;
  59240. }
  59241. } else {
  59242. height = Math.min(node.maxH, availableSpace.height);
  59243. }
  59244. html.attributes.style.height = measureToString(height);
  59245. }
  59246. bbox = [node.x, node.y, width, height];
  59247. }
  59248. return bbox;
  59249. }
  59250. function fixDimensions(node) {
  59251. const parent = node[_xfa_object.$getSubformParent]();
  59252. if (parent.layout && parent.layout.includes("row")) {
  59253. const extra = parent[_xfa_object.$extra];
  59254. const colSpan = node.colSpan;
  59255. let width;
  59256. if (colSpan === -1) {
  59257. width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0);
  59258. } else {
  59259. width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0);
  59260. }
  59261. if (!isNaN(width)) {
  59262. node.w = width;
  59263. }
  59264. }
  59265. if (parent.layout && parent.layout !== "position") {
  59266. node.x = node.y = 0;
  59267. }
  59268. if (node.layout === "table") {
  59269. if (node.w === "" && Array.isArray(node.columnWidths)) {
  59270. node.w = node.columnWidths.reduce((a, x) => a + x, 0);
  59271. }
  59272. }
  59273. }
  59274. function layoutClass(node) {
  59275. switch (node.layout) {
  59276. case "position":
  59277. return "xfaPosition";
  59278. case "lr-tb":
  59279. return "xfaLrTb";
  59280. case "rl-row":
  59281. return "xfaRlRow";
  59282. case "rl-tb":
  59283. return "xfaRlTb";
  59284. case "row":
  59285. return "xfaRow";
  59286. case "table":
  59287. return "xfaTable";
  59288. case "tb":
  59289. return "xfaTb";
  59290. default:
  59291. return "xfaPosition";
  59292. }
  59293. }
  59294. function toStyle(node, ...names) {
  59295. const style = Object.create(null);
  59296. for (const name of names) {
  59297. const value = node[name];
  59298. if (value === null) {
  59299. continue;
  59300. }
  59301. if (converters.hasOwnProperty(name)) {
  59302. converters[name](node, style);
  59303. continue;
  59304. }
  59305. if (value instanceof _xfa_object.XFAObject) {
  59306. const newStyle = value[_xfa_object.$toStyle]();
  59307. if (newStyle) {
  59308. Object.assign(style, newStyle);
  59309. } else {
  59310. (0, _util.warn)(`(DEBUG) - XFA - style for ${name} not implemented yet`);
  59311. }
  59312. }
  59313. }
  59314. return style;
  59315. }
  59316. function createWrapper(node, html) {
  59317. const {
  59318. attributes
  59319. } = html;
  59320. const {
  59321. style
  59322. } = attributes;
  59323. const wrapper = {
  59324. name: "div",
  59325. attributes: {
  59326. class: ["xfaWrapper"],
  59327. style: Object.create(null)
  59328. },
  59329. children: []
  59330. };
  59331. attributes.class.push("xfaWrapped");
  59332. if (node.border) {
  59333. const {
  59334. widths,
  59335. insets
  59336. } = node.border[_xfa_object.$extra];
  59337. let width, height;
  59338. let top = insets[0];
  59339. let left = insets[3];
  59340. const insetsH = insets[0] + insets[2];
  59341. const insetsW = insets[1] + insets[3];
  59342. switch (node.border.hand) {
  59343. case "even":
  59344. top -= widths[0] / 2;
  59345. left -= widths[3] / 2;
  59346. width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
  59347. height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;
  59348. break;
  59349. case "left":
  59350. top -= widths[0];
  59351. left -= widths[3];
  59352. width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
  59353. height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
  59354. break;
  59355. case "right":
  59356. width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
  59357. height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
  59358. break;
  59359. }
  59360. const classNames = ["xfaBorder"];
  59361. if (isPrintOnly(node.border)) {
  59362. classNames.push("xfaPrintOnly");
  59363. }
  59364. const border = {
  59365. name: "div",
  59366. attributes: {
  59367. class: classNames,
  59368. style: {
  59369. top: `${top}px`,
  59370. left: `${left}px`,
  59371. width,
  59372. height
  59373. }
  59374. },
  59375. children: []
  59376. };
  59377. for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) {
  59378. if (style[key] !== undefined) {
  59379. border.attributes.style[key] = style[key];
  59380. delete style[key];
  59381. }
  59382. }
  59383. wrapper.children.push(border, html);
  59384. } else {
  59385. wrapper.children.push(html);
  59386. }
  59387. for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) {
  59388. if (style[key] !== undefined) {
  59389. wrapper.attributes.style[key] = style[key];
  59390. delete style[key];
  59391. }
  59392. }
  59393. if (style.position === "absolute") {
  59394. wrapper.attributes.style.position = "absolute";
  59395. } else {
  59396. wrapper.attributes.style.position = "relative";
  59397. }
  59398. delete style.position;
  59399. if (style.alignSelf) {
  59400. wrapper.attributes.style.alignSelf = style.alignSelf;
  59401. delete style.alignSelf;
  59402. }
  59403. return wrapper;
  59404. }
  59405. function fixTextIndent(styles) {
  59406. const indent = (0, _utils.getMeasurement)(styles.textIndent, "0px");
  59407. if (indent >= 0) {
  59408. return;
  59409. }
  59410. const align = styles.textAlign === "right" ? "right" : "left";
  59411. const name = "padding" + (align === "left" ? "Left" : "Right");
  59412. const padding = (0, _utils.getMeasurement)(styles[name], "0px");
  59413. styles[name] = `${padding - indent}px`;
  59414. }
  59415. function setAccess(node, classNames) {
  59416. switch (node.access) {
  59417. case "nonInteractive":
  59418. classNames.push("xfaNonInteractive");
  59419. break;
  59420. case "readOnly":
  59421. classNames.push("xfaReadOnly");
  59422. break;
  59423. case "protected":
  59424. classNames.push("xfaDisabled");
  59425. break;
  59426. }
  59427. }
  59428. function isPrintOnly(node) {
  59429. return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print";
  59430. }
  59431. function getCurrentPara(node) {
  59432. const stack = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].paraStack;
  59433. return stack.length ? stack.at(-1) : null;
  59434. }
  59435. function setPara(node, nodeStyle, value) {
  59436. if (value.attributes.class && value.attributes.class.includes("xfaRich")) {
  59437. if (nodeStyle) {
  59438. if (node.h === "") {
  59439. nodeStyle.height = "auto";
  59440. }
  59441. if (node.w === "") {
  59442. nodeStyle.width = "auto";
  59443. }
  59444. }
  59445. const para = getCurrentPara(node);
  59446. if (para) {
  59447. const valueStyle = value.attributes.style;
  59448. valueStyle.display = "flex";
  59449. valueStyle.flexDirection = "column";
  59450. switch (para.vAlign) {
  59451. case "top":
  59452. valueStyle.justifyContent = "start";
  59453. break;
  59454. case "bottom":
  59455. valueStyle.justifyContent = "end";
  59456. break;
  59457. case "middle":
  59458. valueStyle.justifyContent = "center";
  59459. break;
  59460. }
  59461. const paraStyle = para[_xfa_object.$toStyle]();
  59462. for (const [key, val] of Object.entries(paraStyle)) {
  59463. if (!(key in valueStyle)) {
  59464. valueStyle[key] = val;
  59465. }
  59466. }
  59467. }
  59468. }
  59469. }
  59470. function setFontFamily(xfaFont, node, fontFinder, style) {
  59471. if (!fontFinder) {
  59472. delete style.fontFamily;
  59473. return;
  59474. }
  59475. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  59476. style.fontFamily = `"${name}"`;
  59477. const typeface = fontFinder.find(name);
  59478. if (typeface) {
  59479. const {
  59480. fontFamily
  59481. } = typeface.regular.cssFontInfo;
  59482. if (fontFamily !== name) {
  59483. style.fontFamily = `"${fontFamily}"`;
  59484. }
  59485. const para = getCurrentPara(node);
  59486. if (para && para.lineHeight !== "") {
  59487. return;
  59488. }
  59489. if (style.lineHeight) {
  59490. return;
  59491. }
  59492. const pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  59493. if (pdfFont) {
  59494. style.lineHeight = Math.max(1.2, pdfFont.lineHeight);
  59495. }
  59496. }
  59497. }
  59498. function fixURL(str) {
  59499. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(str, null, {
  59500. addDefaultProtocol: true,
  59501. tryConvertEncoding: true
  59502. });
  59503. return absoluteUrl ? absoluteUrl.href : null;
  59504. }
  59505. /***/ }),
  59506. /* 83 */
  59507. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59508. Object.defineProperty(exports, "__esModule", ({
  59509. value: true
  59510. }));
  59511. exports.FontFinder = void 0;
  59512. exports.getMetrics = getMetrics;
  59513. exports.selectFont = selectFont;
  59514. var _xfa_object = __w_pdfjs_require__(75);
  59515. var _utils = __w_pdfjs_require__(76);
  59516. var _util = __w_pdfjs_require__(2);
  59517. class FontFinder {
  59518. constructor(pdfFonts) {
  59519. this.fonts = new Map();
  59520. this.cache = new Map();
  59521. this.warned = new Set();
  59522. this.defaultFont = null;
  59523. this.add(pdfFonts);
  59524. }
  59525. add(pdfFonts, reallyMissingFonts = null) {
  59526. for (const pdfFont of pdfFonts) {
  59527. this.addPdfFont(pdfFont);
  59528. }
  59529. for (const pdfFont of this.fonts.values()) {
  59530. if (!pdfFont.regular) {
  59531. pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic;
  59532. }
  59533. }
  59534. if (!reallyMissingFonts || reallyMissingFonts.size === 0) {
  59535. return;
  59536. }
  59537. const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA");
  59538. for (const missing of reallyMissingFonts) {
  59539. this.fonts.set(missing, myriad);
  59540. }
  59541. }
  59542. addPdfFont(pdfFont) {
  59543. const cssFontInfo = pdfFont.cssFontInfo;
  59544. const name = cssFontInfo.fontFamily;
  59545. let font = this.fonts.get(name);
  59546. if (!font) {
  59547. font = Object.create(null);
  59548. this.fonts.set(name, font);
  59549. if (!this.defaultFont) {
  59550. this.defaultFont = font;
  59551. }
  59552. }
  59553. let property = "";
  59554. const fontWeight = parseFloat(cssFontInfo.fontWeight);
  59555. if (parseFloat(cssFontInfo.italicAngle) !== 0) {
  59556. property = fontWeight >= 700 ? "bolditalic" : "italic";
  59557. } else if (fontWeight >= 700) {
  59558. property = "bold";
  59559. }
  59560. if (!property) {
  59561. if (pdfFont.name.includes("Bold") || pdfFont.psName && pdfFont.psName.includes("Bold")) {
  59562. property = "bold";
  59563. }
  59564. if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName && (pdfFont.psName.includes("Italic") || pdfFont.psName.endsWith("It"))) {
  59565. property += "italic";
  59566. }
  59567. }
  59568. if (!property) {
  59569. property = "regular";
  59570. }
  59571. font[property] = pdfFont;
  59572. }
  59573. getDefault() {
  59574. return this.defaultFont;
  59575. }
  59576. find(fontName, mustWarn = true) {
  59577. let font = this.fonts.get(fontName) || this.cache.get(fontName);
  59578. if (font) {
  59579. return font;
  59580. }
  59581. const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi;
  59582. let name = fontName.replace(pattern, "");
  59583. font = this.fonts.get(name);
  59584. if (font) {
  59585. this.cache.set(fontName, font);
  59586. return font;
  59587. }
  59588. name = name.toLowerCase();
  59589. const maybe = [];
  59590. for (const [family, pdfFont] of this.fonts.entries()) {
  59591. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  59592. maybe.push(pdfFont);
  59593. }
  59594. }
  59595. if (maybe.length === 0) {
  59596. for (const [, pdfFont] of this.fonts.entries()) {
  59597. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  59598. maybe.push(pdfFont);
  59599. }
  59600. }
  59601. }
  59602. if (maybe.length === 0) {
  59603. name = name.replace(/psmt|mt/gi, "");
  59604. for (const [family, pdfFont] of this.fonts.entries()) {
  59605. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  59606. maybe.push(pdfFont);
  59607. }
  59608. }
  59609. }
  59610. if (maybe.length === 0) {
  59611. for (const pdfFont of this.fonts.values()) {
  59612. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  59613. maybe.push(pdfFont);
  59614. }
  59615. }
  59616. }
  59617. if (maybe.length >= 1) {
  59618. if (maybe.length !== 1 && mustWarn) {
  59619. (0, _util.warn)(`XFA - Too many choices to guess the correct font: ${fontName}`);
  59620. }
  59621. this.cache.set(fontName, maybe[0]);
  59622. return maybe[0];
  59623. }
  59624. if (mustWarn && !this.warned.has(fontName)) {
  59625. this.warned.add(fontName);
  59626. (0, _util.warn)(`XFA - Cannot find the font: ${fontName}`);
  59627. }
  59628. return null;
  59629. }
  59630. }
  59631. exports.FontFinder = FontFinder;
  59632. function selectFont(xfaFont, typeface) {
  59633. if (xfaFont.posture === "italic") {
  59634. if (xfaFont.weight === "bold") {
  59635. return typeface.bolditalic;
  59636. }
  59637. return typeface.italic;
  59638. } else if (xfaFont.weight === "bold") {
  59639. return typeface.bold;
  59640. }
  59641. return typeface.regular;
  59642. }
  59643. function getMetrics(xfaFont, real = false) {
  59644. let pdfFont = null;
  59645. if (xfaFont) {
  59646. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  59647. const typeface = xfaFont[_xfa_object.$globalData].fontFinder.find(name);
  59648. pdfFont = selectFont(xfaFont, typeface);
  59649. }
  59650. if (!pdfFont) {
  59651. return {
  59652. lineHeight: 12,
  59653. lineGap: 2,
  59654. lineNoGap: 10
  59655. };
  59656. }
  59657. const size = xfaFont.size || 10;
  59658. const lineHeight = pdfFont.lineHeight ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight) : 1.2;
  59659. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  59660. return {
  59661. lineHeight: lineHeight * size,
  59662. lineGap: lineGap * size,
  59663. lineNoGap: Math.max(1, lineHeight - lineGap) * size
  59664. };
  59665. }
  59666. /***/ }),
  59667. /* 84 */
  59668. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59669. Object.defineProperty(exports, "__esModule", ({
  59670. value: true
  59671. }));
  59672. exports.TextMeasure = void 0;
  59673. var _fonts = __w_pdfjs_require__(83);
  59674. const WIDTH_FACTOR = 1.02;
  59675. class FontInfo {
  59676. constructor(xfaFont, margin, lineHeight, fontFinder) {
  59677. this.lineHeight = lineHeight;
  59678. this.paraMargin = margin || {
  59679. top: 0,
  59680. bottom: 0,
  59681. left: 0,
  59682. right: 0
  59683. };
  59684. if (!xfaFont) {
  59685. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  59686. return;
  59687. }
  59688. this.xfaFont = {
  59689. typeface: xfaFont.typeface,
  59690. posture: xfaFont.posture,
  59691. weight: xfaFont.weight,
  59692. size: xfaFont.size,
  59693. letterSpacing: xfaFont.letterSpacing
  59694. };
  59695. const typeface = fontFinder.find(xfaFont.typeface);
  59696. if (!typeface) {
  59697. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  59698. return;
  59699. }
  59700. this.pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  59701. if (!this.pdfFont) {
  59702. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  59703. }
  59704. }
  59705. defaultFont(fontFinder) {
  59706. const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault();
  59707. if (font && font.regular) {
  59708. const pdfFont = font.regular;
  59709. const info = pdfFont.cssFontInfo;
  59710. const xfaFont = {
  59711. typeface: info.fontFamily,
  59712. posture: "normal",
  59713. weight: "normal",
  59714. size: 10,
  59715. letterSpacing: 0
  59716. };
  59717. return [pdfFont, xfaFont];
  59718. }
  59719. const xfaFont = {
  59720. typeface: "Courier",
  59721. posture: "normal",
  59722. weight: "normal",
  59723. size: 10,
  59724. letterSpacing: 0
  59725. };
  59726. return [null, xfaFont];
  59727. }
  59728. }
  59729. class FontSelector {
  59730. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) {
  59731. this.fontFinder = fontFinder;
  59732. this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)];
  59733. }
  59734. pushData(xfaFont, margin, lineHeight) {
  59735. const lastFont = this.stack.at(-1);
  59736. for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) {
  59737. if (!xfaFont[name]) {
  59738. xfaFont[name] = lastFont.xfaFont[name];
  59739. }
  59740. }
  59741. for (const name of ["top", "bottom", "left", "right"]) {
  59742. if (isNaN(margin[name])) {
  59743. margin[name] = lastFont.paraMargin[name];
  59744. }
  59745. }
  59746. const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder);
  59747. if (!fontInfo.pdfFont) {
  59748. fontInfo.pdfFont = lastFont.pdfFont;
  59749. }
  59750. this.stack.push(fontInfo);
  59751. }
  59752. popFont() {
  59753. this.stack.pop();
  59754. }
  59755. topFont() {
  59756. return this.stack.at(-1);
  59757. }
  59758. }
  59759. class TextMeasure {
  59760. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) {
  59761. this.glyphs = [];
  59762. this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts);
  59763. this.extraHeight = 0;
  59764. }
  59765. pushData(xfaFont, margin, lineHeight) {
  59766. this.fontSelector.pushData(xfaFont, margin, lineHeight);
  59767. }
  59768. popFont(xfaFont) {
  59769. return this.fontSelector.popFont();
  59770. }
  59771. addPara() {
  59772. const lastFont = this.fontSelector.topFont();
  59773. this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom;
  59774. }
  59775. addString(str) {
  59776. if (!str) {
  59777. return;
  59778. }
  59779. const lastFont = this.fontSelector.topFont();
  59780. const fontSize = lastFont.xfaFont.size;
  59781. if (lastFont.pdfFont) {
  59782. const letterSpacing = lastFont.xfaFont.letterSpacing;
  59783. const pdfFont = lastFont.pdfFont;
  59784. const fontLineHeight = pdfFont.lineHeight || 1.2;
  59785. const lineHeight = lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize;
  59786. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  59787. const noGap = fontLineHeight - lineGap;
  59788. const firstLineHeight = Math.max(1, noGap) * fontSize;
  59789. const scale = fontSize / 1000;
  59790. const fallbackWidth = pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width;
  59791. for (const line of str.split(/[\u2029\n]/)) {
  59792. const encodedLine = pdfFont.encodeString(line).join("");
  59793. const glyphs = pdfFont.charsToGlyphs(encodedLine);
  59794. for (const glyph of glyphs) {
  59795. const width = glyph.width || fallbackWidth;
  59796. this.glyphs.push([width * scale + letterSpacing, lineHeight, firstLineHeight, glyph.unicode, false]);
  59797. }
  59798. this.glyphs.push([0, 0, 0, "\n", true]);
  59799. }
  59800. this.glyphs.pop();
  59801. return;
  59802. }
  59803. for (const line of str.split(/[\u2029\n]/)) {
  59804. for (const char of line.split("")) {
  59805. this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]);
  59806. }
  59807. this.glyphs.push([0, 0, 0, "\n", true]);
  59808. }
  59809. this.glyphs.pop();
  59810. }
  59811. compute(maxWidth) {
  59812. let lastSpacePos = -1,
  59813. lastSpaceWidth = 0,
  59814. width = 0,
  59815. height = 0,
  59816. currentLineWidth = 0,
  59817. currentLineHeight = 0;
  59818. let isBroken = false;
  59819. let isFirstLine = true;
  59820. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  59821. const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] = this.glyphs[i];
  59822. const isSpace = char === " ";
  59823. const glyphHeight = isFirstLine ? firstLineHeight : lineHeight;
  59824. if (isEOL) {
  59825. width = Math.max(width, currentLineWidth);
  59826. currentLineWidth = 0;
  59827. height += currentLineHeight;
  59828. currentLineHeight = glyphHeight;
  59829. lastSpacePos = -1;
  59830. lastSpaceWidth = 0;
  59831. isFirstLine = false;
  59832. continue;
  59833. }
  59834. if (isSpace) {
  59835. if (currentLineWidth + glyphWidth > maxWidth) {
  59836. width = Math.max(width, currentLineWidth);
  59837. currentLineWidth = 0;
  59838. height += currentLineHeight;
  59839. currentLineHeight = glyphHeight;
  59840. lastSpacePos = -1;
  59841. lastSpaceWidth = 0;
  59842. isBroken = true;
  59843. isFirstLine = false;
  59844. } else {
  59845. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  59846. lastSpaceWidth = currentLineWidth;
  59847. currentLineWidth += glyphWidth;
  59848. lastSpacePos = i;
  59849. }
  59850. continue;
  59851. }
  59852. if (currentLineWidth + glyphWidth > maxWidth) {
  59853. height += currentLineHeight;
  59854. currentLineHeight = glyphHeight;
  59855. if (lastSpacePos !== -1) {
  59856. i = lastSpacePos;
  59857. width = Math.max(width, lastSpaceWidth);
  59858. currentLineWidth = 0;
  59859. lastSpacePos = -1;
  59860. lastSpaceWidth = 0;
  59861. } else {
  59862. width = Math.max(width, currentLineWidth);
  59863. currentLineWidth = glyphWidth;
  59864. }
  59865. isBroken = true;
  59866. isFirstLine = false;
  59867. continue;
  59868. }
  59869. currentLineWidth += glyphWidth;
  59870. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  59871. }
  59872. width = Math.max(width, currentLineWidth);
  59873. height += currentLineHeight + this.extraHeight;
  59874. return {
  59875. width: WIDTH_FACTOR * width,
  59876. height,
  59877. isBroken
  59878. };
  59879. }
  59880. }
  59881. exports.TextMeasure = TextMeasure;
  59882. /***/ }),
  59883. /* 85 */
  59884. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59885. Object.defineProperty(exports, "__esModule", ({
  59886. value: true
  59887. }));
  59888. exports.DataHandler = void 0;
  59889. var _xfa_object = __w_pdfjs_require__(75);
  59890. class DataHandler {
  59891. constructor(root, data) {
  59892. this.data = data;
  59893. this.dataset = root.datasets || null;
  59894. }
  59895. serialize(storage) {
  59896. const stack = [[-1, this.data[_xfa_object.$getChildren]()]];
  59897. while (stack.length > 0) {
  59898. const last = stack.at(-1);
  59899. const [i, children] = last;
  59900. if (i + 1 === children.length) {
  59901. stack.pop();
  59902. continue;
  59903. }
  59904. const child = children[++last[0]];
  59905. const storageEntry = storage.get(child[_xfa_object.$uid]);
  59906. if (storageEntry) {
  59907. child[_xfa_object.$setValue](storageEntry);
  59908. } else {
  59909. const attributes = child[_xfa_object.$getAttributes]();
  59910. for (const value of attributes.values()) {
  59911. const entry = storage.get(value[_xfa_object.$uid]);
  59912. if (entry) {
  59913. value[_xfa_object.$setValue](entry);
  59914. break;
  59915. }
  59916. }
  59917. }
  59918. const nodes = child[_xfa_object.$getChildren]();
  59919. if (nodes.length > 0) {
  59920. stack.push([-1, nodes]);
  59921. }
  59922. }
  59923. const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`];
  59924. if (this.dataset) {
  59925. for (const child of this.dataset[_xfa_object.$getChildren]()) {
  59926. if (child[_xfa_object.$nodeName] !== "data") {
  59927. child[_xfa_object.$toString](buf);
  59928. }
  59929. }
  59930. }
  59931. this.data[_xfa_object.$toString](buf);
  59932. buf.push("</xfa:datasets>");
  59933. return buf.join("");
  59934. }
  59935. }
  59936. exports.DataHandler = DataHandler;
  59937. /***/ }),
  59938. /* 86 */
  59939. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59940. Object.defineProperty(exports, "__esModule", ({
  59941. value: true
  59942. }));
  59943. exports.XFAParser = void 0;
  59944. var _xfa_object = __w_pdfjs_require__(75);
  59945. var _xml_parser = __w_pdfjs_require__(64);
  59946. var _builder = __w_pdfjs_require__(87);
  59947. var _util = __w_pdfjs_require__(2);
  59948. class XFAParser extends _xml_parser.XMLParserBase {
  59949. constructor(rootNameSpace = null, richText = false) {
  59950. super();
  59951. this._builder = new _builder.Builder(rootNameSpace);
  59952. this._stack = [];
  59953. this._globalData = {
  59954. usedTypefaces: new Set()
  59955. };
  59956. this._ids = new Map();
  59957. this._current = this._builder.buildRoot(this._ids);
  59958. this._errorCode = _xml_parser.XMLParserErrorCode.NoError;
  59959. this._whiteRegex = /^\s+$/;
  59960. this._nbsps = /\xa0+/g;
  59961. this._richText = richText;
  59962. }
  59963. parse(data) {
  59964. this.parseXml(data);
  59965. if (this._errorCode !== _xml_parser.XMLParserErrorCode.NoError) {
  59966. return undefined;
  59967. }
  59968. this._current[_xfa_object.$finalize]();
  59969. return this._current.element;
  59970. }
  59971. onText(text) {
  59972. text = text.replace(this._nbsps, match => match.slice(1) + " ");
  59973. if (this._richText || this._current[_xfa_object.$acceptWhitespace]()) {
  59974. this._current[_xfa_object.$onText](text, this._richText);
  59975. return;
  59976. }
  59977. if (this._whiteRegex.test(text)) {
  59978. return;
  59979. }
  59980. this._current[_xfa_object.$onText](text.trim());
  59981. }
  59982. onCdata(text) {
  59983. this._current[_xfa_object.$onText](text);
  59984. }
  59985. _mkAttributes(attributes, tagName) {
  59986. let namespace = null;
  59987. let prefixes = null;
  59988. const attributeObj = Object.create({});
  59989. for (const {
  59990. name,
  59991. value
  59992. } of attributes) {
  59993. if (name === "xmlns") {
  59994. if (!namespace) {
  59995. namespace = value;
  59996. } else {
  59997. (0, _util.warn)(`XFA - multiple namespace definition in <${tagName}>`);
  59998. }
  59999. } else if (name.startsWith("xmlns:")) {
  60000. const prefix = name.substring("xmlns:".length);
  60001. if (!prefixes) {
  60002. prefixes = [];
  60003. }
  60004. prefixes.push({
  60005. prefix,
  60006. value
  60007. });
  60008. } else {
  60009. const i = name.indexOf(":");
  60010. if (i === -1) {
  60011. attributeObj[name] = value;
  60012. } else {
  60013. let nsAttrs = attributeObj[_xfa_object.$nsAttributes];
  60014. if (!nsAttrs) {
  60015. nsAttrs = attributeObj[_xfa_object.$nsAttributes] = Object.create(null);
  60016. }
  60017. const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
  60018. let attrs = nsAttrs[ns];
  60019. if (!attrs) {
  60020. attrs = nsAttrs[ns] = Object.create(null);
  60021. }
  60022. attrs[attrName] = value;
  60023. }
  60024. }
  60025. }
  60026. return [namespace, prefixes, attributeObj];
  60027. }
  60028. _getNameAndPrefix(name, nsAgnostic) {
  60029. const i = name.indexOf(":");
  60030. if (i === -1) {
  60031. return [name, null];
  60032. }
  60033. return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)];
  60034. }
  60035. onBeginElement(tagName, attributes, isEmpty) {
  60036. const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName);
  60037. const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic());
  60038. const node = this._builder.build({
  60039. nsPrefix,
  60040. name,
  60041. attributes: attributesObj,
  60042. namespace,
  60043. prefixes
  60044. });
  60045. node[_xfa_object.$globalData] = this._globalData;
  60046. if (isEmpty) {
  60047. node[_xfa_object.$finalize]();
  60048. if (this._current[_xfa_object.$onChild](node)) {
  60049. node[_xfa_object.$setId](this._ids);
  60050. }
  60051. node[_xfa_object.$clean](this._builder);
  60052. return;
  60053. }
  60054. this._stack.push(this._current);
  60055. this._current = node;
  60056. }
  60057. onEndElement(name) {
  60058. const node = this._current;
  60059. if (node[_xfa_object.$isCDATAXml]() && typeof node[_xfa_object.$content] === "string") {
  60060. const parser = new XFAParser();
  60061. parser._globalData = this._globalData;
  60062. const root = parser.parse(node[_xfa_object.$content]);
  60063. node[_xfa_object.$content] = null;
  60064. node[_xfa_object.$onChild](root);
  60065. }
  60066. node[_xfa_object.$finalize]();
  60067. this._current = this._stack.pop();
  60068. if (this._current[_xfa_object.$onChild](node)) {
  60069. node[_xfa_object.$setId](this._ids);
  60070. }
  60071. node[_xfa_object.$clean](this._builder);
  60072. }
  60073. onError(code) {
  60074. this._errorCode = code;
  60075. }
  60076. }
  60077. exports.XFAParser = XFAParser;
  60078. /***/ }),
  60079. /* 87 */
  60080. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60081. Object.defineProperty(exports, "__esModule", ({
  60082. value: true
  60083. }));
  60084. exports.Builder = void 0;
  60085. var _namespaces = __w_pdfjs_require__(77);
  60086. var _xfa_object = __w_pdfjs_require__(75);
  60087. var _setup = __w_pdfjs_require__(88);
  60088. var _template = __w_pdfjs_require__(80);
  60089. var _unknown = __w_pdfjs_require__(97);
  60090. var _util = __w_pdfjs_require__(2);
  60091. class Root extends _xfa_object.XFAObject {
  60092. constructor(ids) {
  60093. super(-1, "root", Object.create(null));
  60094. this.element = null;
  60095. this[_xfa_object.$ids] = ids;
  60096. }
  60097. [_xfa_object.$onChild](child) {
  60098. this.element = child;
  60099. return true;
  60100. }
  60101. [_xfa_object.$finalize]() {
  60102. super[_xfa_object.$finalize]();
  60103. if (this.element.template instanceof _template.Template) {
  60104. this[_xfa_object.$ids].set(_xfa_object.$root, this.element);
  60105. this.element.template[_xfa_object.$resolvePrototypes](this[_xfa_object.$ids]);
  60106. this.element.template[_xfa_object.$ids] = this[_xfa_object.$ids];
  60107. }
  60108. }
  60109. }
  60110. class Empty extends _xfa_object.XFAObject {
  60111. constructor() {
  60112. super(-1, "", Object.create(null));
  60113. }
  60114. [_xfa_object.$onChild](_) {
  60115. return false;
  60116. }
  60117. }
  60118. class Builder {
  60119. constructor(rootNameSpace = null) {
  60120. this._namespaceStack = [];
  60121. this._nsAgnosticLevel = 0;
  60122. this._namespacePrefixes = new Map();
  60123. this._namespaces = new Map();
  60124. this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(({
  60125. id
  60126. }) => id));
  60127. this._currentNamespace = rootNameSpace || new _unknown.UnknownNamespace(++this._nextNsId);
  60128. }
  60129. buildRoot(ids) {
  60130. return new Root(ids);
  60131. }
  60132. build({
  60133. nsPrefix,
  60134. name,
  60135. attributes,
  60136. namespace,
  60137. prefixes
  60138. }) {
  60139. const hasNamespaceDef = namespace !== null;
  60140. if (hasNamespaceDef) {
  60141. this._namespaceStack.push(this._currentNamespace);
  60142. this._currentNamespace = this._searchNamespace(namespace);
  60143. }
  60144. if (prefixes) {
  60145. this._addNamespacePrefix(prefixes);
  60146. }
  60147. if (attributes.hasOwnProperty(_xfa_object.$nsAttributes)) {
  60148. const dataTemplate = _setup.NamespaceSetUp.datasets;
  60149. const nsAttrs = attributes[_xfa_object.$nsAttributes];
  60150. let xfaAttrs = null;
  60151. for (const [ns, attrs] of Object.entries(nsAttrs)) {
  60152. const nsToUse = this._getNamespaceToUse(ns);
  60153. if (nsToUse === dataTemplate) {
  60154. xfaAttrs = {
  60155. xfa: attrs
  60156. };
  60157. break;
  60158. }
  60159. }
  60160. if (xfaAttrs) {
  60161. attributes[_xfa_object.$nsAttributes] = xfaAttrs;
  60162. } else {
  60163. delete attributes[_xfa_object.$nsAttributes];
  60164. }
  60165. }
  60166. const namespaceToUse = this._getNamespaceToUse(nsPrefix);
  60167. const node = namespaceToUse && namespaceToUse[_namespaces.$buildXFAObject](name, attributes) || new Empty();
  60168. if (node[_xfa_object.$isNsAgnostic]()) {
  60169. this._nsAgnosticLevel++;
  60170. }
  60171. if (hasNamespaceDef || prefixes || node[_xfa_object.$isNsAgnostic]()) {
  60172. node[_xfa_object.$cleanup] = {
  60173. hasNamespace: hasNamespaceDef,
  60174. prefixes,
  60175. nsAgnostic: node[_xfa_object.$isNsAgnostic]()
  60176. };
  60177. }
  60178. return node;
  60179. }
  60180. isNsAgnostic() {
  60181. return this._nsAgnosticLevel > 0;
  60182. }
  60183. _searchNamespace(nsName) {
  60184. let ns = this._namespaces.get(nsName);
  60185. if (ns) {
  60186. return ns;
  60187. }
  60188. for (const [name, {
  60189. check
  60190. }] of Object.entries(_namespaces.NamespaceIds)) {
  60191. if (check(nsName)) {
  60192. ns = _setup.NamespaceSetUp[name];
  60193. if (ns) {
  60194. this._namespaces.set(nsName, ns);
  60195. return ns;
  60196. }
  60197. break;
  60198. }
  60199. }
  60200. ns = new _unknown.UnknownNamespace(++this._nextNsId);
  60201. this._namespaces.set(nsName, ns);
  60202. return ns;
  60203. }
  60204. _addNamespacePrefix(prefixes) {
  60205. for (const {
  60206. prefix,
  60207. value
  60208. } of prefixes) {
  60209. const namespace = this._searchNamespace(value);
  60210. let prefixStack = this._namespacePrefixes.get(prefix);
  60211. if (!prefixStack) {
  60212. prefixStack = [];
  60213. this._namespacePrefixes.set(prefix, prefixStack);
  60214. }
  60215. prefixStack.push(namespace);
  60216. }
  60217. }
  60218. _getNamespaceToUse(prefix) {
  60219. if (!prefix) {
  60220. return this._currentNamespace;
  60221. }
  60222. const prefixStack = this._namespacePrefixes.get(prefix);
  60223. if (prefixStack && prefixStack.length > 0) {
  60224. return prefixStack.at(-1);
  60225. }
  60226. (0, _util.warn)(`Unknown namespace prefix: ${prefix}.`);
  60227. return null;
  60228. }
  60229. clean(data) {
  60230. const {
  60231. hasNamespace,
  60232. prefixes,
  60233. nsAgnostic
  60234. } = data;
  60235. if (hasNamespace) {
  60236. this._currentNamespace = this._namespaceStack.pop();
  60237. }
  60238. if (prefixes) {
  60239. prefixes.forEach(({
  60240. prefix
  60241. }) => {
  60242. this._namespacePrefixes.get(prefix).pop();
  60243. });
  60244. }
  60245. if (nsAgnostic) {
  60246. this._nsAgnosticLevel--;
  60247. }
  60248. }
  60249. }
  60250. exports.Builder = Builder;
  60251. /***/ }),
  60252. /* 88 */
  60253. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60254. Object.defineProperty(exports, "__esModule", ({
  60255. value: true
  60256. }));
  60257. exports.NamespaceSetUp = void 0;
  60258. var _config = __w_pdfjs_require__(89);
  60259. var _connection_set = __w_pdfjs_require__(90);
  60260. var _datasets = __w_pdfjs_require__(91);
  60261. var _locale_set = __w_pdfjs_require__(92);
  60262. var _signature = __w_pdfjs_require__(93);
  60263. var _stylesheet = __w_pdfjs_require__(94);
  60264. var _template = __w_pdfjs_require__(80);
  60265. var _xdp = __w_pdfjs_require__(95);
  60266. var _xhtml = __w_pdfjs_require__(96);
  60267. const NamespaceSetUp = {
  60268. config: _config.ConfigNamespace,
  60269. connection: _connection_set.ConnectionSetNamespace,
  60270. datasets: _datasets.DatasetsNamespace,
  60271. localeSet: _locale_set.LocaleSetNamespace,
  60272. signature: _signature.SignatureNamespace,
  60273. stylesheet: _stylesheet.StylesheetNamespace,
  60274. template: _template.TemplateNamespace,
  60275. xdp: _xdp.XdpNamespace,
  60276. xhtml: _xhtml.XhtmlNamespace
  60277. };
  60278. exports.NamespaceSetUp = NamespaceSetUp;
  60279. /***/ }),
  60280. /* 89 */
  60281. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60282. Object.defineProperty(exports, "__esModule", ({
  60283. value: true
  60284. }));
  60285. exports.ConfigNamespace = void 0;
  60286. var _namespaces = __w_pdfjs_require__(77);
  60287. var _xfa_object = __w_pdfjs_require__(75);
  60288. var _utils = __w_pdfjs_require__(76);
  60289. var _util = __w_pdfjs_require__(2);
  60290. const CONFIG_NS_ID = _namespaces.NamespaceIds.config.id;
  60291. class Acrobat extends _xfa_object.XFAObject {
  60292. constructor(attributes) {
  60293. super(CONFIG_NS_ID, "acrobat", true);
  60294. this.acrobat7 = null;
  60295. this.autoSave = null;
  60296. this.common = null;
  60297. this.validate = null;
  60298. this.validateApprovalSignatures = null;
  60299. this.submitUrl = new _xfa_object.XFAObjectArray();
  60300. }
  60301. }
  60302. class Acrobat7 extends _xfa_object.XFAObject {
  60303. constructor(attributes) {
  60304. super(CONFIG_NS_ID, "acrobat7", true);
  60305. this.dynamicRender = null;
  60306. }
  60307. }
  60308. class ADBE_JSConsole extends _xfa_object.OptionObject {
  60309. constructor(attributes) {
  60310. super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]);
  60311. }
  60312. }
  60313. class ADBE_JSDebugger extends _xfa_object.OptionObject {
  60314. constructor(attributes) {
  60315. super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]);
  60316. }
  60317. }
  60318. class AddSilentPrint extends _xfa_object.Option01 {
  60319. constructor(attributes) {
  60320. super(CONFIG_NS_ID, "addSilentPrint");
  60321. }
  60322. }
  60323. class AddViewerPreferences extends _xfa_object.Option01 {
  60324. constructor(attributes) {
  60325. super(CONFIG_NS_ID, "addViewerPreferences");
  60326. }
  60327. }
  60328. class AdjustData extends _xfa_object.Option10 {
  60329. constructor(attributes) {
  60330. super(CONFIG_NS_ID, "adjustData");
  60331. }
  60332. }
  60333. class AdobeExtensionLevel extends _xfa_object.IntegerObject {
  60334. constructor(attributes) {
  60335. super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8);
  60336. }
  60337. }
  60338. class Agent extends _xfa_object.XFAObject {
  60339. constructor(attributes) {
  60340. super(CONFIG_NS_ID, "agent", true);
  60341. this.name = attributes.name ? attributes.name.trim() : "";
  60342. this.common = new _xfa_object.XFAObjectArray();
  60343. }
  60344. }
  60345. class AlwaysEmbed extends _xfa_object.ContentObject {
  60346. constructor(attributes) {
  60347. super(CONFIG_NS_ID, "alwaysEmbed");
  60348. }
  60349. }
  60350. class Amd extends _xfa_object.StringObject {
  60351. constructor(attributes) {
  60352. super(CONFIG_NS_ID, "amd");
  60353. }
  60354. }
  60355. class Area extends _xfa_object.XFAObject {
  60356. constructor(attributes) {
  60357. super(CONFIG_NS_ID, "area");
  60358. this.level = (0, _utils.getInteger)({
  60359. data: attributes.level,
  60360. defaultValue: 0,
  60361. validate: n => n >= 1 && n <= 3
  60362. });
  60363. this.name = (0, _utils.getStringOption)(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]);
  60364. }
  60365. }
  60366. class Attributes extends _xfa_object.OptionObject {
  60367. constructor(attributes) {
  60368. super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]);
  60369. }
  60370. }
  60371. class AutoSave extends _xfa_object.OptionObject {
  60372. constructor(attributes) {
  60373. super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]);
  60374. }
  60375. }
  60376. class Base extends _xfa_object.StringObject {
  60377. constructor(attributes) {
  60378. super(CONFIG_NS_ID, "base");
  60379. }
  60380. }
  60381. class BatchOutput extends _xfa_object.XFAObject {
  60382. constructor(attributes) {
  60383. super(CONFIG_NS_ID, "batchOutput");
  60384. this.format = (0, _utils.getStringOption)(attributes.format, ["none", "concat", "zip", "zipCompress"]);
  60385. }
  60386. }
  60387. class BehaviorOverride extends _xfa_object.ContentObject {
  60388. constructor(attributes) {
  60389. super(CONFIG_NS_ID, "behaviorOverride");
  60390. }
  60391. [_xfa_object.$finalize]() {
  60392. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2)));
  60393. }
  60394. }
  60395. class Cache extends _xfa_object.XFAObject {
  60396. constructor(attributes) {
  60397. super(CONFIG_NS_ID, "cache", true);
  60398. this.templateCache = null;
  60399. }
  60400. }
  60401. class Change extends _xfa_object.Option01 {
  60402. constructor(attributes) {
  60403. super(CONFIG_NS_ID, "change");
  60404. }
  60405. }
  60406. class Common extends _xfa_object.XFAObject {
  60407. constructor(attributes) {
  60408. super(CONFIG_NS_ID, "common", true);
  60409. this.data = null;
  60410. this.locale = null;
  60411. this.localeSet = null;
  60412. this.messaging = null;
  60413. this.suppressBanner = null;
  60414. this.template = null;
  60415. this.validationMessaging = null;
  60416. this.versionControl = null;
  60417. this.log = new _xfa_object.XFAObjectArray();
  60418. }
  60419. }
  60420. class Compress extends _xfa_object.XFAObject {
  60421. constructor(attributes) {
  60422. super(CONFIG_NS_ID, "compress");
  60423. this.scope = (0, _utils.getStringOption)(attributes.scope, ["imageOnly", "document"]);
  60424. }
  60425. }
  60426. class CompressLogicalStructure extends _xfa_object.Option01 {
  60427. constructor(attributes) {
  60428. super(CONFIG_NS_ID, "compressLogicalStructure");
  60429. }
  60430. }
  60431. class CompressObjectStream extends _xfa_object.Option10 {
  60432. constructor(attributes) {
  60433. super(CONFIG_NS_ID, "compressObjectStream");
  60434. }
  60435. }
  60436. class Compression extends _xfa_object.XFAObject {
  60437. constructor(attributes) {
  60438. super(CONFIG_NS_ID, "compression", true);
  60439. this.compressLogicalStructure = null;
  60440. this.compressObjectStream = null;
  60441. this.level = null;
  60442. this.type = null;
  60443. }
  60444. }
  60445. class Config extends _xfa_object.XFAObject {
  60446. constructor(attributes) {
  60447. super(CONFIG_NS_ID, "config", true);
  60448. this.acrobat = null;
  60449. this.present = null;
  60450. this.trace = null;
  60451. this.agent = new _xfa_object.XFAObjectArray();
  60452. }
  60453. }
  60454. class Conformance extends _xfa_object.OptionObject {
  60455. constructor(attributes) {
  60456. super(CONFIG_NS_ID, "conformance", ["A", "B"]);
  60457. }
  60458. }
  60459. class ContentCopy extends _xfa_object.Option01 {
  60460. constructor(attributes) {
  60461. super(CONFIG_NS_ID, "contentCopy");
  60462. }
  60463. }
  60464. class Copies extends _xfa_object.IntegerObject {
  60465. constructor(attributes) {
  60466. super(CONFIG_NS_ID, "copies", 1, n => n >= 1);
  60467. }
  60468. }
  60469. class Creator extends _xfa_object.StringObject {
  60470. constructor(attributes) {
  60471. super(CONFIG_NS_ID, "creator");
  60472. }
  60473. }
  60474. class CurrentPage extends _xfa_object.IntegerObject {
  60475. constructor(attributes) {
  60476. super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0);
  60477. }
  60478. }
  60479. class Data extends _xfa_object.XFAObject {
  60480. constructor(attributes) {
  60481. super(CONFIG_NS_ID, "data", true);
  60482. this.adjustData = null;
  60483. this.attributes = null;
  60484. this.incrementalLoad = null;
  60485. this.outputXSL = null;
  60486. this.range = null;
  60487. this.record = null;
  60488. this.startNode = null;
  60489. this.uri = null;
  60490. this.window = null;
  60491. this.xsl = null;
  60492. this.excludeNS = new _xfa_object.XFAObjectArray();
  60493. this.transform = new _xfa_object.XFAObjectArray();
  60494. }
  60495. }
  60496. class Debug extends _xfa_object.XFAObject {
  60497. constructor(attributes) {
  60498. super(CONFIG_NS_ID, "debug", true);
  60499. this.uri = null;
  60500. }
  60501. }
  60502. class DefaultTypeface extends _xfa_object.ContentObject {
  60503. constructor(attributes) {
  60504. super(CONFIG_NS_ID, "defaultTypeface");
  60505. this.writingScript = (0, _utils.getStringOption)(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]);
  60506. }
  60507. }
  60508. class Destination extends _xfa_object.OptionObject {
  60509. constructor(attributes) {
  60510. super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]);
  60511. }
  60512. }
  60513. class DocumentAssembly extends _xfa_object.Option01 {
  60514. constructor(attributes) {
  60515. super(CONFIG_NS_ID, "documentAssembly");
  60516. }
  60517. }
  60518. class Driver extends _xfa_object.XFAObject {
  60519. constructor(attributes) {
  60520. super(CONFIG_NS_ID, "driver", true);
  60521. this.name = attributes.name ? attributes.name.trim() : "";
  60522. this.fontInfo = null;
  60523. this.xdc = null;
  60524. }
  60525. }
  60526. class DuplexOption extends _xfa_object.OptionObject {
  60527. constructor(attributes) {
  60528. super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]);
  60529. }
  60530. }
  60531. class DynamicRender extends _xfa_object.OptionObject {
  60532. constructor(attributes) {
  60533. super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]);
  60534. }
  60535. }
  60536. class Embed extends _xfa_object.Option01 {
  60537. constructor(attributes) {
  60538. super(CONFIG_NS_ID, "embed");
  60539. }
  60540. }
  60541. class Encrypt extends _xfa_object.Option01 {
  60542. constructor(attributes) {
  60543. super(CONFIG_NS_ID, "encrypt");
  60544. }
  60545. }
  60546. class Encryption extends _xfa_object.XFAObject {
  60547. constructor(attributes) {
  60548. super(CONFIG_NS_ID, "encryption", true);
  60549. this.encrypt = null;
  60550. this.encryptionLevel = null;
  60551. this.permissions = null;
  60552. }
  60553. }
  60554. class EncryptionLevel extends _xfa_object.OptionObject {
  60555. constructor(attributes) {
  60556. super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]);
  60557. }
  60558. }
  60559. class Enforce extends _xfa_object.StringObject {
  60560. constructor(attributes) {
  60561. super(CONFIG_NS_ID, "enforce");
  60562. }
  60563. }
  60564. class Equate extends _xfa_object.XFAObject {
  60565. constructor(attributes) {
  60566. super(CONFIG_NS_ID, "equate");
  60567. this.force = (0, _utils.getInteger)({
  60568. data: attributes.force,
  60569. defaultValue: 1,
  60570. validate: n => n === 0
  60571. });
  60572. this.from = attributes.from || "";
  60573. this.to = attributes.to || "";
  60574. }
  60575. }
  60576. class EquateRange extends _xfa_object.XFAObject {
  60577. constructor(attributes) {
  60578. super(CONFIG_NS_ID, "equateRange");
  60579. this.from = attributes.from || "";
  60580. this.to = attributes.to || "";
  60581. this._unicodeRange = attributes.unicodeRange || "";
  60582. }
  60583. get unicodeRange() {
  60584. const ranges = [];
  60585. const unicodeRegex = /U\+([0-9a-fA-F]+)/;
  60586. const unicodeRange = this._unicodeRange;
  60587. for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) {
  60588. range = range.split("-", 2).map(x => {
  60589. const found = x.match(unicodeRegex);
  60590. if (!found) {
  60591. return 0;
  60592. }
  60593. return parseInt(found[1], 16);
  60594. });
  60595. if (range.length === 1) {
  60596. range.push(range[0]);
  60597. }
  60598. ranges.push(range);
  60599. }
  60600. return (0, _util.shadow)(this, "unicodeRange", ranges);
  60601. }
  60602. }
  60603. class Exclude extends _xfa_object.ContentObject {
  60604. constructor(attributes) {
  60605. super(CONFIG_NS_ID, "exclude");
  60606. }
  60607. [_xfa_object.$finalize]() {
  60608. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x));
  60609. }
  60610. }
  60611. class ExcludeNS extends _xfa_object.StringObject {
  60612. constructor(attributes) {
  60613. super(CONFIG_NS_ID, "excludeNS");
  60614. }
  60615. }
  60616. class FlipLabel extends _xfa_object.OptionObject {
  60617. constructor(attributes) {
  60618. super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]);
  60619. }
  60620. }
  60621. class FontInfo extends _xfa_object.XFAObject {
  60622. constructor(attributes) {
  60623. super(CONFIG_NS_ID, "fontInfo", true);
  60624. this.embed = null;
  60625. this.map = null;
  60626. this.subsetBelow = null;
  60627. this.alwaysEmbed = new _xfa_object.XFAObjectArray();
  60628. this.defaultTypeface = new _xfa_object.XFAObjectArray();
  60629. this.neverEmbed = new _xfa_object.XFAObjectArray();
  60630. }
  60631. }
  60632. class FormFieldFilling extends _xfa_object.Option01 {
  60633. constructor(attributes) {
  60634. super(CONFIG_NS_ID, "formFieldFilling");
  60635. }
  60636. }
  60637. class GroupParent extends _xfa_object.StringObject {
  60638. constructor(attributes) {
  60639. super(CONFIG_NS_ID, "groupParent");
  60640. }
  60641. }
  60642. class IfEmpty extends _xfa_object.OptionObject {
  60643. constructor(attributes) {
  60644. super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]);
  60645. }
  60646. }
  60647. class IncludeXDPContent extends _xfa_object.StringObject {
  60648. constructor(attributes) {
  60649. super(CONFIG_NS_ID, "includeXDPContent");
  60650. }
  60651. }
  60652. class IncrementalLoad extends _xfa_object.OptionObject {
  60653. constructor(attributes) {
  60654. super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]);
  60655. }
  60656. }
  60657. class IncrementalMerge extends _xfa_object.Option01 {
  60658. constructor(attributes) {
  60659. super(CONFIG_NS_ID, "incrementalMerge");
  60660. }
  60661. }
  60662. class Interactive extends _xfa_object.Option01 {
  60663. constructor(attributes) {
  60664. super(CONFIG_NS_ID, "interactive");
  60665. }
  60666. }
  60667. class Jog extends _xfa_object.OptionObject {
  60668. constructor(attributes) {
  60669. super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]);
  60670. }
  60671. }
  60672. class LabelPrinter extends _xfa_object.XFAObject {
  60673. constructor(attributes) {
  60674. super(CONFIG_NS_ID, "labelPrinter", true);
  60675. this.name = (0, _utils.getStringOption)(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]);
  60676. this.batchOutput = null;
  60677. this.flipLabel = null;
  60678. this.fontInfo = null;
  60679. this.xdc = null;
  60680. }
  60681. }
  60682. class Layout extends _xfa_object.OptionObject {
  60683. constructor(attributes) {
  60684. super(CONFIG_NS_ID, "layout", ["paginate", "panel"]);
  60685. }
  60686. }
  60687. class Level extends _xfa_object.IntegerObject {
  60688. constructor(attributes) {
  60689. super(CONFIG_NS_ID, "level", 0, n => n > 0);
  60690. }
  60691. }
  60692. class Linearized extends _xfa_object.Option01 {
  60693. constructor(attributes) {
  60694. super(CONFIG_NS_ID, "linearized");
  60695. }
  60696. }
  60697. class Locale extends _xfa_object.StringObject {
  60698. constructor(attributes) {
  60699. super(CONFIG_NS_ID, "locale");
  60700. }
  60701. }
  60702. class LocaleSet extends _xfa_object.StringObject {
  60703. constructor(attributes) {
  60704. super(CONFIG_NS_ID, "localeSet");
  60705. }
  60706. }
  60707. class Log extends _xfa_object.XFAObject {
  60708. constructor(attributes) {
  60709. super(CONFIG_NS_ID, "log", true);
  60710. this.mode = null;
  60711. this.threshold = null;
  60712. this.to = null;
  60713. this.uri = null;
  60714. }
  60715. }
  60716. class MapElement extends _xfa_object.XFAObject {
  60717. constructor(attributes) {
  60718. super(CONFIG_NS_ID, "map", true);
  60719. this.equate = new _xfa_object.XFAObjectArray();
  60720. this.equateRange = new _xfa_object.XFAObjectArray();
  60721. }
  60722. }
  60723. class MediumInfo extends _xfa_object.XFAObject {
  60724. constructor(attributes) {
  60725. super(CONFIG_NS_ID, "mediumInfo", true);
  60726. this.map = null;
  60727. }
  60728. }
  60729. class Message extends _xfa_object.XFAObject {
  60730. constructor(attributes) {
  60731. super(CONFIG_NS_ID, "message", true);
  60732. this.msgId = null;
  60733. this.severity = null;
  60734. }
  60735. }
  60736. class Messaging extends _xfa_object.XFAObject {
  60737. constructor(attributes) {
  60738. super(CONFIG_NS_ID, "messaging", true);
  60739. this.message = new _xfa_object.XFAObjectArray();
  60740. }
  60741. }
  60742. class Mode extends _xfa_object.OptionObject {
  60743. constructor(attributes) {
  60744. super(CONFIG_NS_ID, "mode", ["append", "overwrite"]);
  60745. }
  60746. }
  60747. class ModifyAnnots extends _xfa_object.Option01 {
  60748. constructor(attributes) {
  60749. super(CONFIG_NS_ID, "modifyAnnots");
  60750. }
  60751. }
  60752. class MsgId extends _xfa_object.IntegerObject {
  60753. constructor(attributes) {
  60754. super(CONFIG_NS_ID, "msgId", 1, n => n >= 1);
  60755. }
  60756. }
  60757. class NameAttr extends _xfa_object.StringObject {
  60758. constructor(attributes) {
  60759. super(CONFIG_NS_ID, "nameAttr");
  60760. }
  60761. }
  60762. class NeverEmbed extends _xfa_object.ContentObject {
  60763. constructor(attributes) {
  60764. super(CONFIG_NS_ID, "neverEmbed");
  60765. }
  60766. }
  60767. class NumberOfCopies extends _xfa_object.IntegerObject {
  60768. constructor(attributes) {
  60769. super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5);
  60770. }
  60771. }
  60772. class OpenAction extends _xfa_object.XFAObject {
  60773. constructor(attributes) {
  60774. super(CONFIG_NS_ID, "openAction", true);
  60775. this.destination = null;
  60776. }
  60777. }
  60778. class Output extends _xfa_object.XFAObject {
  60779. constructor(attributes) {
  60780. super(CONFIG_NS_ID, "output", true);
  60781. this.to = null;
  60782. this.type = null;
  60783. this.uri = null;
  60784. }
  60785. }
  60786. class OutputBin extends _xfa_object.StringObject {
  60787. constructor(attributes) {
  60788. super(CONFIG_NS_ID, "outputBin");
  60789. }
  60790. }
  60791. class OutputXSL extends _xfa_object.XFAObject {
  60792. constructor(attributes) {
  60793. super(CONFIG_NS_ID, "outputXSL", true);
  60794. this.uri = null;
  60795. }
  60796. }
  60797. class Overprint extends _xfa_object.OptionObject {
  60798. constructor(attributes) {
  60799. super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]);
  60800. }
  60801. }
  60802. class Packets extends _xfa_object.StringObject {
  60803. constructor(attributes) {
  60804. super(CONFIG_NS_ID, "packets");
  60805. }
  60806. [_xfa_object.$finalize]() {
  60807. if (this[_xfa_object.$content] === "*") {
  60808. return;
  60809. }
  60810. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x));
  60811. }
  60812. }
  60813. class PageOffset extends _xfa_object.XFAObject {
  60814. constructor(attributes) {
  60815. super(CONFIG_NS_ID, "pageOffset");
  60816. this.x = (0, _utils.getInteger)({
  60817. data: attributes.x,
  60818. defaultValue: "useXDCSetting",
  60819. validate: n => true
  60820. });
  60821. this.y = (0, _utils.getInteger)({
  60822. data: attributes.y,
  60823. defaultValue: "useXDCSetting",
  60824. validate: n => true
  60825. });
  60826. }
  60827. }
  60828. class PageRange extends _xfa_object.StringObject {
  60829. constructor(attributes) {
  60830. super(CONFIG_NS_ID, "pageRange");
  60831. }
  60832. [_xfa_object.$finalize]() {
  60833. const numbers = this[_xfa_object.$content].trim().split(/\s+/).map(x => parseInt(x, 10));
  60834. const ranges = [];
  60835. for (let i = 0, ii = numbers.length; i < ii; i += 2) {
  60836. ranges.push(numbers.slice(i, i + 2));
  60837. }
  60838. this[_xfa_object.$content] = ranges;
  60839. }
  60840. }
  60841. class Pagination extends _xfa_object.OptionObject {
  60842. constructor(attributes) {
  60843. super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]);
  60844. }
  60845. }
  60846. class PaginationOverride extends _xfa_object.OptionObject {
  60847. constructor(attributes) {
  60848. super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]);
  60849. }
  60850. }
  60851. class Part extends _xfa_object.IntegerObject {
  60852. constructor(attributes) {
  60853. super(CONFIG_NS_ID, "part", 1, n => false);
  60854. }
  60855. }
  60856. class Pcl extends _xfa_object.XFAObject {
  60857. constructor(attributes) {
  60858. super(CONFIG_NS_ID, "pcl", true);
  60859. this.name = attributes.name || "";
  60860. this.batchOutput = null;
  60861. this.fontInfo = null;
  60862. this.jog = null;
  60863. this.mediumInfo = null;
  60864. this.outputBin = null;
  60865. this.pageOffset = null;
  60866. this.staple = null;
  60867. this.xdc = null;
  60868. }
  60869. }
  60870. class Pdf extends _xfa_object.XFAObject {
  60871. constructor(attributes) {
  60872. super(CONFIG_NS_ID, "pdf", true);
  60873. this.name = attributes.name || "";
  60874. this.adobeExtensionLevel = null;
  60875. this.batchOutput = null;
  60876. this.compression = null;
  60877. this.creator = null;
  60878. this.encryption = null;
  60879. this.fontInfo = null;
  60880. this.interactive = null;
  60881. this.linearized = null;
  60882. this.openAction = null;
  60883. this.pdfa = null;
  60884. this.producer = null;
  60885. this.renderPolicy = null;
  60886. this.scriptModel = null;
  60887. this.silentPrint = null;
  60888. this.submitFormat = null;
  60889. this.tagged = null;
  60890. this.version = null;
  60891. this.viewerPreferences = null;
  60892. this.xdc = null;
  60893. }
  60894. }
  60895. class Pdfa extends _xfa_object.XFAObject {
  60896. constructor(attributes) {
  60897. super(CONFIG_NS_ID, "pdfa", true);
  60898. this.amd = null;
  60899. this.conformance = null;
  60900. this.includeXDPContent = null;
  60901. this.part = null;
  60902. }
  60903. }
  60904. class Permissions extends _xfa_object.XFAObject {
  60905. constructor(attributes) {
  60906. super(CONFIG_NS_ID, "permissions", true);
  60907. this.accessibleContent = null;
  60908. this.change = null;
  60909. this.contentCopy = null;
  60910. this.documentAssembly = null;
  60911. this.formFieldFilling = null;
  60912. this.modifyAnnots = null;
  60913. this.plaintextMetadata = null;
  60914. this.print = null;
  60915. this.printHighQuality = null;
  60916. }
  60917. }
  60918. class PickTrayByPDFSize extends _xfa_object.Option01 {
  60919. constructor(attributes) {
  60920. super(CONFIG_NS_ID, "pickTrayByPDFSize");
  60921. }
  60922. }
  60923. class Picture extends _xfa_object.StringObject {
  60924. constructor(attributes) {
  60925. super(CONFIG_NS_ID, "picture");
  60926. }
  60927. }
  60928. class PlaintextMetadata extends _xfa_object.Option01 {
  60929. constructor(attributes) {
  60930. super(CONFIG_NS_ID, "plaintextMetadata");
  60931. }
  60932. }
  60933. class Presence extends _xfa_object.OptionObject {
  60934. constructor(attributes) {
  60935. super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]);
  60936. }
  60937. }
  60938. class Present extends _xfa_object.XFAObject {
  60939. constructor(attributes) {
  60940. super(CONFIG_NS_ID, "present", true);
  60941. this.behaviorOverride = null;
  60942. this.cache = null;
  60943. this.common = null;
  60944. this.copies = null;
  60945. this.destination = null;
  60946. this.incrementalMerge = null;
  60947. this.layout = null;
  60948. this.output = null;
  60949. this.overprint = null;
  60950. this.pagination = null;
  60951. this.paginationOverride = null;
  60952. this.script = null;
  60953. this.validate = null;
  60954. this.xdp = null;
  60955. this.driver = new _xfa_object.XFAObjectArray();
  60956. this.labelPrinter = new _xfa_object.XFAObjectArray();
  60957. this.pcl = new _xfa_object.XFAObjectArray();
  60958. this.pdf = new _xfa_object.XFAObjectArray();
  60959. this.ps = new _xfa_object.XFAObjectArray();
  60960. this.submitUrl = new _xfa_object.XFAObjectArray();
  60961. this.webClient = new _xfa_object.XFAObjectArray();
  60962. this.zpl = new _xfa_object.XFAObjectArray();
  60963. }
  60964. }
  60965. class Print extends _xfa_object.Option01 {
  60966. constructor(attributes) {
  60967. super(CONFIG_NS_ID, "print");
  60968. }
  60969. }
  60970. class PrintHighQuality extends _xfa_object.Option01 {
  60971. constructor(attributes) {
  60972. super(CONFIG_NS_ID, "printHighQuality");
  60973. }
  60974. }
  60975. class PrintScaling extends _xfa_object.OptionObject {
  60976. constructor(attributes) {
  60977. super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]);
  60978. }
  60979. }
  60980. class PrinterName extends _xfa_object.StringObject {
  60981. constructor(attributes) {
  60982. super(CONFIG_NS_ID, "printerName");
  60983. }
  60984. }
  60985. class Producer extends _xfa_object.StringObject {
  60986. constructor(attributes) {
  60987. super(CONFIG_NS_ID, "producer");
  60988. }
  60989. }
  60990. class Ps extends _xfa_object.XFAObject {
  60991. constructor(attributes) {
  60992. super(CONFIG_NS_ID, "ps", true);
  60993. this.name = attributes.name || "";
  60994. this.batchOutput = null;
  60995. this.fontInfo = null;
  60996. this.jog = null;
  60997. this.mediumInfo = null;
  60998. this.outputBin = null;
  60999. this.staple = null;
  61000. this.xdc = null;
  61001. }
  61002. }
  61003. class Range extends _xfa_object.ContentObject {
  61004. constructor(attributes) {
  61005. super(CONFIG_NS_ID, "range");
  61006. }
  61007. [_xfa_object.$finalize]() {
  61008. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s*,\s*/, 2).map(range => range.split("-").map(x => parseInt(x.trim(), 10))).filter(range => range.every(x => !isNaN(x))).map(range => {
  61009. if (range.length === 1) {
  61010. range.push(range[0]);
  61011. }
  61012. return range;
  61013. });
  61014. }
  61015. }
  61016. class Record extends _xfa_object.ContentObject {
  61017. constructor(attributes) {
  61018. super(CONFIG_NS_ID, "record");
  61019. }
  61020. [_xfa_object.$finalize]() {
  61021. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  61022. const n = parseInt(this[_xfa_object.$content], 10);
  61023. if (!isNaN(n) && n >= 0) {
  61024. this[_xfa_object.$content] = n;
  61025. }
  61026. }
  61027. }
  61028. class Relevant extends _xfa_object.ContentObject {
  61029. constructor(attributes) {
  61030. super(CONFIG_NS_ID, "relevant");
  61031. }
  61032. [_xfa_object.$finalize]() {
  61033. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/);
  61034. }
  61035. }
  61036. class Rename extends _xfa_object.ContentObject {
  61037. constructor(attributes) {
  61038. super(CONFIG_NS_ID, "rename");
  61039. }
  61040. [_xfa_object.$finalize]() {
  61041. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  61042. if (this[_xfa_object.$content].toLowerCase().startsWith("xml") || new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u").test(this[_xfa_object.$content])) {
  61043. (0, _util.warn)("XFA - Rename: invalid XFA name");
  61044. }
  61045. }
  61046. }
  61047. class RenderPolicy extends _xfa_object.OptionObject {
  61048. constructor(attributes) {
  61049. super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]);
  61050. }
  61051. }
  61052. class RunScripts extends _xfa_object.OptionObject {
  61053. constructor(attributes) {
  61054. super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]);
  61055. }
  61056. }
  61057. class Script extends _xfa_object.XFAObject {
  61058. constructor(attributes) {
  61059. super(CONFIG_NS_ID, "script", true);
  61060. this.currentPage = null;
  61061. this.exclude = null;
  61062. this.runScripts = null;
  61063. }
  61064. }
  61065. class ScriptModel extends _xfa_object.OptionObject {
  61066. constructor(attributes) {
  61067. super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]);
  61068. }
  61069. }
  61070. class Severity extends _xfa_object.OptionObject {
  61071. constructor(attributes) {
  61072. super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]);
  61073. }
  61074. }
  61075. class SilentPrint extends _xfa_object.XFAObject {
  61076. constructor(attributes) {
  61077. super(CONFIG_NS_ID, "silentPrint", true);
  61078. this.addSilentPrint = null;
  61079. this.printerName = null;
  61080. }
  61081. }
  61082. class Staple extends _xfa_object.XFAObject {
  61083. constructor(attributes) {
  61084. super(CONFIG_NS_ID, "staple");
  61085. this.mode = (0, _utils.getStringOption)(attributes.mode, ["usePrinterSetting", "on", "off"]);
  61086. }
  61087. }
  61088. class StartNode extends _xfa_object.StringObject {
  61089. constructor(attributes) {
  61090. super(CONFIG_NS_ID, "startNode");
  61091. }
  61092. }
  61093. class StartPage extends _xfa_object.IntegerObject {
  61094. constructor(attributes) {
  61095. super(CONFIG_NS_ID, "startPage", 0, n => true);
  61096. }
  61097. }
  61098. class SubmitFormat extends _xfa_object.OptionObject {
  61099. constructor(attributes) {
  61100. super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]);
  61101. }
  61102. }
  61103. class SubmitUrl extends _xfa_object.StringObject {
  61104. constructor(attributes) {
  61105. super(CONFIG_NS_ID, "submitUrl");
  61106. }
  61107. }
  61108. class SubsetBelow extends _xfa_object.IntegerObject {
  61109. constructor(attributes) {
  61110. super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100);
  61111. }
  61112. }
  61113. class SuppressBanner extends _xfa_object.Option01 {
  61114. constructor(attributes) {
  61115. super(CONFIG_NS_ID, "suppressBanner");
  61116. }
  61117. }
  61118. class Tagged extends _xfa_object.Option01 {
  61119. constructor(attributes) {
  61120. super(CONFIG_NS_ID, "tagged");
  61121. }
  61122. }
  61123. class Template extends _xfa_object.XFAObject {
  61124. constructor(attributes) {
  61125. super(CONFIG_NS_ID, "template", true);
  61126. this.base = null;
  61127. this.relevant = null;
  61128. this.startPage = null;
  61129. this.uri = null;
  61130. this.xsl = null;
  61131. }
  61132. }
  61133. class Threshold extends _xfa_object.OptionObject {
  61134. constructor(attributes) {
  61135. super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]);
  61136. }
  61137. }
  61138. class To extends _xfa_object.OptionObject {
  61139. constructor(attributes) {
  61140. super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]);
  61141. }
  61142. }
  61143. class TemplateCache extends _xfa_object.XFAObject {
  61144. constructor(attributes) {
  61145. super(CONFIG_NS_ID, "templateCache");
  61146. this.maxEntries = (0, _utils.getInteger)({
  61147. data: attributes.maxEntries,
  61148. defaultValue: 5,
  61149. validate: n => n >= 0
  61150. });
  61151. }
  61152. }
  61153. class Trace extends _xfa_object.XFAObject {
  61154. constructor(attributes) {
  61155. super(CONFIG_NS_ID, "trace", true);
  61156. this.area = new _xfa_object.XFAObjectArray();
  61157. }
  61158. }
  61159. class Transform extends _xfa_object.XFAObject {
  61160. constructor(attributes) {
  61161. super(CONFIG_NS_ID, "transform", true);
  61162. this.groupParent = null;
  61163. this.ifEmpty = null;
  61164. this.nameAttr = null;
  61165. this.picture = null;
  61166. this.presence = null;
  61167. this.rename = null;
  61168. this.whitespace = null;
  61169. }
  61170. }
  61171. class Type extends _xfa_object.OptionObject {
  61172. constructor(attributes) {
  61173. super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]);
  61174. }
  61175. }
  61176. class Uri extends _xfa_object.StringObject {
  61177. constructor(attributes) {
  61178. super(CONFIG_NS_ID, "uri");
  61179. }
  61180. }
  61181. class Validate extends _xfa_object.OptionObject {
  61182. constructor(attributes) {
  61183. super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]);
  61184. }
  61185. }
  61186. class ValidateApprovalSignatures extends _xfa_object.ContentObject {
  61187. constructor(attributes) {
  61188. super(CONFIG_NS_ID, "validateApprovalSignatures");
  61189. }
  61190. [_xfa_object.$finalize]() {
  61191. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x));
  61192. }
  61193. }
  61194. class ValidationMessaging extends _xfa_object.OptionObject {
  61195. constructor(attributes) {
  61196. super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]);
  61197. }
  61198. }
  61199. class Version extends _xfa_object.OptionObject {
  61200. constructor(attributes) {
  61201. super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]);
  61202. }
  61203. }
  61204. class VersionControl extends _xfa_object.XFAObject {
  61205. constructor(attributes) {
  61206. super(CONFIG_NS_ID, "VersionControl");
  61207. this.outputBelow = (0, _utils.getStringOption)(attributes.outputBelow, ["warn", "error", "update"]);
  61208. this.sourceAbove = (0, _utils.getStringOption)(attributes.sourceAbove, ["warn", "error"]);
  61209. this.sourceBelow = (0, _utils.getStringOption)(attributes.sourceBelow, ["update", "maintain"]);
  61210. }
  61211. }
  61212. class ViewerPreferences extends _xfa_object.XFAObject {
  61213. constructor(attributes) {
  61214. super(CONFIG_NS_ID, "viewerPreferences", true);
  61215. this.ADBE_JSConsole = null;
  61216. this.ADBE_JSDebugger = null;
  61217. this.addViewerPreferences = null;
  61218. this.duplexOption = null;
  61219. this.enforce = null;
  61220. this.numberOfCopies = null;
  61221. this.pageRange = null;
  61222. this.pickTrayByPDFSize = null;
  61223. this.printScaling = null;
  61224. }
  61225. }
  61226. class WebClient extends _xfa_object.XFAObject {
  61227. constructor(attributes) {
  61228. super(CONFIG_NS_ID, "webClient", true);
  61229. this.name = attributes.name ? attributes.name.trim() : "";
  61230. this.fontInfo = null;
  61231. this.xdc = null;
  61232. }
  61233. }
  61234. class Whitespace extends _xfa_object.OptionObject {
  61235. constructor(attributes) {
  61236. super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]);
  61237. }
  61238. }
  61239. class Window extends _xfa_object.ContentObject {
  61240. constructor(attributes) {
  61241. super(CONFIG_NS_ID, "window");
  61242. }
  61243. [_xfa_object.$finalize]() {
  61244. const pair = this[_xfa_object.$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10));
  61245. if (pair.some(x => isNaN(x))) {
  61246. this[_xfa_object.$content] = [0, 0];
  61247. return;
  61248. }
  61249. if (pair.length === 1) {
  61250. pair.push(pair[0]);
  61251. }
  61252. this[_xfa_object.$content] = pair;
  61253. }
  61254. }
  61255. class Xdc extends _xfa_object.XFAObject {
  61256. constructor(attributes) {
  61257. super(CONFIG_NS_ID, "xdc", true);
  61258. this.uri = new _xfa_object.XFAObjectArray();
  61259. this.xsl = new _xfa_object.XFAObjectArray();
  61260. }
  61261. }
  61262. class Xdp extends _xfa_object.XFAObject {
  61263. constructor(attributes) {
  61264. super(CONFIG_NS_ID, "xdp", true);
  61265. this.packets = null;
  61266. }
  61267. }
  61268. class Xsl extends _xfa_object.XFAObject {
  61269. constructor(attributes) {
  61270. super(CONFIG_NS_ID, "xsl", true);
  61271. this.debug = null;
  61272. this.uri = null;
  61273. }
  61274. }
  61275. class Zpl extends _xfa_object.XFAObject {
  61276. constructor(attributes) {
  61277. super(CONFIG_NS_ID, "zpl", true);
  61278. this.name = attributes.name ? attributes.name.trim() : "";
  61279. this.batchOutput = null;
  61280. this.flipLabel = null;
  61281. this.fontInfo = null;
  61282. this.xdc = null;
  61283. }
  61284. }
  61285. class ConfigNamespace {
  61286. static [_namespaces.$buildXFAObject](name, attributes) {
  61287. if (ConfigNamespace.hasOwnProperty(name)) {
  61288. return ConfigNamespace[name](attributes);
  61289. }
  61290. return undefined;
  61291. }
  61292. static acrobat(attrs) {
  61293. return new Acrobat(attrs);
  61294. }
  61295. static acrobat7(attrs) {
  61296. return new Acrobat7(attrs);
  61297. }
  61298. static ADBE_JSConsole(attrs) {
  61299. return new ADBE_JSConsole(attrs);
  61300. }
  61301. static ADBE_JSDebugger(attrs) {
  61302. return new ADBE_JSDebugger(attrs);
  61303. }
  61304. static addSilentPrint(attrs) {
  61305. return new AddSilentPrint(attrs);
  61306. }
  61307. static addViewerPreferences(attrs) {
  61308. return new AddViewerPreferences(attrs);
  61309. }
  61310. static adjustData(attrs) {
  61311. return new AdjustData(attrs);
  61312. }
  61313. static adobeExtensionLevel(attrs) {
  61314. return new AdobeExtensionLevel(attrs);
  61315. }
  61316. static agent(attrs) {
  61317. return new Agent(attrs);
  61318. }
  61319. static alwaysEmbed(attrs) {
  61320. return new AlwaysEmbed(attrs);
  61321. }
  61322. static amd(attrs) {
  61323. return new Amd(attrs);
  61324. }
  61325. static area(attrs) {
  61326. return new Area(attrs);
  61327. }
  61328. static attributes(attrs) {
  61329. return new Attributes(attrs);
  61330. }
  61331. static autoSave(attrs) {
  61332. return new AutoSave(attrs);
  61333. }
  61334. static base(attrs) {
  61335. return new Base(attrs);
  61336. }
  61337. static batchOutput(attrs) {
  61338. return new BatchOutput(attrs);
  61339. }
  61340. static behaviorOverride(attrs) {
  61341. return new BehaviorOverride(attrs);
  61342. }
  61343. static cache(attrs) {
  61344. return new Cache(attrs);
  61345. }
  61346. static change(attrs) {
  61347. return new Change(attrs);
  61348. }
  61349. static common(attrs) {
  61350. return new Common(attrs);
  61351. }
  61352. static compress(attrs) {
  61353. return new Compress(attrs);
  61354. }
  61355. static compressLogicalStructure(attrs) {
  61356. return new CompressLogicalStructure(attrs);
  61357. }
  61358. static compressObjectStream(attrs) {
  61359. return new CompressObjectStream(attrs);
  61360. }
  61361. static compression(attrs) {
  61362. return new Compression(attrs);
  61363. }
  61364. static config(attrs) {
  61365. return new Config(attrs);
  61366. }
  61367. static conformance(attrs) {
  61368. return new Conformance(attrs);
  61369. }
  61370. static contentCopy(attrs) {
  61371. return new ContentCopy(attrs);
  61372. }
  61373. static copies(attrs) {
  61374. return new Copies(attrs);
  61375. }
  61376. static creator(attrs) {
  61377. return new Creator(attrs);
  61378. }
  61379. static currentPage(attrs) {
  61380. return new CurrentPage(attrs);
  61381. }
  61382. static data(attrs) {
  61383. return new Data(attrs);
  61384. }
  61385. static debug(attrs) {
  61386. return new Debug(attrs);
  61387. }
  61388. static defaultTypeface(attrs) {
  61389. return new DefaultTypeface(attrs);
  61390. }
  61391. static destination(attrs) {
  61392. return new Destination(attrs);
  61393. }
  61394. static documentAssembly(attrs) {
  61395. return new DocumentAssembly(attrs);
  61396. }
  61397. static driver(attrs) {
  61398. return new Driver(attrs);
  61399. }
  61400. static duplexOption(attrs) {
  61401. return new DuplexOption(attrs);
  61402. }
  61403. static dynamicRender(attrs) {
  61404. return new DynamicRender(attrs);
  61405. }
  61406. static embed(attrs) {
  61407. return new Embed(attrs);
  61408. }
  61409. static encrypt(attrs) {
  61410. return new Encrypt(attrs);
  61411. }
  61412. static encryption(attrs) {
  61413. return new Encryption(attrs);
  61414. }
  61415. static encryptionLevel(attrs) {
  61416. return new EncryptionLevel(attrs);
  61417. }
  61418. static enforce(attrs) {
  61419. return new Enforce(attrs);
  61420. }
  61421. static equate(attrs) {
  61422. return new Equate(attrs);
  61423. }
  61424. static equateRange(attrs) {
  61425. return new EquateRange(attrs);
  61426. }
  61427. static exclude(attrs) {
  61428. return new Exclude(attrs);
  61429. }
  61430. static excludeNS(attrs) {
  61431. return new ExcludeNS(attrs);
  61432. }
  61433. static flipLabel(attrs) {
  61434. return new FlipLabel(attrs);
  61435. }
  61436. static fontInfo(attrs) {
  61437. return new FontInfo(attrs);
  61438. }
  61439. static formFieldFilling(attrs) {
  61440. return new FormFieldFilling(attrs);
  61441. }
  61442. static groupParent(attrs) {
  61443. return new GroupParent(attrs);
  61444. }
  61445. static ifEmpty(attrs) {
  61446. return new IfEmpty(attrs);
  61447. }
  61448. static includeXDPContent(attrs) {
  61449. return new IncludeXDPContent(attrs);
  61450. }
  61451. static incrementalLoad(attrs) {
  61452. return new IncrementalLoad(attrs);
  61453. }
  61454. static incrementalMerge(attrs) {
  61455. return new IncrementalMerge(attrs);
  61456. }
  61457. static interactive(attrs) {
  61458. return new Interactive(attrs);
  61459. }
  61460. static jog(attrs) {
  61461. return new Jog(attrs);
  61462. }
  61463. static labelPrinter(attrs) {
  61464. return new LabelPrinter(attrs);
  61465. }
  61466. static layout(attrs) {
  61467. return new Layout(attrs);
  61468. }
  61469. static level(attrs) {
  61470. return new Level(attrs);
  61471. }
  61472. static linearized(attrs) {
  61473. return new Linearized(attrs);
  61474. }
  61475. static locale(attrs) {
  61476. return new Locale(attrs);
  61477. }
  61478. static localeSet(attrs) {
  61479. return new LocaleSet(attrs);
  61480. }
  61481. static log(attrs) {
  61482. return new Log(attrs);
  61483. }
  61484. static map(attrs) {
  61485. return new MapElement(attrs);
  61486. }
  61487. static mediumInfo(attrs) {
  61488. return new MediumInfo(attrs);
  61489. }
  61490. static message(attrs) {
  61491. return new Message(attrs);
  61492. }
  61493. static messaging(attrs) {
  61494. return new Messaging(attrs);
  61495. }
  61496. static mode(attrs) {
  61497. return new Mode(attrs);
  61498. }
  61499. static modifyAnnots(attrs) {
  61500. return new ModifyAnnots(attrs);
  61501. }
  61502. static msgId(attrs) {
  61503. return new MsgId(attrs);
  61504. }
  61505. static nameAttr(attrs) {
  61506. return new NameAttr(attrs);
  61507. }
  61508. static neverEmbed(attrs) {
  61509. return new NeverEmbed(attrs);
  61510. }
  61511. static numberOfCopies(attrs) {
  61512. return new NumberOfCopies(attrs);
  61513. }
  61514. static openAction(attrs) {
  61515. return new OpenAction(attrs);
  61516. }
  61517. static output(attrs) {
  61518. return new Output(attrs);
  61519. }
  61520. static outputBin(attrs) {
  61521. return new OutputBin(attrs);
  61522. }
  61523. static outputXSL(attrs) {
  61524. return new OutputXSL(attrs);
  61525. }
  61526. static overprint(attrs) {
  61527. return new Overprint(attrs);
  61528. }
  61529. static packets(attrs) {
  61530. return new Packets(attrs);
  61531. }
  61532. static pageOffset(attrs) {
  61533. return new PageOffset(attrs);
  61534. }
  61535. static pageRange(attrs) {
  61536. return new PageRange(attrs);
  61537. }
  61538. static pagination(attrs) {
  61539. return new Pagination(attrs);
  61540. }
  61541. static paginationOverride(attrs) {
  61542. return new PaginationOverride(attrs);
  61543. }
  61544. static part(attrs) {
  61545. return new Part(attrs);
  61546. }
  61547. static pcl(attrs) {
  61548. return new Pcl(attrs);
  61549. }
  61550. static pdf(attrs) {
  61551. return new Pdf(attrs);
  61552. }
  61553. static pdfa(attrs) {
  61554. return new Pdfa(attrs);
  61555. }
  61556. static permissions(attrs) {
  61557. return new Permissions(attrs);
  61558. }
  61559. static pickTrayByPDFSize(attrs) {
  61560. return new PickTrayByPDFSize(attrs);
  61561. }
  61562. static picture(attrs) {
  61563. return new Picture(attrs);
  61564. }
  61565. static plaintextMetadata(attrs) {
  61566. return new PlaintextMetadata(attrs);
  61567. }
  61568. static presence(attrs) {
  61569. return new Presence(attrs);
  61570. }
  61571. static present(attrs) {
  61572. return new Present(attrs);
  61573. }
  61574. static print(attrs) {
  61575. return new Print(attrs);
  61576. }
  61577. static printHighQuality(attrs) {
  61578. return new PrintHighQuality(attrs);
  61579. }
  61580. static printScaling(attrs) {
  61581. return new PrintScaling(attrs);
  61582. }
  61583. static printerName(attrs) {
  61584. return new PrinterName(attrs);
  61585. }
  61586. static producer(attrs) {
  61587. return new Producer(attrs);
  61588. }
  61589. static ps(attrs) {
  61590. return new Ps(attrs);
  61591. }
  61592. static range(attrs) {
  61593. return new Range(attrs);
  61594. }
  61595. static record(attrs) {
  61596. return new Record(attrs);
  61597. }
  61598. static relevant(attrs) {
  61599. return new Relevant(attrs);
  61600. }
  61601. static rename(attrs) {
  61602. return new Rename(attrs);
  61603. }
  61604. static renderPolicy(attrs) {
  61605. return new RenderPolicy(attrs);
  61606. }
  61607. static runScripts(attrs) {
  61608. return new RunScripts(attrs);
  61609. }
  61610. static script(attrs) {
  61611. return new Script(attrs);
  61612. }
  61613. static scriptModel(attrs) {
  61614. return new ScriptModel(attrs);
  61615. }
  61616. static severity(attrs) {
  61617. return new Severity(attrs);
  61618. }
  61619. static silentPrint(attrs) {
  61620. return new SilentPrint(attrs);
  61621. }
  61622. static staple(attrs) {
  61623. return new Staple(attrs);
  61624. }
  61625. static startNode(attrs) {
  61626. return new StartNode(attrs);
  61627. }
  61628. static startPage(attrs) {
  61629. return new StartPage(attrs);
  61630. }
  61631. static submitFormat(attrs) {
  61632. return new SubmitFormat(attrs);
  61633. }
  61634. static submitUrl(attrs) {
  61635. return new SubmitUrl(attrs);
  61636. }
  61637. static subsetBelow(attrs) {
  61638. return new SubsetBelow(attrs);
  61639. }
  61640. static suppressBanner(attrs) {
  61641. return new SuppressBanner(attrs);
  61642. }
  61643. static tagged(attrs) {
  61644. return new Tagged(attrs);
  61645. }
  61646. static template(attrs) {
  61647. return new Template(attrs);
  61648. }
  61649. static templateCache(attrs) {
  61650. return new TemplateCache(attrs);
  61651. }
  61652. static threshold(attrs) {
  61653. return new Threshold(attrs);
  61654. }
  61655. static to(attrs) {
  61656. return new To(attrs);
  61657. }
  61658. static trace(attrs) {
  61659. return new Trace(attrs);
  61660. }
  61661. static transform(attrs) {
  61662. return new Transform(attrs);
  61663. }
  61664. static type(attrs) {
  61665. return new Type(attrs);
  61666. }
  61667. static uri(attrs) {
  61668. return new Uri(attrs);
  61669. }
  61670. static validate(attrs) {
  61671. return new Validate(attrs);
  61672. }
  61673. static validateApprovalSignatures(attrs) {
  61674. return new ValidateApprovalSignatures(attrs);
  61675. }
  61676. static validationMessaging(attrs) {
  61677. return new ValidationMessaging(attrs);
  61678. }
  61679. static version(attrs) {
  61680. return new Version(attrs);
  61681. }
  61682. static versionControl(attrs) {
  61683. return new VersionControl(attrs);
  61684. }
  61685. static viewerPreferences(attrs) {
  61686. return new ViewerPreferences(attrs);
  61687. }
  61688. static webClient(attrs) {
  61689. return new WebClient(attrs);
  61690. }
  61691. static whitespace(attrs) {
  61692. return new Whitespace(attrs);
  61693. }
  61694. static window(attrs) {
  61695. return new Window(attrs);
  61696. }
  61697. static xdc(attrs) {
  61698. return new Xdc(attrs);
  61699. }
  61700. static xdp(attrs) {
  61701. return new Xdp(attrs);
  61702. }
  61703. static xsl(attrs) {
  61704. return new Xsl(attrs);
  61705. }
  61706. static zpl(attrs) {
  61707. return new Zpl(attrs);
  61708. }
  61709. }
  61710. exports.ConfigNamespace = ConfigNamespace;
  61711. /***/ }),
  61712. /* 90 */
  61713. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61714. Object.defineProperty(exports, "__esModule", ({
  61715. value: true
  61716. }));
  61717. exports.ConnectionSetNamespace = void 0;
  61718. var _namespaces = __w_pdfjs_require__(77);
  61719. var _xfa_object = __w_pdfjs_require__(75);
  61720. const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id;
  61721. class ConnectionSet extends _xfa_object.XFAObject {
  61722. constructor(attributes) {
  61723. super(CONNECTION_SET_NS_ID, "connectionSet", true);
  61724. this.wsdlConnection = new _xfa_object.XFAObjectArray();
  61725. this.xmlConnection = new _xfa_object.XFAObjectArray();
  61726. this.xsdConnection = new _xfa_object.XFAObjectArray();
  61727. }
  61728. }
  61729. class EffectiveInputPolicy extends _xfa_object.XFAObject {
  61730. constructor(attributes) {
  61731. super(CONNECTION_SET_NS_ID, "effectiveInputPolicy");
  61732. this.id = attributes.id || "";
  61733. this.name = attributes.name || "";
  61734. this.use = attributes.use || "";
  61735. this.usehref = attributes.usehref || "";
  61736. }
  61737. }
  61738. class EffectiveOutputPolicy extends _xfa_object.XFAObject {
  61739. constructor(attributes) {
  61740. super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy");
  61741. this.id = attributes.id || "";
  61742. this.name = attributes.name || "";
  61743. this.use = attributes.use || "";
  61744. this.usehref = attributes.usehref || "";
  61745. }
  61746. }
  61747. class Operation extends _xfa_object.StringObject {
  61748. constructor(attributes) {
  61749. super(CONNECTION_SET_NS_ID, "operation");
  61750. this.id = attributes.id || "";
  61751. this.input = attributes.input || "";
  61752. this.name = attributes.name || "";
  61753. this.output = attributes.output || "";
  61754. this.use = attributes.use || "";
  61755. this.usehref = attributes.usehref || "";
  61756. }
  61757. }
  61758. class RootElement extends _xfa_object.StringObject {
  61759. constructor(attributes) {
  61760. super(CONNECTION_SET_NS_ID, "rootElement");
  61761. this.id = attributes.id || "";
  61762. this.name = attributes.name || "";
  61763. this.use = attributes.use || "";
  61764. this.usehref = attributes.usehref || "";
  61765. }
  61766. }
  61767. class SoapAction extends _xfa_object.StringObject {
  61768. constructor(attributes) {
  61769. super(CONNECTION_SET_NS_ID, "soapAction");
  61770. this.id = attributes.id || "";
  61771. this.name = attributes.name || "";
  61772. this.use = attributes.use || "";
  61773. this.usehref = attributes.usehref || "";
  61774. }
  61775. }
  61776. class SoapAddress extends _xfa_object.StringObject {
  61777. constructor(attributes) {
  61778. super(CONNECTION_SET_NS_ID, "soapAddress");
  61779. this.id = attributes.id || "";
  61780. this.name = attributes.name || "";
  61781. this.use = attributes.use || "";
  61782. this.usehref = attributes.usehref || "";
  61783. }
  61784. }
  61785. class Uri extends _xfa_object.StringObject {
  61786. constructor(attributes) {
  61787. super(CONNECTION_SET_NS_ID, "uri");
  61788. this.id = attributes.id || "";
  61789. this.name = attributes.name || "";
  61790. this.use = attributes.use || "";
  61791. this.usehref = attributes.usehref || "";
  61792. }
  61793. }
  61794. class WsdlAddress extends _xfa_object.StringObject {
  61795. constructor(attributes) {
  61796. super(CONNECTION_SET_NS_ID, "wsdlAddress");
  61797. this.id = attributes.id || "";
  61798. this.name = attributes.name || "";
  61799. this.use = attributes.use || "";
  61800. this.usehref = attributes.usehref || "";
  61801. }
  61802. }
  61803. class WsdlConnection extends _xfa_object.XFAObject {
  61804. constructor(attributes) {
  61805. super(CONNECTION_SET_NS_ID, "wsdlConnection", true);
  61806. this.dataDescription = attributes.dataDescription || "";
  61807. this.name = attributes.name || "";
  61808. this.effectiveInputPolicy = null;
  61809. this.effectiveOutputPolicy = null;
  61810. this.operation = null;
  61811. this.soapAction = null;
  61812. this.soapAddress = null;
  61813. this.wsdlAddress = null;
  61814. }
  61815. }
  61816. class XmlConnection extends _xfa_object.XFAObject {
  61817. constructor(attributes) {
  61818. super(CONNECTION_SET_NS_ID, "xmlConnection", true);
  61819. this.dataDescription = attributes.dataDescription || "";
  61820. this.name = attributes.name || "";
  61821. this.uri = null;
  61822. }
  61823. }
  61824. class XsdConnection extends _xfa_object.XFAObject {
  61825. constructor(attributes) {
  61826. super(CONNECTION_SET_NS_ID, "xsdConnection", true);
  61827. this.dataDescription = attributes.dataDescription || "";
  61828. this.name = attributes.name || "";
  61829. this.rootElement = null;
  61830. this.uri = null;
  61831. }
  61832. }
  61833. class ConnectionSetNamespace {
  61834. static [_namespaces.$buildXFAObject](name, attributes) {
  61835. if (ConnectionSetNamespace.hasOwnProperty(name)) {
  61836. return ConnectionSetNamespace[name](attributes);
  61837. }
  61838. return undefined;
  61839. }
  61840. static connectionSet(attrs) {
  61841. return new ConnectionSet(attrs);
  61842. }
  61843. static effectiveInputPolicy(attrs) {
  61844. return new EffectiveInputPolicy(attrs);
  61845. }
  61846. static effectiveOutputPolicy(attrs) {
  61847. return new EffectiveOutputPolicy(attrs);
  61848. }
  61849. static operation(attrs) {
  61850. return new Operation(attrs);
  61851. }
  61852. static rootElement(attrs) {
  61853. return new RootElement(attrs);
  61854. }
  61855. static soapAction(attrs) {
  61856. return new SoapAction(attrs);
  61857. }
  61858. static soapAddress(attrs) {
  61859. return new SoapAddress(attrs);
  61860. }
  61861. static uri(attrs) {
  61862. return new Uri(attrs);
  61863. }
  61864. static wsdlAddress(attrs) {
  61865. return new WsdlAddress(attrs);
  61866. }
  61867. static wsdlConnection(attrs) {
  61868. return new WsdlConnection(attrs);
  61869. }
  61870. static xmlConnection(attrs) {
  61871. return new XmlConnection(attrs);
  61872. }
  61873. static xsdConnection(attrs) {
  61874. return new XsdConnection(attrs);
  61875. }
  61876. }
  61877. exports.ConnectionSetNamespace = ConnectionSetNamespace;
  61878. /***/ }),
  61879. /* 91 */
  61880. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61881. Object.defineProperty(exports, "__esModule", ({
  61882. value: true
  61883. }));
  61884. exports.DatasetsNamespace = void 0;
  61885. var _xfa_object = __w_pdfjs_require__(75);
  61886. var _namespaces = __w_pdfjs_require__(77);
  61887. const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id;
  61888. class Data extends _xfa_object.XmlObject {
  61889. constructor(attributes) {
  61890. super(DATASETS_NS_ID, "data", attributes);
  61891. }
  61892. [_xfa_object.$isNsAgnostic]() {
  61893. return true;
  61894. }
  61895. }
  61896. class Datasets extends _xfa_object.XFAObject {
  61897. constructor(attributes) {
  61898. super(DATASETS_NS_ID, "datasets", true);
  61899. this.data = null;
  61900. this.Signature = null;
  61901. }
  61902. [_xfa_object.$onChild](child) {
  61903. const name = child[_xfa_object.$nodeName];
  61904. if (name === "data" && child[_xfa_object.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.signature.id) {
  61905. this[name] = child;
  61906. }
  61907. this[_xfa_object.$appendChild](child);
  61908. }
  61909. }
  61910. class DatasetsNamespace {
  61911. static [_namespaces.$buildXFAObject](name, attributes) {
  61912. if (DatasetsNamespace.hasOwnProperty(name)) {
  61913. return DatasetsNamespace[name](attributes);
  61914. }
  61915. return undefined;
  61916. }
  61917. static datasets(attributes) {
  61918. return new Datasets(attributes);
  61919. }
  61920. static data(attributes) {
  61921. return new Data(attributes);
  61922. }
  61923. }
  61924. exports.DatasetsNamespace = DatasetsNamespace;
  61925. /***/ }),
  61926. /* 92 */
  61927. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61928. Object.defineProperty(exports, "__esModule", ({
  61929. value: true
  61930. }));
  61931. exports.LocaleSetNamespace = void 0;
  61932. var _namespaces = __w_pdfjs_require__(77);
  61933. var _xfa_object = __w_pdfjs_require__(75);
  61934. var _utils = __w_pdfjs_require__(76);
  61935. const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id;
  61936. class CalendarSymbols extends _xfa_object.XFAObject {
  61937. constructor(attributes) {
  61938. super(LOCALE_SET_NS_ID, "calendarSymbols", true);
  61939. this.name = "gregorian";
  61940. this.dayNames = new _xfa_object.XFAObjectArray(2);
  61941. this.eraNames = null;
  61942. this.meridiemNames = null;
  61943. this.monthNames = new _xfa_object.XFAObjectArray(2);
  61944. }
  61945. }
  61946. class CurrencySymbol extends _xfa_object.StringObject {
  61947. constructor(attributes) {
  61948. super(LOCALE_SET_NS_ID, "currencySymbol");
  61949. this.name = (0, _utils.getStringOption)(attributes.name, ["symbol", "isoname", "decimal"]);
  61950. }
  61951. }
  61952. class CurrencySymbols extends _xfa_object.XFAObject {
  61953. constructor(attributes) {
  61954. super(LOCALE_SET_NS_ID, "currencySymbols", true);
  61955. this.currencySymbol = new _xfa_object.XFAObjectArray(3);
  61956. }
  61957. }
  61958. class DatePattern extends _xfa_object.StringObject {
  61959. constructor(attributes) {
  61960. super(LOCALE_SET_NS_ID, "datePattern");
  61961. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  61962. }
  61963. }
  61964. class DatePatterns extends _xfa_object.XFAObject {
  61965. constructor(attributes) {
  61966. super(LOCALE_SET_NS_ID, "datePatterns", true);
  61967. this.datePattern = new _xfa_object.XFAObjectArray(4);
  61968. }
  61969. }
  61970. class DateTimeSymbols extends _xfa_object.ContentObject {
  61971. constructor(attributes) {
  61972. super(LOCALE_SET_NS_ID, "dateTimeSymbols");
  61973. }
  61974. }
  61975. class Day extends _xfa_object.StringObject {
  61976. constructor(attributes) {
  61977. super(LOCALE_SET_NS_ID, "day");
  61978. }
  61979. }
  61980. class DayNames extends _xfa_object.XFAObject {
  61981. constructor(attributes) {
  61982. super(LOCALE_SET_NS_ID, "dayNames", true);
  61983. this.abbr = (0, _utils.getInteger)({
  61984. data: attributes.abbr,
  61985. defaultValue: 0,
  61986. validate: x => x === 1
  61987. });
  61988. this.day = new _xfa_object.XFAObjectArray(7);
  61989. }
  61990. }
  61991. class Era extends _xfa_object.StringObject {
  61992. constructor(attributes) {
  61993. super(LOCALE_SET_NS_ID, "era");
  61994. }
  61995. }
  61996. class EraNames extends _xfa_object.XFAObject {
  61997. constructor(attributes) {
  61998. super(LOCALE_SET_NS_ID, "eraNames", true);
  61999. this.era = new _xfa_object.XFAObjectArray(2);
  62000. }
  62001. }
  62002. class Locale extends _xfa_object.XFAObject {
  62003. constructor(attributes) {
  62004. super(LOCALE_SET_NS_ID, "locale", true);
  62005. this.desc = attributes.desc || "";
  62006. this.name = "isoname";
  62007. this.calendarSymbols = null;
  62008. this.currencySymbols = null;
  62009. this.datePatterns = null;
  62010. this.dateTimeSymbols = null;
  62011. this.numberPatterns = null;
  62012. this.numberSymbols = null;
  62013. this.timePatterns = null;
  62014. this.typeFaces = null;
  62015. }
  62016. }
  62017. class LocaleSet extends _xfa_object.XFAObject {
  62018. constructor(attributes) {
  62019. super(LOCALE_SET_NS_ID, "localeSet", true);
  62020. this.locale = new _xfa_object.XFAObjectArray();
  62021. }
  62022. }
  62023. class Meridiem extends _xfa_object.StringObject {
  62024. constructor(attributes) {
  62025. super(LOCALE_SET_NS_ID, "meridiem");
  62026. }
  62027. }
  62028. class MeridiemNames extends _xfa_object.XFAObject {
  62029. constructor(attributes) {
  62030. super(LOCALE_SET_NS_ID, "meridiemNames", true);
  62031. this.meridiem = new _xfa_object.XFAObjectArray(2);
  62032. }
  62033. }
  62034. class Month extends _xfa_object.StringObject {
  62035. constructor(attributes) {
  62036. super(LOCALE_SET_NS_ID, "month");
  62037. }
  62038. }
  62039. class MonthNames extends _xfa_object.XFAObject {
  62040. constructor(attributes) {
  62041. super(LOCALE_SET_NS_ID, "monthNames", true);
  62042. this.abbr = (0, _utils.getInteger)({
  62043. data: attributes.abbr,
  62044. defaultValue: 0,
  62045. validate: x => x === 1
  62046. });
  62047. this.month = new _xfa_object.XFAObjectArray(12);
  62048. }
  62049. }
  62050. class NumberPattern extends _xfa_object.StringObject {
  62051. constructor(attributes) {
  62052. super(LOCALE_SET_NS_ID, "numberPattern");
  62053. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  62054. }
  62055. }
  62056. class NumberPatterns extends _xfa_object.XFAObject {
  62057. constructor(attributes) {
  62058. super(LOCALE_SET_NS_ID, "numberPatterns", true);
  62059. this.numberPattern = new _xfa_object.XFAObjectArray(4);
  62060. }
  62061. }
  62062. class NumberSymbol extends _xfa_object.StringObject {
  62063. constructor(attributes) {
  62064. super(LOCALE_SET_NS_ID, "numberSymbol");
  62065. this.name = (0, _utils.getStringOption)(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]);
  62066. }
  62067. }
  62068. class NumberSymbols extends _xfa_object.XFAObject {
  62069. constructor(attributes) {
  62070. super(LOCALE_SET_NS_ID, "numberSymbols", true);
  62071. this.numberSymbol = new _xfa_object.XFAObjectArray(5);
  62072. }
  62073. }
  62074. class TimePattern extends _xfa_object.StringObject {
  62075. constructor(attributes) {
  62076. super(LOCALE_SET_NS_ID, "timePattern");
  62077. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  62078. }
  62079. }
  62080. class TimePatterns extends _xfa_object.XFAObject {
  62081. constructor(attributes) {
  62082. super(LOCALE_SET_NS_ID, "timePatterns", true);
  62083. this.timePattern = new _xfa_object.XFAObjectArray(4);
  62084. }
  62085. }
  62086. class TypeFace extends _xfa_object.XFAObject {
  62087. constructor(attributes) {
  62088. super(LOCALE_SET_NS_ID, "typeFace", true);
  62089. this.name = attributes.name | "";
  62090. }
  62091. }
  62092. class TypeFaces extends _xfa_object.XFAObject {
  62093. constructor(attributes) {
  62094. super(LOCALE_SET_NS_ID, "typeFaces", true);
  62095. this.typeFace = new _xfa_object.XFAObjectArray();
  62096. }
  62097. }
  62098. class LocaleSetNamespace {
  62099. static [_namespaces.$buildXFAObject](name, attributes) {
  62100. if (LocaleSetNamespace.hasOwnProperty(name)) {
  62101. return LocaleSetNamespace[name](attributes);
  62102. }
  62103. return undefined;
  62104. }
  62105. static calendarSymbols(attrs) {
  62106. return new CalendarSymbols(attrs);
  62107. }
  62108. static currencySymbol(attrs) {
  62109. return new CurrencySymbol(attrs);
  62110. }
  62111. static currencySymbols(attrs) {
  62112. return new CurrencySymbols(attrs);
  62113. }
  62114. static datePattern(attrs) {
  62115. return new DatePattern(attrs);
  62116. }
  62117. static datePatterns(attrs) {
  62118. return new DatePatterns(attrs);
  62119. }
  62120. static dateTimeSymbols(attrs) {
  62121. return new DateTimeSymbols(attrs);
  62122. }
  62123. static day(attrs) {
  62124. return new Day(attrs);
  62125. }
  62126. static dayNames(attrs) {
  62127. return new DayNames(attrs);
  62128. }
  62129. static era(attrs) {
  62130. return new Era(attrs);
  62131. }
  62132. static eraNames(attrs) {
  62133. return new EraNames(attrs);
  62134. }
  62135. static locale(attrs) {
  62136. return new Locale(attrs);
  62137. }
  62138. static localeSet(attrs) {
  62139. return new LocaleSet(attrs);
  62140. }
  62141. static meridiem(attrs) {
  62142. return new Meridiem(attrs);
  62143. }
  62144. static meridiemNames(attrs) {
  62145. return new MeridiemNames(attrs);
  62146. }
  62147. static month(attrs) {
  62148. return new Month(attrs);
  62149. }
  62150. static monthNames(attrs) {
  62151. return new MonthNames(attrs);
  62152. }
  62153. static numberPattern(attrs) {
  62154. return new NumberPattern(attrs);
  62155. }
  62156. static numberPatterns(attrs) {
  62157. return new NumberPatterns(attrs);
  62158. }
  62159. static numberSymbol(attrs) {
  62160. return new NumberSymbol(attrs);
  62161. }
  62162. static numberSymbols(attrs) {
  62163. return new NumberSymbols(attrs);
  62164. }
  62165. static timePattern(attrs) {
  62166. return new TimePattern(attrs);
  62167. }
  62168. static timePatterns(attrs) {
  62169. return new TimePatterns(attrs);
  62170. }
  62171. static typeFace(attrs) {
  62172. return new TypeFace(attrs);
  62173. }
  62174. static typeFaces(attrs) {
  62175. return new TypeFaces(attrs);
  62176. }
  62177. }
  62178. exports.LocaleSetNamespace = LocaleSetNamespace;
  62179. /***/ }),
  62180. /* 93 */
  62181. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62182. Object.defineProperty(exports, "__esModule", ({
  62183. value: true
  62184. }));
  62185. exports.SignatureNamespace = void 0;
  62186. var _namespaces = __w_pdfjs_require__(77);
  62187. var _xfa_object = __w_pdfjs_require__(75);
  62188. const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id;
  62189. class Signature extends _xfa_object.XFAObject {
  62190. constructor(attributes) {
  62191. super(SIGNATURE_NS_ID, "signature", true);
  62192. }
  62193. }
  62194. class SignatureNamespace {
  62195. static [_namespaces.$buildXFAObject](name, attributes) {
  62196. if (SignatureNamespace.hasOwnProperty(name)) {
  62197. return SignatureNamespace[name](attributes);
  62198. }
  62199. return undefined;
  62200. }
  62201. static signature(attributes) {
  62202. return new Signature(attributes);
  62203. }
  62204. }
  62205. exports.SignatureNamespace = SignatureNamespace;
  62206. /***/ }),
  62207. /* 94 */
  62208. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62209. Object.defineProperty(exports, "__esModule", ({
  62210. value: true
  62211. }));
  62212. exports.StylesheetNamespace = void 0;
  62213. var _namespaces = __w_pdfjs_require__(77);
  62214. var _xfa_object = __w_pdfjs_require__(75);
  62215. const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id;
  62216. class Stylesheet extends _xfa_object.XFAObject {
  62217. constructor(attributes) {
  62218. super(STYLESHEET_NS_ID, "stylesheet", true);
  62219. }
  62220. }
  62221. class StylesheetNamespace {
  62222. static [_namespaces.$buildXFAObject](name, attributes) {
  62223. if (StylesheetNamespace.hasOwnProperty(name)) {
  62224. return StylesheetNamespace[name](attributes);
  62225. }
  62226. return undefined;
  62227. }
  62228. static stylesheet(attributes) {
  62229. return new Stylesheet(attributes);
  62230. }
  62231. }
  62232. exports.StylesheetNamespace = StylesheetNamespace;
  62233. /***/ }),
  62234. /* 95 */
  62235. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62236. Object.defineProperty(exports, "__esModule", ({
  62237. value: true
  62238. }));
  62239. exports.XdpNamespace = void 0;
  62240. var _namespaces = __w_pdfjs_require__(77);
  62241. var _xfa_object = __w_pdfjs_require__(75);
  62242. const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id;
  62243. class Xdp extends _xfa_object.XFAObject {
  62244. constructor(attributes) {
  62245. super(XDP_NS_ID, "xdp", true);
  62246. this.uuid = attributes.uuid || "";
  62247. this.timeStamp = attributes.timeStamp || "";
  62248. this.config = null;
  62249. this.connectionSet = null;
  62250. this.datasets = null;
  62251. this.localeSet = null;
  62252. this.stylesheet = new _xfa_object.XFAObjectArray();
  62253. this.template = null;
  62254. }
  62255. [_xfa_object.$onChildCheck](child) {
  62256. const ns = _namespaces.NamespaceIds[child[_xfa_object.$nodeName]];
  62257. return ns && child[_xfa_object.$namespaceId] === ns.id;
  62258. }
  62259. }
  62260. class XdpNamespace {
  62261. static [_namespaces.$buildXFAObject](name, attributes) {
  62262. if (XdpNamespace.hasOwnProperty(name)) {
  62263. return XdpNamespace[name](attributes);
  62264. }
  62265. return undefined;
  62266. }
  62267. static xdp(attributes) {
  62268. return new Xdp(attributes);
  62269. }
  62270. }
  62271. exports.XdpNamespace = XdpNamespace;
  62272. /***/ }),
  62273. /* 96 */
  62274. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62275. Object.defineProperty(exports, "__esModule", ({
  62276. value: true
  62277. }));
  62278. exports.XhtmlNamespace = void 0;
  62279. var _xfa_object = __w_pdfjs_require__(75);
  62280. var _namespaces = __w_pdfjs_require__(77);
  62281. var _html_utils = __w_pdfjs_require__(82);
  62282. var _utils = __w_pdfjs_require__(76);
  62283. const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id;
  62284. const $richText = Symbol();
  62285. const VALID_STYLES = new Set(["color", "font", "font-family", "font-size", "font-stretch", "font-style", "font-weight", "margin", "margin-bottom", "margin-left", "margin-right", "margin-top", "letter-spacing", "line-height", "orphans", "page-break-after", "page-break-before", "page-break-inside", "tab-interval", "tab-stop", "text-align", "text-decoration", "text-indent", "vertical-align", "widows", "kerning-mode", "xfa-font-horizontal-scale", "xfa-font-vertical-scale", "xfa-spacerun", "xfa-tab-stops"]);
  62286. const StyleMapping = new Map([["page-break-after", "breakAfter"], ["page-break-before", "breakBefore"], ["page-break-inside", "breakInside"], ["kerning-mode", value => value === "none" ? "none" : "normal"], ["xfa-font-horizontal-scale", value => `scaleX(${Math.max(0, Math.min(parseInt(value) / 100)).toFixed(2)})`], ["xfa-font-vertical-scale", value => `scaleY(${Math.max(0, Math.min(parseInt(value) / 100)).toFixed(2)})`], ["xfa-spacerun", ""], ["xfa-tab-stops", ""], ["font-size", (value, original) => {
  62287. value = original.fontSize = (0, _utils.getMeasurement)(value);
  62288. return (0, _html_utils.measureToString)(0.99 * value);
  62289. }], ["letter-spacing", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["line-height", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-bottom", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-left", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-right", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-top", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["text-indent", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["font-family", value => value], ["vertical-align", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))]]);
  62290. const spacesRegExp = /\s+/g;
  62291. const crlfRegExp = /[\r\n]+/g;
  62292. const crlfForRichTextRegExp = /\r\n?/g;
  62293. function mapStyle(styleStr, node, richText) {
  62294. const style = Object.create(null);
  62295. if (!styleStr) {
  62296. return style;
  62297. }
  62298. const original = Object.create(null);
  62299. for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) {
  62300. const mapping = StyleMapping.get(key);
  62301. if (mapping === "") {
  62302. continue;
  62303. }
  62304. let newValue = value;
  62305. if (mapping) {
  62306. if (typeof mapping === "string") {
  62307. newValue = mapping;
  62308. } else {
  62309. newValue = mapping(value, original);
  62310. }
  62311. }
  62312. if (key.endsWith("scale")) {
  62313. if (style.transform) {
  62314. style.transform = `${style[key]} ${newValue}`;
  62315. } else {
  62316. style.transform = newValue;
  62317. }
  62318. } else {
  62319. style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue;
  62320. }
  62321. }
  62322. if (style.fontFamily) {
  62323. (0, _html_utils.setFontFamily)({
  62324. typeface: style.fontFamily,
  62325. weight: style.fontWeight || "normal",
  62326. posture: style.fontStyle || "normal",
  62327. size: original.fontSize || 0
  62328. }, node, node[_xfa_object.$globalData].fontFinder, style);
  62329. }
  62330. if (richText && style.verticalAlign && style.verticalAlign !== "0px" && style.fontSize) {
  62331. const SUB_SUPER_SCRIPT_FACTOR = 0.583;
  62332. const VERTICAL_FACTOR = 0.333;
  62333. const fontSize = (0, _utils.getMeasurement)(style.fontSize);
  62334. style.fontSize = (0, _html_utils.measureToString)(fontSize * SUB_SUPER_SCRIPT_FACTOR);
  62335. style.verticalAlign = (0, _html_utils.measureToString)(Math.sign((0, _utils.getMeasurement)(style.verticalAlign)) * fontSize * VERTICAL_FACTOR);
  62336. }
  62337. if (richText && style.fontSize) {
  62338. style.fontSize = `calc(${style.fontSize} * var(--scale-factor))`;
  62339. }
  62340. (0, _html_utils.fixTextIndent)(style);
  62341. return style;
  62342. }
  62343. function checkStyle(node) {
  62344. if (!node.style) {
  62345. return "";
  62346. }
  62347. return node.style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(([key, value]) => {
  62348. if (key === "font-family") {
  62349. node[_xfa_object.$globalData].usedTypefaces.add(value);
  62350. }
  62351. return VALID_STYLES.has(key);
  62352. }).map(kv => kv.join(":")).join(";");
  62353. }
  62354. const NoWhites = new Set(["body", "html"]);
  62355. class XhtmlObject extends _xfa_object.XmlObject {
  62356. constructor(attributes, name) {
  62357. super(XHTML_NS_ID, name);
  62358. this[$richText] = false;
  62359. this.style = attributes.style || "";
  62360. }
  62361. [_xfa_object.$clean](builder) {
  62362. super[_xfa_object.$clean](builder);
  62363. this.style = checkStyle(this);
  62364. }
  62365. [_xfa_object.$acceptWhitespace]() {
  62366. return !NoWhites.has(this[_xfa_object.$nodeName]);
  62367. }
  62368. [_xfa_object.$onText](str, richText = false) {
  62369. if (!richText) {
  62370. str = str.replace(crlfRegExp, "");
  62371. if (!this.style.includes("xfa-spacerun:yes")) {
  62372. str = str.replace(spacesRegExp, " ");
  62373. }
  62374. } else {
  62375. this[$richText] = true;
  62376. }
  62377. if (str) {
  62378. this[_xfa_object.$content] += str;
  62379. }
  62380. }
  62381. [_xfa_object.$pushGlyphs](measure, mustPop = true) {
  62382. const xfaFont = Object.create(null);
  62383. const margin = {
  62384. top: NaN,
  62385. bottom: NaN,
  62386. left: NaN,
  62387. right: NaN
  62388. };
  62389. let lineHeight = null;
  62390. for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) {
  62391. switch (key) {
  62392. case "font-family":
  62393. xfaFont.typeface = (0, _utils.stripQuotes)(value);
  62394. break;
  62395. case "font-size":
  62396. xfaFont.size = (0, _utils.getMeasurement)(value);
  62397. break;
  62398. case "font-weight":
  62399. xfaFont.weight = value;
  62400. break;
  62401. case "font-style":
  62402. xfaFont.posture = value;
  62403. break;
  62404. case "letter-spacing":
  62405. xfaFont.letterSpacing = (0, _utils.getMeasurement)(value);
  62406. break;
  62407. case "margin":
  62408. const values = value.split(/ \t/).map(x => (0, _utils.getMeasurement)(x));
  62409. switch (values.length) {
  62410. case 1:
  62411. margin.top = margin.bottom = margin.left = margin.right = values[0];
  62412. break;
  62413. case 2:
  62414. margin.top = margin.bottom = values[0];
  62415. margin.left = margin.right = values[1];
  62416. break;
  62417. case 3:
  62418. margin.top = values[0];
  62419. margin.bottom = values[2];
  62420. margin.left = margin.right = values[1];
  62421. break;
  62422. case 4:
  62423. margin.top = values[0];
  62424. margin.left = values[1];
  62425. margin.bottom = values[2];
  62426. margin.right = values[3];
  62427. break;
  62428. }
  62429. break;
  62430. case "margin-top":
  62431. margin.top = (0, _utils.getMeasurement)(value);
  62432. break;
  62433. case "margin-bottom":
  62434. margin.bottom = (0, _utils.getMeasurement)(value);
  62435. break;
  62436. case "margin-left":
  62437. margin.left = (0, _utils.getMeasurement)(value);
  62438. break;
  62439. case "margin-right":
  62440. margin.right = (0, _utils.getMeasurement)(value);
  62441. break;
  62442. case "line-height":
  62443. lineHeight = (0, _utils.getMeasurement)(value);
  62444. break;
  62445. }
  62446. }
  62447. measure.pushData(xfaFont, margin, lineHeight);
  62448. if (this[_xfa_object.$content]) {
  62449. measure.addString(this[_xfa_object.$content]);
  62450. } else {
  62451. for (const child of this[_xfa_object.$getChildren]()) {
  62452. if (child[_xfa_object.$nodeName] === "#text") {
  62453. measure.addString(child[_xfa_object.$content]);
  62454. continue;
  62455. }
  62456. child[_xfa_object.$pushGlyphs](measure);
  62457. }
  62458. }
  62459. if (mustPop) {
  62460. measure.popFont();
  62461. }
  62462. }
  62463. [_xfa_object.$toHTML](availableSpace) {
  62464. const children = [];
  62465. this[_xfa_object.$extra] = {
  62466. children
  62467. };
  62468. this[_xfa_object.$childrenToHTML]({});
  62469. if (children.length === 0 && !this[_xfa_object.$content]) {
  62470. return _utils.HTMLResult.EMPTY;
  62471. }
  62472. let value;
  62473. if (this[$richText]) {
  62474. value = this[_xfa_object.$content] ? this[_xfa_object.$content].replace(crlfForRichTextRegExp, "\n") : undefined;
  62475. } else {
  62476. value = this[_xfa_object.$content] || undefined;
  62477. }
  62478. return _utils.HTMLResult.success({
  62479. name: this[_xfa_object.$nodeName],
  62480. attributes: {
  62481. href: this.href,
  62482. style: mapStyle(this.style, this, this[$richText])
  62483. },
  62484. children,
  62485. value
  62486. });
  62487. }
  62488. }
  62489. class A extends XhtmlObject {
  62490. constructor(attributes) {
  62491. super(attributes, "a");
  62492. this.href = (0, _html_utils.fixURL)(attributes.href) || "";
  62493. }
  62494. }
  62495. class B extends XhtmlObject {
  62496. constructor(attributes) {
  62497. super(attributes, "b");
  62498. }
  62499. [_xfa_object.$pushGlyphs](measure) {
  62500. measure.pushFont({
  62501. weight: "bold"
  62502. });
  62503. super[_xfa_object.$pushGlyphs](measure);
  62504. measure.popFont();
  62505. }
  62506. }
  62507. class Body extends XhtmlObject {
  62508. constructor(attributes) {
  62509. super(attributes, "body");
  62510. }
  62511. [_xfa_object.$toHTML](availableSpace) {
  62512. const res = super[_xfa_object.$toHTML](availableSpace);
  62513. const {
  62514. html
  62515. } = res;
  62516. if (!html) {
  62517. return _utils.HTMLResult.EMPTY;
  62518. }
  62519. html.name = "div";
  62520. html.attributes.class = ["xfaRich"];
  62521. return res;
  62522. }
  62523. }
  62524. class Br extends XhtmlObject {
  62525. constructor(attributes) {
  62526. super(attributes, "br");
  62527. }
  62528. [_xfa_object.$text]() {
  62529. return "\n";
  62530. }
  62531. [_xfa_object.$pushGlyphs](measure) {
  62532. measure.addString("\n");
  62533. }
  62534. [_xfa_object.$toHTML](availableSpace) {
  62535. return _utils.HTMLResult.success({
  62536. name: "br"
  62537. });
  62538. }
  62539. }
  62540. class Html extends XhtmlObject {
  62541. constructor(attributes) {
  62542. super(attributes, "html");
  62543. }
  62544. [_xfa_object.$toHTML](availableSpace) {
  62545. const children = [];
  62546. this[_xfa_object.$extra] = {
  62547. children
  62548. };
  62549. this[_xfa_object.$childrenToHTML]({});
  62550. if (children.length === 0) {
  62551. return _utils.HTMLResult.success({
  62552. name: "div",
  62553. attributes: {
  62554. class: ["xfaRich"],
  62555. style: {}
  62556. },
  62557. value: this[_xfa_object.$content] || ""
  62558. });
  62559. }
  62560. if (children.length === 1) {
  62561. const child = children[0];
  62562. if (child.attributes && child.attributes.class.includes("xfaRich")) {
  62563. return _utils.HTMLResult.success(child);
  62564. }
  62565. }
  62566. return _utils.HTMLResult.success({
  62567. name: "div",
  62568. attributes: {
  62569. class: ["xfaRich"],
  62570. style: {}
  62571. },
  62572. children
  62573. });
  62574. }
  62575. }
  62576. class I extends XhtmlObject {
  62577. constructor(attributes) {
  62578. super(attributes, "i");
  62579. }
  62580. [_xfa_object.$pushGlyphs](measure) {
  62581. measure.pushFont({
  62582. posture: "italic"
  62583. });
  62584. super[_xfa_object.$pushGlyphs](measure);
  62585. measure.popFont();
  62586. }
  62587. }
  62588. class Li extends XhtmlObject {
  62589. constructor(attributes) {
  62590. super(attributes, "li");
  62591. }
  62592. }
  62593. class Ol extends XhtmlObject {
  62594. constructor(attributes) {
  62595. super(attributes, "ol");
  62596. }
  62597. }
  62598. class P extends XhtmlObject {
  62599. constructor(attributes) {
  62600. super(attributes, "p");
  62601. }
  62602. [_xfa_object.$pushGlyphs](measure) {
  62603. super[_xfa_object.$pushGlyphs](measure, false);
  62604. measure.addString("\n");
  62605. measure.addPara();
  62606. measure.popFont();
  62607. }
  62608. [_xfa_object.$text]() {
  62609. const siblings = this[_xfa_object.$getParent]()[_xfa_object.$getChildren]();
  62610. if (siblings.at(-1) === this) {
  62611. return super[_xfa_object.$text]();
  62612. }
  62613. return super[_xfa_object.$text]() + "\n";
  62614. }
  62615. }
  62616. class Span extends XhtmlObject {
  62617. constructor(attributes) {
  62618. super(attributes, "span");
  62619. }
  62620. }
  62621. class Sub extends XhtmlObject {
  62622. constructor(attributes) {
  62623. super(attributes, "sub");
  62624. }
  62625. }
  62626. class Sup extends XhtmlObject {
  62627. constructor(attributes) {
  62628. super(attributes, "sup");
  62629. }
  62630. }
  62631. class Ul extends XhtmlObject {
  62632. constructor(attributes) {
  62633. super(attributes, "ul");
  62634. }
  62635. }
  62636. class XhtmlNamespace {
  62637. static [_namespaces.$buildXFAObject](name, attributes) {
  62638. if (XhtmlNamespace.hasOwnProperty(name)) {
  62639. return XhtmlNamespace[name](attributes);
  62640. }
  62641. return undefined;
  62642. }
  62643. static a(attributes) {
  62644. return new A(attributes);
  62645. }
  62646. static b(attributes) {
  62647. return new B(attributes);
  62648. }
  62649. static body(attributes) {
  62650. return new Body(attributes);
  62651. }
  62652. static br(attributes) {
  62653. return new Br(attributes);
  62654. }
  62655. static html(attributes) {
  62656. return new Html(attributes);
  62657. }
  62658. static i(attributes) {
  62659. return new I(attributes);
  62660. }
  62661. static li(attributes) {
  62662. return new Li(attributes);
  62663. }
  62664. static ol(attributes) {
  62665. return new Ol(attributes);
  62666. }
  62667. static p(attributes) {
  62668. return new P(attributes);
  62669. }
  62670. static span(attributes) {
  62671. return new Span(attributes);
  62672. }
  62673. static sub(attributes) {
  62674. return new Sub(attributes);
  62675. }
  62676. static sup(attributes) {
  62677. return new Sup(attributes);
  62678. }
  62679. static ul(attributes) {
  62680. return new Ul(attributes);
  62681. }
  62682. }
  62683. exports.XhtmlNamespace = XhtmlNamespace;
  62684. /***/ }),
  62685. /* 97 */
  62686. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62687. Object.defineProperty(exports, "__esModule", ({
  62688. value: true
  62689. }));
  62690. exports.UnknownNamespace = void 0;
  62691. var _namespaces = __w_pdfjs_require__(77);
  62692. var _xfa_object = __w_pdfjs_require__(75);
  62693. class UnknownNamespace {
  62694. constructor(nsId) {
  62695. this.namespaceId = nsId;
  62696. }
  62697. [_namespaces.$buildXFAObject](name, attributes) {
  62698. return new _xfa_object.XmlObject(this.namespaceId, name, attributes);
  62699. }
  62700. }
  62701. exports.UnknownNamespace = UnknownNamespace;
  62702. /***/ }),
  62703. /* 98 */
  62704. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62705. Object.defineProperty(exports, "__esModule", ({
  62706. value: true
  62707. }));
  62708. exports.DatasetReader = void 0;
  62709. var _util = __w_pdfjs_require__(2);
  62710. var _core_utils = __w_pdfjs_require__(4);
  62711. var _xml_parser = __w_pdfjs_require__(64);
  62712. function decodeString(str) {
  62713. try {
  62714. return (0, _util.stringToUTF8String)(str);
  62715. } catch (ex) {
  62716. (0, _util.warn)(`UTF-8 decoding failed: "${ex}".`);
  62717. return str;
  62718. }
  62719. }
  62720. class DatasetXMLParser extends _xml_parser.SimpleXMLParser {
  62721. constructor(options) {
  62722. super(options);
  62723. this.node = null;
  62724. }
  62725. onEndElement(name) {
  62726. const node = super.onEndElement(name);
  62727. if (node && name === "xfa:datasets") {
  62728. this.node = node;
  62729. throw new Error("Aborting DatasetXMLParser.");
  62730. }
  62731. }
  62732. }
  62733. class DatasetReader {
  62734. constructor(data) {
  62735. if (data.datasets) {
  62736. this.node = new _xml_parser.SimpleXMLParser({
  62737. hasAttributes: true
  62738. }).parseFromString(data.datasets).documentElement;
  62739. } else {
  62740. const parser = new DatasetXMLParser({
  62741. hasAttributes: true
  62742. });
  62743. try {
  62744. parser.parseFromString(data["xdp:xdp"]);
  62745. } catch (_) {}
  62746. this.node = parser.node;
  62747. }
  62748. }
  62749. getValue(path) {
  62750. if (!this.node || !path) {
  62751. return "";
  62752. }
  62753. const node = this.node.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  62754. if (!node) {
  62755. return "";
  62756. }
  62757. const first = node.firstChild;
  62758. if (first && first.nodeName === "value") {
  62759. return node.children.map(child => decodeString(child.textContent));
  62760. }
  62761. return decodeString(node.textContent);
  62762. }
  62763. }
  62764. exports.DatasetReader = DatasetReader;
  62765. /***/ }),
  62766. /* 99 */
  62767. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62768. Object.defineProperty(exports, "__esModule", ({
  62769. value: true
  62770. }));
  62771. exports.XRef = void 0;
  62772. var _util = __w_pdfjs_require__(2);
  62773. var _primitives = __w_pdfjs_require__(3);
  62774. var _core_utils = __w_pdfjs_require__(4);
  62775. var _parser = __w_pdfjs_require__(15);
  62776. var _base_stream = __w_pdfjs_require__(5);
  62777. var _crypto = __w_pdfjs_require__(65);
  62778. class XRef {
  62779. constructor(stream, pdfManager) {
  62780. this.stream = stream;
  62781. this.pdfManager = pdfManager;
  62782. this.entries = [];
  62783. this.xrefstms = Object.create(null);
  62784. this._cacheMap = new Map();
  62785. this._pendingRefs = new _primitives.RefSet();
  62786. this.stats = new _core_utils.DocStats(pdfManager.msgHandler);
  62787. this._newPersistentRefNum = null;
  62788. this._newTemporaryRefNum = null;
  62789. }
  62790. getNewPersistentRef(obj) {
  62791. if (this._newPersistentRefNum === null) {
  62792. this._newPersistentRefNum = this.entries.length || 1;
  62793. }
  62794. const num = this._newPersistentRefNum++;
  62795. this._cacheMap.set(num, obj);
  62796. return _primitives.Ref.get(num, 0);
  62797. }
  62798. getNewTemporaryRef() {
  62799. if (this._newTemporaryRefNum === null) {
  62800. this._newTemporaryRefNum = this.entries.length || 1;
  62801. }
  62802. return _primitives.Ref.get(this._newTemporaryRefNum++, 0);
  62803. }
  62804. resetNewTemporaryRef() {
  62805. this._newTemporaryRefNum = null;
  62806. }
  62807. setStartXRef(startXRef) {
  62808. this.startXRefQueue = [startXRef];
  62809. }
  62810. parse(recoveryMode = false) {
  62811. let trailerDict;
  62812. if (!recoveryMode) {
  62813. trailerDict = this.readXRef();
  62814. } else {
  62815. (0, _util.warn)("Indexing all PDF objects");
  62816. trailerDict = this.indexObjects();
  62817. }
  62818. trailerDict.assignXref(this);
  62819. this.trailer = trailerDict;
  62820. let encrypt;
  62821. try {
  62822. encrypt = trailerDict.get("Encrypt");
  62823. } catch (ex) {
  62824. if (ex instanceof _core_utils.MissingDataException) {
  62825. throw ex;
  62826. }
  62827. (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
  62828. }
  62829. if (encrypt instanceof _primitives.Dict) {
  62830. const ids = trailerDict.get("ID");
  62831. const fileId = ids && ids.length ? ids[0] : "";
  62832. encrypt.suppressEncryption = true;
  62833. this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  62834. }
  62835. let root;
  62836. try {
  62837. root = trailerDict.get("Root");
  62838. } catch (ex) {
  62839. if (ex instanceof _core_utils.MissingDataException) {
  62840. throw ex;
  62841. }
  62842. (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
  62843. }
  62844. if (root instanceof _primitives.Dict) {
  62845. try {
  62846. const pages = root.get("Pages");
  62847. if (pages instanceof _primitives.Dict) {
  62848. this.root = root;
  62849. return;
  62850. }
  62851. } catch (ex) {
  62852. if (ex instanceof _core_utils.MissingDataException) {
  62853. throw ex;
  62854. }
  62855. (0, _util.warn)(`XRef.parse - Invalid "Pages" reference: "${ex}".`);
  62856. }
  62857. }
  62858. if (!recoveryMode) {
  62859. throw new _core_utils.XRefParseException();
  62860. }
  62861. throw new _util.InvalidPDFException("Invalid Root reference.");
  62862. }
  62863. processXRefTable(parser) {
  62864. if (!("tableState" in this)) {
  62865. this.tableState = {
  62866. entryNum: 0,
  62867. streamPos: parser.lexer.stream.pos,
  62868. parserBuf1: parser.buf1,
  62869. parserBuf2: parser.buf2
  62870. };
  62871. }
  62872. const obj = this.readXRefTable(parser);
  62873. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  62874. throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary");
  62875. }
  62876. let dict = parser.getObj();
  62877. if (!(dict instanceof _primitives.Dict) && dict.dict) {
  62878. dict = dict.dict;
  62879. }
  62880. if (!(dict instanceof _primitives.Dict)) {
  62881. throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary");
  62882. }
  62883. delete this.tableState;
  62884. return dict;
  62885. }
  62886. readXRefTable(parser) {
  62887. const stream = parser.lexer.stream;
  62888. const tableState = this.tableState;
  62889. stream.pos = tableState.streamPos;
  62890. parser.buf1 = tableState.parserBuf1;
  62891. parser.buf2 = tableState.parserBuf2;
  62892. let obj;
  62893. while (true) {
  62894. if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
  62895. if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) {
  62896. break;
  62897. }
  62898. tableState.firstEntryNum = obj;
  62899. tableState.entryCount = parser.getObj();
  62900. }
  62901. let first = tableState.firstEntryNum;
  62902. const count = tableState.entryCount;
  62903. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  62904. throw new _util.FormatError("Invalid XRef table: wrong types in subsection header");
  62905. }
  62906. for (let i = tableState.entryNum; i < count; i++) {
  62907. tableState.streamPos = stream.pos;
  62908. tableState.entryNum = i;
  62909. tableState.parserBuf1 = parser.buf1;
  62910. tableState.parserBuf2 = parser.buf2;
  62911. const entry = {};
  62912. entry.offset = parser.getObj();
  62913. entry.gen = parser.getObj();
  62914. const type = parser.getObj();
  62915. if (type instanceof _primitives.Cmd) {
  62916. switch (type.cmd) {
  62917. case "f":
  62918. entry.free = true;
  62919. break;
  62920. case "n":
  62921. entry.uncompressed = true;
  62922. break;
  62923. }
  62924. }
  62925. if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
  62926. throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
  62927. }
  62928. if (i === 0 && entry.free && first === 1) {
  62929. first = 0;
  62930. }
  62931. if (!this.entries[i + first]) {
  62932. this.entries[i + first] = entry;
  62933. }
  62934. }
  62935. tableState.entryNum = 0;
  62936. tableState.streamPos = stream.pos;
  62937. tableState.parserBuf1 = parser.buf1;
  62938. tableState.parserBuf2 = parser.buf2;
  62939. delete tableState.firstEntryNum;
  62940. delete tableState.entryCount;
  62941. }
  62942. if (this.entries[0] && !this.entries[0].free) {
  62943. throw new _util.FormatError("Invalid XRef table: unexpected first object");
  62944. }
  62945. return obj;
  62946. }
  62947. processXRefStream(stream) {
  62948. if (!("streamState" in this)) {
  62949. const streamParameters = stream.dict;
  62950. const byteWidths = streamParameters.get("W");
  62951. let range = streamParameters.get("Index");
  62952. if (!range) {
  62953. range = [0, streamParameters.get("Size")];
  62954. }
  62955. this.streamState = {
  62956. entryRanges: range,
  62957. byteWidths,
  62958. entryNum: 0,
  62959. streamPos: stream.pos
  62960. };
  62961. }
  62962. this.readXRefStream(stream);
  62963. delete this.streamState;
  62964. return stream.dict;
  62965. }
  62966. readXRefStream(stream) {
  62967. const streamState = this.streamState;
  62968. stream.pos = streamState.streamPos;
  62969. const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths;
  62970. const entryRanges = streamState.entryRanges;
  62971. while (entryRanges.length > 0) {
  62972. const [first, n] = entryRanges;
  62973. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  62974. throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
  62975. }
  62976. if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
  62977. throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
  62978. }
  62979. for (let i = streamState.entryNum; i < n; ++i) {
  62980. streamState.entryNum = i;
  62981. streamState.streamPos = stream.pos;
  62982. let type = 0,
  62983. offset = 0,
  62984. generation = 0;
  62985. for (let j = 0; j < typeFieldWidth; ++j) {
  62986. const typeByte = stream.getByte();
  62987. if (typeByte === -1) {
  62988. throw new _util.FormatError("Invalid XRef byteWidths 'type'.");
  62989. }
  62990. type = type << 8 | typeByte;
  62991. }
  62992. if (typeFieldWidth === 0) {
  62993. type = 1;
  62994. }
  62995. for (let j = 0; j < offsetFieldWidth; ++j) {
  62996. const offsetByte = stream.getByte();
  62997. if (offsetByte === -1) {
  62998. throw new _util.FormatError("Invalid XRef byteWidths 'offset'.");
  62999. }
  63000. offset = offset << 8 | offsetByte;
  63001. }
  63002. for (let j = 0; j < generationFieldWidth; ++j) {
  63003. const generationByte = stream.getByte();
  63004. if (generationByte === -1) {
  63005. throw new _util.FormatError("Invalid XRef byteWidths 'generation'.");
  63006. }
  63007. generation = generation << 8 | generationByte;
  63008. }
  63009. const entry = {};
  63010. entry.offset = offset;
  63011. entry.gen = generation;
  63012. switch (type) {
  63013. case 0:
  63014. entry.free = true;
  63015. break;
  63016. case 1:
  63017. entry.uncompressed = true;
  63018. break;
  63019. case 2:
  63020. break;
  63021. default:
  63022. throw new _util.FormatError(`Invalid XRef entry type: ${type}`);
  63023. }
  63024. if (!this.entries[first + i]) {
  63025. this.entries[first + i] = entry;
  63026. }
  63027. }
  63028. streamState.entryNum = 0;
  63029. streamState.streamPos = stream.pos;
  63030. entryRanges.splice(0, 2);
  63031. }
  63032. }
  63033. indexObjects() {
  63034. const TAB = 0x9,
  63035. LF = 0xa,
  63036. CR = 0xd,
  63037. SPACE = 0x20;
  63038. const PERCENT = 0x25,
  63039. LT = 0x3c;
  63040. function readToken(data, offset) {
  63041. let token = "",
  63042. ch = data[offset];
  63043. while (ch !== LF && ch !== CR && ch !== LT) {
  63044. if (++offset >= data.length) {
  63045. break;
  63046. }
  63047. token += String.fromCharCode(ch);
  63048. ch = data[offset];
  63049. }
  63050. return token;
  63051. }
  63052. function skipUntil(data, offset, what) {
  63053. const length = what.length,
  63054. dataLength = data.length;
  63055. let skipped = 0;
  63056. while (offset < dataLength) {
  63057. let i = 0;
  63058. while (i < length && data[offset + i] === what[i]) {
  63059. ++i;
  63060. }
  63061. if (i >= length) {
  63062. break;
  63063. }
  63064. offset++;
  63065. skipped++;
  63066. }
  63067. return skipped;
  63068. }
  63069. const gEndobjRegExp = /\b(endobj|\d+\s+\d+\s+obj|xref|trailer)\b/g;
  63070. const gStartxrefRegExp = /\b(startxref|\d+\s+\d+\s+obj)\b/g;
  63071. const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  63072. const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  63073. const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  63074. const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  63075. this.entries.length = 0;
  63076. this._cacheMap.clear();
  63077. const stream = this.stream;
  63078. stream.pos = 0;
  63079. const buffer = stream.getBytes(),
  63080. bufferStr = (0, _util.bytesToString)(buffer),
  63081. length = buffer.length;
  63082. let position = stream.start;
  63083. const trailers = [],
  63084. xrefStms = [];
  63085. while (position < length) {
  63086. let ch = buffer[position];
  63087. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  63088. ++position;
  63089. continue;
  63090. }
  63091. if (ch === PERCENT) {
  63092. do {
  63093. ++position;
  63094. if (position >= length) {
  63095. break;
  63096. }
  63097. ch = buffer[position];
  63098. } while (ch !== LF && ch !== CR);
  63099. continue;
  63100. }
  63101. const token = readToken(buffer, position);
  63102. let m;
  63103. if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
  63104. position += skipUntil(buffer, position, trailerBytes);
  63105. trailers.push(position);
  63106. position += skipUntil(buffer, position, startxrefBytes);
  63107. } else if (m = objRegExp.exec(token)) {
  63108. const num = m[1] | 0,
  63109. gen = m[2] | 0;
  63110. const startPos = position + token.length;
  63111. let contentLength,
  63112. updateEntries = false;
  63113. if (!this.entries[num]) {
  63114. updateEntries = true;
  63115. } else if (this.entries[num].gen === gen) {
  63116. try {
  63117. const parser = new _parser.Parser({
  63118. lexer: new _parser.Lexer(stream.makeSubStream(startPos))
  63119. });
  63120. parser.getObj();
  63121. updateEntries = true;
  63122. } catch (ex) {
  63123. if (ex instanceof _core_utils.ParserEOFException) {
  63124. (0, _util.warn)(`indexObjects -- checking object (${token}): "${ex}".`);
  63125. } else {
  63126. updateEntries = true;
  63127. }
  63128. }
  63129. }
  63130. if (updateEntries) {
  63131. this.entries[num] = {
  63132. offset: position - stream.start,
  63133. gen,
  63134. uncompressed: true
  63135. };
  63136. }
  63137. gEndobjRegExp.lastIndex = startPos;
  63138. const match = gEndobjRegExp.exec(bufferStr);
  63139. if (match) {
  63140. const endPos = gEndobjRegExp.lastIndex + 1;
  63141. contentLength = endPos - position;
  63142. if (match[1] !== "endobj") {
  63143. (0, _util.warn)(`indexObjects: Found "${match[1]}" inside of another "obj", ` + 'caused by missing "endobj" -- trying to recover.');
  63144. contentLength -= match[1].length + 1;
  63145. }
  63146. } else {
  63147. contentLength = length - position;
  63148. }
  63149. const content = buffer.subarray(position, position + contentLength);
  63150. const xrefTagOffset = skipUntil(content, 0, xrefBytes);
  63151. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  63152. xrefStms.push(position - stream.start);
  63153. this.xrefstms[position - stream.start] = 1;
  63154. }
  63155. position += contentLength;
  63156. } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
  63157. trailers.push(position);
  63158. const startPos = position + token.length;
  63159. let contentLength;
  63160. gStartxrefRegExp.lastIndex = startPos;
  63161. const match = gStartxrefRegExp.exec(bufferStr);
  63162. if (match) {
  63163. const endPos = gStartxrefRegExp.lastIndex + 1;
  63164. contentLength = endPos - position;
  63165. if (match[1] !== "startxref") {
  63166. (0, _util.warn)(`indexObjects: Found "${match[1]}" after "trailer", ` + 'caused by missing "startxref" -- trying to recover.');
  63167. contentLength -= match[1].length + 1;
  63168. }
  63169. } else {
  63170. contentLength = length - position;
  63171. }
  63172. position += contentLength;
  63173. } else {
  63174. position += token.length + 1;
  63175. }
  63176. }
  63177. for (const xrefStm of xrefStms) {
  63178. this.startXRefQueue.push(xrefStm);
  63179. this.readXRef(true);
  63180. }
  63181. let trailerDict, trailerError;
  63182. for (const trailer of [...trailers, "generationFallback", ...trailers]) {
  63183. if (trailer === "generationFallback") {
  63184. if (!trailerError) {
  63185. break;
  63186. }
  63187. this._generationFallback = true;
  63188. continue;
  63189. }
  63190. stream.pos = trailer;
  63191. const parser = new _parser.Parser({
  63192. lexer: new _parser.Lexer(stream),
  63193. xref: this,
  63194. allowStreams: true,
  63195. recoveryMode: true
  63196. });
  63197. const obj = parser.getObj();
  63198. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  63199. continue;
  63200. }
  63201. const dict = parser.getObj();
  63202. if (!(dict instanceof _primitives.Dict)) {
  63203. continue;
  63204. }
  63205. let validPagesDict = false;
  63206. try {
  63207. const rootDict = dict.get("Root");
  63208. if (!(rootDict instanceof _primitives.Dict)) {
  63209. continue;
  63210. }
  63211. const pagesDict = rootDict.get("Pages");
  63212. if (!(pagesDict instanceof _primitives.Dict)) {
  63213. continue;
  63214. }
  63215. const pagesCount = pagesDict.get("Count");
  63216. if (Number.isInteger(pagesCount)) {
  63217. validPagesDict = true;
  63218. }
  63219. } catch (ex) {
  63220. trailerError = ex;
  63221. continue;
  63222. }
  63223. if (validPagesDict && dict.has("ID")) {
  63224. return dict;
  63225. }
  63226. trailerDict = dict;
  63227. }
  63228. if (trailerDict) {
  63229. return trailerDict;
  63230. }
  63231. if (this.topDict) {
  63232. return this.topDict;
  63233. }
  63234. throw new _util.InvalidPDFException("Invalid PDF structure.");
  63235. }
  63236. readXRef(recoveryMode = false) {
  63237. const stream = this.stream;
  63238. const startXRefParsedCache = new Set();
  63239. while (this.startXRefQueue.length) {
  63240. try {
  63241. const startXRef = this.startXRefQueue[0];
  63242. if (startXRefParsedCache.has(startXRef)) {
  63243. (0, _util.warn)("readXRef - skipping XRef table since it was already parsed.");
  63244. this.startXRefQueue.shift();
  63245. continue;
  63246. }
  63247. startXRefParsedCache.add(startXRef);
  63248. stream.pos = startXRef + stream.start;
  63249. const parser = new _parser.Parser({
  63250. lexer: new _parser.Lexer(stream),
  63251. xref: this,
  63252. allowStreams: true
  63253. });
  63254. let obj = parser.getObj();
  63255. let dict;
  63256. if ((0, _primitives.isCmd)(obj, "xref")) {
  63257. dict = this.processXRefTable(parser);
  63258. if (!this.topDict) {
  63259. this.topDict = dict;
  63260. }
  63261. obj = dict.get("XRefStm");
  63262. if (Number.isInteger(obj)) {
  63263. const pos = obj;
  63264. if (!(pos in this.xrefstms)) {
  63265. this.xrefstms[pos] = 1;
  63266. this.startXRefQueue.push(pos);
  63267. }
  63268. }
  63269. } else if (Number.isInteger(obj)) {
  63270. if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !((obj = parser.getObj()) instanceof _base_stream.BaseStream)) {
  63271. throw new _util.FormatError("Invalid XRef stream");
  63272. }
  63273. dict = this.processXRefStream(obj);
  63274. if (!this.topDict) {
  63275. this.topDict = dict;
  63276. }
  63277. if (!dict) {
  63278. throw new _util.FormatError("Failed to read XRef stream");
  63279. }
  63280. } else {
  63281. throw new _util.FormatError("Invalid XRef stream header");
  63282. }
  63283. obj = dict.get("Prev");
  63284. if (Number.isInteger(obj)) {
  63285. this.startXRefQueue.push(obj);
  63286. } else if (obj instanceof _primitives.Ref) {
  63287. this.startXRefQueue.push(obj.num);
  63288. }
  63289. } catch (e) {
  63290. if (e instanceof _core_utils.MissingDataException) {
  63291. throw e;
  63292. }
  63293. (0, _util.info)("(while reading XRef): " + e);
  63294. }
  63295. this.startXRefQueue.shift();
  63296. }
  63297. if (this.topDict) {
  63298. return this.topDict;
  63299. }
  63300. if (recoveryMode) {
  63301. return undefined;
  63302. }
  63303. throw new _core_utils.XRefParseException();
  63304. }
  63305. getEntry(i) {
  63306. const xrefEntry = this.entries[i];
  63307. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  63308. return xrefEntry;
  63309. }
  63310. return null;
  63311. }
  63312. fetchIfRef(obj, suppressEncryption = false) {
  63313. if (obj instanceof _primitives.Ref) {
  63314. return this.fetch(obj, suppressEncryption);
  63315. }
  63316. return obj;
  63317. }
  63318. fetch(ref, suppressEncryption = false) {
  63319. if (!(ref instanceof _primitives.Ref)) {
  63320. throw new Error("ref object is not a reference");
  63321. }
  63322. const num = ref.num;
  63323. const cacheEntry = this._cacheMap.get(num);
  63324. if (cacheEntry !== undefined) {
  63325. if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
  63326. cacheEntry.objId = ref.toString();
  63327. }
  63328. return cacheEntry;
  63329. }
  63330. let xrefEntry = this.getEntry(num);
  63331. if (xrefEntry === null) {
  63332. this._cacheMap.set(num, xrefEntry);
  63333. return xrefEntry;
  63334. }
  63335. if (this._pendingRefs.has(ref)) {
  63336. this._pendingRefs.remove(ref);
  63337. (0, _util.warn)(`Ignoring circular reference: ${ref}.`);
  63338. return _primitives.CIRCULAR_REF;
  63339. }
  63340. this._pendingRefs.put(ref);
  63341. try {
  63342. if (xrefEntry.uncompressed) {
  63343. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  63344. } else {
  63345. xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
  63346. }
  63347. this._pendingRefs.remove(ref);
  63348. } catch (ex) {
  63349. this._pendingRefs.remove(ref);
  63350. throw ex;
  63351. }
  63352. if (xrefEntry instanceof _primitives.Dict) {
  63353. xrefEntry.objId = ref.toString();
  63354. } else if (xrefEntry instanceof _base_stream.BaseStream) {
  63355. xrefEntry.dict.objId = ref.toString();
  63356. }
  63357. return xrefEntry;
  63358. }
  63359. fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {
  63360. const gen = ref.gen;
  63361. let num = ref.num;
  63362. if (xrefEntry.gen !== gen) {
  63363. const msg = `Inconsistent generation in XRef: ${ref}`;
  63364. if (this._generationFallback && xrefEntry.gen < gen) {
  63365. (0, _util.warn)(msg);
  63366. return this.fetchUncompressed(_primitives.Ref.get(num, xrefEntry.gen), xrefEntry, suppressEncryption);
  63367. }
  63368. throw new _core_utils.XRefEntryException(msg);
  63369. }
  63370. const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  63371. const parser = new _parser.Parser({
  63372. lexer: new _parser.Lexer(stream),
  63373. xref: this,
  63374. allowStreams: true
  63375. });
  63376. const obj1 = parser.getObj();
  63377. const obj2 = parser.getObj();
  63378. const obj3 = parser.getObj();
  63379. if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
  63380. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  63381. }
  63382. if (obj3.cmd !== "obj") {
  63383. if (obj3.cmd.startsWith("obj")) {
  63384. num = parseInt(obj3.cmd.substring(3), 10);
  63385. if (!Number.isNaN(num)) {
  63386. return num;
  63387. }
  63388. }
  63389. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  63390. }
  63391. if (this.encrypt && !suppressEncryption) {
  63392. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  63393. } else {
  63394. xrefEntry = parser.getObj();
  63395. }
  63396. if (!(xrefEntry instanceof _base_stream.BaseStream)) {
  63397. this._cacheMap.set(num, xrefEntry);
  63398. }
  63399. return xrefEntry;
  63400. }
  63401. fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
  63402. const tableOffset = xrefEntry.offset;
  63403. const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
  63404. if (!(stream instanceof _base_stream.BaseStream)) {
  63405. throw new _util.FormatError("bad ObjStm stream");
  63406. }
  63407. const first = stream.dict.get("First");
  63408. const n = stream.dict.get("N");
  63409. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  63410. throw new _util.FormatError("invalid first and n parameters for ObjStm stream");
  63411. }
  63412. let parser = new _parser.Parser({
  63413. lexer: new _parser.Lexer(stream),
  63414. xref: this,
  63415. allowStreams: true
  63416. });
  63417. const nums = new Array(n);
  63418. const offsets = new Array(n);
  63419. for (let i = 0; i < n; ++i) {
  63420. const num = parser.getObj();
  63421. if (!Number.isInteger(num)) {
  63422. throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
  63423. }
  63424. const offset = parser.getObj();
  63425. if (!Number.isInteger(offset)) {
  63426. throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
  63427. }
  63428. nums[i] = num;
  63429. offsets[i] = offset;
  63430. }
  63431. const start = (stream.start || 0) + first;
  63432. const entries = new Array(n);
  63433. for (let i = 0; i < n; ++i) {
  63434. const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;
  63435. if (length < 0) {
  63436. throw new _util.FormatError("Invalid offset in the ObjStm stream.");
  63437. }
  63438. parser = new _parser.Parser({
  63439. lexer: new _parser.Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)),
  63440. xref: this,
  63441. allowStreams: true
  63442. });
  63443. const obj = parser.getObj();
  63444. entries[i] = obj;
  63445. if (obj instanceof _base_stream.BaseStream) {
  63446. continue;
  63447. }
  63448. const num = nums[i],
  63449. entry = this.entries[num];
  63450. if (entry && entry.offset === tableOffset && entry.gen === i) {
  63451. this._cacheMap.set(num, obj);
  63452. }
  63453. }
  63454. xrefEntry = entries[xrefEntry.gen];
  63455. if (xrefEntry === undefined) {
  63456. throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
  63457. }
  63458. return xrefEntry;
  63459. }
  63460. async fetchIfRefAsync(obj, suppressEncryption) {
  63461. if (obj instanceof _primitives.Ref) {
  63462. return this.fetchAsync(obj, suppressEncryption);
  63463. }
  63464. return obj;
  63465. }
  63466. async fetchAsync(ref, suppressEncryption) {
  63467. try {
  63468. return this.fetch(ref, suppressEncryption);
  63469. } catch (ex) {
  63470. if (!(ex instanceof _core_utils.MissingDataException)) {
  63471. throw ex;
  63472. }
  63473. await this.pdfManager.requestRange(ex.begin, ex.end);
  63474. return this.fetchAsync(ref, suppressEncryption);
  63475. }
  63476. }
  63477. getCatalogObj() {
  63478. return this.root;
  63479. }
  63480. }
  63481. exports.XRef = XRef;
  63482. /***/ }),
  63483. /* 100 */
  63484. /***/ ((__unused_webpack_module, exports) => {
  63485. Object.defineProperty(exports, "__esModule", ({
  63486. value: true
  63487. }));
  63488. exports.isNodeJS = void 0;
  63489. const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
  63490. exports.isNodeJS = isNodeJS;
  63491. /***/ }),
  63492. /* 101 */
  63493. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63494. Object.defineProperty(exports, "__esModule", ({
  63495. value: true
  63496. }));
  63497. exports.MessageHandler = void 0;
  63498. var _util = __w_pdfjs_require__(2);
  63499. const CallbackKind = {
  63500. UNKNOWN: 0,
  63501. DATA: 1,
  63502. ERROR: 2
  63503. };
  63504. const StreamKind = {
  63505. UNKNOWN: 0,
  63506. CANCEL: 1,
  63507. CANCEL_COMPLETE: 2,
  63508. CLOSE: 3,
  63509. ENQUEUE: 4,
  63510. ERROR: 5,
  63511. PULL: 6,
  63512. PULL_COMPLETE: 7,
  63513. START_COMPLETE: 8
  63514. };
  63515. function wrapReason(reason) {
  63516. if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) {
  63517. (0, _util.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
  63518. }
  63519. switch (reason.name) {
  63520. case "AbortException":
  63521. return new _util.AbortException(reason.message);
  63522. case "MissingPDFException":
  63523. return new _util.MissingPDFException(reason.message);
  63524. case "PasswordException":
  63525. return new _util.PasswordException(reason.message, reason.code);
  63526. case "UnexpectedResponseException":
  63527. return new _util.UnexpectedResponseException(reason.message, reason.status);
  63528. case "UnknownErrorException":
  63529. return new _util.UnknownErrorException(reason.message, reason.details);
  63530. default:
  63531. return new _util.UnknownErrorException(reason.message, reason.toString());
  63532. }
  63533. }
  63534. class MessageHandler {
  63535. constructor(sourceName, targetName, comObj) {
  63536. this.sourceName = sourceName;
  63537. this.targetName = targetName;
  63538. this.comObj = comObj;
  63539. this.callbackId = 1;
  63540. this.streamId = 1;
  63541. this.streamSinks = Object.create(null);
  63542. this.streamControllers = Object.create(null);
  63543. this.callbackCapabilities = Object.create(null);
  63544. this.actionHandler = Object.create(null);
  63545. this._onComObjOnMessage = event => {
  63546. const data = event.data;
  63547. if (data.targetName !== this.sourceName) {
  63548. return;
  63549. }
  63550. if (data.stream) {
  63551. this._processStreamMessage(data);
  63552. return;
  63553. }
  63554. if (data.callback) {
  63555. const callbackId = data.callbackId;
  63556. const capability = this.callbackCapabilities[callbackId];
  63557. if (!capability) {
  63558. throw new Error(`Cannot resolve callback ${callbackId}`);
  63559. }
  63560. delete this.callbackCapabilities[callbackId];
  63561. if (data.callback === CallbackKind.DATA) {
  63562. capability.resolve(data.data);
  63563. } else if (data.callback === CallbackKind.ERROR) {
  63564. capability.reject(wrapReason(data.reason));
  63565. } else {
  63566. throw new Error("Unexpected callback case");
  63567. }
  63568. return;
  63569. }
  63570. const action = this.actionHandler[data.action];
  63571. if (!action) {
  63572. throw new Error(`Unknown action from worker: ${data.action}`);
  63573. }
  63574. if (data.callbackId) {
  63575. const cbSourceName = this.sourceName;
  63576. const cbTargetName = data.sourceName;
  63577. new Promise(function (resolve) {
  63578. resolve(action(data.data));
  63579. }).then(function (result) {
  63580. comObj.postMessage({
  63581. sourceName: cbSourceName,
  63582. targetName: cbTargetName,
  63583. callback: CallbackKind.DATA,
  63584. callbackId: data.callbackId,
  63585. data: result
  63586. });
  63587. }, function (reason) {
  63588. comObj.postMessage({
  63589. sourceName: cbSourceName,
  63590. targetName: cbTargetName,
  63591. callback: CallbackKind.ERROR,
  63592. callbackId: data.callbackId,
  63593. reason: wrapReason(reason)
  63594. });
  63595. });
  63596. return;
  63597. }
  63598. if (data.streamId) {
  63599. this._createStreamSink(data);
  63600. return;
  63601. }
  63602. action(data.data);
  63603. };
  63604. comObj.addEventListener("message", this._onComObjOnMessage);
  63605. }
  63606. on(actionName, handler) {
  63607. const ah = this.actionHandler;
  63608. if (ah[actionName]) {
  63609. throw new Error(`There is already an actionName called "${actionName}"`);
  63610. }
  63611. ah[actionName] = handler;
  63612. }
  63613. send(actionName, data, transfers) {
  63614. this.comObj.postMessage({
  63615. sourceName: this.sourceName,
  63616. targetName: this.targetName,
  63617. action: actionName,
  63618. data
  63619. }, transfers);
  63620. }
  63621. sendWithPromise(actionName, data, transfers) {
  63622. const callbackId = this.callbackId++;
  63623. const capability = (0, _util.createPromiseCapability)();
  63624. this.callbackCapabilities[callbackId] = capability;
  63625. try {
  63626. this.comObj.postMessage({
  63627. sourceName: this.sourceName,
  63628. targetName: this.targetName,
  63629. action: actionName,
  63630. callbackId,
  63631. data
  63632. }, transfers);
  63633. } catch (ex) {
  63634. capability.reject(ex);
  63635. }
  63636. return capability.promise;
  63637. }
  63638. sendWithStream(actionName, data, queueingStrategy, transfers) {
  63639. const streamId = this.streamId++,
  63640. sourceName = this.sourceName,
  63641. targetName = this.targetName,
  63642. comObj = this.comObj;
  63643. return new ReadableStream({
  63644. start: controller => {
  63645. const startCapability = (0, _util.createPromiseCapability)();
  63646. this.streamControllers[streamId] = {
  63647. controller,
  63648. startCall: startCapability,
  63649. pullCall: null,
  63650. cancelCall: null,
  63651. isClosed: false
  63652. };
  63653. comObj.postMessage({
  63654. sourceName,
  63655. targetName,
  63656. action: actionName,
  63657. streamId,
  63658. data,
  63659. desiredSize: controller.desiredSize
  63660. }, transfers);
  63661. return startCapability.promise;
  63662. },
  63663. pull: controller => {
  63664. const pullCapability = (0, _util.createPromiseCapability)();
  63665. this.streamControllers[streamId].pullCall = pullCapability;
  63666. comObj.postMessage({
  63667. sourceName,
  63668. targetName,
  63669. stream: StreamKind.PULL,
  63670. streamId,
  63671. desiredSize: controller.desiredSize
  63672. });
  63673. return pullCapability.promise;
  63674. },
  63675. cancel: reason => {
  63676. (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
  63677. const cancelCapability = (0, _util.createPromiseCapability)();
  63678. this.streamControllers[streamId].cancelCall = cancelCapability;
  63679. this.streamControllers[streamId].isClosed = true;
  63680. comObj.postMessage({
  63681. sourceName,
  63682. targetName,
  63683. stream: StreamKind.CANCEL,
  63684. streamId,
  63685. reason: wrapReason(reason)
  63686. });
  63687. return cancelCapability.promise;
  63688. }
  63689. }, queueingStrategy);
  63690. }
  63691. _createStreamSink(data) {
  63692. const streamId = data.streamId,
  63693. sourceName = this.sourceName,
  63694. targetName = data.sourceName,
  63695. comObj = this.comObj;
  63696. const self = this,
  63697. action = this.actionHandler[data.action];
  63698. const streamSink = {
  63699. enqueue(chunk, size = 1, transfers) {
  63700. if (this.isCancelled) {
  63701. return;
  63702. }
  63703. const lastDesiredSize = this.desiredSize;
  63704. this.desiredSize -= size;
  63705. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  63706. this.sinkCapability = (0, _util.createPromiseCapability)();
  63707. this.ready = this.sinkCapability.promise;
  63708. }
  63709. comObj.postMessage({
  63710. sourceName,
  63711. targetName,
  63712. stream: StreamKind.ENQUEUE,
  63713. streamId,
  63714. chunk
  63715. }, transfers);
  63716. },
  63717. close() {
  63718. if (this.isCancelled) {
  63719. return;
  63720. }
  63721. this.isCancelled = true;
  63722. comObj.postMessage({
  63723. sourceName,
  63724. targetName,
  63725. stream: StreamKind.CLOSE,
  63726. streamId
  63727. });
  63728. delete self.streamSinks[streamId];
  63729. },
  63730. error(reason) {
  63731. (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
  63732. if (this.isCancelled) {
  63733. return;
  63734. }
  63735. this.isCancelled = true;
  63736. comObj.postMessage({
  63737. sourceName,
  63738. targetName,
  63739. stream: StreamKind.ERROR,
  63740. streamId,
  63741. reason: wrapReason(reason)
  63742. });
  63743. },
  63744. sinkCapability: (0, _util.createPromiseCapability)(),
  63745. onPull: null,
  63746. onCancel: null,
  63747. isCancelled: false,
  63748. desiredSize: data.desiredSize,
  63749. ready: null
  63750. };
  63751. streamSink.sinkCapability.resolve();
  63752. streamSink.ready = streamSink.sinkCapability.promise;
  63753. this.streamSinks[streamId] = streamSink;
  63754. new Promise(function (resolve) {
  63755. resolve(action(data.data, streamSink));
  63756. }).then(function () {
  63757. comObj.postMessage({
  63758. sourceName,
  63759. targetName,
  63760. stream: StreamKind.START_COMPLETE,
  63761. streamId,
  63762. success: true
  63763. });
  63764. }, function (reason) {
  63765. comObj.postMessage({
  63766. sourceName,
  63767. targetName,
  63768. stream: StreamKind.START_COMPLETE,
  63769. streamId,
  63770. reason: wrapReason(reason)
  63771. });
  63772. });
  63773. }
  63774. _processStreamMessage(data) {
  63775. const streamId = data.streamId,
  63776. sourceName = this.sourceName,
  63777. targetName = data.sourceName,
  63778. comObj = this.comObj;
  63779. const streamController = this.streamControllers[streamId],
  63780. streamSink = this.streamSinks[streamId];
  63781. switch (data.stream) {
  63782. case StreamKind.START_COMPLETE:
  63783. if (data.success) {
  63784. streamController.startCall.resolve();
  63785. } else {
  63786. streamController.startCall.reject(wrapReason(data.reason));
  63787. }
  63788. break;
  63789. case StreamKind.PULL_COMPLETE:
  63790. if (data.success) {
  63791. streamController.pullCall.resolve();
  63792. } else {
  63793. streamController.pullCall.reject(wrapReason(data.reason));
  63794. }
  63795. break;
  63796. case StreamKind.PULL:
  63797. if (!streamSink) {
  63798. comObj.postMessage({
  63799. sourceName,
  63800. targetName,
  63801. stream: StreamKind.PULL_COMPLETE,
  63802. streamId,
  63803. success: true
  63804. });
  63805. break;
  63806. }
  63807. if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
  63808. streamSink.sinkCapability.resolve();
  63809. }
  63810. streamSink.desiredSize = data.desiredSize;
  63811. new Promise(function (resolve) {
  63812. resolve(streamSink.onPull && streamSink.onPull());
  63813. }).then(function () {
  63814. comObj.postMessage({
  63815. sourceName,
  63816. targetName,
  63817. stream: StreamKind.PULL_COMPLETE,
  63818. streamId,
  63819. success: true
  63820. });
  63821. }, function (reason) {
  63822. comObj.postMessage({
  63823. sourceName,
  63824. targetName,
  63825. stream: StreamKind.PULL_COMPLETE,
  63826. streamId,
  63827. reason: wrapReason(reason)
  63828. });
  63829. });
  63830. break;
  63831. case StreamKind.ENQUEUE:
  63832. (0, _util.assert)(streamController, "enqueue should have stream controller");
  63833. if (streamController.isClosed) {
  63834. break;
  63835. }
  63836. streamController.controller.enqueue(data.chunk);
  63837. break;
  63838. case StreamKind.CLOSE:
  63839. (0, _util.assert)(streamController, "close should have stream controller");
  63840. if (streamController.isClosed) {
  63841. break;
  63842. }
  63843. streamController.isClosed = true;
  63844. streamController.controller.close();
  63845. this._deleteStreamController(streamController, streamId);
  63846. break;
  63847. case StreamKind.ERROR:
  63848. (0, _util.assert)(streamController, "error should have stream controller");
  63849. streamController.controller.error(wrapReason(data.reason));
  63850. this._deleteStreamController(streamController, streamId);
  63851. break;
  63852. case StreamKind.CANCEL_COMPLETE:
  63853. if (data.success) {
  63854. streamController.cancelCall.resolve();
  63855. } else {
  63856. streamController.cancelCall.reject(wrapReason(data.reason));
  63857. }
  63858. this._deleteStreamController(streamController, streamId);
  63859. break;
  63860. case StreamKind.CANCEL:
  63861. if (!streamSink) {
  63862. break;
  63863. }
  63864. new Promise(function (resolve) {
  63865. resolve(streamSink.onCancel && streamSink.onCancel(wrapReason(data.reason)));
  63866. }).then(function () {
  63867. comObj.postMessage({
  63868. sourceName,
  63869. targetName,
  63870. stream: StreamKind.CANCEL_COMPLETE,
  63871. streamId,
  63872. success: true
  63873. });
  63874. }, function (reason) {
  63875. comObj.postMessage({
  63876. sourceName,
  63877. targetName,
  63878. stream: StreamKind.CANCEL_COMPLETE,
  63879. streamId,
  63880. reason: wrapReason(reason)
  63881. });
  63882. });
  63883. streamSink.sinkCapability.reject(wrapReason(data.reason));
  63884. streamSink.isCancelled = true;
  63885. delete this.streamSinks[streamId];
  63886. break;
  63887. default:
  63888. throw new Error("Unexpected stream case");
  63889. }
  63890. }
  63891. async _deleteStreamController(streamController, streamId) {
  63892. await Promise.allSettled([streamController.startCall && streamController.startCall.promise, streamController.pullCall && streamController.pullCall.promise, streamController.cancelCall && streamController.cancelCall.promise]);
  63893. delete this.streamControllers[streamId];
  63894. }
  63895. destroy() {
  63896. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  63897. }
  63898. }
  63899. exports.MessageHandler = MessageHandler;
  63900. /***/ }),
  63901. /* 102 */
  63902. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63903. Object.defineProperty(exports, "__esModule", ({
  63904. value: true
  63905. }));
  63906. exports.PDFWorkerStream = void 0;
  63907. var _util = __w_pdfjs_require__(2);
  63908. class PDFWorkerStream {
  63909. constructor(msgHandler) {
  63910. this._msgHandler = msgHandler;
  63911. this._contentLength = null;
  63912. this._fullRequestReader = null;
  63913. this._rangeRequestReaders = [];
  63914. }
  63915. getFullReader() {
  63916. (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
  63917. this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
  63918. return this._fullRequestReader;
  63919. }
  63920. getRangeReader(begin, end) {
  63921. const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
  63922. this._rangeRequestReaders.push(reader);
  63923. return reader;
  63924. }
  63925. cancelAllRequests(reason) {
  63926. if (this._fullRequestReader) {
  63927. this._fullRequestReader.cancel(reason);
  63928. }
  63929. for (const reader of this._rangeRequestReaders.slice(0)) {
  63930. reader.cancel(reason);
  63931. }
  63932. }
  63933. }
  63934. exports.PDFWorkerStream = PDFWorkerStream;
  63935. class PDFWorkerStreamReader {
  63936. constructor(msgHandler) {
  63937. this._msgHandler = msgHandler;
  63938. this.onProgress = null;
  63939. this._contentLength = null;
  63940. this._isRangeSupported = false;
  63941. this._isStreamingSupported = false;
  63942. const readableStream = this._msgHandler.sendWithStream("GetReader");
  63943. this._reader = readableStream.getReader();
  63944. this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
  63945. this._isStreamingSupported = data.isStreamingSupported;
  63946. this._isRangeSupported = data.isRangeSupported;
  63947. this._contentLength = data.contentLength;
  63948. });
  63949. }
  63950. get headersReady() {
  63951. return this._headersReady;
  63952. }
  63953. get contentLength() {
  63954. return this._contentLength;
  63955. }
  63956. get isStreamingSupported() {
  63957. return this._isStreamingSupported;
  63958. }
  63959. get isRangeSupported() {
  63960. return this._isRangeSupported;
  63961. }
  63962. async read() {
  63963. const {
  63964. value,
  63965. done
  63966. } = await this._reader.read();
  63967. if (done) {
  63968. return {
  63969. value: undefined,
  63970. done: true
  63971. };
  63972. }
  63973. return {
  63974. value: value.buffer,
  63975. done: false
  63976. };
  63977. }
  63978. cancel(reason) {
  63979. this._reader.cancel(reason);
  63980. }
  63981. }
  63982. class PDFWorkerStreamRangeReader {
  63983. constructor(begin, end, msgHandler) {
  63984. this._msgHandler = msgHandler;
  63985. this.onProgress = null;
  63986. const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
  63987. begin,
  63988. end
  63989. });
  63990. this._reader = readableStream.getReader();
  63991. }
  63992. get isStreamingSupported() {
  63993. return false;
  63994. }
  63995. async read() {
  63996. const {
  63997. value,
  63998. done
  63999. } = await this._reader.read();
  64000. if (done) {
  64001. return {
  64002. value: undefined,
  64003. done: true
  64004. };
  64005. }
  64006. return {
  64007. value: value.buffer,
  64008. done: false
  64009. };
  64010. }
  64011. cancel(reason) {
  64012. this._reader.cancel(reason);
  64013. }
  64014. }
  64015. /***/ })
  64016. /******/ ]);
  64017. /************************************************************************/
  64018. /******/ // The module cache
  64019. /******/ var __webpack_module_cache__ = {};
  64020. /******/
  64021. /******/ // The require function
  64022. /******/ function __w_pdfjs_require__(moduleId) {
  64023. /******/ // Check if module is in cache
  64024. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  64025. /******/ if (cachedModule !== undefined) {
  64026. /******/ return cachedModule.exports;
  64027. /******/ }
  64028. /******/ // Create a new module (and put it into the cache)
  64029. /******/ var module = __webpack_module_cache__[moduleId] = {
  64030. /******/ // no module.id needed
  64031. /******/ // no module.loaded needed
  64032. /******/ exports: {}
  64033. /******/ };
  64034. /******/
  64035. /******/ // Execute the module function
  64036. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  64037. /******/
  64038. /******/ // Return the exports of the module
  64039. /******/ return module.exports;
  64040. /******/ }
  64041. /******/
  64042. /************************************************************************/
  64043. /******/ /* webpack/runtime/define property getters */
  64044. /******/ (() => {
  64045. /******/ // define getter functions for harmony exports
  64046. /******/ __w_pdfjs_require__.d = (exports, definition) => {
  64047. /******/ for(var key in definition) {
  64048. /******/ if(__w_pdfjs_require__.o(definition, key) && !__w_pdfjs_require__.o(exports, key)) {
  64049. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  64050. /******/ }
  64051. /******/ }
  64052. /******/ };
  64053. /******/ })();
  64054. /******/
  64055. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  64056. /******/ (() => {
  64057. /******/ __w_pdfjs_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  64058. /******/ })();
  64059. /******/
  64060. /******/ /* webpack/runtime/make namespace object */
  64061. /******/ (() => {
  64062. /******/ // define __esModule on exports
  64063. /******/ __w_pdfjs_require__.r = (exports) => {
  64064. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  64065. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  64066. /******/ }
  64067. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  64068. /******/ };
  64069. /******/ })();
  64070. /******/
  64071. /************************************************************************/
  64072. var __webpack_exports__ = {};
  64073. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  64074. (() => {
  64075. var exports = __webpack_exports__;
  64076. Object.defineProperty(exports, "__esModule", ({
  64077. value: true
  64078. }));
  64079. Object.defineProperty(exports, "WorkerMessageHandler", ({
  64080. enumerable: true,
  64081. get: function () {
  64082. return _worker.WorkerMessageHandler;
  64083. }
  64084. }));
  64085. var _worker = __w_pdfjs_require__(1);
  64086. const pdfjsVersion = '3.2.146';
  64087. const pdfjsBuild = '3fd2a3548';
  64088. })();
  64089. /******/ return __webpack_exports__;
  64090. /******/ })()
  64091. ;
  64092. });
  64093. //# sourceMappingURL=pdf.worker.js.map