pdf.worker.js 2.1 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * JavaScript code in this page
  4. *
  5. * Copyright 2023 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. /******/ var __webpack_modules__ = ([
  34. /* 0 */,
  35. /* 1 */
  36. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37. "use strict";
  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 _core_utils = __w_pdfjs_require__(136);
  44. var _primitives = __w_pdfjs_require__(137);
  45. var _pdf_manager = __w_pdfjs_require__(139);
  46. var _cleanup_helper = __w_pdfjs_require__(202);
  47. var _writer = __w_pdfjs_require__(196);
  48. var _is_node = __w_pdfjs_require__(4);
  49. var _message_handler = __w_pdfjs_require__(233);
  50. var _worker_stream = __w_pdfjs_require__(234);
  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 = new Set();
  95. const verbosity = (0, _util.getVerbosityLevel)();
  96. const {
  97. docId,
  98. apiVersion
  99. } = docParams;
  100. const workerVersion = '3.4.120';
  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.add(task);
  127. }
  128. function finishWorkerTask(task) {
  129. task.finish();
  130. WorkerTasks.delete(task);
  131. }
  132. async function loadDocument(recoveryMode) {
  133. await pdfManager.ensureDoc("checkHeader");
  134. await pdfManager.ensureDoc("parseStartXRef");
  135. await pdfManager.ensureDoc("parse", [recoveryMode]);
  136. await pdfManager.ensureDoc("checkFirstPage", [recoveryMode]);
  137. await pdfManager.ensureDoc("checkLastPage", [recoveryMode]);
  138. const isPureXfa = await pdfManager.ensureDoc("isPureXfa");
  139. if (isPureXfa) {
  140. const task = new WorkerTask("loadXfaFonts");
  141. startWorkerTask(task);
  142. await Promise.all([pdfManager.loadXfaFonts(handler, task).catch(reason => {}).then(() => finishWorkerTask(task)), pdfManager.loadXfaImages()]);
  143. }
  144. const [numPages, fingerprints] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprints")]);
  145. const htmlForXfa = isPureXfa ? await pdfManager.ensureDoc("htmlForXfa") : null;
  146. return {
  147. numPages,
  148. fingerprints,
  149. htmlForXfa
  150. };
  151. }
  152. function getPdfManager(_ref) {
  153. let {
  154. data,
  155. password,
  156. disableAutoFetch,
  157. rangeChunkSize,
  158. length,
  159. docBaseUrl,
  160. enableXfa,
  161. evaluatorOptions
  162. } = _ref;
  163. const pdfManagerArgs = {
  164. source: null,
  165. disableAutoFetch,
  166. docBaseUrl,
  167. docId,
  168. enableXfa,
  169. evaluatorOptions,
  170. handler,
  171. length,
  172. password,
  173. rangeChunkSize
  174. };
  175. const pdfManagerCapability = (0, _util.createPromiseCapability)();
  176. let newPdfManager;
  177. if (data) {
  178. try {
  179. pdfManagerArgs.source = data;
  180. newPdfManager = new _pdf_manager.LocalPdfManager(pdfManagerArgs);
  181. pdfManagerCapability.resolve(newPdfManager);
  182. } catch (ex) {
  183. pdfManagerCapability.reject(ex);
  184. }
  185. return pdfManagerCapability.promise;
  186. }
  187. let pdfStream,
  188. cachedChunks = [];
  189. try {
  190. pdfStream = new _worker_stream.PDFWorkerStream(handler);
  191. } catch (ex) {
  192. pdfManagerCapability.reject(ex);
  193. return pdfManagerCapability.promise;
  194. }
  195. const fullRequest = pdfStream.getFullReader();
  196. fullRequest.headersReady.then(function () {
  197. if (!fullRequest.isRangeSupported) {
  198. return;
  199. }
  200. pdfManagerArgs.source = pdfStream;
  201. pdfManagerArgs.length = fullRequest.contentLength;
  202. pdfManagerArgs.disableAutoFetch = pdfManagerArgs.disableAutoFetch || fullRequest.isStreamingSupported;
  203. newPdfManager = new _pdf_manager.NetworkPdfManager(pdfManagerArgs);
  204. for (const chunk of cachedChunks) {
  205. newPdfManager.sendProgressiveData(chunk);
  206. }
  207. cachedChunks = [];
  208. pdfManagerCapability.resolve(newPdfManager);
  209. cancelXHRs = null;
  210. }).catch(function (reason) {
  211. pdfManagerCapability.reject(reason);
  212. cancelXHRs = null;
  213. });
  214. let loaded = 0;
  215. const flushChunks = function () {
  216. const pdfFile = (0, _core_utils.arrayBuffersToBytes)(cachedChunks);
  217. if (length && pdfFile.length !== length) {
  218. (0, _util.warn)("reported HTTP length is different from actual");
  219. }
  220. try {
  221. pdfManagerArgs.source = pdfFile;
  222. newPdfManager = new _pdf_manager.LocalPdfManager(pdfManagerArgs);
  223. pdfManagerCapability.resolve(newPdfManager);
  224. } catch (ex) {
  225. pdfManagerCapability.reject(ex);
  226. }
  227. cachedChunks = [];
  228. };
  229. new Promise(function (resolve, reject) {
  230. const readChunk = function (_ref2) {
  231. let {
  232. value,
  233. done
  234. } = _ref2;
  235. try {
  236. ensureNotTerminated();
  237. if (done) {
  238. if (!newPdfManager) {
  239. flushChunks();
  240. }
  241. cancelXHRs = null;
  242. return;
  243. }
  244. loaded += value.byteLength;
  245. if (!fullRequest.isStreamingSupported) {
  246. handler.send("DocProgress", {
  247. loaded,
  248. total: Math.max(loaded, fullRequest.contentLength || 0)
  249. });
  250. }
  251. if (newPdfManager) {
  252. newPdfManager.sendProgressiveData(value);
  253. } else {
  254. cachedChunks.push(value);
  255. }
  256. fullRequest.read().then(readChunk, reject);
  257. } catch (e) {
  258. reject(e);
  259. }
  260. };
  261. fullRequest.read().then(readChunk, reject);
  262. }).catch(function (e) {
  263. pdfManagerCapability.reject(e);
  264. cancelXHRs = null;
  265. });
  266. cancelXHRs = function (reason) {
  267. pdfStream.cancelAllRequests(reason);
  268. };
  269. return pdfManagerCapability.promise;
  270. }
  271. function setupDoc(data) {
  272. function onSuccess(doc) {
  273. ensureNotTerminated();
  274. handler.send("GetDoc", {
  275. pdfInfo: doc
  276. });
  277. }
  278. function onFailure(ex) {
  279. ensureNotTerminated();
  280. if (ex instanceof _util.PasswordException) {
  281. const task = new WorkerTask(`PasswordException: response ${ex.code}`);
  282. startWorkerTask(task);
  283. handler.sendWithPromise("PasswordRequest", ex).then(function (_ref3) {
  284. let {
  285. password
  286. } = _ref3;
  287. finishWorkerTask(task);
  288. pdfManager.updatePassword(password);
  289. pdfManagerReady();
  290. }).catch(function () {
  291. finishWorkerTask(task);
  292. handler.send("DocException", ex);
  293. });
  294. } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) {
  295. handler.send("DocException", ex);
  296. } else {
  297. handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString()));
  298. }
  299. }
  300. function pdfManagerReady() {
  301. ensureNotTerminated();
  302. loadDocument(false).then(onSuccess, function (reason) {
  303. ensureNotTerminated();
  304. if (!(reason instanceof _core_utils.XRefParseException)) {
  305. onFailure(reason);
  306. return;
  307. }
  308. pdfManager.requestLoadedStream().then(function () {
  309. ensureNotTerminated();
  310. loadDocument(true).then(onSuccess, onFailure);
  311. });
  312. });
  313. }
  314. ensureNotTerminated();
  315. getPdfManager(data).then(function (newPdfManager) {
  316. if (terminated) {
  317. newPdfManager.terminate(new _util.AbortException("Worker was terminated."));
  318. throw new Error("Worker was terminated");
  319. }
  320. pdfManager = newPdfManager;
  321. pdfManager.requestLoadedStream(true).then(stream => {
  322. handler.send("DataLoaded", {
  323. length: stream.bytes.byteLength
  324. });
  325. });
  326. }).then(pdfManagerReady, onFailure);
  327. }
  328. handler.on("GetPage", function (data) {
  329. return pdfManager.getPage(data.pageIndex).then(function (page) {
  330. return Promise.all([pdfManager.ensure(page, "rotate"), pdfManager.ensure(page, "ref"), pdfManager.ensure(page, "userUnit"), pdfManager.ensure(page, "view")]).then(function (_ref4) {
  331. let [rotate, ref, userUnit, view] = _ref4;
  332. return {
  333. rotate,
  334. ref,
  335. userUnit,
  336. view
  337. };
  338. });
  339. });
  340. });
  341. handler.on("GetPageIndex", function (data) {
  342. const pageRef = _primitives.Ref.get(data.num, data.gen);
  343. return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  344. });
  345. handler.on("GetDestinations", function (data) {
  346. return pdfManager.ensureCatalog("destinations");
  347. });
  348. handler.on("GetDestination", function (data) {
  349. return pdfManager.ensureCatalog("getDestination", [data.id]);
  350. });
  351. handler.on("GetPageLabels", function (data) {
  352. return pdfManager.ensureCatalog("pageLabels");
  353. });
  354. handler.on("GetPageLayout", function (data) {
  355. return pdfManager.ensureCatalog("pageLayout");
  356. });
  357. handler.on("GetPageMode", function (data) {
  358. return pdfManager.ensureCatalog("pageMode");
  359. });
  360. handler.on("GetViewerPreferences", function (data) {
  361. return pdfManager.ensureCatalog("viewerPreferences");
  362. });
  363. handler.on("GetOpenAction", function (data) {
  364. return pdfManager.ensureCatalog("openAction");
  365. });
  366. handler.on("GetAttachments", function (data) {
  367. return pdfManager.ensureCatalog("attachments");
  368. });
  369. handler.on("GetJavaScript", function (data) {
  370. return pdfManager.ensureCatalog("javaScript");
  371. });
  372. handler.on("GetDocJSActions", function (data) {
  373. return pdfManager.ensureCatalog("jsActions");
  374. });
  375. handler.on("GetPageJSActions", function (_ref5) {
  376. let {
  377. pageIndex
  378. } = _ref5;
  379. return pdfManager.getPage(pageIndex).then(function (page) {
  380. return pdfManager.ensure(page, "jsActions");
  381. });
  382. });
  383. handler.on("GetOutline", function (data) {
  384. return pdfManager.ensureCatalog("documentOutline");
  385. });
  386. handler.on("GetOptionalContentConfig", function (data) {
  387. return pdfManager.ensureCatalog("optionalContentConfig");
  388. });
  389. handler.on("GetPermissions", function (data) {
  390. return pdfManager.ensureCatalog("permissions");
  391. });
  392. handler.on("GetMetadata", function (data) {
  393. return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]);
  394. });
  395. handler.on("GetMarkInfo", function (data) {
  396. return pdfManager.ensureCatalog("markInfo");
  397. });
  398. handler.on("GetData", function (data) {
  399. return pdfManager.requestLoadedStream().then(function (stream) {
  400. return stream.bytes;
  401. });
  402. });
  403. handler.on("GetAnnotations", function (_ref6) {
  404. let {
  405. pageIndex,
  406. intent
  407. } = _ref6;
  408. return pdfManager.getPage(pageIndex).then(function (page) {
  409. const task = new WorkerTask(`GetAnnotations: page ${pageIndex}`);
  410. startWorkerTask(task);
  411. return page.getAnnotationsData(handler, task, intent).then(data => {
  412. finishWorkerTask(task);
  413. return data;
  414. }, reason => {
  415. finishWorkerTask(task);
  416. throw reason;
  417. });
  418. });
  419. });
  420. handler.on("GetFieldObjects", function (data) {
  421. return pdfManager.ensureDoc("fieldObjects");
  422. });
  423. handler.on("HasJSActions", function (data) {
  424. return pdfManager.ensureDoc("hasJSActions");
  425. });
  426. handler.on("GetCalculationOrderIds", function (data) {
  427. return pdfManager.ensureDoc("calculationOrderIds");
  428. });
  429. handler.on("SaveDocument", function (_ref7) {
  430. let {
  431. isPureXfa,
  432. numPages,
  433. annotationStorage,
  434. filename
  435. } = _ref7;
  436. const promises = [pdfManager.requestLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("startXRef")];
  437. const newAnnotationsByPage = !isPureXfa ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null;
  438. if (newAnnotationsByPage) {
  439. for (const [pageIndex, annotations] of newAnnotationsByPage) {
  440. promises.push(pdfManager.getPage(pageIndex).then(page => {
  441. const task = new WorkerTask(`Save (editor): page ${pageIndex}`);
  442. return page.saveNewAnnotations(handler, task, annotations).finally(function () {
  443. finishWorkerTask(task);
  444. });
  445. }));
  446. }
  447. }
  448. if (isPureXfa) {
  449. promises.push(pdfManager.serializeXfaData(annotationStorage));
  450. } else {
  451. for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
  452. promises.push(pdfManager.getPage(pageIndex).then(function (page) {
  453. const task = new WorkerTask(`Save: page ${pageIndex}`);
  454. return page.save(handler, task, annotationStorage).finally(function () {
  455. finishWorkerTask(task);
  456. });
  457. }));
  458. }
  459. }
  460. return Promise.all(promises).then(function (_ref8) {
  461. let [stream, acroForm, acroFormRef, xref, startXRef, ...refs] = _ref8;
  462. let newRefs = [];
  463. let xfaData = null;
  464. if (isPureXfa) {
  465. xfaData = refs[0];
  466. if (!xfaData) {
  467. return stream.bytes;
  468. }
  469. } else {
  470. newRefs = refs.flat(2);
  471. if (newRefs.length === 0) {
  472. return stream.bytes;
  473. }
  474. }
  475. const needAppearances = acroFormRef && acroForm instanceof _primitives.Dict && newRefs.some(ref => ref.needAppearances);
  476. const xfa = acroForm instanceof _primitives.Dict && acroForm.get("XFA") || null;
  477. let xfaDatasetsRef = null;
  478. let hasXfaDatasetsEntry = false;
  479. if (Array.isArray(xfa)) {
  480. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  481. if (xfa[i] === "datasets") {
  482. xfaDatasetsRef = xfa[i + 1];
  483. hasXfaDatasetsEntry = true;
  484. }
  485. }
  486. if (xfaDatasetsRef === null) {
  487. xfaDatasetsRef = xref.getNewTemporaryRef();
  488. }
  489. } else if (xfa) {
  490. (0, _util.warn)("Unsupported XFA type.");
  491. }
  492. let newXrefInfo = Object.create(null);
  493. if (xref.trailer) {
  494. const infoObj = Object.create(null);
  495. const xrefInfo = xref.trailer.get("Info") || null;
  496. if (xrefInfo instanceof _primitives.Dict) {
  497. xrefInfo.forEach((key, value) => {
  498. if (typeof value === "string") {
  499. infoObj[key] = (0, _util.stringToPDFString)(value);
  500. }
  501. });
  502. }
  503. newXrefInfo = {
  504. rootRef: xref.trailer.getRaw("Root") || null,
  505. encryptRef: xref.trailer.getRaw("Encrypt") || null,
  506. newRef: xref.getNewTemporaryRef(),
  507. infoRef: xref.trailer.getRaw("Info") || null,
  508. info: infoObj,
  509. fileIds: xref.trailer.get("ID") || null,
  510. startXRef,
  511. filename
  512. };
  513. }
  514. try {
  515. return (0, _writer.incrementalUpdate)({
  516. originalData: stream.bytes,
  517. xrefInfo: newXrefInfo,
  518. newRefs,
  519. xref,
  520. hasXfa: !!xfa,
  521. xfaDatasetsRef,
  522. hasXfaDatasetsEntry,
  523. needAppearances,
  524. acroFormRef,
  525. acroForm,
  526. xfaData
  527. });
  528. } finally {
  529. xref.resetNewTemporaryRef();
  530. }
  531. });
  532. });
  533. handler.on("GetOperatorList", function (data, sink) {
  534. const pageIndex = data.pageIndex;
  535. pdfManager.getPage(pageIndex).then(function (page) {
  536. const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
  537. startWorkerTask(task);
  538. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  539. page.getOperatorList({
  540. handler,
  541. sink,
  542. task,
  543. intent: data.intent,
  544. cacheKey: data.cacheKey,
  545. annotationStorage: data.annotationStorage
  546. }).then(function (operatorListInfo) {
  547. finishWorkerTask(task);
  548. if (start) {
  549. (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
  550. }
  551. sink.close();
  552. }, function (reason) {
  553. finishWorkerTask(task);
  554. if (task.terminated) {
  555. return;
  556. }
  557. sink.error(reason);
  558. });
  559. });
  560. });
  561. handler.on("GetTextContent", function (data, sink) {
  562. const pageIndex = data.pageIndex;
  563. pdfManager.getPage(pageIndex).then(function (page) {
  564. const task = new WorkerTask("GetTextContent: page " + pageIndex);
  565. startWorkerTask(task);
  566. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  567. page.extractTextContent({
  568. handler,
  569. task,
  570. sink,
  571. includeMarkedContent: data.includeMarkedContent,
  572. combineTextItems: data.combineTextItems
  573. }).then(function () {
  574. finishWorkerTask(task);
  575. if (start) {
  576. (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
  577. }
  578. sink.close();
  579. }, function (reason) {
  580. finishWorkerTask(task);
  581. if (task.terminated) {
  582. return;
  583. }
  584. sink.error(reason);
  585. });
  586. });
  587. });
  588. handler.on("GetStructTree", function (data) {
  589. return pdfManager.getPage(data.pageIndex).then(function (page) {
  590. return pdfManager.ensure(page, "getStructTree");
  591. });
  592. });
  593. handler.on("FontFallback", function (data) {
  594. return pdfManager.fontFallback(data.id, handler);
  595. });
  596. handler.on("Cleanup", function (data) {
  597. return pdfManager.cleanup(true);
  598. });
  599. handler.on("Terminate", function (data) {
  600. terminated = true;
  601. const waitOn = [];
  602. if (pdfManager) {
  603. pdfManager.terminate(new _util.AbortException("Worker was terminated."));
  604. const cleanupPromise = pdfManager.cleanup();
  605. waitOn.push(cleanupPromise);
  606. pdfManager = null;
  607. } else {
  608. (0, _cleanup_helper.clearGlobalCaches)();
  609. }
  610. if (cancelXHRs) {
  611. cancelXHRs(new _util.AbortException("Worker was terminated."));
  612. }
  613. for (const task of WorkerTasks) {
  614. waitOn.push(task.finished);
  615. task.terminate();
  616. }
  617. return Promise.all(waitOn).then(function () {
  618. handler.destroy();
  619. handler = null;
  620. });
  621. });
  622. handler.on("Ready", function (data) {
  623. setupDoc(docParams);
  624. docParams = null;
  625. });
  626. return workerHandlerName;
  627. }
  628. static initializeFromPort(port) {
  629. const handler = new _message_handler.MessageHandler("worker", "main", port);
  630. WorkerMessageHandler.setup(handler, port);
  631. handler.send("ready", null);
  632. }
  633. }
  634. exports.WorkerMessageHandler = WorkerMessageHandler;
  635. function isMessagePort(maybePort) {
  636. return typeof maybePort.postMessage === "function" && "onmessage" in maybePort;
  637. }
  638. if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) {
  639. WorkerMessageHandler.initializeFromPort(self);
  640. }
  641. /***/ }),
  642. /* 2 */
  643. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  644. "use strict";
  645. Object.defineProperty(exports, "__esModule", ({
  646. value: true
  647. }));
  648. exports.VerbosityLevel = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.UNSUPPORTED_FEATURES = exports.TextRenderingMode = 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.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;
  649. exports.assert = assert;
  650. exports.bytesToString = bytesToString;
  651. exports.createPromiseCapability = createPromiseCapability;
  652. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  653. exports.getModificationDate = getModificationDate;
  654. exports.getVerbosityLevel = getVerbosityLevel;
  655. exports.info = info;
  656. exports.isArrayBuffer = isArrayBuffer;
  657. exports.isArrayEqual = isArrayEqual;
  658. exports.objectFromMap = objectFromMap;
  659. exports.objectSize = objectSize;
  660. exports.setVerbosityLevel = setVerbosityLevel;
  661. exports.shadow = shadow;
  662. exports.string32 = string32;
  663. exports.stringToBytes = stringToBytes;
  664. exports.stringToPDFString = stringToPDFString;
  665. exports.stringToUTF8String = stringToUTF8String;
  666. exports.unreachable = unreachable;
  667. exports.utf8StringToString = utf8StringToString;
  668. exports.warn = warn;
  669. if (!globalThis._pdfjsCompatibilityChecked) {
  670. globalThis._pdfjsCompatibilityChecked = true;
  671. __w_pdfjs_require__(3);
  672. }
  673. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  674. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  675. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  676. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  677. const LINE_FACTOR = 1.35;
  678. exports.LINE_FACTOR = LINE_FACTOR;
  679. const LINE_DESCENT_FACTOR = 0.35;
  680. exports.LINE_DESCENT_FACTOR = LINE_DESCENT_FACTOR;
  681. const BASELINE_FACTOR = LINE_DESCENT_FACTOR / LINE_FACTOR;
  682. exports.BASELINE_FACTOR = BASELINE_FACTOR;
  683. const RenderingIntentFlag = {
  684. ANY: 0x01,
  685. DISPLAY: 0x02,
  686. PRINT: 0x04,
  687. SAVE: 0x08,
  688. ANNOTATIONS_FORMS: 0x10,
  689. ANNOTATIONS_STORAGE: 0x20,
  690. ANNOTATIONS_DISABLE: 0x40,
  691. OPLIST: 0x100
  692. };
  693. exports.RenderingIntentFlag = RenderingIntentFlag;
  694. const AnnotationMode = {
  695. DISABLE: 0,
  696. ENABLE: 1,
  697. ENABLE_FORMS: 2,
  698. ENABLE_STORAGE: 3
  699. };
  700. exports.AnnotationMode = AnnotationMode;
  701. const AnnotationEditorPrefix = "pdfjs_internal_editor_";
  702. exports.AnnotationEditorPrefix = AnnotationEditorPrefix;
  703. const AnnotationEditorType = {
  704. DISABLE: -1,
  705. NONE: 0,
  706. FREETEXT: 3,
  707. INK: 15
  708. };
  709. exports.AnnotationEditorType = AnnotationEditorType;
  710. const AnnotationEditorParamsType = {
  711. FREETEXT_SIZE: 1,
  712. FREETEXT_COLOR: 2,
  713. FREETEXT_OPACITY: 3,
  714. INK_COLOR: 11,
  715. INK_THICKNESS: 12,
  716. INK_OPACITY: 13
  717. };
  718. exports.AnnotationEditorParamsType = AnnotationEditorParamsType;
  719. const PermissionFlag = {
  720. PRINT: 0x04,
  721. MODIFY_CONTENTS: 0x08,
  722. COPY: 0x10,
  723. MODIFY_ANNOTATIONS: 0x20,
  724. FILL_INTERACTIVE_FORMS: 0x100,
  725. COPY_FOR_ACCESSIBILITY: 0x200,
  726. ASSEMBLE: 0x400,
  727. PRINT_HIGH_QUALITY: 0x800
  728. };
  729. exports.PermissionFlag = PermissionFlag;
  730. const TextRenderingMode = {
  731. FILL: 0,
  732. STROKE: 1,
  733. FILL_STROKE: 2,
  734. INVISIBLE: 3,
  735. FILL_ADD_TO_PATH: 4,
  736. STROKE_ADD_TO_PATH: 5,
  737. FILL_STROKE_ADD_TO_PATH: 6,
  738. ADD_TO_PATH: 7,
  739. FILL_STROKE_MASK: 3,
  740. ADD_TO_PATH_FLAG: 4
  741. };
  742. exports.TextRenderingMode = TextRenderingMode;
  743. const ImageKind = {
  744. GRAYSCALE_1BPP: 1,
  745. RGB_24BPP: 2,
  746. RGBA_32BPP: 3
  747. };
  748. exports.ImageKind = ImageKind;
  749. const AnnotationType = {
  750. TEXT: 1,
  751. LINK: 2,
  752. FREETEXT: 3,
  753. LINE: 4,
  754. SQUARE: 5,
  755. CIRCLE: 6,
  756. POLYGON: 7,
  757. POLYLINE: 8,
  758. HIGHLIGHT: 9,
  759. UNDERLINE: 10,
  760. SQUIGGLY: 11,
  761. STRIKEOUT: 12,
  762. STAMP: 13,
  763. CARET: 14,
  764. INK: 15,
  765. POPUP: 16,
  766. FILEATTACHMENT: 17,
  767. SOUND: 18,
  768. MOVIE: 19,
  769. WIDGET: 20,
  770. SCREEN: 21,
  771. PRINTERMARK: 22,
  772. TRAPNET: 23,
  773. WATERMARK: 24,
  774. THREED: 25,
  775. REDACT: 26
  776. };
  777. exports.AnnotationType = AnnotationType;
  778. const AnnotationStateModelType = {
  779. MARKED: "Marked",
  780. REVIEW: "Review"
  781. };
  782. exports.AnnotationStateModelType = AnnotationStateModelType;
  783. const AnnotationMarkedState = {
  784. MARKED: "Marked",
  785. UNMARKED: "Unmarked"
  786. };
  787. exports.AnnotationMarkedState = AnnotationMarkedState;
  788. const AnnotationReviewState = {
  789. ACCEPTED: "Accepted",
  790. REJECTED: "Rejected",
  791. CANCELLED: "Cancelled",
  792. COMPLETED: "Completed",
  793. NONE: "None"
  794. };
  795. exports.AnnotationReviewState = AnnotationReviewState;
  796. const AnnotationReplyType = {
  797. GROUP: "Group",
  798. REPLY: "R"
  799. };
  800. exports.AnnotationReplyType = AnnotationReplyType;
  801. const AnnotationFlag = {
  802. INVISIBLE: 0x01,
  803. HIDDEN: 0x02,
  804. PRINT: 0x04,
  805. NOZOOM: 0x08,
  806. NOROTATE: 0x10,
  807. NOVIEW: 0x20,
  808. READONLY: 0x40,
  809. LOCKED: 0x80,
  810. TOGGLENOVIEW: 0x100,
  811. LOCKEDCONTENTS: 0x200
  812. };
  813. exports.AnnotationFlag = AnnotationFlag;
  814. const AnnotationFieldFlag = {
  815. READONLY: 0x0000001,
  816. REQUIRED: 0x0000002,
  817. NOEXPORT: 0x0000004,
  818. MULTILINE: 0x0001000,
  819. PASSWORD: 0x0002000,
  820. NOTOGGLETOOFF: 0x0004000,
  821. RADIO: 0x0008000,
  822. PUSHBUTTON: 0x0010000,
  823. COMBO: 0x0020000,
  824. EDIT: 0x0040000,
  825. SORT: 0x0080000,
  826. FILESELECT: 0x0100000,
  827. MULTISELECT: 0x0200000,
  828. DONOTSPELLCHECK: 0x0400000,
  829. DONOTSCROLL: 0x0800000,
  830. COMB: 0x1000000,
  831. RICHTEXT: 0x2000000,
  832. RADIOSINUNISON: 0x2000000,
  833. COMMITONSELCHANGE: 0x4000000
  834. };
  835. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  836. const AnnotationBorderStyleType = {
  837. SOLID: 1,
  838. DASHED: 2,
  839. BEVELED: 3,
  840. INSET: 4,
  841. UNDERLINE: 5
  842. };
  843. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  844. const AnnotationActionEventType = {
  845. E: "Mouse Enter",
  846. X: "Mouse Exit",
  847. D: "Mouse Down",
  848. U: "Mouse Up",
  849. Fo: "Focus",
  850. Bl: "Blur",
  851. PO: "PageOpen",
  852. PC: "PageClose",
  853. PV: "PageVisible",
  854. PI: "PageInvisible",
  855. K: "Keystroke",
  856. F: "Format",
  857. V: "Validate",
  858. C: "Calculate"
  859. };
  860. exports.AnnotationActionEventType = AnnotationActionEventType;
  861. const DocumentActionEventType = {
  862. WC: "WillClose",
  863. WS: "WillSave",
  864. DS: "DidSave",
  865. WP: "WillPrint",
  866. DP: "DidPrint"
  867. };
  868. exports.DocumentActionEventType = DocumentActionEventType;
  869. const PageActionEventType = {
  870. O: "PageOpen",
  871. C: "PageClose"
  872. };
  873. exports.PageActionEventType = PageActionEventType;
  874. const VerbosityLevel = {
  875. ERRORS: 0,
  876. WARNINGS: 1,
  877. INFOS: 5
  878. };
  879. exports.VerbosityLevel = VerbosityLevel;
  880. const CMapCompressionType = {
  881. NONE: 0,
  882. BINARY: 1
  883. };
  884. exports.CMapCompressionType = CMapCompressionType;
  885. const OPS = {
  886. dependency: 1,
  887. setLineWidth: 2,
  888. setLineCap: 3,
  889. setLineJoin: 4,
  890. setMiterLimit: 5,
  891. setDash: 6,
  892. setRenderingIntent: 7,
  893. setFlatness: 8,
  894. setGState: 9,
  895. save: 10,
  896. restore: 11,
  897. transform: 12,
  898. moveTo: 13,
  899. lineTo: 14,
  900. curveTo: 15,
  901. curveTo2: 16,
  902. curveTo3: 17,
  903. closePath: 18,
  904. rectangle: 19,
  905. stroke: 20,
  906. closeStroke: 21,
  907. fill: 22,
  908. eoFill: 23,
  909. fillStroke: 24,
  910. eoFillStroke: 25,
  911. closeFillStroke: 26,
  912. closeEOFillStroke: 27,
  913. endPath: 28,
  914. clip: 29,
  915. eoClip: 30,
  916. beginText: 31,
  917. endText: 32,
  918. setCharSpacing: 33,
  919. setWordSpacing: 34,
  920. setHScale: 35,
  921. setLeading: 36,
  922. setFont: 37,
  923. setTextRenderingMode: 38,
  924. setTextRise: 39,
  925. moveText: 40,
  926. setLeadingMoveText: 41,
  927. setTextMatrix: 42,
  928. nextLine: 43,
  929. showText: 44,
  930. showSpacedText: 45,
  931. nextLineShowText: 46,
  932. nextLineSetSpacingShowText: 47,
  933. setCharWidth: 48,
  934. setCharWidthAndBounds: 49,
  935. setStrokeColorSpace: 50,
  936. setFillColorSpace: 51,
  937. setStrokeColor: 52,
  938. setStrokeColorN: 53,
  939. setFillColor: 54,
  940. setFillColorN: 55,
  941. setStrokeGray: 56,
  942. setFillGray: 57,
  943. setStrokeRGBColor: 58,
  944. setFillRGBColor: 59,
  945. setStrokeCMYKColor: 60,
  946. setFillCMYKColor: 61,
  947. shadingFill: 62,
  948. beginInlineImage: 63,
  949. beginImageData: 64,
  950. endInlineImage: 65,
  951. paintXObject: 66,
  952. markPoint: 67,
  953. markPointProps: 68,
  954. beginMarkedContent: 69,
  955. beginMarkedContentProps: 70,
  956. endMarkedContent: 71,
  957. beginCompat: 72,
  958. endCompat: 73,
  959. paintFormXObjectBegin: 74,
  960. paintFormXObjectEnd: 75,
  961. beginGroup: 76,
  962. endGroup: 77,
  963. beginAnnotation: 80,
  964. endAnnotation: 81,
  965. paintImageMaskXObject: 83,
  966. paintImageMaskXObjectGroup: 84,
  967. paintImageXObject: 85,
  968. paintInlineImageXObject: 86,
  969. paintInlineImageXObjectGroup: 87,
  970. paintImageXObjectRepeat: 88,
  971. paintImageMaskXObjectRepeat: 89,
  972. paintSolidColorImageMask: 90,
  973. constructPath: 91
  974. };
  975. exports.OPS = OPS;
  976. const UNSUPPORTED_FEATURES = {
  977. forms: "forms",
  978. javaScript: "javaScript",
  979. signatures: "signatures",
  980. smask: "smask",
  981. shadingPattern: "shadingPattern",
  982. errorTilingPattern: "errorTilingPattern",
  983. errorExtGState: "errorExtGState",
  984. errorXObject: "errorXObject",
  985. errorFontLoadType3: "errorFontLoadType3",
  986. errorFontState: "errorFontState",
  987. errorFontMissing: "errorFontMissing",
  988. errorFontTranslate: "errorFontTranslate",
  989. errorColorSpace: "errorColorSpace",
  990. errorOperatorList: "errorOperatorList",
  991. errorFontToUnicode: "errorFontToUnicode",
  992. errorFontLoadNative: "errorFontLoadNative",
  993. errorFontBuildPath: "errorFontBuildPath",
  994. errorFontGetPath: "errorFontGetPath",
  995. errorMarkedContent: "errorMarkedContent",
  996. errorContentSubStream: "errorContentSubStream"
  997. };
  998. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  999. const PasswordResponses = {
  1000. NEED_PASSWORD: 1,
  1001. INCORRECT_PASSWORD: 2
  1002. };
  1003. exports.PasswordResponses = PasswordResponses;
  1004. let verbosity = VerbosityLevel.WARNINGS;
  1005. function setVerbosityLevel(level) {
  1006. if (Number.isInteger(level)) {
  1007. verbosity = level;
  1008. }
  1009. }
  1010. function getVerbosityLevel() {
  1011. return verbosity;
  1012. }
  1013. function info(msg) {
  1014. if (verbosity >= VerbosityLevel.INFOS) {
  1015. console.log(`Info: ${msg}`);
  1016. }
  1017. }
  1018. function warn(msg) {
  1019. if (verbosity >= VerbosityLevel.WARNINGS) {
  1020. console.log(`Warning: ${msg}`);
  1021. }
  1022. }
  1023. function unreachable(msg) {
  1024. throw new Error(msg);
  1025. }
  1026. function assert(cond, msg) {
  1027. if (!cond) {
  1028. unreachable(msg);
  1029. }
  1030. }
  1031. function _isValidProtocol(url) {
  1032. if (!url) {
  1033. return false;
  1034. }
  1035. switch (url.protocol) {
  1036. case "http:":
  1037. case "https:":
  1038. case "ftp:":
  1039. case "mailto:":
  1040. case "tel:":
  1041. return true;
  1042. default:
  1043. return false;
  1044. }
  1045. }
  1046. function createValidAbsoluteUrl(url) {
  1047. let baseUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  1048. let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  1049. if (!url) {
  1050. return null;
  1051. }
  1052. try {
  1053. if (options && typeof url === "string") {
  1054. if (options.addDefaultProtocol && url.startsWith("www.")) {
  1055. const dots = url.match(/\./g);
  1056. if (dots && dots.length >= 2) {
  1057. url = `http://${url}`;
  1058. }
  1059. }
  1060. if (options.tryConvertEncoding) {
  1061. try {
  1062. url = stringToUTF8String(url);
  1063. } catch (ex) {}
  1064. }
  1065. }
  1066. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  1067. if (_isValidProtocol(absoluteUrl)) {
  1068. return absoluteUrl;
  1069. }
  1070. } catch (ex) {}
  1071. return null;
  1072. }
  1073. function shadow(obj, prop, value) {
  1074. let nonSerializable = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  1075. Object.defineProperty(obj, prop, {
  1076. value,
  1077. enumerable: !nonSerializable,
  1078. configurable: true,
  1079. writable: false
  1080. });
  1081. return value;
  1082. }
  1083. const BaseException = function BaseExceptionClosure() {
  1084. function BaseException(message, name) {
  1085. if (this.constructor === BaseException) {
  1086. unreachable("Cannot initialize BaseException.");
  1087. }
  1088. this.message = message;
  1089. this.name = name;
  1090. }
  1091. BaseException.prototype = new Error();
  1092. BaseException.constructor = BaseException;
  1093. return BaseException;
  1094. }();
  1095. exports.BaseException = BaseException;
  1096. class PasswordException extends BaseException {
  1097. constructor(msg, code) {
  1098. super(msg, "PasswordException");
  1099. this.code = code;
  1100. }
  1101. }
  1102. exports.PasswordException = PasswordException;
  1103. class UnknownErrorException extends BaseException {
  1104. constructor(msg, details) {
  1105. super(msg, "UnknownErrorException");
  1106. this.details = details;
  1107. }
  1108. }
  1109. exports.UnknownErrorException = UnknownErrorException;
  1110. class InvalidPDFException extends BaseException {
  1111. constructor(msg) {
  1112. super(msg, "InvalidPDFException");
  1113. }
  1114. }
  1115. exports.InvalidPDFException = InvalidPDFException;
  1116. class MissingPDFException extends BaseException {
  1117. constructor(msg) {
  1118. super(msg, "MissingPDFException");
  1119. }
  1120. }
  1121. exports.MissingPDFException = MissingPDFException;
  1122. class UnexpectedResponseException extends BaseException {
  1123. constructor(msg, status) {
  1124. super(msg, "UnexpectedResponseException");
  1125. this.status = status;
  1126. }
  1127. }
  1128. exports.UnexpectedResponseException = UnexpectedResponseException;
  1129. class FormatError extends BaseException {
  1130. constructor(msg) {
  1131. super(msg, "FormatError");
  1132. }
  1133. }
  1134. exports.FormatError = FormatError;
  1135. class AbortException extends BaseException {
  1136. constructor(msg) {
  1137. super(msg, "AbortException");
  1138. }
  1139. }
  1140. exports.AbortException = AbortException;
  1141. function bytesToString(bytes) {
  1142. if (typeof bytes !== "object" || bytes === null || bytes.length === undefined) {
  1143. unreachable("Invalid argument for bytesToString");
  1144. }
  1145. const length = bytes.length;
  1146. const MAX_ARGUMENT_COUNT = 8192;
  1147. if (length < MAX_ARGUMENT_COUNT) {
  1148. return String.fromCharCode.apply(null, bytes);
  1149. }
  1150. const strBuf = [];
  1151. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  1152. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  1153. const chunk = bytes.subarray(i, chunkEnd);
  1154. strBuf.push(String.fromCharCode.apply(null, chunk));
  1155. }
  1156. return strBuf.join("");
  1157. }
  1158. function stringToBytes(str) {
  1159. if (typeof str !== "string") {
  1160. unreachable("Invalid argument for stringToBytes");
  1161. }
  1162. const length = str.length;
  1163. const bytes = new Uint8Array(length);
  1164. for (let i = 0; i < length; ++i) {
  1165. bytes[i] = str.charCodeAt(i) & 0xff;
  1166. }
  1167. return bytes;
  1168. }
  1169. function string32(value) {
  1170. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  1171. }
  1172. function objectSize(obj) {
  1173. return Object.keys(obj).length;
  1174. }
  1175. function objectFromMap(map) {
  1176. const obj = Object.create(null);
  1177. for (const [key, value] of map) {
  1178. obj[key] = value;
  1179. }
  1180. return obj;
  1181. }
  1182. function isLittleEndian() {
  1183. const buffer8 = new Uint8Array(4);
  1184. buffer8[0] = 1;
  1185. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  1186. return view32[0] === 1;
  1187. }
  1188. function isEvalSupported() {
  1189. try {
  1190. new Function("");
  1191. return true;
  1192. } catch (e) {
  1193. return false;
  1194. }
  1195. }
  1196. class FeatureTest {
  1197. static get isLittleEndian() {
  1198. return shadow(this, "isLittleEndian", isLittleEndian());
  1199. }
  1200. static get isEvalSupported() {
  1201. return shadow(this, "isEvalSupported", isEvalSupported());
  1202. }
  1203. static get isOffscreenCanvasSupported() {
  1204. return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
  1205. }
  1206. static get platform() {
  1207. if (typeof navigator === "undefined") {
  1208. return shadow(this, "platform", {
  1209. isWin: false,
  1210. isMac: false
  1211. });
  1212. }
  1213. return shadow(this, "platform", {
  1214. isWin: navigator.platform.includes("Win"),
  1215. isMac: navigator.platform.includes("Mac")
  1216. });
  1217. }
  1218. }
  1219. exports.FeatureTest = FeatureTest;
  1220. const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
  1221. class Util {
  1222. static makeHexColor(r, g, b) {
  1223. return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
  1224. }
  1225. static scaleMinMax(transform, minMax) {
  1226. let temp;
  1227. if (transform[0]) {
  1228. if (transform[0] < 0) {
  1229. temp = minMax[0];
  1230. minMax[0] = minMax[1];
  1231. minMax[1] = temp;
  1232. }
  1233. minMax[0] *= transform[0];
  1234. minMax[1] *= transform[0];
  1235. if (transform[3] < 0) {
  1236. temp = minMax[2];
  1237. minMax[2] = minMax[3];
  1238. minMax[3] = temp;
  1239. }
  1240. minMax[2] *= transform[3];
  1241. minMax[3] *= transform[3];
  1242. } else {
  1243. temp = minMax[0];
  1244. minMax[0] = minMax[2];
  1245. minMax[2] = temp;
  1246. temp = minMax[1];
  1247. minMax[1] = minMax[3];
  1248. minMax[3] = temp;
  1249. if (transform[1] < 0) {
  1250. temp = minMax[2];
  1251. minMax[2] = minMax[3];
  1252. minMax[3] = temp;
  1253. }
  1254. minMax[2] *= transform[1];
  1255. minMax[3] *= transform[1];
  1256. if (transform[2] < 0) {
  1257. temp = minMax[0];
  1258. minMax[0] = minMax[1];
  1259. minMax[1] = temp;
  1260. }
  1261. minMax[0] *= transform[2];
  1262. minMax[1] *= transform[2];
  1263. }
  1264. minMax[0] += transform[4];
  1265. minMax[1] += transform[4];
  1266. minMax[2] += transform[5];
  1267. minMax[3] += transform[5];
  1268. }
  1269. static transform(m1, m2) {
  1270. 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]];
  1271. }
  1272. static applyTransform(p, m) {
  1273. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  1274. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  1275. return [xt, yt];
  1276. }
  1277. static applyInverseTransform(p, m) {
  1278. const d = m[0] * m[3] - m[1] * m[2];
  1279. const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  1280. const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  1281. return [xt, yt];
  1282. }
  1283. static getAxialAlignedBoundingBox(r, m) {
  1284. const p1 = Util.applyTransform(r, m);
  1285. const p2 = Util.applyTransform(r.slice(2, 4), m);
  1286. const p3 = Util.applyTransform([r[0], r[3]], m);
  1287. const p4 = Util.applyTransform([r[2], r[1]], m);
  1288. 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])];
  1289. }
  1290. static inverseTransform(m) {
  1291. const d = m[0] * m[3] - m[1] * m[2];
  1292. 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];
  1293. }
  1294. static singularValueDecompose2dScale(m) {
  1295. const transpose = [m[0], m[2], m[1], m[3]];
  1296. const a = m[0] * transpose[0] + m[1] * transpose[2];
  1297. const b = m[0] * transpose[1] + m[1] * transpose[3];
  1298. const c = m[2] * transpose[0] + m[3] * transpose[2];
  1299. const d = m[2] * transpose[1] + m[3] * transpose[3];
  1300. const first = (a + d) / 2;
  1301. const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
  1302. const sx = first + second || 1;
  1303. const sy = first - second || 1;
  1304. return [Math.sqrt(sx), Math.sqrt(sy)];
  1305. }
  1306. static normalizeRect(rect) {
  1307. const r = rect.slice(0);
  1308. if (rect[0] > rect[2]) {
  1309. r[0] = rect[2];
  1310. r[2] = rect[0];
  1311. }
  1312. if (rect[1] > rect[3]) {
  1313. r[1] = rect[3];
  1314. r[3] = rect[1];
  1315. }
  1316. return r;
  1317. }
  1318. static intersect(rect1, rect2) {
  1319. const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2]));
  1320. const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2]));
  1321. if (xLow > xHigh) {
  1322. return null;
  1323. }
  1324. const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3]));
  1325. const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3]));
  1326. if (yLow > yHigh) {
  1327. return null;
  1328. }
  1329. return [xLow, yLow, xHigh, yHigh];
  1330. }
  1331. static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {
  1332. const tvalues = [],
  1333. bounds = [[], []];
  1334. let a, b, c, t, t1, t2, b2ac, sqrtb2ac;
  1335. for (let i = 0; i < 2; ++i) {
  1336. if (i === 0) {
  1337. b = 6 * x0 - 12 * x1 + 6 * x2;
  1338. a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
  1339. c = 3 * x1 - 3 * x0;
  1340. } else {
  1341. b = 6 * y0 - 12 * y1 + 6 * y2;
  1342. a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
  1343. c = 3 * y1 - 3 * y0;
  1344. }
  1345. if (Math.abs(a) < 1e-12) {
  1346. if (Math.abs(b) < 1e-12) {
  1347. continue;
  1348. }
  1349. t = -c / b;
  1350. if (0 < t && t < 1) {
  1351. tvalues.push(t);
  1352. }
  1353. continue;
  1354. }
  1355. b2ac = b * b - 4 * c * a;
  1356. sqrtb2ac = Math.sqrt(b2ac);
  1357. if (b2ac < 0) {
  1358. continue;
  1359. }
  1360. t1 = (-b + sqrtb2ac) / (2 * a);
  1361. if (0 < t1 && t1 < 1) {
  1362. tvalues.push(t1);
  1363. }
  1364. t2 = (-b - sqrtb2ac) / (2 * a);
  1365. if (0 < t2 && t2 < 1) {
  1366. tvalues.push(t2);
  1367. }
  1368. }
  1369. let j = tvalues.length,
  1370. mt;
  1371. const jlen = j;
  1372. while (j--) {
  1373. t = tvalues[j];
  1374. mt = 1 - t;
  1375. bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
  1376. bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
  1377. }
  1378. bounds[0][jlen] = x0;
  1379. bounds[1][jlen] = y0;
  1380. bounds[0][jlen + 1] = x3;
  1381. bounds[1][jlen + 1] = y3;
  1382. bounds[0].length = bounds[1].length = jlen + 2;
  1383. return [Math.min(...bounds[0]), Math.min(...bounds[1]), Math.max(...bounds[0]), Math.max(...bounds[1])];
  1384. }
  1385. }
  1386. exports.Util = Util;
  1387. 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];
  1388. function stringToPDFString(str) {
  1389. if (str[0] >= "\xEF") {
  1390. let encoding;
  1391. if (str[0] === "\xFE" && str[1] === "\xFF") {
  1392. encoding = "utf-16be";
  1393. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  1394. encoding = "utf-16le";
  1395. } else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") {
  1396. encoding = "utf-8";
  1397. }
  1398. if (encoding) {
  1399. try {
  1400. const decoder = new TextDecoder(encoding, {
  1401. fatal: true
  1402. });
  1403. const buffer = stringToBytes(str);
  1404. return decoder.decode(buffer);
  1405. } catch (ex) {
  1406. warn(`stringToPDFString: "${ex}".`);
  1407. }
  1408. }
  1409. }
  1410. const strBuf = [];
  1411. for (let i = 0, ii = str.length; i < ii; i++) {
  1412. const code = PDFStringTranslateTable[str.charCodeAt(i)];
  1413. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1414. }
  1415. return strBuf.join("");
  1416. }
  1417. function stringToUTF8String(str) {
  1418. return decodeURIComponent(escape(str));
  1419. }
  1420. function utf8StringToString(str) {
  1421. return unescape(encodeURIComponent(str));
  1422. }
  1423. function isArrayBuffer(v) {
  1424. return typeof v === "object" && v !== null && v.byteLength !== undefined;
  1425. }
  1426. function isArrayEqual(arr1, arr2) {
  1427. if (arr1.length !== arr2.length) {
  1428. return false;
  1429. }
  1430. for (let i = 0, ii = arr1.length; i < ii; i++) {
  1431. if (arr1[i] !== arr2[i]) {
  1432. return false;
  1433. }
  1434. }
  1435. return true;
  1436. }
  1437. function getModificationDate() {
  1438. let date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
  1439. 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")];
  1440. return buffer.join("");
  1441. }
  1442. function createPromiseCapability() {
  1443. const capability = Object.create(null);
  1444. let isSettled = false;
  1445. Object.defineProperty(capability, "settled", {
  1446. get() {
  1447. return isSettled;
  1448. }
  1449. });
  1450. capability.promise = new Promise(function (resolve, reject) {
  1451. capability.resolve = function (data) {
  1452. isSettled = true;
  1453. resolve(data);
  1454. };
  1455. capability.reject = function (reason) {
  1456. isSettled = true;
  1457. reject(reason);
  1458. };
  1459. });
  1460. return capability;
  1461. }
  1462. /***/ }),
  1463. /* 3 */
  1464. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1465. "use strict";
  1466. var _is_node = __w_pdfjs_require__(4);
  1467. (function checkNodeBtoa() {
  1468. if (globalThis.btoa || !_is_node.isNodeJS) {
  1469. return;
  1470. }
  1471. globalThis.btoa = function (chars) {
  1472. return Buffer.from(chars, "binary").toString("base64");
  1473. };
  1474. })();
  1475. (function checkNodeAtob() {
  1476. if (globalThis.atob || !_is_node.isNodeJS) {
  1477. return;
  1478. }
  1479. globalThis.atob = function (input) {
  1480. return Buffer.from(input, "base64").toString("binary");
  1481. };
  1482. })();
  1483. (function checkDOMMatrix() {
  1484. if (globalThis.DOMMatrix || !_is_node.isNodeJS) {
  1485. return;
  1486. }
  1487. globalThis.DOMMatrix = require("canvas").DOMMatrix;
  1488. })();
  1489. (function checkPath2D() {
  1490. if (globalThis.Path2D || !_is_node.isNodeJS) {
  1491. return;
  1492. }
  1493. const {
  1494. CanvasRenderingContext2D
  1495. } = require("canvas");
  1496. const {
  1497. polyfillPath2D
  1498. } = require("path2d-polyfill");
  1499. globalThis.CanvasRenderingContext2D = CanvasRenderingContext2D;
  1500. polyfillPath2D(globalThis);
  1501. })();
  1502. (function checkReadableStream() {
  1503. if (globalThis.ReadableStream || !_is_node.isNodeJS) {
  1504. return;
  1505. }
  1506. globalThis.ReadableStream = require("web-streams-polyfill/dist/ponyfill.js").ReadableStream;
  1507. })();
  1508. (function checkArrayAt() {
  1509. if (Array.prototype.at) {
  1510. return;
  1511. }
  1512. __w_pdfjs_require__(5);
  1513. })();
  1514. (function checkTypedArrayAt() {
  1515. if (Uint8Array.prototype.at) {
  1516. return;
  1517. }
  1518. __w_pdfjs_require__(79);
  1519. })();
  1520. (function checkStructuredClone() {
  1521. if (globalThis.structuredClone) {
  1522. return;
  1523. }
  1524. __w_pdfjs_require__(89);
  1525. })();
  1526. /***/ }),
  1527. /* 4 */
  1528. /***/ ((__unused_webpack_module, exports) => {
  1529. "use strict";
  1530. Object.defineProperty(exports, "__esModule", ({
  1531. value: true
  1532. }));
  1533. exports.isNodeJS = void 0;
  1534. const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
  1535. exports.isNodeJS = isNodeJS;
  1536. /***/ }),
  1537. /* 5 */
  1538. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1539. __w_pdfjs_require__(6);
  1540. var entryUnbind = __w_pdfjs_require__(78);
  1541. module.exports = entryUnbind('Array', 'at');
  1542. /***/ }),
  1543. /* 6 */
  1544. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1545. "use strict";
  1546. var $ = __w_pdfjs_require__(7);
  1547. var toObject = __w_pdfjs_require__(44);
  1548. var lengthOfArrayLike = __w_pdfjs_require__(68);
  1549. var toIntegerOrInfinity = __w_pdfjs_require__(66);
  1550. var addToUnscopables = __w_pdfjs_require__(73);
  1551. $({
  1552. target: 'Array',
  1553. proto: true
  1554. }, {
  1555. at: function at(index) {
  1556. var O = toObject(this);
  1557. var len = lengthOfArrayLike(O);
  1558. var relativeIndex = toIntegerOrInfinity(index);
  1559. var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex;
  1560. return k < 0 || k >= len ? undefined : O[k];
  1561. }
  1562. });
  1563. addToUnscopables('at');
  1564. /***/ }),
  1565. /* 7 */
  1566. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1567. var global = __w_pdfjs_require__(8);
  1568. var getOwnPropertyDescriptor = (__w_pdfjs_require__(9).f);
  1569. var createNonEnumerableProperty = __w_pdfjs_require__(48);
  1570. var defineBuiltIn = __w_pdfjs_require__(52);
  1571. var defineGlobalProperty = __w_pdfjs_require__(42);
  1572. var copyConstructorProperties = __w_pdfjs_require__(60);
  1573. var isForced = __w_pdfjs_require__(72);
  1574. module.exports = function (options, source) {
  1575. var TARGET = options.target;
  1576. var GLOBAL = options.global;
  1577. var STATIC = options.stat;
  1578. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  1579. if (GLOBAL) {
  1580. target = global;
  1581. } else if (STATIC) {
  1582. target = global[TARGET] || defineGlobalProperty(TARGET, {});
  1583. } else {
  1584. target = (global[TARGET] || {}).prototype;
  1585. }
  1586. if (target)
  1587. for (key in source) {
  1588. sourceProperty = source[key];
  1589. if (options.dontCallGetSet) {
  1590. descriptor = getOwnPropertyDescriptor(target, key);
  1591. targetProperty = descriptor && descriptor.value;
  1592. } else
  1593. targetProperty = target[key];
  1594. FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  1595. if (!FORCED && targetProperty !== undefined) {
  1596. if (typeof sourceProperty == typeof targetProperty)
  1597. continue;
  1598. copyConstructorProperties(sourceProperty, targetProperty);
  1599. }
  1600. if (options.sham || targetProperty && targetProperty.sham) {
  1601. createNonEnumerableProperty(sourceProperty, 'sham', true);
  1602. }
  1603. defineBuiltIn(target, key, sourceProperty, options);
  1604. }
  1605. };
  1606. /***/ }),
  1607. /* 8 */
  1608. /***/ ((module) => {
  1609. var check = function (it) {
  1610. return it && it.Math == Math && it;
  1611. };
  1612. module.exports = check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || check(typeof self == 'object' && self) || check(typeof global == 'object' && global) || (function () {
  1613. return this;
  1614. }()) || Function('return this')();
  1615. /***/ }),
  1616. /* 9 */
  1617. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1618. var DESCRIPTORS = __w_pdfjs_require__(10);
  1619. var call = __w_pdfjs_require__(12);
  1620. var propertyIsEnumerableModule = __w_pdfjs_require__(14);
  1621. var createPropertyDescriptor = __w_pdfjs_require__(15);
  1622. var toIndexedObject = __w_pdfjs_require__(16);
  1623. var toPropertyKey = __w_pdfjs_require__(22);
  1624. var hasOwn = __w_pdfjs_require__(43);
  1625. var IE8_DOM_DEFINE = __w_pdfjs_require__(46);
  1626. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  1627. exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  1628. O = toIndexedObject(O);
  1629. P = toPropertyKey(P);
  1630. if (IE8_DOM_DEFINE)
  1631. try {
  1632. return $getOwnPropertyDescriptor(O, P);
  1633. } catch (error) {
  1634. }
  1635. if (hasOwn(O, P))
  1636. return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
  1637. };
  1638. /***/ }),
  1639. /* 10 */
  1640. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1641. var fails = __w_pdfjs_require__(11);
  1642. module.exports = !fails(function () {
  1643. return Object.defineProperty({}, 1, {
  1644. get: function () {
  1645. return 7;
  1646. }
  1647. })[1] != 7;
  1648. });
  1649. /***/ }),
  1650. /* 11 */
  1651. /***/ ((module) => {
  1652. module.exports = function (exec) {
  1653. try {
  1654. return !!exec();
  1655. } catch (error) {
  1656. return true;
  1657. }
  1658. };
  1659. /***/ }),
  1660. /* 12 */
  1661. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1662. var NATIVE_BIND = __w_pdfjs_require__(13);
  1663. var call = Function.prototype.call;
  1664. module.exports = NATIVE_BIND ? call.bind(call) : function () {
  1665. return call.apply(call, arguments);
  1666. };
  1667. /***/ }),
  1668. /* 13 */
  1669. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1670. var fails = __w_pdfjs_require__(11);
  1671. module.exports = !fails(function () {
  1672. var test = function () {
  1673. }.bind();
  1674. return typeof test != 'function' || test.hasOwnProperty('prototype');
  1675. });
  1676. /***/ }),
  1677. /* 14 */
  1678. /***/ ((__unused_webpack_module, exports) => {
  1679. "use strict";
  1680. var $propertyIsEnumerable = {}.propertyIsEnumerable;
  1681. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  1682. var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
  1683. exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  1684. var descriptor = getOwnPropertyDescriptor(this, V);
  1685. return !!descriptor && descriptor.enumerable;
  1686. } : $propertyIsEnumerable;
  1687. /***/ }),
  1688. /* 15 */
  1689. /***/ ((module) => {
  1690. module.exports = function (bitmap, value) {
  1691. return {
  1692. enumerable: !(bitmap & 1),
  1693. configurable: !(bitmap & 2),
  1694. writable: !(bitmap & 4),
  1695. value: value
  1696. };
  1697. };
  1698. /***/ }),
  1699. /* 16 */
  1700. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1701. var IndexedObject = __w_pdfjs_require__(17);
  1702. var requireObjectCoercible = __w_pdfjs_require__(20);
  1703. module.exports = function (it) {
  1704. return IndexedObject(requireObjectCoercible(it));
  1705. };
  1706. /***/ }),
  1707. /* 17 */
  1708. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1709. var uncurryThis = __w_pdfjs_require__(18);
  1710. var fails = __w_pdfjs_require__(11);
  1711. var classof = __w_pdfjs_require__(19);
  1712. var $Object = Object;
  1713. var split = uncurryThis(''.split);
  1714. module.exports = fails(function () {
  1715. return !$Object('z').propertyIsEnumerable(0);
  1716. }) ? function (it) {
  1717. return classof(it) == 'String' ? split(it, '') : $Object(it);
  1718. } : $Object;
  1719. /***/ }),
  1720. /* 18 */
  1721. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1722. var NATIVE_BIND = __w_pdfjs_require__(13);
  1723. var FunctionPrototype = Function.prototype;
  1724. var call = FunctionPrototype.call;
  1725. var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call);
  1726. module.exports = NATIVE_BIND ? uncurryThisWithBind : function (fn) {
  1727. return function () {
  1728. return call.apply(fn, arguments);
  1729. };
  1730. };
  1731. /***/ }),
  1732. /* 19 */
  1733. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1734. var uncurryThis = __w_pdfjs_require__(18);
  1735. var toString = uncurryThis({}.toString);
  1736. var stringSlice = uncurryThis(''.slice);
  1737. module.exports = function (it) {
  1738. return stringSlice(toString(it), 8, -1);
  1739. };
  1740. /***/ }),
  1741. /* 20 */
  1742. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1743. var isNullOrUndefined = __w_pdfjs_require__(21);
  1744. var $TypeError = TypeError;
  1745. module.exports = function (it) {
  1746. if (isNullOrUndefined(it))
  1747. throw $TypeError("Can't call method on " + it);
  1748. return it;
  1749. };
  1750. /***/ }),
  1751. /* 21 */
  1752. /***/ ((module) => {
  1753. module.exports = function (it) {
  1754. return it === null || it === undefined;
  1755. };
  1756. /***/ }),
  1757. /* 22 */
  1758. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1759. var toPrimitive = __w_pdfjs_require__(23);
  1760. var isSymbol = __w_pdfjs_require__(27);
  1761. module.exports = function (argument) {
  1762. var key = toPrimitive(argument, 'string');
  1763. return isSymbol(key) ? key : key + '';
  1764. };
  1765. /***/ }),
  1766. /* 23 */
  1767. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1768. var call = __w_pdfjs_require__(12);
  1769. var isObject = __w_pdfjs_require__(24);
  1770. var isSymbol = __w_pdfjs_require__(27);
  1771. var getMethod = __w_pdfjs_require__(34);
  1772. var ordinaryToPrimitive = __w_pdfjs_require__(37);
  1773. var wellKnownSymbol = __w_pdfjs_require__(38);
  1774. var $TypeError = TypeError;
  1775. var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
  1776. module.exports = function (input, pref) {
  1777. if (!isObject(input) || isSymbol(input))
  1778. return input;
  1779. var exoticToPrim = getMethod(input, TO_PRIMITIVE);
  1780. var result;
  1781. if (exoticToPrim) {
  1782. if (pref === undefined)
  1783. pref = 'default';
  1784. result = call(exoticToPrim, input, pref);
  1785. if (!isObject(result) || isSymbol(result))
  1786. return result;
  1787. throw $TypeError("Can't convert object to primitive value");
  1788. }
  1789. if (pref === undefined)
  1790. pref = 'number';
  1791. return ordinaryToPrimitive(input, pref);
  1792. };
  1793. /***/ }),
  1794. /* 24 */
  1795. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1796. var isCallable = __w_pdfjs_require__(25);
  1797. var $documentAll = __w_pdfjs_require__(26);
  1798. var documentAll = $documentAll.all;
  1799. module.exports = $documentAll.IS_HTMLDDA ? function (it) {
  1800. return typeof it == 'object' ? it !== null : isCallable(it) || it === documentAll;
  1801. } : function (it) {
  1802. return typeof it == 'object' ? it !== null : isCallable(it);
  1803. };
  1804. /***/ }),
  1805. /* 25 */
  1806. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1807. var $documentAll = __w_pdfjs_require__(26);
  1808. var documentAll = $documentAll.all;
  1809. module.exports = $documentAll.IS_HTMLDDA ? function (argument) {
  1810. return typeof argument == 'function' || argument === documentAll;
  1811. } : function (argument) {
  1812. return typeof argument == 'function';
  1813. };
  1814. /***/ }),
  1815. /* 26 */
  1816. /***/ ((module) => {
  1817. var documentAll = typeof document == 'object' && document.all;
  1818. var IS_HTMLDDA = typeof documentAll == 'undefined' && documentAll !== undefined;
  1819. module.exports = {
  1820. all: documentAll,
  1821. IS_HTMLDDA: IS_HTMLDDA
  1822. };
  1823. /***/ }),
  1824. /* 27 */
  1825. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1826. var getBuiltIn = __w_pdfjs_require__(28);
  1827. var isCallable = __w_pdfjs_require__(25);
  1828. var isPrototypeOf = __w_pdfjs_require__(29);
  1829. var USE_SYMBOL_AS_UID = __w_pdfjs_require__(30);
  1830. var $Object = Object;
  1831. module.exports = USE_SYMBOL_AS_UID ? function (it) {
  1832. return typeof it == 'symbol';
  1833. } : function (it) {
  1834. var $Symbol = getBuiltIn('Symbol');
  1835. return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
  1836. };
  1837. /***/ }),
  1838. /* 28 */
  1839. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1840. var global = __w_pdfjs_require__(8);
  1841. var isCallable = __w_pdfjs_require__(25);
  1842. var aFunction = function (argument) {
  1843. return isCallable(argument) ? argument : undefined;
  1844. };
  1845. module.exports = function (namespace, method) {
  1846. return arguments.length < 2 ? aFunction(global[namespace]) : global[namespace] && global[namespace][method];
  1847. };
  1848. /***/ }),
  1849. /* 29 */
  1850. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1851. var uncurryThis = __w_pdfjs_require__(18);
  1852. module.exports = uncurryThis({}.isPrototypeOf);
  1853. /***/ }),
  1854. /* 30 */
  1855. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1856. var NATIVE_SYMBOL = __w_pdfjs_require__(31);
  1857. module.exports = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == 'symbol';
  1858. /***/ }),
  1859. /* 31 */
  1860. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1861. var V8_VERSION = __w_pdfjs_require__(32);
  1862. var fails = __w_pdfjs_require__(11);
  1863. module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
  1864. var symbol = Symbol();
  1865. return !String(symbol) || !(Object(symbol) instanceof Symbol) || !Symbol.sham && V8_VERSION && V8_VERSION < 41;
  1866. });
  1867. /***/ }),
  1868. /* 32 */
  1869. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1870. var global = __w_pdfjs_require__(8);
  1871. var userAgent = __w_pdfjs_require__(33);
  1872. var process = global.process;
  1873. var Deno = global.Deno;
  1874. var versions = process && process.versions || Deno && Deno.version;
  1875. var v8 = versions && versions.v8;
  1876. var match, version;
  1877. if (v8) {
  1878. match = v8.split('.');
  1879. version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
  1880. }
  1881. if (!version && userAgent) {
  1882. match = userAgent.match(/Edge\/(\d+)/);
  1883. if (!match || match[1] >= 74) {
  1884. match = userAgent.match(/Chrome\/(\d+)/);
  1885. if (match)
  1886. version = +match[1];
  1887. }
  1888. }
  1889. module.exports = version;
  1890. /***/ }),
  1891. /* 33 */
  1892. /***/ ((module) => {
  1893. module.exports = typeof navigator != 'undefined' && String(navigator.userAgent) || '';
  1894. /***/ }),
  1895. /* 34 */
  1896. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1897. var aCallable = __w_pdfjs_require__(35);
  1898. var isNullOrUndefined = __w_pdfjs_require__(21);
  1899. module.exports = function (V, P) {
  1900. var func = V[P];
  1901. return isNullOrUndefined(func) ? undefined : aCallable(func);
  1902. };
  1903. /***/ }),
  1904. /* 35 */
  1905. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1906. var isCallable = __w_pdfjs_require__(25);
  1907. var tryToString = __w_pdfjs_require__(36);
  1908. var $TypeError = TypeError;
  1909. module.exports = function (argument) {
  1910. if (isCallable(argument))
  1911. return argument;
  1912. throw $TypeError(tryToString(argument) + ' is not a function');
  1913. };
  1914. /***/ }),
  1915. /* 36 */
  1916. /***/ ((module) => {
  1917. var $String = String;
  1918. module.exports = function (argument) {
  1919. try {
  1920. return $String(argument);
  1921. } catch (error) {
  1922. return 'Object';
  1923. }
  1924. };
  1925. /***/ }),
  1926. /* 37 */
  1927. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1928. var call = __w_pdfjs_require__(12);
  1929. var isCallable = __w_pdfjs_require__(25);
  1930. var isObject = __w_pdfjs_require__(24);
  1931. var $TypeError = TypeError;
  1932. module.exports = function (input, pref) {
  1933. var fn, val;
  1934. if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input)))
  1935. return val;
  1936. if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input)))
  1937. return val;
  1938. if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input)))
  1939. return val;
  1940. throw $TypeError("Can't convert object to primitive value");
  1941. };
  1942. /***/ }),
  1943. /* 38 */
  1944. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1945. var global = __w_pdfjs_require__(8);
  1946. var shared = __w_pdfjs_require__(39);
  1947. var hasOwn = __w_pdfjs_require__(43);
  1948. var uid = __w_pdfjs_require__(45);
  1949. var NATIVE_SYMBOL = __w_pdfjs_require__(31);
  1950. var USE_SYMBOL_AS_UID = __w_pdfjs_require__(30);
  1951. var Symbol = global.Symbol;
  1952. var WellKnownSymbolsStore = shared('wks');
  1953. var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol['for'] || Symbol : Symbol && Symbol.withoutSetter || uid;
  1954. module.exports = function (name) {
  1955. if (!hasOwn(WellKnownSymbolsStore, name)) {
  1956. WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn(Symbol, name) ? Symbol[name] : createWellKnownSymbol('Symbol.' + name);
  1957. }
  1958. return WellKnownSymbolsStore[name];
  1959. };
  1960. /***/ }),
  1961. /* 39 */
  1962. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1963. var IS_PURE = __w_pdfjs_require__(40);
  1964. var store = __w_pdfjs_require__(41);
  1965. (module.exports = function (key, value) {
  1966. return store[key] || (store[key] = value !== undefined ? value : {});
  1967. })('versions', []).push({
  1968. version: '3.27.2',
  1969. mode: IS_PURE ? 'pure' : 'global',
  1970. copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)',
  1971. license: 'https://github.com/zloirock/core-js/blob/v3.27.2/LICENSE',
  1972. source: 'https://github.com/zloirock/core-js'
  1973. });
  1974. /***/ }),
  1975. /* 40 */
  1976. /***/ ((module) => {
  1977. module.exports = false;
  1978. /***/ }),
  1979. /* 41 */
  1980. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1981. var global = __w_pdfjs_require__(8);
  1982. var defineGlobalProperty = __w_pdfjs_require__(42);
  1983. var SHARED = '__core-js_shared__';
  1984. var store = global[SHARED] || defineGlobalProperty(SHARED, {});
  1985. module.exports = store;
  1986. /***/ }),
  1987. /* 42 */
  1988. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1989. var global = __w_pdfjs_require__(8);
  1990. var defineProperty = Object.defineProperty;
  1991. module.exports = function (key, value) {
  1992. try {
  1993. defineProperty(global, key, {
  1994. value: value,
  1995. configurable: true,
  1996. writable: true
  1997. });
  1998. } catch (error) {
  1999. global[key] = value;
  2000. }
  2001. return value;
  2002. };
  2003. /***/ }),
  2004. /* 43 */
  2005. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2006. var uncurryThis = __w_pdfjs_require__(18);
  2007. var toObject = __w_pdfjs_require__(44);
  2008. var hasOwnProperty = uncurryThis({}.hasOwnProperty);
  2009. module.exports = Object.hasOwn || function hasOwn(it, key) {
  2010. return hasOwnProperty(toObject(it), key);
  2011. };
  2012. /***/ }),
  2013. /* 44 */
  2014. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2015. var requireObjectCoercible = __w_pdfjs_require__(20);
  2016. var $Object = Object;
  2017. module.exports = function (argument) {
  2018. return $Object(requireObjectCoercible(argument));
  2019. };
  2020. /***/ }),
  2021. /* 45 */
  2022. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2023. var uncurryThis = __w_pdfjs_require__(18);
  2024. var id = 0;
  2025. var postfix = Math.random();
  2026. var toString = uncurryThis(1.0.toString);
  2027. module.exports = function (key) {
  2028. return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
  2029. };
  2030. /***/ }),
  2031. /* 46 */
  2032. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2033. var DESCRIPTORS = __w_pdfjs_require__(10);
  2034. var fails = __w_pdfjs_require__(11);
  2035. var createElement = __w_pdfjs_require__(47);
  2036. module.exports = !DESCRIPTORS && !fails(function () {
  2037. return Object.defineProperty(createElement('div'), 'a', {
  2038. get: function () {
  2039. return 7;
  2040. }
  2041. }).a != 7;
  2042. });
  2043. /***/ }),
  2044. /* 47 */
  2045. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2046. var global = __w_pdfjs_require__(8);
  2047. var isObject = __w_pdfjs_require__(24);
  2048. var document = global.document;
  2049. var EXISTS = isObject(document) && isObject(document.createElement);
  2050. module.exports = function (it) {
  2051. return EXISTS ? document.createElement(it) : {};
  2052. };
  2053. /***/ }),
  2054. /* 48 */
  2055. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2056. var DESCRIPTORS = __w_pdfjs_require__(10);
  2057. var definePropertyModule = __w_pdfjs_require__(49);
  2058. var createPropertyDescriptor = __w_pdfjs_require__(15);
  2059. module.exports = DESCRIPTORS ? function (object, key, value) {
  2060. return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
  2061. } : function (object, key, value) {
  2062. object[key] = value;
  2063. return object;
  2064. };
  2065. /***/ }),
  2066. /* 49 */
  2067. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2068. var DESCRIPTORS = __w_pdfjs_require__(10);
  2069. var IE8_DOM_DEFINE = __w_pdfjs_require__(46);
  2070. var V8_PROTOTYPE_DEFINE_BUG = __w_pdfjs_require__(50);
  2071. var anObject = __w_pdfjs_require__(51);
  2072. var toPropertyKey = __w_pdfjs_require__(22);
  2073. var $TypeError = TypeError;
  2074. var $defineProperty = Object.defineProperty;
  2075. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  2076. var ENUMERABLE = 'enumerable';
  2077. var CONFIGURABLE = 'configurable';
  2078. var WRITABLE = 'writable';
  2079. exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
  2080. anObject(O);
  2081. P = toPropertyKey(P);
  2082. anObject(Attributes);
  2083. if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
  2084. var current = $getOwnPropertyDescriptor(O, P);
  2085. if (current && current[WRITABLE]) {
  2086. O[P] = Attributes.value;
  2087. Attributes = {
  2088. configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
  2089. enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
  2090. writable: false
  2091. };
  2092. }
  2093. }
  2094. return $defineProperty(O, P, Attributes);
  2095. } : $defineProperty : function defineProperty(O, P, Attributes) {
  2096. anObject(O);
  2097. P = toPropertyKey(P);
  2098. anObject(Attributes);
  2099. if (IE8_DOM_DEFINE)
  2100. try {
  2101. return $defineProperty(O, P, Attributes);
  2102. } catch (error) {
  2103. }
  2104. if ('get' in Attributes || 'set' in Attributes)
  2105. throw $TypeError('Accessors not supported');
  2106. if ('value' in Attributes)
  2107. O[P] = Attributes.value;
  2108. return O;
  2109. };
  2110. /***/ }),
  2111. /* 50 */
  2112. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2113. var DESCRIPTORS = __w_pdfjs_require__(10);
  2114. var fails = __w_pdfjs_require__(11);
  2115. module.exports = DESCRIPTORS && fails(function () {
  2116. return Object.defineProperty(function () {
  2117. }, 'prototype', {
  2118. value: 42,
  2119. writable: false
  2120. }).prototype != 42;
  2121. });
  2122. /***/ }),
  2123. /* 51 */
  2124. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2125. var isObject = __w_pdfjs_require__(24);
  2126. var $String = String;
  2127. var $TypeError = TypeError;
  2128. module.exports = function (argument) {
  2129. if (isObject(argument))
  2130. return argument;
  2131. throw $TypeError($String(argument) + ' is not an object');
  2132. };
  2133. /***/ }),
  2134. /* 52 */
  2135. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2136. var isCallable = __w_pdfjs_require__(25);
  2137. var definePropertyModule = __w_pdfjs_require__(49);
  2138. var makeBuiltIn = __w_pdfjs_require__(53);
  2139. var defineGlobalProperty = __w_pdfjs_require__(42);
  2140. module.exports = function (O, key, value, options) {
  2141. if (!options)
  2142. options = {};
  2143. var simple = options.enumerable;
  2144. var name = options.name !== undefined ? options.name : key;
  2145. if (isCallable(value))
  2146. makeBuiltIn(value, name, options);
  2147. if (options.global) {
  2148. if (simple)
  2149. O[key] = value;
  2150. else
  2151. defineGlobalProperty(key, value);
  2152. } else {
  2153. try {
  2154. if (!options.unsafe)
  2155. delete O[key];
  2156. else if (O[key])
  2157. simple = true;
  2158. } catch (error) {
  2159. }
  2160. if (simple)
  2161. O[key] = value;
  2162. else
  2163. definePropertyModule.f(O, key, {
  2164. value: value,
  2165. enumerable: false,
  2166. configurable: !options.nonConfigurable,
  2167. writable: !options.nonWritable
  2168. });
  2169. }
  2170. return O;
  2171. };
  2172. /***/ }),
  2173. /* 53 */
  2174. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2175. var uncurryThis = __w_pdfjs_require__(18);
  2176. var fails = __w_pdfjs_require__(11);
  2177. var isCallable = __w_pdfjs_require__(25);
  2178. var hasOwn = __w_pdfjs_require__(43);
  2179. var DESCRIPTORS = __w_pdfjs_require__(10);
  2180. var CONFIGURABLE_FUNCTION_NAME = (__w_pdfjs_require__(54).CONFIGURABLE);
  2181. var inspectSource = __w_pdfjs_require__(55);
  2182. var InternalStateModule = __w_pdfjs_require__(56);
  2183. var enforceInternalState = InternalStateModule.enforce;
  2184. var getInternalState = InternalStateModule.get;
  2185. var $String = String;
  2186. var defineProperty = Object.defineProperty;
  2187. var stringSlice = uncurryThis(''.slice);
  2188. var replace = uncurryThis(''.replace);
  2189. var join = uncurryThis([].join);
  2190. var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () {
  2191. return defineProperty(function () {
  2192. }, 'length', { value: 8 }).length !== 8;
  2193. });
  2194. var TEMPLATE = String(String).split('String');
  2195. var makeBuiltIn = module.exports = function (value, name, options) {
  2196. if (stringSlice($String(name), 0, 7) === 'Symbol(') {
  2197. name = '[' + replace($String(name), /^Symbol\(([^)]*)\)/, '$1') + ']';
  2198. }
  2199. if (options && options.getter)
  2200. name = 'get ' + name;
  2201. if (options && options.setter)
  2202. name = 'set ' + name;
  2203. if (!hasOwn(value, 'name') || CONFIGURABLE_FUNCTION_NAME && value.name !== name) {
  2204. if (DESCRIPTORS)
  2205. defineProperty(value, 'name', {
  2206. value: name,
  2207. configurable: true
  2208. });
  2209. else
  2210. value.name = name;
  2211. }
  2212. if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) {
  2213. defineProperty(value, 'length', { value: options.arity });
  2214. }
  2215. try {
  2216. if (options && hasOwn(options, 'constructor') && options.constructor) {
  2217. if (DESCRIPTORS)
  2218. defineProperty(value, 'prototype', { writable: false });
  2219. } else if (value.prototype)
  2220. value.prototype = undefined;
  2221. } catch (error) {
  2222. }
  2223. var state = enforceInternalState(value);
  2224. if (!hasOwn(state, 'source')) {
  2225. state.source = join(TEMPLATE, typeof name == 'string' ? name : '');
  2226. }
  2227. return value;
  2228. };
  2229. Function.prototype.toString = makeBuiltIn(function toString() {
  2230. return isCallable(this) && getInternalState(this).source || inspectSource(this);
  2231. }, 'toString');
  2232. /***/ }),
  2233. /* 54 */
  2234. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2235. var DESCRIPTORS = __w_pdfjs_require__(10);
  2236. var hasOwn = __w_pdfjs_require__(43);
  2237. var FunctionPrototype = Function.prototype;
  2238. var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
  2239. var EXISTS = hasOwn(FunctionPrototype, 'name');
  2240. var PROPER = EXISTS && function something() {
  2241. }.name === 'something';
  2242. var CONFIGURABLE = EXISTS && (!DESCRIPTORS || DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable);
  2243. module.exports = {
  2244. EXISTS: EXISTS,
  2245. PROPER: PROPER,
  2246. CONFIGURABLE: CONFIGURABLE
  2247. };
  2248. /***/ }),
  2249. /* 55 */
  2250. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2251. var uncurryThis = __w_pdfjs_require__(18);
  2252. var isCallable = __w_pdfjs_require__(25);
  2253. var store = __w_pdfjs_require__(41);
  2254. var functionToString = uncurryThis(Function.toString);
  2255. if (!isCallable(store.inspectSource)) {
  2256. store.inspectSource = function (it) {
  2257. return functionToString(it);
  2258. };
  2259. }
  2260. module.exports = store.inspectSource;
  2261. /***/ }),
  2262. /* 56 */
  2263. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2264. var NATIVE_WEAK_MAP = __w_pdfjs_require__(57);
  2265. var global = __w_pdfjs_require__(8);
  2266. var isObject = __w_pdfjs_require__(24);
  2267. var createNonEnumerableProperty = __w_pdfjs_require__(48);
  2268. var hasOwn = __w_pdfjs_require__(43);
  2269. var shared = __w_pdfjs_require__(41);
  2270. var sharedKey = __w_pdfjs_require__(58);
  2271. var hiddenKeys = __w_pdfjs_require__(59);
  2272. var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
  2273. var TypeError = global.TypeError;
  2274. var WeakMap = global.WeakMap;
  2275. var set, get, has;
  2276. var enforce = function (it) {
  2277. return has(it) ? get(it) : set(it, {});
  2278. };
  2279. var getterFor = function (TYPE) {
  2280. return function (it) {
  2281. var state;
  2282. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  2283. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  2284. }
  2285. return state;
  2286. };
  2287. };
  2288. if (NATIVE_WEAK_MAP || shared.state) {
  2289. var store = shared.state || (shared.state = new WeakMap());
  2290. store.get = store.get;
  2291. store.has = store.has;
  2292. store.set = store.set;
  2293. set = function (it, metadata) {
  2294. if (store.has(it))
  2295. throw TypeError(OBJECT_ALREADY_INITIALIZED);
  2296. metadata.facade = it;
  2297. store.set(it, metadata);
  2298. return metadata;
  2299. };
  2300. get = function (it) {
  2301. return store.get(it) || {};
  2302. };
  2303. has = function (it) {
  2304. return store.has(it);
  2305. };
  2306. } else {
  2307. var STATE = sharedKey('state');
  2308. hiddenKeys[STATE] = true;
  2309. set = function (it, metadata) {
  2310. if (hasOwn(it, STATE))
  2311. throw TypeError(OBJECT_ALREADY_INITIALIZED);
  2312. metadata.facade = it;
  2313. createNonEnumerableProperty(it, STATE, metadata);
  2314. return metadata;
  2315. };
  2316. get = function (it) {
  2317. return hasOwn(it, STATE) ? it[STATE] : {};
  2318. };
  2319. has = function (it) {
  2320. return hasOwn(it, STATE);
  2321. };
  2322. }
  2323. module.exports = {
  2324. set: set,
  2325. get: get,
  2326. has: has,
  2327. enforce: enforce,
  2328. getterFor: getterFor
  2329. };
  2330. /***/ }),
  2331. /* 57 */
  2332. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2333. var global = __w_pdfjs_require__(8);
  2334. var isCallable = __w_pdfjs_require__(25);
  2335. var WeakMap = global.WeakMap;
  2336. module.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap));
  2337. /***/ }),
  2338. /* 58 */
  2339. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2340. var shared = __w_pdfjs_require__(39);
  2341. var uid = __w_pdfjs_require__(45);
  2342. var keys = shared('keys');
  2343. module.exports = function (key) {
  2344. return keys[key] || (keys[key] = uid(key));
  2345. };
  2346. /***/ }),
  2347. /* 59 */
  2348. /***/ ((module) => {
  2349. module.exports = {};
  2350. /***/ }),
  2351. /* 60 */
  2352. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2353. var hasOwn = __w_pdfjs_require__(43);
  2354. var ownKeys = __w_pdfjs_require__(61);
  2355. var getOwnPropertyDescriptorModule = __w_pdfjs_require__(9);
  2356. var definePropertyModule = __w_pdfjs_require__(49);
  2357. module.exports = function (target, source, exceptions) {
  2358. var keys = ownKeys(source);
  2359. var defineProperty = definePropertyModule.f;
  2360. var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  2361. for (var i = 0; i < keys.length; i++) {
  2362. var key = keys[i];
  2363. if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
  2364. defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  2365. }
  2366. }
  2367. };
  2368. /***/ }),
  2369. /* 61 */
  2370. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2371. var getBuiltIn = __w_pdfjs_require__(28);
  2372. var uncurryThis = __w_pdfjs_require__(18);
  2373. var getOwnPropertyNamesModule = __w_pdfjs_require__(62);
  2374. var getOwnPropertySymbolsModule = __w_pdfjs_require__(71);
  2375. var anObject = __w_pdfjs_require__(51);
  2376. var concat = uncurryThis([].concat);
  2377. module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  2378. var keys = getOwnPropertyNamesModule.f(anObject(it));
  2379. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  2380. return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
  2381. };
  2382. /***/ }),
  2383. /* 62 */
  2384. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2385. var internalObjectKeys = __w_pdfjs_require__(63);
  2386. var enumBugKeys = __w_pdfjs_require__(70);
  2387. var hiddenKeys = enumBugKeys.concat('length', 'prototype');
  2388. exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  2389. return internalObjectKeys(O, hiddenKeys);
  2390. };
  2391. /***/ }),
  2392. /* 63 */
  2393. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2394. var uncurryThis = __w_pdfjs_require__(18);
  2395. var hasOwn = __w_pdfjs_require__(43);
  2396. var toIndexedObject = __w_pdfjs_require__(16);
  2397. var indexOf = (__w_pdfjs_require__(64).indexOf);
  2398. var hiddenKeys = __w_pdfjs_require__(59);
  2399. var push = uncurryThis([].push);
  2400. module.exports = function (object, names) {
  2401. var O = toIndexedObject(object);
  2402. var i = 0;
  2403. var result = [];
  2404. var key;
  2405. for (key in O)
  2406. !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
  2407. while (names.length > i)
  2408. if (hasOwn(O, key = names[i++])) {
  2409. ~indexOf(result, key) || push(result, key);
  2410. }
  2411. return result;
  2412. };
  2413. /***/ }),
  2414. /* 64 */
  2415. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2416. var toIndexedObject = __w_pdfjs_require__(16);
  2417. var toAbsoluteIndex = __w_pdfjs_require__(65);
  2418. var lengthOfArrayLike = __w_pdfjs_require__(68);
  2419. var createMethod = function (IS_INCLUDES) {
  2420. return function ($this, el, fromIndex) {
  2421. var O = toIndexedObject($this);
  2422. var length = lengthOfArrayLike(O);
  2423. var index = toAbsoluteIndex(fromIndex, length);
  2424. var value;
  2425. if (IS_INCLUDES && el != el)
  2426. while (length > index) {
  2427. value = O[index++];
  2428. if (value != value)
  2429. return true;
  2430. }
  2431. else
  2432. for (; length > index; index++) {
  2433. if ((IS_INCLUDES || index in O) && O[index] === el)
  2434. return IS_INCLUDES || index || 0;
  2435. }
  2436. return !IS_INCLUDES && -1;
  2437. };
  2438. };
  2439. module.exports = {
  2440. includes: createMethod(true),
  2441. indexOf: createMethod(false)
  2442. };
  2443. /***/ }),
  2444. /* 65 */
  2445. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2446. var toIntegerOrInfinity = __w_pdfjs_require__(66);
  2447. var max = Math.max;
  2448. var min = Math.min;
  2449. module.exports = function (index, length) {
  2450. var integer = toIntegerOrInfinity(index);
  2451. return integer < 0 ? max(integer + length, 0) : min(integer, length);
  2452. };
  2453. /***/ }),
  2454. /* 66 */
  2455. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2456. var trunc = __w_pdfjs_require__(67);
  2457. module.exports = function (argument) {
  2458. var number = +argument;
  2459. return number !== number || number === 0 ? 0 : trunc(number);
  2460. };
  2461. /***/ }),
  2462. /* 67 */
  2463. /***/ ((module) => {
  2464. var ceil = Math.ceil;
  2465. var floor = Math.floor;
  2466. module.exports = Math.trunc || function trunc(x) {
  2467. var n = +x;
  2468. return (n > 0 ? floor : ceil)(n);
  2469. };
  2470. /***/ }),
  2471. /* 68 */
  2472. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2473. var toLength = __w_pdfjs_require__(69);
  2474. module.exports = function (obj) {
  2475. return toLength(obj.length);
  2476. };
  2477. /***/ }),
  2478. /* 69 */
  2479. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2480. var toIntegerOrInfinity = __w_pdfjs_require__(66);
  2481. var min = Math.min;
  2482. module.exports = function (argument) {
  2483. return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0;
  2484. };
  2485. /***/ }),
  2486. /* 70 */
  2487. /***/ ((module) => {
  2488. module.exports = [
  2489. 'constructor',
  2490. 'hasOwnProperty',
  2491. 'isPrototypeOf',
  2492. 'propertyIsEnumerable',
  2493. 'toLocaleString',
  2494. 'toString',
  2495. 'valueOf'
  2496. ];
  2497. /***/ }),
  2498. /* 71 */
  2499. /***/ ((__unused_webpack_module, exports) => {
  2500. exports.f = Object.getOwnPropertySymbols;
  2501. /***/ }),
  2502. /* 72 */
  2503. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2504. var fails = __w_pdfjs_require__(11);
  2505. var isCallable = __w_pdfjs_require__(25);
  2506. var replacement = /#|\.prototype\./;
  2507. var isForced = function (feature, detection) {
  2508. var value = data[normalize(feature)];
  2509. return value == POLYFILL ? true : value == NATIVE ? false : isCallable(detection) ? fails(detection) : !!detection;
  2510. };
  2511. var normalize = isForced.normalize = function (string) {
  2512. return String(string).replace(replacement, '.').toLowerCase();
  2513. };
  2514. var data = isForced.data = {};
  2515. var NATIVE = isForced.NATIVE = 'N';
  2516. var POLYFILL = isForced.POLYFILL = 'P';
  2517. module.exports = isForced;
  2518. /***/ }),
  2519. /* 73 */
  2520. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2521. var wellKnownSymbol = __w_pdfjs_require__(38);
  2522. var create = __w_pdfjs_require__(74);
  2523. var defineProperty = (__w_pdfjs_require__(49).f);
  2524. var UNSCOPABLES = wellKnownSymbol('unscopables');
  2525. var ArrayPrototype = Array.prototype;
  2526. if (ArrayPrototype[UNSCOPABLES] == undefined) {
  2527. defineProperty(ArrayPrototype, UNSCOPABLES, {
  2528. configurable: true,
  2529. value: create(null)
  2530. });
  2531. }
  2532. module.exports = function (key) {
  2533. ArrayPrototype[UNSCOPABLES][key] = true;
  2534. };
  2535. /***/ }),
  2536. /* 74 */
  2537. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2538. var anObject = __w_pdfjs_require__(51);
  2539. var definePropertiesModule = __w_pdfjs_require__(75);
  2540. var enumBugKeys = __w_pdfjs_require__(70);
  2541. var hiddenKeys = __w_pdfjs_require__(59);
  2542. var html = __w_pdfjs_require__(77);
  2543. var documentCreateElement = __w_pdfjs_require__(47);
  2544. var sharedKey = __w_pdfjs_require__(58);
  2545. var GT = '>';
  2546. var LT = '<';
  2547. var PROTOTYPE = 'prototype';
  2548. var SCRIPT = 'script';
  2549. var IE_PROTO = sharedKey('IE_PROTO');
  2550. var EmptyConstructor = function () {
  2551. };
  2552. var scriptTag = function (content) {
  2553. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  2554. };
  2555. var NullProtoObjectViaActiveX = function (activeXDocument) {
  2556. activeXDocument.write(scriptTag(''));
  2557. activeXDocument.close();
  2558. var temp = activeXDocument.parentWindow.Object;
  2559. activeXDocument = null;
  2560. return temp;
  2561. };
  2562. var NullProtoObjectViaIFrame = function () {
  2563. var iframe = documentCreateElement('iframe');
  2564. var JS = 'java' + SCRIPT + ':';
  2565. var iframeDocument;
  2566. iframe.style.display = 'none';
  2567. html.appendChild(iframe);
  2568. iframe.src = String(JS);
  2569. iframeDocument = iframe.contentWindow.document;
  2570. iframeDocument.open();
  2571. iframeDocument.write(scriptTag('document.F=Object'));
  2572. iframeDocument.close();
  2573. return iframeDocument.F;
  2574. };
  2575. var activeXDocument;
  2576. var NullProtoObject = function () {
  2577. try {
  2578. activeXDocument = new ActiveXObject('htmlfile');
  2579. } catch (error) {
  2580. }
  2581. NullProtoObject = typeof document != 'undefined' ? document.domain && activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame() : NullProtoObjectViaActiveX(activeXDocument);
  2582. var length = enumBugKeys.length;
  2583. while (length--)
  2584. delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  2585. return NullProtoObject();
  2586. };
  2587. hiddenKeys[IE_PROTO] = true;
  2588. module.exports = Object.create || function create(O, Properties) {
  2589. var result;
  2590. if (O !== null) {
  2591. EmptyConstructor[PROTOTYPE] = anObject(O);
  2592. result = new EmptyConstructor();
  2593. EmptyConstructor[PROTOTYPE] = null;
  2594. result[IE_PROTO] = O;
  2595. } else
  2596. result = NullProtoObject();
  2597. return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
  2598. };
  2599. /***/ }),
  2600. /* 75 */
  2601. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2602. var DESCRIPTORS = __w_pdfjs_require__(10);
  2603. var V8_PROTOTYPE_DEFINE_BUG = __w_pdfjs_require__(50);
  2604. var definePropertyModule = __w_pdfjs_require__(49);
  2605. var anObject = __w_pdfjs_require__(51);
  2606. var toIndexedObject = __w_pdfjs_require__(16);
  2607. var objectKeys = __w_pdfjs_require__(76);
  2608. exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
  2609. anObject(O);
  2610. var props = toIndexedObject(Properties);
  2611. var keys = objectKeys(Properties);
  2612. var length = keys.length;
  2613. var index = 0;
  2614. var key;
  2615. while (length > index)
  2616. definePropertyModule.f(O, key = keys[index++], props[key]);
  2617. return O;
  2618. };
  2619. /***/ }),
  2620. /* 76 */
  2621. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2622. var internalObjectKeys = __w_pdfjs_require__(63);
  2623. var enumBugKeys = __w_pdfjs_require__(70);
  2624. module.exports = Object.keys || function keys(O) {
  2625. return internalObjectKeys(O, enumBugKeys);
  2626. };
  2627. /***/ }),
  2628. /* 77 */
  2629. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2630. var getBuiltIn = __w_pdfjs_require__(28);
  2631. module.exports = getBuiltIn('document', 'documentElement');
  2632. /***/ }),
  2633. /* 78 */
  2634. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2635. var global = __w_pdfjs_require__(8);
  2636. var uncurryThis = __w_pdfjs_require__(18);
  2637. module.exports = function (CONSTRUCTOR, METHOD) {
  2638. return uncurryThis(global[CONSTRUCTOR].prototype[METHOD]);
  2639. };
  2640. /***/ }),
  2641. /* 79 */
  2642. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2643. __w_pdfjs_require__(80);
  2644. /***/ }),
  2645. /* 80 */
  2646. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2647. "use strict";
  2648. var ArrayBufferViewCore = __w_pdfjs_require__(81);
  2649. var lengthOfArrayLike = __w_pdfjs_require__(68);
  2650. var toIntegerOrInfinity = __w_pdfjs_require__(66);
  2651. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  2652. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  2653. exportTypedArrayMethod('at', function at(index) {
  2654. var O = aTypedArray(this);
  2655. var len = lengthOfArrayLike(O);
  2656. var relativeIndex = toIntegerOrInfinity(index);
  2657. var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex;
  2658. return k < 0 || k >= len ? undefined : O[k];
  2659. });
  2660. /***/ }),
  2661. /* 81 */
  2662. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2663. "use strict";
  2664. var NATIVE_ARRAY_BUFFER = __w_pdfjs_require__(82);
  2665. var DESCRIPTORS = __w_pdfjs_require__(10);
  2666. var global = __w_pdfjs_require__(8);
  2667. var isCallable = __w_pdfjs_require__(25);
  2668. var isObject = __w_pdfjs_require__(24);
  2669. var hasOwn = __w_pdfjs_require__(43);
  2670. var classof = __w_pdfjs_require__(83);
  2671. var tryToString = __w_pdfjs_require__(36);
  2672. var createNonEnumerableProperty = __w_pdfjs_require__(48);
  2673. var defineBuiltIn = __w_pdfjs_require__(52);
  2674. var defineProperty = (__w_pdfjs_require__(49).f);
  2675. var isPrototypeOf = __w_pdfjs_require__(29);
  2676. var getPrototypeOf = __w_pdfjs_require__(85);
  2677. var setPrototypeOf = __w_pdfjs_require__(87);
  2678. var wellKnownSymbol = __w_pdfjs_require__(38);
  2679. var uid = __w_pdfjs_require__(45);
  2680. var InternalStateModule = __w_pdfjs_require__(56);
  2681. var enforceInternalState = InternalStateModule.enforce;
  2682. var getInternalState = InternalStateModule.get;
  2683. var Int8Array = global.Int8Array;
  2684. var Int8ArrayPrototype = Int8Array && Int8Array.prototype;
  2685. var Uint8ClampedArray = global.Uint8ClampedArray;
  2686. var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype;
  2687. var TypedArray = Int8Array && getPrototypeOf(Int8Array);
  2688. var TypedArrayPrototype = Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype);
  2689. var ObjectPrototype = Object.prototype;
  2690. var TypeError = global.TypeError;
  2691. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  2692. var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG');
  2693. var TYPED_ARRAY_CONSTRUCTOR = 'TypedArrayConstructor';
  2694. var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(global.opera) !== 'Opera';
  2695. var TYPED_ARRAY_TAG_REQUIRED = false;
  2696. var NAME, Constructor, Prototype;
  2697. var TypedArrayConstructorsList = {
  2698. Int8Array: 1,
  2699. Uint8Array: 1,
  2700. Uint8ClampedArray: 1,
  2701. Int16Array: 2,
  2702. Uint16Array: 2,
  2703. Int32Array: 4,
  2704. Uint32Array: 4,
  2705. Float32Array: 4,
  2706. Float64Array: 8
  2707. };
  2708. var BigIntArrayConstructorsList = {
  2709. BigInt64Array: 8,
  2710. BigUint64Array: 8
  2711. };
  2712. var isView = function isView(it) {
  2713. if (!isObject(it))
  2714. return false;
  2715. var klass = classof(it);
  2716. return klass === 'DataView' || hasOwn(TypedArrayConstructorsList, klass) || hasOwn(BigIntArrayConstructorsList, klass);
  2717. };
  2718. var getTypedArrayConstructor = function (it) {
  2719. var proto = getPrototypeOf(it);
  2720. if (!isObject(proto))
  2721. return;
  2722. var state = getInternalState(proto);
  2723. return state && hasOwn(state, TYPED_ARRAY_CONSTRUCTOR) ? state[TYPED_ARRAY_CONSTRUCTOR] : getTypedArrayConstructor(proto);
  2724. };
  2725. var isTypedArray = function (it) {
  2726. if (!isObject(it))
  2727. return false;
  2728. var klass = classof(it);
  2729. return hasOwn(TypedArrayConstructorsList, klass) || hasOwn(BigIntArrayConstructorsList, klass);
  2730. };
  2731. var aTypedArray = function (it) {
  2732. if (isTypedArray(it))
  2733. return it;
  2734. throw TypeError('Target is not a typed array');
  2735. };
  2736. var aTypedArrayConstructor = function (C) {
  2737. if (isCallable(C) && (!setPrototypeOf || isPrototypeOf(TypedArray, C)))
  2738. return C;
  2739. throw TypeError(tryToString(C) + ' is not a typed array constructor');
  2740. };
  2741. var exportTypedArrayMethod = function (KEY, property, forced, options) {
  2742. if (!DESCRIPTORS)
  2743. return;
  2744. if (forced)
  2745. for (var ARRAY in TypedArrayConstructorsList) {
  2746. var TypedArrayConstructor = global[ARRAY];
  2747. if (TypedArrayConstructor && hasOwn(TypedArrayConstructor.prototype, KEY))
  2748. try {
  2749. delete TypedArrayConstructor.prototype[KEY];
  2750. } catch (error) {
  2751. try {
  2752. TypedArrayConstructor.prototype[KEY] = property;
  2753. } catch (error2) {
  2754. }
  2755. }
  2756. }
  2757. if (!TypedArrayPrototype[KEY] || forced) {
  2758. defineBuiltIn(TypedArrayPrototype, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property, options);
  2759. }
  2760. };
  2761. var exportTypedArrayStaticMethod = function (KEY, property, forced) {
  2762. var ARRAY, TypedArrayConstructor;
  2763. if (!DESCRIPTORS)
  2764. return;
  2765. if (setPrototypeOf) {
  2766. if (forced)
  2767. for (ARRAY in TypedArrayConstructorsList) {
  2768. TypedArrayConstructor = global[ARRAY];
  2769. if (TypedArrayConstructor && hasOwn(TypedArrayConstructor, KEY))
  2770. try {
  2771. delete TypedArrayConstructor[KEY];
  2772. } catch (error) {
  2773. }
  2774. }
  2775. if (!TypedArray[KEY] || forced) {
  2776. try {
  2777. return defineBuiltIn(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && TypedArray[KEY] || property);
  2778. } catch (error) {
  2779. }
  2780. } else
  2781. return;
  2782. }
  2783. for (ARRAY in TypedArrayConstructorsList) {
  2784. TypedArrayConstructor = global[ARRAY];
  2785. if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) {
  2786. defineBuiltIn(TypedArrayConstructor, KEY, property);
  2787. }
  2788. }
  2789. };
  2790. for (NAME in TypedArrayConstructorsList) {
  2791. Constructor = global[NAME];
  2792. Prototype = Constructor && Constructor.prototype;
  2793. if (Prototype)
  2794. enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor;
  2795. else
  2796. NATIVE_ARRAY_BUFFER_VIEWS = false;
  2797. }
  2798. for (NAME in BigIntArrayConstructorsList) {
  2799. Constructor = global[NAME];
  2800. Prototype = Constructor && Constructor.prototype;
  2801. if (Prototype)
  2802. enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor;
  2803. }
  2804. if (!NATIVE_ARRAY_BUFFER_VIEWS || !isCallable(TypedArray) || TypedArray === Function.prototype) {
  2805. TypedArray = function TypedArray() {
  2806. throw TypeError('Incorrect invocation');
  2807. };
  2808. if (NATIVE_ARRAY_BUFFER_VIEWS)
  2809. for (NAME in TypedArrayConstructorsList) {
  2810. if (global[NAME])
  2811. setPrototypeOf(global[NAME], TypedArray);
  2812. }
  2813. }
  2814. if (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) {
  2815. TypedArrayPrototype = TypedArray.prototype;
  2816. if (NATIVE_ARRAY_BUFFER_VIEWS)
  2817. for (NAME in TypedArrayConstructorsList) {
  2818. if (global[NAME])
  2819. setPrototypeOf(global[NAME].prototype, TypedArrayPrototype);
  2820. }
  2821. }
  2822. if (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) {
  2823. setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype);
  2824. }
  2825. if (DESCRIPTORS && !hasOwn(TypedArrayPrototype, TO_STRING_TAG)) {
  2826. TYPED_ARRAY_TAG_REQUIRED = true;
  2827. defineProperty(TypedArrayPrototype, TO_STRING_TAG, {
  2828. get: function () {
  2829. return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined;
  2830. }
  2831. });
  2832. for (NAME in TypedArrayConstructorsList)
  2833. if (global[NAME]) {
  2834. createNonEnumerableProperty(global[NAME], TYPED_ARRAY_TAG, NAME);
  2835. }
  2836. }
  2837. module.exports = {
  2838. NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS,
  2839. TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQUIRED && TYPED_ARRAY_TAG,
  2840. aTypedArray: aTypedArray,
  2841. aTypedArrayConstructor: aTypedArrayConstructor,
  2842. exportTypedArrayMethod: exportTypedArrayMethod,
  2843. exportTypedArrayStaticMethod: exportTypedArrayStaticMethod,
  2844. getTypedArrayConstructor: getTypedArrayConstructor,
  2845. isView: isView,
  2846. isTypedArray: isTypedArray,
  2847. TypedArray: TypedArray,
  2848. TypedArrayPrototype: TypedArrayPrototype
  2849. };
  2850. /***/ }),
  2851. /* 82 */
  2852. /***/ ((module) => {
  2853. module.exports = typeof ArrayBuffer != 'undefined' && typeof DataView != 'undefined';
  2854. /***/ }),
  2855. /* 83 */
  2856. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2857. var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(84);
  2858. var isCallable = __w_pdfjs_require__(25);
  2859. var classofRaw = __w_pdfjs_require__(19);
  2860. var wellKnownSymbol = __w_pdfjs_require__(38);
  2861. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  2862. var $Object = Object;
  2863. var CORRECT_ARGUMENTS = classofRaw((function () {
  2864. return arguments;
  2865. }())) == 'Arguments';
  2866. var tryGet = function (it, key) {
  2867. try {
  2868. return it[key];
  2869. } catch (error) {
  2870. }
  2871. };
  2872. module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
  2873. var O, tag, result;
  2874. return it === undefined ? 'Undefined' : it === null ? 'Null' : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag : CORRECT_ARGUMENTS ? classofRaw(O) : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
  2875. };
  2876. /***/ }),
  2877. /* 84 */
  2878. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2879. var wellKnownSymbol = __w_pdfjs_require__(38);
  2880. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  2881. var test = {};
  2882. test[TO_STRING_TAG] = 'z';
  2883. module.exports = String(test) === '[object z]';
  2884. /***/ }),
  2885. /* 85 */
  2886. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2887. var hasOwn = __w_pdfjs_require__(43);
  2888. var isCallable = __w_pdfjs_require__(25);
  2889. var toObject = __w_pdfjs_require__(44);
  2890. var sharedKey = __w_pdfjs_require__(58);
  2891. var CORRECT_PROTOTYPE_GETTER = __w_pdfjs_require__(86);
  2892. var IE_PROTO = sharedKey('IE_PROTO');
  2893. var $Object = Object;
  2894. var ObjectPrototype = $Object.prototype;
  2895. module.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
  2896. var object = toObject(O);
  2897. if (hasOwn(object, IE_PROTO))
  2898. return object[IE_PROTO];
  2899. var constructor = object.constructor;
  2900. if (isCallable(constructor) && object instanceof constructor) {
  2901. return constructor.prototype;
  2902. }
  2903. return object instanceof $Object ? ObjectPrototype : null;
  2904. };
  2905. /***/ }),
  2906. /* 86 */
  2907. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2908. var fails = __w_pdfjs_require__(11);
  2909. module.exports = !fails(function () {
  2910. function F() {
  2911. }
  2912. F.prototype.constructor = null;
  2913. return Object.getPrototypeOf(new F()) !== F.prototype;
  2914. });
  2915. /***/ }),
  2916. /* 87 */
  2917. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2918. var uncurryThis = __w_pdfjs_require__(18);
  2919. var anObject = __w_pdfjs_require__(51);
  2920. var aPossiblePrototype = __w_pdfjs_require__(88);
  2921. module.exports = Object.setPrototypeOf || ('__proto__' in {} ? (function () {
  2922. var CORRECT_SETTER = false;
  2923. var test = {};
  2924. var setter;
  2925. try {
  2926. setter = uncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
  2927. setter(test, []);
  2928. CORRECT_SETTER = test instanceof Array;
  2929. } catch (error) {
  2930. }
  2931. return function setPrototypeOf(O, proto) {
  2932. anObject(O);
  2933. aPossiblePrototype(proto);
  2934. if (CORRECT_SETTER)
  2935. setter(O, proto);
  2936. else
  2937. O.__proto__ = proto;
  2938. return O;
  2939. };
  2940. }()) : undefined);
  2941. /***/ }),
  2942. /* 88 */
  2943. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2944. var isCallable = __w_pdfjs_require__(25);
  2945. var $String = String;
  2946. var $TypeError = TypeError;
  2947. module.exports = function (argument) {
  2948. if (typeof argument == 'object' || isCallable(argument))
  2949. return argument;
  2950. throw $TypeError("Can't set " + $String(argument) + ' as a prototype');
  2951. };
  2952. /***/ }),
  2953. /* 89 */
  2954. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2955. __w_pdfjs_require__(90);
  2956. __w_pdfjs_require__(97);
  2957. __w_pdfjs_require__(99);
  2958. __w_pdfjs_require__(122);
  2959. __w_pdfjs_require__(124);
  2960. var path = __w_pdfjs_require__(135);
  2961. module.exports = path.structuredClone;
  2962. /***/ }),
  2963. /* 90 */
  2964. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2965. "use strict";
  2966. var toIndexedObject = __w_pdfjs_require__(16);
  2967. var addToUnscopables = __w_pdfjs_require__(73);
  2968. var Iterators = __w_pdfjs_require__(91);
  2969. var InternalStateModule = __w_pdfjs_require__(56);
  2970. var defineProperty = (__w_pdfjs_require__(49).f);
  2971. var defineIterator = __w_pdfjs_require__(92);
  2972. var createIterResultObject = __w_pdfjs_require__(96);
  2973. var IS_PURE = __w_pdfjs_require__(40);
  2974. var DESCRIPTORS = __w_pdfjs_require__(10);
  2975. var ARRAY_ITERATOR = 'Array Iterator';
  2976. var setInternalState = InternalStateModule.set;
  2977. var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
  2978. module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
  2979. setInternalState(this, {
  2980. type: ARRAY_ITERATOR,
  2981. target: toIndexedObject(iterated),
  2982. index: 0,
  2983. kind: kind
  2984. });
  2985. }, function () {
  2986. var state = getInternalState(this);
  2987. var target = state.target;
  2988. var kind = state.kind;
  2989. var index = state.index++;
  2990. if (!target || index >= target.length) {
  2991. state.target = undefined;
  2992. return createIterResultObject(undefined, true);
  2993. }
  2994. if (kind == 'keys')
  2995. return createIterResultObject(index, false);
  2996. if (kind == 'values')
  2997. return createIterResultObject(target[index], false);
  2998. return createIterResultObject([
  2999. index,
  3000. target[index]
  3001. ], false);
  3002. }, 'values');
  3003. var values = Iterators.Arguments = Iterators.Array;
  3004. addToUnscopables('keys');
  3005. addToUnscopables('values');
  3006. addToUnscopables('entries');
  3007. if (!IS_PURE && DESCRIPTORS && values.name !== 'values')
  3008. try {
  3009. defineProperty(values, 'name', { value: 'values' });
  3010. } catch (error) {
  3011. }
  3012. /***/ }),
  3013. /* 91 */
  3014. /***/ ((module) => {
  3015. module.exports = {};
  3016. /***/ }),
  3017. /* 92 */
  3018. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3019. "use strict";
  3020. var $ = __w_pdfjs_require__(7);
  3021. var call = __w_pdfjs_require__(12);
  3022. var IS_PURE = __w_pdfjs_require__(40);
  3023. var FunctionName = __w_pdfjs_require__(54);
  3024. var isCallable = __w_pdfjs_require__(25);
  3025. var createIteratorConstructor = __w_pdfjs_require__(93);
  3026. var getPrototypeOf = __w_pdfjs_require__(85);
  3027. var setPrototypeOf = __w_pdfjs_require__(87);
  3028. var setToStringTag = __w_pdfjs_require__(95);
  3029. var createNonEnumerableProperty = __w_pdfjs_require__(48);
  3030. var defineBuiltIn = __w_pdfjs_require__(52);
  3031. var wellKnownSymbol = __w_pdfjs_require__(38);
  3032. var Iterators = __w_pdfjs_require__(91);
  3033. var IteratorsCore = __w_pdfjs_require__(94);
  3034. var PROPER_FUNCTION_NAME = FunctionName.PROPER;
  3035. var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
  3036. var IteratorPrototype = IteratorsCore.IteratorPrototype;
  3037. var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
  3038. var ITERATOR = wellKnownSymbol('iterator');
  3039. var KEYS = 'keys';
  3040. var VALUES = 'values';
  3041. var ENTRIES = 'entries';
  3042. var returnThis = function () {
  3043. return this;
  3044. };
  3045. module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
  3046. createIteratorConstructor(IteratorConstructor, NAME, next);
  3047. var getIterationMethod = function (KIND) {
  3048. if (KIND === DEFAULT && defaultIterator)
  3049. return defaultIterator;
  3050. if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype)
  3051. return IterablePrototype[KIND];
  3052. switch (KIND) {
  3053. case KEYS:
  3054. return function keys() {
  3055. return new IteratorConstructor(this, KIND);
  3056. };
  3057. case VALUES:
  3058. return function values() {
  3059. return new IteratorConstructor(this, KIND);
  3060. };
  3061. case ENTRIES:
  3062. return function entries() {
  3063. return new IteratorConstructor(this, KIND);
  3064. };
  3065. }
  3066. return function () {
  3067. return new IteratorConstructor(this);
  3068. };
  3069. };
  3070. var TO_STRING_TAG = NAME + ' Iterator';
  3071. var INCORRECT_VALUES_NAME = false;
  3072. var IterablePrototype = Iterable.prototype;
  3073. var nativeIterator = IterablePrototype[ITERATOR] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT];
  3074. var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
  3075. var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
  3076. var CurrentIteratorPrototype, methods, KEY;
  3077. if (anyNativeIterator) {
  3078. CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
  3079. if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
  3080. if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
  3081. if (setPrototypeOf) {
  3082. setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
  3083. } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {
  3084. defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis);
  3085. }
  3086. }
  3087. setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
  3088. if (IS_PURE)
  3089. Iterators[TO_STRING_TAG] = returnThis;
  3090. }
  3091. }
  3092. if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
  3093. if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) {
  3094. createNonEnumerableProperty(IterablePrototype, 'name', VALUES);
  3095. } else {
  3096. INCORRECT_VALUES_NAME = true;
  3097. defaultIterator = function values() {
  3098. return call(nativeIterator, this);
  3099. };
  3100. }
  3101. }
  3102. if (DEFAULT) {
  3103. methods = {
  3104. values: getIterationMethod(VALUES),
  3105. keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
  3106. entries: getIterationMethod(ENTRIES)
  3107. };
  3108. if (FORCED)
  3109. for (KEY in methods) {
  3110. if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
  3111. defineBuiltIn(IterablePrototype, KEY, methods[KEY]);
  3112. }
  3113. }
  3114. else
  3115. $({
  3116. target: NAME,
  3117. proto: true,
  3118. forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME
  3119. }, methods);
  3120. }
  3121. if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
  3122. defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT });
  3123. }
  3124. Iterators[NAME] = defaultIterator;
  3125. return methods;
  3126. };
  3127. /***/ }),
  3128. /* 93 */
  3129. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3130. "use strict";
  3131. var IteratorPrototype = (__w_pdfjs_require__(94).IteratorPrototype);
  3132. var create = __w_pdfjs_require__(74);
  3133. var createPropertyDescriptor = __w_pdfjs_require__(15);
  3134. var setToStringTag = __w_pdfjs_require__(95);
  3135. var Iterators = __w_pdfjs_require__(91);
  3136. var returnThis = function () {
  3137. return this;
  3138. };
  3139. module.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
  3140. var TO_STRING_TAG = NAME + ' Iterator';
  3141. IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
  3142. setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
  3143. Iterators[TO_STRING_TAG] = returnThis;
  3144. return IteratorConstructor;
  3145. };
  3146. /***/ }),
  3147. /* 94 */
  3148. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3149. "use strict";
  3150. var fails = __w_pdfjs_require__(11);
  3151. var isCallable = __w_pdfjs_require__(25);
  3152. var isObject = __w_pdfjs_require__(24);
  3153. var create = __w_pdfjs_require__(74);
  3154. var getPrototypeOf = __w_pdfjs_require__(85);
  3155. var defineBuiltIn = __w_pdfjs_require__(52);
  3156. var wellKnownSymbol = __w_pdfjs_require__(38);
  3157. var IS_PURE = __w_pdfjs_require__(40);
  3158. var ITERATOR = wellKnownSymbol('iterator');
  3159. var BUGGY_SAFARI_ITERATORS = false;
  3160. var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
  3161. if ([].keys) {
  3162. arrayIterator = [].keys();
  3163. if (!('next' in arrayIterator))
  3164. BUGGY_SAFARI_ITERATORS = true;
  3165. else {
  3166. PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
  3167. if (PrototypeOfArrayIteratorPrototype !== Object.prototype)
  3168. IteratorPrototype = PrototypeOfArrayIteratorPrototype;
  3169. }
  3170. }
  3171. var NEW_ITERATOR_PROTOTYPE = !isObject(IteratorPrototype) || fails(function () {
  3172. var test = {};
  3173. return IteratorPrototype[ITERATOR].call(test) !== test;
  3174. });
  3175. if (NEW_ITERATOR_PROTOTYPE)
  3176. IteratorPrototype = {};
  3177. else if (IS_PURE)
  3178. IteratorPrototype = create(IteratorPrototype);
  3179. if (!isCallable(IteratorPrototype[ITERATOR])) {
  3180. defineBuiltIn(IteratorPrototype, ITERATOR, function () {
  3181. return this;
  3182. });
  3183. }
  3184. module.exports = {
  3185. IteratorPrototype: IteratorPrototype,
  3186. BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
  3187. };
  3188. /***/ }),
  3189. /* 95 */
  3190. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3191. var defineProperty = (__w_pdfjs_require__(49).f);
  3192. var hasOwn = __w_pdfjs_require__(43);
  3193. var wellKnownSymbol = __w_pdfjs_require__(38);
  3194. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  3195. module.exports = function (target, TAG, STATIC) {
  3196. if (target && !STATIC)
  3197. target = target.prototype;
  3198. if (target && !hasOwn(target, TO_STRING_TAG)) {
  3199. defineProperty(target, TO_STRING_TAG, {
  3200. configurable: true,
  3201. value: TAG
  3202. });
  3203. }
  3204. };
  3205. /***/ }),
  3206. /* 96 */
  3207. /***/ ((module) => {
  3208. module.exports = function (value, done) {
  3209. return {
  3210. value: value,
  3211. done: done
  3212. };
  3213. };
  3214. /***/ }),
  3215. /* 97 */
  3216. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3217. var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(84);
  3218. var defineBuiltIn = __w_pdfjs_require__(52);
  3219. var toString = __w_pdfjs_require__(98);
  3220. if (!TO_STRING_TAG_SUPPORT) {
  3221. defineBuiltIn(Object.prototype, 'toString', toString, { unsafe: true });
  3222. }
  3223. /***/ }),
  3224. /* 98 */
  3225. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3226. "use strict";
  3227. var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(84);
  3228. var classof = __w_pdfjs_require__(83);
  3229. module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
  3230. return '[object ' + classof(this) + ']';
  3231. };
  3232. /***/ }),
  3233. /* 99 */
  3234. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3235. __w_pdfjs_require__(100);
  3236. /***/ }),
  3237. /* 100 */
  3238. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3239. "use strict";
  3240. var collection = __w_pdfjs_require__(101);
  3241. var collectionStrong = __w_pdfjs_require__(119);
  3242. collection('Map', function (init) {
  3243. return function Map() {
  3244. return init(this, arguments.length ? arguments[0] : undefined);
  3245. };
  3246. }, collectionStrong);
  3247. /***/ }),
  3248. /* 101 */
  3249. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3250. "use strict";
  3251. var $ = __w_pdfjs_require__(7);
  3252. var global = __w_pdfjs_require__(8);
  3253. var uncurryThis = __w_pdfjs_require__(18);
  3254. var isForced = __w_pdfjs_require__(72);
  3255. var defineBuiltIn = __w_pdfjs_require__(52);
  3256. var InternalMetadataModule = __w_pdfjs_require__(102);
  3257. var iterate = __w_pdfjs_require__(109);
  3258. var anInstance = __w_pdfjs_require__(116);
  3259. var isCallable = __w_pdfjs_require__(25);
  3260. var isNullOrUndefined = __w_pdfjs_require__(21);
  3261. var isObject = __w_pdfjs_require__(24);
  3262. var fails = __w_pdfjs_require__(11);
  3263. var checkCorrectnessOfIteration = __w_pdfjs_require__(117);
  3264. var setToStringTag = __w_pdfjs_require__(95);
  3265. var inheritIfRequired = __w_pdfjs_require__(118);
  3266. module.exports = function (CONSTRUCTOR_NAME, wrapper, common) {
  3267. var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
  3268. var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
  3269. var ADDER = IS_MAP ? 'set' : 'add';
  3270. var NativeConstructor = global[CONSTRUCTOR_NAME];
  3271. var NativePrototype = NativeConstructor && NativeConstructor.prototype;
  3272. var Constructor = NativeConstructor;
  3273. var exported = {};
  3274. var fixMethod = function (KEY) {
  3275. var uncurriedNativeMethod = uncurryThis(NativePrototype[KEY]);
  3276. defineBuiltIn(NativePrototype, KEY, KEY == 'add' ? function add(value) {
  3277. uncurriedNativeMethod(this, value === 0 ? 0 : value);
  3278. return this;
  3279. } : KEY == 'delete' ? function (key) {
  3280. return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key);
  3281. } : KEY == 'get' ? function get(key) {
  3282. return IS_WEAK && !isObject(key) ? undefined : uncurriedNativeMethod(this, key === 0 ? 0 : key);
  3283. } : KEY == 'has' ? function has(key) {
  3284. return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key);
  3285. } : function set(key, value) {
  3286. uncurriedNativeMethod(this, key === 0 ? 0 : key, value);
  3287. return this;
  3288. });
  3289. };
  3290. var REPLACE = isForced(CONSTRUCTOR_NAME, !isCallable(NativeConstructor) || !(IS_WEAK || NativePrototype.forEach && !fails(function () {
  3291. new NativeConstructor().entries().next();
  3292. })));
  3293. if (REPLACE) {
  3294. Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
  3295. InternalMetadataModule.enable();
  3296. } else if (isForced(CONSTRUCTOR_NAME, true)) {
  3297. var instance = new Constructor();
  3298. var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
  3299. var THROWS_ON_PRIMITIVES = fails(function () {
  3300. instance.has(1);
  3301. });
  3302. var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) {
  3303. new NativeConstructor(iterable);
  3304. });
  3305. var BUGGY_ZERO = !IS_WEAK && fails(function () {
  3306. var $instance = new NativeConstructor();
  3307. var index = 5;
  3308. while (index--)
  3309. $instance[ADDER](index, index);
  3310. return !$instance.has(-0);
  3311. });
  3312. if (!ACCEPT_ITERABLES) {
  3313. Constructor = wrapper(function (dummy, iterable) {
  3314. anInstance(dummy, NativePrototype);
  3315. var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor);
  3316. if (!isNullOrUndefined(iterable))
  3317. iterate(iterable, that[ADDER], {
  3318. that: that,
  3319. AS_ENTRIES: IS_MAP
  3320. });
  3321. return that;
  3322. });
  3323. Constructor.prototype = NativePrototype;
  3324. NativePrototype.constructor = Constructor;
  3325. }
  3326. if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
  3327. fixMethod('delete');
  3328. fixMethod('has');
  3329. IS_MAP && fixMethod('get');
  3330. }
  3331. if (BUGGY_ZERO || HASNT_CHAINING)
  3332. fixMethod(ADDER);
  3333. if (IS_WEAK && NativePrototype.clear)
  3334. delete NativePrototype.clear;
  3335. }
  3336. exported[CONSTRUCTOR_NAME] = Constructor;
  3337. $({
  3338. global: true,
  3339. constructor: true,
  3340. forced: Constructor != NativeConstructor
  3341. }, exported);
  3342. setToStringTag(Constructor, CONSTRUCTOR_NAME);
  3343. if (!IS_WEAK)
  3344. common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
  3345. return Constructor;
  3346. };
  3347. /***/ }),
  3348. /* 102 */
  3349. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3350. var $ = __w_pdfjs_require__(7);
  3351. var uncurryThis = __w_pdfjs_require__(18);
  3352. var hiddenKeys = __w_pdfjs_require__(59);
  3353. var isObject = __w_pdfjs_require__(24);
  3354. var hasOwn = __w_pdfjs_require__(43);
  3355. var defineProperty = (__w_pdfjs_require__(49).f);
  3356. var getOwnPropertyNamesModule = __w_pdfjs_require__(62);
  3357. var getOwnPropertyNamesExternalModule = __w_pdfjs_require__(103);
  3358. var isExtensible = __w_pdfjs_require__(106);
  3359. var uid = __w_pdfjs_require__(45);
  3360. var FREEZING = __w_pdfjs_require__(108);
  3361. var REQUIRED = false;
  3362. var METADATA = uid('meta');
  3363. var id = 0;
  3364. var setMetadata = function (it) {
  3365. defineProperty(it, METADATA, {
  3366. value: {
  3367. objectID: 'O' + id++,
  3368. weakData: {}
  3369. }
  3370. });
  3371. };
  3372. var fastKey = function (it, create) {
  3373. if (!isObject(it))
  3374. return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  3375. if (!hasOwn(it, METADATA)) {
  3376. if (!isExtensible(it))
  3377. return 'F';
  3378. if (!create)
  3379. return 'E';
  3380. setMetadata(it);
  3381. }
  3382. return it[METADATA].objectID;
  3383. };
  3384. var getWeakData = function (it, create) {
  3385. if (!hasOwn(it, METADATA)) {
  3386. if (!isExtensible(it))
  3387. return true;
  3388. if (!create)
  3389. return false;
  3390. setMetadata(it);
  3391. }
  3392. return it[METADATA].weakData;
  3393. };
  3394. var onFreeze = function (it) {
  3395. if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA))
  3396. setMetadata(it);
  3397. return it;
  3398. };
  3399. var enable = function () {
  3400. meta.enable = function () {
  3401. };
  3402. REQUIRED = true;
  3403. var getOwnPropertyNames = getOwnPropertyNamesModule.f;
  3404. var splice = uncurryThis([].splice);
  3405. var test = {};
  3406. test[METADATA] = 1;
  3407. if (getOwnPropertyNames(test).length) {
  3408. getOwnPropertyNamesModule.f = function (it) {
  3409. var result = getOwnPropertyNames(it);
  3410. for (var i = 0, length = result.length; i < length; i++) {
  3411. if (result[i] === METADATA) {
  3412. splice(result, i, 1);
  3413. break;
  3414. }
  3415. }
  3416. return result;
  3417. };
  3418. $({
  3419. target: 'Object',
  3420. stat: true,
  3421. forced: true
  3422. }, { getOwnPropertyNames: getOwnPropertyNamesExternalModule.f });
  3423. }
  3424. };
  3425. var meta = module.exports = {
  3426. enable: enable,
  3427. fastKey: fastKey,
  3428. getWeakData: getWeakData,
  3429. onFreeze: onFreeze
  3430. };
  3431. hiddenKeys[METADATA] = true;
  3432. /***/ }),
  3433. /* 103 */
  3434. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3435. var classof = __w_pdfjs_require__(19);
  3436. var toIndexedObject = __w_pdfjs_require__(16);
  3437. var $getOwnPropertyNames = (__w_pdfjs_require__(62).f);
  3438. var arraySlice = __w_pdfjs_require__(104);
  3439. var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
  3440. var getWindowNames = function (it) {
  3441. try {
  3442. return $getOwnPropertyNames(it);
  3443. } catch (error) {
  3444. return arraySlice(windowNames);
  3445. }
  3446. };
  3447. module.exports.f = function getOwnPropertyNames(it) {
  3448. return windowNames && classof(it) == 'Window' ? getWindowNames(it) : $getOwnPropertyNames(toIndexedObject(it));
  3449. };
  3450. /***/ }),
  3451. /* 104 */
  3452. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3453. var toAbsoluteIndex = __w_pdfjs_require__(65);
  3454. var lengthOfArrayLike = __w_pdfjs_require__(68);
  3455. var createProperty = __w_pdfjs_require__(105);
  3456. var $Array = Array;
  3457. var max = Math.max;
  3458. module.exports = function (O, start, end) {
  3459. var length = lengthOfArrayLike(O);
  3460. var k = toAbsoluteIndex(start, length);
  3461. var fin = toAbsoluteIndex(end === undefined ? length : end, length);
  3462. var result = $Array(max(fin - k, 0));
  3463. for (var n = 0; k < fin; k++, n++)
  3464. createProperty(result, n, O[k]);
  3465. result.length = n;
  3466. return result;
  3467. };
  3468. /***/ }),
  3469. /* 105 */
  3470. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3471. "use strict";
  3472. var toPropertyKey = __w_pdfjs_require__(22);
  3473. var definePropertyModule = __w_pdfjs_require__(49);
  3474. var createPropertyDescriptor = __w_pdfjs_require__(15);
  3475. module.exports = function (object, key, value) {
  3476. var propertyKey = toPropertyKey(key);
  3477. if (propertyKey in object)
  3478. definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
  3479. else
  3480. object[propertyKey] = value;
  3481. };
  3482. /***/ }),
  3483. /* 106 */
  3484. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3485. var fails = __w_pdfjs_require__(11);
  3486. var isObject = __w_pdfjs_require__(24);
  3487. var classof = __w_pdfjs_require__(19);
  3488. var ARRAY_BUFFER_NON_EXTENSIBLE = __w_pdfjs_require__(107);
  3489. var $isExtensible = Object.isExtensible;
  3490. var FAILS_ON_PRIMITIVES = fails(function () {
  3491. $isExtensible(1);
  3492. });
  3493. module.exports = FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE ? function isExtensible(it) {
  3494. if (!isObject(it))
  3495. return false;
  3496. if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer')
  3497. return false;
  3498. return $isExtensible ? $isExtensible(it) : true;
  3499. } : $isExtensible;
  3500. /***/ }),
  3501. /* 107 */
  3502. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3503. var fails = __w_pdfjs_require__(11);
  3504. module.exports = fails(function () {
  3505. if (typeof ArrayBuffer == 'function') {
  3506. var buffer = new ArrayBuffer(8);
  3507. if (Object.isExtensible(buffer))
  3508. Object.defineProperty(buffer, 'a', { value: 8 });
  3509. }
  3510. });
  3511. /***/ }),
  3512. /* 108 */
  3513. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3514. var fails = __w_pdfjs_require__(11);
  3515. module.exports = !fails(function () {
  3516. return Object.isExtensible(Object.preventExtensions({}));
  3517. });
  3518. /***/ }),
  3519. /* 109 */
  3520. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3521. var bind = __w_pdfjs_require__(110);
  3522. var call = __w_pdfjs_require__(12);
  3523. var anObject = __w_pdfjs_require__(51);
  3524. var tryToString = __w_pdfjs_require__(36);
  3525. var isArrayIteratorMethod = __w_pdfjs_require__(112);
  3526. var lengthOfArrayLike = __w_pdfjs_require__(68);
  3527. var isPrototypeOf = __w_pdfjs_require__(29);
  3528. var getIterator = __w_pdfjs_require__(113);
  3529. var getIteratorMethod = __w_pdfjs_require__(114);
  3530. var iteratorClose = __w_pdfjs_require__(115);
  3531. var $TypeError = TypeError;
  3532. var Result = function (stopped, result) {
  3533. this.stopped = stopped;
  3534. this.result = result;
  3535. };
  3536. var ResultPrototype = Result.prototype;
  3537. module.exports = function (iterable, unboundFunction, options) {
  3538. var that = options && options.that;
  3539. var AS_ENTRIES = !!(options && options.AS_ENTRIES);
  3540. var IS_RECORD = !!(options && options.IS_RECORD);
  3541. var IS_ITERATOR = !!(options && options.IS_ITERATOR);
  3542. var INTERRUPTED = !!(options && options.INTERRUPTED);
  3543. var fn = bind(unboundFunction, that);
  3544. var iterator, iterFn, index, length, result, next, step;
  3545. var stop = function (condition) {
  3546. if (iterator)
  3547. iteratorClose(iterator, 'normal', condition);
  3548. return new Result(true, condition);
  3549. };
  3550. var callFn = function (value) {
  3551. if (AS_ENTRIES) {
  3552. anObject(value);
  3553. return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
  3554. }
  3555. return INTERRUPTED ? fn(value, stop) : fn(value);
  3556. };
  3557. if (IS_RECORD) {
  3558. iterator = iterable.iterator;
  3559. } else if (IS_ITERATOR) {
  3560. iterator = iterable;
  3561. } else {
  3562. iterFn = getIteratorMethod(iterable);
  3563. if (!iterFn)
  3564. throw $TypeError(tryToString(iterable) + ' is not iterable');
  3565. if (isArrayIteratorMethod(iterFn)) {
  3566. for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
  3567. result = callFn(iterable[index]);
  3568. if (result && isPrototypeOf(ResultPrototype, result))
  3569. return result;
  3570. }
  3571. return new Result(false);
  3572. }
  3573. iterator = getIterator(iterable, iterFn);
  3574. }
  3575. next = IS_RECORD ? iterable.next : iterator.next;
  3576. while (!(step = call(next, iterator)).done) {
  3577. try {
  3578. result = callFn(step.value);
  3579. } catch (error) {
  3580. iteratorClose(iterator, 'throw', error);
  3581. }
  3582. if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result))
  3583. return result;
  3584. }
  3585. return new Result(false);
  3586. };
  3587. /***/ }),
  3588. /* 110 */
  3589. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3590. var uncurryThis = __w_pdfjs_require__(111);
  3591. var aCallable = __w_pdfjs_require__(35);
  3592. var NATIVE_BIND = __w_pdfjs_require__(13);
  3593. var bind = uncurryThis(uncurryThis.bind);
  3594. module.exports = function (fn, that) {
  3595. aCallable(fn);
  3596. return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function () {
  3597. return fn.apply(that, arguments);
  3598. };
  3599. };
  3600. /***/ }),
  3601. /* 111 */
  3602. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3603. var classofRaw = __w_pdfjs_require__(19);
  3604. var uncurryThis = __w_pdfjs_require__(18);
  3605. module.exports = function (fn) {
  3606. if (classofRaw(fn) === 'Function')
  3607. return uncurryThis(fn);
  3608. };
  3609. /***/ }),
  3610. /* 112 */
  3611. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3612. var wellKnownSymbol = __w_pdfjs_require__(38);
  3613. var Iterators = __w_pdfjs_require__(91);
  3614. var ITERATOR = wellKnownSymbol('iterator');
  3615. var ArrayPrototype = Array.prototype;
  3616. module.exports = function (it) {
  3617. return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
  3618. };
  3619. /***/ }),
  3620. /* 113 */
  3621. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3622. var call = __w_pdfjs_require__(12);
  3623. var aCallable = __w_pdfjs_require__(35);
  3624. var anObject = __w_pdfjs_require__(51);
  3625. var tryToString = __w_pdfjs_require__(36);
  3626. var getIteratorMethod = __w_pdfjs_require__(114);
  3627. var $TypeError = TypeError;
  3628. module.exports = function (argument, usingIterator) {
  3629. var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
  3630. if (aCallable(iteratorMethod))
  3631. return anObject(call(iteratorMethod, argument));
  3632. throw $TypeError(tryToString(argument) + ' is not iterable');
  3633. };
  3634. /***/ }),
  3635. /* 114 */
  3636. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3637. var classof = __w_pdfjs_require__(83);
  3638. var getMethod = __w_pdfjs_require__(34);
  3639. var isNullOrUndefined = __w_pdfjs_require__(21);
  3640. var Iterators = __w_pdfjs_require__(91);
  3641. var wellKnownSymbol = __w_pdfjs_require__(38);
  3642. var ITERATOR = wellKnownSymbol('iterator');
  3643. module.exports = function (it) {
  3644. if (!isNullOrUndefined(it))
  3645. return getMethod(it, ITERATOR) || getMethod(it, '@@iterator') || Iterators[classof(it)];
  3646. };
  3647. /***/ }),
  3648. /* 115 */
  3649. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3650. var call = __w_pdfjs_require__(12);
  3651. var anObject = __w_pdfjs_require__(51);
  3652. var getMethod = __w_pdfjs_require__(34);
  3653. module.exports = function (iterator, kind, value) {
  3654. var innerResult, innerError;
  3655. anObject(iterator);
  3656. try {
  3657. innerResult = getMethod(iterator, 'return');
  3658. if (!innerResult) {
  3659. if (kind === 'throw')
  3660. throw value;
  3661. return value;
  3662. }
  3663. innerResult = call(innerResult, iterator);
  3664. } catch (error) {
  3665. innerError = true;
  3666. innerResult = error;
  3667. }
  3668. if (kind === 'throw')
  3669. throw value;
  3670. if (innerError)
  3671. throw innerResult;
  3672. anObject(innerResult);
  3673. return value;
  3674. };
  3675. /***/ }),
  3676. /* 116 */
  3677. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3678. var isPrototypeOf = __w_pdfjs_require__(29);
  3679. var $TypeError = TypeError;
  3680. module.exports = function (it, Prototype) {
  3681. if (isPrototypeOf(Prototype, it))
  3682. return it;
  3683. throw $TypeError('Incorrect invocation');
  3684. };
  3685. /***/ }),
  3686. /* 117 */
  3687. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3688. var wellKnownSymbol = __w_pdfjs_require__(38);
  3689. var ITERATOR = wellKnownSymbol('iterator');
  3690. var SAFE_CLOSING = false;
  3691. try {
  3692. var called = 0;
  3693. var iteratorWithReturn = {
  3694. next: function () {
  3695. return { done: !!called++ };
  3696. },
  3697. 'return': function () {
  3698. SAFE_CLOSING = true;
  3699. }
  3700. };
  3701. iteratorWithReturn[ITERATOR] = function () {
  3702. return this;
  3703. };
  3704. Array.from(iteratorWithReturn, function () {
  3705. throw 2;
  3706. });
  3707. } catch (error) {
  3708. }
  3709. module.exports = function (exec, SKIP_CLOSING) {
  3710. if (!SKIP_CLOSING && !SAFE_CLOSING)
  3711. return false;
  3712. var ITERATION_SUPPORT = false;
  3713. try {
  3714. var object = {};
  3715. object[ITERATOR] = function () {
  3716. return {
  3717. next: function () {
  3718. return { done: ITERATION_SUPPORT = true };
  3719. }
  3720. };
  3721. };
  3722. exec(object);
  3723. } catch (error) {
  3724. }
  3725. return ITERATION_SUPPORT;
  3726. };
  3727. /***/ }),
  3728. /* 118 */
  3729. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3730. var isCallable = __w_pdfjs_require__(25);
  3731. var isObject = __w_pdfjs_require__(24);
  3732. var setPrototypeOf = __w_pdfjs_require__(87);
  3733. module.exports = function ($this, dummy, Wrapper) {
  3734. var NewTarget, NewTargetPrototype;
  3735. if (setPrototypeOf && isCallable(NewTarget = dummy.constructor) && NewTarget !== Wrapper && isObject(NewTargetPrototype = NewTarget.prototype) && NewTargetPrototype !== Wrapper.prototype)
  3736. setPrototypeOf($this, NewTargetPrototype);
  3737. return $this;
  3738. };
  3739. /***/ }),
  3740. /* 119 */
  3741. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3742. "use strict";
  3743. var defineProperty = (__w_pdfjs_require__(49).f);
  3744. var create = __w_pdfjs_require__(74);
  3745. var defineBuiltIns = __w_pdfjs_require__(120);
  3746. var bind = __w_pdfjs_require__(110);
  3747. var anInstance = __w_pdfjs_require__(116);
  3748. var isNullOrUndefined = __w_pdfjs_require__(21);
  3749. var iterate = __w_pdfjs_require__(109);
  3750. var defineIterator = __w_pdfjs_require__(92);
  3751. var createIterResultObject = __w_pdfjs_require__(96);
  3752. var setSpecies = __w_pdfjs_require__(121);
  3753. var DESCRIPTORS = __w_pdfjs_require__(10);
  3754. var fastKey = (__w_pdfjs_require__(102).fastKey);
  3755. var InternalStateModule = __w_pdfjs_require__(56);
  3756. var setInternalState = InternalStateModule.set;
  3757. var internalStateGetterFor = InternalStateModule.getterFor;
  3758. module.exports = {
  3759. getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
  3760. var Constructor = wrapper(function (that, iterable) {
  3761. anInstance(that, Prototype);
  3762. setInternalState(that, {
  3763. type: CONSTRUCTOR_NAME,
  3764. index: create(null),
  3765. first: undefined,
  3766. last: undefined,
  3767. size: 0
  3768. });
  3769. if (!DESCRIPTORS)
  3770. that.size = 0;
  3771. if (!isNullOrUndefined(iterable))
  3772. iterate(iterable, that[ADDER], {
  3773. that: that,
  3774. AS_ENTRIES: IS_MAP
  3775. });
  3776. });
  3777. var Prototype = Constructor.prototype;
  3778. var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
  3779. var define = function (that, key, value) {
  3780. var state = getInternalState(that);
  3781. var entry = getEntry(that, key);
  3782. var previous, index;
  3783. if (entry) {
  3784. entry.value = value;
  3785. } else {
  3786. state.last = entry = {
  3787. index: index = fastKey(key, true),
  3788. key: key,
  3789. value: value,
  3790. previous: previous = state.last,
  3791. next: undefined,
  3792. removed: false
  3793. };
  3794. if (!state.first)
  3795. state.first = entry;
  3796. if (previous)
  3797. previous.next = entry;
  3798. if (DESCRIPTORS)
  3799. state.size++;
  3800. else
  3801. that.size++;
  3802. if (index !== 'F')
  3803. state.index[index] = entry;
  3804. }
  3805. return that;
  3806. };
  3807. var getEntry = function (that, key) {
  3808. var state = getInternalState(that);
  3809. var index = fastKey(key);
  3810. var entry;
  3811. if (index !== 'F')
  3812. return state.index[index];
  3813. for (entry = state.first; entry; entry = entry.next) {
  3814. if (entry.key == key)
  3815. return entry;
  3816. }
  3817. };
  3818. defineBuiltIns(Prototype, {
  3819. clear: function clear() {
  3820. var that = this;
  3821. var state = getInternalState(that);
  3822. var data = state.index;
  3823. var entry = state.first;
  3824. while (entry) {
  3825. entry.removed = true;
  3826. if (entry.previous)
  3827. entry.previous = entry.previous.next = undefined;
  3828. delete data[entry.index];
  3829. entry = entry.next;
  3830. }
  3831. state.first = state.last = undefined;
  3832. if (DESCRIPTORS)
  3833. state.size = 0;
  3834. else
  3835. that.size = 0;
  3836. },
  3837. 'delete': function (key) {
  3838. var that = this;
  3839. var state = getInternalState(that);
  3840. var entry = getEntry(that, key);
  3841. if (entry) {
  3842. var next = entry.next;
  3843. var prev = entry.previous;
  3844. delete state.index[entry.index];
  3845. entry.removed = true;
  3846. if (prev)
  3847. prev.next = next;
  3848. if (next)
  3849. next.previous = prev;
  3850. if (state.first == entry)
  3851. state.first = next;
  3852. if (state.last == entry)
  3853. state.last = prev;
  3854. if (DESCRIPTORS)
  3855. state.size--;
  3856. else
  3857. that.size--;
  3858. }
  3859. return !!entry;
  3860. },
  3861. forEach: function forEach(callbackfn) {
  3862. var state = getInternalState(this);
  3863. var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  3864. var entry;
  3865. while (entry = entry ? entry.next : state.first) {
  3866. boundFunction(entry.value, entry.key, this);
  3867. while (entry && entry.removed)
  3868. entry = entry.previous;
  3869. }
  3870. },
  3871. has: function has(key) {
  3872. return !!getEntry(this, key);
  3873. }
  3874. });
  3875. defineBuiltIns(Prototype, IS_MAP ? {
  3876. get: function get(key) {
  3877. var entry = getEntry(this, key);
  3878. return entry && entry.value;
  3879. },
  3880. set: function set(key, value) {
  3881. return define(this, key === 0 ? 0 : key, value);
  3882. }
  3883. } : {
  3884. add: function add(value) {
  3885. return define(this, value = value === 0 ? 0 : value, value);
  3886. }
  3887. });
  3888. if (DESCRIPTORS)
  3889. defineProperty(Prototype, 'size', {
  3890. get: function () {
  3891. return getInternalState(this).size;
  3892. }
  3893. });
  3894. return Constructor;
  3895. },
  3896. setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) {
  3897. var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
  3898. var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
  3899. var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
  3900. defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) {
  3901. setInternalState(this, {
  3902. type: ITERATOR_NAME,
  3903. target: iterated,
  3904. state: getInternalCollectionState(iterated),
  3905. kind: kind,
  3906. last: undefined
  3907. });
  3908. }, function () {
  3909. var state = getInternalIteratorState(this);
  3910. var kind = state.kind;
  3911. var entry = state.last;
  3912. while (entry && entry.removed)
  3913. entry = entry.previous;
  3914. if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
  3915. state.target = undefined;
  3916. return createIterResultObject(undefined, true);
  3917. }
  3918. if (kind == 'keys')
  3919. return createIterResultObject(entry.key, false);
  3920. if (kind == 'values')
  3921. return createIterResultObject(entry.value, false);
  3922. return createIterResultObject([
  3923. entry.key,
  3924. entry.value
  3925. ], false);
  3926. }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
  3927. setSpecies(CONSTRUCTOR_NAME);
  3928. }
  3929. };
  3930. /***/ }),
  3931. /* 120 */
  3932. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3933. var defineBuiltIn = __w_pdfjs_require__(52);
  3934. module.exports = function (target, src, options) {
  3935. for (var key in src)
  3936. defineBuiltIn(target, key, src[key], options);
  3937. return target;
  3938. };
  3939. /***/ }),
  3940. /* 121 */
  3941. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3942. "use strict";
  3943. var getBuiltIn = __w_pdfjs_require__(28);
  3944. var definePropertyModule = __w_pdfjs_require__(49);
  3945. var wellKnownSymbol = __w_pdfjs_require__(38);
  3946. var DESCRIPTORS = __w_pdfjs_require__(10);
  3947. var SPECIES = wellKnownSymbol('species');
  3948. module.exports = function (CONSTRUCTOR_NAME) {
  3949. var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
  3950. var defineProperty = definePropertyModule.f;
  3951. if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
  3952. defineProperty(Constructor, SPECIES, {
  3953. configurable: true,
  3954. get: function () {
  3955. return this;
  3956. }
  3957. });
  3958. }
  3959. };
  3960. /***/ }),
  3961. /* 122 */
  3962. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3963. __w_pdfjs_require__(123);
  3964. /***/ }),
  3965. /* 123 */
  3966. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3967. "use strict";
  3968. var collection = __w_pdfjs_require__(101);
  3969. var collectionStrong = __w_pdfjs_require__(119);
  3970. collection('Set', function (init) {
  3971. return function Set() {
  3972. return init(this, arguments.length ? arguments[0] : undefined);
  3973. };
  3974. }, collectionStrong);
  3975. /***/ }),
  3976. /* 124 */
  3977. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3978. var IS_PURE = __w_pdfjs_require__(40);
  3979. var $ = __w_pdfjs_require__(7);
  3980. var global = __w_pdfjs_require__(8);
  3981. var getBuiltin = __w_pdfjs_require__(28);
  3982. var uncurryThis = __w_pdfjs_require__(18);
  3983. var fails = __w_pdfjs_require__(11);
  3984. var uid = __w_pdfjs_require__(45);
  3985. var isCallable = __w_pdfjs_require__(25);
  3986. var isConstructor = __w_pdfjs_require__(125);
  3987. var isNullOrUndefined = __w_pdfjs_require__(21);
  3988. var isObject = __w_pdfjs_require__(24);
  3989. var isSymbol = __w_pdfjs_require__(27);
  3990. var iterate = __w_pdfjs_require__(109);
  3991. var anObject = __w_pdfjs_require__(51);
  3992. var classof = __w_pdfjs_require__(83);
  3993. var hasOwn = __w_pdfjs_require__(43);
  3994. var createProperty = __w_pdfjs_require__(105);
  3995. var createNonEnumerableProperty = __w_pdfjs_require__(48);
  3996. var lengthOfArrayLike = __w_pdfjs_require__(68);
  3997. var validateArgumentsLength = __w_pdfjs_require__(126);
  3998. var getRegExpFlags = __w_pdfjs_require__(127);
  3999. var MapHelpers = __w_pdfjs_require__(129);
  4000. var SetHelpers = __w_pdfjs_require__(130);
  4001. var ERROR_STACK_INSTALLABLE = __w_pdfjs_require__(131);
  4002. var V8 = __w_pdfjs_require__(32);
  4003. var IS_BROWSER = __w_pdfjs_require__(132);
  4004. var IS_DENO = __w_pdfjs_require__(133);
  4005. var IS_NODE = __w_pdfjs_require__(134);
  4006. var Object = global.Object;
  4007. var Array = global.Array;
  4008. var Date = global.Date;
  4009. var Error = global.Error;
  4010. var EvalError = global.EvalError;
  4011. var RangeError = global.RangeError;
  4012. var ReferenceError = global.ReferenceError;
  4013. var SyntaxError = global.SyntaxError;
  4014. var TypeError = global.TypeError;
  4015. var URIError = global.URIError;
  4016. var PerformanceMark = global.PerformanceMark;
  4017. var WebAssembly = global.WebAssembly;
  4018. var CompileError = WebAssembly && WebAssembly.CompileError || Error;
  4019. var LinkError = WebAssembly && WebAssembly.LinkError || Error;
  4020. var RuntimeError = WebAssembly && WebAssembly.RuntimeError || Error;
  4021. var DOMException = getBuiltin('DOMException');
  4022. var Map = MapHelpers.Map;
  4023. var mapHas = MapHelpers.has;
  4024. var mapGet = MapHelpers.get;
  4025. var mapSet = MapHelpers.set;
  4026. var Set = SetHelpers.Set;
  4027. var setAdd = SetHelpers.add;
  4028. var objectKeys = getBuiltin('Object', 'keys');
  4029. var push = uncurryThis([].push);
  4030. var thisBooleanValue = uncurryThis(true.valueOf);
  4031. var thisNumberValue = uncurryThis(1.0.valueOf);
  4032. var thisStringValue = uncurryThis(''.valueOf);
  4033. var thisTimeValue = uncurryThis(Date.prototype.getTime);
  4034. var PERFORMANCE_MARK = uid('structuredClone');
  4035. var DATA_CLONE_ERROR = 'DataCloneError';
  4036. var TRANSFERRING = 'Transferring';
  4037. var checkBasicSemantic = function (structuredCloneImplementation) {
  4038. return !fails(function () {
  4039. var set1 = new global.Set([7]);
  4040. var set2 = structuredCloneImplementation(set1);
  4041. var number = structuredCloneImplementation(Object(7));
  4042. return set2 == set1 || !set2.has(7) || typeof number != 'object' || number != 7;
  4043. }) && structuredCloneImplementation;
  4044. };
  4045. var checkErrorsCloning = function (structuredCloneImplementation, $Error) {
  4046. return !fails(function () {
  4047. var error = new $Error();
  4048. var test = structuredCloneImplementation({
  4049. a: error,
  4050. b: error
  4051. });
  4052. return !(test && test.a === test.b && test.a instanceof $Error && test.a.stack === error.stack);
  4053. });
  4054. };
  4055. var checkNewErrorsCloningSemantic = function (structuredCloneImplementation) {
  4056. return !fails(function () {
  4057. var test = structuredCloneImplementation(new global.AggregateError([1], PERFORMANCE_MARK, { cause: 3 }));
  4058. return test.name != 'AggregateError' || test.errors[0] != 1 || test.message != PERFORMANCE_MARK || test.cause != 3;
  4059. });
  4060. };
  4061. var nativeStructuredClone = global.structuredClone;
  4062. var FORCED_REPLACEMENT = IS_PURE || !checkErrorsCloning(nativeStructuredClone, Error) || !checkErrorsCloning(nativeStructuredClone, DOMException) || !checkNewErrorsCloningSemantic(nativeStructuredClone);
  4063. var structuredCloneFromMark = !nativeStructuredClone && checkBasicSemantic(function (value) {
  4064. return new PerformanceMark(PERFORMANCE_MARK, { detail: value }).detail;
  4065. });
  4066. var nativeRestrictedStructuredClone = checkBasicSemantic(nativeStructuredClone) || structuredCloneFromMark;
  4067. var throwUncloneable = function (type) {
  4068. throw new DOMException('Uncloneable type: ' + type, DATA_CLONE_ERROR);
  4069. };
  4070. var throwUnpolyfillable = function (type, action) {
  4071. throw new DOMException((action || 'Cloning') + ' of ' + type + ' cannot be properly polyfilled in this engine', DATA_CLONE_ERROR);
  4072. };
  4073. var createDataTransfer = function () {
  4074. var dataTransfer;
  4075. try {
  4076. dataTransfer = new global.DataTransfer();
  4077. } catch (error) {
  4078. try {
  4079. dataTransfer = new global.ClipboardEvent('').clipboardData;
  4080. } catch (error2) {
  4081. }
  4082. }
  4083. return dataTransfer && dataTransfer.items && dataTransfer.files ? dataTransfer : null;
  4084. };
  4085. var structuredCloneInternal = function (value, map) {
  4086. if (isSymbol(value))
  4087. throwUncloneable('Symbol');
  4088. if (!isObject(value))
  4089. return value;
  4090. if (map) {
  4091. if (mapHas(map, value))
  4092. return mapGet(map, value);
  4093. } else
  4094. map = new Map();
  4095. var type = classof(value);
  4096. var deep = false;
  4097. var C, name, cloned, dataTransfer, i, length, keys, key, source, target;
  4098. switch (type) {
  4099. case 'Array':
  4100. cloned = Array(lengthOfArrayLike(value));
  4101. deep = true;
  4102. break;
  4103. case 'Object':
  4104. cloned = {};
  4105. deep = true;
  4106. break;
  4107. case 'Map':
  4108. cloned = new Map();
  4109. deep = true;
  4110. break;
  4111. case 'Set':
  4112. cloned = new Set();
  4113. deep = true;
  4114. break;
  4115. case 'RegExp':
  4116. cloned = new RegExp(value.source, getRegExpFlags(value));
  4117. break;
  4118. case 'Error':
  4119. name = value.name;
  4120. switch (name) {
  4121. case 'AggregateError':
  4122. cloned = getBuiltin('AggregateError')([]);
  4123. break;
  4124. case 'EvalError':
  4125. cloned = EvalError();
  4126. break;
  4127. case 'RangeError':
  4128. cloned = RangeError();
  4129. break;
  4130. case 'ReferenceError':
  4131. cloned = ReferenceError();
  4132. break;
  4133. case 'SyntaxError':
  4134. cloned = SyntaxError();
  4135. break;
  4136. case 'TypeError':
  4137. cloned = TypeError();
  4138. break;
  4139. case 'URIError':
  4140. cloned = URIError();
  4141. break;
  4142. case 'CompileError':
  4143. cloned = CompileError();
  4144. break;
  4145. case 'LinkError':
  4146. cloned = LinkError();
  4147. break;
  4148. case 'RuntimeError':
  4149. cloned = RuntimeError();
  4150. break;
  4151. default:
  4152. cloned = Error();
  4153. }
  4154. deep = true;
  4155. break;
  4156. case 'DOMException':
  4157. cloned = new DOMException(value.message, value.name);
  4158. deep = true;
  4159. break;
  4160. case 'DataView':
  4161. case 'Int8Array':
  4162. case 'Uint8Array':
  4163. case 'Uint8ClampedArray':
  4164. case 'Int16Array':
  4165. case 'Uint16Array':
  4166. case 'Int32Array':
  4167. case 'Uint32Array':
  4168. case 'Float32Array':
  4169. case 'Float64Array':
  4170. case 'BigInt64Array':
  4171. case 'BigUint64Array':
  4172. C = global[type];
  4173. if (!isObject(C))
  4174. throwUnpolyfillable(type);
  4175. cloned = new C(structuredCloneInternal(value.buffer, map), value.byteOffset, type === 'DataView' ? value.byteLength : value.length);
  4176. break;
  4177. case 'DOMQuad':
  4178. try {
  4179. cloned = new DOMQuad(structuredCloneInternal(value.p1, map), structuredCloneInternal(value.p2, map), structuredCloneInternal(value.p3, map), structuredCloneInternal(value.p4, map));
  4180. } catch (error) {
  4181. if (nativeRestrictedStructuredClone) {
  4182. cloned = nativeRestrictedStructuredClone(value);
  4183. } else
  4184. throwUnpolyfillable(type);
  4185. }
  4186. break;
  4187. case 'FileList':
  4188. dataTransfer = createDataTransfer();
  4189. if (dataTransfer) {
  4190. for (i = 0, length = lengthOfArrayLike(value); i < length; i++) {
  4191. dataTransfer.items.add(structuredCloneInternal(value[i], map));
  4192. }
  4193. cloned = dataTransfer.files;
  4194. } else if (nativeRestrictedStructuredClone) {
  4195. cloned = nativeRestrictedStructuredClone(value);
  4196. } else
  4197. throwUnpolyfillable(type);
  4198. break;
  4199. case 'ImageData':
  4200. try {
  4201. cloned = new ImageData(structuredCloneInternal(value.data, map), value.width, value.height, { colorSpace: value.colorSpace });
  4202. } catch (error) {
  4203. if (nativeRestrictedStructuredClone) {
  4204. cloned = nativeRestrictedStructuredClone(value);
  4205. } else
  4206. throwUnpolyfillable(type);
  4207. }
  4208. break;
  4209. default:
  4210. if (nativeRestrictedStructuredClone) {
  4211. cloned = nativeRestrictedStructuredClone(value);
  4212. } else
  4213. switch (type) {
  4214. case 'BigInt':
  4215. cloned = Object(value.valueOf());
  4216. break;
  4217. case 'Boolean':
  4218. cloned = Object(thisBooleanValue(value));
  4219. break;
  4220. case 'Number':
  4221. cloned = Object(thisNumberValue(value));
  4222. break;
  4223. case 'String':
  4224. cloned = Object(thisStringValue(value));
  4225. break;
  4226. case 'Date':
  4227. cloned = new Date(thisTimeValue(value));
  4228. break;
  4229. case 'ArrayBuffer':
  4230. C = global.DataView;
  4231. if (!C && typeof value.slice != 'function')
  4232. throwUnpolyfillable(type);
  4233. try {
  4234. if (typeof value.slice == 'function') {
  4235. cloned = value.slice(0);
  4236. } else {
  4237. length = value.byteLength;
  4238. cloned = new ArrayBuffer(length);
  4239. source = new C(value);
  4240. target = new C(cloned);
  4241. for (i = 0; i < length; i++) {
  4242. target.setUint8(i, source.getUint8(i));
  4243. }
  4244. }
  4245. } catch (error) {
  4246. throw new DOMException('ArrayBuffer is detached', DATA_CLONE_ERROR);
  4247. }
  4248. break;
  4249. case 'SharedArrayBuffer':
  4250. cloned = value;
  4251. break;
  4252. case 'Blob':
  4253. try {
  4254. cloned = value.slice(0, value.size, value.type);
  4255. } catch (error) {
  4256. throwUnpolyfillable(type);
  4257. }
  4258. break;
  4259. case 'DOMPoint':
  4260. case 'DOMPointReadOnly':
  4261. C = global[type];
  4262. try {
  4263. cloned = C.fromPoint ? C.fromPoint(value) : new C(value.x, value.y, value.z, value.w);
  4264. } catch (error) {
  4265. throwUnpolyfillable(type);
  4266. }
  4267. break;
  4268. case 'DOMRect':
  4269. case 'DOMRectReadOnly':
  4270. C = global[type];
  4271. try {
  4272. cloned = C.fromRect ? C.fromRect(value) : new C(value.x, value.y, value.width, value.height);
  4273. } catch (error) {
  4274. throwUnpolyfillable(type);
  4275. }
  4276. break;
  4277. case 'DOMMatrix':
  4278. case 'DOMMatrixReadOnly':
  4279. C = global[type];
  4280. try {
  4281. cloned = C.fromMatrix ? C.fromMatrix(value) : new C(value);
  4282. } catch (error) {
  4283. throwUnpolyfillable(type);
  4284. }
  4285. break;
  4286. case 'AudioData':
  4287. case 'VideoFrame':
  4288. if (!isCallable(value.clone))
  4289. throwUnpolyfillable(type);
  4290. try {
  4291. cloned = value.clone();
  4292. } catch (error) {
  4293. throwUncloneable(type);
  4294. }
  4295. break;
  4296. case 'File':
  4297. try {
  4298. cloned = new File([value], value.name, value);
  4299. } catch (error) {
  4300. throwUnpolyfillable(type);
  4301. }
  4302. break;
  4303. case 'CropTarget':
  4304. case 'CryptoKey':
  4305. case 'FileSystemDirectoryHandle':
  4306. case 'FileSystemFileHandle':
  4307. case 'FileSystemHandle':
  4308. case 'GPUCompilationInfo':
  4309. case 'GPUCompilationMessage':
  4310. case 'ImageBitmap':
  4311. case 'RTCCertificate':
  4312. case 'WebAssembly.Module':
  4313. throwUnpolyfillable(type);
  4314. default:
  4315. throwUncloneable(type);
  4316. }
  4317. }
  4318. mapSet(map, value, cloned);
  4319. if (deep)
  4320. switch (type) {
  4321. case 'Array':
  4322. case 'Object':
  4323. keys = objectKeys(value);
  4324. for (i = 0, length = lengthOfArrayLike(keys); i < length; i++) {
  4325. key = keys[i];
  4326. createProperty(cloned, key, structuredCloneInternal(value[key], map));
  4327. }
  4328. break;
  4329. case 'Map':
  4330. value.forEach(function (v, k) {
  4331. mapSet(cloned, structuredCloneInternal(k, map), structuredCloneInternal(v, map));
  4332. });
  4333. break;
  4334. case 'Set':
  4335. value.forEach(function (v) {
  4336. setAdd(cloned, structuredCloneInternal(v, map));
  4337. });
  4338. break;
  4339. case 'Error':
  4340. createNonEnumerableProperty(cloned, 'message', structuredCloneInternal(value.message, map));
  4341. if (hasOwn(value, 'cause')) {
  4342. createNonEnumerableProperty(cloned, 'cause', structuredCloneInternal(value.cause, map));
  4343. }
  4344. if (name == 'AggregateError') {
  4345. cloned.errors = structuredCloneInternal(value.errors, map);
  4346. }
  4347. case 'DOMException':
  4348. if (ERROR_STACK_INSTALLABLE) {
  4349. createNonEnumerableProperty(cloned, 'stack', structuredCloneInternal(value.stack, map));
  4350. }
  4351. }
  4352. return cloned;
  4353. };
  4354. var PROPER_TRANSFER = nativeStructuredClone && !fails(function () {
  4355. if (IS_DENO && V8 > 92 || IS_NODE && V8 > 94 || IS_BROWSER && V8 > 97)
  4356. return false;
  4357. var buffer = new ArrayBuffer(8);
  4358. var clone = nativeStructuredClone(buffer, { transfer: [buffer] });
  4359. return buffer.byteLength != 0 || clone.byteLength != 8;
  4360. });
  4361. var tryToTransfer = function (rawTransfer, map) {
  4362. if (!isObject(rawTransfer))
  4363. throw TypeError('Transfer option cannot be converted to a sequence');
  4364. var transfer = [];
  4365. iterate(rawTransfer, function (value) {
  4366. push(transfer, anObject(value));
  4367. });
  4368. var i = 0;
  4369. var length = lengthOfArrayLike(transfer);
  4370. var value, type, C, transferredArray, transferred, canvas, context;
  4371. if (PROPER_TRANSFER) {
  4372. transferredArray = nativeStructuredClone(transfer, { transfer: transfer });
  4373. while (i < length)
  4374. mapSet(map, transfer[i], transferredArray[i++]);
  4375. } else
  4376. while (i < length) {
  4377. value = transfer[i++];
  4378. if (mapHas(map, value))
  4379. throw new DOMException('Duplicate transferable', DATA_CLONE_ERROR);
  4380. type = classof(value);
  4381. switch (type) {
  4382. case 'ImageBitmap':
  4383. C = global.OffscreenCanvas;
  4384. if (!isConstructor(C))
  4385. throwUnpolyfillable(type, TRANSFERRING);
  4386. try {
  4387. canvas = new C(value.width, value.height);
  4388. context = canvas.getContext('bitmaprenderer');
  4389. context.transferFromImageBitmap(value);
  4390. transferred = canvas.transferToImageBitmap();
  4391. } catch (error) {
  4392. }
  4393. break;
  4394. case 'AudioData':
  4395. case 'VideoFrame':
  4396. if (!isCallable(value.clone) || !isCallable(value.close))
  4397. throwUnpolyfillable(type, TRANSFERRING);
  4398. try {
  4399. transferred = value.clone();
  4400. value.close();
  4401. } catch (error) {
  4402. }
  4403. break;
  4404. case 'ArrayBuffer':
  4405. case 'MediaSourceHandle':
  4406. case 'MessagePort':
  4407. case 'OffscreenCanvas':
  4408. case 'ReadableStream':
  4409. case 'TransformStream':
  4410. case 'WritableStream':
  4411. throwUnpolyfillable(type, TRANSFERRING);
  4412. }
  4413. if (transferred === undefined)
  4414. throw new DOMException('This object cannot be transferred: ' + type, DATA_CLONE_ERROR);
  4415. mapSet(map, value, transferred);
  4416. }
  4417. };
  4418. $({
  4419. global: true,
  4420. enumerable: true,
  4421. sham: !PROPER_TRANSFER,
  4422. forced: FORCED_REPLACEMENT
  4423. }, {
  4424. structuredClone: function structuredClone(value) {
  4425. var options = validateArgumentsLength(arguments.length, 1) > 1 && !isNullOrUndefined(arguments[1]) ? anObject(arguments[1]) : undefined;
  4426. var transfer = options ? options.transfer : undefined;
  4427. var map;
  4428. if (transfer !== undefined) {
  4429. map = new Map();
  4430. tryToTransfer(transfer, map);
  4431. }
  4432. return structuredCloneInternal(value, map);
  4433. }
  4434. });
  4435. /***/ }),
  4436. /* 125 */
  4437. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4438. var uncurryThis = __w_pdfjs_require__(18);
  4439. var fails = __w_pdfjs_require__(11);
  4440. var isCallable = __w_pdfjs_require__(25);
  4441. var classof = __w_pdfjs_require__(83);
  4442. var getBuiltIn = __w_pdfjs_require__(28);
  4443. var inspectSource = __w_pdfjs_require__(55);
  4444. var noop = function () {
  4445. };
  4446. var empty = [];
  4447. var construct = getBuiltIn('Reflect', 'construct');
  4448. var constructorRegExp = /^\s*(?:class|function)\b/;
  4449. var exec = uncurryThis(constructorRegExp.exec);
  4450. var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
  4451. var isConstructorModern = function isConstructor(argument) {
  4452. if (!isCallable(argument))
  4453. return false;
  4454. try {
  4455. construct(noop, empty, argument);
  4456. return true;
  4457. } catch (error) {
  4458. return false;
  4459. }
  4460. };
  4461. var isConstructorLegacy = function isConstructor(argument) {
  4462. if (!isCallable(argument))
  4463. return false;
  4464. switch (classof(argument)) {
  4465. case 'AsyncFunction':
  4466. case 'GeneratorFunction':
  4467. case 'AsyncGeneratorFunction':
  4468. return false;
  4469. }
  4470. try {
  4471. return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
  4472. } catch (error) {
  4473. return true;
  4474. }
  4475. };
  4476. isConstructorLegacy.sham = true;
  4477. module.exports = !construct || fails(function () {
  4478. var called;
  4479. return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function () {
  4480. called = true;
  4481. }) || called;
  4482. }) ? isConstructorLegacy : isConstructorModern;
  4483. /***/ }),
  4484. /* 126 */
  4485. /***/ ((module) => {
  4486. var $TypeError = TypeError;
  4487. module.exports = function (passed, required) {
  4488. if (passed < required)
  4489. throw $TypeError('Not enough arguments');
  4490. return passed;
  4491. };
  4492. /***/ }),
  4493. /* 127 */
  4494. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4495. var call = __w_pdfjs_require__(12);
  4496. var hasOwn = __w_pdfjs_require__(43);
  4497. var isPrototypeOf = __w_pdfjs_require__(29);
  4498. var regExpFlags = __w_pdfjs_require__(128);
  4499. var RegExpPrototype = RegExp.prototype;
  4500. module.exports = function (R) {
  4501. var flags = R.flags;
  4502. return flags === undefined && !('flags' in RegExpPrototype) && !hasOwn(R, 'flags') && isPrototypeOf(RegExpPrototype, R) ? call(regExpFlags, R) : flags;
  4503. };
  4504. /***/ }),
  4505. /* 128 */
  4506. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4507. "use strict";
  4508. var anObject = __w_pdfjs_require__(51);
  4509. module.exports = function () {
  4510. var that = anObject(this);
  4511. var result = '';
  4512. if (that.hasIndices)
  4513. result += 'd';
  4514. if (that.global)
  4515. result += 'g';
  4516. if (that.ignoreCase)
  4517. result += 'i';
  4518. if (that.multiline)
  4519. result += 'm';
  4520. if (that.dotAll)
  4521. result += 's';
  4522. if (that.unicode)
  4523. result += 'u';
  4524. if (that.unicodeSets)
  4525. result += 'v';
  4526. if (that.sticky)
  4527. result += 'y';
  4528. return result;
  4529. };
  4530. /***/ }),
  4531. /* 129 */
  4532. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4533. var uncurryThis = __w_pdfjs_require__(18);
  4534. var MapPrototype = Map.prototype;
  4535. module.exports = {
  4536. Map: Map,
  4537. set: uncurryThis(MapPrototype.set),
  4538. get: uncurryThis(MapPrototype.get),
  4539. has: uncurryThis(MapPrototype.has),
  4540. remove: uncurryThis(MapPrototype['delete']),
  4541. proto: MapPrototype
  4542. };
  4543. /***/ }),
  4544. /* 130 */
  4545. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4546. var uncurryThis = __w_pdfjs_require__(18);
  4547. var SetPrototype = Set.prototype;
  4548. module.exports = {
  4549. Set: Set,
  4550. add: uncurryThis(SetPrototype.add),
  4551. has: uncurryThis(SetPrototype.has),
  4552. remove: uncurryThis(SetPrototype['delete']),
  4553. proto: SetPrototype,
  4554. $has: SetPrototype.has,
  4555. $keys: SetPrototype.keys
  4556. };
  4557. /***/ }),
  4558. /* 131 */
  4559. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4560. var fails = __w_pdfjs_require__(11);
  4561. var createPropertyDescriptor = __w_pdfjs_require__(15);
  4562. module.exports = !fails(function () {
  4563. var error = Error('a');
  4564. if (!('stack' in error))
  4565. return true;
  4566. Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));
  4567. return error.stack !== 7;
  4568. });
  4569. /***/ }),
  4570. /* 132 */
  4571. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4572. var IS_DENO = __w_pdfjs_require__(133);
  4573. var IS_NODE = __w_pdfjs_require__(134);
  4574. module.exports = !IS_DENO && !IS_NODE && typeof window == 'object' && typeof document == 'object';
  4575. /***/ }),
  4576. /* 133 */
  4577. /***/ ((module) => {
  4578. module.exports = typeof Deno == 'object' && Deno && typeof Deno.version == 'object';
  4579. /***/ }),
  4580. /* 134 */
  4581. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4582. var classof = __w_pdfjs_require__(19);
  4583. module.exports = typeof process != 'undefined' && classof(process) == 'process';
  4584. /***/ }),
  4585. /* 135 */
  4586. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4587. var global = __w_pdfjs_require__(8);
  4588. module.exports = global;
  4589. /***/ }),
  4590. /* 136 */
  4591. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4592. "use strict";
  4593. Object.defineProperty(exports, "__esModule", ({
  4594. value: true
  4595. }));
  4596. exports.XRefParseException = exports.XRefEntryException = exports.ParserEOFException = exports.PDF_VERSION_REGEXP = exports.MissingDataException = void 0;
  4597. exports.arrayBuffersToBytes = arrayBuffersToBytes;
  4598. exports.collectActions = collectActions;
  4599. exports.encodeToXmlString = encodeToXmlString;
  4600. exports.escapePDFName = escapePDFName;
  4601. exports.escapeString = escapeString;
  4602. exports.getArrayLookupTableFactory = getArrayLookupTableFactory;
  4603. exports.getInheritableProperty = getInheritableProperty;
  4604. exports.getLookupTableFactory = getLookupTableFactory;
  4605. exports.getNewAnnotationsMap = getNewAnnotationsMap;
  4606. exports.getRotationMatrix = getRotationMatrix;
  4607. exports.isAscii = isAscii;
  4608. exports.isWhiteSpace = isWhiteSpace;
  4609. exports.log2 = log2;
  4610. exports.numberToString = numberToString;
  4611. exports.parseXFAPath = parseXFAPath;
  4612. exports.readInt8 = readInt8;
  4613. exports.readUint16 = readUint16;
  4614. exports.readUint32 = readUint32;
  4615. exports.recoverJsURL = recoverJsURL;
  4616. exports.stringToUTF16HexString = stringToUTF16HexString;
  4617. exports.stringToUTF16String = stringToUTF16String;
  4618. exports.toRomanNumerals = toRomanNumerals;
  4619. exports.validateCSSFont = validateCSSFont;
  4620. var _util = __w_pdfjs_require__(2);
  4621. var _primitives = __w_pdfjs_require__(137);
  4622. var _base_stream = __w_pdfjs_require__(138);
  4623. const PDF_VERSION_REGEXP = /^[1-9]\.\d$/;
  4624. exports.PDF_VERSION_REGEXP = PDF_VERSION_REGEXP;
  4625. function getLookupTableFactory(initializer) {
  4626. let lookup;
  4627. return function () {
  4628. if (initializer) {
  4629. lookup = Object.create(null);
  4630. initializer(lookup);
  4631. initializer = null;
  4632. }
  4633. return lookup;
  4634. };
  4635. }
  4636. function getArrayLookupTableFactory(initializer) {
  4637. let lookup;
  4638. return function () {
  4639. if (initializer) {
  4640. let arr = initializer();
  4641. initializer = null;
  4642. lookup = Object.create(null);
  4643. for (let i = 0, ii = arr.length; i < ii; i += 2) {
  4644. lookup[arr[i]] = arr[i + 1];
  4645. }
  4646. arr = null;
  4647. }
  4648. return lookup;
  4649. };
  4650. }
  4651. class MissingDataException extends _util.BaseException {
  4652. constructor(begin, end) {
  4653. super(`Missing data [${begin}, ${end})`, "MissingDataException");
  4654. this.begin = begin;
  4655. this.end = end;
  4656. }
  4657. }
  4658. exports.MissingDataException = MissingDataException;
  4659. class ParserEOFException extends _util.BaseException {
  4660. constructor(msg) {
  4661. super(msg, "ParserEOFException");
  4662. }
  4663. }
  4664. exports.ParserEOFException = ParserEOFException;
  4665. class XRefEntryException extends _util.BaseException {
  4666. constructor(msg) {
  4667. super(msg, "XRefEntryException");
  4668. }
  4669. }
  4670. exports.XRefEntryException = XRefEntryException;
  4671. class XRefParseException extends _util.BaseException {
  4672. constructor(msg) {
  4673. super(msg, "XRefParseException");
  4674. }
  4675. }
  4676. exports.XRefParseException = XRefParseException;
  4677. function arrayBuffersToBytes(arr) {
  4678. const length = arr.length;
  4679. if (length === 0) {
  4680. return new Uint8Array(0);
  4681. }
  4682. if (length === 1) {
  4683. return new Uint8Array(arr[0]);
  4684. }
  4685. let dataLength = 0;
  4686. for (let i = 0; i < length; i++) {
  4687. dataLength += arr[i].byteLength;
  4688. }
  4689. const data = new Uint8Array(dataLength);
  4690. let pos = 0;
  4691. for (let i = 0; i < length; i++) {
  4692. const item = new Uint8Array(arr[i]);
  4693. data.set(item, pos);
  4694. pos += item.byteLength;
  4695. }
  4696. return data;
  4697. }
  4698. function getInheritableProperty(_ref) {
  4699. let {
  4700. dict,
  4701. key,
  4702. getArray = false,
  4703. stopWhenFound = true
  4704. } = _ref;
  4705. let values;
  4706. const visited = new _primitives.RefSet();
  4707. while (dict instanceof _primitives.Dict && !(dict.objId && visited.has(dict.objId))) {
  4708. if (dict.objId) {
  4709. visited.put(dict.objId);
  4710. }
  4711. const value = getArray ? dict.getArray(key) : dict.get(key);
  4712. if (value !== undefined) {
  4713. if (stopWhenFound) {
  4714. return value;
  4715. }
  4716. if (!values) {
  4717. values = [];
  4718. }
  4719. values.push(value);
  4720. }
  4721. dict = dict.get("Parent");
  4722. }
  4723. return values;
  4724. }
  4725. 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"];
  4726. function toRomanNumerals(number) {
  4727. let lowerCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  4728. (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
  4729. const romanBuf = [];
  4730. let pos;
  4731. while (number >= 1000) {
  4732. number -= 1000;
  4733. romanBuf.push("M");
  4734. }
  4735. pos = number / 100 | 0;
  4736. number %= 100;
  4737. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  4738. pos = number / 10 | 0;
  4739. number %= 10;
  4740. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  4741. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  4742. const romanStr = romanBuf.join("");
  4743. return lowerCase ? romanStr.toLowerCase() : romanStr;
  4744. }
  4745. function log2(x) {
  4746. if (x <= 0) {
  4747. return 0;
  4748. }
  4749. return Math.ceil(Math.log2(x));
  4750. }
  4751. function readInt8(data, offset) {
  4752. return data[offset] << 24 >> 24;
  4753. }
  4754. function readUint16(data, offset) {
  4755. return data[offset] << 8 | data[offset + 1];
  4756. }
  4757. function readUint32(data, offset) {
  4758. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  4759. }
  4760. function isWhiteSpace(ch) {
  4761. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  4762. }
  4763. function parseXFAPath(path) {
  4764. const positionPattern = /(.+)\[(\d+)\]$/;
  4765. return path.split(".").map(component => {
  4766. const m = component.match(positionPattern);
  4767. if (m) {
  4768. return {
  4769. name: m[1],
  4770. pos: parseInt(m[2], 10)
  4771. };
  4772. }
  4773. return {
  4774. name: component,
  4775. pos: 0
  4776. };
  4777. });
  4778. }
  4779. function escapePDFName(str) {
  4780. const buffer = [];
  4781. let start = 0;
  4782. for (let i = 0, ii = str.length; i < ii; i++) {
  4783. const char = str.charCodeAt(i);
  4784. 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) {
  4785. if (start < i) {
  4786. buffer.push(str.substring(start, i));
  4787. }
  4788. buffer.push(`#${char.toString(16)}`);
  4789. start = i + 1;
  4790. }
  4791. }
  4792. if (buffer.length === 0) {
  4793. return str;
  4794. }
  4795. if (start < str.length) {
  4796. buffer.push(str.substring(start, str.length));
  4797. }
  4798. return buffer.join("");
  4799. }
  4800. function escapeString(str) {
  4801. return str.replace(/([()\\\n\r])/g, match => {
  4802. if (match === "\n") {
  4803. return "\\n";
  4804. } else if (match === "\r") {
  4805. return "\\r";
  4806. }
  4807. return `\\${match}`;
  4808. });
  4809. }
  4810. function _collectJS(entry, xref, list, parents) {
  4811. if (!entry) {
  4812. return;
  4813. }
  4814. let parent = null;
  4815. if (entry instanceof _primitives.Ref) {
  4816. if (parents.has(entry)) {
  4817. return;
  4818. }
  4819. parent = entry;
  4820. parents.put(parent);
  4821. entry = xref.fetch(entry);
  4822. }
  4823. if (Array.isArray(entry)) {
  4824. for (const element of entry) {
  4825. _collectJS(element, xref, list, parents);
  4826. }
  4827. } else if (entry instanceof _primitives.Dict) {
  4828. if ((0, _primitives.isName)(entry.get("S"), "JavaScript")) {
  4829. const js = entry.get("JS");
  4830. let code;
  4831. if (js instanceof _base_stream.BaseStream) {
  4832. code = js.getString();
  4833. } else if (typeof js === "string") {
  4834. code = js;
  4835. }
  4836. code = code && (0, _util.stringToPDFString)(code).replace(/\u0000/g, "");
  4837. if (code) {
  4838. list.push(code);
  4839. }
  4840. }
  4841. _collectJS(entry.getRaw("Next"), xref, list, parents);
  4842. }
  4843. if (parent) {
  4844. parents.remove(parent);
  4845. }
  4846. }
  4847. function collectActions(xref, dict, eventType) {
  4848. const actions = Object.create(null);
  4849. const additionalActionsDicts = getInheritableProperty({
  4850. dict,
  4851. key: "AA",
  4852. stopWhenFound: false
  4853. });
  4854. if (additionalActionsDicts) {
  4855. for (let i = additionalActionsDicts.length - 1; i >= 0; i--) {
  4856. const additionalActions = additionalActionsDicts[i];
  4857. if (!(additionalActions instanceof _primitives.Dict)) {
  4858. continue;
  4859. }
  4860. for (const key of additionalActions.getKeys()) {
  4861. const action = eventType[key];
  4862. if (!action) {
  4863. continue;
  4864. }
  4865. const actionDict = additionalActions.getRaw(key);
  4866. const parents = new _primitives.RefSet();
  4867. const list = [];
  4868. _collectJS(actionDict, xref, list, parents);
  4869. if (list.length > 0) {
  4870. actions[action] = list;
  4871. }
  4872. }
  4873. }
  4874. }
  4875. if (dict.has("A")) {
  4876. const actionDict = dict.get("A");
  4877. const parents = new _primitives.RefSet();
  4878. const list = [];
  4879. _collectJS(actionDict, xref, list, parents);
  4880. if (list.length > 0) {
  4881. actions.Action = list;
  4882. }
  4883. }
  4884. return (0, _util.objectSize)(actions) > 0 ? actions : null;
  4885. }
  4886. const XMLEntities = {
  4887. 0x3c: "&lt;",
  4888. 0x3e: "&gt;",
  4889. 0x26: "&amp;",
  4890. 0x22: "&quot;",
  4891. 0x27: "&apos;"
  4892. };
  4893. function encodeToXmlString(str) {
  4894. const buffer = [];
  4895. let start = 0;
  4896. for (let i = 0, ii = str.length; i < ii; i++) {
  4897. const char = str.codePointAt(i);
  4898. if (0x20 <= char && char <= 0x7e) {
  4899. const entity = XMLEntities[char];
  4900. if (entity) {
  4901. if (start < i) {
  4902. buffer.push(str.substring(start, i));
  4903. }
  4904. buffer.push(entity);
  4905. start = i + 1;
  4906. }
  4907. } else {
  4908. if (start < i) {
  4909. buffer.push(str.substring(start, i));
  4910. }
  4911. buffer.push(`&#x${char.toString(16).toUpperCase()};`);
  4912. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  4913. i++;
  4914. }
  4915. start = i + 1;
  4916. }
  4917. }
  4918. if (buffer.length === 0) {
  4919. return str;
  4920. }
  4921. if (start < str.length) {
  4922. buffer.push(str.substring(start, str.length));
  4923. }
  4924. return buffer.join("");
  4925. }
  4926. function validateCSSFont(cssFontInfo) {
  4927. const DEFAULT_CSS_FONT_OBLIQUE = "14";
  4928. const DEFAULT_CSS_FONT_WEIGHT = "400";
  4929. const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]);
  4930. const {
  4931. fontFamily,
  4932. fontWeight,
  4933. italicAngle
  4934. } = cssFontInfo;
  4935. if (/^".*"$/.test(fontFamily)) {
  4936. if (/[^\\]"/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  4937. (0, _util.warn)(`XFA - FontFamily contains some unescaped ": ${fontFamily}.`);
  4938. return false;
  4939. }
  4940. } else if (/^'.*'$/.test(fontFamily)) {
  4941. if (/[^\\]'/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  4942. (0, _util.warn)(`XFA - FontFamily contains some unescaped ': ${fontFamily}.`);
  4943. return false;
  4944. }
  4945. } else {
  4946. for (const ident of fontFamily.split(/[ \t]+/)) {
  4947. if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) {
  4948. (0, _util.warn)(`XFA - FontFamily contains some invalid <custom-ident>: ${fontFamily}.`);
  4949. return false;
  4950. }
  4951. }
  4952. }
  4953. const weight = fontWeight ? fontWeight.toString() : "";
  4954. cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT;
  4955. const angle = parseFloat(italicAngle);
  4956. cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString();
  4957. return true;
  4958. }
  4959. function recoverJsURL(str) {
  4960. const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"];
  4961. const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
  4962. const jsUrl = regex.exec(str);
  4963. if (jsUrl && jsUrl[2]) {
  4964. const url = jsUrl[2];
  4965. let newWindow = false;
  4966. if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
  4967. newWindow = true;
  4968. }
  4969. return {
  4970. url,
  4971. newWindow
  4972. };
  4973. }
  4974. return null;
  4975. }
  4976. function numberToString(value) {
  4977. if (Number.isInteger(value)) {
  4978. return value.toString();
  4979. }
  4980. const roundedValue = Math.round(value * 100);
  4981. if (roundedValue % 100 === 0) {
  4982. return (roundedValue / 100).toString();
  4983. }
  4984. if (roundedValue % 10 === 0) {
  4985. return value.toFixed(1);
  4986. }
  4987. return value.toFixed(2);
  4988. }
  4989. function getNewAnnotationsMap(annotationStorage) {
  4990. if (!annotationStorage) {
  4991. return null;
  4992. }
  4993. const newAnnotationsByPage = new Map();
  4994. for (const [key, value] of annotationStorage) {
  4995. if (!key.startsWith(_util.AnnotationEditorPrefix)) {
  4996. continue;
  4997. }
  4998. let annotations = newAnnotationsByPage.get(value.pageIndex);
  4999. if (!annotations) {
  5000. annotations = [];
  5001. newAnnotationsByPage.set(value.pageIndex, annotations);
  5002. }
  5003. annotations.push(value);
  5004. }
  5005. return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null;
  5006. }
  5007. function isAscii(str) {
  5008. return /^[\x00-\x7F]*$/.test(str);
  5009. }
  5010. function stringToUTF16HexString(str) {
  5011. const buf = [];
  5012. for (let i = 0, ii = str.length; i < ii; i++) {
  5013. const char = str.charCodeAt(i);
  5014. buf.push((char >> 8 & 0xff).toString(16).padStart(2, "0"), (char & 0xff).toString(16).padStart(2, "0"));
  5015. }
  5016. return buf.join("");
  5017. }
  5018. function stringToUTF16String(str) {
  5019. let bigEndian = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  5020. const buf = [];
  5021. if (bigEndian) {
  5022. buf.push("\xFE\xFF");
  5023. }
  5024. for (let i = 0, ii = str.length; i < ii; i++) {
  5025. const char = str.charCodeAt(i);
  5026. buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
  5027. }
  5028. return buf.join("");
  5029. }
  5030. function getRotationMatrix(rotation, width, height) {
  5031. switch (rotation) {
  5032. case 90:
  5033. return [0, 1, -1, 0, width, 0];
  5034. case 180:
  5035. return [-1, 0, 0, -1, width, height];
  5036. case 270:
  5037. return [0, -1, 1, 0, 0, height];
  5038. default:
  5039. throw new Error("Invalid rotation");
  5040. }
  5041. }
  5042. /***/ }),
  5043. /* 137 */
  5044. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5045. "use strict";
  5046. Object.defineProperty(exports, "__esModule", ({
  5047. value: true
  5048. }));
  5049. exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd = exports.CIRCULAR_REF = void 0;
  5050. exports.clearPrimitiveCaches = clearPrimitiveCaches;
  5051. exports.isCmd = isCmd;
  5052. exports.isDict = isDict;
  5053. exports.isName = isName;
  5054. exports.isRefsEqual = isRefsEqual;
  5055. var _util = __w_pdfjs_require__(2);
  5056. const CIRCULAR_REF = Symbol("CIRCULAR_REF");
  5057. exports.CIRCULAR_REF = CIRCULAR_REF;
  5058. const EOF = Symbol("EOF");
  5059. exports.EOF = EOF;
  5060. const Name = function NameClosure() {
  5061. let nameCache = Object.create(null);
  5062. class Name {
  5063. constructor(name) {
  5064. this.name = name;
  5065. }
  5066. static get(name) {
  5067. return nameCache[name] || (nameCache[name] = new Name(name));
  5068. }
  5069. static _clearCache() {
  5070. nameCache = Object.create(null);
  5071. }
  5072. }
  5073. return Name;
  5074. }();
  5075. exports.Name = Name;
  5076. const Cmd = function CmdClosure() {
  5077. let cmdCache = Object.create(null);
  5078. class Cmd {
  5079. constructor(cmd) {
  5080. this.cmd = cmd;
  5081. }
  5082. static get(cmd) {
  5083. return cmdCache[cmd] || (cmdCache[cmd] = new Cmd(cmd));
  5084. }
  5085. static _clearCache() {
  5086. cmdCache = Object.create(null);
  5087. }
  5088. }
  5089. return Cmd;
  5090. }();
  5091. exports.Cmd = Cmd;
  5092. const nonSerializable = function nonSerializableClosure() {
  5093. return nonSerializable;
  5094. };
  5095. class Dict {
  5096. constructor() {
  5097. let xref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  5098. this._map = Object.create(null);
  5099. this.xref = xref;
  5100. this.objId = null;
  5101. this.suppressEncryption = false;
  5102. this.__nonSerializable__ = nonSerializable;
  5103. }
  5104. assignXref(newXref) {
  5105. this.xref = newXref;
  5106. }
  5107. get size() {
  5108. return Object.keys(this._map).length;
  5109. }
  5110. get(key1, key2, key3) {
  5111. let value = this._map[key1];
  5112. if (value === undefined && key2 !== undefined) {
  5113. value = this._map[key2];
  5114. if (value === undefined && key3 !== undefined) {
  5115. value = this._map[key3];
  5116. }
  5117. }
  5118. if (value instanceof Ref && this.xref) {
  5119. return this.xref.fetch(value, this.suppressEncryption);
  5120. }
  5121. return value;
  5122. }
  5123. async getAsync(key1, key2, key3) {
  5124. let value = this._map[key1];
  5125. if (value === undefined && key2 !== undefined) {
  5126. value = this._map[key2];
  5127. if (value === undefined && key3 !== undefined) {
  5128. value = this._map[key3];
  5129. }
  5130. }
  5131. if (value instanceof Ref && this.xref) {
  5132. return this.xref.fetchAsync(value, this.suppressEncryption);
  5133. }
  5134. return value;
  5135. }
  5136. getArray(key1, key2, key3) {
  5137. let value = this._map[key1];
  5138. if (value === undefined && key2 !== undefined) {
  5139. value = this._map[key2];
  5140. if (value === undefined && key3 !== undefined) {
  5141. value = this._map[key3];
  5142. }
  5143. }
  5144. if (value instanceof Ref && this.xref) {
  5145. value = this.xref.fetch(value, this.suppressEncryption);
  5146. }
  5147. if (Array.isArray(value)) {
  5148. value = value.slice();
  5149. for (let i = 0, ii = value.length; i < ii; i++) {
  5150. if (value[i] instanceof Ref && this.xref) {
  5151. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  5152. }
  5153. }
  5154. }
  5155. return value;
  5156. }
  5157. getRaw(key) {
  5158. return this._map[key];
  5159. }
  5160. getKeys() {
  5161. return Object.keys(this._map);
  5162. }
  5163. getRawValues() {
  5164. return Object.values(this._map);
  5165. }
  5166. set(key, value) {
  5167. this._map[key] = value;
  5168. }
  5169. has(key) {
  5170. return this._map[key] !== undefined;
  5171. }
  5172. forEach(callback) {
  5173. for (const key in this._map) {
  5174. callback(key, this.get(key));
  5175. }
  5176. }
  5177. static get empty() {
  5178. const emptyDict = new Dict(null);
  5179. emptyDict.set = (key, value) => {
  5180. (0, _util.unreachable)("Should not call `set` on the empty dictionary.");
  5181. };
  5182. return (0, _util.shadow)(this, "empty", emptyDict);
  5183. }
  5184. static merge(_ref) {
  5185. let {
  5186. xref,
  5187. dictArray,
  5188. mergeSubDicts = false
  5189. } = _ref;
  5190. const mergedDict = new Dict(xref),
  5191. properties = new Map();
  5192. for (const dict of dictArray) {
  5193. if (!(dict instanceof Dict)) {
  5194. continue;
  5195. }
  5196. for (const [key, value] of Object.entries(dict._map)) {
  5197. let property = properties.get(key);
  5198. if (property === undefined) {
  5199. property = [];
  5200. properties.set(key, property);
  5201. } else if (!mergeSubDicts || !(value instanceof Dict)) {
  5202. continue;
  5203. }
  5204. property.push(value);
  5205. }
  5206. }
  5207. for (const [name, values] of properties) {
  5208. if (values.length === 1 || !(values[0] instanceof Dict)) {
  5209. mergedDict._map[name] = values[0];
  5210. continue;
  5211. }
  5212. const subDict = new Dict(xref);
  5213. for (const dict of values) {
  5214. for (const [key, value] of Object.entries(dict._map)) {
  5215. if (subDict._map[key] === undefined) {
  5216. subDict._map[key] = value;
  5217. }
  5218. }
  5219. }
  5220. if (subDict.size > 0) {
  5221. mergedDict._map[name] = subDict;
  5222. }
  5223. }
  5224. properties.clear();
  5225. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  5226. }
  5227. }
  5228. exports.Dict = Dict;
  5229. const Ref = function RefClosure() {
  5230. let refCache = Object.create(null);
  5231. class Ref {
  5232. constructor(num, gen) {
  5233. this.num = num;
  5234. this.gen = gen;
  5235. }
  5236. toString() {
  5237. if (this.gen === 0) {
  5238. return `${this.num}R`;
  5239. }
  5240. return `${this.num}R${this.gen}`;
  5241. }
  5242. static get(num, gen) {
  5243. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  5244. return refCache[key] || (refCache[key] = new Ref(num, gen));
  5245. }
  5246. static _clearCache() {
  5247. refCache = Object.create(null);
  5248. }
  5249. }
  5250. return Ref;
  5251. }();
  5252. exports.Ref = Ref;
  5253. class RefSet {
  5254. constructor() {
  5255. let parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  5256. this._set = new Set(parent && parent._set);
  5257. }
  5258. has(ref) {
  5259. return this._set.has(ref.toString());
  5260. }
  5261. put(ref) {
  5262. this._set.add(ref.toString());
  5263. }
  5264. remove(ref) {
  5265. this._set.delete(ref.toString());
  5266. }
  5267. [Symbol.iterator]() {
  5268. return this._set.values();
  5269. }
  5270. clear() {
  5271. this._set.clear();
  5272. }
  5273. }
  5274. exports.RefSet = RefSet;
  5275. class RefSetCache {
  5276. constructor() {
  5277. this._map = new Map();
  5278. }
  5279. get size() {
  5280. return this._map.size;
  5281. }
  5282. get(ref) {
  5283. return this._map.get(ref.toString());
  5284. }
  5285. has(ref) {
  5286. return this._map.has(ref.toString());
  5287. }
  5288. put(ref, obj) {
  5289. this._map.set(ref.toString(), obj);
  5290. }
  5291. putAlias(ref, aliasRef) {
  5292. this._map.set(ref.toString(), this.get(aliasRef));
  5293. }
  5294. [Symbol.iterator]() {
  5295. return this._map.values();
  5296. }
  5297. clear() {
  5298. this._map.clear();
  5299. }
  5300. }
  5301. exports.RefSetCache = RefSetCache;
  5302. function isName(v, name) {
  5303. return v instanceof Name && (name === undefined || v.name === name);
  5304. }
  5305. function isCmd(v, cmd) {
  5306. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  5307. }
  5308. function isDict(v, type) {
  5309. return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
  5310. }
  5311. function isRefsEqual(v1, v2) {
  5312. return v1.num === v2.num && v1.gen === v2.gen;
  5313. }
  5314. function clearPrimitiveCaches() {
  5315. Cmd._clearCache();
  5316. Name._clearCache();
  5317. Ref._clearCache();
  5318. }
  5319. /***/ }),
  5320. /* 138 */
  5321. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5322. "use strict";
  5323. Object.defineProperty(exports, "__esModule", ({
  5324. value: true
  5325. }));
  5326. exports.BaseStream = void 0;
  5327. var _util = __w_pdfjs_require__(2);
  5328. class BaseStream {
  5329. constructor() {
  5330. if (this.constructor === BaseStream) {
  5331. (0, _util.unreachable)("Cannot initialize BaseStream.");
  5332. }
  5333. }
  5334. get length() {
  5335. (0, _util.unreachable)("Abstract getter `length` accessed");
  5336. }
  5337. get isEmpty() {
  5338. (0, _util.unreachable)("Abstract getter `isEmpty` accessed");
  5339. }
  5340. get isDataLoaded() {
  5341. return (0, _util.shadow)(this, "isDataLoaded", true);
  5342. }
  5343. getByte() {
  5344. (0, _util.unreachable)("Abstract method `getByte` called");
  5345. }
  5346. getBytes(length) {
  5347. (0, _util.unreachable)("Abstract method `getBytes` called");
  5348. }
  5349. peekByte() {
  5350. const peekedByte = this.getByte();
  5351. if (peekedByte !== -1) {
  5352. this.pos--;
  5353. }
  5354. return peekedByte;
  5355. }
  5356. peekBytes(length) {
  5357. const bytes = this.getBytes(length);
  5358. this.pos -= bytes.length;
  5359. return bytes;
  5360. }
  5361. getUint16() {
  5362. const b0 = this.getByte();
  5363. const b1 = this.getByte();
  5364. if (b0 === -1 || b1 === -1) {
  5365. return -1;
  5366. }
  5367. return (b0 << 8) + b1;
  5368. }
  5369. getInt32() {
  5370. const b0 = this.getByte();
  5371. const b1 = this.getByte();
  5372. const b2 = this.getByte();
  5373. const b3 = this.getByte();
  5374. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  5375. }
  5376. getByteRange(begin, end) {
  5377. (0, _util.unreachable)("Abstract method `getByteRange` called");
  5378. }
  5379. getString(length) {
  5380. return (0, _util.bytesToString)(this.getBytes(length));
  5381. }
  5382. skip(n) {
  5383. this.pos += n || 1;
  5384. }
  5385. reset() {
  5386. (0, _util.unreachable)("Abstract method `reset` called");
  5387. }
  5388. moveStart() {
  5389. (0, _util.unreachable)("Abstract method `moveStart` called");
  5390. }
  5391. makeSubStream(start, length) {
  5392. let dict = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  5393. (0, _util.unreachable)("Abstract method `makeSubStream` called");
  5394. }
  5395. getBaseStreams() {
  5396. return null;
  5397. }
  5398. }
  5399. exports.BaseStream = BaseStream;
  5400. /***/ }),
  5401. /* 139 */
  5402. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5403. "use strict";
  5404. Object.defineProperty(exports, "__esModule", ({
  5405. value: true
  5406. }));
  5407. exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
  5408. var _util = __w_pdfjs_require__(2);
  5409. var _chunked_stream = __w_pdfjs_require__(140);
  5410. var _core_utils = __w_pdfjs_require__(136);
  5411. var _document = __w_pdfjs_require__(142);
  5412. var _stream = __w_pdfjs_require__(141);
  5413. function parseDocBaseUrl(url) {
  5414. if (url) {
  5415. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url);
  5416. if (absoluteUrl) {
  5417. return absoluteUrl.href;
  5418. }
  5419. (0, _util.warn)(`Invalid absolute docBaseUrl: "${url}".`);
  5420. }
  5421. return null;
  5422. }
  5423. class BasePdfManager {
  5424. constructor(args) {
  5425. if (this.constructor === BasePdfManager) {
  5426. (0, _util.unreachable)("Cannot initialize BasePdfManager.");
  5427. }
  5428. this._docBaseUrl = parseDocBaseUrl(args.docBaseUrl);
  5429. this._docId = args.docId;
  5430. this._password = args.password;
  5431. this.enableXfa = args.enableXfa;
  5432. this.evaluatorOptions = args.evaluatorOptions;
  5433. }
  5434. get docId() {
  5435. return this._docId;
  5436. }
  5437. get password() {
  5438. return this._password;
  5439. }
  5440. get docBaseUrl() {
  5441. const catalog = this.pdfDocument.catalog;
  5442. return (0, _util.shadow)(this, "docBaseUrl", catalog.baseUrl || this._docBaseUrl);
  5443. }
  5444. ensureDoc(prop, args) {
  5445. return this.ensure(this.pdfDocument, prop, args);
  5446. }
  5447. ensureXRef(prop, args) {
  5448. return this.ensure(this.pdfDocument.xref, prop, args);
  5449. }
  5450. ensureCatalog(prop, args) {
  5451. return this.ensure(this.pdfDocument.catalog, prop, args);
  5452. }
  5453. getPage(pageIndex) {
  5454. return this.pdfDocument.getPage(pageIndex);
  5455. }
  5456. fontFallback(id, handler) {
  5457. return this.pdfDocument.fontFallback(id, handler);
  5458. }
  5459. loadXfaFonts(handler, task) {
  5460. return this.pdfDocument.loadXfaFonts(handler, task);
  5461. }
  5462. loadXfaImages() {
  5463. return this.pdfDocument.loadXfaImages();
  5464. }
  5465. serializeXfaData(annotationStorage) {
  5466. return this.pdfDocument.serializeXfaData(annotationStorage);
  5467. }
  5468. cleanup() {
  5469. let manuallyTriggered = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5470. return this.pdfDocument.cleanup(manuallyTriggered);
  5471. }
  5472. async ensure(obj, prop, args) {
  5473. (0, _util.unreachable)("Abstract method `ensure` called");
  5474. }
  5475. requestRange(begin, end) {
  5476. (0, _util.unreachable)("Abstract method `requestRange` called");
  5477. }
  5478. requestLoadedStream() {
  5479. let noFetch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5480. (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
  5481. }
  5482. sendProgressiveData(chunk) {
  5483. (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
  5484. }
  5485. updatePassword(password) {
  5486. this._password = password;
  5487. }
  5488. terminate(reason) {
  5489. (0, _util.unreachable)("Abstract method `terminate` called");
  5490. }
  5491. }
  5492. class LocalPdfManager extends BasePdfManager {
  5493. constructor(args) {
  5494. super(args);
  5495. const stream = new _stream.Stream(args.source);
  5496. this.pdfDocument = new _document.PDFDocument(this, stream);
  5497. this._loadedStreamPromise = Promise.resolve(stream);
  5498. }
  5499. async ensure(obj, prop, args) {
  5500. const value = obj[prop];
  5501. if (typeof value === "function") {
  5502. return value.apply(obj, args);
  5503. }
  5504. return value;
  5505. }
  5506. requestRange(begin, end) {
  5507. return Promise.resolve();
  5508. }
  5509. requestLoadedStream() {
  5510. let noFetch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5511. return this._loadedStreamPromise;
  5512. }
  5513. terminate(reason) {}
  5514. }
  5515. exports.LocalPdfManager = LocalPdfManager;
  5516. class NetworkPdfManager extends BasePdfManager {
  5517. constructor(args) {
  5518. super(args);
  5519. this.streamManager = new _chunked_stream.ChunkedStreamManager(args.source, {
  5520. msgHandler: args.handler,
  5521. length: args.length,
  5522. disableAutoFetch: args.disableAutoFetch,
  5523. rangeChunkSize: args.rangeChunkSize
  5524. });
  5525. this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
  5526. }
  5527. async ensure(obj, prop, args) {
  5528. try {
  5529. const value = obj[prop];
  5530. if (typeof value === "function") {
  5531. return value.apply(obj, args);
  5532. }
  5533. return value;
  5534. } catch (ex) {
  5535. if (!(ex instanceof _core_utils.MissingDataException)) {
  5536. throw ex;
  5537. }
  5538. await this.requestRange(ex.begin, ex.end);
  5539. return this.ensure(obj, prop, args);
  5540. }
  5541. }
  5542. requestRange(begin, end) {
  5543. return this.streamManager.requestRange(begin, end);
  5544. }
  5545. requestLoadedStream() {
  5546. let noFetch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5547. return this.streamManager.requestAllChunks(noFetch);
  5548. }
  5549. sendProgressiveData(chunk) {
  5550. this.streamManager.onReceiveData({
  5551. chunk
  5552. });
  5553. }
  5554. terminate(reason) {
  5555. this.streamManager.abort(reason);
  5556. }
  5557. }
  5558. exports.NetworkPdfManager = NetworkPdfManager;
  5559. /***/ }),
  5560. /* 140 */
  5561. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5562. "use strict";
  5563. Object.defineProperty(exports, "__esModule", ({
  5564. value: true
  5565. }));
  5566. exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
  5567. var _core_utils = __w_pdfjs_require__(136);
  5568. var _util = __w_pdfjs_require__(2);
  5569. var _stream = __w_pdfjs_require__(141);
  5570. class ChunkedStream extends _stream.Stream {
  5571. constructor(length, chunkSize, manager) {
  5572. super(new Uint8Array(length), 0, length, null);
  5573. this.chunkSize = chunkSize;
  5574. this._loadedChunks = new Set();
  5575. this.numChunks = Math.ceil(length / chunkSize);
  5576. this.manager = manager;
  5577. this.progressiveDataLength = 0;
  5578. this.lastSuccessfulEnsureByteChunk = -1;
  5579. }
  5580. getMissingChunks() {
  5581. const chunks = [];
  5582. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  5583. if (!this._loadedChunks.has(chunk)) {
  5584. chunks.push(chunk);
  5585. }
  5586. }
  5587. return chunks;
  5588. }
  5589. get numChunksLoaded() {
  5590. return this._loadedChunks.size;
  5591. }
  5592. get isDataLoaded() {
  5593. return this.numChunksLoaded === this.numChunks;
  5594. }
  5595. onReceiveData(begin, chunk) {
  5596. const chunkSize = this.chunkSize;
  5597. if (begin % chunkSize !== 0) {
  5598. throw new Error(`Bad begin offset: ${begin}`);
  5599. }
  5600. const end = begin + chunk.byteLength;
  5601. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  5602. throw new Error(`Bad end offset: ${end}`);
  5603. }
  5604. this.bytes.set(new Uint8Array(chunk), begin);
  5605. const beginChunk = Math.floor(begin / chunkSize);
  5606. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  5607. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  5608. this._loadedChunks.add(curChunk);
  5609. }
  5610. }
  5611. onReceiveProgressiveData(data) {
  5612. let position = this.progressiveDataLength;
  5613. const beginChunk = Math.floor(position / this.chunkSize);
  5614. this.bytes.set(new Uint8Array(data), position);
  5615. position += data.byteLength;
  5616. this.progressiveDataLength = position;
  5617. const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  5618. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  5619. this._loadedChunks.add(curChunk);
  5620. }
  5621. }
  5622. ensureByte(pos) {
  5623. if (pos < this.progressiveDataLength) {
  5624. return;
  5625. }
  5626. const chunk = Math.floor(pos / this.chunkSize);
  5627. if (chunk > this.numChunks) {
  5628. return;
  5629. }
  5630. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  5631. return;
  5632. }
  5633. if (!this._loadedChunks.has(chunk)) {
  5634. throw new _core_utils.MissingDataException(pos, pos + 1);
  5635. }
  5636. this.lastSuccessfulEnsureByteChunk = chunk;
  5637. }
  5638. ensureRange(begin, end) {
  5639. if (begin >= end) {
  5640. return;
  5641. }
  5642. if (end <= this.progressiveDataLength) {
  5643. return;
  5644. }
  5645. const beginChunk = Math.floor(begin / this.chunkSize);
  5646. if (beginChunk > this.numChunks) {
  5647. return;
  5648. }
  5649. const endChunk = Math.min(Math.floor((end - 1) / this.chunkSize) + 1, this.numChunks);
  5650. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  5651. if (!this._loadedChunks.has(chunk)) {
  5652. throw new _core_utils.MissingDataException(begin, end);
  5653. }
  5654. }
  5655. }
  5656. nextEmptyChunk(beginChunk) {
  5657. const numChunks = this.numChunks;
  5658. for (let i = 0; i < numChunks; ++i) {
  5659. const chunk = (beginChunk + i) % numChunks;
  5660. if (!this._loadedChunks.has(chunk)) {
  5661. return chunk;
  5662. }
  5663. }
  5664. return null;
  5665. }
  5666. hasChunk(chunk) {
  5667. return this._loadedChunks.has(chunk);
  5668. }
  5669. getByte() {
  5670. const pos = this.pos;
  5671. if (pos >= this.end) {
  5672. return -1;
  5673. }
  5674. if (pos >= this.progressiveDataLength) {
  5675. this.ensureByte(pos);
  5676. }
  5677. return this.bytes[this.pos++];
  5678. }
  5679. getBytes(length) {
  5680. const bytes = this.bytes;
  5681. const pos = this.pos;
  5682. const strEnd = this.end;
  5683. if (!length) {
  5684. if (strEnd > this.progressiveDataLength) {
  5685. this.ensureRange(pos, strEnd);
  5686. }
  5687. return bytes.subarray(pos, strEnd);
  5688. }
  5689. let end = pos + length;
  5690. if (end > strEnd) {
  5691. end = strEnd;
  5692. }
  5693. if (end > this.progressiveDataLength) {
  5694. this.ensureRange(pos, end);
  5695. }
  5696. this.pos = end;
  5697. return bytes.subarray(pos, end);
  5698. }
  5699. getByteRange(begin, end) {
  5700. if (begin < 0) {
  5701. begin = 0;
  5702. }
  5703. if (end > this.end) {
  5704. end = this.end;
  5705. }
  5706. if (end > this.progressiveDataLength) {
  5707. this.ensureRange(begin, end);
  5708. }
  5709. return this.bytes.subarray(begin, end);
  5710. }
  5711. makeSubStream(start, length) {
  5712. let dict = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  5713. if (length) {
  5714. if (start + length > this.progressiveDataLength) {
  5715. this.ensureRange(start, start + length);
  5716. }
  5717. } else {
  5718. if (start >= this.progressiveDataLength) {
  5719. this.ensureByte(start);
  5720. }
  5721. }
  5722. function ChunkedStreamSubstream() {}
  5723. ChunkedStreamSubstream.prototype = Object.create(this);
  5724. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  5725. const chunkSize = this.chunkSize;
  5726. const beginChunk = Math.floor(this.start / chunkSize);
  5727. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  5728. const missingChunks = [];
  5729. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  5730. if (!this._loadedChunks.has(chunk)) {
  5731. missingChunks.push(chunk);
  5732. }
  5733. }
  5734. return missingChunks;
  5735. };
  5736. Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", {
  5737. get() {
  5738. if (this.numChunksLoaded === this.numChunks) {
  5739. return true;
  5740. }
  5741. return this.getMissingChunks().length === 0;
  5742. },
  5743. configurable: true
  5744. });
  5745. const subStream = new ChunkedStreamSubstream();
  5746. subStream.pos = subStream.start = start;
  5747. subStream.end = start + length || this.end;
  5748. subStream.dict = dict;
  5749. return subStream;
  5750. }
  5751. getBaseStreams() {
  5752. return [this];
  5753. }
  5754. }
  5755. exports.ChunkedStream = ChunkedStream;
  5756. class ChunkedStreamManager {
  5757. constructor(pdfNetworkStream, args) {
  5758. this.length = args.length;
  5759. this.chunkSize = args.rangeChunkSize;
  5760. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  5761. this.pdfNetworkStream = pdfNetworkStream;
  5762. this.disableAutoFetch = args.disableAutoFetch;
  5763. this.msgHandler = args.msgHandler;
  5764. this.currRequestId = 0;
  5765. this._chunksNeededByRequest = new Map();
  5766. this._requestsByChunk = new Map();
  5767. this._promisesByRequest = new Map();
  5768. this.progressiveDataLength = 0;
  5769. this.aborted = false;
  5770. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  5771. }
  5772. sendRequest(begin, end) {
  5773. const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  5774. if (!rangeReader.isStreamingSupported) {
  5775. rangeReader.onProgress = this.onProgress.bind(this);
  5776. }
  5777. let chunks = [],
  5778. loaded = 0;
  5779. return new Promise((resolve, reject) => {
  5780. const readChunk = _ref => {
  5781. let {
  5782. value,
  5783. done
  5784. } = _ref;
  5785. try {
  5786. if (done) {
  5787. const chunkData = (0, _core_utils.arrayBuffersToBytes)(chunks);
  5788. chunks = null;
  5789. resolve(chunkData);
  5790. return;
  5791. }
  5792. loaded += value.byteLength;
  5793. if (rangeReader.isStreamingSupported) {
  5794. this.onProgress({
  5795. loaded
  5796. });
  5797. }
  5798. chunks.push(value);
  5799. rangeReader.read().then(readChunk, reject);
  5800. } catch (e) {
  5801. reject(e);
  5802. }
  5803. };
  5804. rangeReader.read().then(readChunk, reject);
  5805. }).then(data => {
  5806. if (this.aborted) {
  5807. return;
  5808. }
  5809. this.onReceiveData({
  5810. chunk: data,
  5811. begin
  5812. });
  5813. });
  5814. }
  5815. requestAllChunks() {
  5816. let noFetch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5817. if (!noFetch) {
  5818. const missingChunks = this.stream.getMissingChunks();
  5819. this._requestChunks(missingChunks);
  5820. }
  5821. return this._loadedStreamCapability.promise;
  5822. }
  5823. _requestChunks(chunks) {
  5824. const requestId = this.currRequestId++;
  5825. const chunksNeeded = new Set();
  5826. this._chunksNeededByRequest.set(requestId, chunksNeeded);
  5827. for (const chunk of chunks) {
  5828. if (!this.stream.hasChunk(chunk)) {
  5829. chunksNeeded.add(chunk);
  5830. }
  5831. }
  5832. if (chunksNeeded.size === 0) {
  5833. return Promise.resolve();
  5834. }
  5835. const capability = (0, _util.createPromiseCapability)();
  5836. this._promisesByRequest.set(requestId, capability);
  5837. const chunksToRequest = [];
  5838. for (const chunk of chunksNeeded) {
  5839. let requestIds = this._requestsByChunk.get(chunk);
  5840. if (!requestIds) {
  5841. requestIds = [];
  5842. this._requestsByChunk.set(chunk, requestIds);
  5843. chunksToRequest.push(chunk);
  5844. }
  5845. requestIds.push(requestId);
  5846. }
  5847. if (chunksToRequest.length > 0) {
  5848. const groupedChunksToRequest = this.groupChunks(chunksToRequest);
  5849. for (const groupedChunk of groupedChunksToRequest) {
  5850. const begin = groupedChunk.beginChunk * this.chunkSize;
  5851. const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  5852. this.sendRequest(begin, end).catch(capability.reject);
  5853. }
  5854. }
  5855. return capability.promise.catch(reason => {
  5856. if (this.aborted) {
  5857. return;
  5858. }
  5859. throw reason;
  5860. });
  5861. }
  5862. getStream() {
  5863. return this.stream;
  5864. }
  5865. requestRange(begin, end) {
  5866. end = Math.min(end, this.length);
  5867. const beginChunk = this.getBeginChunk(begin);
  5868. const endChunk = this.getEndChunk(end);
  5869. const chunks = [];
  5870. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  5871. chunks.push(chunk);
  5872. }
  5873. return this._requestChunks(chunks);
  5874. }
  5875. requestRanges() {
  5876. let ranges = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  5877. const chunksToRequest = [];
  5878. for (const range of ranges) {
  5879. const beginChunk = this.getBeginChunk(range.begin);
  5880. const endChunk = this.getEndChunk(range.end);
  5881. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  5882. if (!chunksToRequest.includes(chunk)) {
  5883. chunksToRequest.push(chunk);
  5884. }
  5885. }
  5886. }
  5887. chunksToRequest.sort(function (a, b) {
  5888. return a - b;
  5889. });
  5890. return this._requestChunks(chunksToRequest);
  5891. }
  5892. groupChunks(chunks) {
  5893. const groupedChunks = [];
  5894. let beginChunk = -1;
  5895. let prevChunk = -1;
  5896. for (let i = 0, ii = chunks.length; i < ii; ++i) {
  5897. const chunk = chunks[i];
  5898. if (beginChunk < 0) {
  5899. beginChunk = chunk;
  5900. }
  5901. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  5902. groupedChunks.push({
  5903. beginChunk,
  5904. endChunk: prevChunk + 1
  5905. });
  5906. beginChunk = chunk;
  5907. }
  5908. if (i + 1 === chunks.length) {
  5909. groupedChunks.push({
  5910. beginChunk,
  5911. endChunk: chunk + 1
  5912. });
  5913. }
  5914. prevChunk = chunk;
  5915. }
  5916. return groupedChunks;
  5917. }
  5918. onProgress(args) {
  5919. this.msgHandler.send("DocProgress", {
  5920. loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
  5921. total: this.length
  5922. });
  5923. }
  5924. onReceiveData(args) {
  5925. const chunk = args.chunk;
  5926. const isProgressive = args.begin === undefined;
  5927. const begin = isProgressive ? this.progressiveDataLength : args.begin;
  5928. const end = begin + chunk.byteLength;
  5929. const beginChunk = Math.floor(begin / this.chunkSize);
  5930. const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  5931. if (isProgressive) {
  5932. this.stream.onReceiveProgressiveData(chunk);
  5933. this.progressiveDataLength = end;
  5934. } else {
  5935. this.stream.onReceiveData(begin, chunk);
  5936. }
  5937. if (this.stream.isDataLoaded) {
  5938. this._loadedStreamCapability.resolve(this.stream);
  5939. }
  5940. const loadedRequests = [];
  5941. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  5942. const requestIds = this._requestsByChunk.get(curChunk);
  5943. if (!requestIds) {
  5944. continue;
  5945. }
  5946. this._requestsByChunk.delete(curChunk);
  5947. for (const requestId of requestIds) {
  5948. const chunksNeeded = this._chunksNeededByRequest.get(requestId);
  5949. if (chunksNeeded.has(curChunk)) {
  5950. chunksNeeded.delete(curChunk);
  5951. }
  5952. if (chunksNeeded.size > 0) {
  5953. continue;
  5954. }
  5955. loadedRequests.push(requestId);
  5956. }
  5957. }
  5958. if (!this.disableAutoFetch && this._requestsByChunk.size === 0) {
  5959. let nextEmptyChunk;
  5960. if (this.stream.numChunksLoaded === 1) {
  5961. const lastChunk = this.stream.numChunks - 1;
  5962. if (!this.stream.hasChunk(lastChunk)) {
  5963. nextEmptyChunk = lastChunk;
  5964. }
  5965. } else {
  5966. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  5967. }
  5968. if (Number.isInteger(nextEmptyChunk)) {
  5969. this._requestChunks([nextEmptyChunk]);
  5970. }
  5971. }
  5972. for (const requestId of loadedRequests) {
  5973. const capability = this._promisesByRequest.get(requestId);
  5974. this._promisesByRequest.delete(requestId);
  5975. capability.resolve();
  5976. }
  5977. this.msgHandler.send("DocProgress", {
  5978. loaded: this.stream.numChunksLoaded * this.chunkSize,
  5979. total: this.length
  5980. });
  5981. }
  5982. onError(err) {
  5983. this._loadedStreamCapability.reject(err);
  5984. }
  5985. getBeginChunk(begin) {
  5986. return Math.floor(begin / this.chunkSize);
  5987. }
  5988. getEndChunk(end) {
  5989. return Math.floor((end - 1) / this.chunkSize) + 1;
  5990. }
  5991. abort(reason) {
  5992. this.aborted = true;
  5993. if (this.pdfNetworkStream) {
  5994. this.pdfNetworkStream.cancelAllRequests(reason);
  5995. }
  5996. for (const capability of this._promisesByRequest.values()) {
  5997. capability.reject(reason);
  5998. }
  5999. }
  6000. }
  6001. exports.ChunkedStreamManager = ChunkedStreamManager;
  6002. /***/ }),
  6003. /* 141 */
  6004. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  6005. "use strict";
  6006. Object.defineProperty(exports, "__esModule", ({
  6007. value: true
  6008. }));
  6009. exports.StringStream = exports.Stream = exports.NullStream = void 0;
  6010. var _base_stream = __w_pdfjs_require__(138);
  6011. var _util = __w_pdfjs_require__(2);
  6012. class Stream extends _base_stream.BaseStream {
  6013. constructor(arrayBuffer, start, length, dict) {
  6014. super();
  6015. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  6016. this.start = start || 0;
  6017. this.pos = this.start;
  6018. this.end = start + length || this.bytes.length;
  6019. this.dict = dict;
  6020. }
  6021. get length() {
  6022. return this.end - this.start;
  6023. }
  6024. get isEmpty() {
  6025. return this.length === 0;
  6026. }
  6027. getByte() {
  6028. if (this.pos >= this.end) {
  6029. return -1;
  6030. }
  6031. return this.bytes[this.pos++];
  6032. }
  6033. getBytes(length) {
  6034. const bytes = this.bytes;
  6035. const pos = this.pos;
  6036. const strEnd = this.end;
  6037. if (!length) {
  6038. return bytes.subarray(pos, strEnd);
  6039. }
  6040. let end = pos + length;
  6041. if (end > strEnd) {
  6042. end = strEnd;
  6043. }
  6044. this.pos = end;
  6045. return bytes.subarray(pos, end);
  6046. }
  6047. getByteRange(begin, end) {
  6048. if (begin < 0) {
  6049. begin = 0;
  6050. }
  6051. if (end > this.end) {
  6052. end = this.end;
  6053. }
  6054. return this.bytes.subarray(begin, end);
  6055. }
  6056. reset() {
  6057. this.pos = this.start;
  6058. }
  6059. moveStart() {
  6060. this.start = this.pos;
  6061. }
  6062. makeSubStream(start, length) {
  6063. let dict = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  6064. return new Stream(this.bytes.buffer, start, length, dict);
  6065. }
  6066. }
  6067. exports.Stream = Stream;
  6068. class StringStream extends Stream {
  6069. constructor(str) {
  6070. super((0, _util.stringToBytes)(str));
  6071. }
  6072. }
  6073. exports.StringStream = StringStream;
  6074. class NullStream extends Stream {
  6075. constructor() {
  6076. super(new Uint8Array(0));
  6077. }
  6078. }
  6079. exports.NullStream = NullStream;
  6080. /***/ }),
  6081. /* 142 */
  6082. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  6083. "use strict";
  6084. Object.defineProperty(exports, "__esModule", ({
  6085. value: true
  6086. }));
  6087. exports.Page = exports.PDFDocument = void 0;
  6088. var _annotation = __w_pdfjs_require__(143);
  6089. var _util = __w_pdfjs_require__(2);
  6090. var _core_utils = __w_pdfjs_require__(136);
  6091. var _primitives = __w_pdfjs_require__(137);
  6092. var _xfa_fonts = __w_pdfjs_require__(182);
  6093. var _base_stream = __w_pdfjs_require__(138);
  6094. var _crypto = __w_pdfjs_require__(198);
  6095. var _catalog = __w_pdfjs_require__(200);
  6096. var _cleanup_helper = __w_pdfjs_require__(202);
  6097. var _dataset_reader = __w_pdfjs_require__(231);
  6098. var _parser = __w_pdfjs_require__(148);
  6099. var _stream = __w_pdfjs_require__(141);
  6100. var _object_loader = __w_pdfjs_require__(206);
  6101. var _operator_list = __w_pdfjs_require__(193);
  6102. var _evaluator = __w_pdfjs_require__(146);
  6103. var _decode_stream = __w_pdfjs_require__(150);
  6104. var _struct_tree = __w_pdfjs_require__(205);
  6105. var _writer = __w_pdfjs_require__(196);
  6106. var _factory = __w_pdfjs_require__(207);
  6107. var _xref = __w_pdfjs_require__(232);
  6108. const DEFAULT_USER_UNIT = 1.0;
  6109. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  6110. class Page {
  6111. constructor(_ref) {
  6112. let {
  6113. pdfManager,
  6114. xref,
  6115. pageIndex,
  6116. pageDict,
  6117. ref,
  6118. globalIdFactory,
  6119. fontCache,
  6120. builtInCMapCache,
  6121. standardFontDataCache,
  6122. globalImageCache,
  6123. nonBlendModesSet,
  6124. xfaFactory
  6125. } = _ref;
  6126. this.pdfManager = pdfManager;
  6127. this.pageIndex = pageIndex;
  6128. this.pageDict = pageDict;
  6129. this.xref = xref;
  6130. this.ref = ref;
  6131. this.fontCache = fontCache;
  6132. this.builtInCMapCache = builtInCMapCache;
  6133. this.standardFontDataCache = standardFontDataCache;
  6134. this.globalImageCache = globalImageCache;
  6135. this.nonBlendModesSet = nonBlendModesSet;
  6136. this.evaluatorOptions = pdfManager.evaluatorOptions;
  6137. this.resourcesPromise = null;
  6138. this.xfaFactory = xfaFactory;
  6139. const idCounters = {
  6140. obj: 0
  6141. };
  6142. this._localIdFactory = class extends globalIdFactory {
  6143. static createObjId() {
  6144. return `p${pageIndex}_${++idCounters.obj}`;
  6145. }
  6146. static getPageObjId() {
  6147. return `page${ref.toString()}`;
  6148. }
  6149. };
  6150. }
  6151. _getInheritableProperty(key) {
  6152. let getArray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  6153. const value = (0, _core_utils.getInheritableProperty)({
  6154. dict: this.pageDict,
  6155. key,
  6156. getArray,
  6157. stopWhenFound: false
  6158. });
  6159. if (!Array.isArray(value)) {
  6160. return value;
  6161. }
  6162. if (value.length === 1 || !(value[0] instanceof _primitives.Dict)) {
  6163. return value[0];
  6164. }
  6165. return _primitives.Dict.merge({
  6166. xref: this.xref,
  6167. dictArray: value
  6168. });
  6169. }
  6170. get content() {
  6171. return this.pageDict.getArray("Contents");
  6172. }
  6173. get resources() {
  6174. const resources = this._getInheritableProperty("Resources");
  6175. return (0, _util.shadow)(this, "resources", resources instanceof _primitives.Dict ? resources : _primitives.Dict.empty);
  6176. }
  6177. _getBoundingBox(name) {
  6178. if (this.xfaData) {
  6179. return this.xfaData.bbox;
  6180. }
  6181. let box = this._getInheritableProperty(name, true);
  6182. if (Array.isArray(box) && box.length === 4) {
  6183. box = _util.Util.normalizeRect(box);
  6184. if (box[2] - box[0] > 0 && box[3] - box[1] > 0) {
  6185. return box;
  6186. }
  6187. (0, _util.warn)(`Empty, or invalid, /${name} entry.`);
  6188. }
  6189. return null;
  6190. }
  6191. get mediaBox() {
  6192. return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
  6193. }
  6194. get cropBox() {
  6195. return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
  6196. }
  6197. get userUnit() {
  6198. let obj = this.pageDict.get("UserUnit");
  6199. if (typeof obj !== "number" || obj <= 0) {
  6200. obj = DEFAULT_USER_UNIT;
  6201. }
  6202. return (0, _util.shadow)(this, "userUnit", obj);
  6203. }
  6204. get view() {
  6205. const {
  6206. cropBox,
  6207. mediaBox
  6208. } = this;
  6209. if (cropBox !== mediaBox && !(0, _util.isArrayEqual)(cropBox, mediaBox)) {
  6210. const box = _util.Util.intersect(cropBox, mediaBox);
  6211. if (box && box[2] - box[0] > 0 && box[3] - box[1] > 0) {
  6212. return (0, _util.shadow)(this, "view", box);
  6213. }
  6214. (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
  6215. }
  6216. return (0, _util.shadow)(this, "view", mediaBox);
  6217. }
  6218. get rotate() {
  6219. let rotate = this._getInheritableProperty("Rotate") || 0;
  6220. if (rotate % 90 !== 0) {
  6221. rotate = 0;
  6222. } else if (rotate >= 360) {
  6223. rotate %= 360;
  6224. } else if (rotate < 0) {
  6225. rotate = (rotate % 360 + 360) % 360;
  6226. }
  6227. return (0, _util.shadow)(this, "rotate", rotate);
  6228. }
  6229. _onSubStreamError(handler, reason, objId) {
  6230. if (this.evaluatorOptions.ignoreErrors) {
  6231. handler.send("UnsupportedFeature", {
  6232. featureId: _util.UNSUPPORTED_FEATURES.errorContentSubStream
  6233. });
  6234. (0, _util.warn)(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`);
  6235. return;
  6236. }
  6237. throw reason;
  6238. }
  6239. getContentStream(handler) {
  6240. return this.pdfManager.ensure(this, "content").then(content => {
  6241. if (content instanceof _base_stream.BaseStream) {
  6242. return content;
  6243. }
  6244. if (Array.isArray(content)) {
  6245. return new _decode_stream.StreamsSequenceStream(content, this._onSubStreamError.bind(this, handler));
  6246. }
  6247. return new _stream.NullStream();
  6248. });
  6249. }
  6250. get xfaData() {
  6251. return (0, _util.shadow)(this, "xfaData", this.xfaFactory ? {
  6252. bbox: this.xfaFactory.getBoundingBox(this.pageIndex)
  6253. } : null);
  6254. }
  6255. async saveNewAnnotations(handler, task, annotations) {
  6256. if (this.xfaFactory) {
  6257. throw new Error("XFA: Cannot save new annotations.");
  6258. }
  6259. const partialEvaluator = new _evaluator.PartialEvaluator({
  6260. xref: this.xref,
  6261. handler,
  6262. pageIndex: this.pageIndex,
  6263. idFactory: this._localIdFactory,
  6264. fontCache: this.fontCache,
  6265. builtInCMapCache: this.builtInCMapCache,
  6266. standardFontDataCache: this.standardFontDataCache,
  6267. globalImageCache: this.globalImageCache,
  6268. options: this.evaluatorOptions
  6269. });
  6270. const pageDict = this.pageDict;
  6271. const annotationsArray = this.annotations.slice();
  6272. const newData = await _annotation.AnnotationFactory.saveNewAnnotations(partialEvaluator, task, annotations);
  6273. for (const {
  6274. ref
  6275. } of newData.annotations) {
  6276. annotationsArray.push(ref);
  6277. }
  6278. const savedDict = pageDict.get("Annots");
  6279. pageDict.set("Annots", annotationsArray);
  6280. const buffer = [];
  6281. let transform = null;
  6282. if (this.xref.encrypt) {
  6283. transform = this.xref.encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  6284. }
  6285. (0, _writer.writeObject)(this.ref, pageDict, buffer, transform);
  6286. if (savedDict) {
  6287. pageDict.set("Annots", savedDict);
  6288. }
  6289. const objects = newData.dependencies;
  6290. objects.push({
  6291. ref: this.ref,
  6292. data: buffer.join("")
  6293. }, ...newData.annotations);
  6294. return objects;
  6295. }
  6296. save(handler, task, annotationStorage) {
  6297. const partialEvaluator = new _evaluator.PartialEvaluator({
  6298. xref: this.xref,
  6299. handler,
  6300. pageIndex: this.pageIndex,
  6301. idFactory: this._localIdFactory,
  6302. fontCache: this.fontCache,
  6303. builtInCMapCache: this.builtInCMapCache,
  6304. standardFontDataCache: this.standardFontDataCache,
  6305. globalImageCache: this.globalImageCache,
  6306. options: this.evaluatorOptions
  6307. });
  6308. return this._parsedAnnotations.then(function (annotations) {
  6309. const newRefsPromises = [];
  6310. for (const annotation of annotations) {
  6311. if (!annotation.mustBePrinted(annotationStorage)) {
  6312. continue;
  6313. }
  6314. newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) {
  6315. (0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  6316. return null;
  6317. }));
  6318. }
  6319. return Promise.all(newRefsPromises).then(function (newRefs) {
  6320. return newRefs.filter(newRef => !!newRef);
  6321. });
  6322. });
  6323. }
  6324. loadResources(keys) {
  6325. if (!this.resourcesPromise) {
  6326. this.resourcesPromise = this.pdfManager.ensure(this, "resources");
  6327. }
  6328. return this.resourcesPromise.then(() => {
  6329. const objectLoader = new _object_loader.ObjectLoader(this.resources, keys, this.xref);
  6330. return objectLoader.load();
  6331. });
  6332. }
  6333. getOperatorList(_ref2) {
  6334. let {
  6335. handler,
  6336. sink,
  6337. task,
  6338. intent,
  6339. cacheKey,
  6340. annotationStorage = null
  6341. } = _ref2;
  6342. const contentStreamPromise = this.getContentStream(handler);
  6343. const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]);
  6344. const partialEvaluator = new _evaluator.PartialEvaluator({
  6345. xref: this.xref,
  6346. handler,
  6347. pageIndex: this.pageIndex,
  6348. idFactory: this._localIdFactory,
  6349. fontCache: this.fontCache,
  6350. builtInCMapCache: this.builtInCMapCache,
  6351. standardFontDataCache: this.standardFontDataCache,
  6352. globalImageCache: this.globalImageCache,
  6353. options: this.evaluatorOptions
  6354. });
  6355. const newAnnotationsByPage = !this.xfaFactory ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null;
  6356. let newAnnotationsPromise = Promise.resolve(null);
  6357. if (newAnnotationsByPage) {
  6358. const newAnnotations = newAnnotationsByPage.get(this.pageIndex);
  6359. if (newAnnotations) {
  6360. newAnnotationsPromise = _annotation.AnnotationFactory.printNewAnnotations(partialEvaluator, task, newAnnotations);
  6361. }
  6362. }
  6363. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  6364. const pageListPromise = dataPromises.then(_ref3 => {
  6365. let [contentStream] = _ref3;
  6366. const opList = new _operator_list.OperatorList(intent, sink);
  6367. handler.send("StartRenderPage", {
  6368. transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
  6369. pageIndex: this.pageIndex,
  6370. cacheKey
  6371. });
  6372. return partialEvaluator.getOperatorList({
  6373. stream: contentStream,
  6374. task,
  6375. resources: this.resources,
  6376. operatorList: opList
  6377. }).then(function () {
  6378. return opList;
  6379. });
  6380. });
  6381. return Promise.all([pageListPromise, this._parsedAnnotations, newAnnotationsPromise]).then(function (_ref4) {
  6382. let [pageOpList, annotations, newAnnotations] = _ref4;
  6383. if (newAnnotations) {
  6384. annotations = annotations.concat(newAnnotations);
  6385. }
  6386. if (annotations.length === 0 || intent & _util.RenderingIntentFlag.ANNOTATIONS_DISABLE) {
  6387. pageOpList.flush(true);
  6388. return {
  6389. length: pageOpList.totalLength
  6390. };
  6391. }
  6392. const renderForms = !!(intent & _util.RenderingIntentFlag.ANNOTATIONS_FORMS),
  6393. intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  6394. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  6395. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  6396. const opListPromises = [];
  6397. for (const annotation of annotations) {
  6398. if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage) || intentPrint && annotation.mustBePrinted(annotationStorage)) {
  6399. opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, renderForms, annotationStorage).catch(function (reason) {
  6400. (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  6401. return {
  6402. opList: null,
  6403. separateForm: false,
  6404. separateCanvas: false
  6405. };
  6406. }));
  6407. }
  6408. }
  6409. return Promise.all(opListPromises).then(function (opLists) {
  6410. let form = false,
  6411. canvas = false;
  6412. for (const {
  6413. opList,
  6414. separateForm,
  6415. separateCanvas
  6416. } of opLists) {
  6417. pageOpList.addOpList(opList);
  6418. if (separateForm) {
  6419. form = separateForm;
  6420. }
  6421. if (separateCanvas) {
  6422. canvas = separateCanvas;
  6423. }
  6424. }
  6425. pageOpList.flush(true, {
  6426. form,
  6427. canvas
  6428. });
  6429. return {
  6430. length: pageOpList.totalLength
  6431. };
  6432. });
  6433. });
  6434. }
  6435. extractTextContent(_ref5) {
  6436. let {
  6437. handler,
  6438. task,
  6439. includeMarkedContent,
  6440. sink,
  6441. combineTextItems
  6442. } = _ref5;
  6443. const contentStreamPromise = this.getContentStream(handler);
  6444. const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]);
  6445. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  6446. return dataPromises.then(_ref6 => {
  6447. let [contentStream] = _ref6;
  6448. const partialEvaluator = new _evaluator.PartialEvaluator({
  6449. xref: this.xref,
  6450. handler,
  6451. pageIndex: this.pageIndex,
  6452. idFactory: this._localIdFactory,
  6453. fontCache: this.fontCache,
  6454. builtInCMapCache: this.builtInCMapCache,
  6455. standardFontDataCache: this.standardFontDataCache,
  6456. globalImageCache: this.globalImageCache,
  6457. options: this.evaluatorOptions
  6458. });
  6459. return partialEvaluator.getTextContent({
  6460. stream: contentStream,
  6461. task,
  6462. resources: this.resources,
  6463. includeMarkedContent,
  6464. combineTextItems,
  6465. sink,
  6466. viewBox: this.view
  6467. });
  6468. });
  6469. }
  6470. async getStructTree() {
  6471. const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot");
  6472. if (!structTreeRoot) {
  6473. return null;
  6474. }
  6475. const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]);
  6476. return structTree.serializable;
  6477. }
  6478. _parseStructTree(structTreeRoot) {
  6479. const tree = new _struct_tree.StructTreePage(structTreeRoot, this.pageDict);
  6480. tree.parse();
  6481. return tree;
  6482. }
  6483. async getAnnotationsData(handler, task, intent) {
  6484. const annotations = await this._parsedAnnotations;
  6485. if (annotations.length === 0) {
  6486. return [];
  6487. }
  6488. const textContentPromises = [];
  6489. const annotationsData = [];
  6490. let partialEvaluator;
  6491. const intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  6492. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  6493. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  6494. for (const annotation of annotations) {
  6495. const isVisible = intentAny || intentDisplay && annotation.viewable;
  6496. if (isVisible || intentPrint && annotation.printable) {
  6497. annotationsData.push(annotation.data);
  6498. }
  6499. if (annotation.hasTextContent && isVisible) {
  6500. if (!partialEvaluator) {
  6501. partialEvaluator = new _evaluator.PartialEvaluator({
  6502. xref: this.xref,
  6503. handler,
  6504. pageIndex: this.pageIndex,
  6505. idFactory: this._localIdFactory,
  6506. fontCache: this.fontCache,
  6507. builtInCMapCache: this.builtInCMapCache,
  6508. standardFontDataCache: this.standardFontDataCache,
  6509. globalImageCache: this.globalImageCache,
  6510. options: this.evaluatorOptions
  6511. });
  6512. }
  6513. textContentPromises.push(annotation.extractTextContent(partialEvaluator, task, this.view).catch(function (reason) {
  6514. (0, _util.warn)(`getAnnotationsData - ignoring textContent during "${task.name}" task: "${reason}".`);
  6515. }));
  6516. }
  6517. }
  6518. await Promise.all(textContentPromises);
  6519. return annotationsData;
  6520. }
  6521. get annotations() {
  6522. const annots = this._getInheritableProperty("Annots");
  6523. return (0, _util.shadow)(this, "annotations", Array.isArray(annots) ? annots : []);
  6524. }
  6525. get _parsedAnnotations() {
  6526. const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
  6527. const annotationPromises = [];
  6528. for (const annotationRef of this.annotations) {
  6529. annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this._localIdFactory, false).catch(function (reason) {
  6530. (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
  6531. return null;
  6532. }));
  6533. }
  6534. return Promise.all(annotationPromises).then(function (annotations) {
  6535. if (annotations.length === 0) {
  6536. return annotations;
  6537. }
  6538. const sortedAnnotations = [];
  6539. let popupAnnotations;
  6540. for (const annotation of annotations) {
  6541. if (!annotation) {
  6542. continue;
  6543. }
  6544. if (annotation instanceof _annotation.PopupAnnotation) {
  6545. if (!popupAnnotations) {
  6546. popupAnnotations = [];
  6547. }
  6548. popupAnnotations.push(annotation);
  6549. continue;
  6550. }
  6551. sortedAnnotations.push(annotation);
  6552. }
  6553. if (popupAnnotations) {
  6554. sortedAnnotations.push(...popupAnnotations);
  6555. }
  6556. return sortedAnnotations;
  6557. });
  6558. });
  6559. return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
  6560. }
  6561. get jsActions() {
  6562. const actions = (0, _core_utils.collectActions)(this.xref, this.pageDict, _util.PageActionEventType);
  6563. return (0, _util.shadow)(this, "jsActions", actions);
  6564. }
  6565. }
  6566. exports.Page = Page;
  6567. const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
  6568. const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
  6569. const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
  6570. const FINGERPRINT_FIRST_BYTES = 1024;
  6571. const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  6572. function find(stream, signature) {
  6573. let limit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1024;
  6574. let backwards = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  6575. const signatureLength = signature.length;
  6576. const scanBytes = stream.peekBytes(limit);
  6577. const scanLength = scanBytes.length - signatureLength;
  6578. if (scanLength <= 0) {
  6579. return false;
  6580. }
  6581. if (backwards) {
  6582. const signatureEnd = signatureLength - 1;
  6583. let pos = scanBytes.length - 1;
  6584. while (pos >= signatureEnd) {
  6585. let j = 0;
  6586. while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
  6587. j++;
  6588. }
  6589. if (j >= signatureLength) {
  6590. stream.pos += pos - signatureEnd;
  6591. return true;
  6592. }
  6593. pos--;
  6594. }
  6595. } else {
  6596. let pos = 0;
  6597. while (pos <= scanLength) {
  6598. let j = 0;
  6599. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  6600. j++;
  6601. }
  6602. if (j >= signatureLength) {
  6603. stream.pos += pos;
  6604. return true;
  6605. }
  6606. pos++;
  6607. }
  6608. }
  6609. return false;
  6610. }
  6611. class PDFDocument {
  6612. constructor(pdfManager, stream) {
  6613. if (stream.length <= 0) {
  6614. throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
  6615. }
  6616. this.pdfManager = pdfManager;
  6617. this.stream = stream;
  6618. this.xref = new _xref.XRef(stream, pdfManager);
  6619. this._pagePromises = new Map();
  6620. this._version = null;
  6621. const idCounters = {
  6622. font: 0
  6623. };
  6624. this._globalIdFactory = class {
  6625. static getDocId() {
  6626. return `g_${pdfManager.docId}`;
  6627. }
  6628. static createFontId() {
  6629. return `f${++idCounters.font}`;
  6630. }
  6631. static createObjId() {
  6632. (0, _util.unreachable)("Abstract method `createObjId` called.");
  6633. }
  6634. static getPageObjId() {
  6635. (0, _util.unreachable)("Abstract method `getPageObjId` called.");
  6636. }
  6637. };
  6638. }
  6639. parse(recoveryMode) {
  6640. this.xref.parse(recoveryMode);
  6641. this.catalog = new _catalog.Catalog(this.pdfManager, this.xref);
  6642. }
  6643. get linearization() {
  6644. let linearization = null;
  6645. try {
  6646. linearization = _parser.Linearization.create(this.stream);
  6647. } catch (err) {
  6648. if (err instanceof _core_utils.MissingDataException) {
  6649. throw err;
  6650. }
  6651. (0, _util.info)(err);
  6652. }
  6653. return (0, _util.shadow)(this, "linearization", linearization);
  6654. }
  6655. get startXRef() {
  6656. const stream = this.stream;
  6657. let startXRef = 0;
  6658. if (this.linearization) {
  6659. stream.reset();
  6660. if (find(stream, ENDOBJ_SIGNATURE)) {
  6661. startXRef = stream.pos + 6 - stream.start;
  6662. }
  6663. } else {
  6664. const step = 1024;
  6665. const startXRefLength = STARTXREF_SIGNATURE.length;
  6666. let found = false,
  6667. pos = stream.end;
  6668. while (!found && pos > 0) {
  6669. pos -= step - startXRefLength;
  6670. if (pos < 0) {
  6671. pos = 0;
  6672. }
  6673. stream.pos = pos;
  6674. found = find(stream, STARTXREF_SIGNATURE, step, true);
  6675. }
  6676. if (found) {
  6677. stream.skip(9);
  6678. let ch;
  6679. do {
  6680. ch = stream.getByte();
  6681. } while ((0, _core_utils.isWhiteSpace)(ch));
  6682. let str = "";
  6683. while (ch >= 0x20 && ch <= 0x39) {
  6684. str += String.fromCharCode(ch);
  6685. ch = stream.getByte();
  6686. }
  6687. startXRef = parseInt(str, 10);
  6688. if (isNaN(startXRef)) {
  6689. startXRef = 0;
  6690. }
  6691. }
  6692. }
  6693. return (0, _util.shadow)(this, "startXRef", startXRef);
  6694. }
  6695. checkHeader() {
  6696. const stream = this.stream;
  6697. stream.reset();
  6698. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  6699. return;
  6700. }
  6701. stream.moveStart();
  6702. stream.skip(PDF_HEADER_SIGNATURE.length);
  6703. let version = "",
  6704. ch;
  6705. while ((ch = stream.getByte()) > 0x20 && version.length < 7) {
  6706. version += String.fromCharCode(ch);
  6707. }
  6708. if (_core_utils.PDF_VERSION_REGEXP.test(version)) {
  6709. this._version = version;
  6710. } else {
  6711. (0, _util.warn)(`Invalid PDF header version: ${version}`);
  6712. }
  6713. }
  6714. parseStartXRef() {
  6715. this.xref.setStartXRef(this.startXRef);
  6716. }
  6717. get numPages() {
  6718. let num = 0;
  6719. if (this.catalog.hasActualNumPages) {
  6720. num = this.catalog.numPages;
  6721. } else if (this.xfaFactory) {
  6722. num = this.xfaFactory.getNumPages();
  6723. } else if (this.linearization) {
  6724. num = this.linearization.numPages;
  6725. } else {
  6726. num = this.catalog.numPages;
  6727. }
  6728. return (0, _util.shadow)(this, "numPages", num);
  6729. }
  6730. _hasOnlyDocumentSignatures(fields) {
  6731. let recursionDepth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  6732. const RECURSION_LIMIT = 10;
  6733. if (!Array.isArray(fields)) {
  6734. return false;
  6735. }
  6736. return fields.every(field => {
  6737. field = this.xref.fetchIfRef(field);
  6738. if (!(field instanceof _primitives.Dict)) {
  6739. return false;
  6740. }
  6741. if (field.has("Kids")) {
  6742. if (++recursionDepth > RECURSION_LIMIT) {
  6743. (0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached");
  6744. return false;
  6745. }
  6746. return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
  6747. }
  6748. const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig");
  6749. const rectangle = field.get("Rect");
  6750. const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
  6751. return isSignature && isInvisible;
  6752. });
  6753. }
  6754. get _xfaStreams() {
  6755. const acroForm = this.catalog.acroForm;
  6756. if (!acroForm) {
  6757. return null;
  6758. }
  6759. const xfa = acroForm.get("XFA");
  6760. const entries = {
  6761. "xdp:xdp": "",
  6762. template: "",
  6763. datasets: "",
  6764. config: "",
  6765. connectionSet: "",
  6766. localeSet: "",
  6767. stylesheet: "",
  6768. "/xdp:xdp": ""
  6769. };
  6770. if (xfa instanceof _base_stream.BaseStream && !xfa.isEmpty) {
  6771. entries["xdp:xdp"] = xfa;
  6772. return entries;
  6773. }
  6774. if (!Array.isArray(xfa) || xfa.length === 0) {
  6775. return null;
  6776. }
  6777. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  6778. let name;
  6779. if (i === 0) {
  6780. name = "xdp:xdp";
  6781. } else if (i === ii - 2) {
  6782. name = "/xdp:xdp";
  6783. } else {
  6784. name = xfa[i];
  6785. }
  6786. if (!entries.hasOwnProperty(name)) {
  6787. continue;
  6788. }
  6789. const data = this.xref.fetchIfRef(xfa[i + 1]);
  6790. if (!(data instanceof _base_stream.BaseStream) || data.isEmpty) {
  6791. continue;
  6792. }
  6793. entries[name] = data;
  6794. }
  6795. return entries;
  6796. }
  6797. get xfaDatasets() {
  6798. const streams = this._xfaStreams;
  6799. if (!streams) {
  6800. return (0, _util.shadow)(this, "xfaDatasets", null);
  6801. }
  6802. for (const key of ["datasets", "xdp:xdp"]) {
  6803. const stream = streams[key];
  6804. if (!stream) {
  6805. continue;
  6806. }
  6807. try {
  6808. const str = (0, _util.stringToUTF8String)(stream.getString());
  6809. const data = {
  6810. [key]: str
  6811. };
  6812. return (0, _util.shadow)(this, "xfaDatasets", new _dataset_reader.DatasetReader(data));
  6813. } catch (_) {
  6814. (0, _util.warn)("XFA - Invalid utf-8 string.");
  6815. break;
  6816. }
  6817. }
  6818. return (0, _util.shadow)(this, "xfaDatasets", null);
  6819. }
  6820. get xfaData() {
  6821. const streams = this._xfaStreams;
  6822. if (!streams) {
  6823. return null;
  6824. }
  6825. const data = Object.create(null);
  6826. for (const [key, stream] of Object.entries(streams)) {
  6827. if (!stream) {
  6828. continue;
  6829. }
  6830. try {
  6831. data[key] = (0, _util.stringToUTF8String)(stream.getString());
  6832. } catch (_) {
  6833. (0, _util.warn)("XFA - Invalid utf-8 string.");
  6834. return null;
  6835. }
  6836. }
  6837. return data;
  6838. }
  6839. get xfaFactory() {
  6840. let data;
  6841. if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
  6842. data = this.xfaData;
  6843. }
  6844. return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null);
  6845. }
  6846. get isPureXfa() {
  6847. return this.xfaFactory ? this.xfaFactory.isValid() : false;
  6848. }
  6849. get htmlForXfa() {
  6850. return this.xfaFactory ? this.xfaFactory.getPages() : null;
  6851. }
  6852. async loadXfaImages() {
  6853. const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages");
  6854. if (!xfaImagesDict) {
  6855. return;
  6856. }
  6857. const keys = xfaImagesDict.getKeys();
  6858. const objectLoader = new _object_loader.ObjectLoader(xfaImagesDict, keys, this.xref);
  6859. await objectLoader.load();
  6860. const xfaImages = new Map();
  6861. for (const key of keys) {
  6862. const stream = xfaImagesDict.get(key);
  6863. if (stream instanceof _base_stream.BaseStream) {
  6864. xfaImages.set(key, stream.getBytes());
  6865. }
  6866. }
  6867. this.xfaFactory.setImages(xfaImages);
  6868. }
  6869. async loadXfaFonts(handler, task) {
  6870. const acroForm = await this.pdfManager.ensureCatalog("acroForm");
  6871. if (!acroForm) {
  6872. return;
  6873. }
  6874. const resources = await acroForm.getAsync("DR");
  6875. if (!(resources instanceof _primitives.Dict)) {
  6876. return;
  6877. }
  6878. const objectLoader = new _object_loader.ObjectLoader(resources, ["Font"], this.xref);
  6879. await objectLoader.load();
  6880. const fontRes = resources.get("Font");
  6881. if (!(fontRes instanceof _primitives.Dict)) {
  6882. return;
  6883. }
  6884. const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions);
  6885. options.useSystemFonts = false;
  6886. const partialEvaluator = new _evaluator.PartialEvaluator({
  6887. xref: this.xref,
  6888. handler,
  6889. pageIndex: -1,
  6890. idFactory: this._globalIdFactory,
  6891. fontCache: this.catalog.fontCache,
  6892. builtInCMapCache: this.catalog.builtInCMapCache,
  6893. standardFontDataCache: this.catalog.standardFontDataCache,
  6894. options
  6895. });
  6896. const operatorList = new _operator_list.OperatorList();
  6897. const pdfFonts = [];
  6898. const initialState = {
  6899. get font() {
  6900. return pdfFonts.at(-1);
  6901. },
  6902. set font(font) {
  6903. pdfFonts.push(font);
  6904. },
  6905. clone() {
  6906. return this;
  6907. }
  6908. };
  6909. const fonts = new Map();
  6910. fontRes.forEach((fontName, font) => {
  6911. fonts.set(fontName, font);
  6912. });
  6913. const promises = [];
  6914. for (const [fontName, font] of fonts) {
  6915. const descriptor = font.get("FontDescriptor");
  6916. if (!(descriptor instanceof _primitives.Dict)) {
  6917. continue;
  6918. }
  6919. let fontFamily = descriptor.get("FontFamily");
  6920. fontFamily = fontFamily.replace(/[ ]+(\d)/g, "$1");
  6921. const fontWeight = descriptor.get("FontWeight");
  6922. const italicAngle = -descriptor.get("ItalicAngle");
  6923. const cssFontInfo = {
  6924. fontFamily,
  6925. fontWeight,
  6926. italicAngle
  6927. };
  6928. if (!(0, _core_utils.validateCSSFont)(cssFontInfo)) {
  6929. continue;
  6930. }
  6931. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(fontName), 1], null, operatorList, task, initialState, null, cssFontInfo).catch(function (reason) {
  6932. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  6933. return null;
  6934. }));
  6935. }
  6936. await Promise.all(promises);
  6937. const missingFonts = this.xfaFactory.setFonts(pdfFonts);
  6938. if (!missingFonts) {
  6939. return;
  6940. }
  6941. options.ignoreErrors = true;
  6942. promises.length = 0;
  6943. pdfFonts.length = 0;
  6944. const reallyMissingFonts = new Set();
  6945. for (const missing of missingFonts) {
  6946. if (!(0, _xfa_fonts.getXfaFontName)(`${missing}-Regular`)) {
  6947. reallyMissingFonts.add(missing);
  6948. }
  6949. }
  6950. if (reallyMissingFonts.size) {
  6951. missingFonts.push("PdfJS-Fallback");
  6952. }
  6953. for (const missing of missingFonts) {
  6954. if (reallyMissingFonts.has(missing)) {
  6955. continue;
  6956. }
  6957. for (const fontInfo of [{
  6958. name: "Regular",
  6959. fontWeight: 400,
  6960. italicAngle: 0
  6961. }, {
  6962. name: "Bold",
  6963. fontWeight: 700,
  6964. italicAngle: 0
  6965. }, {
  6966. name: "Italic",
  6967. fontWeight: 400,
  6968. italicAngle: 12
  6969. }, {
  6970. name: "BoldItalic",
  6971. fontWeight: 700,
  6972. italicAngle: 12
  6973. }]) {
  6974. const name = `${missing}-${fontInfo.name}`;
  6975. const dict = (0, _xfa_fonts.getXfaFontDict)(name);
  6976. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(name), 1], null, operatorList, task, initialState, dict, {
  6977. fontFamily: missing,
  6978. fontWeight: fontInfo.fontWeight,
  6979. italicAngle: fontInfo.italicAngle
  6980. }).catch(function (reason) {
  6981. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  6982. return null;
  6983. }));
  6984. }
  6985. }
  6986. await Promise.all(promises);
  6987. this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts);
  6988. }
  6989. async serializeXfaData(annotationStorage) {
  6990. return this.xfaFactory ? this.xfaFactory.serializeData(annotationStorage) : null;
  6991. }
  6992. get version() {
  6993. return this.catalog.version || this._version;
  6994. }
  6995. get formInfo() {
  6996. const formInfo = {
  6997. hasFields: false,
  6998. hasAcroForm: false,
  6999. hasXfa: false,
  7000. hasSignatures: false
  7001. };
  7002. const acroForm = this.catalog.acroForm;
  7003. if (!acroForm) {
  7004. return (0, _util.shadow)(this, "formInfo", formInfo);
  7005. }
  7006. try {
  7007. const fields = acroForm.get("Fields");
  7008. const hasFields = Array.isArray(fields) && fields.length > 0;
  7009. formInfo.hasFields = hasFields;
  7010. const xfa = acroForm.get("XFA");
  7011. formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || xfa instanceof _base_stream.BaseStream && !xfa.isEmpty;
  7012. const sigFlags = acroForm.get("SigFlags");
  7013. const hasSignatures = !!(sigFlags & 0x1);
  7014. const hasOnlyDocumentSignatures = hasSignatures && this._hasOnlyDocumentSignatures(fields);
  7015. formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
  7016. formInfo.hasSignatures = hasSignatures;
  7017. } catch (ex) {
  7018. if (ex instanceof _core_utils.MissingDataException) {
  7019. throw ex;
  7020. }
  7021. (0, _util.warn)(`Cannot fetch form information: "${ex}".`);
  7022. }
  7023. return (0, _util.shadow)(this, "formInfo", formInfo);
  7024. }
  7025. get documentInfo() {
  7026. const docInfo = {
  7027. PDFFormatVersion: this.version,
  7028. Language: this.catalog.lang,
  7029. EncryptFilterName: this.xref.encrypt ? this.xref.encrypt.filterName : null,
  7030. IsLinearized: !!this.linearization,
  7031. IsAcroFormPresent: this.formInfo.hasAcroForm,
  7032. IsXFAPresent: this.formInfo.hasXfa,
  7033. IsCollectionPresent: !!this.catalog.collection,
  7034. IsSignaturesPresent: this.formInfo.hasSignatures
  7035. };
  7036. let infoDict;
  7037. try {
  7038. infoDict = this.xref.trailer.get("Info");
  7039. } catch (err) {
  7040. if (err instanceof _core_utils.MissingDataException) {
  7041. throw err;
  7042. }
  7043. (0, _util.info)("The document information dictionary is invalid.");
  7044. }
  7045. if (!(infoDict instanceof _primitives.Dict)) {
  7046. return (0, _util.shadow)(this, "documentInfo", docInfo);
  7047. }
  7048. for (const key of infoDict.getKeys()) {
  7049. const value = infoDict.get(key);
  7050. switch (key) {
  7051. case "Title":
  7052. case "Author":
  7053. case "Subject":
  7054. case "Keywords":
  7055. case "Creator":
  7056. case "Producer":
  7057. case "CreationDate":
  7058. case "ModDate":
  7059. if (typeof value === "string") {
  7060. docInfo[key] = (0, _util.stringToPDFString)(value);
  7061. continue;
  7062. }
  7063. break;
  7064. case "Trapped":
  7065. if (value instanceof _primitives.Name) {
  7066. docInfo[key] = value;
  7067. continue;
  7068. }
  7069. break;
  7070. default:
  7071. let customValue;
  7072. switch (typeof value) {
  7073. case "string":
  7074. customValue = (0, _util.stringToPDFString)(value);
  7075. break;
  7076. case "number":
  7077. case "boolean":
  7078. customValue = value;
  7079. break;
  7080. default:
  7081. if (value instanceof _primitives.Name) {
  7082. customValue = value;
  7083. }
  7084. break;
  7085. }
  7086. if (customValue === undefined) {
  7087. (0, _util.warn)(`Bad value, for custom key "${key}", in Info: ${value}.`);
  7088. continue;
  7089. }
  7090. if (!docInfo.Custom) {
  7091. docInfo.Custom = Object.create(null);
  7092. }
  7093. docInfo.Custom[key] = customValue;
  7094. continue;
  7095. }
  7096. (0, _util.warn)(`Bad value, for key "${key}", in Info: ${value}.`);
  7097. }
  7098. return (0, _util.shadow)(this, "documentInfo", docInfo);
  7099. }
  7100. get fingerprints() {
  7101. function validate(data) {
  7102. return typeof data === "string" && data.length > 0 && data !== EMPTY_FINGERPRINT;
  7103. }
  7104. function hexString(hash) {
  7105. const buf = [];
  7106. for (const num of hash) {
  7107. const hex = num.toString(16);
  7108. buf.push(hex.padStart(2, "0"));
  7109. }
  7110. return buf.join("");
  7111. }
  7112. const idArray = this.xref.trailer.get("ID");
  7113. let hashOriginal, hashModified;
  7114. if (Array.isArray(idArray) && validate(idArray[0])) {
  7115. hashOriginal = (0, _util.stringToBytes)(idArray[0]);
  7116. if (idArray[1] !== idArray[0] && validate(idArray[1])) {
  7117. hashModified = (0, _util.stringToBytes)(idArray[1]);
  7118. }
  7119. } else {
  7120. hashOriginal = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  7121. }
  7122. return (0, _util.shadow)(this, "fingerprints", [hexString(hashOriginal), hashModified ? hexString(hashModified) : null]);
  7123. }
  7124. async _getLinearizationPage(pageIndex) {
  7125. const {
  7126. catalog,
  7127. linearization,
  7128. xref
  7129. } = this;
  7130. const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
  7131. try {
  7132. const obj = await xref.fetchAsync(ref);
  7133. if (obj instanceof _primitives.Dict) {
  7134. let type = obj.getRaw("Type");
  7135. if (type instanceof _primitives.Ref) {
  7136. type = await xref.fetchAsync(type);
  7137. }
  7138. if ((0, _primitives.isName)(type, "Page") || !obj.has("Type") && !obj.has("Kids")) {
  7139. if (!catalog.pageKidsCountCache.has(ref)) {
  7140. catalog.pageKidsCountCache.put(ref, 1);
  7141. }
  7142. if (!catalog.pageIndexCache.has(ref)) {
  7143. catalog.pageIndexCache.put(ref, 0);
  7144. }
  7145. return [obj, ref];
  7146. }
  7147. }
  7148. throw new _util.FormatError("The Linearization dictionary doesn't point to a valid Page dictionary.");
  7149. } catch (reason) {
  7150. (0, _util.warn)(`_getLinearizationPage: "${reason.message}".`);
  7151. return catalog.getPageDict(pageIndex);
  7152. }
  7153. }
  7154. getPage(pageIndex) {
  7155. const cachedPromise = this._pagePromises.get(pageIndex);
  7156. if (cachedPromise) {
  7157. return cachedPromise;
  7158. }
  7159. const {
  7160. catalog,
  7161. linearization,
  7162. xfaFactory
  7163. } = this;
  7164. let promise;
  7165. if (xfaFactory) {
  7166. promise = Promise.resolve([_primitives.Dict.empty, null]);
  7167. } else if (linearization && linearization.pageFirst === pageIndex) {
  7168. promise = this._getLinearizationPage(pageIndex);
  7169. } else {
  7170. promise = catalog.getPageDict(pageIndex);
  7171. }
  7172. promise = promise.then(_ref7 => {
  7173. let [pageDict, ref] = _ref7;
  7174. return new Page({
  7175. pdfManager: this.pdfManager,
  7176. xref: this.xref,
  7177. pageIndex,
  7178. pageDict,
  7179. ref,
  7180. globalIdFactory: this._globalIdFactory,
  7181. fontCache: catalog.fontCache,
  7182. builtInCMapCache: catalog.builtInCMapCache,
  7183. standardFontDataCache: catalog.standardFontDataCache,
  7184. globalImageCache: catalog.globalImageCache,
  7185. nonBlendModesSet: catalog.nonBlendModesSet,
  7186. xfaFactory
  7187. });
  7188. });
  7189. this._pagePromises.set(pageIndex, promise);
  7190. return promise;
  7191. }
  7192. async checkFirstPage() {
  7193. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  7194. if (recoveryMode) {
  7195. return;
  7196. }
  7197. try {
  7198. await this.getPage(0);
  7199. } catch (reason) {
  7200. if (reason instanceof _core_utils.XRefEntryException) {
  7201. this._pagePromises.delete(0);
  7202. await this.cleanup();
  7203. throw new _core_utils.XRefParseException();
  7204. }
  7205. }
  7206. }
  7207. async checkLastPage() {
  7208. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  7209. const {
  7210. catalog,
  7211. pdfManager
  7212. } = this;
  7213. catalog.setActualNumPages();
  7214. let numPages;
  7215. try {
  7216. await Promise.all([pdfManager.ensureDoc("xfaFactory"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("numPages")]);
  7217. if (this.xfaFactory) {
  7218. return;
  7219. } else if (this.linearization) {
  7220. numPages = this.linearization.numPages;
  7221. } else {
  7222. numPages = catalog.numPages;
  7223. }
  7224. if (!Number.isInteger(numPages)) {
  7225. throw new _util.FormatError("Page count is not an integer.");
  7226. } else if (numPages <= 1) {
  7227. return;
  7228. }
  7229. await this.getPage(numPages - 1);
  7230. } catch (reason) {
  7231. this._pagePromises.delete(numPages - 1);
  7232. await this.cleanup();
  7233. if (reason instanceof _core_utils.XRefEntryException && !recoveryMode) {
  7234. throw new _core_utils.XRefParseException();
  7235. }
  7236. (0, _util.warn)(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`);
  7237. let pagesTree;
  7238. try {
  7239. pagesTree = await catalog.getAllPageDicts(recoveryMode);
  7240. } catch (reasonAll) {
  7241. if (reasonAll instanceof _core_utils.XRefEntryException && !recoveryMode) {
  7242. throw new _core_utils.XRefParseException();
  7243. }
  7244. catalog.setActualNumPages(1);
  7245. return;
  7246. }
  7247. for (const [pageIndex, [pageDict, ref]] of pagesTree) {
  7248. let promise;
  7249. if (pageDict instanceof Error) {
  7250. promise = Promise.reject(pageDict);
  7251. promise.catch(() => {});
  7252. } else {
  7253. promise = Promise.resolve(new Page({
  7254. pdfManager,
  7255. xref: this.xref,
  7256. pageIndex,
  7257. pageDict,
  7258. ref,
  7259. globalIdFactory: this._globalIdFactory,
  7260. fontCache: catalog.fontCache,
  7261. builtInCMapCache: catalog.builtInCMapCache,
  7262. standardFontDataCache: catalog.standardFontDataCache,
  7263. globalImageCache: catalog.globalImageCache,
  7264. nonBlendModesSet: catalog.nonBlendModesSet,
  7265. xfaFactory: null
  7266. }));
  7267. }
  7268. this._pagePromises.set(pageIndex, promise);
  7269. }
  7270. catalog.setActualNumPages(pagesTree.size);
  7271. }
  7272. }
  7273. fontFallback(id, handler) {
  7274. return this.catalog.fontFallback(id, handler);
  7275. }
  7276. async cleanup() {
  7277. let manuallyTriggered = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  7278. return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _cleanup_helper.clearGlobalCaches)();
  7279. }
  7280. _collectFieldObjects(name, fieldRef, promises) {
  7281. const field = this.xref.fetchIfRef(fieldRef);
  7282. if (field.has("T")) {
  7283. const partName = (0, _util.stringToPDFString)(field.get("T"));
  7284. if (name === "") {
  7285. name = partName;
  7286. } else {
  7287. name = `${name}.${partName}`;
  7288. }
  7289. }
  7290. if (!promises.has(name)) {
  7291. promises.set(name, []);
  7292. }
  7293. promises.get(name).push(_annotation.AnnotationFactory.create(this.xref, fieldRef, this.pdfManager, this._localIdFactory, true).then(annotation => annotation && annotation.getFieldObject()).catch(function (reason) {
  7294. (0, _util.warn)(`_collectFieldObjects: "${reason}".`);
  7295. return null;
  7296. }));
  7297. if (field.has("Kids")) {
  7298. const kids = field.get("Kids");
  7299. for (const kid of kids) {
  7300. this._collectFieldObjects(name, kid, promises);
  7301. }
  7302. }
  7303. }
  7304. get fieldObjects() {
  7305. if (!this.formInfo.hasFields) {
  7306. return (0, _util.shadow)(this, "fieldObjects", Promise.resolve(null));
  7307. }
  7308. const allFields = Object.create(null);
  7309. const fieldPromises = new Map();
  7310. for (const fieldRef of this.catalog.acroForm.get("Fields")) {
  7311. this._collectFieldObjects("", fieldRef, fieldPromises);
  7312. }
  7313. const allPromises = [];
  7314. for (const [name, promises] of fieldPromises) {
  7315. allPromises.push(Promise.all(promises).then(fields => {
  7316. fields = fields.filter(field => !!field);
  7317. if (fields.length > 0) {
  7318. allFields[name] = fields;
  7319. }
  7320. }));
  7321. }
  7322. return (0, _util.shadow)(this, "fieldObjects", Promise.all(allPromises).then(() => allFields));
  7323. }
  7324. get hasJSActions() {
  7325. const promise = this.pdfManager.ensureDoc("_parseHasJSActions");
  7326. return (0, _util.shadow)(this, "hasJSActions", promise);
  7327. }
  7328. async _parseHasJSActions() {
  7329. const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]);
  7330. if (catalogJsActions) {
  7331. return true;
  7332. }
  7333. if (fieldObjects) {
  7334. return Object.values(fieldObjects).some(fieldObject => fieldObject.some(object => object.actions !== null));
  7335. }
  7336. return false;
  7337. }
  7338. get calculationOrderIds() {
  7339. const acroForm = this.catalog.acroForm;
  7340. if (!acroForm || !acroForm.has("CO")) {
  7341. return (0, _util.shadow)(this, "calculationOrderIds", null);
  7342. }
  7343. const calculationOrder = acroForm.get("CO");
  7344. if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
  7345. return (0, _util.shadow)(this, "calculationOrderIds", null);
  7346. }
  7347. const ids = [];
  7348. for (const id of calculationOrder) {
  7349. if (id instanceof _primitives.Ref) {
  7350. ids.push(id.toString());
  7351. }
  7352. }
  7353. if (ids.length === 0) {
  7354. return (0, _util.shadow)(this, "calculationOrderIds", null);
  7355. }
  7356. return (0, _util.shadow)(this, "calculationOrderIds", ids);
  7357. }
  7358. }
  7359. exports.PDFDocument = PDFDocument;
  7360. /***/ }),
  7361. /* 143 */
  7362. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  7363. "use strict";
  7364. Object.defineProperty(exports, "__esModule", ({
  7365. value: true
  7366. }));
  7367. exports.PopupAnnotation = exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
  7368. exports.getQuadPoints = getQuadPoints;
  7369. var _util = __w_pdfjs_require__(2);
  7370. var _core_utils = __w_pdfjs_require__(136);
  7371. var _default_appearance = __w_pdfjs_require__(144);
  7372. var _primitives = __w_pdfjs_require__(137);
  7373. var _writer = __w_pdfjs_require__(196);
  7374. var _base_stream = __w_pdfjs_require__(138);
  7375. var _bidi = __w_pdfjs_require__(191);
  7376. var _catalog = __w_pdfjs_require__(200);
  7377. var _colorspace = __w_pdfjs_require__(145);
  7378. var _file_spec = __w_pdfjs_require__(203);
  7379. var _object_loader = __w_pdfjs_require__(206);
  7380. var _operator_list = __w_pdfjs_require__(193);
  7381. var _stream = __w_pdfjs_require__(141);
  7382. var _factory = __w_pdfjs_require__(207);
  7383. class AnnotationFactory {
  7384. static create(xref, ref, pdfManager, idFactory, collectFields) {
  7385. return Promise.all([pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("baseUrl"), pdfManager.ensureCatalog("attachments"), pdfManager.ensureDoc("xfaDatasets"), collectFields ? this._getPageIndex(xref, ref, pdfManager) : -1]).then(_ref => {
  7386. let [acroForm, baseUrl, attachments, xfaDatasets, pageIndex] = _ref;
  7387. return pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory, acroForm, attachments, xfaDatasets, collectFields, pageIndex]);
  7388. });
  7389. }
  7390. static _create(xref, ref, pdfManager, idFactory, acroForm) {
  7391. let attachments = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
  7392. let xfaDatasets = arguments.length > 6 ? arguments[6] : undefined;
  7393. let collectFields = arguments.length > 7 ? arguments[7] : undefined;
  7394. let pageIndex = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : -1;
  7395. const dict = xref.fetchIfRef(ref);
  7396. if (!(dict instanceof _primitives.Dict)) {
  7397. return undefined;
  7398. }
  7399. const id = ref instanceof _primitives.Ref ? ref.toString() : `annot_${idFactory.createObjId()}`;
  7400. let subtype = dict.get("Subtype");
  7401. subtype = subtype instanceof _primitives.Name ? subtype.name : null;
  7402. const acroFormDict = acroForm instanceof _primitives.Dict ? acroForm : _primitives.Dict.empty;
  7403. const parameters = {
  7404. xref,
  7405. ref,
  7406. dict,
  7407. subtype,
  7408. id,
  7409. pdfManager,
  7410. acroForm: acroFormDict,
  7411. attachments,
  7412. xfaDatasets,
  7413. collectFields,
  7414. needAppearances: !collectFields && acroFormDict.get("NeedAppearances") === true,
  7415. pageIndex,
  7416. isOffscreenCanvasSupported: _util.FeatureTest.isOffscreenCanvasSupported && pdfManager.evaluatorOptions.isOffscreenCanvasSupported
  7417. };
  7418. switch (subtype) {
  7419. case "Link":
  7420. return new LinkAnnotation(parameters);
  7421. case "Text":
  7422. return new TextAnnotation(parameters);
  7423. case "Widget":
  7424. let fieldType = (0, _core_utils.getInheritableProperty)({
  7425. dict,
  7426. key: "FT"
  7427. });
  7428. fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  7429. switch (fieldType) {
  7430. case "Tx":
  7431. return new TextWidgetAnnotation(parameters);
  7432. case "Btn":
  7433. return new ButtonWidgetAnnotation(parameters);
  7434. case "Ch":
  7435. return new ChoiceWidgetAnnotation(parameters);
  7436. case "Sig":
  7437. return new SignatureWidgetAnnotation(parameters);
  7438. }
  7439. (0, _util.warn)(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type.");
  7440. return new WidgetAnnotation(parameters);
  7441. case "Popup":
  7442. return new PopupAnnotation(parameters);
  7443. case "FreeText":
  7444. return new FreeTextAnnotation(parameters);
  7445. case "Line":
  7446. return new LineAnnotation(parameters);
  7447. case "Square":
  7448. return new SquareAnnotation(parameters);
  7449. case "Circle":
  7450. return new CircleAnnotation(parameters);
  7451. case "PolyLine":
  7452. return new PolylineAnnotation(parameters);
  7453. case "Polygon":
  7454. return new PolygonAnnotation(parameters);
  7455. case "Caret":
  7456. return new CaretAnnotation(parameters);
  7457. case "Ink":
  7458. return new InkAnnotation(parameters);
  7459. case "Highlight":
  7460. return new HighlightAnnotation(parameters);
  7461. case "Underline":
  7462. return new UnderlineAnnotation(parameters);
  7463. case "Squiggly":
  7464. return new SquigglyAnnotation(parameters);
  7465. case "StrikeOut":
  7466. return new StrikeOutAnnotation(parameters);
  7467. case "Stamp":
  7468. return new StampAnnotation(parameters);
  7469. case "FileAttachment":
  7470. return new FileAttachmentAnnotation(parameters);
  7471. default:
  7472. if (!collectFields) {
  7473. if (!subtype) {
  7474. (0, _util.warn)("Annotation is missing the required /Subtype.");
  7475. } else {
  7476. (0, _util.warn)(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation.");
  7477. }
  7478. }
  7479. return new Annotation(parameters);
  7480. }
  7481. }
  7482. static async _getPageIndex(xref, ref, pdfManager) {
  7483. try {
  7484. const annotDict = await xref.fetchIfRefAsync(ref);
  7485. if (!(annotDict instanceof _primitives.Dict)) {
  7486. return -1;
  7487. }
  7488. const pageRef = annotDict.getRaw("P");
  7489. if (!(pageRef instanceof _primitives.Ref)) {
  7490. return -1;
  7491. }
  7492. const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  7493. return pageIndex;
  7494. } catch (ex) {
  7495. (0, _util.warn)(`_getPageIndex: "${ex}".`);
  7496. return -1;
  7497. }
  7498. }
  7499. static async saveNewAnnotations(evaluator, task, annotations) {
  7500. const xref = evaluator.xref;
  7501. let baseFontRef;
  7502. const dependencies = [];
  7503. const promises = [];
  7504. for (const annotation of annotations) {
  7505. switch (annotation.annotationType) {
  7506. case _util.AnnotationEditorType.FREETEXT:
  7507. if (!baseFontRef) {
  7508. const baseFont = new _primitives.Dict(xref);
  7509. baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
  7510. baseFont.set("Type", _primitives.Name.get("Font"));
  7511. baseFont.set("Subtype", _primitives.Name.get("Type1"));
  7512. baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  7513. const buffer = [];
  7514. baseFontRef = xref.getNewTemporaryRef();
  7515. (0, _writer.writeObject)(baseFontRef, baseFont, buffer, null);
  7516. dependencies.push({
  7517. ref: baseFontRef,
  7518. data: buffer.join("")
  7519. });
  7520. }
  7521. promises.push(FreeTextAnnotation.createNewAnnotation(xref, annotation, dependencies, {
  7522. evaluator,
  7523. task,
  7524. baseFontRef
  7525. }));
  7526. break;
  7527. case _util.AnnotationEditorType.INK:
  7528. promises.push(InkAnnotation.createNewAnnotation(xref, annotation, dependencies));
  7529. }
  7530. }
  7531. return {
  7532. annotations: await Promise.all(promises),
  7533. dependencies
  7534. };
  7535. }
  7536. static async printNewAnnotations(evaluator, task, annotations) {
  7537. if (!annotations) {
  7538. return null;
  7539. }
  7540. const xref = evaluator.xref;
  7541. const promises = [];
  7542. const isOffscreenCanvasSupported = _util.FeatureTest.isOffscreenCanvasSupported && evaluator.options.isOffscreenCanvasSupported;
  7543. for (const annotation of annotations) {
  7544. switch (annotation.annotationType) {
  7545. case _util.AnnotationEditorType.FREETEXT:
  7546. promises.push(FreeTextAnnotation.createNewPrintAnnotation(xref, annotation, {
  7547. evaluator,
  7548. task,
  7549. isOffscreenCanvasSupported
  7550. }));
  7551. break;
  7552. case _util.AnnotationEditorType.INK:
  7553. promises.push(InkAnnotation.createNewPrintAnnotation(xref, annotation, {
  7554. isOffscreenCanvasSupported
  7555. }));
  7556. break;
  7557. }
  7558. }
  7559. return Promise.all(promises);
  7560. }
  7561. }
  7562. exports.AnnotationFactory = AnnotationFactory;
  7563. function getRgbColor(color) {
  7564. let defaultColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Uint8ClampedArray(3);
  7565. if (!Array.isArray(color)) {
  7566. return defaultColor;
  7567. }
  7568. const rgbColor = defaultColor || new Uint8ClampedArray(3);
  7569. switch (color.length) {
  7570. case 0:
  7571. return null;
  7572. case 1:
  7573. _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  7574. return rgbColor;
  7575. case 3:
  7576. _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  7577. return rgbColor;
  7578. case 4:
  7579. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  7580. return rgbColor;
  7581. default:
  7582. return defaultColor;
  7583. }
  7584. }
  7585. function getPdfColorArray(color) {
  7586. return Array.from(color, c => c / 255);
  7587. }
  7588. function getQuadPoints(dict, rect) {
  7589. const quadPoints = dict.getArray("QuadPoints");
  7590. if (!Array.isArray(quadPoints) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
  7591. return null;
  7592. }
  7593. const quadPointsLists = [];
  7594. for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
  7595. let minX = Infinity,
  7596. maxX = -Infinity,
  7597. minY = Infinity,
  7598. maxY = -Infinity;
  7599. for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
  7600. const x = quadPoints[j];
  7601. const y = quadPoints[j + 1];
  7602. minX = Math.min(x, minX);
  7603. maxX = Math.max(x, maxX);
  7604. minY = Math.min(y, minY);
  7605. maxY = Math.max(y, maxY);
  7606. }
  7607. if (rect !== null && (minX < rect[0] || maxX > rect[2] || minY < rect[1] || maxY > rect[3])) {
  7608. return null;
  7609. }
  7610. quadPointsLists.push([{
  7611. x: minX,
  7612. y: maxY
  7613. }, {
  7614. x: maxX,
  7615. y: maxY
  7616. }, {
  7617. x: minX,
  7618. y: minY
  7619. }, {
  7620. x: maxX,
  7621. y: minY
  7622. }]);
  7623. }
  7624. return quadPointsLists;
  7625. }
  7626. function getTransformMatrix(rect, bbox, matrix) {
  7627. const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
  7628. if (minX === maxX || minY === maxY) {
  7629. return [1, 0, 0, 1, rect[0], rect[1]];
  7630. }
  7631. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  7632. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  7633. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  7634. }
  7635. class Annotation {
  7636. constructor(params) {
  7637. const {
  7638. dict,
  7639. xref
  7640. } = params;
  7641. this.setTitle(dict.get("T"));
  7642. this.setContents(dict.get("Contents"));
  7643. this.setModificationDate(dict.get("M"));
  7644. this.setFlags(dict.get("F"));
  7645. this.setRectangle(dict.getArray("Rect"));
  7646. this.setColor(dict.getArray("C"));
  7647. this.setBorderStyle(dict);
  7648. this.setAppearance(dict);
  7649. this.setOptionalContent(dict);
  7650. const MK = dict.get("MK");
  7651. this.setBorderAndBackgroundColors(MK);
  7652. this.setRotation(MK);
  7653. this._streams = [];
  7654. if (this.appearance) {
  7655. this._streams.push(this.appearance);
  7656. }
  7657. this.data = {
  7658. annotationFlags: this.flags,
  7659. borderStyle: this.borderStyle,
  7660. color: this.color,
  7661. backgroundColor: this.backgroundColor,
  7662. borderColor: this.borderColor,
  7663. rotation: this.rotation,
  7664. contentsObj: this._contents,
  7665. hasAppearance: !!this.appearance,
  7666. id: params.id,
  7667. modificationDate: this.modificationDate,
  7668. rect: this.rectangle,
  7669. subtype: params.subtype,
  7670. hasOwnCanvas: false
  7671. };
  7672. if (params.collectFields) {
  7673. const kids = dict.get("Kids");
  7674. if (Array.isArray(kids)) {
  7675. const kidIds = [];
  7676. for (const kid of kids) {
  7677. if (kid instanceof _primitives.Ref) {
  7678. kidIds.push(kid.toString());
  7679. }
  7680. }
  7681. if (kidIds.length !== 0) {
  7682. this.data.kidIds = kidIds;
  7683. }
  7684. }
  7685. this.data.actions = (0, _core_utils.collectActions)(xref, dict, _util.AnnotationActionEventType);
  7686. this.data.fieldName = this._constructFieldName(dict);
  7687. this.data.pageIndex = params.pageIndex;
  7688. }
  7689. this._isOffscreenCanvasSupported = params.isOffscreenCanvasSupported;
  7690. this._fallbackFontDict = null;
  7691. this._needAppearances = false;
  7692. }
  7693. _hasFlag(flags, flag) {
  7694. return !!(flags & flag);
  7695. }
  7696. _isViewable(flags) {
  7697. return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
  7698. }
  7699. _isPrintable(flags) {
  7700. return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE);
  7701. }
  7702. mustBeViewed(annotationStorage) {
  7703. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  7704. if (storageEntry && storageEntry.hidden !== undefined) {
  7705. return !storageEntry.hidden;
  7706. }
  7707. return this.viewable && !this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN);
  7708. }
  7709. mustBePrinted(annotationStorage) {
  7710. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  7711. if (storageEntry && storageEntry.print !== undefined) {
  7712. return storageEntry.print;
  7713. }
  7714. return this.printable;
  7715. }
  7716. get viewable() {
  7717. if (this.data.quadPoints === null) {
  7718. return false;
  7719. }
  7720. if (this.flags === 0) {
  7721. return true;
  7722. }
  7723. return this._isViewable(this.flags);
  7724. }
  7725. get printable() {
  7726. if (this.data.quadPoints === null) {
  7727. return false;
  7728. }
  7729. if (this.flags === 0) {
  7730. return false;
  7731. }
  7732. return this._isPrintable(this.flags);
  7733. }
  7734. _parseStringHelper(data) {
  7735. const str = typeof data === "string" ? (0, _util.stringToPDFString)(data) : "";
  7736. const dir = str && (0, _bidi.bidi)(str).dir === "rtl" ? "rtl" : "ltr";
  7737. return {
  7738. str,
  7739. dir
  7740. };
  7741. }
  7742. setDefaultAppearance(params) {
  7743. const defaultAppearance = (0, _core_utils.getInheritableProperty)({
  7744. dict: params.dict,
  7745. key: "DA"
  7746. }) || params.acroForm.get("DA");
  7747. this._defaultAppearance = typeof defaultAppearance === "string" ? defaultAppearance : "";
  7748. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance);
  7749. }
  7750. setTitle(title) {
  7751. this._title = this._parseStringHelper(title);
  7752. }
  7753. setContents(contents) {
  7754. this._contents = this._parseStringHelper(contents);
  7755. }
  7756. setModificationDate(modificationDate) {
  7757. this.modificationDate = typeof modificationDate === "string" ? modificationDate : null;
  7758. }
  7759. setFlags(flags) {
  7760. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  7761. }
  7762. hasFlag(flag) {
  7763. return this._hasFlag(this.flags, flag);
  7764. }
  7765. setRectangle(rectangle) {
  7766. if (Array.isArray(rectangle) && rectangle.length === 4) {
  7767. this.rectangle = _util.Util.normalizeRect(rectangle);
  7768. } else {
  7769. this.rectangle = [0, 0, 0, 0];
  7770. }
  7771. }
  7772. setColor(color) {
  7773. this.color = getRgbColor(color);
  7774. }
  7775. setLineEndings(lineEndings) {
  7776. this.lineEndings = ["None", "None"];
  7777. if (Array.isArray(lineEndings) && lineEndings.length === 2) {
  7778. for (let i = 0; i < 2; i++) {
  7779. const obj = lineEndings[i];
  7780. if (obj instanceof _primitives.Name) {
  7781. switch (obj.name) {
  7782. case "None":
  7783. continue;
  7784. case "Square":
  7785. case "Circle":
  7786. case "Diamond":
  7787. case "OpenArrow":
  7788. case "ClosedArrow":
  7789. case "Butt":
  7790. case "ROpenArrow":
  7791. case "RClosedArrow":
  7792. case "Slash":
  7793. this.lineEndings[i] = obj.name;
  7794. continue;
  7795. }
  7796. }
  7797. (0, _util.warn)(`Ignoring invalid lineEnding: ${obj}`);
  7798. }
  7799. }
  7800. }
  7801. setRotation(mk) {
  7802. this.rotation = 0;
  7803. if (mk instanceof _primitives.Dict) {
  7804. let angle = mk.get("R") || 0;
  7805. if (Number.isInteger(angle) && angle !== 0) {
  7806. angle %= 360;
  7807. if (angle < 0) {
  7808. angle += 360;
  7809. }
  7810. if (angle % 90 === 0) {
  7811. this.rotation = angle;
  7812. }
  7813. }
  7814. }
  7815. }
  7816. setBorderAndBackgroundColors(mk) {
  7817. if (mk instanceof _primitives.Dict) {
  7818. this.borderColor = getRgbColor(mk.getArray("BC"), null);
  7819. this.backgroundColor = getRgbColor(mk.getArray("BG"), null);
  7820. } else {
  7821. this.borderColor = this.backgroundColor = null;
  7822. }
  7823. }
  7824. setBorderStyle(borderStyle) {
  7825. this.borderStyle = new AnnotationBorderStyle();
  7826. if (!(borderStyle instanceof _primitives.Dict)) {
  7827. return;
  7828. }
  7829. if (borderStyle.has("BS")) {
  7830. const dict = borderStyle.get("BS");
  7831. const dictType = dict.get("Type");
  7832. if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
  7833. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  7834. this.borderStyle.setStyle(dict.get("S"));
  7835. this.borderStyle.setDashArray(dict.getArray("D"));
  7836. }
  7837. } else if (borderStyle.has("Border")) {
  7838. const array = borderStyle.getArray("Border");
  7839. if (Array.isArray(array) && array.length >= 3) {
  7840. this.borderStyle.setHorizontalCornerRadius(array[0]);
  7841. this.borderStyle.setVerticalCornerRadius(array[1]);
  7842. this.borderStyle.setWidth(array[2], this.rectangle);
  7843. if (array.length === 4) {
  7844. this.borderStyle.setDashArray(array[3], true);
  7845. }
  7846. }
  7847. } else {
  7848. this.borderStyle.setWidth(0);
  7849. }
  7850. }
  7851. setAppearance(dict) {
  7852. this.appearance = null;
  7853. const appearanceStates = dict.get("AP");
  7854. if (!(appearanceStates instanceof _primitives.Dict)) {
  7855. return;
  7856. }
  7857. const normalAppearanceState = appearanceStates.get("N");
  7858. if (normalAppearanceState instanceof _base_stream.BaseStream) {
  7859. this.appearance = normalAppearanceState;
  7860. return;
  7861. }
  7862. if (!(normalAppearanceState instanceof _primitives.Dict)) {
  7863. return;
  7864. }
  7865. const as = dict.get("AS");
  7866. if (!(as instanceof _primitives.Name) || !normalAppearanceState.has(as.name)) {
  7867. return;
  7868. }
  7869. const appearance = normalAppearanceState.get(as.name);
  7870. if (appearance instanceof _base_stream.BaseStream) {
  7871. this.appearance = appearance;
  7872. }
  7873. }
  7874. setOptionalContent(dict) {
  7875. this.oc = null;
  7876. const oc = dict.get("OC");
  7877. if (oc instanceof _primitives.Name) {
  7878. (0, _util.warn)("setOptionalContent: Support for /Name-entry is not implemented.");
  7879. } else if (oc instanceof _primitives.Dict) {
  7880. this.oc = oc;
  7881. }
  7882. }
  7883. loadResources(keys, appearance) {
  7884. return appearance.dict.getAsync("Resources").then(resources => {
  7885. if (!resources) {
  7886. return undefined;
  7887. }
  7888. const objectLoader = new _object_loader.ObjectLoader(resources, keys, resources.xref);
  7889. return objectLoader.load().then(function () {
  7890. return resources;
  7891. });
  7892. });
  7893. }
  7894. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  7895. const data = this.data;
  7896. let appearance = this.appearance;
  7897. const isUsingOwnCanvas = !!(this.data.hasOwnCanvas && intent & _util.RenderingIntentFlag.DISPLAY);
  7898. if (!appearance) {
  7899. if (!isUsingOwnCanvas) {
  7900. return {
  7901. opList: new _operator_list.OperatorList(),
  7902. separateForm: false,
  7903. separateCanvas: false
  7904. };
  7905. }
  7906. appearance = new _stream.StringStream("");
  7907. appearance.dict = new _primitives.Dict();
  7908. }
  7909. const appearanceDict = appearance.dict;
  7910. const resources = await this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"], appearance);
  7911. const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
  7912. const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
  7913. const transform = getTransformMatrix(data.rect, bbox, matrix);
  7914. const opList = new _operator_list.OperatorList();
  7915. let optionalContent;
  7916. if (this.oc) {
  7917. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  7918. }
  7919. if (optionalContent !== undefined) {
  7920. opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  7921. }
  7922. opList.addOp(_util.OPS.beginAnnotation, [data.id, data.rect, transform, matrix, isUsingOwnCanvas]);
  7923. await evaluator.getOperatorList({
  7924. stream: appearance,
  7925. task,
  7926. resources,
  7927. operatorList: opList,
  7928. fallbackFontDict: this._fallbackFontDict
  7929. });
  7930. opList.addOp(_util.OPS.endAnnotation, []);
  7931. if (optionalContent !== undefined) {
  7932. opList.addOp(_util.OPS.endMarkedContent, []);
  7933. }
  7934. this.reset();
  7935. return {
  7936. opList,
  7937. separateForm: false,
  7938. separateCanvas: isUsingOwnCanvas
  7939. };
  7940. }
  7941. async save(evaluator, task, annotationStorage) {
  7942. return null;
  7943. }
  7944. get hasTextContent() {
  7945. return false;
  7946. }
  7947. async extractTextContent(evaluator, task, viewBox) {
  7948. if (!this.appearance) {
  7949. return;
  7950. }
  7951. const resources = await this.loadResources(["ExtGState", "Font", "Properties", "XObject"], this.appearance);
  7952. const text = [];
  7953. const buffer = [];
  7954. const sink = {
  7955. desiredSize: Math.Infinity,
  7956. ready: true,
  7957. enqueue(chunk, size) {
  7958. for (const item of chunk.items) {
  7959. buffer.push(item.str);
  7960. if (item.hasEOL) {
  7961. text.push(buffer.join(""));
  7962. buffer.length = 0;
  7963. }
  7964. }
  7965. }
  7966. };
  7967. await evaluator.getTextContent({
  7968. stream: this.appearance,
  7969. task,
  7970. resources,
  7971. includeMarkedContent: true,
  7972. combineTextItems: true,
  7973. sink,
  7974. viewBox
  7975. });
  7976. this.reset();
  7977. if (buffer.length) {
  7978. text.push(buffer.join(""));
  7979. }
  7980. if (text.length > 0) {
  7981. this.data.textContent = text;
  7982. }
  7983. }
  7984. getFieldObject() {
  7985. if (this.data.kidIds) {
  7986. return {
  7987. id: this.data.id,
  7988. actions: this.data.actions,
  7989. name: this.data.fieldName,
  7990. strokeColor: this.data.borderColor,
  7991. fillColor: this.data.backgroundColor,
  7992. type: "",
  7993. kidIds: this.data.kidIds,
  7994. page: this.data.pageIndex,
  7995. rotation: this.rotation
  7996. };
  7997. }
  7998. return null;
  7999. }
  8000. reset() {
  8001. for (const stream of this._streams) {
  8002. stream.reset();
  8003. }
  8004. }
  8005. _constructFieldName(dict) {
  8006. if (!dict.has("T") && !dict.has("Parent")) {
  8007. (0, _util.warn)("Unknown field name, falling back to empty field name.");
  8008. return "";
  8009. }
  8010. if (!dict.has("Parent")) {
  8011. return (0, _util.stringToPDFString)(dict.get("T"));
  8012. }
  8013. const fieldName = [];
  8014. if (dict.has("T")) {
  8015. fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
  8016. }
  8017. let loopDict = dict;
  8018. const visited = new _primitives.RefSet();
  8019. if (dict.objId) {
  8020. visited.put(dict.objId);
  8021. }
  8022. while (loopDict.has("Parent")) {
  8023. loopDict = loopDict.get("Parent");
  8024. if (!(loopDict instanceof _primitives.Dict) || loopDict.objId && visited.has(loopDict.objId)) {
  8025. break;
  8026. }
  8027. if (loopDict.objId) {
  8028. visited.put(loopDict.objId);
  8029. }
  8030. if (loopDict.has("T")) {
  8031. const t = (0, _util.stringToPDFString)(loopDict.get("T"));
  8032. if (!t.startsWith("#")) {
  8033. fieldName.unshift(t);
  8034. }
  8035. }
  8036. }
  8037. return fieldName.join(".");
  8038. }
  8039. }
  8040. exports.Annotation = Annotation;
  8041. class AnnotationBorderStyle {
  8042. constructor() {
  8043. this.width = 1;
  8044. this.style = _util.AnnotationBorderStyleType.SOLID;
  8045. this.dashArray = [3];
  8046. this.horizontalCornerRadius = 0;
  8047. this.verticalCornerRadius = 0;
  8048. }
  8049. setWidth(width) {
  8050. let rect = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0, 0];
  8051. if (width instanceof _primitives.Name) {
  8052. this.width = 0;
  8053. return;
  8054. }
  8055. if (typeof width === "number") {
  8056. if (width > 0) {
  8057. const maxWidth = (rect[2] - rect[0]) / 2;
  8058. const maxHeight = (rect[3] - rect[1]) / 2;
  8059. if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
  8060. (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
  8061. width = 1;
  8062. }
  8063. }
  8064. this.width = width;
  8065. }
  8066. }
  8067. setStyle(style) {
  8068. if (!(style instanceof _primitives.Name)) {
  8069. return;
  8070. }
  8071. switch (style.name) {
  8072. case "S":
  8073. this.style = _util.AnnotationBorderStyleType.SOLID;
  8074. break;
  8075. case "D":
  8076. this.style = _util.AnnotationBorderStyleType.DASHED;
  8077. break;
  8078. case "B":
  8079. this.style = _util.AnnotationBorderStyleType.BEVELED;
  8080. break;
  8081. case "I":
  8082. this.style = _util.AnnotationBorderStyleType.INSET;
  8083. break;
  8084. case "U":
  8085. this.style = _util.AnnotationBorderStyleType.UNDERLINE;
  8086. break;
  8087. default:
  8088. break;
  8089. }
  8090. }
  8091. setDashArray(dashArray) {
  8092. let forceStyle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  8093. if (Array.isArray(dashArray) && dashArray.length > 0) {
  8094. let isValid = true;
  8095. let allZeros = true;
  8096. for (const element of dashArray) {
  8097. const validNumber = +element >= 0;
  8098. if (!validNumber) {
  8099. isValid = false;
  8100. break;
  8101. } else if (element > 0) {
  8102. allZeros = false;
  8103. }
  8104. }
  8105. if (isValid && !allZeros) {
  8106. this.dashArray = dashArray;
  8107. if (forceStyle) {
  8108. this.setStyle(_primitives.Name.get("D"));
  8109. }
  8110. } else {
  8111. this.width = 0;
  8112. }
  8113. } else if (dashArray) {
  8114. this.width = 0;
  8115. }
  8116. }
  8117. setHorizontalCornerRadius(radius) {
  8118. if (Number.isInteger(radius)) {
  8119. this.horizontalCornerRadius = radius;
  8120. }
  8121. }
  8122. setVerticalCornerRadius(radius) {
  8123. if (Number.isInteger(radius)) {
  8124. this.verticalCornerRadius = radius;
  8125. }
  8126. }
  8127. }
  8128. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  8129. class MarkupAnnotation extends Annotation {
  8130. constructor(params) {
  8131. super(params);
  8132. const {
  8133. dict
  8134. } = params;
  8135. if (dict.has("IRT")) {
  8136. const rawIRT = dict.getRaw("IRT");
  8137. this.data.inReplyTo = rawIRT instanceof _primitives.Ref ? rawIRT.toString() : null;
  8138. const rt = dict.get("RT");
  8139. this.data.replyType = rt instanceof _primitives.Name ? rt.name : _util.AnnotationReplyType.REPLY;
  8140. }
  8141. if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
  8142. const parent = dict.get("IRT");
  8143. this.setTitle(parent.get("T"));
  8144. this.data.titleObj = this._title;
  8145. this.setContents(parent.get("Contents"));
  8146. this.data.contentsObj = this._contents;
  8147. if (!parent.has("CreationDate")) {
  8148. this.data.creationDate = null;
  8149. } else {
  8150. this.setCreationDate(parent.get("CreationDate"));
  8151. this.data.creationDate = this.creationDate;
  8152. }
  8153. if (!parent.has("M")) {
  8154. this.data.modificationDate = null;
  8155. } else {
  8156. this.setModificationDate(parent.get("M"));
  8157. this.data.modificationDate = this.modificationDate;
  8158. }
  8159. this.data.hasPopup = parent.has("Popup");
  8160. if (!parent.has("C")) {
  8161. this.data.color = null;
  8162. } else {
  8163. this.setColor(parent.getArray("C"));
  8164. this.data.color = this.color;
  8165. }
  8166. } else {
  8167. this.data.titleObj = this._title;
  8168. this.setCreationDate(dict.get("CreationDate"));
  8169. this.data.creationDate = this.creationDate;
  8170. this.data.hasPopup = dict.has("Popup");
  8171. if (!dict.has("C")) {
  8172. this.data.color = null;
  8173. }
  8174. }
  8175. if (dict.has("RC")) {
  8176. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(dict.get("RC"));
  8177. }
  8178. }
  8179. setCreationDate(creationDate) {
  8180. this.creationDate = typeof creationDate === "string" ? creationDate : null;
  8181. }
  8182. _setDefaultAppearance(_ref2) {
  8183. let {
  8184. xref,
  8185. extra,
  8186. strokeColor,
  8187. fillColor,
  8188. blendMode,
  8189. strokeAlpha,
  8190. fillAlpha,
  8191. pointsCallback
  8192. } = _ref2;
  8193. let minX = Number.MAX_VALUE;
  8194. let minY = Number.MAX_VALUE;
  8195. let maxX = Number.MIN_VALUE;
  8196. let maxY = Number.MIN_VALUE;
  8197. const buffer = ["q"];
  8198. if (extra) {
  8199. buffer.push(extra);
  8200. }
  8201. if (strokeColor) {
  8202. buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`);
  8203. }
  8204. if (fillColor) {
  8205. buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
  8206. }
  8207. let pointsArray = this.data.quadPoints;
  8208. if (!pointsArray) {
  8209. pointsArray = [[{
  8210. x: this.rectangle[0],
  8211. y: this.rectangle[3]
  8212. }, {
  8213. x: this.rectangle[2],
  8214. y: this.rectangle[3]
  8215. }, {
  8216. x: this.rectangle[0],
  8217. y: this.rectangle[1]
  8218. }, {
  8219. x: this.rectangle[2],
  8220. y: this.rectangle[1]
  8221. }]];
  8222. }
  8223. for (const points of pointsArray) {
  8224. const [mX, MX, mY, MY] = pointsCallback(buffer, points);
  8225. minX = Math.min(minX, mX);
  8226. maxX = Math.max(maxX, MX);
  8227. minY = Math.min(minY, mY);
  8228. maxY = Math.max(maxY, MY);
  8229. }
  8230. buffer.push("Q");
  8231. const formDict = new _primitives.Dict(xref);
  8232. const appearanceStreamDict = new _primitives.Dict(xref);
  8233. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  8234. const appearanceStream = new _stream.StringStream(buffer.join(" "));
  8235. appearanceStream.dict = appearanceStreamDict;
  8236. formDict.set("Fm0", appearanceStream);
  8237. const gsDict = new _primitives.Dict(xref);
  8238. if (blendMode) {
  8239. gsDict.set("BM", _primitives.Name.get(blendMode));
  8240. }
  8241. if (typeof strokeAlpha === "number") {
  8242. gsDict.set("CA", strokeAlpha);
  8243. }
  8244. if (typeof fillAlpha === "number") {
  8245. gsDict.set("ca", fillAlpha);
  8246. }
  8247. const stateDict = new _primitives.Dict(xref);
  8248. stateDict.set("GS0", gsDict);
  8249. const resources = new _primitives.Dict(xref);
  8250. resources.set("ExtGState", stateDict);
  8251. resources.set("XObject", formDict);
  8252. const appearanceDict = new _primitives.Dict(xref);
  8253. appearanceDict.set("Resources", resources);
  8254. const bbox = this.data.rect = [minX, minY, maxX, maxY];
  8255. appearanceDict.set("BBox", bbox);
  8256. this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do");
  8257. this.appearance.dict = appearanceDict;
  8258. this._streams.push(this.appearance, appearanceStream);
  8259. }
  8260. static async createNewAnnotation(xref, annotation, dependencies, params) {
  8261. const annotationRef = xref.getNewTemporaryRef();
  8262. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  8263. const buffer = [];
  8264. let annotationDict;
  8265. if (ap) {
  8266. const apRef = xref.getNewTemporaryRef();
  8267. annotationDict = this.createNewDict(annotation, xref, {
  8268. apRef
  8269. });
  8270. const transform = xref.encrypt ? xref.encrypt.createCipherTransform(apRef.num, apRef.gen) : null;
  8271. (0, _writer.writeObject)(apRef, ap, buffer, transform);
  8272. dependencies.push({
  8273. ref: apRef,
  8274. data: buffer.join("")
  8275. });
  8276. } else {
  8277. annotationDict = this.createNewDict(annotation, xref, {});
  8278. }
  8279. buffer.length = 0;
  8280. const transform = xref.encrypt ? xref.encrypt.createCipherTransform(annotationRef.num, annotationRef.gen) : null;
  8281. (0, _writer.writeObject)(annotationRef, annotationDict, buffer, transform);
  8282. return {
  8283. ref: annotationRef,
  8284. data: buffer.join("")
  8285. };
  8286. }
  8287. static async createNewPrintAnnotation(xref, annotation, params) {
  8288. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  8289. const annotationDict = this.createNewDict(annotation, xref, {
  8290. ap
  8291. });
  8292. return new this.prototype.constructor({
  8293. dict: annotationDict,
  8294. xref,
  8295. isOffscreenCanvasSupported: params.isOffscreenCanvasSupported
  8296. });
  8297. }
  8298. }
  8299. exports.MarkupAnnotation = MarkupAnnotation;
  8300. class WidgetAnnotation extends Annotation {
  8301. constructor(params) {
  8302. super(params);
  8303. const {
  8304. dict,
  8305. xref
  8306. } = params;
  8307. const data = this.data;
  8308. this.ref = params.ref;
  8309. this._needAppearances = params.needAppearances;
  8310. data.annotationType = _util.AnnotationType.WIDGET;
  8311. if (data.fieldName === undefined) {
  8312. data.fieldName = this._constructFieldName(dict);
  8313. }
  8314. if (data.actions === undefined) {
  8315. data.actions = (0, _core_utils.collectActions)(xref, dict, _util.AnnotationActionEventType);
  8316. }
  8317. let fieldValue = (0, _core_utils.getInheritableProperty)({
  8318. dict,
  8319. key: "V",
  8320. getArray: true
  8321. });
  8322. data.fieldValue = this._decodeFormValue(fieldValue);
  8323. const defaultFieldValue = (0, _core_utils.getInheritableProperty)({
  8324. dict,
  8325. key: "DV",
  8326. getArray: true
  8327. });
  8328. data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
  8329. if (fieldValue === undefined && params.xfaDatasets) {
  8330. const path = this._title.str;
  8331. if (path) {
  8332. this._hasValueFromXFA = true;
  8333. data.fieldValue = fieldValue = params.xfaDatasets.getValue(path);
  8334. }
  8335. }
  8336. if (fieldValue === undefined && data.defaultFieldValue !== null) {
  8337. data.fieldValue = data.defaultFieldValue;
  8338. }
  8339. data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || "");
  8340. this.setDefaultAppearance(params);
  8341. data.hasAppearance = this._needAppearances && data.fieldValue !== undefined && data.fieldValue !== null || data.hasAppearance;
  8342. const fieldType = (0, _core_utils.getInheritableProperty)({
  8343. dict,
  8344. key: "FT"
  8345. });
  8346. data.fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  8347. const localResources = (0, _core_utils.getInheritableProperty)({
  8348. dict,
  8349. key: "DR"
  8350. });
  8351. const acroFormResources = params.acroForm.get("DR");
  8352. const appearanceResources = this.appearance && this.appearance.dict.get("Resources");
  8353. this._fieldResources = {
  8354. localResources,
  8355. acroFormResources,
  8356. appearanceResources,
  8357. mergedResources: _primitives.Dict.merge({
  8358. xref,
  8359. dictArray: [localResources, appearanceResources, acroFormResources],
  8360. mergeSubDicts: true
  8361. })
  8362. };
  8363. data.fieldFlags = (0, _core_utils.getInheritableProperty)({
  8364. dict,
  8365. key: "Ff"
  8366. });
  8367. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  8368. data.fieldFlags = 0;
  8369. }
  8370. data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
  8371. data.required = this.hasFieldFlag(_util.AnnotationFieldFlag.REQUIRED);
  8372. data.hidden = this._hasFlag(data.annotationFlags, _util.AnnotationFlag.HIDDEN);
  8373. }
  8374. _decodeFormValue(formValue) {
  8375. if (Array.isArray(formValue)) {
  8376. return formValue.filter(item => typeof item === "string").map(item => (0, _util.stringToPDFString)(item));
  8377. } else if (formValue instanceof _primitives.Name) {
  8378. return (0, _util.stringToPDFString)(formValue.name);
  8379. } else if (typeof formValue === "string") {
  8380. return (0, _util.stringToPDFString)(formValue);
  8381. }
  8382. return null;
  8383. }
  8384. hasFieldFlag(flag) {
  8385. return !!(this.data.fieldFlags & flag);
  8386. }
  8387. getRotationMatrix(annotationStorage) {
  8388. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  8389. let rotation = storageEntry && storageEntry.rotation;
  8390. if (rotation === undefined) {
  8391. rotation = this.rotation;
  8392. }
  8393. if (rotation === 0) {
  8394. return _util.IDENTITY_MATRIX;
  8395. }
  8396. const width = this.data.rect[2] - this.data.rect[0];
  8397. const height = this.data.rect[3] - this.data.rect[1];
  8398. return (0, _core_utils.getRotationMatrix)(rotation, width, height);
  8399. }
  8400. getBorderAndBackgroundAppearances(annotationStorage) {
  8401. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  8402. let rotation = storageEntry && storageEntry.rotation;
  8403. if (rotation === undefined) {
  8404. rotation = this.rotation;
  8405. }
  8406. if (!this.backgroundColor && !this.borderColor) {
  8407. return "";
  8408. }
  8409. const width = this.data.rect[2] - this.data.rect[0];
  8410. const height = this.data.rect[3] - this.data.rect[1];
  8411. const rect = rotation === 0 || rotation === 180 ? `0 0 ${width} ${height} re` : `0 0 ${height} ${width} re`;
  8412. let str = "";
  8413. if (this.backgroundColor) {
  8414. str = `${(0, _default_appearance.getPdfColor)(this.backgroundColor, true)} ${rect} f `;
  8415. }
  8416. if (this.borderColor) {
  8417. const borderWidth = this.borderStyle.width || 1;
  8418. str += `${borderWidth} w ${(0, _default_appearance.getPdfColor)(this.borderColor, false)} ${rect} S `;
  8419. }
  8420. return str;
  8421. }
  8422. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  8423. if (renderForms && !(this instanceof SignatureWidgetAnnotation)) {
  8424. return {
  8425. opList: new _operator_list.OperatorList(),
  8426. separateForm: true,
  8427. separateCanvas: false
  8428. };
  8429. }
  8430. if (!this._hasText) {
  8431. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  8432. }
  8433. const content = await this._getAppearance(evaluator, task, intent, annotationStorage);
  8434. if (this.appearance && content === null) {
  8435. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  8436. }
  8437. const opList = new _operator_list.OperatorList();
  8438. if (!this._defaultAppearance || content === null) {
  8439. return {
  8440. opList,
  8441. separateForm: false,
  8442. separateCanvas: false
  8443. };
  8444. }
  8445. const matrix = [1, 0, 0, 1, 0, 0];
  8446. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  8447. const transform = getTransformMatrix(this.data.rect, bbox, matrix);
  8448. let optionalContent;
  8449. if (this.oc) {
  8450. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  8451. }
  8452. if (optionalContent !== undefined) {
  8453. opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  8454. }
  8455. opList.addOp(_util.OPS.beginAnnotation, [this.data.id, this.data.rect, transform, this.getRotationMatrix(annotationStorage), false]);
  8456. const stream = new _stream.StringStream(content);
  8457. await evaluator.getOperatorList({
  8458. stream,
  8459. task,
  8460. resources: this._fieldResources.mergedResources,
  8461. operatorList: opList
  8462. });
  8463. opList.addOp(_util.OPS.endAnnotation, []);
  8464. if (optionalContent !== undefined) {
  8465. opList.addOp(_util.OPS.endMarkedContent, []);
  8466. }
  8467. return {
  8468. opList,
  8469. separateForm: false,
  8470. separateCanvas: false
  8471. };
  8472. }
  8473. _getMKDict(rotation) {
  8474. const mk = new _primitives.Dict(null);
  8475. if (rotation) {
  8476. mk.set("R", rotation);
  8477. }
  8478. if (this.borderColor) {
  8479. mk.set("BC", getPdfColorArray(this.borderColor));
  8480. }
  8481. if (this.backgroundColor) {
  8482. mk.set("BG", getPdfColorArray(this.backgroundColor));
  8483. }
  8484. return mk.size > 0 ? mk : null;
  8485. }
  8486. amendSavedDict(annotationStorage, dict) {}
  8487. async save(evaluator, task, annotationStorage) {
  8488. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  8489. let value = storageEntry && storageEntry.value;
  8490. let rotation = storageEntry && storageEntry.rotation;
  8491. if (value === this.data.fieldValue || value === undefined) {
  8492. if (!this._hasValueFromXFA && rotation === undefined) {
  8493. return null;
  8494. }
  8495. value = value || this.data.fieldValue;
  8496. }
  8497. 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])) {
  8498. return null;
  8499. }
  8500. if (rotation === undefined) {
  8501. rotation = this.rotation;
  8502. }
  8503. let appearance = null;
  8504. if (!this._needAppearances) {
  8505. appearance = await this._getAppearance(evaluator, task, _util.RenderingIntentFlag.SAVE, annotationStorage);
  8506. if (appearance === null) {
  8507. return null;
  8508. }
  8509. } else {}
  8510. let needAppearances = false;
  8511. if (appearance && appearance.needAppearances) {
  8512. needAppearances = true;
  8513. appearance = null;
  8514. }
  8515. const {
  8516. xref
  8517. } = evaluator;
  8518. const originalDict = xref.fetchIfRef(this.ref);
  8519. if (!(originalDict instanceof _primitives.Dict)) {
  8520. return null;
  8521. }
  8522. const dict = new _primitives.Dict(xref);
  8523. for (const key of originalDict.getKeys()) {
  8524. if (key !== "AP") {
  8525. dict.set(key, originalDict.getRaw(key));
  8526. }
  8527. }
  8528. const xfa = {
  8529. path: this.data.fieldName,
  8530. value
  8531. };
  8532. const encoder = val => {
  8533. return (0, _core_utils.isAscii)(val) ? val : (0, _core_utils.stringToUTF16String)(val, true);
  8534. };
  8535. dict.set("V", Array.isArray(value) ? value.map(encoder) : encoder(value));
  8536. this.amendSavedDict(annotationStorage, dict);
  8537. const maybeMK = this._getMKDict(rotation);
  8538. if (maybeMK) {
  8539. dict.set("MK", maybeMK);
  8540. }
  8541. const encrypt = xref.encrypt;
  8542. const originalTransform = encrypt ? encrypt.createCipherTransform(this.ref.num, this.ref.gen) : null;
  8543. const buffer = [];
  8544. const changes = [{
  8545. ref: this.ref,
  8546. data: "",
  8547. xfa,
  8548. needAppearances
  8549. }];
  8550. if (appearance !== null) {
  8551. const newRef = xref.getNewTemporaryRef();
  8552. const AP = new _primitives.Dict(xref);
  8553. dict.set("AP", AP);
  8554. AP.set("N", newRef);
  8555. let newTransform = null;
  8556. if (encrypt) {
  8557. newTransform = encrypt.createCipherTransform(newRef.num, newRef.gen);
  8558. }
  8559. const resources = this._getSaveFieldResources(xref);
  8560. const appearanceStream = new _stream.StringStream(appearance);
  8561. const appearanceDict = appearanceStream.dict = new _primitives.Dict(xref);
  8562. appearanceDict.set("Subtype", _primitives.Name.get("Form"));
  8563. appearanceDict.set("Resources", resources);
  8564. appearanceDict.set("BBox", [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]]);
  8565. const rotationMatrix = this.getRotationMatrix(annotationStorage);
  8566. if (rotationMatrix !== _util.IDENTITY_MATRIX) {
  8567. appearanceDict.set("Matrix", rotationMatrix);
  8568. }
  8569. (0, _writer.writeObject)(newRef, appearanceStream, buffer, newTransform);
  8570. changes.push({
  8571. ref: newRef,
  8572. data: buffer.join(""),
  8573. xfa: null,
  8574. needAppearances: false
  8575. });
  8576. buffer.length = 0;
  8577. }
  8578. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  8579. (0, _writer.writeObject)(this.ref, dict, buffer, originalTransform);
  8580. changes[0].data = buffer.join("");
  8581. return changes;
  8582. }
  8583. async _getAppearance(evaluator, task, intent, annotationStorage) {
  8584. const isPassword = this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD);
  8585. if (isPassword) {
  8586. return null;
  8587. }
  8588. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  8589. let value, rotation;
  8590. if (storageEntry) {
  8591. value = storageEntry.formattedValue || storageEntry.value;
  8592. rotation = storageEntry.rotation;
  8593. }
  8594. if (rotation === undefined && value === undefined && !this._needAppearances) {
  8595. if (!this._hasValueFromXFA || this.appearance) {
  8596. return null;
  8597. }
  8598. }
  8599. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  8600. if (value === undefined) {
  8601. value = this.data.fieldValue;
  8602. if (!value) {
  8603. return `/Tx BMC q ${colors}Q EMC`;
  8604. }
  8605. }
  8606. if (Array.isArray(value) && value.length === 1) {
  8607. value = value[0];
  8608. }
  8609. (0, _util.assert)(typeof value === "string", "Expected `value` to be a string.");
  8610. value = value.trim();
  8611. if (this.data.combo) {
  8612. const option = this.data.options.find(_ref3 => {
  8613. let {
  8614. exportValue
  8615. } = _ref3;
  8616. return value === exportValue;
  8617. });
  8618. value = option && option.displayValue || value;
  8619. }
  8620. if (value === "") {
  8621. return `/Tx BMC q ${colors}Q EMC`;
  8622. }
  8623. if (rotation === undefined) {
  8624. rotation = this.rotation;
  8625. }
  8626. let lineCount = -1;
  8627. let lines;
  8628. if (this.data.multiLine) {
  8629. lines = value.split(/\r\n?|\n/).map(line => line.normalize("NFC"));
  8630. lineCount = lines.length;
  8631. } else {
  8632. lines = [value.replace(/\r\n?|\n/, "").normalize("NFC")];
  8633. }
  8634. const defaultPadding = 1;
  8635. const defaultHPadding = 2;
  8636. let totalHeight = this.data.rect[3] - this.data.rect[1];
  8637. let totalWidth = this.data.rect[2] - this.data.rect[0];
  8638. if (rotation === 90 || rotation === 270) {
  8639. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  8640. }
  8641. if (!this._defaultAppearance) {
  8642. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  8643. }
  8644. let font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  8645. let defaultAppearance, fontSize, lineHeight;
  8646. const encodedLines = [];
  8647. let encodingError = false;
  8648. for (const line of lines) {
  8649. const encodedString = font.encodeString(line);
  8650. if (encodedString.length > 1) {
  8651. encodingError = true;
  8652. }
  8653. encodedLines.push(encodedString.join(""));
  8654. }
  8655. if (encodingError && intent & _util.RenderingIntentFlag.SAVE) {
  8656. return {
  8657. needAppearances: true
  8658. };
  8659. }
  8660. if (encodingError && this._isOffscreenCanvasSupported) {
  8661. const fontFamily = this.data.comb ? "monospace" : "sans-serif";
  8662. const fakeUnicodeFont = new _default_appearance.FakeUnicodeFont(evaluator.xref, fontFamily);
  8663. const resources = fakeUnicodeFont.createFontResources(lines.join(""));
  8664. const newFont = resources.getRaw("Font");
  8665. if (this._fieldResources.mergedResources.has("Font")) {
  8666. const oldFont = this._fieldResources.mergedResources.get("Font");
  8667. for (const key of newFont.getKeys()) {
  8668. oldFont.set(key, newFont.getRaw(key));
  8669. }
  8670. } else {
  8671. this._fieldResources.mergedResources.set("Font", newFont);
  8672. }
  8673. const fontName = fakeUnicodeFont.fontName.name;
  8674. font = await WidgetAnnotation._getFontData(evaluator, task, {
  8675. fontName,
  8676. fontSize: 0
  8677. }, resources);
  8678. for (let i = 0, ii = encodedLines.length; i < ii; i++) {
  8679. encodedLines[i] = (0, _core_utils.stringToUTF16String)(lines[i]);
  8680. }
  8681. const savedDefaultAppearance = Object.assign(Object.create(null), this.data.defaultAppearanceData);
  8682. this.data.defaultAppearanceData.fontSize = 0;
  8683. this.data.defaultAppearanceData.fontName = fontName;
  8684. [defaultAppearance, fontSize, lineHeight] = this._computeFontSize(totalHeight - 2 * defaultPadding, totalWidth - 2 * defaultHPadding, value, font, lineCount);
  8685. this.data.defaultAppearanceData = savedDefaultAppearance;
  8686. } else {
  8687. if (!this._isOffscreenCanvasSupported) {
  8688. (0, _util.warn)("_getAppearance: OffscreenCanvas is not supported, annotation may not render correctly.");
  8689. }
  8690. [defaultAppearance, fontSize, lineHeight] = this._computeFontSize(totalHeight - 2 * defaultPadding, totalWidth - 2 * defaultHPadding, value, font, lineCount);
  8691. }
  8692. let descent = font.descent;
  8693. if (isNaN(descent)) {
  8694. descent = _util.BASELINE_FACTOR * lineHeight;
  8695. } else {
  8696. descent = Math.max(_util.BASELINE_FACTOR * lineHeight, Math.abs(descent) * fontSize);
  8697. }
  8698. const defaultVPadding = Math.min(Math.floor((totalHeight - fontSize) / 2), defaultPadding);
  8699. const alignment = this.data.textAlignment;
  8700. if (this.data.multiLine) {
  8701. return this._getMultilineAppearance(defaultAppearance, encodedLines, font, fontSize, totalWidth, totalHeight, alignment, defaultHPadding, defaultVPadding, descent, lineHeight, annotationStorage);
  8702. }
  8703. if (this.data.comb) {
  8704. return this._getCombAppearance(defaultAppearance, font, encodedLines[0], fontSize, totalWidth, totalHeight, defaultHPadding, defaultVPadding, descent, lineHeight, annotationStorage);
  8705. }
  8706. const bottomPadding = defaultVPadding + descent;
  8707. if (alignment === 0 || alignment > 2) {
  8708. 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";
  8709. }
  8710. const prevInfo = {
  8711. shift: 0
  8712. };
  8713. const renderedText = this._renderText(encodedLines[0], font, fontSize, totalWidth, alignment, prevInfo, defaultHPadding, bottomPadding);
  8714. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC";
  8715. }
  8716. static async _getFontData(evaluator, task, appearanceData, resources) {
  8717. const operatorList = new _operator_list.OperatorList();
  8718. const initialState = {
  8719. font: null,
  8720. clone() {
  8721. return this;
  8722. }
  8723. };
  8724. const {
  8725. fontName,
  8726. fontSize
  8727. } = appearanceData;
  8728. await evaluator.handleSetFont(resources, [fontName && _primitives.Name.get(fontName), fontSize], null, operatorList, task, initialState, null);
  8729. return initialState.font;
  8730. }
  8731. _getTextWidth(text, font) {
  8732. return font.charsToGlyphs(text).reduce((width, glyph) => width + glyph.width, 0) / 1000;
  8733. }
  8734. _computeFontSize(height, width, text, font, lineCount) {
  8735. let {
  8736. fontSize
  8737. } = this.data.defaultAppearanceData;
  8738. let lineHeight = (fontSize || 12) * _util.LINE_FACTOR,
  8739. numberOfLines = Math.round(height / lineHeight);
  8740. if (!fontSize) {
  8741. const roundWithTwoDigits = x => Math.floor(x * 100) / 100;
  8742. if (lineCount === -1) {
  8743. const textWidth = this._getTextWidth(text, font);
  8744. fontSize = roundWithTwoDigits(Math.min(height / _util.LINE_FACTOR, textWidth > width ? width / textWidth : Infinity));
  8745. numberOfLines = 1;
  8746. } else {
  8747. const lines = text.split(/\r\n?|\n/);
  8748. const cachedLines = [];
  8749. for (const line of lines) {
  8750. const encoded = font.encodeString(line).join("");
  8751. const glyphs = font.charsToGlyphs(encoded);
  8752. const positions = font.getCharPositions(encoded);
  8753. cachedLines.push({
  8754. line: encoded,
  8755. glyphs,
  8756. positions
  8757. });
  8758. }
  8759. const isTooBig = fsize => {
  8760. let totalHeight = 0;
  8761. for (const cache of cachedLines) {
  8762. const chunks = this._splitLine(null, font, fsize, width, cache);
  8763. totalHeight += chunks.length * fsize;
  8764. if (totalHeight > height) {
  8765. return true;
  8766. }
  8767. }
  8768. return false;
  8769. };
  8770. numberOfLines = Math.max(numberOfLines, lineCount);
  8771. while (true) {
  8772. lineHeight = height / numberOfLines;
  8773. fontSize = roundWithTwoDigits(lineHeight / _util.LINE_FACTOR);
  8774. if (isTooBig(fontSize)) {
  8775. numberOfLines++;
  8776. continue;
  8777. }
  8778. break;
  8779. }
  8780. }
  8781. const {
  8782. fontName,
  8783. fontColor
  8784. } = this.data.defaultAppearanceData;
  8785. this._defaultAppearance = (0, _default_appearance.createDefaultAppearance)({
  8786. fontSize,
  8787. fontName,
  8788. fontColor
  8789. });
  8790. }
  8791. return [this._defaultAppearance, fontSize, height / numberOfLines];
  8792. }
  8793. _renderText(text, font, fontSize, totalWidth, alignment, prevInfo, hPadding, vPadding) {
  8794. let shift;
  8795. if (alignment === 1) {
  8796. const width = this._getTextWidth(text, font) * fontSize;
  8797. shift = (totalWidth - width) / 2;
  8798. } else if (alignment === 2) {
  8799. const width = this._getTextWidth(text, font) * fontSize;
  8800. shift = totalWidth - width - hPadding;
  8801. } else {
  8802. shift = hPadding;
  8803. }
  8804. const shiftStr = (0, _core_utils.numberToString)(shift - prevInfo.shift);
  8805. prevInfo.shift = shift;
  8806. vPadding = (0, _core_utils.numberToString)(vPadding);
  8807. return `${shiftStr} ${vPadding} Td (${(0, _core_utils.escapeString)(text)}) Tj`;
  8808. }
  8809. _getSaveFieldResources(xref) {
  8810. const {
  8811. localResources,
  8812. appearanceResources,
  8813. acroFormResources
  8814. } = this._fieldResources;
  8815. const fontName = this.data.defaultAppearanceData && this.data.defaultAppearanceData.fontName;
  8816. if (!fontName) {
  8817. return localResources || _primitives.Dict.empty;
  8818. }
  8819. for (const resources of [localResources, appearanceResources]) {
  8820. if (resources instanceof _primitives.Dict) {
  8821. const localFont = resources.get("Font");
  8822. if (localFont instanceof _primitives.Dict && localFont.has(fontName)) {
  8823. return resources;
  8824. }
  8825. }
  8826. }
  8827. if (acroFormResources instanceof _primitives.Dict) {
  8828. const acroFormFont = acroFormResources.get("Font");
  8829. if (acroFormFont instanceof _primitives.Dict && acroFormFont.has(fontName)) {
  8830. const subFontDict = new _primitives.Dict(xref);
  8831. subFontDict.set(fontName, acroFormFont.getRaw(fontName));
  8832. const subResourcesDict = new _primitives.Dict(xref);
  8833. subResourcesDict.set("Font", subFontDict);
  8834. return _primitives.Dict.merge({
  8835. xref,
  8836. dictArray: [subResourcesDict, localResources],
  8837. mergeSubDicts: true
  8838. });
  8839. }
  8840. }
  8841. return localResources || _primitives.Dict.empty;
  8842. }
  8843. getFieldObject() {
  8844. return null;
  8845. }
  8846. }
  8847. class TextWidgetAnnotation extends WidgetAnnotation {
  8848. constructor(params) {
  8849. super(params);
  8850. this._hasText = true;
  8851. const dict = params.dict;
  8852. if (typeof this.data.fieldValue !== "string") {
  8853. this.data.fieldValue = "";
  8854. }
  8855. let alignment = (0, _core_utils.getInheritableProperty)({
  8856. dict,
  8857. key: "Q"
  8858. });
  8859. if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
  8860. alignment = null;
  8861. }
  8862. this.data.textAlignment = alignment;
  8863. let maximumLength = (0, _core_utils.getInheritableProperty)({
  8864. dict,
  8865. key: "MaxLen"
  8866. });
  8867. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  8868. maximumLength = 0;
  8869. }
  8870. this.data.maxLen = maximumLength;
  8871. this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
  8872. 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;
  8873. this.data.doNotScroll = this.hasFieldFlag(_util.AnnotationFieldFlag.DONOTSCROLL);
  8874. }
  8875. _getCombAppearance(defaultAppearance, font, text, fontSize, width, height, hPadding, vPadding, descent, lineHeight, annotationStorage) {
  8876. const combWidth = width / this.data.maxLen;
  8877. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  8878. const buf = [];
  8879. const positions = font.getCharPositions(text);
  8880. for (const [start, end] of positions) {
  8881. buf.push(`(${(0, _core_utils.escapeString)(text.substring(start, end))}) Tj`);
  8882. }
  8883. const renderedComb = buf.join(` ${(0, _core_utils.numberToString)(combWidth)} 0 Td `);
  8884. 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";
  8885. }
  8886. _getMultilineAppearance(defaultAppearance, lines, font, fontSize, width, height, alignment, hPadding, vPadding, descent, lineHeight, annotationStorage) {
  8887. const buf = [];
  8888. const totalWidth = width - 2 * hPadding;
  8889. const prevInfo = {
  8890. shift: 0
  8891. };
  8892. for (let i = 0, ii = lines.length; i < ii; i++) {
  8893. const line = lines[i];
  8894. const chunks = this._splitLine(line, font, fontSize, totalWidth);
  8895. for (let j = 0, jj = chunks.length; j < jj; j++) {
  8896. const chunk = chunks[j];
  8897. const vShift = i === 0 && j === 0 ? -vPadding - (lineHeight - descent) : -lineHeight;
  8898. buf.push(this._renderText(chunk, font, fontSize, width, alignment, prevInfo, hPadding, vShift));
  8899. }
  8900. }
  8901. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  8902. const renderedText = buf.join("\n");
  8903. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 ${(0, _core_utils.numberToString)(height)} Tm ${renderedText}` + " ET Q EMC";
  8904. }
  8905. _splitLine(line, font, fontSize, width) {
  8906. let cache = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
  8907. line = cache.line || line;
  8908. const glyphs = cache.glyphs || font.charsToGlyphs(line);
  8909. if (glyphs.length <= 1) {
  8910. return [line];
  8911. }
  8912. const positions = cache.positions || font.getCharPositions(line);
  8913. const scale = fontSize / 1000;
  8914. const chunks = [];
  8915. let lastSpacePosInStringStart = -1,
  8916. lastSpacePosInStringEnd = -1,
  8917. lastSpacePos = -1,
  8918. startChunk = 0,
  8919. currentWidth = 0;
  8920. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  8921. const [start, end] = positions[i];
  8922. const glyph = glyphs[i];
  8923. const glyphWidth = glyph.width * scale;
  8924. if (glyph.unicode === " ") {
  8925. if (currentWidth + glyphWidth > width) {
  8926. chunks.push(line.substring(startChunk, start));
  8927. startChunk = start;
  8928. currentWidth = glyphWidth;
  8929. lastSpacePosInStringStart = -1;
  8930. lastSpacePos = -1;
  8931. } else {
  8932. currentWidth += glyphWidth;
  8933. lastSpacePosInStringStart = start;
  8934. lastSpacePosInStringEnd = end;
  8935. lastSpacePos = i;
  8936. }
  8937. } else {
  8938. if (currentWidth + glyphWidth > width) {
  8939. if (lastSpacePosInStringStart !== -1) {
  8940. chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
  8941. startChunk = lastSpacePosInStringEnd;
  8942. i = lastSpacePos + 1;
  8943. lastSpacePosInStringStart = -1;
  8944. currentWidth = 0;
  8945. } else {
  8946. chunks.push(line.substring(startChunk, start));
  8947. startChunk = start;
  8948. currentWidth = glyphWidth;
  8949. }
  8950. } else {
  8951. currentWidth += glyphWidth;
  8952. }
  8953. }
  8954. }
  8955. if (startChunk < line.length) {
  8956. chunks.push(line.substring(startChunk, line.length));
  8957. }
  8958. return chunks;
  8959. }
  8960. getFieldObject() {
  8961. return {
  8962. id: this.data.id,
  8963. value: this.data.fieldValue,
  8964. defaultValue: this.data.defaultFieldValue || "",
  8965. multiline: this.data.multiLine,
  8966. password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD),
  8967. charLimit: this.data.maxLen,
  8968. comb: this.data.comb,
  8969. editable: !this.data.readOnly,
  8970. hidden: this.data.hidden,
  8971. name: this.data.fieldName,
  8972. rect: this.data.rect,
  8973. actions: this.data.actions,
  8974. page: this.data.pageIndex,
  8975. strokeColor: this.data.borderColor,
  8976. fillColor: this.data.backgroundColor,
  8977. rotation: this.rotation,
  8978. type: "text"
  8979. };
  8980. }
  8981. }
  8982. class ButtonWidgetAnnotation extends WidgetAnnotation {
  8983. constructor(params) {
  8984. super(params);
  8985. this.checkedAppearance = null;
  8986. this.uncheckedAppearance = null;
  8987. this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  8988. this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  8989. this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  8990. this.data.isTooltipOnly = false;
  8991. if (this.data.checkBox) {
  8992. this._processCheckBox(params);
  8993. } else if (this.data.radioButton) {
  8994. this._processRadioButton(params);
  8995. } else if (this.data.pushButton) {
  8996. this.data.hasOwnCanvas = true;
  8997. this._processPushButton(params);
  8998. } else {
  8999. (0, _util.warn)("Invalid field flags for button widget annotation");
  9000. }
  9001. }
  9002. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  9003. if (this.data.pushButton) {
  9004. return super.getOperatorList(evaluator, task, intent, false, annotationStorage);
  9005. }
  9006. let value = null;
  9007. let rotation = null;
  9008. if (annotationStorage) {
  9009. const storageEntry = annotationStorage.get(this.data.id);
  9010. value = storageEntry ? storageEntry.value : null;
  9011. rotation = storageEntry ? storageEntry.rotation : null;
  9012. }
  9013. if (value === null && this.appearance) {
  9014. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  9015. }
  9016. if (value === null || value === undefined) {
  9017. if (this.data.checkBox) {
  9018. value = this.data.fieldValue === this.data.exportValue;
  9019. } else {
  9020. value = this.data.fieldValue === this.data.buttonValue;
  9021. }
  9022. }
  9023. const appearance = value ? this.checkedAppearance : this.uncheckedAppearance;
  9024. if (appearance) {
  9025. const savedAppearance = this.appearance;
  9026. const savedMatrix = appearance.dict.getArray("Matrix") || _util.IDENTITY_MATRIX;
  9027. if (rotation) {
  9028. appearance.dict.set("Matrix", this.getRotationMatrix(annotationStorage));
  9029. }
  9030. this.appearance = appearance;
  9031. const operatorList = super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  9032. this.appearance = savedAppearance;
  9033. appearance.dict.set("Matrix", savedMatrix);
  9034. return operatorList;
  9035. }
  9036. return {
  9037. opList: new _operator_list.OperatorList(),
  9038. separateForm: false,
  9039. separateCanvas: false
  9040. };
  9041. }
  9042. async save(evaluator, task, annotationStorage) {
  9043. if (this.data.checkBox) {
  9044. return this._saveCheckbox(evaluator, task, annotationStorage);
  9045. }
  9046. if (this.data.radioButton) {
  9047. return this._saveRadioButton(evaluator, task, annotationStorage);
  9048. }
  9049. return null;
  9050. }
  9051. async _saveCheckbox(evaluator, task, annotationStorage) {
  9052. if (!annotationStorage) {
  9053. return null;
  9054. }
  9055. const storageEntry = annotationStorage.get(this.data.id);
  9056. let rotation = storageEntry && storageEntry.rotation;
  9057. let value = storageEntry && storageEntry.value;
  9058. if (rotation === undefined) {
  9059. if (value === undefined) {
  9060. return null;
  9061. }
  9062. const defaultValue = this.data.fieldValue === this.data.exportValue;
  9063. if (defaultValue === value) {
  9064. return null;
  9065. }
  9066. }
  9067. const dict = evaluator.xref.fetchIfRef(this.ref);
  9068. if (!(dict instanceof _primitives.Dict)) {
  9069. return null;
  9070. }
  9071. if (rotation === undefined) {
  9072. rotation = this.rotation;
  9073. }
  9074. if (value === undefined) {
  9075. value = this.data.fieldValue === this.data.exportValue;
  9076. }
  9077. const xfa = {
  9078. path: this.data.fieldName,
  9079. value: value ? this.data.exportValue : ""
  9080. };
  9081. const name = _primitives.Name.get(value ? this.data.exportValue : "Off");
  9082. dict.set("V", name);
  9083. dict.set("AS", name);
  9084. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  9085. const maybeMK = this._getMKDict(rotation);
  9086. if (maybeMK) {
  9087. dict.set("MK", maybeMK);
  9088. }
  9089. const encrypt = evaluator.xref.encrypt;
  9090. let originalTransform = null;
  9091. if (encrypt) {
  9092. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  9093. }
  9094. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  9095. (0, _writer.writeDict)(dict, buffer, originalTransform);
  9096. buffer.push("\nendobj\n");
  9097. return [{
  9098. ref: this.ref,
  9099. data: buffer.join(""),
  9100. xfa
  9101. }];
  9102. }
  9103. async _saveRadioButton(evaluator, task, annotationStorage) {
  9104. if (!annotationStorage) {
  9105. return null;
  9106. }
  9107. const storageEntry = annotationStorage.get(this.data.id);
  9108. let rotation = storageEntry && storageEntry.rotation;
  9109. let value = storageEntry && storageEntry.value;
  9110. if (rotation === undefined) {
  9111. if (value === undefined) {
  9112. return null;
  9113. }
  9114. const defaultValue = this.data.fieldValue === this.data.buttonValue;
  9115. if (defaultValue === value) {
  9116. return null;
  9117. }
  9118. }
  9119. const dict = evaluator.xref.fetchIfRef(this.ref);
  9120. if (!(dict instanceof _primitives.Dict)) {
  9121. return null;
  9122. }
  9123. if (value === undefined) {
  9124. value = this.data.fieldValue === this.data.buttonValue;
  9125. }
  9126. if (rotation === undefined) {
  9127. rotation = this.rotation;
  9128. }
  9129. const xfa = {
  9130. path: this.data.fieldName,
  9131. value: value ? this.data.buttonValue : ""
  9132. };
  9133. const name = _primitives.Name.get(value ? this.data.buttonValue : "Off");
  9134. let parentBuffer = null;
  9135. const encrypt = evaluator.xref.encrypt;
  9136. if (value) {
  9137. if (this.parent instanceof _primitives.Ref) {
  9138. const parent = evaluator.xref.fetch(this.parent);
  9139. let parentTransform = null;
  9140. if (encrypt) {
  9141. parentTransform = encrypt.createCipherTransform(this.parent.num, this.parent.gen);
  9142. }
  9143. parent.set("V", name);
  9144. parentBuffer = [`${this.parent.num} ${this.parent.gen} obj\n`];
  9145. (0, _writer.writeDict)(parent, parentBuffer, parentTransform);
  9146. parentBuffer.push("\nendobj\n");
  9147. } else if (this.parent instanceof _primitives.Dict) {
  9148. this.parent.set("V", name);
  9149. }
  9150. }
  9151. dict.set("AS", name);
  9152. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  9153. const maybeMK = this._getMKDict(rotation);
  9154. if (maybeMK) {
  9155. dict.set("MK", maybeMK);
  9156. }
  9157. let originalTransform = null;
  9158. if (encrypt) {
  9159. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  9160. }
  9161. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  9162. (0, _writer.writeDict)(dict, buffer, originalTransform);
  9163. buffer.push("\nendobj\n");
  9164. const newRefs = [{
  9165. ref: this.ref,
  9166. data: buffer.join(""),
  9167. xfa
  9168. }];
  9169. if (parentBuffer !== null) {
  9170. newRefs.push({
  9171. ref: this.parent,
  9172. data: parentBuffer.join(""),
  9173. xfa: null
  9174. });
  9175. }
  9176. return newRefs;
  9177. }
  9178. _getDefaultCheckedAppearance(params, type) {
  9179. const width = this.data.rect[2] - this.data.rect[0];
  9180. const height = this.data.rect[3] - this.data.rect[1];
  9181. const bbox = [0, 0, width, height];
  9182. const FONT_RATIO = 0.8;
  9183. const fontSize = Math.min(width, height) * FONT_RATIO;
  9184. let metrics, char;
  9185. if (type === "check") {
  9186. metrics = {
  9187. width: 0.755 * fontSize,
  9188. height: 0.705 * fontSize
  9189. };
  9190. char = "\x33";
  9191. } else if (type === "disc") {
  9192. metrics = {
  9193. width: 0.791 * fontSize,
  9194. height: 0.705 * fontSize
  9195. };
  9196. char = "\x6C";
  9197. } else {
  9198. (0, _util.unreachable)(`_getDefaultCheckedAppearance - unsupported type: ${type}`);
  9199. }
  9200. const xShift = (0, _core_utils.numberToString)((width - metrics.width) / 2);
  9201. const yShift = (0, _core_utils.numberToString)((height - metrics.height) / 2);
  9202. const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`;
  9203. const appearanceStreamDict = new _primitives.Dict(params.xref);
  9204. appearanceStreamDict.set("FormType", 1);
  9205. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  9206. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  9207. appearanceStreamDict.set("BBox", bbox);
  9208. appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]);
  9209. appearanceStreamDict.set("Length", appearance.length);
  9210. const resources = new _primitives.Dict(params.xref);
  9211. const font = new _primitives.Dict(params.xref);
  9212. font.set("PdfJsZaDb", this.fallbackFontDict);
  9213. resources.set("Font", font);
  9214. appearanceStreamDict.set("Resources", resources);
  9215. this.checkedAppearance = new _stream.StringStream(appearance);
  9216. this.checkedAppearance.dict = appearanceStreamDict;
  9217. this._streams.push(this.checkedAppearance);
  9218. }
  9219. _processCheckBox(params) {
  9220. const customAppearance = params.dict.get("AP");
  9221. if (!(customAppearance instanceof _primitives.Dict)) {
  9222. return;
  9223. }
  9224. const normalAppearance = customAppearance.get("N");
  9225. if (!(normalAppearance instanceof _primitives.Dict)) {
  9226. return;
  9227. }
  9228. const asValue = this._decodeFormValue(params.dict.get("AS"));
  9229. if (typeof asValue === "string") {
  9230. this.data.fieldValue = asValue;
  9231. }
  9232. const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes";
  9233. const exportValues = normalAppearance.getKeys();
  9234. if (exportValues.length === 0) {
  9235. exportValues.push("Off", yes);
  9236. } else if (exportValues.length === 1) {
  9237. if (exportValues[0] === "Off") {
  9238. exportValues.push(yes);
  9239. } else {
  9240. exportValues.unshift("Off");
  9241. }
  9242. } else if (exportValues.includes(yes)) {
  9243. exportValues.length = 0;
  9244. exportValues.push("Off", yes);
  9245. } else {
  9246. const otherYes = exportValues.find(v => v !== "Off");
  9247. exportValues.length = 0;
  9248. exportValues.push("Off", otherYes);
  9249. }
  9250. if (!exportValues.includes(this.data.fieldValue)) {
  9251. this.data.fieldValue = "Off";
  9252. }
  9253. this.data.exportValue = exportValues[1];
  9254. const checkedAppearance = normalAppearance.get(this.data.exportValue);
  9255. this.checkedAppearance = checkedAppearance instanceof _base_stream.BaseStream ? checkedAppearance : null;
  9256. const uncheckedAppearance = normalAppearance.get("Off");
  9257. this.uncheckedAppearance = uncheckedAppearance instanceof _base_stream.BaseStream ? uncheckedAppearance : null;
  9258. if (this.checkedAppearance) {
  9259. this._streams.push(this.checkedAppearance);
  9260. } else {
  9261. this._getDefaultCheckedAppearance(params, "check");
  9262. }
  9263. if (this.uncheckedAppearance) {
  9264. this._streams.push(this.uncheckedAppearance);
  9265. }
  9266. this._fallbackFontDict = this.fallbackFontDict;
  9267. }
  9268. _processRadioButton(params) {
  9269. this.data.fieldValue = this.data.buttonValue = null;
  9270. const fieldParent = params.dict.get("Parent");
  9271. if (fieldParent instanceof _primitives.Dict) {
  9272. this.parent = params.dict.getRaw("Parent");
  9273. const fieldParentValue = fieldParent.get("V");
  9274. if (fieldParentValue instanceof _primitives.Name) {
  9275. this.data.fieldValue = this._decodeFormValue(fieldParentValue);
  9276. }
  9277. }
  9278. const appearanceStates = params.dict.get("AP");
  9279. if (!(appearanceStates instanceof _primitives.Dict)) {
  9280. return;
  9281. }
  9282. const normalAppearance = appearanceStates.get("N");
  9283. if (!(normalAppearance instanceof _primitives.Dict)) {
  9284. return;
  9285. }
  9286. for (const key of normalAppearance.getKeys()) {
  9287. if (key !== "Off") {
  9288. this.data.buttonValue = this._decodeFormValue(key);
  9289. break;
  9290. }
  9291. }
  9292. const checkedAppearance = normalAppearance.get(this.data.buttonValue);
  9293. this.checkedAppearance = checkedAppearance instanceof _base_stream.BaseStream ? checkedAppearance : null;
  9294. const uncheckedAppearance = normalAppearance.get("Off");
  9295. this.uncheckedAppearance = uncheckedAppearance instanceof _base_stream.BaseStream ? uncheckedAppearance : null;
  9296. if (this.checkedAppearance) {
  9297. this._streams.push(this.checkedAppearance);
  9298. } else {
  9299. this._getDefaultCheckedAppearance(params, "disc");
  9300. }
  9301. if (this.uncheckedAppearance) {
  9302. this._streams.push(this.uncheckedAppearance);
  9303. }
  9304. this._fallbackFontDict = this.fallbackFontDict;
  9305. }
  9306. _processPushButton(params) {
  9307. if (!params.dict.has("A") && !params.dict.has("AA") && !this.data.alternativeText) {
  9308. (0, _util.warn)("Push buttons without action dictionaries are not supported");
  9309. return;
  9310. }
  9311. this.data.isTooltipOnly = !params.dict.has("A") && !params.dict.has("AA");
  9312. _catalog.Catalog.parseDestDictionary({
  9313. destDict: params.dict,
  9314. resultObj: this.data,
  9315. docBaseUrl: params.pdfManager.docBaseUrl,
  9316. docAttachments: params.attachments
  9317. });
  9318. }
  9319. getFieldObject() {
  9320. let type = "button";
  9321. let exportValues;
  9322. if (this.data.checkBox) {
  9323. type = "checkbox";
  9324. exportValues = this.data.exportValue;
  9325. } else if (this.data.radioButton) {
  9326. type = "radiobutton";
  9327. exportValues = this.data.buttonValue;
  9328. }
  9329. return {
  9330. id: this.data.id,
  9331. value: this.data.fieldValue || "Off",
  9332. defaultValue: this.data.defaultFieldValue,
  9333. exportValues,
  9334. editable: !this.data.readOnly,
  9335. name: this.data.fieldName,
  9336. rect: this.data.rect,
  9337. hidden: this.data.hidden,
  9338. actions: this.data.actions,
  9339. page: this.data.pageIndex,
  9340. strokeColor: this.data.borderColor,
  9341. fillColor: this.data.backgroundColor,
  9342. rotation: this.rotation,
  9343. type
  9344. };
  9345. }
  9346. get fallbackFontDict() {
  9347. const dict = new _primitives.Dict();
  9348. dict.set("BaseFont", _primitives.Name.get("ZapfDingbats"));
  9349. dict.set("Type", _primitives.Name.get("FallbackType"));
  9350. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  9351. dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding"));
  9352. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  9353. }
  9354. }
  9355. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  9356. constructor(params) {
  9357. super(params);
  9358. const {
  9359. dict,
  9360. xref
  9361. } = params;
  9362. this.indices = dict.getArray("I");
  9363. this.hasIndices = Array.isArray(this.indices) && this.indices.length > 0;
  9364. this.data.options = [];
  9365. const options = (0, _core_utils.getInheritableProperty)({
  9366. dict,
  9367. key: "Opt"
  9368. });
  9369. if (Array.isArray(options)) {
  9370. for (let i = 0, ii = options.length; i < ii; i++) {
  9371. const option = xref.fetchIfRef(options[i]);
  9372. const isOptionArray = Array.isArray(option);
  9373. this.data.options[i] = {
  9374. exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
  9375. displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
  9376. };
  9377. }
  9378. }
  9379. if (!this.hasIndices) {
  9380. if (typeof this.data.fieldValue === "string") {
  9381. this.data.fieldValue = [this.data.fieldValue];
  9382. } else if (!this.data.fieldValue) {
  9383. this.data.fieldValue = [];
  9384. }
  9385. } else {
  9386. this.data.fieldValue = [];
  9387. const ii = this.data.options.length;
  9388. for (const i of this.indices) {
  9389. if (Number.isInteger(i) && i >= 0 && i < ii) {
  9390. this.data.fieldValue.push(this.data.options[i].exportValue);
  9391. }
  9392. }
  9393. }
  9394. this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
  9395. this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
  9396. this._hasText = true;
  9397. }
  9398. getFieldObject() {
  9399. const type = this.data.combo ? "combobox" : "listbox";
  9400. const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
  9401. return {
  9402. id: this.data.id,
  9403. value,
  9404. defaultValue: this.data.defaultFieldValue,
  9405. editable: !this.data.readOnly,
  9406. name: this.data.fieldName,
  9407. rect: this.data.rect,
  9408. numItems: this.data.fieldValue.length,
  9409. multipleSelection: this.data.multiSelect,
  9410. hidden: this.data.hidden,
  9411. actions: this.data.actions,
  9412. items: this.data.options,
  9413. page: this.data.pageIndex,
  9414. strokeColor: this.data.borderColor,
  9415. fillColor: this.data.backgroundColor,
  9416. rotation: this.rotation,
  9417. type
  9418. };
  9419. }
  9420. amendSavedDict(annotationStorage, dict) {
  9421. if (!this.hasIndices) {
  9422. return;
  9423. }
  9424. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  9425. let values = storageEntry && storageEntry.value;
  9426. if (!Array.isArray(values)) {
  9427. values = [values];
  9428. }
  9429. const indices = [];
  9430. const {
  9431. options
  9432. } = this.data;
  9433. for (let i = 0, j = 0, ii = options.length; i < ii; i++) {
  9434. if (options[i].exportValue === values[j]) {
  9435. indices.push(i);
  9436. j += 1;
  9437. }
  9438. }
  9439. dict.set("I", indices);
  9440. }
  9441. async _getAppearance(evaluator, task, intent, annotationStorage) {
  9442. if (this.data.combo) {
  9443. return super._getAppearance(evaluator, task, intent, annotationStorage);
  9444. }
  9445. let exportedValue, rotation;
  9446. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  9447. if (storageEntry) {
  9448. rotation = storageEntry.rotation;
  9449. exportedValue = storageEntry.value;
  9450. }
  9451. if (rotation === undefined && exportedValue === undefined && !this._needAppearances) {
  9452. return null;
  9453. }
  9454. if (exportedValue === undefined) {
  9455. exportedValue = this.data.fieldValue;
  9456. } else if (!Array.isArray(exportedValue)) {
  9457. exportedValue = [exportedValue];
  9458. }
  9459. const defaultPadding = 1;
  9460. const defaultHPadding = 2;
  9461. let totalHeight = this.data.rect[3] - this.data.rect[1];
  9462. let totalWidth = this.data.rect[2] - this.data.rect[0];
  9463. if (rotation === 90 || rotation === 270) {
  9464. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  9465. }
  9466. const lineCount = this.data.options.length;
  9467. const valueIndices = [];
  9468. for (let i = 0; i < lineCount; i++) {
  9469. const {
  9470. exportValue
  9471. } = this.data.options[i];
  9472. if (exportedValue.includes(exportValue)) {
  9473. valueIndices.push(i);
  9474. }
  9475. }
  9476. if (!this._defaultAppearance) {
  9477. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  9478. }
  9479. const font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  9480. let defaultAppearance;
  9481. let {
  9482. fontSize
  9483. } = this.data.defaultAppearanceData;
  9484. if (!fontSize) {
  9485. const lineHeight = (totalHeight - defaultPadding) / lineCount;
  9486. let lineWidth = -1;
  9487. let value;
  9488. for (const {
  9489. displayValue
  9490. } of this.data.options) {
  9491. const width = this._getTextWidth(displayValue, font);
  9492. if (width > lineWidth) {
  9493. lineWidth = width;
  9494. value = displayValue;
  9495. }
  9496. }
  9497. [defaultAppearance, fontSize] = this._computeFontSize(lineHeight, totalWidth - 2 * defaultHPadding, value, font, -1);
  9498. } else {
  9499. defaultAppearance = this._defaultAppearance;
  9500. }
  9501. const lineHeight = fontSize * _util.LINE_FACTOR;
  9502. const vPadding = (lineHeight - fontSize) / 2;
  9503. const numberOfVisibleLines = Math.floor(totalHeight / lineHeight);
  9504. let firstIndex;
  9505. if (valueIndices.length === 1) {
  9506. const valuePosition = valueIndices[0];
  9507. const indexInPage = valuePosition % numberOfVisibleLines;
  9508. firstIndex = valuePosition - indexInPage;
  9509. } else {
  9510. firstIndex = valueIndices.length ? valueIndices[0] : 0;
  9511. }
  9512. const end = Math.min(firstIndex + numberOfVisibleLines + 1, lineCount);
  9513. const buf = ["/Tx BMC q", `1 1 ${totalWidth} ${totalHeight} re W n`];
  9514. if (valueIndices.length) {
  9515. buf.push("0.600006 0.756866 0.854904 rg");
  9516. for (const index of valueIndices) {
  9517. if (firstIndex <= index && index < end) {
  9518. buf.push(`1 ${totalHeight - (index - firstIndex + 1) * lineHeight} ${totalWidth} ${lineHeight} re f`);
  9519. }
  9520. }
  9521. }
  9522. buf.push("BT", defaultAppearance, `1 0 0 1 0 ${totalHeight} Tm`);
  9523. const prevInfo = {
  9524. shift: 0
  9525. };
  9526. for (let i = firstIndex; i < end; i++) {
  9527. const {
  9528. displayValue
  9529. } = this.data.options[i];
  9530. const vpadding = i === firstIndex ? vPadding : 0;
  9531. buf.push(this._renderText(displayValue, font, fontSize, totalWidth, 0, prevInfo, defaultHPadding, -lineHeight + vpadding));
  9532. }
  9533. buf.push("ET Q EMC");
  9534. return buf.join("\n");
  9535. }
  9536. }
  9537. class SignatureWidgetAnnotation extends WidgetAnnotation {
  9538. constructor(params) {
  9539. super(params);
  9540. this.data.fieldValue = null;
  9541. }
  9542. getFieldObject() {
  9543. return {
  9544. id: this.data.id,
  9545. value: null,
  9546. page: this.data.pageIndex,
  9547. type: "signature"
  9548. };
  9549. }
  9550. }
  9551. class TextAnnotation extends MarkupAnnotation {
  9552. constructor(params) {
  9553. const DEFAULT_ICON_SIZE = 22;
  9554. super(params);
  9555. const {
  9556. dict
  9557. } = params;
  9558. this.data.annotationType = _util.AnnotationType.TEXT;
  9559. if (this.data.hasAppearance) {
  9560. this.data.name = "NoIcon";
  9561. } else {
  9562. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  9563. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  9564. this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
  9565. }
  9566. if (dict.has("State")) {
  9567. this.data.state = dict.get("State") || null;
  9568. this.data.stateModel = dict.get("StateModel") || null;
  9569. } else {
  9570. this.data.state = null;
  9571. this.data.stateModel = null;
  9572. }
  9573. }
  9574. }
  9575. class LinkAnnotation extends Annotation {
  9576. constructor(params) {
  9577. super(params);
  9578. this.data.annotationType = _util.AnnotationType.LINK;
  9579. const quadPoints = getQuadPoints(params.dict, this.rectangle);
  9580. if (quadPoints) {
  9581. this.data.quadPoints = quadPoints;
  9582. }
  9583. this.data.borderColor = this.data.borderColor || this.data.color;
  9584. _catalog.Catalog.parseDestDictionary({
  9585. destDict: params.dict,
  9586. resultObj: this.data,
  9587. docBaseUrl: params.pdfManager.docBaseUrl,
  9588. docAttachments: params.attachments
  9589. });
  9590. }
  9591. }
  9592. class PopupAnnotation extends Annotation {
  9593. constructor(params) {
  9594. super(params);
  9595. const {
  9596. dict
  9597. } = params;
  9598. this.data.annotationType = _util.AnnotationType.POPUP;
  9599. let parentItem = dict.get("Parent");
  9600. if (!parentItem) {
  9601. (0, _util.warn)("Popup annotation has a missing or invalid parent annotation.");
  9602. return;
  9603. }
  9604. const parentSubtype = parentItem.get("Subtype");
  9605. this.data.parentType = parentSubtype instanceof _primitives.Name ? parentSubtype.name : null;
  9606. const rawParent = dict.getRaw("Parent");
  9607. this.data.parentId = rawParent instanceof _primitives.Ref ? rawParent.toString() : null;
  9608. const parentRect = parentItem.getArray("Rect");
  9609. if (Array.isArray(parentRect) && parentRect.length === 4) {
  9610. this.data.parentRect = _util.Util.normalizeRect(parentRect);
  9611. } else {
  9612. this.data.parentRect = [0, 0, 0, 0];
  9613. }
  9614. const rt = parentItem.get("RT");
  9615. if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
  9616. parentItem = parentItem.get("IRT");
  9617. }
  9618. if (!parentItem.has("M")) {
  9619. this.data.modificationDate = null;
  9620. } else {
  9621. this.setModificationDate(parentItem.get("M"));
  9622. this.data.modificationDate = this.modificationDate;
  9623. }
  9624. if (!parentItem.has("C")) {
  9625. this.data.color = null;
  9626. } else {
  9627. this.setColor(parentItem.getArray("C"));
  9628. this.data.color = this.color;
  9629. }
  9630. if (!this.viewable) {
  9631. const parentFlags = parentItem.get("F");
  9632. if (this._isViewable(parentFlags)) {
  9633. this.setFlags(parentFlags);
  9634. }
  9635. }
  9636. this.setTitle(parentItem.get("T"));
  9637. this.data.titleObj = this._title;
  9638. this.setContents(parentItem.get("Contents"));
  9639. this.data.contentsObj = this._contents;
  9640. if (parentItem.has("RC")) {
  9641. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(parentItem.get("RC"));
  9642. }
  9643. }
  9644. }
  9645. exports.PopupAnnotation = PopupAnnotation;
  9646. class FreeTextAnnotation extends MarkupAnnotation {
  9647. constructor(params) {
  9648. super(params);
  9649. const {
  9650. xref
  9651. } = params;
  9652. this.data.annotationType = _util.AnnotationType.FREETEXT;
  9653. this.setDefaultAppearance(params);
  9654. if (!this.appearance && this._isOffscreenCanvasSupported) {
  9655. const strokeAlpha = params.dict.get("CA");
  9656. const fakeUnicodeFont = new _default_appearance.FakeUnicodeFont(xref, "sans-serif");
  9657. const fontData = this.data.defaultAppearanceData;
  9658. this.appearance = fakeUnicodeFont.createAppearance(this._contents.str, this.rectangle, this.rotation, fontData.fontSize || 10, fontData.fontColor, strokeAlpha);
  9659. this._streams.push(this.appearance, _default_appearance.FakeUnicodeFont.toUnicodeStream);
  9660. } else if (!this._isOffscreenCanvasSupported) {
  9661. (0, _util.warn)("FreeTextAnnotation: OffscreenCanvas is not supported, annotation may not render correctly.");
  9662. }
  9663. }
  9664. get hasTextContent() {
  9665. return !!this.appearance;
  9666. }
  9667. static createNewDict(annotation, xref, _ref4) {
  9668. let {
  9669. apRef,
  9670. ap
  9671. } = _ref4;
  9672. const {
  9673. color,
  9674. fontSize,
  9675. rect,
  9676. rotation,
  9677. user,
  9678. value
  9679. } = annotation;
  9680. const freetext = new _primitives.Dict(xref);
  9681. freetext.set("Type", _primitives.Name.get("Annot"));
  9682. freetext.set("Subtype", _primitives.Name.get("FreeText"));
  9683. freetext.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
  9684. freetext.set("Rect", rect);
  9685. const da = `/Helv ${fontSize} Tf ${(0, _default_appearance.getPdfColor)(color, true)}`;
  9686. freetext.set("DA", da);
  9687. freetext.set("Contents", (0, _core_utils.isAscii)(value) ? value : (0, _core_utils.stringToUTF16String)(value, true));
  9688. freetext.set("F", 4);
  9689. freetext.set("Border", [0, 0, 0]);
  9690. freetext.set("Rotate", rotation);
  9691. if (user) {
  9692. freetext.set("T", (0, _core_utils.isAscii)(user) ? user : (0, _core_utils.stringToUTF16String)(user, true));
  9693. }
  9694. if (apRef || ap) {
  9695. const n = new _primitives.Dict(xref);
  9696. freetext.set("AP", n);
  9697. if (apRef) {
  9698. n.set("N", apRef);
  9699. } else {
  9700. n.set("N", ap);
  9701. }
  9702. }
  9703. return freetext;
  9704. }
  9705. static async createNewAppearanceStream(annotation, xref, params) {
  9706. const {
  9707. baseFontRef,
  9708. evaluator,
  9709. task
  9710. } = params;
  9711. const {
  9712. color,
  9713. fontSize,
  9714. rect,
  9715. rotation,
  9716. value
  9717. } = annotation;
  9718. const resources = new _primitives.Dict(xref);
  9719. const font = new _primitives.Dict(xref);
  9720. if (baseFontRef) {
  9721. font.set("Helv", baseFontRef);
  9722. } else {
  9723. const baseFont = new _primitives.Dict(xref);
  9724. baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
  9725. baseFont.set("Type", _primitives.Name.get("Font"));
  9726. baseFont.set("Subtype", _primitives.Name.get("Type1"));
  9727. baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  9728. font.set("Helv", baseFont);
  9729. }
  9730. resources.set("Font", font);
  9731. const helv = await WidgetAnnotation._getFontData(evaluator, task, {
  9732. fontName: "Helvetica",
  9733. fontSize
  9734. }, resources);
  9735. const [x1, y1, x2, y2] = rect;
  9736. let w = x2 - x1;
  9737. let h = y2 - y1;
  9738. if (rotation % 180 !== 0) {
  9739. [w, h] = [h, w];
  9740. }
  9741. const lines = value.split("\n");
  9742. const scale = fontSize / 1000;
  9743. let totalWidth = -Infinity;
  9744. const encodedLines = [];
  9745. for (let line of lines) {
  9746. const encoded = helv.encodeString(line);
  9747. if (encoded.length > 1) {
  9748. return null;
  9749. }
  9750. line = encoded.join("");
  9751. encodedLines.push(line);
  9752. let lineWidth = 0;
  9753. const glyphs = helv.charsToGlyphs(line);
  9754. for (const glyph of glyphs) {
  9755. lineWidth += glyph.width * scale;
  9756. }
  9757. totalWidth = Math.max(totalWidth, lineWidth);
  9758. }
  9759. let hscale = 1;
  9760. if (totalWidth > w) {
  9761. hscale = w / totalWidth;
  9762. }
  9763. let vscale = 1;
  9764. const lineHeight = _util.LINE_FACTOR * fontSize;
  9765. const lineDescent = _util.LINE_DESCENT_FACTOR * fontSize;
  9766. const totalHeight = lineHeight * lines.length;
  9767. if (totalHeight > h) {
  9768. vscale = h / totalHeight;
  9769. }
  9770. const fscale = Math.min(hscale, vscale);
  9771. const newFontSize = fontSize * fscale;
  9772. 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`];
  9773. const vShift = (0, _core_utils.numberToString)(lineHeight);
  9774. for (const line of encodedLines) {
  9775. buffer.push(`0 -${vShift} Td (${(0, _core_utils.escapeString)(line)}) Tj`);
  9776. }
  9777. buffer.push("ET", "Q");
  9778. const appearance = buffer.join("\n");
  9779. const appearanceStreamDict = new _primitives.Dict(xref);
  9780. appearanceStreamDict.set("FormType", 1);
  9781. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  9782. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  9783. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  9784. appearanceStreamDict.set("Resources", resources);
  9785. if (rotation) {
  9786. const matrix = (0, _core_utils.getRotationMatrix)(rotation, w, h);
  9787. appearanceStreamDict.set("Matrix", matrix);
  9788. }
  9789. const ap = new _stream.StringStream(appearance);
  9790. ap.dict = appearanceStreamDict;
  9791. return ap;
  9792. }
  9793. }
  9794. class LineAnnotation extends MarkupAnnotation {
  9795. constructor(params) {
  9796. super(params);
  9797. const {
  9798. dict,
  9799. xref
  9800. } = params;
  9801. this.data.annotationType = _util.AnnotationType.LINE;
  9802. const lineCoordinates = dict.getArray("L");
  9803. this.data.lineCoordinates = _util.Util.normalizeRect(lineCoordinates);
  9804. this.setLineEndings(dict.getArray("LE"));
  9805. this.data.lineEndings = this.lineEndings;
  9806. if (!this.appearance) {
  9807. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  9808. const strokeAlpha = dict.get("CA");
  9809. const interiorColor = getRgbColor(dict.getArray("IC"), null);
  9810. const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
  9811. const fillAlpha = fillColor ? strokeAlpha : null;
  9812. const borderWidth = this.borderStyle.width || 1,
  9813. borderAdjust = 2 * borderWidth;
  9814. const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust];
  9815. if (!_util.Util.intersect(this.rectangle, bbox)) {
  9816. this.rectangle = bbox;
  9817. }
  9818. this._setDefaultAppearance({
  9819. xref,
  9820. extra: `${borderWidth} w`,
  9821. strokeColor,
  9822. fillColor,
  9823. strokeAlpha,
  9824. fillAlpha,
  9825. pointsCallback: (buffer, points) => {
  9826. buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
  9827. return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth];
  9828. }
  9829. });
  9830. }
  9831. }
  9832. }
  9833. class SquareAnnotation extends MarkupAnnotation {
  9834. constructor(params) {
  9835. super(params);
  9836. const {
  9837. dict,
  9838. xref
  9839. } = params;
  9840. this.data.annotationType = _util.AnnotationType.SQUARE;
  9841. if (!this.appearance) {
  9842. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  9843. const strokeAlpha = dict.get("CA");
  9844. const interiorColor = getRgbColor(dict.getArray("IC"), null);
  9845. const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
  9846. const fillAlpha = fillColor ? strokeAlpha : null;
  9847. if (this.borderStyle.width === 0 && !fillColor) {
  9848. return;
  9849. }
  9850. this._setDefaultAppearance({
  9851. xref,
  9852. extra: `${this.borderStyle.width} w`,
  9853. strokeColor,
  9854. fillColor,
  9855. strokeAlpha,
  9856. fillAlpha,
  9857. pointsCallback: (buffer, points) => {
  9858. const x = points[2].x + this.borderStyle.width / 2;
  9859. const y = points[2].y + this.borderStyle.width / 2;
  9860. const width = points[3].x - points[2].x - this.borderStyle.width;
  9861. const height = points[1].y - points[3].y - this.borderStyle.width;
  9862. buffer.push(`${x} ${y} ${width} ${height} re`);
  9863. if (fillColor) {
  9864. buffer.push("B");
  9865. } else {
  9866. buffer.push("S");
  9867. }
  9868. return [points[0].x, points[1].x, points[3].y, points[1].y];
  9869. }
  9870. });
  9871. }
  9872. }
  9873. }
  9874. class CircleAnnotation extends MarkupAnnotation {
  9875. constructor(params) {
  9876. super(params);
  9877. const {
  9878. dict,
  9879. xref
  9880. } = params;
  9881. this.data.annotationType = _util.AnnotationType.CIRCLE;
  9882. if (!this.appearance) {
  9883. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  9884. const strokeAlpha = dict.get("CA");
  9885. const interiorColor = getRgbColor(dict.getArray("IC"), null);
  9886. const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
  9887. const fillAlpha = fillColor ? strokeAlpha : null;
  9888. if (this.borderStyle.width === 0 && !fillColor) {
  9889. return;
  9890. }
  9891. const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4));
  9892. this._setDefaultAppearance({
  9893. xref,
  9894. extra: `${this.borderStyle.width} w`,
  9895. strokeColor,
  9896. fillColor,
  9897. strokeAlpha,
  9898. fillAlpha,
  9899. pointsCallback: (buffer, points) => {
  9900. const x0 = points[0].x + this.borderStyle.width / 2;
  9901. const y0 = points[0].y - this.borderStyle.width / 2;
  9902. const x1 = points[3].x - this.borderStyle.width / 2;
  9903. const y1 = points[3].y + this.borderStyle.width / 2;
  9904. const xMid = x0 + (x1 - x0) / 2;
  9905. const yMid = y0 + (y1 - y0) / 2;
  9906. const xOffset = (x1 - x0) / 2 * controlPointsDistance;
  9907. const yOffset = (y1 - y0) / 2 * controlPointsDistance;
  9908. 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");
  9909. if (fillColor) {
  9910. buffer.push("B");
  9911. } else {
  9912. buffer.push("S");
  9913. }
  9914. return [points[0].x, points[1].x, points[3].y, points[1].y];
  9915. }
  9916. });
  9917. }
  9918. }
  9919. }
  9920. class PolylineAnnotation extends MarkupAnnotation {
  9921. constructor(params) {
  9922. super(params);
  9923. const {
  9924. dict,
  9925. xref
  9926. } = params;
  9927. this.data.annotationType = _util.AnnotationType.POLYLINE;
  9928. this.data.vertices = [];
  9929. if (!(this instanceof PolygonAnnotation)) {
  9930. this.setLineEndings(dict.getArray("LE"));
  9931. this.data.lineEndings = this.lineEndings;
  9932. }
  9933. const rawVertices = dict.getArray("Vertices");
  9934. if (!Array.isArray(rawVertices)) {
  9935. return;
  9936. }
  9937. for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
  9938. this.data.vertices.push({
  9939. x: rawVertices[i],
  9940. y: rawVertices[i + 1]
  9941. });
  9942. }
  9943. if (!this.appearance) {
  9944. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  9945. const strokeAlpha = dict.get("CA");
  9946. const borderWidth = this.borderStyle.width || 1,
  9947. borderAdjust = 2 * borderWidth;
  9948. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  9949. for (const vertex of this.data.vertices) {
  9950. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  9951. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  9952. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  9953. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  9954. }
  9955. if (!_util.Util.intersect(this.rectangle, bbox)) {
  9956. this.rectangle = bbox;
  9957. }
  9958. this._setDefaultAppearance({
  9959. xref,
  9960. extra: `${borderWidth} w`,
  9961. strokeColor,
  9962. strokeAlpha,
  9963. pointsCallback: (buffer, points) => {
  9964. const vertices = this.data.vertices;
  9965. for (let i = 0, ii = vertices.length; i < ii; i++) {
  9966. buffer.push(`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`);
  9967. }
  9968. buffer.push("S");
  9969. return [points[0].x, points[1].x, points[3].y, points[1].y];
  9970. }
  9971. });
  9972. }
  9973. }
  9974. }
  9975. class PolygonAnnotation extends PolylineAnnotation {
  9976. constructor(params) {
  9977. super(params);
  9978. this.data.annotationType = _util.AnnotationType.POLYGON;
  9979. }
  9980. }
  9981. class CaretAnnotation extends MarkupAnnotation {
  9982. constructor(params) {
  9983. super(params);
  9984. this.data.annotationType = _util.AnnotationType.CARET;
  9985. }
  9986. }
  9987. class InkAnnotation extends MarkupAnnotation {
  9988. constructor(params) {
  9989. super(params);
  9990. const {
  9991. dict,
  9992. xref
  9993. } = params;
  9994. this.data.annotationType = _util.AnnotationType.INK;
  9995. this.data.inkLists = [];
  9996. const rawInkLists = dict.getArray("InkList");
  9997. if (!Array.isArray(rawInkLists)) {
  9998. return;
  9999. }
  10000. for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
  10001. this.data.inkLists.push([]);
  10002. for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
  10003. this.data.inkLists[i].push({
  10004. x: xref.fetchIfRef(rawInkLists[i][j]),
  10005. y: xref.fetchIfRef(rawInkLists[i][j + 1])
  10006. });
  10007. }
  10008. }
  10009. if (!this.appearance) {
  10010. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  10011. const strokeAlpha = dict.get("CA");
  10012. const borderWidth = this.borderStyle.width || 1,
  10013. borderAdjust = 2 * borderWidth;
  10014. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  10015. for (const inkLists of this.data.inkLists) {
  10016. for (const vertex of inkLists) {
  10017. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  10018. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  10019. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  10020. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  10021. }
  10022. }
  10023. if (!_util.Util.intersect(this.rectangle, bbox)) {
  10024. this.rectangle = bbox;
  10025. }
  10026. this._setDefaultAppearance({
  10027. xref,
  10028. extra: `${borderWidth} w`,
  10029. strokeColor,
  10030. strokeAlpha,
  10031. pointsCallback: (buffer, points) => {
  10032. for (const inkList of this.data.inkLists) {
  10033. for (let i = 0, ii = inkList.length; i < ii; i++) {
  10034. buffer.push(`${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`);
  10035. }
  10036. buffer.push("S");
  10037. }
  10038. return [points[0].x, points[1].x, points[3].y, points[1].y];
  10039. }
  10040. });
  10041. }
  10042. }
  10043. static createNewDict(annotation, xref, _ref5) {
  10044. let {
  10045. apRef,
  10046. ap
  10047. } = _ref5;
  10048. const {
  10049. paths,
  10050. rect,
  10051. rotation
  10052. } = annotation;
  10053. const ink = new _primitives.Dict(xref);
  10054. ink.set("Type", _primitives.Name.get("Annot"));
  10055. ink.set("Subtype", _primitives.Name.get("Ink"));
  10056. ink.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
  10057. ink.set("Rect", rect);
  10058. ink.set("InkList", paths.map(p => p.points));
  10059. ink.set("F", 4);
  10060. ink.set("Border", [0, 0, 0]);
  10061. ink.set("Rotate", rotation);
  10062. const n = new _primitives.Dict(xref);
  10063. ink.set("AP", n);
  10064. if (apRef) {
  10065. n.set("N", apRef);
  10066. } else {
  10067. n.set("N", ap);
  10068. }
  10069. return ink;
  10070. }
  10071. static async createNewAppearanceStream(annotation, xref, params) {
  10072. const {
  10073. color,
  10074. rect,
  10075. rotation,
  10076. paths,
  10077. thickness,
  10078. opacity
  10079. } = annotation;
  10080. const [x1, y1, x2, y2] = rect;
  10081. let w = x2 - x1;
  10082. let h = y2 - y1;
  10083. if (rotation % 180 !== 0) {
  10084. [w, h] = [h, w];
  10085. }
  10086. const appearanceBuffer = [`${thickness} w 1 J 1 j`, `${(0, _default_appearance.getPdfColor)(color, false)}`];
  10087. if (opacity !== 1) {
  10088. appearanceBuffer.push("/R0 gs");
  10089. }
  10090. const buffer = [];
  10091. for (const {
  10092. bezier
  10093. } of paths) {
  10094. buffer.length = 0;
  10095. buffer.push(`${(0, _core_utils.numberToString)(bezier[0])} ${(0, _core_utils.numberToString)(bezier[1])} m`);
  10096. for (let i = 2, ii = bezier.length; i < ii; i += 6) {
  10097. const curve = bezier.slice(i, i + 6).map(_core_utils.numberToString).join(" ");
  10098. buffer.push(`${curve} c`);
  10099. }
  10100. buffer.push("S");
  10101. appearanceBuffer.push(buffer.join("\n"));
  10102. }
  10103. const appearance = appearanceBuffer.join("\n");
  10104. const appearanceStreamDict = new _primitives.Dict(xref);
  10105. appearanceStreamDict.set("FormType", 1);
  10106. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  10107. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  10108. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  10109. appearanceStreamDict.set("Length", appearance.length);
  10110. if (rotation) {
  10111. const matrix = (0, _core_utils.getRotationMatrix)(rotation, w, h);
  10112. appearanceStreamDict.set("Matrix", matrix);
  10113. }
  10114. if (opacity !== 1) {
  10115. const resources = new _primitives.Dict(xref);
  10116. const extGState = new _primitives.Dict(xref);
  10117. const r0 = new _primitives.Dict(xref);
  10118. r0.set("CA", opacity);
  10119. r0.set("Type", _primitives.Name.get("ExtGState"));
  10120. extGState.set("R0", r0);
  10121. resources.set("ExtGState", extGState);
  10122. appearanceStreamDict.set("Resources", resources);
  10123. }
  10124. const ap = new _stream.StringStream(appearance);
  10125. ap.dict = appearanceStreamDict;
  10126. return ap;
  10127. }
  10128. }
  10129. class HighlightAnnotation extends MarkupAnnotation {
  10130. constructor(params) {
  10131. super(params);
  10132. const {
  10133. dict,
  10134. xref
  10135. } = params;
  10136. this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
  10137. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  10138. if (quadPoints) {
  10139. const resources = this.appearance && this.appearance.dict.get("Resources");
  10140. if (!this.appearance || !(resources && resources.has("ExtGState"))) {
  10141. if (this.appearance) {
  10142. (0, _util.warn)("HighlightAnnotation - ignoring built-in appearance stream.");
  10143. }
  10144. const fillColor = this.color ? getPdfColorArray(this.color) : [1, 1, 0];
  10145. const fillAlpha = dict.get("CA");
  10146. this._setDefaultAppearance({
  10147. xref,
  10148. fillColor,
  10149. blendMode: "Multiply",
  10150. fillAlpha,
  10151. pointsCallback: (buffer, points) => {
  10152. 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");
  10153. return [points[0].x, points[1].x, points[3].y, points[1].y];
  10154. }
  10155. });
  10156. }
  10157. } else {
  10158. this.data.hasPopup = false;
  10159. }
  10160. }
  10161. }
  10162. class UnderlineAnnotation extends MarkupAnnotation {
  10163. constructor(params) {
  10164. super(params);
  10165. const {
  10166. dict,
  10167. xref
  10168. } = params;
  10169. this.data.annotationType = _util.AnnotationType.UNDERLINE;
  10170. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  10171. if (quadPoints) {
  10172. if (!this.appearance) {
  10173. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  10174. const strokeAlpha = dict.get("CA");
  10175. this._setDefaultAppearance({
  10176. xref,
  10177. extra: "[] 0 d 1 w",
  10178. strokeColor,
  10179. strokeAlpha,
  10180. pointsCallback: (buffer, points) => {
  10181. buffer.push(`${points[2].x} ${points[2].y} m`, `${points[3].x} ${points[3].y} l`, "S");
  10182. return [points[0].x, points[1].x, points[3].y, points[1].y];
  10183. }
  10184. });
  10185. }
  10186. } else {
  10187. this.data.hasPopup = false;
  10188. }
  10189. }
  10190. }
  10191. class SquigglyAnnotation extends MarkupAnnotation {
  10192. constructor(params) {
  10193. super(params);
  10194. const {
  10195. dict,
  10196. xref
  10197. } = params;
  10198. this.data.annotationType = _util.AnnotationType.SQUIGGLY;
  10199. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  10200. if (quadPoints) {
  10201. if (!this.appearance) {
  10202. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  10203. const strokeAlpha = dict.get("CA");
  10204. this._setDefaultAppearance({
  10205. xref,
  10206. extra: "[] 0 d 1 w",
  10207. strokeColor,
  10208. strokeAlpha,
  10209. pointsCallback: (buffer, points) => {
  10210. const dy = (points[0].y - points[2].y) / 6;
  10211. let shift = dy;
  10212. let x = points[2].x;
  10213. const y = points[2].y;
  10214. const xEnd = points[3].x;
  10215. buffer.push(`${x} ${y + shift} m`);
  10216. do {
  10217. x += 2;
  10218. shift = shift === 0 ? dy : 0;
  10219. buffer.push(`${x} ${y + shift} l`);
  10220. } while (x < xEnd);
  10221. buffer.push("S");
  10222. return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy];
  10223. }
  10224. });
  10225. }
  10226. } else {
  10227. this.data.hasPopup = false;
  10228. }
  10229. }
  10230. }
  10231. class StrikeOutAnnotation extends MarkupAnnotation {
  10232. constructor(params) {
  10233. super(params);
  10234. const {
  10235. dict,
  10236. xref
  10237. } = params;
  10238. this.data.annotationType = _util.AnnotationType.STRIKEOUT;
  10239. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  10240. if (quadPoints) {
  10241. if (!this.appearance) {
  10242. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  10243. const strokeAlpha = dict.get("CA");
  10244. this._setDefaultAppearance({
  10245. xref,
  10246. extra: "[] 0 d 1 w",
  10247. strokeColor,
  10248. strokeAlpha,
  10249. pointsCallback: (buffer, points) => {
  10250. 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");
  10251. return [points[0].x, points[1].x, points[3].y, points[1].y];
  10252. }
  10253. });
  10254. }
  10255. } else {
  10256. this.data.hasPopup = false;
  10257. }
  10258. }
  10259. }
  10260. class StampAnnotation extends MarkupAnnotation {
  10261. constructor(params) {
  10262. super(params);
  10263. this.data.annotationType = _util.AnnotationType.STAMP;
  10264. }
  10265. }
  10266. class FileAttachmentAnnotation extends MarkupAnnotation {
  10267. constructor(params) {
  10268. super(params);
  10269. const {
  10270. dict,
  10271. xref
  10272. } = params;
  10273. const file = new _file_spec.FileSpec(dict.get("FS"), xref);
  10274. this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
  10275. this.data.file = file.serializable;
  10276. const name = dict.get("Name");
  10277. this.data.name = name instanceof _primitives.Name ? (0, _util.stringToPDFString)(name.name) : "PushPin";
  10278. }
  10279. }
  10280. /***/ }),
  10281. /* 144 */
  10282. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  10283. "use strict";
  10284. Object.defineProperty(exports, "__esModule", ({
  10285. value: true
  10286. }));
  10287. exports.FakeUnicodeFont = void 0;
  10288. exports.createDefaultAppearance = createDefaultAppearance;
  10289. exports.getPdfColor = getPdfColor;
  10290. exports.parseDefaultAppearance = parseDefaultAppearance;
  10291. var _primitives = __w_pdfjs_require__(137);
  10292. var _core_utils = __w_pdfjs_require__(136);
  10293. var _util = __w_pdfjs_require__(2);
  10294. var _colorspace = __w_pdfjs_require__(145);
  10295. var _evaluator = __w_pdfjs_require__(146);
  10296. var _stream = __w_pdfjs_require__(141);
  10297. class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor {
  10298. constructor(str) {
  10299. super(new _stream.StringStream(str));
  10300. }
  10301. parse() {
  10302. const operation = {
  10303. fn: 0,
  10304. args: []
  10305. };
  10306. const result = {
  10307. fontSize: 0,
  10308. fontName: "",
  10309. fontColor: new Uint8ClampedArray(3)
  10310. };
  10311. try {
  10312. while (true) {
  10313. operation.args.length = 0;
  10314. if (!this.read(operation)) {
  10315. break;
  10316. }
  10317. if (this.savedStatesDepth !== 0) {
  10318. continue;
  10319. }
  10320. const {
  10321. fn,
  10322. args
  10323. } = operation;
  10324. switch (fn | 0) {
  10325. case _util.OPS.setFont:
  10326. const [fontName, fontSize] = args;
  10327. if (fontName instanceof _primitives.Name) {
  10328. result.fontName = fontName.name;
  10329. }
  10330. if (typeof fontSize === "number" && fontSize > 0) {
  10331. result.fontSize = fontSize;
  10332. }
  10333. break;
  10334. case _util.OPS.setFillRGBColor:
  10335. _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
  10336. break;
  10337. case _util.OPS.setFillGray:
  10338. _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
  10339. break;
  10340. case _util.OPS.setFillColorSpace:
  10341. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
  10342. break;
  10343. }
  10344. }
  10345. } catch (reason) {
  10346. (0, _util.warn)(`parseDefaultAppearance - ignoring errors: "${reason}".`);
  10347. }
  10348. return result;
  10349. }
  10350. }
  10351. function parseDefaultAppearance(str) {
  10352. return new DefaultAppearanceEvaluator(str).parse();
  10353. }
  10354. function getPdfColor(color, isFill) {
  10355. if (color[0] === color[1] && color[1] === color[2]) {
  10356. const gray = color[0] / 255;
  10357. return `${(0, _core_utils.numberToString)(gray)} ${isFill ? "g" : "G"}`;
  10358. }
  10359. return Array.from(color, c => (0, _core_utils.numberToString)(c / 255)).join(" ") + ` ${isFill ? "rg" : "RG"}`;
  10360. }
  10361. function createDefaultAppearance(_ref) {
  10362. let {
  10363. fontSize,
  10364. fontName,
  10365. fontColor
  10366. } = _ref;
  10367. return `/${(0, _core_utils.escapePDFName)(fontName)} ${fontSize} Tf ${getPdfColor(fontColor, true)}`;
  10368. }
  10369. class FakeUnicodeFont {
  10370. constructor(xref, fontFamily) {
  10371. this.xref = xref;
  10372. this.widths = null;
  10373. this.firstChar = Infinity;
  10374. this.lastChar = -Infinity;
  10375. this.fontFamily = fontFamily;
  10376. const canvas = new OffscreenCanvas(1, 1);
  10377. this.ctxMeasure = canvas.getContext("2d");
  10378. if (!FakeUnicodeFont._fontNameId) {
  10379. FakeUnicodeFont._fontNameId = 1;
  10380. }
  10381. this.fontName = _primitives.Name.get(`InvalidPDFjsFont_${fontFamily}_${FakeUnicodeFont._fontNameId++}`);
  10382. }
  10383. get toUnicodeRef() {
  10384. if (!FakeUnicodeFont._toUnicodeRef) {
  10385. const toUnicode = `/CIDInit /ProcSet findresource begin
  10386. 12 dict begin
  10387. begincmap
  10388. /CIDSystemInfo
  10389. << /Registry (Adobe)
  10390. /Ordering (UCS) /Supplement 0 >> def
  10391. /CMapName /Adobe-Identity-UCS def
  10392. /CMapType 2 def
  10393. 1 begincodespacerange
  10394. <0000> <FFFF>
  10395. endcodespacerange
  10396. 1 beginbfrange
  10397. <0000> <FFFF> <0000>
  10398. endbfrange
  10399. endcmap CMapName currentdict /CMap defineresource pop end end`;
  10400. const toUnicodeStream = FakeUnicodeFont.toUnicodeStream = new _stream.StringStream(toUnicode);
  10401. const toUnicodeDict = new _primitives.Dict(this.xref);
  10402. toUnicodeStream.dict = toUnicodeDict;
  10403. toUnicodeDict.set("Length", toUnicode.length);
  10404. FakeUnicodeFont._toUnicodeRef = this.xref.getNewPersistentRef(toUnicodeStream);
  10405. }
  10406. return FakeUnicodeFont._toUnicodeRef;
  10407. }
  10408. get fontDescriptorRef() {
  10409. if (!FakeUnicodeFont._fontDescriptorRef) {
  10410. const fontDescriptor = new _primitives.Dict(this.xref);
  10411. fontDescriptor.set("Type", _primitives.Name.get("FontDescriptor"));
  10412. fontDescriptor.set("FontName", this.fontName);
  10413. fontDescriptor.set("FontFamily", "MyriadPro Regular");
  10414. fontDescriptor.set("FontBBox", [0, 0, 0, 0]);
  10415. fontDescriptor.set("FontStretch", _primitives.Name.get("Normal"));
  10416. fontDescriptor.set("FontWeight", 400);
  10417. fontDescriptor.set("ItalicAngle", 0);
  10418. FakeUnicodeFont._fontDescriptorRef = this.xref.getNewPersistentRef(fontDescriptor);
  10419. }
  10420. return FakeUnicodeFont._fontDescriptorRef;
  10421. }
  10422. get descendantFontRef() {
  10423. const descendantFont = new _primitives.Dict(this.xref);
  10424. descendantFont.set("BaseFont", this.fontName);
  10425. descendantFont.set("Type", _primitives.Name.get("Font"));
  10426. descendantFont.set("Subtype", _primitives.Name.get("CIDFontType0"));
  10427. descendantFont.set("CIDToGIDMap", _primitives.Name.get("Identity"));
  10428. descendantFont.set("FirstChar", this.firstChar);
  10429. descendantFont.set("LastChar", this.lastChar);
  10430. descendantFont.set("FontDescriptor", this.fontDescriptorRef);
  10431. descendantFont.set("DW", 1000);
  10432. const widths = [];
  10433. const chars = [...this.widths.entries()].sort();
  10434. let currentChar = null;
  10435. let currentWidths = null;
  10436. for (const [char, width] of chars) {
  10437. if (!currentChar) {
  10438. currentChar = char;
  10439. currentWidths = [width];
  10440. continue;
  10441. }
  10442. if (char === currentChar + currentWidths.length) {
  10443. currentWidths.push(width);
  10444. } else {
  10445. widths.push(currentChar, currentWidths);
  10446. currentChar = char;
  10447. currentWidths = [width];
  10448. }
  10449. }
  10450. if (currentChar) {
  10451. widths.push(currentChar, currentWidths);
  10452. }
  10453. descendantFont.set("W", widths);
  10454. const cidSystemInfo = new _primitives.Dict(this.xref);
  10455. cidSystemInfo.set("Ordering", "Identity");
  10456. cidSystemInfo.set("Registry", "Adobe");
  10457. cidSystemInfo.set("Supplement", 0);
  10458. descendantFont.set("CIDSystemInfo", cidSystemInfo);
  10459. return this.xref.getNewPersistentRef(descendantFont);
  10460. }
  10461. get baseFontRef() {
  10462. const baseFont = new _primitives.Dict(this.xref);
  10463. baseFont.set("BaseFont", this.fontName);
  10464. baseFont.set("Type", _primitives.Name.get("Font"));
  10465. baseFont.set("Subtype", _primitives.Name.get("Type0"));
  10466. baseFont.set("Encoding", _primitives.Name.get("Identity-H"));
  10467. baseFont.set("DescendantFonts", [this.descendantFontRef]);
  10468. baseFont.set("ToUnicode", this.toUnicodeRef);
  10469. return this.xref.getNewPersistentRef(baseFont);
  10470. }
  10471. get resources() {
  10472. const resources = new _primitives.Dict(this.xref);
  10473. const font = new _primitives.Dict(this.xref);
  10474. font.set(this.fontName.name, this.baseFontRef);
  10475. resources.set("Font", font);
  10476. return resources;
  10477. }
  10478. _createContext() {
  10479. this.widths = new Map();
  10480. this.ctxMeasure.font = `1000px ${this.fontFamily}`;
  10481. return this.ctxMeasure;
  10482. }
  10483. createFontResources(text) {
  10484. const ctx = this._createContext();
  10485. for (const line of text.split(/\r\n?|\n/)) {
  10486. for (const char of line.split("")) {
  10487. const code = char.charCodeAt(0);
  10488. if (this.widths.has(code)) {
  10489. continue;
  10490. }
  10491. const metrics = ctx.measureText(char);
  10492. const width = Math.ceil(metrics.width);
  10493. this.widths.set(code, width);
  10494. this.firstChar = Math.min(code, this.firstChar);
  10495. this.lastChar = Math.max(code, this.lastChar);
  10496. }
  10497. }
  10498. return this.resources;
  10499. }
  10500. createAppearance(text, rect, rotation, fontSize, bgColor, strokeAlpha) {
  10501. const ctx = this._createContext();
  10502. const lines = [];
  10503. let maxWidth = -Infinity;
  10504. for (const line of text.split(/\r\n?|\n/)) {
  10505. lines.push(line);
  10506. const lineWidth = ctx.measureText(line).width;
  10507. maxWidth = Math.max(maxWidth, lineWidth);
  10508. for (const char of line.split("")) {
  10509. const code = char.charCodeAt(0);
  10510. let width = this.widths.get(code);
  10511. if (width === undefined) {
  10512. const metrics = ctx.measureText(char);
  10513. width = Math.ceil(metrics.width);
  10514. this.widths.set(code, width);
  10515. this.firstChar = Math.min(code, this.firstChar);
  10516. this.lastChar = Math.max(code, this.lastChar);
  10517. }
  10518. }
  10519. }
  10520. maxWidth *= fontSize / 1000;
  10521. const [x1, y1, x2, y2] = rect;
  10522. let w = x2 - x1;
  10523. let h = y2 - y1;
  10524. if (rotation % 180 !== 0) {
  10525. [w, h] = [h, w];
  10526. }
  10527. let hscale = 1;
  10528. if (maxWidth > w) {
  10529. hscale = w / maxWidth;
  10530. }
  10531. let vscale = 1;
  10532. const lineHeight = _util.LINE_FACTOR * fontSize;
  10533. const lineDescent = _util.LINE_DESCENT_FACTOR * fontSize;
  10534. const maxHeight = lineHeight * lines.length;
  10535. if (maxHeight > h) {
  10536. vscale = h / maxHeight;
  10537. }
  10538. const fscale = Math.min(hscale, vscale);
  10539. const newFontSize = fontSize * fscale;
  10540. 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`];
  10541. const {
  10542. resources
  10543. } = this;
  10544. strokeAlpha = typeof strokeAlpha === "number" && strokeAlpha >= 0 && strokeAlpha <= 1 ? strokeAlpha : 1;
  10545. if (strokeAlpha !== 1) {
  10546. buffer.push("/R0 gs");
  10547. const extGState = new _primitives.Dict(this.xref);
  10548. const r0 = new _primitives.Dict(this.xref);
  10549. r0.set("ca", strokeAlpha);
  10550. r0.set("CA", strokeAlpha);
  10551. r0.set("Type", _primitives.Name.get("ExtGState"));
  10552. extGState.set("R0", r0);
  10553. resources.set("ExtGState", extGState);
  10554. }
  10555. const vShift = (0, _core_utils.numberToString)(lineHeight);
  10556. for (const line of lines) {
  10557. buffer.push(`0 -${vShift} Td <${(0, _core_utils.stringToUTF16HexString)(line)}> Tj`);
  10558. }
  10559. buffer.push("ET", "Q");
  10560. const appearance = buffer.join("\n");
  10561. const appearanceStreamDict = new _primitives.Dict(this.xref);
  10562. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  10563. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  10564. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  10565. appearanceStreamDict.set("Length", appearance.length);
  10566. appearanceStreamDict.set("Resources", resources);
  10567. if (rotation) {
  10568. const matrix = (0, _core_utils.getRotationMatrix)(rotation, w, h);
  10569. appearanceStreamDict.set("Matrix", matrix);
  10570. }
  10571. const ap = new _stream.StringStream(appearance);
  10572. ap.dict = appearanceStreamDict;
  10573. return ap;
  10574. }
  10575. }
  10576. exports.FakeUnicodeFont = FakeUnicodeFont;
  10577. /***/ }),
  10578. /* 145 */
  10579. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  10580. "use strict";
  10581. Object.defineProperty(exports, "__esModule", ({
  10582. value: true
  10583. }));
  10584. exports.ColorSpace = void 0;
  10585. var _util = __w_pdfjs_require__(2);
  10586. var _primitives = __w_pdfjs_require__(137);
  10587. var _base_stream = __w_pdfjs_require__(138);
  10588. var _core_utils = __w_pdfjs_require__(136);
  10589. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  10590. const COMPONENTS = 3;
  10591. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  10592. const xRatio = w1 / w2;
  10593. const yRatio = h1 / h2;
  10594. let newIndex = 0,
  10595. oldIndex;
  10596. const xScaled = new Uint16Array(w2);
  10597. const w1Scanline = w1 * COMPONENTS;
  10598. for (let i = 0; i < w2; i++) {
  10599. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  10600. }
  10601. for (let i = 0; i < h2; i++) {
  10602. const py = Math.floor(i * yRatio) * w1Scanline;
  10603. for (let j = 0; j < w2; j++) {
  10604. oldIndex = py + xScaled[j];
  10605. dest[newIndex++] = src[oldIndex++];
  10606. dest[newIndex++] = src[oldIndex++];
  10607. dest[newIndex++] = src[oldIndex++];
  10608. newIndex += alpha01;
  10609. }
  10610. }
  10611. }
  10612. class ColorSpace {
  10613. constructor(name, numComps) {
  10614. if (this.constructor === ColorSpace) {
  10615. (0, _util.unreachable)("Cannot initialize ColorSpace.");
  10616. }
  10617. this.name = name;
  10618. this.numComps = numComps;
  10619. }
  10620. getRgb(src, srcOffset) {
  10621. const rgb = new Uint8ClampedArray(3);
  10622. this.getRgbItem(src, srcOffset, rgb, 0);
  10623. return rgb;
  10624. }
  10625. getRgbItem(src, srcOffset, dest, destOffset) {
  10626. (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
  10627. }
  10628. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10629. (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
  10630. }
  10631. getOutputLength(inputLength, alpha01) {
  10632. (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
  10633. }
  10634. isPassthrough(bits) {
  10635. return false;
  10636. }
  10637. isDefaultDecode(decodeMap, bpc) {
  10638. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  10639. }
  10640. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  10641. const count = originalWidth * originalHeight;
  10642. let rgbBuf = null;
  10643. const numComponentColors = 1 << bpc;
  10644. const needsResizing = originalHeight !== height || originalWidth !== width;
  10645. if (this.isPassthrough(bpc)) {
  10646. rgbBuf = comps;
  10647. } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
  10648. const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  10649. for (let i = 0; i < numComponentColors; i++) {
  10650. allColors[i] = i;
  10651. }
  10652. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  10653. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  10654. if (!needsResizing) {
  10655. let destPos = 0;
  10656. for (let i = 0; i < count; ++i) {
  10657. const key = comps[i] * 3;
  10658. dest[destPos++] = colorMap[key];
  10659. dest[destPos++] = colorMap[key + 1];
  10660. dest[destPos++] = colorMap[key + 2];
  10661. destPos += alpha01;
  10662. }
  10663. } else {
  10664. rgbBuf = new Uint8Array(count * 3);
  10665. let rgbPos = 0;
  10666. for (let i = 0; i < count; ++i) {
  10667. const key = comps[i] * 3;
  10668. rgbBuf[rgbPos++] = colorMap[key];
  10669. rgbBuf[rgbPos++] = colorMap[key + 1];
  10670. rgbBuf[rgbPos++] = colorMap[key + 2];
  10671. }
  10672. }
  10673. } else {
  10674. if (!needsResizing) {
  10675. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  10676. } else {
  10677. rgbBuf = new Uint8ClampedArray(count * 3);
  10678. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  10679. }
  10680. }
  10681. if (rgbBuf) {
  10682. if (needsResizing) {
  10683. resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
  10684. } else {
  10685. let destPos = 0,
  10686. rgbPos = 0;
  10687. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  10688. dest[destPos++] = rgbBuf[rgbPos++];
  10689. dest[destPos++] = rgbBuf[rgbPos++];
  10690. dest[destPos++] = rgbBuf[rgbPos++];
  10691. destPos += alpha01;
  10692. }
  10693. }
  10694. }
  10695. }
  10696. get usesZeroToOneRange() {
  10697. return (0, _util.shadow)(this, "usesZeroToOneRange", true);
  10698. }
  10699. static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
  10700. if (!localColorSpaceCache) {
  10701. throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.');
  10702. }
  10703. if (!parsedColorSpace) {
  10704. throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.');
  10705. }
  10706. let csName, csRef;
  10707. if (cacheKey instanceof _primitives.Ref) {
  10708. csRef = cacheKey;
  10709. cacheKey = xref.fetch(cacheKey);
  10710. }
  10711. if (cacheKey instanceof _primitives.Name) {
  10712. csName = cacheKey.name;
  10713. }
  10714. if (csName || csRef) {
  10715. localColorSpaceCache.set(csName, csRef, parsedColorSpace);
  10716. }
  10717. }
  10718. static getCached(cacheKey, xref, localColorSpaceCache) {
  10719. if (!localColorSpaceCache) {
  10720. throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.');
  10721. }
  10722. if (cacheKey instanceof _primitives.Ref) {
  10723. const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
  10724. if (localColorSpace) {
  10725. return localColorSpace;
  10726. }
  10727. try {
  10728. cacheKey = xref.fetch(cacheKey);
  10729. } catch (ex) {
  10730. if (ex instanceof _core_utils.MissingDataException) {
  10731. throw ex;
  10732. }
  10733. }
  10734. }
  10735. if (cacheKey instanceof _primitives.Name) {
  10736. const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
  10737. if (localColorSpace) {
  10738. return localColorSpace;
  10739. }
  10740. }
  10741. return null;
  10742. }
  10743. static async parseAsync(_ref) {
  10744. let {
  10745. cs,
  10746. xref,
  10747. resources = null,
  10748. pdfFunctionFactory,
  10749. localColorSpaceCache
  10750. } = _ref;
  10751. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  10752. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  10753. return parsedColorSpace;
  10754. }
  10755. static parse(_ref2) {
  10756. let {
  10757. cs,
  10758. xref,
  10759. resources = null,
  10760. pdfFunctionFactory,
  10761. localColorSpaceCache
  10762. } = _ref2;
  10763. const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
  10764. if (cachedColorSpace) {
  10765. return cachedColorSpace;
  10766. }
  10767. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  10768. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  10769. return parsedColorSpace;
  10770. }
  10771. static _parse(cs, xref) {
  10772. let resources = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  10773. let pdfFunctionFactory = arguments.length > 3 ? arguments[3] : undefined;
  10774. cs = xref.fetchIfRef(cs);
  10775. if (cs instanceof _primitives.Name) {
  10776. switch (cs.name) {
  10777. case "G":
  10778. case "DeviceGray":
  10779. return this.singletons.gray;
  10780. case "RGB":
  10781. case "DeviceRGB":
  10782. return this.singletons.rgb;
  10783. case "CMYK":
  10784. case "DeviceCMYK":
  10785. return this.singletons.cmyk;
  10786. case "Pattern":
  10787. return new PatternCS(null);
  10788. default:
  10789. if (resources instanceof _primitives.Dict) {
  10790. const colorSpaces = resources.get("ColorSpace");
  10791. if (colorSpaces instanceof _primitives.Dict) {
  10792. const resourcesCS = colorSpaces.get(cs.name);
  10793. if (resourcesCS) {
  10794. if (resourcesCS instanceof _primitives.Name) {
  10795. return this._parse(resourcesCS, xref, resources, pdfFunctionFactory);
  10796. }
  10797. cs = resourcesCS;
  10798. break;
  10799. }
  10800. }
  10801. }
  10802. throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`);
  10803. }
  10804. }
  10805. if (Array.isArray(cs)) {
  10806. const mode = xref.fetchIfRef(cs[0]).name;
  10807. let params, numComps, baseCS, whitePoint, blackPoint, gamma;
  10808. switch (mode) {
  10809. case "G":
  10810. case "DeviceGray":
  10811. return this.singletons.gray;
  10812. case "RGB":
  10813. case "DeviceRGB":
  10814. return this.singletons.rgb;
  10815. case "CMYK":
  10816. case "DeviceCMYK":
  10817. return this.singletons.cmyk;
  10818. case "CalGray":
  10819. params = xref.fetchIfRef(cs[1]);
  10820. whitePoint = params.getArray("WhitePoint");
  10821. blackPoint = params.getArray("BlackPoint");
  10822. gamma = params.get("Gamma");
  10823. return new CalGrayCS(whitePoint, blackPoint, gamma);
  10824. case "CalRGB":
  10825. params = xref.fetchIfRef(cs[1]);
  10826. whitePoint = params.getArray("WhitePoint");
  10827. blackPoint = params.getArray("BlackPoint");
  10828. gamma = params.getArray("Gamma");
  10829. const matrix = params.getArray("Matrix");
  10830. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  10831. case "ICCBased":
  10832. const stream = xref.fetchIfRef(cs[1]);
  10833. const dict = stream.dict;
  10834. numComps = dict.get("N");
  10835. const alt = dict.get("Alternate");
  10836. if (alt) {
  10837. const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
  10838. if (altCS.numComps === numComps) {
  10839. return altCS;
  10840. }
  10841. (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
  10842. }
  10843. if (numComps === 1) {
  10844. return this.singletons.gray;
  10845. } else if (numComps === 3) {
  10846. return this.singletons.rgb;
  10847. } else if (numComps === 4) {
  10848. return this.singletons.cmyk;
  10849. }
  10850. break;
  10851. case "Pattern":
  10852. baseCS = cs[1] || null;
  10853. if (baseCS) {
  10854. baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
  10855. }
  10856. return new PatternCS(baseCS);
  10857. case "I":
  10858. case "Indexed":
  10859. baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
  10860. const hiVal = xref.fetchIfRef(cs[2]) + 1;
  10861. const lookup = xref.fetchIfRef(cs[3]);
  10862. return new IndexedCS(baseCS, hiVal, lookup);
  10863. case "Separation":
  10864. case "DeviceN":
  10865. const name = xref.fetchIfRef(cs[1]);
  10866. numComps = Array.isArray(name) ? name.length : 1;
  10867. baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
  10868. const tintFn = pdfFunctionFactory.create(cs[3]);
  10869. return new AlternateCS(numComps, baseCS, tintFn);
  10870. case "Lab":
  10871. params = xref.fetchIfRef(cs[1]);
  10872. whitePoint = params.getArray("WhitePoint");
  10873. blackPoint = params.getArray("BlackPoint");
  10874. const range = params.getArray("Range");
  10875. return new LabCS(whitePoint, blackPoint, range);
  10876. default:
  10877. throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`);
  10878. }
  10879. }
  10880. throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`);
  10881. }
  10882. static isDefaultDecode(decode, numComps) {
  10883. if (!Array.isArray(decode)) {
  10884. return true;
  10885. }
  10886. if (numComps * 2 !== decode.length) {
  10887. (0, _util.warn)("The decode map is not the correct length");
  10888. return true;
  10889. }
  10890. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  10891. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  10892. return false;
  10893. }
  10894. }
  10895. return true;
  10896. }
  10897. static get singletons() {
  10898. return (0, _util.shadow)(this, "singletons", {
  10899. get gray() {
  10900. return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
  10901. },
  10902. get rgb() {
  10903. return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
  10904. },
  10905. get cmyk() {
  10906. return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
  10907. }
  10908. });
  10909. }
  10910. }
  10911. exports.ColorSpace = ColorSpace;
  10912. class AlternateCS extends ColorSpace {
  10913. constructor(numComps, base, tintFn) {
  10914. super("Alternate", numComps);
  10915. this.base = base;
  10916. this.tintFn = tintFn;
  10917. this.tmpBuf = new Float32Array(base.numComps);
  10918. }
  10919. getRgbItem(src, srcOffset, dest, destOffset) {
  10920. const tmpBuf = this.tmpBuf;
  10921. this.tintFn(src, srcOffset, tmpBuf, 0);
  10922. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  10923. }
  10924. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10925. const tintFn = this.tintFn;
  10926. const base = this.base;
  10927. const scale = 1 / ((1 << bits) - 1);
  10928. const baseNumComps = base.numComps;
  10929. const usesZeroToOneRange = base.usesZeroToOneRange;
  10930. const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  10931. let pos = isPassthrough ? destOffset : 0;
  10932. const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
  10933. const numComps = this.numComps;
  10934. const scaled = new Float32Array(numComps);
  10935. const tinted = new Float32Array(baseNumComps);
  10936. let i, j;
  10937. for (i = 0; i < count; i++) {
  10938. for (j = 0; j < numComps; j++) {
  10939. scaled[j] = src[srcOffset++] * scale;
  10940. }
  10941. tintFn(scaled, 0, tinted, 0);
  10942. if (usesZeroToOneRange) {
  10943. for (j = 0; j < baseNumComps; j++) {
  10944. baseBuf[pos++] = tinted[j] * 255;
  10945. }
  10946. } else {
  10947. base.getRgbItem(tinted, 0, baseBuf, pos);
  10948. pos += baseNumComps;
  10949. }
  10950. }
  10951. if (!isPassthrough) {
  10952. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  10953. }
  10954. }
  10955. getOutputLength(inputLength, alpha01) {
  10956. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  10957. }
  10958. }
  10959. class PatternCS extends ColorSpace {
  10960. constructor(baseCS) {
  10961. super("Pattern", null);
  10962. this.base = baseCS;
  10963. }
  10964. isDefaultDecode(decodeMap, bpc) {
  10965. (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
  10966. }
  10967. }
  10968. class IndexedCS extends ColorSpace {
  10969. constructor(base, highVal, lookup) {
  10970. super("Indexed", 1);
  10971. this.base = base;
  10972. this.highVal = highVal;
  10973. const length = base.numComps * highVal;
  10974. this.lookup = new Uint8Array(length);
  10975. if (lookup instanceof _base_stream.BaseStream) {
  10976. const bytes = lookup.getBytes(length);
  10977. this.lookup.set(bytes);
  10978. } else if (typeof lookup === "string") {
  10979. for (let i = 0; i < length; ++i) {
  10980. this.lookup[i] = lookup.charCodeAt(i) & 0xff;
  10981. }
  10982. } else {
  10983. throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
  10984. }
  10985. }
  10986. getRgbItem(src, srcOffset, dest, destOffset) {
  10987. const numComps = this.base.numComps;
  10988. const start = src[srcOffset] * numComps;
  10989. this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
  10990. }
  10991. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10992. const base = this.base;
  10993. const numComps = base.numComps;
  10994. const outputDelta = base.getOutputLength(numComps, alpha01);
  10995. const lookup = this.lookup;
  10996. for (let i = 0; i < count; ++i) {
  10997. const lookupPos = src[srcOffset++] * numComps;
  10998. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  10999. destOffset += outputDelta;
  11000. }
  11001. }
  11002. getOutputLength(inputLength, alpha01) {
  11003. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  11004. }
  11005. isDefaultDecode(decodeMap, bpc) {
  11006. if (!Array.isArray(decodeMap)) {
  11007. return true;
  11008. }
  11009. if (decodeMap.length !== 2) {
  11010. (0, _util.warn)("Decode map length is not correct");
  11011. return true;
  11012. }
  11013. if (!Number.isInteger(bpc) || bpc < 1) {
  11014. (0, _util.warn)("Bits per component is not correct");
  11015. return true;
  11016. }
  11017. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  11018. }
  11019. }
  11020. class DeviceGrayCS extends ColorSpace {
  11021. constructor() {
  11022. super("DeviceGray", 1);
  11023. }
  11024. getRgbItem(src, srcOffset, dest, destOffset) {
  11025. const c = src[srcOffset] * 255;
  11026. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  11027. }
  11028. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  11029. const scale = 255 / ((1 << bits) - 1);
  11030. let j = srcOffset,
  11031. q = destOffset;
  11032. for (let i = 0; i < count; ++i) {
  11033. const c = scale * src[j++];
  11034. dest[q++] = c;
  11035. dest[q++] = c;
  11036. dest[q++] = c;
  11037. q += alpha01;
  11038. }
  11039. }
  11040. getOutputLength(inputLength, alpha01) {
  11041. return inputLength * (3 + alpha01);
  11042. }
  11043. }
  11044. class DeviceRgbCS extends ColorSpace {
  11045. constructor() {
  11046. super("DeviceRGB", 3);
  11047. }
  11048. getRgbItem(src, srcOffset, dest, destOffset) {
  11049. dest[destOffset] = src[srcOffset] * 255;
  11050. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  11051. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  11052. }
  11053. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  11054. if (bits === 8 && alpha01 === 0) {
  11055. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  11056. return;
  11057. }
  11058. const scale = 255 / ((1 << bits) - 1);
  11059. let j = srcOffset,
  11060. q = destOffset;
  11061. for (let i = 0; i < count; ++i) {
  11062. dest[q++] = scale * src[j++];
  11063. dest[q++] = scale * src[j++];
  11064. dest[q++] = scale * src[j++];
  11065. q += alpha01;
  11066. }
  11067. }
  11068. getOutputLength(inputLength, alpha01) {
  11069. return inputLength * (3 + alpha01) / 3 | 0;
  11070. }
  11071. isPassthrough(bits) {
  11072. return bits === 8;
  11073. }
  11074. }
  11075. const DeviceCmykCS = function DeviceCmykCSClosure() {
  11076. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  11077. const c = src[srcOffset] * srcScale;
  11078. const m = src[srcOffset + 1] * srcScale;
  11079. const y = src[srcOffset + 2] * srcScale;
  11080. const k = src[srcOffset + 3] * srcScale;
  11081. 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);
  11082. 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);
  11083. 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);
  11084. }
  11085. class DeviceCmykCS extends ColorSpace {
  11086. constructor() {
  11087. super("DeviceCMYK", 4);
  11088. }
  11089. getRgbItem(src, srcOffset, dest, destOffset) {
  11090. convertToRgb(src, srcOffset, 1, dest, destOffset);
  11091. }
  11092. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  11093. const scale = 1 / ((1 << bits) - 1);
  11094. for (let i = 0; i < count; i++) {
  11095. convertToRgb(src, srcOffset, scale, dest, destOffset);
  11096. srcOffset += 4;
  11097. destOffset += 3 + alpha01;
  11098. }
  11099. }
  11100. getOutputLength(inputLength, alpha01) {
  11101. return inputLength / 4 * (3 + alpha01) | 0;
  11102. }
  11103. }
  11104. return DeviceCmykCS;
  11105. }();
  11106. const CalGrayCS = function CalGrayCSClosure() {
  11107. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  11108. const A = src[srcOffset] * scale;
  11109. const AG = A ** cs.G;
  11110. const L = cs.YW * AG;
  11111. const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0);
  11112. dest[destOffset] = val;
  11113. dest[destOffset + 1] = val;
  11114. dest[destOffset + 2] = val;
  11115. }
  11116. class CalGrayCS extends ColorSpace {
  11117. constructor(whitePoint, blackPoint, gamma) {
  11118. super("CalGray", 1);
  11119. if (!whitePoint) {
  11120. throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
  11121. }
  11122. blackPoint = blackPoint || [0, 0, 0];
  11123. gamma = gamma || 1;
  11124. this.XW = whitePoint[0];
  11125. this.YW = whitePoint[1];
  11126. this.ZW = whitePoint[2];
  11127. this.XB = blackPoint[0];
  11128. this.YB = blackPoint[1];
  11129. this.ZB = blackPoint[2];
  11130. this.G = gamma;
  11131. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  11132. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  11133. }
  11134. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  11135. (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
  11136. this.XB = this.YB = this.ZB = 0;
  11137. }
  11138. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  11139. (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
  11140. }
  11141. if (this.G < 1) {
  11142. (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default.");
  11143. this.G = 1;
  11144. }
  11145. }
  11146. getRgbItem(src, srcOffset, dest, destOffset) {
  11147. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  11148. }
  11149. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  11150. const scale = 1 / ((1 << bits) - 1);
  11151. for (let i = 0; i < count; ++i) {
  11152. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  11153. srcOffset += 1;
  11154. destOffset += 3 + alpha01;
  11155. }
  11156. }
  11157. getOutputLength(inputLength, alpha01) {
  11158. return inputLength * (3 + alpha01);
  11159. }
  11160. }
  11161. return CalGrayCS;
  11162. }();
  11163. const CalRGBCS = function CalRGBCSClosure() {
  11164. const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  11165. 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]);
  11166. 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]);
  11167. const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  11168. const tempNormalizeMatrix = new Float32Array(3);
  11169. const tempConvertMatrix1 = new Float32Array(3);
  11170. const tempConvertMatrix2 = new Float32Array(3);
  11171. const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  11172. function matrixProduct(a, b, result) {
  11173. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  11174. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  11175. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  11176. }
  11177. function convertToFlat(sourceWhitePoint, LMS, result) {
  11178. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  11179. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  11180. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  11181. }
  11182. function convertToD65(sourceWhitePoint, LMS, result) {
  11183. const D65X = 0.95047;
  11184. const D65Y = 1;
  11185. const D65Z = 1.08883;
  11186. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  11187. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  11188. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  11189. }
  11190. function sRGBTransferFunction(color) {
  11191. if (color <= 0.0031308) {
  11192. return adjustToRange(0, 1, 12.92 * color);
  11193. }
  11194. if (color >= 0.99554525) {
  11195. return 1;
  11196. }
  11197. return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
  11198. }
  11199. function adjustToRange(min, max, value) {
  11200. return Math.max(min, Math.min(max, value));
  11201. }
  11202. function decodeL(L) {
  11203. if (L < 0) {
  11204. return -decodeL(-L);
  11205. }
  11206. if (L > 8.0) {
  11207. return ((L + 16) / 116) ** 3;
  11208. }
  11209. return L * DECODE_L_CONSTANT;
  11210. }
  11211. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  11212. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  11213. result[0] = XYZ_Flat[0];
  11214. result[1] = XYZ_Flat[1];
  11215. result[2] = XYZ_Flat[2];
  11216. return;
  11217. }
  11218. const zeroDecodeL = decodeL(0);
  11219. const X_DST = zeroDecodeL;
  11220. const X_SRC = decodeL(sourceBlackPoint[0]);
  11221. const Y_DST = zeroDecodeL;
  11222. const Y_SRC = decodeL(sourceBlackPoint[1]);
  11223. const Z_DST = zeroDecodeL;
  11224. const Z_SRC = decodeL(sourceBlackPoint[2]);
  11225. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  11226. const X_Offset = 1 - X_Scale;
  11227. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  11228. const Y_Offset = 1 - Y_Scale;
  11229. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  11230. const Z_Offset = 1 - Z_Scale;
  11231. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  11232. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  11233. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  11234. }
  11235. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  11236. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  11237. result[0] = XYZ_In[0];
  11238. result[1] = XYZ_In[1];
  11239. result[2] = XYZ_In[2];
  11240. return;
  11241. }
  11242. const LMS = result;
  11243. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  11244. const LMS_Flat = tempNormalizeMatrix;
  11245. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  11246. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  11247. }
  11248. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  11249. const LMS = result;
  11250. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  11251. const LMS_D65 = tempNormalizeMatrix;
  11252. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  11253. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  11254. }
  11255. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  11256. const A = adjustToRange(0, 1, src[srcOffset] * scale);
  11257. const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  11258. const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  11259. const AGR = A === 1 ? 1 : A ** cs.GR;
  11260. const BGG = B === 1 ? 1 : B ** cs.GG;
  11261. const CGB = C === 1 ? 1 : C ** cs.GB;
  11262. const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  11263. const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  11264. const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  11265. const XYZ = tempConvertMatrix1;
  11266. XYZ[0] = X;
  11267. XYZ[1] = Y;
  11268. XYZ[2] = Z;
  11269. const XYZ_Flat = tempConvertMatrix2;
  11270. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  11271. const XYZ_Black = tempConvertMatrix1;
  11272. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  11273. const XYZ_D65 = tempConvertMatrix2;
  11274. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  11275. const SRGB = tempConvertMatrix1;
  11276. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  11277. dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
  11278. dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
  11279. dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
  11280. }
  11281. class CalRGBCS extends ColorSpace {
  11282. constructor(whitePoint, blackPoint, gamma, matrix) {
  11283. super("CalRGB", 3);
  11284. if (!whitePoint) {
  11285. throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
  11286. }
  11287. blackPoint = blackPoint || new Float32Array(3);
  11288. gamma = gamma || new Float32Array([1, 1, 1]);
  11289. matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  11290. const XW = whitePoint[0];
  11291. const YW = whitePoint[1];
  11292. const ZW = whitePoint[2];
  11293. this.whitePoint = whitePoint;
  11294. const XB = blackPoint[0];
  11295. const YB = blackPoint[1];
  11296. const ZB = blackPoint[2];
  11297. this.blackPoint = blackPoint;
  11298. this.GR = gamma[0];
  11299. this.GG = gamma[1];
  11300. this.GB = gamma[2];
  11301. this.MXA = matrix[0];
  11302. this.MYA = matrix[1];
  11303. this.MZA = matrix[2];
  11304. this.MXB = matrix[3];
  11305. this.MYB = matrix[4];
  11306. this.MZB = matrix[5];
  11307. this.MXC = matrix[6];
  11308. this.MYC = matrix[7];
  11309. this.MZC = matrix[8];
  11310. if (XW < 0 || ZW < 0 || YW !== 1) {
  11311. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  11312. }
  11313. if (XB < 0 || YB < 0 || ZB < 0) {
  11314. (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
  11315. this.blackPoint = new Float32Array(3);
  11316. }
  11317. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  11318. (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
  11319. this.GR = this.GG = this.GB = 1;
  11320. }
  11321. }
  11322. getRgbItem(src, srcOffset, dest, destOffset) {
  11323. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  11324. }
  11325. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  11326. const scale = 1 / ((1 << bits) - 1);
  11327. for (let i = 0; i < count; ++i) {
  11328. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  11329. srcOffset += 3;
  11330. destOffset += 3 + alpha01;
  11331. }
  11332. }
  11333. getOutputLength(inputLength, alpha01) {
  11334. return inputLength * (3 + alpha01) / 3 | 0;
  11335. }
  11336. }
  11337. return CalRGBCS;
  11338. }();
  11339. const LabCS = function LabCSClosure() {
  11340. function fn_g(x) {
  11341. let result;
  11342. if (x >= 6 / 29) {
  11343. result = x ** 3;
  11344. } else {
  11345. result = 108 / 841 * (x - 4 / 29);
  11346. }
  11347. return result;
  11348. }
  11349. function decode(value, high1, low2, high2) {
  11350. return low2 + value * (high2 - low2) / high1;
  11351. }
  11352. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  11353. let Ls = src[srcOffset];
  11354. let as = src[srcOffset + 1];
  11355. let bs = src[srcOffset + 2];
  11356. if (maxVal !== false) {
  11357. Ls = decode(Ls, maxVal, 0, 100);
  11358. as = decode(as, maxVal, cs.amin, cs.amax);
  11359. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  11360. }
  11361. if (as > cs.amax) {
  11362. as = cs.amax;
  11363. } else if (as < cs.amin) {
  11364. as = cs.amin;
  11365. }
  11366. if (bs > cs.bmax) {
  11367. bs = cs.bmax;
  11368. } else if (bs < cs.bmin) {
  11369. bs = cs.bmin;
  11370. }
  11371. const M = (Ls + 16) / 116;
  11372. const L = M + as / 500;
  11373. const N = M - bs / 200;
  11374. const X = cs.XW * fn_g(L);
  11375. const Y = cs.YW * fn_g(M);
  11376. const Z = cs.ZW * fn_g(N);
  11377. let r, g, b;
  11378. if (cs.ZW < 1) {
  11379. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  11380. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  11381. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  11382. } else {
  11383. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  11384. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  11385. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  11386. }
  11387. dest[destOffset] = Math.sqrt(r) * 255;
  11388. dest[destOffset + 1] = Math.sqrt(g) * 255;
  11389. dest[destOffset + 2] = Math.sqrt(b) * 255;
  11390. }
  11391. class LabCS extends ColorSpace {
  11392. constructor(whitePoint, blackPoint, range) {
  11393. super("Lab", 3);
  11394. if (!whitePoint) {
  11395. throw new _util.FormatError("WhitePoint missing - required for color space Lab");
  11396. }
  11397. blackPoint = blackPoint || [0, 0, 0];
  11398. range = range || [-100, 100, -100, 100];
  11399. this.XW = whitePoint[0];
  11400. this.YW = whitePoint[1];
  11401. this.ZW = whitePoint[2];
  11402. this.amin = range[0];
  11403. this.amax = range[1];
  11404. this.bmin = range[2];
  11405. this.bmax = range[3];
  11406. this.XB = blackPoint[0];
  11407. this.YB = blackPoint[1];
  11408. this.ZB = blackPoint[2];
  11409. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  11410. throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
  11411. }
  11412. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  11413. (0, _util.info)("Invalid BlackPoint, falling back to default");
  11414. this.XB = this.YB = this.ZB = 0;
  11415. }
  11416. if (this.amin > this.amax || this.bmin > this.bmax) {
  11417. (0, _util.info)("Invalid Range, falling back to defaults");
  11418. this.amin = -100;
  11419. this.amax = 100;
  11420. this.bmin = -100;
  11421. this.bmax = 100;
  11422. }
  11423. }
  11424. getRgbItem(src, srcOffset, dest, destOffset) {
  11425. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  11426. }
  11427. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  11428. const maxVal = (1 << bits) - 1;
  11429. for (let i = 0; i < count; i++) {
  11430. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  11431. srcOffset += 3;
  11432. destOffset += 3 + alpha01;
  11433. }
  11434. }
  11435. getOutputLength(inputLength, alpha01) {
  11436. return inputLength * (3 + alpha01) / 3 | 0;
  11437. }
  11438. isDefaultDecode(decodeMap, bpc) {
  11439. return true;
  11440. }
  11441. get usesZeroToOneRange() {
  11442. return (0, _util.shadow)(this, "usesZeroToOneRange", false);
  11443. }
  11444. }
  11445. return LabCS;
  11446. }();
  11447. /***/ }),
  11448. /* 146 */
  11449. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  11450. "use strict";
  11451. Object.defineProperty(exports, "__esModule", ({
  11452. value: true
  11453. }));
  11454. exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0;
  11455. var _util = __w_pdfjs_require__(2);
  11456. var _cmap = __w_pdfjs_require__(147);
  11457. var _primitives = __w_pdfjs_require__(137);
  11458. var _fonts = __w_pdfjs_require__(165);
  11459. var _encodings = __w_pdfjs_require__(168);
  11460. var _standard_fonts = __w_pdfjs_require__(172);
  11461. var _pattern = __w_pdfjs_require__(181);
  11462. var _xfa_fonts = __w_pdfjs_require__(182);
  11463. var _to_unicode_map = __w_pdfjs_require__(173);
  11464. var _function = __w_pdfjs_require__(188);
  11465. var _parser = __w_pdfjs_require__(148);
  11466. var _image_utils = __w_pdfjs_require__(190);
  11467. var _stream = __w_pdfjs_require__(141);
  11468. var _base_stream = __w_pdfjs_require__(138);
  11469. var _bidi = __w_pdfjs_require__(191);
  11470. var _colorspace = __w_pdfjs_require__(145);
  11471. var _decode_stream = __w_pdfjs_require__(150);
  11472. var _fonts_utils = __w_pdfjs_require__(169);
  11473. var _glyphlist = __w_pdfjs_require__(170);
  11474. var _core_utils = __w_pdfjs_require__(136);
  11475. var _metrics = __w_pdfjs_require__(176);
  11476. var _unicode = __w_pdfjs_require__(171);
  11477. var _murmurhash = __w_pdfjs_require__(192);
  11478. var _operator_list = __w_pdfjs_require__(193);
  11479. var _image = __w_pdfjs_require__(194);
  11480. const DefaultPartialEvaluatorOptions = Object.freeze({
  11481. maxImageSize: -1,
  11482. disableFontFace: false,
  11483. ignoreErrors: false,
  11484. isEvalSupported: true,
  11485. isOffscreenCanvasSupported: true,
  11486. fontExtraProperties: false,
  11487. useSystemFonts: true,
  11488. cMapUrl: null,
  11489. standardFontDataUrl: null
  11490. });
  11491. const PatternType = {
  11492. TILING: 1,
  11493. SHADING: 2
  11494. };
  11495. const TEXT_CHUNK_BATCH_SIZE = 10;
  11496. const deferred = Promise.resolve();
  11497. function normalizeBlendMode(value) {
  11498. let parsingArray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  11499. if (Array.isArray(value)) {
  11500. for (const val of value) {
  11501. const maybeBM = normalizeBlendMode(val, true);
  11502. if (maybeBM) {
  11503. return maybeBM;
  11504. }
  11505. }
  11506. (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
  11507. return "source-over";
  11508. }
  11509. if (!(value instanceof _primitives.Name)) {
  11510. if (parsingArray) {
  11511. return null;
  11512. }
  11513. return "source-over";
  11514. }
  11515. switch (value.name) {
  11516. case "Normal":
  11517. case "Compatible":
  11518. return "source-over";
  11519. case "Multiply":
  11520. return "multiply";
  11521. case "Screen":
  11522. return "screen";
  11523. case "Overlay":
  11524. return "overlay";
  11525. case "Darken":
  11526. return "darken";
  11527. case "Lighten":
  11528. return "lighten";
  11529. case "ColorDodge":
  11530. return "color-dodge";
  11531. case "ColorBurn":
  11532. return "color-burn";
  11533. case "HardLight":
  11534. return "hard-light";
  11535. case "SoftLight":
  11536. return "soft-light";
  11537. case "Difference":
  11538. return "difference";
  11539. case "Exclusion":
  11540. return "exclusion";
  11541. case "Hue":
  11542. return "hue";
  11543. case "Saturation":
  11544. return "saturation";
  11545. case "Color":
  11546. return "color";
  11547. case "Luminosity":
  11548. return "luminosity";
  11549. }
  11550. if (parsingArray) {
  11551. return null;
  11552. }
  11553. (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
  11554. return "source-over";
  11555. }
  11556. function incrementCachedImageMaskCount(data) {
  11557. if (data.fn === _util.OPS.paintImageMaskXObject && data.args[0] && data.args[0].count > 0) {
  11558. data.args[0].count++;
  11559. }
  11560. }
  11561. class TimeSlotManager {
  11562. static get TIME_SLOT_DURATION_MS() {
  11563. return (0, _util.shadow)(this, "TIME_SLOT_DURATION_MS", 20);
  11564. }
  11565. static get CHECK_TIME_EVERY() {
  11566. return (0, _util.shadow)(this, "CHECK_TIME_EVERY", 100);
  11567. }
  11568. constructor() {
  11569. this.reset();
  11570. }
  11571. check() {
  11572. if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
  11573. return false;
  11574. }
  11575. this.checked = 0;
  11576. return this.endTime <= Date.now();
  11577. }
  11578. reset() {
  11579. this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
  11580. this.checked = 0;
  11581. }
  11582. }
  11583. class PartialEvaluator {
  11584. constructor(_ref) {
  11585. let {
  11586. xref,
  11587. handler,
  11588. pageIndex,
  11589. idFactory,
  11590. fontCache,
  11591. builtInCMapCache,
  11592. standardFontDataCache,
  11593. globalImageCache,
  11594. options = null
  11595. } = _ref;
  11596. this.xref = xref;
  11597. this.handler = handler;
  11598. this.pageIndex = pageIndex;
  11599. this.idFactory = idFactory;
  11600. this.fontCache = fontCache;
  11601. this.builtInCMapCache = builtInCMapCache;
  11602. this.standardFontDataCache = standardFontDataCache;
  11603. this.globalImageCache = globalImageCache;
  11604. this.options = options || DefaultPartialEvaluatorOptions;
  11605. this.parsingType3Font = false;
  11606. this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
  11607. }
  11608. get _pdfFunctionFactory() {
  11609. const pdfFunctionFactory = new _function.PDFFunctionFactory({
  11610. xref: this.xref,
  11611. isEvalSupported: this.options.isEvalSupported
  11612. });
  11613. return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory);
  11614. }
  11615. clone() {
  11616. let newOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  11617. const newEvaluator = Object.create(this);
  11618. newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
  11619. return newEvaluator;
  11620. }
  11621. hasBlendModes(resources, nonBlendModesSet) {
  11622. if (!(resources instanceof _primitives.Dict)) {
  11623. return false;
  11624. }
  11625. if (resources.objId && nonBlendModesSet.has(resources.objId)) {
  11626. return false;
  11627. }
  11628. const processed = new _primitives.RefSet(nonBlendModesSet);
  11629. if (resources.objId) {
  11630. processed.put(resources.objId);
  11631. }
  11632. const nodes = [resources],
  11633. xref = this.xref;
  11634. while (nodes.length) {
  11635. const node = nodes.shift();
  11636. const graphicStates = node.get("ExtGState");
  11637. if (graphicStates instanceof _primitives.Dict) {
  11638. for (let graphicState of graphicStates.getRawValues()) {
  11639. if (graphicState instanceof _primitives.Ref) {
  11640. if (processed.has(graphicState)) {
  11641. continue;
  11642. }
  11643. try {
  11644. graphicState = xref.fetch(graphicState);
  11645. } catch (ex) {
  11646. processed.put(graphicState);
  11647. (0, _util.info)(`hasBlendModes - ignoring ExtGState: "${ex}".`);
  11648. continue;
  11649. }
  11650. }
  11651. if (!(graphicState instanceof _primitives.Dict)) {
  11652. continue;
  11653. }
  11654. if (graphicState.objId) {
  11655. processed.put(graphicState.objId);
  11656. }
  11657. const bm = graphicState.get("BM");
  11658. if (bm instanceof _primitives.Name) {
  11659. if (bm.name !== "Normal") {
  11660. return true;
  11661. }
  11662. continue;
  11663. }
  11664. if (bm !== undefined && Array.isArray(bm)) {
  11665. for (const element of bm) {
  11666. if (element instanceof _primitives.Name && element.name !== "Normal") {
  11667. return true;
  11668. }
  11669. }
  11670. }
  11671. }
  11672. }
  11673. const xObjects = node.get("XObject");
  11674. if (!(xObjects instanceof _primitives.Dict)) {
  11675. continue;
  11676. }
  11677. for (let xObject of xObjects.getRawValues()) {
  11678. if (xObject instanceof _primitives.Ref) {
  11679. if (processed.has(xObject)) {
  11680. continue;
  11681. }
  11682. try {
  11683. xObject = xref.fetch(xObject);
  11684. } catch (ex) {
  11685. processed.put(xObject);
  11686. (0, _util.info)(`hasBlendModes - ignoring XObject: "${ex}".`);
  11687. continue;
  11688. }
  11689. }
  11690. if (!(xObject instanceof _base_stream.BaseStream)) {
  11691. continue;
  11692. }
  11693. if (xObject.dict.objId) {
  11694. processed.put(xObject.dict.objId);
  11695. }
  11696. const xResources = xObject.dict.get("Resources");
  11697. if (!(xResources instanceof _primitives.Dict)) {
  11698. continue;
  11699. }
  11700. if (xResources.objId && processed.has(xResources.objId)) {
  11701. continue;
  11702. }
  11703. nodes.push(xResources);
  11704. if (xResources.objId) {
  11705. processed.put(xResources.objId);
  11706. }
  11707. }
  11708. }
  11709. for (const ref of processed) {
  11710. nonBlendModesSet.put(ref);
  11711. }
  11712. return false;
  11713. }
  11714. async fetchBuiltInCMap(name) {
  11715. const cachedData = this.builtInCMapCache.get(name);
  11716. if (cachedData) {
  11717. return cachedData;
  11718. }
  11719. let data;
  11720. if (this.options.cMapUrl !== null) {
  11721. const url = `${this.options.cMapUrl}${name}.bcmap`;
  11722. const response = await fetch(url);
  11723. if (!response.ok) {
  11724. throw new Error(`fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`);
  11725. }
  11726. data = {
  11727. cMapData: new Uint8Array(await response.arrayBuffer()),
  11728. compressionType: _util.CMapCompressionType.BINARY
  11729. };
  11730. } else {
  11731. data = await this.handler.sendWithPromise("FetchBuiltInCMap", {
  11732. name
  11733. });
  11734. }
  11735. if (data.compressionType !== _util.CMapCompressionType.NONE) {
  11736. this.builtInCMapCache.set(name, data);
  11737. }
  11738. return data;
  11739. }
  11740. async fetchStandardFontData(name) {
  11741. const cachedData = this.standardFontDataCache.get(name);
  11742. if (cachedData) {
  11743. return new _stream.Stream(cachedData);
  11744. }
  11745. if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") {
  11746. return null;
  11747. }
  11748. const standardFontNameToFileName = (0, _standard_fonts.getFontNameToFileMap)(),
  11749. filename = standardFontNameToFileName[name];
  11750. let data;
  11751. if (this.options.standardFontDataUrl !== null) {
  11752. const url = `${this.options.standardFontDataUrl}${filename}`;
  11753. const response = await fetch(url);
  11754. if (!response.ok) {
  11755. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`);
  11756. } else {
  11757. data = await response.arrayBuffer();
  11758. }
  11759. } else {
  11760. try {
  11761. data = await this.handler.sendWithPromise("FetchStandardFontData", {
  11762. filename
  11763. });
  11764. } catch (e) {
  11765. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`);
  11766. }
  11767. }
  11768. if (!data) {
  11769. return null;
  11770. }
  11771. this.standardFontDataCache.set(name, data);
  11772. return new _stream.Stream(data);
  11773. }
  11774. async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) {
  11775. const dict = xobj.dict;
  11776. const matrix = dict.getArray("Matrix");
  11777. let bbox = dict.getArray("BBox");
  11778. if (Array.isArray(bbox) && bbox.length === 4) {
  11779. bbox = _util.Util.normalizeRect(bbox);
  11780. } else {
  11781. bbox = null;
  11782. }
  11783. let optionalContent, groupOptions;
  11784. if (dict.has("OC")) {
  11785. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  11786. }
  11787. if (optionalContent !== undefined) {
  11788. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  11789. }
  11790. const group = dict.get("Group");
  11791. if (group) {
  11792. groupOptions = {
  11793. matrix,
  11794. bbox,
  11795. smask,
  11796. isolated: false,
  11797. knockout: false
  11798. };
  11799. const groupSubtype = group.get("S");
  11800. let colorSpace = null;
  11801. if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
  11802. groupOptions.isolated = group.get("I") || false;
  11803. groupOptions.knockout = group.get("K") || false;
  11804. if (group.has("CS")) {
  11805. const cs = group.getRaw("CS");
  11806. const cachedColorSpace = _colorspace.ColorSpace.getCached(cs, this.xref, localColorSpaceCache);
  11807. if (cachedColorSpace) {
  11808. colorSpace = cachedColorSpace;
  11809. } else {
  11810. colorSpace = await this.parseColorSpace({
  11811. cs,
  11812. resources,
  11813. localColorSpaceCache
  11814. });
  11815. }
  11816. }
  11817. }
  11818. if (smask && smask.backdrop) {
  11819. colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
  11820. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  11821. }
  11822. operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
  11823. }
  11824. const args = group ? [matrix, null] : [matrix, bbox];
  11825. operatorList.addOp(_util.OPS.paintFormXObjectBegin, args);
  11826. return this.getOperatorList({
  11827. stream: xobj,
  11828. task,
  11829. resources: dict.get("Resources") || resources,
  11830. operatorList,
  11831. initialState
  11832. }).then(function () {
  11833. operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
  11834. if (group) {
  11835. operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
  11836. }
  11837. if (optionalContent !== undefined) {
  11838. operatorList.addOp(_util.OPS.endMarkedContent, []);
  11839. }
  11840. });
  11841. }
  11842. _sendImgData(objId, imgData) {
  11843. let cacheGlobally = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  11844. const transfers = imgData ? [imgData.bitmap || imgData.data.buffer] : null;
  11845. if (this.parsingType3Font || cacheGlobally) {
  11846. return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
  11847. }
  11848. return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
  11849. }
  11850. async buildPaintImageXObject(_ref2) {
  11851. let {
  11852. resources,
  11853. image,
  11854. isInline = false,
  11855. operatorList,
  11856. cacheKey,
  11857. localImageCache,
  11858. localColorSpaceCache
  11859. } = _ref2;
  11860. const dict = image.dict;
  11861. const imageRef = dict.objId;
  11862. const w = dict.get("W", "Width");
  11863. const h = dict.get("H", "Height");
  11864. if (!(w && typeof w === "number") || !(h && typeof h === "number")) {
  11865. (0, _util.warn)("Image dimensions are missing, or not numbers.");
  11866. return;
  11867. }
  11868. const maxImageSize = this.options.maxImageSize;
  11869. if (maxImageSize !== -1 && w * h > maxImageSize) {
  11870. const msg = "Image exceeded maximum allowed size and was removed.";
  11871. if (this.options.ignoreErrors) {
  11872. (0, _util.warn)(msg);
  11873. return;
  11874. }
  11875. throw new Error(msg);
  11876. }
  11877. let optionalContent;
  11878. if (dict.has("OC")) {
  11879. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  11880. }
  11881. const imageMask = dict.get("IM", "ImageMask") || false;
  11882. let imgData, args;
  11883. if (imageMask) {
  11884. const interpolate = dict.get("I", "Interpolate");
  11885. const bitStrideLength = w + 7 >> 3;
  11886. const imgArray = image.getBytes(bitStrideLength * h);
  11887. const decode = dict.getArray("D", "Decode");
  11888. if (this.parsingType3Font) {
  11889. imgData = _image.PDFImage.createRawMask({
  11890. imgArray,
  11891. width: w,
  11892. height: h,
  11893. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  11894. inverseDecode: !!decode && decode[0] > 0,
  11895. interpolate
  11896. });
  11897. imgData.cached = !!cacheKey;
  11898. args = [imgData];
  11899. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  11900. if (cacheKey) {
  11901. localImageCache.set(cacheKey, imageRef, {
  11902. fn: _util.OPS.paintImageMaskXObject,
  11903. args,
  11904. optionalContent
  11905. });
  11906. }
  11907. return;
  11908. }
  11909. imgData = _image.PDFImage.createMask({
  11910. imgArray,
  11911. width: w,
  11912. height: h,
  11913. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  11914. inverseDecode: !!decode && decode[0] > 0,
  11915. interpolate,
  11916. isOffscreenCanvasSupported: this.options.isOffscreenCanvasSupported
  11917. });
  11918. if (imgData.isSingleOpaquePixel) {
  11919. operatorList.addImageOps(_util.OPS.paintSolidColorImageMask, [], optionalContent);
  11920. if (cacheKey) {
  11921. localImageCache.set(cacheKey, imageRef, {
  11922. fn: _util.OPS.paintSolidColorImageMask,
  11923. args: [],
  11924. optionalContent
  11925. });
  11926. }
  11927. return;
  11928. }
  11929. const objId = `mask_${this.idFactory.createObjId()}`;
  11930. operatorList.addDependency(objId);
  11931. this._sendImgData(objId, imgData);
  11932. args = [{
  11933. data: objId,
  11934. width: imgData.width,
  11935. height: imgData.height,
  11936. interpolate: imgData.interpolate,
  11937. count: 1
  11938. }];
  11939. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  11940. if (cacheKey) {
  11941. localImageCache.set(cacheKey, imageRef, {
  11942. fn: _util.OPS.paintImageMaskXObject,
  11943. args,
  11944. optionalContent
  11945. });
  11946. }
  11947. return;
  11948. }
  11949. const softMask = dict.get("SM", "SMask") || false;
  11950. const mask = dict.get("Mask") || false;
  11951. const SMALL_IMAGE_DIMENSIONS = 200;
  11952. if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) {
  11953. const imageObj = new _image.PDFImage({
  11954. xref: this.xref,
  11955. res: resources,
  11956. image,
  11957. isInline,
  11958. pdfFunctionFactory: this._pdfFunctionFactory,
  11959. localColorSpaceCache
  11960. });
  11961. imgData = imageObj.createImageData(true);
  11962. operatorList.addImageOps(_util.OPS.paintInlineImageXObject, [imgData], optionalContent);
  11963. return;
  11964. }
  11965. let objId = `img_${this.idFactory.createObjId()}`,
  11966. cacheGlobally = false;
  11967. if (this.parsingType3Font) {
  11968. objId = `${this.idFactory.getDocId()}_type3_${objId}`;
  11969. } else if (imageRef) {
  11970. cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
  11971. if (cacheGlobally) {
  11972. objId = `${this.idFactory.getDocId()}_${objId}`;
  11973. }
  11974. }
  11975. operatorList.addDependency(objId);
  11976. args = [objId, w, h];
  11977. _image.PDFImage.buildImage({
  11978. xref: this.xref,
  11979. res: resources,
  11980. image,
  11981. isInline,
  11982. pdfFunctionFactory: this._pdfFunctionFactory,
  11983. localColorSpaceCache
  11984. }).then(imageObj => {
  11985. imgData = imageObj.createImageData(false);
  11986. if (cacheKey && imageRef && cacheGlobally) {
  11987. this.globalImageCache.addByteSize(imageRef, imgData.data.length);
  11988. }
  11989. return this._sendImgData(objId, imgData, cacheGlobally);
  11990. }).catch(reason => {
  11991. (0, _util.warn)(`Unable to decode image "${objId}": "${reason}".`);
  11992. return this._sendImgData(objId, null, cacheGlobally);
  11993. });
  11994. operatorList.addImageOps(_util.OPS.paintImageXObject, args, optionalContent);
  11995. if (cacheKey) {
  11996. localImageCache.set(cacheKey, imageRef, {
  11997. fn: _util.OPS.paintImageXObject,
  11998. args,
  11999. optionalContent
  12000. });
  12001. if (imageRef) {
  12002. (0, _util.assert)(!isInline, "Cannot cache an inline image globally.");
  12003. this.globalImageCache.addPageIndex(imageRef, this.pageIndex);
  12004. if (cacheGlobally) {
  12005. this.globalImageCache.setData(imageRef, {
  12006. objId,
  12007. fn: _util.OPS.paintImageXObject,
  12008. args,
  12009. optionalContent,
  12010. byteSize: 0
  12011. });
  12012. }
  12013. }
  12014. }
  12015. }
  12016. handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) {
  12017. const smaskContent = smask.get("G");
  12018. const smaskOptions = {
  12019. subtype: smask.get("S").name,
  12020. backdrop: smask.get("BC")
  12021. };
  12022. const transferObj = smask.get("TR");
  12023. if ((0, _function.isPDFFunction)(transferObj)) {
  12024. const transferFn = this._pdfFunctionFactory.create(transferObj);
  12025. const transferMap = new Uint8Array(256);
  12026. const tmp = new Float32Array(1);
  12027. for (let i = 0; i < 256; i++) {
  12028. tmp[0] = i / 255;
  12029. transferFn(tmp, 0, tmp, 0);
  12030. transferMap[i] = tmp[0] * 255 | 0;
  12031. }
  12032. smaskOptions.transferMap = transferMap;
  12033. }
  12034. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache);
  12035. }
  12036. handleTransferFunction(tr) {
  12037. let transferArray;
  12038. if (Array.isArray(tr)) {
  12039. transferArray = tr;
  12040. } else if ((0, _function.isPDFFunction)(tr)) {
  12041. transferArray = [tr];
  12042. } else {
  12043. return null;
  12044. }
  12045. const transferMaps = [];
  12046. let numFns = 0,
  12047. numEffectfulFns = 0;
  12048. for (const entry of transferArray) {
  12049. const transferObj = this.xref.fetchIfRef(entry);
  12050. numFns++;
  12051. if ((0, _primitives.isName)(transferObj, "Identity")) {
  12052. transferMaps.push(null);
  12053. continue;
  12054. } else if (!(0, _function.isPDFFunction)(transferObj)) {
  12055. return null;
  12056. }
  12057. const transferFn = this._pdfFunctionFactory.create(transferObj);
  12058. const transferMap = new Uint8Array(256),
  12059. tmp = new Float32Array(1);
  12060. for (let j = 0; j < 256; j++) {
  12061. tmp[0] = j / 255;
  12062. transferFn(tmp, 0, tmp, 0);
  12063. transferMap[j] = tmp[0] * 255 | 0;
  12064. }
  12065. transferMaps.push(transferMap);
  12066. numEffectfulFns++;
  12067. }
  12068. if (!(numFns === 1 || numFns === 4)) {
  12069. return null;
  12070. }
  12071. if (numEffectfulFns === 0) {
  12072. return null;
  12073. }
  12074. return transferMaps;
  12075. }
  12076. handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) {
  12077. const tilingOpList = new _operator_list.OperatorList();
  12078. const patternResources = _primitives.Dict.merge({
  12079. xref: this.xref,
  12080. dictArray: [patternDict.get("Resources"), resources]
  12081. });
  12082. return this.getOperatorList({
  12083. stream: pattern,
  12084. task,
  12085. resources: patternResources,
  12086. operatorList: tilingOpList
  12087. }).then(function () {
  12088. const operatorListIR = tilingOpList.getIR();
  12089. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(operatorListIR, patternDict, color);
  12090. operatorList.addDependencies(tilingOpList.dependencies);
  12091. operatorList.addOp(fn, tilingPatternIR);
  12092. if (patternDict.objId) {
  12093. localTilingPatternCache.set(null, patternDict.objId, {
  12094. operatorListIR,
  12095. dict: patternDict
  12096. });
  12097. }
  12098. }).catch(reason => {
  12099. if (reason instanceof _util.AbortException) {
  12100. return;
  12101. }
  12102. if (this.options.ignoreErrors) {
  12103. this.handler.send("UnsupportedFeature", {
  12104. featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern
  12105. });
  12106. (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`);
  12107. return;
  12108. }
  12109. throw reason;
  12110. });
  12111. }
  12112. handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) {
  12113. let fallbackFontDict = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
  12114. let cssFontInfo = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  12115. const fontName = fontArgs && fontArgs[0] instanceof _primitives.Name ? fontArgs[0].name : null;
  12116. return this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo).then(translated => {
  12117. if (!translated.font.isType3Font) {
  12118. return translated;
  12119. }
  12120. return translated.loadType3Data(this, resources, task).then(function () {
  12121. operatorList.addDependencies(translated.type3Dependencies);
  12122. return translated;
  12123. }).catch(reason => {
  12124. this.handler.send("UnsupportedFeature", {
  12125. featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3
  12126. });
  12127. return new TranslatedFont({
  12128. loadedName: "g_font_error",
  12129. font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`),
  12130. dict: translated.font,
  12131. evaluatorOptions: this.options
  12132. });
  12133. });
  12134. }).then(translated => {
  12135. state.font = translated.font;
  12136. translated.send(this.handler);
  12137. return translated.loadedName;
  12138. });
  12139. }
  12140. handleText(chars, state) {
  12141. const font = state.font;
  12142. const glyphs = font.charsToGlyphs(chars);
  12143. if (font.data) {
  12144. const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  12145. if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
  12146. PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options);
  12147. }
  12148. }
  12149. return glyphs;
  12150. }
  12151. ensureStateFont(state) {
  12152. if (state.font) {
  12153. return;
  12154. }
  12155. const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
  12156. if (this.options.ignoreErrors) {
  12157. this.handler.send("UnsupportedFeature", {
  12158. featureId: _util.UNSUPPORTED_FEATURES.errorFontState
  12159. });
  12160. (0, _util.warn)(`ensureStateFont: "${reason}".`);
  12161. return;
  12162. }
  12163. throw reason;
  12164. }
  12165. async setGState(_ref3) {
  12166. let {
  12167. resources,
  12168. gState,
  12169. operatorList,
  12170. cacheKey,
  12171. task,
  12172. stateManager,
  12173. localGStateCache,
  12174. localColorSpaceCache
  12175. } = _ref3;
  12176. const gStateRef = gState.objId;
  12177. let isSimpleGState = true;
  12178. const gStateObj = [];
  12179. let promise = Promise.resolve();
  12180. for (const key of gState.getKeys()) {
  12181. const value = gState.get(key);
  12182. switch (key) {
  12183. case "Type":
  12184. break;
  12185. case "LW":
  12186. case "LC":
  12187. case "LJ":
  12188. case "ML":
  12189. case "D":
  12190. case "RI":
  12191. case "FL":
  12192. case "CA":
  12193. case "ca":
  12194. gStateObj.push([key, value]);
  12195. break;
  12196. case "Font":
  12197. isSimpleGState = false;
  12198. promise = promise.then(() => {
  12199. return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  12200. operatorList.addDependency(loadedName);
  12201. gStateObj.push([key, [loadedName, value[1]]]);
  12202. });
  12203. });
  12204. break;
  12205. case "BM":
  12206. gStateObj.push([key, normalizeBlendMode(value)]);
  12207. break;
  12208. case "SMask":
  12209. if ((0, _primitives.isName)(value, "None")) {
  12210. gStateObj.push([key, false]);
  12211. break;
  12212. }
  12213. if (value instanceof _primitives.Dict) {
  12214. isSimpleGState = false;
  12215. promise = promise.then(() => {
  12216. return this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache);
  12217. });
  12218. gStateObj.push([key, true]);
  12219. } else {
  12220. (0, _util.warn)("Unsupported SMask type");
  12221. }
  12222. break;
  12223. case "TR":
  12224. const transferMaps = this.handleTransferFunction(value);
  12225. gStateObj.push([key, transferMaps]);
  12226. break;
  12227. case "OP":
  12228. case "op":
  12229. case "OPM":
  12230. case "BG":
  12231. case "BG2":
  12232. case "UCR":
  12233. case "UCR2":
  12234. case "TR2":
  12235. case "HT":
  12236. case "SM":
  12237. case "SA":
  12238. case "AIS":
  12239. case "TK":
  12240. (0, _util.info)("graphic state operator " + key);
  12241. break;
  12242. default:
  12243. (0, _util.info)("Unknown graphic state operator " + key);
  12244. break;
  12245. }
  12246. }
  12247. return promise.then(function () {
  12248. if (gStateObj.length > 0) {
  12249. operatorList.addOp(_util.OPS.setGState, [gStateObj]);
  12250. }
  12251. if (isSimpleGState) {
  12252. localGStateCache.set(cacheKey, gStateRef, gStateObj);
  12253. }
  12254. });
  12255. }
  12256. loadFont(fontName, font, resources) {
  12257. let fallbackFontDict = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  12258. let cssFontInfo = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  12259. const errorFont = async () => {
  12260. return new TranslatedFont({
  12261. loadedName: "g_font_error",
  12262. font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`),
  12263. dict: font,
  12264. evaluatorOptions: this.options
  12265. });
  12266. };
  12267. const xref = this.xref;
  12268. let fontRef;
  12269. if (font) {
  12270. if (font instanceof _primitives.Ref) {
  12271. fontRef = font;
  12272. }
  12273. } else {
  12274. const fontRes = resources.get("Font");
  12275. if (fontRes) {
  12276. fontRef = fontRes.getRaw(fontName);
  12277. }
  12278. }
  12279. if (!fontRef) {
  12280. const partialMsg = `Font "${fontName || font && font.toString()}" is not available`;
  12281. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  12282. (0, _util.warn)(`${partialMsg}.`);
  12283. return errorFont();
  12284. }
  12285. this.handler.send("UnsupportedFeature", {
  12286. featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing
  12287. });
  12288. (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`);
  12289. if (fallbackFontDict) {
  12290. fontRef = fallbackFontDict;
  12291. } else {
  12292. fontRef = PartialEvaluator.fallbackFontDict;
  12293. }
  12294. }
  12295. if (this.parsingType3Font && this.type3FontRefs.has(fontRef)) {
  12296. return errorFont();
  12297. }
  12298. if (this.fontCache.has(fontRef)) {
  12299. return this.fontCache.get(fontRef);
  12300. }
  12301. font = xref.fetchIfRef(fontRef);
  12302. if (!(font instanceof _primitives.Dict)) {
  12303. return errorFont();
  12304. }
  12305. if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
  12306. return this.fontCache.get(font.cacheKey);
  12307. }
  12308. const fontCapability = (0, _util.createPromiseCapability)();
  12309. let preEvaluatedFont;
  12310. try {
  12311. preEvaluatedFont = this.preEvaluateFont(font);
  12312. preEvaluatedFont.cssFontInfo = cssFontInfo;
  12313. } catch (reason) {
  12314. (0, _util.warn)(`loadFont - preEvaluateFont failed: "${reason}".`);
  12315. return errorFont();
  12316. }
  12317. const {
  12318. descriptor,
  12319. hash
  12320. } = preEvaluatedFont;
  12321. const fontRefIsRef = fontRef instanceof _primitives.Ref;
  12322. let fontID;
  12323. if (fontRefIsRef) {
  12324. fontID = `f${fontRef.toString()}`;
  12325. }
  12326. if (hash && descriptor instanceof _primitives.Dict) {
  12327. if (!descriptor.fontAliases) {
  12328. descriptor.fontAliases = Object.create(null);
  12329. }
  12330. const fontAliases = descriptor.fontAliases;
  12331. if (fontAliases[hash]) {
  12332. const aliasFontRef = fontAliases[hash].aliasRef;
  12333. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  12334. this.fontCache.putAlias(fontRef, aliasFontRef);
  12335. return this.fontCache.get(fontRef);
  12336. }
  12337. } else {
  12338. fontAliases[hash] = {
  12339. fontID: this.idFactory.createFontId()
  12340. };
  12341. }
  12342. if (fontRefIsRef) {
  12343. fontAliases[hash].aliasRef = fontRef;
  12344. }
  12345. fontID = fontAliases[hash].fontID;
  12346. }
  12347. if (fontRefIsRef) {
  12348. this.fontCache.put(fontRef, fontCapability.promise);
  12349. } else {
  12350. if (!fontID) {
  12351. fontID = this.idFactory.createFontId();
  12352. }
  12353. font.cacheKey = `cacheKey_${fontID}`;
  12354. this.fontCache.put(font.cacheKey, fontCapability.promise);
  12355. }
  12356. (0, _util.assert)(fontID && fontID.startsWith("f"), 'The "fontID" must be (correctly) defined.');
  12357. font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
  12358. this.translateFont(preEvaluatedFont).then(translatedFont => {
  12359. fontCapability.resolve(new TranslatedFont({
  12360. loadedName: font.loadedName,
  12361. font: translatedFont,
  12362. dict: font,
  12363. evaluatorOptions: this.options
  12364. }));
  12365. }).catch(reason => {
  12366. this.handler.send("UnsupportedFeature", {
  12367. featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate
  12368. });
  12369. (0, _util.warn)(`loadFont - translateFont failed: "${reason}".`);
  12370. fontCapability.resolve(new TranslatedFont({
  12371. loadedName: font.loadedName,
  12372. font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason),
  12373. dict: font,
  12374. evaluatorOptions: this.options
  12375. }));
  12376. });
  12377. return fontCapability.promise;
  12378. }
  12379. buildPath(operatorList, fn, args) {
  12380. let parsingText = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  12381. const lastIndex = operatorList.length - 1;
  12382. if (!args) {
  12383. args = [];
  12384. }
  12385. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
  12386. if (parsingText) {
  12387. (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`);
  12388. operatorList.addOp(_util.OPS.save, null);
  12389. }
  12390. let minMax;
  12391. switch (fn) {
  12392. case _util.OPS.rectangle:
  12393. const x = args[0] + args[2];
  12394. const y = args[1] + args[3];
  12395. minMax = [Math.min(args[0], x), Math.max(args[0], x), Math.min(args[1], y), Math.max(args[1], y)];
  12396. break;
  12397. case _util.OPS.moveTo:
  12398. case _util.OPS.lineTo:
  12399. minMax = [args[0], args[0], args[1], args[1]];
  12400. break;
  12401. default:
  12402. minMax = [Infinity, -Infinity, Infinity, -Infinity];
  12403. break;
  12404. }
  12405. operatorList.addOp(_util.OPS.constructPath, [[fn], args, minMax]);
  12406. if (parsingText) {
  12407. operatorList.addOp(_util.OPS.restore, null);
  12408. }
  12409. } else {
  12410. const opArgs = operatorList.argsArray[lastIndex];
  12411. opArgs[0].push(fn);
  12412. opArgs[1].push(...args);
  12413. const minMax = opArgs[2];
  12414. switch (fn) {
  12415. case _util.OPS.rectangle:
  12416. const x = args[0] + args[2];
  12417. const y = args[1] + args[3];
  12418. minMax[0] = Math.min(minMax[0], args[0], x);
  12419. minMax[1] = Math.max(minMax[1], args[0], x);
  12420. minMax[2] = Math.min(minMax[2], args[1], y);
  12421. minMax[3] = Math.max(minMax[3], args[1], y);
  12422. break;
  12423. case _util.OPS.moveTo:
  12424. case _util.OPS.lineTo:
  12425. minMax[0] = Math.min(minMax[0], args[0]);
  12426. minMax[1] = Math.max(minMax[1], args[0]);
  12427. minMax[2] = Math.min(minMax[2], args[1]);
  12428. minMax[3] = Math.max(minMax[3], args[1]);
  12429. break;
  12430. }
  12431. }
  12432. }
  12433. parseColorSpace(_ref4) {
  12434. let {
  12435. cs,
  12436. resources,
  12437. localColorSpaceCache
  12438. } = _ref4;
  12439. return _colorspace.ColorSpace.parseAsync({
  12440. cs,
  12441. xref: this.xref,
  12442. resources,
  12443. pdfFunctionFactory: this._pdfFunctionFactory,
  12444. localColorSpaceCache
  12445. }).catch(reason => {
  12446. if (reason instanceof _util.AbortException) {
  12447. return null;
  12448. }
  12449. if (this.options.ignoreErrors) {
  12450. this.handler.send("UnsupportedFeature", {
  12451. featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace
  12452. });
  12453. (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
  12454. return null;
  12455. }
  12456. throw reason;
  12457. });
  12458. }
  12459. parseShading(_ref5) {
  12460. let {
  12461. shading,
  12462. resources,
  12463. localColorSpaceCache,
  12464. localShadingPatternCache
  12465. } = _ref5;
  12466. let id = localShadingPatternCache.get(shading);
  12467. if (!id) {
  12468. var shadingFill = _pattern.Pattern.parseShading(shading, this.xref, resources, this.handler, this._pdfFunctionFactory, localColorSpaceCache);
  12469. const patternIR = shadingFill.getIR();
  12470. id = `pattern_${this.idFactory.createObjId()}`;
  12471. localShadingPatternCache.set(shading, id);
  12472. this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
  12473. }
  12474. return id;
  12475. }
  12476. handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) {
  12477. const patternName = args.pop();
  12478. if (patternName instanceof _primitives.Name) {
  12479. const rawPattern = patterns.getRaw(patternName.name);
  12480. const localTilingPattern = rawPattern instanceof _primitives.Ref && localTilingPatternCache.getByRef(rawPattern);
  12481. if (localTilingPattern) {
  12482. try {
  12483. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  12484. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(localTilingPattern.operatorListIR, localTilingPattern.dict, color);
  12485. operatorList.addOp(fn, tilingPatternIR);
  12486. return undefined;
  12487. } catch (ex) {}
  12488. }
  12489. const pattern = this.xref.fetchIfRef(rawPattern);
  12490. if (pattern) {
  12491. const dict = pattern instanceof _base_stream.BaseStream ? pattern.dict : pattern;
  12492. const typeNum = dict.get("PatternType");
  12493. if (typeNum === PatternType.TILING) {
  12494. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  12495. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache);
  12496. } else if (typeNum === PatternType.SHADING) {
  12497. const shading = dict.get("Shading");
  12498. const matrix = dict.getArray("Matrix");
  12499. const objId = this.parseShading({
  12500. shading,
  12501. resources,
  12502. localColorSpaceCache,
  12503. localShadingPatternCache
  12504. });
  12505. operatorList.addOp(fn, ["Shading", objId, matrix]);
  12506. return undefined;
  12507. }
  12508. throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
  12509. }
  12510. }
  12511. throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
  12512. }
  12513. _parseVisibilityExpression(array, nestingCounter, currentResult) {
  12514. const MAX_NESTING = 10;
  12515. if (++nestingCounter > MAX_NESTING) {
  12516. (0, _util.warn)("Visibility expression is too deeply nested");
  12517. return;
  12518. }
  12519. const length = array.length;
  12520. const operator = this.xref.fetchIfRef(array[0]);
  12521. if (length < 2 || !(operator instanceof _primitives.Name)) {
  12522. (0, _util.warn)("Invalid visibility expression");
  12523. return;
  12524. }
  12525. switch (operator.name) {
  12526. case "And":
  12527. case "Or":
  12528. case "Not":
  12529. currentResult.push(operator.name);
  12530. break;
  12531. default:
  12532. (0, _util.warn)(`Invalid operator ${operator.name} in visibility expression`);
  12533. return;
  12534. }
  12535. for (let i = 1; i < length; i++) {
  12536. const raw = array[i];
  12537. const object = this.xref.fetchIfRef(raw);
  12538. if (Array.isArray(object)) {
  12539. const nestedResult = [];
  12540. currentResult.push(nestedResult);
  12541. this._parseVisibilityExpression(object, nestingCounter, nestedResult);
  12542. } else if (raw instanceof _primitives.Ref) {
  12543. currentResult.push(raw.toString());
  12544. }
  12545. }
  12546. }
  12547. async parseMarkedContentProps(contentProperties, resources) {
  12548. let optionalContent;
  12549. if (contentProperties instanceof _primitives.Name) {
  12550. const properties = resources.get("Properties");
  12551. optionalContent = properties.get(contentProperties.name);
  12552. } else if (contentProperties instanceof _primitives.Dict) {
  12553. optionalContent = contentProperties;
  12554. } else {
  12555. throw new _util.FormatError("Optional content properties malformed.");
  12556. }
  12557. const optionalContentType = optionalContent.get("Type").name;
  12558. if (optionalContentType === "OCG") {
  12559. return {
  12560. type: optionalContentType,
  12561. id: optionalContent.objId
  12562. };
  12563. } else if (optionalContentType === "OCMD") {
  12564. const expression = optionalContent.get("VE");
  12565. if (Array.isArray(expression)) {
  12566. const result = [];
  12567. this._parseVisibilityExpression(expression, 0, result);
  12568. if (result.length > 0) {
  12569. return {
  12570. type: "OCMD",
  12571. expression: result
  12572. };
  12573. }
  12574. }
  12575. const optionalContentGroups = optionalContent.get("OCGs");
  12576. if (Array.isArray(optionalContentGroups) || optionalContentGroups instanceof _primitives.Dict) {
  12577. const groupIds = [];
  12578. if (Array.isArray(optionalContentGroups)) {
  12579. for (const ocg of optionalContentGroups) {
  12580. groupIds.push(ocg.toString());
  12581. }
  12582. } else {
  12583. groupIds.push(optionalContentGroups.objId);
  12584. }
  12585. return {
  12586. type: optionalContentType,
  12587. ids: groupIds,
  12588. policy: optionalContent.get("P") instanceof _primitives.Name ? optionalContent.get("P").name : null,
  12589. expression: null
  12590. };
  12591. } else if (optionalContentGroups instanceof _primitives.Ref) {
  12592. return {
  12593. type: optionalContentType,
  12594. id: optionalContentGroups.toString()
  12595. };
  12596. }
  12597. }
  12598. return null;
  12599. }
  12600. getOperatorList(_ref6) {
  12601. let {
  12602. stream,
  12603. task,
  12604. resources,
  12605. operatorList,
  12606. initialState = null,
  12607. fallbackFontDict = null
  12608. } = _ref6;
  12609. resources = resources || _primitives.Dict.empty;
  12610. initialState = initialState || new EvalState();
  12611. if (!operatorList) {
  12612. throw new Error('getOperatorList: missing "operatorList" parameter');
  12613. }
  12614. const self = this;
  12615. const xref = this.xref;
  12616. let parsingText = false;
  12617. const localImageCache = new _image_utils.LocalImageCache();
  12618. const localColorSpaceCache = new _image_utils.LocalColorSpaceCache();
  12619. const localGStateCache = new _image_utils.LocalGStateCache();
  12620. const localTilingPatternCache = new _image_utils.LocalTilingPatternCache();
  12621. const localShadingPatternCache = new Map();
  12622. const xobjs = resources.get("XObject") || _primitives.Dict.empty;
  12623. const patterns = resources.get("Pattern") || _primitives.Dict.empty;
  12624. const stateManager = new StateManager(initialState);
  12625. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  12626. const timeSlotManager = new TimeSlotManager();
  12627. function closePendingRestoreOPS(argument) {
  12628. for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  12629. operatorList.addOp(_util.OPS.restore, []);
  12630. }
  12631. }
  12632. return new Promise(function promiseBody(resolve, reject) {
  12633. const next = function (promise) {
  12634. Promise.all([promise, operatorList.ready]).then(function () {
  12635. try {
  12636. promiseBody(resolve, reject);
  12637. } catch (ex) {
  12638. reject(ex);
  12639. }
  12640. }, reject);
  12641. };
  12642. task.ensureNotTerminated();
  12643. timeSlotManager.reset();
  12644. const operation = {};
  12645. let stop, i, ii, cs, name, isValidName;
  12646. while (!(stop = timeSlotManager.check())) {
  12647. operation.args = null;
  12648. if (!preprocessor.read(operation)) {
  12649. break;
  12650. }
  12651. let args = operation.args;
  12652. let fn = operation.fn;
  12653. switch (fn | 0) {
  12654. case _util.OPS.paintXObject:
  12655. isValidName = args[0] instanceof _primitives.Name;
  12656. name = args[0].name;
  12657. if (isValidName) {
  12658. const localImage = localImageCache.getByName(name);
  12659. if (localImage) {
  12660. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  12661. incrementCachedImageMaskCount(localImage);
  12662. args = null;
  12663. continue;
  12664. }
  12665. }
  12666. next(new Promise(function (resolveXObject, rejectXObject) {
  12667. if (!isValidName) {
  12668. throw new _util.FormatError("XObject must be referred to by name.");
  12669. }
  12670. let xobj = xobjs.getRaw(name);
  12671. if (xobj instanceof _primitives.Ref) {
  12672. const localImage = localImageCache.getByRef(xobj);
  12673. if (localImage) {
  12674. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  12675. incrementCachedImageMaskCount(localImage);
  12676. resolveXObject();
  12677. return;
  12678. }
  12679. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  12680. if (globalImage) {
  12681. operatorList.addDependency(globalImage.objId);
  12682. operatorList.addImageOps(globalImage.fn, globalImage.args, globalImage.optionalContent);
  12683. resolveXObject();
  12684. return;
  12685. }
  12686. xobj = xref.fetch(xobj);
  12687. }
  12688. if (!(xobj instanceof _base_stream.BaseStream)) {
  12689. throw new _util.FormatError("XObject should be a stream");
  12690. }
  12691. const type = xobj.dict.get("Subtype");
  12692. if (!(type instanceof _primitives.Name)) {
  12693. throw new _util.FormatError("XObject should have a Name subtype");
  12694. }
  12695. if (type.name === "Form") {
  12696. stateManager.save();
  12697. self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () {
  12698. stateManager.restore();
  12699. resolveXObject();
  12700. }, rejectXObject);
  12701. return;
  12702. } else if (type.name === "Image") {
  12703. self.buildPaintImageXObject({
  12704. resources,
  12705. image: xobj,
  12706. operatorList,
  12707. cacheKey: name,
  12708. localImageCache,
  12709. localColorSpaceCache
  12710. }).then(resolveXObject, rejectXObject);
  12711. return;
  12712. } else if (type.name === "PS") {
  12713. (0, _util.info)("Ignored XObject subtype PS");
  12714. } else {
  12715. throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);
  12716. }
  12717. resolveXObject();
  12718. }).catch(function (reason) {
  12719. if (reason instanceof _util.AbortException) {
  12720. return;
  12721. }
  12722. if (self.options.ignoreErrors) {
  12723. self.handler.send("UnsupportedFeature", {
  12724. featureId: _util.UNSUPPORTED_FEATURES.errorXObject
  12725. });
  12726. (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`);
  12727. return;
  12728. }
  12729. throw reason;
  12730. }));
  12731. return;
  12732. case _util.OPS.setFont:
  12733. var fontSize = args[1];
  12734. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) {
  12735. operatorList.addDependency(loadedName);
  12736. operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
  12737. }));
  12738. return;
  12739. case _util.OPS.beginText:
  12740. parsingText = true;
  12741. break;
  12742. case _util.OPS.endText:
  12743. parsingText = false;
  12744. break;
  12745. case _util.OPS.endInlineImage:
  12746. var cacheKey = args[0].cacheKey;
  12747. if (cacheKey) {
  12748. const localImage = localImageCache.getByName(cacheKey);
  12749. if (localImage) {
  12750. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  12751. incrementCachedImageMaskCount(localImage);
  12752. args = null;
  12753. continue;
  12754. }
  12755. }
  12756. next(self.buildPaintImageXObject({
  12757. resources,
  12758. image: args[0],
  12759. isInline: true,
  12760. operatorList,
  12761. cacheKey,
  12762. localImageCache,
  12763. localColorSpaceCache
  12764. }));
  12765. return;
  12766. case _util.OPS.showText:
  12767. if (!stateManager.state.font) {
  12768. self.ensureStateFont(stateManager.state);
  12769. continue;
  12770. }
  12771. args[0] = self.handleText(args[0], stateManager.state);
  12772. break;
  12773. case _util.OPS.showSpacedText:
  12774. if (!stateManager.state.font) {
  12775. self.ensureStateFont(stateManager.state);
  12776. continue;
  12777. }
  12778. var combinedGlyphs = [];
  12779. var state = stateManager.state;
  12780. for (const arrItem of args[0]) {
  12781. if (typeof arrItem === "string") {
  12782. combinedGlyphs.push(...self.handleText(arrItem, state));
  12783. } else if (typeof arrItem === "number") {
  12784. combinedGlyphs.push(arrItem);
  12785. }
  12786. }
  12787. args[0] = combinedGlyphs;
  12788. fn = _util.OPS.showText;
  12789. break;
  12790. case _util.OPS.nextLineShowText:
  12791. if (!stateManager.state.font) {
  12792. self.ensureStateFont(stateManager.state);
  12793. continue;
  12794. }
  12795. operatorList.addOp(_util.OPS.nextLine);
  12796. args[0] = self.handleText(args[0], stateManager.state);
  12797. fn = _util.OPS.showText;
  12798. break;
  12799. case _util.OPS.nextLineSetSpacingShowText:
  12800. if (!stateManager.state.font) {
  12801. self.ensureStateFont(stateManager.state);
  12802. continue;
  12803. }
  12804. operatorList.addOp(_util.OPS.nextLine);
  12805. operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
  12806. operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
  12807. args[0] = self.handleText(args[0], stateManager.state);
  12808. fn = _util.OPS.showText;
  12809. break;
  12810. case _util.OPS.setTextRenderingMode:
  12811. stateManager.state.textRenderingMode = args[0];
  12812. break;
  12813. case _util.OPS.setFillColorSpace:
  12814. {
  12815. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  12816. if (cachedColorSpace) {
  12817. stateManager.state.fillColorSpace = cachedColorSpace;
  12818. continue;
  12819. }
  12820. next(self.parseColorSpace({
  12821. cs: args[0],
  12822. resources,
  12823. localColorSpaceCache
  12824. }).then(function (colorSpace) {
  12825. if (colorSpace) {
  12826. stateManager.state.fillColorSpace = colorSpace;
  12827. }
  12828. }));
  12829. return;
  12830. }
  12831. case _util.OPS.setStrokeColorSpace:
  12832. {
  12833. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  12834. if (cachedColorSpace) {
  12835. stateManager.state.strokeColorSpace = cachedColorSpace;
  12836. continue;
  12837. }
  12838. next(self.parseColorSpace({
  12839. cs: args[0],
  12840. resources,
  12841. localColorSpaceCache
  12842. }).then(function (colorSpace) {
  12843. if (colorSpace) {
  12844. stateManager.state.strokeColorSpace = colorSpace;
  12845. }
  12846. }));
  12847. return;
  12848. }
  12849. case _util.OPS.setFillColor:
  12850. cs = stateManager.state.fillColorSpace;
  12851. args = cs.getRgb(args, 0);
  12852. fn = _util.OPS.setFillRGBColor;
  12853. break;
  12854. case _util.OPS.setStrokeColor:
  12855. cs = stateManager.state.strokeColorSpace;
  12856. args = cs.getRgb(args, 0);
  12857. fn = _util.OPS.setStrokeRGBColor;
  12858. break;
  12859. case _util.OPS.setFillGray:
  12860. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  12861. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  12862. fn = _util.OPS.setFillRGBColor;
  12863. break;
  12864. case _util.OPS.setStrokeGray:
  12865. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  12866. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  12867. fn = _util.OPS.setStrokeRGBColor;
  12868. break;
  12869. case _util.OPS.setFillCMYKColor:
  12870. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  12871. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  12872. fn = _util.OPS.setFillRGBColor;
  12873. break;
  12874. case _util.OPS.setStrokeCMYKColor:
  12875. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  12876. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  12877. fn = _util.OPS.setStrokeRGBColor;
  12878. break;
  12879. case _util.OPS.setFillRGBColor:
  12880. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
  12881. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  12882. break;
  12883. case _util.OPS.setStrokeRGBColor:
  12884. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
  12885. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  12886. break;
  12887. case _util.OPS.setFillColorN:
  12888. cs = stateManager.state.fillColorSpace;
  12889. if (cs.name === "Pattern") {
  12890. next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  12891. return;
  12892. }
  12893. args = cs.getRgb(args, 0);
  12894. fn = _util.OPS.setFillRGBColor;
  12895. break;
  12896. case _util.OPS.setStrokeColorN:
  12897. cs = stateManager.state.strokeColorSpace;
  12898. if (cs.name === "Pattern") {
  12899. next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  12900. return;
  12901. }
  12902. args = cs.getRgb(args, 0);
  12903. fn = _util.OPS.setStrokeRGBColor;
  12904. break;
  12905. case _util.OPS.shadingFill:
  12906. var shadingRes = resources.get("Shading");
  12907. if (!shadingRes) {
  12908. throw new _util.FormatError("No shading resource found");
  12909. }
  12910. var shading = shadingRes.get(args[0].name);
  12911. if (!shading) {
  12912. throw new _util.FormatError("No shading object found");
  12913. }
  12914. const patternId = self.parseShading({
  12915. shading,
  12916. resources,
  12917. localColorSpaceCache,
  12918. localShadingPatternCache
  12919. });
  12920. args = [patternId];
  12921. fn = _util.OPS.shadingFill;
  12922. break;
  12923. case _util.OPS.setGState:
  12924. isValidName = args[0] instanceof _primitives.Name;
  12925. name = args[0].name;
  12926. if (isValidName) {
  12927. const localGStateObj = localGStateCache.getByName(name);
  12928. if (localGStateObj) {
  12929. if (localGStateObj.length > 0) {
  12930. operatorList.addOp(_util.OPS.setGState, [localGStateObj]);
  12931. }
  12932. args = null;
  12933. continue;
  12934. }
  12935. }
  12936. next(new Promise(function (resolveGState, rejectGState) {
  12937. if (!isValidName) {
  12938. throw new _util.FormatError("GState must be referred to by name.");
  12939. }
  12940. const extGState = resources.get("ExtGState");
  12941. if (!(extGState instanceof _primitives.Dict)) {
  12942. throw new _util.FormatError("ExtGState should be a dictionary.");
  12943. }
  12944. const gState = extGState.get(name);
  12945. if (!(gState instanceof _primitives.Dict)) {
  12946. throw new _util.FormatError("GState should be a dictionary.");
  12947. }
  12948. self.setGState({
  12949. resources,
  12950. gState,
  12951. operatorList,
  12952. cacheKey: name,
  12953. task,
  12954. stateManager,
  12955. localGStateCache,
  12956. localColorSpaceCache
  12957. }).then(resolveGState, rejectGState);
  12958. }).catch(function (reason) {
  12959. if (reason instanceof _util.AbortException) {
  12960. return;
  12961. }
  12962. if (self.options.ignoreErrors) {
  12963. self.handler.send("UnsupportedFeature", {
  12964. featureId: _util.UNSUPPORTED_FEATURES.errorExtGState
  12965. });
  12966. (0, _util.warn)(`getOperatorList - ignoring ExtGState: "${reason}".`);
  12967. return;
  12968. }
  12969. throw reason;
  12970. }));
  12971. return;
  12972. case _util.OPS.moveTo:
  12973. case _util.OPS.lineTo:
  12974. case _util.OPS.curveTo:
  12975. case _util.OPS.curveTo2:
  12976. case _util.OPS.curveTo3:
  12977. case _util.OPS.closePath:
  12978. case _util.OPS.rectangle:
  12979. self.buildPath(operatorList, fn, args, parsingText);
  12980. continue;
  12981. case _util.OPS.markPoint:
  12982. case _util.OPS.markPointProps:
  12983. case _util.OPS.beginCompat:
  12984. case _util.OPS.endCompat:
  12985. continue;
  12986. case _util.OPS.beginMarkedContentProps:
  12987. if (!(args[0] instanceof _primitives.Name)) {
  12988. (0, _util.warn)(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
  12989. continue;
  12990. }
  12991. if (args[0].name === "OC") {
  12992. next(self.parseMarkedContentProps(args[1], resources).then(data => {
  12993. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", data]);
  12994. }).catch(reason => {
  12995. if (reason instanceof _util.AbortException) {
  12996. return;
  12997. }
  12998. if (self.options.ignoreErrors) {
  12999. self.handler.send("UnsupportedFeature", {
  13000. featureId: _util.UNSUPPORTED_FEATURES.errorMarkedContent
  13001. });
  13002. (0, _util.warn)(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
  13003. return;
  13004. }
  13005. throw reason;
  13006. }));
  13007. return;
  13008. }
  13009. args = [args[0].name, args[1] instanceof _primitives.Dict ? args[1].get("MCID") : null];
  13010. break;
  13011. case _util.OPS.beginMarkedContent:
  13012. case _util.OPS.endMarkedContent:
  13013. default:
  13014. if (args !== null) {
  13015. for (i = 0, ii = args.length; i < ii; i++) {
  13016. if (args[i] instanceof _primitives.Dict) {
  13017. break;
  13018. }
  13019. }
  13020. if (i < ii) {
  13021. (0, _util.warn)("getOperatorList - ignoring operator: " + fn);
  13022. continue;
  13023. }
  13024. }
  13025. }
  13026. operatorList.addOp(fn, args);
  13027. }
  13028. if (stop) {
  13029. next(deferred);
  13030. return;
  13031. }
  13032. closePendingRestoreOPS();
  13033. resolve();
  13034. }).catch(reason => {
  13035. if (reason instanceof _util.AbortException) {
  13036. return;
  13037. }
  13038. if (this.options.ignoreErrors) {
  13039. this.handler.send("UnsupportedFeature", {
  13040. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  13041. });
  13042. (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  13043. closePendingRestoreOPS();
  13044. return;
  13045. }
  13046. throw reason;
  13047. });
  13048. }
  13049. getTextContent(_ref7) {
  13050. let {
  13051. stream,
  13052. task,
  13053. resources,
  13054. stateManager = null,
  13055. combineTextItems = false,
  13056. includeMarkedContent = false,
  13057. sink,
  13058. seenStyles = new Set(),
  13059. viewBox,
  13060. markedContentData = null
  13061. } = _ref7;
  13062. resources = resources || _primitives.Dict.empty;
  13063. stateManager = stateManager || new StateManager(new TextState());
  13064. if (includeMarkedContent) {
  13065. markedContentData = markedContentData || {
  13066. level: 0
  13067. };
  13068. }
  13069. const textContent = {
  13070. items: [],
  13071. styles: Object.create(null)
  13072. };
  13073. const textContentItem = {
  13074. initialized: false,
  13075. str: [],
  13076. totalWidth: 0,
  13077. totalHeight: 0,
  13078. width: 0,
  13079. height: 0,
  13080. vertical: false,
  13081. prevTransform: null,
  13082. textAdvanceScale: 0,
  13083. spaceInFlowMin: 0,
  13084. spaceInFlowMax: 0,
  13085. trackingSpaceMin: Infinity,
  13086. negativeSpaceMax: -Infinity,
  13087. notASpace: -Infinity,
  13088. transform: null,
  13089. fontName: null,
  13090. hasEOL: false
  13091. };
  13092. const twoLastChars = [" ", " "];
  13093. let twoLastCharsPos = 0;
  13094. function saveLastChar(char) {
  13095. const nextPos = (twoLastCharsPos + 1) % 2;
  13096. const ret = twoLastChars[twoLastCharsPos] !== " " && twoLastChars[nextPos] === " ";
  13097. twoLastChars[twoLastCharsPos] = char;
  13098. twoLastCharsPos = nextPos;
  13099. return ret;
  13100. }
  13101. function resetLastChars() {
  13102. twoLastChars[0] = twoLastChars[1] = " ";
  13103. twoLastCharsPos = 0;
  13104. }
  13105. const TRACKING_SPACE_FACTOR = 0.1;
  13106. const NOT_A_SPACE_FACTOR = 0.03;
  13107. const NEGATIVE_SPACE_FACTOR = -0.2;
  13108. const SPACE_IN_FLOW_MIN_FACTOR = 0.1;
  13109. const SPACE_IN_FLOW_MAX_FACTOR = 0.6;
  13110. const self = this;
  13111. const xref = this.xref;
  13112. const showSpacedTextBuffer = [];
  13113. let xobjs = null;
  13114. const emptyXObjectCache = new _image_utils.LocalImageCache();
  13115. const emptyGStateCache = new _image_utils.LocalGStateCache();
  13116. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  13117. let textState;
  13118. function getCurrentTextTransform() {
  13119. const font = textState.font;
  13120. const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  13121. if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
  13122. const glyphHeight = font.bbox[3] - font.bbox[1];
  13123. if (glyphHeight > 0) {
  13124. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  13125. }
  13126. }
  13127. return _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
  13128. }
  13129. function ensureTextContentItem() {
  13130. if (textContentItem.initialized) {
  13131. return textContentItem;
  13132. }
  13133. const {
  13134. font,
  13135. loadedName
  13136. } = textState;
  13137. if (!seenStyles.has(loadedName)) {
  13138. seenStyles.add(loadedName);
  13139. textContent.styles[loadedName] = {
  13140. fontFamily: font.fallbackName,
  13141. ascent: font.ascent,
  13142. descent: font.descent,
  13143. vertical: font.vertical
  13144. };
  13145. }
  13146. textContentItem.fontName = loadedName;
  13147. const trm = textContentItem.transform = getCurrentTextTransform();
  13148. if (!font.vertical) {
  13149. textContentItem.width = textContentItem.totalWidth = 0;
  13150. textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]);
  13151. textContentItem.vertical = false;
  13152. } else {
  13153. textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]);
  13154. textContentItem.height = textContentItem.totalHeight = 0;
  13155. textContentItem.vertical = true;
  13156. }
  13157. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  13158. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  13159. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  13160. textContentItem.trackingSpaceMin = textState.fontSize * TRACKING_SPACE_FACTOR;
  13161. textContentItem.notASpace = textState.fontSize * NOT_A_SPACE_FACTOR;
  13162. textContentItem.negativeSpaceMax = textState.fontSize * NEGATIVE_SPACE_FACTOR;
  13163. textContentItem.spaceInFlowMin = textState.fontSize * SPACE_IN_FLOW_MIN_FACTOR;
  13164. textContentItem.spaceInFlowMax = textState.fontSize * SPACE_IN_FLOW_MAX_FACTOR;
  13165. textContentItem.hasEOL = false;
  13166. textContentItem.initialized = true;
  13167. return textContentItem;
  13168. }
  13169. function updateAdvanceScale() {
  13170. if (!textContentItem.initialized) {
  13171. return;
  13172. }
  13173. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  13174. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  13175. const scaleFactor = scaleCtmX * scaleLineX;
  13176. if (scaleFactor === textContentItem.textAdvanceScale) {
  13177. return;
  13178. }
  13179. if (!textContentItem.vertical) {
  13180. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  13181. textContentItem.width = 0;
  13182. } else {
  13183. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  13184. textContentItem.height = 0;
  13185. }
  13186. textContentItem.textAdvanceScale = scaleFactor;
  13187. }
  13188. function runBidiTransform(textChunk) {
  13189. const text = textChunk.str.join("");
  13190. const bidiResult = (0, _bidi.bidi)(text, -1, textChunk.vertical);
  13191. return {
  13192. str: bidiResult.str,
  13193. dir: bidiResult.dir,
  13194. width: Math.abs(textChunk.totalWidth),
  13195. height: Math.abs(textChunk.totalHeight),
  13196. transform: textChunk.transform,
  13197. fontName: textChunk.fontName,
  13198. hasEOL: textChunk.hasEOL
  13199. };
  13200. }
  13201. function handleSetFont(fontName, fontRef) {
  13202. return self.loadFont(fontName, fontRef, resources).then(function (translated) {
  13203. if (!translated.font.isType3Font) {
  13204. return translated;
  13205. }
  13206. return translated.loadType3Data(self, resources, task).catch(function () {}).then(function () {
  13207. return translated;
  13208. });
  13209. }).then(function (translated) {
  13210. textState.loadedName = translated.loadedName;
  13211. textState.font = translated.font;
  13212. textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  13213. });
  13214. }
  13215. function applyInverseRotation(x, y, matrix) {
  13216. const scale = Math.hypot(matrix[0], matrix[1]);
  13217. return [(matrix[0] * x + matrix[1] * y) / scale, (matrix[2] * x + matrix[3] * y) / scale];
  13218. }
  13219. function compareWithLastPosition() {
  13220. const currentTransform = getCurrentTextTransform();
  13221. let posX = currentTransform[4];
  13222. let posY = currentTransform[5];
  13223. const shiftedX = posX - viewBox[0];
  13224. const shiftedY = posY - viewBox[1];
  13225. if (shiftedX < 0 || shiftedX > viewBox[2] || shiftedY < 0 || shiftedY > viewBox[3]) {
  13226. return false;
  13227. }
  13228. if (!combineTextItems || !textState.font || !textContentItem.prevTransform) {
  13229. return true;
  13230. }
  13231. let lastPosX = textContentItem.prevTransform[4];
  13232. let lastPosY = textContentItem.prevTransform[5];
  13233. if (lastPosX === posX && lastPosY === posY) {
  13234. return true;
  13235. }
  13236. let rotate = -1;
  13237. if (currentTransform[0] && currentTransform[1] === 0 && currentTransform[2] === 0) {
  13238. rotate = currentTransform[0] > 0 ? 0 : 180;
  13239. } else if (currentTransform[1] && currentTransform[0] === 0 && currentTransform[3] === 0) {
  13240. rotate = currentTransform[1] > 0 ? 90 : 270;
  13241. }
  13242. switch (rotate) {
  13243. case 0:
  13244. break;
  13245. case 90:
  13246. [posX, posY] = [posY, posX];
  13247. [lastPosX, lastPosY] = [lastPosY, lastPosX];
  13248. break;
  13249. case 180:
  13250. [posX, posY, lastPosX, lastPosY] = [-posX, -posY, -lastPosX, -lastPosY];
  13251. break;
  13252. case 270:
  13253. [posX, posY] = [-posY, -posX];
  13254. [lastPosX, lastPosY] = [-lastPosY, -lastPosX];
  13255. break;
  13256. default:
  13257. [posX, posY] = applyInverseRotation(posX, posY, currentTransform);
  13258. [lastPosX, lastPosY] = applyInverseRotation(lastPosX, lastPosY, textContentItem.prevTransform);
  13259. }
  13260. if (textState.font.vertical) {
  13261. const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale;
  13262. const advanceX = posX - lastPosX;
  13263. const textOrientation = Math.sign(textContentItem.height);
  13264. if (advanceY < textOrientation * textContentItem.negativeSpaceMax) {
  13265. if (Math.abs(advanceX) > 0.5 * textContentItem.width) {
  13266. appendEOL();
  13267. return true;
  13268. }
  13269. resetLastChars();
  13270. flushTextContentItem();
  13271. return true;
  13272. }
  13273. if (Math.abs(advanceX) > textContentItem.width) {
  13274. appendEOL();
  13275. return true;
  13276. }
  13277. if (advanceY <= textOrientation * textContentItem.notASpace) {
  13278. resetLastChars();
  13279. }
  13280. if (advanceY <= textOrientation * textContentItem.trackingSpaceMin) {
  13281. textContentItem.height += advanceY;
  13282. } else if (!addFakeSpaces(advanceY, textContentItem.prevTransform, textOrientation)) {
  13283. if (textContentItem.str.length === 0) {
  13284. resetLastChars();
  13285. textContent.items.push({
  13286. str: " ",
  13287. dir: "ltr",
  13288. width: 0,
  13289. height: Math.abs(advanceY),
  13290. transform: textContentItem.prevTransform,
  13291. fontName: textContentItem.fontName,
  13292. hasEOL: false
  13293. });
  13294. } else {
  13295. textContentItem.height += advanceY;
  13296. }
  13297. }
  13298. return true;
  13299. }
  13300. const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
  13301. const advanceY = posY - lastPosY;
  13302. const textOrientation = Math.sign(textContentItem.width);
  13303. if (advanceX < textOrientation * textContentItem.negativeSpaceMax) {
  13304. if (Math.abs(advanceY) > 0.5 * textContentItem.height) {
  13305. appendEOL();
  13306. return true;
  13307. }
  13308. resetLastChars();
  13309. flushTextContentItem();
  13310. return true;
  13311. }
  13312. if (Math.abs(advanceY) > textContentItem.height) {
  13313. appendEOL();
  13314. return true;
  13315. }
  13316. if (advanceX <= textOrientation * textContentItem.notASpace) {
  13317. resetLastChars();
  13318. }
  13319. if (advanceX <= textOrientation * textContentItem.trackingSpaceMin) {
  13320. textContentItem.width += advanceX;
  13321. } else if (!addFakeSpaces(advanceX, textContentItem.prevTransform, textOrientation)) {
  13322. if (textContentItem.str.length === 0) {
  13323. resetLastChars();
  13324. textContent.items.push({
  13325. str: " ",
  13326. dir: "ltr",
  13327. width: Math.abs(advanceX),
  13328. height: 0,
  13329. transform: textContentItem.prevTransform,
  13330. fontName: textContentItem.fontName,
  13331. hasEOL: false
  13332. });
  13333. } else {
  13334. textContentItem.width += advanceX;
  13335. }
  13336. }
  13337. return true;
  13338. }
  13339. function buildTextContentItem(_ref8) {
  13340. let {
  13341. chars,
  13342. extraSpacing
  13343. } = _ref8;
  13344. const font = textState.font;
  13345. if (!chars) {
  13346. const charSpacing = textState.charSpacing + extraSpacing;
  13347. if (charSpacing) {
  13348. if (!font.vertical) {
  13349. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  13350. } else {
  13351. textState.translateTextMatrix(0, -charSpacing);
  13352. }
  13353. }
  13354. return;
  13355. }
  13356. const glyphs = font.charsToGlyphs(chars);
  13357. const scale = textState.fontMatrix[0] * textState.fontSize;
  13358. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  13359. const glyph = glyphs[i];
  13360. const {
  13361. category
  13362. } = glyph;
  13363. if (category.isInvisibleFormatMark) {
  13364. continue;
  13365. }
  13366. let charSpacing = textState.charSpacing + (i + 1 === ii ? extraSpacing : 0);
  13367. let glyphWidth = glyph.width;
  13368. if (font.vertical) {
  13369. glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth;
  13370. }
  13371. let scaledDim = glyphWidth * scale;
  13372. if (category.isWhitespace) {
  13373. if (!font.vertical) {
  13374. charSpacing += scaledDim + textState.wordSpacing;
  13375. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  13376. } else {
  13377. charSpacing += -scaledDim + textState.wordSpacing;
  13378. textState.translateTextMatrix(0, -charSpacing);
  13379. }
  13380. saveLastChar(" ");
  13381. continue;
  13382. }
  13383. if (!category.isZeroWidthDiacritic && !compareWithLastPosition()) {
  13384. continue;
  13385. }
  13386. const textChunk = ensureTextContentItem();
  13387. if (category.isZeroWidthDiacritic) {
  13388. scaledDim = 0;
  13389. }
  13390. if (!font.vertical) {
  13391. scaledDim *= textState.textHScale;
  13392. textState.translateTextMatrix(scaledDim, 0);
  13393. textChunk.width += scaledDim;
  13394. } else {
  13395. textState.translateTextMatrix(0, scaledDim);
  13396. scaledDim = Math.abs(scaledDim);
  13397. textChunk.height += scaledDim;
  13398. }
  13399. if (scaledDim) {
  13400. textChunk.prevTransform = getCurrentTextTransform();
  13401. }
  13402. const glyphUnicode = glyph.normalizedUnicode;
  13403. if (saveLastChar(glyphUnicode)) {
  13404. textChunk.str.push(" ");
  13405. }
  13406. textChunk.str.push(glyphUnicode);
  13407. if (charSpacing) {
  13408. if (!font.vertical) {
  13409. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  13410. } else {
  13411. textState.translateTextMatrix(0, -charSpacing);
  13412. }
  13413. }
  13414. }
  13415. }
  13416. function appendEOL() {
  13417. resetLastChars();
  13418. if (textContentItem.initialized) {
  13419. textContentItem.hasEOL = true;
  13420. flushTextContentItem();
  13421. } else {
  13422. textContent.items.push({
  13423. str: "",
  13424. dir: "ltr",
  13425. width: 0,
  13426. height: 0,
  13427. transform: getCurrentTextTransform(),
  13428. fontName: textState.loadedName,
  13429. hasEOL: true
  13430. });
  13431. }
  13432. }
  13433. function addFakeSpaces(width, transf, textOrientation) {
  13434. if (textOrientation * textContentItem.spaceInFlowMin <= width && width <= textOrientation * textContentItem.spaceInFlowMax) {
  13435. if (textContentItem.initialized) {
  13436. resetLastChars();
  13437. textContentItem.str.push(" ");
  13438. }
  13439. return false;
  13440. }
  13441. const fontName = textContentItem.fontName;
  13442. let height = 0;
  13443. if (textContentItem.vertical) {
  13444. height = width;
  13445. width = 0;
  13446. }
  13447. flushTextContentItem();
  13448. resetLastChars();
  13449. textContent.items.push({
  13450. str: " ",
  13451. dir: "ltr",
  13452. width: Math.abs(width),
  13453. height: Math.abs(height),
  13454. transform: transf || getCurrentTextTransform(),
  13455. fontName,
  13456. hasEOL: false
  13457. });
  13458. return true;
  13459. }
  13460. function flushTextContentItem() {
  13461. if (!textContentItem.initialized || !textContentItem.str) {
  13462. return;
  13463. }
  13464. if (!textContentItem.vertical) {
  13465. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  13466. } else {
  13467. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  13468. }
  13469. textContent.items.push(runBidiTransform(textContentItem));
  13470. textContentItem.initialized = false;
  13471. textContentItem.str.length = 0;
  13472. }
  13473. function enqueueChunk() {
  13474. let batch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  13475. const length = textContent.items.length;
  13476. if (length === 0) {
  13477. return;
  13478. }
  13479. if (batch && length < TEXT_CHUNK_BATCH_SIZE) {
  13480. return;
  13481. }
  13482. sink.enqueue(textContent, length);
  13483. textContent.items = [];
  13484. textContent.styles = Object.create(null);
  13485. }
  13486. const timeSlotManager = new TimeSlotManager();
  13487. return new Promise(function promiseBody(resolve, reject) {
  13488. const next = function (promise) {
  13489. enqueueChunk(true);
  13490. Promise.all([promise, sink.ready]).then(function () {
  13491. try {
  13492. promiseBody(resolve, reject);
  13493. } catch (ex) {
  13494. reject(ex);
  13495. }
  13496. }, reject);
  13497. };
  13498. task.ensureNotTerminated();
  13499. timeSlotManager.reset();
  13500. const operation = {};
  13501. let stop,
  13502. args = [];
  13503. while (!(stop = timeSlotManager.check())) {
  13504. args.length = 0;
  13505. operation.args = args;
  13506. if (!preprocessor.read(operation)) {
  13507. break;
  13508. }
  13509. textState = stateManager.state;
  13510. const fn = operation.fn;
  13511. args = operation.args;
  13512. switch (fn | 0) {
  13513. case _util.OPS.setFont:
  13514. var fontNameArg = args[0].name,
  13515. fontSizeArg = args[1];
  13516. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  13517. break;
  13518. }
  13519. flushTextContentItem();
  13520. textState.fontName = fontNameArg;
  13521. textState.fontSize = fontSizeArg;
  13522. next(handleSetFont(fontNameArg, null));
  13523. return;
  13524. case _util.OPS.setTextRise:
  13525. textState.textRise = args[0];
  13526. break;
  13527. case _util.OPS.setHScale:
  13528. textState.textHScale = args[0] / 100;
  13529. break;
  13530. case _util.OPS.setLeading:
  13531. textState.leading = args[0];
  13532. break;
  13533. case _util.OPS.moveText:
  13534. textState.translateTextLineMatrix(args[0], args[1]);
  13535. textState.textMatrix = textState.textLineMatrix.slice();
  13536. break;
  13537. case _util.OPS.setLeadingMoveText:
  13538. textState.leading = -args[1];
  13539. textState.translateTextLineMatrix(args[0], args[1]);
  13540. textState.textMatrix = textState.textLineMatrix.slice();
  13541. break;
  13542. case _util.OPS.nextLine:
  13543. textState.carriageReturn();
  13544. break;
  13545. case _util.OPS.setTextMatrix:
  13546. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  13547. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  13548. updateAdvanceScale();
  13549. break;
  13550. case _util.OPS.setCharSpacing:
  13551. textState.charSpacing = args[0];
  13552. break;
  13553. case _util.OPS.setWordSpacing:
  13554. textState.wordSpacing = args[0];
  13555. break;
  13556. case _util.OPS.beginText:
  13557. textState.textMatrix = _util.IDENTITY_MATRIX.slice();
  13558. textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  13559. break;
  13560. case _util.OPS.showSpacedText:
  13561. if (!stateManager.state.font) {
  13562. self.ensureStateFont(stateManager.state);
  13563. continue;
  13564. }
  13565. const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000;
  13566. const elements = args[0];
  13567. for (let i = 0, ii = elements.length; i < ii - 1; i++) {
  13568. const item = elements[i];
  13569. if (typeof item === "string") {
  13570. showSpacedTextBuffer.push(item);
  13571. } else if (typeof item === "number" && item !== 0) {
  13572. const str = showSpacedTextBuffer.join("");
  13573. showSpacedTextBuffer.length = 0;
  13574. buildTextContentItem({
  13575. chars: str,
  13576. extraSpacing: item * spaceFactor
  13577. });
  13578. }
  13579. }
  13580. const item = elements.at(-1);
  13581. if (typeof item === "string") {
  13582. showSpacedTextBuffer.push(item);
  13583. }
  13584. if (showSpacedTextBuffer.length > 0) {
  13585. const str = showSpacedTextBuffer.join("");
  13586. showSpacedTextBuffer.length = 0;
  13587. buildTextContentItem({
  13588. chars: str,
  13589. extraSpacing: 0
  13590. });
  13591. }
  13592. break;
  13593. case _util.OPS.showText:
  13594. if (!stateManager.state.font) {
  13595. self.ensureStateFont(stateManager.state);
  13596. continue;
  13597. }
  13598. buildTextContentItem({
  13599. chars: args[0],
  13600. extraSpacing: 0
  13601. });
  13602. break;
  13603. case _util.OPS.nextLineShowText:
  13604. if (!stateManager.state.font) {
  13605. self.ensureStateFont(stateManager.state);
  13606. continue;
  13607. }
  13608. textState.carriageReturn();
  13609. buildTextContentItem({
  13610. chars: args[0],
  13611. extraSpacing: 0
  13612. });
  13613. break;
  13614. case _util.OPS.nextLineSetSpacingShowText:
  13615. if (!stateManager.state.font) {
  13616. self.ensureStateFont(stateManager.state);
  13617. continue;
  13618. }
  13619. textState.wordSpacing = args[0];
  13620. textState.charSpacing = args[1];
  13621. textState.carriageReturn();
  13622. buildTextContentItem({
  13623. chars: args[2],
  13624. extraSpacing: 0
  13625. });
  13626. break;
  13627. case _util.OPS.paintXObject:
  13628. flushTextContentItem();
  13629. if (!xobjs) {
  13630. xobjs = resources.get("XObject") || _primitives.Dict.empty;
  13631. }
  13632. var isValidName = args[0] instanceof _primitives.Name;
  13633. var name = args[0].name;
  13634. if (isValidName && emptyXObjectCache.getByName(name)) {
  13635. break;
  13636. }
  13637. next(new Promise(function (resolveXObject, rejectXObject) {
  13638. if (!isValidName) {
  13639. throw new _util.FormatError("XObject must be referred to by name.");
  13640. }
  13641. let xobj = xobjs.getRaw(name);
  13642. if (xobj instanceof _primitives.Ref) {
  13643. if (emptyXObjectCache.getByRef(xobj)) {
  13644. resolveXObject();
  13645. return;
  13646. }
  13647. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  13648. if (globalImage) {
  13649. resolveXObject();
  13650. return;
  13651. }
  13652. xobj = xref.fetch(xobj);
  13653. }
  13654. if (!(xobj instanceof _base_stream.BaseStream)) {
  13655. throw new _util.FormatError("XObject should be a stream");
  13656. }
  13657. const type = xobj.dict.get("Subtype");
  13658. if (!(type instanceof _primitives.Name)) {
  13659. throw new _util.FormatError("XObject should have a Name subtype");
  13660. }
  13661. if (type.name !== "Form") {
  13662. emptyXObjectCache.set(name, xobj.dict.objId, true);
  13663. resolveXObject();
  13664. return;
  13665. }
  13666. const currentState = stateManager.state.clone();
  13667. const xObjStateManager = new StateManager(currentState);
  13668. const matrix = xobj.dict.getArray("Matrix");
  13669. if (Array.isArray(matrix) && matrix.length === 6) {
  13670. xObjStateManager.transform(matrix);
  13671. }
  13672. enqueueChunk();
  13673. const sinkWrapper = {
  13674. enqueueInvoked: false,
  13675. enqueue(chunk, size) {
  13676. this.enqueueInvoked = true;
  13677. sink.enqueue(chunk, size);
  13678. },
  13679. get desiredSize() {
  13680. return sink.desiredSize;
  13681. },
  13682. get ready() {
  13683. return sink.ready;
  13684. }
  13685. };
  13686. self.getTextContent({
  13687. stream: xobj,
  13688. task,
  13689. resources: xobj.dict.get("Resources") || resources,
  13690. stateManager: xObjStateManager,
  13691. combineTextItems,
  13692. includeMarkedContent,
  13693. sink: sinkWrapper,
  13694. seenStyles,
  13695. viewBox,
  13696. markedContentData
  13697. }).then(function () {
  13698. if (!sinkWrapper.enqueueInvoked) {
  13699. emptyXObjectCache.set(name, xobj.dict.objId, true);
  13700. }
  13701. resolveXObject();
  13702. }, rejectXObject);
  13703. }).catch(function (reason) {
  13704. if (reason instanceof _util.AbortException) {
  13705. return;
  13706. }
  13707. if (self.options.ignoreErrors) {
  13708. (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`);
  13709. return;
  13710. }
  13711. throw reason;
  13712. }));
  13713. return;
  13714. case _util.OPS.setGState:
  13715. isValidName = args[0] instanceof _primitives.Name;
  13716. name = args[0].name;
  13717. if (isValidName && emptyGStateCache.getByName(name)) {
  13718. break;
  13719. }
  13720. next(new Promise(function (resolveGState, rejectGState) {
  13721. if (!isValidName) {
  13722. throw new _util.FormatError("GState must be referred to by name.");
  13723. }
  13724. const extGState = resources.get("ExtGState");
  13725. if (!(extGState instanceof _primitives.Dict)) {
  13726. throw new _util.FormatError("ExtGState should be a dictionary.");
  13727. }
  13728. const gState = extGState.get(name);
  13729. if (!(gState instanceof _primitives.Dict)) {
  13730. throw new _util.FormatError("GState should be a dictionary.");
  13731. }
  13732. const gStateFont = gState.get("Font");
  13733. if (!gStateFont) {
  13734. emptyGStateCache.set(name, gState.objId, true);
  13735. resolveGState();
  13736. return;
  13737. }
  13738. flushTextContentItem();
  13739. textState.fontName = null;
  13740. textState.fontSize = gStateFont[1];
  13741. handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
  13742. }).catch(function (reason) {
  13743. if (reason instanceof _util.AbortException) {
  13744. return;
  13745. }
  13746. if (self.options.ignoreErrors) {
  13747. (0, _util.warn)(`getTextContent - ignoring ExtGState: "${reason}".`);
  13748. return;
  13749. }
  13750. throw reason;
  13751. }));
  13752. return;
  13753. case _util.OPS.beginMarkedContent:
  13754. flushTextContentItem();
  13755. if (includeMarkedContent) {
  13756. markedContentData.level++;
  13757. textContent.items.push({
  13758. type: "beginMarkedContent",
  13759. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  13760. });
  13761. }
  13762. break;
  13763. case _util.OPS.beginMarkedContentProps:
  13764. flushTextContentItem();
  13765. if (includeMarkedContent) {
  13766. markedContentData.level++;
  13767. let mcid = null;
  13768. if (args[1] instanceof _primitives.Dict) {
  13769. mcid = args[1].get("MCID");
  13770. }
  13771. textContent.items.push({
  13772. type: "beginMarkedContentProps",
  13773. id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mcid${mcid}` : null,
  13774. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  13775. });
  13776. }
  13777. break;
  13778. case _util.OPS.endMarkedContent:
  13779. flushTextContentItem();
  13780. if (includeMarkedContent) {
  13781. if (markedContentData.level === 0) {
  13782. break;
  13783. }
  13784. markedContentData.level--;
  13785. textContent.items.push({
  13786. type: "endMarkedContent"
  13787. });
  13788. }
  13789. break;
  13790. }
  13791. if (textContent.items.length >= sink.desiredSize) {
  13792. stop = true;
  13793. break;
  13794. }
  13795. }
  13796. if (stop) {
  13797. next(deferred);
  13798. return;
  13799. }
  13800. flushTextContentItem();
  13801. enqueueChunk();
  13802. resolve();
  13803. }).catch(reason => {
  13804. if (reason instanceof _util.AbortException) {
  13805. return;
  13806. }
  13807. if (this.options.ignoreErrors) {
  13808. (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  13809. flushTextContentItem();
  13810. enqueueChunk();
  13811. return;
  13812. }
  13813. throw reason;
  13814. });
  13815. }
  13816. extractDataStructures(dict, baseDict, properties) {
  13817. const xref = this.xref;
  13818. let cidToGidBytes;
  13819. const toUnicodePromise = this.readToUnicode(properties.toUnicode || dict.get("ToUnicode") || baseDict.get("ToUnicode"));
  13820. if (properties.composite) {
  13821. const cidSystemInfo = dict.get("CIDSystemInfo");
  13822. if (cidSystemInfo instanceof _primitives.Dict) {
  13823. properties.cidSystemInfo = {
  13824. registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")),
  13825. ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")),
  13826. supplement: cidSystemInfo.get("Supplement")
  13827. };
  13828. }
  13829. try {
  13830. const cidToGidMap = dict.get("CIDToGIDMap");
  13831. if (cidToGidMap instanceof _base_stream.BaseStream) {
  13832. cidToGidBytes = cidToGidMap.getBytes();
  13833. }
  13834. } catch (ex) {
  13835. if (!this.options.ignoreErrors) {
  13836. throw ex;
  13837. }
  13838. (0, _util.warn)(`extractDataStructures - ignoring CIDToGIDMap data: "${ex}".`);
  13839. }
  13840. }
  13841. const differences = [];
  13842. let baseEncodingName = null;
  13843. let encoding;
  13844. if (dict.has("Encoding")) {
  13845. encoding = dict.get("Encoding");
  13846. if (encoding instanceof _primitives.Dict) {
  13847. baseEncodingName = encoding.get("BaseEncoding");
  13848. baseEncodingName = baseEncodingName instanceof _primitives.Name ? baseEncodingName.name : null;
  13849. if (encoding.has("Differences")) {
  13850. const diffEncoding = encoding.get("Differences");
  13851. let index = 0;
  13852. for (const entry of diffEncoding) {
  13853. const data = xref.fetchIfRef(entry);
  13854. if (typeof data === "number") {
  13855. index = data;
  13856. } else if (data instanceof _primitives.Name) {
  13857. differences[index++] = data.name;
  13858. } else {
  13859. throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);
  13860. }
  13861. }
  13862. }
  13863. } else if (encoding instanceof _primitives.Name) {
  13864. baseEncodingName = encoding.name;
  13865. } else {
  13866. const msg = "Encoding is not a Name nor a Dict";
  13867. if (!this.options.ignoreErrors) {
  13868. throw new _util.FormatError(msg);
  13869. }
  13870. (0, _util.warn)(msg);
  13871. }
  13872. if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
  13873. baseEncodingName = null;
  13874. }
  13875. }
  13876. if (baseEncodingName) {
  13877. properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  13878. } else {
  13879. const isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  13880. const isNonsymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Nonsymbolic);
  13881. encoding = _encodings.StandardEncoding;
  13882. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  13883. encoding = _encodings.WinAnsiEncoding;
  13884. }
  13885. if (isSymbolicFont) {
  13886. encoding = _encodings.MacRomanEncoding;
  13887. if (!properties.file || properties.isInternalFont) {
  13888. if (/Symbol/i.test(properties.name)) {
  13889. encoding = _encodings.SymbolSetEncoding;
  13890. } else if (/Dingbats|Wingdings/i.test(properties.name)) {
  13891. encoding = _encodings.ZapfDingbatsEncoding;
  13892. }
  13893. }
  13894. }
  13895. properties.defaultEncoding = encoding;
  13896. }
  13897. properties.differences = differences;
  13898. properties.baseEncodingName = baseEncodingName;
  13899. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  13900. properties.dict = dict;
  13901. return toUnicodePromise.then(readToUnicode => {
  13902. properties.toUnicode = readToUnicode;
  13903. return this.buildToUnicode(properties);
  13904. }).then(builtToUnicode => {
  13905. properties.toUnicode = builtToUnicode;
  13906. if (cidToGidBytes) {
  13907. properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
  13908. }
  13909. return properties;
  13910. });
  13911. }
  13912. _simpleFontToUnicode(properties) {
  13913. let forceGlyphs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  13914. (0, _util.assert)(!properties.composite, "Must be a simple font.");
  13915. const toUnicode = [];
  13916. const encoding = properties.defaultEncoding.slice();
  13917. const baseEncodingName = properties.baseEncodingName;
  13918. const differences = properties.differences;
  13919. for (const charcode in differences) {
  13920. const glyphName = differences[charcode];
  13921. if (glyphName === ".notdef") {
  13922. continue;
  13923. }
  13924. encoding[charcode] = glyphName;
  13925. }
  13926. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  13927. for (const charcode in encoding) {
  13928. let glyphName = encoding[charcode];
  13929. if (glyphName === "") {
  13930. continue;
  13931. }
  13932. let unicode = glyphsUnicodeMap[glyphName];
  13933. if (unicode !== undefined) {
  13934. toUnicode[charcode] = String.fromCharCode(unicode);
  13935. continue;
  13936. }
  13937. let code = 0;
  13938. switch (glyphName[0]) {
  13939. case "G":
  13940. if (glyphName.length === 3) {
  13941. code = parseInt(glyphName.substring(1), 16);
  13942. }
  13943. break;
  13944. case "g":
  13945. if (glyphName.length === 5) {
  13946. code = parseInt(glyphName.substring(1), 16);
  13947. }
  13948. break;
  13949. case "C":
  13950. case "c":
  13951. if (glyphName.length >= 3 && glyphName.length <= 4) {
  13952. const codeStr = glyphName.substring(1);
  13953. if (forceGlyphs) {
  13954. code = parseInt(codeStr, 16);
  13955. break;
  13956. }
  13957. code = +codeStr;
  13958. if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
  13959. return this._simpleFontToUnicode(properties, true);
  13960. }
  13961. }
  13962. break;
  13963. case "u":
  13964. unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  13965. if (unicode !== -1) {
  13966. code = unicode;
  13967. }
  13968. break;
  13969. }
  13970. if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
  13971. if (baseEncodingName && code === +charcode) {
  13972. const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  13973. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  13974. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  13975. continue;
  13976. }
  13977. }
  13978. toUnicode[charcode] = String.fromCodePoint(code);
  13979. }
  13980. }
  13981. return toUnicode;
  13982. }
  13983. async buildToUnicode(properties) {
  13984. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  13985. if (properties.hasIncludedToUnicodeMap) {
  13986. if (!properties.composite && properties.hasEncoding) {
  13987. properties.fallbackToUnicode = this._simpleFontToUnicode(properties);
  13988. }
  13989. return properties.toUnicode;
  13990. }
  13991. if (!properties.composite) {
  13992. return new _to_unicode_map.ToUnicodeMap(this._simpleFontToUnicode(properties));
  13993. }
  13994. 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"))) {
  13995. const {
  13996. registry,
  13997. ordering
  13998. } = properties.cidSystemInfo;
  13999. const ucs2CMapName = _primitives.Name.get(`${registry}-${ordering}-UCS2`);
  14000. const ucs2CMap = await _cmap.CMapFactory.create({
  14001. encoding: ucs2CMapName,
  14002. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  14003. useCMap: null
  14004. });
  14005. const toUnicode = [];
  14006. properties.cMap.forEach(function (charcode, cid) {
  14007. if (cid > 0xffff) {
  14008. throw new _util.FormatError("Max size of CID is 65,535");
  14009. }
  14010. const ucs2 = ucs2CMap.lookup(cid);
  14011. if (ucs2) {
  14012. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  14013. }
  14014. });
  14015. return new _to_unicode_map.ToUnicodeMap(toUnicode);
  14016. }
  14017. return new _to_unicode_map.IdentityToUnicodeMap(properties.firstChar, properties.lastChar);
  14018. }
  14019. readToUnicode(cmapObj) {
  14020. if (!cmapObj) {
  14021. return Promise.resolve(null);
  14022. }
  14023. if (cmapObj instanceof _primitives.Name) {
  14024. return _cmap.CMapFactory.create({
  14025. encoding: cmapObj,
  14026. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  14027. useCMap: null
  14028. }).then(function (cmap) {
  14029. if (cmap instanceof _cmap.IdentityCMap) {
  14030. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  14031. }
  14032. return new _to_unicode_map.ToUnicodeMap(cmap.getMap());
  14033. });
  14034. } else if (cmapObj instanceof _base_stream.BaseStream) {
  14035. return _cmap.CMapFactory.create({
  14036. encoding: cmapObj,
  14037. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  14038. useCMap: null
  14039. }).then(function (cmap) {
  14040. if (cmap instanceof _cmap.IdentityCMap) {
  14041. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  14042. }
  14043. const map = new Array(cmap.length);
  14044. cmap.forEach(function (charCode, token) {
  14045. if (typeof token === "number") {
  14046. map[charCode] = String.fromCodePoint(token);
  14047. return;
  14048. }
  14049. const str = [];
  14050. for (let k = 0; k < token.length; k += 2) {
  14051. const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  14052. if ((w1 & 0xf800) !== 0xd800) {
  14053. str.push(w1);
  14054. continue;
  14055. }
  14056. k += 2;
  14057. const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  14058. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  14059. }
  14060. map[charCode] = String.fromCodePoint(...str);
  14061. });
  14062. return new _to_unicode_map.ToUnicodeMap(map);
  14063. }, reason => {
  14064. if (reason instanceof _util.AbortException) {
  14065. return null;
  14066. }
  14067. if (this.options.ignoreErrors) {
  14068. this.handler.send("UnsupportedFeature", {
  14069. featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode
  14070. });
  14071. (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
  14072. return null;
  14073. }
  14074. throw reason;
  14075. });
  14076. }
  14077. return Promise.resolve(null);
  14078. }
  14079. readCidToGidMap(glyphsData, toUnicode) {
  14080. const result = [];
  14081. for (let j = 0, jj = glyphsData.length; j < jj; j++) {
  14082. const glyphID = glyphsData[j++] << 8 | glyphsData[j];
  14083. const code = j >> 1;
  14084. if (glyphID === 0 && !toUnicode.has(code)) {
  14085. continue;
  14086. }
  14087. result[code] = glyphID;
  14088. }
  14089. return result;
  14090. }
  14091. extractWidths(dict, descriptor, properties) {
  14092. const xref = this.xref;
  14093. let glyphsWidths = [];
  14094. let defaultWidth = 0;
  14095. const glyphsVMetrics = [];
  14096. let defaultVMetrics;
  14097. let i, ii, j, jj, start, code, widths;
  14098. if (properties.composite) {
  14099. defaultWidth = dict.has("DW") ? dict.get("DW") : 1000;
  14100. widths = dict.get("W");
  14101. if (widths) {
  14102. for (i = 0, ii = widths.length; i < ii; i++) {
  14103. start = xref.fetchIfRef(widths[i++]);
  14104. code = xref.fetchIfRef(widths[i]);
  14105. if (Array.isArray(code)) {
  14106. for (j = 0, jj = code.length; j < jj; j++) {
  14107. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  14108. }
  14109. } else {
  14110. const width = xref.fetchIfRef(widths[++i]);
  14111. for (j = start; j <= code; j++) {
  14112. glyphsWidths[j] = width;
  14113. }
  14114. }
  14115. }
  14116. }
  14117. if (properties.vertical) {
  14118. let vmetrics = dict.getArray("DW2") || [880, -1000];
  14119. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  14120. vmetrics = dict.get("W2");
  14121. if (vmetrics) {
  14122. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  14123. start = xref.fetchIfRef(vmetrics[i++]);
  14124. code = xref.fetchIfRef(vmetrics[i]);
  14125. if (Array.isArray(code)) {
  14126. for (j = 0, jj = code.length; j < jj; j++) {
  14127. glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  14128. }
  14129. } else {
  14130. const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  14131. for (j = start; j <= code; j++) {
  14132. glyphsVMetrics[j] = vmetric;
  14133. }
  14134. }
  14135. }
  14136. }
  14137. }
  14138. } else {
  14139. const firstChar = properties.firstChar;
  14140. widths = dict.get("Widths");
  14141. if (widths) {
  14142. j = firstChar;
  14143. for (i = 0, ii = widths.length; i < ii; i++) {
  14144. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  14145. }
  14146. defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0;
  14147. } else {
  14148. const baseFontName = dict.get("BaseFont");
  14149. if (baseFontName instanceof _primitives.Name) {
  14150. const metrics = this.getBaseFontMetrics(baseFontName.name);
  14151. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  14152. defaultWidth = metrics.defaultWidth;
  14153. }
  14154. }
  14155. }
  14156. let isMonospace = true;
  14157. let firstWidth = defaultWidth;
  14158. for (const glyph in glyphsWidths) {
  14159. const glyphWidth = glyphsWidths[glyph];
  14160. if (!glyphWidth) {
  14161. continue;
  14162. }
  14163. if (!firstWidth) {
  14164. firstWidth = glyphWidth;
  14165. continue;
  14166. }
  14167. if (firstWidth !== glyphWidth) {
  14168. isMonospace = false;
  14169. break;
  14170. }
  14171. }
  14172. if (isMonospace) {
  14173. properties.flags |= _fonts_utils.FontFlags.FixedPitch;
  14174. }
  14175. properties.defaultWidth = defaultWidth;
  14176. properties.widths = glyphsWidths;
  14177. properties.defaultVMetrics = defaultVMetrics;
  14178. properties.vmetrics = glyphsVMetrics;
  14179. }
  14180. isSerifFont(baseFontName) {
  14181. const fontNameWoStyle = baseFontName.split("-")[0];
  14182. return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || /serif/gi.test(fontNameWoStyle);
  14183. }
  14184. getBaseFontMetrics(name) {
  14185. let defaultWidth = 0;
  14186. let widths = Object.create(null);
  14187. let monospace = false;
  14188. const stdFontMap = (0, _standard_fonts.getStdFontMap)();
  14189. let lookupName = stdFontMap[name] || name;
  14190. const Metrics = (0, _metrics.getMetrics)();
  14191. if (!(lookupName in Metrics)) {
  14192. if (this.isSerifFont(name)) {
  14193. lookupName = "Times-Roman";
  14194. } else {
  14195. lookupName = "Helvetica";
  14196. }
  14197. }
  14198. const glyphWidths = Metrics[lookupName];
  14199. if (typeof glyphWidths === "number") {
  14200. defaultWidth = glyphWidths;
  14201. monospace = true;
  14202. } else {
  14203. widths = glyphWidths();
  14204. }
  14205. return {
  14206. defaultWidth,
  14207. monospace,
  14208. widths
  14209. };
  14210. }
  14211. buildCharCodeToWidth(widthsByGlyphName, properties) {
  14212. const widths = Object.create(null);
  14213. const differences = properties.differences;
  14214. const encoding = properties.defaultEncoding;
  14215. for (let charCode = 0; charCode < 256; charCode++) {
  14216. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  14217. widths[charCode] = widthsByGlyphName[differences[charCode]];
  14218. continue;
  14219. }
  14220. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  14221. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  14222. continue;
  14223. }
  14224. }
  14225. return widths;
  14226. }
  14227. preEvaluateFont(dict) {
  14228. const baseDict = dict;
  14229. let type = dict.get("Subtype");
  14230. if (!(type instanceof _primitives.Name)) {
  14231. throw new _util.FormatError("invalid font Subtype");
  14232. }
  14233. let composite = false;
  14234. let hash, toUnicode;
  14235. if (type.name === "Type0") {
  14236. const df = dict.get("DescendantFonts");
  14237. if (!df) {
  14238. throw new _util.FormatError("Descendant fonts are not specified");
  14239. }
  14240. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  14241. if (!(dict instanceof _primitives.Dict)) {
  14242. throw new _util.FormatError("Descendant font is not a dictionary.");
  14243. }
  14244. type = dict.get("Subtype");
  14245. if (!(type instanceof _primitives.Name)) {
  14246. throw new _util.FormatError("invalid font Subtype");
  14247. }
  14248. composite = true;
  14249. }
  14250. const firstChar = dict.get("FirstChar") || 0,
  14251. lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
  14252. const descriptor = dict.get("FontDescriptor");
  14253. if (descriptor) {
  14254. hash = new _murmurhash.MurmurHash3_64();
  14255. const encoding = baseDict.getRaw("Encoding");
  14256. if (encoding instanceof _primitives.Name) {
  14257. hash.update(encoding.name);
  14258. } else if (encoding instanceof _primitives.Ref) {
  14259. hash.update(encoding.toString());
  14260. } else if (encoding instanceof _primitives.Dict) {
  14261. for (const entry of encoding.getRawValues()) {
  14262. if (entry instanceof _primitives.Name) {
  14263. hash.update(entry.name);
  14264. } else if (entry instanceof _primitives.Ref) {
  14265. hash.update(entry.toString());
  14266. } else if (Array.isArray(entry)) {
  14267. const diffLength = entry.length,
  14268. diffBuf = new Array(diffLength);
  14269. for (let j = 0; j < diffLength; j++) {
  14270. const diffEntry = entry[j];
  14271. if (diffEntry instanceof _primitives.Name) {
  14272. diffBuf[j] = diffEntry.name;
  14273. } else if (typeof diffEntry === "number" || diffEntry instanceof _primitives.Ref) {
  14274. diffBuf[j] = diffEntry.toString();
  14275. }
  14276. }
  14277. hash.update(diffBuf.join());
  14278. }
  14279. }
  14280. }
  14281. hash.update(`${firstChar}-${lastChar}`);
  14282. toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  14283. if (toUnicode instanceof _base_stream.BaseStream) {
  14284. const stream = toUnicode.str || toUnicode;
  14285. const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  14286. hash.update(uint8array);
  14287. } else if (toUnicode instanceof _primitives.Name) {
  14288. hash.update(toUnicode.name);
  14289. }
  14290. const widths = dict.get("Widths") || baseDict.get("Widths");
  14291. if (Array.isArray(widths)) {
  14292. const widthsBuf = [];
  14293. for (const entry of widths) {
  14294. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  14295. widthsBuf.push(entry.toString());
  14296. }
  14297. }
  14298. hash.update(widthsBuf.join());
  14299. }
  14300. if (composite) {
  14301. hash.update("compositeFont");
  14302. const compositeWidths = dict.get("W") || baseDict.get("W");
  14303. if (Array.isArray(compositeWidths)) {
  14304. const widthsBuf = [];
  14305. for (const entry of compositeWidths) {
  14306. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  14307. widthsBuf.push(entry.toString());
  14308. } else if (Array.isArray(entry)) {
  14309. const subWidthsBuf = [];
  14310. for (const element of entry) {
  14311. if (typeof element === "number" || element instanceof _primitives.Ref) {
  14312. subWidthsBuf.push(element.toString());
  14313. }
  14314. }
  14315. widthsBuf.push(`[${subWidthsBuf.join()}]`);
  14316. }
  14317. }
  14318. hash.update(widthsBuf.join());
  14319. }
  14320. const cidToGidMap = dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap");
  14321. if (cidToGidMap instanceof _primitives.Name) {
  14322. hash.update(cidToGidMap.name);
  14323. } else if (cidToGidMap instanceof _primitives.Ref) {
  14324. hash.update(cidToGidMap.toString());
  14325. } else if (cidToGidMap instanceof _base_stream.BaseStream) {
  14326. hash.update(cidToGidMap.peekBytes());
  14327. }
  14328. }
  14329. }
  14330. return {
  14331. descriptor,
  14332. dict,
  14333. baseDict,
  14334. composite,
  14335. type: type.name,
  14336. firstChar,
  14337. lastChar,
  14338. toUnicode,
  14339. hash: hash ? hash.hexdigest() : ""
  14340. };
  14341. }
  14342. async translateFont(_ref9) {
  14343. let {
  14344. descriptor,
  14345. dict,
  14346. baseDict,
  14347. composite,
  14348. type,
  14349. firstChar,
  14350. lastChar,
  14351. toUnicode,
  14352. cssFontInfo
  14353. } = _ref9;
  14354. const isType3Font = type === "Type3";
  14355. let properties;
  14356. if (!descriptor) {
  14357. if (isType3Font) {
  14358. descriptor = new _primitives.Dict(null);
  14359. descriptor.set("FontName", _primitives.Name.get(type));
  14360. descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]);
  14361. } else {
  14362. let baseFontName = dict.get("BaseFont");
  14363. if (!(baseFontName instanceof _primitives.Name)) {
  14364. throw new _util.FormatError("Base font is not specified");
  14365. }
  14366. baseFontName = baseFontName.name.replace(/[,_]/g, "-");
  14367. const metrics = this.getBaseFontMetrics(baseFontName);
  14368. const fontNameWoStyle = baseFontName.split("-")[0];
  14369. 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);
  14370. properties = {
  14371. type,
  14372. name: baseFontName,
  14373. loadedName: baseDict.loadedName,
  14374. widths: metrics.widths,
  14375. defaultWidth: metrics.defaultWidth,
  14376. isSimulatedFlags: true,
  14377. flags,
  14378. firstChar,
  14379. lastChar,
  14380. toUnicode,
  14381. xHeight: 0,
  14382. capHeight: 0,
  14383. italicAngle: 0,
  14384. isType3Font
  14385. };
  14386. const widths = dict.get("Widths");
  14387. const standardFontName = (0, _standard_fonts.getStandardFontName)(baseFontName);
  14388. let file = null;
  14389. if (standardFontName) {
  14390. properties.isStandardFont = true;
  14391. file = await this.fetchStandardFontData(standardFontName);
  14392. properties.isInternalFont = !!file;
  14393. }
  14394. return this.extractDataStructures(dict, dict, properties).then(newProperties => {
  14395. if (widths) {
  14396. const glyphWidths = [];
  14397. let j = firstChar;
  14398. for (const width of widths) {
  14399. glyphWidths[j++] = this.xref.fetchIfRef(width);
  14400. }
  14401. newProperties.widths = glyphWidths;
  14402. } else {
  14403. newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
  14404. }
  14405. return new _fonts.Font(baseFontName, file, newProperties);
  14406. });
  14407. }
  14408. }
  14409. let fontName = descriptor.get("FontName");
  14410. let baseFont = dict.get("BaseFont");
  14411. if (typeof fontName === "string") {
  14412. fontName = _primitives.Name.get(fontName);
  14413. }
  14414. if (typeof baseFont === "string") {
  14415. baseFont = _primitives.Name.get(baseFont);
  14416. }
  14417. if (!isType3Font) {
  14418. const fontNameStr = fontName && fontName.name;
  14419. const baseFontStr = baseFont && baseFont.name;
  14420. if (fontNameStr !== baseFontStr) {
  14421. (0, _util.info)(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`);
  14422. if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) {
  14423. fontName = baseFont;
  14424. }
  14425. }
  14426. }
  14427. fontName = fontName || baseFont;
  14428. if (!(fontName instanceof _primitives.Name)) {
  14429. throw new _util.FormatError("invalid font name");
  14430. }
  14431. let fontFile, subtype, length1, length2, length3;
  14432. try {
  14433. fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  14434. } catch (ex) {
  14435. if (!this.options.ignoreErrors) {
  14436. throw ex;
  14437. }
  14438. (0, _util.warn)(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
  14439. fontFile = new _stream.NullStream();
  14440. }
  14441. let isStandardFont = false;
  14442. let isInternalFont = false;
  14443. let glyphScaleFactors = null;
  14444. if (fontFile) {
  14445. if (fontFile.dict) {
  14446. const subtypeEntry = fontFile.dict.get("Subtype");
  14447. if (subtypeEntry instanceof _primitives.Name) {
  14448. subtype = subtypeEntry.name;
  14449. }
  14450. length1 = fontFile.dict.get("Length1");
  14451. length2 = fontFile.dict.get("Length2");
  14452. length3 = fontFile.dict.get("Length3");
  14453. }
  14454. } else if (cssFontInfo) {
  14455. const standardFontName = (0, _xfa_fonts.getXfaFontName)(fontName.name);
  14456. if (standardFontName) {
  14457. cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`;
  14458. cssFontInfo.metrics = standardFontName.metrics || null;
  14459. glyphScaleFactors = standardFontName.factors || null;
  14460. fontFile = await this.fetchStandardFontData(standardFontName.name);
  14461. isInternalFont = !!fontFile;
  14462. baseDict = dict = (0, _xfa_fonts.getXfaFontDict)(fontName.name);
  14463. composite = true;
  14464. }
  14465. } else if (!isType3Font) {
  14466. const standardFontName = (0, _standard_fonts.getStandardFontName)(fontName.name);
  14467. if (standardFontName) {
  14468. isStandardFont = true;
  14469. fontFile = await this.fetchStandardFontData(standardFontName);
  14470. isInternalFont = !!fontFile;
  14471. }
  14472. }
  14473. properties = {
  14474. type,
  14475. name: fontName.name,
  14476. subtype,
  14477. file: fontFile,
  14478. length1,
  14479. length2,
  14480. length3,
  14481. isStandardFont,
  14482. isInternalFont,
  14483. loadedName: baseDict.loadedName,
  14484. composite,
  14485. fixedPitch: false,
  14486. fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
  14487. firstChar,
  14488. lastChar,
  14489. toUnicode,
  14490. bbox: descriptor.getArray("FontBBox") || dict.getArray("FontBBox"),
  14491. ascent: descriptor.get("Ascent"),
  14492. descent: descriptor.get("Descent"),
  14493. xHeight: descriptor.get("XHeight") || 0,
  14494. capHeight: descriptor.get("CapHeight") || 0,
  14495. flags: descriptor.get("Flags"),
  14496. italicAngle: descriptor.get("ItalicAngle") || 0,
  14497. isType3Font,
  14498. cssFontInfo,
  14499. scaleFactors: glyphScaleFactors
  14500. };
  14501. if (composite) {
  14502. const cidEncoding = baseDict.get("Encoding");
  14503. if (cidEncoding instanceof _primitives.Name) {
  14504. properties.cidEncoding = cidEncoding.name;
  14505. }
  14506. const cMap = await _cmap.CMapFactory.create({
  14507. encoding: cidEncoding,
  14508. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  14509. useCMap: null
  14510. });
  14511. properties.cMap = cMap;
  14512. properties.vertical = properties.cMap.vertical;
  14513. }
  14514. return this.extractDataStructures(dict, baseDict, properties).then(newProperties => {
  14515. this.extractWidths(dict, descriptor, newProperties);
  14516. return new _fonts.Font(fontName.name, fontFile, newProperties);
  14517. });
  14518. }
  14519. static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
  14520. function buildPath(fontChar) {
  14521. const glyphName = `${font.loadedName}_path_${fontChar}`;
  14522. try {
  14523. if (font.renderer.hasBuiltPath(fontChar)) {
  14524. return;
  14525. }
  14526. handler.send("commonobj", [glyphName, "FontPath", font.renderer.getPathJs(fontChar)]);
  14527. } catch (reason) {
  14528. if (evaluatorOptions.ignoreErrors) {
  14529. handler.send("UnsupportedFeature", {
  14530. featureId: _util.UNSUPPORTED_FEATURES.errorFontBuildPath
  14531. });
  14532. (0, _util.warn)(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
  14533. return;
  14534. }
  14535. throw reason;
  14536. }
  14537. }
  14538. for (const glyph of glyphs) {
  14539. buildPath(glyph.fontChar);
  14540. const accent = glyph.accent;
  14541. if (accent && accent.fontChar) {
  14542. buildPath(accent.fontChar);
  14543. }
  14544. }
  14545. }
  14546. static get fallbackFontDict() {
  14547. const dict = new _primitives.Dict();
  14548. dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont"));
  14549. dict.set("Type", _primitives.Name.get("FallbackType"));
  14550. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  14551. dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  14552. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  14553. }
  14554. }
  14555. exports.PartialEvaluator = PartialEvaluator;
  14556. class TranslatedFont {
  14557. constructor(_ref10) {
  14558. let {
  14559. loadedName,
  14560. font,
  14561. dict,
  14562. evaluatorOptions
  14563. } = _ref10;
  14564. this.loadedName = loadedName;
  14565. this.font = font;
  14566. this.dict = dict;
  14567. this._evaluatorOptions = evaluatorOptions || DefaultPartialEvaluatorOptions;
  14568. this.type3Loaded = null;
  14569. this.type3Dependencies = font.isType3Font ? new Set() : null;
  14570. this.sent = false;
  14571. }
  14572. send(handler) {
  14573. if (this.sent) {
  14574. return;
  14575. }
  14576. this.sent = true;
  14577. handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._evaluatorOptions.fontExtraProperties)]);
  14578. }
  14579. fallback(handler) {
  14580. if (!this.font.data) {
  14581. return;
  14582. }
  14583. this.font.disableFontFace = true;
  14584. PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, this._evaluatorOptions);
  14585. }
  14586. loadType3Data(evaluator, resources, task) {
  14587. if (this.type3Loaded) {
  14588. return this.type3Loaded;
  14589. }
  14590. if (!this.font.isType3Font) {
  14591. throw new Error("Must be a Type3 font.");
  14592. }
  14593. const type3Evaluator = evaluator.clone({
  14594. ignoreErrors: false
  14595. });
  14596. type3Evaluator.parsingType3Font = true;
  14597. const type3FontRefs = new _primitives.RefSet(evaluator.type3FontRefs);
  14598. if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
  14599. type3FontRefs.put(this.dict.objId);
  14600. }
  14601. type3Evaluator.type3FontRefs = type3FontRefs;
  14602. const translatedFont = this.font,
  14603. type3Dependencies = this.type3Dependencies;
  14604. let loadCharProcsPromise = Promise.resolve();
  14605. const charProcs = this.dict.get("CharProcs");
  14606. const fontResources = this.dict.get("Resources") || resources;
  14607. const charProcOperatorList = Object.create(null);
  14608. const fontBBox = _util.Util.normalizeRect(translatedFont.bbox || [0, 0, 0, 0]),
  14609. width = fontBBox[2] - fontBBox[0],
  14610. height = fontBBox[3] - fontBBox[1];
  14611. const fontBBoxSize = Math.hypot(width, height);
  14612. for (const key of charProcs.getKeys()) {
  14613. loadCharProcsPromise = loadCharProcsPromise.then(() => {
  14614. const glyphStream = charProcs.get(key);
  14615. const operatorList = new _operator_list.OperatorList();
  14616. return type3Evaluator.getOperatorList({
  14617. stream: glyphStream,
  14618. task,
  14619. resources: fontResources,
  14620. operatorList
  14621. }).then(() => {
  14622. if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) {
  14623. this._removeType3ColorOperators(operatorList, fontBBoxSize);
  14624. }
  14625. charProcOperatorList[key] = operatorList.getIR();
  14626. for (const dependency of operatorList.dependencies) {
  14627. type3Dependencies.add(dependency);
  14628. }
  14629. }).catch(function (reason) {
  14630. (0, _util.warn)(`Type3 font resource "${key}" is not available.`);
  14631. const dummyOperatorList = new _operator_list.OperatorList();
  14632. charProcOperatorList[key] = dummyOperatorList.getIR();
  14633. });
  14634. });
  14635. }
  14636. this.type3Loaded = loadCharProcsPromise.then(() => {
  14637. translatedFont.charProcOperatorList = charProcOperatorList;
  14638. if (this._bbox) {
  14639. translatedFont.isCharBBox = true;
  14640. translatedFont.bbox = this._bbox;
  14641. }
  14642. });
  14643. return this.type3Loaded;
  14644. }
  14645. _removeType3ColorOperators(operatorList) {
  14646. let fontBBoxSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : NaN;
  14647. const charBBox = _util.Util.normalizeRect(operatorList.argsArray[0].slice(2)),
  14648. width = charBBox[2] - charBBox[0],
  14649. height = charBBox[3] - charBBox[1];
  14650. const charBBoxSize = Math.hypot(width, height);
  14651. if (width === 0 || height === 0) {
  14652. operatorList.fnArray.splice(0, 1);
  14653. operatorList.argsArray.splice(0, 1);
  14654. } else if (fontBBoxSize === 0 || Math.round(charBBoxSize / fontBBoxSize) >= 10) {
  14655. if (!this._bbox) {
  14656. this._bbox = [Infinity, Infinity, -Infinity, -Infinity];
  14657. }
  14658. this._bbox[0] = Math.min(this._bbox[0], charBBox[0]);
  14659. this._bbox[1] = Math.min(this._bbox[1], charBBox[1]);
  14660. this._bbox[2] = Math.max(this._bbox[2], charBBox[2]);
  14661. this._bbox[3] = Math.max(this._bbox[3], charBBox[3]);
  14662. }
  14663. let i = 0,
  14664. ii = operatorList.length;
  14665. while (i < ii) {
  14666. switch (operatorList.fnArray[i]) {
  14667. case _util.OPS.setCharWidthAndBounds:
  14668. break;
  14669. case _util.OPS.setStrokeColorSpace:
  14670. case _util.OPS.setFillColorSpace:
  14671. case _util.OPS.setStrokeColor:
  14672. case _util.OPS.setStrokeColorN:
  14673. case _util.OPS.setFillColor:
  14674. case _util.OPS.setFillColorN:
  14675. case _util.OPS.setStrokeGray:
  14676. case _util.OPS.setFillGray:
  14677. case _util.OPS.setStrokeRGBColor:
  14678. case _util.OPS.setFillRGBColor:
  14679. case _util.OPS.setStrokeCMYKColor:
  14680. case _util.OPS.setFillCMYKColor:
  14681. case _util.OPS.shadingFill:
  14682. case _util.OPS.setRenderingIntent:
  14683. operatorList.fnArray.splice(i, 1);
  14684. operatorList.argsArray.splice(i, 1);
  14685. ii--;
  14686. continue;
  14687. case _util.OPS.setGState:
  14688. const [gStateObj] = operatorList.argsArray[i];
  14689. let j = 0,
  14690. jj = gStateObj.length;
  14691. while (j < jj) {
  14692. const [gStateKey] = gStateObj[j];
  14693. switch (gStateKey) {
  14694. case "TR":
  14695. case "TR2":
  14696. case "HT":
  14697. case "BG":
  14698. case "BG2":
  14699. case "UCR":
  14700. case "UCR2":
  14701. gStateObj.splice(j, 1);
  14702. jj--;
  14703. continue;
  14704. }
  14705. j++;
  14706. }
  14707. break;
  14708. }
  14709. i++;
  14710. }
  14711. }
  14712. }
  14713. class StateManager {
  14714. constructor() {
  14715. let initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new EvalState();
  14716. this.state = initialState;
  14717. this.stateStack = [];
  14718. }
  14719. save() {
  14720. const old = this.state;
  14721. this.stateStack.push(this.state);
  14722. this.state = old.clone();
  14723. }
  14724. restore() {
  14725. const prev = this.stateStack.pop();
  14726. if (prev) {
  14727. this.state = prev;
  14728. }
  14729. }
  14730. transform(args) {
  14731. this.state.ctm = _util.Util.transform(this.state.ctm, args);
  14732. }
  14733. }
  14734. class TextState {
  14735. constructor() {
  14736. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  14737. this.fontName = null;
  14738. this.fontSize = 0;
  14739. this.loadedName = null;
  14740. this.font = null;
  14741. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  14742. this.textMatrix = _util.IDENTITY_MATRIX.slice();
  14743. this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  14744. this.charSpacing = 0;
  14745. this.wordSpacing = 0;
  14746. this.leading = 0;
  14747. this.textHScale = 1;
  14748. this.textRise = 0;
  14749. }
  14750. setTextMatrix(a, b, c, d, e, f) {
  14751. const m = this.textMatrix;
  14752. m[0] = a;
  14753. m[1] = b;
  14754. m[2] = c;
  14755. m[3] = d;
  14756. m[4] = e;
  14757. m[5] = f;
  14758. }
  14759. setTextLineMatrix(a, b, c, d, e, f) {
  14760. const m = this.textLineMatrix;
  14761. m[0] = a;
  14762. m[1] = b;
  14763. m[2] = c;
  14764. m[3] = d;
  14765. m[4] = e;
  14766. m[5] = f;
  14767. }
  14768. translateTextMatrix(x, y) {
  14769. const m = this.textMatrix;
  14770. m[4] = m[0] * x + m[2] * y + m[4];
  14771. m[5] = m[1] * x + m[3] * y + m[5];
  14772. }
  14773. translateTextLineMatrix(x, y) {
  14774. const m = this.textLineMatrix;
  14775. m[4] = m[0] * x + m[2] * y + m[4];
  14776. m[5] = m[1] * x + m[3] * y + m[5];
  14777. }
  14778. carriageReturn() {
  14779. this.translateTextLineMatrix(0, -this.leading);
  14780. this.textMatrix = this.textLineMatrix.slice();
  14781. }
  14782. clone() {
  14783. const clone = Object.create(this);
  14784. clone.textMatrix = this.textMatrix.slice();
  14785. clone.textLineMatrix = this.textLineMatrix.slice();
  14786. clone.fontMatrix = this.fontMatrix.slice();
  14787. return clone;
  14788. }
  14789. }
  14790. class EvalState {
  14791. constructor() {
  14792. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  14793. this.font = null;
  14794. this.textRenderingMode = _util.TextRenderingMode.FILL;
  14795. this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  14796. this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  14797. }
  14798. clone() {
  14799. return Object.create(this);
  14800. }
  14801. }
  14802. class EvaluatorPreprocessor {
  14803. static get opMap() {
  14804. const getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  14805. t.w = {
  14806. id: _util.OPS.setLineWidth,
  14807. numArgs: 1,
  14808. variableArgs: false
  14809. };
  14810. t.J = {
  14811. id: _util.OPS.setLineCap,
  14812. numArgs: 1,
  14813. variableArgs: false
  14814. };
  14815. t.j = {
  14816. id: _util.OPS.setLineJoin,
  14817. numArgs: 1,
  14818. variableArgs: false
  14819. };
  14820. t.M = {
  14821. id: _util.OPS.setMiterLimit,
  14822. numArgs: 1,
  14823. variableArgs: false
  14824. };
  14825. t.d = {
  14826. id: _util.OPS.setDash,
  14827. numArgs: 2,
  14828. variableArgs: false
  14829. };
  14830. t.ri = {
  14831. id: _util.OPS.setRenderingIntent,
  14832. numArgs: 1,
  14833. variableArgs: false
  14834. };
  14835. t.i = {
  14836. id: _util.OPS.setFlatness,
  14837. numArgs: 1,
  14838. variableArgs: false
  14839. };
  14840. t.gs = {
  14841. id: _util.OPS.setGState,
  14842. numArgs: 1,
  14843. variableArgs: false
  14844. };
  14845. t.q = {
  14846. id: _util.OPS.save,
  14847. numArgs: 0,
  14848. variableArgs: false
  14849. };
  14850. t.Q = {
  14851. id: _util.OPS.restore,
  14852. numArgs: 0,
  14853. variableArgs: false
  14854. };
  14855. t.cm = {
  14856. id: _util.OPS.transform,
  14857. numArgs: 6,
  14858. variableArgs: false
  14859. };
  14860. t.m = {
  14861. id: _util.OPS.moveTo,
  14862. numArgs: 2,
  14863. variableArgs: false
  14864. };
  14865. t.l = {
  14866. id: _util.OPS.lineTo,
  14867. numArgs: 2,
  14868. variableArgs: false
  14869. };
  14870. t.c = {
  14871. id: _util.OPS.curveTo,
  14872. numArgs: 6,
  14873. variableArgs: false
  14874. };
  14875. t.v = {
  14876. id: _util.OPS.curveTo2,
  14877. numArgs: 4,
  14878. variableArgs: false
  14879. };
  14880. t.y = {
  14881. id: _util.OPS.curveTo3,
  14882. numArgs: 4,
  14883. variableArgs: false
  14884. };
  14885. t.h = {
  14886. id: _util.OPS.closePath,
  14887. numArgs: 0,
  14888. variableArgs: false
  14889. };
  14890. t.re = {
  14891. id: _util.OPS.rectangle,
  14892. numArgs: 4,
  14893. variableArgs: false
  14894. };
  14895. t.S = {
  14896. id: _util.OPS.stroke,
  14897. numArgs: 0,
  14898. variableArgs: false
  14899. };
  14900. t.s = {
  14901. id: _util.OPS.closeStroke,
  14902. numArgs: 0,
  14903. variableArgs: false
  14904. };
  14905. t.f = {
  14906. id: _util.OPS.fill,
  14907. numArgs: 0,
  14908. variableArgs: false
  14909. };
  14910. t.F = {
  14911. id: _util.OPS.fill,
  14912. numArgs: 0,
  14913. variableArgs: false
  14914. };
  14915. t["f*"] = {
  14916. id: _util.OPS.eoFill,
  14917. numArgs: 0,
  14918. variableArgs: false
  14919. };
  14920. t.B = {
  14921. id: _util.OPS.fillStroke,
  14922. numArgs: 0,
  14923. variableArgs: false
  14924. };
  14925. t["B*"] = {
  14926. id: _util.OPS.eoFillStroke,
  14927. numArgs: 0,
  14928. variableArgs: false
  14929. };
  14930. t.b = {
  14931. id: _util.OPS.closeFillStroke,
  14932. numArgs: 0,
  14933. variableArgs: false
  14934. };
  14935. t["b*"] = {
  14936. id: _util.OPS.closeEOFillStroke,
  14937. numArgs: 0,
  14938. variableArgs: false
  14939. };
  14940. t.n = {
  14941. id: _util.OPS.endPath,
  14942. numArgs: 0,
  14943. variableArgs: false
  14944. };
  14945. t.W = {
  14946. id: _util.OPS.clip,
  14947. numArgs: 0,
  14948. variableArgs: false
  14949. };
  14950. t["W*"] = {
  14951. id: _util.OPS.eoClip,
  14952. numArgs: 0,
  14953. variableArgs: false
  14954. };
  14955. t.BT = {
  14956. id: _util.OPS.beginText,
  14957. numArgs: 0,
  14958. variableArgs: false
  14959. };
  14960. t.ET = {
  14961. id: _util.OPS.endText,
  14962. numArgs: 0,
  14963. variableArgs: false
  14964. };
  14965. t.Tc = {
  14966. id: _util.OPS.setCharSpacing,
  14967. numArgs: 1,
  14968. variableArgs: false
  14969. };
  14970. t.Tw = {
  14971. id: _util.OPS.setWordSpacing,
  14972. numArgs: 1,
  14973. variableArgs: false
  14974. };
  14975. t.Tz = {
  14976. id: _util.OPS.setHScale,
  14977. numArgs: 1,
  14978. variableArgs: false
  14979. };
  14980. t.TL = {
  14981. id: _util.OPS.setLeading,
  14982. numArgs: 1,
  14983. variableArgs: false
  14984. };
  14985. t.Tf = {
  14986. id: _util.OPS.setFont,
  14987. numArgs: 2,
  14988. variableArgs: false
  14989. };
  14990. t.Tr = {
  14991. id: _util.OPS.setTextRenderingMode,
  14992. numArgs: 1,
  14993. variableArgs: false
  14994. };
  14995. t.Ts = {
  14996. id: _util.OPS.setTextRise,
  14997. numArgs: 1,
  14998. variableArgs: false
  14999. };
  15000. t.Td = {
  15001. id: _util.OPS.moveText,
  15002. numArgs: 2,
  15003. variableArgs: false
  15004. };
  15005. t.TD = {
  15006. id: _util.OPS.setLeadingMoveText,
  15007. numArgs: 2,
  15008. variableArgs: false
  15009. };
  15010. t.Tm = {
  15011. id: _util.OPS.setTextMatrix,
  15012. numArgs: 6,
  15013. variableArgs: false
  15014. };
  15015. t["T*"] = {
  15016. id: _util.OPS.nextLine,
  15017. numArgs: 0,
  15018. variableArgs: false
  15019. };
  15020. t.Tj = {
  15021. id: _util.OPS.showText,
  15022. numArgs: 1,
  15023. variableArgs: false
  15024. };
  15025. t.TJ = {
  15026. id: _util.OPS.showSpacedText,
  15027. numArgs: 1,
  15028. variableArgs: false
  15029. };
  15030. t["'"] = {
  15031. id: _util.OPS.nextLineShowText,
  15032. numArgs: 1,
  15033. variableArgs: false
  15034. };
  15035. t['"'] = {
  15036. id: _util.OPS.nextLineSetSpacingShowText,
  15037. numArgs: 3,
  15038. variableArgs: false
  15039. };
  15040. t.d0 = {
  15041. id: _util.OPS.setCharWidth,
  15042. numArgs: 2,
  15043. variableArgs: false
  15044. };
  15045. t.d1 = {
  15046. id: _util.OPS.setCharWidthAndBounds,
  15047. numArgs: 6,
  15048. variableArgs: false
  15049. };
  15050. t.CS = {
  15051. id: _util.OPS.setStrokeColorSpace,
  15052. numArgs: 1,
  15053. variableArgs: false
  15054. };
  15055. t.cs = {
  15056. id: _util.OPS.setFillColorSpace,
  15057. numArgs: 1,
  15058. variableArgs: false
  15059. };
  15060. t.SC = {
  15061. id: _util.OPS.setStrokeColor,
  15062. numArgs: 4,
  15063. variableArgs: true
  15064. };
  15065. t.SCN = {
  15066. id: _util.OPS.setStrokeColorN,
  15067. numArgs: 33,
  15068. variableArgs: true
  15069. };
  15070. t.sc = {
  15071. id: _util.OPS.setFillColor,
  15072. numArgs: 4,
  15073. variableArgs: true
  15074. };
  15075. t.scn = {
  15076. id: _util.OPS.setFillColorN,
  15077. numArgs: 33,
  15078. variableArgs: true
  15079. };
  15080. t.G = {
  15081. id: _util.OPS.setStrokeGray,
  15082. numArgs: 1,
  15083. variableArgs: false
  15084. };
  15085. t.g = {
  15086. id: _util.OPS.setFillGray,
  15087. numArgs: 1,
  15088. variableArgs: false
  15089. };
  15090. t.RG = {
  15091. id: _util.OPS.setStrokeRGBColor,
  15092. numArgs: 3,
  15093. variableArgs: false
  15094. };
  15095. t.rg = {
  15096. id: _util.OPS.setFillRGBColor,
  15097. numArgs: 3,
  15098. variableArgs: false
  15099. };
  15100. t.K = {
  15101. id: _util.OPS.setStrokeCMYKColor,
  15102. numArgs: 4,
  15103. variableArgs: false
  15104. };
  15105. t.k = {
  15106. id: _util.OPS.setFillCMYKColor,
  15107. numArgs: 4,
  15108. variableArgs: false
  15109. };
  15110. t.sh = {
  15111. id: _util.OPS.shadingFill,
  15112. numArgs: 1,
  15113. variableArgs: false
  15114. };
  15115. t.BI = {
  15116. id: _util.OPS.beginInlineImage,
  15117. numArgs: 0,
  15118. variableArgs: false
  15119. };
  15120. t.ID = {
  15121. id: _util.OPS.beginImageData,
  15122. numArgs: 0,
  15123. variableArgs: false
  15124. };
  15125. t.EI = {
  15126. id: _util.OPS.endInlineImage,
  15127. numArgs: 1,
  15128. variableArgs: false
  15129. };
  15130. t.Do = {
  15131. id: _util.OPS.paintXObject,
  15132. numArgs: 1,
  15133. variableArgs: false
  15134. };
  15135. t.MP = {
  15136. id: _util.OPS.markPoint,
  15137. numArgs: 1,
  15138. variableArgs: false
  15139. };
  15140. t.DP = {
  15141. id: _util.OPS.markPointProps,
  15142. numArgs: 2,
  15143. variableArgs: false
  15144. };
  15145. t.BMC = {
  15146. id: _util.OPS.beginMarkedContent,
  15147. numArgs: 1,
  15148. variableArgs: false
  15149. };
  15150. t.BDC = {
  15151. id: _util.OPS.beginMarkedContentProps,
  15152. numArgs: 2,
  15153. variableArgs: false
  15154. };
  15155. t.EMC = {
  15156. id: _util.OPS.endMarkedContent,
  15157. numArgs: 0,
  15158. variableArgs: false
  15159. };
  15160. t.BX = {
  15161. id: _util.OPS.beginCompat,
  15162. numArgs: 0,
  15163. variableArgs: false
  15164. };
  15165. t.EX = {
  15166. id: _util.OPS.endCompat,
  15167. numArgs: 0,
  15168. variableArgs: false
  15169. };
  15170. t.BM = null;
  15171. t.BD = null;
  15172. t.true = null;
  15173. t.fa = null;
  15174. t.fal = null;
  15175. t.fals = null;
  15176. t.false = null;
  15177. t.nu = null;
  15178. t.nul = null;
  15179. t.null = null;
  15180. });
  15181. return (0, _util.shadow)(this, "opMap", getOPMap());
  15182. }
  15183. static get MAX_INVALID_PATH_OPS() {
  15184. return (0, _util.shadow)(this, "MAX_INVALID_PATH_OPS", 10);
  15185. }
  15186. constructor(stream, xref) {
  15187. let stateManager = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new StateManager();
  15188. this.parser = new _parser.Parser({
  15189. lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap),
  15190. xref
  15191. });
  15192. this.stateManager = stateManager;
  15193. this.nonProcessedArgs = [];
  15194. this._isPathOp = false;
  15195. this._numInvalidPathOPS = 0;
  15196. }
  15197. get savedStatesDepth() {
  15198. return this.stateManager.stateStack.length;
  15199. }
  15200. read(operation) {
  15201. let args = operation.args;
  15202. while (true) {
  15203. const obj = this.parser.getObj();
  15204. if (obj instanceof _primitives.Cmd) {
  15205. const cmd = obj.cmd;
  15206. const opSpec = EvaluatorPreprocessor.opMap[cmd];
  15207. if (!opSpec) {
  15208. (0, _util.warn)(`Unknown command "${cmd}".`);
  15209. continue;
  15210. }
  15211. const fn = opSpec.id;
  15212. const numArgs = opSpec.numArgs;
  15213. let argsLength = args !== null ? args.length : 0;
  15214. if (!this._isPathOp) {
  15215. this._numInvalidPathOPS = 0;
  15216. }
  15217. this._isPathOp = fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath;
  15218. if (!opSpec.variableArgs) {
  15219. if (argsLength !== numArgs) {
  15220. const nonProcessedArgs = this.nonProcessedArgs;
  15221. while (argsLength > numArgs) {
  15222. nonProcessedArgs.push(args.shift());
  15223. argsLength--;
  15224. }
  15225. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  15226. if (args === null) {
  15227. args = [];
  15228. }
  15229. args.unshift(nonProcessedArgs.pop());
  15230. argsLength++;
  15231. }
  15232. }
  15233. if (argsLength < numArgs) {
  15234. const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
  15235. if (this._isPathOp && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
  15236. throw new _util.FormatError(`Invalid ${partialMsg}`);
  15237. }
  15238. (0, _util.warn)(`Skipping ${partialMsg}`);
  15239. if (args !== null) {
  15240. args.length = 0;
  15241. }
  15242. continue;
  15243. }
  15244. } else if (argsLength > numArgs) {
  15245. (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
  15246. }
  15247. this.preprocessCommand(fn, args);
  15248. operation.fn = fn;
  15249. operation.args = args;
  15250. return true;
  15251. }
  15252. if (obj === _primitives.EOF) {
  15253. return false;
  15254. }
  15255. if (obj !== null) {
  15256. if (args === null) {
  15257. args = [];
  15258. }
  15259. args.push(obj);
  15260. if (args.length > 33) {
  15261. throw new _util.FormatError("Too many arguments");
  15262. }
  15263. }
  15264. }
  15265. }
  15266. preprocessCommand(fn, args) {
  15267. switch (fn | 0) {
  15268. case _util.OPS.save:
  15269. this.stateManager.save();
  15270. break;
  15271. case _util.OPS.restore:
  15272. this.stateManager.restore();
  15273. break;
  15274. case _util.OPS.transform:
  15275. this.stateManager.transform(args);
  15276. break;
  15277. }
  15278. }
  15279. }
  15280. exports.EvaluatorPreprocessor = EvaluatorPreprocessor;
  15281. /***/ }),
  15282. /* 147 */
  15283. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  15284. "use strict";
  15285. Object.defineProperty(exports, "__esModule", ({
  15286. value: true
  15287. }));
  15288. exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0;
  15289. var _util = __w_pdfjs_require__(2);
  15290. var _primitives = __w_pdfjs_require__(137);
  15291. var _base_stream = __w_pdfjs_require__(138);
  15292. var _parser = __w_pdfjs_require__(148);
  15293. var _core_utils = __w_pdfjs_require__(136);
  15294. var _stream = __w_pdfjs_require__(141);
  15295. 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"];
  15296. const MAX_MAP_RANGE = 2 ** 24 - 1;
  15297. class CMap {
  15298. constructor() {
  15299. let builtInCMap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  15300. this.codespaceRanges = [[], [], [], []];
  15301. this.numCodespaceRanges = 0;
  15302. this._map = [];
  15303. this.name = "";
  15304. this.vertical = false;
  15305. this.useCMap = null;
  15306. this.builtInCMap = builtInCMap;
  15307. }
  15308. addCodespaceRange(n, low, high) {
  15309. this.codespaceRanges[n - 1].push(low, high);
  15310. this.numCodespaceRanges++;
  15311. }
  15312. mapCidRange(low, high, dstLow) {
  15313. if (high - low > MAX_MAP_RANGE) {
  15314. throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
  15315. }
  15316. while (low <= high) {
  15317. this._map[low++] = dstLow++;
  15318. }
  15319. }
  15320. mapBfRange(low, high, dstLow) {
  15321. if (high - low > MAX_MAP_RANGE) {
  15322. throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
  15323. }
  15324. const lastByte = dstLow.length - 1;
  15325. while (low <= high) {
  15326. this._map[low++] = dstLow;
  15327. const nextCharCode = dstLow.charCodeAt(lastByte) + 1;
  15328. if (nextCharCode > 0xff) {
  15329. dstLow = dstLow.substring(0, lastByte - 1) + String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 1) + "\x00";
  15330. continue;
  15331. }
  15332. dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(nextCharCode);
  15333. }
  15334. }
  15335. mapBfRangeToArray(low, high, array) {
  15336. if (high - low > MAX_MAP_RANGE) {
  15337. throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
  15338. }
  15339. const ii = array.length;
  15340. let i = 0;
  15341. while (low <= high && i < ii) {
  15342. this._map[low] = array[i++];
  15343. ++low;
  15344. }
  15345. }
  15346. mapOne(src, dst) {
  15347. this._map[src] = dst;
  15348. }
  15349. lookup(code) {
  15350. return this._map[code];
  15351. }
  15352. contains(code) {
  15353. return this._map[code] !== undefined;
  15354. }
  15355. forEach(callback) {
  15356. const map = this._map;
  15357. const length = map.length;
  15358. if (length <= 0x10000) {
  15359. for (let i = 0; i < length; i++) {
  15360. if (map[i] !== undefined) {
  15361. callback(i, map[i]);
  15362. }
  15363. }
  15364. } else {
  15365. for (const i in map) {
  15366. callback(i, map[i]);
  15367. }
  15368. }
  15369. }
  15370. charCodeOf(value) {
  15371. const map = this._map;
  15372. if (map.length <= 0x10000) {
  15373. return map.indexOf(value);
  15374. }
  15375. for (const charCode in map) {
  15376. if (map[charCode] === value) {
  15377. return charCode | 0;
  15378. }
  15379. }
  15380. return -1;
  15381. }
  15382. getMap() {
  15383. return this._map;
  15384. }
  15385. readCharCode(str, offset, out) {
  15386. let c = 0;
  15387. const codespaceRanges = this.codespaceRanges;
  15388. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  15389. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  15390. const codespaceRange = codespaceRanges[n];
  15391. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  15392. const low = codespaceRange[k++];
  15393. const high = codespaceRange[k++];
  15394. if (c >= low && c <= high) {
  15395. out.charcode = c;
  15396. out.length = n + 1;
  15397. return;
  15398. }
  15399. }
  15400. }
  15401. out.charcode = 0;
  15402. out.length = 1;
  15403. }
  15404. getCharCodeLength(charCode) {
  15405. const codespaceRanges = this.codespaceRanges;
  15406. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  15407. const codespaceRange = codespaceRanges[n];
  15408. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  15409. const low = codespaceRange[k++];
  15410. const high = codespaceRange[k++];
  15411. if (charCode >= low && charCode <= high) {
  15412. return n + 1;
  15413. }
  15414. }
  15415. }
  15416. return 1;
  15417. }
  15418. get length() {
  15419. return this._map.length;
  15420. }
  15421. get isIdentityCMap() {
  15422. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  15423. return false;
  15424. }
  15425. if (this._map.length !== 0x10000) {
  15426. return false;
  15427. }
  15428. for (let i = 0; i < 0x10000; i++) {
  15429. if (this._map[i] !== i) {
  15430. return false;
  15431. }
  15432. }
  15433. return true;
  15434. }
  15435. }
  15436. exports.CMap = CMap;
  15437. class IdentityCMap extends CMap {
  15438. constructor(vertical, n) {
  15439. super();
  15440. this.vertical = vertical;
  15441. this.addCodespaceRange(n, 0, 0xffff);
  15442. }
  15443. mapCidRange(low, high, dstLow) {
  15444. (0, _util.unreachable)("should not call mapCidRange");
  15445. }
  15446. mapBfRange(low, high, dstLow) {
  15447. (0, _util.unreachable)("should not call mapBfRange");
  15448. }
  15449. mapBfRangeToArray(low, high, array) {
  15450. (0, _util.unreachable)("should not call mapBfRangeToArray");
  15451. }
  15452. mapOne(src, dst) {
  15453. (0, _util.unreachable)("should not call mapCidOne");
  15454. }
  15455. lookup(code) {
  15456. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  15457. }
  15458. contains(code) {
  15459. return Number.isInteger(code) && code <= 0xffff;
  15460. }
  15461. forEach(callback) {
  15462. for (let i = 0; i <= 0xffff; i++) {
  15463. callback(i, i);
  15464. }
  15465. }
  15466. charCodeOf(value) {
  15467. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  15468. }
  15469. getMap() {
  15470. const map = new Array(0x10000);
  15471. for (let i = 0; i <= 0xffff; i++) {
  15472. map[i] = i;
  15473. }
  15474. return map;
  15475. }
  15476. get length() {
  15477. return 0x10000;
  15478. }
  15479. get isIdentityCMap() {
  15480. (0, _util.unreachable)("should not access .isIdentityCMap");
  15481. }
  15482. }
  15483. exports.IdentityCMap = IdentityCMap;
  15484. const BinaryCMapReader = function BinaryCMapReaderClosure() {
  15485. function hexToInt(a, size) {
  15486. let n = 0;
  15487. for (let i = 0; i <= size; i++) {
  15488. n = n << 8 | a[i];
  15489. }
  15490. return n >>> 0;
  15491. }
  15492. function hexToStr(a, size) {
  15493. if (size === 1) {
  15494. return String.fromCharCode(a[0], a[1]);
  15495. }
  15496. if (size === 3) {
  15497. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  15498. }
  15499. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  15500. }
  15501. function addHex(a, b, size) {
  15502. let c = 0;
  15503. for (let i = size; i >= 0; i--) {
  15504. c += a[i] + b[i];
  15505. a[i] = c & 255;
  15506. c >>= 8;
  15507. }
  15508. }
  15509. function incHex(a, size) {
  15510. let c = 1;
  15511. for (let i = size; i >= 0 && c > 0; i--) {
  15512. c += a[i];
  15513. a[i] = c & 255;
  15514. c >>= 8;
  15515. }
  15516. }
  15517. const MAX_NUM_SIZE = 16;
  15518. const MAX_ENCODED_NUM_SIZE = 19;
  15519. class BinaryCMapStream {
  15520. constructor(data) {
  15521. this.buffer = data;
  15522. this.pos = 0;
  15523. this.end = data.length;
  15524. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  15525. }
  15526. readByte() {
  15527. if (this.pos >= this.end) {
  15528. return -1;
  15529. }
  15530. return this.buffer[this.pos++];
  15531. }
  15532. readNumber() {
  15533. let n = 0;
  15534. let last;
  15535. do {
  15536. const b = this.readByte();
  15537. if (b < 0) {
  15538. throw new _util.FormatError("unexpected EOF in bcmap");
  15539. }
  15540. last = !(b & 0x80);
  15541. n = n << 7 | b & 0x7f;
  15542. } while (!last);
  15543. return n;
  15544. }
  15545. readSigned() {
  15546. const n = this.readNumber();
  15547. return n & 1 ? ~(n >>> 1) : n >>> 1;
  15548. }
  15549. readHex(num, size) {
  15550. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  15551. this.pos += size + 1;
  15552. }
  15553. readHexNumber(num, size) {
  15554. let last;
  15555. const stack = this.tmpBuf;
  15556. let sp = 0;
  15557. do {
  15558. const b = this.readByte();
  15559. if (b < 0) {
  15560. throw new _util.FormatError("unexpected EOF in bcmap");
  15561. }
  15562. last = !(b & 0x80);
  15563. stack[sp++] = b & 0x7f;
  15564. } while (!last);
  15565. let i = size,
  15566. buffer = 0,
  15567. bufferSize = 0;
  15568. while (i >= 0) {
  15569. while (bufferSize < 8 && stack.length > 0) {
  15570. buffer |= stack[--sp] << bufferSize;
  15571. bufferSize += 7;
  15572. }
  15573. num[i] = buffer & 255;
  15574. i--;
  15575. buffer >>= 8;
  15576. bufferSize -= 8;
  15577. }
  15578. }
  15579. readHexSigned(num, size) {
  15580. this.readHexNumber(num, size);
  15581. const sign = num[size] & 1 ? 255 : 0;
  15582. let c = 0;
  15583. for (let i = 0; i <= size; i++) {
  15584. c = (c & 1) << 8 | num[i];
  15585. num[i] = c >> 1 ^ sign;
  15586. }
  15587. }
  15588. readString() {
  15589. const len = this.readNumber();
  15590. let s = "";
  15591. for (let i = 0; i < len; i++) {
  15592. s += String.fromCharCode(this.readNumber());
  15593. }
  15594. return s;
  15595. }
  15596. }
  15597. class BinaryCMapReader {
  15598. async process(data, cMap, extend) {
  15599. const stream = new BinaryCMapStream(data);
  15600. const header = stream.readByte();
  15601. cMap.vertical = !!(header & 1);
  15602. let useCMap = null;
  15603. const start = new Uint8Array(MAX_NUM_SIZE);
  15604. const end = new Uint8Array(MAX_NUM_SIZE);
  15605. const char = new Uint8Array(MAX_NUM_SIZE);
  15606. const charCode = new Uint8Array(MAX_NUM_SIZE);
  15607. const tmp = new Uint8Array(MAX_NUM_SIZE);
  15608. let code;
  15609. let b;
  15610. while ((b = stream.readByte()) >= 0) {
  15611. const type = b >> 5;
  15612. if (type === 7) {
  15613. switch (b & 0x1f) {
  15614. case 0:
  15615. stream.readString();
  15616. break;
  15617. case 1:
  15618. useCMap = stream.readString();
  15619. break;
  15620. }
  15621. continue;
  15622. }
  15623. const sequence = !!(b & 0x10);
  15624. const dataSize = b & 15;
  15625. if (dataSize + 1 > MAX_NUM_SIZE) {
  15626. throw new Error("BinaryCMapReader.process: Invalid dataSize.");
  15627. }
  15628. const ucs2DataSize = 1;
  15629. const subitemsCount = stream.readNumber();
  15630. switch (type) {
  15631. case 0:
  15632. stream.readHex(start, dataSize);
  15633. stream.readHexNumber(end, dataSize);
  15634. addHex(end, start, dataSize);
  15635. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  15636. for (let i = 1; i < subitemsCount; i++) {
  15637. incHex(end, dataSize);
  15638. stream.readHexNumber(start, dataSize);
  15639. addHex(start, end, dataSize);
  15640. stream.readHexNumber(end, dataSize);
  15641. addHex(end, start, dataSize);
  15642. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  15643. }
  15644. break;
  15645. case 1:
  15646. stream.readHex(start, dataSize);
  15647. stream.readHexNumber(end, dataSize);
  15648. addHex(end, start, dataSize);
  15649. stream.readNumber();
  15650. for (let i = 1; i < subitemsCount; i++) {
  15651. incHex(end, dataSize);
  15652. stream.readHexNumber(start, dataSize);
  15653. addHex(start, end, dataSize);
  15654. stream.readHexNumber(end, dataSize);
  15655. addHex(end, start, dataSize);
  15656. stream.readNumber();
  15657. }
  15658. break;
  15659. case 2:
  15660. stream.readHex(char, dataSize);
  15661. code = stream.readNumber();
  15662. cMap.mapOne(hexToInt(char, dataSize), code);
  15663. for (let i = 1; i < subitemsCount; i++) {
  15664. incHex(char, dataSize);
  15665. if (!sequence) {
  15666. stream.readHexNumber(tmp, dataSize);
  15667. addHex(char, tmp, dataSize);
  15668. }
  15669. code = stream.readSigned() + (code + 1);
  15670. cMap.mapOne(hexToInt(char, dataSize), code);
  15671. }
  15672. break;
  15673. case 3:
  15674. stream.readHex(start, dataSize);
  15675. stream.readHexNumber(end, dataSize);
  15676. addHex(end, start, dataSize);
  15677. code = stream.readNumber();
  15678. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  15679. for (let i = 1; i < subitemsCount; i++) {
  15680. incHex(end, dataSize);
  15681. if (!sequence) {
  15682. stream.readHexNumber(start, dataSize);
  15683. addHex(start, end, dataSize);
  15684. } else {
  15685. start.set(end);
  15686. }
  15687. stream.readHexNumber(end, dataSize);
  15688. addHex(end, start, dataSize);
  15689. code = stream.readNumber();
  15690. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  15691. }
  15692. break;
  15693. case 4:
  15694. stream.readHex(char, ucs2DataSize);
  15695. stream.readHex(charCode, dataSize);
  15696. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  15697. for (let i = 1; i < subitemsCount; i++) {
  15698. incHex(char, ucs2DataSize);
  15699. if (!sequence) {
  15700. stream.readHexNumber(tmp, ucs2DataSize);
  15701. addHex(char, tmp, ucs2DataSize);
  15702. }
  15703. incHex(charCode, dataSize);
  15704. stream.readHexSigned(tmp, dataSize);
  15705. addHex(charCode, tmp, dataSize);
  15706. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  15707. }
  15708. break;
  15709. case 5:
  15710. stream.readHex(start, ucs2DataSize);
  15711. stream.readHexNumber(end, ucs2DataSize);
  15712. addHex(end, start, ucs2DataSize);
  15713. stream.readHex(charCode, dataSize);
  15714. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  15715. for (let i = 1; i < subitemsCount; i++) {
  15716. incHex(end, ucs2DataSize);
  15717. if (!sequence) {
  15718. stream.readHexNumber(start, ucs2DataSize);
  15719. addHex(start, end, ucs2DataSize);
  15720. } else {
  15721. start.set(end);
  15722. }
  15723. stream.readHexNumber(end, ucs2DataSize);
  15724. addHex(end, start, ucs2DataSize);
  15725. stream.readHex(charCode, dataSize);
  15726. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  15727. }
  15728. break;
  15729. default:
  15730. throw new Error(`BinaryCMapReader.process - unknown type: ${type}`);
  15731. }
  15732. }
  15733. if (useCMap) {
  15734. return extend(useCMap);
  15735. }
  15736. return cMap;
  15737. }
  15738. }
  15739. return BinaryCMapReader;
  15740. }();
  15741. const CMapFactory = function CMapFactoryClosure() {
  15742. function strToInt(str) {
  15743. let a = 0;
  15744. for (let i = 0; i < str.length; i++) {
  15745. a = a << 8 | str.charCodeAt(i);
  15746. }
  15747. return a >>> 0;
  15748. }
  15749. function expectString(obj) {
  15750. if (typeof obj !== "string") {
  15751. throw new _util.FormatError("Malformed CMap: expected string.");
  15752. }
  15753. }
  15754. function expectInt(obj) {
  15755. if (!Number.isInteger(obj)) {
  15756. throw new _util.FormatError("Malformed CMap: expected int.");
  15757. }
  15758. }
  15759. function parseBfChar(cMap, lexer) {
  15760. while (true) {
  15761. let obj = lexer.getObj();
  15762. if (obj === _primitives.EOF) {
  15763. break;
  15764. }
  15765. if ((0, _primitives.isCmd)(obj, "endbfchar")) {
  15766. return;
  15767. }
  15768. expectString(obj);
  15769. const src = strToInt(obj);
  15770. obj = lexer.getObj();
  15771. expectString(obj);
  15772. const dst = obj;
  15773. cMap.mapOne(src, dst);
  15774. }
  15775. }
  15776. function parseBfRange(cMap, lexer) {
  15777. while (true) {
  15778. let obj = lexer.getObj();
  15779. if (obj === _primitives.EOF) {
  15780. break;
  15781. }
  15782. if ((0, _primitives.isCmd)(obj, "endbfrange")) {
  15783. return;
  15784. }
  15785. expectString(obj);
  15786. const low = strToInt(obj);
  15787. obj = lexer.getObj();
  15788. expectString(obj);
  15789. const high = strToInt(obj);
  15790. obj = lexer.getObj();
  15791. if (Number.isInteger(obj) || typeof obj === "string") {
  15792. const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
  15793. cMap.mapBfRange(low, high, dstLow);
  15794. } else if ((0, _primitives.isCmd)(obj, "[")) {
  15795. obj = lexer.getObj();
  15796. const array = [];
  15797. while (!(0, _primitives.isCmd)(obj, "]") && obj !== _primitives.EOF) {
  15798. array.push(obj);
  15799. obj = lexer.getObj();
  15800. }
  15801. cMap.mapBfRangeToArray(low, high, array);
  15802. } else {
  15803. break;
  15804. }
  15805. }
  15806. throw new _util.FormatError("Invalid bf range.");
  15807. }
  15808. function parseCidChar(cMap, lexer) {
  15809. while (true) {
  15810. let obj = lexer.getObj();
  15811. if (obj === _primitives.EOF) {
  15812. break;
  15813. }
  15814. if ((0, _primitives.isCmd)(obj, "endcidchar")) {
  15815. return;
  15816. }
  15817. expectString(obj);
  15818. const src = strToInt(obj);
  15819. obj = lexer.getObj();
  15820. expectInt(obj);
  15821. const dst = obj;
  15822. cMap.mapOne(src, dst);
  15823. }
  15824. }
  15825. function parseCidRange(cMap, lexer) {
  15826. while (true) {
  15827. let obj = lexer.getObj();
  15828. if (obj === _primitives.EOF) {
  15829. break;
  15830. }
  15831. if ((0, _primitives.isCmd)(obj, "endcidrange")) {
  15832. return;
  15833. }
  15834. expectString(obj);
  15835. const low = strToInt(obj);
  15836. obj = lexer.getObj();
  15837. expectString(obj);
  15838. const high = strToInt(obj);
  15839. obj = lexer.getObj();
  15840. expectInt(obj);
  15841. const dstLow = obj;
  15842. cMap.mapCidRange(low, high, dstLow);
  15843. }
  15844. }
  15845. function parseCodespaceRange(cMap, lexer) {
  15846. while (true) {
  15847. let obj = lexer.getObj();
  15848. if (obj === _primitives.EOF) {
  15849. break;
  15850. }
  15851. if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
  15852. return;
  15853. }
  15854. if (typeof obj !== "string") {
  15855. break;
  15856. }
  15857. const low = strToInt(obj);
  15858. obj = lexer.getObj();
  15859. if (typeof obj !== "string") {
  15860. break;
  15861. }
  15862. const high = strToInt(obj);
  15863. cMap.addCodespaceRange(obj.length, low, high);
  15864. }
  15865. throw new _util.FormatError("Invalid codespace range.");
  15866. }
  15867. function parseWMode(cMap, lexer) {
  15868. const obj = lexer.getObj();
  15869. if (Number.isInteger(obj)) {
  15870. cMap.vertical = !!obj;
  15871. }
  15872. }
  15873. function parseCMapName(cMap, lexer) {
  15874. const obj = lexer.getObj();
  15875. if (obj instanceof _primitives.Name) {
  15876. cMap.name = obj.name;
  15877. }
  15878. }
  15879. async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  15880. let previous, embeddedUseCMap;
  15881. objLoop: while (true) {
  15882. try {
  15883. const obj = lexer.getObj();
  15884. if (obj === _primitives.EOF) {
  15885. break;
  15886. } else if (obj instanceof _primitives.Name) {
  15887. if (obj.name === "WMode") {
  15888. parseWMode(cMap, lexer);
  15889. } else if (obj.name === "CMapName") {
  15890. parseCMapName(cMap, lexer);
  15891. }
  15892. previous = obj;
  15893. } else if (obj instanceof _primitives.Cmd) {
  15894. switch (obj.cmd) {
  15895. case "endcmap":
  15896. break objLoop;
  15897. case "usecmap":
  15898. if (previous instanceof _primitives.Name) {
  15899. embeddedUseCMap = previous.name;
  15900. }
  15901. break;
  15902. case "begincodespacerange":
  15903. parseCodespaceRange(cMap, lexer);
  15904. break;
  15905. case "beginbfchar":
  15906. parseBfChar(cMap, lexer);
  15907. break;
  15908. case "begincidchar":
  15909. parseCidChar(cMap, lexer);
  15910. break;
  15911. case "beginbfrange":
  15912. parseBfRange(cMap, lexer);
  15913. break;
  15914. case "begincidrange":
  15915. parseCidRange(cMap, lexer);
  15916. break;
  15917. }
  15918. }
  15919. } catch (ex) {
  15920. if (ex instanceof _core_utils.MissingDataException) {
  15921. throw ex;
  15922. }
  15923. (0, _util.warn)("Invalid cMap data: " + ex);
  15924. continue;
  15925. }
  15926. }
  15927. if (!useCMap && embeddedUseCMap) {
  15928. useCMap = embeddedUseCMap;
  15929. }
  15930. if (useCMap) {
  15931. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  15932. }
  15933. return cMap;
  15934. }
  15935. async function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  15936. cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap);
  15937. if (cMap.numCodespaceRanges === 0) {
  15938. const useCodespaceRanges = cMap.useCMap.codespaceRanges;
  15939. for (let i = 0; i < useCodespaceRanges.length; i++) {
  15940. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  15941. }
  15942. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  15943. }
  15944. cMap.useCMap.forEach(function (key, value) {
  15945. if (!cMap.contains(key)) {
  15946. cMap.mapOne(key, cMap.useCMap.lookup(key));
  15947. }
  15948. });
  15949. return cMap;
  15950. }
  15951. async function createBuiltInCMap(name, fetchBuiltInCMap) {
  15952. if (name === "Identity-H") {
  15953. return new IdentityCMap(false, 2);
  15954. } else if (name === "Identity-V") {
  15955. return new IdentityCMap(true, 2);
  15956. }
  15957. if (!BUILT_IN_CMAPS.includes(name)) {
  15958. throw new Error("Unknown CMap name: " + name);
  15959. }
  15960. if (!fetchBuiltInCMap) {
  15961. throw new Error("Built-in CMap parameters are not provided.");
  15962. }
  15963. const {
  15964. cMapData,
  15965. compressionType
  15966. } = await fetchBuiltInCMap(name);
  15967. const cMap = new CMap(true);
  15968. if (compressionType === _util.CMapCompressionType.BINARY) {
  15969. return new BinaryCMapReader().process(cMapData, cMap, useCMap => {
  15970. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  15971. });
  15972. }
  15973. if (compressionType === _util.CMapCompressionType.NONE) {
  15974. const lexer = new _parser.Lexer(new _stream.Stream(cMapData));
  15975. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  15976. }
  15977. throw new Error(`Invalid CMap "compressionType" value: ${compressionType}`);
  15978. }
  15979. return {
  15980. async create(params) {
  15981. const encoding = params.encoding;
  15982. const fetchBuiltInCMap = params.fetchBuiltInCMap;
  15983. const useCMap = params.useCMap;
  15984. if (encoding instanceof _primitives.Name) {
  15985. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  15986. } else if (encoding instanceof _base_stream.BaseStream) {
  15987. const parsedCMap = await parseCMap(new CMap(), new _parser.Lexer(encoding), fetchBuiltInCMap, useCMap);
  15988. if (parsedCMap.isIdentityCMap) {
  15989. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  15990. }
  15991. return parsedCMap;
  15992. }
  15993. throw new Error("Encoding required.");
  15994. }
  15995. };
  15996. }();
  15997. exports.CMapFactory = CMapFactory;
  15998. /***/ }),
  15999. /* 148 */
  16000. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16001. "use strict";
  16002. Object.defineProperty(exports, "__esModule", ({
  16003. value: true
  16004. }));
  16005. exports.Parser = exports.Linearization = exports.Lexer = void 0;
  16006. var _util = __w_pdfjs_require__(2);
  16007. var _primitives = __w_pdfjs_require__(137);
  16008. var _core_utils = __w_pdfjs_require__(136);
  16009. var _ascii_85_stream = __w_pdfjs_require__(149);
  16010. var _ascii_hex_stream = __w_pdfjs_require__(151);
  16011. var _ccitt_stream = __w_pdfjs_require__(152);
  16012. var _flate_stream = __w_pdfjs_require__(154);
  16013. var _jbig2_stream = __w_pdfjs_require__(155);
  16014. var _jpeg_stream = __w_pdfjs_require__(158);
  16015. var _jpx_stream = __w_pdfjs_require__(160);
  16016. var _lzw_stream = __w_pdfjs_require__(162);
  16017. var _stream = __w_pdfjs_require__(141);
  16018. var _predictor_stream = __w_pdfjs_require__(163);
  16019. var _run_length_stream = __w_pdfjs_require__(164);
  16020. const MAX_LENGTH_TO_CACHE = 1000;
  16021. function getInlineImageCacheKey(bytes) {
  16022. const strBuf = [],
  16023. ii = bytes.length;
  16024. let i = 0;
  16025. while (i < ii - 1) {
  16026. strBuf.push(bytes[i++] << 8 | bytes[i++]);
  16027. }
  16028. if (i < ii) {
  16029. strBuf.push(bytes[i]);
  16030. }
  16031. return ii + "_" + String.fromCharCode.apply(null, strBuf);
  16032. }
  16033. class Parser {
  16034. constructor(_ref) {
  16035. let {
  16036. lexer,
  16037. xref,
  16038. allowStreams = false,
  16039. recoveryMode = false
  16040. } = _ref;
  16041. this.lexer = lexer;
  16042. this.xref = xref;
  16043. this.allowStreams = allowStreams;
  16044. this.recoveryMode = recoveryMode;
  16045. this.imageCache = Object.create(null);
  16046. this._imageId = 0;
  16047. this.refill();
  16048. }
  16049. refill() {
  16050. this.buf1 = this.lexer.getObj();
  16051. this.buf2 = this.lexer.getObj();
  16052. }
  16053. shift() {
  16054. if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
  16055. this.buf1 = this.buf2;
  16056. this.buf2 = null;
  16057. } else {
  16058. this.buf1 = this.buf2;
  16059. this.buf2 = this.lexer.getObj();
  16060. }
  16061. }
  16062. tryShift() {
  16063. try {
  16064. this.shift();
  16065. return true;
  16066. } catch (e) {
  16067. if (e instanceof _core_utils.MissingDataException) {
  16068. throw e;
  16069. }
  16070. return false;
  16071. }
  16072. }
  16073. getObj() {
  16074. let cipherTransform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  16075. const buf1 = this.buf1;
  16076. this.shift();
  16077. if (buf1 instanceof _primitives.Cmd) {
  16078. switch (buf1.cmd) {
  16079. case "BI":
  16080. return this.makeInlineImage(cipherTransform);
  16081. case "[":
  16082. const array = [];
  16083. while (!(0, _primitives.isCmd)(this.buf1, "]") && this.buf1 !== _primitives.EOF) {
  16084. array.push(this.getObj(cipherTransform));
  16085. }
  16086. if (this.buf1 === _primitives.EOF) {
  16087. if (this.recoveryMode) {
  16088. return array;
  16089. }
  16090. throw new _core_utils.ParserEOFException("End of file inside array.");
  16091. }
  16092. this.shift();
  16093. return array;
  16094. case "<<":
  16095. const dict = new _primitives.Dict(this.xref);
  16096. while (!(0, _primitives.isCmd)(this.buf1, ">>") && this.buf1 !== _primitives.EOF) {
  16097. if (!(this.buf1 instanceof _primitives.Name)) {
  16098. (0, _util.info)("Malformed dictionary: key must be a name object");
  16099. this.shift();
  16100. continue;
  16101. }
  16102. const key = this.buf1.name;
  16103. this.shift();
  16104. if (this.buf1 === _primitives.EOF) {
  16105. break;
  16106. }
  16107. dict.set(key, this.getObj(cipherTransform));
  16108. }
  16109. if (this.buf1 === _primitives.EOF) {
  16110. if (this.recoveryMode) {
  16111. return dict;
  16112. }
  16113. throw new _core_utils.ParserEOFException("End of file inside dictionary.");
  16114. }
  16115. if ((0, _primitives.isCmd)(this.buf2, "stream")) {
  16116. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  16117. }
  16118. this.shift();
  16119. return dict;
  16120. default:
  16121. return buf1;
  16122. }
  16123. }
  16124. if (Number.isInteger(buf1)) {
  16125. if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
  16126. const ref = _primitives.Ref.get(buf1, this.buf1);
  16127. this.shift();
  16128. this.shift();
  16129. return ref;
  16130. }
  16131. return buf1;
  16132. }
  16133. if (typeof buf1 === "string") {
  16134. if (cipherTransform) {
  16135. return cipherTransform.decryptString(buf1);
  16136. }
  16137. return buf1;
  16138. }
  16139. return buf1;
  16140. }
  16141. findDefaultInlineStreamEnd(stream) {
  16142. const E = 0x45,
  16143. I = 0x49,
  16144. SPACE = 0x20,
  16145. LF = 0xa,
  16146. CR = 0xd,
  16147. NUL = 0x0;
  16148. const lexer = this.lexer,
  16149. startPos = stream.pos,
  16150. n = 10;
  16151. let state = 0,
  16152. ch,
  16153. maybeEIPos;
  16154. while ((ch = stream.getByte()) !== -1) {
  16155. if (state === 0) {
  16156. state = ch === E ? 1 : 0;
  16157. } else if (state === 1) {
  16158. state = ch === I ? 2 : 0;
  16159. } else {
  16160. if (ch === SPACE || ch === LF || ch === CR) {
  16161. maybeEIPos = stream.pos;
  16162. const followingBytes = stream.peekBytes(n);
  16163. for (let i = 0, ii = followingBytes.length; i < ii; i++) {
  16164. ch = followingBytes[i];
  16165. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  16166. continue;
  16167. }
  16168. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  16169. state = 0;
  16170. break;
  16171. }
  16172. }
  16173. if (state !== 2) {
  16174. continue;
  16175. }
  16176. if (lexer.knownCommands) {
  16177. const nextObj = lexer.peekObj();
  16178. if (nextObj instanceof _primitives.Cmd && !lexer.knownCommands[nextObj.cmd]) {
  16179. state = 0;
  16180. }
  16181. } else {
  16182. (0, _util.warn)("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");
  16183. }
  16184. if (state === 2) {
  16185. break;
  16186. }
  16187. } else {
  16188. state = 0;
  16189. }
  16190. }
  16191. }
  16192. if (ch === -1) {
  16193. (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
  16194. if (maybeEIPos) {
  16195. (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
  16196. stream.skip(-(stream.pos - maybeEIPos));
  16197. }
  16198. }
  16199. let endOffset = 4;
  16200. stream.skip(-endOffset);
  16201. ch = stream.peekByte();
  16202. stream.skip(endOffset);
  16203. if (!(0, _core_utils.isWhiteSpace)(ch)) {
  16204. endOffset--;
  16205. }
  16206. return stream.pos - endOffset - startPos;
  16207. }
  16208. findDCTDecodeInlineStreamEnd(stream) {
  16209. const startPos = stream.pos;
  16210. let foundEOI = false,
  16211. b,
  16212. markerLength;
  16213. while ((b = stream.getByte()) !== -1) {
  16214. if (b !== 0xff) {
  16215. continue;
  16216. }
  16217. switch (stream.getByte()) {
  16218. case 0x00:
  16219. break;
  16220. case 0xff:
  16221. stream.skip(-1);
  16222. break;
  16223. case 0xd9:
  16224. foundEOI = true;
  16225. break;
  16226. case 0xc0:
  16227. case 0xc1:
  16228. case 0xc2:
  16229. case 0xc3:
  16230. case 0xc5:
  16231. case 0xc6:
  16232. case 0xc7:
  16233. case 0xc9:
  16234. case 0xca:
  16235. case 0xcb:
  16236. case 0xcd:
  16237. case 0xce:
  16238. case 0xcf:
  16239. case 0xc4:
  16240. case 0xcc:
  16241. case 0xda:
  16242. case 0xdb:
  16243. case 0xdc:
  16244. case 0xdd:
  16245. case 0xde:
  16246. case 0xdf:
  16247. case 0xe0:
  16248. case 0xe1:
  16249. case 0xe2:
  16250. case 0xe3:
  16251. case 0xe4:
  16252. case 0xe5:
  16253. case 0xe6:
  16254. case 0xe7:
  16255. case 0xe8:
  16256. case 0xe9:
  16257. case 0xea:
  16258. case 0xeb:
  16259. case 0xec:
  16260. case 0xed:
  16261. case 0xee:
  16262. case 0xef:
  16263. case 0xfe:
  16264. markerLength = stream.getUint16();
  16265. if (markerLength > 2) {
  16266. stream.skip(markerLength - 2);
  16267. } else {
  16268. stream.skip(-2);
  16269. }
  16270. break;
  16271. }
  16272. if (foundEOI) {
  16273. break;
  16274. }
  16275. }
  16276. const length = stream.pos - startPos;
  16277. if (b === -1) {
  16278. (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
  16279. stream.skip(-length);
  16280. return this.findDefaultInlineStreamEnd(stream);
  16281. }
  16282. this.inlineStreamSkipEI(stream);
  16283. return length;
  16284. }
  16285. findASCII85DecodeInlineStreamEnd(stream) {
  16286. const TILDE = 0x7e,
  16287. GT = 0x3e;
  16288. const startPos = stream.pos;
  16289. let ch;
  16290. while ((ch = stream.getByte()) !== -1) {
  16291. if (ch === TILDE) {
  16292. const tildePos = stream.pos;
  16293. ch = stream.peekByte();
  16294. while ((0, _core_utils.isWhiteSpace)(ch)) {
  16295. stream.skip();
  16296. ch = stream.peekByte();
  16297. }
  16298. if (ch === GT) {
  16299. stream.skip();
  16300. break;
  16301. }
  16302. if (stream.pos > tildePos) {
  16303. const maybeEI = stream.peekBytes(2);
  16304. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  16305. break;
  16306. }
  16307. }
  16308. }
  16309. }
  16310. const length = stream.pos - startPos;
  16311. if (ch === -1) {
  16312. (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  16313. stream.skip(-length);
  16314. return this.findDefaultInlineStreamEnd(stream);
  16315. }
  16316. this.inlineStreamSkipEI(stream);
  16317. return length;
  16318. }
  16319. findASCIIHexDecodeInlineStreamEnd(stream) {
  16320. const GT = 0x3e;
  16321. const startPos = stream.pos;
  16322. let ch;
  16323. while ((ch = stream.getByte()) !== -1) {
  16324. if (ch === GT) {
  16325. break;
  16326. }
  16327. }
  16328. const length = stream.pos - startPos;
  16329. if (ch === -1) {
  16330. (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  16331. stream.skip(-length);
  16332. return this.findDefaultInlineStreamEnd(stream);
  16333. }
  16334. this.inlineStreamSkipEI(stream);
  16335. return length;
  16336. }
  16337. inlineStreamSkipEI(stream) {
  16338. const E = 0x45,
  16339. I = 0x49;
  16340. let state = 0,
  16341. ch;
  16342. while ((ch = stream.getByte()) !== -1) {
  16343. if (state === 0) {
  16344. state = ch === E ? 1 : 0;
  16345. } else if (state === 1) {
  16346. state = ch === I ? 2 : 0;
  16347. } else if (state === 2) {
  16348. break;
  16349. }
  16350. }
  16351. }
  16352. makeInlineImage(cipherTransform) {
  16353. const lexer = this.lexer;
  16354. const stream = lexer.stream;
  16355. const dictMap = Object.create(null);
  16356. let dictLength;
  16357. while (!(0, _primitives.isCmd)(this.buf1, "ID") && this.buf1 !== _primitives.EOF) {
  16358. if (!(this.buf1 instanceof _primitives.Name)) {
  16359. throw new _util.FormatError("Dictionary key must be a name object");
  16360. }
  16361. const key = this.buf1.name;
  16362. this.shift();
  16363. if (this.buf1 === _primitives.EOF) {
  16364. break;
  16365. }
  16366. dictMap[key] = this.getObj(cipherTransform);
  16367. }
  16368. if (lexer.beginInlineImagePos !== -1) {
  16369. dictLength = stream.pos - lexer.beginInlineImagePos;
  16370. }
  16371. const filter = this.xref.fetchIfRef(dictMap.F || dictMap.Filter);
  16372. let filterName;
  16373. if (filter instanceof _primitives.Name) {
  16374. filterName = filter.name;
  16375. } else if (Array.isArray(filter)) {
  16376. const filterZero = this.xref.fetchIfRef(filter[0]);
  16377. if (filterZero instanceof _primitives.Name) {
  16378. filterName = filterZero.name;
  16379. }
  16380. }
  16381. const startPos = stream.pos;
  16382. let length;
  16383. switch (filterName) {
  16384. case "DCT":
  16385. case "DCTDecode":
  16386. length = this.findDCTDecodeInlineStreamEnd(stream);
  16387. break;
  16388. case "A85":
  16389. case "ASCII85Decode":
  16390. length = this.findASCII85DecodeInlineStreamEnd(stream);
  16391. break;
  16392. case "AHx":
  16393. case "ASCIIHexDecode":
  16394. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  16395. break;
  16396. default:
  16397. length = this.findDefaultInlineStreamEnd(stream);
  16398. }
  16399. let cacheKey;
  16400. if (length < MAX_LENGTH_TO_CACHE && dictLength > 0) {
  16401. const initialStreamPos = stream.pos;
  16402. stream.pos = lexer.beginInlineImagePos;
  16403. cacheKey = getInlineImageCacheKey(stream.getBytes(dictLength + length));
  16404. stream.pos = initialStreamPos;
  16405. const cacheEntry = this.imageCache[cacheKey];
  16406. if (cacheEntry !== undefined) {
  16407. this.buf2 = _primitives.Cmd.get("EI");
  16408. this.shift();
  16409. cacheEntry.reset();
  16410. return cacheEntry;
  16411. }
  16412. }
  16413. const dict = new _primitives.Dict(this.xref);
  16414. for (const key in dictMap) {
  16415. dict.set(key, dictMap[key]);
  16416. }
  16417. let imageStream = stream.makeSubStream(startPos, length, dict);
  16418. if (cipherTransform) {
  16419. imageStream = cipherTransform.createStream(imageStream, length);
  16420. }
  16421. imageStream = this.filter(imageStream, dict, length);
  16422. imageStream.dict = dict;
  16423. if (cacheKey !== undefined) {
  16424. imageStream.cacheKey = `inline_img_${++this._imageId}`;
  16425. this.imageCache[cacheKey] = imageStream;
  16426. }
  16427. this.buf2 = _primitives.Cmd.get("EI");
  16428. this.shift();
  16429. return imageStream;
  16430. }
  16431. _findStreamLength(startPos, signature) {
  16432. const {
  16433. stream
  16434. } = this.lexer;
  16435. stream.pos = startPos;
  16436. const SCAN_BLOCK_LENGTH = 2048;
  16437. const signatureLength = signature.length;
  16438. while (stream.pos < stream.end) {
  16439. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  16440. const scanLength = scanBytes.length - signatureLength;
  16441. if (scanLength <= 0) {
  16442. break;
  16443. }
  16444. let pos = 0;
  16445. while (pos < scanLength) {
  16446. let j = 0;
  16447. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  16448. j++;
  16449. }
  16450. if (j >= signatureLength) {
  16451. stream.pos += pos;
  16452. return stream.pos - startPos;
  16453. }
  16454. pos++;
  16455. }
  16456. stream.pos += scanLength;
  16457. }
  16458. return -1;
  16459. }
  16460. makeStream(dict, cipherTransform) {
  16461. const lexer = this.lexer;
  16462. let stream = lexer.stream;
  16463. lexer.skipToNextLine();
  16464. const startPos = stream.pos - 1;
  16465. let length = dict.get("Length");
  16466. if (!Number.isInteger(length)) {
  16467. (0, _util.info)(`Bad length "${length && length.toString()}" in stream.`);
  16468. length = 0;
  16469. }
  16470. stream.pos = startPos + length;
  16471. lexer.nextChar();
  16472. if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
  16473. this.shift();
  16474. } else {
  16475. const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]);
  16476. let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
  16477. if (actualLength < 0) {
  16478. const MAX_TRUNCATION = 1;
  16479. for (let i = 1; i <= MAX_TRUNCATION; i++) {
  16480. const end = ENDSTREAM_SIGNATURE.length - i;
  16481. const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
  16482. const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
  16483. if (maybeLength >= 0) {
  16484. const lastByte = stream.peekBytes(end + 1)[end];
  16485. if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
  16486. break;
  16487. }
  16488. (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command.");
  16489. actualLength = maybeLength;
  16490. break;
  16491. }
  16492. }
  16493. if (actualLength < 0) {
  16494. throw new _util.FormatError("Missing endstream command.");
  16495. }
  16496. }
  16497. length = actualLength;
  16498. lexer.nextChar();
  16499. this.shift();
  16500. this.shift();
  16501. }
  16502. this.shift();
  16503. stream = stream.makeSubStream(startPos, length, dict);
  16504. if (cipherTransform) {
  16505. stream = cipherTransform.createStream(stream, length);
  16506. }
  16507. stream = this.filter(stream, dict, length);
  16508. stream.dict = dict;
  16509. return stream;
  16510. }
  16511. filter(stream, dict, length) {
  16512. let filter = dict.get("F", "Filter");
  16513. let params = dict.get("DP", "DecodeParms");
  16514. if (filter instanceof _primitives.Name) {
  16515. if (Array.isArray(params)) {
  16516. (0, _util.warn)("/DecodeParms should not be an Array, when /Filter is a Name.");
  16517. }
  16518. return this.makeFilter(stream, filter.name, length, params);
  16519. }
  16520. let maybeLength = length;
  16521. if (Array.isArray(filter)) {
  16522. const filterArray = filter;
  16523. const paramsArray = params;
  16524. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  16525. filter = this.xref.fetchIfRef(filterArray[i]);
  16526. if (!(filter instanceof _primitives.Name)) {
  16527. throw new _util.FormatError(`Bad filter name "${filter}"`);
  16528. }
  16529. params = null;
  16530. if (Array.isArray(paramsArray) && i in paramsArray) {
  16531. params = this.xref.fetchIfRef(paramsArray[i]);
  16532. }
  16533. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  16534. maybeLength = null;
  16535. }
  16536. }
  16537. return stream;
  16538. }
  16539. makeFilter(stream, name, maybeLength, params) {
  16540. if (maybeLength === 0) {
  16541. (0, _util.warn)(`Empty "${name}" stream.`);
  16542. return new _stream.NullStream();
  16543. }
  16544. try {
  16545. switch (name) {
  16546. case "Fl":
  16547. case "FlateDecode":
  16548. if (params) {
  16549. return new _predictor_stream.PredictorStream(new _flate_stream.FlateStream(stream, maybeLength), maybeLength, params);
  16550. }
  16551. return new _flate_stream.FlateStream(stream, maybeLength);
  16552. case "LZW":
  16553. case "LZWDecode":
  16554. let earlyChange = 1;
  16555. if (params) {
  16556. if (params.has("EarlyChange")) {
  16557. earlyChange = params.get("EarlyChange");
  16558. }
  16559. return new _predictor_stream.PredictorStream(new _lzw_stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  16560. }
  16561. return new _lzw_stream.LZWStream(stream, maybeLength, earlyChange);
  16562. case "DCT":
  16563. case "DCTDecode":
  16564. return new _jpeg_stream.JpegStream(stream, maybeLength, params);
  16565. case "JPX":
  16566. case "JPXDecode":
  16567. return new _jpx_stream.JpxStream(stream, maybeLength, params);
  16568. case "A85":
  16569. case "ASCII85Decode":
  16570. return new _ascii_85_stream.Ascii85Stream(stream, maybeLength);
  16571. case "AHx":
  16572. case "ASCIIHexDecode":
  16573. return new _ascii_hex_stream.AsciiHexStream(stream, maybeLength);
  16574. case "CCF":
  16575. case "CCITTFaxDecode":
  16576. return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
  16577. case "RL":
  16578. case "RunLengthDecode":
  16579. return new _run_length_stream.RunLengthStream(stream, maybeLength);
  16580. case "JBIG2Decode":
  16581. return new _jbig2_stream.Jbig2Stream(stream, maybeLength, params);
  16582. }
  16583. (0, _util.warn)(`Filter "${name}" is not supported.`);
  16584. return stream;
  16585. } catch (ex) {
  16586. if (ex instanceof _core_utils.MissingDataException) {
  16587. throw ex;
  16588. }
  16589. (0, _util.warn)(`Invalid stream: "${ex}"`);
  16590. return new _stream.NullStream();
  16591. }
  16592. }
  16593. }
  16594. exports.Parser = Parser;
  16595. 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];
  16596. function toHexDigit(ch) {
  16597. if (ch >= 0x30 && ch <= 0x39) {
  16598. return ch & 0x0f;
  16599. }
  16600. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  16601. return (ch & 0x0f) + 9;
  16602. }
  16603. return -1;
  16604. }
  16605. class Lexer {
  16606. constructor(stream) {
  16607. let knownCommands = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  16608. this.stream = stream;
  16609. this.nextChar();
  16610. this.strBuf = [];
  16611. this.knownCommands = knownCommands;
  16612. this._hexStringNumWarn = 0;
  16613. this.beginInlineImagePos = -1;
  16614. }
  16615. nextChar() {
  16616. return this.currentChar = this.stream.getByte();
  16617. }
  16618. peekChar() {
  16619. return this.stream.peekByte();
  16620. }
  16621. getNumber() {
  16622. let ch = this.currentChar;
  16623. let eNotation = false;
  16624. let divideBy = 0;
  16625. let sign = 0;
  16626. if (ch === 0x2d) {
  16627. sign = -1;
  16628. ch = this.nextChar();
  16629. if (ch === 0x2d) {
  16630. ch = this.nextChar();
  16631. }
  16632. } else if (ch === 0x2b) {
  16633. sign = 1;
  16634. ch = this.nextChar();
  16635. }
  16636. if (ch === 0x0a || ch === 0x0d) {
  16637. do {
  16638. ch = this.nextChar();
  16639. } while (ch === 0x0a || ch === 0x0d);
  16640. }
  16641. if (ch === 0x2e) {
  16642. divideBy = 10;
  16643. ch = this.nextChar();
  16644. }
  16645. if (ch < 0x30 || ch > 0x39) {
  16646. const msg = `Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`;
  16647. if ((0, _core_utils.isWhiteSpace)(ch) || ch === -1) {
  16648. (0, _util.info)(`Lexer.getNumber - "${msg}".`);
  16649. return 0;
  16650. }
  16651. throw new _util.FormatError(msg);
  16652. }
  16653. sign = sign || 1;
  16654. let baseValue = ch - 0x30;
  16655. let powerValue = 0;
  16656. let powerValueSign = 1;
  16657. while ((ch = this.nextChar()) >= 0) {
  16658. if (ch >= 0x30 && ch <= 0x39) {
  16659. const currentDigit = ch - 0x30;
  16660. if (eNotation) {
  16661. powerValue = powerValue * 10 + currentDigit;
  16662. } else {
  16663. if (divideBy !== 0) {
  16664. divideBy *= 10;
  16665. }
  16666. baseValue = baseValue * 10 + currentDigit;
  16667. }
  16668. } else if (ch === 0x2e) {
  16669. if (divideBy === 0) {
  16670. divideBy = 1;
  16671. } else {
  16672. break;
  16673. }
  16674. } else if (ch === 0x2d) {
  16675. (0, _util.warn)("Badly formatted number: minus sign in the middle");
  16676. } else if (ch === 0x45 || ch === 0x65) {
  16677. ch = this.peekChar();
  16678. if (ch === 0x2b || ch === 0x2d) {
  16679. powerValueSign = ch === 0x2d ? -1 : 1;
  16680. this.nextChar();
  16681. } else if (ch < 0x30 || ch > 0x39) {
  16682. break;
  16683. }
  16684. eNotation = true;
  16685. } else {
  16686. break;
  16687. }
  16688. }
  16689. if (divideBy !== 0) {
  16690. baseValue /= divideBy;
  16691. }
  16692. if (eNotation) {
  16693. baseValue *= 10 ** (powerValueSign * powerValue);
  16694. }
  16695. return sign * baseValue;
  16696. }
  16697. getString() {
  16698. let numParen = 1;
  16699. let done = false;
  16700. const strBuf = this.strBuf;
  16701. strBuf.length = 0;
  16702. let ch = this.nextChar();
  16703. while (true) {
  16704. let charBuffered = false;
  16705. switch (ch | 0) {
  16706. case -1:
  16707. (0, _util.warn)("Unterminated string");
  16708. done = true;
  16709. break;
  16710. case 0x28:
  16711. ++numParen;
  16712. strBuf.push("(");
  16713. break;
  16714. case 0x29:
  16715. if (--numParen === 0) {
  16716. this.nextChar();
  16717. done = true;
  16718. } else {
  16719. strBuf.push(")");
  16720. }
  16721. break;
  16722. case 0x5c:
  16723. ch = this.nextChar();
  16724. switch (ch) {
  16725. case -1:
  16726. (0, _util.warn)("Unterminated string");
  16727. done = true;
  16728. break;
  16729. case 0x6e:
  16730. strBuf.push("\n");
  16731. break;
  16732. case 0x72:
  16733. strBuf.push("\r");
  16734. break;
  16735. case 0x74:
  16736. strBuf.push("\t");
  16737. break;
  16738. case 0x62:
  16739. strBuf.push("\b");
  16740. break;
  16741. case 0x66:
  16742. strBuf.push("\f");
  16743. break;
  16744. case 0x5c:
  16745. case 0x28:
  16746. case 0x29:
  16747. strBuf.push(String.fromCharCode(ch));
  16748. break;
  16749. case 0x30:
  16750. case 0x31:
  16751. case 0x32:
  16752. case 0x33:
  16753. case 0x34:
  16754. case 0x35:
  16755. case 0x36:
  16756. case 0x37:
  16757. let x = ch & 0x0f;
  16758. ch = this.nextChar();
  16759. charBuffered = true;
  16760. if (ch >= 0x30 && ch <= 0x37) {
  16761. x = (x << 3) + (ch & 0x0f);
  16762. ch = this.nextChar();
  16763. if (ch >= 0x30 && ch <= 0x37) {
  16764. charBuffered = false;
  16765. x = (x << 3) + (ch & 0x0f);
  16766. }
  16767. }
  16768. strBuf.push(String.fromCharCode(x));
  16769. break;
  16770. case 0x0d:
  16771. if (this.peekChar() === 0x0a) {
  16772. this.nextChar();
  16773. }
  16774. break;
  16775. case 0x0a:
  16776. break;
  16777. default:
  16778. strBuf.push(String.fromCharCode(ch));
  16779. break;
  16780. }
  16781. break;
  16782. default:
  16783. strBuf.push(String.fromCharCode(ch));
  16784. break;
  16785. }
  16786. if (done) {
  16787. break;
  16788. }
  16789. if (!charBuffered) {
  16790. ch = this.nextChar();
  16791. }
  16792. }
  16793. return strBuf.join("");
  16794. }
  16795. getName() {
  16796. let ch, previousCh;
  16797. const strBuf = this.strBuf;
  16798. strBuf.length = 0;
  16799. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  16800. if (ch === 0x23) {
  16801. ch = this.nextChar();
  16802. if (specialChars[ch]) {
  16803. (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
  16804. strBuf.push("#");
  16805. break;
  16806. }
  16807. const x = toHexDigit(ch);
  16808. if (x !== -1) {
  16809. previousCh = ch;
  16810. ch = this.nextChar();
  16811. const x2 = toHexDigit(ch);
  16812. if (x2 === -1) {
  16813. (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
  16814. strBuf.push("#", String.fromCharCode(previousCh));
  16815. if (specialChars[ch]) {
  16816. break;
  16817. }
  16818. strBuf.push(String.fromCharCode(ch));
  16819. continue;
  16820. }
  16821. strBuf.push(String.fromCharCode(x << 4 | x2));
  16822. } else {
  16823. strBuf.push("#", String.fromCharCode(ch));
  16824. }
  16825. } else {
  16826. strBuf.push(String.fromCharCode(ch));
  16827. }
  16828. }
  16829. if (strBuf.length > 127) {
  16830. (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
  16831. }
  16832. return _primitives.Name.get(strBuf.join(""));
  16833. }
  16834. _hexStringWarn(ch) {
  16835. const MAX_HEX_STRING_NUM_WARN = 5;
  16836. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  16837. (0, _util.warn)("getHexString - ignoring additional invalid characters.");
  16838. return;
  16839. }
  16840. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  16841. return;
  16842. }
  16843. (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
  16844. }
  16845. getHexString() {
  16846. const strBuf = this.strBuf;
  16847. strBuf.length = 0;
  16848. let ch = this.currentChar;
  16849. let isFirstHex = true;
  16850. let firstDigit, secondDigit;
  16851. this._hexStringNumWarn = 0;
  16852. while (true) {
  16853. if (ch < 0) {
  16854. (0, _util.warn)("Unterminated hex string");
  16855. break;
  16856. } else if (ch === 0x3e) {
  16857. this.nextChar();
  16858. break;
  16859. } else if (specialChars[ch] === 1) {
  16860. ch = this.nextChar();
  16861. continue;
  16862. } else {
  16863. if (isFirstHex) {
  16864. firstDigit = toHexDigit(ch);
  16865. if (firstDigit === -1) {
  16866. this._hexStringWarn(ch);
  16867. ch = this.nextChar();
  16868. continue;
  16869. }
  16870. } else {
  16871. secondDigit = toHexDigit(ch);
  16872. if (secondDigit === -1) {
  16873. this._hexStringWarn(ch);
  16874. ch = this.nextChar();
  16875. continue;
  16876. }
  16877. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  16878. }
  16879. isFirstHex = !isFirstHex;
  16880. ch = this.nextChar();
  16881. }
  16882. }
  16883. return strBuf.join("");
  16884. }
  16885. getObj() {
  16886. let comment = false;
  16887. let ch = this.currentChar;
  16888. while (true) {
  16889. if (ch < 0) {
  16890. return _primitives.EOF;
  16891. }
  16892. if (comment) {
  16893. if (ch === 0x0a || ch === 0x0d) {
  16894. comment = false;
  16895. }
  16896. } else if (ch === 0x25) {
  16897. comment = true;
  16898. } else if (specialChars[ch] !== 1) {
  16899. break;
  16900. }
  16901. ch = this.nextChar();
  16902. }
  16903. switch (ch | 0) {
  16904. case 0x30:
  16905. case 0x31:
  16906. case 0x32:
  16907. case 0x33:
  16908. case 0x34:
  16909. case 0x35:
  16910. case 0x36:
  16911. case 0x37:
  16912. case 0x38:
  16913. case 0x39:
  16914. case 0x2b:
  16915. case 0x2d:
  16916. case 0x2e:
  16917. return this.getNumber();
  16918. case 0x28:
  16919. return this.getString();
  16920. case 0x2f:
  16921. return this.getName();
  16922. case 0x5b:
  16923. this.nextChar();
  16924. return _primitives.Cmd.get("[");
  16925. case 0x5d:
  16926. this.nextChar();
  16927. return _primitives.Cmd.get("]");
  16928. case 0x3c:
  16929. ch = this.nextChar();
  16930. if (ch === 0x3c) {
  16931. this.nextChar();
  16932. return _primitives.Cmd.get("<<");
  16933. }
  16934. return this.getHexString();
  16935. case 0x3e:
  16936. ch = this.nextChar();
  16937. if (ch === 0x3e) {
  16938. this.nextChar();
  16939. return _primitives.Cmd.get(">>");
  16940. }
  16941. return _primitives.Cmd.get(">");
  16942. case 0x7b:
  16943. this.nextChar();
  16944. return _primitives.Cmd.get("{");
  16945. case 0x7d:
  16946. this.nextChar();
  16947. return _primitives.Cmd.get("}");
  16948. case 0x29:
  16949. this.nextChar();
  16950. throw new _util.FormatError(`Illegal character: ${ch}`);
  16951. }
  16952. let str = String.fromCharCode(ch);
  16953. if (ch < 0x20 || ch > 0x7f) {
  16954. const nextCh = this.peekChar();
  16955. if (nextCh >= 0x20 && nextCh <= 0x7f) {
  16956. this.nextChar();
  16957. return _primitives.Cmd.get(str);
  16958. }
  16959. }
  16960. const knownCommands = this.knownCommands;
  16961. let knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  16962. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  16963. const possibleCommand = str + String.fromCharCode(ch);
  16964. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  16965. break;
  16966. }
  16967. if (str.length === 128) {
  16968. throw new _util.FormatError(`Command token too long: ${str.length}`);
  16969. }
  16970. str = possibleCommand;
  16971. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  16972. }
  16973. if (str === "true") {
  16974. return true;
  16975. }
  16976. if (str === "false") {
  16977. return false;
  16978. }
  16979. if (str === "null") {
  16980. return null;
  16981. }
  16982. if (str === "BI") {
  16983. this.beginInlineImagePos = this.stream.pos;
  16984. }
  16985. return _primitives.Cmd.get(str);
  16986. }
  16987. peekObj() {
  16988. const streamPos = this.stream.pos,
  16989. currentChar = this.currentChar,
  16990. beginInlineImagePos = this.beginInlineImagePos;
  16991. let nextObj;
  16992. try {
  16993. nextObj = this.getObj();
  16994. } catch (ex) {
  16995. if (ex instanceof _core_utils.MissingDataException) {
  16996. throw ex;
  16997. }
  16998. (0, _util.warn)(`peekObj: ${ex}`);
  16999. }
  17000. this.stream.pos = streamPos;
  17001. this.currentChar = currentChar;
  17002. this.beginInlineImagePos = beginInlineImagePos;
  17003. return nextObj;
  17004. }
  17005. skipToNextLine() {
  17006. let ch = this.currentChar;
  17007. while (ch >= 0) {
  17008. if (ch === 0x0d) {
  17009. ch = this.nextChar();
  17010. if (ch === 0x0a) {
  17011. this.nextChar();
  17012. }
  17013. break;
  17014. } else if (ch === 0x0a) {
  17015. this.nextChar();
  17016. break;
  17017. }
  17018. ch = this.nextChar();
  17019. }
  17020. }
  17021. }
  17022. exports.Lexer = Lexer;
  17023. class Linearization {
  17024. static create(stream) {
  17025. function getInt(linDict, name) {
  17026. let allowZeroValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  17027. const obj = linDict.get(name);
  17028. if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  17029. return obj;
  17030. }
  17031. throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
  17032. }
  17033. function getHints(linDict) {
  17034. const hints = linDict.get("H");
  17035. let hintsLength;
  17036. if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  17037. for (let index = 0; index < hintsLength; index++) {
  17038. const hint = hints[index];
  17039. if (!(Number.isInteger(hint) && hint > 0)) {
  17040. throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
  17041. }
  17042. }
  17043. return hints;
  17044. }
  17045. throw new Error("Hint array in the linearization dictionary is invalid.");
  17046. }
  17047. const parser = new Parser({
  17048. lexer: new Lexer(stream),
  17049. xref: null
  17050. });
  17051. const obj1 = parser.getObj();
  17052. const obj2 = parser.getObj();
  17053. const obj3 = parser.getObj();
  17054. const linDict = parser.getObj();
  17055. let obj, length;
  17056. if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && linDict instanceof _primitives.Dict && typeof (obj = linDict.get("Linearized")) === "number" && obj > 0)) {
  17057. return null;
  17058. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  17059. throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
  17060. }
  17061. return {
  17062. length,
  17063. hints: getHints(linDict),
  17064. objectNumberFirst: getInt(linDict, "O"),
  17065. endFirst: getInt(linDict, "E"),
  17066. numPages: getInt(linDict, "N"),
  17067. mainXRefEntriesOffset: getInt(linDict, "T"),
  17068. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
  17069. };
  17070. }
  17071. }
  17072. exports.Linearization = Linearization;
  17073. /***/ }),
  17074. /* 149 */
  17075. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17076. "use strict";
  17077. Object.defineProperty(exports, "__esModule", ({
  17078. value: true
  17079. }));
  17080. exports.Ascii85Stream = void 0;
  17081. var _decode_stream = __w_pdfjs_require__(150);
  17082. var _core_utils = __w_pdfjs_require__(136);
  17083. class Ascii85Stream extends _decode_stream.DecodeStream {
  17084. constructor(str, maybeLength) {
  17085. if (maybeLength) {
  17086. maybeLength *= 0.8;
  17087. }
  17088. super(maybeLength);
  17089. this.str = str;
  17090. this.dict = str.dict;
  17091. this.input = new Uint8Array(5);
  17092. }
  17093. readBlock() {
  17094. const TILDA_CHAR = 0x7e;
  17095. const Z_LOWER_CHAR = 0x7a;
  17096. const EOF = -1;
  17097. const str = this.str;
  17098. let c = str.getByte();
  17099. while ((0, _core_utils.isWhiteSpace)(c)) {
  17100. c = str.getByte();
  17101. }
  17102. if (c === EOF || c === TILDA_CHAR) {
  17103. this.eof = true;
  17104. return;
  17105. }
  17106. const bufferLength = this.bufferLength;
  17107. let buffer, i;
  17108. if (c === Z_LOWER_CHAR) {
  17109. buffer = this.ensureBuffer(bufferLength + 4);
  17110. for (i = 0; i < 4; ++i) {
  17111. buffer[bufferLength + i] = 0;
  17112. }
  17113. this.bufferLength += 4;
  17114. } else {
  17115. const input = this.input;
  17116. input[0] = c;
  17117. for (i = 1; i < 5; ++i) {
  17118. c = str.getByte();
  17119. while ((0, _core_utils.isWhiteSpace)(c)) {
  17120. c = str.getByte();
  17121. }
  17122. input[i] = c;
  17123. if (c === EOF || c === TILDA_CHAR) {
  17124. break;
  17125. }
  17126. }
  17127. buffer = this.ensureBuffer(bufferLength + i - 1);
  17128. this.bufferLength += i - 1;
  17129. if (i < 5) {
  17130. for (; i < 5; ++i) {
  17131. input[i] = 0x21 + 84;
  17132. }
  17133. this.eof = true;
  17134. }
  17135. let t = 0;
  17136. for (i = 0; i < 5; ++i) {
  17137. t = t * 85 + (input[i] - 0x21);
  17138. }
  17139. for (i = 3; i >= 0; --i) {
  17140. buffer[bufferLength + i] = t & 0xff;
  17141. t >>= 8;
  17142. }
  17143. }
  17144. }
  17145. }
  17146. exports.Ascii85Stream = Ascii85Stream;
  17147. /***/ }),
  17148. /* 150 */
  17149. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17150. "use strict";
  17151. Object.defineProperty(exports, "__esModule", ({
  17152. value: true
  17153. }));
  17154. exports.StreamsSequenceStream = exports.DecodeStream = void 0;
  17155. var _base_stream = __w_pdfjs_require__(138);
  17156. var _stream = __w_pdfjs_require__(141);
  17157. const emptyBuffer = new Uint8Array(0);
  17158. class DecodeStream extends _base_stream.BaseStream {
  17159. constructor(maybeMinBufferLength) {
  17160. super();
  17161. this._rawMinBufferLength = maybeMinBufferLength || 0;
  17162. this.pos = 0;
  17163. this.bufferLength = 0;
  17164. this.eof = false;
  17165. this.buffer = emptyBuffer;
  17166. this.minBufferLength = 512;
  17167. if (maybeMinBufferLength) {
  17168. while (this.minBufferLength < maybeMinBufferLength) {
  17169. this.minBufferLength *= 2;
  17170. }
  17171. }
  17172. }
  17173. get isEmpty() {
  17174. while (!this.eof && this.bufferLength === 0) {
  17175. this.readBlock();
  17176. }
  17177. return this.bufferLength === 0;
  17178. }
  17179. ensureBuffer(requested) {
  17180. const buffer = this.buffer;
  17181. if (requested <= buffer.byteLength) {
  17182. return buffer;
  17183. }
  17184. let size = this.minBufferLength;
  17185. while (size < requested) {
  17186. size *= 2;
  17187. }
  17188. const buffer2 = new Uint8Array(size);
  17189. buffer2.set(buffer);
  17190. return this.buffer = buffer2;
  17191. }
  17192. getByte() {
  17193. const pos = this.pos;
  17194. while (this.bufferLength <= pos) {
  17195. if (this.eof) {
  17196. return -1;
  17197. }
  17198. this.readBlock();
  17199. }
  17200. return this.buffer[this.pos++];
  17201. }
  17202. getBytes(length) {
  17203. const pos = this.pos;
  17204. let end;
  17205. if (length) {
  17206. this.ensureBuffer(pos + length);
  17207. end = pos + length;
  17208. while (!this.eof && this.bufferLength < end) {
  17209. this.readBlock();
  17210. }
  17211. const bufEnd = this.bufferLength;
  17212. if (end > bufEnd) {
  17213. end = bufEnd;
  17214. }
  17215. } else {
  17216. while (!this.eof) {
  17217. this.readBlock();
  17218. }
  17219. end = this.bufferLength;
  17220. }
  17221. this.pos = end;
  17222. return this.buffer.subarray(pos, end);
  17223. }
  17224. reset() {
  17225. this.pos = 0;
  17226. }
  17227. makeSubStream(start, length) {
  17228. let dict = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  17229. if (length === undefined) {
  17230. while (!this.eof) {
  17231. this.readBlock();
  17232. }
  17233. } else {
  17234. const end = start + length;
  17235. while (this.bufferLength <= end && !this.eof) {
  17236. this.readBlock();
  17237. }
  17238. }
  17239. return new _stream.Stream(this.buffer, start, length, dict);
  17240. }
  17241. getBaseStreams() {
  17242. return this.str ? this.str.getBaseStreams() : null;
  17243. }
  17244. }
  17245. exports.DecodeStream = DecodeStream;
  17246. class StreamsSequenceStream extends DecodeStream {
  17247. constructor(streams) {
  17248. let onError = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  17249. let maybeLength = 0;
  17250. for (const stream of streams) {
  17251. maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length;
  17252. }
  17253. super(maybeLength);
  17254. this.streams = streams;
  17255. this._onError = onError;
  17256. }
  17257. readBlock() {
  17258. const streams = this.streams;
  17259. if (streams.length === 0) {
  17260. this.eof = true;
  17261. return;
  17262. }
  17263. const stream = streams.shift();
  17264. let chunk;
  17265. try {
  17266. chunk = stream.getBytes();
  17267. } catch (reason) {
  17268. if (this._onError) {
  17269. this._onError(reason, stream.dict && stream.dict.objId);
  17270. return;
  17271. }
  17272. throw reason;
  17273. }
  17274. const bufferLength = this.bufferLength;
  17275. const newLength = bufferLength + chunk.length;
  17276. const buffer = this.ensureBuffer(newLength);
  17277. buffer.set(chunk, bufferLength);
  17278. this.bufferLength = newLength;
  17279. }
  17280. getBaseStreams() {
  17281. const baseStreamsBuf = [];
  17282. for (const stream of this.streams) {
  17283. const baseStreams = stream.getBaseStreams();
  17284. if (baseStreams) {
  17285. baseStreamsBuf.push(...baseStreams);
  17286. }
  17287. }
  17288. return baseStreamsBuf.length > 0 ? baseStreamsBuf : null;
  17289. }
  17290. }
  17291. exports.StreamsSequenceStream = StreamsSequenceStream;
  17292. /***/ }),
  17293. /* 151 */
  17294. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17295. "use strict";
  17296. Object.defineProperty(exports, "__esModule", ({
  17297. value: true
  17298. }));
  17299. exports.AsciiHexStream = void 0;
  17300. var _decode_stream = __w_pdfjs_require__(150);
  17301. class AsciiHexStream extends _decode_stream.DecodeStream {
  17302. constructor(str, maybeLength) {
  17303. if (maybeLength) {
  17304. maybeLength *= 0.5;
  17305. }
  17306. super(maybeLength);
  17307. this.str = str;
  17308. this.dict = str.dict;
  17309. this.firstDigit = -1;
  17310. }
  17311. readBlock() {
  17312. const UPSTREAM_BLOCK_SIZE = 8000;
  17313. const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  17314. if (!bytes.length) {
  17315. this.eof = true;
  17316. return;
  17317. }
  17318. const maxDecodeLength = bytes.length + 1 >> 1;
  17319. const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  17320. let bufferLength = this.bufferLength;
  17321. let firstDigit = this.firstDigit;
  17322. for (const ch of bytes) {
  17323. let digit;
  17324. if (ch >= 0x30 && ch <= 0x39) {
  17325. digit = ch & 0x0f;
  17326. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  17327. digit = (ch & 0x0f) + 9;
  17328. } else if (ch === 0x3e) {
  17329. this.eof = true;
  17330. break;
  17331. } else {
  17332. continue;
  17333. }
  17334. if (firstDigit < 0) {
  17335. firstDigit = digit;
  17336. } else {
  17337. buffer[bufferLength++] = firstDigit << 4 | digit;
  17338. firstDigit = -1;
  17339. }
  17340. }
  17341. if (firstDigit >= 0 && this.eof) {
  17342. buffer[bufferLength++] = firstDigit << 4;
  17343. firstDigit = -1;
  17344. }
  17345. this.firstDigit = firstDigit;
  17346. this.bufferLength = bufferLength;
  17347. }
  17348. }
  17349. exports.AsciiHexStream = AsciiHexStream;
  17350. /***/ }),
  17351. /* 152 */
  17352. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17353. "use strict";
  17354. Object.defineProperty(exports, "__esModule", ({
  17355. value: true
  17356. }));
  17357. exports.CCITTFaxStream = void 0;
  17358. var _ccitt = __w_pdfjs_require__(153);
  17359. var _decode_stream = __w_pdfjs_require__(150);
  17360. var _primitives = __w_pdfjs_require__(137);
  17361. class CCITTFaxStream extends _decode_stream.DecodeStream {
  17362. constructor(str, maybeLength, params) {
  17363. super(maybeLength);
  17364. this.str = str;
  17365. this.dict = str.dict;
  17366. if (!(params instanceof _primitives.Dict)) {
  17367. params = _primitives.Dict.empty;
  17368. }
  17369. const source = {
  17370. next() {
  17371. return str.getByte();
  17372. }
  17373. };
  17374. this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
  17375. K: params.get("K"),
  17376. EndOfLine: params.get("EndOfLine"),
  17377. EncodedByteAlign: params.get("EncodedByteAlign"),
  17378. Columns: params.get("Columns"),
  17379. Rows: params.get("Rows"),
  17380. EndOfBlock: params.get("EndOfBlock"),
  17381. BlackIs1: params.get("BlackIs1")
  17382. });
  17383. }
  17384. readBlock() {
  17385. while (!this.eof) {
  17386. const c = this.ccittFaxDecoder.readNextChar();
  17387. if (c === -1) {
  17388. this.eof = true;
  17389. return;
  17390. }
  17391. this.ensureBuffer(this.bufferLength + 1);
  17392. this.buffer[this.bufferLength++] = c;
  17393. }
  17394. }
  17395. }
  17396. exports.CCITTFaxStream = CCITTFaxStream;
  17397. /***/ }),
  17398. /* 153 */
  17399. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17400. "use strict";
  17401. Object.defineProperty(exports, "__esModule", ({
  17402. value: true
  17403. }));
  17404. exports.CCITTFaxDecoder = void 0;
  17405. var _util = __w_pdfjs_require__(2);
  17406. const ccittEOL = -2;
  17407. const ccittEOF = -1;
  17408. const twoDimPass = 0;
  17409. const twoDimHoriz = 1;
  17410. const twoDimVert0 = 2;
  17411. const twoDimVertR1 = 3;
  17412. const twoDimVertL1 = 4;
  17413. const twoDimVertR2 = 5;
  17414. const twoDimVertL2 = 6;
  17415. const twoDimVertR3 = 7;
  17416. const twoDimVertL3 = 8;
  17417. 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]];
  17418. 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]];
  17419. 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]];
  17420. 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]];
  17421. 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]];
  17422. 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]];
  17423. class CCITTFaxDecoder {
  17424. constructor(source) {
  17425. let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  17426. if (!source || typeof source.next !== "function") {
  17427. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  17428. }
  17429. this.source = source;
  17430. this.eof = false;
  17431. this.encoding = options.K || 0;
  17432. this.eoline = options.EndOfLine || false;
  17433. this.byteAlign = options.EncodedByteAlign || false;
  17434. this.columns = options.Columns || 1728;
  17435. this.rows = options.Rows || 0;
  17436. let eoblock = options.EndOfBlock;
  17437. if (eoblock === null || eoblock === undefined) {
  17438. eoblock = true;
  17439. }
  17440. this.eoblock = eoblock;
  17441. this.black = options.BlackIs1 || false;
  17442. this.codingLine = new Uint32Array(this.columns + 1);
  17443. this.refLine = new Uint32Array(this.columns + 2);
  17444. this.codingLine[0] = this.columns;
  17445. this.codingPos = 0;
  17446. this.row = 0;
  17447. this.nextLine2D = this.encoding < 0;
  17448. this.inputBits = 0;
  17449. this.inputBuf = 0;
  17450. this.outputBits = 0;
  17451. this.rowsDone = false;
  17452. let code1;
  17453. while ((code1 = this._lookBits(12)) === 0) {
  17454. this._eatBits(1);
  17455. }
  17456. if (code1 === 1) {
  17457. this._eatBits(12);
  17458. }
  17459. if (this.encoding > 0) {
  17460. this.nextLine2D = !this._lookBits(1);
  17461. this._eatBits(1);
  17462. }
  17463. }
  17464. readNextChar() {
  17465. if (this.eof) {
  17466. return -1;
  17467. }
  17468. const refLine = this.refLine;
  17469. const codingLine = this.codingLine;
  17470. const columns = this.columns;
  17471. let refPos, blackPixels, bits, i;
  17472. if (this.outputBits === 0) {
  17473. if (this.rowsDone) {
  17474. this.eof = true;
  17475. }
  17476. if (this.eof) {
  17477. return -1;
  17478. }
  17479. this.err = false;
  17480. let code1, code2, code3;
  17481. if (this.nextLine2D) {
  17482. for (i = 0; codingLine[i] < columns; ++i) {
  17483. refLine[i] = codingLine[i];
  17484. }
  17485. refLine[i++] = columns;
  17486. refLine[i] = columns;
  17487. codingLine[0] = 0;
  17488. this.codingPos = 0;
  17489. refPos = 0;
  17490. blackPixels = 0;
  17491. while (codingLine[this.codingPos] < columns) {
  17492. code1 = this._getTwoDimCode();
  17493. switch (code1) {
  17494. case twoDimPass:
  17495. this._addPixels(refLine[refPos + 1], blackPixels);
  17496. if (refLine[refPos + 1] < columns) {
  17497. refPos += 2;
  17498. }
  17499. break;
  17500. case twoDimHoriz:
  17501. code1 = code2 = 0;
  17502. if (blackPixels) {
  17503. do {
  17504. code1 += code3 = this._getBlackCode();
  17505. } while (code3 >= 64);
  17506. do {
  17507. code2 += code3 = this._getWhiteCode();
  17508. } while (code3 >= 64);
  17509. } else {
  17510. do {
  17511. code1 += code3 = this._getWhiteCode();
  17512. } while (code3 >= 64);
  17513. do {
  17514. code2 += code3 = this._getBlackCode();
  17515. } while (code3 >= 64);
  17516. }
  17517. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  17518. if (codingLine[this.codingPos] < columns) {
  17519. this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  17520. }
  17521. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17522. refPos += 2;
  17523. }
  17524. break;
  17525. case twoDimVertR3:
  17526. this._addPixels(refLine[refPos] + 3, blackPixels);
  17527. blackPixels ^= 1;
  17528. if (codingLine[this.codingPos] < columns) {
  17529. ++refPos;
  17530. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17531. refPos += 2;
  17532. }
  17533. }
  17534. break;
  17535. case twoDimVertR2:
  17536. this._addPixels(refLine[refPos] + 2, blackPixels);
  17537. blackPixels ^= 1;
  17538. if (codingLine[this.codingPos] < columns) {
  17539. ++refPos;
  17540. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17541. refPos += 2;
  17542. }
  17543. }
  17544. break;
  17545. case twoDimVertR1:
  17546. this._addPixels(refLine[refPos] + 1, blackPixels);
  17547. blackPixels ^= 1;
  17548. if (codingLine[this.codingPos] < columns) {
  17549. ++refPos;
  17550. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17551. refPos += 2;
  17552. }
  17553. }
  17554. break;
  17555. case twoDimVert0:
  17556. this._addPixels(refLine[refPos], blackPixels);
  17557. blackPixels ^= 1;
  17558. if (codingLine[this.codingPos] < columns) {
  17559. ++refPos;
  17560. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17561. refPos += 2;
  17562. }
  17563. }
  17564. break;
  17565. case twoDimVertL3:
  17566. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  17567. blackPixels ^= 1;
  17568. if (codingLine[this.codingPos] < columns) {
  17569. if (refPos > 0) {
  17570. --refPos;
  17571. } else {
  17572. ++refPos;
  17573. }
  17574. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17575. refPos += 2;
  17576. }
  17577. }
  17578. break;
  17579. case twoDimVertL2:
  17580. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  17581. blackPixels ^= 1;
  17582. if (codingLine[this.codingPos] < columns) {
  17583. if (refPos > 0) {
  17584. --refPos;
  17585. } else {
  17586. ++refPos;
  17587. }
  17588. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17589. refPos += 2;
  17590. }
  17591. }
  17592. break;
  17593. case twoDimVertL1:
  17594. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  17595. blackPixels ^= 1;
  17596. if (codingLine[this.codingPos] < columns) {
  17597. if (refPos > 0) {
  17598. --refPos;
  17599. } else {
  17600. ++refPos;
  17601. }
  17602. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17603. refPos += 2;
  17604. }
  17605. }
  17606. break;
  17607. case ccittEOF:
  17608. this._addPixels(columns, 0);
  17609. this.eof = true;
  17610. break;
  17611. default:
  17612. (0, _util.info)("bad 2d code");
  17613. this._addPixels(columns, 0);
  17614. this.err = true;
  17615. }
  17616. }
  17617. } else {
  17618. codingLine[0] = 0;
  17619. this.codingPos = 0;
  17620. blackPixels = 0;
  17621. while (codingLine[this.codingPos] < columns) {
  17622. code1 = 0;
  17623. if (blackPixels) {
  17624. do {
  17625. code1 += code3 = this._getBlackCode();
  17626. } while (code3 >= 64);
  17627. } else {
  17628. do {
  17629. code1 += code3 = this._getWhiteCode();
  17630. } while (code3 >= 64);
  17631. }
  17632. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  17633. blackPixels ^= 1;
  17634. }
  17635. }
  17636. let gotEOL = false;
  17637. if (this.byteAlign) {
  17638. this.inputBits &= ~7;
  17639. }
  17640. if (!this.eoblock && this.row === this.rows - 1) {
  17641. this.rowsDone = true;
  17642. } else {
  17643. code1 = this._lookBits(12);
  17644. if (this.eoline) {
  17645. while (code1 !== ccittEOF && code1 !== 1) {
  17646. this._eatBits(1);
  17647. code1 = this._lookBits(12);
  17648. }
  17649. } else {
  17650. while (code1 === 0) {
  17651. this._eatBits(1);
  17652. code1 = this._lookBits(12);
  17653. }
  17654. }
  17655. if (code1 === 1) {
  17656. this._eatBits(12);
  17657. gotEOL = true;
  17658. } else if (code1 === ccittEOF) {
  17659. this.eof = true;
  17660. }
  17661. }
  17662. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  17663. this.nextLine2D = !this._lookBits(1);
  17664. this._eatBits(1);
  17665. }
  17666. if (this.eoblock && gotEOL && this.byteAlign) {
  17667. code1 = this._lookBits(12);
  17668. if (code1 === 1) {
  17669. this._eatBits(12);
  17670. if (this.encoding > 0) {
  17671. this._lookBits(1);
  17672. this._eatBits(1);
  17673. }
  17674. if (this.encoding >= 0) {
  17675. for (i = 0; i < 4; ++i) {
  17676. code1 = this._lookBits(12);
  17677. if (code1 !== 1) {
  17678. (0, _util.info)("bad rtc code: " + code1);
  17679. }
  17680. this._eatBits(12);
  17681. if (this.encoding > 0) {
  17682. this._lookBits(1);
  17683. this._eatBits(1);
  17684. }
  17685. }
  17686. }
  17687. this.eof = true;
  17688. }
  17689. } else if (this.err && this.eoline) {
  17690. while (true) {
  17691. code1 = this._lookBits(13);
  17692. if (code1 === ccittEOF) {
  17693. this.eof = true;
  17694. return -1;
  17695. }
  17696. if (code1 >> 1 === 1) {
  17697. break;
  17698. }
  17699. this._eatBits(1);
  17700. }
  17701. this._eatBits(12);
  17702. if (this.encoding > 0) {
  17703. this._eatBits(1);
  17704. this.nextLine2D = !(code1 & 1);
  17705. }
  17706. }
  17707. if (codingLine[0] > 0) {
  17708. this.outputBits = codingLine[this.codingPos = 0];
  17709. } else {
  17710. this.outputBits = codingLine[this.codingPos = 1];
  17711. }
  17712. this.row++;
  17713. }
  17714. let c;
  17715. if (this.outputBits >= 8) {
  17716. c = this.codingPos & 1 ? 0 : 0xff;
  17717. this.outputBits -= 8;
  17718. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  17719. this.codingPos++;
  17720. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  17721. }
  17722. } else {
  17723. bits = 8;
  17724. c = 0;
  17725. do {
  17726. if (typeof this.outputBits !== "number") {
  17727. throw new _util.FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.');
  17728. }
  17729. if (this.outputBits > bits) {
  17730. c <<= bits;
  17731. if (!(this.codingPos & 1)) {
  17732. c |= 0xff >> 8 - bits;
  17733. }
  17734. this.outputBits -= bits;
  17735. bits = 0;
  17736. } else {
  17737. c <<= this.outputBits;
  17738. if (!(this.codingPos & 1)) {
  17739. c |= 0xff >> 8 - this.outputBits;
  17740. }
  17741. bits -= this.outputBits;
  17742. this.outputBits = 0;
  17743. if (codingLine[this.codingPos] < columns) {
  17744. this.codingPos++;
  17745. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  17746. } else if (bits > 0) {
  17747. c <<= bits;
  17748. bits = 0;
  17749. }
  17750. }
  17751. } while (bits);
  17752. }
  17753. if (this.black) {
  17754. c ^= 0xff;
  17755. }
  17756. return c;
  17757. }
  17758. _addPixels(a1, blackPixels) {
  17759. const codingLine = this.codingLine;
  17760. let codingPos = this.codingPos;
  17761. if (a1 > codingLine[codingPos]) {
  17762. if (a1 > this.columns) {
  17763. (0, _util.info)("row is wrong length");
  17764. this.err = true;
  17765. a1 = this.columns;
  17766. }
  17767. if (codingPos & 1 ^ blackPixels) {
  17768. ++codingPos;
  17769. }
  17770. codingLine[codingPos] = a1;
  17771. }
  17772. this.codingPos = codingPos;
  17773. }
  17774. _addPixelsNeg(a1, blackPixels) {
  17775. const codingLine = this.codingLine;
  17776. let codingPos = this.codingPos;
  17777. if (a1 > codingLine[codingPos]) {
  17778. if (a1 > this.columns) {
  17779. (0, _util.info)("row is wrong length");
  17780. this.err = true;
  17781. a1 = this.columns;
  17782. }
  17783. if (codingPos & 1 ^ blackPixels) {
  17784. ++codingPos;
  17785. }
  17786. codingLine[codingPos] = a1;
  17787. } else if (a1 < codingLine[codingPos]) {
  17788. if (a1 < 0) {
  17789. (0, _util.info)("invalid code");
  17790. this.err = true;
  17791. a1 = 0;
  17792. }
  17793. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  17794. --codingPos;
  17795. }
  17796. codingLine[codingPos] = a1;
  17797. }
  17798. this.codingPos = codingPos;
  17799. }
  17800. _findTableCode(start, end, table, limit) {
  17801. const limitValue = limit || 0;
  17802. for (let i = start; i <= end; ++i) {
  17803. let code = this._lookBits(i);
  17804. if (code === ccittEOF) {
  17805. return [true, 1, false];
  17806. }
  17807. if (i < end) {
  17808. code <<= end - i;
  17809. }
  17810. if (!limitValue || code >= limitValue) {
  17811. const p = table[code - limitValue];
  17812. if (p[0] === i) {
  17813. this._eatBits(i);
  17814. return [true, p[1], true];
  17815. }
  17816. }
  17817. }
  17818. return [false, 0, false];
  17819. }
  17820. _getTwoDimCode() {
  17821. let code = 0;
  17822. let p;
  17823. if (this.eoblock) {
  17824. code = this._lookBits(7);
  17825. p = twoDimTable[code];
  17826. if (p && p[0] > 0) {
  17827. this._eatBits(p[0]);
  17828. return p[1];
  17829. }
  17830. } else {
  17831. const result = this._findTableCode(1, 7, twoDimTable);
  17832. if (result[0] && result[2]) {
  17833. return result[1];
  17834. }
  17835. }
  17836. (0, _util.info)("Bad two dim code");
  17837. return ccittEOF;
  17838. }
  17839. _getWhiteCode() {
  17840. let code = 0;
  17841. let p;
  17842. if (this.eoblock) {
  17843. code = this._lookBits(12);
  17844. if (code === ccittEOF) {
  17845. return 1;
  17846. }
  17847. if (code >> 5 === 0) {
  17848. p = whiteTable1[code];
  17849. } else {
  17850. p = whiteTable2[code >> 3];
  17851. }
  17852. if (p[0] > 0) {
  17853. this._eatBits(p[0]);
  17854. return p[1];
  17855. }
  17856. } else {
  17857. let result = this._findTableCode(1, 9, whiteTable2);
  17858. if (result[0]) {
  17859. return result[1];
  17860. }
  17861. result = this._findTableCode(11, 12, whiteTable1);
  17862. if (result[0]) {
  17863. return result[1];
  17864. }
  17865. }
  17866. (0, _util.info)("bad white code");
  17867. this._eatBits(1);
  17868. return 1;
  17869. }
  17870. _getBlackCode() {
  17871. let code, p;
  17872. if (this.eoblock) {
  17873. code = this._lookBits(13);
  17874. if (code === ccittEOF) {
  17875. return 1;
  17876. }
  17877. if (code >> 7 === 0) {
  17878. p = blackTable1[code];
  17879. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  17880. p = blackTable2[(code >> 1) - 64];
  17881. } else {
  17882. p = blackTable3[code >> 7];
  17883. }
  17884. if (p[0] > 0) {
  17885. this._eatBits(p[0]);
  17886. return p[1];
  17887. }
  17888. } else {
  17889. let result = this._findTableCode(2, 6, blackTable3);
  17890. if (result[0]) {
  17891. return result[1];
  17892. }
  17893. result = this._findTableCode(7, 12, blackTable2, 64);
  17894. if (result[0]) {
  17895. return result[1];
  17896. }
  17897. result = this._findTableCode(10, 13, blackTable1);
  17898. if (result[0]) {
  17899. return result[1];
  17900. }
  17901. }
  17902. (0, _util.info)("bad black code");
  17903. this._eatBits(1);
  17904. return 1;
  17905. }
  17906. _lookBits(n) {
  17907. let c;
  17908. while (this.inputBits < n) {
  17909. if ((c = this.source.next()) === -1) {
  17910. if (this.inputBits === 0) {
  17911. return ccittEOF;
  17912. }
  17913. return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
  17914. }
  17915. this.inputBuf = this.inputBuf << 8 | c;
  17916. this.inputBits += 8;
  17917. }
  17918. return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
  17919. }
  17920. _eatBits(n) {
  17921. if ((this.inputBits -= n) < 0) {
  17922. this.inputBits = 0;
  17923. }
  17924. }
  17925. }
  17926. exports.CCITTFaxDecoder = CCITTFaxDecoder;
  17927. /***/ }),
  17928. /* 154 */
  17929. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17930. "use strict";
  17931. Object.defineProperty(exports, "__esModule", ({
  17932. value: true
  17933. }));
  17934. exports.FlateStream = void 0;
  17935. var _decode_stream = __w_pdfjs_require__(150);
  17936. var _util = __w_pdfjs_require__(2);
  17937. const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  17938. 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]);
  17939. 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]);
  17940. 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];
  17941. 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];
  17942. class FlateStream extends _decode_stream.DecodeStream {
  17943. constructor(str, maybeLength) {
  17944. super(maybeLength);
  17945. this.str = str;
  17946. this.dict = str.dict;
  17947. const cmf = str.getByte();
  17948. const flg = str.getByte();
  17949. if (cmf === -1 || flg === -1) {
  17950. throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
  17951. }
  17952. if ((cmf & 0x0f) !== 0x08) {
  17953. throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
  17954. }
  17955. if (((cmf << 8) + flg) % 31 !== 0) {
  17956. throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
  17957. }
  17958. if (flg & 0x20) {
  17959. throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
  17960. }
  17961. this.codeSize = 0;
  17962. this.codeBuf = 0;
  17963. }
  17964. getBits(bits) {
  17965. const str = this.str;
  17966. let codeSize = this.codeSize;
  17967. let codeBuf = this.codeBuf;
  17968. let b;
  17969. while (codeSize < bits) {
  17970. if ((b = str.getByte()) === -1) {
  17971. throw new _util.FormatError("Bad encoding in flate stream");
  17972. }
  17973. codeBuf |= b << codeSize;
  17974. codeSize += 8;
  17975. }
  17976. b = codeBuf & (1 << bits) - 1;
  17977. this.codeBuf = codeBuf >> bits;
  17978. this.codeSize = codeSize -= bits;
  17979. return b;
  17980. }
  17981. getCode(table) {
  17982. const str = this.str;
  17983. const codes = table[0];
  17984. const maxLen = table[1];
  17985. let codeSize = this.codeSize;
  17986. let codeBuf = this.codeBuf;
  17987. let b;
  17988. while (codeSize < maxLen) {
  17989. if ((b = str.getByte()) === -1) {
  17990. break;
  17991. }
  17992. codeBuf |= b << codeSize;
  17993. codeSize += 8;
  17994. }
  17995. const code = codes[codeBuf & (1 << maxLen) - 1];
  17996. const codeLen = code >> 16;
  17997. const codeVal = code & 0xffff;
  17998. if (codeLen < 1 || codeSize < codeLen) {
  17999. throw new _util.FormatError("Bad encoding in flate stream");
  18000. }
  18001. this.codeBuf = codeBuf >> codeLen;
  18002. this.codeSize = codeSize - codeLen;
  18003. return codeVal;
  18004. }
  18005. generateHuffmanTable(lengths) {
  18006. const n = lengths.length;
  18007. let maxLen = 0;
  18008. let i;
  18009. for (i = 0; i < n; ++i) {
  18010. if (lengths[i] > maxLen) {
  18011. maxLen = lengths[i];
  18012. }
  18013. }
  18014. const size = 1 << maxLen;
  18015. const codes = new Int32Array(size);
  18016. for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  18017. for (let val = 0; val < n; ++val) {
  18018. if (lengths[val] === len) {
  18019. let code2 = 0;
  18020. let t = code;
  18021. for (i = 0; i < len; ++i) {
  18022. code2 = code2 << 1 | t & 1;
  18023. t >>= 1;
  18024. }
  18025. for (i = code2; i < size; i += skip) {
  18026. codes[i] = len << 16 | val;
  18027. }
  18028. ++code;
  18029. }
  18030. }
  18031. }
  18032. return [codes, maxLen];
  18033. }
  18034. readBlock() {
  18035. let buffer, len;
  18036. const str = this.str;
  18037. let hdr = this.getBits(3);
  18038. if (hdr & 1) {
  18039. this.eof = true;
  18040. }
  18041. hdr >>= 1;
  18042. if (hdr === 0) {
  18043. let b;
  18044. if ((b = str.getByte()) === -1) {
  18045. throw new _util.FormatError("Bad block header in flate stream");
  18046. }
  18047. let blockLen = b;
  18048. if ((b = str.getByte()) === -1) {
  18049. throw new _util.FormatError("Bad block header in flate stream");
  18050. }
  18051. blockLen |= b << 8;
  18052. if ((b = str.getByte()) === -1) {
  18053. throw new _util.FormatError("Bad block header in flate stream");
  18054. }
  18055. let check = b;
  18056. if ((b = str.getByte()) === -1) {
  18057. throw new _util.FormatError("Bad block header in flate stream");
  18058. }
  18059. check |= b << 8;
  18060. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  18061. throw new _util.FormatError("Bad uncompressed block length in flate stream");
  18062. }
  18063. this.codeBuf = 0;
  18064. this.codeSize = 0;
  18065. const bufferLength = this.bufferLength,
  18066. end = bufferLength + blockLen;
  18067. buffer = this.ensureBuffer(end);
  18068. this.bufferLength = end;
  18069. if (blockLen === 0) {
  18070. if (str.peekByte() === -1) {
  18071. this.eof = true;
  18072. }
  18073. } else {
  18074. const block = str.getBytes(blockLen);
  18075. buffer.set(block, bufferLength);
  18076. if (block.length < blockLen) {
  18077. this.eof = true;
  18078. }
  18079. }
  18080. return;
  18081. }
  18082. let litCodeTable;
  18083. let distCodeTable;
  18084. if (hdr === 1) {
  18085. litCodeTable = fixedLitCodeTab;
  18086. distCodeTable = fixedDistCodeTab;
  18087. } else if (hdr === 2) {
  18088. const numLitCodes = this.getBits(5) + 257;
  18089. const numDistCodes = this.getBits(5) + 1;
  18090. const numCodeLenCodes = this.getBits(4) + 4;
  18091. const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  18092. let i;
  18093. for (i = 0; i < numCodeLenCodes; ++i) {
  18094. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  18095. }
  18096. const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  18097. len = 0;
  18098. i = 0;
  18099. const codes = numLitCodes + numDistCodes;
  18100. const codeLengths = new Uint8Array(codes);
  18101. let bitsLength, bitsOffset, what;
  18102. while (i < codes) {
  18103. const code = this.getCode(codeLenCodeTab);
  18104. if (code === 16) {
  18105. bitsLength = 2;
  18106. bitsOffset = 3;
  18107. what = len;
  18108. } else if (code === 17) {
  18109. bitsLength = 3;
  18110. bitsOffset = 3;
  18111. what = len = 0;
  18112. } else if (code === 18) {
  18113. bitsLength = 7;
  18114. bitsOffset = 11;
  18115. what = len = 0;
  18116. } else {
  18117. codeLengths[i++] = len = code;
  18118. continue;
  18119. }
  18120. let repeatLength = this.getBits(bitsLength) + bitsOffset;
  18121. while (repeatLength-- > 0) {
  18122. codeLengths[i++] = what;
  18123. }
  18124. }
  18125. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  18126. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  18127. } else {
  18128. throw new _util.FormatError("Unknown block type in flate stream");
  18129. }
  18130. buffer = this.buffer;
  18131. let limit = buffer ? buffer.length : 0;
  18132. let pos = this.bufferLength;
  18133. while (true) {
  18134. let code1 = this.getCode(litCodeTable);
  18135. if (code1 < 256) {
  18136. if (pos + 1 >= limit) {
  18137. buffer = this.ensureBuffer(pos + 1);
  18138. limit = buffer.length;
  18139. }
  18140. buffer[pos++] = code1;
  18141. continue;
  18142. }
  18143. if (code1 === 256) {
  18144. this.bufferLength = pos;
  18145. return;
  18146. }
  18147. code1 -= 257;
  18148. code1 = lengthDecode[code1];
  18149. let code2 = code1 >> 16;
  18150. if (code2 > 0) {
  18151. code2 = this.getBits(code2);
  18152. }
  18153. len = (code1 & 0xffff) + code2;
  18154. code1 = this.getCode(distCodeTable);
  18155. code1 = distDecode[code1];
  18156. code2 = code1 >> 16;
  18157. if (code2 > 0) {
  18158. code2 = this.getBits(code2);
  18159. }
  18160. const dist = (code1 & 0xffff) + code2;
  18161. if (pos + len >= limit) {
  18162. buffer = this.ensureBuffer(pos + len);
  18163. limit = buffer.length;
  18164. }
  18165. for (let k = 0; k < len; ++k, ++pos) {
  18166. buffer[pos] = buffer[pos - dist];
  18167. }
  18168. }
  18169. }
  18170. }
  18171. exports.FlateStream = FlateStream;
  18172. /***/ }),
  18173. /* 155 */
  18174. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18175. "use strict";
  18176. Object.defineProperty(exports, "__esModule", ({
  18177. value: true
  18178. }));
  18179. exports.Jbig2Stream = void 0;
  18180. var _base_stream = __w_pdfjs_require__(138);
  18181. var _decode_stream = __w_pdfjs_require__(150);
  18182. var _primitives = __w_pdfjs_require__(137);
  18183. var _jbig = __w_pdfjs_require__(156);
  18184. var _util = __w_pdfjs_require__(2);
  18185. class Jbig2Stream extends _decode_stream.DecodeStream {
  18186. constructor(stream, maybeLength, params) {
  18187. super(maybeLength);
  18188. this.stream = stream;
  18189. this.dict = stream.dict;
  18190. this.maybeLength = maybeLength;
  18191. this.params = params;
  18192. }
  18193. get bytes() {
  18194. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  18195. }
  18196. ensureBuffer(requested) {}
  18197. readBlock() {
  18198. if (this.eof) {
  18199. return;
  18200. }
  18201. const jbig2Image = new _jbig.Jbig2Image();
  18202. const chunks = [];
  18203. if (this.params instanceof _primitives.Dict) {
  18204. const globalsStream = this.params.get("JBIG2Globals");
  18205. if (globalsStream instanceof _base_stream.BaseStream) {
  18206. const globals = globalsStream.getBytes();
  18207. chunks.push({
  18208. data: globals,
  18209. start: 0,
  18210. end: globals.length
  18211. });
  18212. }
  18213. }
  18214. chunks.push({
  18215. data: this.bytes,
  18216. start: 0,
  18217. end: this.bytes.length
  18218. });
  18219. const data = jbig2Image.parseChunks(chunks);
  18220. const dataLength = data.length;
  18221. for (let i = 0; i < dataLength; i++) {
  18222. data[i] ^= 0xff;
  18223. }
  18224. this.buffer = data;
  18225. this.bufferLength = dataLength;
  18226. this.eof = true;
  18227. }
  18228. }
  18229. exports.Jbig2Stream = Jbig2Stream;
  18230. /***/ }),
  18231. /* 156 */
  18232. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18233. "use strict";
  18234. Object.defineProperty(exports, "__esModule", ({
  18235. value: true
  18236. }));
  18237. exports.Jbig2Image = void 0;
  18238. var _util = __w_pdfjs_require__(2);
  18239. var _core_utils = __w_pdfjs_require__(136);
  18240. var _arithmetic_decoder = __w_pdfjs_require__(157);
  18241. var _ccitt = __w_pdfjs_require__(153);
  18242. class Jbig2Error extends _util.BaseException {
  18243. constructor(msg) {
  18244. super(`JBIG2 error: ${msg}`, "Jbig2Error");
  18245. }
  18246. }
  18247. class ContextCache {
  18248. getContexts(id) {
  18249. if (id in this) {
  18250. return this[id];
  18251. }
  18252. return this[id] = new Int8Array(1 << 16);
  18253. }
  18254. }
  18255. class DecodingContext {
  18256. constructor(data, start, end) {
  18257. this.data = data;
  18258. this.start = start;
  18259. this.end = end;
  18260. }
  18261. get decoder() {
  18262. const decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
  18263. return (0, _util.shadow)(this, "decoder", decoder);
  18264. }
  18265. get contextCache() {
  18266. const cache = new ContextCache();
  18267. return (0, _util.shadow)(this, "contextCache", cache);
  18268. }
  18269. }
  18270. const MAX_INT_32 = 2 ** 31 - 1;
  18271. const MIN_INT_32 = -(2 ** 31);
  18272. function decodeInteger(contextCache, procedure, decoder) {
  18273. const contexts = contextCache.getContexts(procedure);
  18274. let prev = 1;
  18275. function readBits(length) {
  18276. let v = 0;
  18277. for (let i = 0; i < length; i++) {
  18278. const bit = decoder.readBit(contexts, prev);
  18279. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  18280. v = v << 1 | bit;
  18281. }
  18282. return v >>> 0;
  18283. }
  18284. const sign = readBits(1);
  18285. 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);
  18286. let signedValue;
  18287. if (sign === 0) {
  18288. signedValue = value;
  18289. } else if (value > 0) {
  18290. signedValue = -value;
  18291. }
  18292. if (signedValue >= MIN_INT_32 && signedValue <= MAX_INT_32) {
  18293. return signedValue;
  18294. }
  18295. return null;
  18296. }
  18297. function decodeIAID(contextCache, decoder, codeLength) {
  18298. const contexts = contextCache.getContexts("IAID");
  18299. let prev = 1;
  18300. for (let i = 0; i < codeLength; i++) {
  18301. const bit = decoder.readBit(contexts, prev);
  18302. prev = prev << 1 | bit;
  18303. }
  18304. if (codeLength < 31) {
  18305. return prev & (1 << codeLength) - 1;
  18306. }
  18307. return prev & 0x7fffffff;
  18308. }
  18309. 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"];
  18310. const CodingTemplates = [[{
  18311. x: -1,
  18312. y: -2
  18313. }, {
  18314. x: 0,
  18315. y: -2
  18316. }, {
  18317. x: 1,
  18318. y: -2
  18319. }, {
  18320. x: -2,
  18321. y: -1
  18322. }, {
  18323. x: -1,
  18324. y: -1
  18325. }, {
  18326. x: 0,
  18327. y: -1
  18328. }, {
  18329. x: 1,
  18330. y: -1
  18331. }, {
  18332. x: 2,
  18333. y: -1
  18334. }, {
  18335. x: -4,
  18336. y: 0
  18337. }, {
  18338. x: -3,
  18339. y: 0
  18340. }, {
  18341. x: -2,
  18342. y: 0
  18343. }, {
  18344. x: -1,
  18345. y: 0
  18346. }], [{
  18347. x: -1,
  18348. y: -2
  18349. }, {
  18350. x: 0,
  18351. y: -2
  18352. }, {
  18353. x: 1,
  18354. y: -2
  18355. }, {
  18356. x: 2,
  18357. y: -2
  18358. }, {
  18359. x: -2,
  18360. y: -1
  18361. }, {
  18362. x: -1,
  18363. y: -1
  18364. }, {
  18365. x: 0,
  18366. y: -1
  18367. }, {
  18368. x: 1,
  18369. y: -1
  18370. }, {
  18371. x: 2,
  18372. y: -1
  18373. }, {
  18374. x: -3,
  18375. y: 0
  18376. }, {
  18377. x: -2,
  18378. y: 0
  18379. }, {
  18380. x: -1,
  18381. y: 0
  18382. }], [{
  18383. x: -1,
  18384. y: -2
  18385. }, {
  18386. x: 0,
  18387. y: -2
  18388. }, {
  18389. x: 1,
  18390. y: -2
  18391. }, {
  18392. x: -2,
  18393. y: -1
  18394. }, {
  18395. x: -1,
  18396. y: -1
  18397. }, {
  18398. x: 0,
  18399. y: -1
  18400. }, {
  18401. x: 1,
  18402. y: -1
  18403. }, {
  18404. x: -2,
  18405. y: 0
  18406. }, {
  18407. x: -1,
  18408. y: 0
  18409. }], [{
  18410. x: -3,
  18411. y: -1
  18412. }, {
  18413. x: -2,
  18414. y: -1
  18415. }, {
  18416. x: -1,
  18417. y: -1
  18418. }, {
  18419. x: 0,
  18420. y: -1
  18421. }, {
  18422. x: 1,
  18423. y: -1
  18424. }, {
  18425. x: -4,
  18426. y: 0
  18427. }, {
  18428. x: -3,
  18429. y: 0
  18430. }, {
  18431. x: -2,
  18432. y: 0
  18433. }, {
  18434. x: -1,
  18435. y: 0
  18436. }]];
  18437. const RefinementTemplates = [{
  18438. coding: [{
  18439. x: 0,
  18440. y: -1
  18441. }, {
  18442. x: 1,
  18443. y: -1
  18444. }, {
  18445. x: -1,
  18446. y: 0
  18447. }],
  18448. reference: [{
  18449. x: 0,
  18450. y: -1
  18451. }, {
  18452. x: 1,
  18453. y: -1
  18454. }, {
  18455. x: -1,
  18456. y: 0
  18457. }, {
  18458. x: 0,
  18459. y: 0
  18460. }, {
  18461. x: 1,
  18462. y: 0
  18463. }, {
  18464. x: -1,
  18465. y: 1
  18466. }, {
  18467. x: 0,
  18468. y: 1
  18469. }, {
  18470. x: 1,
  18471. y: 1
  18472. }]
  18473. }, {
  18474. coding: [{
  18475. x: -1,
  18476. y: -1
  18477. }, {
  18478. x: 0,
  18479. y: -1
  18480. }, {
  18481. x: 1,
  18482. y: -1
  18483. }, {
  18484. x: -1,
  18485. y: 0
  18486. }],
  18487. reference: [{
  18488. x: 0,
  18489. y: -1
  18490. }, {
  18491. x: -1,
  18492. y: 0
  18493. }, {
  18494. x: 0,
  18495. y: 0
  18496. }, {
  18497. x: 1,
  18498. y: 0
  18499. }, {
  18500. x: 0,
  18501. y: 1
  18502. }, {
  18503. x: 1,
  18504. y: 1
  18505. }]
  18506. }];
  18507. const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  18508. const RefinementReusedContexts = [0x0020, 0x0008];
  18509. function decodeBitmapTemplate0(width, height, decodingContext) {
  18510. const decoder = decodingContext.decoder;
  18511. const contexts = decodingContext.contextCache.getContexts("GB");
  18512. const bitmap = [];
  18513. let contextLabel, i, j, pixel, row, row1, row2;
  18514. const OLD_PIXEL_MASK = 0x7bf7;
  18515. for (i = 0; i < height; i++) {
  18516. row = bitmap[i] = new Uint8Array(width);
  18517. row1 = i < 1 ? row : bitmap[i - 1];
  18518. row2 = i < 2 ? row : bitmap[i - 2];
  18519. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  18520. for (j = 0; j < width; j++) {
  18521. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  18522. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  18523. }
  18524. }
  18525. return bitmap;
  18526. }
  18527. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  18528. if (mmr) {
  18529. const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  18530. return decodeMMRBitmap(input, width, height, false);
  18531. }
  18532. 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) {
  18533. return decodeBitmapTemplate0(width, height, decodingContext);
  18534. }
  18535. const useskip = !!skip;
  18536. const template = CodingTemplates[templateIndex].concat(at);
  18537. template.sort(function (a, b) {
  18538. return a.y - b.y || a.x - b.x;
  18539. });
  18540. const templateLength = template.length;
  18541. const templateX = new Int8Array(templateLength);
  18542. const templateY = new Int8Array(templateLength);
  18543. const changingTemplateEntries = [];
  18544. let reuseMask = 0,
  18545. minX = 0,
  18546. maxX = 0,
  18547. minY = 0;
  18548. let c, k;
  18549. for (k = 0; k < templateLength; k++) {
  18550. templateX[k] = template[k].x;
  18551. templateY[k] = template[k].y;
  18552. minX = Math.min(minX, template[k].x);
  18553. maxX = Math.max(maxX, template[k].x);
  18554. minY = Math.min(minY, template[k].y);
  18555. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  18556. reuseMask |= 1 << templateLength - 1 - k;
  18557. } else {
  18558. changingTemplateEntries.push(k);
  18559. }
  18560. }
  18561. const changingEntriesLength = changingTemplateEntries.length;
  18562. const changingTemplateX = new Int8Array(changingEntriesLength);
  18563. const changingTemplateY = new Int8Array(changingEntriesLength);
  18564. const changingTemplateBit = new Uint16Array(changingEntriesLength);
  18565. for (c = 0; c < changingEntriesLength; c++) {
  18566. k = changingTemplateEntries[c];
  18567. changingTemplateX[c] = template[k].x;
  18568. changingTemplateY[c] = template[k].y;
  18569. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  18570. }
  18571. const sbb_left = -minX;
  18572. const sbb_top = -minY;
  18573. const sbb_right = width - maxX;
  18574. const pseudoPixelContext = ReusedContexts[templateIndex];
  18575. let row = new Uint8Array(width);
  18576. const bitmap = [];
  18577. const decoder = decodingContext.decoder;
  18578. const contexts = decodingContext.contextCache.getContexts("GB");
  18579. let ltp = 0,
  18580. j,
  18581. i0,
  18582. j0,
  18583. contextLabel = 0,
  18584. bit,
  18585. shift;
  18586. for (let i = 0; i < height; i++) {
  18587. if (prediction) {
  18588. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  18589. ltp ^= sltp;
  18590. if (ltp) {
  18591. bitmap.push(row);
  18592. continue;
  18593. }
  18594. }
  18595. row = new Uint8Array(row);
  18596. bitmap.push(row);
  18597. for (j = 0; j < width; j++) {
  18598. if (useskip && skip[i][j]) {
  18599. row[j] = 0;
  18600. continue;
  18601. }
  18602. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  18603. contextLabel = contextLabel << 1 & reuseMask;
  18604. for (k = 0; k < changingEntriesLength; k++) {
  18605. i0 = i + changingTemplateY[k];
  18606. j0 = j + changingTemplateX[k];
  18607. bit = bitmap[i0][j0];
  18608. if (bit) {
  18609. bit = changingTemplateBit[k];
  18610. contextLabel |= bit;
  18611. }
  18612. }
  18613. } else {
  18614. contextLabel = 0;
  18615. shift = templateLength - 1;
  18616. for (k = 0; k < templateLength; k++, shift--) {
  18617. j0 = j + templateX[k];
  18618. if (j0 >= 0 && j0 < width) {
  18619. i0 = i + templateY[k];
  18620. if (i0 >= 0) {
  18621. bit = bitmap[i0][j0];
  18622. if (bit) {
  18623. contextLabel |= bit << shift;
  18624. }
  18625. }
  18626. }
  18627. }
  18628. }
  18629. const pixel = decoder.readBit(contexts, contextLabel);
  18630. row[j] = pixel;
  18631. }
  18632. }
  18633. return bitmap;
  18634. }
  18635. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  18636. let codingTemplate = RefinementTemplates[templateIndex].coding;
  18637. if (templateIndex === 0) {
  18638. codingTemplate = codingTemplate.concat([at[0]]);
  18639. }
  18640. const codingTemplateLength = codingTemplate.length;
  18641. const codingTemplateX = new Int32Array(codingTemplateLength);
  18642. const codingTemplateY = new Int32Array(codingTemplateLength);
  18643. let k;
  18644. for (k = 0; k < codingTemplateLength; k++) {
  18645. codingTemplateX[k] = codingTemplate[k].x;
  18646. codingTemplateY[k] = codingTemplate[k].y;
  18647. }
  18648. let referenceTemplate = RefinementTemplates[templateIndex].reference;
  18649. if (templateIndex === 0) {
  18650. referenceTemplate = referenceTemplate.concat([at[1]]);
  18651. }
  18652. const referenceTemplateLength = referenceTemplate.length;
  18653. const referenceTemplateX = new Int32Array(referenceTemplateLength);
  18654. const referenceTemplateY = new Int32Array(referenceTemplateLength);
  18655. for (k = 0; k < referenceTemplateLength; k++) {
  18656. referenceTemplateX[k] = referenceTemplate[k].x;
  18657. referenceTemplateY[k] = referenceTemplate[k].y;
  18658. }
  18659. const referenceWidth = referenceBitmap[0].length;
  18660. const referenceHeight = referenceBitmap.length;
  18661. const pseudoPixelContext = RefinementReusedContexts[templateIndex];
  18662. const bitmap = [];
  18663. const decoder = decodingContext.decoder;
  18664. const contexts = decodingContext.contextCache.getContexts("GR");
  18665. let ltp = 0;
  18666. for (let i = 0; i < height; i++) {
  18667. if (prediction) {
  18668. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  18669. ltp ^= sltp;
  18670. if (ltp) {
  18671. throw new Jbig2Error("prediction is not supported");
  18672. }
  18673. }
  18674. const row = new Uint8Array(width);
  18675. bitmap.push(row);
  18676. for (let j = 0; j < width; j++) {
  18677. let i0, j0;
  18678. let contextLabel = 0;
  18679. for (k = 0; k < codingTemplateLength; k++) {
  18680. i0 = i + codingTemplateY[k];
  18681. j0 = j + codingTemplateX[k];
  18682. if (i0 < 0 || j0 < 0 || j0 >= width) {
  18683. contextLabel <<= 1;
  18684. } else {
  18685. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  18686. }
  18687. }
  18688. for (k = 0; k < referenceTemplateLength; k++) {
  18689. i0 = i + referenceTemplateY[k] - offsetY;
  18690. j0 = j + referenceTemplateX[k] - offsetX;
  18691. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  18692. contextLabel <<= 1;
  18693. } else {
  18694. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  18695. }
  18696. }
  18697. const pixel = decoder.readBit(contexts, contextLabel);
  18698. row[j] = pixel;
  18699. }
  18700. }
  18701. return bitmap;
  18702. }
  18703. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
  18704. if (huffman && refinement) {
  18705. throw new Jbig2Error("symbol refinement with Huffman is not supported");
  18706. }
  18707. const newSymbols = [];
  18708. let currentHeight = 0;
  18709. let symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);
  18710. const decoder = decodingContext.decoder;
  18711. const contextCache = decodingContext.contextCache;
  18712. let tableB1, symbolWidths;
  18713. if (huffman) {
  18714. tableB1 = getStandardTable(1);
  18715. symbolWidths = [];
  18716. symbolCodeLength = Math.max(symbolCodeLength, 1);
  18717. }
  18718. while (newSymbols.length < numberOfNewSymbols) {
  18719. const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
  18720. currentHeight += deltaHeight;
  18721. let currentWidth = 0,
  18722. totalWidth = 0;
  18723. const firstSymbol = huffman ? symbolWidths.length : 0;
  18724. while (true) {
  18725. const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
  18726. if (deltaWidth === null) {
  18727. break;
  18728. }
  18729. currentWidth += deltaWidth;
  18730. totalWidth += currentWidth;
  18731. let bitmap;
  18732. if (refinement) {
  18733. const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
  18734. if (numberOfInstances > 1) {
  18735. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
  18736. } else {
  18737. const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  18738. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  18739. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  18740. const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  18741. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  18742. }
  18743. newSymbols.push(bitmap);
  18744. } else if (huffman) {
  18745. symbolWidths.push(currentWidth);
  18746. } else {
  18747. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  18748. newSymbols.push(bitmap);
  18749. }
  18750. }
  18751. if (huffman && !refinement) {
  18752. const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
  18753. huffmanInput.byteAlign();
  18754. let collectiveBitmap;
  18755. if (bitmapSize === 0) {
  18756. collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
  18757. } else {
  18758. const originalEnd = huffmanInput.end;
  18759. const bitmapEnd = huffmanInput.position + bitmapSize;
  18760. huffmanInput.end = bitmapEnd;
  18761. collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
  18762. huffmanInput.end = originalEnd;
  18763. huffmanInput.position = bitmapEnd;
  18764. }
  18765. const numberOfSymbolsDecoded = symbolWidths.length;
  18766. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  18767. newSymbols.push(collectiveBitmap);
  18768. } else {
  18769. let i,
  18770. y,
  18771. xMin = 0,
  18772. xMax,
  18773. bitmapWidth,
  18774. symbolBitmap;
  18775. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  18776. bitmapWidth = symbolWidths[i];
  18777. xMax = xMin + bitmapWidth;
  18778. symbolBitmap = [];
  18779. for (y = 0; y < currentHeight; y++) {
  18780. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  18781. }
  18782. newSymbols.push(symbolBitmap);
  18783. xMin = xMax;
  18784. }
  18785. }
  18786. }
  18787. }
  18788. const exportedSymbols = [],
  18789. flags = [];
  18790. let currentFlag = false,
  18791. i,
  18792. ii;
  18793. const totalSymbolsLength = symbols.length + numberOfNewSymbols;
  18794. while (flags.length < totalSymbolsLength) {
  18795. let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
  18796. while (runLength--) {
  18797. flags.push(currentFlag);
  18798. }
  18799. currentFlag = !currentFlag;
  18800. }
  18801. for (i = 0, ii = symbols.length; i < ii; i++) {
  18802. if (flags[i]) {
  18803. exportedSymbols.push(symbols[i]);
  18804. }
  18805. }
  18806. for (let j = 0; j < numberOfNewSymbols; i++, j++) {
  18807. if (flags[i]) {
  18808. exportedSymbols.push(newSymbols[j]);
  18809. }
  18810. }
  18811. return exportedSymbols;
  18812. }
  18813. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
  18814. if (huffman && refinement) {
  18815. throw new Jbig2Error("refinement with Huffman is not supported");
  18816. }
  18817. const bitmap = [];
  18818. let i, row;
  18819. for (i = 0; i < height; i++) {
  18820. row = new Uint8Array(width);
  18821. if (defaultPixelValue) {
  18822. for (let j = 0; j < width; j++) {
  18823. row[j] = defaultPixelValue;
  18824. }
  18825. }
  18826. bitmap.push(row);
  18827. }
  18828. const decoder = decodingContext.decoder;
  18829. const contextCache = decodingContext.contextCache;
  18830. let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
  18831. let firstS = 0;
  18832. i = 0;
  18833. while (i < numberOfSymbolInstances) {
  18834. const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
  18835. stripT += deltaT;
  18836. const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
  18837. firstS += deltaFirstS;
  18838. let currentS = firstS;
  18839. do {
  18840. let currentT = 0;
  18841. if (stripSize > 1) {
  18842. currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
  18843. }
  18844. const t = stripSize * stripT + currentT;
  18845. const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
  18846. const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
  18847. let symbolBitmap = inputSymbols[symbolId];
  18848. let symbolWidth = symbolBitmap[0].length;
  18849. let symbolHeight = symbolBitmap.length;
  18850. if (applyRefinement) {
  18851. const rdw = decodeInteger(contextCache, "IARDW", decoder);
  18852. const rdh = decodeInteger(contextCache, "IARDH", decoder);
  18853. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  18854. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  18855. symbolWidth += rdw;
  18856. symbolHeight += rdh;
  18857. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  18858. }
  18859. const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  18860. const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  18861. let s2, t2, symbolRow;
  18862. if (transposed) {
  18863. for (s2 = 0; s2 < symbolHeight; s2++) {
  18864. row = bitmap[offsetS + s2];
  18865. if (!row) {
  18866. continue;
  18867. }
  18868. symbolRow = symbolBitmap[s2];
  18869. const maxWidth = Math.min(width - offsetT, symbolWidth);
  18870. switch (combinationOperator) {
  18871. case 0:
  18872. for (t2 = 0; t2 < maxWidth; t2++) {
  18873. row[offsetT + t2] |= symbolRow[t2];
  18874. }
  18875. break;
  18876. case 2:
  18877. for (t2 = 0; t2 < maxWidth; t2++) {
  18878. row[offsetT + t2] ^= symbolRow[t2];
  18879. }
  18880. break;
  18881. default:
  18882. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  18883. }
  18884. }
  18885. currentS += symbolHeight - 1;
  18886. } else {
  18887. for (t2 = 0; t2 < symbolHeight; t2++) {
  18888. row = bitmap[offsetT + t2];
  18889. if (!row) {
  18890. continue;
  18891. }
  18892. symbolRow = symbolBitmap[t2];
  18893. switch (combinationOperator) {
  18894. case 0:
  18895. for (s2 = 0; s2 < symbolWidth; s2++) {
  18896. row[offsetS + s2] |= symbolRow[s2];
  18897. }
  18898. break;
  18899. case 2:
  18900. for (s2 = 0; s2 < symbolWidth; s2++) {
  18901. row[offsetS + s2] ^= symbolRow[s2];
  18902. }
  18903. break;
  18904. default:
  18905. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  18906. }
  18907. }
  18908. currentS += symbolWidth - 1;
  18909. }
  18910. i++;
  18911. const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
  18912. if (deltaS === null) {
  18913. break;
  18914. }
  18915. currentS += deltaS + dsOffset;
  18916. } while (true);
  18917. }
  18918. return bitmap;
  18919. }
  18920. function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
  18921. const at = [];
  18922. if (!mmr) {
  18923. at.push({
  18924. x: -patternWidth,
  18925. y: 0
  18926. });
  18927. if (template === 0) {
  18928. at.push({
  18929. x: -3,
  18930. y: -1
  18931. }, {
  18932. x: 2,
  18933. y: -2
  18934. }, {
  18935. x: -2,
  18936. y: -2
  18937. });
  18938. }
  18939. }
  18940. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  18941. const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
  18942. const patterns = [];
  18943. for (let i = 0; i <= maxPatternIndex; i++) {
  18944. const patternBitmap = [];
  18945. const xMin = patternWidth * i;
  18946. const xMax = xMin + patternWidth;
  18947. for (let y = 0; y < patternHeight; y++) {
  18948. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  18949. }
  18950. patterns.push(patternBitmap);
  18951. }
  18952. return patterns;
  18953. }
  18954. function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
  18955. const skip = null;
  18956. if (enableSkip) {
  18957. throw new Jbig2Error("skip is not supported");
  18958. }
  18959. if (combinationOperator !== 0) {
  18960. throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`);
  18961. }
  18962. const regionBitmap = [];
  18963. let i, j, row;
  18964. for (i = 0; i < regionHeight; i++) {
  18965. row = new Uint8Array(regionWidth);
  18966. if (defaultPixelValue) {
  18967. for (j = 0; j < regionWidth; j++) {
  18968. row[j] = defaultPixelValue;
  18969. }
  18970. }
  18971. regionBitmap.push(row);
  18972. }
  18973. const numberOfPatterns = patterns.length;
  18974. const pattern0 = patterns[0];
  18975. const patternWidth = pattern0[0].length,
  18976. patternHeight = pattern0.length;
  18977. const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
  18978. const at = [];
  18979. if (!mmr) {
  18980. at.push({
  18981. x: template <= 1 ? 3 : 2,
  18982. y: -1
  18983. });
  18984. if (template === 0) {
  18985. at.push({
  18986. x: -3,
  18987. y: -1
  18988. }, {
  18989. x: 2,
  18990. y: -2
  18991. }, {
  18992. x: -2,
  18993. y: -2
  18994. });
  18995. }
  18996. }
  18997. const grayScaleBitPlanes = [];
  18998. let mmrInput, bitmap;
  18999. if (mmr) {
  19000. mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  19001. }
  19002. for (i = bitsPerValue - 1; i >= 0; i--) {
  19003. if (mmr) {
  19004. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  19005. } else {
  19006. bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
  19007. }
  19008. grayScaleBitPlanes[i] = bitmap;
  19009. }
  19010. let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
  19011. for (mg = 0; mg < gridHeight; mg++) {
  19012. for (ng = 0; ng < gridWidth; ng++) {
  19013. bit = 0;
  19014. patternIndex = 0;
  19015. for (j = bitsPerValue - 1; j >= 0; j--) {
  19016. bit ^= grayScaleBitPlanes[j][mg][ng];
  19017. patternIndex |= bit << j;
  19018. }
  19019. patternBitmap = patterns[patternIndex];
  19020. x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
  19021. y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
  19022. if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
  19023. for (i = 0; i < patternHeight; i++) {
  19024. regionRow = regionBitmap[y + i];
  19025. patternRow = patternBitmap[i];
  19026. for (j = 0; j < patternWidth; j++) {
  19027. regionRow[x + j] |= patternRow[j];
  19028. }
  19029. }
  19030. } else {
  19031. let regionX, regionY;
  19032. for (i = 0; i < patternHeight; i++) {
  19033. regionY = y + i;
  19034. if (regionY < 0 || regionY >= regionHeight) {
  19035. continue;
  19036. }
  19037. regionRow = regionBitmap[regionY];
  19038. patternRow = patternBitmap[i];
  19039. for (j = 0; j < patternWidth; j++) {
  19040. regionX = x + j;
  19041. if (regionX >= 0 && regionX < regionWidth) {
  19042. regionRow[regionX] |= patternRow[j];
  19043. }
  19044. }
  19045. }
  19046. }
  19047. }
  19048. }
  19049. return regionBitmap;
  19050. }
  19051. function readSegmentHeader(data, start) {
  19052. const segmentHeader = {};
  19053. segmentHeader.number = (0, _core_utils.readUint32)(data, start);
  19054. const flags = data[start + 4];
  19055. const segmentType = flags & 0x3f;
  19056. if (!SegmentTypes[segmentType]) {
  19057. throw new Jbig2Error("invalid segment type: " + segmentType);
  19058. }
  19059. segmentHeader.type = segmentType;
  19060. segmentHeader.typeName = SegmentTypes[segmentType];
  19061. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  19062. const pageAssociationFieldSize = !!(flags & 0x40);
  19063. const referredFlags = data[start + 5];
  19064. let referredToCount = referredFlags >> 5 & 7;
  19065. const retainBits = [referredFlags & 31];
  19066. let position = start + 6;
  19067. if (referredFlags === 7) {
  19068. referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;
  19069. position += 3;
  19070. let bytes = referredToCount + 7 >> 3;
  19071. retainBits[0] = data[position++];
  19072. while (--bytes > 0) {
  19073. retainBits.push(data[position++]);
  19074. }
  19075. } else if (referredFlags === 5 || referredFlags === 6) {
  19076. throw new Jbig2Error("invalid referred-to flags");
  19077. }
  19078. segmentHeader.retainBits = retainBits;
  19079. let referredToSegmentNumberSize = 4;
  19080. if (segmentHeader.number <= 256) {
  19081. referredToSegmentNumberSize = 1;
  19082. } else if (segmentHeader.number <= 65536) {
  19083. referredToSegmentNumberSize = 2;
  19084. }
  19085. const referredTo = [];
  19086. let i, ii;
  19087. for (i = 0; i < referredToCount; i++) {
  19088. let number;
  19089. if (referredToSegmentNumberSize === 1) {
  19090. number = data[position];
  19091. } else if (referredToSegmentNumberSize === 2) {
  19092. number = (0, _core_utils.readUint16)(data, position);
  19093. } else {
  19094. number = (0, _core_utils.readUint32)(data, position);
  19095. }
  19096. referredTo.push(number);
  19097. position += referredToSegmentNumberSize;
  19098. }
  19099. segmentHeader.referredTo = referredTo;
  19100. if (!pageAssociationFieldSize) {
  19101. segmentHeader.pageAssociation = data[position++];
  19102. } else {
  19103. segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position);
  19104. position += 4;
  19105. }
  19106. segmentHeader.length = (0, _core_utils.readUint32)(data, position);
  19107. position += 4;
  19108. if (segmentHeader.length === 0xffffffff) {
  19109. if (segmentType === 38) {
  19110. const genericRegionInfo = readRegionSegmentInformation(data, position);
  19111. const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  19112. const genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  19113. const searchPatternLength = 6;
  19114. const searchPattern = new Uint8Array(searchPatternLength);
  19115. if (!genericRegionMmr) {
  19116. searchPattern[0] = 0xff;
  19117. searchPattern[1] = 0xac;
  19118. }
  19119. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
  19120. searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
  19121. searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
  19122. searchPattern[5] = genericRegionInfo.height & 0xff;
  19123. for (i = position, ii = data.length; i < ii; i++) {
  19124. let j = 0;
  19125. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  19126. j++;
  19127. }
  19128. if (j === searchPatternLength) {
  19129. segmentHeader.length = i + searchPatternLength;
  19130. break;
  19131. }
  19132. }
  19133. if (segmentHeader.length === 0xffffffff) {
  19134. throw new Jbig2Error("segment end was not found");
  19135. }
  19136. } else {
  19137. throw new Jbig2Error("invalid unknown segment length");
  19138. }
  19139. }
  19140. segmentHeader.headerEnd = position;
  19141. return segmentHeader;
  19142. }
  19143. function readSegments(header, data, start, end) {
  19144. const segments = [];
  19145. let position = start;
  19146. while (position < end) {
  19147. const segmentHeader = readSegmentHeader(data, position);
  19148. position = segmentHeader.headerEnd;
  19149. const segment = {
  19150. header: segmentHeader,
  19151. data
  19152. };
  19153. if (!header.randomAccess) {
  19154. segment.start = position;
  19155. position += segmentHeader.length;
  19156. segment.end = position;
  19157. }
  19158. segments.push(segment);
  19159. if (segmentHeader.type === 51) {
  19160. break;
  19161. }
  19162. }
  19163. if (header.randomAccess) {
  19164. for (let i = 0, ii = segments.length; i < ii; i++) {
  19165. segments[i].start = position;
  19166. position += segments[i].header.length;
  19167. segments[i].end = position;
  19168. }
  19169. }
  19170. return segments;
  19171. }
  19172. function readRegionSegmentInformation(data, start) {
  19173. return {
  19174. width: (0, _core_utils.readUint32)(data, start),
  19175. height: (0, _core_utils.readUint32)(data, start + 4),
  19176. x: (0, _core_utils.readUint32)(data, start + 8),
  19177. y: (0, _core_utils.readUint32)(data, start + 12),
  19178. combinationOperator: data[start + 16] & 7
  19179. };
  19180. }
  19181. const RegionSegmentInformationFieldLength = 17;
  19182. function processSegment(segment, visitor) {
  19183. const header = segment.header;
  19184. const data = segment.data,
  19185. end = segment.end;
  19186. let position = segment.start;
  19187. let args, at, i, atLength;
  19188. switch (header.type) {
  19189. case 0:
  19190. const dictionary = {};
  19191. const dictionaryFlags = (0, _core_utils.readUint16)(data, position);
  19192. dictionary.huffman = !!(dictionaryFlags & 1);
  19193. dictionary.refinement = !!(dictionaryFlags & 2);
  19194. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  19195. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  19196. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  19197. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  19198. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  19199. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  19200. dictionary.template = dictionaryFlags >> 10 & 3;
  19201. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  19202. position += 2;
  19203. if (!dictionary.huffman) {
  19204. atLength = dictionary.template === 0 ? 4 : 1;
  19205. at = [];
  19206. for (i = 0; i < atLength; i++) {
  19207. at.push({
  19208. x: (0, _core_utils.readInt8)(data, position),
  19209. y: (0, _core_utils.readInt8)(data, position + 1)
  19210. });
  19211. position += 2;
  19212. }
  19213. dictionary.at = at;
  19214. }
  19215. if (dictionary.refinement && !dictionary.refinementTemplate) {
  19216. at = [];
  19217. for (i = 0; i < 2; i++) {
  19218. at.push({
  19219. x: (0, _core_utils.readInt8)(data, position),
  19220. y: (0, _core_utils.readInt8)(data, position + 1)
  19221. });
  19222. position += 2;
  19223. }
  19224. dictionary.refinementAt = at;
  19225. }
  19226. dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position);
  19227. position += 4;
  19228. dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position);
  19229. position += 4;
  19230. args = [dictionary, header.number, header.referredTo, data, position, end];
  19231. break;
  19232. case 6:
  19233. case 7:
  19234. const textRegion = {};
  19235. textRegion.info = readRegionSegmentInformation(data, position);
  19236. position += RegionSegmentInformationFieldLength;
  19237. const textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position);
  19238. position += 2;
  19239. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  19240. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  19241. textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
  19242. textRegion.stripSize = 1 << textRegion.logStripSize;
  19243. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  19244. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  19245. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  19246. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  19247. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  19248. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  19249. if (textRegion.huffman) {
  19250. const textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position);
  19251. position += 2;
  19252. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  19253. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  19254. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  19255. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  19256. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  19257. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  19258. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  19259. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
  19260. }
  19261. if (textRegion.refinement && !textRegion.refinementTemplate) {
  19262. at = [];
  19263. for (i = 0; i < 2; i++) {
  19264. at.push({
  19265. x: (0, _core_utils.readInt8)(data, position),
  19266. y: (0, _core_utils.readInt8)(data, position + 1)
  19267. });
  19268. position += 2;
  19269. }
  19270. textRegion.refinementAt = at;
  19271. }
  19272. textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position);
  19273. position += 4;
  19274. args = [textRegion, header.referredTo, data, position, end];
  19275. break;
  19276. case 16:
  19277. const patternDictionary = {};
  19278. const patternDictionaryFlags = data[position++];
  19279. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  19280. patternDictionary.template = patternDictionaryFlags >> 1 & 3;
  19281. patternDictionary.patternWidth = data[position++];
  19282. patternDictionary.patternHeight = data[position++];
  19283. patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position);
  19284. position += 4;
  19285. args = [patternDictionary, header.number, data, position, end];
  19286. break;
  19287. case 22:
  19288. case 23:
  19289. const halftoneRegion = {};
  19290. halftoneRegion.info = readRegionSegmentInformation(data, position);
  19291. position += RegionSegmentInformationFieldLength;
  19292. const halftoneRegionFlags = data[position++];
  19293. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  19294. halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
  19295. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  19296. halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
  19297. halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
  19298. halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position);
  19299. position += 4;
  19300. halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position);
  19301. position += 4;
  19302. halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  19303. position += 4;
  19304. halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  19305. position += 4;
  19306. halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position);
  19307. position += 2;
  19308. halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position);
  19309. position += 2;
  19310. args = [halftoneRegion, header.referredTo, data, position, end];
  19311. break;
  19312. case 38:
  19313. case 39:
  19314. const genericRegion = {};
  19315. genericRegion.info = readRegionSegmentInformation(data, position);
  19316. position += RegionSegmentInformationFieldLength;
  19317. const genericRegionSegmentFlags = data[position++];
  19318. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  19319. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  19320. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  19321. if (!genericRegion.mmr) {
  19322. atLength = genericRegion.template === 0 ? 4 : 1;
  19323. at = [];
  19324. for (i = 0; i < atLength; i++) {
  19325. at.push({
  19326. x: (0, _core_utils.readInt8)(data, position),
  19327. y: (0, _core_utils.readInt8)(data, position + 1)
  19328. });
  19329. position += 2;
  19330. }
  19331. genericRegion.at = at;
  19332. }
  19333. args = [genericRegion, data, position, end];
  19334. break;
  19335. case 48:
  19336. const pageInfo = {
  19337. width: (0, _core_utils.readUint32)(data, position),
  19338. height: (0, _core_utils.readUint32)(data, position + 4),
  19339. resolutionX: (0, _core_utils.readUint32)(data, position + 8),
  19340. resolutionY: (0, _core_utils.readUint32)(data, position + 12)
  19341. };
  19342. if (pageInfo.height === 0xffffffff) {
  19343. delete pageInfo.height;
  19344. }
  19345. const pageSegmentFlags = data[position + 16];
  19346. (0, _core_utils.readUint16)(data, position + 17);
  19347. pageInfo.lossless = !!(pageSegmentFlags & 1);
  19348. pageInfo.refinement = !!(pageSegmentFlags & 2);
  19349. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  19350. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  19351. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  19352. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  19353. args = [pageInfo];
  19354. break;
  19355. case 49:
  19356. break;
  19357. case 50:
  19358. break;
  19359. case 51:
  19360. break;
  19361. case 53:
  19362. args = [header.number, data, position, end];
  19363. break;
  19364. case 62:
  19365. break;
  19366. default:
  19367. throw new Jbig2Error(`segment type ${header.typeName}(${header.type}) is not implemented`);
  19368. }
  19369. const callbackName = "on" + header.typeName;
  19370. if (callbackName in visitor) {
  19371. visitor[callbackName].apply(visitor, args);
  19372. }
  19373. }
  19374. function processSegments(segments, visitor) {
  19375. for (let i = 0, ii = segments.length; i < ii; i++) {
  19376. processSegment(segments[i], visitor);
  19377. }
  19378. }
  19379. function parseJbig2Chunks(chunks) {
  19380. const visitor = new SimpleSegmentVisitor();
  19381. for (let i = 0, ii = chunks.length; i < ii; i++) {
  19382. const chunk = chunks[i];
  19383. const segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  19384. processSegments(segments, visitor);
  19385. }
  19386. return visitor.buffer;
  19387. }
  19388. function parseJbig2(data) {
  19389. throw new Error("Not implemented: parseJbig2");
  19390. }
  19391. class SimpleSegmentVisitor {
  19392. onPageInformation(info) {
  19393. this.currentPageInfo = info;
  19394. const rowSize = info.width + 7 >> 3;
  19395. const buffer = new Uint8ClampedArray(rowSize * info.height);
  19396. if (info.defaultPixelValue) {
  19397. buffer.fill(0xff);
  19398. }
  19399. this.buffer = buffer;
  19400. }
  19401. drawBitmap(regionInfo, bitmap) {
  19402. const pageInfo = this.currentPageInfo;
  19403. const width = regionInfo.width,
  19404. height = regionInfo.height;
  19405. const rowSize = pageInfo.width + 7 >> 3;
  19406. const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  19407. const buffer = this.buffer;
  19408. const mask0 = 128 >> (regionInfo.x & 7);
  19409. let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  19410. let i, j, mask, offset;
  19411. switch (combinationOperator) {
  19412. case 0:
  19413. for (i = 0; i < height; i++) {
  19414. mask = mask0;
  19415. offset = offset0;
  19416. for (j = 0; j < width; j++) {
  19417. if (bitmap[i][j]) {
  19418. buffer[offset] |= mask;
  19419. }
  19420. mask >>= 1;
  19421. if (!mask) {
  19422. mask = 128;
  19423. offset++;
  19424. }
  19425. }
  19426. offset0 += rowSize;
  19427. }
  19428. break;
  19429. case 2:
  19430. for (i = 0; i < height; i++) {
  19431. mask = mask0;
  19432. offset = offset0;
  19433. for (j = 0; j < width; j++) {
  19434. if (bitmap[i][j]) {
  19435. buffer[offset] ^= mask;
  19436. }
  19437. mask >>= 1;
  19438. if (!mask) {
  19439. mask = 128;
  19440. offset++;
  19441. }
  19442. }
  19443. offset0 += rowSize;
  19444. }
  19445. break;
  19446. default:
  19447. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  19448. }
  19449. }
  19450. onImmediateGenericRegion(region, data, start, end) {
  19451. const regionInfo = region.info;
  19452. const decodingContext = new DecodingContext(data, start, end);
  19453. const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  19454. this.drawBitmap(regionInfo, bitmap);
  19455. }
  19456. onImmediateLosslessGenericRegion() {
  19457. this.onImmediateGenericRegion(...arguments);
  19458. }
  19459. onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  19460. let huffmanTables, huffmanInput;
  19461. if (dictionary.huffman) {
  19462. huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
  19463. huffmanInput = new Reader(data, start, end);
  19464. }
  19465. let symbols = this.symbols;
  19466. if (!symbols) {
  19467. this.symbols = symbols = {};
  19468. }
  19469. const inputSymbols = [];
  19470. for (const referredSegment of referredSegments) {
  19471. const referredSymbols = symbols[referredSegment];
  19472. if (referredSymbols) {
  19473. inputSymbols.push(...referredSymbols);
  19474. }
  19475. }
  19476. const decodingContext = new DecodingContext(data, start, end);
  19477. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
  19478. }
  19479. onImmediateTextRegion(region, referredSegments, data, start, end) {
  19480. const regionInfo = region.info;
  19481. let huffmanTables, huffmanInput;
  19482. const symbols = this.symbols;
  19483. const inputSymbols = [];
  19484. for (const referredSegment of referredSegments) {
  19485. const referredSymbols = symbols[referredSegment];
  19486. if (referredSymbols) {
  19487. inputSymbols.push(...referredSymbols);
  19488. }
  19489. }
  19490. const symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);
  19491. if (region.huffman) {
  19492. huffmanInput = new Reader(data, start, end);
  19493. huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
  19494. }
  19495. const decodingContext = new DecodingContext(data, start, end);
  19496. 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);
  19497. this.drawBitmap(regionInfo, bitmap);
  19498. }
  19499. onImmediateLosslessTextRegion() {
  19500. this.onImmediateTextRegion(...arguments);
  19501. }
  19502. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  19503. let patterns = this.patterns;
  19504. if (!patterns) {
  19505. this.patterns = patterns = {};
  19506. }
  19507. const decodingContext = new DecodingContext(data, start, end);
  19508. patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
  19509. }
  19510. onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
  19511. const patterns = this.patterns[referredSegments[0]];
  19512. const regionInfo = region.info;
  19513. const decodingContext = new DecodingContext(data, start, end);
  19514. 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);
  19515. this.drawBitmap(regionInfo, bitmap);
  19516. }
  19517. onImmediateLosslessHalftoneRegion() {
  19518. this.onImmediateHalftoneRegion(...arguments);
  19519. }
  19520. onTables(currentSegment, data, start, end) {
  19521. let customTables = this.customTables;
  19522. if (!customTables) {
  19523. this.customTables = customTables = {};
  19524. }
  19525. customTables[currentSegment] = decodeTablesSegment(data, start, end);
  19526. }
  19527. }
  19528. class HuffmanLine {
  19529. constructor(lineData) {
  19530. if (lineData.length === 2) {
  19531. this.isOOB = true;
  19532. this.rangeLow = 0;
  19533. this.prefixLength = lineData[0];
  19534. this.rangeLength = 0;
  19535. this.prefixCode = lineData[1];
  19536. this.isLowerRange = false;
  19537. } else {
  19538. this.isOOB = false;
  19539. this.rangeLow = lineData[0];
  19540. this.prefixLength = lineData[1];
  19541. this.rangeLength = lineData[2];
  19542. this.prefixCode = lineData[3];
  19543. this.isLowerRange = lineData[4] === "lower";
  19544. }
  19545. }
  19546. }
  19547. class HuffmanTreeNode {
  19548. constructor(line) {
  19549. this.children = [];
  19550. if (line) {
  19551. this.isLeaf = true;
  19552. this.rangeLength = line.rangeLength;
  19553. this.rangeLow = line.rangeLow;
  19554. this.isLowerRange = line.isLowerRange;
  19555. this.isOOB = line.isOOB;
  19556. } else {
  19557. this.isLeaf = false;
  19558. }
  19559. }
  19560. buildTree(line, shift) {
  19561. const bit = line.prefixCode >> shift & 1;
  19562. if (shift <= 0) {
  19563. this.children[bit] = new HuffmanTreeNode(line);
  19564. } else {
  19565. let node = this.children[bit];
  19566. if (!node) {
  19567. this.children[bit] = node = new HuffmanTreeNode(null);
  19568. }
  19569. node.buildTree(line, shift - 1);
  19570. }
  19571. }
  19572. decodeNode(reader) {
  19573. if (this.isLeaf) {
  19574. if (this.isOOB) {
  19575. return null;
  19576. }
  19577. const htOffset = reader.readBits(this.rangeLength);
  19578. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  19579. }
  19580. const node = this.children[reader.readBit()];
  19581. if (!node) {
  19582. throw new Jbig2Error("invalid Huffman data");
  19583. }
  19584. return node.decodeNode(reader);
  19585. }
  19586. }
  19587. class HuffmanTable {
  19588. constructor(lines, prefixCodesDone) {
  19589. if (!prefixCodesDone) {
  19590. this.assignPrefixCodes(lines);
  19591. }
  19592. this.rootNode = new HuffmanTreeNode(null);
  19593. for (let i = 0, ii = lines.length; i < ii; i++) {
  19594. const line = lines[i];
  19595. if (line.prefixLength > 0) {
  19596. this.rootNode.buildTree(line, line.prefixLength - 1);
  19597. }
  19598. }
  19599. }
  19600. decode(reader) {
  19601. return this.rootNode.decodeNode(reader);
  19602. }
  19603. assignPrefixCodes(lines) {
  19604. const linesLength = lines.length;
  19605. let prefixLengthMax = 0;
  19606. for (let i = 0; i < linesLength; i++) {
  19607. prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
  19608. }
  19609. const histogram = new Uint32Array(prefixLengthMax + 1);
  19610. for (let i = 0; i < linesLength; i++) {
  19611. histogram[lines[i].prefixLength]++;
  19612. }
  19613. let currentLength = 1,
  19614. firstCode = 0,
  19615. currentCode,
  19616. currentTemp,
  19617. line;
  19618. histogram[0] = 0;
  19619. while (currentLength <= prefixLengthMax) {
  19620. firstCode = firstCode + histogram[currentLength - 1] << 1;
  19621. currentCode = firstCode;
  19622. currentTemp = 0;
  19623. while (currentTemp < linesLength) {
  19624. line = lines[currentTemp];
  19625. if (line.prefixLength === currentLength) {
  19626. line.prefixCode = currentCode;
  19627. currentCode++;
  19628. }
  19629. currentTemp++;
  19630. }
  19631. currentLength++;
  19632. }
  19633. }
  19634. }
  19635. function decodeTablesSegment(data, start, end) {
  19636. const flags = data[start];
  19637. const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
  19638. const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
  19639. const reader = new Reader(data, start + 9, end);
  19640. const prefixSizeBits = (flags >> 1 & 7) + 1;
  19641. const rangeSizeBits = (flags >> 4 & 7) + 1;
  19642. const lines = [];
  19643. let prefixLength,
  19644. rangeLength,
  19645. currentRangeLow = lowestValue;
  19646. do {
  19647. prefixLength = reader.readBits(prefixSizeBits);
  19648. rangeLength = reader.readBits(rangeSizeBits);
  19649. lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
  19650. currentRangeLow += 1 << rangeLength;
  19651. } while (currentRangeLow < highestValue);
  19652. prefixLength = reader.readBits(prefixSizeBits);
  19653. lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
  19654. prefixLength = reader.readBits(prefixSizeBits);
  19655. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  19656. if (flags & 1) {
  19657. prefixLength = reader.readBits(prefixSizeBits);
  19658. lines.push(new HuffmanLine([prefixLength, 0]));
  19659. }
  19660. return new HuffmanTable(lines, false);
  19661. }
  19662. const standardTablesCache = {};
  19663. function getStandardTable(number) {
  19664. let table = standardTablesCache[number];
  19665. if (table) {
  19666. return table;
  19667. }
  19668. let lines;
  19669. switch (number) {
  19670. case 1:
  19671. lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
  19672. break;
  19673. case 2:
  19674. 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]];
  19675. break;
  19676. case 3:
  19677. 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]];
  19678. break;
  19679. case 4:
  19680. 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]];
  19681. break;
  19682. case 5:
  19683. 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]];
  19684. break;
  19685. case 6:
  19686. 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]];
  19687. break;
  19688. case 7:
  19689. 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]];
  19690. break;
  19691. case 8:
  19692. 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]];
  19693. break;
  19694. case 9:
  19695. 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]];
  19696. break;
  19697. case 10:
  19698. 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]];
  19699. break;
  19700. case 11:
  19701. 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]];
  19702. break;
  19703. case 12:
  19704. 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]];
  19705. break;
  19706. case 13:
  19707. 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]];
  19708. break;
  19709. case 14:
  19710. lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
  19711. break;
  19712. case 15:
  19713. 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]];
  19714. break;
  19715. default:
  19716. throw new Jbig2Error(`standard table B.${number} does not exist`);
  19717. }
  19718. for (let i = 0, ii = lines.length; i < ii; i++) {
  19719. lines[i] = new HuffmanLine(lines[i]);
  19720. }
  19721. table = new HuffmanTable(lines, true);
  19722. standardTablesCache[number] = table;
  19723. return table;
  19724. }
  19725. class Reader {
  19726. constructor(data, start, end) {
  19727. this.data = data;
  19728. this.start = start;
  19729. this.end = end;
  19730. this.position = start;
  19731. this.shift = -1;
  19732. this.currentByte = 0;
  19733. }
  19734. readBit() {
  19735. if (this.shift < 0) {
  19736. if (this.position >= this.end) {
  19737. throw new Jbig2Error("end of data while reading bit");
  19738. }
  19739. this.currentByte = this.data[this.position++];
  19740. this.shift = 7;
  19741. }
  19742. const bit = this.currentByte >> this.shift & 1;
  19743. this.shift--;
  19744. return bit;
  19745. }
  19746. readBits(numBits) {
  19747. let result = 0,
  19748. i;
  19749. for (i = numBits - 1; i >= 0; i--) {
  19750. result |= this.readBit() << i;
  19751. }
  19752. return result;
  19753. }
  19754. byteAlign() {
  19755. this.shift = -1;
  19756. }
  19757. next() {
  19758. if (this.position >= this.end) {
  19759. return -1;
  19760. }
  19761. return this.data[this.position++];
  19762. }
  19763. }
  19764. function getCustomHuffmanTable(index, referredTo, customTables) {
  19765. let currentIndex = 0;
  19766. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  19767. const table = customTables[referredTo[i]];
  19768. if (table) {
  19769. if (index === currentIndex) {
  19770. return table;
  19771. }
  19772. currentIndex++;
  19773. }
  19774. }
  19775. throw new Jbig2Error("can't find custom Huffman table");
  19776. }
  19777. function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
  19778. const codes = [];
  19779. for (let i = 0; i <= 34; i++) {
  19780. const codeLength = reader.readBits(4);
  19781. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  19782. }
  19783. const runCodesTable = new HuffmanTable(codes, false);
  19784. codes.length = 0;
  19785. for (let i = 0; i < numberOfSymbols;) {
  19786. const codeLength = runCodesTable.decode(reader);
  19787. if (codeLength >= 32) {
  19788. let repeatedLength, numberOfRepeats, j;
  19789. switch (codeLength) {
  19790. case 32:
  19791. if (i === 0) {
  19792. throw new Jbig2Error("no previous value in symbol ID table");
  19793. }
  19794. numberOfRepeats = reader.readBits(2) + 3;
  19795. repeatedLength = codes[i - 1].prefixLength;
  19796. break;
  19797. case 33:
  19798. numberOfRepeats = reader.readBits(3) + 3;
  19799. repeatedLength = 0;
  19800. break;
  19801. case 34:
  19802. numberOfRepeats = reader.readBits(7) + 11;
  19803. repeatedLength = 0;
  19804. break;
  19805. default:
  19806. throw new Jbig2Error("invalid code length in symbol ID table");
  19807. }
  19808. for (j = 0; j < numberOfRepeats; j++) {
  19809. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  19810. i++;
  19811. }
  19812. } else {
  19813. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  19814. i++;
  19815. }
  19816. }
  19817. reader.byteAlign();
  19818. const symbolIDTable = new HuffmanTable(codes, false);
  19819. let customIndex = 0,
  19820. tableFirstS,
  19821. tableDeltaS,
  19822. tableDeltaT;
  19823. switch (textRegion.huffmanFS) {
  19824. case 0:
  19825. case 1:
  19826. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  19827. break;
  19828. case 3:
  19829. tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19830. customIndex++;
  19831. break;
  19832. default:
  19833. throw new Jbig2Error("invalid Huffman FS selector");
  19834. }
  19835. switch (textRegion.huffmanDS) {
  19836. case 0:
  19837. case 1:
  19838. case 2:
  19839. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  19840. break;
  19841. case 3:
  19842. tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19843. customIndex++;
  19844. break;
  19845. default:
  19846. throw new Jbig2Error("invalid Huffman DS selector");
  19847. }
  19848. switch (textRegion.huffmanDT) {
  19849. case 0:
  19850. case 1:
  19851. case 2:
  19852. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  19853. break;
  19854. case 3:
  19855. tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19856. customIndex++;
  19857. break;
  19858. default:
  19859. throw new Jbig2Error("invalid Huffman DT selector");
  19860. }
  19861. if (textRegion.refinement) {
  19862. throw new Jbig2Error("refinement with Huffman is not supported");
  19863. }
  19864. return {
  19865. symbolIDTable,
  19866. tableFirstS,
  19867. tableDeltaS,
  19868. tableDeltaT
  19869. };
  19870. }
  19871. function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
  19872. let customIndex = 0,
  19873. tableDeltaHeight,
  19874. tableDeltaWidth;
  19875. switch (dictionary.huffmanDHSelector) {
  19876. case 0:
  19877. case 1:
  19878. tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
  19879. break;
  19880. case 3:
  19881. tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19882. customIndex++;
  19883. break;
  19884. default:
  19885. throw new Jbig2Error("invalid Huffman DH selector");
  19886. }
  19887. switch (dictionary.huffmanDWSelector) {
  19888. case 0:
  19889. case 1:
  19890. tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
  19891. break;
  19892. case 3:
  19893. tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19894. customIndex++;
  19895. break;
  19896. default:
  19897. throw new Jbig2Error("invalid Huffman DW selector");
  19898. }
  19899. let tableBitmapSize, tableAggregateInstances;
  19900. if (dictionary.bitmapSizeSelector) {
  19901. tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19902. customIndex++;
  19903. } else {
  19904. tableBitmapSize = getStandardTable(1);
  19905. }
  19906. if (dictionary.aggregationInstancesSelector) {
  19907. tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19908. } else {
  19909. tableAggregateInstances = getStandardTable(1);
  19910. }
  19911. return {
  19912. tableDeltaHeight,
  19913. tableDeltaWidth,
  19914. tableBitmapSize,
  19915. tableAggregateInstances
  19916. };
  19917. }
  19918. function readUncompressedBitmap(reader, width, height) {
  19919. const bitmap = [];
  19920. for (let y = 0; y < height; y++) {
  19921. const row = new Uint8Array(width);
  19922. bitmap.push(row);
  19923. for (let x = 0; x < width; x++) {
  19924. row[x] = reader.readBit();
  19925. }
  19926. reader.byteAlign();
  19927. }
  19928. return bitmap;
  19929. }
  19930. function decodeMMRBitmap(input, width, height, endOfBlock) {
  19931. const params = {
  19932. K: -1,
  19933. Columns: width,
  19934. Rows: height,
  19935. BlackIs1: true,
  19936. EndOfBlock: endOfBlock
  19937. };
  19938. const decoder = new _ccitt.CCITTFaxDecoder(input, params);
  19939. const bitmap = [];
  19940. let currentByte,
  19941. eof = false;
  19942. for (let y = 0; y < height; y++) {
  19943. const row = new Uint8Array(width);
  19944. bitmap.push(row);
  19945. let shift = -1;
  19946. for (let x = 0; x < width; x++) {
  19947. if (shift < 0) {
  19948. currentByte = decoder.readNextChar();
  19949. if (currentByte === -1) {
  19950. currentByte = 0;
  19951. eof = true;
  19952. }
  19953. shift = 7;
  19954. }
  19955. row[x] = currentByte >> shift & 1;
  19956. shift--;
  19957. }
  19958. }
  19959. if (endOfBlock && !eof) {
  19960. const lookForEOFLimit = 5;
  19961. for (let i = 0; i < lookForEOFLimit; i++) {
  19962. if (decoder.readNextChar() === -1) {
  19963. break;
  19964. }
  19965. }
  19966. }
  19967. return bitmap;
  19968. }
  19969. class Jbig2Image {
  19970. parseChunks(chunks) {
  19971. return parseJbig2Chunks(chunks);
  19972. }
  19973. parse(data) {
  19974. throw new Error("Not implemented: Jbig2Image.parse");
  19975. }
  19976. }
  19977. exports.Jbig2Image = Jbig2Image;
  19978. /***/ }),
  19979. /* 157 */
  19980. /***/ ((__unused_webpack_module, exports) => {
  19981. "use strict";
  19982. Object.defineProperty(exports, "__esModule", ({
  19983. value: true
  19984. }));
  19985. exports.ArithmeticDecoder = void 0;
  19986. const QeTable = [{
  19987. qe: 0x5601,
  19988. nmps: 1,
  19989. nlps: 1,
  19990. switchFlag: 1
  19991. }, {
  19992. qe: 0x3401,
  19993. nmps: 2,
  19994. nlps: 6,
  19995. switchFlag: 0
  19996. }, {
  19997. qe: 0x1801,
  19998. nmps: 3,
  19999. nlps: 9,
  20000. switchFlag: 0
  20001. }, {
  20002. qe: 0x0ac1,
  20003. nmps: 4,
  20004. nlps: 12,
  20005. switchFlag: 0
  20006. }, {
  20007. qe: 0x0521,
  20008. nmps: 5,
  20009. nlps: 29,
  20010. switchFlag: 0
  20011. }, {
  20012. qe: 0x0221,
  20013. nmps: 38,
  20014. nlps: 33,
  20015. switchFlag: 0
  20016. }, {
  20017. qe: 0x5601,
  20018. nmps: 7,
  20019. nlps: 6,
  20020. switchFlag: 1
  20021. }, {
  20022. qe: 0x5401,
  20023. nmps: 8,
  20024. nlps: 14,
  20025. switchFlag: 0
  20026. }, {
  20027. qe: 0x4801,
  20028. nmps: 9,
  20029. nlps: 14,
  20030. switchFlag: 0
  20031. }, {
  20032. qe: 0x3801,
  20033. nmps: 10,
  20034. nlps: 14,
  20035. switchFlag: 0
  20036. }, {
  20037. qe: 0x3001,
  20038. nmps: 11,
  20039. nlps: 17,
  20040. switchFlag: 0
  20041. }, {
  20042. qe: 0x2401,
  20043. nmps: 12,
  20044. nlps: 18,
  20045. switchFlag: 0
  20046. }, {
  20047. qe: 0x1c01,
  20048. nmps: 13,
  20049. nlps: 20,
  20050. switchFlag: 0
  20051. }, {
  20052. qe: 0x1601,
  20053. nmps: 29,
  20054. nlps: 21,
  20055. switchFlag: 0
  20056. }, {
  20057. qe: 0x5601,
  20058. nmps: 15,
  20059. nlps: 14,
  20060. switchFlag: 1
  20061. }, {
  20062. qe: 0x5401,
  20063. nmps: 16,
  20064. nlps: 14,
  20065. switchFlag: 0
  20066. }, {
  20067. qe: 0x5101,
  20068. nmps: 17,
  20069. nlps: 15,
  20070. switchFlag: 0
  20071. }, {
  20072. qe: 0x4801,
  20073. nmps: 18,
  20074. nlps: 16,
  20075. switchFlag: 0
  20076. }, {
  20077. qe: 0x3801,
  20078. nmps: 19,
  20079. nlps: 17,
  20080. switchFlag: 0
  20081. }, {
  20082. qe: 0x3401,
  20083. nmps: 20,
  20084. nlps: 18,
  20085. switchFlag: 0
  20086. }, {
  20087. qe: 0x3001,
  20088. nmps: 21,
  20089. nlps: 19,
  20090. switchFlag: 0
  20091. }, {
  20092. qe: 0x2801,
  20093. nmps: 22,
  20094. nlps: 19,
  20095. switchFlag: 0
  20096. }, {
  20097. qe: 0x2401,
  20098. nmps: 23,
  20099. nlps: 20,
  20100. switchFlag: 0
  20101. }, {
  20102. qe: 0x2201,
  20103. nmps: 24,
  20104. nlps: 21,
  20105. switchFlag: 0
  20106. }, {
  20107. qe: 0x1c01,
  20108. nmps: 25,
  20109. nlps: 22,
  20110. switchFlag: 0
  20111. }, {
  20112. qe: 0x1801,
  20113. nmps: 26,
  20114. nlps: 23,
  20115. switchFlag: 0
  20116. }, {
  20117. qe: 0x1601,
  20118. nmps: 27,
  20119. nlps: 24,
  20120. switchFlag: 0
  20121. }, {
  20122. qe: 0x1401,
  20123. nmps: 28,
  20124. nlps: 25,
  20125. switchFlag: 0
  20126. }, {
  20127. qe: 0x1201,
  20128. nmps: 29,
  20129. nlps: 26,
  20130. switchFlag: 0
  20131. }, {
  20132. qe: 0x1101,
  20133. nmps: 30,
  20134. nlps: 27,
  20135. switchFlag: 0
  20136. }, {
  20137. qe: 0x0ac1,
  20138. nmps: 31,
  20139. nlps: 28,
  20140. switchFlag: 0
  20141. }, {
  20142. qe: 0x09c1,
  20143. nmps: 32,
  20144. nlps: 29,
  20145. switchFlag: 0
  20146. }, {
  20147. qe: 0x08a1,
  20148. nmps: 33,
  20149. nlps: 30,
  20150. switchFlag: 0
  20151. }, {
  20152. qe: 0x0521,
  20153. nmps: 34,
  20154. nlps: 31,
  20155. switchFlag: 0
  20156. }, {
  20157. qe: 0x0441,
  20158. nmps: 35,
  20159. nlps: 32,
  20160. switchFlag: 0
  20161. }, {
  20162. qe: 0x02a1,
  20163. nmps: 36,
  20164. nlps: 33,
  20165. switchFlag: 0
  20166. }, {
  20167. qe: 0x0221,
  20168. nmps: 37,
  20169. nlps: 34,
  20170. switchFlag: 0
  20171. }, {
  20172. qe: 0x0141,
  20173. nmps: 38,
  20174. nlps: 35,
  20175. switchFlag: 0
  20176. }, {
  20177. qe: 0x0111,
  20178. nmps: 39,
  20179. nlps: 36,
  20180. switchFlag: 0
  20181. }, {
  20182. qe: 0x0085,
  20183. nmps: 40,
  20184. nlps: 37,
  20185. switchFlag: 0
  20186. }, {
  20187. qe: 0x0049,
  20188. nmps: 41,
  20189. nlps: 38,
  20190. switchFlag: 0
  20191. }, {
  20192. qe: 0x0025,
  20193. nmps: 42,
  20194. nlps: 39,
  20195. switchFlag: 0
  20196. }, {
  20197. qe: 0x0015,
  20198. nmps: 43,
  20199. nlps: 40,
  20200. switchFlag: 0
  20201. }, {
  20202. qe: 0x0009,
  20203. nmps: 44,
  20204. nlps: 41,
  20205. switchFlag: 0
  20206. }, {
  20207. qe: 0x0005,
  20208. nmps: 45,
  20209. nlps: 42,
  20210. switchFlag: 0
  20211. }, {
  20212. qe: 0x0001,
  20213. nmps: 45,
  20214. nlps: 43,
  20215. switchFlag: 0
  20216. }, {
  20217. qe: 0x5601,
  20218. nmps: 46,
  20219. nlps: 46,
  20220. switchFlag: 0
  20221. }];
  20222. class ArithmeticDecoder {
  20223. constructor(data, start, end) {
  20224. this.data = data;
  20225. this.bp = start;
  20226. this.dataEnd = end;
  20227. this.chigh = data[start];
  20228. this.clow = 0;
  20229. this.byteIn();
  20230. this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
  20231. this.clow = this.clow << 7 & 0xffff;
  20232. this.ct -= 7;
  20233. this.a = 0x8000;
  20234. }
  20235. byteIn() {
  20236. const data = this.data;
  20237. let bp = this.bp;
  20238. if (data[bp] === 0xff) {
  20239. if (data[bp + 1] > 0x8f) {
  20240. this.clow += 0xff00;
  20241. this.ct = 8;
  20242. } else {
  20243. bp++;
  20244. this.clow += data[bp] << 9;
  20245. this.ct = 7;
  20246. this.bp = bp;
  20247. }
  20248. } else {
  20249. bp++;
  20250. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  20251. this.ct = 8;
  20252. this.bp = bp;
  20253. }
  20254. if (this.clow > 0xffff) {
  20255. this.chigh += this.clow >> 16;
  20256. this.clow &= 0xffff;
  20257. }
  20258. }
  20259. readBit(contexts, pos) {
  20260. let cx_index = contexts[pos] >> 1,
  20261. cx_mps = contexts[pos] & 1;
  20262. const qeTableIcx = QeTable[cx_index];
  20263. const qeIcx = qeTableIcx.qe;
  20264. let d;
  20265. let a = this.a - qeIcx;
  20266. if (this.chigh < qeIcx) {
  20267. if (a < qeIcx) {
  20268. a = qeIcx;
  20269. d = cx_mps;
  20270. cx_index = qeTableIcx.nmps;
  20271. } else {
  20272. a = qeIcx;
  20273. d = 1 ^ cx_mps;
  20274. if (qeTableIcx.switchFlag === 1) {
  20275. cx_mps = d;
  20276. }
  20277. cx_index = qeTableIcx.nlps;
  20278. }
  20279. } else {
  20280. this.chigh -= qeIcx;
  20281. if ((a & 0x8000) !== 0) {
  20282. this.a = a;
  20283. return cx_mps;
  20284. }
  20285. if (a < qeIcx) {
  20286. d = 1 ^ cx_mps;
  20287. if (qeTableIcx.switchFlag === 1) {
  20288. cx_mps = d;
  20289. }
  20290. cx_index = qeTableIcx.nlps;
  20291. } else {
  20292. d = cx_mps;
  20293. cx_index = qeTableIcx.nmps;
  20294. }
  20295. }
  20296. do {
  20297. if (this.ct === 0) {
  20298. this.byteIn();
  20299. }
  20300. a <<= 1;
  20301. this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
  20302. this.clow = this.clow << 1 & 0xffff;
  20303. this.ct--;
  20304. } while ((a & 0x8000) === 0);
  20305. this.a = a;
  20306. contexts[pos] = cx_index << 1 | cx_mps;
  20307. return d;
  20308. }
  20309. }
  20310. exports.ArithmeticDecoder = ArithmeticDecoder;
  20311. /***/ }),
  20312. /* 158 */
  20313. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20314. "use strict";
  20315. Object.defineProperty(exports, "__esModule", ({
  20316. value: true
  20317. }));
  20318. exports.JpegStream = void 0;
  20319. var _decode_stream = __w_pdfjs_require__(150);
  20320. var _primitives = __w_pdfjs_require__(137);
  20321. var _jpg = __w_pdfjs_require__(159);
  20322. var _util = __w_pdfjs_require__(2);
  20323. class JpegStream extends _decode_stream.DecodeStream {
  20324. constructor(stream, maybeLength, params) {
  20325. let ch;
  20326. while ((ch = stream.getByte()) !== -1) {
  20327. if (ch === 0xff) {
  20328. stream.skip(-1);
  20329. break;
  20330. }
  20331. }
  20332. super(maybeLength);
  20333. this.stream = stream;
  20334. this.dict = stream.dict;
  20335. this.maybeLength = maybeLength;
  20336. this.params = params;
  20337. }
  20338. get bytes() {
  20339. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  20340. }
  20341. ensureBuffer(requested) {}
  20342. readBlock() {
  20343. if (this.eof) {
  20344. return;
  20345. }
  20346. const jpegOptions = {
  20347. decodeTransform: undefined,
  20348. colorTransform: undefined
  20349. };
  20350. const decodeArr = this.dict.getArray("D", "Decode");
  20351. if (this.forceRGB && Array.isArray(decodeArr)) {
  20352. const bitsPerComponent = this.dict.get("BPC", "BitsPerComponent") || 8;
  20353. const decodeArrLength = decodeArr.length;
  20354. const transform = new Int32Array(decodeArrLength);
  20355. let transformNeeded = false;
  20356. const maxValue = (1 << bitsPerComponent) - 1;
  20357. for (let i = 0; i < decodeArrLength; i += 2) {
  20358. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  20359. transform[i + 1] = decodeArr[i] * maxValue | 0;
  20360. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  20361. transformNeeded = true;
  20362. }
  20363. }
  20364. if (transformNeeded) {
  20365. jpegOptions.decodeTransform = transform;
  20366. }
  20367. }
  20368. if (this.params instanceof _primitives.Dict) {
  20369. const colorTransform = this.params.get("ColorTransform");
  20370. if (Number.isInteger(colorTransform)) {
  20371. jpegOptions.colorTransform = colorTransform;
  20372. }
  20373. }
  20374. const jpegImage = new _jpg.JpegImage(jpegOptions);
  20375. jpegImage.parse(this.bytes);
  20376. const data = jpegImage.getData({
  20377. width: this.drawWidth,
  20378. height: this.drawHeight,
  20379. forceRGB: this.forceRGB,
  20380. isSourcePDF: true
  20381. });
  20382. this.buffer = data;
  20383. this.bufferLength = data.length;
  20384. this.eof = true;
  20385. }
  20386. }
  20387. exports.JpegStream = JpegStream;
  20388. /***/ }),
  20389. /* 159 */
  20390. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20391. "use strict";
  20392. Object.defineProperty(exports, "__esModule", ({
  20393. value: true
  20394. }));
  20395. exports.JpegImage = void 0;
  20396. var _util = __w_pdfjs_require__(2);
  20397. var _core_utils = __w_pdfjs_require__(136);
  20398. class JpegError extends _util.BaseException {
  20399. constructor(msg) {
  20400. super(`JPEG error: ${msg}`, "JpegError");
  20401. }
  20402. }
  20403. class DNLMarkerError extends _util.BaseException {
  20404. constructor(message, scanLines) {
  20405. super(message, "DNLMarkerError");
  20406. this.scanLines = scanLines;
  20407. }
  20408. }
  20409. class EOIMarkerError extends _util.BaseException {
  20410. constructor(msg) {
  20411. super(msg, "EOIMarkerError");
  20412. }
  20413. }
  20414. 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]);
  20415. const dctCos1 = 4017;
  20416. const dctSin1 = 799;
  20417. const dctCos3 = 3406;
  20418. const dctSin3 = 2276;
  20419. const dctCos6 = 1567;
  20420. const dctSin6 = 3784;
  20421. const dctSqrt2 = 5793;
  20422. const dctSqrt1d2 = 2896;
  20423. function buildHuffmanTable(codeLengths, values) {
  20424. let k = 0,
  20425. i,
  20426. j,
  20427. length = 16;
  20428. while (length > 0 && !codeLengths[length - 1]) {
  20429. length--;
  20430. }
  20431. const code = [{
  20432. children: [],
  20433. index: 0
  20434. }];
  20435. let p = code[0],
  20436. q;
  20437. for (i = 0; i < length; i++) {
  20438. for (j = 0; j < codeLengths[i]; j++) {
  20439. p = code.pop();
  20440. p.children[p.index] = values[k];
  20441. while (p.index > 0) {
  20442. p = code.pop();
  20443. }
  20444. p.index++;
  20445. code.push(p);
  20446. while (code.length <= i) {
  20447. code.push(q = {
  20448. children: [],
  20449. index: 0
  20450. });
  20451. p.children[p.index] = q.children;
  20452. p = q;
  20453. }
  20454. k++;
  20455. }
  20456. if (i + 1 < length) {
  20457. code.push(q = {
  20458. children: [],
  20459. index: 0
  20460. });
  20461. p.children[p.index] = q.children;
  20462. p = q;
  20463. }
  20464. }
  20465. return code[0].children;
  20466. }
  20467. function getBlockBufferOffset(component, row, col) {
  20468. return 64 * ((component.blocksPerLine + 1) * row + col);
  20469. }
  20470. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive) {
  20471. let parseDNLMarker = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
  20472. const mcusPerLine = frame.mcusPerLine;
  20473. const progressive = frame.progressive;
  20474. const startOffset = offset;
  20475. let bitsData = 0,
  20476. bitsCount = 0;
  20477. function readBit() {
  20478. if (bitsCount > 0) {
  20479. bitsCount--;
  20480. return bitsData >> bitsCount & 1;
  20481. }
  20482. bitsData = data[offset++];
  20483. if (bitsData === 0xff) {
  20484. const nextByte = data[offset++];
  20485. if (nextByte) {
  20486. if (nextByte === 0xdc && parseDNLMarker) {
  20487. offset += 2;
  20488. const scanLines = (0, _core_utils.readUint16)(data, offset);
  20489. offset += 2;
  20490. if (scanLines > 0 && scanLines !== frame.scanLines) {
  20491. throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
  20492. }
  20493. } else if (nextByte === 0xd9) {
  20494. if (parseDNLMarker) {
  20495. const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
  20496. if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 5) {
  20497. throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
  20498. }
  20499. }
  20500. throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
  20501. }
  20502. throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
  20503. }
  20504. }
  20505. bitsCount = 7;
  20506. return bitsData >>> 7;
  20507. }
  20508. function decodeHuffman(tree) {
  20509. let node = tree;
  20510. while (true) {
  20511. node = node[readBit()];
  20512. switch (typeof node) {
  20513. case "number":
  20514. return node;
  20515. case "object":
  20516. continue;
  20517. }
  20518. throw new JpegError("invalid huffman sequence");
  20519. }
  20520. }
  20521. function receive(length) {
  20522. let n = 0;
  20523. while (length > 0) {
  20524. n = n << 1 | readBit();
  20525. length--;
  20526. }
  20527. return n;
  20528. }
  20529. function receiveAndExtend(length) {
  20530. if (length === 1) {
  20531. return readBit() === 1 ? 1 : -1;
  20532. }
  20533. const n = receive(length);
  20534. if (n >= 1 << length - 1) {
  20535. return n;
  20536. }
  20537. return n + (-1 << length) + 1;
  20538. }
  20539. function decodeBaseline(component, blockOffset) {
  20540. const t = decodeHuffman(component.huffmanTableDC);
  20541. const diff = t === 0 ? 0 : receiveAndExtend(t);
  20542. component.blockData[blockOffset] = component.pred += diff;
  20543. let k = 1;
  20544. while (k < 64) {
  20545. const rs = decodeHuffman(component.huffmanTableAC);
  20546. const s = rs & 15,
  20547. r = rs >> 4;
  20548. if (s === 0) {
  20549. if (r < 15) {
  20550. break;
  20551. }
  20552. k += 16;
  20553. continue;
  20554. }
  20555. k += r;
  20556. const z = dctZigZag[k];
  20557. component.blockData[blockOffset + z] = receiveAndExtend(s);
  20558. k++;
  20559. }
  20560. }
  20561. function decodeDCFirst(component, blockOffset) {
  20562. const t = decodeHuffman(component.huffmanTableDC);
  20563. const diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  20564. component.blockData[blockOffset] = component.pred += diff;
  20565. }
  20566. function decodeDCSuccessive(component, blockOffset) {
  20567. component.blockData[blockOffset] |= readBit() << successive;
  20568. }
  20569. let eobrun = 0;
  20570. function decodeACFirst(component, blockOffset) {
  20571. if (eobrun > 0) {
  20572. eobrun--;
  20573. return;
  20574. }
  20575. let k = spectralStart;
  20576. const e = spectralEnd;
  20577. while (k <= e) {
  20578. const rs = decodeHuffman(component.huffmanTableAC);
  20579. const s = rs & 15,
  20580. r = rs >> 4;
  20581. if (s === 0) {
  20582. if (r < 15) {
  20583. eobrun = receive(r) + (1 << r) - 1;
  20584. break;
  20585. }
  20586. k += 16;
  20587. continue;
  20588. }
  20589. k += r;
  20590. const z = dctZigZag[k];
  20591. component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
  20592. k++;
  20593. }
  20594. }
  20595. let successiveACState = 0,
  20596. successiveACNextValue;
  20597. function decodeACSuccessive(component, blockOffset) {
  20598. let k = spectralStart;
  20599. const e = spectralEnd;
  20600. let r = 0;
  20601. let s;
  20602. let rs;
  20603. while (k <= e) {
  20604. const offsetZ = blockOffset + dctZigZag[k];
  20605. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  20606. switch (successiveACState) {
  20607. case 0:
  20608. rs = decodeHuffman(component.huffmanTableAC);
  20609. s = rs & 15;
  20610. r = rs >> 4;
  20611. if (s === 0) {
  20612. if (r < 15) {
  20613. eobrun = receive(r) + (1 << r);
  20614. successiveACState = 4;
  20615. } else {
  20616. r = 16;
  20617. successiveACState = 1;
  20618. }
  20619. } else {
  20620. if (s !== 1) {
  20621. throw new JpegError("invalid ACn encoding");
  20622. }
  20623. successiveACNextValue = receiveAndExtend(s);
  20624. successiveACState = r ? 2 : 3;
  20625. }
  20626. continue;
  20627. case 1:
  20628. case 2:
  20629. if (component.blockData[offsetZ]) {
  20630. component.blockData[offsetZ] += sign * (readBit() << successive);
  20631. } else {
  20632. r--;
  20633. if (r === 0) {
  20634. successiveACState = successiveACState === 2 ? 3 : 0;
  20635. }
  20636. }
  20637. break;
  20638. case 3:
  20639. if (component.blockData[offsetZ]) {
  20640. component.blockData[offsetZ] += sign * (readBit() << successive);
  20641. } else {
  20642. component.blockData[offsetZ] = successiveACNextValue << successive;
  20643. successiveACState = 0;
  20644. }
  20645. break;
  20646. case 4:
  20647. if (component.blockData[offsetZ]) {
  20648. component.blockData[offsetZ] += sign * (readBit() << successive);
  20649. }
  20650. break;
  20651. }
  20652. k++;
  20653. }
  20654. if (successiveACState === 4) {
  20655. eobrun--;
  20656. if (eobrun === 0) {
  20657. successiveACState = 0;
  20658. }
  20659. }
  20660. }
  20661. let blockRow = 0;
  20662. function decodeMcu(component, decode, mcu, row, col) {
  20663. const mcuRow = mcu / mcusPerLine | 0;
  20664. const mcuCol = mcu % mcusPerLine;
  20665. blockRow = mcuRow * component.v + row;
  20666. const blockCol = mcuCol * component.h + col;
  20667. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  20668. decode(component, blockOffset);
  20669. }
  20670. function decodeBlock(component, decode, mcu) {
  20671. blockRow = mcu / component.blocksPerLine | 0;
  20672. const blockCol = mcu % component.blocksPerLine;
  20673. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  20674. decode(component, blockOffset);
  20675. }
  20676. const componentsLength = components.length;
  20677. let component, i, j, k, n;
  20678. let decodeFn;
  20679. if (progressive) {
  20680. if (spectralStart === 0) {
  20681. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  20682. } else {
  20683. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  20684. }
  20685. } else {
  20686. decodeFn = decodeBaseline;
  20687. }
  20688. let mcu = 0,
  20689. fileMarker;
  20690. let mcuExpected;
  20691. if (componentsLength === 1) {
  20692. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  20693. } else {
  20694. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  20695. }
  20696. let h, v;
  20697. while (mcu <= mcuExpected) {
  20698. const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  20699. if (mcuToRead > 0) {
  20700. for (i = 0; i < componentsLength; i++) {
  20701. components[i].pred = 0;
  20702. }
  20703. eobrun = 0;
  20704. if (componentsLength === 1) {
  20705. component = components[0];
  20706. for (n = 0; n < mcuToRead; n++) {
  20707. decodeBlock(component, decodeFn, mcu);
  20708. mcu++;
  20709. }
  20710. } else {
  20711. for (n = 0; n < mcuToRead; n++) {
  20712. for (i = 0; i < componentsLength; i++) {
  20713. component = components[i];
  20714. h = component.h;
  20715. v = component.v;
  20716. for (j = 0; j < v; j++) {
  20717. for (k = 0; k < h; k++) {
  20718. decodeMcu(component, decodeFn, mcu, j, k);
  20719. }
  20720. }
  20721. }
  20722. mcu++;
  20723. }
  20724. }
  20725. }
  20726. bitsCount = 0;
  20727. fileMarker = findNextFileMarker(data, offset);
  20728. if (!fileMarker) {
  20729. break;
  20730. }
  20731. if (fileMarker.invalid) {
  20732. const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
  20733. (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
  20734. offset = fileMarker.offset;
  20735. }
  20736. if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
  20737. offset += 2;
  20738. } else {
  20739. break;
  20740. }
  20741. }
  20742. return offset - startOffset;
  20743. }
  20744. function quantizeAndInverse(component, blockBufferOffset, p) {
  20745. const qt = component.quantizationTable,
  20746. blockData = component.blockData;
  20747. let v0, v1, v2, v3, v4, v5, v6, v7;
  20748. let p0, p1, p2, p3, p4, p5, p6, p7;
  20749. let t;
  20750. if (!qt) {
  20751. throw new JpegError("missing required Quantization Table.");
  20752. }
  20753. for (let row = 0; row < 64; row += 8) {
  20754. p0 = blockData[blockBufferOffset + row];
  20755. p1 = blockData[blockBufferOffset + row + 1];
  20756. p2 = blockData[blockBufferOffset + row + 2];
  20757. p3 = blockData[blockBufferOffset + row + 3];
  20758. p4 = blockData[blockBufferOffset + row + 4];
  20759. p5 = blockData[blockBufferOffset + row + 5];
  20760. p6 = blockData[blockBufferOffset + row + 6];
  20761. p7 = blockData[blockBufferOffset + row + 7];
  20762. p0 *= qt[row];
  20763. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  20764. t = dctSqrt2 * p0 + 512 >> 10;
  20765. p[row] = t;
  20766. p[row + 1] = t;
  20767. p[row + 2] = t;
  20768. p[row + 3] = t;
  20769. p[row + 4] = t;
  20770. p[row + 5] = t;
  20771. p[row + 6] = t;
  20772. p[row + 7] = t;
  20773. continue;
  20774. }
  20775. p1 *= qt[row + 1];
  20776. p2 *= qt[row + 2];
  20777. p3 *= qt[row + 3];
  20778. p4 *= qt[row + 4];
  20779. p5 *= qt[row + 5];
  20780. p6 *= qt[row + 6];
  20781. p7 *= qt[row + 7];
  20782. v0 = dctSqrt2 * p0 + 128 >> 8;
  20783. v1 = dctSqrt2 * p4 + 128 >> 8;
  20784. v2 = p2;
  20785. v3 = p6;
  20786. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  20787. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  20788. v5 = p3 << 4;
  20789. v6 = p5 << 4;
  20790. v0 = v0 + v1 + 1 >> 1;
  20791. v1 = v0 - v1;
  20792. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  20793. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  20794. v3 = t;
  20795. v4 = v4 + v6 + 1 >> 1;
  20796. v6 = v4 - v6;
  20797. v7 = v7 + v5 + 1 >> 1;
  20798. v5 = v7 - v5;
  20799. v0 = v0 + v3 + 1 >> 1;
  20800. v3 = v0 - v3;
  20801. v1 = v1 + v2 + 1 >> 1;
  20802. v2 = v1 - v2;
  20803. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  20804. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  20805. v7 = t;
  20806. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  20807. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  20808. v6 = t;
  20809. p[row] = v0 + v7;
  20810. p[row + 7] = v0 - v7;
  20811. p[row + 1] = v1 + v6;
  20812. p[row + 6] = v1 - v6;
  20813. p[row + 2] = v2 + v5;
  20814. p[row + 5] = v2 - v5;
  20815. p[row + 3] = v3 + v4;
  20816. p[row + 4] = v3 - v4;
  20817. }
  20818. for (let col = 0; col < 8; ++col) {
  20819. p0 = p[col];
  20820. p1 = p[col + 8];
  20821. p2 = p[col + 16];
  20822. p3 = p[col + 24];
  20823. p4 = p[col + 32];
  20824. p5 = p[col + 40];
  20825. p6 = p[col + 48];
  20826. p7 = p[col + 56];
  20827. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  20828. t = dctSqrt2 * p0 + 8192 >> 14;
  20829. if (t < -2040) {
  20830. t = 0;
  20831. } else if (t >= 2024) {
  20832. t = 255;
  20833. } else {
  20834. t = t + 2056 >> 4;
  20835. }
  20836. blockData[blockBufferOffset + col] = t;
  20837. blockData[blockBufferOffset + col + 8] = t;
  20838. blockData[blockBufferOffset + col + 16] = t;
  20839. blockData[blockBufferOffset + col + 24] = t;
  20840. blockData[blockBufferOffset + col + 32] = t;
  20841. blockData[blockBufferOffset + col + 40] = t;
  20842. blockData[blockBufferOffset + col + 48] = t;
  20843. blockData[blockBufferOffset + col + 56] = t;
  20844. continue;
  20845. }
  20846. v0 = dctSqrt2 * p0 + 2048 >> 12;
  20847. v1 = dctSqrt2 * p4 + 2048 >> 12;
  20848. v2 = p2;
  20849. v3 = p6;
  20850. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  20851. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  20852. v5 = p3;
  20853. v6 = p5;
  20854. v0 = (v0 + v1 + 1 >> 1) + 4112;
  20855. v1 = v0 - v1;
  20856. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  20857. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  20858. v3 = t;
  20859. v4 = v4 + v6 + 1 >> 1;
  20860. v6 = v4 - v6;
  20861. v7 = v7 + v5 + 1 >> 1;
  20862. v5 = v7 - v5;
  20863. v0 = v0 + v3 + 1 >> 1;
  20864. v3 = v0 - v3;
  20865. v1 = v1 + v2 + 1 >> 1;
  20866. v2 = v1 - v2;
  20867. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  20868. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  20869. v7 = t;
  20870. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  20871. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  20872. v6 = t;
  20873. p0 = v0 + v7;
  20874. p7 = v0 - v7;
  20875. p1 = v1 + v6;
  20876. p6 = v1 - v6;
  20877. p2 = v2 + v5;
  20878. p5 = v2 - v5;
  20879. p3 = v3 + v4;
  20880. p4 = v3 - v4;
  20881. if (p0 < 16) {
  20882. p0 = 0;
  20883. } else if (p0 >= 4080) {
  20884. p0 = 255;
  20885. } else {
  20886. p0 >>= 4;
  20887. }
  20888. if (p1 < 16) {
  20889. p1 = 0;
  20890. } else if (p1 >= 4080) {
  20891. p1 = 255;
  20892. } else {
  20893. p1 >>= 4;
  20894. }
  20895. if (p2 < 16) {
  20896. p2 = 0;
  20897. } else if (p2 >= 4080) {
  20898. p2 = 255;
  20899. } else {
  20900. p2 >>= 4;
  20901. }
  20902. if (p3 < 16) {
  20903. p3 = 0;
  20904. } else if (p3 >= 4080) {
  20905. p3 = 255;
  20906. } else {
  20907. p3 >>= 4;
  20908. }
  20909. if (p4 < 16) {
  20910. p4 = 0;
  20911. } else if (p4 >= 4080) {
  20912. p4 = 255;
  20913. } else {
  20914. p4 >>= 4;
  20915. }
  20916. if (p5 < 16) {
  20917. p5 = 0;
  20918. } else if (p5 >= 4080) {
  20919. p5 = 255;
  20920. } else {
  20921. p5 >>= 4;
  20922. }
  20923. if (p6 < 16) {
  20924. p6 = 0;
  20925. } else if (p6 >= 4080) {
  20926. p6 = 255;
  20927. } else {
  20928. p6 >>= 4;
  20929. }
  20930. if (p7 < 16) {
  20931. p7 = 0;
  20932. } else if (p7 >= 4080) {
  20933. p7 = 255;
  20934. } else {
  20935. p7 >>= 4;
  20936. }
  20937. blockData[blockBufferOffset + col] = p0;
  20938. blockData[blockBufferOffset + col + 8] = p1;
  20939. blockData[blockBufferOffset + col + 16] = p2;
  20940. blockData[blockBufferOffset + col + 24] = p3;
  20941. blockData[blockBufferOffset + col + 32] = p4;
  20942. blockData[blockBufferOffset + col + 40] = p5;
  20943. blockData[blockBufferOffset + col + 48] = p6;
  20944. blockData[blockBufferOffset + col + 56] = p7;
  20945. }
  20946. }
  20947. function buildComponentData(frame, component) {
  20948. const blocksPerLine = component.blocksPerLine;
  20949. const blocksPerColumn = component.blocksPerColumn;
  20950. const computationBuffer = new Int16Array(64);
  20951. for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  20952. for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  20953. const offset = getBlockBufferOffset(component, blockRow, blockCol);
  20954. quantizeAndInverse(component, offset, computationBuffer);
  20955. }
  20956. }
  20957. return component.blockData;
  20958. }
  20959. function findNextFileMarker(data, currentPos) {
  20960. let startPos = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : currentPos;
  20961. const maxPos = data.length - 1;
  20962. let newPos = startPos < currentPos ? startPos : currentPos;
  20963. if (currentPos >= maxPos) {
  20964. return null;
  20965. }
  20966. const currentMarker = (0, _core_utils.readUint16)(data, currentPos);
  20967. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  20968. return {
  20969. invalid: null,
  20970. marker: currentMarker,
  20971. offset: currentPos
  20972. };
  20973. }
  20974. let newMarker = (0, _core_utils.readUint16)(data, newPos);
  20975. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  20976. if (++newPos >= maxPos) {
  20977. return null;
  20978. }
  20979. newMarker = (0, _core_utils.readUint16)(data, newPos);
  20980. }
  20981. return {
  20982. invalid: currentMarker.toString(16),
  20983. marker: newMarker,
  20984. offset: newPos
  20985. };
  20986. }
  20987. class JpegImage {
  20988. constructor() {
  20989. let {
  20990. decodeTransform = null,
  20991. colorTransform = -1
  20992. } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  20993. this._decodeTransform = decodeTransform;
  20994. this._colorTransform = colorTransform;
  20995. }
  20996. parse(data) {
  20997. let {
  20998. dnlScanLines = null
  20999. } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  21000. function readDataBlock() {
  21001. const length = (0, _core_utils.readUint16)(data, offset);
  21002. offset += 2;
  21003. let endOffset = offset + length - 2;
  21004. const fileMarker = findNextFileMarker(data, endOffset, offset);
  21005. if (fileMarker && fileMarker.invalid) {
  21006. (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
  21007. endOffset = fileMarker.offset;
  21008. }
  21009. const array = data.subarray(offset, endOffset);
  21010. offset += array.length;
  21011. return array;
  21012. }
  21013. function prepareComponents(frame) {
  21014. const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  21015. const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  21016. for (const component of frame.components) {
  21017. const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  21018. const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  21019. const blocksPerLineForMcu = mcusPerLine * component.h;
  21020. const blocksPerColumnForMcu = mcusPerColumn * component.v;
  21021. const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  21022. component.blockData = new Int16Array(blocksBufferSize);
  21023. component.blocksPerLine = blocksPerLine;
  21024. component.blocksPerColumn = blocksPerColumn;
  21025. }
  21026. frame.mcusPerLine = mcusPerLine;
  21027. frame.mcusPerColumn = mcusPerColumn;
  21028. }
  21029. let offset = 0;
  21030. let jfif = null;
  21031. let adobe = null;
  21032. let frame, resetInterval;
  21033. let numSOSMarkers = 0;
  21034. const quantizationTables = [];
  21035. const huffmanTablesAC = [],
  21036. huffmanTablesDC = [];
  21037. let fileMarker = (0, _core_utils.readUint16)(data, offset);
  21038. offset += 2;
  21039. if (fileMarker !== 0xffd8) {
  21040. throw new JpegError("SOI not found");
  21041. }
  21042. fileMarker = (0, _core_utils.readUint16)(data, offset);
  21043. offset += 2;
  21044. markerLoop: while (fileMarker !== 0xffd9) {
  21045. let i, j, l;
  21046. switch (fileMarker) {
  21047. case 0xffe0:
  21048. case 0xffe1:
  21049. case 0xffe2:
  21050. case 0xffe3:
  21051. case 0xffe4:
  21052. case 0xffe5:
  21053. case 0xffe6:
  21054. case 0xffe7:
  21055. case 0xffe8:
  21056. case 0xffe9:
  21057. case 0xffea:
  21058. case 0xffeb:
  21059. case 0xffec:
  21060. case 0xffed:
  21061. case 0xffee:
  21062. case 0xffef:
  21063. case 0xfffe:
  21064. const appData = readDataBlock();
  21065. if (fileMarker === 0xffe0) {
  21066. if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  21067. jfif = {
  21068. version: {
  21069. major: appData[5],
  21070. minor: appData[6]
  21071. },
  21072. densityUnits: appData[7],
  21073. xDensity: appData[8] << 8 | appData[9],
  21074. yDensity: appData[10] << 8 | appData[11],
  21075. thumbWidth: appData[12],
  21076. thumbHeight: appData[13],
  21077. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  21078. };
  21079. }
  21080. }
  21081. if (fileMarker === 0xffee) {
  21082. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
  21083. adobe = {
  21084. version: appData[5] << 8 | appData[6],
  21085. flags0: appData[7] << 8 | appData[8],
  21086. flags1: appData[9] << 8 | appData[10],
  21087. transformCode: appData[11]
  21088. };
  21089. }
  21090. }
  21091. break;
  21092. case 0xffdb:
  21093. const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
  21094. offset += 2;
  21095. const quantizationTablesEnd = quantizationTablesLength + offset - 2;
  21096. let z;
  21097. while (offset < quantizationTablesEnd) {
  21098. const quantizationTableSpec = data[offset++];
  21099. const tableData = new Uint16Array(64);
  21100. if (quantizationTableSpec >> 4 === 0) {
  21101. for (j = 0; j < 64; j++) {
  21102. z = dctZigZag[j];
  21103. tableData[z] = data[offset++];
  21104. }
  21105. } else if (quantizationTableSpec >> 4 === 1) {
  21106. for (j = 0; j < 64; j++) {
  21107. z = dctZigZag[j];
  21108. tableData[z] = (0, _core_utils.readUint16)(data, offset);
  21109. offset += 2;
  21110. }
  21111. } else {
  21112. throw new JpegError("DQT - invalid table spec");
  21113. }
  21114. quantizationTables[quantizationTableSpec & 15] = tableData;
  21115. }
  21116. break;
  21117. case 0xffc0:
  21118. case 0xffc1:
  21119. case 0xffc2:
  21120. if (frame) {
  21121. throw new JpegError("Only single frame JPEGs supported");
  21122. }
  21123. offset += 2;
  21124. frame = {};
  21125. frame.extended = fileMarker === 0xffc1;
  21126. frame.progressive = fileMarker === 0xffc2;
  21127. frame.precision = data[offset++];
  21128. const sofScanLines = (0, _core_utils.readUint16)(data, offset);
  21129. offset += 2;
  21130. frame.scanLines = dnlScanLines || sofScanLines;
  21131. frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);
  21132. offset += 2;
  21133. frame.components = [];
  21134. frame.componentIds = {};
  21135. const componentsCount = data[offset++];
  21136. let maxH = 0,
  21137. maxV = 0;
  21138. for (i = 0; i < componentsCount; i++) {
  21139. const componentId = data[offset];
  21140. const h = data[offset + 1] >> 4;
  21141. const v = data[offset + 1] & 15;
  21142. if (maxH < h) {
  21143. maxH = h;
  21144. }
  21145. if (maxV < v) {
  21146. maxV = v;
  21147. }
  21148. const qId = data[offset + 2];
  21149. l = frame.components.push({
  21150. h,
  21151. v,
  21152. quantizationId: qId,
  21153. quantizationTable: null
  21154. });
  21155. frame.componentIds[componentId] = l - 1;
  21156. offset += 3;
  21157. }
  21158. frame.maxH = maxH;
  21159. frame.maxV = maxV;
  21160. prepareComponents(frame);
  21161. break;
  21162. case 0xffc4:
  21163. const huffmanLength = (0, _core_utils.readUint16)(data, offset);
  21164. offset += 2;
  21165. for (i = 2; i < huffmanLength;) {
  21166. const huffmanTableSpec = data[offset++];
  21167. const codeLengths = new Uint8Array(16);
  21168. let codeLengthSum = 0;
  21169. for (j = 0; j < 16; j++, offset++) {
  21170. codeLengthSum += codeLengths[j] = data[offset];
  21171. }
  21172. const huffmanValues = new Uint8Array(codeLengthSum);
  21173. for (j = 0; j < codeLengthSum; j++, offset++) {
  21174. huffmanValues[j] = data[offset];
  21175. }
  21176. i += 17 + codeLengthSum;
  21177. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  21178. }
  21179. break;
  21180. case 0xffdd:
  21181. offset += 2;
  21182. resetInterval = (0, _core_utils.readUint16)(data, offset);
  21183. offset += 2;
  21184. break;
  21185. case 0xffda:
  21186. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  21187. offset += 2;
  21188. const selectorsCount = data[offset++],
  21189. components = [];
  21190. for (i = 0; i < selectorsCount; i++) {
  21191. const index = data[offset++];
  21192. const componentIndex = frame.componentIds[index];
  21193. const component = frame.components[componentIndex];
  21194. component.index = index;
  21195. const tableSpec = data[offset++];
  21196. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  21197. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  21198. components.push(component);
  21199. }
  21200. const spectralStart = data[offset++],
  21201. spectralEnd = data[offset++],
  21202. successiveApproximation = data[offset++];
  21203. try {
  21204. const processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
  21205. offset += processed;
  21206. } catch (ex) {
  21207. if (ex instanceof DNLMarkerError) {
  21208. (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);
  21209. return this.parse(data, {
  21210. dnlScanLines: ex.scanLines
  21211. });
  21212. } else if (ex instanceof EOIMarkerError) {
  21213. (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
  21214. break markerLoop;
  21215. }
  21216. throw ex;
  21217. }
  21218. break;
  21219. case 0xffdc:
  21220. offset += 4;
  21221. break;
  21222. case 0xffff:
  21223. if (data[offset] !== 0xff) {
  21224. offset--;
  21225. }
  21226. break;
  21227. default:
  21228. const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
  21229. if (nextFileMarker && nextFileMarker.invalid) {
  21230. (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
  21231. offset = nextFileMarker.offset;
  21232. break;
  21233. }
  21234. if (!nextFileMarker || offset >= data.length - 1) {
  21235. (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
  21236. break markerLoop;
  21237. }
  21238. throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
  21239. }
  21240. fileMarker = (0, _core_utils.readUint16)(data, offset);
  21241. offset += 2;
  21242. }
  21243. this.width = frame.samplesPerLine;
  21244. this.height = frame.scanLines;
  21245. this.jfif = jfif;
  21246. this.adobe = adobe;
  21247. this.components = [];
  21248. for (const component of frame.components) {
  21249. const quantizationTable = quantizationTables[component.quantizationId];
  21250. if (quantizationTable) {
  21251. component.quantizationTable = quantizationTable;
  21252. }
  21253. this.components.push({
  21254. index: component.index,
  21255. output: buildComponentData(frame, component),
  21256. scaleX: component.h / frame.maxH,
  21257. scaleY: component.v / frame.maxV,
  21258. blocksPerLine: component.blocksPerLine,
  21259. blocksPerColumn: component.blocksPerColumn
  21260. });
  21261. }
  21262. this.numComponents = this.components.length;
  21263. return undefined;
  21264. }
  21265. _getLinearizedBlockData(width, height) {
  21266. let isSourcePDF = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  21267. const scaleX = this.width / width,
  21268. scaleY = this.height / height;
  21269. let component, componentScaleX, componentScaleY, blocksPerScanline;
  21270. let x, y, i, j, k;
  21271. let index;
  21272. let offset = 0;
  21273. let output;
  21274. const numComponents = this.components.length;
  21275. const dataLength = width * height * numComponents;
  21276. const data = new Uint8ClampedArray(dataLength);
  21277. const xScaleBlockOffset = new Uint32Array(width);
  21278. const mask3LSB = 0xfffffff8;
  21279. let lastComponentScaleX;
  21280. for (i = 0; i < numComponents; i++) {
  21281. component = this.components[i];
  21282. componentScaleX = component.scaleX * scaleX;
  21283. componentScaleY = component.scaleY * scaleY;
  21284. offset = i;
  21285. output = component.output;
  21286. blocksPerScanline = component.blocksPerLine + 1 << 3;
  21287. if (componentScaleX !== lastComponentScaleX) {
  21288. for (x = 0; x < width; x++) {
  21289. j = 0 | x * componentScaleX;
  21290. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  21291. }
  21292. lastComponentScaleX = componentScaleX;
  21293. }
  21294. for (y = 0; y < height; y++) {
  21295. j = 0 | y * componentScaleY;
  21296. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  21297. for (x = 0; x < width; x++) {
  21298. data[offset] = output[index + xScaleBlockOffset[x]];
  21299. offset += numComponents;
  21300. }
  21301. }
  21302. }
  21303. let transform = this._decodeTransform;
  21304. if (!isSourcePDF && numComponents === 4 && !transform) {
  21305. transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
  21306. }
  21307. if (transform) {
  21308. for (i = 0; i < dataLength;) {
  21309. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  21310. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  21311. }
  21312. }
  21313. }
  21314. return data;
  21315. }
  21316. get _isColorConversionNeeded() {
  21317. if (this.adobe) {
  21318. return !!this.adobe.transformCode;
  21319. }
  21320. if (this.numComponents === 3) {
  21321. if (this._colorTransform === 0) {
  21322. return false;
  21323. } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) {
  21324. return false;
  21325. }
  21326. return true;
  21327. }
  21328. if (this._colorTransform === 1) {
  21329. return true;
  21330. }
  21331. return false;
  21332. }
  21333. _convertYccToRgb(data) {
  21334. let Y, Cb, Cr;
  21335. for (let i = 0, length = data.length; i < length; i += 3) {
  21336. Y = data[i];
  21337. Cb = data[i + 1];
  21338. Cr = data[i + 2];
  21339. data[i] = Y - 179.456 + 1.402 * Cr;
  21340. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  21341. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  21342. }
  21343. return data;
  21344. }
  21345. _convertYcckToRgb(data) {
  21346. let Y, Cb, Cr, k;
  21347. let offset = 0;
  21348. for (let i = 0, length = data.length; i < length; i += 4) {
  21349. Y = data[i];
  21350. Cb = data[i + 1];
  21351. Cr = data[i + 2];
  21352. k = data[i + 3];
  21353. 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);
  21354. 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);
  21355. 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);
  21356. }
  21357. return data.subarray(0, offset);
  21358. }
  21359. _convertYcckToCmyk(data) {
  21360. let Y, Cb, Cr;
  21361. for (let i = 0, length = data.length; i < length; i += 4) {
  21362. Y = data[i];
  21363. Cb = data[i + 1];
  21364. Cr = data[i + 2];
  21365. data[i] = 434.456 - Y - 1.402 * Cr;
  21366. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  21367. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  21368. }
  21369. return data;
  21370. }
  21371. _convertCmykToRgb(data) {
  21372. let c, m, y, k;
  21373. let offset = 0;
  21374. for (let i = 0, length = data.length; i < length; i += 4) {
  21375. c = data[i];
  21376. m = data[i + 1];
  21377. y = data[i + 2];
  21378. k = data[i + 3];
  21379. 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);
  21380. 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);
  21381. 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);
  21382. }
  21383. return data.subarray(0, offset);
  21384. }
  21385. getData(_ref) {
  21386. let {
  21387. width,
  21388. height,
  21389. forceRGB = false,
  21390. isSourcePDF = false
  21391. } = _ref;
  21392. if (this.numComponents > 4) {
  21393. throw new JpegError("Unsupported color mode");
  21394. }
  21395. const data = this._getLinearizedBlockData(width, height, isSourcePDF);
  21396. if (this.numComponents === 1 && forceRGB) {
  21397. const rgbData = new Uint8ClampedArray(data.length * 3);
  21398. let offset = 0;
  21399. for (const grayColor of data) {
  21400. rgbData[offset++] = grayColor;
  21401. rgbData[offset++] = grayColor;
  21402. rgbData[offset++] = grayColor;
  21403. }
  21404. return rgbData;
  21405. } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
  21406. return this._convertYccToRgb(data);
  21407. } else if (this.numComponents === 4) {
  21408. if (this._isColorConversionNeeded) {
  21409. if (forceRGB) {
  21410. return this._convertYcckToRgb(data);
  21411. }
  21412. return this._convertYcckToCmyk(data);
  21413. } else if (forceRGB) {
  21414. return this._convertCmykToRgb(data);
  21415. }
  21416. }
  21417. return data;
  21418. }
  21419. }
  21420. exports.JpegImage = JpegImage;
  21421. /***/ }),
  21422. /* 160 */
  21423. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  21424. "use strict";
  21425. Object.defineProperty(exports, "__esModule", ({
  21426. value: true
  21427. }));
  21428. exports.JpxStream = void 0;
  21429. var _decode_stream = __w_pdfjs_require__(150);
  21430. var _jpx = __w_pdfjs_require__(161);
  21431. var _util = __w_pdfjs_require__(2);
  21432. class JpxStream extends _decode_stream.DecodeStream {
  21433. constructor(stream, maybeLength, params) {
  21434. super(maybeLength);
  21435. this.stream = stream;
  21436. this.dict = stream.dict;
  21437. this.maybeLength = maybeLength;
  21438. this.params = params;
  21439. }
  21440. get bytes() {
  21441. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  21442. }
  21443. ensureBuffer(requested) {}
  21444. readBlock() {
  21445. if (this.eof) {
  21446. return;
  21447. }
  21448. const jpxImage = new _jpx.JpxImage();
  21449. jpxImage.parse(this.bytes);
  21450. const width = jpxImage.width;
  21451. const height = jpxImage.height;
  21452. const componentsCount = jpxImage.componentsCount;
  21453. const tileCount = jpxImage.tiles.length;
  21454. if (tileCount === 1) {
  21455. this.buffer = jpxImage.tiles[0].items;
  21456. } else {
  21457. const data = new Uint8ClampedArray(width * height * componentsCount);
  21458. for (let k = 0; k < tileCount; k++) {
  21459. const tileComponents = jpxImage.tiles[k];
  21460. const tileWidth = tileComponents.width;
  21461. const tileHeight = tileComponents.height;
  21462. const tileLeft = tileComponents.left;
  21463. const tileTop = tileComponents.top;
  21464. const src = tileComponents.items;
  21465. let srcPosition = 0;
  21466. let dataPosition = (width * tileTop + tileLeft) * componentsCount;
  21467. const imgRowSize = width * componentsCount;
  21468. const tileRowSize = tileWidth * componentsCount;
  21469. for (let j = 0; j < tileHeight; j++) {
  21470. const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  21471. data.set(rowBytes, dataPosition);
  21472. srcPosition += tileRowSize;
  21473. dataPosition += imgRowSize;
  21474. }
  21475. }
  21476. this.buffer = data;
  21477. }
  21478. this.bufferLength = this.buffer.length;
  21479. this.eof = true;
  21480. }
  21481. }
  21482. exports.JpxStream = JpxStream;
  21483. /***/ }),
  21484. /* 161 */
  21485. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  21486. "use strict";
  21487. Object.defineProperty(exports, "__esModule", ({
  21488. value: true
  21489. }));
  21490. exports.JpxImage = void 0;
  21491. var _util = __w_pdfjs_require__(2);
  21492. var _core_utils = __w_pdfjs_require__(136);
  21493. var _arithmetic_decoder = __w_pdfjs_require__(157);
  21494. class JpxError extends _util.BaseException {
  21495. constructor(msg) {
  21496. super(`JPX error: ${msg}`, "JpxError");
  21497. }
  21498. }
  21499. const SubbandsGainLog2 = {
  21500. LL: 0,
  21501. LH: 1,
  21502. HL: 1,
  21503. HH: 2
  21504. };
  21505. class JpxImage {
  21506. constructor() {
  21507. this.failOnCorruptedImage = false;
  21508. }
  21509. parse(data) {
  21510. const head = (0, _core_utils.readUint16)(data, 0);
  21511. if (head === 0xff4f) {
  21512. this.parseCodestream(data, 0, data.length);
  21513. return;
  21514. }
  21515. const length = data.length;
  21516. let position = 0;
  21517. while (position < length) {
  21518. let headerSize = 8;
  21519. let lbox = (0, _core_utils.readUint32)(data, position);
  21520. const tbox = (0, _core_utils.readUint32)(data, position + 4);
  21521. position += headerSize;
  21522. if (lbox === 1) {
  21523. lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4);
  21524. position += 8;
  21525. headerSize += 8;
  21526. }
  21527. if (lbox === 0) {
  21528. lbox = length - position + headerSize;
  21529. }
  21530. if (lbox < headerSize) {
  21531. throw new JpxError("Invalid box field size");
  21532. }
  21533. const dataLength = lbox - headerSize;
  21534. let jumpDataLength = true;
  21535. switch (tbox) {
  21536. case 0x6a703268:
  21537. jumpDataLength = false;
  21538. break;
  21539. case 0x636f6c72:
  21540. const method = data[position];
  21541. if (method === 1) {
  21542. const colorspace = (0, _core_utils.readUint32)(data, position + 3);
  21543. switch (colorspace) {
  21544. case 16:
  21545. case 17:
  21546. case 18:
  21547. break;
  21548. default:
  21549. (0, _util.warn)("Unknown colorspace " + colorspace);
  21550. break;
  21551. }
  21552. } else if (method === 2) {
  21553. (0, _util.info)("ICC profile not supported");
  21554. }
  21555. break;
  21556. case 0x6a703263:
  21557. this.parseCodestream(data, position, position + dataLength);
  21558. break;
  21559. case 0x6a502020:
  21560. if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) {
  21561. (0, _util.warn)("Invalid JP2 signature");
  21562. }
  21563. break;
  21564. case 0x6a501a1a:
  21565. case 0x66747970:
  21566. case 0x72726571:
  21567. case 0x72657320:
  21568. case 0x69686472:
  21569. break;
  21570. default:
  21571. const headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff);
  21572. (0, _util.warn)(`Unsupported header type ${tbox} (${headerType}).`);
  21573. break;
  21574. }
  21575. if (jumpDataLength) {
  21576. position += dataLength;
  21577. }
  21578. }
  21579. }
  21580. parseImageProperties(stream) {
  21581. let newByte = stream.getByte();
  21582. while (newByte >= 0) {
  21583. const oldByte = newByte;
  21584. newByte = stream.getByte();
  21585. const code = oldByte << 8 | newByte;
  21586. if (code === 0xff51) {
  21587. stream.skip(4);
  21588. const Xsiz = stream.getInt32() >>> 0;
  21589. const Ysiz = stream.getInt32() >>> 0;
  21590. const XOsiz = stream.getInt32() >>> 0;
  21591. const YOsiz = stream.getInt32() >>> 0;
  21592. stream.skip(16);
  21593. const Csiz = stream.getUint16();
  21594. this.width = Xsiz - XOsiz;
  21595. this.height = Ysiz - YOsiz;
  21596. this.componentsCount = Csiz;
  21597. this.bitsPerComponent = 8;
  21598. return;
  21599. }
  21600. }
  21601. throw new JpxError("No size marker found in JPX stream");
  21602. }
  21603. parseCodestream(data, start, end) {
  21604. const context = {};
  21605. let doNotRecover = false;
  21606. try {
  21607. let position = start;
  21608. while (position + 1 < end) {
  21609. const code = (0, _core_utils.readUint16)(data, position);
  21610. position += 2;
  21611. let length = 0,
  21612. j,
  21613. sqcd,
  21614. spqcds,
  21615. spqcdSize,
  21616. scalarExpounded,
  21617. tile;
  21618. switch (code) {
  21619. case 0xff4f:
  21620. context.mainHeader = true;
  21621. break;
  21622. case 0xffd9:
  21623. break;
  21624. case 0xff51:
  21625. length = (0, _core_utils.readUint16)(data, position);
  21626. const siz = {};
  21627. siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);
  21628. siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);
  21629. siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12);
  21630. siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16);
  21631. siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20);
  21632. siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24);
  21633. siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28);
  21634. siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32);
  21635. const componentsCount = (0, _core_utils.readUint16)(data, position + 36);
  21636. siz.Csiz = componentsCount;
  21637. const components = [];
  21638. j = position + 38;
  21639. for (let i = 0; i < componentsCount; i++) {
  21640. const component = {
  21641. precision: (data[j] & 0x7f) + 1,
  21642. isSigned: !!(data[j] & 0x80),
  21643. XRsiz: data[j + 1],
  21644. YRsiz: data[j + 2]
  21645. };
  21646. j += 3;
  21647. calculateComponentDimensions(component, siz);
  21648. components.push(component);
  21649. }
  21650. context.SIZ = siz;
  21651. context.components = components;
  21652. calculateTileGrids(context, components);
  21653. context.QCC = [];
  21654. context.COC = [];
  21655. break;
  21656. case 0xff5c:
  21657. length = (0, _core_utils.readUint16)(data, position);
  21658. const qcd = {};
  21659. j = position + 2;
  21660. sqcd = data[j++];
  21661. switch (sqcd & 0x1f) {
  21662. case 0:
  21663. spqcdSize = 8;
  21664. scalarExpounded = true;
  21665. break;
  21666. case 1:
  21667. spqcdSize = 16;
  21668. scalarExpounded = false;
  21669. break;
  21670. case 2:
  21671. spqcdSize = 16;
  21672. scalarExpounded = true;
  21673. break;
  21674. default:
  21675. throw new Error("Invalid SQcd value " + sqcd);
  21676. }
  21677. qcd.noQuantization = spqcdSize === 8;
  21678. qcd.scalarExpounded = scalarExpounded;
  21679. qcd.guardBits = sqcd >> 5;
  21680. spqcds = [];
  21681. while (j < length + position) {
  21682. const spqcd = {};
  21683. if (spqcdSize === 8) {
  21684. spqcd.epsilon = data[j++] >> 3;
  21685. spqcd.mu = 0;
  21686. } else {
  21687. spqcd.epsilon = data[j] >> 3;
  21688. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  21689. j += 2;
  21690. }
  21691. spqcds.push(spqcd);
  21692. }
  21693. qcd.SPqcds = spqcds;
  21694. if (context.mainHeader) {
  21695. context.QCD = qcd;
  21696. } else {
  21697. context.currentTile.QCD = qcd;
  21698. context.currentTile.QCC = [];
  21699. }
  21700. break;
  21701. case 0xff5d:
  21702. length = (0, _core_utils.readUint16)(data, position);
  21703. const qcc = {};
  21704. j = position + 2;
  21705. let cqcc;
  21706. if (context.SIZ.Csiz < 257) {
  21707. cqcc = data[j++];
  21708. } else {
  21709. cqcc = (0, _core_utils.readUint16)(data, j);
  21710. j += 2;
  21711. }
  21712. sqcd = data[j++];
  21713. switch (sqcd & 0x1f) {
  21714. case 0:
  21715. spqcdSize = 8;
  21716. scalarExpounded = true;
  21717. break;
  21718. case 1:
  21719. spqcdSize = 16;
  21720. scalarExpounded = false;
  21721. break;
  21722. case 2:
  21723. spqcdSize = 16;
  21724. scalarExpounded = true;
  21725. break;
  21726. default:
  21727. throw new Error("Invalid SQcd value " + sqcd);
  21728. }
  21729. qcc.noQuantization = spqcdSize === 8;
  21730. qcc.scalarExpounded = scalarExpounded;
  21731. qcc.guardBits = sqcd >> 5;
  21732. spqcds = [];
  21733. while (j < length + position) {
  21734. const spqcd = {};
  21735. if (spqcdSize === 8) {
  21736. spqcd.epsilon = data[j++] >> 3;
  21737. spqcd.mu = 0;
  21738. } else {
  21739. spqcd.epsilon = data[j] >> 3;
  21740. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  21741. j += 2;
  21742. }
  21743. spqcds.push(spqcd);
  21744. }
  21745. qcc.SPqcds = spqcds;
  21746. if (context.mainHeader) {
  21747. context.QCC[cqcc] = qcc;
  21748. } else {
  21749. context.currentTile.QCC[cqcc] = qcc;
  21750. }
  21751. break;
  21752. case 0xff52:
  21753. length = (0, _core_utils.readUint16)(data, position);
  21754. const cod = {};
  21755. j = position + 2;
  21756. const scod = data[j++];
  21757. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  21758. cod.sopMarkerUsed = !!(scod & 2);
  21759. cod.ephMarkerUsed = !!(scod & 4);
  21760. cod.progressionOrder = data[j++];
  21761. cod.layersCount = (0, _core_utils.readUint16)(data, j);
  21762. j += 2;
  21763. cod.multipleComponentTransform = data[j++];
  21764. cod.decompositionLevelsCount = data[j++];
  21765. cod.xcb = (data[j++] & 0xf) + 2;
  21766. cod.ycb = (data[j++] & 0xf) + 2;
  21767. const blockStyle = data[j++];
  21768. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  21769. cod.resetContextProbabilities = !!(blockStyle & 2);
  21770. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  21771. cod.verticallyStripe = !!(blockStyle & 8);
  21772. cod.predictableTermination = !!(blockStyle & 16);
  21773. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  21774. cod.reversibleTransformation = data[j++];
  21775. if (cod.entropyCoderWithCustomPrecincts) {
  21776. const precinctsSizes = [];
  21777. while (j < length + position) {
  21778. const precinctsSize = data[j++];
  21779. precinctsSizes.push({
  21780. PPx: precinctsSize & 0xf,
  21781. PPy: precinctsSize >> 4
  21782. });
  21783. }
  21784. cod.precinctsSizes = precinctsSizes;
  21785. }
  21786. const unsupported = [];
  21787. if (cod.selectiveArithmeticCodingBypass) {
  21788. unsupported.push("selectiveArithmeticCodingBypass");
  21789. }
  21790. if (cod.terminationOnEachCodingPass) {
  21791. unsupported.push("terminationOnEachCodingPass");
  21792. }
  21793. if (cod.verticallyStripe) {
  21794. unsupported.push("verticallyStripe");
  21795. }
  21796. if (cod.predictableTermination) {
  21797. unsupported.push("predictableTermination");
  21798. }
  21799. if (unsupported.length > 0) {
  21800. doNotRecover = true;
  21801. (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`);
  21802. }
  21803. if (context.mainHeader) {
  21804. context.COD = cod;
  21805. } else {
  21806. context.currentTile.COD = cod;
  21807. context.currentTile.COC = [];
  21808. }
  21809. break;
  21810. case 0xff90:
  21811. length = (0, _core_utils.readUint16)(data, position);
  21812. tile = {};
  21813. tile.index = (0, _core_utils.readUint16)(data, position + 2);
  21814. tile.length = (0, _core_utils.readUint32)(data, position + 4);
  21815. tile.dataEnd = tile.length + position - 2;
  21816. tile.partIndex = data[position + 8];
  21817. tile.partsCount = data[position + 9];
  21818. context.mainHeader = false;
  21819. if (tile.partIndex === 0) {
  21820. tile.COD = context.COD;
  21821. tile.COC = context.COC.slice(0);
  21822. tile.QCD = context.QCD;
  21823. tile.QCC = context.QCC.slice(0);
  21824. }
  21825. context.currentTile = tile;
  21826. break;
  21827. case 0xff93:
  21828. tile = context.currentTile;
  21829. if (tile.partIndex === 0) {
  21830. initializeTile(context, tile.index);
  21831. buildPackets(context);
  21832. }
  21833. length = tile.dataEnd - position;
  21834. parseTilePackets(context, data, position, length);
  21835. break;
  21836. case 0xff53:
  21837. (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented.");
  21838. case 0xff55:
  21839. case 0xff57:
  21840. case 0xff58:
  21841. case 0xff64:
  21842. length = (0, _core_utils.readUint16)(data, position);
  21843. break;
  21844. default:
  21845. throw new Error("Unknown codestream code: " + code.toString(16));
  21846. }
  21847. position += length;
  21848. }
  21849. } catch (e) {
  21850. if (doNotRecover || this.failOnCorruptedImage) {
  21851. throw new JpxError(e.message);
  21852. } else {
  21853. (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`);
  21854. }
  21855. }
  21856. this.tiles = transformComponents(context);
  21857. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  21858. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  21859. this.componentsCount = context.SIZ.Csiz;
  21860. }
  21861. }
  21862. exports.JpxImage = JpxImage;
  21863. function calculateComponentDimensions(component, siz) {
  21864. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  21865. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  21866. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  21867. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  21868. component.width = component.x1 - component.x0;
  21869. component.height = component.y1 - component.y0;
  21870. }
  21871. function calculateTileGrids(context, components) {
  21872. const siz = context.SIZ;
  21873. const tiles = [];
  21874. let tile;
  21875. const numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  21876. const numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  21877. for (let q = 0; q < numYtiles; q++) {
  21878. for (let p = 0; p < numXtiles; p++) {
  21879. tile = {};
  21880. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  21881. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  21882. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  21883. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  21884. tile.width = tile.tx1 - tile.tx0;
  21885. tile.height = tile.ty1 - tile.ty0;
  21886. tile.components = [];
  21887. tiles.push(tile);
  21888. }
  21889. }
  21890. context.tiles = tiles;
  21891. const componentsCount = siz.Csiz;
  21892. for (let i = 0, ii = componentsCount; i < ii; i++) {
  21893. const component = components[i];
  21894. for (let j = 0, jj = tiles.length; j < jj; j++) {
  21895. const tileComponent = {};
  21896. tile = tiles[j];
  21897. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  21898. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  21899. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  21900. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  21901. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  21902. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  21903. tile.components[i] = tileComponent;
  21904. }
  21905. }
  21906. }
  21907. function getBlocksDimensions(context, component, r) {
  21908. const codOrCoc = component.codingStyleParameters;
  21909. const result = {};
  21910. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  21911. result.PPx = 15;
  21912. result.PPy = 15;
  21913. } else {
  21914. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  21915. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  21916. }
  21917. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  21918. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  21919. return result;
  21920. }
  21921. function buildPrecincts(context, resolution, dimensions) {
  21922. const precinctWidth = 1 << dimensions.PPx;
  21923. const precinctHeight = 1 << dimensions.PPy;
  21924. const isZeroRes = resolution.resLevel === 0;
  21925. const precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  21926. const precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  21927. const numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  21928. const numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  21929. const numprecincts = numprecinctswide * numprecinctshigh;
  21930. resolution.precinctParameters = {
  21931. precinctWidth,
  21932. precinctHeight,
  21933. numprecinctswide,
  21934. numprecinctshigh,
  21935. numprecincts,
  21936. precinctWidthInSubband,
  21937. precinctHeightInSubband
  21938. };
  21939. }
  21940. function buildCodeblocks(context, subband, dimensions) {
  21941. const xcb_ = dimensions.xcb_;
  21942. const ycb_ = dimensions.ycb_;
  21943. const codeblockWidth = 1 << xcb_;
  21944. const codeblockHeight = 1 << ycb_;
  21945. const cbx0 = subband.tbx0 >> xcb_;
  21946. const cby0 = subband.tby0 >> ycb_;
  21947. const cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  21948. const cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  21949. const precinctParameters = subband.resolution.precinctParameters;
  21950. const codeblocks = [];
  21951. const precincts = [];
  21952. let i, j, codeblock, precinctNumber;
  21953. for (j = cby0; j < cby1; j++) {
  21954. for (i = cbx0; i < cbx1; i++) {
  21955. codeblock = {
  21956. cbx: i,
  21957. cby: j,
  21958. tbx0: codeblockWidth * i,
  21959. tby0: codeblockHeight * j,
  21960. tbx1: codeblockWidth * (i + 1),
  21961. tby1: codeblockHeight * (j + 1)
  21962. };
  21963. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  21964. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  21965. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  21966. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  21967. const pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  21968. const pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  21969. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  21970. codeblock.precinctNumber = precinctNumber;
  21971. codeblock.subbandType = subband.type;
  21972. codeblock.Lblock = 3;
  21973. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  21974. continue;
  21975. }
  21976. codeblocks.push(codeblock);
  21977. let precinct = precincts[precinctNumber];
  21978. if (precinct !== undefined) {
  21979. if (i < precinct.cbxMin) {
  21980. precinct.cbxMin = i;
  21981. } else if (i > precinct.cbxMax) {
  21982. precinct.cbxMax = i;
  21983. }
  21984. if (j < precinct.cbyMin) {
  21985. precinct.cbxMin = j;
  21986. } else if (j > precinct.cbyMax) {
  21987. precinct.cbyMax = j;
  21988. }
  21989. } else {
  21990. precincts[precinctNumber] = precinct = {
  21991. cbxMin: i,
  21992. cbyMin: j,
  21993. cbxMax: i,
  21994. cbyMax: j
  21995. };
  21996. }
  21997. codeblock.precinct = precinct;
  21998. }
  21999. }
  22000. subband.codeblockParameters = {
  22001. codeblockWidth: xcb_,
  22002. codeblockHeight: ycb_,
  22003. numcodeblockwide: cbx1 - cbx0 + 1,
  22004. numcodeblockhigh: cby1 - cby0 + 1
  22005. };
  22006. subband.codeblocks = codeblocks;
  22007. subband.precincts = precincts;
  22008. }
  22009. function createPacket(resolution, precinctNumber, layerNumber) {
  22010. const precinctCodeblocks = [];
  22011. const subbands = resolution.subbands;
  22012. for (let i = 0, ii = subbands.length; i < ii; i++) {
  22013. const subband = subbands[i];
  22014. const codeblocks = subband.codeblocks;
  22015. for (let j = 0, jj = codeblocks.length; j < jj; j++) {
  22016. const codeblock = codeblocks[j];
  22017. if (codeblock.precinctNumber !== precinctNumber) {
  22018. continue;
  22019. }
  22020. precinctCodeblocks.push(codeblock);
  22021. }
  22022. }
  22023. return {
  22024. layerNumber,
  22025. codeblocks: precinctCodeblocks
  22026. };
  22027. }
  22028. function LayerResolutionComponentPositionIterator(context) {
  22029. const siz = context.SIZ;
  22030. const tileIndex = context.currentTile.index;
  22031. const tile = context.tiles[tileIndex];
  22032. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  22033. const componentsCount = siz.Csiz;
  22034. let maxDecompositionLevelsCount = 0;
  22035. for (let q = 0; q < componentsCount; q++) {
  22036. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  22037. }
  22038. let l = 0,
  22039. r = 0,
  22040. i = 0,
  22041. k = 0;
  22042. this.nextPacket = function JpxImage_nextPacket() {
  22043. for (; l < layersCount; l++) {
  22044. for (; r <= maxDecompositionLevelsCount; r++) {
  22045. for (; i < componentsCount; i++) {
  22046. const component = tile.components[i];
  22047. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  22048. continue;
  22049. }
  22050. const resolution = component.resolutions[r];
  22051. const numprecincts = resolution.precinctParameters.numprecincts;
  22052. for (; k < numprecincts;) {
  22053. const packet = createPacket(resolution, k, l);
  22054. k++;
  22055. return packet;
  22056. }
  22057. k = 0;
  22058. }
  22059. i = 0;
  22060. }
  22061. r = 0;
  22062. }
  22063. throw new JpxError("Out of packets");
  22064. };
  22065. }
  22066. function ResolutionLayerComponentPositionIterator(context) {
  22067. const siz = context.SIZ;
  22068. const tileIndex = context.currentTile.index;
  22069. const tile = context.tiles[tileIndex];
  22070. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  22071. const componentsCount = siz.Csiz;
  22072. let maxDecompositionLevelsCount = 0;
  22073. for (let q = 0; q < componentsCount; q++) {
  22074. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  22075. }
  22076. let r = 0,
  22077. l = 0,
  22078. i = 0,
  22079. k = 0;
  22080. this.nextPacket = function JpxImage_nextPacket() {
  22081. for (; r <= maxDecompositionLevelsCount; r++) {
  22082. for (; l < layersCount; l++) {
  22083. for (; i < componentsCount; i++) {
  22084. const component = tile.components[i];
  22085. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  22086. continue;
  22087. }
  22088. const resolution = component.resolutions[r];
  22089. const numprecincts = resolution.precinctParameters.numprecincts;
  22090. for (; k < numprecincts;) {
  22091. const packet = createPacket(resolution, k, l);
  22092. k++;
  22093. return packet;
  22094. }
  22095. k = 0;
  22096. }
  22097. i = 0;
  22098. }
  22099. l = 0;
  22100. }
  22101. throw new JpxError("Out of packets");
  22102. };
  22103. }
  22104. function ResolutionPositionComponentLayerIterator(context) {
  22105. const siz = context.SIZ;
  22106. const tileIndex = context.currentTile.index;
  22107. const tile = context.tiles[tileIndex];
  22108. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  22109. const componentsCount = siz.Csiz;
  22110. let l, r, c, p;
  22111. let maxDecompositionLevelsCount = 0;
  22112. for (c = 0; c < componentsCount; c++) {
  22113. const component = tile.components[c];
  22114. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  22115. }
  22116. const maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  22117. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  22118. let maxNumPrecincts = 0;
  22119. for (c = 0; c < componentsCount; ++c) {
  22120. const resolutions = tile.components[c].resolutions;
  22121. if (r < resolutions.length) {
  22122. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  22123. }
  22124. }
  22125. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  22126. }
  22127. l = 0;
  22128. r = 0;
  22129. c = 0;
  22130. p = 0;
  22131. this.nextPacket = function JpxImage_nextPacket() {
  22132. for (; r <= maxDecompositionLevelsCount; r++) {
  22133. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  22134. for (; c < componentsCount; c++) {
  22135. const component = tile.components[c];
  22136. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  22137. continue;
  22138. }
  22139. const resolution = component.resolutions[r];
  22140. const numprecincts = resolution.precinctParameters.numprecincts;
  22141. if (p >= numprecincts) {
  22142. continue;
  22143. }
  22144. for (; l < layersCount;) {
  22145. const packet = createPacket(resolution, p, l);
  22146. l++;
  22147. return packet;
  22148. }
  22149. l = 0;
  22150. }
  22151. c = 0;
  22152. }
  22153. p = 0;
  22154. }
  22155. throw new JpxError("Out of packets");
  22156. };
  22157. }
  22158. function PositionComponentResolutionLayerIterator(context) {
  22159. const siz = context.SIZ;
  22160. const tileIndex = context.currentTile.index;
  22161. const tile = context.tiles[tileIndex];
  22162. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  22163. const componentsCount = siz.Csiz;
  22164. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  22165. const precinctsIterationSizes = precinctsSizes;
  22166. let l = 0,
  22167. r = 0,
  22168. c = 0,
  22169. px = 0,
  22170. py = 0;
  22171. this.nextPacket = function JpxImage_nextPacket() {
  22172. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  22173. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  22174. for (; c < componentsCount; c++) {
  22175. const component = tile.components[c];
  22176. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  22177. for (; r <= decompositionLevelsCount; r++) {
  22178. const resolution = component.resolutions[r];
  22179. const sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  22180. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  22181. if (k === null) {
  22182. continue;
  22183. }
  22184. for (; l < layersCount;) {
  22185. const packet = createPacket(resolution, k, l);
  22186. l++;
  22187. return packet;
  22188. }
  22189. l = 0;
  22190. }
  22191. r = 0;
  22192. }
  22193. c = 0;
  22194. }
  22195. px = 0;
  22196. }
  22197. throw new JpxError("Out of packets");
  22198. };
  22199. }
  22200. function ComponentPositionResolutionLayerIterator(context) {
  22201. const siz = context.SIZ;
  22202. const tileIndex = context.currentTile.index;
  22203. const tile = context.tiles[tileIndex];
  22204. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  22205. const componentsCount = siz.Csiz;
  22206. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  22207. let l = 0,
  22208. r = 0,
  22209. c = 0,
  22210. px = 0,
  22211. py = 0;
  22212. this.nextPacket = function JpxImage_nextPacket() {
  22213. for (; c < componentsCount; ++c) {
  22214. const component = tile.components[c];
  22215. const precinctsIterationSizes = precinctsSizes.components[c];
  22216. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  22217. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  22218. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  22219. for (; r <= decompositionLevelsCount; r++) {
  22220. const resolution = component.resolutions[r];
  22221. const sizeInImageScale = precinctsIterationSizes.resolutions[r];
  22222. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  22223. if (k === null) {
  22224. continue;
  22225. }
  22226. for (; l < layersCount;) {
  22227. const packet = createPacket(resolution, k, l);
  22228. l++;
  22229. return packet;
  22230. }
  22231. l = 0;
  22232. }
  22233. r = 0;
  22234. }
  22235. px = 0;
  22236. }
  22237. py = 0;
  22238. }
  22239. throw new JpxError("Out of packets");
  22240. };
  22241. }
  22242. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  22243. const posX = pxIndex * precinctIterationSizes.minWidth;
  22244. const posY = pyIndex * precinctIterationSizes.minHeight;
  22245. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  22246. return null;
  22247. }
  22248. const startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  22249. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  22250. }
  22251. function getPrecinctSizesInImageScale(tile) {
  22252. const componentsCount = tile.components.length;
  22253. let minWidth = Number.MAX_VALUE;
  22254. let minHeight = Number.MAX_VALUE;
  22255. let maxNumWide = 0;
  22256. let maxNumHigh = 0;
  22257. const sizePerComponent = new Array(componentsCount);
  22258. for (let c = 0; c < componentsCount; c++) {
  22259. const component = tile.components[c];
  22260. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  22261. const sizePerResolution = new Array(decompositionLevelsCount + 1);
  22262. let minWidthCurrentComponent = Number.MAX_VALUE;
  22263. let minHeightCurrentComponent = Number.MAX_VALUE;
  22264. let maxNumWideCurrentComponent = 0;
  22265. let maxNumHighCurrentComponent = 0;
  22266. let scale = 1;
  22267. for (let r = decompositionLevelsCount; r >= 0; --r) {
  22268. const resolution = component.resolutions[r];
  22269. const widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  22270. const heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  22271. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  22272. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  22273. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  22274. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  22275. sizePerResolution[r] = {
  22276. width: widthCurrentResolution,
  22277. height: heightCurrentResolution
  22278. };
  22279. scale <<= 1;
  22280. }
  22281. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  22282. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  22283. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  22284. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  22285. sizePerComponent[c] = {
  22286. resolutions: sizePerResolution,
  22287. minWidth: minWidthCurrentComponent,
  22288. minHeight: minHeightCurrentComponent,
  22289. maxNumWide: maxNumWideCurrentComponent,
  22290. maxNumHigh: maxNumHighCurrentComponent
  22291. };
  22292. }
  22293. return {
  22294. components: sizePerComponent,
  22295. minWidth,
  22296. minHeight,
  22297. maxNumWide,
  22298. maxNumHigh
  22299. };
  22300. }
  22301. function buildPackets(context) {
  22302. const siz = context.SIZ;
  22303. const tileIndex = context.currentTile.index;
  22304. const tile = context.tiles[tileIndex];
  22305. const componentsCount = siz.Csiz;
  22306. for (let c = 0; c < componentsCount; c++) {
  22307. const component = tile.components[c];
  22308. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  22309. const resolutions = [];
  22310. const subbands = [];
  22311. for (let r = 0; r <= decompositionLevelsCount; r++) {
  22312. const blocksDimensions = getBlocksDimensions(context, component, r);
  22313. const resolution = {};
  22314. const scale = 1 << decompositionLevelsCount - r;
  22315. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  22316. resolution.try0 = Math.ceil(component.tcy0 / scale);
  22317. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  22318. resolution.try1 = Math.ceil(component.tcy1 / scale);
  22319. resolution.resLevel = r;
  22320. buildPrecincts(context, resolution, blocksDimensions);
  22321. resolutions.push(resolution);
  22322. let subband;
  22323. if (r === 0) {
  22324. subband = {};
  22325. subband.type = "LL";
  22326. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  22327. subband.tby0 = Math.ceil(component.tcy0 / scale);
  22328. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  22329. subband.tby1 = Math.ceil(component.tcy1 / scale);
  22330. subband.resolution = resolution;
  22331. buildCodeblocks(context, subband, blocksDimensions);
  22332. subbands.push(subband);
  22333. resolution.subbands = [subband];
  22334. } else {
  22335. const bscale = 1 << decompositionLevelsCount - r + 1;
  22336. const resolutionSubbands = [];
  22337. subband = {};
  22338. subband.type = "HL";
  22339. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  22340. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  22341. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  22342. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  22343. subband.resolution = resolution;
  22344. buildCodeblocks(context, subband, blocksDimensions);
  22345. subbands.push(subband);
  22346. resolutionSubbands.push(subband);
  22347. subband = {};
  22348. subband.type = "LH";
  22349. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  22350. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  22351. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  22352. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  22353. subband.resolution = resolution;
  22354. buildCodeblocks(context, subband, blocksDimensions);
  22355. subbands.push(subband);
  22356. resolutionSubbands.push(subband);
  22357. subband = {};
  22358. subband.type = "HH";
  22359. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  22360. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  22361. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  22362. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  22363. subband.resolution = resolution;
  22364. buildCodeblocks(context, subband, blocksDimensions);
  22365. subbands.push(subband);
  22366. resolutionSubbands.push(subband);
  22367. resolution.subbands = resolutionSubbands;
  22368. }
  22369. }
  22370. component.resolutions = resolutions;
  22371. component.subbands = subbands;
  22372. }
  22373. const progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  22374. switch (progressionOrder) {
  22375. case 0:
  22376. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  22377. break;
  22378. case 1:
  22379. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  22380. break;
  22381. case 2:
  22382. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  22383. break;
  22384. case 3:
  22385. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  22386. break;
  22387. case 4:
  22388. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  22389. break;
  22390. default:
  22391. throw new JpxError(`Unsupported progression order ${progressionOrder}`);
  22392. }
  22393. }
  22394. function parseTilePackets(context, data, offset, dataLength) {
  22395. let position = 0;
  22396. let buffer,
  22397. bufferSize = 0,
  22398. skipNextBit = false;
  22399. function readBits(count) {
  22400. while (bufferSize < count) {
  22401. const b = data[offset + position];
  22402. position++;
  22403. if (skipNextBit) {
  22404. buffer = buffer << 7 | b;
  22405. bufferSize += 7;
  22406. skipNextBit = false;
  22407. } else {
  22408. buffer = buffer << 8 | b;
  22409. bufferSize += 8;
  22410. }
  22411. if (b === 0xff) {
  22412. skipNextBit = true;
  22413. }
  22414. }
  22415. bufferSize -= count;
  22416. return buffer >>> bufferSize & (1 << count) - 1;
  22417. }
  22418. function skipMarkerIfEqual(value) {
  22419. if (data[offset + position - 1] === 0xff && data[offset + position] === value) {
  22420. skipBytes(1);
  22421. return true;
  22422. } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) {
  22423. skipBytes(2);
  22424. return true;
  22425. }
  22426. return false;
  22427. }
  22428. function skipBytes(count) {
  22429. position += count;
  22430. }
  22431. function alignToByte() {
  22432. bufferSize = 0;
  22433. if (skipNextBit) {
  22434. position++;
  22435. skipNextBit = false;
  22436. }
  22437. }
  22438. function readCodingpasses() {
  22439. if (readBits(1) === 0) {
  22440. return 1;
  22441. }
  22442. if (readBits(1) === 0) {
  22443. return 2;
  22444. }
  22445. let value = readBits(2);
  22446. if (value < 3) {
  22447. return value + 3;
  22448. }
  22449. value = readBits(5);
  22450. if (value < 31) {
  22451. return value + 6;
  22452. }
  22453. value = readBits(7);
  22454. return value + 37;
  22455. }
  22456. const tileIndex = context.currentTile.index;
  22457. const tile = context.tiles[tileIndex];
  22458. const sopMarkerUsed = context.COD.sopMarkerUsed;
  22459. const ephMarkerUsed = context.COD.ephMarkerUsed;
  22460. const packetsIterator = tile.packetsIterator;
  22461. while (position < dataLength) {
  22462. alignToByte();
  22463. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  22464. skipBytes(4);
  22465. }
  22466. const packet = packetsIterator.nextPacket();
  22467. if (!readBits(1)) {
  22468. continue;
  22469. }
  22470. const layerNumber = packet.layerNumber,
  22471. queue = [];
  22472. let codeblock;
  22473. for (let i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  22474. codeblock = packet.codeblocks[i];
  22475. let precinct = codeblock.precinct;
  22476. const codeblockColumn = codeblock.cbx - precinct.cbxMin;
  22477. const codeblockRow = codeblock.cby - precinct.cbyMin;
  22478. let codeblockIncluded = false;
  22479. let firstTimeInclusion = false;
  22480. let valueReady, zeroBitPlanesTree;
  22481. if (codeblock.included !== undefined) {
  22482. codeblockIncluded = !!readBits(1);
  22483. } else {
  22484. precinct = codeblock.precinct;
  22485. let inclusionTree;
  22486. if (precinct.inclusionTree !== undefined) {
  22487. inclusionTree = precinct.inclusionTree;
  22488. } else {
  22489. const width = precinct.cbxMax - precinct.cbxMin + 1;
  22490. const height = precinct.cbyMax - precinct.cbyMin + 1;
  22491. inclusionTree = new InclusionTree(width, height, layerNumber);
  22492. zeroBitPlanesTree = new TagTree(width, height);
  22493. precinct.inclusionTree = inclusionTree;
  22494. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  22495. for (let l = 0; l < layerNumber; l++) {
  22496. if (readBits(1) !== 0) {
  22497. throw new JpxError("Invalid tag tree");
  22498. }
  22499. }
  22500. }
  22501. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  22502. while (true) {
  22503. if (readBits(1)) {
  22504. valueReady = !inclusionTree.nextLevel();
  22505. if (valueReady) {
  22506. codeblock.included = true;
  22507. codeblockIncluded = firstTimeInclusion = true;
  22508. break;
  22509. }
  22510. } else {
  22511. inclusionTree.incrementValue(layerNumber);
  22512. break;
  22513. }
  22514. }
  22515. }
  22516. }
  22517. if (!codeblockIncluded) {
  22518. continue;
  22519. }
  22520. if (firstTimeInclusion) {
  22521. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  22522. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  22523. while (true) {
  22524. if (readBits(1)) {
  22525. valueReady = !zeroBitPlanesTree.nextLevel();
  22526. if (valueReady) {
  22527. break;
  22528. }
  22529. } else {
  22530. zeroBitPlanesTree.incrementValue();
  22531. }
  22532. }
  22533. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  22534. }
  22535. const codingpasses = readCodingpasses();
  22536. while (readBits(1)) {
  22537. codeblock.Lblock++;
  22538. }
  22539. const codingpassesLog2 = (0, _core_utils.log2)(codingpasses);
  22540. const bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  22541. const codedDataLength = readBits(bits);
  22542. queue.push({
  22543. codeblock,
  22544. codingpasses,
  22545. dataLength: codedDataLength
  22546. });
  22547. }
  22548. alignToByte();
  22549. if (ephMarkerUsed) {
  22550. skipMarkerIfEqual(0x92);
  22551. }
  22552. while (queue.length > 0) {
  22553. const packetItem = queue.shift();
  22554. codeblock = packetItem.codeblock;
  22555. if (codeblock.data === undefined) {
  22556. codeblock.data = [];
  22557. }
  22558. codeblock.data.push({
  22559. data,
  22560. start: offset + position,
  22561. end: offset + position + packetItem.dataLength,
  22562. codingpasses: packetItem.codingpasses
  22563. });
  22564. position += packetItem.dataLength;
  22565. }
  22566. }
  22567. return position;
  22568. }
  22569. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities) {
  22570. const x0 = subband.tbx0;
  22571. const y0 = subband.tby0;
  22572. const width = subband.tbx1 - subband.tbx0;
  22573. const codeblocks = subband.codeblocks;
  22574. const right = subband.type.charAt(0) === "H" ? 1 : 0;
  22575. const bottom = subband.type.charAt(1) === "H" ? levelWidth : 0;
  22576. for (let i = 0, ii = codeblocks.length; i < ii; ++i) {
  22577. const codeblock = codeblocks[i];
  22578. const blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  22579. const blockHeight = codeblock.tby1_ - codeblock.tby0_;
  22580. if (blockWidth === 0 || blockHeight === 0) {
  22581. continue;
  22582. }
  22583. if (codeblock.data === undefined) {
  22584. continue;
  22585. }
  22586. const bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  22587. let currentCodingpassType = 2;
  22588. const data = codeblock.data;
  22589. let totalLength = 0,
  22590. codingpasses = 0;
  22591. let j, jj, dataItem;
  22592. for (j = 0, jj = data.length; j < jj; j++) {
  22593. dataItem = data[j];
  22594. totalLength += dataItem.end - dataItem.start;
  22595. codingpasses += dataItem.codingpasses;
  22596. }
  22597. const encodedData = new Uint8Array(totalLength);
  22598. let position = 0;
  22599. for (j = 0, jj = data.length; j < jj; j++) {
  22600. dataItem = data[j];
  22601. const chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  22602. encodedData.set(chunk, position);
  22603. position += chunk.length;
  22604. }
  22605. const decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
  22606. bitModel.setDecoder(decoder);
  22607. for (j = 0; j < codingpasses; j++) {
  22608. switch (currentCodingpassType) {
  22609. case 0:
  22610. bitModel.runSignificancePropagationPass();
  22611. break;
  22612. case 1:
  22613. bitModel.runMagnitudeRefinementPass();
  22614. break;
  22615. case 2:
  22616. bitModel.runCleanupPass();
  22617. if (segmentationSymbolUsed) {
  22618. bitModel.checkSegmentationSymbol();
  22619. }
  22620. break;
  22621. }
  22622. if (resetContextProbabilities) {
  22623. bitModel.reset();
  22624. }
  22625. currentCodingpassType = (currentCodingpassType + 1) % 3;
  22626. }
  22627. let offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  22628. const sign = bitModel.coefficentsSign;
  22629. const magnitude = bitModel.coefficentsMagnitude;
  22630. const bitsDecoded = bitModel.bitsDecoded;
  22631. const magnitudeCorrection = reversible ? 0 : 0.5;
  22632. let k, n, nb;
  22633. position = 0;
  22634. const interleave = subband.type !== "LL";
  22635. for (j = 0; j < blockHeight; j++) {
  22636. const row = offset / width | 0;
  22637. const levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  22638. for (k = 0; k < blockWidth; k++) {
  22639. n = magnitude[position];
  22640. if (n !== 0) {
  22641. n = (n + magnitudeCorrection) * delta;
  22642. if (sign[position] !== 0) {
  22643. n = -n;
  22644. }
  22645. nb = bitsDecoded[position];
  22646. const pos = interleave ? levelOffset + (offset << 1) : offset;
  22647. if (reversible && nb >= mb) {
  22648. coefficients[pos] = n;
  22649. } else {
  22650. coefficients[pos] = n * (1 << mb - nb);
  22651. }
  22652. }
  22653. offset++;
  22654. position++;
  22655. }
  22656. offset += width - blockWidth;
  22657. }
  22658. }
  22659. }
  22660. function transformTile(context, tile, c) {
  22661. const component = tile.components[c];
  22662. const codingStyleParameters = component.codingStyleParameters;
  22663. const quantizationParameters = component.quantizationParameters;
  22664. const decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  22665. const spqcds = quantizationParameters.SPqcds;
  22666. const scalarExpounded = quantizationParameters.scalarExpounded;
  22667. const guardBits = quantizationParameters.guardBits;
  22668. const segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  22669. const resetContextProbabilities = codingStyleParameters.resetContextProbabilities;
  22670. const precision = context.components[c].precision;
  22671. const reversible = codingStyleParameters.reversibleTransformation;
  22672. const transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  22673. const subbandCoefficients = [];
  22674. let b = 0;
  22675. for (let i = 0; i <= decompositionLevelsCount; i++) {
  22676. const resolution = component.resolutions[i];
  22677. const width = resolution.trx1 - resolution.trx0;
  22678. const height = resolution.try1 - resolution.try0;
  22679. const coefficients = new Float32Array(width * height);
  22680. for (let j = 0, jj = resolution.subbands.length; j < jj; j++) {
  22681. let mu, epsilon;
  22682. if (!scalarExpounded) {
  22683. mu = spqcds[0].mu;
  22684. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  22685. } else {
  22686. mu = spqcds[b].mu;
  22687. epsilon = spqcds[b].epsilon;
  22688. b++;
  22689. }
  22690. const subband = resolution.subbands[j];
  22691. const gainLog2 = SubbandsGainLog2[subband.type];
  22692. const delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
  22693. const mb = guardBits + epsilon - 1;
  22694. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities);
  22695. }
  22696. subbandCoefficients.push({
  22697. width,
  22698. height,
  22699. items: coefficients
  22700. });
  22701. }
  22702. const result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  22703. return {
  22704. left: component.tcx0,
  22705. top: component.tcy0,
  22706. width: result.width,
  22707. height: result.height,
  22708. items: result.items
  22709. };
  22710. }
  22711. function transformComponents(context) {
  22712. const siz = context.SIZ;
  22713. const components = context.components;
  22714. const componentsCount = siz.Csiz;
  22715. const resultImages = [];
  22716. for (let i = 0, ii = context.tiles.length; i < ii; i++) {
  22717. const tile = context.tiles[i];
  22718. const transformedTiles = [];
  22719. for (let c = 0; c < componentsCount; c++) {
  22720. transformedTiles[c] = transformTile(context, tile, c);
  22721. }
  22722. const tile0 = transformedTiles[0];
  22723. const out = new Uint8ClampedArray(tile0.items.length * componentsCount);
  22724. const result = {
  22725. left: tile0.left,
  22726. top: tile0.top,
  22727. width: tile0.width,
  22728. height: tile0.height,
  22729. items: out
  22730. };
  22731. let shift, offset;
  22732. let pos = 0,
  22733. j,
  22734. jj,
  22735. y0,
  22736. y1,
  22737. y2;
  22738. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  22739. const fourComponents = componentsCount === 4;
  22740. const y0items = transformedTiles[0].items;
  22741. const y1items = transformedTiles[1].items;
  22742. const y2items = transformedTiles[2].items;
  22743. const y3items = fourComponents ? transformedTiles[3].items : null;
  22744. shift = components[0].precision - 8;
  22745. offset = (128 << shift) + 0.5;
  22746. const component0 = tile.components[0];
  22747. const alpha01 = componentsCount - 3;
  22748. jj = y0items.length;
  22749. if (!component0.codingStyleParameters.reversibleTransformation) {
  22750. for (j = 0; j < jj; j++, pos += alpha01) {
  22751. y0 = y0items[j] + offset;
  22752. y1 = y1items[j];
  22753. y2 = y2items[j];
  22754. out[pos++] = y0 + 1.402 * y2 >> shift;
  22755. out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
  22756. out[pos++] = y0 + 1.772 * y1 >> shift;
  22757. }
  22758. } else {
  22759. for (j = 0; j < jj; j++, pos += alpha01) {
  22760. y0 = y0items[j] + offset;
  22761. y1 = y1items[j];
  22762. y2 = y2items[j];
  22763. const g = y0 - (y2 + y1 >> 2);
  22764. out[pos++] = g + y2 >> shift;
  22765. out[pos++] = g >> shift;
  22766. out[pos++] = g + y1 >> shift;
  22767. }
  22768. }
  22769. if (fourComponents) {
  22770. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  22771. out[pos] = y3items[j] + offset >> shift;
  22772. }
  22773. }
  22774. } else {
  22775. for (let c = 0; c < componentsCount; c++) {
  22776. const items = transformedTiles[c].items;
  22777. shift = components[c].precision - 8;
  22778. offset = (128 << shift) + 0.5;
  22779. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  22780. out[pos] = items[j] + offset >> shift;
  22781. pos += componentsCount;
  22782. }
  22783. }
  22784. }
  22785. resultImages.push(result);
  22786. }
  22787. return resultImages;
  22788. }
  22789. function initializeTile(context, tileIndex) {
  22790. const siz = context.SIZ;
  22791. const componentsCount = siz.Csiz;
  22792. const tile = context.tiles[tileIndex];
  22793. for (let c = 0; c < componentsCount; c++) {
  22794. const component = tile.components[c];
  22795. const qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  22796. component.quantizationParameters = qcdOrQcc;
  22797. const codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  22798. component.codingStyleParameters = codOrCoc;
  22799. }
  22800. tile.codingStyleDefaultParameters = context.currentTile.COD;
  22801. }
  22802. class TagTree {
  22803. constructor(width, height) {
  22804. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  22805. this.levels = [];
  22806. for (let i = 0; i < levelsLength; i++) {
  22807. const level = {
  22808. width,
  22809. height,
  22810. items: []
  22811. };
  22812. this.levels.push(level);
  22813. width = Math.ceil(width / 2);
  22814. height = Math.ceil(height / 2);
  22815. }
  22816. }
  22817. reset(i, j) {
  22818. let currentLevel = 0,
  22819. value = 0,
  22820. level;
  22821. while (currentLevel < this.levels.length) {
  22822. level = this.levels[currentLevel];
  22823. const index = i + j * level.width;
  22824. if (level.items[index] !== undefined) {
  22825. value = level.items[index];
  22826. break;
  22827. }
  22828. level.index = index;
  22829. i >>= 1;
  22830. j >>= 1;
  22831. currentLevel++;
  22832. }
  22833. currentLevel--;
  22834. level = this.levels[currentLevel];
  22835. level.items[level.index] = value;
  22836. this.currentLevel = currentLevel;
  22837. delete this.value;
  22838. }
  22839. incrementValue() {
  22840. const level = this.levels[this.currentLevel];
  22841. level.items[level.index]++;
  22842. }
  22843. nextLevel() {
  22844. let currentLevel = this.currentLevel;
  22845. let level = this.levels[currentLevel];
  22846. const value = level.items[level.index];
  22847. currentLevel--;
  22848. if (currentLevel < 0) {
  22849. this.value = value;
  22850. return false;
  22851. }
  22852. this.currentLevel = currentLevel;
  22853. level = this.levels[currentLevel];
  22854. level.items[level.index] = value;
  22855. return true;
  22856. }
  22857. }
  22858. class InclusionTree {
  22859. constructor(width, height, defaultValue) {
  22860. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  22861. this.levels = [];
  22862. for (let i = 0; i < levelsLength; i++) {
  22863. const items = new Uint8Array(width * height);
  22864. for (let j = 0, jj = items.length; j < jj; j++) {
  22865. items[j] = defaultValue;
  22866. }
  22867. const level = {
  22868. width,
  22869. height,
  22870. items
  22871. };
  22872. this.levels.push(level);
  22873. width = Math.ceil(width / 2);
  22874. height = Math.ceil(height / 2);
  22875. }
  22876. }
  22877. reset(i, j, stopValue) {
  22878. let currentLevel = 0;
  22879. while (currentLevel < this.levels.length) {
  22880. const level = this.levels[currentLevel];
  22881. const index = i + j * level.width;
  22882. level.index = index;
  22883. const value = level.items[index];
  22884. if (value === 0xff) {
  22885. break;
  22886. }
  22887. if (value > stopValue) {
  22888. this.currentLevel = currentLevel;
  22889. this.propagateValues();
  22890. return false;
  22891. }
  22892. i >>= 1;
  22893. j >>= 1;
  22894. currentLevel++;
  22895. }
  22896. this.currentLevel = currentLevel - 1;
  22897. return true;
  22898. }
  22899. incrementValue(stopValue) {
  22900. const level = this.levels[this.currentLevel];
  22901. level.items[level.index] = stopValue + 1;
  22902. this.propagateValues();
  22903. }
  22904. propagateValues() {
  22905. let levelIndex = this.currentLevel;
  22906. let level = this.levels[levelIndex];
  22907. const currentValue = level.items[level.index];
  22908. while (--levelIndex >= 0) {
  22909. level = this.levels[levelIndex];
  22910. level.items[level.index] = currentValue;
  22911. }
  22912. }
  22913. nextLevel() {
  22914. let currentLevel = this.currentLevel;
  22915. let level = this.levels[currentLevel];
  22916. const value = level.items[level.index];
  22917. level.items[level.index] = 0xff;
  22918. currentLevel--;
  22919. if (currentLevel < 0) {
  22920. return false;
  22921. }
  22922. this.currentLevel = currentLevel;
  22923. level = this.levels[currentLevel];
  22924. level.items[level.index] = value;
  22925. return true;
  22926. }
  22927. }
  22928. const BitModel = function BitModelClosure() {
  22929. const UNIFORM_CONTEXT = 17;
  22930. const RUNLENGTH_CONTEXT = 18;
  22931. 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]);
  22932. 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]);
  22933. 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]);
  22934. class BitModel {
  22935. constructor(width, height, subband, zeroBitPlanes, mb) {
  22936. this.width = width;
  22937. this.height = height;
  22938. let contextLabelTable;
  22939. if (subband === "HH") {
  22940. contextLabelTable = HHContextLabel;
  22941. } else if (subband === "HL") {
  22942. contextLabelTable = HLContextLabel;
  22943. } else {
  22944. contextLabelTable = LLAndLHContextsLabel;
  22945. }
  22946. this.contextLabelTable = contextLabelTable;
  22947. const coefficientCount = width * height;
  22948. this.neighborsSignificance = new Uint8Array(coefficientCount);
  22949. this.coefficentsSign = new Uint8Array(coefficientCount);
  22950. let coefficentsMagnitude;
  22951. if (mb > 14) {
  22952. coefficentsMagnitude = new Uint32Array(coefficientCount);
  22953. } else if (mb > 6) {
  22954. coefficentsMagnitude = new Uint16Array(coefficientCount);
  22955. } else {
  22956. coefficentsMagnitude = new Uint8Array(coefficientCount);
  22957. }
  22958. this.coefficentsMagnitude = coefficentsMagnitude;
  22959. this.processingFlags = new Uint8Array(coefficientCount);
  22960. const bitsDecoded = new Uint8Array(coefficientCount);
  22961. if (zeroBitPlanes !== 0) {
  22962. for (let i = 0; i < coefficientCount; i++) {
  22963. bitsDecoded[i] = zeroBitPlanes;
  22964. }
  22965. }
  22966. this.bitsDecoded = bitsDecoded;
  22967. this.reset();
  22968. }
  22969. setDecoder(decoder) {
  22970. this.decoder = decoder;
  22971. }
  22972. reset() {
  22973. this.contexts = new Int8Array(19);
  22974. this.contexts[0] = 4 << 1 | 0;
  22975. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  22976. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  22977. }
  22978. setNeighborsSignificance(row, column, index) {
  22979. const neighborsSignificance = this.neighborsSignificance;
  22980. const width = this.width,
  22981. height = this.height;
  22982. const left = column > 0;
  22983. const right = column + 1 < width;
  22984. let i;
  22985. if (row > 0) {
  22986. i = index - width;
  22987. if (left) {
  22988. neighborsSignificance[i - 1] += 0x10;
  22989. }
  22990. if (right) {
  22991. neighborsSignificance[i + 1] += 0x10;
  22992. }
  22993. neighborsSignificance[i] += 0x04;
  22994. }
  22995. if (row + 1 < height) {
  22996. i = index + width;
  22997. if (left) {
  22998. neighborsSignificance[i - 1] += 0x10;
  22999. }
  23000. if (right) {
  23001. neighborsSignificance[i + 1] += 0x10;
  23002. }
  23003. neighborsSignificance[i] += 0x04;
  23004. }
  23005. if (left) {
  23006. neighborsSignificance[index - 1] += 0x01;
  23007. }
  23008. if (right) {
  23009. neighborsSignificance[index + 1] += 0x01;
  23010. }
  23011. neighborsSignificance[index] |= 0x80;
  23012. }
  23013. runSignificancePropagationPass() {
  23014. const decoder = this.decoder;
  23015. const width = this.width,
  23016. height = this.height;
  23017. const coefficentsMagnitude = this.coefficentsMagnitude;
  23018. const coefficentsSign = this.coefficentsSign;
  23019. const neighborsSignificance = this.neighborsSignificance;
  23020. const processingFlags = this.processingFlags;
  23021. const contexts = this.contexts;
  23022. const labels = this.contextLabelTable;
  23023. const bitsDecoded = this.bitsDecoded;
  23024. const processedInverseMask = ~1;
  23025. const processedMask = 1;
  23026. const firstMagnitudeBitMask = 2;
  23027. for (let i0 = 0; i0 < height; i0 += 4) {
  23028. for (let j = 0; j < width; j++) {
  23029. let index = i0 * width + j;
  23030. for (let i1 = 0; i1 < 4; i1++, index += width) {
  23031. const i = i0 + i1;
  23032. if (i >= height) {
  23033. break;
  23034. }
  23035. processingFlags[index] &= processedInverseMask;
  23036. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  23037. continue;
  23038. }
  23039. const contextLabel = labels[neighborsSignificance[index]];
  23040. const decision = decoder.readBit(contexts, contextLabel);
  23041. if (decision) {
  23042. const sign = this.decodeSignBit(i, j, index);
  23043. coefficentsSign[index] = sign;
  23044. coefficentsMagnitude[index] = 1;
  23045. this.setNeighborsSignificance(i, j, index);
  23046. processingFlags[index] |= firstMagnitudeBitMask;
  23047. }
  23048. bitsDecoded[index]++;
  23049. processingFlags[index] |= processedMask;
  23050. }
  23051. }
  23052. }
  23053. }
  23054. decodeSignBit(row, column, index) {
  23055. const width = this.width,
  23056. height = this.height;
  23057. const coefficentsMagnitude = this.coefficentsMagnitude;
  23058. const coefficentsSign = this.coefficentsSign;
  23059. let contribution, sign0, sign1, significance1;
  23060. let contextLabel, decoded;
  23061. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  23062. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  23063. sign1 = coefficentsSign[index + 1];
  23064. if (significance1) {
  23065. sign0 = coefficentsSign[index - 1];
  23066. contribution = 1 - sign1 - sign0;
  23067. } else {
  23068. contribution = 1 - sign1 - sign1;
  23069. }
  23070. } else if (significance1) {
  23071. sign0 = coefficentsSign[index - 1];
  23072. contribution = 1 - sign0 - sign0;
  23073. } else {
  23074. contribution = 0;
  23075. }
  23076. const horizontalContribution = 3 * contribution;
  23077. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  23078. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  23079. sign1 = coefficentsSign[index + width];
  23080. if (significance1) {
  23081. sign0 = coefficentsSign[index - width];
  23082. contribution = 1 - sign1 - sign0 + horizontalContribution;
  23083. } else {
  23084. contribution = 1 - sign1 - sign1 + horizontalContribution;
  23085. }
  23086. } else if (significance1) {
  23087. sign0 = coefficentsSign[index - width];
  23088. contribution = 1 - sign0 - sign0 + horizontalContribution;
  23089. } else {
  23090. contribution = horizontalContribution;
  23091. }
  23092. if (contribution >= 0) {
  23093. contextLabel = 9 + contribution;
  23094. decoded = this.decoder.readBit(this.contexts, contextLabel);
  23095. } else {
  23096. contextLabel = 9 - contribution;
  23097. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  23098. }
  23099. return decoded;
  23100. }
  23101. runMagnitudeRefinementPass() {
  23102. const decoder = this.decoder;
  23103. const width = this.width,
  23104. height = this.height;
  23105. const coefficentsMagnitude = this.coefficentsMagnitude;
  23106. const neighborsSignificance = this.neighborsSignificance;
  23107. const contexts = this.contexts;
  23108. const bitsDecoded = this.bitsDecoded;
  23109. const processingFlags = this.processingFlags;
  23110. const processedMask = 1;
  23111. const firstMagnitudeBitMask = 2;
  23112. const length = width * height;
  23113. const width4 = width * 4;
  23114. for (let index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  23115. indexNext = Math.min(length, index0 + width4);
  23116. for (let j = 0; j < width; j++) {
  23117. for (let index = index0 + j; index < indexNext; index += width) {
  23118. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  23119. continue;
  23120. }
  23121. let contextLabel = 16;
  23122. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  23123. processingFlags[index] ^= firstMagnitudeBitMask;
  23124. const significance = neighborsSignificance[index] & 127;
  23125. contextLabel = significance === 0 ? 15 : 14;
  23126. }
  23127. const bit = decoder.readBit(contexts, contextLabel);
  23128. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  23129. bitsDecoded[index]++;
  23130. processingFlags[index] |= processedMask;
  23131. }
  23132. }
  23133. }
  23134. }
  23135. runCleanupPass() {
  23136. const decoder = this.decoder;
  23137. const width = this.width,
  23138. height = this.height;
  23139. const neighborsSignificance = this.neighborsSignificance;
  23140. const coefficentsMagnitude = this.coefficentsMagnitude;
  23141. const coefficentsSign = this.coefficentsSign;
  23142. const contexts = this.contexts;
  23143. const labels = this.contextLabelTable;
  23144. const bitsDecoded = this.bitsDecoded;
  23145. const processingFlags = this.processingFlags;
  23146. const processedMask = 1;
  23147. const firstMagnitudeBitMask = 2;
  23148. const oneRowDown = width;
  23149. const twoRowsDown = width * 2;
  23150. const threeRowsDown = width * 3;
  23151. let iNext;
  23152. for (let i0 = 0; i0 < height; i0 = iNext) {
  23153. iNext = Math.min(i0 + 4, height);
  23154. const indexBase = i0 * width;
  23155. const checkAllEmpty = i0 + 3 < height;
  23156. for (let j = 0; j < width; j++) {
  23157. const index0 = indexBase + j;
  23158. 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;
  23159. let i1 = 0,
  23160. index = index0;
  23161. let i = i0,
  23162. sign;
  23163. if (allEmpty) {
  23164. const hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  23165. if (!hasSignificantCoefficent) {
  23166. bitsDecoded[index0]++;
  23167. bitsDecoded[index0 + oneRowDown]++;
  23168. bitsDecoded[index0 + twoRowsDown]++;
  23169. bitsDecoded[index0 + threeRowsDown]++;
  23170. continue;
  23171. }
  23172. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  23173. if (i1 !== 0) {
  23174. i = i0 + i1;
  23175. index += i1 * width;
  23176. }
  23177. sign = this.decodeSignBit(i, j, index);
  23178. coefficentsSign[index] = sign;
  23179. coefficentsMagnitude[index] = 1;
  23180. this.setNeighborsSignificance(i, j, index);
  23181. processingFlags[index] |= firstMagnitudeBitMask;
  23182. index = index0;
  23183. for (let i2 = i0; i2 <= i; i2++, index += width) {
  23184. bitsDecoded[index]++;
  23185. }
  23186. i1++;
  23187. }
  23188. for (i = i0 + i1; i < iNext; i++, index += width) {
  23189. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  23190. continue;
  23191. }
  23192. const contextLabel = labels[neighborsSignificance[index]];
  23193. const decision = decoder.readBit(contexts, contextLabel);
  23194. if (decision === 1) {
  23195. sign = this.decodeSignBit(i, j, index);
  23196. coefficentsSign[index] = sign;
  23197. coefficentsMagnitude[index] = 1;
  23198. this.setNeighborsSignificance(i, j, index);
  23199. processingFlags[index] |= firstMagnitudeBitMask;
  23200. }
  23201. bitsDecoded[index]++;
  23202. }
  23203. }
  23204. }
  23205. }
  23206. checkSegmentationSymbol() {
  23207. const decoder = this.decoder;
  23208. const contexts = this.contexts;
  23209. 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);
  23210. if (symbol !== 0xa) {
  23211. throw new JpxError("Invalid segmentation symbol");
  23212. }
  23213. }
  23214. }
  23215. return BitModel;
  23216. }();
  23217. class Transform {
  23218. constructor() {
  23219. if (this.constructor === Transform) {
  23220. (0, _util.unreachable)("Cannot initialize Transform.");
  23221. }
  23222. }
  23223. calculate(subbands, u0, v0) {
  23224. let ll = subbands[0];
  23225. for (let i = 1, ii = subbands.length; i < ii; i++) {
  23226. ll = this.iterate(ll, subbands[i], u0, v0);
  23227. }
  23228. return ll;
  23229. }
  23230. extend(buffer, offset, size) {
  23231. let i1 = offset - 1,
  23232. j1 = offset + 1;
  23233. let i2 = offset + size - 2,
  23234. j2 = offset + size;
  23235. buffer[i1--] = buffer[j1++];
  23236. buffer[j2++] = buffer[i2--];
  23237. buffer[i1--] = buffer[j1++];
  23238. buffer[j2++] = buffer[i2--];
  23239. buffer[i1--] = buffer[j1++];
  23240. buffer[j2++] = buffer[i2--];
  23241. buffer[i1] = buffer[j1];
  23242. buffer[j2] = buffer[i2];
  23243. }
  23244. filter(x, offset, length) {
  23245. (0, _util.unreachable)("Abstract method `filter` called");
  23246. }
  23247. iterate(ll, hl_lh_hh, u0, v0) {
  23248. const llWidth = ll.width,
  23249. llHeight = ll.height;
  23250. let llItems = ll.items;
  23251. const width = hl_lh_hh.width;
  23252. const height = hl_lh_hh.height;
  23253. const items = hl_lh_hh.items;
  23254. let i, j, k, l, u, v;
  23255. for (k = 0, i = 0; i < llHeight; i++) {
  23256. l = i * 2 * width;
  23257. for (j = 0; j < llWidth; j++, k++, l += 2) {
  23258. items[l] = llItems[k];
  23259. }
  23260. }
  23261. llItems = ll.items = null;
  23262. const bufferPadding = 4;
  23263. const rowBuffer = new Float32Array(width + 2 * bufferPadding);
  23264. if (width === 1) {
  23265. if ((u0 & 1) !== 0) {
  23266. for (v = 0, k = 0; v < height; v++, k += width) {
  23267. items[k] *= 0.5;
  23268. }
  23269. }
  23270. } else {
  23271. for (v = 0, k = 0; v < height; v++, k += width) {
  23272. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  23273. this.extend(rowBuffer, bufferPadding, width);
  23274. this.filter(rowBuffer, bufferPadding, width);
  23275. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  23276. }
  23277. }
  23278. let numBuffers = 16;
  23279. const colBuffers = [];
  23280. for (i = 0; i < numBuffers; i++) {
  23281. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  23282. }
  23283. let b,
  23284. currentBuffer = 0;
  23285. ll = bufferPadding + height;
  23286. if (height === 1) {
  23287. if ((v0 & 1) !== 0) {
  23288. for (u = 0; u < width; u++) {
  23289. items[u] *= 0.5;
  23290. }
  23291. }
  23292. } else {
  23293. for (u = 0; u < width; u++) {
  23294. if (currentBuffer === 0) {
  23295. numBuffers = Math.min(width - u, numBuffers);
  23296. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  23297. for (b = 0; b < numBuffers; b++) {
  23298. colBuffers[b][l] = items[k + b];
  23299. }
  23300. }
  23301. currentBuffer = numBuffers;
  23302. }
  23303. currentBuffer--;
  23304. const buffer = colBuffers[currentBuffer];
  23305. this.extend(buffer, bufferPadding, height);
  23306. this.filter(buffer, bufferPadding, height);
  23307. if (currentBuffer === 0) {
  23308. k = u - numBuffers + 1;
  23309. for (l = bufferPadding; l < ll; k += width, l++) {
  23310. for (b = 0; b < numBuffers; b++) {
  23311. items[k + b] = colBuffers[b][l];
  23312. }
  23313. }
  23314. }
  23315. }
  23316. }
  23317. return {
  23318. width,
  23319. height,
  23320. items
  23321. };
  23322. }
  23323. }
  23324. class IrreversibleTransform extends Transform {
  23325. filter(x, offset, length) {
  23326. const len = length >> 1;
  23327. offset |= 0;
  23328. let j, n, current, next;
  23329. const alpha = -1.586134342059924;
  23330. const beta = -0.052980118572961;
  23331. const gamma = 0.882911075530934;
  23332. const delta = 0.443506852043971;
  23333. const K = 1.230174104914001;
  23334. const K_ = 1 / K;
  23335. j = offset - 3;
  23336. for (n = len + 4; n--; j += 2) {
  23337. x[j] *= K_;
  23338. }
  23339. j = offset - 2;
  23340. current = delta * x[j - 1];
  23341. for (n = len + 3; n--; j += 2) {
  23342. next = delta * x[j + 1];
  23343. x[j] = K * x[j] - current - next;
  23344. if (n--) {
  23345. j += 2;
  23346. current = delta * x[j + 1];
  23347. x[j] = K * x[j] - current - next;
  23348. } else {
  23349. break;
  23350. }
  23351. }
  23352. j = offset - 1;
  23353. current = gamma * x[j - 1];
  23354. for (n = len + 2; n--; j += 2) {
  23355. next = gamma * x[j + 1];
  23356. x[j] -= current + next;
  23357. if (n--) {
  23358. j += 2;
  23359. current = gamma * x[j + 1];
  23360. x[j] -= current + next;
  23361. } else {
  23362. break;
  23363. }
  23364. }
  23365. j = offset;
  23366. current = beta * x[j - 1];
  23367. for (n = len + 1; n--; j += 2) {
  23368. next = beta * x[j + 1];
  23369. x[j] -= current + next;
  23370. if (n--) {
  23371. j += 2;
  23372. current = beta * x[j + 1];
  23373. x[j] -= current + next;
  23374. } else {
  23375. break;
  23376. }
  23377. }
  23378. if (len !== 0) {
  23379. j = offset + 1;
  23380. current = alpha * x[j - 1];
  23381. for (n = len; n--; j += 2) {
  23382. next = alpha * x[j + 1];
  23383. x[j] -= current + next;
  23384. if (n--) {
  23385. j += 2;
  23386. current = alpha * x[j + 1];
  23387. x[j] -= current + next;
  23388. } else {
  23389. break;
  23390. }
  23391. }
  23392. }
  23393. }
  23394. }
  23395. class ReversibleTransform extends Transform {
  23396. filter(x, offset, length) {
  23397. const len = length >> 1;
  23398. offset |= 0;
  23399. let j, n;
  23400. for (j = offset, n = len + 1; n--; j += 2) {
  23401. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  23402. }
  23403. for (j = offset + 1, n = len; n--; j += 2) {
  23404. x[j] += x[j - 1] + x[j + 1] >> 1;
  23405. }
  23406. }
  23407. }
  23408. /***/ }),
  23409. /* 162 */
  23410. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23411. "use strict";
  23412. Object.defineProperty(exports, "__esModule", ({
  23413. value: true
  23414. }));
  23415. exports.LZWStream = void 0;
  23416. var _decode_stream = __w_pdfjs_require__(150);
  23417. class LZWStream extends _decode_stream.DecodeStream {
  23418. constructor(str, maybeLength, earlyChange) {
  23419. super(maybeLength);
  23420. this.str = str;
  23421. this.dict = str.dict;
  23422. this.cachedData = 0;
  23423. this.bitsCached = 0;
  23424. const maxLzwDictionarySize = 4096;
  23425. const lzwState = {
  23426. earlyChange,
  23427. codeLength: 9,
  23428. nextCode: 258,
  23429. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  23430. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  23431. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  23432. currentSequence: new Uint8Array(maxLzwDictionarySize),
  23433. currentSequenceLength: 0
  23434. };
  23435. for (let i = 0; i < 256; ++i) {
  23436. lzwState.dictionaryValues[i] = i;
  23437. lzwState.dictionaryLengths[i] = 1;
  23438. }
  23439. this.lzwState = lzwState;
  23440. }
  23441. readBits(n) {
  23442. let bitsCached = this.bitsCached;
  23443. let cachedData = this.cachedData;
  23444. while (bitsCached < n) {
  23445. const c = this.str.getByte();
  23446. if (c === -1) {
  23447. this.eof = true;
  23448. return null;
  23449. }
  23450. cachedData = cachedData << 8 | c;
  23451. bitsCached += 8;
  23452. }
  23453. this.bitsCached = bitsCached -= n;
  23454. this.cachedData = cachedData;
  23455. this.lastCode = null;
  23456. return cachedData >>> bitsCached & (1 << n) - 1;
  23457. }
  23458. readBlock() {
  23459. const blockSize = 512,
  23460. decodedSizeDelta = blockSize;
  23461. let estimatedDecodedSize = blockSize * 2;
  23462. let i, j, q;
  23463. const lzwState = this.lzwState;
  23464. if (!lzwState) {
  23465. return;
  23466. }
  23467. const earlyChange = lzwState.earlyChange;
  23468. let nextCode = lzwState.nextCode;
  23469. const dictionaryValues = lzwState.dictionaryValues;
  23470. const dictionaryLengths = lzwState.dictionaryLengths;
  23471. const dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  23472. let codeLength = lzwState.codeLength;
  23473. let prevCode = lzwState.prevCode;
  23474. const currentSequence = lzwState.currentSequence;
  23475. let currentSequenceLength = lzwState.currentSequenceLength;
  23476. let decodedLength = 0;
  23477. let currentBufferLength = this.bufferLength;
  23478. let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  23479. for (i = 0; i < blockSize; i++) {
  23480. const code = this.readBits(codeLength);
  23481. const hasPrev = currentSequenceLength > 0;
  23482. if (code < 256) {
  23483. currentSequence[0] = code;
  23484. currentSequenceLength = 1;
  23485. } else if (code >= 258) {
  23486. if (code < nextCode) {
  23487. currentSequenceLength = dictionaryLengths[code];
  23488. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  23489. currentSequence[j] = dictionaryValues[q];
  23490. q = dictionaryPrevCodes[q];
  23491. }
  23492. } else {
  23493. currentSequence[currentSequenceLength++] = currentSequence[0];
  23494. }
  23495. } else if (code === 256) {
  23496. codeLength = 9;
  23497. nextCode = 258;
  23498. currentSequenceLength = 0;
  23499. continue;
  23500. } else {
  23501. this.eof = true;
  23502. delete this.lzwState;
  23503. break;
  23504. }
  23505. if (hasPrev) {
  23506. dictionaryPrevCodes[nextCode] = prevCode;
  23507. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  23508. dictionaryValues[nextCode] = currentSequence[0];
  23509. nextCode++;
  23510. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  23511. }
  23512. prevCode = code;
  23513. decodedLength += currentSequenceLength;
  23514. if (estimatedDecodedSize < decodedLength) {
  23515. do {
  23516. estimatedDecodedSize += decodedSizeDelta;
  23517. } while (estimatedDecodedSize < decodedLength);
  23518. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  23519. }
  23520. for (j = 0; j < currentSequenceLength; j++) {
  23521. buffer[currentBufferLength++] = currentSequence[j];
  23522. }
  23523. }
  23524. lzwState.nextCode = nextCode;
  23525. lzwState.codeLength = codeLength;
  23526. lzwState.prevCode = prevCode;
  23527. lzwState.currentSequenceLength = currentSequenceLength;
  23528. this.bufferLength = currentBufferLength;
  23529. }
  23530. }
  23531. exports.LZWStream = LZWStream;
  23532. /***/ }),
  23533. /* 163 */
  23534. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23535. "use strict";
  23536. Object.defineProperty(exports, "__esModule", ({
  23537. value: true
  23538. }));
  23539. exports.PredictorStream = void 0;
  23540. var _decode_stream = __w_pdfjs_require__(150);
  23541. var _primitives = __w_pdfjs_require__(137);
  23542. var _util = __w_pdfjs_require__(2);
  23543. class PredictorStream extends _decode_stream.DecodeStream {
  23544. constructor(str, maybeLength, params) {
  23545. super(maybeLength);
  23546. if (!(params instanceof _primitives.Dict)) {
  23547. return str;
  23548. }
  23549. const predictor = this.predictor = params.get("Predictor") || 1;
  23550. if (predictor <= 1) {
  23551. return str;
  23552. }
  23553. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  23554. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  23555. }
  23556. if (predictor === 2) {
  23557. this.readBlock = this.readBlockTiff;
  23558. } else {
  23559. this.readBlock = this.readBlockPng;
  23560. }
  23561. this.str = str;
  23562. this.dict = str.dict;
  23563. const colors = this.colors = params.get("Colors") || 1;
  23564. const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8;
  23565. const columns = this.columns = params.get("Columns") || 1;
  23566. this.pixBytes = colors * bits + 7 >> 3;
  23567. this.rowBytes = columns * colors * bits + 7 >> 3;
  23568. return this;
  23569. }
  23570. readBlockTiff() {
  23571. const rowBytes = this.rowBytes;
  23572. const bufferLength = this.bufferLength;
  23573. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  23574. const bits = this.bits;
  23575. const colors = this.colors;
  23576. const rawBytes = this.str.getBytes(rowBytes);
  23577. this.eof = !rawBytes.length;
  23578. if (this.eof) {
  23579. return;
  23580. }
  23581. let inbuf = 0,
  23582. outbuf = 0;
  23583. let inbits = 0,
  23584. outbits = 0;
  23585. let pos = bufferLength;
  23586. let i;
  23587. if (bits === 1 && colors === 1) {
  23588. for (i = 0; i < rowBytes; ++i) {
  23589. let c = rawBytes[i] ^ inbuf;
  23590. c ^= c >> 1;
  23591. c ^= c >> 2;
  23592. c ^= c >> 4;
  23593. inbuf = (c & 1) << 7;
  23594. buffer[pos++] = c;
  23595. }
  23596. } else if (bits === 8) {
  23597. for (i = 0; i < colors; ++i) {
  23598. buffer[pos++] = rawBytes[i];
  23599. }
  23600. for (; i < rowBytes; ++i) {
  23601. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  23602. pos++;
  23603. }
  23604. } else if (bits === 16) {
  23605. const bytesPerPixel = colors * 2;
  23606. for (i = 0; i < bytesPerPixel; ++i) {
  23607. buffer[pos++] = rawBytes[i];
  23608. }
  23609. for (; i < rowBytes; i += 2) {
  23610. const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
  23611. buffer[pos++] = sum >> 8 & 0xff;
  23612. buffer[pos++] = sum & 0xff;
  23613. }
  23614. } else {
  23615. const compArray = new Uint8Array(colors + 1);
  23616. const bitMask = (1 << bits) - 1;
  23617. let j = 0,
  23618. k = bufferLength;
  23619. const columns = this.columns;
  23620. for (i = 0; i < columns; ++i) {
  23621. for (let kk = 0; kk < colors; ++kk) {
  23622. if (inbits < bits) {
  23623. inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
  23624. inbits += 8;
  23625. }
  23626. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  23627. inbits -= bits;
  23628. outbuf = outbuf << bits | compArray[kk];
  23629. outbits += bits;
  23630. if (outbits >= 8) {
  23631. buffer[k++] = outbuf >> outbits - 8 & 0xff;
  23632. outbits -= 8;
  23633. }
  23634. }
  23635. }
  23636. if (outbits > 0) {
  23637. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  23638. }
  23639. }
  23640. this.bufferLength += rowBytes;
  23641. }
  23642. readBlockPng() {
  23643. const rowBytes = this.rowBytes;
  23644. const pixBytes = this.pixBytes;
  23645. const predictor = this.str.getByte();
  23646. const rawBytes = this.str.getBytes(rowBytes);
  23647. this.eof = !rawBytes.length;
  23648. if (this.eof) {
  23649. return;
  23650. }
  23651. const bufferLength = this.bufferLength;
  23652. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  23653. let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  23654. if (prevRow.length === 0) {
  23655. prevRow = new Uint8Array(rowBytes);
  23656. }
  23657. let i,
  23658. j = bufferLength,
  23659. up,
  23660. c;
  23661. switch (predictor) {
  23662. case 0:
  23663. for (i = 0; i < rowBytes; ++i) {
  23664. buffer[j++] = rawBytes[i];
  23665. }
  23666. break;
  23667. case 1:
  23668. for (i = 0; i < pixBytes; ++i) {
  23669. buffer[j++] = rawBytes[i];
  23670. }
  23671. for (; i < rowBytes; ++i) {
  23672. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
  23673. j++;
  23674. }
  23675. break;
  23676. case 2:
  23677. for (i = 0; i < rowBytes; ++i) {
  23678. buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
  23679. }
  23680. break;
  23681. case 3:
  23682. for (i = 0; i < pixBytes; ++i) {
  23683. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  23684. }
  23685. for (; i < rowBytes; ++i) {
  23686. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
  23687. j++;
  23688. }
  23689. break;
  23690. case 4:
  23691. for (i = 0; i < pixBytes; ++i) {
  23692. up = prevRow[i];
  23693. c = rawBytes[i];
  23694. buffer[j++] = up + c;
  23695. }
  23696. for (; i < rowBytes; ++i) {
  23697. up = prevRow[i];
  23698. const upLeft = prevRow[i - pixBytes];
  23699. const left = buffer[j - pixBytes];
  23700. const p = left + up - upLeft;
  23701. let pa = p - left;
  23702. if (pa < 0) {
  23703. pa = -pa;
  23704. }
  23705. let pb = p - up;
  23706. if (pb < 0) {
  23707. pb = -pb;
  23708. }
  23709. let pc = p - upLeft;
  23710. if (pc < 0) {
  23711. pc = -pc;
  23712. }
  23713. c = rawBytes[i];
  23714. if (pa <= pb && pa <= pc) {
  23715. buffer[j++] = left + c;
  23716. } else if (pb <= pc) {
  23717. buffer[j++] = up + c;
  23718. } else {
  23719. buffer[j++] = upLeft + c;
  23720. }
  23721. }
  23722. break;
  23723. default:
  23724. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  23725. }
  23726. this.bufferLength += rowBytes;
  23727. }
  23728. }
  23729. exports.PredictorStream = PredictorStream;
  23730. /***/ }),
  23731. /* 164 */
  23732. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23733. "use strict";
  23734. Object.defineProperty(exports, "__esModule", ({
  23735. value: true
  23736. }));
  23737. exports.RunLengthStream = void 0;
  23738. var _decode_stream = __w_pdfjs_require__(150);
  23739. class RunLengthStream extends _decode_stream.DecodeStream {
  23740. constructor(str, maybeLength) {
  23741. super(maybeLength);
  23742. this.str = str;
  23743. this.dict = str.dict;
  23744. }
  23745. readBlock() {
  23746. const repeatHeader = this.str.getBytes(2);
  23747. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  23748. this.eof = true;
  23749. return;
  23750. }
  23751. let buffer;
  23752. let bufferLength = this.bufferLength;
  23753. let n = repeatHeader[0];
  23754. if (n < 128) {
  23755. buffer = this.ensureBuffer(bufferLength + n + 1);
  23756. buffer[bufferLength++] = repeatHeader[1];
  23757. if (n > 0) {
  23758. const source = this.str.getBytes(n);
  23759. buffer.set(source, bufferLength);
  23760. bufferLength += n;
  23761. }
  23762. } else {
  23763. n = 257 - n;
  23764. const b = repeatHeader[1];
  23765. buffer = this.ensureBuffer(bufferLength + n + 1);
  23766. for (let i = 0; i < n; i++) {
  23767. buffer[bufferLength++] = b;
  23768. }
  23769. }
  23770. this.bufferLength = bufferLength;
  23771. }
  23772. }
  23773. exports.RunLengthStream = RunLengthStream;
  23774. /***/ }),
  23775. /* 165 */
  23776. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23777. "use strict";
  23778. Object.defineProperty(exports, "__esModule", ({
  23779. value: true
  23780. }));
  23781. exports.Font = exports.ErrorFont = void 0;
  23782. var _util = __w_pdfjs_require__(2);
  23783. var _cff_parser = __w_pdfjs_require__(166);
  23784. var _fonts_utils = __w_pdfjs_require__(169);
  23785. var _unicode = __w_pdfjs_require__(171);
  23786. var _glyphlist = __w_pdfjs_require__(170);
  23787. var _encodings = __w_pdfjs_require__(168);
  23788. var _standard_fonts = __w_pdfjs_require__(172);
  23789. var _to_unicode_map = __w_pdfjs_require__(173);
  23790. var _cff_font = __w_pdfjs_require__(174);
  23791. var _font_renderer = __w_pdfjs_require__(175);
  23792. var _metrics = __w_pdfjs_require__(176);
  23793. var _glyf = __w_pdfjs_require__(177);
  23794. var _cmap = __w_pdfjs_require__(147);
  23795. var _opentype_file_builder = __w_pdfjs_require__(178);
  23796. var _core_utils = __w_pdfjs_require__(136);
  23797. var _stream = __w_pdfjs_require__(141);
  23798. var _type1_font = __w_pdfjs_require__(179);
  23799. const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
  23800. const PDF_GLYPH_SPACE_UNITS = 1000;
  23801. const EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "charProcOperatorList", "composite", "cssFontInfo", "data", "defaultVMetrics", "defaultWidth", "descent", "fallbackName", "fontMatrix", "isInvalidPDFjsFont", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "subtype", "type", "vertical"];
  23802. const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
  23803. function adjustWidths(properties) {
  23804. if (!properties.fontMatrix) {
  23805. return;
  23806. }
  23807. if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
  23808. return;
  23809. }
  23810. const scale = 0.001 / properties.fontMatrix[0];
  23811. const glyphsWidths = properties.widths;
  23812. for (const glyph in glyphsWidths) {
  23813. glyphsWidths[glyph] *= scale;
  23814. }
  23815. properties.defaultWidth *= scale;
  23816. }
  23817. function adjustTrueTypeToUnicode(properties, isSymbolicFont, nameRecords) {
  23818. if (properties.isInternalFont) {
  23819. return;
  23820. }
  23821. if (properties.hasIncludedToUnicodeMap) {
  23822. return;
  23823. }
  23824. if (properties.hasEncoding) {
  23825. return;
  23826. }
  23827. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  23828. return;
  23829. }
  23830. if (!isSymbolicFont) {
  23831. return;
  23832. }
  23833. if (nameRecords.length === 0) {
  23834. return;
  23835. }
  23836. if (properties.defaultEncoding === _encodings.WinAnsiEncoding) {
  23837. return;
  23838. }
  23839. for (const r of nameRecords) {
  23840. if (!isWinNameRecord(r)) {
  23841. return;
  23842. }
  23843. }
  23844. const encoding = _encodings.WinAnsiEncoding;
  23845. const toUnicode = [],
  23846. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  23847. for (const charCode in encoding) {
  23848. const glyphName = encoding[charCode];
  23849. if (glyphName === "") {
  23850. continue;
  23851. }
  23852. const unicode = glyphsUnicodeMap[glyphName];
  23853. if (unicode === undefined) {
  23854. continue;
  23855. }
  23856. toUnicode[charCode] = String.fromCharCode(unicode);
  23857. }
  23858. if (toUnicode.length > 0) {
  23859. properties.toUnicode.amend(toUnicode);
  23860. }
  23861. }
  23862. function adjustType1ToUnicode(properties, builtInEncoding) {
  23863. if (properties.isInternalFont) {
  23864. return;
  23865. }
  23866. if (properties.hasIncludedToUnicodeMap) {
  23867. return;
  23868. }
  23869. if (builtInEncoding === properties.defaultEncoding) {
  23870. return;
  23871. }
  23872. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  23873. return;
  23874. }
  23875. const toUnicode = [],
  23876. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  23877. for (const charCode in builtInEncoding) {
  23878. if (properties.hasEncoding) {
  23879. if (properties.baseEncodingName || properties.differences[charCode] !== undefined) {
  23880. continue;
  23881. }
  23882. }
  23883. const glyphName = builtInEncoding[charCode];
  23884. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  23885. if (unicode !== -1) {
  23886. toUnicode[charCode] = String.fromCharCode(unicode);
  23887. }
  23888. }
  23889. if (toUnicode.length > 0) {
  23890. properties.toUnicode.amend(toUnicode);
  23891. }
  23892. }
  23893. function amendFallbackToUnicode(properties) {
  23894. if (!properties.fallbackToUnicode) {
  23895. return;
  23896. }
  23897. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  23898. return;
  23899. }
  23900. const toUnicode = [];
  23901. for (const charCode in properties.fallbackToUnicode) {
  23902. if (properties.toUnicode.has(charCode)) {
  23903. continue;
  23904. }
  23905. toUnicode[charCode] = properties.fallbackToUnicode[charCode];
  23906. }
  23907. if (toUnicode.length > 0) {
  23908. properties.toUnicode.amend(toUnicode);
  23909. }
  23910. }
  23911. class Glyph {
  23912. constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  23913. this.originalCharCode = originalCharCode;
  23914. this.fontChar = fontChar;
  23915. this.unicode = unicode;
  23916. this.accent = accent;
  23917. this.width = width;
  23918. this.vmetric = vmetric;
  23919. this.operatorListId = operatorListId;
  23920. this.isSpace = isSpace;
  23921. this.isInFont = isInFont;
  23922. }
  23923. get category() {
  23924. return (0, _util.shadow)(this, "category", (0, _unicode.getCharUnicodeCategory)(this.unicode), true);
  23925. }
  23926. get normalizedUnicode() {
  23927. return (0, _util.shadow)(this, "normalizedUnicode", (0, _unicode.reverseIfRtl)(Glyph._NormalizedUnicodes[this.unicode] || this.unicode), true);
  23928. }
  23929. static get _NormalizedUnicodes() {
  23930. return (0, _util.shadow)(this, "_NormalizedUnicodes", (0, _unicode.getNormalizedUnicodes)());
  23931. }
  23932. }
  23933. function int16(b0, b1) {
  23934. return (b0 << 8) + b1;
  23935. }
  23936. function writeSignedInt16(bytes, index, value) {
  23937. bytes[index + 1] = value;
  23938. bytes[index] = value >>> 8;
  23939. }
  23940. function signedInt16(b0, b1) {
  23941. const value = (b0 << 8) + b1;
  23942. return value & 1 << 15 ? value - 0x10000 : value;
  23943. }
  23944. function int32(b0, b1, b2, b3) {
  23945. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  23946. }
  23947. function string16(value) {
  23948. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  23949. }
  23950. function safeString16(value) {
  23951. if (value > 0x7fff) {
  23952. value = 0x7fff;
  23953. } else if (value < -0x8000) {
  23954. value = -0x8000;
  23955. }
  23956. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  23957. }
  23958. function isTrueTypeFile(file) {
  23959. const header = file.peekBytes(4);
  23960. return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true";
  23961. }
  23962. function isTrueTypeCollectionFile(file) {
  23963. const header = file.peekBytes(4);
  23964. return (0, _util.bytesToString)(header) === "ttcf";
  23965. }
  23966. function isOpenTypeFile(file) {
  23967. const header = file.peekBytes(4);
  23968. return (0, _util.bytesToString)(header) === "OTTO";
  23969. }
  23970. function isType1File(file) {
  23971. const header = file.peekBytes(2);
  23972. if (header[0] === 0x25 && header[1] === 0x21) {
  23973. return true;
  23974. }
  23975. if (header[0] === 0x80 && header[1] === 0x01) {
  23976. return true;
  23977. }
  23978. return false;
  23979. }
  23980. function isCFFFile(file) {
  23981. const header = file.peekBytes(4);
  23982. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  23983. return true;
  23984. }
  23985. return false;
  23986. }
  23987. function getFontFileType(file, _ref) {
  23988. let {
  23989. type,
  23990. subtype,
  23991. composite
  23992. } = _ref;
  23993. let fileType, fileSubtype;
  23994. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  23995. if (composite) {
  23996. fileType = "CIDFontType2";
  23997. } else {
  23998. fileType = "TrueType";
  23999. }
  24000. } else if (isOpenTypeFile(file)) {
  24001. if (composite) {
  24002. fileType = "CIDFontType2";
  24003. } else {
  24004. fileType = "OpenType";
  24005. }
  24006. } else if (isType1File(file)) {
  24007. if (composite) {
  24008. fileType = "CIDFontType0";
  24009. } else {
  24010. fileType = type === "MMType1" ? "MMType1" : "Type1";
  24011. }
  24012. } else if (isCFFFile(file)) {
  24013. if (composite) {
  24014. fileType = "CIDFontType0";
  24015. fileSubtype = "CIDFontType0C";
  24016. } else {
  24017. fileType = type === "MMType1" ? "MMType1" : "Type1";
  24018. fileSubtype = "Type1C";
  24019. }
  24020. } else {
  24021. (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");
  24022. fileType = type;
  24023. fileSubtype = subtype;
  24024. }
  24025. return [fileType, fileSubtype];
  24026. }
  24027. function applyStandardFontGlyphMap(map, glyphMap) {
  24028. for (const charCode in glyphMap) {
  24029. map[+charCode] = glyphMap[charCode];
  24030. }
  24031. }
  24032. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  24033. const toFontChar = [];
  24034. let unicode;
  24035. for (let i = 0, ii = encoding.length; i < ii; i++) {
  24036. unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
  24037. if (unicode !== -1) {
  24038. toFontChar[i] = unicode;
  24039. }
  24040. }
  24041. for (const charCode in differences) {
  24042. unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
  24043. if (unicode !== -1) {
  24044. toFontChar[+charCode] = unicode;
  24045. }
  24046. }
  24047. return toFontChar;
  24048. }
  24049. function isMacNameRecord(r) {
  24050. return r.platform === 1 && r.encoding === 0 && r.language === 0;
  24051. }
  24052. function isWinNameRecord(r) {
  24053. return r.platform === 3 && r.encoding === 1 && r.language === 0x409;
  24054. }
  24055. function convertCidString(charCode, cid) {
  24056. let shouldThrow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  24057. switch (cid.length) {
  24058. case 1:
  24059. return cid.charCodeAt(0);
  24060. case 2:
  24061. return cid.charCodeAt(0) << 8 | cid.charCodeAt(1);
  24062. }
  24063. const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`;
  24064. if (shouldThrow) {
  24065. throw new _util.FormatError(msg);
  24066. }
  24067. (0, _util.warn)(msg);
  24068. return cid;
  24069. }
  24070. function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId, toUnicode) {
  24071. const newMap = Object.create(null);
  24072. const toUnicodeExtraMap = new Map();
  24073. const toFontChar = [];
  24074. const usedGlyphIds = new Set();
  24075. let privateUseAreaIndex = 0;
  24076. const privateUseOffetStart = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  24077. let nextAvailableFontCharCode = privateUseOffetStart;
  24078. let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  24079. for (let originalCharCode in charCodeToGlyphId) {
  24080. originalCharCode |= 0;
  24081. let glyphId = charCodeToGlyphId[originalCharCode];
  24082. if (!hasGlyph(glyphId)) {
  24083. continue;
  24084. }
  24085. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  24086. privateUseAreaIndex++;
  24087. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  24088. (0, _util.warn)("Ran out of space in font private use area.");
  24089. break;
  24090. }
  24091. nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  24092. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  24093. }
  24094. const fontCharCode = nextAvailableFontCharCode++;
  24095. if (glyphId === 0) {
  24096. glyphId = newGlyphZeroId;
  24097. }
  24098. let unicode = toUnicode.get(originalCharCode);
  24099. if (typeof unicode === "string") {
  24100. unicode = unicode.codePointAt(0);
  24101. }
  24102. if (unicode && unicode < privateUseOffetStart && !usedGlyphIds.has(glyphId)) {
  24103. toUnicodeExtraMap.set(unicode, glyphId);
  24104. usedGlyphIds.add(glyphId);
  24105. }
  24106. newMap[fontCharCode] = glyphId;
  24107. toFontChar[originalCharCode] = fontCharCode;
  24108. }
  24109. return {
  24110. toFontChar,
  24111. charCodeToGlyphId: newMap,
  24112. toUnicodeExtraMap,
  24113. nextAvailableFontCharCode
  24114. };
  24115. }
  24116. function getRanges(glyphs, toUnicodeExtraMap, numGlyphs) {
  24117. const codes = [];
  24118. for (const charCode in glyphs) {
  24119. if (glyphs[charCode] >= numGlyphs) {
  24120. continue;
  24121. }
  24122. codes.push({
  24123. fontCharCode: charCode | 0,
  24124. glyphId: glyphs[charCode]
  24125. });
  24126. }
  24127. if (toUnicodeExtraMap) {
  24128. for (const [unicode, glyphId] of toUnicodeExtraMap) {
  24129. if (glyphId >= numGlyphs) {
  24130. continue;
  24131. }
  24132. codes.push({
  24133. fontCharCode: unicode,
  24134. glyphId
  24135. });
  24136. }
  24137. }
  24138. if (codes.length === 0) {
  24139. codes.push({
  24140. fontCharCode: 0,
  24141. glyphId: 0
  24142. });
  24143. }
  24144. codes.sort(function fontGetRangesSort(a, b) {
  24145. return a.fontCharCode - b.fontCharCode;
  24146. });
  24147. const ranges = [];
  24148. const length = codes.length;
  24149. for (let n = 0; n < length;) {
  24150. const start = codes[n].fontCharCode;
  24151. const codeIndices = [codes[n].glyphId];
  24152. ++n;
  24153. let end = start;
  24154. while (n < length && end + 1 === codes[n].fontCharCode) {
  24155. codeIndices.push(codes[n].glyphId);
  24156. ++end;
  24157. ++n;
  24158. if (end === 0xffff) {
  24159. break;
  24160. }
  24161. }
  24162. ranges.push([start, end, codeIndices]);
  24163. }
  24164. return ranges;
  24165. }
  24166. function createCmapTable(glyphs, toUnicodeExtraMap, numGlyphs) {
  24167. const ranges = getRanges(glyphs, toUnicodeExtraMap, numGlyphs);
  24168. const numTables = ranges.at(-1)[1] > 0xffff ? 2 : 1;
  24169. let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8);
  24170. let i, ii, j, jj;
  24171. for (i = ranges.length - 1; i >= 0; --i) {
  24172. if (ranges[i][0] <= 0xffff) {
  24173. break;
  24174. }
  24175. }
  24176. const bmpLength = i + 1;
  24177. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  24178. ranges[i][1] = 0xfffe;
  24179. }
  24180. const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  24181. const segCount = bmpLength + trailingRangesCount;
  24182. const searchParams = _opentype_file_builder.OpenTypeFileBuilder.getSearchParams(segCount, 2);
  24183. let startCount = "";
  24184. let endCount = "";
  24185. let idDeltas = "";
  24186. let idRangeOffsets = "";
  24187. let glyphsIds = "";
  24188. let bias = 0;
  24189. let range, start, end, codes;
  24190. for (i = 0, ii = bmpLength; i < ii; i++) {
  24191. range = ranges[i];
  24192. start = range[0];
  24193. end = range[1];
  24194. startCount += string16(start);
  24195. endCount += string16(end);
  24196. codes = range[2];
  24197. let contiguous = true;
  24198. for (j = 1, jj = codes.length; j < jj; ++j) {
  24199. if (codes[j] !== codes[j - 1] + 1) {
  24200. contiguous = false;
  24201. break;
  24202. }
  24203. }
  24204. if (!contiguous) {
  24205. const offset = (segCount - i) * 2 + bias * 2;
  24206. bias += end - start + 1;
  24207. idDeltas += string16(0);
  24208. idRangeOffsets += string16(offset);
  24209. for (j = 0, jj = codes.length; j < jj; ++j) {
  24210. glyphsIds += string16(codes[j]);
  24211. }
  24212. } else {
  24213. const startCode = codes[0];
  24214. idDeltas += string16(startCode - start & 0xffff);
  24215. idRangeOffsets += string16(0);
  24216. }
  24217. }
  24218. if (trailingRangesCount > 0) {
  24219. endCount += "\xFF\xFF";
  24220. startCount += "\xFF\xFF";
  24221. idDeltas += "\x00\x01";
  24222. idRangeOffsets += "\x00\x00";
  24223. }
  24224. const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
  24225. let format31012 = "";
  24226. let header31012 = "";
  24227. if (numTables > 1) {
  24228. cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
  24229. format31012 = "";
  24230. for (i = 0, ii = ranges.length; i < ii; i++) {
  24231. range = ranges[i];
  24232. start = range[0];
  24233. codes = range[2];
  24234. let code = codes[0];
  24235. for (j = 1, jj = codes.length; j < jj; ++j) {
  24236. if (codes[j] !== codes[j - 1] + 1) {
  24237. end = range[0] + j - 1;
  24238. format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
  24239. start = end + 1;
  24240. code = codes[j];
  24241. }
  24242. }
  24243. format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
  24244. }
  24245. header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12);
  24246. }
  24247. return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
  24248. }
  24249. function validateOS2Table(os2, file) {
  24250. file.pos = (file.start || 0) + os2.offset;
  24251. const version = file.getUint16();
  24252. file.skip(60);
  24253. const selection = file.getUint16();
  24254. if (version < 4 && selection & 0x0300) {
  24255. return false;
  24256. }
  24257. const firstChar = file.getUint16();
  24258. const lastChar = file.getUint16();
  24259. if (firstChar > lastChar) {
  24260. return false;
  24261. }
  24262. file.skip(6);
  24263. const usWinAscent = file.getUint16();
  24264. if (usWinAscent === 0) {
  24265. return false;
  24266. }
  24267. os2.data[8] = os2.data[9] = 0;
  24268. return true;
  24269. }
  24270. function createOS2Table(properties, charstrings, override) {
  24271. override = override || {
  24272. unitsPerEm: 0,
  24273. yMax: 0,
  24274. yMin: 0,
  24275. ascent: 0,
  24276. descent: 0
  24277. };
  24278. let ulUnicodeRange1 = 0;
  24279. let ulUnicodeRange2 = 0;
  24280. let ulUnicodeRange3 = 0;
  24281. let ulUnicodeRange4 = 0;
  24282. let firstCharIndex = null;
  24283. let lastCharIndex = 0;
  24284. if (charstrings) {
  24285. for (let code in charstrings) {
  24286. code |= 0;
  24287. if (firstCharIndex > code || !firstCharIndex) {
  24288. firstCharIndex = code;
  24289. }
  24290. if (lastCharIndex < code) {
  24291. lastCharIndex = code;
  24292. }
  24293. const position = (0, _unicode.getUnicodeRangeFor)(code);
  24294. if (position < 32) {
  24295. ulUnicodeRange1 |= 1 << position;
  24296. } else if (position < 64) {
  24297. ulUnicodeRange2 |= 1 << position - 32;
  24298. } else if (position < 96) {
  24299. ulUnicodeRange3 |= 1 << position - 64;
  24300. } else if (position < 123) {
  24301. ulUnicodeRange4 |= 1 << position - 96;
  24302. } else {
  24303. throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
  24304. }
  24305. }
  24306. if (lastCharIndex > 0xffff) {
  24307. lastCharIndex = 0xffff;
  24308. }
  24309. } else {
  24310. firstCharIndex = 0;
  24311. lastCharIndex = 255;
  24312. }
  24313. const bbox = properties.bbox || [0, 0, 0, 0];
  24314. const unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  24315. const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  24316. const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  24317. let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  24318. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  24319. typoDescent = -typoDescent;
  24320. }
  24321. const winAscent = override.yMax || typoAscent;
  24322. const winDescent = -override.yMin || -typoDescent;
  24323. 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";
  24324. }
  24325. function createPostTable(properties) {
  24326. const angle = Math.floor(properties.italicAngle * 2 ** 16);
  24327. 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";
  24328. }
  24329. function createPostscriptName(name) {
  24330. return name.replace(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63);
  24331. }
  24332. function createNameTable(name, proto) {
  24333. if (!proto) {
  24334. proto = [[], []];
  24335. }
  24336. 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"];
  24337. const stringsUnicode = [];
  24338. let i, ii, j, jj, str;
  24339. for (i = 0, ii = strings.length; i < ii; i++) {
  24340. str = proto[1][i] || strings[i];
  24341. const strBufUnicode = [];
  24342. for (j = 0, jj = str.length; j < jj; j++) {
  24343. strBufUnicode.push(string16(str.charCodeAt(j)));
  24344. }
  24345. stringsUnicode.push(strBufUnicode.join(""));
  24346. }
  24347. const names = [strings, stringsUnicode];
  24348. const platforms = ["\x00\x01", "\x00\x03"];
  24349. const encodings = ["\x00\x00", "\x00\x01"];
  24350. const languages = ["\x00\x00", "\x04\x09"];
  24351. const namesRecordCount = strings.length * platforms.length;
  24352. let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  24353. let strOffset = 0;
  24354. for (i = 0, ii = platforms.length; i < ii; i++) {
  24355. const strs = names[i];
  24356. for (j = 0, jj = strs.length; j < jj; j++) {
  24357. str = strs[j];
  24358. const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  24359. nameTable += nameRecord;
  24360. strOffset += str.length;
  24361. }
  24362. }
  24363. nameTable += strings.join("") + stringsUnicode.join("");
  24364. return nameTable;
  24365. }
  24366. class Font {
  24367. constructor(name, file, properties) {
  24368. this.name = name;
  24369. this.psName = null;
  24370. this.mimetype = null;
  24371. this.disableFontFace = false;
  24372. this.loadedName = properties.loadedName;
  24373. this.isType3Font = properties.isType3Font;
  24374. this.missingFile = false;
  24375. this.cssFontInfo = properties.cssFontInfo;
  24376. this._charsCache = Object.create(null);
  24377. this._glyphCache = Object.create(null);
  24378. let isSerifFont = !!(properties.flags & _fonts_utils.FontFlags.Serif);
  24379. if (!isSerifFont && !properties.isSimulatedFlags) {
  24380. const baseName = name.replace(/[,_]/g, "-").split("-")[0],
  24381. serifFonts = (0, _standard_fonts.getSerifFonts)();
  24382. for (const namePart of baseName.split("+")) {
  24383. if (serifFonts[namePart]) {
  24384. isSerifFont = true;
  24385. break;
  24386. }
  24387. }
  24388. }
  24389. this.isSerifFont = isSerifFont;
  24390. this.isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  24391. this.isMonospace = !!(properties.flags & _fonts_utils.FontFlags.FixedPitch);
  24392. let {
  24393. type,
  24394. subtype
  24395. } = properties;
  24396. this.type = type;
  24397. this.subtype = subtype;
  24398. const matches = name.match(/^InvalidPDFjsFont_(.*)_\d+$/);
  24399. this.isInvalidPDFjsFont = !!matches;
  24400. if (this.isInvalidPDFjsFont) {
  24401. this.fallbackName = matches[1];
  24402. } else if (this.isMonospace) {
  24403. this.fallbackName = "monospace";
  24404. } else if (this.isSerifFont) {
  24405. this.fallbackName = "serif";
  24406. } else {
  24407. this.fallbackName = "sans-serif";
  24408. }
  24409. this.differences = properties.differences;
  24410. this.widths = properties.widths;
  24411. this.defaultWidth = properties.defaultWidth;
  24412. this.composite = properties.composite;
  24413. this.cMap = properties.cMap;
  24414. this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
  24415. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  24416. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  24417. this.lineHeight = this.ascent - this.descent;
  24418. this.fontMatrix = properties.fontMatrix;
  24419. this.bbox = properties.bbox;
  24420. this.defaultEncoding = properties.defaultEncoding;
  24421. this.toUnicode = properties.toUnicode;
  24422. this.toFontChar = [];
  24423. if (properties.type === "Type3") {
  24424. for (let charCode = 0; charCode < 256; charCode++) {
  24425. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  24426. }
  24427. return;
  24428. }
  24429. this.cidEncoding = properties.cidEncoding || "";
  24430. this.vertical = !!properties.vertical;
  24431. if (this.vertical) {
  24432. this.vmetrics = properties.vmetrics;
  24433. this.defaultVMetrics = properties.defaultVMetrics;
  24434. }
  24435. if (!file || file.isEmpty) {
  24436. if (file) {
  24437. (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")");
  24438. }
  24439. this.fallbackToSystemFont(properties);
  24440. return;
  24441. }
  24442. [type, subtype] = getFontFileType(file, properties);
  24443. if (type !== this.type || subtype !== this.subtype) {
  24444. (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
  24445. }
  24446. let data;
  24447. try {
  24448. switch (type) {
  24449. case "MMType1":
  24450. (0, _util.info)("MMType1 font (" + name + "), falling back to Type1.");
  24451. case "Type1":
  24452. case "CIDFontType0":
  24453. this.mimetype = "font/opentype";
  24454. const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new _cff_font.CFFFont(file, properties) : new _type1_font.Type1Font(name, file, properties);
  24455. adjustWidths(properties);
  24456. data = this.convert(name, cff, properties);
  24457. break;
  24458. case "OpenType":
  24459. case "TrueType":
  24460. case "CIDFontType2":
  24461. this.mimetype = "font/opentype";
  24462. data = this.checkAndRepair(name, file, properties);
  24463. if (this.isOpenType) {
  24464. adjustWidths(properties);
  24465. type = "OpenType";
  24466. }
  24467. break;
  24468. default:
  24469. throw new _util.FormatError(`Font ${type} is not supported`);
  24470. }
  24471. } catch (e) {
  24472. (0, _util.warn)(e);
  24473. this.fallbackToSystemFont(properties);
  24474. return;
  24475. }
  24476. amendFallbackToUnicode(properties);
  24477. this.data = data;
  24478. this.type = type;
  24479. this.subtype = subtype;
  24480. this.fontMatrix = properties.fontMatrix;
  24481. this.widths = properties.widths;
  24482. this.defaultWidth = properties.defaultWidth;
  24483. this.toUnicode = properties.toUnicode;
  24484. this.seacMap = properties.seacMap;
  24485. }
  24486. get renderer() {
  24487. const renderer = _font_renderer.FontRendererFactory.create(this, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  24488. return (0, _util.shadow)(this, "renderer", renderer);
  24489. }
  24490. exportData() {
  24491. let extraProperties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  24492. const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
  24493. const data = Object.create(null);
  24494. let property, value;
  24495. for (property of exportDataProperties) {
  24496. value = this[property];
  24497. if (value !== undefined) {
  24498. data[property] = value;
  24499. }
  24500. }
  24501. return data;
  24502. }
  24503. fallbackToSystemFont(properties) {
  24504. this.missingFile = true;
  24505. const {
  24506. name,
  24507. type
  24508. } = this;
  24509. let fontName = (0, _fonts_utils.normalizeFontName)(name);
  24510. const stdFontMap = (0, _standard_fonts.getStdFontMap)(),
  24511. nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
  24512. const isStandardFont = !!stdFontMap[fontName];
  24513. const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  24514. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  24515. const fontBasicMetricsMap = (0, _metrics.getFontBasicMetrics)();
  24516. const metrics = fontBasicMetricsMap[fontName];
  24517. if (metrics) {
  24518. if (isNaN(this.ascent)) {
  24519. this.ascent = metrics.ascent / PDF_GLYPH_SPACE_UNITS;
  24520. }
  24521. if (isNaN(this.descent)) {
  24522. this.descent = metrics.descent / PDF_GLYPH_SPACE_UNITS;
  24523. }
  24524. if (isNaN(this.capHeight)) {
  24525. this.capHeight = metrics.capHeight / PDF_GLYPH_SPACE_UNITS;
  24526. }
  24527. }
  24528. this.bold = /bold/gi.test(fontName);
  24529. this.italic = /oblique|italic/gi.test(fontName);
  24530. this.black = /Black/g.test(name);
  24531. const isNarrow = /Narrow/g.test(name);
  24532. this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
  24533. if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
  24534. const cidToGidMap = properties.cidToGidMap;
  24535. const map = [];
  24536. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  24537. if (/Arial-?Black/i.test(name)) {
  24538. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)());
  24539. } else if (/Calibri/i.test(name)) {
  24540. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForCalibri)());
  24541. }
  24542. if (cidToGidMap) {
  24543. for (const charCode in map) {
  24544. const cid = map[charCode];
  24545. if (cidToGidMap[cid] !== undefined) {
  24546. map[+charCode] = cidToGidMap[cid];
  24547. }
  24548. }
  24549. if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  24550. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  24551. const cid = map[charCode];
  24552. if (cidToGidMap[cid] === undefined) {
  24553. map[+charCode] = unicodeCharCode;
  24554. }
  24555. });
  24556. }
  24557. }
  24558. if (!(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  24559. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  24560. map[+charCode] = unicodeCharCode;
  24561. });
  24562. }
  24563. this.toFontChar = map;
  24564. this.toUnicode = new _to_unicode_map.ToUnicodeMap(map);
  24565. } else if (/Symbol/i.test(fontName)) {
  24566. this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  24567. } else if (/Dingbats/i.test(fontName)) {
  24568. if (/Wingdings/i.test(name)) {
  24569. (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats.");
  24570. }
  24571. this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
  24572. } else if (isStandardFont) {
  24573. const map = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  24574. if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  24575. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  24576. map[+charCode] = unicodeCharCode;
  24577. });
  24578. }
  24579. this.toFontChar = map;
  24580. } else {
  24581. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  24582. const map = [];
  24583. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  24584. if (!this.composite) {
  24585. const glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
  24586. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  24587. if (unicode !== -1) {
  24588. unicodeCharCode = unicode;
  24589. }
  24590. }
  24591. map[+charCode] = unicodeCharCode;
  24592. });
  24593. if (this.composite && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  24594. if (/Tahoma|Verdana/i.test(name)) {
  24595. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  24596. }
  24597. }
  24598. this.toFontChar = map;
  24599. }
  24600. amendFallbackToUnicode(properties);
  24601. this.loadedName = fontName.split("-")[0];
  24602. }
  24603. checkAndRepair(name, font, properties) {
  24604. const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
  24605. function readTables(file, numTables) {
  24606. const tables = Object.create(null);
  24607. tables["OS/2"] = null;
  24608. tables.cmap = null;
  24609. tables.head = null;
  24610. tables.hhea = null;
  24611. tables.hmtx = null;
  24612. tables.maxp = null;
  24613. tables.name = null;
  24614. tables.post = null;
  24615. for (let i = 0; i < numTables; i++) {
  24616. const table = readTableEntry(file);
  24617. if (!VALID_TABLES.includes(table.tag)) {
  24618. continue;
  24619. }
  24620. if (table.length === 0) {
  24621. continue;
  24622. }
  24623. tables[table.tag] = table;
  24624. }
  24625. return tables;
  24626. }
  24627. function readTableEntry(file) {
  24628. const tag = file.getString(4);
  24629. const checksum = file.getInt32() >>> 0;
  24630. const offset = file.getInt32() >>> 0;
  24631. const length = file.getInt32() >>> 0;
  24632. const previousPosition = file.pos;
  24633. file.pos = file.start || 0;
  24634. file.skip(offset);
  24635. const data = file.getBytes(length);
  24636. file.pos = previousPosition;
  24637. if (tag === "head") {
  24638. data[8] = data[9] = data[10] = data[11] = 0;
  24639. data[17] |= 0x20;
  24640. }
  24641. return {
  24642. tag,
  24643. checksum,
  24644. length,
  24645. offset,
  24646. data
  24647. };
  24648. }
  24649. function readOpenTypeHeader(ttf) {
  24650. return {
  24651. version: ttf.getString(4),
  24652. numTables: ttf.getUint16(),
  24653. searchRange: ttf.getUint16(),
  24654. entrySelector: ttf.getUint16(),
  24655. rangeShift: ttf.getUint16()
  24656. };
  24657. }
  24658. function readTrueTypeCollectionHeader(ttc) {
  24659. const ttcTag = ttc.getString(4);
  24660. (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font.");
  24661. const majorVersion = ttc.getUint16();
  24662. const minorVersion = ttc.getUint16();
  24663. const numFonts = ttc.getInt32() >>> 0;
  24664. const offsetTable = [];
  24665. for (let i = 0; i < numFonts; i++) {
  24666. offsetTable.push(ttc.getInt32() >>> 0);
  24667. }
  24668. const header = {
  24669. ttcTag,
  24670. majorVersion,
  24671. minorVersion,
  24672. numFonts,
  24673. offsetTable
  24674. };
  24675. switch (majorVersion) {
  24676. case 1:
  24677. return header;
  24678. case 2:
  24679. header.dsigTag = ttc.getInt32() >>> 0;
  24680. header.dsigLength = ttc.getInt32() >>> 0;
  24681. header.dsigOffset = ttc.getInt32() >>> 0;
  24682. return header;
  24683. }
  24684. throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
  24685. }
  24686. function readTrueTypeCollectionData(ttc, fontName) {
  24687. const {
  24688. numFonts,
  24689. offsetTable
  24690. } = readTrueTypeCollectionHeader(ttc);
  24691. const fontNameParts = fontName.split("+");
  24692. let fallbackData;
  24693. for (let i = 0; i < numFonts; i++) {
  24694. ttc.pos = (ttc.start || 0) + offsetTable[i];
  24695. const potentialHeader = readOpenTypeHeader(ttc);
  24696. const potentialTables = readTables(ttc, potentialHeader.numTables);
  24697. if (!potentialTables.name) {
  24698. throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
  24699. }
  24700. const [nameTable] = readNameTable(potentialTables.name);
  24701. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  24702. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  24703. const nameEntry = nameTable[j][k] && nameTable[j][k].replace(/\s/g, "");
  24704. if (!nameEntry) {
  24705. continue;
  24706. }
  24707. if (nameEntry === fontName) {
  24708. return {
  24709. header: potentialHeader,
  24710. tables: potentialTables
  24711. };
  24712. }
  24713. if (fontNameParts.length < 2) {
  24714. continue;
  24715. }
  24716. for (const part of fontNameParts) {
  24717. if (nameEntry === part) {
  24718. fallbackData = {
  24719. name: part,
  24720. header: potentialHeader,
  24721. tables: potentialTables
  24722. };
  24723. }
  24724. }
  24725. }
  24726. }
  24727. }
  24728. if (fallbackData) {
  24729. (0, _util.warn)(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`);
  24730. return {
  24731. header: fallbackData.header,
  24732. tables: fallbackData.tables
  24733. };
  24734. }
  24735. throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`);
  24736. }
  24737. function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
  24738. if (!cmap) {
  24739. (0, _util.warn)("No cmap table available.");
  24740. return {
  24741. platformId: -1,
  24742. encodingId: -1,
  24743. mappings: [],
  24744. hasShortCmap: false
  24745. };
  24746. }
  24747. let segment;
  24748. let start = (file.start || 0) + cmap.offset;
  24749. file.pos = start;
  24750. file.skip(2);
  24751. const numTables = file.getUint16();
  24752. let potentialTable;
  24753. let canBreak = false;
  24754. for (let i = 0; i < numTables; i++) {
  24755. const platformId = file.getUint16();
  24756. const encodingId = file.getUint16();
  24757. const offset = file.getInt32() >>> 0;
  24758. let useTable = false;
  24759. if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) {
  24760. continue;
  24761. }
  24762. if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
  24763. useTable = true;
  24764. } else if (platformId === 1 && encodingId === 0) {
  24765. useTable = true;
  24766. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  24767. useTable = true;
  24768. if (!isSymbolicFont) {
  24769. canBreak = true;
  24770. }
  24771. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  24772. useTable = true;
  24773. let correctlySorted = true;
  24774. if (i < numTables - 1) {
  24775. const nextBytes = file.peekBytes(2),
  24776. nextPlatformId = int16(nextBytes[0], nextBytes[1]);
  24777. if (nextPlatformId < platformId) {
  24778. correctlySorted = false;
  24779. }
  24780. }
  24781. if (correctlySorted) {
  24782. canBreak = true;
  24783. }
  24784. }
  24785. if (useTable) {
  24786. potentialTable = {
  24787. platformId,
  24788. encodingId,
  24789. offset
  24790. };
  24791. }
  24792. if (canBreak) {
  24793. break;
  24794. }
  24795. }
  24796. if (potentialTable) {
  24797. file.pos = start + potentialTable.offset;
  24798. }
  24799. if (!potentialTable || file.peekByte() === -1) {
  24800. (0, _util.warn)("Could not find a preferred cmap table.");
  24801. return {
  24802. platformId: -1,
  24803. encodingId: -1,
  24804. mappings: [],
  24805. hasShortCmap: false
  24806. };
  24807. }
  24808. const format = file.getUint16();
  24809. let hasShortCmap = false;
  24810. const mappings = [];
  24811. let j, glyphId;
  24812. if (format === 0) {
  24813. file.skip(2 + 2);
  24814. for (j = 0; j < 256; j++) {
  24815. const index = file.getByte();
  24816. if (!index) {
  24817. continue;
  24818. }
  24819. mappings.push({
  24820. charCode: j,
  24821. glyphId: index
  24822. });
  24823. }
  24824. hasShortCmap = true;
  24825. } else if (format === 2) {
  24826. file.skip(2 + 2);
  24827. const subHeaderKeys = [];
  24828. let maxSubHeaderKey = 0;
  24829. for (let i = 0; i < 256; i++) {
  24830. const subHeaderKey = file.getUint16() >> 3;
  24831. subHeaderKeys.push(subHeaderKey);
  24832. maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey);
  24833. }
  24834. const subHeaders = [];
  24835. for (let i = 0; i <= maxSubHeaderKey; i++) {
  24836. subHeaders.push({
  24837. firstCode: file.getUint16(),
  24838. entryCount: file.getUint16(),
  24839. idDelta: signedInt16(file.getByte(), file.getByte()),
  24840. idRangePos: file.pos + file.getUint16()
  24841. });
  24842. }
  24843. for (let i = 0; i < 256; i++) {
  24844. if (subHeaderKeys[i] === 0) {
  24845. file.pos = subHeaders[0].idRangePos + 2 * i;
  24846. glyphId = file.getUint16();
  24847. mappings.push({
  24848. charCode: i,
  24849. glyphId
  24850. });
  24851. } else {
  24852. const s = subHeaders[subHeaderKeys[i]];
  24853. for (j = 0; j < s.entryCount; j++) {
  24854. const charCode = (i << 8) + j + s.firstCode;
  24855. file.pos = s.idRangePos + 2 * j;
  24856. glyphId = file.getUint16();
  24857. if (glyphId !== 0) {
  24858. glyphId = (glyphId + s.idDelta) % 65536;
  24859. }
  24860. mappings.push({
  24861. charCode,
  24862. glyphId
  24863. });
  24864. }
  24865. }
  24866. }
  24867. } else if (format === 4) {
  24868. file.skip(2 + 2);
  24869. const segCount = file.getUint16() >> 1;
  24870. file.skip(6);
  24871. const segments = [];
  24872. let segIndex;
  24873. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24874. segments.push({
  24875. end: file.getUint16()
  24876. });
  24877. }
  24878. file.skip(2);
  24879. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24880. segments[segIndex].start = file.getUint16();
  24881. }
  24882. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24883. segments[segIndex].delta = file.getUint16();
  24884. }
  24885. let offsetsCount = 0,
  24886. offsetIndex;
  24887. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24888. segment = segments[segIndex];
  24889. const rangeOffset = file.getUint16();
  24890. if (!rangeOffset) {
  24891. segment.offsetIndex = -1;
  24892. continue;
  24893. }
  24894. offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  24895. segment.offsetIndex = offsetIndex;
  24896. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  24897. }
  24898. const offsets = [];
  24899. for (j = 0; j < offsetsCount; j++) {
  24900. offsets.push(file.getUint16());
  24901. }
  24902. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24903. segment = segments[segIndex];
  24904. start = segment.start;
  24905. const end = segment.end;
  24906. const delta = segment.delta;
  24907. offsetIndex = segment.offsetIndex;
  24908. for (j = start; j <= end; j++) {
  24909. if (j === 0xffff) {
  24910. continue;
  24911. }
  24912. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  24913. glyphId = glyphId + delta & 0xffff;
  24914. mappings.push({
  24915. charCode: j,
  24916. glyphId
  24917. });
  24918. }
  24919. }
  24920. } else if (format === 6) {
  24921. file.skip(2 + 2);
  24922. const firstCode = file.getUint16();
  24923. const entryCount = file.getUint16();
  24924. for (j = 0; j < entryCount; j++) {
  24925. glyphId = file.getUint16();
  24926. const charCode = firstCode + j;
  24927. mappings.push({
  24928. charCode,
  24929. glyphId
  24930. });
  24931. }
  24932. } else if (format === 12) {
  24933. file.skip(2 + 4 + 4);
  24934. const nGroups = file.getInt32() >>> 0;
  24935. for (j = 0; j < nGroups; j++) {
  24936. const startCharCode = file.getInt32() >>> 0;
  24937. const endCharCode = file.getInt32() >>> 0;
  24938. let glyphCode = file.getInt32() >>> 0;
  24939. for (let charCode = startCharCode; charCode <= endCharCode; charCode++) {
  24940. mappings.push({
  24941. charCode,
  24942. glyphId: glyphCode++
  24943. });
  24944. }
  24945. }
  24946. } else {
  24947. (0, _util.warn)("cmap table has unsupported format: " + format);
  24948. return {
  24949. platformId: -1,
  24950. encodingId: -1,
  24951. mappings: [],
  24952. hasShortCmap: false
  24953. };
  24954. }
  24955. mappings.sort(function (a, b) {
  24956. return a.charCode - b.charCode;
  24957. });
  24958. for (let i = 1; i < mappings.length; i++) {
  24959. if (mappings[i - 1].charCode === mappings[i].charCode) {
  24960. mappings.splice(i, 1);
  24961. i--;
  24962. }
  24963. }
  24964. return {
  24965. platformId: potentialTable.platformId,
  24966. encodingId: potentialTable.encodingId,
  24967. mappings,
  24968. hasShortCmap
  24969. };
  24970. }
  24971. function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) {
  24972. if (!header) {
  24973. if (metrics) {
  24974. metrics.data = null;
  24975. }
  24976. return;
  24977. }
  24978. file.pos = (file.start || 0) + header.offset;
  24979. file.pos += 4;
  24980. file.pos += 2;
  24981. file.pos += 2;
  24982. file.pos += 2;
  24983. file.pos += 2;
  24984. file.pos += 2;
  24985. file.pos += 2;
  24986. file.pos += 2;
  24987. file.pos += 2;
  24988. file.pos += 2;
  24989. const caretOffset = file.getUint16();
  24990. file.pos += 8;
  24991. file.pos += 2;
  24992. let numOfMetrics = file.getUint16();
  24993. if (caretOffset !== 0) {
  24994. const macStyle = int16(headTable.data[44], headTable.data[45]);
  24995. if (!(macStyle & 2)) {
  24996. header.data[22] = 0;
  24997. header.data[23] = 0;
  24998. }
  24999. }
  25000. if (numOfMetrics > numGlyphs) {
  25001. (0, _util.info)(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`);
  25002. numOfMetrics = numGlyphs;
  25003. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  25004. header.data[35] = numOfMetrics & 0x00ff;
  25005. }
  25006. const numOfSidebearings = numGlyphs - numOfMetrics;
  25007. const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  25008. if (numMissing > 0) {
  25009. const entries = new Uint8Array(metrics.length + numMissing * 2);
  25010. entries.set(metrics.data);
  25011. if (dupFirstEntry) {
  25012. entries[metrics.length] = metrics.data[2];
  25013. entries[metrics.length + 1] = metrics.data[3];
  25014. }
  25015. metrics.data = entries;
  25016. }
  25017. }
  25018. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  25019. const glyphProfile = {
  25020. length: 0,
  25021. sizeOfInstructions: 0
  25022. };
  25023. if (sourceEnd - sourceStart <= 12) {
  25024. return glyphProfile;
  25025. }
  25026. const glyf = source.subarray(sourceStart, sourceEnd);
  25027. let contoursCount = signedInt16(glyf[0], glyf[1]);
  25028. if (contoursCount < 0) {
  25029. contoursCount = -1;
  25030. writeSignedInt16(glyf, 0, contoursCount);
  25031. dest.set(glyf, destStart);
  25032. glyphProfile.length = glyf.length;
  25033. return glyphProfile;
  25034. }
  25035. let i,
  25036. j = 10,
  25037. flagsCount = 0;
  25038. for (i = 0; i < contoursCount; i++) {
  25039. const endPoint = glyf[j] << 8 | glyf[j + 1];
  25040. flagsCount = endPoint + 1;
  25041. j += 2;
  25042. }
  25043. const instructionsStart = j;
  25044. const instructionsLength = glyf[j] << 8 | glyf[j + 1];
  25045. glyphProfile.sizeOfInstructions = instructionsLength;
  25046. j += 2 + instructionsLength;
  25047. const instructionsEnd = j;
  25048. let coordinatesLength = 0;
  25049. for (i = 0; i < flagsCount; i++) {
  25050. const flag = glyf[j++];
  25051. if (flag & 0xc0) {
  25052. glyf[j - 1] = flag & 0x3f;
  25053. }
  25054. let xLength = 2;
  25055. if (flag & 2) {
  25056. xLength = 1;
  25057. } else if (flag & 16) {
  25058. xLength = 0;
  25059. }
  25060. let yLength = 2;
  25061. if (flag & 4) {
  25062. yLength = 1;
  25063. } else if (flag & 32) {
  25064. yLength = 0;
  25065. }
  25066. const xyLength = xLength + yLength;
  25067. coordinatesLength += xyLength;
  25068. if (flag & 8) {
  25069. const repeat = glyf[j++];
  25070. i += repeat;
  25071. coordinatesLength += repeat * xyLength;
  25072. }
  25073. }
  25074. if (coordinatesLength === 0) {
  25075. return glyphProfile;
  25076. }
  25077. let glyphDataLength = j + coordinatesLength;
  25078. if (glyphDataLength > glyf.length) {
  25079. return glyphProfile;
  25080. }
  25081. if (!hintsValid && instructionsLength > 0) {
  25082. dest.set(glyf.subarray(0, instructionsStart), destStart);
  25083. dest.set([0, 0], destStart + instructionsStart);
  25084. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  25085. glyphDataLength -= instructionsLength;
  25086. if (glyf.length - glyphDataLength > 3) {
  25087. glyphDataLength = glyphDataLength + 3 & ~3;
  25088. }
  25089. glyphProfile.length = glyphDataLength;
  25090. return glyphProfile;
  25091. }
  25092. if (glyf.length - glyphDataLength > 3) {
  25093. glyphDataLength = glyphDataLength + 3 & ~3;
  25094. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  25095. glyphProfile.length = glyphDataLength;
  25096. return glyphProfile;
  25097. }
  25098. dest.set(glyf, destStart);
  25099. glyphProfile.length = glyf.length;
  25100. return glyphProfile;
  25101. }
  25102. function sanitizeHead(head, numGlyphs, locaLength) {
  25103. const data = head.data;
  25104. const version = int32(data[0], data[1], data[2], data[3]);
  25105. if (version >> 16 !== 1) {
  25106. (0, _util.info)("Attempting to fix invalid version in head table: " + version);
  25107. data[0] = 0;
  25108. data[1] = 1;
  25109. data[2] = 0;
  25110. data[3] = 0;
  25111. }
  25112. const indexToLocFormat = int16(data[50], data[51]);
  25113. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  25114. (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
  25115. const numGlyphsPlusOne = numGlyphs + 1;
  25116. if (locaLength === numGlyphsPlusOne << 1) {
  25117. data[50] = 0;
  25118. data[51] = 0;
  25119. } else if (locaLength === numGlyphsPlusOne << 2) {
  25120. data[50] = 0;
  25121. data[51] = 1;
  25122. } else {
  25123. throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
  25124. }
  25125. }
  25126. }
  25127. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
  25128. let itemSize, itemDecode, itemEncode;
  25129. if (isGlyphLocationsLong) {
  25130. itemSize = 4;
  25131. itemDecode = function fontItemDecodeLong(data, offset) {
  25132. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  25133. };
  25134. itemEncode = function fontItemEncodeLong(data, offset, value) {
  25135. data[offset] = value >>> 24 & 0xff;
  25136. data[offset + 1] = value >> 16 & 0xff;
  25137. data[offset + 2] = value >> 8 & 0xff;
  25138. data[offset + 3] = value & 0xff;
  25139. };
  25140. } else {
  25141. itemSize = 2;
  25142. itemDecode = function fontItemDecode(data, offset) {
  25143. return data[offset] << 9 | data[offset + 1] << 1;
  25144. };
  25145. itemEncode = function fontItemEncode(data, offset, value) {
  25146. data[offset] = value >> 9 & 0xff;
  25147. data[offset + 1] = value >> 1 & 0xff;
  25148. };
  25149. }
  25150. const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  25151. const locaDataSize = itemSize * (1 + numGlyphsOut);
  25152. const locaData = new Uint8Array(locaDataSize);
  25153. locaData.set(loca.data.subarray(0, locaDataSize));
  25154. loca.data = locaData;
  25155. const oldGlyfData = glyf.data;
  25156. const oldGlyfDataLength = oldGlyfData.length;
  25157. const newGlyfData = new Uint8Array(oldGlyfDataLength);
  25158. let i, j;
  25159. const locaEntries = [];
  25160. for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
  25161. let offset = itemDecode(locaData, j);
  25162. if (offset > oldGlyfDataLength) {
  25163. offset = oldGlyfDataLength;
  25164. }
  25165. locaEntries.push({
  25166. index: i,
  25167. offset,
  25168. endOffset: 0
  25169. });
  25170. }
  25171. locaEntries.sort((a, b) => {
  25172. return a.offset - b.offset;
  25173. });
  25174. for (i = 0; i < numGlyphs; i++) {
  25175. locaEntries[i].endOffset = locaEntries[i + 1].offset;
  25176. }
  25177. locaEntries.sort((a, b) => {
  25178. return a.index - b.index;
  25179. });
  25180. for (i = 0; i < numGlyphs; i++) {
  25181. const {
  25182. offset,
  25183. endOffset
  25184. } = locaEntries[i];
  25185. if (offset !== 0 || endOffset !== 0) {
  25186. break;
  25187. }
  25188. const nextOffset = locaEntries[i + 1].offset;
  25189. if (nextOffset === 0) {
  25190. continue;
  25191. }
  25192. locaEntries[i].endOffset = nextOffset;
  25193. break;
  25194. }
  25195. const missingGlyphs = Object.create(null);
  25196. let writeOffset = 0;
  25197. itemEncode(locaData, 0, writeOffset);
  25198. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  25199. const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
  25200. const newLength = glyphProfile.length;
  25201. if (newLength === 0) {
  25202. missingGlyphs[i] = true;
  25203. }
  25204. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  25205. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  25206. }
  25207. writeOffset += newLength;
  25208. itemEncode(locaData, j, writeOffset);
  25209. }
  25210. if (writeOffset === 0) {
  25211. const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  25212. for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
  25213. itemEncode(locaData, j, simpleGlyph.length);
  25214. }
  25215. glyf.data = simpleGlyph;
  25216. } else if (dupFirstEntry) {
  25217. const firstEntryLength = itemDecode(locaData, itemSize);
  25218. if (newGlyfData.length > firstEntryLength + writeOffset) {
  25219. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  25220. } else {
  25221. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  25222. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  25223. }
  25224. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  25225. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  25226. } else {
  25227. glyf.data = newGlyfData.subarray(0, writeOffset);
  25228. }
  25229. return {
  25230. missingGlyphs,
  25231. maxSizeOfInstructions
  25232. };
  25233. }
  25234. function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
  25235. const start = (font.start || 0) + post.offset;
  25236. font.pos = start;
  25237. const length = post.length,
  25238. end = start + length;
  25239. const version = font.getInt32();
  25240. font.skip(28);
  25241. let glyphNames;
  25242. let valid = true;
  25243. let i;
  25244. switch (version) {
  25245. case 0x00010000:
  25246. glyphNames = _fonts_utils.MacStandardGlyphOrdering;
  25247. break;
  25248. case 0x00020000:
  25249. const numGlyphs = font.getUint16();
  25250. if (numGlyphs !== maxpNumGlyphs) {
  25251. valid = false;
  25252. break;
  25253. }
  25254. const glyphNameIndexes = [];
  25255. for (i = 0; i < numGlyphs; ++i) {
  25256. const index = font.getUint16();
  25257. if (index >= 32768) {
  25258. valid = false;
  25259. break;
  25260. }
  25261. glyphNameIndexes.push(index);
  25262. }
  25263. if (!valid) {
  25264. break;
  25265. }
  25266. const customNames = [],
  25267. strBuf = [];
  25268. while (font.pos < end) {
  25269. const stringLength = font.getByte();
  25270. strBuf.length = stringLength;
  25271. for (i = 0; i < stringLength; ++i) {
  25272. strBuf[i] = String.fromCharCode(font.getByte());
  25273. }
  25274. customNames.push(strBuf.join(""));
  25275. }
  25276. glyphNames = [];
  25277. for (i = 0; i < numGlyphs; ++i) {
  25278. const j = glyphNameIndexes[i];
  25279. if (j < 258) {
  25280. glyphNames.push(_fonts_utils.MacStandardGlyphOrdering[j]);
  25281. continue;
  25282. }
  25283. glyphNames.push(customNames[j - 258]);
  25284. }
  25285. break;
  25286. case 0x00030000:
  25287. break;
  25288. default:
  25289. (0, _util.warn)("Unknown/unsupported post table version " + version);
  25290. valid = false;
  25291. if (propertiesObj.defaultEncoding) {
  25292. glyphNames = propertiesObj.defaultEncoding;
  25293. }
  25294. break;
  25295. }
  25296. propertiesObj.glyphNames = glyphNames;
  25297. return valid;
  25298. }
  25299. function readNameTable(nameTable) {
  25300. const start = (font.start || 0) + nameTable.offset;
  25301. font.pos = start;
  25302. const names = [[], []],
  25303. records = [];
  25304. const length = nameTable.length,
  25305. end = start + length;
  25306. const format = font.getUint16();
  25307. const FORMAT_0_HEADER_LENGTH = 6;
  25308. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  25309. return [names, records];
  25310. }
  25311. const numRecords = font.getUint16();
  25312. const stringsStart = font.getUint16();
  25313. const NAME_RECORD_LENGTH = 12;
  25314. let i, ii;
  25315. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  25316. const r = {
  25317. platform: font.getUint16(),
  25318. encoding: font.getUint16(),
  25319. language: font.getUint16(),
  25320. name: font.getUint16(),
  25321. length: font.getUint16(),
  25322. offset: font.getUint16()
  25323. };
  25324. if (isMacNameRecord(r) || isWinNameRecord(r)) {
  25325. records.push(r);
  25326. }
  25327. }
  25328. for (i = 0, ii = records.length; i < ii; i++) {
  25329. const record = records[i];
  25330. if (record.length <= 0) {
  25331. continue;
  25332. }
  25333. const pos = start + stringsStart + record.offset;
  25334. if (pos + record.length > end) {
  25335. continue;
  25336. }
  25337. font.pos = pos;
  25338. const nameIndex = record.name;
  25339. if (record.encoding) {
  25340. let str = "";
  25341. for (let j = 0, jj = record.length; j < jj; j += 2) {
  25342. str += String.fromCharCode(font.getUint16());
  25343. }
  25344. names[1][nameIndex] = str;
  25345. } else {
  25346. names[0][nameIndex] = font.getString(record.length);
  25347. }
  25348. }
  25349. return [names, records];
  25350. }
  25351. 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];
  25352. function sanitizeTTProgram(table, ttContext) {
  25353. let data = table.data;
  25354. let i = 0,
  25355. j,
  25356. n,
  25357. b,
  25358. funcId,
  25359. pc,
  25360. lastEndf = 0,
  25361. lastDeff = 0;
  25362. const stack = [];
  25363. const callstack = [];
  25364. const functionsCalled = [];
  25365. let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  25366. let inFDEF = false,
  25367. ifLevel = 0,
  25368. inELSE = 0;
  25369. for (let ii = data.length; i < ii;) {
  25370. const op = data[i++];
  25371. if (op === 0x40) {
  25372. n = data[i++];
  25373. if (inFDEF || inELSE) {
  25374. i += n;
  25375. } else {
  25376. for (j = 0; j < n; j++) {
  25377. stack.push(data[i++]);
  25378. }
  25379. }
  25380. } else if (op === 0x41) {
  25381. n = data[i++];
  25382. if (inFDEF || inELSE) {
  25383. i += n * 2;
  25384. } else {
  25385. for (j = 0; j < n; j++) {
  25386. b = data[i++];
  25387. stack.push(b << 8 | data[i++]);
  25388. }
  25389. }
  25390. } else if ((op & 0xf8) === 0xb0) {
  25391. n = op - 0xb0 + 1;
  25392. if (inFDEF || inELSE) {
  25393. i += n;
  25394. } else {
  25395. for (j = 0; j < n; j++) {
  25396. stack.push(data[i++]);
  25397. }
  25398. }
  25399. } else if ((op & 0xf8) === 0xb8) {
  25400. n = op - 0xb8 + 1;
  25401. if (inFDEF || inELSE) {
  25402. i += n * 2;
  25403. } else {
  25404. for (j = 0; j < n; j++) {
  25405. b = data[i++];
  25406. stack.push(b << 8 | data[i++]);
  25407. }
  25408. }
  25409. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  25410. if (!inFDEF && !inELSE) {
  25411. funcId = stack.at(-1);
  25412. if (isNaN(funcId)) {
  25413. (0, _util.info)("TT: CALL empty stack (or invalid entry).");
  25414. } else {
  25415. ttContext.functionsUsed[funcId] = true;
  25416. if (funcId in ttContext.functionsStackDeltas) {
  25417. const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
  25418. if (newStackLength < 0) {
  25419. (0, _util.warn)("TT: CALL invalid functions stack delta.");
  25420. ttContext.hintsValid = false;
  25421. return;
  25422. }
  25423. stack.length = newStackLength;
  25424. } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
  25425. callstack.push({
  25426. data,
  25427. i,
  25428. stackTop: stack.length - 1
  25429. });
  25430. functionsCalled.push(funcId);
  25431. pc = ttContext.functionsDefined[funcId];
  25432. if (!pc) {
  25433. (0, _util.warn)("TT: CALL non-existent function");
  25434. ttContext.hintsValid = false;
  25435. return;
  25436. }
  25437. data = pc.data;
  25438. i = pc.i;
  25439. }
  25440. }
  25441. }
  25442. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  25443. if (inFDEF || inELSE) {
  25444. (0, _util.warn)("TT: nested FDEFs not allowed");
  25445. tooComplexToFollowFunctions = true;
  25446. }
  25447. inFDEF = true;
  25448. lastDeff = i;
  25449. funcId = stack.pop();
  25450. ttContext.functionsDefined[funcId] = {
  25451. data,
  25452. i
  25453. };
  25454. } else if (op === 0x2d) {
  25455. if (inFDEF) {
  25456. inFDEF = false;
  25457. lastEndf = i;
  25458. } else {
  25459. pc = callstack.pop();
  25460. if (!pc) {
  25461. (0, _util.warn)("TT: ENDF bad stack");
  25462. ttContext.hintsValid = false;
  25463. return;
  25464. }
  25465. funcId = functionsCalled.pop();
  25466. data = pc.data;
  25467. i = pc.i;
  25468. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  25469. }
  25470. } else if (op === 0x89) {
  25471. if (inFDEF || inELSE) {
  25472. (0, _util.warn)("TT: nested IDEFs not allowed");
  25473. tooComplexToFollowFunctions = true;
  25474. }
  25475. inFDEF = true;
  25476. lastDeff = i;
  25477. } else if (op === 0x58) {
  25478. ++ifLevel;
  25479. } else if (op === 0x1b) {
  25480. inELSE = ifLevel;
  25481. } else if (op === 0x59) {
  25482. if (inELSE === ifLevel) {
  25483. inELSE = 0;
  25484. }
  25485. --ifLevel;
  25486. } else if (op === 0x1c) {
  25487. if (!inFDEF && !inELSE) {
  25488. const offset = stack.at(-1);
  25489. if (offset > 0) {
  25490. i += offset - 1;
  25491. }
  25492. }
  25493. }
  25494. if (!inFDEF && !inELSE) {
  25495. let stackDelta = 0;
  25496. if (op <= 0x8e) {
  25497. stackDelta = TTOpsStackDeltas[op];
  25498. } else if (op >= 0xc0 && op <= 0xdf) {
  25499. stackDelta = -1;
  25500. } else if (op >= 0xe0) {
  25501. stackDelta = -2;
  25502. }
  25503. if (op >= 0x71 && op <= 0x75) {
  25504. n = stack.pop();
  25505. if (!isNaN(n)) {
  25506. stackDelta = -n * 2;
  25507. }
  25508. }
  25509. while (stackDelta < 0 && stack.length > 0) {
  25510. stack.pop();
  25511. stackDelta++;
  25512. }
  25513. while (stackDelta > 0) {
  25514. stack.push(NaN);
  25515. stackDelta--;
  25516. }
  25517. }
  25518. }
  25519. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  25520. const content = [data];
  25521. if (i > data.length) {
  25522. content.push(new Uint8Array(i - data.length));
  25523. }
  25524. if (lastDeff > lastEndf) {
  25525. (0, _util.warn)("TT: complementing a missing function tail");
  25526. content.push(new Uint8Array([0x22, 0x2d]));
  25527. }
  25528. foldTTTable(table, content);
  25529. }
  25530. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  25531. if (ttContext.tooComplexToFollowFunctions) {
  25532. return;
  25533. }
  25534. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  25535. (0, _util.warn)("TT: more functions defined than expected");
  25536. ttContext.hintsValid = false;
  25537. return;
  25538. }
  25539. for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  25540. if (j > maxFunctionDefs) {
  25541. (0, _util.warn)("TT: invalid function id: " + j);
  25542. ttContext.hintsValid = false;
  25543. return;
  25544. }
  25545. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  25546. (0, _util.warn)("TT: undefined function: " + j);
  25547. ttContext.hintsValid = false;
  25548. return;
  25549. }
  25550. }
  25551. }
  25552. function foldTTTable(table, content) {
  25553. if (content.length > 1) {
  25554. let newLength = 0;
  25555. let j, jj;
  25556. for (j = 0, jj = content.length; j < jj; j++) {
  25557. newLength += content[j].length;
  25558. }
  25559. newLength = newLength + 3 & ~3;
  25560. const result = new Uint8Array(newLength);
  25561. let pos = 0;
  25562. for (j = 0, jj = content.length; j < jj; j++) {
  25563. result.set(content[j], pos);
  25564. pos += content[j].length;
  25565. }
  25566. table.data = result;
  25567. table.length = newLength;
  25568. }
  25569. }
  25570. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  25571. const ttContext = {
  25572. functionsDefined: [],
  25573. functionsUsed: [],
  25574. functionsStackDeltas: [],
  25575. tooComplexToFollowFunctions: false,
  25576. hintsValid: true
  25577. };
  25578. if (fpgm) {
  25579. sanitizeTTProgram(fpgm, ttContext);
  25580. }
  25581. if (prep) {
  25582. sanitizeTTProgram(prep, ttContext);
  25583. }
  25584. if (fpgm) {
  25585. checkInvalidFunctions(ttContext, maxFunctionDefs);
  25586. }
  25587. if (cvt && cvt.length & 1) {
  25588. const cvtData = new Uint8Array(cvt.length + 1);
  25589. cvtData.set(cvt.data);
  25590. cvt.data = cvtData;
  25591. }
  25592. return ttContext.hintsValid;
  25593. }
  25594. font = new _stream.Stream(new Uint8Array(font.getBytes()));
  25595. let header, tables;
  25596. if (isTrueTypeCollectionFile(font)) {
  25597. const ttcData = readTrueTypeCollectionData(font, this.name);
  25598. header = ttcData.header;
  25599. tables = ttcData.tables;
  25600. } else {
  25601. header = readOpenTypeHeader(font);
  25602. tables = readTables(font, header.numTables);
  25603. }
  25604. let cff, cffFile;
  25605. const isTrueType = !tables["CFF "];
  25606. if (!isTrueType) {
  25607. const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
  25608. if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
  25609. cffFile = new _stream.Stream(tables["CFF "].data);
  25610. cff = new _cff_font.CFFFont(cffFile, properties);
  25611. adjustWidths(properties);
  25612. return this.convert(name, cff, properties);
  25613. }
  25614. delete tables.glyf;
  25615. delete tables.loca;
  25616. delete tables.fpgm;
  25617. delete tables.prep;
  25618. delete tables["cvt "];
  25619. this.isOpenType = true;
  25620. } else {
  25621. if (!tables.loca) {
  25622. throw new _util.FormatError('Required "loca" table is not found');
  25623. }
  25624. if (!tables.glyf) {
  25625. (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
  25626. tables.glyf = {
  25627. tag: "glyf",
  25628. data: new Uint8Array(0)
  25629. };
  25630. }
  25631. this.isOpenType = false;
  25632. }
  25633. if (!tables.maxp) {
  25634. throw new _util.FormatError('Required "maxp" table is not found');
  25635. }
  25636. font.pos = (font.start || 0) + tables.maxp.offset;
  25637. const version = font.getInt32();
  25638. const numGlyphs = font.getUint16();
  25639. if (properties.scaleFactors && properties.scaleFactors.length === numGlyphs && isTrueType) {
  25640. const {
  25641. scaleFactors
  25642. } = properties;
  25643. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  25644. const glyphs = new _glyf.GlyfTable({
  25645. glyfTable: tables.glyf.data,
  25646. isGlyphLocationsLong,
  25647. locaTable: tables.loca.data,
  25648. numGlyphs
  25649. });
  25650. glyphs.scale(scaleFactors);
  25651. const {
  25652. glyf,
  25653. loca,
  25654. isLocationLong
  25655. } = glyphs.write();
  25656. tables.glyf.data = glyf;
  25657. tables.loca.data = loca;
  25658. if (isLocationLong !== !!isGlyphLocationsLong) {
  25659. tables.head.data[50] = 0;
  25660. tables.head.data[51] = isLocationLong ? 1 : 0;
  25661. }
  25662. const metrics = tables.hmtx.data;
  25663. for (let i = 0; i < numGlyphs; i++) {
  25664. const j = 4 * i;
  25665. const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1]));
  25666. metrics[j] = advanceWidth >> 8 & 0xff;
  25667. metrics[j + 1] = advanceWidth & 0xff;
  25668. const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3]));
  25669. writeSignedInt16(metrics, j + 2, lsb);
  25670. }
  25671. }
  25672. let numGlyphsOut = numGlyphs + 1;
  25673. let dupFirstEntry = true;
  25674. if (numGlyphsOut > 0xffff) {
  25675. dupFirstEntry = false;
  25676. numGlyphsOut = numGlyphs;
  25677. (0, _util.warn)("Not enough space in glyfs to duplicate first glyph.");
  25678. }
  25679. let maxFunctionDefs = 0;
  25680. let maxSizeOfInstructions = 0;
  25681. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  25682. font.pos += 8;
  25683. const maxZones = font.getUint16();
  25684. if (maxZones > 2) {
  25685. tables.maxp.data[14] = 0;
  25686. tables.maxp.data[15] = 2;
  25687. }
  25688. font.pos += 4;
  25689. maxFunctionDefs = font.getUint16();
  25690. font.pos += 4;
  25691. maxSizeOfInstructions = font.getUint16();
  25692. }
  25693. tables.maxp.data[4] = numGlyphsOut >> 8;
  25694. tables.maxp.data[5] = numGlyphsOut & 255;
  25695. const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
  25696. if (!hintsValid) {
  25697. delete tables.fpgm;
  25698. delete tables.prep;
  25699. delete tables["cvt "];
  25700. }
  25701. sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry);
  25702. if (!tables.head) {
  25703. throw new _util.FormatError('Required "head" table is not found');
  25704. }
  25705. sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
  25706. let missingGlyphs = Object.create(null);
  25707. if (isTrueType) {
  25708. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  25709. const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
  25710. missingGlyphs = glyphsInfo.missingGlyphs;
  25711. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  25712. tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  25713. tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  25714. }
  25715. }
  25716. if (!tables.hhea) {
  25717. throw new _util.FormatError('Required "hhea" table is not found');
  25718. }
  25719. if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
  25720. tables.hhea.data[10] = 0xff;
  25721. tables.hhea.data[11] = 0xff;
  25722. }
  25723. const metricsOverride = {
  25724. unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
  25725. yMax: int16(tables.head.data[42], tables.head.data[43]),
  25726. yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
  25727. ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]),
  25728. descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]),
  25729. lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9])
  25730. };
  25731. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  25732. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  25733. this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm;
  25734. if (this.cssFontInfo && this.cssFontInfo.lineHeight) {
  25735. this.lineHeight = this.cssFontInfo.metrics.lineHeight;
  25736. this.lineGap = this.cssFontInfo.metrics.lineGap;
  25737. } else {
  25738. this.lineHeight = this.ascent - this.descent + this.lineGap;
  25739. }
  25740. if (tables.post) {
  25741. readPostScriptTable(tables.post, properties, numGlyphs);
  25742. }
  25743. tables.post = {
  25744. tag: "post",
  25745. data: createPostTable(properties)
  25746. };
  25747. const charCodeToGlyphId = [];
  25748. function hasGlyph(glyphId) {
  25749. return !missingGlyphs[glyphId];
  25750. }
  25751. if (properties.composite) {
  25752. const cidToGidMap = properties.cidToGidMap || [];
  25753. const isCidToGidMapEmpty = cidToGidMap.length === 0;
  25754. properties.cMap.forEach(function (charCode, cid) {
  25755. if (typeof cid === "string") {
  25756. cid = convertCidString(charCode, cid, true);
  25757. }
  25758. if (cid > 0xffff) {
  25759. throw new _util.FormatError("Max size of CID is 65,535");
  25760. }
  25761. let glyphId = -1;
  25762. if (isCidToGidMapEmpty) {
  25763. glyphId = cid;
  25764. } else if (cidToGidMap[cid] !== undefined) {
  25765. glyphId = cidToGidMap[cid];
  25766. }
  25767. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  25768. charCodeToGlyphId[charCode] = glyphId;
  25769. }
  25770. });
  25771. } else {
  25772. const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
  25773. const cmapPlatformId = cmapTable.platformId;
  25774. const cmapEncodingId = cmapTable.encodingId;
  25775. const cmapMappings = cmapTable.mappings;
  25776. let baseEncoding = [],
  25777. forcePostTable = false;
  25778. if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) {
  25779. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  25780. }
  25781. if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) {
  25782. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  25783. for (let charCode = 0; charCode < 256; charCode++) {
  25784. let glyphName;
  25785. if (this.differences[charCode] !== undefined) {
  25786. glyphName = this.differences[charCode];
  25787. } else if (baseEncoding.length && baseEncoding[charCode] !== "") {
  25788. glyphName = baseEncoding[charCode];
  25789. } else {
  25790. glyphName = _encodings.StandardEncoding[charCode];
  25791. }
  25792. if (!glyphName) {
  25793. continue;
  25794. }
  25795. const standardGlyphName = (0, _fonts_utils.recoverGlyphName)(glyphName, glyphsUnicodeMap);
  25796. let unicodeOrCharCode;
  25797. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  25798. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  25799. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  25800. unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
  25801. }
  25802. if (unicodeOrCharCode === undefined) {
  25803. if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  25804. const unicode = this.toUnicode.get(charCode);
  25805. if (unicode) {
  25806. unicodeOrCharCode = unicode.codePointAt(0);
  25807. }
  25808. }
  25809. if (unicodeOrCharCode === undefined) {
  25810. continue;
  25811. }
  25812. }
  25813. for (const mapping of cmapMappings) {
  25814. if (mapping.charCode !== unicodeOrCharCode) {
  25815. continue;
  25816. }
  25817. charCodeToGlyphId[charCode] = mapping.glyphId;
  25818. break;
  25819. }
  25820. }
  25821. } else if (cmapPlatformId === 0) {
  25822. for (const mapping of cmapMappings) {
  25823. charCodeToGlyphId[mapping.charCode] = mapping.glyphId;
  25824. }
  25825. forcePostTable = true;
  25826. } else {
  25827. for (const mapping of cmapMappings) {
  25828. let charCode = mapping.charCode;
  25829. if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) {
  25830. charCode &= 0xff;
  25831. }
  25832. charCodeToGlyphId[charCode] = mapping.glyphId;
  25833. }
  25834. }
  25835. if (properties.glyphNames && (baseEncoding.length || this.differences.length)) {
  25836. for (let i = 0; i < 256; ++i) {
  25837. if (!forcePostTable && charCodeToGlyphId[i] !== undefined) {
  25838. continue;
  25839. }
  25840. const glyphName = this.differences[i] || baseEncoding[i];
  25841. if (!glyphName) {
  25842. continue;
  25843. }
  25844. const glyphId = properties.glyphNames.indexOf(glyphName);
  25845. if (glyphId > 0 && hasGlyph(glyphId)) {
  25846. charCodeToGlyphId[i] = glyphId;
  25847. }
  25848. }
  25849. }
  25850. }
  25851. if (charCodeToGlyphId.length === 0) {
  25852. charCodeToGlyphId[0] = 0;
  25853. }
  25854. let glyphZeroId = numGlyphsOut - 1;
  25855. if (!dupFirstEntry) {
  25856. glyphZeroId = 0;
  25857. }
  25858. if (!properties.cssFontInfo) {
  25859. const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId, this.toUnicode);
  25860. this.toFontChar = newMapping.toFontChar;
  25861. tables.cmap = {
  25862. tag: "cmap",
  25863. data: createCmapTable(newMapping.charCodeToGlyphId, newMapping.toUnicodeExtraMap, numGlyphsOut)
  25864. };
  25865. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
  25866. tables["OS/2"] = {
  25867. tag: "OS/2",
  25868. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  25869. };
  25870. }
  25871. }
  25872. if (!isTrueType) {
  25873. try {
  25874. cffFile = new _stream.Stream(tables["CFF "].data);
  25875. const parser = new _cff_parser.CFFParser(cffFile, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  25876. cff = parser.parse();
  25877. cff.duplicateFirstGlyph();
  25878. const compiler = new _cff_parser.CFFCompiler(cff);
  25879. tables["CFF "].data = compiler.compile();
  25880. } catch (e) {
  25881. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  25882. }
  25883. }
  25884. if (!tables.name) {
  25885. tables.name = {
  25886. tag: "name",
  25887. data: createNameTable(this.name)
  25888. };
  25889. } else {
  25890. const [namePrototype, nameRecords] = readNameTable(tables.name);
  25891. tables.name.data = createNameTable(name, namePrototype);
  25892. this.psName = namePrototype[0][6] || null;
  25893. if (!properties.composite) {
  25894. adjustTrueTypeToUnicode(properties, this.isSymbolicFont, nameRecords);
  25895. }
  25896. }
  25897. const builder = new _opentype_file_builder.OpenTypeFileBuilder(header.version);
  25898. for (const tableTag in tables) {
  25899. builder.addTable(tableTag, tables[tableTag].data);
  25900. }
  25901. return builder.toArray();
  25902. }
  25903. convert(fontName, font, properties) {
  25904. properties.fixedPitch = false;
  25905. if (properties.builtInEncoding) {
  25906. adjustType1ToUnicode(properties, properties.builtInEncoding);
  25907. }
  25908. let glyphZeroId = 1;
  25909. if (font instanceof _cff_font.CFFFont) {
  25910. glyphZeroId = font.numGlyphs - 1;
  25911. }
  25912. const mapping = font.getGlyphMapping(properties);
  25913. let newMapping = null;
  25914. let newCharCodeToGlyphId = mapping;
  25915. let toUnicodeExtraMap = null;
  25916. if (!properties.cssFontInfo) {
  25917. newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId, this.toUnicode);
  25918. this.toFontChar = newMapping.toFontChar;
  25919. newCharCodeToGlyphId = newMapping.charCodeToGlyphId;
  25920. toUnicodeExtraMap = newMapping.toUnicodeExtraMap;
  25921. }
  25922. const numGlyphs = font.numGlyphs;
  25923. function getCharCodes(charCodeToGlyphId, glyphId) {
  25924. let charCodes = null;
  25925. for (const charCode in charCodeToGlyphId) {
  25926. if (glyphId === charCodeToGlyphId[charCode]) {
  25927. if (!charCodes) {
  25928. charCodes = [];
  25929. }
  25930. charCodes.push(charCode | 0);
  25931. }
  25932. }
  25933. return charCodes;
  25934. }
  25935. function createCharCode(charCodeToGlyphId, glyphId) {
  25936. for (const charCode in charCodeToGlyphId) {
  25937. if (glyphId === charCodeToGlyphId[charCode]) {
  25938. return charCode | 0;
  25939. }
  25940. }
  25941. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  25942. return newMapping.nextAvailableFontCharCode++;
  25943. }
  25944. const seacs = font.seacs;
  25945. if (newMapping && _fonts_utils.SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  25946. const matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  25947. const charset = font.getCharset();
  25948. const seacMap = Object.create(null);
  25949. for (let glyphId in seacs) {
  25950. glyphId |= 0;
  25951. const seac = seacs[glyphId];
  25952. const baseGlyphName = _encodings.StandardEncoding[seac[2]];
  25953. const accentGlyphName = _encodings.StandardEncoding[seac[3]];
  25954. const baseGlyphId = charset.indexOf(baseGlyphName);
  25955. const accentGlyphId = charset.indexOf(accentGlyphName);
  25956. if (baseGlyphId < 0 || accentGlyphId < 0) {
  25957. continue;
  25958. }
  25959. const accentOffset = {
  25960. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  25961. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  25962. };
  25963. const charCodes = getCharCodes(mapping, glyphId);
  25964. if (!charCodes) {
  25965. continue;
  25966. }
  25967. for (const charCode of charCodes) {
  25968. const charCodeToGlyphId = newMapping.charCodeToGlyphId;
  25969. const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  25970. const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  25971. seacMap[charCode] = {
  25972. baseFontCharCode,
  25973. accentFontCharCode,
  25974. accentOffset
  25975. };
  25976. }
  25977. }
  25978. properties.seacMap = seacMap;
  25979. }
  25980. const unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  25981. const builder = new _opentype_file_builder.OpenTypeFileBuilder("\x4F\x54\x54\x4F");
  25982. builder.addTable("CFF ", font.data);
  25983. builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId));
  25984. builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, toUnicodeExtraMap, numGlyphs));
  25985. 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");
  25986. 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));
  25987. builder.addTable("hmtx", function fontFieldsHmtx() {
  25988. const charstrings = font.charstrings;
  25989. const cffWidths = font.cff ? font.cff.widths : null;
  25990. let hmtx = "\x00\x00\x00\x00";
  25991. for (let i = 1, ii = numGlyphs; i < ii; i++) {
  25992. let width = 0;
  25993. if (charstrings) {
  25994. const charstring = charstrings[i - 1];
  25995. width = "width" in charstring ? charstring.width : 0;
  25996. } else if (cffWidths) {
  25997. width = Math.ceil(cffWidths[i] || 0);
  25998. }
  25999. hmtx += string16(width) + string16(0);
  26000. }
  26001. return hmtx;
  26002. }());
  26003. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  26004. builder.addTable("name", createNameTable(fontName));
  26005. builder.addTable("post", createPostTable(properties));
  26006. return builder.toArray();
  26007. }
  26008. get spaceWidth() {
  26009. const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
  26010. let width;
  26011. for (const glyphName of possibleSpaceReplacements) {
  26012. if (glyphName in this.widths) {
  26013. width = this.widths[glyphName];
  26014. break;
  26015. }
  26016. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  26017. const glyphUnicode = glyphsUnicodeMap[glyphName];
  26018. let charcode = 0;
  26019. if (this.composite && this.cMap.contains(glyphUnicode)) {
  26020. charcode = this.cMap.lookup(glyphUnicode);
  26021. if (typeof charcode === "string") {
  26022. charcode = convertCidString(glyphUnicode, charcode);
  26023. }
  26024. }
  26025. if (!charcode && this.toUnicode) {
  26026. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  26027. }
  26028. if (charcode <= 0) {
  26029. charcode = glyphUnicode;
  26030. }
  26031. width = this.widths[charcode];
  26032. if (width) {
  26033. break;
  26034. }
  26035. }
  26036. width = width || this.defaultWidth;
  26037. return (0, _util.shadow)(this, "spaceWidth", width);
  26038. }
  26039. _charToGlyph(charcode) {
  26040. let isSpace = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  26041. let glyph = this._glyphCache[charcode];
  26042. if (glyph && glyph.isSpace === isSpace) {
  26043. return glyph;
  26044. }
  26045. let fontCharCode, width, operatorListId;
  26046. let widthCode = charcode;
  26047. if (this.cMap && this.cMap.contains(charcode)) {
  26048. widthCode = this.cMap.lookup(charcode);
  26049. if (typeof widthCode === "string") {
  26050. widthCode = convertCidString(charcode, widthCode);
  26051. }
  26052. }
  26053. width = this.widths[widthCode];
  26054. if (typeof width !== "number") {
  26055. width = this.defaultWidth;
  26056. }
  26057. const vmetric = this.vmetrics && this.vmetrics[widthCode];
  26058. let unicode = this.toUnicode.get(charcode) || charcode;
  26059. if (typeof unicode === "number") {
  26060. unicode = String.fromCharCode(unicode);
  26061. }
  26062. let isInFont = this.toFontChar[charcode] !== undefined;
  26063. fontCharCode = this.toFontChar[charcode] || charcode;
  26064. if (this.missingFile) {
  26065. const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
  26066. if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
  26067. fontCharCode = 0x20;
  26068. }
  26069. fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
  26070. }
  26071. if (this.isType3Font) {
  26072. operatorListId = fontCharCode;
  26073. }
  26074. let accent = null;
  26075. if (this.seacMap && this.seacMap[charcode]) {
  26076. isInFont = true;
  26077. const seac = this.seacMap[charcode];
  26078. fontCharCode = seac.baseFontCharCode;
  26079. accent = {
  26080. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  26081. offset: seac.accentOffset
  26082. };
  26083. }
  26084. let fontChar = "";
  26085. if (typeof fontCharCode === "number") {
  26086. if (fontCharCode <= 0x10ffff) {
  26087. fontChar = String.fromCodePoint(fontCharCode);
  26088. } else {
  26089. (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
  26090. }
  26091. }
  26092. glyph = new Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  26093. return this._glyphCache[charcode] = glyph;
  26094. }
  26095. charsToGlyphs(chars) {
  26096. let glyphs = this._charsCache[chars];
  26097. if (glyphs) {
  26098. return glyphs;
  26099. }
  26100. glyphs = [];
  26101. if (this.cMap) {
  26102. const c = Object.create(null),
  26103. ii = chars.length;
  26104. let i = 0;
  26105. while (i < ii) {
  26106. this.cMap.readCharCode(chars, i, c);
  26107. const {
  26108. charcode,
  26109. length
  26110. } = c;
  26111. i += length;
  26112. const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20);
  26113. glyphs.push(glyph);
  26114. }
  26115. } else {
  26116. for (let i = 0, ii = chars.length; i < ii; ++i) {
  26117. const charcode = chars.charCodeAt(i);
  26118. const glyph = this._charToGlyph(charcode, charcode === 0x20);
  26119. glyphs.push(glyph);
  26120. }
  26121. }
  26122. return this._charsCache[chars] = glyphs;
  26123. }
  26124. getCharPositions(chars) {
  26125. const positions = [];
  26126. if (this.cMap) {
  26127. const c = Object.create(null);
  26128. let i = 0;
  26129. while (i < chars.length) {
  26130. this.cMap.readCharCode(chars, i, c);
  26131. const length = c.length;
  26132. positions.push([i, i + length]);
  26133. i += length;
  26134. }
  26135. } else {
  26136. for (let i = 0, ii = chars.length; i < ii; ++i) {
  26137. positions.push([i, i + 1]);
  26138. }
  26139. }
  26140. return positions;
  26141. }
  26142. get glyphCacheValues() {
  26143. return Object.values(this._glyphCache);
  26144. }
  26145. encodeString(str) {
  26146. const buffers = [];
  26147. const currentBuf = [];
  26148. const hasCurrentBufErrors = () => buffers.length % 2 === 1;
  26149. const getCharCode = this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode));
  26150. for (let i = 0, ii = str.length; i < ii; i++) {
  26151. const unicode = str.codePointAt(i);
  26152. if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
  26153. i++;
  26154. }
  26155. if (this.toUnicode) {
  26156. const charCode = getCharCode(unicode);
  26157. if (charCode !== -1) {
  26158. if (hasCurrentBufErrors()) {
  26159. buffers.push(currentBuf.join(""));
  26160. currentBuf.length = 0;
  26161. }
  26162. const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
  26163. for (let j = charCodeLength - 1; j >= 0; j--) {
  26164. currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
  26165. }
  26166. continue;
  26167. }
  26168. }
  26169. if (!hasCurrentBufErrors()) {
  26170. buffers.push(currentBuf.join(""));
  26171. currentBuf.length = 0;
  26172. }
  26173. currentBuf.push(String.fromCodePoint(unicode));
  26174. }
  26175. buffers.push(currentBuf.join(""));
  26176. return buffers;
  26177. }
  26178. }
  26179. exports.Font = Font;
  26180. class ErrorFont {
  26181. constructor(error) {
  26182. this.error = error;
  26183. this.loadedName = "g_font_error";
  26184. this.missingFile = true;
  26185. }
  26186. charsToGlyphs() {
  26187. return [];
  26188. }
  26189. encodeString(chars) {
  26190. return [chars];
  26191. }
  26192. exportData() {
  26193. let extraProperties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  26194. return {
  26195. error: this.error
  26196. };
  26197. }
  26198. }
  26199. exports.ErrorFont = ErrorFont;
  26200. /***/ }),
  26201. /* 166 */
  26202. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26203. "use strict";
  26204. Object.defineProperty(exports, "__esModule", ({
  26205. value: true
  26206. }));
  26207. exports.CFFTopDict = exports.CFFStrings = exports.CFFStandardStrings = exports.CFFPrivateDict = exports.CFFParser = exports.CFFIndex = exports.CFFHeader = exports.CFFFDSelect = exports.CFFCompiler = exports.CFFCharset = exports.CFF = void 0;
  26208. var _util = __w_pdfjs_require__(2);
  26209. var _charsets = __w_pdfjs_require__(167);
  26210. var _encodings = __w_pdfjs_require__(168);
  26211. const MAX_SUBR_NESTING = 10;
  26212. 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"];
  26213. exports.CFFStandardStrings = CFFStandardStrings;
  26214. const NUM_STANDARD_CFF_STRINGS = 391;
  26215. const CharstringValidationData = [null, {
  26216. id: "hstem",
  26217. min: 2,
  26218. stackClearing: true,
  26219. stem: true
  26220. }, null, {
  26221. id: "vstem",
  26222. min: 2,
  26223. stackClearing: true,
  26224. stem: true
  26225. }, {
  26226. id: "vmoveto",
  26227. min: 1,
  26228. stackClearing: true
  26229. }, {
  26230. id: "rlineto",
  26231. min: 2,
  26232. resetStack: true
  26233. }, {
  26234. id: "hlineto",
  26235. min: 1,
  26236. resetStack: true
  26237. }, {
  26238. id: "vlineto",
  26239. min: 1,
  26240. resetStack: true
  26241. }, {
  26242. id: "rrcurveto",
  26243. min: 6,
  26244. resetStack: true
  26245. }, null, {
  26246. id: "callsubr",
  26247. min: 1,
  26248. undefStack: true
  26249. }, {
  26250. id: "return",
  26251. min: 0,
  26252. undefStack: true
  26253. }, null, null, {
  26254. id: "endchar",
  26255. min: 0,
  26256. stackClearing: true
  26257. }, null, null, null, {
  26258. id: "hstemhm",
  26259. min: 2,
  26260. stackClearing: true,
  26261. stem: true
  26262. }, {
  26263. id: "hintmask",
  26264. min: 0,
  26265. stackClearing: true
  26266. }, {
  26267. id: "cntrmask",
  26268. min: 0,
  26269. stackClearing: true
  26270. }, {
  26271. id: "rmoveto",
  26272. min: 2,
  26273. stackClearing: true
  26274. }, {
  26275. id: "hmoveto",
  26276. min: 1,
  26277. stackClearing: true
  26278. }, {
  26279. id: "vstemhm",
  26280. min: 2,
  26281. stackClearing: true,
  26282. stem: true
  26283. }, {
  26284. id: "rcurveline",
  26285. min: 8,
  26286. resetStack: true
  26287. }, {
  26288. id: "rlinecurve",
  26289. min: 8,
  26290. resetStack: true
  26291. }, {
  26292. id: "vvcurveto",
  26293. min: 4,
  26294. resetStack: true
  26295. }, {
  26296. id: "hhcurveto",
  26297. min: 4,
  26298. resetStack: true
  26299. }, null, {
  26300. id: "callgsubr",
  26301. min: 1,
  26302. undefStack: true
  26303. }, {
  26304. id: "vhcurveto",
  26305. min: 4,
  26306. resetStack: true
  26307. }, {
  26308. id: "hvcurveto",
  26309. min: 4,
  26310. resetStack: true
  26311. }];
  26312. const CharstringValidationData12 = [null, null, null, {
  26313. id: "and",
  26314. min: 2,
  26315. stackDelta: -1
  26316. }, {
  26317. id: "or",
  26318. min: 2,
  26319. stackDelta: -1
  26320. }, {
  26321. id: "not",
  26322. min: 1,
  26323. stackDelta: 0
  26324. }, null, null, null, {
  26325. id: "abs",
  26326. min: 1,
  26327. stackDelta: 0
  26328. }, {
  26329. id: "add",
  26330. min: 2,
  26331. stackDelta: -1,
  26332. stackFn(stack, index) {
  26333. stack[index - 2] = stack[index - 2] + stack[index - 1];
  26334. }
  26335. }, {
  26336. id: "sub",
  26337. min: 2,
  26338. stackDelta: -1,
  26339. stackFn(stack, index) {
  26340. stack[index - 2] = stack[index - 2] - stack[index - 1];
  26341. }
  26342. }, {
  26343. id: "div",
  26344. min: 2,
  26345. stackDelta: -1,
  26346. stackFn(stack, index) {
  26347. stack[index - 2] = stack[index - 2] / stack[index - 1];
  26348. }
  26349. }, null, {
  26350. id: "neg",
  26351. min: 1,
  26352. stackDelta: 0,
  26353. stackFn(stack, index) {
  26354. stack[index - 1] = -stack[index - 1];
  26355. }
  26356. }, {
  26357. id: "eq",
  26358. min: 2,
  26359. stackDelta: -1
  26360. }, null, null, {
  26361. id: "drop",
  26362. min: 1,
  26363. stackDelta: -1
  26364. }, null, {
  26365. id: "put",
  26366. min: 2,
  26367. stackDelta: -2
  26368. }, {
  26369. id: "get",
  26370. min: 1,
  26371. stackDelta: 0
  26372. }, {
  26373. id: "ifelse",
  26374. min: 4,
  26375. stackDelta: -3
  26376. }, {
  26377. id: "random",
  26378. min: 0,
  26379. stackDelta: 1
  26380. }, {
  26381. id: "mul",
  26382. min: 2,
  26383. stackDelta: -1,
  26384. stackFn(stack, index) {
  26385. stack[index - 2] = stack[index - 2] * stack[index - 1];
  26386. }
  26387. }, null, {
  26388. id: "sqrt",
  26389. min: 1,
  26390. stackDelta: 0
  26391. }, {
  26392. id: "dup",
  26393. min: 1,
  26394. stackDelta: 1
  26395. }, {
  26396. id: "exch",
  26397. min: 2,
  26398. stackDelta: 0
  26399. }, {
  26400. id: "index",
  26401. min: 2,
  26402. stackDelta: 0
  26403. }, {
  26404. id: "roll",
  26405. min: 3,
  26406. stackDelta: -2
  26407. }, null, null, null, {
  26408. id: "hflex",
  26409. min: 7,
  26410. resetStack: true
  26411. }, {
  26412. id: "flex",
  26413. min: 13,
  26414. resetStack: true
  26415. }, {
  26416. id: "hflex1",
  26417. min: 9,
  26418. resetStack: true
  26419. }, {
  26420. id: "flex1",
  26421. min: 11,
  26422. resetStack: true
  26423. }];
  26424. class CFFParser {
  26425. constructor(file, properties, seacAnalysisEnabled) {
  26426. this.bytes = file.getBytes();
  26427. this.properties = properties;
  26428. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  26429. }
  26430. parse() {
  26431. const properties = this.properties;
  26432. const cff = new CFF();
  26433. this.cff = cff;
  26434. const header = this.parseHeader();
  26435. const nameIndex = this.parseIndex(header.endPos);
  26436. const topDictIndex = this.parseIndex(nameIndex.endPos);
  26437. const stringIndex = this.parseIndex(topDictIndex.endPos);
  26438. const globalSubrIndex = this.parseIndex(stringIndex.endPos);
  26439. const topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  26440. const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  26441. cff.header = header.obj;
  26442. cff.names = this.parseNameIndex(nameIndex.obj);
  26443. cff.strings = this.parseStringIndex(stringIndex.obj);
  26444. cff.topDict = topDict;
  26445. cff.globalSubrIndex = globalSubrIndex.obj;
  26446. this.parsePrivateDict(cff.topDict);
  26447. cff.isCIDFont = topDict.hasName("ROS");
  26448. const charStringOffset = topDict.getByName("CharStrings");
  26449. const charStringIndex = this.parseIndex(charStringOffset).obj;
  26450. const fontMatrix = topDict.getByName("FontMatrix");
  26451. if (fontMatrix) {
  26452. properties.fontMatrix = fontMatrix;
  26453. }
  26454. const fontBBox = topDict.getByName("FontBBox");
  26455. if (fontBBox) {
  26456. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  26457. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  26458. properties.ascentScaled = true;
  26459. }
  26460. let charset, encoding;
  26461. if (cff.isCIDFont) {
  26462. const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
  26463. for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  26464. const dictRaw = fdArrayIndex.get(i);
  26465. const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  26466. this.parsePrivateDict(fontDict);
  26467. cff.fdArray.push(fontDict);
  26468. }
  26469. encoding = null;
  26470. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
  26471. cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
  26472. } else {
  26473. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
  26474. encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
  26475. }
  26476. cff.charset = charset;
  26477. cff.encoding = encoding;
  26478. const charStringsAndSeacs = this.parseCharStrings({
  26479. charStrings: charStringIndex,
  26480. localSubrIndex: topDict.privateDict.subrsIndex,
  26481. globalSubrIndex: globalSubrIndex.obj,
  26482. fdSelect: cff.fdSelect,
  26483. fdArray: cff.fdArray,
  26484. privateDict: topDict.privateDict
  26485. });
  26486. cff.charStrings = charStringsAndSeacs.charStrings;
  26487. cff.seacs = charStringsAndSeacs.seacs;
  26488. cff.widths = charStringsAndSeacs.widths;
  26489. return cff;
  26490. }
  26491. parseHeader() {
  26492. let bytes = this.bytes;
  26493. const bytesLength = bytes.length;
  26494. let offset = 0;
  26495. while (offset < bytesLength && bytes[offset] !== 1) {
  26496. ++offset;
  26497. }
  26498. if (offset >= bytesLength) {
  26499. throw new _util.FormatError("Invalid CFF header");
  26500. }
  26501. if (offset !== 0) {
  26502. (0, _util.info)("cff data is shifted");
  26503. bytes = bytes.subarray(offset);
  26504. this.bytes = bytes;
  26505. }
  26506. const major = bytes[0];
  26507. const minor = bytes[1];
  26508. const hdrSize = bytes[2];
  26509. const offSize = bytes[3];
  26510. const header = new CFFHeader(major, minor, hdrSize, offSize);
  26511. return {
  26512. obj: header,
  26513. endPos: hdrSize
  26514. };
  26515. }
  26516. parseDict(dict) {
  26517. let pos = 0;
  26518. function parseOperand() {
  26519. let value = dict[pos++];
  26520. if (value === 30) {
  26521. return parseFloatOperand();
  26522. } else if (value === 28) {
  26523. value = dict[pos++];
  26524. value = (value << 24 | dict[pos++] << 16) >> 16;
  26525. return value;
  26526. } else if (value === 29) {
  26527. value = dict[pos++];
  26528. value = value << 8 | dict[pos++];
  26529. value = value << 8 | dict[pos++];
  26530. value = value << 8 | dict[pos++];
  26531. return value;
  26532. } else if (value >= 32 && value <= 246) {
  26533. return value - 139;
  26534. } else if (value >= 247 && value <= 250) {
  26535. return (value - 247) * 256 + dict[pos++] + 108;
  26536. } else if (value >= 251 && value <= 254) {
  26537. return -((value - 251) * 256) - dict[pos++] - 108;
  26538. }
  26539. (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
  26540. return NaN;
  26541. }
  26542. function parseFloatOperand() {
  26543. let str = "";
  26544. const eof = 15;
  26545. const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
  26546. const length = dict.length;
  26547. while (pos < length) {
  26548. const b = dict[pos++];
  26549. const b1 = b >> 4;
  26550. const b2 = b & 15;
  26551. if (b1 === eof) {
  26552. break;
  26553. }
  26554. str += lookup[b1];
  26555. if (b2 === eof) {
  26556. break;
  26557. }
  26558. str += lookup[b2];
  26559. }
  26560. return parseFloat(str);
  26561. }
  26562. let operands = [];
  26563. const entries = [];
  26564. pos = 0;
  26565. const end = dict.length;
  26566. while (pos < end) {
  26567. let b = dict[pos];
  26568. if (b <= 21) {
  26569. if (b === 12) {
  26570. b = b << 8 | dict[++pos];
  26571. }
  26572. entries.push([b, operands]);
  26573. operands = [];
  26574. ++pos;
  26575. } else {
  26576. operands.push(parseOperand());
  26577. }
  26578. }
  26579. return entries;
  26580. }
  26581. parseIndex(pos) {
  26582. const cffIndex = new CFFIndex();
  26583. const bytes = this.bytes;
  26584. const count = bytes[pos++] << 8 | bytes[pos++];
  26585. const offsets = [];
  26586. let end = pos;
  26587. let i, ii;
  26588. if (count !== 0) {
  26589. const offsetSize = bytes[pos++];
  26590. const startPos = pos + (count + 1) * offsetSize - 1;
  26591. for (i = 0, ii = count + 1; i < ii; ++i) {
  26592. let offset = 0;
  26593. for (let j = 0; j < offsetSize; ++j) {
  26594. offset <<= 8;
  26595. offset += bytes[pos++];
  26596. }
  26597. offsets.push(startPos + offset);
  26598. }
  26599. end = offsets[count];
  26600. }
  26601. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  26602. const offsetStart = offsets[i];
  26603. const offsetEnd = offsets[i + 1];
  26604. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  26605. }
  26606. return {
  26607. obj: cffIndex,
  26608. endPos: end
  26609. };
  26610. }
  26611. parseNameIndex(index) {
  26612. const names = [];
  26613. for (let i = 0, ii = index.count; i < ii; ++i) {
  26614. const name = index.get(i);
  26615. names.push((0, _util.bytesToString)(name));
  26616. }
  26617. return names;
  26618. }
  26619. parseStringIndex(index) {
  26620. const strings = new CFFStrings();
  26621. for (let i = 0, ii = index.count; i < ii; ++i) {
  26622. const data = index.get(i);
  26623. strings.add((0, _util.bytesToString)(data));
  26624. }
  26625. return strings;
  26626. }
  26627. createDict(Type, dict, strings) {
  26628. const cffDict = new Type(strings);
  26629. for (const [key, value] of dict) {
  26630. cffDict.setByKey(key, value);
  26631. }
  26632. return cffDict;
  26633. }
  26634. parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  26635. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  26636. return false;
  26637. }
  26638. let stackSize = state.stackSize;
  26639. const stack = state.stack;
  26640. let length = data.length;
  26641. for (let j = 0; j < length;) {
  26642. const value = data[j++];
  26643. let validationCommand = null;
  26644. if (value === 12) {
  26645. const q = data[j++];
  26646. if (q === 0) {
  26647. data[j - 2] = 139;
  26648. data[j - 1] = 22;
  26649. stackSize = 0;
  26650. } else {
  26651. validationCommand = CharstringValidationData12[q];
  26652. }
  26653. } else if (value === 28) {
  26654. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  26655. j += 2;
  26656. stackSize++;
  26657. } else if (value === 14) {
  26658. if (stackSize >= 4) {
  26659. stackSize -= 4;
  26660. if (this.seacAnalysisEnabled) {
  26661. state.seac = stack.slice(stackSize, stackSize + 4);
  26662. return false;
  26663. }
  26664. }
  26665. validationCommand = CharstringValidationData[value];
  26666. } else if (value >= 32 && value <= 246) {
  26667. stack[stackSize] = value - 139;
  26668. stackSize++;
  26669. } else if (value >= 247 && value <= 254) {
  26670. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  26671. j++;
  26672. stackSize++;
  26673. } else if (value === 255) {
  26674. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  26675. j += 4;
  26676. stackSize++;
  26677. } else if (value === 19 || value === 20) {
  26678. state.hints += stackSize >> 1;
  26679. j += state.hints + 7 >> 3;
  26680. stackSize %= 2;
  26681. validationCommand = CharstringValidationData[value];
  26682. } else if (value === 10 || value === 29) {
  26683. let subrsIndex;
  26684. if (value === 10) {
  26685. subrsIndex = localSubrIndex;
  26686. } else {
  26687. subrsIndex = globalSubrIndex;
  26688. }
  26689. if (!subrsIndex) {
  26690. validationCommand = CharstringValidationData[value];
  26691. (0, _util.warn)("Missing subrsIndex for " + validationCommand.id);
  26692. return false;
  26693. }
  26694. let bias = 32768;
  26695. if (subrsIndex.count < 1240) {
  26696. bias = 107;
  26697. } else if (subrsIndex.count < 33900) {
  26698. bias = 1131;
  26699. }
  26700. const subrNumber = stack[--stackSize] + bias;
  26701. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  26702. validationCommand = CharstringValidationData[value];
  26703. (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id);
  26704. return false;
  26705. }
  26706. state.stackSize = stackSize;
  26707. state.callDepth++;
  26708. const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  26709. if (!valid) {
  26710. return false;
  26711. }
  26712. state.callDepth--;
  26713. stackSize = state.stackSize;
  26714. continue;
  26715. } else if (value === 11) {
  26716. state.stackSize = stackSize;
  26717. return true;
  26718. } else if (value === 0 && j === data.length) {
  26719. data[j - 1] = 14;
  26720. validationCommand = CharstringValidationData[14];
  26721. } else if (value === 9) {
  26722. data.copyWithin(j - 1, j, -1);
  26723. j -= 1;
  26724. length -= 1;
  26725. continue;
  26726. } else {
  26727. validationCommand = CharstringValidationData[value];
  26728. }
  26729. if (validationCommand) {
  26730. if (validationCommand.stem) {
  26731. state.hints += stackSize >> 1;
  26732. if (value === 3 || value === 23) {
  26733. state.hasVStems = true;
  26734. } else if (state.hasVStems && (value === 1 || value === 18)) {
  26735. (0, _util.warn)("CFF stem hints are in wrong order");
  26736. data[j - 1] = value === 1 ? 3 : 23;
  26737. }
  26738. }
  26739. if ("min" in validationCommand) {
  26740. if (!state.undefStack && stackSize < validationCommand.min) {
  26741. (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
  26742. if (stackSize === 0) {
  26743. data[j - 1] = 14;
  26744. return true;
  26745. }
  26746. return false;
  26747. }
  26748. }
  26749. if (state.firstStackClearing && validationCommand.stackClearing) {
  26750. state.firstStackClearing = false;
  26751. stackSize -= validationCommand.min;
  26752. if (stackSize >= 2 && validationCommand.stem) {
  26753. stackSize %= 2;
  26754. } else if (stackSize > 1) {
  26755. (0, _util.warn)("Found too many parameters for stack-clearing command");
  26756. }
  26757. if (stackSize > 0) {
  26758. state.width = stack[stackSize - 1];
  26759. }
  26760. }
  26761. if ("stackDelta" in validationCommand) {
  26762. if ("stackFn" in validationCommand) {
  26763. validationCommand.stackFn(stack, stackSize);
  26764. }
  26765. stackSize += validationCommand.stackDelta;
  26766. } else if (validationCommand.stackClearing) {
  26767. stackSize = 0;
  26768. } else if (validationCommand.resetStack) {
  26769. stackSize = 0;
  26770. state.undefStack = false;
  26771. } else if (validationCommand.undefStack) {
  26772. stackSize = 0;
  26773. state.undefStack = true;
  26774. state.firstStackClearing = false;
  26775. }
  26776. }
  26777. }
  26778. if (length < data.length) {
  26779. data.fill(14, length);
  26780. }
  26781. state.stackSize = stackSize;
  26782. return true;
  26783. }
  26784. parseCharStrings(_ref) {
  26785. let {
  26786. charStrings,
  26787. localSubrIndex,
  26788. globalSubrIndex,
  26789. fdSelect,
  26790. fdArray,
  26791. privateDict
  26792. } = _ref;
  26793. const seacs = [];
  26794. const widths = [];
  26795. const count = charStrings.count;
  26796. for (let i = 0; i < count; i++) {
  26797. const charstring = charStrings.get(i);
  26798. const state = {
  26799. callDepth: 0,
  26800. stackSize: 0,
  26801. stack: [],
  26802. undefStack: true,
  26803. hints: 0,
  26804. firstStackClearing: true,
  26805. seac: null,
  26806. width: null,
  26807. hasVStems: false
  26808. };
  26809. let valid = true;
  26810. let localSubrToUse = null;
  26811. let privateDictToUse = privateDict;
  26812. if (fdSelect && fdArray.length) {
  26813. const fdIndex = fdSelect.getFDIndex(i);
  26814. if (fdIndex === -1) {
  26815. (0, _util.warn)("Glyph index is not in fd select.");
  26816. valid = false;
  26817. }
  26818. if (fdIndex >= fdArray.length) {
  26819. (0, _util.warn)("Invalid fd index for glyph index.");
  26820. valid = false;
  26821. }
  26822. if (valid) {
  26823. privateDictToUse = fdArray[fdIndex].privateDict;
  26824. localSubrToUse = privateDictToUse.subrsIndex;
  26825. }
  26826. } else if (localSubrIndex) {
  26827. localSubrToUse = localSubrIndex;
  26828. }
  26829. if (valid) {
  26830. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  26831. }
  26832. if (state.width !== null) {
  26833. const nominalWidth = privateDictToUse.getByName("nominalWidthX");
  26834. widths[i] = nominalWidth + state.width;
  26835. } else {
  26836. const defaultWidth = privateDictToUse.getByName("defaultWidthX");
  26837. widths[i] = defaultWidth;
  26838. }
  26839. if (state.seac !== null) {
  26840. seacs[i] = state.seac;
  26841. }
  26842. if (!valid) {
  26843. charStrings.set(i, new Uint8Array([14]));
  26844. }
  26845. }
  26846. return {
  26847. charStrings,
  26848. seacs,
  26849. widths
  26850. };
  26851. }
  26852. emptyPrivateDictionary(parentDict) {
  26853. const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  26854. parentDict.setByKey(18, [0, 0]);
  26855. parentDict.privateDict = privateDict;
  26856. }
  26857. parsePrivateDict(parentDict) {
  26858. if (!parentDict.hasName("Private")) {
  26859. this.emptyPrivateDictionary(parentDict);
  26860. return;
  26861. }
  26862. const privateOffset = parentDict.getByName("Private");
  26863. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  26864. parentDict.removeByName("Private");
  26865. return;
  26866. }
  26867. const size = privateOffset[0];
  26868. const offset = privateOffset[1];
  26869. if (size === 0 || offset >= this.bytes.length) {
  26870. this.emptyPrivateDictionary(parentDict);
  26871. return;
  26872. }
  26873. const privateDictEnd = offset + size;
  26874. const dictData = this.bytes.subarray(offset, privateDictEnd);
  26875. const dict = this.parseDict(dictData);
  26876. const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  26877. parentDict.privateDict = privateDict;
  26878. if (privateDict.getByName("ExpansionFactor") === 0) {
  26879. privateDict.setByName("ExpansionFactor", 0.06);
  26880. }
  26881. if (!privateDict.getByName("Subrs")) {
  26882. return;
  26883. }
  26884. const subrsOffset = privateDict.getByName("Subrs");
  26885. const relativeOffset = offset + subrsOffset;
  26886. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  26887. this.emptyPrivateDictionary(parentDict);
  26888. return;
  26889. }
  26890. const subrsIndex = this.parseIndex(relativeOffset);
  26891. privateDict.subrsIndex = subrsIndex.obj;
  26892. }
  26893. parseCharsets(pos, length, strings, cid) {
  26894. if (pos === 0) {
  26895. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
  26896. } else if (pos === 1) {
  26897. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
  26898. } else if (pos === 2) {
  26899. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
  26900. }
  26901. const bytes = this.bytes;
  26902. const start = pos;
  26903. const format = bytes[pos++];
  26904. const charset = [cid ? 0 : ".notdef"];
  26905. let id, count, i;
  26906. length -= 1;
  26907. switch (format) {
  26908. case 0:
  26909. for (i = 0; i < length; i++) {
  26910. id = bytes[pos++] << 8 | bytes[pos++];
  26911. charset.push(cid ? id : strings.get(id));
  26912. }
  26913. break;
  26914. case 1:
  26915. while (charset.length <= length) {
  26916. id = bytes[pos++] << 8 | bytes[pos++];
  26917. count = bytes[pos++];
  26918. for (i = 0; i <= count; i++) {
  26919. charset.push(cid ? id++ : strings.get(id++));
  26920. }
  26921. }
  26922. break;
  26923. case 2:
  26924. while (charset.length <= length) {
  26925. id = bytes[pos++] << 8 | bytes[pos++];
  26926. count = bytes[pos++] << 8 | bytes[pos++];
  26927. for (i = 0; i <= count; i++) {
  26928. charset.push(cid ? id++ : strings.get(id++));
  26929. }
  26930. }
  26931. break;
  26932. default:
  26933. throw new _util.FormatError("Unknown charset format");
  26934. }
  26935. const end = pos;
  26936. const raw = bytes.subarray(start, end);
  26937. return new CFFCharset(false, format, charset, raw);
  26938. }
  26939. parseEncoding(pos, properties, strings, charset) {
  26940. const encoding = Object.create(null);
  26941. const bytes = this.bytes;
  26942. let predefined = false;
  26943. let format, i, ii;
  26944. let raw = null;
  26945. function readSupplement() {
  26946. const supplementsCount = bytes[pos++];
  26947. for (i = 0; i < supplementsCount; i++) {
  26948. const code = bytes[pos++];
  26949. const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  26950. encoding[code] = charset.indexOf(strings.get(sid));
  26951. }
  26952. }
  26953. if (pos === 0 || pos === 1) {
  26954. predefined = true;
  26955. format = pos;
  26956. const baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
  26957. for (i = 0, ii = charset.length; i < ii; i++) {
  26958. const index = baseEncoding.indexOf(charset[i]);
  26959. if (index !== -1) {
  26960. encoding[index] = i;
  26961. }
  26962. }
  26963. } else {
  26964. const dataStart = pos;
  26965. format = bytes[pos++];
  26966. switch (format & 0x7f) {
  26967. case 0:
  26968. const glyphsCount = bytes[pos++];
  26969. for (i = 1; i <= glyphsCount; i++) {
  26970. encoding[bytes[pos++]] = i;
  26971. }
  26972. break;
  26973. case 1:
  26974. const rangesCount = bytes[pos++];
  26975. let gid = 1;
  26976. for (i = 0; i < rangesCount; i++) {
  26977. const start = bytes[pos++];
  26978. const left = bytes[pos++];
  26979. for (let j = start; j <= start + left; j++) {
  26980. encoding[j] = gid++;
  26981. }
  26982. }
  26983. break;
  26984. default:
  26985. throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
  26986. }
  26987. const dataEnd = pos;
  26988. if (format & 0x80) {
  26989. bytes[dataStart] &= 0x7f;
  26990. readSupplement();
  26991. }
  26992. raw = bytes.subarray(dataStart, dataEnd);
  26993. }
  26994. format &= 0x7f;
  26995. return new CFFEncoding(predefined, format, encoding, raw);
  26996. }
  26997. parseFDSelect(pos, length) {
  26998. const bytes = this.bytes;
  26999. const format = bytes[pos++];
  27000. const fdSelect = [];
  27001. let i;
  27002. switch (format) {
  27003. case 0:
  27004. for (i = 0; i < length; ++i) {
  27005. const id = bytes[pos++];
  27006. fdSelect.push(id);
  27007. }
  27008. break;
  27009. case 3:
  27010. const rangesCount = bytes[pos++] << 8 | bytes[pos++];
  27011. for (i = 0; i < rangesCount; ++i) {
  27012. let first = bytes[pos++] << 8 | bytes[pos++];
  27013. if (i === 0 && first !== 0) {
  27014. (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
  27015. first = 0;
  27016. }
  27017. const fdIndex = bytes[pos++];
  27018. const next = bytes[pos] << 8 | bytes[pos + 1];
  27019. for (let j = first; j < next; ++j) {
  27020. fdSelect.push(fdIndex);
  27021. }
  27022. }
  27023. pos += 2;
  27024. break;
  27025. default:
  27026. throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
  27027. }
  27028. if (fdSelect.length !== length) {
  27029. throw new _util.FormatError("parseFDSelect: Invalid font data.");
  27030. }
  27031. return new CFFFDSelect(format, fdSelect);
  27032. }
  27033. }
  27034. exports.CFFParser = CFFParser;
  27035. class CFF {
  27036. constructor() {
  27037. this.header = null;
  27038. this.names = [];
  27039. this.topDict = null;
  27040. this.strings = new CFFStrings();
  27041. this.globalSubrIndex = null;
  27042. this.encoding = null;
  27043. this.charset = null;
  27044. this.charStrings = null;
  27045. this.fdArray = [];
  27046. this.fdSelect = null;
  27047. this.isCIDFont = false;
  27048. }
  27049. duplicateFirstGlyph() {
  27050. if (this.charStrings.count >= 65535) {
  27051. (0, _util.warn)("Not enough space in charstrings to duplicate first glyph.");
  27052. return;
  27053. }
  27054. const glyphZero = this.charStrings.get(0);
  27055. this.charStrings.add(glyphZero);
  27056. if (this.isCIDFont) {
  27057. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  27058. }
  27059. }
  27060. hasGlyphId(id) {
  27061. if (id < 0 || id >= this.charStrings.count) {
  27062. return false;
  27063. }
  27064. const glyph = this.charStrings.get(id);
  27065. return glyph.length > 0;
  27066. }
  27067. }
  27068. exports.CFF = CFF;
  27069. class CFFHeader {
  27070. constructor(major, minor, hdrSize, offSize) {
  27071. this.major = major;
  27072. this.minor = minor;
  27073. this.hdrSize = hdrSize;
  27074. this.offSize = offSize;
  27075. }
  27076. }
  27077. exports.CFFHeader = CFFHeader;
  27078. class CFFStrings {
  27079. constructor() {
  27080. this.strings = [];
  27081. }
  27082. get(index) {
  27083. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  27084. return CFFStandardStrings[index];
  27085. }
  27086. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  27087. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  27088. }
  27089. return CFFStandardStrings[0];
  27090. }
  27091. getSID(str) {
  27092. let index = CFFStandardStrings.indexOf(str);
  27093. if (index !== -1) {
  27094. return index;
  27095. }
  27096. index = this.strings.indexOf(str);
  27097. if (index !== -1) {
  27098. return index + NUM_STANDARD_CFF_STRINGS;
  27099. }
  27100. return -1;
  27101. }
  27102. add(value) {
  27103. this.strings.push(value);
  27104. }
  27105. get count() {
  27106. return this.strings.length;
  27107. }
  27108. }
  27109. exports.CFFStrings = CFFStrings;
  27110. class CFFIndex {
  27111. constructor() {
  27112. this.objects = [];
  27113. this.length = 0;
  27114. }
  27115. add(data) {
  27116. this.length += data.length;
  27117. this.objects.push(data);
  27118. }
  27119. set(index, data) {
  27120. this.length += data.length - this.objects[index].length;
  27121. this.objects[index] = data;
  27122. }
  27123. get(index) {
  27124. return this.objects[index];
  27125. }
  27126. get count() {
  27127. return this.objects.length;
  27128. }
  27129. }
  27130. exports.CFFIndex = CFFIndex;
  27131. class CFFDict {
  27132. constructor(tables, strings) {
  27133. this.keyToNameMap = tables.keyToNameMap;
  27134. this.nameToKeyMap = tables.nameToKeyMap;
  27135. this.defaults = tables.defaults;
  27136. this.types = tables.types;
  27137. this.opcodes = tables.opcodes;
  27138. this.order = tables.order;
  27139. this.strings = strings;
  27140. this.values = Object.create(null);
  27141. }
  27142. setByKey(key, value) {
  27143. if (!(key in this.keyToNameMap)) {
  27144. return false;
  27145. }
  27146. if (value.length === 0) {
  27147. return true;
  27148. }
  27149. for (const val of value) {
  27150. if (isNaN(val)) {
  27151. (0, _util.warn)(`Invalid CFFDict value: "${value}" for key "${key}".`);
  27152. return true;
  27153. }
  27154. }
  27155. const type = this.types[key];
  27156. if (type === "num" || type === "sid" || type === "offset") {
  27157. value = value[0];
  27158. }
  27159. this.values[key] = value;
  27160. return true;
  27161. }
  27162. setByName(name, value) {
  27163. if (!(name in this.nameToKeyMap)) {
  27164. throw new _util.FormatError(`Invalid dictionary name "${name}"`);
  27165. }
  27166. this.values[this.nameToKeyMap[name]] = value;
  27167. }
  27168. hasName(name) {
  27169. return this.nameToKeyMap[name] in this.values;
  27170. }
  27171. getByName(name) {
  27172. if (!(name in this.nameToKeyMap)) {
  27173. throw new _util.FormatError(`Invalid dictionary name ${name}"`);
  27174. }
  27175. const key = this.nameToKeyMap[name];
  27176. if (!(key in this.values)) {
  27177. return this.defaults[key];
  27178. }
  27179. return this.values[key];
  27180. }
  27181. removeByName(name) {
  27182. delete this.values[this.nameToKeyMap[name]];
  27183. }
  27184. static createTables(layout) {
  27185. const tables = {
  27186. keyToNameMap: {},
  27187. nameToKeyMap: {},
  27188. defaults: {},
  27189. types: {},
  27190. opcodes: {},
  27191. order: []
  27192. };
  27193. for (const entry of layout) {
  27194. const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  27195. tables.keyToNameMap[key] = entry[1];
  27196. tables.nameToKeyMap[entry[1]] = key;
  27197. tables.types[key] = entry[2];
  27198. tables.defaults[key] = entry[3];
  27199. tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
  27200. tables.order.push(key);
  27201. }
  27202. return tables;
  27203. }
  27204. }
  27205. 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]];
  27206. class CFFTopDict extends CFFDict {
  27207. static get tables() {
  27208. return (0, _util.shadow)(this, "tables", this.createTables(CFFTopDictLayout));
  27209. }
  27210. constructor(strings) {
  27211. super(CFFTopDict.tables, strings);
  27212. this.privateDict = null;
  27213. }
  27214. }
  27215. exports.CFFTopDict = CFFTopDict;
  27216. 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]];
  27217. class CFFPrivateDict extends CFFDict {
  27218. static get tables() {
  27219. return (0, _util.shadow)(this, "tables", this.createTables(CFFPrivateDictLayout));
  27220. }
  27221. constructor(strings) {
  27222. super(CFFPrivateDict.tables, strings);
  27223. this.subrsIndex = null;
  27224. }
  27225. }
  27226. exports.CFFPrivateDict = CFFPrivateDict;
  27227. const CFFCharsetPredefinedTypes = {
  27228. ISO_ADOBE: 0,
  27229. EXPERT: 1,
  27230. EXPERT_SUBSET: 2
  27231. };
  27232. class CFFCharset {
  27233. constructor(predefined, format, charset, raw) {
  27234. this.predefined = predefined;
  27235. this.format = format;
  27236. this.charset = charset;
  27237. this.raw = raw;
  27238. }
  27239. }
  27240. exports.CFFCharset = CFFCharset;
  27241. class CFFEncoding {
  27242. constructor(predefined, format, encoding, raw) {
  27243. this.predefined = predefined;
  27244. this.format = format;
  27245. this.encoding = encoding;
  27246. this.raw = raw;
  27247. }
  27248. }
  27249. class CFFFDSelect {
  27250. constructor(format, fdSelect) {
  27251. this.format = format;
  27252. this.fdSelect = fdSelect;
  27253. }
  27254. getFDIndex(glyphIndex) {
  27255. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  27256. return -1;
  27257. }
  27258. return this.fdSelect[glyphIndex];
  27259. }
  27260. }
  27261. exports.CFFFDSelect = CFFFDSelect;
  27262. class CFFOffsetTracker {
  27263. constructor() {
  27264. this.offsets = Object.create(null);
  27265. }
  27266. isTracking(key) {
  27267. return key in this.offsets;
  27268. }
  27269. track(key, location) {
  27270. if (key in this.offsets) {
  27271. throw new _util.FormatError(`Already tracking location of ${key}`);
  27272. }
  27273. this.offsets[key] = location;
  27274. }
  27275. offset(value) {
  27276. for (const key in this.offsets) {
  27277. this.offsets[key] += value;
  27278. }
  27279. }
  27280. setEntryLocation(key, values, output) {
  27281. if (!(key in this.offsets)) {
  27282. throw new _util.FormatError(`Not tracking location of ${key}`);
  27283. }
  27284. const data = output.data;
  27285. const dataOffset = this.offsets[key];
  27286. const size = 5;
  27287. for (let i = 0, ii = values.length; i < ii; ++i) {
  27288. const offset0 = i * size + dataOffset;
  27289. const offset1 = offset0 + 1;
  27290. const offset2 = offset0 + 2;
  27291. const offset3 = offset0 + 3;
  27292. const offset4 = offset0 + 4;
  27293. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  27294. throw new _util.FormatError("writing to an offset that is not empty");
  27295. }
  27296. const value = values[i];
  27297. data[offset0] = 0x1d;
  27298. data[offset1] = value >> 24 & 0xff;
  27299. data[offset2] = value >> 16 & 0xff;
  27300. data[offset3] = value >> 8 & 0xff;
  27301. data[offset4] = value & 0xff;
  27302. }
  27303. }
  27304. }
  27305. class CFFCompiler {
  27306. constructor(cff) {
  27307. this.cff = cff;
  27308. }
  27309. compile() {
  27310. const cff = this.cff;
  27311. const output = {
  27312. data: [],
  27313. length: 0,
  27314. add(data) {
  27315. this.data = this.data.concat(data);
  27316. this.length = this.data.length;
  27317. }
  27318. };
  27319. const header = this.compileHeader(cff.header);
  27320. output.add(header);
  27321. const nameIndex = this.compileNameIndex(cff.names);
  27322. output.add(nameIndex);
  27323. if (cff.isCIDFont) {
  27324. if (cff.topDict.hasName("FontMatrix")) {
  27325. const base = cff.topDict.getByName("FontMatrix");
  27326. cff.topDict.removeByName("FontMatrix");
  27327. for (const subDict of cff.fdArray) {
  27328. let matrix = base.slice(0);
  27329. if (subDict.hasName("FontMatrix")) {
  27330. matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix"));
  27331. }
  27332. subDict.setByName("FontMatrix", matrix);
  27333. }
  27334. }
  27335. }
  27336. const xuid = cff.topDict.getByName("XUID");
  27337. if (xuid && xuid.length > 16) {
  27338. cff.topDict.removeByName("XUID");
  27339. }
  27340. cff.topDict.setByName("charset", 0);
  27341. let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  27342. output.add(compiled.output);
  27343. const topDictTracker = compiled.trackers[0];
  27344. const stringIndex = this.compileStringIndex(cff.strings.strings);
  27345. output.add(stringIndex);
  27346. const globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  27347. output.add(globalSubrIndex);
  27348. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  27349. if (cff.encoding.predefined) {
  27350. topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
  27351. } else {
  27352. const encoding = this.compileEncoding(cff.encoding);
  27353. topDictTracker.setEntryLocation("Encoding", [output.length], output);
  27354. output.add(encoding);
  27355. }
  27356. }
  27357. const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
  27358. topDictTracker.setEntryLocation("charset", [output.length], output);
  27359. output.add(charset);
  27360. const charStrings = this.compileCharStrings(cff.charStrings);
  27361. topDictTracker.setEntryLocation("CharStrings", [output.length], output);
  27362. output.add(charStrings);
  27363. if (cff.isCIDFont) {
  27364. topDictTracker.setEntryLocation("FDSelect", [output.length], output);
  27365. const fdSelect = this.compileFDSelect(cff.fdSelect);
  27366. output.add(fdSelect);
  27367. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  27368. topDictTracker.setEntryLocation("FDArray", [output.length], output);
  27369. output.add(compiled.output);
  27370. const fontDictTrackers = compiled.trackers;
  27371. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  27372. }
  27373. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  27374. output.add([0]);
  27375. return output.data;
  27376. }
  27377. encodeNumber(value) {
  27378. if (Number.isInteger(value)) {
  27379. return this.encodeInteger(value);
  27380. }
  27381. return this.encodeFloat(value);
  27382. }
  27383. static get EncodeFloatRegExp() {
  27384. return (0, _util.shadow)(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/);
  27385. }
  27386. encodeFloat(num) {
  27387. let value = num.toString();
  27388. const m = CFFCompiler.EncodeFloatRegExp.exec(value);
  27389. if (m) {
  27390. const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
  27391. value = (Math.round(num * epsilon) / epsilon).toString();
  27392. }
  27393. let nibbles = "";
  27394. let i, ii;
  27395. for (i = 0, ii = value.length; i < ii; ++i) {
  27396. const a = value[i];
  27397. if (a === "e") {
  27398. nibbles += value[++i] === "-" ? "c" : "b";
  27399. } else if (a === ".") {
  27400. nibbles += "a";
  27401. } else if (a === "-") {
  27402. nibbles += "e";
  27403. } else {
  27404. nibbles += a;
  27405. }
  27406. }
  27407. nibbles += nibbles.length & 1 ? "f" : "ff";
  27408. const out = [30];
  27409. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  27410. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  27411. }
  27412. return out;
  27413. }
  27414. encodeInteger(value) {
  27415. let code;
  27416. if (value >= -107 && value <= 107) {
  27417. code = [value + 139];
  27418. } else if (value >= 108 && value <= 1131) {
  27419. value -= 108;
  27420. code = [(value >> 8) + 247, value & 0xff];
  27421. } else if (value >= -1131 && value <= -108) {
  27422. value = -value - 108;
  27423. code = [(value >> 8) + 251, value & 0xff];
  27424. } else if (value >= -32768 && value <= 32767) {
  27425. code = [0x1c, value >> 8 & 0xff, value & 0xff];
  27426. } else {
  27427. code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
  27428. }
  27429. return code;
  27430. }
  27431. compileHeader(header) {
  27432. return [header.major, header.minor, 4, header.offSize];
  27433. }
  27434. compileNameIndex(names) {
  27435. const nameIndex = new CFFIndex();
  27436. for (const name of names) {
  27437. const length = Math.min(name.length, 127);
  27438. let sanitizedName = new Array(length);
  27439. for (let j = 0; j < length; j++) {
  27440. let char = name[j];
  27441. if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
  27442. char = "_";
  27443. }
  27444. sanitizedName[j] = char;
  27445. }
  27446. sanitizedName = sanitizedName.join("");
  27447. if (sanitizedName === "") {
  27448. sanitizedName = "Bad_Font_Name";
  27449. }
  27450. nameIndex.add((0, _util.stringToBytes)(sanitizedName));
  27451. }
  27452. return this.compileIndex(nameIndex);
  27453. }
  27454. compileTopDicts(dicts, length, removeCidKeys) {
  27455. const fontDictTrackers = [];
  27456. let fdArrayIndex = new CFFIndex();
  27457. for (const fontDict of dicts) {
  27458. if (removeCidKeys) {
  27459. fontDict.removeByName("CIDFontVersion");
  27460. fontDict.removeByName("CIDFontRevision");
  27461. fontDict.removeByName("CIDFontType");
  27462. fontDict.removeByName("CIDCount");
  27463. fontDict.removeByName("UIDBase");
  27464. }
  27465. const fontDictTracker = new CFFOffsetTracker();
  27466. const fontDictData = this.compileDict(fontDict, fontDictTracker);
  27467. fontDictTrackers.push(fontDictTracker);
  27468. fdArrayIndex.add(fontDictData);
  27469. fontDictTracker.offset(length);
  27470. }
  27471. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  27472. return {
  27473. trackers: fontDictTrackers,
  27474. output: fdArrayIndex
  27475. };
  27476. }
  27477. compilePrivateDicts(dicts, trackers, output) {
  27478. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  27479. const fontDict = dicts[i];
  27480. const privateDict = fontDict.privateDict;
  27481. if (!privateDict || !fontDict.hasName("Private")) {
  27482. throw new _util.FormatError("There must be a private dictionary.");
  27483. }
  27484. const privateDictTracker = new CFFOffsetTracker();
  27485. const privateDictData = this.compileDict(privateDict, privateDictTracker);
  27486. let outputLength = output.length;
  27487. privateDictTracker.offset(outputLength);
  27488. if (!privateDictData.length) {
  27489. outputLength = 0;
  27490. }
  27491. trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
  27492. output.add(privateDictData);
  27493. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  27494. const subrs = this.compileIndex(privateDict.subrsIndex);
  27495. privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
  27496. output.add(subrs);
  27497. }
  27498. }
  27499. }
  27500. compileDict(dict, offsetTracker) {
  27501. const out = [];
  27502. for (const key of dict.order) {
  27503. if (!(key in dict.values)) {
  27504. continue;
  27505. }
  27506. let values = dict.values[key];
  27507. let types = dict.types[key];
  27508. if (!Array.isArray(types)) {
  27509. types = [types];
  27510. }
  27511. if (!Array.isArray(values)) {
  27512. values = [values];
  27513. }
  27514. if (values.length === 0) {
  27515. continue;
  27516. }
  27517. for (let j = 0, jj = types.length; j < jj; ++j) {
  27518. const type = types[j];
  27519. const value = values[j];
  27520. switch (type) {
  27521. case "num":
  27522. case "sid":
  27523. out.push(...this.encodeNumber(value));
  27524. break;
  27525. case "offset":
  27526. const name = dict.keyToNameMap[key];
  27527. if (!offsetTracker.isTracking(name)) {
  27528. offsetTracker.track(name, out.length);
  27529. }
  27530. out.push(0x1d, 0, 0, 0, 0);
  27531. break;
  27532. case "array":
  27533. case "delta":
  27534. out.push(...this.encodeNumber(value));
  27535. for (let k = 1, kk = values.length; k < kk; ++k) {
  27536. out.push(...this.encodeNumber(values[k]));
  27537. }
  27538. break;
  27539. default:
  27540. throw new _util.FormatError(`Unknown data type of ${type}`);
  27541. }
  27542. }
  27543. out.push(...dict.opcodes[key]);
  27544. }
  27545. return out;
  27546. }
  27547. compileStringIndex(strings) {
  27548. const stringIndex = new CFFIndex();
  27549. for (const string of strings) {
  27550. stringIndex.add((0, _util.stringToBytes)(string));
  27551. }
  27552. return this.compileIndex(stringIndex);
  27553. }
  27554. compileGlobalSubrIndex() {
  27555. const globalSubrIndex = this.cff.globalSubrIndex;
  27556. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  27557. }
  27558. compileCharStrings(charStrings) {
  27559. const charStringsIndex = new CFFIndex();
  27560. for (let i = 0; i < charStrings.count; i++) {
  27561. const glyph = charStrings.get(i);
  27562. if (glyph.length === 0) {
  27563. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  27564. continue;
  27565. }
  27566. charStringsIndex.add(glyph);
  27567. }
  27568. return this.compileIndex(charStringsIndex);
  27569. }
  27570. compileCharset(charset, numGlyphs, strings, isCIDFont) {
  27571. let out;
  27572. const numGlyphsLessNotDef = numGlyphs - 1;
  27573. if (isCIDFont) {
  27574. out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
  27575. } else {
  27576. const length = 1 + numGlyphsLessNotDef * 2;
  27577. out = new Uint8Array(length);
  27578. out[0] = 0;
  27579. let charsetIndex = 0;
  27580. const numCharsets = charset.charset.length;
  27581. let warned = false;
  27582. for (let i = 1; i < out.length; i += 2) {
  27583. let sid = 0;
  27584. if (charsetIndex < numCharsets) {
  27585. const name = charset.charset[charsetIndex++];
  27586. sid = strings.getSID(name);
  27587. if (sid === -1) {
  27588. sid = 0;
  27589. if (!warned) {
  27590. warned = true;
  27591. (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
  27592. }
  27593. }
  27594. }
  27595. out[i] = sid >> 8 & 0xff;
  27596. out[i + 1] = sid & 0xff;
  27597. }
  27598. }
  27599. return this.compileTypedArray(out);
  27600. }
  27601. compileEncoding(encoding) {
  27602. return this.compileTypedArray(encoding.raw);
  27603. }
  27604. compileFDSelect(fdSelect) {
  27605. const format = fdSelect.format;
  27606. let out, i;
  27607. switch (format) {
  27608. case 0:
  27609. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  27610. out[0] = format;
  27611. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  27612. out[i + 1] = fdSelect.fdSelect[i];
  27613. }
  27614. break;
  27615. case 3:
  27616. const start = 0;
  27617. let lastFD = fdSelect.fdSelect[0];
  27618. const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
  27619. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  27620. const currentFD = fdSelect.fdSelect[i];
  27621. if (currentFD !== lastFD) {
  27622. ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
  27623. lastFD = currentFD;
  27624. }
  27625. }
  27626. const numRanges = (ranges.length - 3) / 3;
  27627. ranges[1] = numRanges >> 8 & 0xff;
  27628. ranges[2] = numRanges & 0xff;
  27629. ranges.push(i >> 8 & 0xff, i & 0xff);
  27630. out = new Uint8Array(ranges);
  27631. break;
  27632. }
  27633. return this.compileTypedArray(out);
  27634. }
  27635. compileTypedArray(data) {
  27636. const out = [];
  27637. for (let i = 0, ii = data.length; i < ii; ++i) {
  27638. out[i] = data[i];
  27639. }
  27640. return out;
  27641. }
  27642. compileIndex(index) {
  27643. let trackers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  27644. const objects = index.objects;
  27645. const count = objects.length;
  27646. if (count === 0) {
  27647. return [0, 0];
  27648. }
  27649. const data = [count >> 8 & 0xff, count & 0xff];
  27650. let lastOffset = 1,
  27651. i;
  27652. for (i = 0; i < count; ++i) {
  27653. lastOffset += objects[i].length;
  27654. }
  27655. let offsetSize;
  27656. if (lastOffset < 0x100) {
  27657. offsetSize = 1;
  27658. } else if (lastOffset < 0x10000) {
  27659. offsetSize = 2;
  27660. } else if (lastOffset < 0x1000000) {
  27661. offsetSize = 3;
  27662. } else {
  27663. offsetSize = 4;
  27664. }
  27665. data.push(offsetSize);
  27666. let relativeOffset = 1;
  27667. for (i = 0; i < count + 1; i++) {
  27668. if (offsetSize === 1) {
  27669. data.push(relativeOffset & 0xff);
  27670. } else if (offsetSize === 2) {
  27671. data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  27672. } else if (offsetSize === 3) {
  27673. data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  27674. } else {
  27675. data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  27676. }
  27677. if (objects[i]) {
  27678. relativeOffset += objects[i].length;
  27679. }
  27680. }
  27681. for (i = 0; i < count; i++) {
  27682. if (trackers[i]) {
  27683. trackers[i].offset(data.length);
  27684. }
  27685. data.push(...objects[i]);
  27686. }
  27687. return data;
  27688. }
  27689. }
  27690. exports.CFFCompiler = CFFCompiler;
  27691. /***/ }),
  27692. /* 167 */
  27693. /***/ ((__unused_webpack_module, exports) => {
  27694. "use strict";
  27695. Object.defineProperty(exports, "__esModule", ({
  27696. value: true
  27697. }));
  27698. exports.ISOAdobeCharset = exports.ExpertSubsetCharset = exports.ExpertCharset = void 0;
  27699. 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"];
  27700. exports.ISOAdobeCharset = ISOAdobeCharset;
  27701. 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"];
  27702. exports.ExpertCharset = ExpertCharset;
  27703. 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"];
  27704. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  27705. /***/ }),
  27706. /* 168 */
  27707. /***/ ((__unused_webpack_module, exports) => {
  27708. "use strict";
  27709. Object.defineProperty(exports, "__esModule", ({
  27710. value: true
  27711. }));
  27712. exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0;
  27713. exports.getEncoding = getEncoding;
  27714. 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"];
  27715. exports.ExpertEncoding = ExpertEncoding;
  27716. 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", "", "", "", ""];
  27717. 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"];
  27718. exports.MacRomanEncoding = MacRomanEncoding;
  27719. 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", "", "", "", ""];
  27720. exports.StandardEncoding = StandardEncoding;
  27721. 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"];
  27722. exports.WinAnsiEncoding = WinAnsiEncoding;
  27723. 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", ""];
  27724. exports.SymbolSetEncoding = SymbolSetEncoding;
  27725. 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", ""];
  27726. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  27727. function getEncoding(encodingName) {
  27728. switch (encodingName) {
  27729. case "WinAnsiEncoding":
  27730. return WinAnsiEncoding;
  27731. case "StandardEncoding":
  27732. return StandardEncoding;
  27733. case "MacRomanEncoding":
  27734. return MacRomanEncoding;
  27735. case "SymbolSetEncoding":
  27736. return SymbolSetEncoding;
  27737. case "ZapfDingbatsEncoding":
  27738. return ZapfDingbatsEncoding;
  27739. case "ExpertEncoding":
  27740. return ExpertEncoding;
  27741. case "MacExpertEncoding":
  27742. return MacExpertEncoding;
  27743. default:
  27744. return null;
  27745. }
  27746. }
  27747. /***/ }),
  27748. /* 169 */
  27749. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  27750. "use strict";
  27751. Object.defineProperty(exports, "__esModule", ({
  27752. value: true
  27753. }));
  27754. exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0;
  27755. exports.normalizeFontName = normalizeFontName;
  27756. exports.recoverGlyphName = recoverGlyphName;
  27757. exports.type1FontGlyphMapping = type1FontGlyphMapping;
  27758. var _encodings = __w_pdfjs_require__(168);
  27759. var _glyphlist = __w_pdfjs_require__(170);
  27760. var _unicode = __w_pdfjs_require__(171);
  27761. var _util = __w_pdfjs_require__(2);
  27762. const SEAC_ANALYSIS_ENABLED = true;
  27763. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  27764. const FontFlags = {
  27765. FixedPitch: 1,
  27766. Serif: 2,
  27767. Symbolic: 4,
  27768. Script: 8,
  27769. Nonsymbolic: 32,
  27770. Italic: 64,
  27771. AllCap: 65536,
  27772. SmallCap: 131072,
  27773. ForceBold: 262144
  27774. };
  27775. exports.FontFlags = FontFlags;
  27776. 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"];
  27777. exports.MacStandardGlyphOrdering = MacStandardGlyphOrdering;
  27778. function recoverGlyphName(name, glyphsUnicodeMap) {
  27779. if (glyphsUnicodeMap[name] !== undefined) {
  27780. return name;
  27781. }
  27782. const unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
  27783. if (unicode !== -1) {
  27784. for (const key in glyphsUnicodeMap) {
  27785. if (glyphsUnicodeMap[key] === unicode) {
  27786. return key;
  27787. }
  27788. }
  27789. }
  27790. (0, _util.info)("Unable to recover a standard glyph name for: " + name);
  27791. return name;
  27792. }
  27793. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  27794. const charCodeToGlyphId = Object.create(null);
  27795. let glyphId, charCode, baseEncoding;
  27796. const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  27797. if (properties.isInternalFont) {
  27798. baseEncoding = builtInEncoding;
  27799. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  27800. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  27801. if (glyphId >= 0) {
  27802. charCodeToGlyphId[charCode] = glyphId;
  27803. } else {
  27804. charCodeToGlyphId[charCode] = 0;
  27805. }
  27806. }
  27807. } else if (properties.baseEncodingName) {
  27808. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  27809. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  27810. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  27811. if (glyphId >= 0) {
  27812. charCodeToGlyphId[charCode] = glyphId;
  27813. } else {
  27814. charCodeToGlyphId[charCode] = 0;
  27815. }
  27816. }
  27817. } else if (isSymbolicFont) {
  27818. for (charCode in builtInEncoding) {
  27819. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  27820. }
  27821. } else {
  27822. baseEncoding = _encodings.StandardEncoding;
  27823. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  27824. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  27825. if (glyphId >= 0) {
  27826. charCodeToGlyphId[charCode] = glyphId;
  27827. } else {
  27828. charCodeToGlyphId[charCode] = 0;
  27829. }
  27830. }
  27831. }
  27832. const differences = properties.differences;
  27833. let glyphsUnicodeMap;
  27834. if (differences) {
  27835. for (charCode in differences) {
  27836. const glyphName = differences[charCode];
  27837. glyphId = glyphNames.indexOf(glyphName);
  27838. if (glyphId === -1) {
  27839. if (!glyphsUnicodeMap) {
  27840. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  27841. }
  27842. const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  27843. if (standardGlyphName !== glyphName) {
  27844. glyphId = glyphNames.indexOf(standardGlyphName);
  27845. }
  27846. }
  27847. if (glyphId >= 0) {
  27848. charCodeToGlyphId[charCode] = glyphId;
  27849. } else {
  27850. charCodeToGlyphId[charCode] = 0;
  27851. }
  27852. }
  27853. }
  27854. return charCodeToGlyphId;
  27855. }
  27856. function normalizeFontName(name) {
  27857. return name.replace(/[,_]/g, "-").replace(/\s/g, "");
  27858. }
  27859. /***/ }),
  27860. /* 170 */
  27861. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  27862. "use strict";
  27863. __w_pdfjs_require__.r(__webpack_exports__);
  27864. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  27865. /* harmony export */ "getDingbatsGlyphsUnicode": () => (/* binding */ getDingbatsGlyphsUnicode),
  27866. /* harmony export */ "getGlyphsUnicode": () => (/* binding */ getGlyphsUnicode)
  27867. /* harmony export */ });
  27868. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(136);
  27869. const getGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  27870. return [
  27871. "A",
  27872. 0x0041,
  27873. "AE",
  27874. 0x00c6,
  27875. "AEacute",
  27876. 0x01fc,
  27877. "AEmacron",
  27878. 0x01e2,
  27879. "AEsmall",
  27880. 0xf7e6,
  27881. "Aacute",
  27882. 0x00c1,
  27883. "Aacutesmall",
  27884. 0xf7e1,
  27885. "Abreve",
  27886. 0x0102,
  27887. "Abreveacute",
  27888. 0x1eae,
  27889. "Abrevecyrillic",
  27890. 0x04d0,
  27891. "Abrevedotbelow",
  27892. 0x1eb6,
  27893. "Abrevegrave",
  27894. 0x1eb0,
  27895. "Abrevehookabove",
  27896. 0x1eb2,
  27897. "Abrevetilde",
  27898. 0x1eb4,
  27899. "Acaron",
  27900. 0x01cd,
  27901. "Acircle",
  27902. 0x24b6,
  27903. "Acircumflex",
  27904. 0x00c2,
  27905. "Acircumflexacute",
  27906. 0x1ea4,
  27907. "Acircumflexdotbelow",
  27908. 0x1eac,
  27909. "Acircumflexgrave",
  27910. 0x1ea6,
  27911. "Acircumflexhookabove",
  27912. 0x1ea8,
  27913. "Acircumflexsmall",
  27914. 0xf7e2,
  27915. "Acircumflextilde",
  27916. 0x1eaa,
  27917. "Acute",
  27918. 0xf6c9,
  27919. "Acutesmall",
  27920. 0xf7b4,
  27921. "Acyrillic",
  27922. 0x0410,
  27923. "Adblgrave",
  27924. 0x0200,
  27925. "Adieresis",
  27926. 0x00c4,
  27927. "Adieresiscyrillic",
  27928. 0x04d2,
  27929. "Adieresismacron",
  27930. 0x01de,
  27931. "Adieresissmall",
  27932. 0xf7e4,
  27933. "Adotbelow",
  27934. 0x1ea0,
  27935. "Adotmacron",
  27936. 0x01e0,
  27937. "Agrave",
  27938. 0x00c0,
  27939. "Agravesmall",
  27940. 0xf7e0,
  27941. "Ahookabove",
  27942. 0x1ea2,
  27943. "Aiecyrillic",
  27944. 0x04d4,
  27945. "Ainvertedbreve",
  27946. 0x0202,
  27947. "Alpha",
  27948. 0x0391,
  27949. "Alphatonos",
  27950. 0x0386,
  27951. "Amacron",
  27952. 0x0100,
  27953. "Amonospace",
  27954. 0xff21,
  27955. "Aogonek",
  27956. 0x0104,
  27957. "Aring",
  27958. 0x00c5,
  27959. "Aringacute",
  27960. 0x01fa,
  27961. "Aringbelow",
  27962. 0x1e00,
  27963. "Aringsmall",
  27964. 0xf7e5,
  27965. "Asmall",
  27966. 0xf761,
  27967. "Atilde",
  27968. 0x00c3,
  27969. "Atildesmall",
  27970. 0xf7e3,
  27971. "Aybarmenian",
  27972. 0x0531,
  27973. "B",
  27974. 0x0042,
  27975. "Bcircle",
  27976. 0x24b7,
  27977. "Bdotaccent",
  27978. 0x1e02,
  27979. "Bdotbelow",
  27980. 0x1e04,
  27981. "Becyrillic",
  27982. 0x0411,
  27983. "Benarmenian",
  27984. 0x0532,
  27985. "Beta",
  27986. 0x0392,
  27987. "Bhook",
  27988. 0x0181,
  27989. "Blinebelow",
  27990. 0x1e06,
  27991. "Bmonospace",
  27992. 0xff22,
  27993. "Brevesmall",
  27994. 0xf6f4,
  27995. "Bsmall",
  27996. 0xf762,
  27997. "Btopbar",
  27998. 0x0182,
  27999. "C",
  28000. 0x0043,
  28001. "Caarmenian",
  28002. 0x053e,
  28003. "Cacute",
  28004. 0x0106,
  28005. "Caron",
  28006. 0xf6ca,
  28007. "Caronsmall",
  28008. 0xf6f5,
  28009. "Ccaron",
  28010. 0x010c,
  28011. "Ccedilla",
  28012. 0x00c7,
  28013. "Ccedillaacute",
  28014. 0x1e08,
  28015. "Ccedillasmall",
  28016. 0xf7e7,
  28017. "Ccircle",
  28018. 0x24b8,
  28019. "Ccircumflex",
  28020. 0x0108,
  28021. "Cdot",
  28022. 0x010a,
  28023. "Cdotaccent",
  28024. 0x010a,
  28025. "Cedillasmall",
  28026. 0xf7b8,
  28027. "Chaarmenian",
  28028. 0x0549,
  28029. "Cheabkhasiancyrillic",
  28030. 0x04bc,
  28031. "Checyrillic",
  28032. 0x0427,
  28033. "Chedescenderabkhasiancyrillic",
  28034. 0x04be,
  28035. "Chedescendercyrillic",
  28036. 0x04b6,
  28037. "Chedieresiscyrillic",
  28038. 0x04f4,
  28039. "Cheharmenian",
  28040. 0x0543,
  28041. "Chekhakassiancyrillic",
  28042. 0x04cb,
  28043. "Cheverticalstrokecyrillic",
  28044. 0x04b8,
  28045. "Chi",
  28046. 0x03a7,
  28047. "Chook",
  28048. 0x0187,
  28049. "Circumflexsmall",
  28050. 0xf6f6,
  28051. "Cmonospace",
  28052. 0xff23,
  28053. "Coarmenian",
  28054. 0x0551,
  28055. "Csmall",
  28056. 0xf763,
  28057. "D",
  28058. 0x0044,
  28059. "DZ",
  28060. 0x01f1,
  28061. "DZcaron",
  28062. 0x01c4,
  28063. "Daarmenian",
  28064. 0x0534,
  28065. "Dafrican",
  28066. 0x0189,
  28067. "Dcaron",
  28068. 0x010e,
  28069. "Dcedilla",
  28070. 0x1e10,
  28071. "Dcircle",
  28072. 0x24b9,
  28073. "Dcircumflexbelow",
  28074. 0x1e12,
  28075. "Dcroat",
  28076. 0x0110,
  28077. "Ddotaccent",
  28078. 0x1e0a,
  28079. "Ddotbelow",
  28080. 0x1e0c,
  28081. "Decyrillic",
  28082. 0x0414,
  28083. "Deicoptic",
  28084. 0x03ee,
  28085. "Delta",
  28086. 0x2206,
  28087. "Deltagreek",
  28088. 0x0394,
  28089. "Dhook",
  28090. 0x018a,
  28091. "Dieresis",
  28092. 0xf6cb,
  28093. "DieresisAcute",
  28094. 0xf6cc,
  28095. "DieresisGrave",
  28096. 0xf6cd,
  28097. "Dieresissmall",
  28098. 0xf7a8,
  28099. "Digammagreek",
  28100. 0x03dc,
  28101. "Djecyrillic",
  28102. 0x0402,
  28103. "Dlinebelow",
  28104. 0x1e0e,
  28105. "Dmonospace",
  28106. 0xff24,
  28107. "Dotaccentsmall",
  28108. 0xf6f7,
  28109. "Dslash",
  28110. 0x0110,
  28111. "Dsmall",
  28112. 0xf764,
  28113. "Dtopbar",
  28114. 0x018b,
  28115. "Dz",
  28116. 0x01f2,
  28117. "Dzcaron",
  28118. 0x01c5,
  28119. "Dzeabkhasiancyrillic",
  28120. 0x04e0,
  28121. "Dzecyrillic",
  28122. 0x0405,
  28123. "Dzhecyrillic",
  28124. 0x040f,
  28125. "E",
  28126. 0x0045,
  28127. "Eacute",
  28128. 0x00c9,
  28129. "Eacutesmall",
  28130. 0xf7e9,
  28131. "Ebreve",
  28132. 0x0114,
  28133. "Ecaron",
  28134. 0x011a,
  28135. "Ecedillabreve",
  28136. 0x1e1c,
  28137. "Echarmenian",
  28138. 0x0535,
  28139. "Ecircle",
  28140. 0x24ba,
  28141. "Ecircumflex",
  28142. 0x00ca,
  28143. "Ecircumflexacute",
  28144. 0x1ebe,
  28145. "Ecircumflexbelow",
  28146. 0x1e18,
  28147. "Ecircumflexdotbelow",
  28148. 0x1ec6,
  28149. "Ecircumflexgrave",
  28150. 0x1ec0,
  28151. "Ecircumflexhookabove",
  28152. 0x1ec2,
  28153. "Ecircumflexsmall",
  28154. 0xf7ea,
  28155. "Ecircumflextilde",
  28156. 0x1ec4,
  28157. "Ecyrillic",
  28158. 0x0404,
  28159. "Edblgrave",
  28160. 0x0204,
  28161. "Edieresis",
  28162. 0x00cb,
  28163. "Edieresissmall",
  28164. 0xf7eb,
  28165. "Edot",
  28166. 0x0116,
  28167. "Edotaccent",
  28168. 0x0116,
  28169. "Edotbelow",
  28170. 0x1eb8,
  28171. "Efcyrillic",
  28172. 0x0424,
  28173. "Egrave",
  28174. 0x00c8,
  28175. "Egravesmall",
  28176. 0xf7e8,
  28177. "Eharmenian",
  28178. 0x0537,
  28179. "Ehookabove",
  28180. 0x1eba,
  28181. "Eightroman",
  28182. 0x2167,
  28183. "Einvertedbreve",
  28184. 0x0206,
  28185. "Eiotifiedcyrillic",
  28186. 0x0464,
  28187. "Elcyrillic",
  28188. 0x041b,
  28189. "Elevenroman",
  28190. 0x216a,
  28191. "Emacron",
  28192. 0x0112,
  28193. "Emacronacute",
  28194. 0x1e16,
  28195. "Emacrongrave",
  28196. 0x1e14,
  28197. "Emcyrillic",
  28198. 0x041c,
  28199. "Emonospace",
  28200. 0xff25,
  28201. "Encyrillic",
  28202. 0x041d,
  28203. "Endescendercyrillic",
  28204. 0x04a2,
  28205. "Eng",
  28206. 0x014a,
  28207. "Enghecyrillic",
  28208. 0x04a4,
  28209. "Enhookcyrillic",
  28210. 0x04c7,
  28211. "Eogonek",
  28212. 0x0118,
  28213. "Eopen",
  28214. 0x0190,
  28215. "Epsilon",
  28216. 0x0395,
  28217. "Epsilontonos",
  28218. 0x0388,
  28219. "Ercyrillic",
  28220. 0x0420,
  28221. "Ereversed",
  28222. 0x018e,
  28223. "Ereversedcyrillic",
  28224. 0x042d,
  28225. "Escyrillic",
  28226. 0x0421,
  28227. "Esdescendercyrillic",
  28228. 0x04aa,
  28229. "Esh",
  28230. 0x01a9,
  28231. "Esmall",
  28232. 0xf765,
  28233. "Eta",
  28234. 0x0397,
  28235. "Etarmenian",
  28236. 0x0538,
  28237. "Etatonos",
  28238. 0x0389,
  28239. "Eth",
  28240. 0x00d0,
  28241. "Ethsmall",
  28242. 0xf7f0,
  28243. "Etilde",
  28244. 0x1ebc,
  28245. "Etildebelow",
  28246. 0x1e1a,
  28247. "Euro",
  28248. 0x20ac,
  28249. "Ezh",
  28250. 0x01b7,
  28251. "Ezhcaron",
  28252. 0x01ee,
  28253. "Ezhreversed",
  28254. 0x01b8,
  28255. "F",
  28256. 0x0046,
  28257. "Fcircle",
  28258. 0x24bb,
  28259. "Fdotaccent",
  28260. 0x1e1e,
  28261. "Feharmenian",
  28262. 0x0556,
  28263. "Feicoptic",
  28264. 0x03e4,
  28265. "Fhook",
  28266. 0x0191,
  28267. "Fitacyrillic",
  28268. 0x0472,
  28269. "Fiveroman",
  28270. 0x2164,
  28271. "Fmonospace",
  28272. 0xff26,
  28273. "Fourroman",
  28274. 0x2163,
  28275. "Fsmall",
  28276. 0xf766,
  28277. "G",
  28278. 0x0047,
  28279. "GBsquare",
  28280. 0x3387,
  28281. "Gacute",
  28282. 0x01f4,
  28283. "Gamma",
  28284. 0x0393,
  28285. "Gammaafrican",
  28286. 0x0194,
  28287. "Gangiacoptic",
  28288. 0x03ea,
  28289. "Gbreve",
  28290. 0x011e,
  28291. "Gcaron",
  28292. 0x01e6,
  28293. "Gcedilla",
  28294. 0x0122,
  28295. "Gcircle",
  28296. 0x24bc,
  28297. "Gcircumflex",
  28298. 0x011c,
  28299. "Gcommaaccent",
  28300. 0x0122,
  28301. "Gdot",
  28302. 0x0120,
  28303. "Gdotaccent",
  28304. 0x0120,
  28305. "Gecyrillic",
  28306. 0x0413,
  28307. "Ghadarmenian",
  28308. 0x0542,
  28309. "Ghemiddlehookcyrillic",
  28310. 0x0494,
  28311. "Ghestrokecyrillic",
  28312. 0x0492,
  28313. "Gheupturncyrillic",
  28314. 0x0490,
  28315. "Ghook",
  28316. 0x0193,
  28317. "Gimarmenian",
  28318. 0x0533,
  28319. "Gjecyrillic",
  28320. 0x0403,
  28321. "Gmacron",
  28322. 0x1e20,
  28323. "Gmonospace",
  28324. 0xff27,
  28325. "Grave",
  28326. 0xf6ce,
  28327. "Gravesmall",
  28328. 0xf760,
  28329. "Gsmall",
  28330. 0xf767,
  28331. "Gsmallhook",
  28332. 0x029b,
  28333. "Gstroke",
  28334. 0x01e4,
  28335. "H",
  28336. 0x0048,
  28337. "H18533",
  28338. 0x25cf,
  28339. "H18543",
  28340. 0x25aa,
  28341. "H18551",
  28342. 0x25ab,
  28343. "H22073",
  28344. 0x25a1,
  28345. "HPsquare",
  28346. 0x33cb,
  28347. "Haabkhasiancyrillic",
  28348. 0x04a8,
  28349. "Hadescendercyrillic",
  28350. 0x04b2,
  28351. "Hardsigncyrillic",
  28352. 0x042a,
  28353. "Hbar",
  28354. 0x0126,
  28355. "Hbrevebelow",
  28356. 0x1e2a,
  28357. "Hcedilla",
  28358. 0x1e28,
  28359. "Hcircle",
  28360. 0x24bd,
  28361. "Hcircumflex",
  28362. 0x0124,
  28363. "Hdieresis",
  28364. 0x1e26,
  28365. "Hdotaccent",
  28366. 0x1e22,
  28367. "Hdotbelow",
  28368. 0x1e24,
  28369. "Hmonospace",
  28370. 0xff28,
  28371. "Hoarmenian",
  28372. 0x0540,
  28373. "Horicoptic",
  28374. 0x03e8,
  28375. "Hsmall",
  28376. 0xf768,
  28377. "Hungarumlaut",
  28378. 0xf6cf,
  28379. "Hungarumlautsmall",
  28380. 0xf6f8,
  28381. "Hzsquare",
  28382. 0x3390,
  28383. "I",
  28384. 0x0049,
  28385. "IAcyrillic",
  28386. 0x042f,
  28387. "IJ",
  28388. 0x0132,
  28389. "IUcyrillic",
  28390. 0x042e,
  28391. "Iacute",
  28392. 0x00cd,
  28393. "Iacutesmall",
  28394. 0xf7ed,
  28395. "Ibreve",
  28396. 0x012c,
  28397. "Icaron",
  28398. 0x01cf,
  28399. "Icircle",
  28400. 0x24be,
  28401. "Icircumflex",
  28402. 0x00ce,
  28403. "Icircumflexsmall",
  28404. 0xf7ee,
  28405. "Icyrillic",
  28406. 0x0406,
  28407. "Idblgrave",
  28408. 0x0208,
  28409. "Idieresis",
  28410. 0x00cf,
  28411. "Idieresisacute",
  28412. 0x1e2e,
  28413. "Idieresiscyrillic",
  28414. 0x04e4,
  28415. "Idieresissmall",
  28416. 0xf7ef,
  28417. "Idot",
  28418. 0x0130,
  28419. "Idotaccent",
  28420. 0x0130,
  28421. "Idotbelow",
  28422. 0x1eca,
  28423. "Iebrevecyrillic",
  28424. 0x04d6,
  28425. "Iecyrillic",
  28426. 0x0415,
  28427. "Ifraktur",
  28428. 0x2111,
  28429. "Igrave",
  28430. 0x00cc,
  28431. "Igravesmall",
  28432. 0xf7ec,
  28433. "Ihookabove",
  28434. 0x1ec8,
  28435. "Iicyrillic",
  28436. 0x0418,
  28437. "Iinvertedbreve",
  28438. 0x020a,
  28439. "Iishortcyrillic",
  28440. 0x0419,
  28441. "Imacron",
  28442. 0x012a,
  28443. "Imacroncyrillic",
  28444. 0x04e2,
  28445. "Imonospace",
  28446. 0xff29,
  28447. "Iniarmenian",
  28448. 0x053b,
  28449. "Iocyrillic",
  28450. 0x0401,
  28451. "Iogonek",
  28452. 0x012e,
  28453. "Iota",
  28454. 0x0399,
  28455. "Iotaafrican",
  28456. 0x0196,
  28457. "Iotadieresis",
  28458. 0x03aa,
  28459. "Iotatonos",
  28460. 0x038a,
  28461. "Ismall",
  28462. 0xf769,
  28463. "Istroke",
  28464. 0x0197,
  28465. "Itilde",
  28466. 0x0128,
  28467. "Itildebelow",
  28468. 0x1e2c,
  28469. "Izhitsacyrillic",
  28470. 0x0474,
  28471. "Izhitsadblgravecyrillic",
  28472. 0x0476,
  28473. "J",
  28474. 0x004a,
  28475. "Jaarmenian",
  28476. 0x0541,
  28477. "Jcircle",
  28478. 0x24bf,
  28479. "Jcircumflex",
  28480. 0x0134,
  28481. "Jecyrillic",
  28482. 0x0408,
  28483. "Jheharmenian",
  28484. 0x054b,
  28485. "Jmonospace",
  28486. 0xff2a,
  28487. "Jsmall",
  28488. 0xf76a,
  28489. "K",
  28490. 0x004b,
  28491. "KBsquare",
  28492. 0x3385,
  28493. "KKsquare",
  28494. 0x33cd,
  28495. "Kabashkircyrillic",
  28496. 0x04a0,
  28497. "Kacute",
  28498. 0x1e30,
  28499. "Kacyrillic",
  28500. 0x041a,
  28501. "Kadescendercyrillic",
  28502. 0x049a,
  28503. "Kahookcyrillic",
  28504. 0x04c3,
  28505. "Kappa",
  28506. 0x039a,
  28507. "Kastrokecyrillic",
  28508. 0x049e,
  28509. "Kaverticalstrokecyrillic",
  28510. 0x049c,
  28511. "Kcaron",
  28512. 0x01e8,
  28513. "Kcedilla",
  28514. 0x0136,
  28515. "Kcircle",
  28516. 0x24c0,
  28517. "Kcommaaccent",
  28518. 0x0136,
  28519. "Kdotbelow",
  28520. 0x1e32,
  28521. "Keharmenian",
  28522. 0x0554,
  28523. "Kenarmenian",
  28524. 0x053f,
  28525. "Khacyrillic",
  28526. 0x0425,
  28527. "Kheicoptic",
  28528. 0x03e6,
  28529. "Khook",
  28530. 0x0198,
  28531. "Kjecyrillic",
  28532. 0x040c,
  28533. "Klinebelow",
  28534. 0x1e34,
  28535. "Kmonospace",
  28536. 0xff2b,
  28537. "Koppacyrillic",
  28538. 0x0480,
  28539. "Koppagreek",
  28540. 0x03de,
  28541. "Ksicyrillic",
  28542. 0x046e,
  28543. "Ksmall",
  28544. 0xf76b,
  28545. "L",
  28546. 0x004c,
  28547. "LJ",
  28548. 0x01c7,
  28549. "LL",
  28550. 0xf6bf,
  28551. "Lacute",
  28552. 0x0139,
  28553. "Lambda",
  28554. 0x039b,
  28555. "Lcaron",
  28556. 0x013d,
  28557. "Lcedilla",
  28558. 0x013b,
  28559. "Lcircle",
  28560. 0x24c1,
  28561. "Lcircumflexbelow",
  28562. 0x1e3c,
  28563. "Lcommaaccent",
  28564. 0x013b,
  28565. "Ldot",
  28566. 0x013f,
  28567. "Ldotaccent",
  28568. 0x013f,
  28569. "Ldotbelow",
  28570. 0x1e36,
  28571. "Ldotbelowmacron",
  28572. 0x1e38,
  28573. "Liwnarmenian",
  28574. 0x053c,
  28575. "Lj",
  28576. 0x01c8,
  28577. "Ljecyrillic",
  28578. 0x0409,
  28579. "Llinebelow",
  28580. 0x1e3a,
  28581. "Lmonospace",
  28582. 0xff2c,
  28583. "Lslash",
  28584. 0x0141,
  28585. "Lslashsmall",
  28586. 0xf6f9,
  28587. "Lsmall",
  28588. 0xf76c,
  28589. "M",
  28590. 0x004d,
  28591. "MBsquare",
  28592. 0x3386,
  28593. "Macron",
  28594. 0xf6d0,
  28595. "Macronsmall",
  28596. 0xf7af,
  28597. "Macute",
  28598. 0x1e3e,
  28599. "Mcircle",
  28600. 0x24c2,
  28601. "Mdotaccent",
  28602. 0x1e40,
  28603. "Mdotbelow",
  28604. 0x1e42,
  28605. "Menarmenian",
  28606. 0x0544,
  28607. "Mmonospace",
  28608. 0xff2d,
  28609. "Msmall",
  28610. 0xf76d,
  28611. "Mturned",
  28612. 0x019c,
  28613. "Mu",
  28614. 0x039c,
  28615. "N",
  28616. 0x004e,
  28617. "NJ",
  28618. 0x01ca,
  28619. "Nacute",
  28620. 0x0143,
  28621. "Ncaron",
  28622. 0x0147,
  28623. "Ncedilla",
  28624. 0x0145,
  28625. "Ncircle",
  28626. 0x24c3,
  28627. "Ncircumflexbelow",
  28628. 0x1e4a,
  28629. "Ncommaaccent",
  28630. 0x0145,
  28631. "Ndotaccent",
  28632. 0x1e44,
  28633. "Ndotbelow",
  28634. 0x1e46,
  28635. "Nhookleft",
  28636. 0x019d,
  28637. "Nineroman",
  28638. 0x2168,
  28639. "Nj",
  28640. 0x01cb,
  28641. "Njecyrillic",
  28642. 0x040a,
  28643. "Nlinebelow",
  28644. 0x1e48,
  28645. "Nmonospace",
  28646. 0xff2e,
  28647. "Nowarmenian",
  28648. 0x0546,
  28649. "Nsmall",
  28650. 0xf76e,
  28651. "Ntilde",
  28652. 0x00d1,
  28653. "Ntildesmall",
  28654. 0xf7f1,
  28655. "Nu",
  28656. 0x039d,
  28657. "O",
  28658. 0x004f,
  28659. "OE",
  28660. 0x0152,
  28661. "OEsmall",
  28662. 0xf6fa,
  28663. "Oacute",
  28664. 0x00d3,
  28665. "Oacutesmall",
  28666. 0xf7f3,
  28667. "Obarredcyrillic",
  28668. 0x04e8,
  28669. "Obarreddieresiscyrillic",
  28670. 0x04ea,
  28671. "Obreve",
  28672. 0x014e,
  28673. "Ocaron",
  28674. 0x01d1,
  28675. "Ocenteredtilde",
  28676. 0x019f,
  28677. "Ocircle",
  28678. 0x24c4,
  28679. "Ocircumflex",
  28680. 0x00d4,
  28681. "Ocircumflexacute",
  28682. 0x1ed0,
  28683. "Ocircumflexdotbelow",
  28684. 0x1ed8,
  28685. "Ocircumflexgrave",
  28686. 0x1ed2,
  28687. "Ocircumflexhookabove",
  28688. 0x1ed4,
  28689. "Ocircumflexsmall",
  28690. 0xf7f4,
  28691. "Ocircumflextilde",
  28692. 0x1ed6,
  28693. "Ocyrillic",
  28694. 0x041e,
  28695. "Odblacute",
  28696. 0x0150,
  28697. "Odblgrave",
  28698. 0x020c,
  28699. "Odieresis",
  28700. 0x00d6,
  28701. "Odieresiscyrillic",
  28702. 0x04e6,
  28703. "Odieresissmall",
  28704. 0xf7f6,
  28705. "Odotbelow",
  28706. 0x1ecc,
  28707. "Ogoneksmall",
  28708. 0xf6fb,
  28709. "Ograve",
  28710. 0x00d2,
  28711. "Ogravesmall",
  28712. 0xf7f2,
  28713. "Oharmenian",
  28714. 0x0555,
  28715. "Ohm",
  28716. 0x2126,
  28717. "Ohookabove",
  28718. 0x1ece,
  28719. "Ohorn",
  28720. 0x01a0,
  28721. "Ohornacute",
  28722. 0x1eda,
  28723. "Ohorndotbelow",
  28724. 0x1ee2,
  28725. "Ohorngrave",
  28726. 0x1edc,
  28727. "Ohornhookabove",
  28728. 0x1ede,
  28729. "Ohorntilde",
  28730. 0x1ee0,
  28731. "Ohungarumlaut",
  28732. 0x0150,
  28733. "Oi",
  28734. 0x01a2,
  28735. "Oinvertedbreve",
  28736. 0x020e,
  28737. "Omacron",
  28738. 0x014c,
  28739. "Omacronacute",
  28740. 0x1e52,
  28741. "Omacrongrave",
  28742. 0x1e50,
  28743. "Omega",
  28744. 0x2126,
  28745. "Omegacyrillic",
  28746. 0x0460,
  28747. "Omegagreek",
  28748. 0x03a9,
  28749. "Omegaroundcyrillic",
  28750. 0x047a,
  28751. "Omegatitlocyrillic",
  28752. 0x047c,
  28753. "Omegatonos",
  28754. 0x038f,
  28755. "Omicron",
  28756. 0x039f,
  28757. "Omicrontonos",
  28758. 0x038c,
  28759. "Omonospace",
  28760. 0xff2f,
  28761. "Oneroman",
  28762. 0x2160,
  28763. "Oogonek",
  28764. 0x01ea,
  28765. "Oogonekmacron",
  28766. 0x01ec,
  28767. "Oopen",
  28768. 0x0186,
  28769. "Oslash",
  28770. 0x00d8,
  28771. "Oslashacute",
  28772. 0x01fe,
  28773. "Oslashsmall",
  28774. 0xf7f8,
  28775. "Osmall",
  28776. 0xf76f,
  28777. "Ostrokeacute",
  28778. 0x01fe,
  28779. "Otcyrillic",
  28780. 0x047e,
  28781. "Otilde",
  28782. 0x00d5,
  28783. "Otildeacute",
  28784. 0x1e4c,
  28785. "Otildedieresis",
  28786. 0x1e4e,
  28787. "Otildesmall",
  28788. 0xf7f5,
  28789. "P",
  28790. 0x0050,
  28791. "Pacute",
  28792. 0x1e54,
  28793. "Pcircle",
  28794. 0x24c5,
  28795. "Pdotaccent",
  28796. 0x1e56,
  28797. "Pecyrillic",
  28798. 0x041f,
  28799. "Peharmenian",
  28800. 0x054a,
  28801. "Pemiddlehookcyrillic",
  28802. 0x04a6,
  28803. "Phi",
  28804. 0x03a6,
  28805. "Phook",
  28806. 0x01a4,
  28807. "Pi",
  28808. 0x03a0,
  28809. "Piwrarmenian",
  28810. 0x0553,
  28811. "Pmonospace",
  28812. 0xff30,
  28813. "Psi",
  28814. 0x03a8,
  28815. "Psicyrillic",
  28816. 0x0470,
  28817. "Psmall",
  28818. 0xf770,
  28819. "Q",
  28820. 0x0051,
  28821. "Qcircle",
  28822. 0x24c6,
  28823. "Qmonospace",
  28824. 0xff31,
  28825. "Qsmall",
  28826. 0xf771,
  28827. "R",
  28828. 0x0052,
  28829. "Raarmenian",
  28830. 0x054c,
  28831. "Racute",
  28832. 0x0154,
  28833. "Rcaron",
  28834. 0x0158,
  28835. "Rcedilla",
  28836. 0x0156,
  28837. "Rcircle",
  28838. 0x24c7,
  28839. "Rcommaaccent",
  28840. 0x0156,
  28841. "Rdblgrave",
  28842. 0x0210,
  28843. "Rdotaccent",
  28844. 0x1e58,
  28845. "Rdotbelow",
  28846. 0x1e5a,
  28847. "Rdotbelowmacron",
  28848. 0x1e5c,
  28849. "Reharmenian",
  28850. 0x0550,
  28851. "Rfraktur",
  28852. 0x211c,
  28853. "Rho",
  28854. 0x03a1,
  28855. "Ringsmall",
  28856. 0xf6fc,
  28857. "Rinvertedbreve",
  28858. 0x0212,
  28859. "Rlinebelow",
  28860. 0x1e5e,
  28861. "Rmonospace",
  28862. 0xff32,
  28863. "Rsmall",
  28864. 0xf772,
  28865. "Rsmallinverted",
  28866. 0x0281,
  28867. "Rsmallinvertedsuperior",
  28868. 0x02b6,
  28869. "S",
  28870. 0x0053,
  28871. "SF010000",
  28872. 0x250c,
  28873. "SF020000",
  28874. 0x2514,
  28875. "SF030000",
  28876. 0x2510,
  28877. "SF040000",
  28878. 0x2518,
  28879. "SF050000",
  28880. 0x253c,
  28881. "SF060000",
  28882. 0x252c,
  28883. "SF070000",
  28884. 0x2534,
  28885. "SF080000",
  28886. 0x251c,
  28887. "SF090000",
  28888. 0x2524,
  28889. "SF100000",
  28890. 0x2500,
  28891. "SF110000",
  28892. 0x2502,
  28893. "SF190000",
  28894. 0x2561,
  28895. "SF200000",
  28896. 0x2562,
  28897. "SF210000",
  28898. 0x2556,
  28899. "SF220000",
  28900. 0x2555,
  28901. "SF230000",
  28902. 0x2563,
  28903. "SF240000",
  28904. 0x2551,
  28905. "SF250000",
  28906. 0x2557,
  28907. "SF260000",
  28908. 0x255d,
  28909. "SF270000",
  28910. 0x255c,
  28911. "SF280000",
  28912. 0x255b,
  28913. "SF360000",
  28914. 0x255e,
  28915. "SF370000",
  28916. 0x255f,
  28917. "SF380000",
  28918. 0x255a,
  28919. "SF390000",
  28920. 0x2554,
  28921. "SF400000",
  28922. 0x2569,
  28923. "SF410000",
  28924. 0x2566,
  28925. "SF420000",
  28926. 0x2560,
  28927. "SF430000",
  28928. 0x2550,
  28929. "SF440000",
  28930. 0x256c,
  28931. "SF450000",
  28932. 0x2567,
  28933. "SF460000",
  28934. 0x2568,
  28935. "SF470000",
  28936. 0x2564,
  28937. "SF480000",
  28938. 0x2565,
  28939. "SF490000",
  28940. 0x2559,
  28941. "SF500000",
  28942. 0x2558,
  28943. "SF510000",
  28944. 0x2552,
  28945. "SF520000",
  28946. 0x2553,
  28947. "SF530000",
  28948. 0x256b,
  28949. "SF540000",
  28950. 0x256a,
  28951. "Sacute",
  28952. 0x015a,
  28953. "Sacutedotaccent",
  28954. 0x1e64,
  28955. "Sampigreek",
  28956. 0x03e0,
  28957. "Scaron",
  28958. 0x0160,
  28959. "Scarondotaccent",
  28960. 0x1e66,
  28961. "Scaronsmall",
  28962. 0xf6fd,
  28963. "Scedilla",
  28964. 0x015e,
  28965. "Schwa",
  28966. 0x018f,
  28967. "Schwacyrillic",
  28968. 0x04d8,
  28969. "Schwadieresiscyrillic",
  28970. 0x04da,
  28971. "Scircle",
  28972. 0x24c8,
  28973. "Scircumflex",
  28974. 0x015c,
  28975. "Scommaaccent",
  28976. 0x0218,
  28977. "Sdotaccent",
  28978. 0x1e60,
  28979. "Sdotbelow",
  28980. 0x1e62,
  28981. "Sdotbelowdotaccent",
  28982. 0x1e68,
  28983. "Seharmenian",
  28984. 0x054d,
  28985. "Sevenroman",
  28986. 0x2166,
  28987. "Shaarmenian",
  28988. 0x0547,
  28989. "Shacyrillic",
  28990. 0x0428,
  28991. "Shchacyrillic",
  28992. 0x0429,
  28993. "Sheicoptic",
  28994. 0x03e2,
  28995. "Shhacyrillic",
  28996. 0x04ba,
  28997. "Shimacoptic",
  28998. 0x03ec,
  28999. "Sigma",
  29000. 0x03a3,
  29001. "Sixroman",
  29002. 0x2165,
  29003. "Smonospace",
  29004. 0xff33,
  29005. "Softsigncyrillic",
  29006. 0x042c,
  29007. "Ssmall",
  29008. 0xf773,
  29009. "Stigmagreek",
  29010. 0x03da,
  29011. "T",
  29012. 0x0054,
  29013. "Tau",
  29014. 0x03a4,
  29015. "Tbar",
  29016. 0x0166,
  29017. "Tcaron",
  29018. 0x0164,
  29019. "Tcedilla",
  29020. 0x0162,
  29021. "Tcircle",
  29022. 0x24c9,
  29023. "Tcircumflexbelow",
  29024. 0x1e70,
  29025. "Tcommaaccent",
  29026. 0x0162,
  29027. "Tdotaccent",
  29028. 0x1e6a,
  29029. "Tdotbelow",
  29030. 0x1e6c,
  29031. "Tecyrillic",
  29032. 0x0422,
  29033. "Tedescendercyrillic",
  29034. 0x04ac,
  29035. "Tenroman",
  29036. 0x2169,
  29037. "Tetsecyrillic",
  29038. 0x04b4,
  29039. "Theta",
  29040. 0x0398,
  29041. "Thook",
  29042. 0x01ac,
  29043. "Thorn",
  29044. 0x00de,
  29045. "Thornsmall",
  29046. 0xf7fe,
  29047. "Threeroman",
  29048. 0x2162,
  29049. "Tildesmall",
  29050. 0xf6fe,
  29051. "Tiwnarmenian",
  29052. 0x054f,
  29053. "Tlinebelow",
  29054. 0x1e6e,
  29055. "Tmonospace",
  29056. 0xff34,
  29057. "Toarmenian",
  29058. 0x0539,
  29059. "Tonefive",
  29060. 0x01bc,
  29061. "Tonesix",
  29062. 0x0184,
  29063. "Tonetwo",
  29064. 0x01a7,
  29065. "Tretroflexhook",
  29066. 0x01ae,
  29067. "Tsecyrillic",
  29068. 0x0426,
  29069. "Tshecyrillic",
  29070. 0x040b,
  29071. "Tsmall",
  29072. 0xf774,
  29073. "Twelveroman",
  29074. 0x216b,
  29075. "Tworoman",
  29076. 0x2161,
  29077. "U",
  29078. 0x0055,
  29079. "Uacute",
  29080. 0x00da,
  29081. "Uacutesmall",
  29082. 0xf7fa,
  29083. "Ubreve",
  29084. 0x016c,
  29085. "Ucaron",
  29086. 0x01d3,
  29087. "Ucircle",
  29088. 0x24ca,
  29089. "Ucircumflex",
  29090. 0x00db,
  29091. "Ucircumflexbelow",
  29092. 0x1e76,
  29093. "Ucircumflexsmall",
  29094. 0xf7fb,
  29095. "Ucyrillic",
  29096. 0x0423,
  29097. "Udblacute",
  29098. 0x0170,
  29099. "Udblgrave",
  29100. 0x0214,
  29101. "Udieresis",
  29102. 0x00dc,
  29103. "Udieresisacute",
  29104. 0x01d7,
  29105. "Udieresisbelow",
  29106. 0x1e72,
  29107. "Udieresiscaron",
  29108. 0x01d9,
  29109. "Udieresiscyrillic",
  29110. 0x04f0,
  29111. "Udieresisgrave",
  29112. 0x01db,
  29113. "Udieresismacron",
  29114. 0x01d5,
  29115. "Udieresissmall",
  29116. 0xf7fc,
  29117. "Udotbelow",
  29118. 0x1ee4,
  29119. "Ugrave",
  29120. 0x00d9,
  29121. "Ugravesmall",
  29122. 0xf7f9,
  29123. "Uhookabove",
  29124. 0x1ee6,
  29125. "Uhorn",
  29126. 0x01af,
  29127. "Uhornacute",
  29128. 0x1ee8,
  29129. "Uhorndotbelow",
  29130. 0x1ef0,
  29131. "Uhorngrave",
  29132. 0x1eea,
  29133. "Uhornhookabove",
  29134. 0x1eec,
  29135. "Uhorntilde",
  29136. 0x1eee,
  29137. "Uhungarumlaut",
  29138. 0x0170,
  29139. "Uhungarumlautcyrillic",
  29140. 0x04f2,
  29141. "Uinvertedbreve",
  29142. 0x0216,
  29143. "Ukcyrillic",
  29144. 0x0478,
  29145. "Umacron",
  29146. 0x016a,
  29147. "Umacroncyrillic",
  29148. 0x04ee,
  29149. "Umacrondieresis",
  29150. 0x1e7a,
  29151. "Umonospace",
  29152. 0xff35,
  29153. "Uogonek",
  29154. 0x0172,
  29155. "Upsilon",
  29156. 0x03a5,
  29157. "Upsilon1",
  29158. 0x03d2,
  29159. "Upsilonacutehooksymbolgreek",
  29160. 0x03d3,
  29161. "Upsilonafrican",
  29162. 0x01b1,
  29163. "Upsilondieresis",
  29164. 0x03ab,
  29165. "Upsilondieresishooksymbolgreek",
  29166. 0x03d4,
  29167. "Upsilonhooksymbol",
  29168. 0x03d2,
  29169. "Upsilontonos",
  29170. 0x038e,
  29171. "Uring",
  29172. 0x016e,
  29173. "Ushortcyrillic",
  29174. 0x040e,
  29175. "Usmall",
  29176. 0xf775,
  29177. "Ustraightcyrillic",
  29178. 0x04ae,
  29179. "Ustraightstrokecyrillic",
  29180. 0x04b0,
  29181. "Utilde",
  29182. 0x0168,
  29183. "Utildeacute",
  29184. 0x1e78,
  29185. "Utildebelow",
  29186. 0x1e74,
  29187. "V",
  29188. 0x0056,
  29189. "Vcircle",
  29190. 0x24cb,
  29191. "Vdotbelow",
  29192. 0x1e7e,
  29193. "Vecyrillic",
  29194. 0x0412,
  29195. "Vewarmenian",
  29196. 0x054e,
  29197. "Vhook",
  29198. 0x01b2,
  29199. "Vmonospace",
  29200. 0xff36,
  29201. "Voarmenian",
  29202. 0x0548,
  29203. "Vsmall",
  29204. 0xf776,
  29205. "Vtilde",
  29206. 0x1e7c,
  29207. "W",
  29208. 0x0057,
  29209. "Wacute",
  29210. 0x1e82,
  29211. "Wcircle",
  29212. 0x24cc,
  29213. "Wcircumflex",
  29214. 0x0174,
  29215. "Wdieresis",
  29216. 0x1e84,
  29217. "Wdotaccent",
  29218. 0x1e86,
  29219. "Wdotbelow",
  29220. 0x1e88,
  29221. "Wgrave",
  29222. 0x1e80,
  29223. "Wmonospace",
  29224. 0xff37,
  29225. "Wsmall",
  29226. 0xf777,
  29227. "X",
  29228. 0x0058,
  29229. "Xcircle",
  29230. 0x24cd,
  29231. "Xdieresis",
  29232. 0x1e8c,
  29233. "Xdotaccent",
  29234. 0x1e8a,
  29235. "Xeharmenian",
  29236. 0x053d,
  29237. "Xi",
  29238. 0x039e,
  29239. "Xmonospace",
  29240. 0xff38,
  29241. "Xsmall",
  29242. 0xf778,
  29243. "Y",
  29244. 0x0059,
  29245. "Yacute",
  29246. 0x00dd,
  29247. "Yacutesmall",
  29248. 0xf7fd,
  29249. "Yatcyrillic",
  29250. 0x0462,
  29251. "Ycircle",
  29252. 0x24ce,
  29253. "Ycircumflex",
  29254. 0x0176,
  29255. "Ydieresis",
  29256. 0x0178,
  29257. "Ydieresissmall",
  29258. 0xf7ff,
  29259. "Ydotaccent",
  29260. 0x1e8e,
  29261. "Ydotbelow",
  29262. 0x1ef4,
  29263. "Yericyrillic",
  29264. 0x042b,
  29265. "Yerudieresiscyrillic",
  29266. 0x04f8,
  29267. "Ygrave",
  29268. 0x1ef2,
  29269. "Yhook",
  29270. 0x01b3,
  29271. "Yhookabove",
  29272. 0x1ef6,
  29273. "Yiarmenian",
  29274. 0x0545,
  29275. "Yicyrillic",
  29276. 0x0407,
  29277. "Yiwnarmenian",
  29278. 0x0552,
  29279. "Ymonospace",
  29280. 0xff39,
  29281. "Ysmall",
  29282. 0xf779,
  29283. "Ytilde",
  29284. 0x1ef8,
  29285. "Yusbigcyrillic",
  29286. 0x046a,
  29287. "Yusbigiotifiedcyrillic",
  29288. 0x046c,
  29289. "Yuslittlecyrillic",
  29290. 0x0466,
  29291. "Yuslittleiotifiedcyrillic",
  29292. 0x0468,
  29293. "Z",
  29294. 0x005a,
  29295. "Zaarmenian",
  29296. 0x0536,
  29297. "Zacute",
  29298. 0x0179,
  29299. "Zcaron",
  29300. 0x017d,
  29301. "Zcaronsmall",
  29302. 0xf6ff,
  29303. "Zcircle",
  29304. 0x24cf,
  29305. "Zcircumflex",
  29306. 0x1e90,
  29307. "Zdot",
  29308. 0x017b,
  29309. "Zdotaccent",
  29310. 0x017b,
  29311. "Zdotbelow",
  29312. 0x1e92,
  29313. "Zecyrillic",
  29314. 0x0417,
  29315. "Zedescendercyrillic",
  29316. 0x0498,
  29317. "Zedieresiscyrillic",
  29318. 0x04de,
  29319. "Zeta",
  29320. 0x0396,
  29321. "Zhearmenian",
  29322. 0x053a,
  29323. "Zhebrevecyrillic",
  29324. 0x04c1,
  29325. "Zhecyrillic",
  29326. 0x0416,
  29327. "Zhedescendercyrillic",
  29328. 0x0496,
  29329. "Zhedieresiscyrillic",
  29330. 0x04dc,
  29331. "Zlinebelow",
  29332. 0x1e94,
  29333. "Zmonospace",
  29334. 0xff3a,
  29335. "Zsmall",
  29336. 0xf77a,
  29337. "Zstroke",
  29338. 0x01b5,
  29339. "a",
  29340. 0x0061,
  29341. "aabengali",
  29342. 0x0986,
  29343. "aacute",
  29344. 0x00e1,
  29345. "aadeva",
  29346. 0x0906,
  29347. "aagujarati",
  29348. 0x0a86,
  29349. "aagurmukhi",
  29350. 0x0a06,
  29351. "aamatragurmukhi",
  29352. 0x0a3e,
  29353. "aarusquare",
  29354. 0x3303,
  29355. "aavowelsignbengali",
  29356. 0x09be,
  29357. "aavowelsigndeva",
  29358. 0x093e,
  29359. "aavowelsigngujarati",
  29360. 0x0abe,
  29361. "abbreviationmarkarmenian",
  29362. 0x055f,
  29363. "abbreviationsigndeva",
  29364. 0x0970,
  29365. "abengali",
  29366. 0x0985,
  29367. "abopomofo",
  29368. 0x311a,
  29369. "abreve",
  29370. 0x0103,
  29371. "abreveacute",
  29372. 0x1eaf,
  29373. "abrevecyrillic",
  29374. 0x04d1,
  29375. "abrevedotbelow",
  29376. 0x1eb7,
  29377. "abrevegrave",
  29378. 0x1eb1,
  29379. "abrevehookabove",
  29380. 0x1eb3,
  29381. "abrevetilde",
  29382. 0x1eb5,
  29383. "acaron",
  29384. 0x01ce,
  29385. "acircle",
  29386. 0x24d0,
  29387. "acircumflex",
  29388. 0x00e2,
  29389. "acircumflexacute",
  29390. 0x1ea5,
  29391. "acircumflexdotbelow",
  29392. 0x1ead,
  29393. "acircumflexgrave",
  29394. 0x1ea7,
  29395. "acircumflexhookabove",
  29396. 0x1ea9,
  29397. "acircumflextilde",
  29398. 0x1eab,
  29399. "acute",
  29400. 0x00b4,
  29401. "acutebelowcmb",
  29402. 0x0317,
  29403. "acutecmb",
  29404. 0x0301,
  29405. "acutecomb",
  29406. 0x0301,
  29407. "acutedeva",
  29408. 0x0954,
  29409. "acutelowmod",
  29410. 0x02cf,
  29411. "acutetonecmb",
  29412. 0x0341,
  29413. "acyrillic",
  29414. 0x0430,
  29415. "adblgrave",
  29416. 0x0201,
  29417. "addakgurmukhi",
  29418. 0x0a71,
  29419. "adeva",
  29420. 0x0905,
  29421. "adieresis",
  29422. 0x00e4,
  29423. "adieresiscyrillic",
  29424. 0x04d3,
  29425. "adieresismacron",
  29426. 0x01df,
  29427. "adotbelow",
  29428. 0x1ea1,
  29429. "adotmacron",
  29430. 0x01e1,
  29431. "ae",
  29432. 0x00e6,
  29433. "aeacute",
  29434. 0x01fd,
  29435. "aekorean",
  29436. 0x3150,
  29437. "aemacron",
  29438. 0x01e3,
  29439. "afii00208",
  29440. 0x2015,
  29441. "afii08941",
  29442. 0x20a4,
  29443. "afii10017",
  29444. 0x0410,
  29445. "afii10018",
  29446. 0x0411,
  29447. "afii10019",
  29448. 0x0412,
  29449. "afii10020",
  29450. 0x0413,
  29451. "afii10021",
  29452. 0x0414,
  29453. "afii10022",
  29454. 0x0415,
  29455. "afii10023",
  29456. 0x0401,
  29457. "afii10024",
  29458. 0x0416,
  29459. "afii10025",
  29460. 0x0417,
  29461. "afii10026",
  29462. 0x0418,
  29463. "afii10027",
  29464. 0x0419,
  29465. "afii10028",
  29466. 0x041a,
  29467. "afii10029",
  29468. 0x041b,
  29469. "afii10030",
  29470. 0x041c,
  29471. "afii10031",
  29472. 0x041d,
  29473. "afii10032",
  29474. 0x041e,
  29475. "afii10033",
  29476. 0x041f,
  29477. "afii10034",
  29478. 0x0420,
  29479. "afii10035",
  29480. 0x0421,
  29481. "afii10036",
  29482. 0x0422,
  29483. "afii10037",
  29484. 0x0423,
  29485. "afii10038",
  29486. 0x0424,
  29487. "afii10039",
  29488. 0x0425,
  29489. "afii10040",
  29490. 0x0426,
  29491. "afii10041",
  29492. 0x0427,
  29493. "afii10042",
  29494. 0x0428,
  29495. "afii10043",
  29496. 0x0429,
  29497. "afii10044",
  29498. 0x042a,
  29499. "afii10045",
  29500. 0x042b,
  29501. "afii10046",
  29502. 0x042c,
  29503. "afii10047",
  29504. 0x042d,
  29505. "afii10048",
  29506. 0x042e,
  29507. "afii10049",
  29508. 0x042f,
  29509. "afii10050",
  29510. 0x0490,
  29511. "afii10051",
  29512. 0x0402,
  29513. "afii10052",
  29514. 0x0403,
  29515. "afii10053",
  29516. 0x0404,
  29517. "afii10054",
  29518. 0x0405,
  29519. "afii10055",
  29520. 0x0406,
  29521. "afii10056",
  29522. 0x0407,
  29523. "afii10057",
  29524. 0x0408,
  29525. "afii10058",
  29526. 0x0409,
  29527. "afii10059",
  29528. 0x040a,
  29529. "afii10060",
  29530. 0x040b,
  29531. "afii10061",
  29532. 0x040c,
  29533. "afii10062",
  29534. 0x040e,
  29535. "afii10063",
  29536. 0xf6c4,
  29537. "afii10064",
  29538. 0xf6c5,
  29539. "afii10065",
  29540. 0x0430,
  29541. "afii10066",
  29542. 0x0431,
  29543. "afii10067",
  29544. 0x0432,
  29545. "afii10068",
  29546. 0x0433,
  29547. "afii10069",
  29548. 0x0434,
  29549. "afii10070",
  29550. 0x0435,
  29551. "afii10071",
  29552. 0x0451,
  29553. "afii10072",
  29554. 0x0436,
  29555. "afii10073",
  29556. 0x0437,
  29557. "afii10074",
  29558. 0x0438,
  29559. "afii10075",
  29560. 0x0439,
  29561. "afii10076",
  29562. 0x043a,
  29563. "afii10077",
  29564. 0x043b,
  29565. "afii10078",
  29566. 0x043c,
  29567. "afii10079",
  29568. 0x043d,
  29569. "afii10080",
  29570. 0x043e,
  29571. "afii10081",
  29572. 0x043f,
  29573. "afii10082",
  29574. 0x0440,
  29575. "afii10083",
  29576. 0x0441,
  29577. "afii10084",
  29578. 0x0442,
  29579. "afii10085",
  29580. 0x0443,
  29581. "afii10086",
  29582. 0x0444,
  29583. "afii10087",
  29584. 0x0445,
  29585. "afii10088",
  29586. 0x0446,
  29587. "afii10089",
  29588. 0x0447,
  29589. "afii10090",
  29590. 0x0448,
  29591. "afii10091",
  29592. 0x0449,
  29593. "afii10092",
  29594. 0x044a,
  29595. "afii10093",
  29596. 0x044b,
  29597. "afii10094",
  29598. 0x044c,
  29599. "afii10095",
  29600. 0x044d,
  29601. "afii10096",
  29602. 0x044e,
  29603. "afii10097",
  29604. 0x044f,
  29605. "afii10098",
  29606. 0x0491,
  29607. "afii10099",
  29608. 0x0452,
  29609. "afii10100",
  29610. 0x0453,
  29611. "afii10101",
  29612. 0x0454,
  29613. "afii10102",
  29614. 0x0455,
  29615. "afii10103",
  29616. 0x0456,
  29617. "afii10104",
  29618. 0x0457,
  29619. "afii10105",
  29620. 0x0458,
  29621. "afii10106",
  29622. 0x0459,
  29623. "afii10107",
  29624. 0x045a,
  29625. "afii10108",
  29626. 0x045b,
  29627. "afii10109",
  29628. 0x045c,
  29629. "afii10110",
  29630. 0x045e,
  29631. "afii10145",
  29632. 0x040f,
  29633. "afii10146",
  29634. 0x0462,
  29635. "afii10147",
  29636. 0x0472,
  29637. "afii10148",
  29638. 0x0474,
  29639. "afii10192",
  29640. 0xf6c6,
  29641. "afii10193",
  29642. 0x045f,
  29643. "afii10194",
  29644. 0x0463,
  29645. "afii10195",
  29646. 0x0473,
  29647. "afii10196",
  29648. 0x0475,
  29649. "afii10831",
  29650. 0xf6c7,
  29651. "afii10832",
  29652. 0xf6c8,
  29653. "afii10846",
  29654. 0x04d9,
  29655. "afii299",
  29656. 0x200e,
  29657. "afii300",
  29658. 0x200f,
  29659. "afii301",
  29660. 0x200d,
  29661. "afii57381",
  29662. 0x066a,
  29663. "afii57388",
  29664. 0x060c,
  29665. "afii57392",
  29666. 0x0660,
  29667. "afii57393",
  29668. 0x0661,
  29669. "afii57394",
  29670. 0x0662,
  29671. "afii57395",
  29672. 0x0663,
  29673. "afii57396",
  29674. 0x0664,
  29675. "afii57397",
  29676. 0x0665,
  29677. "afii57398",
  29678. 0x0666,
  29679. "afii57399",
  29680. 0x0667,
  29681. "afii57400",
  29682. 0x0668,
  29683. "afii57401",
  29684. 0x0669,
  29685. "afii57403",
  29686. 0x061b,
  29687. "afii57407",
  29688. 0x061f,
  29689. "afii57409",
  29690. 0x0621,
  29691. "afii57410",
  29692. 0x0622,
  29693. "afii57411",
  29694. 0x0623,
  29695. "afii57412",
  29696. 0x0624,
  29697. "afii57413",
  29698. 0x0625,
  29699. "afii57414",
  29700. 0x0626,
  29701. "afii57415",
  29702. 0x0627,
  29703. "afii57416",
  29704. 0x0628,
  29705. "afii57417",
  29706. 0x0629,
  29707. "afii57418",
  29708. 0x062a,
  29709. "afii57419",
  29710. 0x062b,
  29711. "afii57420",
  29712. 0x062c,
  29713. "afii57421",
  29714. 0x062d,
  29715. "afii57422",
  29716. 0x062e,
  29717. "afii57423",
  29718. 0x062f,
  29719. "afii57424",
  29720. 0x0630,
  29721. "afii57425",
  29722. 0x0631,
  29723. "afii57426",
  29724. 0x0632,
  29725. "afii57427",
  29726. 0x0633,
  29727. "afii57428",
  29728. 0x0634,
  29729. "afii57429",
  29730. 0x0635,
  29731. "afii57430",
  29732. 0x0636,
  29733. "afii57431",
  29734. 0x0637,
  29735. "afii57432",
  29736. 0x0638,
  29737. "afii57433",
  29738. 0x0639,
  29739. "afii57434",
  29740. 0x063a,
  29741. "afii57440",
  29742. 0x0640,
  29743. "afii57441",
  29744. 0x0641,
  29745. "afii57442",
  29746. 0x0642,
  29747. "afii57443",
  29748. 0x0643,
  29749. "afii57444",
  29750. 0x0644,
  29751. "afii57445",
  29752. 0x0645,
  29753. "afii57446",
  29754. 0x0646,
  29755. "afii57448",
  29756. 0x0648,
  29757. "afii57449",
  29758. 0x0649,
  29759. "afii57450",
  29760. 0x064a,
  29761. "afii57451",
  29762. 0x064b,
  29763. "afii57452",
  29764. 0x064c,
  29765. "afii57453",
  29766. 0x064d,
  29767. "afii57454",
  29768. 0x064e,
  29769. "afii57455",
  29770. 0x064f,
  29771. "afii57456",
  29772. 0x0650,
  29773. "afii57457",
  29774. 0x0651,
  29775. "afii57458",
  29776. 0x0652,
  29777. "afii57470",
  29778. 0x0647,
  29779. "afii57505",
  29780. 0x06a4,
  29781. "afii57506",
  29782. 0x067e,
  29783. "afii57507",
  29784. 0x0686,
  29785. "afii57508",
  29786. 0x0698,
  29787. "afii57509",
  29788. 0x06af,
  29789. "afii57511",
  29790. 0x0679,
  29791. "afii57512",
  29792. 0x0688,
  29793. "afii57513",
  29794. 0x0691,
  29795. "afii57514",
  29796. 0x06ba,
  29797. "afii57519",
  29798. 0x06d2,
  29799. "afii57534",
  29800. 0x06d5,
  29801. "afii57636",
  29802. 0x20aa,
  29803. "afii57645",
  29804. 0x05be,
  29805. "afii57658",
  29806. 0x05c3,
  29807. "afii57664",
  29808. 0x05d0,
  29809. "afii57665",
  29810. 0x05d1,
  29811. "afii57666",
  29812. 0x05d2,
  29813. "afii57667",
  29814. 0x05d3,
  29815. "afii57668",
  29816. 0x05d4,
  29817. "afii57669",
  29818. 0x05d5,
  29819. "afii57670",
  29820. 0x05d6,
  29821. "afii57671",
  29822. 0x05d7,
  29823. "afii57672",
  29824. 0x05d8,
  29825. "afii57673",
  29826. 0x05d9,
  29827. "afii57674",
  29828. 0x05da,
  29829. "afii57675",
  29830. 0x05db,
  29831. "afii57676",
  29832. 0x05dc,
  29833. "afii57677",
  29834. 0x05dd,
  29835. "afii57678",
  29836. 0x05de,
  29837. "afii57679",
  29838. 0x05df,
  29839. "afii57680",
  29840. 0x05e0,
  29841. "afii57681",
  29842. 0x05e1,
  29843. "afii57682",
  29844. 0x05e2,
  29845. "afii57683",
  29846. 0x05e3,
  29847. "afii57684",
  29848. 0x05e4,
  29849. "afii57685",
  29850. 0x05e5,
  29851. "afii57686",
  29852. 0x05e6,
  29853. "afii57687",
  29854. 0x05e7,
  29855. "afii57688",
  29856. 0x05e8,
  29857. "afii57689",
  29858. 0x05e9,
  29859. "afii57690",
  29860. 0x05ea,
  29861. "afii57694",
  29862. 0xfb2a,
  29863. "afii57695",
  29864. 0xfb2b,
  29865. "afii57700",
  29866. 0xfb4b,
  29867. "afii57705",
  29868. 0xfb1f,
  29869. "afii57716",
  29870. 0x05f0,
  29871. "afii57717",
  29872. 0x05f1,
  29873. "afii57718",
  29874. 0x05f2,
  29875. "afii57723",
  29876. 0xfb35,
  29877. "afii57793",
  29878. 0x05b4,
  29879. "afii57794",
  29880. 0x05b5,
  29881. "afii57795",
  29882. 0x05b6,
  29883. "afii57796",
  29884. 0x05bb,
  29885. "afii57797",
  29886. 0x05b8,
  29887. "afii57798",
  29888. 0x05b7,
  29889. "afii57799",
  29890. 0x05b0,
  29891. "afii57800",
  29892. 0x05b2,
  29893. "afii57801",
  29894. 0x05b1,
  29895. "afii57802",
  29896. 0x05b3,
  29897. "afii57803",
  29898. 0x05c2,
  29899. "afii57804",
  29900. 0x05c1,
  29901. "afii57806",
  29902. 0x05b9,
  29903. "afii57807",
  29904. 0x05bc,
  29905. "afii57839",
  29906. 0x05bd,
  29907. "afii57841",
  29908. 0x05bf,
  29909. "afii57842",
  29910. 0x05c0,
  29911. "afii57929",
  29912. 0x02bc,
  29913. "afii61248",
  29914. 0x2105,
  29915. "afii61289",
  29916. 0x2113,
  29917. "afii61352",
  29918. 0x2116,
  29919. "afii61573",
  29920. 0x202c,
  29921. "afii61574",
  29922. 0x202d,
  29923. "afii61575",
  29924. 0x202e,
  29925. "afii61664",
  29926. 0x200c,
  29927. "afii63167",
  29928. 0x066d,
  29929. "afii64937",
  29930. 0x02bd,
  29931. "agrave",
  29932. 0x00e0,
  29933. "agujarati",
  29934. 0x0a85,
  29935. "agurmukhi",
  29936. 0x0a05,
  29937. "ahiragana",
  29938. 0x3042,
  29939. "ahookabove",
  29940. 0x1ea3,
  29941. "aibengali",
  29942. 0x0990,
  29943. "aibopomofo",
  29944. 0x311e,
  29945. "aideva",
  29946. 0x0910,
  29947. "aiecyrillic",
  29948. 0x04d5,
  29949. "aigujarati",
  29950. 0x0a90,
  29951. "aigurmukhi",
  29952. 0x0a10,
  29953. "aimatragurmukhi",
  29954. 0x0a48,
  29955. "ainarabic",
  29956. 0x0639,
  29957. "ainfinalarabic",
  29958. 0xfeca,
  29959. "aininitialarabic",
  29960. 0xfecb,
  29961. "ainmedialarabic",
  29962. 0xfecc,
  29963. "ainvertedbreve",
  29964. 0x0203,
  29965. "aivowelsignbengali",
  29966. 0x09c8,
  29967. "aivowelsigndeva",
  29968. 0x0948,
  29969. "aivowelsigngujarati",
  29970. 0x0ac8,
  29971. "akatakana",
  29972. 0x30a2,
  29973. "akatakanahalfwidth",
  29974. 0xff71,
  29975. "akorean",
  29976. 0x314f,
  29977. "alef",
  29978. 0x05d0,
  29979. "alefarabic",
  29980. 0x0627,
  29981. "alefdageshhebrew",
  29982. 0xfb30,
  29983. "aleffinalarabic",
  29984. 0xfe8e,
  29985. "alefhamzaabovearabic",
  29986. 0x0623,
  29987. "alefhamzaabovefinalarabic",
  29988. 0xfe84,
  29989. "alefhamzabelowarabic",
  29990. 0x0625,
  29991. "alefhamzabelowfinalarabic",
  29992. 0xfe88,
  29993. "alefhebrew",
  29994. 0x05d0,
  29995. "aleflamedhebrew",
  29996. 0xfb4f,
  29997. "alefmaddaabovearabic",
  29998. 0x0622,
  29999. "alefmaddaabovefinalarabic",
  30000. 0xfe82,
  30001. "alefmaksuraarabic",
  30002. 0x0649,
  30003. "alefmaksurafinalarabic",
  30004. 0xfef0,
  30005. "alefmaksurainitialarabic",
  30006. 0xfef3,
  30007. "alefmaksuramedialarabic",
  30008. 0xfef4,
  30009. "alefpatahhebrew",
  30010. 0xfb2e,
  30011. "alefqamatshebrew",
  30012. 0xfb2f,
  30013. "aleph",
  30014. 0x2135,
  30015. "allequal",
  30016. 0x224c,
  30017. "alpha",
  30018. 0x03b1,
  30019. "alphatonos",
  30020. 0x03ac,
  30021. "amacron",
  30022. 0x0101,
  30023. "amonospace",
  30024. 0xff41,
  30025. "ampersand",
  30026. 0x0026,
  30027. "ampersandmonospace",
  30028. 0xff06,
  30029. "ampersandsmall",
  30030. 0xf726,
  30031. "amsquare",
  30032. 0x33c2,
  30033. "anbopomofo",
  30034. 0x3122,
  30035. "angbopomofo",
  30036. 0x3124,
  30037. "angbracketleft",
  30038. 0x3008,
  30039. "angbracketright",
  30040. 0x3009,
  30041. "angkhankhuthai",
  30042. 0x0e5a,
  30043. "angle",
  30044. 0x2220,
  30045. "anglebracketleft",
  30046. 0x3008,
  30047. "anglebracketleftvertical",
  30048. 0xfe3f,
  30049. "anglebracketright",
  30050. 0x3009,
  30051. "anglebracketrightvertical",
  30052. 0xfe40,
  30053. "angleleft",
  30054. 0x2329,
  30055. "angleright",
  30056. 0x232a,
  30057. "angstrom",
  30058. 0x212b,
  30059. "anoteleia",
  30060. 0x0387,
  30061. "anudattadeva",
  30062. 0x0952,
  30063. "anusvarabengali",
  30064. 0x0982,
  30065. "anusvaradeva",
  30066. 0x0902,
  30067. "anusvaragujarati",
  30068. 0x0a82,
  30069. "aogonek",
  30070. 0x0105,
  30071. "apaatosquare",
  30072. 0x3300,
  30073. "aparen",
  30074. 0x249c,
  30075. "apostrophearmenian",
  30076. 0x055a,
  30077. "apostrophemod",
  30078. 0x02bc,
  30079. "apple",
  30080. 0xf8ff,
  30081. "approaches",
  30082. 0x2250,
  30083. "approxequal",
  30084. 0x2248,
  30085. "approxequalorimage",
  30086. 0x2252,
  30087. "approximatelyequal",
  30088. 0x2245,
  30089. "araeaekorean",
  30090. 0x318e,
  30091. "araeakorean",
  30092. 0x318d,
  30093. "arc",
  30094. 0x2312,
  30095. "arighthalfring",
  30096. 0x1e9a,
  30097. "aring",
  30098. 0x00e5,
  30099. "aringacute",
  30100. 0x01fb,
  30101. "aringbelow",
  30102. 0x1e01,
  30103. "arrowboth",
  30104. 0x2194,
  30105. "arrowdashdown",
  30106. 0x21e3,
  30107. "arrowdashleft",
  30108. 0x21e0,
  30109. "arrowdashright",
  30110. 0x21e2,
  30111. "arrowdashup",
  30112. 0x21e1,
  30113. "arrowdblboth",
  30114. 0x21d4,
  30115. "arrowdbldown",
  30116. 0x21d3,
  30117. "arrowdblleft",
  30118. 0x21d0,
  30119. "arrowdblright",
  30120. 0x21d2,
  30121. "arrowdblup",
  30122. 0x21d1,
  30123. "arrowdown",
  30124. 0x2193,
  30125. "arrowdownleft",
  30126. 0x2199,
  30127. "arrowdownright",
  30128. 0x2198,
  30129. "arrowdownwhite",
  30130. 0x21e9,
  30131. "arrowheaddownmod",
  30132. 0x02c5,
  30133. "arrowheadleftmod",
  30134. 0x02c2,
  30135. "arrowheadrightmod",
  30136. 0x02c3,
  30137. "arrowheadupmod",
  30138. 0x02c4,
  30139. "arrowhorizex",
  30140. 0xf8e7,
  30141. "arrowleft",
  30142. 0x2190,
  30143. "arrowleftdbl",
  30144. 0x21d0,
  30145. "arrowleftdblstroke",
  30146. 0x21cd,
  30147. "arrowleftoverright",
  30148. 0x21c6,
  30149. "arrowleftwhite",
  30150. 0x21e6,
  30151. "arrowright",
  30152. 0x2192,
  30153. "arrowrightdblstroke",
  30154. 0x21cf,
  30155. "arrowrightheavy",
  30156. 0x279e,
  30157. "arrowrightoverleft",
  30158. 0x21c4,
  30159. "arrowrightwhite",
  30160. 0x21e8,
  30161. "arrowtableft",
  30162. 0x21e4,
  30163. "arrowtabright",
  30164. 0x21e5,
  30165. "arrowup",
  30166. 0x2191,
  30167. "arrowupdn",
  30168. 0x2195,
  30169. "arrowupdnbse",
  30170. 0x21a8,
  30171. "arrowupdownbase",
  30172. 0x21a8,
  30173. "arrowupleft",
  30174. 0x2196,
  30175. "arrowupleftofdown",
  30176. 0x21c5,
  30177. "arrowupright",
  30178. 0x2197,
  30179. "arrowupwhite",
  30180. 0x21e7,
  30181. "arrowvertex",
  30182. 0xf8e6,
  30183. "asciicircum",
  30184. 0x005e,
  30185. "asciicircummonospace",
  30186. 0xff3e,
  30187. "asciitilde",
  30188. 0x007e,
  30189. "asciitildemonospace",
  30190. 0xff5e,
  30191. "ascript",
  30192. 0x0251,
  30193. "ascriptturned",
  30194. 0x0252,
  30195. "asmallhiragana",
  30196. 0x3041,
  30197. "asmallkatakana",
  30198. 0x30a1,
  30199. "asmallkatakanahalfwidth",
  30200. 0xff67,
  30201. "asterisk",
  30202. 0x002a,
  30203. "asteriskaltonearabic",
  30204. 0x066d,
  30205. "asteriskarabic",
  30206. 0x066d,
  30207. "asteriskmath",
  30208. 0x2217,
  30209. "asteriskmonospace",
  30210. 0xff0a,
  30211. "asterisksmall",
  30212. 0xfe61,
  30213. "asterism",
  30214. 0x2042,
  30215. "asuperior",
  30216. 0xf6e9,
  30217. "asymptoticallyequal",
  30218. 0x2243,
  30219. "at",
  30220. 0x0040,
  30221. "atilde",
  30222. 0x00e3,
  30223. "atmonospace",
  30224. 0xff20,
  30225. "atsmall",
  30226. 0xfe6b,
  30227. "aturned",
  30228. 0x0250,
  30229. "aubengali",
  30230. 0x0994,
  30231. "aubopomofo",
  30232. 0x3120,
  30233. "audeva",
  30234. 0x0914,
  30235. "augujarati",
  30236. 0x0a94,
  30237. "augurmukhi",
  30238. 0x0a14,
  30239. "aulengthmarkbengali",
  30240. 0x09d7,
  30241. "aumatragurmukhi",
  30242. 0x0a4c,
  30243. "auvowelsignbengali",
  30244. 0x09cc,
  30245. "auvowelsigndeva",
  30246. 0x094c,
  30247. "auvowelsigngujarati",
  30248. 0x0acc,
  30249. "avagrahadeva",
  30250. 0x093d,
  30251. "aybarmenian",
  30252. 0x0561,
  30253. "ayin",
  30254. 0x05e2,
  30255. "ayinaltonehebrew",
  30256. 0xfb20,
  30257. "ayinhebrew",
  30258. 0x05e2,
  30259. "b",
  30260. 0x0062,
  30261. "babengali",
  30262. 0x09ac,
  30263. "backslash",
  30264. 0x005c,
  30265. "backslashmonospace",
  30266. 0xff3c,
  30267. "badeva",
  30268. 0x092c,
  30269. "bagujarati",
  30270. 0x0aac,
  30271. "bagurmukhi",
  30272. 0x0a2c,
  30273. "bahiragana",
  30274. 0x3070,
  30275. "bahtthai",
  30276. 0x0e3f,
  30277. "bakatakana",
  30278. 0x30d0,
  30279. "bar",
  30280. 0x007c,
  30281. "barmonospace",
  30282. 0xff5c,
  30283. "bbopomofo",
  30284. 0x3105,
  30285. "bcircle",
  30286. 0x24d1,
  30287. "bdotaccent",
  30288. 0x1e03,
  30289. "bdotbelow",
  30290. 0x1e05,
  30291. "beamedsixteenthnotes",
  30292. 0x266c,
  30293. "because",
  30294. 0x2235,
  30295. "becyrillic",
  30296. 0x0431,
  30297. "beharabic",
  30298. 0x0628,
  30299. "behfinalarabic",
  30300. 0xfe90,
  30301. "behinitialarabic",
  30302. 0xfe91,
  30303. "behiragana",
  30304. 0x3079,
  30305. "behmedialarabic",
  30306. 0xfe92,
  30307. "behmeeminitialarabic",
  30308. 0xfc9f,
  30309. "behmeemisolatedarabic",
  30310. 0xfc08,
  30311. "behnoonfinalarabic",
  30312. 0xfc6d,
  30313. "bekatakana",
  30314. 0x30d9,
  30315. "benarmenian",
  30316. 0x0562,
  30317. "bet",
  30318. 0x05d1,
  30319. "beta",
  30320. 0x03b2,
  30321. "betasymbolgreek",
  30322. 0x03d0,
  30323. "betdagesh",
  30324. 0xfb31,
  30325. "betdageshhebrew",
  30326. 0xfb31,
  30327. "bethebrew",
  30328. 0x05d1,
  30329. "betrafehebrew",
  30330. 0xfb4c,
  30331. "bhabengali",
  30332. 0x09ad,
  30333. "bhadeva",
  30334. 0x092d,
  30335. "bhagujarati",
  30336. 0x0aad,
  30337. "bhagurmukhi",
  30338. 0x0a2d,
  30339. "bhook",
  30340. 0x0253,
  30341. "bihiragana",
  30342. 0x3073,
  30343. "bikatakana",
  30344. 0x30d3,
  30345. "bilabialclick",
  30346. 0x0298,
  30347. "bindigurmukhi",
  30348. 0x0a02,
  30349. "birusquare",
  30350. 0x3331,
  30351. "blackcircle",
  30352. 0x25cf,
  30353. "blackdiamond",
  30354. 0x25c6,
  30355. "blackdownpointingtriangle",
  30356. 0x25bc,
  30357. "blackleftpointingpointer",
  30358. 0x25c4,
  30359. "blackleftpointingtriangle",
  30360. 0x25c0,
  30361. "blacklenticularbracketleft",
  30362. 0x3010,
  30363. "blacklenticularbracketleftvertical",
  30364. 0xfe3b,
  30365. "blacklenticularbracketright",
  30366. 0x3011,
  30367. "blacklenticularbracketrightvertical",
  30368. 0xfe3c,
  30369. "blacklowerlefttriangle",
  30370. 0x25e3,
  30371. "blacklowerrighttriangle",
  30372. 0x25e2,
  30373. "blackrectangle",
  30374. 0x25ac,
  30375. "blackrightpointingpointer",
  30376. 0x25ba,
  30377. "blackrightpointingtriangle",
  30378. 0x25b6,
  30379. "blacksmallsquare",
  30380. 0x25aa,
  30381. "blacksmilingface",
  30382. 0x263b,
  30383. "blacksquare",
  30384. 0x25a0,
  30385. "blackstar",
  30386. 0x2605,
  30387. "blackupperlefttriangle",
  30388. 0x25e4,
  30389. "blackupperrighttriangle",
  30390. 0x25e5,
  30391. "blackuppointingsmalltriangle",
  30392. 0x25b4,
  30393. "blackuppointingtriangle",
  30394. 0x25b2,
  30395. "blank",
  30396. 0x2423,
  30397. "blinebelow",
  30398. 0x1e07,
  30399. "block",
  30400. 0x2588,
  30401. "bmonospace",
  30402. 0xff42,
  30403. "bobaimaithai",
  30404. 0x0e1a,
  30405. "bohiragana",
  30406. 0x307c,
  30407. "bokatakana",
  30408. 0x30dc,
  30409. "bparen",
  30410. 0x249d,
  30411. "bqsquare",
  30412. 0x33c3,
  30413. "braceex",
  30414. 0xf8f4,
  30415. "braceleft",
  30416. 0x007b,
  30417. "braceleftbt",
  30418. 0xf8f3,
  30419. "braceleftmid",
  30420. 0xf8f2,
  30421. "braceleftmonospace",
  30422. 0xff5b,
  30423. "braceleftsmall",
  30424. 0xfe5b,
  30425. "bracelefttp",
  30426. 0xf8f1,
  30427. "braceleftvertical",
  30428. 0xfe37,
  30429. "braceright",
  30430. 0x007d,
  30431. "bracerightbt",
  30432. 0xf8fe,
  30433. "bracerightmid",
  30434. 0xf8fd,
  30435. "bracerightmonospace",
  30436. 0xff5d,
  30437. "bracerightsmall",
  30438. 0xfe5c,
  30439. "bracerighttp",
  30440. 0xf8fc,
  30441. "bracerightvertical",
  30442. 0xfe38,
  30443. "bracketleft",
  30444. 0x005b,
  30445. "bracketleftbt",
  30446. 0xf8f0,
  30447. "bracketleftex",
  30448. 0xf8ef,
  30449. "bracketleftmonospace",
  30450. 0xff3b,
  30451. "bracketlefttp",
  30452. 0xf8ee,
  30453. "bracketright",
  30454. 0x005d,
  30455. "bracketrightbt",
  30456. 0xf8fb,
  30457. "bracketrightex",
  30458. 0xf8fa,
  30459. "bracketrightmonospace",
  30460. 0xff3d,
  30461. "bracketrighttp",
  30462. 0xf8f9,
  30463. "breve",
  30464. 0x02d8,
  30465. "brevebelowcmb",
  30466. 0x032e,
  30467. "brevecmb",
  30468. 0x0306,
  30469. "breveinvertedbelowcmb",
  30470. 0x032f,
  30471. "breveinvertedcmb",
  30472. 0x0311,
  30473. "breveinverteddoublecmb",
  30474. 0x0361,
  30475. "bridgebelowcmb",
  30476. 0x032a,
  30477. "bridgeinvertedbelowcmb",
  30478. 0x033a,
  30479. "brokenbar",
  30480. 0x00a6,
  30481. "bstroke",
  30482. 0x0180,
  30483. "bsuperior",
  30484. 0xf6ea,
  30485. "btopbar",
  30486. 0x0183,
  30487. "buhiragana",
  30488. 0x3076,
  30489. "bukatakana",
  30490. 0x30d6,
  30491. "bullet",
  30492. 0x2022,
  30493. "bulletinverse",
  30494. 0x25d8,
  30495. "bulletoperator",
  30496. 0x2219,
  30497. "bullseye",
  30498. 0x25ce,
  30499. "c",
  30500. 0x0063,
  30501. "caarmenian",
  30502. 0x056e,
  30503. "cabengali",
  30504. 0x099a,
  30505. "cacute",
  30506. 0x0107,
  30507. "cadeva",
  30508. 0x091a,
  30509. "cagujarati",
  30510. 0x0a9a,
  30511. "cagurmukhi",
  30512. 0x0a1a,
  30513. "calsquare",
  30514. 0x3388,
  30515. "candrabindubengali",
  30516. 0x0981,
  30517. "candrabinducmb",
  30518. 0x0310,
  30519. "candrabindudeva",
  30520. 0x0901,
  30521. "candrabindugujarati",
  30522. 0x0a81,
  30523. "capslock",
  30524. 0x21ea,
  30525. "careof",
  30526. 0x2105,
  30527. "caron",
  30528. 0x02c7,
  30529. "caronbelowcmb",
  30530. 0x032c,
  30531. "caroncmb",
  30532. 0x030c,
  30533. "carriagereturn",
  30534. 0x21b5,
  30535. "cbopomofo",
  30536. 0x3118,
  30537. "ccaron",
  30538. 0x010d,
  30539. "ccedilla",
  30540. 0x00e7,
  30541. "ccedillaacute",
  30542. 0x1e09,
  30543. "ccircle",
  30544. 0x24d2,
  30545. "ccircumflex",
  30546. 0x0109,
  30547. "ccurl",
  30548. 0x0255,
  30549. "cdot",
  30550. 0x010b,
  30551. "cdotaccent",
  30552. 0x010b,
  30553. "cdsquare",
  30554. 0x33c5,
  30555. "cedilla",
  30556. 0x00b8,
  30557. "cedillacmb",
  30558. 0x0327,
  30559. "cent",
  30560. 0x00a2,
  30561. "centigrade",
  30562. 0x2103,
  30563. "centinferior",
  30564. 0xf6df,
  30565. "centmonospace",
  30566. 0xffe0,
  30567. "centoldstyle",
  30568. 0xf7a2,
  30569. "centsuperior",
  30570. 0xf6e0,
  30571. "chaarmenian",
  30572. 0x0579,
  30573. "chabengali",
  30574. 0x099b,
  30575. "chadeva",
  30576. 0x091b,
  30577. "chagujarati",
  30578. 0x0a9b,
  30579. "chagurmukhi",
  30580. 0x0a1b,
  30581. "chbopomofo",
  30582. 0x3114,
  30583. "cheabkhasiancyrillic",
  30584. 0x04bd,
  30585. "checkmark",
  30586. 0x2713,
  30587. "checyrillic",
  30588. 0x0447,
  30589. "chedescenderabkhasiancyrillic",
  30590. 0x04bf,
  30591. "chedescendercyrillic",
  30592. 0x04b7,
  30593. "chedieresiscyrillic",
  30594. 0x04f5,
  30595. "cheharmenian",
  30596. 0x0573,
  30597. "chekhakassiancyrillic",
  30598. 0x04cc,
  30599. "cheverticalstrokecyrillic",
  30600. 0x04b9,
  30601. "chi",
  30602. 0x03c7,
  30603. "chieuchacirclekorean",
  30604. 0x3277,
  30605. "chieuchaparenkorean",
  30606. 0x3217,
  30607. "chieuchcirclekorean",
  30608. 0x3269,
  30609. "chieuchkorean",
  30610. 0x314a,
  30611. "chieuchparenkorean",
  30612. 0x3209,
  30613. "chochangthai",
  30614. 0x0e0a,
  30615. "chochanthai",
  30616. 0x0e08,
  30617. "chochingthai",
  30618. 0x0e09,
  30619. "chochoethai",
  30620. 0x0e0c,
  30621. "chook",
  30622. 0x0188,
  30623. "cieucacirclekorean",
  30624. 0x3276,
  30625. "cieucaparenkorean",
  30626. 0x3216,
  30627. "cieuccirclekorean",
  30628. 0x3268,
  30629. "cieuckorean",
  30630. 0x3148,
  30631. "cieucparenkorean",
  30632. 0x3208,
  30633. "cieucuparenkorean",
  30634. 0x321c,
  30635. "circle",
  30636. 0x25cb,
  30637. "circlecopyrt",
  30638. 0x00a9,
  30639. "circlemultiply",
  30640. 0x2297,
  30641. "circleot",
  30642. 0x2299,
  30643. "circleplus",
  30644. 0x2295,
  30645. "circlepostalmark",
  30646. 0x3036,
  30647. "circlewithlefthalfblack",
  30648. 0x25d0,
  30649. "circlewithrighthalfblack",
  30650. 0x25d1,
  30651. "circumflex",
  30652. 0x02c6,
  30653. "circumflexbelowcmb",
  30654. 0x032d,
  30655. "circumflexcmb",
  30656. 0x0302,
  30657. "clear",
  30658. 0x2327,
  30659. "clickalveolar",
  30660. 0x01c2,
  30661. "clickdental",
  30662. 0x01c0,
  30663. "clicklateral",
  30664. 0x01c1,
  30665. "clickretroflex",
  30666. 0x01c3,
  30667. "club",
  30668. 0x2663,
  30669. "clubsuitblack",
  30670. 0x2663,
  30671. "clubsuitwhite",
  30672. 0x2667,
  30673. "cmcubedsquare",
  30674. 0x33a4,
  30675. "cmonospace",
  30676. 0xff43,
  30677. "cmsquaredsquare",
  30678. 0x33a0,
  30679. "coarmenian",
  30680. 0x0581,
  30681. "colon",
  30682. 0x003a,
  30683. "colonmonetary",
  30684. 0x20a1,
  30685. "colonmonospace",
  30686. 0xff1a,
  30687. "colonsign",
  30688. 0x20a1,
  30689. "colonsmall",
  30690. 0xfe55,
  30691. "colontriangularhalfmod",
  30692. 0x02d1,
  30693. "colontriangularmod",
  30694. 0x02d0,
  30695. "comma",
  30696. 0x002c,
  30697. "commaabovecmb",
  30698. 0x0313,
  30699. "commaaboverightcmb",
  30700. 0x0315,
  30701. "commaaccent",
  30702. 0xf6c3,
  30703. "commaarabic",
  30704. 0x060c,
  30705. "commaarmenian",
  30706. 0x055d,
  30707. "commainferior",
  30708. 0xf6e1,
  30709. "commamonospace",
  30710. 0xff0c,
  30711. "commareversedabovecmb",
  30712. 0x0314,
  30713. "commareversedmod",
  30714. 0x02bd,
  30715. "commasmall",
  30716. 0xfe50,
  30717. "commasuperior",
  30718. 0xf6e2,
  30719. "commaturnedabovecmb",
  30720. 0x0312,
  30721. "commaturnedmod",
  30722. 0x02bb,
  30723. "compass",
  30724. 0x263c,
  30725. "congruent",
  30726. 0x2245,
  30727. "contourintegral",
  30728. 0x222e,
  30729. "control",
  30730. 0x2303,
  30731. "controlACK",
  30732. 0x0006,
  30733. "controlBEL",
  30734. 0x0007,
  30735. "controlBS",
  30736. 0x0008,
  30737. "controlCAN",
  30738. 0x0018,
  30739. "controlCR",
  30740. 0x000d,
  30741. "controlDC1",
  30742. 0x0011,
  30743. "controlDC2",
  30744. 0x0012,
  30745. "controlDC3",
  30746. 0x0013,
  30747. "controlDC4",
  30748. 0x0014,
  30749. "controlDEL",
  30750. 0x007f,
  30751. "controlDLE",
  30752. 0x0010,
  30753. "controlEM",
  30754. 0x0019,
  30755. "controlENQ",
  30756. 0x0005,
  30757. "controlEOT",
  30758. 0x0004,
  30759. "controlESC",
  30760. 0x001b,
  30761. "controlETB",
  30762. 0x0017,
  30763. "controlETX",
  30764. 0x0003,
  30765. "controlFF",
  30766. 0x000c,
  30767. "controlFS",
  30768. 0x001c,
  30769. "controlGS",
  30770. 0x001d,
  30771. "controlHT",
  30772. 0x0009,
  30773. "controlLF",
  30774. 0x000a,
  30775. "controlNAK",
  30776. 0x0015,
  30777. "controlNULL",
  30778. 0x0000,
  30779. "controlRS",
  30780. 0x001e,
  30781. "controlSI",
  30782. 0x000f,
  30783. "controlSO",
  30784. 0x000e,
  30785. "controlSOT",
  30786. 0x0002,
  30787. "controlSTX",
  30788. 0x0001,
  30789. "controlSUB",
  30790. 0x001a,
  30791. "controlSYN",
  30792. 0x0016,
  30793. "controlUS",
  30794. 0x001f,
  30795. "controlVT",
  30796. 0x000b,
  30797. "copyright",
  30798. 0x00a9,
  30799. "copyrightsans",
  30800. 0xf8e9,
  30801. "copyrightserif",
  30802. 0xf6d9,
  30803. "cornerbracketleft",
  30804. 0x300c,
  30805. "cornerbracketlefthalfwidth",
  30806. 0xff62,
  30807. "cornerbracketleftvertical",
  30808. 0xfe41,
  30809. "cornerbracketright",
  30810. 0x300d,
  30811. "cornerbracketrighthalfwidth",
  30812. 0xff63,
  30813. "cornerbracketrightvertical",
  30814. 0xfe42,
  30815. "corporationsquare",
  30816. 0x337f,
  30817. "cosquare",
  30818. 0x33c7,
  30819. "coverkgsquare",
  30820. 0x33c6,
  30821. "cparen",
  30822. 0x249e,
  30823. "cruzeiro",
  30824. 0x20a2,
  30825. "cstretched",
  30826. 0x0297,
  30827. "curlyand",
  30828. 0x22cf,
  30829. "curlyor",
  30830. 0x22ce,
  30831. "currency",
  30832. 0x00a4,
  30833. "cyrBreve",
  30834. 0xf6d1,
  30835. "cyrFlex",
  30836. 0xf6d2,
  30837. "cyrbreve",
  30838. 0xf6d4,
  30839. "cyrflex",
  30840. 0xf6d5,
  30841. "d",
  30842. 0x0064,
  30843. "daarmenian",
  30844. 0x0564,
  30845. "dabengali",
  30846. 0x09a6,
  30847. "dadarabic",
  30848. 0x0636,
  30849. "dadeva",
  30850. 0x0926,
  30851. "dadfinalarabic",
  30852. 0xfebe,
  30853. "dadinitialarabic",
  30854. 0xfebf,
  30855. "dadmedialarabic",
  30856. 0xfec0,
  30857. "dagesh",
  30858. 0x05bc,
  30859. "dageshhebrew",
  30860. 0x05bc,
  30861. "dagger",
  30862. 0x2020,
  30863. "daggerdbl",
  30864. 0x2021,
  30865. "dagujarati",
  30866. 0x0aa6,
  30867. "dagurmukhi",
  30868. 0x0a26,
  30869. "dahiragana",
  30870. 0x3060,
  30871. "dakatakana",
  30872. 0x30c0,
  30873. "dalarabic",
  30874. 0x062f,
  30875. "dalet",
  30876. 0x05d3,
  30877. "daletdagesh",
  30878. 0xfb33,
  30879. "daletdageshhebrew",
  30880. 0xfb33,
  30881. "dalethebrew",
  30882. 0x05d3,
  30883. "dalfinalarabic",
  30884. 0xfeaa,
  30885. "dammaarabic",
  30886. 0x064f,
  30887. "dammalowarabic",
  30888. 0x064f,
  30889. "dammatanaltonearabic",
  30890. 0x064c,
  30891. "dammatanarabic",
  30892. 0x064c,
  30893. "danda",
  30894. 0x0964,
  30895. "dargahebrew",
  30896. 0x05a7,
  30897. "dargalefthebrew",
  30898. 0x05a7,
  30899. "dasiapneumatacyrilliccmb",
  30900. 0x0485,
  30901. "dblGrave",
  30902. 0xf6d3,
  30903. "dblanglebracketleft",
  30904. 0x300a,
  30905. "dblanglebracketleftvertical",
  30906. 0xfe3d,
  30907. "dblanglebracketright",
  30908. 0x300b,
  30909. "dblanglebracketrightvertical",
  30910. 0xfe3e,
  30911. "dblarchinvertedbelowcmb",
  30912. 0x032b,
  30913. "dblarrowleft",
  30914. 0x21d4,
  30915. "dblarrowright",
  30916. 0x21d2,
  30917. "dbldanda",
  30918. 0x0965,
  30919. "dblgrave",
  30920. 0xf6d6,
  30921. "dblgravecmb",
  30922. 0x030f,
  30923. "dblintegral",
  30924. 0x222c,
  30925. "dbllowline",
  30926. 0x2017,
  30927. "dbllowlinecmb",
  30928. 0x0333,
  30929. "dbloverlinecmb",
  30930. 0x033f,
  30931. "dblprimemod",
  30932. 0x02ba,
  30933. "dblverticalbar",
  30934. 0x2016,
  30935. "dblverticallineabovecmb",
  30936. 0x030e,
  30937. "dbopomofo",
  30938. 0x3109,
  30939. "dbsquare",
  30940. 0x33c8,
  30941. "dcaron",
  30942. 0x010f,
  30943. "dcedilla",
  30944. 0x1e11,
  30945. "dcircle",
  30946. 0x24d3,
  30947. "dcircumflexbelow",
  30948. 0x1e13,
  30949. "dcroat",
  30950. 0x0111,
  30951. "ddabengali",
  30952. 0x09a1,
  30953. "ddadeva",
  30954. 0x0921,
  30955. "ddagujarati",
  30956. 0x0aa1,
  30957. "ddagurmukhi",
  30958. 0x0a21,
  30959. "ddalarabic",
  30960. 0x0688,
  30961. "ddalfinalarabic",
  30962. 0xfb89,
  30963. "dddhadeva",
  30964. 0x095c,
  30965. "ddhabengali",
  30966. 0x09a2,
  30967. "ddhadeva",
  30968. 0x0922,
  30969. "ddhagujarati",
  30970. 0x0aa2,
  30971. "ddhagurmukhi",
  30972. 0x0a22,
  30973. "ddotaccent",
  30974. 0x1e0b,
  30975. "ddotbelow",
  30976. 0x1e0d,
  30977. "decimalseparatorarabic",
  30978. 0x066b,
  30979. "decimalseparatorpersian",
  30980. 0x066b,
  30981. "decyrillic",
  30982. 0x0434,
  30983. "degree",
  30984. 0x00b0,
  30985. "dehihebrew",
  30986. 0x05ad,
  30987. "dehiragana",
  30988. 0x3067,
  30989. "deicoptic",
  30990. 0x03ef,
  30991. "dekatakana",
  30992. 0x30c7,
  30993. "deleteleft",
  30994. 0x232b,
  30995. "deleteright",
  30996. 0x2326,
  30997. "delta",
  30998. 0x03b4,
  30999. "deltaturned",
  31000. 0x018d,
  31001. "denominatorminusonenumeratorbengali",
  31002. 0x09f8,
  31003. "dezh",
  31004. 0x02a4,
  31005. "dhabengali",
  31006. 0x09a7,
  31007. "dhadeva",
  31008. 0x0927,
  31009. "dhagujarati",
  31010. 0x0aa7,
  31011. "dhagurmukhi",
  31012. 0x0a27,
  31013. "dhook",
  31014. 0x0257,
  31015. "dialytikatonos",
  31016. 0x0385,
  31017. "dialytikatonoscmb",
  31018. 0x0344,
  31019. "diamond",
  31020. 0x2666,
  31021. "diamondsuitwhite",
  31022. 0x2662,
  31023. "dieresis",
  31024. 0x00a8,
  31025. "dieresisacute",
  31026. 0xf6d7,
  31027. "dieresisbelowcmb",
  31028. 0x0324,
  31029. "dieresiscmb",
  31030. 0x0308,
  31031. "dieresisgrave",
  31032. 0xf6d8,
  31033. "dieresistonos",
  31034. 0x0385,
  31035. "dihiragana",
  31036. 0x3062,
  31037. "dikatakana",
  31038. 0x30c2,
  31039. "dittomark",
  31040. 0x3003,
  31041. "divide",
  31042. 0x00f7,
  31043. "divides",
  31044. 0x2223,
  31045. "divisionslash",
  31046. 0x2215,
  31047. "djecyrillic",
  31048. 0x0452,
  31049. "dkshade",
  31050. 0x2593,
  31051. "dlinebelow",
  31052. 0x1e0f,
  31053. "dlsquare",
  31054. 0x3397,
  31055. "dmacron",
  31056. 0x0111,
  31057. "dmonospace",
  31058. 0xff44,
  31059. "dnblock",
  31060. 0x2584,
  31061. "dochadathai",
  31062. 0x0e0e,
  31063. "dodekthai",
  31064. 0x0e14,
  31065. "dohiragana",
  31066. 0x3069,
  31067. "dokatakana",
  31068. 0x30c9,
  31069. "dollar",
  31070. 0x0024,
  31071. "dollarinferior",
  31072. 0xf6e3,
  31073. "dollarmonospace",
  31074. 0xff04,
  31075. "dollaroldstyle",
  31076. 0xf724,
  31077. "dollarsmall",
  31078. 0xfe69,
  31079. "dollarsuperior",
  31080. 0xf6e4,
  31081. "dong",
  31082. 0x20ab,
  31083. "dorusquare",
  31084. 0x3326,
  31085. "dotaccent",
  31086. 0x02d9,
  31087. "dotaccentcmb",
  31088. 0x0307,
  31089. "dotbelowcmb",
  31090. 0x0323,
  31091. "dotbelowcomb",
  31092. 0x0323,
  31093. "dotkatakana",
  31094. 0x30fb,
  31095. "dotlessi",
  31096. 0x0131,
  31097. "dotlessj",
  31098. 0xf6be,
  31099. "dotlessjstrokehook",
  31100. 0x0284,
  31101. "dotmath",
  31102. 0x22c5,
  31103. "dottedcircle",
  31104. 0x25cc,
  31105. "doubleyodpatah",
  31106. 0xfb1f,
  31107. "doubleyodpatahhebrew",
  31108. 0xfb1f,
  31109. "downtackbelowcmb",
  31110. 0x031e,
  31111. "downtackmod",
  31112. 0x02d5,
  31113. "dparen",
  31114. 0x249f,
  31115. "dsuperior",
  31116. 0xf6eb,
  31117. "dtail",
  31118. 0x0256,
  31119. "dtopbar",
  31120. 0x018c,
  31121. "duhiragana",
  31122. 0x3065,
  31123. "dukatakana",
  31124. 0x30c5,
  31125. "dz",
  31126. 0x01f3,
  31127. "dzaltone",
  31128. 0x02a3,
  31129. "dzcaron",
  31130. 0x01c6,
  31131. "dzcurl",
  31132. 0x02a5,
  31133. "dzeabkhasiancyrillic",
  31134. 0x04e1,
  31135. "dzecyrillic",
  31136. 0x0455,
  31137. "dzhecyrillic",
  31138. 0x045f,
  31139. "e",
  31140. 0x0065,
  31141. "eacute",
  31142. 0x00e9,
  31143. "earth",
  31144. 0x2641,
  31145. "ebengali",
  31146. 0x098f,
  31147. "ebopomofo",
  31148. 0x311c,
  31149. "ebreve",
  31150. 0x0115,
  31151. "ecandradeva",
  31152. 0x090d,
  31153. "ecandragujarati",
  31154. 0x0a8d,
  31155. "ecandravowelsigndeva",
  31156. 0x0945,
  31157. "ecandravowelsigngujarati",
  31158. 0x0ac5,
  31159. "ecaron",
  31160. 0x011b,
  31161. "ecedillabreve",
  31162. 0x1e1d,
  31163. "echarmenian",
  31164. 0x0565,
  31165. "echyiwnarmenian",
  31166. 0x0587,
  31167. "ecircle",
  31168. 0x24d4,
  31169. "ecircumflex",
  31170. 0x00ea,
  31171. "ecircumflexacute",
  31172. 0x1ebf,
  31173. "ecircumflexbelow",
  31174. 0x1e19,
  31175. "ecircumflexdotbelow",
  31176. 0x1ec7,
  31177. "ecircumflexgrave",
  31178. 0x1ec1,
  31179. "ecircumflexhookabove",
  31180. 0x1ec3,
  31181. "ecircumflextilde",
  31182. 0x1ec5,
  31183. "ecyrillic",
  31184. 0x0454,
  31185. "edblgrave",
  31186. 0x0205,
  31187. "edeva",
  31188. 0x090f,
  31189. "edieresis",
  31190. 0x00eb,
  31191. "edot",
  31192. 0x0117,
  31193. "edotaccent",
  31194. 0x0117,
  31195. "edotbelow",
  31196. 0x1eb9,
  31197. "eegurmukhi",
  31198. 0x0a0f,
  31199. "eematragurmukhi",
  31200. 0x0a47,
  31201. "efcyrillic",
  31202. 0x0444,
  31203. "egrave",
  31204. 0x00e8,
  31205. "egujarati",
  31206. 0x0a8f,
  31207. "eharmenian",
  31208. 0x0567,
  31209. "ehbopomofo",
  31210. 0x311d,
  31211. "ehiragana",
  31212. 0x3048,
  31213. "ehookabove",
  31214. 0x1ebb,
  31215. "eibopomofo",
  31216. 0x311f,
  31217. "eight",
  31218. 0x0038,
  31219. "eightarabic",
  31220. 0x0668,
  31221. "eightbengali",
  31222. 0x09ee,
  31223. "eightcircle",
  31224. 0x2467,
  31225. "eightcircleinversesansserif",
  31226. 0x2791,
  31227. "eightdeva",
  31228. 0x096e,
  31229. "eighteencircle",
  31230. 0x2471,
  31231. "eighteenparen",
  31232. 0x2485,
  31233. "eighteenperiod",
  31234. 0x2499,
  31235. "eightgujarati",
  31236. 0x0aee,
  31237. "eightgurmukhi",
  31238. 0x0a6e,
  31239. "eighthackarabic",
  31240. 0x0668,
  31241. "eighthangzhou",
  31242. 0x3028,
  31243. "eighthnotebeamed",
  31244. 0x266b,
  31245. "eightideographicparen",
  31246. 0x3227,
  31247. "eightinferior",
  31248. 0x2088,
  31249. "eightmonospace",
  31250. 0xff18,
  31251. "eightoldstyle",
  31252. 0xf738,
  31253. "eightparen",
  31254. 0x247b,
  31255. "eightperiod",
  31256. 0x248f,
  31257. "eightpersian",
  31258. 0x06f8,
  31259. "eightroman",
  31260. 0x2177,
  31261. "eightsuperior",
  31262. 0x2078,
  31263. "eightthai",
  31264. 0x0e58,
  31265. "einvertedbreve",
  31266. 0x0207,
  31267. "eiotifiedcyrillic",
  31268. 0x0465,
  31269. "ekatakana",
  31270. 0x30a8,
  31271. "ekatakanahalfwidth",
  31272. 0xff74,
  31273. "ekonkargurmukhi",
  31274. 0x0a74,
  31275. "ekorean",
  31276. 0x3154,
  31277. "elcyrillic",
  31278. 0x043b,
  31279. "element",
  31280. 0x2208,
  31281. "elevencircle",
  31282. 0x246a,
  31283. "elevenparen",
  31284. 0x247e,
  31285. "elevenperiod",
  31286. 0x2492,
  31287. "elevenroman",
  31288. 0x217a,
  31289. "ellipsis",
  31290. 0x2026,
  31291. "ellipsisvertical",
  31292. 0x22ee,
  31293. "emacron",
  31294. 0x0113,
  31295. "emacronacute",
  31296. 0x1e17,
  31297. "emacrongrave",
  31298. 0x1e15,
  31299. "emcyrillic",
  31300. 0x043c,
  31301. "emdash",
  31302. 0x2014,
  31303. "emdashvertical",
  31304. 0xfe31,
  31305. "emonospace",
  31306. 0xff45,
  31307. "emphasismarkarmenian",
  31308. 0x055b,
  31309. "emptyset",
  31310. 0x2205,
  31311. "enbopomofo",
  31312. 0x3123,
  31313. "encyrillic",
  31314. 0x043d,
  31315. "endash",
  31316. 0x2013,
  31317. "endashvertical",
  31318. 0xfe32,
  31319. "endescendercyrillic",
  31320. 0x04a3,
  31321. "eng",
  31322. 0x014b,
  31323. "engbopomofo",
  31324. 0x3125,
  31325. "enghecyrillic",
  31326. 0x04a5,
  31327. "enhookcyrillic",
  31328. 0x04c8,
  31329. "enspace",
  31330. 0x2002,
  31331. "eogonek",
  31332. 0x0119,
  31333. "eokorean",
  31334. 0x3153,
  31335. "eopen",
  31336. 0x025b,
  31337. "eopenclosed",
  31338. 0x029a,
  31339. "eopenreversed",
  31340. 0x025c,
  31341. "eopenreversedclosed",
  31342. 0x025e,
  31343. "eopenreversedhook",
  31344. 0x025d,
  31345. "eparen",
  31346. 0x24a0,
  31347. "epsilon",
  31348. 0x03b5,
  31349. "epsilontonos",
  31350. 0x03ad,
  31351. "equal",
  31352. 0x003d,
  31353. "equalmonospace",
  31354. 0xff1d,
  31355. "equalsmall",
  31356. 0xfe66,
  31357. "equalsuperior",
  31358. 0x207c,
  31359. "equivalence",
  31360. 0x2261,
  31361. "erbopomofo",
  31362. 0x3126,
  31363. "ercyrillic",
  31364. 0x0440,
  31365. "ereversed",
  31366. 0x0258,
  31367. "ereversedcyrillic",
  31368. 0x044d,
  31369. "escyrillic",
  31370. 0x0441,
  31371. "esdescendercyrillic",
  31372. 0x04ab,
  31373. "esh",
  31374. 0x0283,
  31375. "eshcurl",
  31376. 0x0286,
  31377. "eshortdeva",
  31378. 0x090e,
  31379. "eshortvowelsigndeva",
  31380. 0x0946,
  31381. "eshreversedloop",
  31382. 0x01aa,
  31383. "eshsquatreversed",
  31384. 0x0285,
  31385. "esmallhiragana",
  31386. 0x3047,
  31387. "esmallkatakana",
  31388. 0x30a7,
  31389. "esmallkatakanahalfwidth",
  31390. 0xff6a,
  31391. "estimated",
  31392. 0x212e,
  31393. "esuperior",
  31394. 0xf6ec,
  31395. "eta",
  31396. 0x03b7,
  31397. "etarmenian",
  31398. 0x0568,
  31399. "etatonos",
  31400. 0x03ae,
  31401. "eth",
  31402. 0x00f0,
  31403. "etilde",
  31404. 0x1ebd,
  31405. "etildebelow",
  31406. 0x1e1b,
  31407. "etnahtafoukhhebrew",
  31408. 0x0591,
  31409. "etnahtafoukhlefthebrew",
  31410. 0x0591,
  31411. "etnahtahebrew",
  31412. 0x0591,
  31413. "etnahtalefthebrew",
  31414. 0x0591,
  31415. "eturned",
  31416. 0x01dd,
  31417. "eukorean",
  31418. 0x3161,
  31419. "euro",
  31420. 0x20ac,
  31421. "evowelsignbengali",
  31422. 0x09c7,
  31423. "evowelsigndeva",
  31424. 0x0947,
  31425. "evowelsigngujarati",
  31426. 0x0ac7,
  31427. "exclam",
  31428. 0x0021,
  31429. "exclamarmenian",
  31430. 0x055c,
  31431. "exclamdbl",
  31432. 0x203c,
  31433. "exclamdown",
  31434. 0x00a1,
  31435. "exclamdownsmall",
  31436. 0xf7a1,
  31437. "exclammonospace",
  31438. 0xff01,
  31439. "exclamsmall",
  31440. 0xf721,
  31441. "existential",
  31442. 0x2203,
  31443. "ezh",
  31444. 0x0292,
  31445. "ezhcaron",
  31446. 0x01ef,
  31447. "ezhcurl",
  31448. 0x0293,
  31449. "ezhreversed",
  31450. 0x01b9,
  31451. "ezhtail",
  31452. 0x01ba,
  31453. "f",
  31454. 0x0066,
  31455. "fadeva",
  31456. 0x095e,
  31457. "fagurmukhi",
  31458. 0x0a5e,
  31459. "fahrenheit",
  31460. 0x2109,
  31461. "fathaarabic",
  31462. 0x064e,
  31463. "fathalowarabic",
  31464. 0x064e,
  31465. "fathatanarabic",
  31466. 0x064b,
  31467. "fbopomofo",
  31468. 0x3108,
  31469. "fcircle",
  31470. 0x24d5,
  31471. "fdotaccent",
  31472. 0x1e1f,
  31473. "feharabic",
  31474. 0x0641,
  31475. "feharmenian",
  31476. 0x0586,
  31477. "fehfinalarabic",
  31478. 0xfed2,
  31479. "fehinitialarabic",
  31480. 0xfed3,
  31481. "fehmedialarabic",
  31482. 0xfed4,
  31483. "feicoptic",
  31484. 0x03e5,
  31485. "female",
  31486. 0x2640,
  31487. "ff",
  31488. 0xfb00,
  31489. "f_f",
  31490. 0xfb00,
  31491. "ffi",
  31492. 0xfb03,
  31493. "f_f_i",
  31494. 0xfb03,
  31495. "ffl",
  31496. 0xfb04,
  31497. "f_f_l",
  31498. 0xfb04,
  31499. "fi",
  31500. 0xfb01,
  31501. "f_i",
  31502. 0xfb01,
  31503. "fifteencircle",
  31504. 0x246e,
  31505. "fifteenparen",
  31506. 0x2482,
  31507. "fifteenperiod",
  31508. 0x2496,
  31509. "figuredash",
  31510. 0x2012,
  31511. "filledbox",
  31512. 0x25a0,
  31513. "filledrect",
  31514. 0x25ac,
  31515. "finalkaf",
  31516. 0x05da,
  31517. "finalkafdagesh",
  31518. 0xfb3a,
  31519. "finalkafdageshhebrew",
  31520. 0xfb3a,
  31521. "finalkafhebrew",
  31522. 0x05da,
  31523. "finalmem",
  31524. 0x05dd,
  31525. "finalmemhebrew",
  31526. 0x05dd,
  31527. "finalnun",
  31528. 0x05df,
  31529. "finalnunhebrew",
  31530. 0x05df,
  31531. "finalpe",
  31532. 0x05e3,
  31533. "finalpehebrew",
  31534. 0x05e3,
  31535. "finaltsadi",
  31536. 0x05e5,
  31537. "finaltsadihebrew",
  31538. 0x05e5,
  31539. "firsttonechinese",
  31540. 0x02c9,
  31541. "fisheye",
  31542. 0x25c9,
  31543. "fitacyrillic",
  31544. 0x0473,
  31545. "five",
  31546. 0x0035,
  31547. "fivearabic",
  31548. 0x0665,
  31549. "fivebengali",
  31550. 0x09eb,
  31551. "fivecircle",
  31552. 0x2464,
  31553. "fivecircleinversesansserif",
  31554. 0x278e,
  31555. "fivedeva",
  31556. 0x096b,
  31557. "fiveeighths",
  31558. 0x215d,
  31559. "fivegujarati",
  31560. 0x0aeb,
  31561. "fivegurmukhi",
  31562. 0x0a6b,
  31563. "fivehackarabic",
  31564. 0x0665,
  31565. "fivehangzhou",
  31566. 0x3025,
  31567. "fiveideographicparen",
  31568. 0x3224,
  31569. "fiveinferior",
  31570. 0x2085,
  31571. "fivemonospace",
  31572. 0xff15,
  31573. "fiveoldstyle",
  31574. 0xf735,
  31575. "fiveparen",
  31576. 0x2478,
  31577. "fiveperiod",
  31578. 0x248c,
  31579. "fivepersian",
  31580. 0x06f5,
  31581. "fiveroman",
  31582. 0x2174,
  31583. "fivesuperior",
  31584. 0x2075,
  31585. "fivethai",
  31586. 0x0e55,
  31587. "fl",
  31588. 0xfb02,
  31589. "f_l",
  31590. 0xfb02,
  31591. "florin",
  31592. 0x0192,
  31593. "fmonospace",
  31594. 0xff46,
  31595. "fmsquare",
  31596. 0x3399,
  31597. "fofanthai",
  31598. 0x0e1f,
  31599. "fofathai",
  31600. 0x0e1d,
  31601. "fongmanthai",
  31602. 0x0e4f,
  31603. "forall",
  31604. 0x2200,
  31605. "four",
  31606. 0x0034,
  31607. "fourarabic",
  31608. 0x0664,
  31609. "fourbengali",
  31610. 0x09ea,
  31611. "fourcircle",
  31612. 0x2463,
  31613. "fourcircleinversesansserif",
  31614. 0x278d,
  31615. "fourdeva",
  31616. 0x096a,
  31617. "fourgujarati",
  31618. 0x0aea,
  31619. "fourgurmukhi",
  31620. 0x0a6a,
  31621. "fourhackarabic",
  31622. 0x0664,
  31623. "fourhangzhou",
  31624. 0x3024,
  31625. "fourideographicparen",
  31626. 0x3223,
  31627. "fourinferior",
  31628. 0x2084,
  31629. "fourmonospace",
  31630. 0xff14,
  31631. "fournumeratorbengali",
  31632. 0x09f7,
  31633. "fouroldstyle",
  31634. 0xf734,
  31635. "fourparen",
  31636. 0x2477,
  31637. "fourperiod",
  31638. 0x248b,
  31639. "fourpersian",
  31640. 0x06f4,
  31641. "fourroman",
  31642. 0x2173,
  31643. "foursuperior",
  31644. 0x2074,
  31645. "fourteencircle",
  31646. 0x246d,
  31647. "fourteenparen",
  31648. 0x2481,
  31649. "fourteenperiod",
  31650. 0x2495,
  31651. "fourthai",
  31652. 0x0e54,
  31653. "fourthtonechinese",
  31654. 0x02cb,
  31655. "fparen",
  31656. 0x24a1,
  31657. "fraction",
  31658. 0x2044,
  31659. "franc",
  31660. 0x20a3,
  31661. "g",
  31662. 0x0067,
  31663. "gabengali",
  31664. 0x0997,
  31665. "gacute",
  31666. 0x01f5,
  31667. "gadeva",
  31668. 0x0917,
  31669. "gafarabic",
  31670. 0x06af,
  31671. "gaffinalarabic",
  31672. 0xfb93,
  31673. "gafinitialarabic",
  31674. 0xfb94,
  31675. "gafmedialarabic",
  31676. 0xfb95,
  31677. "gagujarati",
  31678. 0x0a97,
  31679. "gagurmukhi",
  31680. 0x0a17,
  31681. "gahiragana",
  31682. 0x304c,
  31683. "gakatakana",
  31684. 0x30ac,
  31685. "gamma",
  31686. 0x03b3,
  31687. "gammalatinsmall",
  31688. 0x0263,
  31689. "gammasuperior",
  31690. 0x02e0,
  31691. "gangiacoptic",
  31692. 0x03eb,
  31693. "gbopomofo",
  31694. 0x310d,
  31695. "gbreve",
  31696. 0x011f,
  31697. "gcaron",
  31698. 0x01e7,
  31699. "gcedilla",
  31700. 0x0123,
  31701. "gcircle",
  31702. 0x24d6,
  31703. "gcircumflex",
  31704. 0x011d,
  31705. "gcommaaccent",
  31706. 0x0123,
  31707. "gdot",
  31708. 0x0121,
  31709. "gdotaccent",
  31710. 0x0121,
  31711. "gecyrillic",
  31712. 0x0433,
  31713. "gehiragana",
  31714. 0x3052,
  31715. "gekatakana",
  31716. 0x30b2,
  31717. "geometricallyequal",
  31718. 0x2251,
  31719. "gereshaccenthebrew",
  31720. 0x059c,
  31721. "gereshhebrew",
  31722. 0x05f3,
  31723. "gereshmuqdamhebrew",
  31724. 0x059d,
  31725. "germandbls",
  31726. 0x00df,
  31727. "gershayimaccenthebrew",
  31728. 0x059e,
  31729. "gershayimhebrew",
  31730. 0x05f4,
  31731. "getamark",
  31732. 0x3013,
  31733. "ghabengali",
  31734. 0x0998,
  31735. "ghadarmenian",
  31736. 0x0572,
  31737. "ghadeva",
  31738. 0x0918,
  31739. "ghagujarati",
  31740. 0x0a98,
  31741. "ghagurmukhi",
  31742. 0x0a18,
  31743. "ghainarabic",
  31744. 0x063a,
  31745. "ghainfinalarabic",
  31746. 0xfece,
  31747. "ghaininitialarabic",
  31748. 0xfecf,
  31749. "ghainmedialarabic",
  31750. 0xfed0,
  31751. "ghemiddlehookcyrillic",
  31752. 0x0495,
  31753. "ghestrokecyrillic",
  31754. 0x0493,
  31755. "gheupturncyrillic",
  31756. 0x0491,
  31757. "ghhadeva",
  31758. 0x095a,
  31759. "ghhagurmukhi",
  31760. 0x0a5a,
  31761. "ghook",
  31762. 0x0260,
  31763. "ghzsquare",
  31764. 0x3393,
  31765. "gihiragana",
  31766. 0x304e,
  31767. "gikatakana",
  31768. 0x30ae,
  31769. "gimarmenian",
  31770. 0x0563,
  31771. "gimel",
  31772. 0x05d2,
  31773. "gimeldagesh",
  31774. 0xfb32,
  31775. "gimeldageshhebrew",
  31776. 0xfb32,
  31777. "gimelhebrew",
  31778. 0x05d2,
  31779. "gjecyrillic",
  31780. 0x0453,
  31781. "glottalinvertedstroke",
  31782. 0x01be,
  31783. "glottalstop",
  31784. 0x0294,
  31785. "glottalstopinverted",
  31786. 0x0296,
  31787. "glottalstopmod",
  31788. 0x02c0,
  31789. "glottalstopreversed",
  31790. 0x0295,
  31791. "glottalstopreversedmod",
  31792. 0x02c1,
  31793. "glottalstopreversedsuperior",
  31794. 0x02e4,
  31795. "glottalstopstroke",
  31796. 0x02a1,
  31797. "glottalstopstrokereversed",
  31798. 0x02a2,
  31799. "gmacron",
  31800. 0x1e21,
  31801. "gmonospace",
  31802. 0xff47,
  31803. "gohiragana",
  31804. 0x3054,
  31805. "gokatakana",
  31806. 0x30b4,
  31807. "gparen",
  31808. 0x24a2,
  31809. "gpasquare",
  31810. 0x33ac,
  31811. "gradient",
  31812. 0x2207,
  31813. "grave",
  31814. 0x0060,
  31815. "gravebelowcmb",
  31816. 0x0316,
  31817. "gravecmb",
  31818. 0x0300,
  31819. "gravecomb",
  31820. 0x0300,
  31821. "gravedeva",
  31822. 0x0953,
  31823. "gravelowmod",
  31824. 0x02ce,
  31825. "gravemonospace",
  31826. 0xff40,
  31827. "gravetonecmb",
  31828. 0x0340,
  31829. "greater",
  31830. 0x003e,
  31831. "greaterequal",
  31832. 0x2265,
  31833. "greaterequalorless",
  31834. 0x22db,
  31835. "greatermonospace",
  31836. 0xff1e,
  31837. "greaterorequivalent",
  31838. 0x2273,
  31839. "greaterorless",
  31840. 0x2277,
  31841. "greateroverequal",
  31842. 0x2267,
  31843. "greatersmall",
  31844. 0xfe65,
  31845. "gscript",
  31846. 0x0261,
  31847. "gstroke",
  31848. 0x01e5,
  31849. "guhiragana",
  31850. 0x3050,
  31851. "guillemotleft",
  31852. 0x00ab,
  31853. "guillemotright",
  31854. 0x00bb,
  31855. "guilsinglleft",
  31856. 0x2039,
  31857. "guilsinglright",
  31858. 0x203a,
  31859. "gukatakana",
  31860. 0x30b0,
  31861. "guramusquare",
  31862. 0x3318,
  31863. "gysquare",
  31864. 0x33c9,
  31865. "h",
  31866. 0x0068,
  31867. "haabkhasiancyrillic",
  31868. 0x04a9,
  31869. "haaltonearabic",
  31870. 0x06c1,
  31871. "habengali",
  31872. 0x09b9,
  31873. "hadescendercyrillic",
  31874. 0x04b3,
  31875. "hadeva",
  31876. 0x0939,
  31877. "hagujarati",
  31878. 0x0ab9,
  31879. "hagurmukhi",
  31880. 0x0a39,
  31881. "haharabic",
  31882. 0x062d,
  31883. "hahfinalarabic",
  31884. 0xfea2,
  31885. "hahinitialarabic",
  31886. 0xfea3,
  31887. "hahiragana",
  31888. 0x306f,
  31889. "hahmedialarabic",
  31890. 0xfea4,
  31891. "haitusquare",
  31892. 0x332a,
  31893. "hakatakana",
  31894. 0x30cf,
  31895. "hakatakanahalfwidth",
  31896. 0xff8a,
  31897. "halantgurmukhi",
  31898. 0x0a4d,
  31899. "hamzaarabic",
  31900. 0x0621,
  31901. "hamzalowarabic",
  31902. 0x0621,
  31903. "hangulfiller",
  31904. 0x3164,
  31905. "hardsigncyrillic",
  31906. 0x044a,
  31907. "harpoonleftbarbup",
  31908. 0x21bc,
  31909. "harpoonrightbarbup",
  31910. 0x21c0,
  31911. "hasquare",
  31912. 0x33ca,
  31913. "hatafpatah",
  31914. 0x05b2,
  31915. "hatafpatah16",
  31916. 0x05b2,
  31917. "hatafpatah23",
  31918. 0x05b2,
  31919. "hatafpatah2f",
  31920. 0x05b2,
  31921. "hatafpatahhebrew",
  31922. 0x05b2,
  31923. "hatafpatahnarrowhebrew",
  31924. 0x05b2,
  31925. "hatafpatahquarterhebrew",
  31926. 0x05b2,
  31927. "hatafpatahwidehebrew",
  31928. 0x05b2,
  31929. "hatafqamats",
  31930. 0x05b3,
  31931. "hatafqamats1b",
  31932. 0x05b3,
  31933. "hatafqamats28",
  31934. 0x05b3,
  31935. "hatafqamats34",
  31936. 0x05b3,
  31937. "hatafqamatshebrew",
  31938. 0x05b3,
  31939. "hatafqamatsnarrowhebrew",
  31940. 0x05b3,
  31941. "hatafqamatsquarterhebrew",
  31942. 0x05b3,
  31943. "hatafqamatswidehebrew",
  31944. 0x05b3,
  31945. "hatafsegol",
  31946. 0x05b1,
  31947. "hatafsegol17",
  31948. 0x05b1,
  31949. "hatafsegol24",
  31950. 0x05b1,
  31951. "hatafsegol30",
  31952. 0x05b1,
  31953. "hatafsegolhebrew",
  31954. 0x05b1,
  31955. "hatafsegolnarrowhebrew",
  31956. 0x05b1,
  31957. "hatafsegolquarterhebrew",
  31958. 0x05b1,
  31959. "hatafsegolwidehebrew",
  31960. 0x05b1,
  31961. "hbar",
  31962. 0x0127,
  31963. "hbopomofo",
  31964. 0x310f,
  31965. "hbrevebelow",
  31966. 0x1e2b,
  31967. "hcedilla",
  31968. 0x1e29,
  31969. "hcircle",
  31970. 0x24d7,
  31971. "hcircumflex",
  31972. 0x0125,
  31973. "hdieresis",
  31974. 0x1e27,
  31975. "hdotaccent",
  31976. 0x1e23,
  31977. "hdotbelow",
  31978. 0x1e25,
  31979. "he",
  31980. 0x05d4,
  31981. "heart",
  31982. 0x2665,
  31983. "heartsuitblack",
  31984. 0x2665,
  31985. "heartsuitwhite",
  31986. 0x2661,
  31987. "hedagesh",
  31988. 0xfb34,
  31989. "hedageshhebrew",
  31990. 0xfb34,
  31991. "hehaltonearabic",
  31992. 0x06c1,
  31993. "heharabic",
  31994. 0x0647,
  31995. "hehebrew",
  31996. 0x05d4,
  31997. "hehfinalaltonearabic",
  31998. 0xfba7,
  31999. "hehfinalalttwoarabic",
  32000. 0xfeea,
  32001. "hehfinalarabic",
  32002. 0xfeea,
  32003. "hehhamzaabovefinalarabic",
  32004. 0xfba5,
  32005. "hehhamzaaboveisolatedarabic",
  32006. 0xfba4,
  32007. "hehinitialaltonearabic",
  32008. 0xfba8,
  32009. "hehinitialarabic",
  32010. 0xfeeb,
  32011. "hehiragana",
  32012. 0x3078,
  32013. "hehmedialaltonearabic",
  32014. 0xfba9,
  32015. "hehmedialarabic",
  32016. 0xfeec,
  32017. "heiseierasquare",
  32018. 0x337b,
  32019. "hekatakana",
  32020. 0x30d8,
  32021. "hekatakanahalfwidth",
  32022. 0xff8d,
  32023. "hekutaarusquare",
  32024. 0x3336,
  32025. "henghook",
  32026. 0x0267,
  32027. "herutusquare",
  32028. 0x3339,
  32029. "het",
  32030. 0x05d7,
  32031. "hethebrew",
  32032. 0x05d7,
  32033. "hhook",
  32034. 0x0266,
  32035. "hhooksuperior",
  32036. 0x02b1,
  32037. "hieuhacirclekorean",
  32038. 0x327b,
  32039. "hieuhaparenkorean",
  32040. 0x321b,
  32041. "hieuhcirclekorean",
  32042. 0x326d,
  32043. "hieuhkorean",
  32044. 0x314e,
  32045. "hieuhparenkorean",
  32046. 0x320d,
  32047. "hihiragana",
  32048. 0x3072,
  32049. "hikatakana",
  32050. 0x30d2,
  32051. "hikatakanahalfwidth",
  32052. 0xff8b,
  32053. "hiriq",
  32054. 0x05b4,
  32055. "hiriq14",
  32056. 0x05b4,
  32057. "hiriq21",
  32058. 0x05b4,
  32059. "hiriq2d",
  32060. 0x05b4,
  32061. "hiriqhebrew",
  32062. 0x05b4,
  32063. "hiriqnarrowhebrew",
  32064. 0x05b4,
  32065. "hiriqquarterhebrew",
  32066. 0x05b4,
  32067. "hiriqwidehebrew",
  32068. 0x05b4,
  32069. "hlinebelow",
  32070. 0x1e96,
  32071. "hmonospace",
  32072. 0xff48,
  32073. "hoarmenian",
  32074. 0x0570,
  32075. "hohipthai",
  32076. 0x0e2b,
  32077. "hohiragana",
  32078. 0x307b,
  32079. "hokatakana",
  32080. 0x30db,
  32081. "hokatakanahalfwidth",
  32082. 0xff8e,
  32083. "holam",
  32084. 0x05b9,
  32085. "holam19",
  32086. 0x05b9,
  32087. "holam26",
  32088. 0x05b9,
  32089. "holam32",
  32090. 0x05b9,
  32091. "holamhebrew",
  32092. 0x05b9,
  32093. "holamnarrowhebrew",
  32094. 0x05b9,
  32095. "holamquarterhebrew",
  32096. 0x05b9,
  32097. "holamwidehebrew",
  32098. 0x05b9,
  32099. "honokhukthai",
  32100. 0x0e2e,
  32101. "hookabovecomb",
  32102. 0x0309,
  32103. "hookcmb",
  32104. 0x0309,
  32105. "hookpalatalizedbelowcmb",
  32106. 0x0321,
  32107. "hookretroflexbelowcmb",
  32108. 0x0322,
  32109. "hoonsquare",
  32110. 0x3342,
  32111. "horicoptic",
  32112. 0x03e9,
  32113. "horizontalbar",
  32114. 0x2015,
  32115. "horncmb",
  32116. 0x031b,
  32117. "hotsprings",
  32118. 0x2668,
  32119. "house",
  32120. 0x2302,
  32121. "hparen",
  32122. 0x24a3,
  32123. "hsuperior",
  32124. 0x02b0,
  32125. "hturned",
  32126. 0x0265,
  32127. "huhiragana",
  32128. 0x3075,
  32129. "huiitosquare",
  32130. 0x3333,
  32131. "hukatakana",
  32132. 0x30d5,
  32133. "hukatakanahalfwidth",
  32134. 0xff8c,
  32135. "hungarumlaut",
  32136. 0x02dd,
  32137. "hungarumlautcmb",
  32138. 0x030b,
  32139. "hv",
  32140. 0x0195,
  32141. "hyphen",
  32142. 0x002d,
  32143. "hypheninferior",
  32144. 0xf6e5,
  32145. "hyphenmonospace",
  32146. 0xff0d,
  32147. "hyphensmall",
  32148. 0xfe63,
  32149. "hyphensuperior",
  32150. 0xf6e6,
  32151. "hyphentwo",
  32152. 0x2010,
  32153. "i",
  32154. 0x0069,
  32155. "iacute",
  32156. 0x00ed,
  32157. "iacyrillic",
  32158. 0x044f,
  32159. "ibengali",
  32160. 0x0987,
  32161. "ibopomofo",
  32162. 0x3127,
  32163. "ibreve",
  32164. 0x012d,
  32165. "icaron",
  32166. 0x01d0,
  32167. "icircle",
  32168. 0x24d8,
  32169. "icircumflex",
  32170. 0x00ee,
  32171. "icyrillic",
  32172. 0x0456,
  32173. "idblgrave",
  32174. 0x0209,
  32175. "ideographearthcircle",
  32176. 0x328f,
  32177. "ideographfirecircle",
  32178. 0x328b,
  32179. "ideographicallianceparen",
  32180. 0x323f,
  32181. "ideographiccallparen",
  32182. 0x323a,
  32183. "ideographiccentrecircle",
  32184. 0x32a5,
  32185. "ideographicclose",
  32186. 0x3006,
  32187. "ideographiccomma",
  32188. 0x3001,
  32189. "ideographiccommaleft",
  32190. 0xff64,
  32191. "ideographiccongratulationparen",
  32192. 0x3237,
  32193. "ideographiccorrectcircle",
  32194. 0x32a3,
  32195. "ideographicearthparen",
  32196. 0x322f,
  32197. "ideographicenterpriseparen",
  32198. 0x323d,
  32199. "ideographicexcellentcircle",
  32200. 0x329d,
  32201. "ideographicfestivalparen",
  32202. 0x3240,
  32203. "ideographicfinancialcircle",
  32204. 0x3296,
  32205. "ideographicfinancialparen",
  32206. 0x3236,
  32207. "ideographicfireparen",
  32208. 0x322b,
  32209. "ideographichaveparen",
  32210. 0x3232,
  32211. "ideographichighcircle",
  32212. 0x32a4,
  32213. "ideographiciterationmark",
  32214. 0x3005,
  32215. "ideographiclaborcircle",
  32216. 0x3298,
  32217. "ideographiclaborparen",
  32218. 0x3238,
  32219. "ideographicleftcircle",
  32220. 0x32a7,
  32221. "ideographiclowcircle",
  32222. 0x32a6,
  32223. "ideographicmedicinecircle",
  32224. 0x32a9,
  32225. "ideographicmetalparen",
  32226. 0x322e,
  32227. "ideographicmoonparen",
  32228. 0x322a,
  32229. "ideographicnameparen",
  32230. 0x3234,
  32231. "ideographicperiod",
  32232. 0x3002,
  32233. "ideographicprintcircle",
  32234. 0x329e,
  32235. "ideographicreachparen",
  32236. 0x3243,
  32237. "ideographicrepresentparen",
  32238. 0x3239,
  32239. "ideographicresourceparen",
  32240. 0x323e,
  32241. "ideographicrightcircle",
  32242. 0x32a8,
  32243. "ideographicsecretcircle",
  32244. 0x3299,
  32245. "ideographicselfparen",
  32246. 0x3242,
  32247. "ideographicsocietyparen",
  32248. 0x3233,
  32249. "ideographicspace",
  32250. 0x3000,
  32251. "ideographicspecialparen",
  32252. 0x3235,
  32253. "ideographicstockparen",
  32254. 0x3231,
  32255. "ideographicstudyparen",
  32256. 0x323b,
  32257. "ideographicsunparen",
  32258. 0x3230,
  32259. "ideographicsuperviseparen",
  32260. 0x323c,
  32261. "ideographicwaterparen",
  32262. 0x322c,
  32263. "ideographicwoodparen",
  32264. 0x322d,
  32265. "ideographiczero",
  32266. 0x3007,
  32267. "ideographmetalcircle",
  32268. 0x328e,
  32269. "ideographmooncircle",
  32270. 0x328a,
  32271. "ideographnamecircle",
  32272. 0x3294,
  32273. "ideographsuncircle",
  32274. 0x3290,
  32275. "ideographwatercircle",
  32276. 0x328c,
  32277. "ideographwoodcircle",
  32278. 0x328d,
  32279. "ideva",
  32280. 0x0907,
  32281. "idieresis",
  32282. 0x00ef,
  32283. "idieresisacute",
  32284. 0x1e2f,
  32285. "idieresiscyrillic",
  32286. 0x04e5,
  32287. "idotbelow",
  32288. 0x1ecb,
  32289. "iebrevecyrillic",
  32290. 0x04d7,
  32291. "iecyrillic",
  32292. 0x0435,
  32293. "ieungacirclekorean",
  32294. 0x3275,
  32295. "ieungaparenkorean",
  32296. 0x3215,
  32297. "ieungcirclekorean",
  32298. 0x3267,
  32299. "ieungkorean",
  32300. 0x3147,
  32301. "ieungparenkorean",
  32302. 0x3207,
  32303. "igrave",
  32304. 0x00ec,
  32305. "igujarati",
  32306. 0x0a87,
  32307. "igurmukhi",
  32308. 0x0a07,
  32309. "ihiragana",
  32310. 0x3044,
  32311. "ihookabove",
  32312. 0x1ec9,
  32313. "iibengali",
  32314. 0x0988,
  32315. "iicyrillic",
  32316. 0x0438,
  32317. "iideva",
  32318. 0x0908,
  32319. "iigujarati",
  32320. 0x0a88,
  32321. "iigurmukhi",
  32322. 0x0a08,
  32323. "iimatragurmukhi",
  32324. 0x0a40,
  32325. "iinvertedbreve",
  32326. 0x020b,
  32327. "iishortcyrillic",
  32328. 0x0439,
  32329. "iivowelsignbengali",
  32330. 0x09c0,
  32331. "iivowelsigndeva",
  32332. 0x0940,
  32333. "iivowelsigngujarati",
  32334. 0x0ac0,
  32335. "ij",
  32336. 0x0133,
  32337. "ikatakana",
  32338. 0x30a4,
  32339. "ikatakanahalfwidth",
  32340. 0xff72,
  32341. "ikorean",
  32342. 0x3163,
  32343. "ilde",
  32344. 0x02dc,
  32345. "iluyhebrew",
  32346. 0x05ac,
  32347. "imacron",
  32348. 0x012b,
  32349. "imacroncyrillic",
  32350. 0x04e3,
  32351. "imageorapproximatelyequal",
  32352. 0x2253,
  32353. "imatragurmukhi",
  32354. 0x0a3f,
  32355. "imonospace",
  32356. 0xff49,
  32357. "increment",
  32358. 0x2206,
  32359. "infinity",
  32360. 0x221e,
  32361. "iniarmenian",
  32362. 0x056b,
  32363. "integral",
  32364. 0x222b,
  32365. "integralbottom",
  32366. 0x2321,
  32367. "integralbt",
  32368. 0x2321,
  32369. "integralex",
  32370. 0xf8f5,
  32371. "integraltop",
  32372. 0x2320,
  32373. "integraltp",
  32374. 0x2320,
  32375. "intersection",
  32376. 0x2229,
  32377. "intisquare",
  32378. 0x3305,
  32379. "invbullet",
  32380. 0x25d8,
  32381. "invcircle",
  32382. 0x25d9,
  32383. "invsmileface",
  32384. 0x263b,
  32385. "iocyrillic",
  32386. 0x0451,
  32387. "iogonek",
  32388. 0x012f,
  32389. "iota",
  32390. 0x03b9,
  32391. "iotadieresis",
  32392. 0x03ca,
  32393. "iotadieresistonos",
  32394. 0x0390,
  32395. "iotalatin",
  32396. 0x0269,
  32397. "iotatonos",
  32398. 0x03af,
  32399. "iparen",
  32400. 0x24a4,
  32401. "irigurmukhi",
  32402. 0x0a72,
  32403. "ismallhiragana",
  32404. 0x3043,
  32405. "ismallkatakana",
  32406. 0x30a3,
  32407. "ismallkatakanahalfwidth",
  32408. 0xff68,
  32409. "issharbengali",
  32410. 0x09fa,
  32411. "istroke",
  32412. 0x0268,
  32413. "isuperior",
  32414. 0xf6ed,
  32415. "iterationhiragana",
  32416. 0x309d,
  32417. "iterationkatakana",
  32418. 0x30fd,
  32419. "itilde",
  32420. 0x0129,
  32421. "itildebelow",
  32422. 0x1e2d,
  32423. "iubopomofo",
  32424. 0x3129,
  32425. "iucyrillic",
  32426. 0x044e,
  32427. "ivowelsignbengali",
  32428. 0x09bf,
  32429. "ivowelsigndeva",
  32430. 0x093f,
  32431. "ivowelsigngujarati",
  32432. 0x0abf,
  32433. "izhitsacyrillic",
  32434. 0x0475,
  32435. "izhitsadblgravecyrillic",
  32436. 0x0477,
  32437. "j",
  32438. 0x006a,
  32439. "jaarmenian",
  32440. 0x0571,
  32441. "jabengali",
  32442. 0x099c,
  32443. "jadeva",
  32444. 0x091c,
  32445. "jagujarati",
  32446. 0x0a9c,
  32447. "jagurmukhi",
  32448. 0x0a1c,
  32449. "jbopomofo",
  32450. 0x3110,
  32451. "jcaron",
  32452. 0x01f0,
  32453. "jcircle",
  32454. 0x24d9,
  32455. "jcircumflex",
  32456. 0x0135,
  32457. "jcrossedtail",
  32458. 0x029d,
  32459. "jdotlessstroke",
  32460. 0x025f,
  32461. "jecyrillic",
  32462. 0x0458,
  32463. "jeemarabic",
  32464. 0x062c,
  32465. "jeemfinalarabic",
  32466. 0xfe9e,
  32467. "jeeminitialarabic",
  32468. 0xfe9f,
  32469. "jeemmedialarabic",
  32470. 0xfea0,
  32471. "jeharabic",
  32472. 0x0698,
  32473. "jehfinalarabic",
  32474. 0xfb8b,
  32475. "jhabengali",
  32476. 0x099d,
  32477. "jhadeva",
  32478. 0x091d,
  32479. "jhagujarati",
  32480. 0x0a9d,
  32481. "jhagurmukhi",
  32482. 0x0a1d,
  32483. "jheharmenian",
  32484. 0x057b,
  32485. "jis",
  32486. 0x3004,
  32487. "jmonospace",
  32488. 0xff4a,
  32489. "jparen",
  32490. 0x24a5,
  32491. "jsuperior",
  32492. 0x02b2,
  32493. "k",
  32494. 0x006b,
  32495. "kabashkircyrillic",
  32496. 0x04a1,
  32497. "kabengali",
  32498. 0x0995,
  32499. "kacute",
  32500. 0x1e31,
  32501. "kacyrillic",
  32502. 0x043a,
  32503. "kadescendercyrillic",
  32504. 0x049b,
  32505. "kadeva",
  32506. 0x0915,
  32507. "kaf",
  32508. 0x05db,
  32509. "kafarabic",
  32510. 0x0643,
  32511. "kafdagesh",
  32512. 0xfb3b,
  32513. "kafdageshhebrew",
  32514. 0xfb3b,
  32515. "kaffinalarabic",
  32516. 0xfeda,
  32517. "kafhebrew",
  32518. 0x05db,
  32519. "kafinitialarabic",
  32520. 0xfedb,
  32521. "kafmedialarabic",
  32522. 0xfedc,
  32523. "kafrafehebrew",
  32524. 0xfb4d,
  32525. "kagujarati",
  32526. 0x0a95,
  32527. "kagurmukhi",
  32528. 0x0a15,
  32529. "kahiragana",
  32530. 0x304b,
  32531. "kahookcyrillic",
  32532. 0x04c4,
  32533. "kakatakana",
  32534. 0x30ab,
  32535. "kakatakanahalfwidth",
  32536. 0xff76,
  32537. "kappa",
  32538. 0x03ba,
  32539. "kappasymbolgreek",
  32540. 0x03f0,
  32541. "kapyeounmieumkorean",
  32542. 0x3171,
  32543. "kapyeounphieuphkorean",
  32544. 0x3184,
  32545. "kapyeounpieupkorean",
  32546. 0x3178,
  32547. "kapyeounssangpieupkorean",
  32548. 0x3179,
  32549. "karoriisquare",
  32550. 0x330d,
  32551. "kashidaautoarabic",
  32552. 0x0640,
  32553. "kashidaautonosidebearingarabic",
  32554. 0x0640,
  32555. "kasmallkatakana",
  32556. 0x30f5,
  32557. "kasquare",
  32558. 0x3384,
  32559. "kasraarabic",
  32560. 0x0650,
  32561. "kasratanarabic",
  32562. 0x064d,
  32563. "kastrokecyrillic",
  32564. 0x049f,
  32565. "katahiraprolongmarkhalfwidth",
  32566. 0xff70,
  32567. "kaverticalstrokecyrillic",
  32568. 0x049d,
  32569. "kbopomofo",
  32570. 0x310e,
  32571. "kcalsquare",
  32572. 0x3389,
  32573. "kcaron",
  32574. 0x01e9,
  32575. "kcedilla",
  32576. 0x0137,
  32577. "kcircle",
  32578. 0x24da,
  32579. "kcommaaccent",
  32580. 0x0137,
  32581. "kdotbelow",
  32582. 0x1e33,
  32583. "keharmenian",
  32584. 0x0584,
  32585. "kehiragana",
  32586. 0x3051,
  32587. "kekatakana",
  32588. 0x30b1,
  32589. "kekatakanahalfwidth",
  32590. 0xff79,
  32591. "kenarmenian",
  32592. 0x056f,
  32593. "kesmallkatakana",
  32594. 0x30f6,
  32595. "kgreenlandic",
  32596. 0x0138,
  32597. "khabengali",
  32598. 0x0996,
  32599. "khacyrillic",
  32600. 0x0445,
  32601. "khadeva",
  32602. 0x0916,
  32603. "khagujarati",
  32604. 0x0a96,
  32605. "khagurmukhi",
  32606. 0x0a16,
  32607. "khaharabic",
  32608. 0x062e,
  32609. "khahfinalarabic",
  32610. 0xfea6,
  32611. "khahinitialarabic",
  32612. 0xfea7,
  32613. "khahmedialarabic",
  32614. 0xfea8,
  32615. "kheicoptic",
  32616. 0x03e7,
  32617. "khhadeva",
  32618. 0x0959,
  32619. "khhagurmukhi",
  32620. 0x0a59,
  32621. "khieukhacirclekorean",
  32622. 0x3278,
  32623. "khieukhaparenkorean",
  32624. 0x3218,
  32625. "khieukhcirclekorean",
  32626. 0x326a,
  32627. "khieukhkorean",
  32628. 0x314b,
  32629. "khieukhparenkorean",
  32630. 0x320a,
  32631. "khokhaithai",
  32632. 0x0e02,
  32633. "khokhonthai",
  32634. 0x0e05,
  32635. "khokhuatthai",
  32636. 0x0e03,
  32637. "khokhwaithai",
  32638. 0x0e04,
  32639. "khomutthai",
  32640. 0x0e5b,
  32641. "khook",
  32642. 0x0199,
  32643. "khorakhangthai",
  32644. 0x0e06,
  32645. "khzsquare",
  32646. 0x3391,
  32647. "kihiragana",
  32648. 0x304d,
  32649. "kikatakana",
  32650. 0x30ad,
  32651. "kikatakanahalfwidth",
  32652. 0xff77,
  32653. "kiroguramusquare",
  32654. 0x3315,
  32655. "kiromeetorusquare",
  32656. 0x3316,
  32657. "kirosquare",
  32658. 0x3314,
  32659. "kiyeokacirclekorean",
  32660. 0x326e,
  32661. "kiyeokaparenkorean",
  32662. 0x320e,
  32663. "kiyeokcirclekorean",
  32664. 0x3260,
  32665. "kiyeokkorean",
  32666. 0x3131,
  32667. "kiyeokparenkorean",
  32668. 0x3200,
  32669. "kiyeoksioskorean",
  32670. 0x3133,
  32671. "kjecyrillic",
  32672. 0x045c,
  32673. "klinebelow",
  32674. 0x1e35,
  32675. "klsquare",
  32676. 0x3398,
  32677. "kmcubedsquare",
  32678. 0x33a6,
  32679. "kmonospace",
  32680. 0xff4b,
  32681. "kmsquaredsquare",
  32682. 0x33a2,
  32683. "kohiragana",
  32684. 0x3053,
  32685. "kohmsquare",
  32686. 0x33c0,
  32687. "kokaithai",
  32688. 0x0e01,
  32689. "kokatakana",
  32690. 0x30b3,
  32691. "kokatakanahalfwidth",
  32692. 0xff7a,
  32693. "kooposquare",
  32694. 0x331e,
  32695. "koppacyrillic",
  32696. 0x0481,
  32697. "koreanstandardsymbol",
  32698. 0x327f,
  32699. "koroniscmb",
  32700. 0x0343,
  32701. "kparen",
  32702. 0x24a6,
  32703. "kpasquare",
  32704. 0x33aa,
  32705. "ksicyrillic",
  32706. 0x046f,
  32707. "ktsquare",
  32708. 0x33cf,
  32709. "kturned",
  32710. 0x029e,
  32711. "kuhiragana",
  32712. 0x304f,
  32713. "kukatakana",
  32714. 0x30af,
  32715. "kukatakanahalfwidth",
  32716. 0xff78,
  32717. "kvsquare",
  32718. 0x33b8,
  32719. "kwsquare",
  32720. 0x33be,
  32721. "l",
  32722. 0x006c,
  32723. "labengali",
  32724. 0x09b2,
  32725. "lacute",
  32726. 0x013a,
  32727. "ladeva",
  32728. 0x0932,
  32729. "lagujarati",
  32730. 0x0ab2,
  32731. "lagurmukhi",
  32732. 0x0a32,
  32733. "lakkhangyaothai",
  32734. 0x0e45,
  32735. "lamaleffinalarabic",
  32736. 0xfefc,
  32737. "lamalefhamzaabovefinalarabic",
  32738. 0xfef8,
  32739. "lamalefhamzaaboveisolatedarabic",
  32740. 0xfef7,
  32741. "lamalefhamzabelowfinalarabic",
  32742. 0xfefa,
  32743. "lamalefhamzabelowisolatedarabic",
  32744. 0xfef9,
  32745. "lamalefisolatedarabic",
  32746. 0xfefb,
  32747. "lamalefmaddaabovefinalarabic",
  32748. 0xfef6,
  32749. "lamalefmaddaaboveisolatedarabic",
  32750. 0xfef5,
  32751. "lamarabic",
  32752. 0x0644,
  32753. "lambda",
  32754. 0x03bb,
  32755. "lambdastroke",
  32756. 0x019b,
  32757. "lamed",
  32758. 0x05dc,
  32759. "lameddagesh",
  32760. 0xfb3c,
  32761. "lameddageshhebrew",
  32762. 0xfb3c,
  32763. "lamedhebrew",
  32764. 0x05dc,
  32765. "lamfinalarabic",
  32766. 0xfede,
  32767. "lamhahinitialarabic",
  32768. 0xfcca,
  32769. "laminitialarabic",
  32770. 0xfedf,
  32771. "lamjeeminitialarabic",
  32772. 0xfcc9,
  32773. "lamkhahinitialarabic",
  32774. 0xfccb,
  32775. "lamlamhehisolatedarabic",
  32776. 0xfdf2,
  32777. "lammedialarabic",
  32778. 0xfee0,
  32779. "lammeemhahinitialarabic",
  32780. 0xfd88,
  32781. "lammeeminitialarabic",
  32782. 0xfccc,
  32783. "largecircle",
  32784. 0x25ef,
  32785. "lbar",
  32786. 0x019a,
  32787. "lbelt",
  32788. 0x026c,
  32789. "lbopomofo",
  32790. 0x310c,
  32791. "lcaron",
  32792. 0x013e,
  32793. "lcedilla",
  32794. 0x013c,
  32795. "lcircle",
  32796. 0x24db,
  32797. "lcircumflexbelow",
  32798. 0x1e3d,
  32799. "lcommaaccent",
  32800. 0x013c,
  32801. "ldot",
  32802. 0x0140,
  32803. "ldotaccent",
  32804. 0x0140,
  32805. "ldotbelow",
  32806. 0x1e37,
  32807. "ldotbelowmacron",
  32808. 0x1e39,
  32809. "leftangleabovecmb",
  32810. 0x031a,
  32811. "lefttackbelowcmb",
  32812. 0x0318,
  32813. "less",
  32814. 0x003c,
  32815. "lessequal",
  32816. 0x2264,
  32817. "lessequalorgreater",
  32818. 0x22da,
  32819. "lessmonospace",
  32820. 0xff1c,
  32821. "lessorequivalent",
  32822. 0x2272,
  32823. "lessorgreater",
  32824. 0x2276,
  32825. "lessoverequal",
  32826. 0x2266,
  32827. "lesssmall",
  32828. 0xfe64,
  32829. "lezh",
  32830. 0x026e,
  32831. "lfblock",
  32832. 0x258c,
  32833. "lhookretroflex",
  32834. 0x026d,
  32835. "lira",
  32836. 0x20a4,
  32837. "liwnarmenian",
  32838. 0x056c,
  32839. "lj",
  32840. 0x01c9,
  32841. "ljecyrillic",
  32842. 0x0459,
  32843. "ll",
  32844. 0xf6c0,
  32845. "lladeva",
  32846. 0x0933,
  32847. "llagujarati",
  32848. 0x0ab3,
  32849. "llinebelow",
  32850. 0x1e3b,
  32851. "llladeva",
  32852. 0x0934,
  32853. "llvocalicbengali",
  32854. 0x09e1,
  32855. "llvocalicdeva",
  32856. 0x0961,
  32857. "llvocalicvowelsignbengali",
  32858. 0x09e3,
  32859. "llvocalicvowelsigndeva",
  32860. 0x0963,
  32861. "lmiddletilde",
  32862. 0x026b,
  32863. "lmonospace",
  32864. 0xff4c,
  32865. "lmsquare",
  32866. 0x33d0,
  32867. "lochulathai",
  32868. 0x0e2c,
  32869. "logicaland",
  32870. 0x2227,
  32871. "logicalnot",
  32872. 0x00ac,
  32873. "logicalnotreversed",
  32874. 0x2310,
  32875. "logicalor",
  32876. 0x2228,
  32877. "lolingthai",
  32878. 0x0e25,
  32879. "longs",
  32880. 0x017f,
  32881. "lowlinecenterline",
  32882. 0xfe4e,
  32883. "lowlinecmb",
  32884. 0x0332,
  32885. "lowlinedashed",
  32886. 0xfe4d,
  32887. "lozenge",
  32888. 0x25ca,
  32889. "lparen",
  32890. 0x24a7,
  32891. "lslash",
  32892. 0x0142,
  32893. "lsquare",
  32894. 0x2113,
  32895. "lsuperior",
  32896. 0xf6ee,
  32897. "ltshade",
  32898. 0x2591,
  32899. "luthai",
  32900. 0x0e26,
  32901. "lvocalicbengali",
  32902. 0x098c,
  32903. "lvocalicdeva",
  32904. 0x090c,
  32905. "lvocalicvowelsignbengali",
  32906. 0x09e2,
  32907. "lvocalicvowelsigndeva",
  32908. 0x0962,
  32909. "lxsquare",
  32910. 0x33d3,
  32911. "m",
  32912. 0x006d,
  32913. "mabengali",
  32914. 0x09ae,
  32915. "macron",
  32916. 0x00af,
  32917. "macronbelowcmb",
  32918. 0x0331,
  32919. "macroncmb",
  32920. 0x0304,
  32921. "macronlowmod",
  32922. 0x02cd,
  32923. "macronmonospace",
  32924. 0xffe3,
  32925. "macute",
  32926. 0x1e3f,
  32927. "madeva",
  32928. 0x092e,
  32929. "magujarati",
  32930. 0x0aae,
  32931. "magurmukhi",
  32932. 0x0a2e,
  32933. "mahapakhhebrew",
  32934. 0x05a4,
  32935. "mahapakhlefthebrew",
  32936. 0x05a4,
  32937. "mahiragana",
  32938. 0x307e,
  32939. "maichattawalowleftthai",
  32940. 0xf895,
  32941. "maichattawalowrightthai",
  32942. 0xf894,
  32943. "maichattawathai",
  32944. 0x0e4b,
  32945. "maichattawaupperleftthai",
  32946. 0xf893,
  32947. "maieklowleftthai",
  32948. 0xf88c,
  32949. "maieklowrightthai",
  32950. 0xf88b,
  32951. "maiekthai",
  32952. 0x0e48,
  32953. "maiekupperleftthai",
  32954. 0xf88a,
  32955. "maihanakatleftthai",
  32956. 0xf884,
  32957. "maihanakatthai",
  32958. 0x0e31,
  32959. "maitaikhuleftthai",
  32960. 0xf889,
  32961. "maitaikhuthai",
  32962. 0x0e47,
  32963. "maitholowleftthai",
  32964. 0xf88f,
  32965. "maitholowrightthai",
  32966. 0xf88e,
  32967. "maithothai",
  32968. 0x0e49,
  32969. "maithoupperleftthai",
  32970. 0xf88d,
  32971. "maitrilowleftthai",
  32972. 0xf892,
  32973. "maitrilowrightthai",
  32974. 0xf891,
  32975. "maitrithai",
  32976. 0x0e4a,
  32977. "maitriupperleftthai",
  32978. 0xf890,
  32979. "maiyamokthai",
  32980. 0x0e46,
  32981. "makatakana",
  32982. 0x30de,
  32983. "makatakanahalfwidth",
  32984. 0xff8f,
  32985. "male",
  32986. 0x2642,
  32987. "mansyonsquare",
  32988. 0x3347,
  32989. "maqafhebrew",
  32990. 0x05be,
  32991. "mars",
  32992. 0x2642,
  32993. "masoracirclehebrew",
  32994. 0x05af,
  32995. "masquare",
  32996. 0x3383,
  32997. "mbopomofo",
  32998. 0x3107,
  32999. "mbsquare",
  33000. 0x33d4,
  33001. "mcircle",
  33002. 0x24dc,
  33003. "mcubedsquare",
  33004. 0x33a5,
  33005. "mdotaccent",
  33006. 0x1e41,
  33007. "mdotbelow",
  33008. 0x1e43,
  33009. "meemarabic",
  33010. 0x0645,
  33011. "meemfinalarabic",
  33012. 0xfee2,
  33013. "meeminitialarabic",
  33014. 0xfee3,
  33015. "meemmedialarabic",
  33016. 0xfee4,
  33017. "meemmeeminitialarabic",
  33018. 0xfcd1,
  33019. "meemmeemisolatedarabic",
  33020. 0xfc48,
  33021. "meetorusquare",
  33022. 0x334d,
  33023. "mehiragana",
  33024. 0x3081,
  33025. "meizierasquare",
  33026. 0x337e,
  33027. "mekatakana",
  33028. 0x30e1,
  33029. "mekatakanahalfwidth",
  33030. 0xff92,
  33031. "mem",
  33032. 0x05de,
  33033. "memdagesh",
  33034. 0xfb3e,
  33035. "memdageshhebrew",
  33036. 0xfb3e,
  33037. "memhebrew",
  33038. 0x05de,
  33039. "menarmenian",
  33040. 0x0574,
  33041. "merkhahebrew",
  33042. 0x05a5,
  33043. "merkhakefulahebrew",
  33044. 0x05a6,
  33045. "merkhakefulalefthebrew",
  33046. 0x05a6,
  33047. "merkhalefthebrew",
  33048. 0x05a5,
  33049. "mhook",
  33050. 0x0271,
  33051. "mhzsquare",
  33052. 0x3392,
  33053. "middledotkatakanahalfwidth",
  33054. 0xff65,
  33055. "middot",
  33056. 0x00b7,
  33057. "mieumacirclekorean",
  33058. 0x3272,
  33059. "mieumaparenkorean",
  33060. 0x3212,
  33061. "mieumcirclekorean",
  33062. 0x3264,
  33063. "mieumkorean",
  33064. 0x3141,
  33065. "mieumpansioskorean",
  33066. 0x3170,
  33067. "mieumparenkorean",
  33068. 0x3204,
  33069. "mieumpieupkorean",
  33070. 0x316e,
  33071. "mieumsioskorean",
  33072. 0x316f,
  33073. "mihiragana",
  33074. 0x307f,
  33075. "mikatakana",
  33076. 0x30df,
  33077. "mikatakanahalfwidth",
  33078. 0xff90,
  33079. "minus",
  33080. 0x2212,
  33081. "minusbelowcmb",
  33082. 0x0320,
  33083. "minuscircle",
  33084. 0x2296,
  33085. "minusmod",
  33086. 0x02d7,
  33087. "minusplus",
  33088. 0x2213,
  33089. "minute",
  33090. 0x2032,
  33091. "miribaarusquare",
  33092. 0x334a,
  33093. "mirisquare",
  33094. 0x3349,
  33095. "mlonglegturned",
  33096. 0x0270,
  33097. "mlsquare",
  33098. 0x3396,
  33099. "mmcubedsquare",
  33100. 0x33a3,
  33101. "mmonospace",
  33102. 0xff4d,
  33103. "mmsquaredsquare",
  33104. 0x339f,
  33105. "mohiragana",
  33106. 0x3082,
  33107. "mohmsquare",
  33108. 0x33c1,
  33109. "mokatakana",
  33110. 0x30e2,
  33111. "mokatakanahalfwidth",
  33112. 0xff93,
  33113. "molsquare",
  33114. 0x33d6,
  33115. "momathai",
  33116. 0x0e21,
  33117. "moverssquare",
  33118. 0x33a7,
  33119. "moverssquaredsquare",
  33120. 0x33a8,
  33121. "mparen",
  33122. 0x24a8,
  33123. "mpasquare",
  33124. 0x33ab,
  33125. "mssquare",
  33126. 0x33b3,
  33127. "msuperior",
  33128. 0xf6ef,
  33129. "mturned",
  33130. 0x026f,
  33131. "mu",
  33132. 0x00b5,
  33133. "mu1",
  33134. 0x00b5,
  33135. "muasquare",
  33136. 0x3382,
  33137. "muchgreater",
  33138. 0x226b,
  33139. "muchless",
  33140. 0x226a,
  33141. "mufsquare",
  33142. 0x338c,
  33143. "mugreek",
  33144. 0x03bc,
  33145. "mugsquare",
  33146. 0x338d,
  33147. "muhiragana",
  33148. 0x3080,
  33149. "mukatakana",
  33150. 0x30e0,
  33151. "mukatakanahalfwidth",
  33152. 0xff91,
  33153. "mulsquare",
  33154. 0x3395,
  33155. "multiply",
  33156. 0x00d7,
  33157. "mumsquare",
  33158. 0x339b,
  33159. "munahhebrew",
  33160. 0x05a3,
  33161. "munahlefthebrew",
  33162. 0x05a3,
  33163. "musicalnote",
  33164. 0x266a,
  33165. "musicalnotedbl",
  33166. 0x266b,
  33167. "musicflatsign",
  33168. 0x266d,
  33169. "musicsharpsign",
  33170. 0x266f,
  33171. "mussquare",
  33172. 0x33b2,
  33173. "muvsquare",
  33174. 0x33b6,
  33175. "muwsquare",
  33176. 0x33bc,
  33177. "mvmegasquare",
  33178. 0x33b9,
  33179. "mvsquare",
  33180. 0x33b7,
  33181. "mwmegasquare",
  33182. 0x33bf,
  33183. "mwsquare",
  33184. 0x33bd,
  33185. "n",
  33186. 0x006e,
  33187. "nabengali",
  33188. 0x09a8,
  33189. "nabla",
  33190. 0x2207,
  33191. "nacute",
  33192. 0x0144,
  33193. "nadeva",
  33194. 0x0928,
  33195. "nagujarati",
  33196. 0x0aa8,
  33197. "nagurmukhi",
  33198. 0x0a28,
  33199. "nahiragana",
  33200. 0x306a,
  33201. "nakatakana",
  33202. 0x30ca,
  33203. "nakatakanahalfwidth",
  33204. 0xff85,
  33205. "napostrophe",
  33206. 0x0149,
  33207. "nasquare",
  33208. 0x3381,
  33209. "nbopomofo",
  33210. 0x310b,
  33211. "nbspace",
  33212. 0x00a0,
  33213. "ncaron",
  33214. 0x0148,
  33215. "ncedilla",
  33216. 0x0146,
  33217. "ncircle",
  33218. 0x24dd,
  33219. "ncircumflexbelow",
  33220. 0x1e4b,
  33221. "ncommaaccent",
  33222. 0x0146,
  33223. "ndotaccent",
  33224. 0x1e45,
  33225. "ndotbelow",
  33226. 0x1e47,
  33227. "nehiragana",
  33228. 0x306d,
  33229. "nekatakana",
  33230. 0x30cd,
  33231. "nekatakanahalfwidth",
  33232. 0xff88,
  33233. "newsheqelsign",
  33234. 0x20aa,
  33235. "nfsquare",
  33236. 0x338b,
  33237. "ngabengali",
  33238. 0x0999,
  33239. "ngadeva",
  33240. 0x0919,
  33241. "ngagujarati",
  33242. 0x0a99,
  33243. "ngagurmukhi",
  33244. 0x0a19,
  33245. "ngonguthai",
  33246. 0x0e07,
  33247. "nhiragana",
  33248. 0x3093,
  33249. "nhookleft",
  33250. 0x0272,
  33251. "nhookretroflex",
  33252. 0x0273,
  33253. "nieunacirclekorean",
  33254. 0x326f,
  33255. "nieunaparenkorean",
  33256. 0x320f,
  33257. "nieuncieuckorean",
  33258. 0x3135,
  33259. "nieuncirclekorean",
  33260. 0x3261,
  33261. "nieunhieuhkorean",
  33262. 0x3136,
  33263. "nieunkorean",
  33264. 0x3134,
  33265. "nieunpansioskorean",
  33266. 0x3168,
  33267. "nieunparenkorean",
  33268. 0x3201,
  33269. "nieunsioskorean",
  33270. 0x3167,
  33271. "nieuntikeutkorean",
  33272. 0x3166,
  33273. "nihiragana",
  33274. 0x306b,
  33275. "nikatakana",
  33276. 0x30cb,
  33277. "nikatakanahalfwidth",
  33278. 0xff86,
  33279. "nikhahitleftthai",
  33280. 0xf899,
  33281. "nikhahitthai",
  33282. 0x0e4d,
  33283. "nine",
  33284. 0x0039,
  33285. "ninearabic",
  33286. 0x0669,
  33287. "ninebengali",
  33288. 0x09ef,
  33289. "ninecircle",
  33290. 0x2468,
  33291. "ninecircleinversesansserif",
  33292. 0x2792,
  33293. "ninedeva",
  33294. 0x096f,
  33295. "ninegujarati",
  33296. 0x0aef,
  33297. "ninegurmukhi",
  33298. 0x0a6f,
  33299. "ninehackarabic",
  33300. 0x0669,
  33301. "ninehangzhou",
  33302. 0x3029,
  33303. "nineideographicparen",
  33304. 0x3228,
  33305. "nineinferior",
  33306. 0x2089,
  33307. "ninemonospace",
  33308. 0xff19,
  33309. "nineoldstyle",
  33310. 0xf739,
  33311. "nineparen",
  33312. 0x247c,
  33313. "nineperiod",
  33314. 0x2490,
  33315. "ninepersian",
  33316. 0x06f9,
  33317. "nineroman",
  33318. 0x2178,
  33319. "ninesuperior",
  33320. 0x2079,
  33321. "nineteencircle",
  33322. 0x2472,
  33323. "nineteenparen",
  33324. 0x2486,
  33325. "nineteenperiod",
  33326. 0x249a,
  33327. "ninethai",
  33328. 0x0e59,
  33329. "nj",
  33330. 0x01cc,
  33331. "njecyrillic",
  33332. 0x045a,
  33333. "nkatakana",
  33334. 0x30f3,
  33335. "nkatakanahalfwidth",
  33336. 0xff9d,
  33337. "nlegrightlong",
  33338. 0x019e,
  33339. "nlinebelow",
  33340. 0x1e49,
  33341. "nmonospace",
  33342. 0xff4e,
  33343. "nmsquare",
  33344. 0x339a,
  33345. "nnabengali",
  33346. 0x09a3,
  33347. "nnadeva",
  33348. 0x0923,
  33349. "nnagujarati",
  33350. 0x0aa3,
  33351. "nnagurmukhi",
  33352. 0x0a23,
  33353. "nnnadeva",
  33354. 0x0929,
  33355. "nohiragana",
  33356. 0x306e,
  33357. "nokatakana",
  33358. 0x30ce,
  33359. "nokatakanahalfwidth",
  33360. 0xff89,
  33361. "nonbreakingspace",
  33362. 0x00a0,
  33363. "nonenthai",
  33364. 0x0e13,
  33365. "nonuthai",
  33366. 0x0e19,
  33367. "noonarabic",
  33368. 0x0646,
  33369. "noonfinalarabic",
  33370. 0xfee6,
  33371. "noonghunnaarabic",
  33372. 0x06ba,
  33373. "noonghunnafinalarabic",
  33374. 0xfb9f,
  33375. "nooninitialarabic",
  33376. 0xfee7,
  33377. "noonjeeminitialarabic",
  33378. 0xfcd2,
  33379. "noonjeemisolatedarabic",
  33380. 0xfc4b,
  33381. "noonmedialarabic",
  33382. 0xfee8,
  33383. "noonmeeminitialarabic",
  33384. 0xfcd5,
  33385. "noonmeemisolatedarabic",
  33386. 0xfc4e,
  33387. "noonnoonfinalarabic",
  33388. 0xfc8d,
  33389. "notcontains",
  33390. 0x220c,
  33391. "notelement",
  33392. 0x2209,
  33393. "notelementof",
  33394. 0x2209,
  33395. "notequal",
  33396. 0x2260,
  33397. "notgreater",
  33398. 0x226f,
  33399. "notgreaternorequal",
  33400. 0x2271,
  33401. "notgreaternorless",
  33402. 0x2279,
  33403. "notidentical",
  33404. 0x2262,
  33405. "notless",
  33406. 0x226e,
  33407. "notlessnorequal",
  33408. 0x2270,
  33409. "notparallel",
  33410. 0x2226,
  33411. "notprecedes",
  33412. 0x2280,
  33413. "notsubset",
  33414. 0x2284,
  33415. "notsucceeds",
  33416. 0x2281,
  33417. "notsuperset",
  33418. 0x2285,
  33419. "nowarmenian",
  33420. 0x0576,
  33421. "nparen",
  33422. 0x24a9,
  33423. "nssquare",
  33424. 0x33b1,
  33425. "nsuperior",
  33426. 0x207f,
  33427. "ntilde",
  33428. 0x00f1,
  33429. "nu",
  33430. 0x03bd,
  33431. "nuhiragana",
  33432. 0x306c,
  33433. "nukatakana",
  33434. 0x30cc,
  33435. "nukatakanahalfwidth",
  33436. 0xff87,
  33437. "nuktabengali",
  33438. 0x09bc,
  33439. "nuktadeva",
  33440. 0x093c,
  33441. "nuktagujarati",
  33442. 0x0abc,
  33443. "nuktagurmukhi",
  33444. 0x0a3c,
  33445. "numbersign",
  33446. 0x0023,
  33447. "numbersignmonospace",
  33448. 0xff03,
  33449. "numbersignsmall",
  33450. 0xfe5f,
  33451. "numeralsigngreek",
  33452. 0x0374,
  33453. "numeralsignlowergreek",
  33454. 0x0375,
  33455. "numero",
  33456. 0x2116,
  33457. "nun",
  33458. 0x05e0,
  33459. "nundagesh",
  33460. 0xfb40,
  33461. "nundageshhebrew",
  33462. 0xfb40,
  33463. "nunhebrew",
  33464. 0x05e0,
  33465. "nvsquare",
  33466. 0x33b5,
  33467. "nwsquare",
  33468. 0x33bb,
  33469. "nyabengali",
  33470. 0x099e,
  33471. "nyadeva",
  33472. 0x091e,
  33473. "nyagujarati",
  33474. 0x0a9e,
  33475. "nyagurmukhi",
  33476. 0x0a1e,
  33477. "o",
  33478. 0x006f,
  33479. "oacute",
  33480. 0x00f3,
  33481. "oangthai",
  33482. 0x0e2d,
  33483. "obarred",
  33484. 0x0275,
  33485. "obarredcyrillic",
  33486. 0x04e9,
  33487. "obarreddieresiscyrillic",
  33488. 0x04eb,
  33489. "obengali",
  33490. 0x0993,
  33491. "obopomofo",
  33492. 0x311b,
  33493. "obreve",
  33494. 0x014f,
  33495. "ocandradeva",
  33496. 0x0911,
  33497. "ocandragujarati",
  33498. 0x0a91,
  33499. "ocandravowelsigndeva",
  33500. 0x0949,
  33501. "ocandravowelsigngujarati",
  33502. 0x0ac9,
  33503. "ocaron",
  33504. 0x01d2,
  33505. "ocircle",
  33506. 0x24de,
  33507. "ocircumflex",
  33508. 0x00f4,
  33509. "ocircumflexacute",
  33510. 0x1ed1,
  33511. "ocircumflexdotbelow",
  33512. 0x1ed9,
  33513. "ocircumflexgrave",
  33514. 0x1ed3,
  33515. "ocircumflexhookabove",
  33516. 0x1ed5,
  33517. "ocircumflextilde",
  33518. 0x1ed7,
  33519. "ocyrillic",
  33520. 0x043e,
  33521. "odblacute",
  33522. 0x0151,
  33523. "odblgrave",
  33524. 0x020d,
  33525. "odeva",
  33526. 0x0913,
  33527. "odieresis",
  33528. 0x00f6,
  33529. "odieresiscyrillic",
  33530. 0x04e7,
  33531. "odotbelow",
  33532. 0x1ecd,
  33533. "oe",
  33534. 0x0153,
  33535. "oekorean",
  33536. 0x315a,
  33537. "ogonek",
  33538. 0x02db,
  33539. "ogonekcmb",
  33540. 0x0328,
  33541. "ograve",
  33542. 0x00f2,
  33543. "ogujarati",
  33544. 0x0a93,
  33545. "oharmenian",
  33546. 0x0585,
  33547. "ohiragana",
  33548. 0x304a,
  33549. "ohookabove",
  33550. 0x1ecf,
  33551. "ohorn",
  33552. 0x01a1,
  33553. "ohornacute",
  33554. 0x1edb,
  33555. "ohorndotbelow",
  33556. 0x1ee3,
  33557. "ohorngrave",
  33558. 0x1edd,
  33559. "ohornhookabove",
  33560. 0x1edf,
  33561. "ohorntilde",
  33562. 0x1ee1,
  33563. "ohungarumlaut",
  33564. 0x0151,
  33565. "oi",
  33566. 0x01a3,
  33567. "oinvertedbreve",
  33568. 0x020f,
  33569. "okatakana",
  33570. 0x30aa,
  33571. "okatakanahalfwidth",
  33572. 0xff75,
  33573. "okorean",
  33574. 0x3157,
  33575. "olehebrew",
  33576. 0x05ab,
  33577. "omacron",
  33578. 0x014d,
  33579. "omacronacute",
  33580. 0x1e53,
  33581. "omacrongrave",
  33582. 0x1e51,
  33583. "omdeva",
  33584. 0x0950,
  33585. "omega",
  33586. 0x03c9,
  33587. "omega1",
  33588. 0x03d6,
  33589. "omegacyrillic",
  33590. 0x0461,
  33591. "omegalatinclosed",
  33592. 0x0277,
  33593. "omegaroundcyrillic",
  33594. 0x047b,
  33595. "omegatitlocyrillic",
  33596. 0x047d,
  33597. "omegatonos",
  33598. 0x03ce,
  33599. "omgujarati",
  33600. 0x0ad0,
  33601. "omicron",
  33602. 0x03bf,
  33603. "omicrontonos",
  33604. 0x03cc,
  33605. "omonospace",
  33606. 0xff4f,
  33607. "one",
  33608. 0x0031,
  33609. "onearabic",
  33610. 0x0661,
  33611. "onebengali",
  33612. 0x09e7,
  33613. "onecircle",
  33614. 0x2460,
  33615. "onecircleinversesansserif",
  33616. 0x278a,
  33617. "onedeva",
  33618. 0x0967,
  33619. "onedotenleader",
  33620. 0x2024,
  33621. "oneeighth",
  33622. 0x215b,
  33623. "onefitted",
  33624. 0xf6dc,
  33625. "onegujarati",
  33626. 0x0ae7,
  33627. "onegurmukhi",
  33628. 0x0a67,
  33629. "onehackarabic",
  33630. 0x0661,
  33631. "onehalf",
  33632. 0x00bd,
  33633. "onehangzhou",
  33634. 0x3021,
  33635. "oneideographicparen",
  33636. 0x3220,
  33637. "oneinferior",
  33638. 0x2081,
  33639. "onemonospace",
  33640. 0xff11,
  33641. "onenumeratorbengali",
  33642. 0x09f4,
  33643. "oneoldstyle",
  33644. 0xf731,
  33645. "oneparen",
  33646. 0x2474,
  33647. "oneperiod",
  33648. 0x2488,
  33649. "onepersian",
  33650. 0x06f1,
  33651. "onequarter",
  33652. 0x00bc,
  33653. "oneroman",
  33654. 0x2170,
  33655. "onesuperior",
  33656. 0x00b9,
  33657. "onethai",
  33658. 0x0e51,
  33659. "onethird",
  33660. 0x2153,
  33661. "oogonek",
  33662. 0x01eb,
  33663. "oogonekmacron",
  33664. 0x01ed,
  33665. "oogurmukhi",
  33666. 0x0a13,
  33667. "oomatragurmukhi",
  33668. 0x0a4b,
  33669. "oopen",
  33670. 0x0254,
  33671. "oparen",
  33672. 0x24aa,
  33673. "openbullet",
  33674. 0x25e6,
  33675. "option",
  33676. 0x2325,
  33677. "ordfeminine",
  33678. 0x00aa,
  33679. "ordmasculine",
  33680. 0x00ba,
  33681. "orthogonal",
  33682. 0x221f,
  33683. "oshortdeva",
  33684. 0x0912,
  33685. "oshortvowelsigndeva",
  33686. 0x094a,
  33687. "oslash",
  33688. 0x00f8,
  33689. "oslashacute",
  33690. 0x01ff,
  33691. "osmallhiragana",
  33692. 0x3049,
  33693. "osmallkatakana",
  33694. 0x30a9,
  33695. "osmallkatakanahalfwidth",
  33696. 0xff6b,
  33697. "ostrokeacute",
  33698. 0x01ff,
  33699. "osuperior",
  33700. 0xf6f0,
  33701. "otcyrillic",
  33702. 0x047f,
  33703. "otilde",
  33704. 0x00f5,
  33705. "otildeacute",
  33706. 0x1e4d,
  33707. "otildedieresis",
  33708. 0x1e4f,
  33709. "oubopomofo",
  33710. 0x3121,
  33711. "overline",
  33712. 0x203e,
  33713. "overlinecenterline",
  33714. 0xfe4a,
  33715. "overlinecmb",
  33716. 0x0305,
  33717. "overlinedashed",
  33718. 0xfe49,
  33719. "overlinedblwavy",
  33720. 0xfe4c,
  33721. "overlinewavy",
  33722. 0xfe4b,
  33723. "overscore",
  33724. 0x00af,
  33725. "ovowelsignbengali",
  33726. 0x09cb,
  33727. "ovowelsigndeva",
  33728. 0x094b,
  33729. "ovowelsigngujarati",
  33730. 0x0acb,
  33731. "p",
  33732. 0x0070,
  33733. "paampssquare",
  33734. 0x3380,
  33735. "paasentosquare",
  33736. 0x332b,
  33737. "pabengali",
  33738. 0x09aa,
  33739. "pacute",
  33740. 0x1e55,
  33741. "padeva",
  33742. 0x092a,
  33743. "pagedown",
  33744. 0x21df,
  33745. "pageup",
  33746. 0x21de,
  33747. "pagujarati",
  33748. 0x0aaa,
  33749. "pagurmukhi",
  33750. 0x0a2a,
  33751. "pahiragana",
  33752. 0x3071,
  33753. "paiyannoithai",
  33754. 0x0e2f,
  33755. "pakatakana",
  33756. 0x30d1,
  33757. "palatalizationcyrilliccmb",
  33758. 0x0484,
  33759. "palochkacyrillic",
  33760. 0x04c0,
  33761. "pansioskorean",
  33762. 0x317f,
  33763. "paragraph",
  33764. 0x00b6,
  33765. "parallel",
  33766. 0x2225,
  33767. "parenleft",
  33768. 0x0028,
  33769. "parenleftaltonearabic",
  33770. 0xfd3e,
  33771. "parenleftbt",
  33772. 0xf8ed,
  33773. "parenleftex",
  33774. 0xf8ec,
  33775. "parenleftinferior",
  33776. 0x208d,
  33777. "parenleftmonospace",
  33778. 0xff08,
  33779. "parenleftsmall",
  33780. 0xfe59,
  33781. "parenleftsuperior",
  33782. 0x207d,
  33783. "parenlefttp",
  33784. 0xf8eb,
  33785. "parenleftvertical",
  33786. 0xfe35,
  33787. "parenright",
  33788. 0x0029,
  33789. "parenrightaltonearabic",
  33790. 0xfd3f,
  33791. "parenrightbt",
  33792. 0xf8f8,
  33793. "parenrightex",
  33794. 0xf8f7,
  33795. "parenrightinferior",
  33796. 0x208e,
  33797. "parenrightmonospace",
  33798. 0xff09,
  33799. "parenrightsmall",
  33800. 0xfe5a,
  33801. "parenrightsuperior",
  33802. 0x207e,
  33803. "parenrighttp",
  33804. 0xf8f6,
  33805. "parenrightvertical",
  33806. 0xfe36,
  33807. "partialdiff",
  33808. 0x2202,
  33809. "paseqhebrew",
  33810. 0x05c0,
  33811. "pashtahebrew",
  33812. 0x0599,
  33813. "pasquare",
  33814. 0x33a9,
  33815. "patah",
  33816. 0x05b7,
  33817. "patah11",
  33818. 0x05b7,
  33819. "patah1d",
  33820. 0x05b7,
  33821. "patah2a",
  33822. 0x05b7,
  33823. "patahhebrew",
  33824. 0x05b7,
  33825. "patahnarrowhebrew",
  33826. 0x05b7,
  33827. "patahquarterhebrew",
  33828. 0x05b7,
  33829. "patahwidehebrew",
  33830. 0x05b7,
  33831. "pazerhebrew",
  33832. 0x05a1,
  33833. "pbopomofo",
  33834. 0x3106,
  33835. "pcircle",
  33836. 0x24df,
  33837. "pdotaccent",
  33838. 0x1e57,
  33839. "pe",
  33840. 0x05e4,
  33841. "pecyrillic",
  33842. 0x043f,
  33843. "pedagesh",
  33844. 0xfb44,
  33845. "pedageshhebrew",
  33846. 0xfb44,
  33847. "peezisquare",
  33848. 0x333b,
  33849. "pefinaldageshhebrew",
  33850. 0xfb43,
  33851. "peharabic",
  33852. 0x067e,
  33853. "peharmenian",
  33854. 0x057a,
  33855. "pehebrew",
  33856. 0x05e4,
  33857. "pehfinalarabic",
  33858. 0xfb57,
  33859. "pehinitialarabic",
  33860. 0xfb58,
  33861. "pehiragana",
  33862. 0x307a,
  33863. "pehmedialarabic",
  33864. 0xfb59,
  33865. "pekatakana",
  33866. 0x30da,
  33867. "pemiddlehookcyrillic",
  33868. 0x04a7,
  33869. "perafehebrew",
  33870. 0xfb4e,
  33871. "percent",
  33872. 0x0025,
  33873. "percentarabic",
  33874. 0x066a,
  33875. "percentmonospace",
  33876. 0xff05,
  33877. "percentsmall",
  33878. 0xfe6a,
  33879. "period",
  33880. 0x002e,
  33881. "periodarmenian",
  33882. 0x0589,
  33883. "periodcentered",
  33884. 0x00b7,
  33885. "periodhalfwidth",
  33886. 0xff61,
  33887. "periodinferior",
  33888. 0xf6e7,
  33889. "periodmonospace",
  33890. 0xff0e,
  33891. "periodsmall",
  33892. 0xfe52,
  33893. "periodsuperior",
  33894. 0xf6e8,
  33895. "perispomenigreekcmb",
  33896. 0x0342,
  33897. "perpendicular",
  33898. 0x22a5,
  33899. "perthousand",
  33900. 0x2030,
  33901. "peseta",
  33902. 0x20a7,
  33903. "pfsquare",
  33904. 0x338a,
  33905. "phabengali",
  33906. 0x09ab,
  33907. "phadeva",
  33908. 0x092b,
  33909. "phagujarati",
  33910. 0x0aab,
  33911. "phagurmukhi",
  33912. 0x0a2b,
  33913. "phi",
  33914. 0x03c6,
  33915. "phi1",
  33916. 0x03d5,
  33917. "phieuphacirclekorean",
  33918. 0x327a,
  33919. "phieuphaparenkorean",
  33920. 0x321a,
  33921. "phieuphcirclekorean",
  33922. 0x326c,
  33923. "phieuphkorean",
  33924. 0x314d,
  33925. "phieuphparenkorean",
  33926. 0x320c,
  33927. "philatin",
  33928. 0x0278,
  33929. "phinthuthai",
  33930. 0x0e3a,
  33931. "phisymbolgreek",
  33932. 0x03d5,
  33933. "phook",
  33934. 0x01a5,
  33935. "phophanthai",
  33936. 0x0e1e,
  33937. "phophungthai",
  33938. 0x0e1c,
  33939. "phosamphaothai",
  33940. 0x0e20,
  33941. "pi",
  33942. 0x03c0,
  33943. "pieupacirclekorean",
  33944. 0x3273,
  33945. "pieupaparenkorean",
  33946. 0x3213,
  33947. "pieupcieuckorean",
  33948. 0x3176,
  33949. "pieupcirclekorean",
  33950. 0x3265,
  33951. "pieupkiyeokkorean",
  33952. 0x3172,
  33953. "pieupkorean",
  33954. 0x3142,
  33955. "pieupparenkorean",
  33956. 0x3205,
  33957. "pieupsioskiyeokkorean",
  33958. 0x3174,
  33959. "pieupsioskorean",
  33960. 0x3144,
  33961. "pieupsiostikeutkorean",
  33962. 0x3175,
  33963. "pieupthieuthkorean",
  33964. 0x3177,
  33965. "pieuptikeutkorean",
  33966. 0x3173,
  33967. "pihiragana",
  33968. 0x3074,
  33969. "pikatakana",
  33970. 0x30d4,
  33971. "pisymbolgreek",
  33972. 0x03d6,
  33973. "piwrarmenian",
  33974. 0x0583,
  33975. "plus",
  33976. 0x002b,
  33977. "plusbelowcmb",
  33978. 0x031f,
  33979. "pluscircle",
  33980. 0x2295,
  33981. "plusminus",
  33982. 0x00b1,
  33983. "plusmod",
  33984. 0x02d6,
  33985. "plusmonospace",
  33986. 0xff0b,
  33987. "plussmall",
  33988. 0xfe62,
  33989. "plussuperior",
  33990. 0x207a,
  33991. "pmonospace",
  33992. 0xff50,
  33993. "pmsquare",
  33994. 0x33d8,
  33995. "pohiragana",
  33996. 0x307d,
  33997. "pointingindexdownwhite",
  33998. 0x261f,
  33999. "pointingindexleftwhite",
  34000. 0x261c,
  34001. "pointingindexrightwhite",
  34002. 0x261e,
  34003. "pointingindexupwhite",
  34004. 0x261d,
  34005. "pokatakana",
  34006. 0x30dd,
  34007. "poplathai",
  34008. 0x0e1b,
  34009. "postalmark",
  34010. 0x3012,
  34011. "postalmarkface",
  34012. 0x3020,
  34013. "pparen",
  34014. 0x24ab,
  34015. "precedes",
  34016. 0x227a,
  34017. "prescription",
  34018. 0x211e,
  34019. "primemod",
  34020. 0x02b9,
  34021. "primereversed",
  34022. 0x2035,
  34023. "product",
  34024. 0x220f,
  34025. "projective",
  34026. 0x2305,
  34027. "prolongedkana",
  34028. 0x30fc,
  34029. "propellor",
  34030. 0x2318,
  34031. "propersubset",
  34032. 0x2282,
  34033. "propersuperset",
  34034. 0x2283,
  34035. "proportion",
  34036. 0x2237,
  34037. "proportional",
  34038. 0x221d,
  34039. "psi",
  34040. 0x03c8,
  34041. "psicyrillic",
  34042. 0x0471,
  34043. "psilipneumatacyrilliccmb",
  34044. 0x0486,
  34045. "pssquare",
  34046. 0x33b0,
  34047. "puhiragana",
  34048. 0x3077,
  34049. "pukatakana",
  34050. 0x30d7,
  34051. "pvsquare",
  34052. 0x33b4,
  34053. "pwsquare",
  34054. 0x33ba,
  34055. "q",
  34056. 0x0071,
  34057. "qadeva",
  34058. 0x0958,
  34059. "qadmahebrew",
  34060. 0x05a8,
  34061. "qafarabic",
  34062. 0x0642,
  34063. "qaffinalarabic",
  34064. 0xfed6,
  34065. "qafinitialarabic",
  34066. 0xfed7,
  34067. "qafmedialarabic",
  34068. 0xfed8,
  34069. "qamats",
  34070. 0x05b8,
  34071. "qamats10",
  34072. 0x05b8,
  34073. "qamats1a",
  34074. 0x05b8,
  34075. "qamats1c",
  34076. 0x05b8,
  34077. "qamats27",
  34078. 0x05b8,
  34079. "qamats29",
  34080. 0x05b8,
  34081. "qamats33",
  34082. 0x05b8,
  34083. "qamatsde",
  34084. 0x05b8,
  34085. "qamatshebrew",
  34086. 0x05b8,
  34087. "qamatsnarrowhebrew",
  34088. 0x05b8,
  34089. "qamatsqatanhebrew",
  34090. 0x05b8,
  34091. "qamatsqatannarrowhebrew",
  34092. 0x05b8,
  34093. "qamatsqatanquarterhebrew",
  34094. 0x05b8,
  34095. "qamatsqatanwidehebrew",
  34096. 0x05b8,
  34097. "qamatsquarterhebrew",
  34098. 0x05b8,
  34099. "qamatswidehebrew",
  34100. 0x05b8,
  34101. "qarneyparahebrew",
  34102. 0x059f,
  34103. "qbopomofo",
  34104. 0x3111,
  34105. "qcircle",
  34106. 0x24e0,
  34107. "qhook",
  34108. 0x02a0,
  34109. "qmonospace",
  34110. 0xff51,
  34111. "qof",
  34112. 0x05e7,
  34113. "qofdagesh",
  34114. 0xfb47,
  34115. "qofdageshhebrew",
  34116. 0xfb47,
  34117. "qofhebrew",
  34118. 0x05e7,
  34119. "qparen",
  34120. 0x24ac,
  34121. "quarternote",
  34122. 0x2669,
  34123. "qubuts",
  34124. 0x05bb,
  34125. "qubuts18",
  34126. 0x05bb,
  34127. "qubuts25",
  34128. 0x05bb,
  34129. "qubuts31",
  34130. 0x05bb,
  34131. "qubutshebrew",
  34132. 0x05bb,
  34133. "qubutsnarrowhebrew",
  34134. 0x05bb,
  34135. "qubutsquarterhebrew",
  34136. 0x05bb,
  34137. "qubutswidehebrew",
  34138. 0x05bb,
  34139. "question",
  34140. 0x003f,
  34141. "questionarabic",
  34142. 0x061f,
  34143. "questionarmenian",
  34144. 0x055e,
  34145. "questiondown",
  34146. 0x00bf,
  34147. "questiondownsmall",
  34148. 0xf7bf,
  34149. "questiongreek",
  34150. 0x037e,
  34151. "questionmonospace",
  34152. 0xff1f,
  34153. "questionsmall",
  34154. 0xf73f,
  34155. "quotedbl",
  34156. 0x0022,
  34157. "quotedblbase",
  34158. 0x201e,
  34159. "quotedblleft",
  34160. 0x201c,
  34161. "quotedblmonospace",
  34162. 0xff02,
  34163. "quotedblprime",
  34164. 0x301e,
  34165. "quotedblprimereversed",
  34166. 0x301d,
  34167. "quotedblright",
  34168. 0x201d,
  34169. "quoteleft",
  34170. 0x2018,
  34171. "quoteleftreversed",
  34172. 0x201b,
  34173. "quotereversed",
  34174. 0x201b,
  34175. "quoteright",
  34176. 0x2019,
  34177. "quoterightn",
  34178. 0x0149,
  34179. "quotesinglbase",
  34180. 0x201a,
  34181. "quotesingle",
  34182. 0x0027,
  34183. "quotesinglemonospace",
  34184. 0xff07,
  34185. "r",
  34186. 0x0072,
  34187. "raarmenian",
  34188. 0x057c,
  34189. "rabengali",
  34190. 0x09b0,
  34191. "racute",
  34192. 0x0155,
  34193. "radeva",
  34194. 0x0930,
  34195. "radical",
  34196. 0x221a,
  34197. "radicalex",
  34198. 0xf8e5,
  34199. "radoverssquare",
  34200. 0x33ae,
  34201. "radoverssquaredsquare",
  34202. 0x33af,
  34203. "radsquare",
  34204. 0x33ad,
  34205. "rafe",
  34206. 0x05bf,
  34207. "rafehebrew",
  34208. 0x05bf,
  34209. "ragujarati",
  34210. 0x0ab0,
  34211. "ragurmukhi",
  34212. 0x0a30,
  34213. "rahiragana",
  34214. 0x3089,
  34215. "rakatakana",
  34216. 0x30e9,
  34217. "rakatakanahalfwidth",
  34218. 0xff97,
  34219. "ralowerdiagonalbengali",
  34220. 0x09f1,
  34221. "ramiddlediagonalbengali",
  34222. 0x09f0,
  34223. "ramshorn",
  34224. 0x0264,
  34225. "ratio",
  34226. 0x2236,
  34227. "rbopomofo",
  34228. 0x3116,
  34229. "rcaron",
  34230. 0x0159,
  34231. "rcedilla",
  34232. 0x0157,
  34233. "rcircle",
  34234. 0x24e1,
  34235. "rcommaaccent",
  34236. 0x0157,
  34237. "rdblgrave",
  34238. 0x0211,
  34239. "rdotaccent",
  34240. 0x1e59,
  34241. "rdotbelow",
  34242. 0x1e5b,
  34243. "rdotbelowmacron",
  34244. 0x1e5d,
  34245. "referencemark",
  34246. 0x203b,
  34247. "reflexsubset",
  34248. 0x2286,
  34249. "reflexsuperset",
  34250. 0x2287,
  34251. "registered",
  34252. 0x00ae,
  34253. "registersans",
  34254. 0xf8e8,
  34255. "registerserif",
  34256. 0xf6da,
  34257. "reharabic",
  34258. 0x0631,
  34259. "reharmenian",
  34260. 0x0580,
  34261. "rehfinalarabic",
  34262. 0xfeae,
  34263. "rehiragana",
  34264. 0x308c,
  34265. "rekatakana",
  34266. 0x30ec,
  34267. "rekatakanahalfwidth",
  34268. 0xff9a,
  34269. "resh",
  34270. 0x05e8,
  34271. "reshdageshhebrew",
  34272. 0xfb48,
  34273. "reshhebrew",
  34274. 0x05e8,
  34275. "reversedtilde",
  34276. 0x223d,
  34277. "reviahebrew",
  34278. 0x0597,
  34279. "reviamugrashhebrew",
  34280. 0x0597,
  34281. "revlogicalnot",
  34282. 0x2310,
  34283. "rfishhook",
  34284. 0x027e,
  34285. "rfishhookreversed",
  34286. 0x027f,
  34287. "rhabengali",
  34288. 0x09dd,
  34289. "rhadeva",
  34290. 0x095d,
  34291. "rho",
  34292. 0x03c1,
  34293. "rhook",
  34294. 0x027d,
  34295. "rhookturned",
  34296. 0x027b,
  34297. "rhookturnedsuperior",
  34298. 0x02b5,
  34299. "rhosymbolgreek",
  34300. 0x03f1,
  34301. "rhotichookmod",
  34302. 0x02de,
  34303. "rieulacirclekorean",
  34304. 0x3271,
  34305. "rieulaparenkorean",
  34306. 0x3211,
  34307. "rieulcirclekorean",
  34308. 0x3263,
  34309. "rieulhieuhkorean",
  34310. 0x3140,
  34311. "rieulkiyeokkorean",
  34312. 0x313a,
  34313. "rieulkiyeoksioskorean",
  34314. 0x3169,
  34315. "rieulkorean",
  34316. 0x3139,
  34317. "rieulmieumkorean",
  34318. 0x313b,
  34319. "rieulpansioskorean",
  34320. 0x316c,
  34321. "rieulparenkorean",
  34322. 0x3203,
  34323. "rieulphieuphkorean",
  34324. 0x313f,
  34325. "rieulpieupkorean",
  34326. 0x313c,
  34327. "rieulpieupsioskorean",
  34328. 0x316b,
  34329. "rieulsioskorean",
  34330. 0x313d,
  34331. "rieulthieuthkorean",
  34332. 0x313e,
  34333. "rieultikeutkorean",
  34334. 0x316a,
  34335. "rieulyeorinhieuhkorean",
  34336. 0x316d,
  34337. "rightangle",
  34338. 0x221f,
  34339. "righttackbelowcmb",
  34340. 0x0319,
  34341. "righttriangle",
  34342. 0x22bf,
  34343. "rihiragana",
  34344. 0x308a,
  34345. "rikatakana",
  34346. 0x30ea,
  34347. "rikatakanahalfwidth",
  34348. 0xff98,
  34349. "ring",
  34350. 0x02da,
  34351. "ringbelowcmb",
  34352. 0x0325,
  34353. "ringcmb",
  34354. 0x030a,
  34355. "ringhalfleft",
  34356. 0x02bf,
  34357. "ringhalfleftarmenian",
  34358. 0x0559,
  34359. "ringhalfleftbelowcmb",
  34360. 0x031c,
  34361. "ringhalfleftcentered",
  34362. 0x02d3,
  34363. "ringhalfright",
  34364. 0x02be,
  34365. "ringhalfrightbelowcmb",
  34366. 0x0339,
  34367. "ringhalfrightcentered",
  34368. 0x02d2,
  34369. "rinvertedbreve",
  34370. 0x0213,
  34371. "rittorusquare",
  34372. 0x3351,
  34373. "rlinebelow",
  34374. 0x1e5f,
  34375. "rlongleg",
  34376. 0x027c,
  34377. "rlonglegturned",
  34378. 0x027a,
  34379. "rmonospace",
  34380. 0xff52,
  34381. "rohiragana",
  34382. 0x308d,
  34383. "rokatakana",
  34384. 0x30ed,
  34385. "rokatakanahalfwidth",
  34386. 0xff9b,
  34387. "roruathai",
  34388. 0x0e23,
  34389. "rparen",
  34390. 0x24ad,
  34391. "rrabengali",
  34392. 0x09dc,
  34393. "rradeva",
  34394. 0x0931,
  34395. "rragurmukhi",
  34396. 0x0a5c,
  34397. "rreharabic",
  34398. 0x0691,
  34399. "rrehfinalarabic",
  34400. 0xfb8d,
  34401. "rrvocalicbengali",
  34402. 0x09e0,
  34403. "rrvocalicdeva",
  34404. 0x0960,
  34405. "rrvocalicgujarati",
  34406. 0x0ae0,
  34407. "rrvocalicvowelsignbengali",
  34408. 0x09c4,
  34409. "rrvocalicvowelsigndeva",
  34410. 0x0944,
  34411. "rrvocalicvowelsigngujarati",
  34412. 0x0ac4,
  34413. "rsuperior",
  34414. 0xf6f1,
  34415. "rtblock",
  34416. 0x2590,
  34417. "rturned",
  34418. 0x0279,
  34419. "rturnedsuperior",
  34420. 0x02b4,
  34421. "ruhiragana",
  34422. 0x308b,
  34423. "rukatakana",
  34424. 0x30eb,
  34425. "rukatakanahalfwidth",
  34426. 0xff99,
  34427. "rupeemarkbengali",
  34428. 0x09f2,
  34429. "rupeesignbengali",
  34430. 0x09f3,
  34431. "rupiah",
  34432. 0xf6dd,
  34433. "ruthai",
  34434. 0x0e24,
  34435. "rvocalicbengali",
  34436. 0x098b,
  34437. "rvocalicdeva",
  34438. 0x090b,
  34439. "rvocalicgujarati",
  34440. 0x0a8b,
  34441. "rvocalicvowelsignbengali",
  34442. 0x09c3,
  34443. "rvocalicvowelsigndeva",
  34444. 0x0943,
  34445. "rvocalicvowelsigngujarati",
  34446. 0x0ac3,
  34447. "s",
  34448. 0x0073,
  34449. "sabengali",
  34450. 0x09b8,
  34451. "sacute",
  34452. 0x015b,
  34453. "sacutedotaccent",
  34454. 0x1e65,
  34455. "sadarabic",
  34456. 0x0635,
  34457. "sadeva",
  34458. 0x0938,
  34459. "sadfinalarabic",
  34460. 0xfeba,
  34461. "sadinitialarabic",
  34462. 0xfebb,
  34463. "sadmedialarabic",
  34464. 0xfebc,
  34465. "sagujarati",
  34466. 0x0ab8,
  34467. "sagurmukhi",
  34468. 0x0a38,
  34469. "sahiragana",
  34470. 0x3055,
  34471. "sakatakana",
  34472. 0x30b5,
  34473. "sakatakanahalfwidth",
  34474. 0xff7b,
  34475. "sallallahoualayhewasallamarabic",
  34476. 0xfdfa,
  34477. "samekh",
  34478. 0x05e1,
  34479. "samekhdagesh",
  34480. 0xfb41,
  34481. "samekhdageshhebrew",
  34482. 0xfb41,
  34483. "samekhhebrew",
  34484. 0x05e1,
  34485. "saraaathai",
  34486. 0x0e32,
  34487. "saraaethai",
  34488. 0x0e41,
  34489. "saraaimaimalaithai",
  34490. 0x0e44,
  34491. "saraaimaimuanthai",
  34492. 0x0e43,
  34493. "saraamthai",
  34494. 0x0e33,
  34495. "saraathai",
  34496. 0x0e30,
  34497. "saraethai",
  34498. 0x0e40,
  34499. "saraiileftthai",
  34500. 0xf886,
  34501. "saraiithai",
  34502. 0x0e35,
  34503. "saraileftthai",
  34504. 0xf885,
  34505. "saraithai",
  34506. 0x0e34,
  34507. "saraothai",
  34508. 0x0e42,
  34509. "saraueeleftthai",
  34510. 0xf888,
  34511. "saraueethai",
  34512. 0x0e37,
  34513. "saraueleftthai",
  34514. 0xf887,
  34515. "sarauethai",
  34516. 0x0e36,
  34517. "sarauthai",
  34518. 0x0e38,
  34519. "sarauuthai",
  34520. 0x0e39,
  34521. "sbopomofo",
  34522. 0x3119,
  34523. "scaron",
  34524. 0x0161,
  34525. "scarondotaccent",
  34526. 0x1e67,
  34527. "scedilla",
  34528. 0x015f,
  34529. "schwa",
  34530. 0x0259,
  34531. "schwacyrillic",
  34532. 0x04d9,
  34533. "schwadieresiscyrillic",
  34534. 0x04db,
  34535. "schwahook",
  34536. 0x025a,
  34537. "scircle",
  34538. 0x24e2,
  34539. "scircumflex",
  34540. 0x015d,
  34541. "scommaaccent",
  34542. 0x0219,
  34543. "sdotaccent",
  34544. 0x1e61,
  34545. "sdotbelow",
  34546. 0x1e63,
  34547. "sdotbelowdotaccent",
  34548. 0x1e69,
  34549. "seagullbelowcmb",
  34550. 0x033c,
  34551. "second",
  34552. 0x2033,
  34553. "secondtonechinese",
  34554. 0x02ca,
  34555. "section",
  34556. 0x00a7,
  34557. "seenarabic",
  34558. 0x0633,
  34559. "seenfinalarabic",
  34560. 0xfeb2,
  34561. "seeninitialarabic",
  34562. 0xfeb3,
  34563. "seenmedialarabic",
  34564. 0xfeb4,
  34565. "segol",
  34566. 0x05b6,
  34567. "segol13",
  34568. 0x05b6,
  34569. "segol1f",
  34570. 0x05b6,
  34571. "segol2c",
  34572. 0x05b6,
  34573. "segolhebrew",
  34574. 0x05b6,
  34575. "segolnarrowhebrew",
  34576. 0x05b6,
  34577. "segolquarterhebrew",
  34578. 0x05b6,
  34579. "segoltahebrew",
  34580. 0x0592,
  34581. "segolwidehebrew",
  34582. 0x05b6,
  34583. "seharmenian",
  34584. 0x057d,
  34585. "sehiragana",
  34586. 0x305b,
  34587. "sekatakana",
  34588. 0x30bb,
  34589. "sekatakanahalfwidth",
  34590. 0xff7e,
  34591. "semicolon",
  34592. 0x003b,
  34593. "semicolonarabic",
  34594. 0x061b,
  34595. "semicolonmonospace",
  34596. 0xff1b,
  34597. "semicolonsmall",
  34598. 0xfe54,
  34599. "semivoicedmarkkana",
  34600. 0x309c,
  34601. "semivoicedmarkkanahalfwidth",
  34602. 0xff9f,
  34603. "sentisquare",
  34604. 0x3322,
  34605. "sentosquare",
  34606. 0x3323,
  34607. "seven",
  34608. 0x0037,
  34609. "sevenarabic",
  34610. 0x0667,
  34611. "sevenbengali",
  34612. 0x09ed,
  34613. "sevencircle",
  34614. 0x2466,
  34615. "sevencircleinversesansserif",
  34616. 0x2790,
  34617. "sevendeva",
  34618. 0x096d,
  34619. "seveneighths",
  34620. 0x215e,
  34621. "sevengujarati",
  34622. 0x0aed,
  34623. "sevengurmukhi",
  34624. 0x0a6d,
  34625. "sevenhackarabic",
  34626. 0x0667,
  34627. "sevenhangzhou",
  34628. 0x3027,
  34629. "sevenideographicparen",
  34630. 0x3226,
  34631. "seveninferior",
  34632. 0x2087,
  34633. "sevenmonospace",
  34634. 0xff17,
  34635. "sevenoldstyle",
  34636. 0xf737,
  34637. "sevenparen",
  34638. 0x247a,
  34639. "sevenperiod",
  34640. 0x248e,
  34641. "sevenpersian",
  34642. 0x06f7,
  34643. "sevenroman",
  34644. 0x2176,
  34645. "sevensuperior",
  34646. 0x2077,
  34647. "seventeencircle",
  34648. 0x2470,
  34649. "seventeenparen",
  34650. 0x2484,
  34651. "seventeenperiod",
  34652. 0x2498,
  34653. "seventhai",
  34654. 0x0e57,
  34655. "sfthyphen",
  34656. 0x00ad,
  34657. "shaarmenian",
  34658. 0x0577,
  34659. "shabengali",
  34660. 0x09b6,
  34661. "shacyrillic",
  34662. 0x0448,
  34663. "shaddaarabic",
  34664. 0x0651,
  34665. "shaddadammaarabic",
  34666. 0xfc61,
  34667. "shaddadammatanarabic",
  34668. 0xfc5e,
  34669. "shaddafathaarabic",
  34670. 0xfc60,
  34671. "shaddakasraarabic",
  34672. 0xfc62,
  34673. "shaddakasratanarabic",
  34674. 0xfc5f,
  34675. "shade",
  34676. 0x2592,
  34677. "shadedark",
  34678. 0x2593,
  34679. "shadelight",
  34680. 0x2591,
  34681. "shademedium",
  34682. 0x2592,
  34683. "shadeva",
  34684. 0x0936,
  34685. "shagujarati",
  34686. 0x0ab6,
  34687. "shagurmukhi",
  34688. 0x0a36,
  34689. "shalshelethebrew",
  34690. 0x0593,
  34691. "shbopomofo",
  34692. 0x3115,
  34693. "shchacyrillic",
  34694. 0x0449,
  34695. "sheenarabic",
  34696. 0x0634,
  34697. "sheenfinalarabic",
  34698. 0xfeb6,
  34699. "sheeninitialarabic",
  34700. 0xfeb7,
  34701. "sheenmedialarabic",
  34702. 0xfeb8,
  34703. "sheicoptic",
  34704. 0x03e3,
  34705. "sheqel",
  34706. 0x20aa,
  34707. "sheqelhebrew",
  34708. 0x20aa,
  34709. "sheva",
  34710. 0x05b0,
  34711. "sheva115",
  34712. 0x05b0,
  34713. "sheva15",
  34714. 0x05b0,
  34715. "sheva22",
  34716. 0x05b0,
  34717. "sheva2e",
  34718. 0x05b0,
  34719. "shevahebrew",
  34720. 0x05b0,
  34721. "shevanarrowhebrew",
  34722. 0x05b0,
  34723. "shevaquarterhebrew",
  34724. 0x05b0,
  34725. "shevawidehebrew",
  34726. 0x05b0,
  34727. "shhacyrillic",
  34728. 0x04bb,
  34729. "shimacoptic",
  34730. 0x03ed,
  34731. "shin",
  34732. 0x05e9,
  34733. "shindagesh",
  34734. 0xfb49,
  34735. "shindageshhebrew",
  34736. 0xfb49,
  34737. "shindageshshindot",
  34738. 0xfb2c,
  34739. "shindageshshindothebrew",
  34740. 0xfb2c,
  34741. "shindageshsindot",
  34742. 0xfb2d,
  34743. "shindageshsindothebrew",
  34744. 0xfb2d,
  34745. "shindothebrew",
  34746. 0x05c1,
  34747. "shinhebrew",
  34748. 0x05e9,
  34749. "shinshindot",
  34750. 0xfb2a,
  34751. "shinshindothebrew",
  34752. 0xfb2a,
  34753. "shinsindot",
  34754. 0xfb2b,
  34755. "shinsindothebrew",
  34756. 0xfb2b,
  34757. "shook",
  34758. 0x0282,
  34759. "sigma",
  34760. 0x03c3,
  34761. "sigma1",
  34762. 0x03c2,
  34763. "sigmafinal",
  34764. 0x03c2,
  34765. "sigmalunatesymbolgreek",
  34766. 0x03f2,
  34767. "sihiragana",
  34768. 0x3057,
  34769. "sikatakana",
  34770. 0x30b7,
  34771. "sikatakanahalfwidth",
  34772. 0xff7c,
  34773. "siluqhebrew",
  34774. 0x05bd,
  34775. "siluqlefthebrew",
  34776. 0x05bd,
  34777. "similar",
  34778. 0x223c,
  34779. "sindothebrew",
  34780. 0x05c2,
  34781. "siosacirclekorean",
  34782. 0x3274,
  34783. "siosaparenkorean",
  34784. 0x3214,
  34785. "sioscieuckorean",
  34786. 0x317e,
  34787. "sioscirclekorean",
  34788. 0x3266,
  34789. "sioskiyeokkorean",
  34790. 0x317a,
  34791. "sioskorean",
  34792. 0x3145,
  34793. "siosnieunkorean",
  34794. 0x317b,
  34795. "siosparenkorean",
  34796. 0x3206,
  34797. "siospieupkorean",
  34798. 0x317d,
  34799. "siostikeutkorean",
  34800. 0x317c,
  34801. "six",
  34802. 0x0036,
  34803. "sixarabic",
  34804. 0x0666,
  34805. "sixbengali",
  34806. 0x09ec,
  34807. "sixcircle",
  34808. 0x2465,
  34809. "sixcircleinversesansserif",
  34810. 0x278f,
  34811. "sixdeva",
  34812. 0x096c,
  34813. "sixgujarati",
  34814. 0x0aec,
  34815. "sixgurmukhi",
  34816. 0x0a6c,
  34817. "sixhackarabic",
  34818. 0x0666,
  34819. "sixhangzhou",
  34820. 0x3026,
  34821. "sixideographicparen",
  34822. 0x3225,
  34823. "sixinferior",
  34824. 0x2086,
  34825. "sixmonospace",
  34826. 0xff16,
  34827. "sixoldstyle",
  34828. 0xf736,
  34829. "sixparen",
  34830. 0x2479,
  34831. "sixperiod",
  34832. 0x248d,
  34833. "sixpersian",
  34834. 0x06f6,
  34835. "sixroman",
  34836. 0x2175,
  34837. "sixsuperior",
  34838. 0x2076,
  34839. "sixteencircle",
  34840. 0x246f,
  34841. "sixteencurrencydenominatorbengali",
  34842. 0x09f9,
  34843. "sixteenparen",
  34844. 0x2483,
  34845. "sixteenperiod",
  34846. 0x2497,
  34847. "sixthai",
  34848. 0x0e56,
  34849. "slash",
  34850. 0x002f,
  34851. "slashmonospace",
  34852. 0xff0f,
  34853. "slong",
  34854. 0x017f,
  34855. "slongdotaccent",
  34856. 0x1e9b,
  34857. "smileface",
  34858. 0x263a,
  34859. "smonospace",
  34860. 0xff53,
  34861. "sofpasuqhebrew",
  34862. 0x05c3,
  34863. "softhyphen",
  34864. 0x00ad,
  34865. "softsigncyrillic",
  34866. 0x044c,
  34867. "sohiragana",
  34868. 0x305d,
  34869. "sokatakana",
  34870. 0x30bd,
  34871. "sokatakanahalfwidth",
  34872. 0xff7f,
  34873. "soliduslongoverlaycmb",
  34874. 0x0338,
  34875. "solidusshortoverlaycmb",
  34876. 0x0337,
  34877. "sorusithai",
  34878. 0x0e29,
  34879. "sosalathai",
  34880. 0x0e28,
  34881. "sosothai",
  34882. 0x0e0b,
  34883. "sosuathai",
  34884. 0x0e2a,
  34885. "space",
  34886. 0x0020,
  34887. "spacehackarabic",
  34888. 0x0020,
  34889. "spade",
  34890. 0x2660,
  34891. "spadesuitblack",
  34892. 0x2660,
  34893. "spadesuitwhite",
  34894. 0x2664,
  34895. "sparen",
  34896. 0x24ae,
  34897. "squarebelowcmb",
  34898. 0x033b,
  34899. "squarecc",
  34900. 0x33c4,
  34901. "squarecm",
  34902. 0x339d,
  34903. "squarediagonalcrosshatchfill",
  34904. 0x25a9,
  34905. "squarehorizontalfill",
  34906. 0x25a4,
  34907. "squarekg",
  34908. 0x338f,
  34909. "squarekm",
  34910. 0x339e,
  34911. "squarekmcapital",
  34912. 0x33ce,
  34913. "squareln",
  34914. 0x33d1,
  34915. "squarelog",
  34916. 0x33d2,
  34917. "squaremg",
  34918. 0x338e,
  34919. "squaremil",
  34920. 0x33d5,
  34921. "squaremm",
  34922. 0x339c,
  34923. "squaremsquared",
  34924. 0x33a1,
  34925. "squareorthogonalcrosshatchfill",
  34926. 0x25a6,
  34927. "squareupperlefttolowerrightfill",
  34928. 0x25a7,
  34929. "squareupperrighttolowerleftfill",
  34930. 0x25a8,
  34931. "squareverticalfill",
  34932. 0x25a5,
  34933. "squarewhitewithsmallblack",
  34934. 0x25a3,
  34935. "srsquare",
  34936. 0x33db,
  34937. "ssabengali",
  34938. 0x09b7,
  34939. "ssadeva",
  34940. 0x0937,
  34941. "ssagujarati",
  34942. 0x0ab7,
  34943. "ssangcieuckorean",
  34944. 0x3149,
  34945. "ssanghieuhkorean",
  34946. 0x3185,
  34947. "ssangieungkorean",
  34948. 0x3180,
  34949. "ssangkiyeokkorean",
  34950. 0x3132,
  34951. "ssangnieunkorean",
  34952. 0x3165,
  34953. "ssangpieupkorean",
  34954. 0x3143,
  34955. "ssangsioskorean",
  34956. 0x3146,
  34957. "ssangtikeutkorean",
  34958. 0x3138,
  34959. "ssuperior",
  34960. 0xf6f2,
  34961. "sterling",
  34962. 0x00a3,
  34963. "sterlingmonospace",
  34964. 0xffe1,
  34965. "strokelongoverlaycmb",
  34966. 0x0336,
  34967. "strokeshortoverlaycmb",
  34968. 0x0335,
  34969. "subset",
  34970. 0x2282,
  34971. "subsetnotequal",
  34972. 0x228a,
  34973. "subsetorequal",
  34974. 0x2286,
  34975. "succeeds",
  34976. 0x227b,
  34977. "suchthat",
  34978. 0x220b,
  34979. "suhiragana",
  34980. 0x3059,
  34981. "sukatakana",
  34982. 0x30b9,
  34983. "sukatakanahalfwidth",
  34984. 0xff7d,
  34985. "sukunarabic",
  34986. 0x0652,
  34987. "summation",
  34988. 0x2211,
  34989. "sun",
  34990. 0x263c,
  34991. "superset",
  34992. 0x2283,
  34993. "supersetnotequal",
  34994. 0x228b,
  34995. "supersetorequal",
  34996. 0x2287,
  34997. "svsquare",
  34998. 0x33dc,
  34999. "syouwaerasquare",
  35000. 0x337c,
  35001. "t",
  35002. 0x0074,
  35003. "tabengali",
  35004. 0x09a4,
  35005. "tackdown",
  35006. 0x22a4,
  35007. "tackleft",
  35008. 0x22a3,
  35009. "tadeva",
  35010. 0x0924,
  35011. "tagujarati",
  35012. 0x0aa4,
  35013. "tagurmukhi",
  35014. 0x0a24,
  35015. "taharabic",
  35016. 0x0637,
  35017. "tahfinalarabic",
  35018. 0xfec2,
  35019. "tahinitialarabic",
  35020. 0xfec3,
  35021. "tahiragana",
  35022. 0x305f,
  35023. "tahmedialarabic",
  35024. 0xfec4,
  35025. "taisyouerasquare",
  35026. 0x337d,
  35027. "takatakana",
  35028. 0x30bf,
  35029. "takatakanahalfwidth",
  35030. 0xff80,
  35031. "tatweelarabic",
  35032. 0x0640,
  35033. "tau",
  35034. 0x03c4,
  35035. "tav",
  35036. 0x05ea,
  35037. "tavdages",
  35038. 0xfb4a,
  35039. "tavdagesh",
  35040. 0xfb4a,
  35041. "tavdageshhebrew",
  35042. 0xfb4a,
  35043. "tavhebrew",
  35044. 0x05ea,
  35045. "tbar",
  35046. 0x0167,
  35047. "tbopomofo",
  35048. 0x310a,
  35049. "tcaron",
  35050. 0x0165,
  35051. "tccurl",
  35052. 0x02a8,
  35053. "tcedilla",
  35054. 0x0163,
  35055. "tcheharabic",
  35056. 0x0686,
  35057. "tchehfinalarabic",
  35058. 0xfb7b,
  35059. "tchehinitialarabic",
  35060. 0xfb7c,
  35061. "tchehmedialarabic",
  35062. 0xfb7d,
  35063. "tcircle",
  35064. 0x24e3,
  35065. "tcircumflexbelow",
  35066. 0x1e71,
  35067. "tcommaaccent",
  35068. 0x0163,
  35069. "tdieresis",
  35070. 0x1e97,
  35071. "tdotaccent",
  35072. 0x1e6b,
  35073. "tdotbelow",
  35074. 0x1e6d,
  35075. "tecyrillic",
  35076. 0x0442,
  35077. "tedescendercyrillic",
  35078. 0x04ad,
  35079. "teharabic",
  35080. 0x062a,
  35081. "tehfinalarabic",
  35082. 0xfe96,
  35083. "tehhahinitialarabic",
  35084. 0xfca2,
  35085. "tehhahisolatedarabic",
  35086. 0xfc0c,
  35087. "tehinitialarabic",
  35088. 0xfe97,
  35089. "tehiragana",
  35090. 0x3066,
  35091. "tehjeeminitialarabic",
  35092. 0xfca1,
  35093. "tehjeemisolatedarabic",
  35094. 0xfc0b,
  35095. "tehmarbutaarabic",
  35096. 0x0629,
  35097. "tehmarbutafinalarabic",
  35098. 0xfe94,
  35099. "tehmedialarabic",
  35100. 0xfe98,
  35101. "tehmeeminitialarabic",
  35102. 0xfca4,
  35103. "tehmeemisolatedarabic",
  35104. 0xfc0e,
  35105. "tehnoonfinalarabic",
  35106. 0xfc73,
  35107. "tekatakana",
  35108. 0x30c6,
  35109. "tekatakanahalfwidth",
  35110. 0xff83,
  35111. "telephone",
  35112. 0x2121,
  35113. "telephoneblack",
  35114. 0x260e,
  35115. "telishagedolahebrew",
  35116. 0x05a0,
  35117. "telishaqetanahebrew",
  35118. 0x05a9,
  35119. "tencircle",
  35120. 0x2469,
  35121. "tenideographicparen",
  35122. 0x3229,
  35123. "tenparen",
  35124. 0x247d,
  35125. "tenperiod",
  35126. 0x2491,
  35127. "tenroman",
  35128. 0x2179,
  35129. "tesh",
  35130. 0x02a7,
  35131. "tet",
  35132. 0x05d8,
  35133. "tetdagesh",
  35134. 0xfb38,
  35135. "tetdageshhebrew",
  35136. 0xfb38,
  35137. "tethebrew",
  35138. 0x05d8,
  35139. "tetsecyrillic",
  35140. 0x04b5,
  35141. "tevirhebrew",
  35142. 0x059b,
  35143. "tevirlefthebrew",
  35144. 0x059b,
  35145. "thabengali",
  35146. 0x09a5,
  35147. "thadeva",
  35148. 0x0925,
  35149. "thagujarati",
  35150. 0x0aa5,
  35151. "thagurmukhi",
  35152. 0x0a25,
  35153. "thalarabic",
  35154. 0x0630,
  35155. "thalfinalarabic",
  35156. 0xfeac,
  35157. "thanthakhatlowleftthai",
  35158. 0xf898,
  35159. "thanthakhatlowrightthai",
  35160. 0xf897,
  35161. "thanthakhatthai",
  35162. 0x0e4c,
  35163. "thanthakhatupperleftthai",
  35164. 0xf896,
  35165. "theharabic",
  35166. 0x062b,
  35167. "thehfinalarabic",
  35168. 0xfe9a,
  35169. "thehinitialarabic",
  35170. 0xfe9b,
  35171. "thehmedialarabic",
  35172. 0xfe9c,
  35173. "thereexists",
  35174. 0x2203,
  35175. "therefore",
  35176. 0x2234,
  35177. "theta",
  35178. 0x03b8,
  35179. "theta1",
  35180. 0x03d1,
  35181. "thetasymbolgreek",
  35182. 0x03d1,
  35183. "thieuthacirclekorean",
  35184. 0x3279,
  35185. "thieuthaparenkorean",
  35186. 0x3219,
  35187. "thieuthcirclekorean",
  35188. 0x326b,
  35189. "thieuthkorean",
  35190. 0x314c,
  35191. "thieuthparenkorean",
  35192. 0x320b,
  35193. "thirteencircle",
  35194. 0x246c,
  35195. "thirteenparen",
  35196. 0x2480,
  35197. "thirteenperiod",
  35198. 0x2494,
  35199. "thonangmonthothai",
  35200. 0x0e11,
  35201. "thook",
  35202. 0x01ad,
  35203. "thophuthaothai",
  35204. 0x0e12,
  35205. "thorn",
  35206. 0x00fe,
  35207. "thothahanthai",
  35208. 0x0e17,
  35209. "thothanthai",
  35210. 0x0e10,
  35211. "thothongthai",
  35212. 0x0e18,
  35213. "thothungthai",
  35214. 0x0e16,
  35215. "thousandcyrillic",
  35216. 0x0482,
  35217. "thousandsseparatorarabic",
  35218. 0x066c,
  35219. "thousandsseparatorpersian",
  35220. 0x066c,
  35221. "three",
  35222. 0x0033,
  35223. "threearabic",
  35224. 0x0663,
  35225. "threebengali",
  35226. 0x09e9,
  35227. "threecircle",
  35228. 0x2462,
  35229. "threecircleinversesansserif",
  35230. 0x278c,
  35231. "threedeva",
  35232. 0x0969,
  35233. "threeeighths",
  35234. 0x215c,
  35235. "threegujarati",
  35236. 0x0ae9,
  35237. "threegurmukhi",
  35238. 0x0a69,
  35239. "threehackarabic",
  35240. 0x0663,
  35241. "threehangzhou",
  35242. 0x3023,
  35243. "threeideographicparen",
  35244. 0x3222,
  35245. "threeinferior",
  35246. 0x2083,
  35247. "threemonospace",
  35248. 0xff13,
  35249. "threenumeratorbengali",
  35250. 0x09f6,
  35251. "threeoldstyle",
  35252. 0xf733,
  35253. "threeparen",
  35254. 0x2476,
  35255. "threeperiod",
  35256. 0x248a,
  35257. "threepersian",
  35258. 0x06f3,
  35259. "threequarters",
  35260. 0x00be,
  35261. "threequartersemdash",
  35262. 0xf6de,
  35263. "threeroman",
  35264. 0x2172,
  35265. "threesuperior",
  35266. 0x00b3,
  35267. "threethai",
  35268. 0x0e53,
  35269. "thzsquare",
  35270. 0x3394,
  35271. "tihiragana",
  35272. 0x3061,
  35273. "tikatakana",
  35274. 0x30c1,
  35275. "tikatakanahalfwidth",
  35276. 0xff81,
  35277. "tikeutacirclekorean",
  35278. 0x3270,
  35279. "tikeutaparenkorean",
  35280. 0x3210,
  35281. "tikeutcirclekorean",
  35282. 0x3262,
  35283. "tikeutkorean",
  35284. 0x3137,
  35285. "tikeutparenkorean",
  35286. 0x3202,
  35287. "tilde",
  35288. 0x02dc,
  35289. "tildebelowcmb",
  35290. 0x0330,
  35291. "tildecmb",
  35292. 0x0303,
  35293. "tildecomb",
  35294. 0x0303,
  35295. "tildedoublecmb",
  35296. 0x0360,
  35297. "tildeoperator",
  35298. 0x223c,
  35299. "tildeoverlaycmb",
  35300. 0x0334,
  35301. "tildeverticalcmb",
  35302. 0x033e,
  35303. "timescircle",
  35304. 0x2297,
  35305. "tipehahebrew",
  35306. 0x0596,
  35307. "tipehalefthebrew",
  35308. 0x0596,
  35309. "tippigurmukhi",
  35310. 0x0a70,
  35311. "titlocyrilliccmb",
  35312. 0x0483,
  35313. "tiwnarmenian",
  35314. 0x057f,
  35315. "tlinebelow",
  35316. 0x1e6f,
  35317. "tmonospace",
  35318. 0xff54,
  35319. "toarmenian",
  35320. 0x0569,
  35321. "tohiragana",
  35322. 0x3068,
  35323. "tokatakana",
  35324. 0x30c8,
  35325. "tokatakanahalfwidth",
  35326. 0xff84,
  35327. "tonebarextrahighmod",
  35328. 0x02e5,
  35329. "tonebarextralowmod",
  35330. 0x02e9,
  35331. "tonebarhighmod",
  35332. 0x02e6,
  35333. "tonebarlowmod",
  35334. 0x02e8,
  35335. "tonebarmidmod",
  35336. 0x02e7,
  35337. "tonefive",
  35338. 0x01bd,
  35339. "tonesix",
  35340. 0x0185,
  35341. "tonetwo",
  35342. 0x01a8,
  35343. "tonos",
  35344. 0x0384,
  35345. "tonsquare",
  35346. 0x3327,
  35347. "topatakthai",
  35348. 0x0e0f,
  35349. "tortoiseshellbracketleft",
  35350. 0x3014,
  35351. "tortoiseshellbracketleftsmall",
  35352. 0xfe5d,
  35353. "tortoiseshellbracketleftvertical",
  35354. 0xfe39,
  35355. "tortoiseshellbracketright",
  35356. 0x3015,
  35357. "tortoiseshellbracketrightsmall",
  35358. 0xfe5e,
  35359. "tortoiseshellbracketrightvertical",
  35360. 0xfe3a,
  35361. "totaothai",
  35362. 0x0e15,
  35363. "tpalatalhook",
  35364. 0x01ab,
  35365. "tparen",
  35366. 0x24af,
  35367. "trademark",
  35368. 0x2122,
  35369. "trademarksans",
  35370. 0xf8ea,
  35371. "trademarkserif",
  35372. 0xf6db,
  35373. "tretroflexhook",
  35374. 0x0288,
  35375. "triagdn",
  35376. 0x25bc,
  35377. "triaglf",
  35378. 0x25c4,
  35379. "triagrt",
  35380. 0x25ba,
  35381. "triagup",
  35382. 0x25b2,
  35383. "ts",
  35384. 0x02a6,
  35385. "tsadi",
  35386. 0x05e6,
  35387. "tsadidagesh",
  35388. 0xfb46,
  35389. "tsadidageshhebrew",
  35390. 0xfb46,
  35391. "tsadihebrew",
  35392. 0x05e6,
  35393. "tsecyrillic",
  35394. 0x0446,
  35395. "tsere",
  35396. 0x05b5,
  35397. "tsere12",
  35398. 0x05b5,
  35399. "tsere1e",
  35400. 0x05b5,
  35401. "tsere2b",
  35402. 0x05b5,
  35403. "tserehebrew",
  35404. 0x05b5,
  35405. "tserenarrowhebrew",
  35406. 0x05b5,
  35407. "tserequarterhebrew",
  35408. 0x05b5,
  35409. "tserewidehebrew",
  35410. 0x05b5,
  35411. "tshecyrillic",
  35412. 0x045b,
  35413. "tsuperior",
  35414. 0xf6f3,
  35415. "ttabengali",
  35416. 0x099f,
  35417. "ttadeva",
  35418. 0x091f,
  35419. "ttagujarati",
  35420. 0x0a9f,
  35421. "ttagurmukhi",
  35422. 0x0a1f,
  35423. "tteharabic",
  35424. 0x0679,
  35425. "ttehfinalarabic",
  35426. 0xfb67,
  35427. "ttehinitialarabic",
  35428. 0xfb68,
  35429. "ttehmedialarabic",
  35430. 0xfb69,
  35431. "tthabengali",
  35432. 0x09a0,
  35433. "tthadeva",
  35434. 0x0920,
  35435. "tthagujarati",
  35436. 0x0aa0,
  35437. "tthagurmukhi",
  35438. 0x0a20,
  35439. "tturned",
  35440. 0x0287,
  35441. "tuhiragana",
  35442. 0x3064,
  35443. "tukatakana",
  35444. 0x30c4,
  35445. "tukatakanahalfwidth",
  35446. 0xff82,
  35447. "tusmallhiragana",
  35448. 0x3063,
  35449. "tusmallkatakana",
  35450. 0x30c3,
  35451. "tusmallkatakanahalfwidth",
  35452. 0xff6f,
  35453. "twelvecircle",
  35454. 0x246b,
  35455. "twelveparen",
  35456. 0x247f,
  35457. "twelveperiod",
  35458. 0x2493,
  35459. "twelveroman",
  35460. 0x217b,
  35461. "twentycircle",
  35462. 0x2473,
  35463. "twentyhangzhou",
  35464. 0x5344,
  35465. "twentyparen",
  35466. 0x2487,
  35467. "twentyperiod",
  35468. 0x249b,
  35469. "two",
  35470. 0x0032,
  35471. "twoarabic",
  35472. 0x0662,
  35473. "twobengali",
  35474. 0x09e8,
  35475. "twocircle",
  35476. 0x2461,
  35477. "twocircleinversesansserif",
  35478. 0x278b,
  35479. "twodeva",
  35480. 0x0968,
  35481. "twodotenleader",
  35482. 0x2025,
  35483. "twodotleader",
  35484. 0x2025,
  35485. "twodotleadervertical",
  35486. 0xfe30,
  35487. "twogujarati",
  35488. 0x0ae8,
  35489. "twogurmukhi",
  35490. 0x0a68,
  35491. "twohackarabic",
  35492. 0x0662,
  35493. "twohangzhou",
  35494. 0x3022,
  35495. "twoideographicparen",
  35496. 0x3221,
  35497. "twoinferior",
  35498. 0x2082,
  35499. "twomonospace",
  35500. 0xff12,
  35501. "twonumeratorbengali",
  35502. 0x09f5,
  35503. "twooldstyle",
  35504. 0xf732,
  35505. "twoparen",
  35506. 0x2475,
  35507. "twoperiod",
  35508. 0x2489,
  35509. "twopersian",
  35510. 0x06f2,
  35511. "tworoman",
  35512. 0x2171,
  35513. "twostroke",
  35514. 0x01bb,
  35515. "twosuperior",
  35516. 0x00b2,
  35517. "twothai",
  35518. 0x0e52,
  35519. "twothirds",
  35520. 0x2154,
  35521. "u",
  35522. 0x0075,
  35523. "uacute",
  35524. 0x00fa,
  35525. "ubar",
  35526. 0x0289,
  35527. "ubengali",
  35528. 0x0989,
  35529. "ubopomofo",
  35530. 0x3128,
  35531. "ubreve",
  35532. 0x016d,
  35533. "ucaron",
  35534. 0x01d4,
  35535. "ucircle",
  35536. 0x24e4,
  35537. "ucircumflex",
  35538. 0x00fb,
  35539. "ucircumflexbelow",
  35540. 0x1e77,
  35541. "ucyrillic",
  35542. 0x0443,
  35543. "udattadeva",
  35544. 0x0951,
  35545. "udblacute",
  35546. 0x0171,
  35547. "udblgrave",
  35548. 0x0215,
  35549. "udeva",
  35550. 0x0909,
  35551. "udieresis",
  35552. 0x00fc,
  35553. "udieresisacute",
  35554. 0x01d8,
  35555. "udieresisbelow",
  35556. 0x1e73,
  35557. "udieresiscaron",
  35558. 0x01da,
  35559. "udieresiscyrillic",
  35560. 0x04f1,
  35561. "udieresisgrave",
  35562. 0x01dc,
  35563. "udieresismacron",
  35564. 0x01d6,
  35565. "udotbelow",
  35566. 0x1ee5,
  35567. "ugrave",
  35568. 0x00f9,
  35569. "ugujarati",
  35570. 0x0a89,
  35571. "ugurmukhi",
  35572. 0x0a09,
  35573. "uhiragana",
  35574. 0x3046,
  35575. "uhookabove",
  35576. 0x1ee7,
  35577. "uhorn",
  35578. 0x01b0,
  35579. "uhornacute",
  35580. 0x1ee9,
  35581. "uhorndotbelow",
  35582. 0x1ef1,
  35583. "uhorngrave",
  35584. 0x1eeb,
  35585. "uhornhookabove",
  35586. 0x1eed,
  35587. "uhorntilde",
  35588. 0x1eef,
  35589. "uhungarumlaut",
  35590. 0x0171,
  35591. "uhungarumlautcyrillic",
  35592. 0x04f3,
  35593. "uinvertedbreve",
  35594. 0x0217,
  35595. "ukatakana",
  35596. 0x30a6,
  35597. "ukatakanahalfwidth",
  35598. 0xff73,
  35599. "ukcyrillic",
  35600. 0x0479,
  35601. "ukorean",
  35602. 0x315c,
  35603. "umacron",
  35604. 0x016b,
  35605. "umacroncyrillic",
  35606. 0x04ef,
  35607. "umacrondieresis",
  35608. 0x1e7b,
  35609. "umatragurmukhi",
  35610. 0x0a41,
  35611. "umonospace",
  35612. 0xff55,
  35613. "underscore",
  35614. 0x005f,
  35615. "underscoredbl",
  35616. 0x2017,
  35617. "underscoremonospace",
  35618. 0xff3f,
  35619. "underscorevertical",
  35620. 0xfe33,
  35621. "underscorewavy",
  35622. 0xfe4f,
  35623. "union",
  35624. 0x222a,
  35625. "universal",
  35626. 0x2200,
  35627. "uogonek",
  35628. 0x0173,
  35629. "uparen",
  35630. 0x24b0,
  35631. "upblock",
  35632. 0x2580,
  35633. "upperdothebrew",
  35634. 0x05c4,
  35635. "upsilon",
  35636. 0x03c5,
  35637. "upsilondieresis",
  35638. 0x03cb,
  35639. "upsilondieresistonos",
  35640. 0x03b0,
  35641. "upsilonlatin",
  35642. 0x028a,
  35643. "upsilontonos",
  35644. 0x03cd,
  35645. "uptackbelowcmb",
  35646. 0x031d,
  35647. "uptackmod",
  35648. 0x02d4,
  35649. "uragurmukhi",
  35650. 0x0a73,
  35651. "uring",
  35652. 0x016f,
  35653. "ushortcyrillic",
  35654. 0x045e,
  35655. "usmallhiragana",
  35656. 0x3045,
  35657. "usmallkatakana",
  35658. 0x30a5,
  35659. "usmallkatakanahalfwidth",
  35660. 0xff69,
  35661. "ustraightcyrillic",
  35662. 0x04af,
  35663. "ustraightstrokecyrillic",
  35664. 0x04b1,
  35665. "utilde",
  35666. 0x0169,
  35667. "utildeacute",
  35668. 0x1e79,
  35669. "utildebelow",
  35670. 0x1e75,
  35671. "uubengali",
  35672. 0x098a,
  35673. "uudeva",
  35674. 0x090a,
  35675. "uugujarati",
  35676. 0x0a8a,
  35677. "uugurmukhi",
  35678. 0x0a0a,
  35679. "uumatragurmukhi",
  35680. 0x0a42,
  35681. "uuvowelsignbengali",
  35682. 0x09c2,
  35683. "uuvowelsigndeva",
  35684. 0x0942,
  35685. "uuvowelsigngujarati",
  35686. 0x0ac2,
  35687. "uvowelsignbengali",
  35688. 0x09c1,
  35689. "uvowelsigndeva",
  35690. 0x0941,
  35691. "uvowelsigngujarati",
  35692. 0x0ac1,
  35693. "v",
  35694. 0x0076,
  35695. "vadeva",
  35696. 0x0935,
  35697. "vagujarati",
  35698. 0x0ab5,
  35699. "vagurmukhi",
  35700. 0x0a35,
  35701. "vakatakana",
  35702. 0x30f7,
  35703. "vav",
  35704. 0x05d5,
  35705. "vavdagesh",
  35706. 0xfb35,
  35707. "vavdagesh65",
  35708. 0xfb35,
  35709. "vavdageshhebrew",
  35710. 0xfb35,
  35711. "vavhebrew",
  35712. 0x05d5,
  35713. "vavholam",
  35714. 0xfb4b,
  35715. "vavholamhebrew",
  35716. 0xfb4b,
  35717. "vavvavhebrew",
  35718. 0x05f0,
  35719. "vavyodhebrew",
  35720. 0x05f1,
  35721. "vcircle",
  35722. 0x24e5,
  35723. "vdotbelow",
  35724. 0x1e7f,
  35725. "vecyrillic",
  35726. 0x0432,
  35727. "veharabic",
  35728. 0x06a4,
  35729. "vehfinalarabic",
  35730. 0xfb6b,
  35731. "vehinitialarabic",
  35732. 0xfb6c,
  35733. "vehmedialarabic",
  35734. 0xfb6d,
  35735. "vekatakana",
  35736. 0x30f9,
  35737. "venus",
  35738. 0x2640,
  35739. "verticalbar",
  35740. 0x007c,
  35741. "verticallineabovecmb",
  35742. 0x030d,
  35743. "verticallinebelowcmb",
  35744. 0x0329,
  35745. "verticallinelowmod",
  35746. 0x02cc,
  35747. "verticallinemod",
  35748. 0x02c8,
  35749. "vewarmenian",
  35750. 0x057e,
  35751. "vhook",
  35752. 0x028b,
  35753. "vikatakana",
  35754. 0x30f8,
  35755. "viramabengali",
  35756. 0x09cd,
  35757. "viramadeva",
  35758. 0x094d,
  35759. "viramagujarati",
  35760. 0x0acd,
  35761. "visargabengali",
  35762. 0x0983,
  35763. "visargadeva",
  35764. 0x0903,
  35765. "visargagujarati",
  35766. 0x0a83,
  35767. "vmonospace",
  35768. 0xff56,
  35769. "voarmenian",
  35770. 0x0578,
  35771. "voicediterationhiragana",
  35772. 0x309e,
  35773. "voicediterationkatakana",
  35774. 0x30fe,
  35775. "voicedmarkkana",
  35776. 0x309b,
  35777. "voicedmarkkanahalfwidth",
  35778. 0xff9e,
  35779. "vokatakana",
  35780. 0x30fa,
  35781. "vparen",
  35782. 0x24b1,
  35783. "vtilde",
  35784. 0x1e7d,
  35785. "vturned",
  35786. 0x028c,
  35787. "vuhiragana",
  35788. 0x3094,
  35789. "vukatakana",
  35790. 0x30f4,
  35791. "w",
  35792. 0x0077,
  35793. "wacute",
  35794. 0x1e83,
  35795. "waekorean",
  35796. 0x3159,
  35797. "wahiragana",
  35798. 0x308f,
  35799. "wakatakana",
  35800. 0x30ef,
  35801. "wakatakanahalfwidth",
  35802. 0xff9c,
  35803. "wakorean",
  35804. 0x3158,
  35805. "wasmallhiragana",
  35806. 0x308e,
  35807. "wasmallkatakana",
  35808. 0x30ee,
  35809. "wattosquare",
  35810. 0x3357,
  35811. "wavedash",
  35812. 0x301c,
  35813. "wavyunderscorevertical",
  35814. 0xfe34,
  35815. "wawarabic",
  35816. 0x0648,
  35817. "wawfinalarabic",
  35818. 0xfeee,
  35819. "wawhamzaabovearabic",
  35820. 0x0624,
  35821. "wawhamzaabovefinalarabic",
  35822. 0xfe86,
  35823. "wbsquare",
  35824. 0x33dd,
  35825. "wcircle",
  35826. 0x24e6,
  35827. "wcircumflex",
  35828. 0x0175,
  35829. "wdieresis",
  35830. 0x1e85,
  35831. "wdotaccent",
  35832. 0x1e87,
  35833. "wdotbelow",
  35834. 0x1e89,
  35835. "wehiragana",
  35836. 0x3091,
  35837. "weierstrass",
  35838. 0x2118,
  35839. "wekatakana",
  35840. 0x30f1,
  35841. "wekorean",
  35842. 0x315e,
  35843. "weokorean",
  35844. 0x315d,
  35845. "wgrave",
  35846. 0x1e81,
  35847. "whitebullet",
  35848. 0x25e6,
  35849. "whitecircle",
  35850. 0x25cb,
  35851. "whitecircleinverse",
  35852. 0x25d9,
  35853. "whitecornerbracketleft",
  35854. 0x300e,
  35855. "whitecornerbracketleftvertical",
  35856. 0xfe43,
  35857. "whitecornerbracketright",
  35858. 0x300f,
  35859. "whitecornerbracketrightvertical",
  35860. 0xfe44,
  35861. "whitediamond",
  35862. 0x25c7,
  35863. "whitediamondcontainingblacksmalldiamond",
  35864. 0x25c8,
  35865. "whitedownpointingsmalltriangle",
  35866. 0x25bf,
  35867. "whitedownpointingtriangle",
  35868. 0x25bd,
  35869. "whiteleftpointingsmalltriangle",
  35870. 0x25c3,
  35871. "whiteleftpointingtriangle",
  35872. 0x25c1,
  35873. "whitelenticularbracketleft",
  35874. 0x3016,
  35875. "whitelenticularbracketright",
  35876. 0x3017,
  35877. "whiterightpointingsmalltriangle",
  35878. 0x25b9,
  35879. "whiterightpointingtriangle",
  35880. 0x25b7,
  35881. "whitesmallsquare",
  35882. 0x25ab,
  35883. "whitesmilingface",
  35884. 0x263a,
  35885. "whitesquare",
  35886. 0x25a1,
  35887. "whitestar",
  35888. 0x2606,
  35889. "whitetelephone",
  35890. 0x260f,
  35891. "whitetortoiseshellbracketleft",
  35892. 0x3018,
  35893. "whitetortoiseshellbracketright",
  35894. 0x3019,
  35895. "whiteuppointingsmalltriangle",
  35896. 0x25b5,
  35897. "whiteuppointingtriangle",
  35898. 0x25b3,
  35899. "wihiragana",
  35900. 0x3090,
  35901. "wikatakana",
  35902. 0x30f0,
  35903. "wikorean",
  35904. 0x315f,
  35905. "wmonospace",
  35906. 0xff57,
  35907. "wohiragana",
  35908. 0x3092,
  35909. "wokatakana",
  35910. 0x30f2,
  35911. "wokatakanahalfwidth",
  35912. 0xff66,
  35913. "won",
  35914. 0x20a9,
  35915. "wonmonospace",
  35916. 0xffe6,
  35917. "wowaenthai",
  35918. 0x0e27,
  35919. "wparen",
  35920. 0x24b2,
  35921. "wring",
  35922. 0x1e98,
  35923. "wsuperior",
  35924. 0x02b7,
  35925. "wturned",
  35926. 0x028d,
  35927. "wynn",
  35928. 0x01bf,
  35929. "x",
  35930. 0x0078,
  35931. "xabovecmb",
  35932. 0x033d,
  35933. "xbopomofo",
  35934. 0x3112,
  35935. "xcircle",
  35936. 0x24e7,
  35937. "xdieresis",
  35938. 0x1e8d,
  35939. "xdotaccent",
  35940. 0x1e8b,
  35941. "xeharmenian",
  35942. 0x056d,
  35943. "xi",
  35944. 0x03be,
  35945. "xmonospace",
  35946. 0xff58,
  35947. "xparen",
  35948. 0x24b3,
  35949. "xsuperior",
  35950. 0x02e3,
  35951. "y",
  35952. 0x0079,
  35953. "yaadosquare",
  35954. 0x334e,
  35955. "yabengali",
  35956. 0x09af,
  35957. "yacute",
  35958. 0x00fd,
  35959. "yadeva",
  35960. 0x092f,
  35961. "yaekorean",
  35962. 0x3152,
  35963. "yagujarati",
  35964. 0x0aaf,
  35965. "yagurmukhi",
  35966. 0x0a2f,
  35967. "yahiragana",
  35968. 0x3084,
  35969. "yakatakana",
  35970. 0x30e4,
  35971. "yakatakanahalfwidth",
  35972. 0xff94,
  35973. "yakorean",
  35974. 0x3151,
  35975. "yamakkanthai",
  35976. 0x0e4e,
  35977. "yasmallhiragana",
  35978. 0x3083,
  35979. "yasmallkatakana",
  35980. 0x30e3,
  35981. "yasmallkatakanahalfwidth",
  35982. 0xff6c,
  35983. "yatcyrillic",
  35984. 0x0463,
  35985. "ycircle",
  35986. 0x24e8,
  35987. "ycircumflex",
  35988. 0x0177,
  35989. "ydieresis",
  35990. 0x00ff,
  35991. "ydotaccent",
  35992. 0x1e8f,
  35993. "ydotbelow",
  35994. 0x1ef5,
  35995. "yeharabic",
  35996. 0x064a,
  35997. "yehbarreearabic",
  35998. 0x06d2,
  35999. "yehbarreefinalarabic",
  36000. 0xfbaf,
  36001. "yehfinalarabic",
  36002. 0xfef2,
  36003. "yehhamzaabovearabic",
  36004. 0x0626,
  36005. "yehhamzaabovefinalarabic",
  36006. 0xfe8a,
  36007. "yehhamzaaboveinitialarabic",
  36008. 0xfe8b,
  36009. "yehhamzaabovemedialarabic",
  36010. 0xfe8c,
  36011. "yehinitialarabic",
  36012. 0xfef3,
  36013. "yehmedialarabic",
  36014. 0xfef4,
  36015. "yehmeeminitialarabic",
  36016. 0xfcdd,
  36017. "yehmeemisolatedarabic",
  36018. 0xfc58,
  36019. "yehnoonfinalarabic",
  36020. 0xfc94,
  36021. "yehthreedotsbelowarabic",
  36022. 0x06d1,
  36023. "yekorean",
  36024. 0x3156,
  36025. "yen",
  36026. 0x00a5,
  36027. "yenmonospace",
  36028. 0xffe5,
  36029. "yeokorean",
  36030. 0x3155,
  36031. "yeorinhieuhkorean",
  36032. 0x3186,
  36033. "yerahbenyomohebrew",
  36034. 0x05aa,
  36035. "yerahbenyomolefthebrew",
  36036. 0x05aa,
  36037. "yericyrillic",
  36038. 0x044b,
  36039. "yerudieresiscyrillic",
  36040. 0x04f9,
  36041. "yesieungkorean",
  36042. 0x3181,
  36043. "yesieungpansioskorean",
  36044. 0x3183,
  36045. "yesieungsioskorean",
  36046. 0x3182,
  36047. "yetivhebrew",
  36048. 0x059a,
  36049. "ygrave",
  36050. 0x1ef3,
  36051. "yhook",
  36052. 0x01b4,
  36053. "yhookabove",
  36054. 0x1ef7,
  36055. "yiarmenian",
  36056. 0x0575,
  36057. "yicyrillic",
  36058. 0x0457,
  36059. "yikorean",
  36060. 0x3162,
  36061. "yinyang",
  36062. 0x262f,
  36063. "yiwnarmenian",
  36064. 0x0582,
  36065. "ymonospace",
  36066. 0xff59,
  36067. "yod",
  36068. 0x05d9,
  36069. "yoddagesh",
  36070. 0xfb39,
  36071. "yoddageshhebrew",
  36072. 0xfb39,
  36073. "yodhebrew",
  36074. 0x05d9,
  36075. "yodyodhebrew",
  36076. 0x05f2,
  36077. "yodyodpatahhebrew",
  36078. 0xfb1f,
  36079. "yohiragana",
  36080. 0x3088,
  36081. "yoikorean",
  36082. 0x3189,
  36083. "yokatakana",
  36084. 0x30e8,
  36085. "yokatakanahalfwidth",
  36086. 0xff96,
  36087. "yokorean",
  36088. 0x315b,
  36089. "yosmallhiragana",
  36090. 0x3087,
  36091. "yosmallkatakana",
  36092. 0x30e7,
  36093. "yosmallkatakanahalfwidth",
  36094. 0xff6e,
  36095. "yotgreek",
  36096. 0x03f3,
  36097. "yoyaekorean",
  36098. 0x3188,
  36099. "yoyakorean",
  36100. 0x3187,
  36101. "yoyakthai",
  36102. 0x0e22,
  36103. "yoyingthai",
  36104. 0x0e0d,
  36105. "yparen",
  36106. 0x24b4,
  36107. "ypogegrammeni",
  36108. 0x037a,
  36109. "ypogegrammenigreekcmb",
  36110. 0x0345,
  36111. "yr",
  36112. 0x01a6,
  36113. "yring",
  36114. 0x1e99,
  36115. "ysuperior",
  36116. 0x02b8,
  36117. "ytilde",
  36118. 0x1ef9,
  36119. "yturned",
  36120. 0x028e,
  36121. "yuhiragana",
  36122. 0x3086,
  36123. "yuikorean",
  36124. 0x318c,
  36125. "yukatakana",
  36126. 0x30e6,
  36127. "yukatakanahalfwidth",
  36128. 0xff95,
  36129. "yukorean",
  36130. 0x3160,
  36131. "yusbigcyrillic",
  36132. 0x046b,
  36133. "yusbigiotifiedcyrillic",
  36134. 0x046d,
  36135. "yuslittlecyrillic",
  36136. 0x0467,
  36137. "yuslittleiotifiedcyrillic",
  36138. 0x0469,
  36139. "yusmallhiragana",
  36140. 0x3085,
  36141. "yusmallkatakana",
  36142. 0x30e5,
  36143. "yusmallkatakanahalfwidth",
  36144. 0xff6d,
  36145. "yuyekorean",
  36146. 0x318b,
  36147. "yuyeokorean",
  36148. 0x318a,
  36149. "yyabengali",
  36150. 0x09df,
  36151. "yyadeva",
  36152. 0x095f,
  36153. "z",
  36154. 0x007a,
  36155. "zaarmenian",
  36156. 0x0566,
  36157. "zacute",
  36158. 0x017a,
  36159. "zadeva",
  36160. 0x095b,
  36161. "zagurmukhi",
  36162. 0x0a5b,
  36163. "zaharabic",
  36164. 0x0638,
  36165. "zahfinalarabic",
  36166. 0xfec6,
  36167. "zahinitialarabic",
  36168. 0xfec7,
  36169. "zahiragana",
  36170. 0x3056,
  36171. "zahmedialarabic",
  36172. 0xfec8,
  36173. "zainarabic",
  36174. 0x0632,
  36175. "zainfinalarabic",
  36176. 0xfeb0,
  36177. "zakatakana",
  36178. 0x30b6,
  36179. "zaqefgadolhebrew",
  36180. 0x0595,
  36181. "zaqefqatanhebrew",
  36182. 0x0594,
  36183. "zarqahebrew",
  36184. 0x0598,
  36185. "zayin",
  36186. 0x05d6,
  36187. "zayindagesh",
  36188. 0xfb36,
  36189. "zayindageshhebrew",
  36190. 0xfb36,
  36191. "zayinhebrew",
  36192. 0x05d6,
  36193. "zbopomofo",
  36194. 0x3117,
  36195. "zcaron",
  36196. 0x017e,
  36197. "zcircle",
  36198. 0x24e9,
  36199. "zcircumflex",
  36200. 0x1e91,
  36201. "zcurl",
  36202. 0x0291,
  36203. "zdot",
  36204. 0x017c,
  36205. "zdotaccent",
  36206. 0x017c,
  36207. "zdotbelow",
  36208. 0x1e93,
  36209. "zecyrillic",
  36210. 0x0437,
  36211. "zedescendercyrillic",
  36212. 0x0499,
  36213. "zedieresiscyrillic",
  36214. 0x04df,
  36215. "zehiragana",
  36216. 0x305c,
  36217. "zekatakana",
  36218. 0x30bc,
  36219. "zero",
  36220. 0x0030,
  36221. "zeroarabic",
  36222. 0x0660,
  36223. "zerobengali",
  36224. 0x09e6,
  36225. "zerodeva",
  36226. 0x0966,
  36227. "zerogujarati",
  36228. 0x0ae6,
  36229. "zerogurmukhi",
  36230. 0x0a66,
  36231. "zerohackarabic",
  36232. 0x0660,
  36233. "zeroinferior",
  36234. 0x2080,
  36235. "zeromonospace",
  36236. 0xff10,
  36237. "zerooldstyle",
  36238. 0xf730,
  36239. "zeropersian",
  36240. 0x06f0,
  36241. "zerosuperior",
  36242. 0x2070,
  36243. "zerothai",
  36244. 0x0e50,
  36245. "zerowidthjoiner",
  36246. 0xfeff,
  36247. "zerowidthnonjoiner",
  36248. 0x200c,
  36249. "zerowidthspace",
  36250. 0x200b,
  36251. "zeta",
  36252. 0x03b6,
  36253. "zhbopomofo",
  36254. 0x3113,
  36255. "zhearmenian",
  36256. 0x056a,
  36257. "zhebrevecyrillic",
  36258. 0x04c2,
  36259. "zhecyrillic",
  36260. 0x0436,
  36261. "zhedescendercyrillic",
  36262. 0x0497,
  36263. "zhedieresiscyrillic",
  36264. 0x04dd,
  36265. "zihiragana",
  36266. 0x3058,
  36267. "zikatakana",
  36268. 0x30b8,
  36269. "zinorhebrew",
  36270. 0x05ae,
  36271. "zlinebelow",
  36272. 0x1e95,
  36273. "zmonospace",
  36274. 0xff5a,
  36275. "zohiragana",
  36276. 0x305e,
  36277. "zokatakana",
  36278. 0x30be,
  36279. "zparen",
  36280. 0x24b5,
  36281. "zretroflexhook",
  36282. 0x0290,
  36283. "zstroke",
  36284. 0x01b6,
  36285. "zuhiragana",
  36286. 0x305a,
  36287. "zukatakana",
  36288. 0x30ba,
  36289. ".notdef",
  36290. 0x0000,
  36291. "angbracketleftbig",
  36292. 0x2329,
  36293. "angbracketleftBig",
  36294. 0x2329,
  36295. "angbracketleftbigg",
  36296. 0x2329,
  36297. "angbracketleftBigg",
  36298. 0x2329,
  36299. "angbracketrightBig",
  36300. 0x232a,
  36301. "angbracketrightbig",
  36302. 0x232a,
  36303. "angbracketrightBigg",
  36304. 0x232a,
  36305. "angbracketrightbigg",
  36306. 0x232a,
  36307. "arrowhookleft",
  36308. 0x21aa,
  36309. "arrowhookright",
  36310. 0x21a9,
  36311. "arrowlefttophalf",
  36312. 0x21bc,
  36313. "arrowleftbothalf",
  36314. 0x21bd,
  36315. "arrownortheast",
  36316. 0x2197,
  36317. "arrownorthwest",
  36318. 0x2196,
  36319. "arrowrighttophalf",
  36320. 0x21c0,
  36321. "arrowrightbothalf",
  36322. 0x21c1,
  36323. "arrowsoutheast",
  36324. 0x2198,
  36325. "arrowsouthwest",
  36326. 0x2199,
  36327. "backslashbig",
  36328. 0x2216,
  36329. "backslashBig",
  36330. 0x2216,
  36331. "backslashBigg",
  36332. 0x2216,
  36333. "backslashbigg",
  36334. 0x2216,
  36335. "bardbl",
  36336. 0x2016,
  36337. "bracehtipdownleft",
  36338. 0xfe37,
  36339. "bracehtipdownright",
  36340. 0xfe37,
  36341. "bracehtipupleft",
  36342. 0xfe38,
  36343. "bracehtipupright",
  36344. 0xfe38,
  36345. "braceleftBig",
  36346. 0x007b,
  36347. "braceleftbig",
  36348. 0x007b,
  36349. "braceleftbigg",
  36350. 0x007b,
  36351. "braceleftBigg",
  36352. 0x007b,
  36353. "bracerightBig",
  36354. 0x007d,
  36355. "bracerightbig",
  36356. 0x007d,
  36357. "bracerightbigg",
  36358. 0x007d,
  36359. "bracerightBigg",
  36360. 0x007d,
  36361. "bracketleftbig",
  36362. 0x005b,
  36363. "bracketleftBig",
  36364. 0x005b,
  36365. "bracketleftbigg",
  36366. 0x005b,
  36367. "bracketleftBigg",
  36368. 0x005b,
  36369. "bracketrightBig",
  36370. 0x005d,
  36371. "bracketrightbig",
  36372. 0x005d,
  36373. "bracketrightbigg",
  36374. 0x005d,
  36375. "bracketrightBigg",
  36376. 0x005d,
  36377. "ceilingleftbig",
  36378. 0x2308,
  36379. "ceilingleftBig",
  36380. 0x2308,
  36381. "ceilingleftBigg",
  36382. 0x2308,
  36383. "ceilingleftbigg",
  36384. 0x2308,
  36385. "ceilingrightbig",
  36386. 0x2309,
  36387. "ceilingrightBig",
  36388. 0x2309,
  36389. "ceilingrightbigg",
  36390. 0x2309,
  36391. "ceilingrightBigg",
  36392. 0x2309,
  36393. "circledotdisplay",
  36394. 0x2299,
  36395. "circledottext",
  36396. 0x2299,
  36397. "circlemultiplydisplay",
  36398. 0x2297,
  36399. "circlemultiplytext",
  36400. 0x2297,
  36401. "circleplusdisplay",
  36402. 0x2295,
  36403. "circleplustext",
  36404. 0x2295,
  36405. "contintegraldisplay",
  36406. 0x222e,
  36407. "contintegraltext",
  36408. 0x222e,
  36409. "coproductdisplay",
  36410. 0x2210,
  36411. "coproducttext",
  36412. 0x2210,
  36413. "floorleftBig",
  36414. 0x230a,
  36415. "floorleftbig",
  36416. 0x230a,
  36417. "floorleftbigg",
  36418. 0x230a,
  36419. "floorleftBigg",
  36420. 0x230a,
  36421. "floorrightbig",
  36422. 0x230b,
  36423. "floorrightBig",
  36424. 0x230b,
  36425. "floorrightBigg",
  36426. 0x230b,
  36427. "floorrightbigg",
  36428. 0x230b,
  36429. "hatwide",
  36430. 0x0302,
  36431. "hatwider",
  36432. 0x0302,
  36433. "hatwidest",
  36434. 0x0302,
  36435. "intercal",
  36436. 0x1d40,
  36437. "integraldisplay",
  36438. 0x222b,
  36439. "integraltext",
  36440. 0x222b,
  36441. "intersectiondisplay",
  36442. 0x22c2,
  36443. "intersectiontext",
  36444. 0x22c2,
  36445. "logicalanddisplay",
  36446. 0x2227,
  36447. "logicalandtext",
  36448. 0x2227,
  36449. "logicalordisplay",
  36450. 0x2228,
  36451. "logicalortext",
  36452. 0x2228,
  36453. "parenleftBig",
  36454. 0x0028,
  36455. "parenleftbig",
  36456. 0x0028,
  36457. "parenleftBigg",
  36458. 0x0028,
  36459. "parenleftbigg",
  36460. 0x0028,
  36461. "parenrightBig",
  36462. 0x0029,
  36463. "parenrightbig",
  36464. 0x0029,
  36465. "parenrightBigg",
  36466. 0x0029,
  36467. "parenrightbigg",
  36468. 0x0029,
  36469. "prime",
  36470. 0x2032,
  36471. "productdisplay",
  36472. 0x220f,
  36473. "producttext",
  36474. 0x220f,
  36475. "radicalbig",
  36476. 0x221a,
  36477. "radicalBig",
  36478. 0x221a,
  36479. "radicalBigg",
  36480. 0x221a,
  36481. "radicalbigg",
  36482. 0x221a,
  36483. "radicalbt",
  36484. 0x221a,
  36485. "radicaltp",
  36486. 0x221a,
  36487. "radicalvertex",
  36488. 0x221a,
  36489. "slashbig",
  36490. 0x002f,
  36491. "slashBig",
  36492. 0x002f,
  36493. "slashBigg",
  36494. 0x002f,
  36495. "slashbigg",
  36496. 0x002f,
  36497. "summationdisplay",
  36498. 0x2211,
  36499. "summationtext",
  36500. 0x2211,
  36501. "tildewide",
  36502. 0x02dc,
  36503. "tildewider",
  36504. 0x02dc,
  36505. "tildewidest",
  36506. 0x02dc,
  36507. "uniondisplay",
  36508. 0x22c3,
  36509. "unionmultidisplay",
  36510. 0x228e,
  36511. "unionmultitext",
  36512. 0x228e,
  36513. "unionsqdisplay",
  36514. 0x2294,
  36515. "unionsqtext",
  36516. 0x2294,
  36517. "uniontext",
  36518. 0x22c3,
  36519. "vextenddouble",
  36520. 0x2225,
  36521. "vextendsingle",
  36522. 0x2223
  36523. ];
  36524. });
  36525. const getDingbatsGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  36526. return [
  36527. "space",
  36528. 0x0020,
  36529. "a1",
  36530. 0x2701,
  36531. "a2",
  36532. 0x2702,
  36533. "a202",
  36534. 0x2703,
  36535. "a3",
  36536. 0x2704,
  36537. "a4",
  36538. 0x260e,
  36539. "a5",
  36540. 0x2706,
  36541. "a119",
  36542. 0x2707,
  36543. "a118",
  36544. 0x2708,
  36545. "a117",
  36546. 0x2709,
  36547. "a11",
  36548. 0x261b,
  36549. "a12",
  36550. 0x261e,
  36551. "a13",
  36552. 0x270c,
  36553. "a14",
  36554. 0x270d,
  36555. "a15",
  36556. 0x270e,
  36557. "a16",
  36558. 0x270f,
  36559. "a105",
  36560. 0x2710,
  36561. "a17",
  36562. 0x2711,
  36563. "a18",
  36564. 0x2712,
  36565. "a19",
  36566. 0x2713,
  36567. "a20",
  36568. 0x2714,
  36569. "a21",
  36570. 0x2715,
  36571. "a22",
  36572. 0x2716,
  36573. "a23",
  36574. 0x2717,
  36575. "a24",
  36576. 0x2718,
  36577. "a25",
  36578. 0x2719,
  36579. "a26",
  36580. 0x271a,
  36581. "a27",
  36582. 0x271b,
  36583. "a28",
  36584. 0x271c,
  36585. "a6",
  36586. 0x271d,
  36587. "a7",
  36588. 0x271e,
  36589. "a8",
  36590. 0x271f,
  36591. "a9",
  36592. 0x2720,
  36593. "a10",
  36594. 0x2721,
  36595. "a29",
  36596. 0x2722,
  36597. "a30",
  36598. 0x2723,
  36599. "a31",
  36600. 0x2724,
  36601. "a32",
  36602. 0x2725,
  36603. "a33",
  36604. 0x2726,
  36605. "a34",
  36606. 0x2727,
  36607. "a35",
  36608. 0x2605,
  36609. "a36",
  36610. 0x2729,
  36611. "a37",
  36612. 0x272a,
  36613. "a38",
  36614. 0x272b,
  36615. "a39",
  36616. 0x272c,
  36617. "a40",
  36618. 0x272d,
  36619. "a41",
  36620. 0x272e,
  36621. "a42",
  36622. 0x272f,
  36623. "a43",
  36624. 0x2730,
  36625. "a44",
  36626. 0x2731,
  36627. "a45",
  36628. 0x2732,
  36629. "a46",
  36630. 0x2733,
  36631. "a47",
  36632. 0x2734,
  36633. "a48",
  36634. 0x2735,
  36635. "a49",
  36636. 0x2736,
  36637. "a50",
  36638. 0x2737,
  36639. "a51",
  36640. 0x2738,
  36641. "a52",
  36642. 0x2739,
  36643. "a53",
  36644. 0x273a,
  36645. "a54",
  36646. 0x273b,
  36647. "a55",
  36648. 0x273c,
  36649. "a56",
  36650. 0x273d,
  36651. "a57",
  36652. 0x273e,
  36653. "a58",
  36654. 0x273f,
  36655. "a59",
  36656. 0x2740,
  36657. "a60",
  36658. 0x2741,
  36659. "a61",
  36660. 0x2742,
  36661. "a62",
  36662. 0x2743,
  36663. "a63",
  36664. 0x2744,
  36665. "a64",
  36666. 0x2745,
  36667. "a65",
  36668. 0x2746,
  36669. "a66",
  36670. 0x2747,
  36671. "a67",
  36672. 0x2748,
  36673. "a68",
  36674. 0x2749,
  36675. "a69",
  36676. 0x274a,
  36677. "a70",
  36678. 0x274b,
  36679. "a71",
  36680. 0x25cf,
  36681. "a72",
  36682. 0x274d,
  36683. "a73",
  36684. 0x25a0,
  36685. "a74",
  36686. 0x274f,
  36687. "a203",
  36688. 0x2750,
  36689. "a75",
  36690. 0x2751,
  36691. "a204",
  36692. 0x2752,
  36693. "a76",
  36694. 0x25b2,
  36695. "a77",
  36696. 0x25bc,
  36697. "a78",
  36698. 0x25c6,
  36699. "a79",
  36700. 0x2756,
  36701. "a81",
  36702. 0x25d7,
  36703. "a82",
  36704. 0x2758,
  36705. "a83",
  36706. 0x2759,
  36707. "a84",
  36708. 0x275a,
  36709. "a97",
  36710. 0x275b,
  36711. "a98",
  36712. 0x275c,
  36713. "a99",
  36714. 0x275d,
  36715. "a100",
  36716. 0x275e,
  36717. "a101",
  36718. 0x2761,
  36719. "a102",
  36720. 0x2762,
  36721. "a103",
  36722. 0x2763,
  36723. "a104",
  36724. 0x2764,
  36725. "a106",
  36726. 0x2765,
  36727. "a107",
  36728. 0x2766,
  36729. "a108",
  36730. 0x2767,
  36731. "a112",
  36732. 0x2663,
  36733. "a111",
  36734. 0x2666,
  36735. "a110",
  36736. 0x2665,
  36737. "a109",
  36738. 0x2660,
  36739. "a120",
  36740. 0x2460,
  36741. "a121",
  36742. 0x2461,
  36743. "a122",
  36744. 0x2462,
  36745. "a123",
  36746. 0x2463,
  36747. "a124",
  36748. 0x2464,
  36749. "a125",
  36750. 0x2465,
  36751. "a126",
  36752. 0x2466,
  36753. "a127",
  36754. 0x2467,
  36755. "a128",
  36756. 0x2468,
  36757. "a129",
  36758. 0x2469,
  36759. "a130",
  36760. 0x2776,
  36761. "a131",
  36762. 0x2777,
  36763. "a132",
  36764. 0x2778,
  36765. "a133",
  36766. 0x2779,
  36767. "a134",
  36768. 0x277a,
  36769. "a135",
  36770. 0x277b,
  36771. "a136",
  36772. 0x277c,
  36773. "a137",
  36774. 0x277d,
  36775. "a138",
  36776. 0x277e,
  36777. "a139",
  36778. 0x277f,
  36779. "a140",
  36780. 0x2780,
  36781. "a141",
  36782. 0x2781,
  36783. "a142",
  36784. 0x2782,
  36785. "a143",
  36786. 0x2783,
  36787. "a144",
  36788. 0x2784,
  36789. "a145",
  36790. 0x2785,
  36791. "a146",
  36792. 0x2786,
  36793. "a147",
  36794. 0x2787,
  36795. "a148",
  36796. 0x2788,
  36797. "a149",
  36798. 0x2789,
  36799. "a150",
  36800. 0x278a,
  36801. "a151",
  36802. 0x278b,
  36803. "a152",
  36804. 0x278c,
  36805. "a153",
  36806. 0x278d,
  36807. "a154",
  36808. 0x278e,
  36809. "a155",
  36810. 0x278f,
  36811. "a156",
  36812. 0x2790,
  36813. "a157",
  36814. 0x2791,
  36815. "a158",
  36816. 0x2792,
  36817. "a159",
  36818. 0x2793,
  36819. "a160",
  36820. 0x2794,
  36821. "a161",
  36822. 0x2192,
  36823. "a163",
  36824. 0x2194,
  36825. "a164",
  36826. 0x2195,
  36827. "a196",
  36828. 0x2798,
  36829. "a165",
  36830. 0x2799,
  36831. "a192",
  36832. 0x279a,
  36833. "a166",
  36834. 0x279b,
  36835. "a167",
  36836. 0x279c,
  36837. "a168",
  36838. 0x279d,
  36839. "a169",
  36840. 0x279e,
  36841. "a170",
  36842. 0x279f,
  36843. "a171",
  36844. 0x27a0,
  36845. "a172",
  36846. 0x27a1,
  36847. "a173",
  36848. 0x27a2,
  36849. "a162",
  36850. 0x27a3,
  36851. "a174",
  36852. 0x27a4,
  36853. "a175",
  36854. 0x27a5,
  36855. "a176",
  36856. 0x27a6,
  36857. "a177",
  36858. 0x27a7,
  36859. "a178",
  36860. 0x27a8,
  36861. "a179",
  36862. 0x27a9,
  36863. "a193",
  36864. 0x27aa,
  36865. "a180",
  36866. 0x27ab,
  36867. "a199",
  36868. 0x27ac,
  36869. "a181",
  36870. 0x27ad,
  36871. "a200",
  36872. 0x27ae,
  36873. "a182",
  36874. 0x27af,
  36875. "a201",
  36876. 0x27b1,
  36877. "a183",
  36878. 0x27b2,
  36879. "a184",
  36880. 0x27b3,
  36881. "a197",
  36882. 0x27b4,
  36883. "a185",
  36884. 0x27b5,
  36885. "a194",
  36886. 0x27b6,
  36887. "a198",
  36888. 0x27b7,
  36889. "a186",
  36890. 0x27b8,
  36891. "a195",
  36892. 0x27b9,
  36893. "a187",
  36894. 0x27ba,
  36895. "a188",
  36896. 0x27bb,
  36897. "a189",
  36898. 0x27bc,
  36899. "a190",
  36900. 0x27bd,
  36901. "a191",
  36902. 0x27be,
  36903. "a89",
  36904. 0x2768,
  36905. "a90",
  36906. 0x2769,
  36907. "a93",
  36908. 0x276a,
  36909. "a94",
  36910. 0x276b,
  36911. "a91",
  36912. 0x276c,
  36913. "a92",
  36914. 0x276d,
  36915. "a205",
  36916. 0x276e,
  36917. "a85",
  36918. 0x276f,
  36919. "a206",
  36920. 0x2770,
  36921. "a86",
  36922. 0x2771,
  36923. "a87",
  36924. 0x2772,
  36925. "a88",
  36926. 0x2773,
  36927. "a95",
  36928. 0x2774,
  36929. "a96",
  36930. 0x2775,
  36931. ".notdef",
  36932. 0x0000
  36933. ];
  36934. });
  36935. /***/ }),
  36936. /* 171 */
  36937. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  36938. "use strict";
  36939. __w_pdfjs_require__.r(__webpack_exports__);
  36940. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  36941. /* harmony export */ "clearUnicodeCaches": () => (/* binding */ clearUnicodeCaches),
  36942. /* harmony export */ "getCharUnicodeCategory": () => (/* binding */ getCharUnicodeCategory),
  36943. /* harmony export */ "getNormalizedUnicodes": () => (/* binding */ getNormalizedUnicodes),
  36944. /* harmony export */ "getUnicodeForGlyph": () => (/* binding */ getUnicodeForGlyph),
  36945. /* harmony export */ "getUnicodeRangeFor": () => (/* binding */ getUnicodeRangeFor),
  36946. /* harmony export */ "mapSpecialUnicodeValues": () => (/* binding */ mapSpecialUnicodeValues),
  36947. /* harmony export */ "reverseIfRtl": () => (/* binding */ reverseIfRtl)
  36948. /* harmony export */ });
  36949. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(136);
  36950. const getSpecialPUASymbols = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getLookupTableFactory)(function (t) {
  36951. t[63721] = 0x00a9;
  36952. t[63193] = 0x00a9;
  36953. t[63720] = 0x00ae;
  36954. t[63194] = 0x00ae;
  36955. t[63722] = 0x2122;
  36956. t[63195] = 0x2122;
  36957. t[63729] = 0x23a7;
  36958. t[63730] = 0x23a8;
  36959. t[63731] = 0x23a9;
  36960. t[63740] = 0x23ab;
  36961. t[63741] = 0x23ac;
  36962. t[63742] = 0x23ad;
  36963. t[63726] = 0x23a1;
  36964. t[63727] = 0x23a2;
  36965. t[63728] = 0x23a3;
  36966. t[63737] = 0x23a4;
  36967. t[63738] = 0x23a5;
  36968. t[63739] = 0x23a6;
  36969. t[63723] = 0x239b;
  36970. t[63724] = 0x239c;
  36971. t[63725] = 0x239d;
  36972. t[63734] = 0x239e;
  36973. t[63735] = 0x239f;
  36974. t[63736] = 0x23a0;
  36975. });
  36976. function mapSpecialUnicodeValues(code) {
  36977. if (code >= 0xfff0 && code <= 0xffff) {
  36978. return 0;
  36979. } else if (code >= 0xf600 && code <= 0xf8ff) {
  36980. return getSpecialPUASymbols()[code] || code;
  36981. } else if (code === 0x00ad) {
  36982. return 0x002d;
  36983. }
  36984. return code;
  36985. }
  36986. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  36987. let unicode = glyphsUnicodeMap[name];
  36988. if (unicode !== undefined) {
  36989. return unicode;
  36990. }
  36991. if (!name) {
  36992. return -1;
  36993. }
  36994. if (name[0] === "u") {
  36995. const nameLen = name.length;
  36996. let hexStr;
  36997. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  36998. hexStr = name.substring(3);
  36999. } else if (nameLen >= 5 && nameLen <= 7) {
  37000. hexStr = name.substring(1);
  37001. } else {
  37002. return -1;
  37003. }
  37004. if (hexStr === hexStr.toUpperCase()) {
  37005. unicode = parseInt(hexStr, 16);
  37006. if (unicode >= 0) {
  37007. return unicode;
  37008. }
  37009. }
  37010. }
  37011. return -1;
  37012. }
  37013. const UnicodeRanges = [
  37014. {
  37015. begin: 0x0000,
  37016. end: 0x007f
  37017. },
  37018. {
  37019. begin: 0x0080,
  37020. end: 0x00ff
  37021. },
  37022. {
  37023. begin: 0x0100,
  37024. end: 0x017f
  37025. },
  37026. {
  37027. begin: 0x0180,
  37028. end: 0x024f
  37029. },
  37030. {
  37031. begin: 0x0250,
  37032. end: 0x02af
  37033. },
  37034. {
  37035. begin: 0x02b0,
  37036. end: 0x02ff
  37037. },
  37038. {
  37039. begin: 0x0300,
  37040. end: 0x036f
  37041. },
  37042. {
  37043. begin: 0x0370,
  37044. end: 0x03ff
  37045. },
  37046. {
  37047. begin: 0x2c80,
  37048. end: 0x2cff
  37049. },
  37050. {
  37051. begin: 0x0400,
  37052. end: 0x04ff
  37053. },
  37054. {
  37055. begin: 0x0530,
  37056. end: 0x058f
  37057. },
  37058. {
  37059. begin: 0x0590,
  37060. end: 0x05ff
  37061. },
  37062. {
  37063. begin: 0xa500,
  37064. end: 0xa63f
  37065. },
  37066. {
  37067. begin: 0x0600,
  37068. end: 0x06ff
  37069. },
  37070. {
  37071. begin: 0x07c0,
  37072. end: 0x07ff
  37073. },
  37074. {
  37075. begin: 0x0900,
  37076. end: 0x097f
  37077. },
  37078. {
  37079. begin: 0x0980,
  37080. end: 0x09ff
  37081. },
  37082. {
  37083. begin: 0x0a00,
  37084. end: 0x0a7f
  37085. },
  37086. {
  37087. begin: 0x0a80,
  37088. end: 0x0aff
  37089. },
  37090. {
  37091. begin: 0x0b00,
  37092. end: 0x0b7f
  37093. },
  37094. {
  37095. begin: 0x0b80,
  37096. end: 0x0bff
  37097. },
  37098. {
  37099. begin: 0x0c00,
  37100. end: 0x0c7f
  37101. },
  37102. {
  37103. begin: 0x0c80,
  37104. end: 0x0cff
  37105. },
  37106. {
  37107. begin: 0x0d00,
  37108. end: 0x0d7f
  37109. },
  37110. {
  37111. begin: 0x0e00,
  37112. end: 0x0e7f
  37113. },
  37114. {
  37115. begin: 0x0e80,
  37116. end: 0x0eff
  37117. },
  37118. {
  37119. begin: 0x10a0,
  37120. end: 0x10ff
  37121. },
  37122. {
  37123. begin: 0x1b00,
  37124. end: 0x1b7f
  37125. },
  37126. {
  37127. begin: 0x1100,
  37128. end: 0x11ff
  37129. },
  37130. {
  37131. begin: 0x1e00,
  37132. end: 0x1eff
  37133. },
  37134. {
  37135. begin: 0x1f00,
  37136. end: 0x1fff
  37137. },
  37138. {
  37139. begin: 0x2000,
  37140. end: 0x206f
  37141. },
  37142. {
  37143. begin: 0x2070,
  37144. end: 0x209f
  37145. },
  37146. {
  37147. begin: 0x20a0,
  37148. end: 0x20cf
  37149. },
  37150. {
  37151. begin: 0x20d0,
  37152. end: 0x20ff
  37153. },
  37154. {
  37155. begin: 0x2100,
  37156. end: 0x214f
  37157. },
  37158. {
  37159. begin: 0x2150,
  37160. end: 0x218f
  37161. },
  37162. {
  37163. begin: 0x2190,
  37164. end: 0x21ff
  37165. },
  37166. {
  37167. begin: 0x2200,
  37168. end: 0x22ff
  37169. },
  37170. {
  37171. begin: 0x2300,
  37172. end: 0x23ff
  37173. },
  37174. {
  37175. begin: 0x2400,
  37176. end: 0x243f
  37177. },
  37178. {
  37179. begin: 0x2440,
  37180. end: 0x245f
  37181. },
  37182. {
  37183. begin: 0x2460,
  37184. end: 0x24ff
  37185. },
  37186. {
  37187. begin: 0x2500,
  37188. end: 0x257f
  37189. },
  37190. {
  37191. begin: 0x2580,
  37192. end: 0x259f
  37193. },
  37194. {
  37195. begin: 0x25a0,
  37196. end: 0x25ff
  37197. },
  37198. {
  37199. begin: 0x2600,
  37200. end: 0x26ff
  37201. },
  37202. {
  37203. begin: 0x2700,
  37204. end: 0x27bf
  37205. },
  37206. {
  37207. begin: 0x3000,
  37208. end: 0x303f
  37209. },
  37210. {
  37211. begin: 0x3040,
  37212. end: 0x309f
  37213. },
  37214. {
  37215. begin: 0x30a0,
  37216. end: 0x30ff
  37217. },
  37218. {
  37219. begin: 0x3100,
  37220. end: 0x312f
  37221. },
  37222. {
  37223. begin: 0x3130,
  37224. end: 0x318f
  37225. },
  37226. {
  37227. begin: 0xa840,
  37228. end: 0xa87f
  37229. },
  37230. {
  37231. begin: 0x3200,
  37232. end: 0x32ff
  37233. },
  37234. {
  37235. begin: 0x3300,
  37236. end: 0x33ff
  37237. },
  37238. {
  37239. begin: 0xac00,
  37240. end: 0xd7af
  37241. },
  37242. {
  37243. begin: 0xd800,
  37244. end: 0xdfff
  37245. },
  37246. {
  37247. begin: 0x10900,
  37248. end: 0x1091f
  37249. },
  37250. {
  37251. begin: 0x4e00,
  37252. end: 0x9fff
  37253. },
  37254. {
  37255. begin: 0xe000,
  37256. end: 0xf8ff
  37257. },
  37258. {
  37259. begin: 0x31c0,
  37260. end: 0x31ef
  37261. },
  37262. {
  37263. begin: 0xfb00,
  37264. end: 0xfb4f
  37265. },
  37266. {
  37267. begin: 0xfb50,
  37268. end: 0xfdff
  37269. },
  37270. {
  37271. begin: 0xfe20,
  37272. end: 0xfe2f
  37273. },
  37274. {
  37275. begin: 0xfe10,
  37276. end: 0xfe1f
  37277. },
  37278. {
  37279. begin: 0xfe50,
  37280. end: 0xfe6f
  37281. },
  37282. {
  37283. begin: 0xfe70,
  37284. end: 0xfeff
  37285. },
  37286. {
  37287. begin: 0xff00,
  37288. end: 0xffef
  37289. },
  37290. {
  37291. begin: 0xfff0,
  37292. end: 0xffff
  37293. },
  37294. {
  37295. begin: 0x0f00,
  37296. end: 0x0fff
  37297. },
  37298. {
  37299. begin: 0x0700,
  37300. end: 0x074f
  37301. },
  37302. {
  37303. begin: 0x0780,
  37304. end: 0x07bf
  37305. },
  37306. {
  37307. begin: 0x0d80,
  37308. end: 0x0dff
  37309. },
  37310. {
  37311. begin: 0x1000,
  37312. end: 0x109f
  37313. },
  37314. {
  37315. begin: 0x1200,
  37316. end: 0x137f
  37317. },
  37318. {
  37319. begin: 0x13a0,
  37320. end: 0x13ff
  37321. },
  37322. {
  37323. begin: 0x1400,
  37324. end: 0x167f
  37325. },
  37326. {
  37327. begin: 0x1680,
  37328. end: 0x169f
  37329. },
  37330. {
  37331. begin: 0x16a0,
  37332. end: 0x16ff
  37333. },
  37334. {
  37335. begin: 0x1780,
  37336. end: 0x17ff
  37337. },
  37338. {
  37339. begin: 0x1800,
  37340. end: 0x18af
  37341. },
  37342. {
  37343. begin: 0x2800,
  37344. end: 0x28ff
  37345. },
  37346. {
  37347. begin: 0xa000,
  37348. end: 0xa48f
  37349. },
  37350. {
  37351. begin: 0x1700,
  37352. end: 0x171f
  37353. },
  37354. {
  37355. begin: 0x10300,
  37356. end: 0x1032f
  37357. },
  37358. {
  37359. begin: 0x10330,
  37360. end: 0x1034f
  37361. },
  37362. {
  37363. begin: 0x10400,
  37364. end: 0x1044f
  37365. },
  37366. {
  37367. begin: 0x1d000,
  37368. end: 0x1d0ff
  37369. },
  37370. {
  37371. begin: 0x1d400,
  37372. end: 0x1d7ff
  37373. },
  37374. {
  37375. begin: 0xff000,
  37376. end: 0xffffd
  37377. },
  37378. {
  37379. begin: 0xfe00,
  37380. end: 0xfe0f
  37381. },
  37382. {
  37383. begin: 0xe0000,
  37384. end: 0xe007f
  37385. },
  37386. {
  37387. begin: 0x1900,
  37388. end: 0x194f
  37389. },
  37390. {
  37391. begin: 0x1950,
  37392. end: 0x197f
  37393. },
  37394. {
  37395. begin: 0x1980,
  37396. end: 0x19df
  37397. },
  37398. {
  37399. begin: 0x1a00,
  37400. end: 0x1a1f
  37401. },
  37402. {
  37403. begin: 0x2c00,
  37404. end: 0x2c5f
  37405. },
  37406. {
  37407. begin: 0x2d30,
  37408. end: 0x2d7f
  37409. },
  37410. {
  37411. begin: 0x4dc0,
  37412. end: 0x4dff
  37413. },
  37414. {
  37415. begin: 0xa800,
  37416. end: 0xa82f
  37417. },
  37418. {
  37419. begin: 0x10000,
  37420. end: 0x1007f
  37421. },
  37422. {
  37423. begin: 0x10140,
  37424. end: 0x1018f
  37425. },
  37426. {
  37427. begin: 0x10380,
  37428. end: 0x1039f
  37429. },
  37430. {
  37431. begin: 0x103a0,
  37432. end: 0x103df
  37433. },
  37434. {
  37435. begin: 0x10450,
  37436. end: 0x1047f
  37437. },
  37438. {
  37439. begin: 0x10480,
  37440. end: 0x104af
  37441. },
  37442. {
  37443. begin: 0x10800,
  37444. end: 0x1083f
  37445. },
  37446. {
  37447. begin: 0x10a00,
  37448. end: 0x10a5f
  37449. },
  37450. {
  37451. begin: 0x1d300,
  37452. end: 0x1d35f
  37453. },
  37454. {
  37455. begin: 0x12000,
  37456. end: 0x123ff
  37457. },
  37458. {
  37459. begin: 0x1d360,
  37460. end: 0x1d37f
  37461. },
  37462. {
  37463. begin: 0x1b80,
  37464. end: 0x1bbf
  37465. },
  37466. {
  37467. begin: 0x1c00,
  37468. end: 0x1c4f
  37469. },
  37470. {
  37471. begin: 0x1c50,
  37472. end: 0x1c7f
  37473. },
  37474. {
  37475. begin: 0xa880,
  37476. end: 0xa8df
  37477. },
  37478. {
  37479. begin: 0xa900,
  37480. end: 0xa92f
  37481. },
  37482. {
  37483. begin: 0xa930,
  37484. end: 0xa95f
  37485. },
  37486. {
  37487. begin: 0xaa00,
  37488. end: 0xaa5f
  37489. },
  37490. {
  37491. begin: 0x10190,
  37492. end: 0x101cf
  37493. },
  37494. {
  37495. begin: 0x101d0,
  37496. end: 0x101ff
  37497. },
  37498. {
  37499. begin: 0x102a0,
  37500. end: 0x102df
  37501. },
  37502. {
  37503. begin: 0x1f030,
  37504. end: 0x1f09f
  37505. }
  37506. ];
  37507. function getUnicodeRangeFor(value) {
  37508. for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  37509. const range = UnicodeRanges[i];
  37510. if (value >= range.begin && value < range.end) {
  37511. return i;
  37512. }
  37513. }
  37514. return -1;
  37515. }
  37516. function isRTLRangeFor(value) {
  37517. let range = UnicodeRanges[13];
  37518. if (value >= range.begin && value < range.end) {
  37519. return true;
  37520. }
  37521. range = UnicodeRanges[11];
  37522. if (value >= range.begin && value < range.end) {
  37523. return true;
  37524. }
  37525. return false;
  37526. }
  37527. const getNormalizedUnicodes = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  37528. return [
  37529. "\u00A8",
  37530. "\u0020\u0308",
  37531. "\u00AF",
  37532. "\u0020\u0304",
  37533. "\u00B4",
  37534. "\u0020\u0301",
  37535. "\u00B5",
  37536. "\u03BC",
  37537. "\u00B8",
  37538. "\u0020\u0327",
  37539. "\u0132",
  37540. "\u0049\u004A",
  37541. "\u0133",
  37542. "\u0069\u006A",
  37543. "\u013F",
  37544. "\u004C\u00B7",
  37545. "\u0140",
  37546. "\u006C\u00B7",
  37547. "\u0149",
  37548. "\u02BC\u006E",
  37549. "\u017F",
  37550. "\u0073",
  37551. "\u01C4",
  37552. "\u0044\u017D",
  37553. "\u01C5",
  37554. "\u0044\u017E",
  37555. "\u01C6",
  37556. "\u0064\u017E",
  37557. "\u01C7",
  37558. "\u004C\u004A",
  37559. "\u01C8",
  37560. "\u004C\u006A",
  37561. "\u01C9",
  37562. "\u006C\u006A",
  37563. "\u01CA",
  37564. "\u004E\u004A",
  37565. "\u01CB",
  37566. "\u004E\u006A",
  37567. "\u01CC",
  37568. "\u006E\u006A",
  37569. "\u01F1",
  37570. "\u0044\u005A",
  37571. "\u01F2",
  37572. "\u0044\u007A",
  37573. "\u01F3",
  37574. "\u0064\u007A",
  37575. "\u02D8",
  37576. "\u0020\u0306",
  37577. "\u02D9",
  37578. "\u0020\u0307",
  37579. "\u02DA",
  37580. "\u0020\u030A",
  37581. "\u02DB",
  37582. "\u0020\u0328",
  37583. "\u02DC",
  37584. "\u0020\u0303",
  37585. "\u02DD",
  37586. "\u0020\u030B",
  37587. "\u037A",
  37588. "\u0020\u0345",
  37589. "\u0384",
  37590. "\u0020\u0301",
  37591. "\u03D0",
  37592. "\u03B2",
  37593. "\u03D1",
  37594. "\u03B8",
  37595. "\u03D2",
  37596. "\u03A5",
  37597. "\u03D5",
  37598. "\u03C6",
  37599. "\u03D6",
  37600. "\u03C0",
  37601. "\u03F0",
  37602. "\u03BA",
  37603. "\u03F1",
  37604. "\u03C1",
  37605. "\u03F2",
  37606. "\u03C2",
  37607. "\u03F4",
  37608. "\u0398",
  37609. "\u03F5",
  37610. "\u03B5",
  37611. "\u03F9",
  37612. "\u03A3",
  37613. "\u0587",
  37614. "\u0565\u0582",
  37615. "\u0675",
  37616. "\u0627\u0674",
  37617. "\u0676",
  37618. "\u0648\u0674",
  37619. "\u0677",
  37620. "\u06C7\u0674",
  37621. "\u0678",
  37622. "\u064A\u0674",
  37623. "\u0E33",
  37624. "\u0E4D\u0E32",
  37625. "\u0EB3",
  37626. "\u0ECD\u0EB2",
  37627. "\u0EDC",
  37628. "\u0EAB\u0E99",
  37629. "\u0EDD",
  37630. "\u0EAB\u0EA1",
  37631. "\u0F77",
  37632. "\u0FB2\u0F81",
  37633. "\u0F79",
  37634. "\u0FB3\u0F81",
  37635. "\u1E9A",
  37636. "\u0061\u02BE",
  37637. "\u1FBD",
  37638. "\u0020\u0313",
  37639. "\u1FBF",
  37640. "\u0020\u0313",
  37641. "\u1FC0",
  37642. "\u0020\u0342",
  37643. "\u1FFE",
  37644. "\u0020\u0314",
  37645. "\u2002",
  37646. "\u0020",
  37647. "\u2003",
  37648. "\u0020",
  37649. "\u2004",
  37650. "\u0020",
  37651. "\u2005",
  37652. "\u0020",
  37653. "\u2006",
  37654. "\u0020",
  37655. "\u2008",
  37656. "\u0020",
  37657. "\u2009",
  37658. "\u0020",
  37659. "\u200A",
  37660. "\u0020",
  37661. "\u2017",
  37662. "\u0020\u0333",
  37663. "\u2024",
  37664. "\u002E",
  37665. "\u2025",
  37666. "\u002E\u002E",
  37667. "\u2026",
  37668. "\u002E\u002E\u002E",
  37669. "\u2033",
  37670. "\u2032\u2032",
  37671. "\u2034",
  37672. "\u2032\u2032\u2032",
  37673. "\u2036",
  37674. "\u2035\u2035",
  37675. "\u2037",
  37676. "\u2035\u2035\u2035",
  37677. "\u203C",
  37678. "\u0021\u0021",
  37679. "\u203E",
  37680. "\u0020\u0305",
  37681. "\u2047",
  37682. "\u003F\u003F",
  37683. "\u2048",
  37684. "\u003F\u0021",
  37685. "\u2049",
  37686. "\u0021\u003F",
  37687. "\u2057",
  37688. "\u2032\u2032\u2032\u2032",
  37689. "\u205F",
  37690. "\u0020",
  37691. "\u20A8",
  37692. "\u0052\u0073",
  37693. "\u2100",
  37694. "\u0061\u002F\u0063",
  37695. "\u2101",
  37696. "\u0061\u002F\u0073",
  37697. "\u2103",
  37698. "\u00B0\u0043",
  37699. "\u2105",
  37700. "\u0063\u002F\u006F",
  37701. "\u2106",
  37702. "\u0063\u002F\u0075",
  37703. "\u2107",
  37704. "\u0190",
  37705. "\u2109",
  37706. "\u00B0\u0046",
  37707. "\u2116",
  37708. "\u004E\u006F",
  37709. "\u2121",
  37710. "\u0054\u0045\u004C",
  37711. "\u2135",
  37712. "\u05D0",
  37713. "\u2136",
  37714. "\u05D1",
  37715. "\u2137",
  37716. "\u05D2",
  37717. "\u2138",
  37718. "\u05D3",
  37719. "\u213B",
  37720. "\u0046\u0041\u0058",
  37721. "\u2160",
  37722. "\u0049",
  37723. "\u2161",
  37724. "\u0049\u0049",
  37725. "\u2162",
  37726. "\u0049\u0049\u0049",
  37727. "\u2163",
  37728. "\u0049\u0056",
  37729. "\u2164",
  37730. "\u0056",
  37731. "\u2165",
  37732. "\u0056\u0049",
  37733. "\u2166",
  37734. "\u0056\u0049\u0049",
  37735. "\u2167",
  37736. "\u0056\u0049\u0049\u0049",
  37737. "\u2168",
  37738. "\u0049\u0058",
  37739. "\u2169",
  37740. "\u0058",
  37741. "\u216A",
  37742. "\u0058\u0049",
  37743. "\u216B",
  37744. "\u0058\u0049\u0049",
  37745. "\u216C",
  37746. "\u004C",
  37747. "\u216D",
  37748. "\u0043",
  37749. "\u216E",
  37750. "\u0044",
  37751. "\u216F",
  37752. "\u004D",
  37753. "\u2170",
  37754. "\u0069",
  37755. "\u2171",
  37756. "\u0069\u0069",
  37757. "\u2172",
  37758. "\u0069\u0069\u0069",
  37759. "\u2173",
  37760. "\u0069\u0076",
  37761. "\u2174",
  37762. "\u0076",
  37763. "\u2175",
  37764. "\u0076\u0069",
  37765. "\u2176",
  37766. "\u0076\u0069\u0069",
  37767. "\u2177",
  37768. "\u0076\u0069\u0069\u0069",
  37769. "\u2178",
  37770. "\u0069\u0078",
  37771. "\u2179",
  37772. "\u0078",
  37773. "\u217A",
  37774. "\u0078\u0069",
  37775. "\u217B",
  37776. "\u0078\u0069\u0069",
  37777. "\u217C",
  37778. "\u006C",
  37779. "\u217D",
  37780. "\u0063",
  37781. "\u217E",
  37782. "\u0064",
  37783. "\u217F",
  37784. "\u006D",
  37785. "\u222C",
  37786. "\u222B\u222B",
  37787. "\u222D",
  37788. "\u222B\u222B\u222B",
  37789. "\u222F",
  37790. "\u222E\u222E",
  37791. "\u2230",
  37792. "\u222E\u222E\u222E",
  37793. "\u2474",
  37794. "\u0028\u0031\u0029",
  37795. "\u2475",
  37796. "\u0028\u0032\u0029",
  37797. "\u2476",
  37798. "\u0028\u0033\u0029",
  37799. "\u2477",
  37800. "\u0028\u0034\u0029",
  37801. "\u2478",
  37802. "\u0028\u0035\u0029",
  37803. "\u2479",
  37804. "\u0028\u0036\u0029",
  37805. "\u247A",
  37806. "\u0028\u0037\u0029",
  37807. "\u247B",
  37808. "\u0028\u0038\u0029",
  37809. "\u247C",
  37810. "\u0028\u0039\u0029",
  37811. "\u247D",
  37812. "\u0028\u0031\u0030\u0029",
  37813. "\u247E",
  37814. "\u0028\u0031\u0031\u0029",
  37815. "\u247F",
  37816. "\u0028\u0031\u0032\u0029",
  37817. "\u2480",
  37818. "\u0028\u0031\u0033\u0029",
  37819. "\u2481",
  37820. "\u0028\u0031\u0034\u0029",
  37821. "\u2482",
  37822. "\u0028\u0031\u0035\u0029",
  37823. "\u2483",
  37824. "\u0028\u0031\u0036\u0029",
  37825. "\u2484",
  37826. "\u0028\u0031\u0037\u0029",
  37827. "\u2485",
  37828. "\u0028\u0031\u0038\u0029",
  37829. "\u2486",
  37830. "\u0028\u0031\u0039\u0029",
  37831. "\u2487",
  37832. "\u0028\u0032\u0030\u0029",
  37833. "\u2488",
  37834. "\u0031\u002E",
  37835. "\u2489",
  37836. "\u0032\u002E",
  37837. "\u248A",
  37838. "\u0033\u002E",
  37839. "\u248B",
  37840. "\u0034\u002E",
  37841. "\u248C",
  37842. "\u0035\u002E",
  37843. "\u248D",
  37844. "\u0036\u002E",
  37845. "\u248E",
  37846. "\u0037\u002E",
  37847. "\u248F",
  37848. "\u0038\u002E",
  37849. "\u2490",
  37850. "\u0039\u002E",
  37851. "\u2491",
  37852. "\u0031\u0030\u002E",
  37853. "\u2492",
  37854. "\u0031\u0031\u002E",
  37855. "\u2493",
  37856. "\u0031\u0032\u002E",
  37857. "\u2494",
  37858. "\u0031\u0033\u002E",
  37859. "\u2495",
  37860. "\u0031\u0034\u002E",
  37861. "\u2496",
  37862. "\u0031\u0035\u002E",
  37863. "\u2497",
  37864. "\u0031\u0036\u002E",
  37865. "\u2498",
  37866. "\u0031\u0037\u002E",
  37867. "\u2499",
  37868. "\u0031\u0038\u002E",
  37869. "\u249A",
  37870. "\u0031\u0039\u002E",
  37871. "\u249B",
  37872. "\u0032\u0030\u002E",
  37873. "\u249C",
  37874. "\u0028\u0061\u0029",
  37875. "\u249D",
  37876. "\u0028\u0062\u0029",
  37877. "\u249E",
  37878. "\u0028\u0063\u0029",
  37879. "\u249F",
  37880. "\u0028\u0064\u0029",
  37881. "\u24A0",
  37882. "\u0028\u0065\u0029",
  37883. "\u24A1",
  37884. "\u0028\u0066\u0029",
  37885. "\u24A2",
  37886. "\u0028\u0067\u0029",
  37887. "\u24A3",
  37888. "\u0028\u0068\u0029",
  37889. "\u24A4",
  37890. "\u0028\u0069\u0029",
  37891. "\u24A5",
  37892. "\u0028\u006A\u0029",
  37893. "\u24A6",
  37894. "\u0028\u006B\u0029",
  37895. "\u24A7",
  37896. "\u0028\u006C\u0029",
  37897. "\u24A8",
  37898. "\u0028\u006D\u0029",
  37899. "\u24A9",
  37900. "\u0028\u006E\u0029",
  37901. "\u24AA",
  37902. "\u0028\u006F\u0029",
  37903. "\u24AB",
  37904. "\u0028\u0070\u0029",
  37905. "\u24AC",
  37906. "\u0028\u0071\u0029",
  37907. "\u24AD",
  37908. "\u0028\u0072\u0029",
  37909. "\u24AE",
  37910. "\u0028\u0073\u0029",
  37911. "\u24AF",
  37912. "\u0028\u0074\u0029",
  37913. "\u24B0",
  37914. "\u0028\u0075\u0029",
  37915. "\u24B1",
  37916. "\u0028\u0076\u0029",
  37917. "\u24B2",
  37918. "\u0028\u0077\u0029",
  37919. "\u24B3",
  37920. "\u0028\u0078\u0029",
  37921. "\u24B4",
  37922. "\u0028\u0079\u0029",
  37923. "\u24B5",
  37924. "\u0028\u007A\u0029",
  37925. "\u2A0C",
  37926. "\u222B\u222B\u222B\u222B",
  37927. "\u2A74",
  37928. "\u003A\u003A\u003D",
  37929. "\u2A75",
  37930. "\u003D\u003D",
  37931. "\u2A76",
  37932. "\u003D\u003D\u003D",
  37933. "\u2E9F",
  37934. "\u6BCD",
  37935. "\u2EF3",
  37936. "\u9F9F",
  37937. "\u2F00",
  37938. "\u4E00",
  37939. "\u2F01",
  37940. "\u4E28",
  37941. "\u2F02",
  37942. "\u4E36",
  37943. "\u2F03",
  37944. "\u4E3F",
  37945. "\u2F04",
  37946. "\u4E59",
  37947. "\u2F05",
  37948. "\u4E85",
  37949. "\u2F06",
  37950. "\u4E8C",
  37951. "\u2F07",
  37952. "\u4EA0",
  37953. "\u2F08",
  37954. "\u4EBA",
  37955. "\u2F09",
  37956. "\u513F",
  37957. "\u2F0A",
  37958. "\u5165",
  37959. "\u2F0B",
  37960. "\u516B",
  37961. "\u2F0C",
  37962. "\u5182",
  37963. "\u2F0D",
  37964. "\u5196",
  37965. "\u2F0E",
  37966. "\u51AB",
  37967. "\u2F0F",
  37968. "\u51E0",
  37969. "\u2F10",
  37970. "\u51F5",
  37971. "\u2F11",
  37972. "\u5200",
  37973. "\u2F12",
  37974. "\u529B",
  37975. "\u2F13",
  37976. "\u52F9",
  37977. "\u2F14",
  37978. "\u5315",
  37979. "\u2F15",
  37980. "\u531A",
  37981. "\u2F16",
  37982. "\u5338",
  37983. "\u2F17",
  37984. "\u5341",
  37985. "\u2F18",
  37986. "\u535C",
  37987. "\u2F19",
  37988. "\u5369",
  37989. "\u2F1A",
  37990. "\u5382",
  37991. "\u2F1B",
  37992. "\u53B6",
  37993. "\u2F1C",
  37994. "\u53C8",
  37995. "\u2F1D",
  37996. "\u53E3",
  37997. "\u2F1E",
  37998. "\u56D7",
  37999. "\u2F1F",
  38000. "\u571F",
  38001. "\u2F20",
  38002. "\u58EB",
  38003. "\u2F21",
  38004. "\u5902",
  38005. "\u2F22",
  38006. "\u590A",
  38007. "\u2F23",
  38008. "\u5915",
  38009. "\u2F24",
  38010. "\u5927",
  38011. "\u2F25",
  38012. "\u5973",
  38013. "\u2F26",
  38014. "\u5B50",
  38015. "\u2F27",
  38016. "\u5B80",
  38017. "\u2F28",
  38018. "\u5BF8",
  38019. "\u2F29",
  38020. "\u5C0F",
  38021. "\u2F2A",
  38022. "\u5C22",
  38023. "\u2F2B",
  38024. "\u5C38",
  38025. "\u2F2C",
  38026. "\u5C6E",
  38027. "\u2F2D",
  38028. "\u5C71",
  38029. "\u2F2E",
  38030. "\u5DDB",
  38031. "\u2F2F",
  38032. "\u5DE5",
  38033. "\u2F30",
  38034. "\u5DF1",
  38035. "\u2F31",
  38036. "\u5DFE",
  38037. "\u2F32",
  38038. "\u5E72",
  38039. "\u2F33",
  38040. "\u5E7A",
  38041. "\u2F34",
  38042. "\u5E7F",
  38043. "\u2F35",
  38044. "\u5EF4",
  38045. "\u2F36",
  38046. "\u5EFE",
  38047. "\u2F37",
  38048. "\u5F0B",
  38049. "\u2F38",
  38050. "\u5F13",
  38051. "\u2F39",
  38052. "\u5F50",
  38053. "\u2F3A",
  38054. "\u5F61",
  38055. "\u2F3B",
  38056. "\u5F73",
  38057. "\u2F3C",
  38058. "\u5FC3",
  38059. "\u2F3D",
  38060. "\u6208",
  38061. "\u2F3E",
  38062. "\u6236",
  38063. "\u2F3F",
  38064. "\u624B",
  38065. "\u2F40",
  38066. "\u652F",
  38067. "\u2F41",
  38068. "\u6534",
  38069. "\u2F42",
  38070. "\u6587",
  38071. "\u2F43",
  38072. "\u6597",
  38073. "\u2F44",
  38074. "\u65A4",
  38075. "\u2F45",
  38076. "\u65B9",
  38077. "\u2F46",
  38078. "\u65E0",
  38079. "\u2F47",
  38080. "\u65E5",
  38081. "\u2F48",
  38082. "\u66F0",
  38083. "\u2F49",
  38084. "\u6708",
  38085. "\u2F4A",
  38086. "\u6728",
  38087. "\u2F4B",
  38088. "\u6B20",
  38089. "\u2F4C",
  38090. "\u6B62",
  38091. "\u2F4D",
  38092. "\u6B79",
  38093. "\u2F4E",
  38094. "\u6BB3",
  38095. "\u2F4F",
  38096. "\u6BCB",
  38097. "\u2F50",
  38098. "\u6BD4",
  38099. "\u2F51",
  38100. "\u6BDB",
  38101. "\u2F52",
  38102. "\u6C0F",
  38103. "\u2F53",
  38104. "\u6C14",
  38105. "\u2F54",
  38106. "\u6C34",
  38107. "\u2F55",
  38108. "\u706B",
  38109. "\u2F56",
  38110. "\u722A",
  38111. "\u2F57",
  38112. "\u7236",
  38113. "\u2F58",
  38114. "\u723B",
  38115. "\u2F59",
  38116. "\u723F",
  38117. "\u2F5A",
  38118. "\u7247",
  38119. "\u2F5B",
  38120. "\u7259",
  38121. "\u2F5C",
  38122. "\u725B",
  38123. "\u2F5D",
  38124. "\u72AC",
  38125. "\u2F5E",
  38126. "\u7384",
  38127. "\u2F5F",
  38128. "\u7389",
  38129. "\u2F60",
  38130. "\u74DC",
  38131. "\u2F61",
  38132. "\u74E6",
  38133. "\u2F62",
  38134. "\u7518",
  38135. "\u2F63",
  38136. "\u751F",
  38137. "\u2F64",
  38138. "\u7528",
  38139. "\u2F65",
  38140. "\u7530",
  38141. "\u2F66",
  38142. "\u758B",
  38143. "\u2F67",
  38144. "\u7592",
  38145. "\u2F68",
  38146. "\u7676",
  38147. "\u2F69",
  38148. "\u767D",
  38149. "\u2F6A",
  38150. "\u76AE",
  38151. "\u2F6B",
  38152. "\u76BF",
  38153. "\u2F6C",
  38154. "\u76EE",
  38155. "\u2F6D",
  38156. "\u77DB",
  38157. "\u2F6E",
  38158. "\u77E2",
  38159. "\u2F6F",
  38160. "\u77F3",
  38161. "\u2F70",
  38162. "\u793A",
  38163. "\u2F71",
  38164. "\u79B8",
  38165. "\u2F72",
  38166. "\u79BE",
  38167. "\u2F73",
  38168. "\u7A74",
  38169. "\u2F74",
  38170. "\u7ACB",
  38171. "\u2F75",
  38172. "\u7AF9",
  38173. "\u2F76",
  38174. "\u7C73",
  38175. "\u2F77",
  38176. "\u7CF8",
  38177. "\u2F78",
  38178. "\u7F36",
  38179. "\u2F79",
  38180. "\u7F51",
  38181. "\u2F7A",
  38182. "\u7F8A",
  38183. "\u2F7B",
  38184. "\u7FBD",
  38185. "\u2F7C",
  38186. "\u8001",
  38187. "\u2F7D",
  38188. "\u800C",
  38189. "\u2F7E",
  38190. "\u8012",
  38191. "\u2F7F",
  38192. "\u8033",
  38193. "\u2F80",
  38194. "\u807F",
  38195. "\u2F81",
  38196. "\u8089",
  38197. "\u2F82",
  38198. "\u81E3",
  38199. "\u2F83",
  38200. "\u81EA",
  38201. "\u2F84",
  38202. "\u81F3",
  38203. "\u2F85",
  38204. "\u81FC",
  38205. "\u2F86",
  38206. "\u820C",
  38207. "\u2F87",
  38208. "\u821B",
  38209. "\u2F88",
  38210. "\u821F",
  38211. "\u2F89",
  38212. "\u826E",
  38213. "\u2F8A",
  38214. "\u8272",
  38215. "\u2F8B",
  38216. "\u8278",
  38217. "\u2F8C",
  38218. "\u864D",
  38219. "\u2F8D",
  38220. "\u866B",
  38221. "\u2F8E",
  38222. "\u8840",
  38223. "\u2F8F",
  38224. "\u884C",
  38225. "\u2F90",
  38226. "\u8863",
  38227. "\u2F91",
  38228. "\u897E",
  38229. "\u2F92",
  38230. "\u898B",
  38231. "\u2F93",
  38232. "\u89D2",
  38233. "\u2F94",
  38234. "\u8A00",
  38235. "\u2F95",
  38236. "\u8C37",
  38237. "\u2F96",
  38238. "\u8C46",
  38239. "\u2F97",
  38240. "\u8C55",
  38241. "\u2F98",
  38242. "\u8C78",
  38243. "\u2F99",
  38244. "\u8C9D",
  38245. "\u2F9A",
  38246. "\u8D64",
  38247. "\u2F9B",
  38248. "\u8D70",
  38249. "\u2F9C",
  38250. "\u8DB3",
  38251. "\u2F9D",
  38252. "\u8EAB",
  38253. "\u2F9E",
  38254. "\u8ECA",
  38255. "\u2F9F",
  38256. "\u8F9B",
  38257. "\u2FA0",
  38258. "\u8FB0",
  38259. "\u2FA1",
  38260. "\u8FB5",
  38261. "\u2FA2",
  38262. "\u9091",
  38263. "\u2FA3",
  38264. "\u9149",
  38265. "\u2FA4",
  38266. "\u91C6",
  38267. "\u2FA5",
  38268. "\u91CC",
  38269. "\u2FA6",
  38270. "\u91D1",
  38271. "\u2FA7",
  38272. "\u9577",
  38273. "\u2FA8",
  38274. "\u9580",
  38275. "\u2FA9",
  38276. "\u961C",
  38277. "\u2FAA",
  38278. "\u96B6",
  38279. "\u2FAB",
  38280. "\u96B9",
  38281. "\u2FAC",
  38282. "\u96E8",
  38283. "\u2FAD",
  38284. "\u9751",
  38285. "\u2FAE",
  38286. "\u975E",
  38287. "\u2FAF",
  38288. "\u9762",
  38289. "\u2FB0",
  38290. "\u9769",
  38291. "\u2FB1",
  38292. "\u97CB",
  38293. "\u2FB2",
  38294. "\u97ED",
  38295. "\u2FB3",
  38296. "\u97F3",
  38297. "\u2FB4",
  38298. "\u9801",
  38299. "\u2FB5",
  38300. "\u98A8",
  38301. "\u2FB6",
  38302. "\u98DB",
  38303. "\u2FB7",
  38304. "\u98DF",
  38305. "\u2FB8",
  38306. "\u9996",
  38307. "\u2FB9",
  38308. "\u9999",
  38309. "\u2FBA",
  38310. "\u99AC",
  38311. "\u2FBB",
  38312. "\u9AA8",
  38313. "\u2FBC",
  38314. "\u9AD8",
  38315. "\u2FBD",
  38316. "\u9ADF",
  38317. "\u2FBE",
  38318. "\u9B25",
  38319. "\u2FBF",
  38320. "\u9B2F",
  38321. "\u2FC0",
  38322. "\u9B32",
  38323. "\u2FC1",
  38324. "\u9B3C",
  38325. "\u2FC2",
  38326. "\u9B5A",
  38327. "\u2FC3",
  38328. "\u9CE5",
  38329. "\u2FC4",
  38330. "\u9E75",
  38331. "\u2FC5",
  38332. "\u9E7F",
  38333. "\u2FC6",
  38334. "\u9EA5",
  38335. "\u2FC7",
  38336. "\u9EBB",
  38337. "\u2FC8",
  38338. "\u9EC3",
  38339. "\u2FC9",
  38340. "\u9ECD",
  38341. "\u2FCA",
  38342. "\u9ED1",
  38343. "\u2FCB",
  38344. "\u9EF9",
  38345. "\u2FCC",
  38346. "\u9EFD",
  38347. "\u2FCD",
  38348. "\u9F0E",
  38349. "\u2FCE",
  38350. "\u9F13",
  38351. "\u2FCF",
  38352. "\u9F20",
  38353. "\u2FD0",
  38354. "\u9F3B",
  38355. "\u2FD1",
  38356. "\u9F4A",
  38357. "\u2FD2",
  38358. "\u9F52",
  38359. "\u2FD3",
  38360. "\u9F8D",
  38361. "\u2FD4",
  38362. "\u9F9C",
  38363. "\u2FD5",
  38364. "\u9FA0",
  38365. "\u3036",
  38366. "\u3012",
  38367. "\u3038",
  38368. "\u5341",
  38369. "\u3039",
  38370. "\u5344",
  38371. "\u303A",
  38372. "\u5345",
  38373. "\u309B",
  38374. "\u0020\u3099",
  38375. "\u309C",
  38376. "\u0020\u309A",
  38377. "\u3131",
  38378. "\u1100",
  38379. "\u3132",
  38380. "\u1101",
  38381. "\u3133",
  38382. "\u11AA",
  38383. "\u3134",
  38384. "\u1102",
  38385. "\u3135",
  38386. "\u11AC",
  38387. "\u3136",
  38388. "\u11AD",
  38389. "\u3137",
  38390. "\u1103",
  38391. "\u3138",
  38392. "\u1104",
  38393. "\u3139",
  38394. "\u1105",
  38395. "\u313A",
  38396. "\u11B0",
  38397. "\u313B",
  38398. "\u11B1",
  38399. "\u313C",
  38400. "\u11B2",
  38401. "\u313D",
  38402. "\u11B3",
  38403. "\u313E",
  38404. "\u11B4",
  38405. "\u313F",
  38406. "\u11B5",
  38407. "\u3140",
  38408. "\u111A",
  38409. "\u3141",
  38410. "\u1106",
  38411. "\u3142",
  38412. "\u1107",
  38413. "\u3143",
  38414. "\u1108",
  38415. "\u3144",
  38416. "\u1121",
  38417. "\u3145",
  38418. "\u1109",
  38419. "\u3146",
  38420. "\u110A",
  38421. "\u3147",
  38422. "\u110B",
  38423. "\u3148",
  38424. "\u110C",
  38425. "\u3149",
  38426. "\u110D",
  38427. "\u314A",
  38428. "\u110E",
  38429. "\u314B",
  38430. "\u110F",
  38431. "\u314C",
  38432. "\u1110",
  38433. "\u314D",
  38434. "\u1111",
  38435. "\u314E",
  38436. "\u1112",
  38437. "\u314F",
  38438. "\u1161",
  38439. "\u3150",
  38440. "\u1162",
  38441. "\u3151",
  38442. "\u1163",
  38443. "\u3152",
  38444. "\u1164",
  38445. "\u3153",
  38446. "\u1165",
  38447. "\u3154",
  38448. "\u1166",
  38449. "\u3155",
  38450. "\u1167",
  38451. "\u3156",
  38452. "\u1168",
  38453. "\u3157",
  38454. "\u1169",
  38455. "\u3158",
  38456. "\u116A",
  38457. "\u3159",
  38458. "\u116B",
  38459. "\u315A",
  38460. "\u116C",
  38461. "\u315B",
  38462. "\u116D",
  38463. "\u315C",
  38464. "\u116E",
  38465. "\u315D",
  38466. "\u116F",
  38467. "\u315E",
  38468. "\u1170",
  38469. "\u315F",
  38470. "\u1171",
  38471. "\u3160",
  38472. "\u1172",
  38473. "\u3161",
  38474. "\u1173",
  38475. "\u3162",
  38476. "\u1174",
  38477. "\u3163",
  38478. "\u1175",
  38479. "\u3164",
  38480. "\u1160",
  38481. "\u3165",
  38482. "\u1114",
  38483. "\u3166",
  38484. "\u1115",
  38485. "\u3167",
  38486. "\u11C7",
  38487. "\u3168",
  38488. "\u11C8",
  38489. "\u3169",
  38490. "\u11CC",
  38491. "\u316A",
  38492. "\u11CE",
  38493. "\u316B",
  38494. "\u11D3",
  38495. "\u316C",
  38496. "\u11D7",
  38497. "\u316D",
  38498. "\u11D9",
  38499. "\u316E",
  38500. "\u111C",
  38501. "\u316F",
  38502. "\u11DD",
  38503. "\u3170",
  38504. "\u11DF",
  38505. "\u3171",
  38506. "\u111D",
  38507. "\u3172",
  38508. "\u111E",
  38509. "\u3173",
  38510. "\u1120",
  38511. "\u3174",
  38512. "\u1122",
  38513. "\u3175",
  38514. "\u1123",
  38515. "\u3176",
  38516. "\u1127",
  38517. "\u3177",
  38518. "\u1129",
  38519. "\u3178",
  38520. "\u112B",
  38521. "\u3179",
  38522. "\u112C",
  38523. "\u317A",
  38524. "\u112D",
  38525. "\u317B",
  38526. "\u112E",
  38527. "\u317C",
  38528. "\u112F",
  38529. "\u317D",
  38530. "\u1132",
  38531. "\u317E",
  38532. "\u1136",
  38533. "\u317F",
  38534. "\u1140",
  38535. "\u3180",
  38536. "\u1147",
  38537. "\u3181",
  38538. "\u114C",
  38539. "\u3182",
  38540. "\u11F1",
  38541. "\u3183",
  38542. "\u11F2",
  38543. "\u3184",
  38544. "\u1157",
  38545. "\u3185",
  38546. "\u1158",
  38547. "\u3186",
  38548. "\u1159",
  38549. "\u3187",
  38550. "\u1184",
  38551. "\u3188",
  38552. "\u1185",
  38553. "\u3189",
  38554. "\u1188",
  38555. "\u318A",
  38556. "\u1191",
  38557. "\u318B",
  38558. "\u1192",
  38559. "\u318C",
  38560. "\u1194",
  38561. "\u318D",
  38562. "\u119E",
  38563. "\u318E",
  38564. "\u11A1",
  38565. "\u3200",
  38566. "\u0028\u1100\u0029",
  38567. "\u3201",
  38568. "\u0028\u1102\u0029",
  38569. "\u3202",
  38570. "\u0028\u1103\u0029",
  38571. "\u3203",
  38572. "\u0028\u1105\u0029",
  38573. "\u3204",
  38574. "\u0028\u1106\u0029",
  38575. "\u3205",
  38576. "\u0028\u1107\u0029",
  38577. "\u3206",
  38578. "\u0028\u1109\u0029",
  38579. "\u3207",
  38580. "\u0028\u110B\u0029",
  38581. "\u3208",
  38582. "\u0028\u110C\u0029",
  38583. "\u3209",
  38584. "\u0028\u110E\u0029",
  38585. "\u320A",
  38586. "\u0028\u110F\u0029",
  38587. "\u320B",
  38588. "\u0028\u1110\u0029",
  38589. "\u320C",
  38590. "\u0028\u1111\u0029",
  38591. "\u320D",
  38592. "\u0028\u1112\u0029",
  38593. "\u320E",
  38594. "\u0028\u1100\u1161\u0029",
  38595. "\u320F",
  38596. "\u0028\u1102\u1161\u0029",
  38597. "\u3210",
  38598. "\u0028\u1103\u1161\u0029",
  38599. "\u3211",
  38600. "\u0028\u1105\u1161\u0029",
  38601. "\u3212",
  38602. "\u0028\u1106\u1161\u0029",
  38603. "\u3213",
  38604. "\u0028\u1107\u1161\u0029",
  38605. "\u3214",
  38606. "\u0028\u1109\u1161\u0029",
  38607. "\u3215",
  38608. "\u0028\u110B\u1161\u0029",
  38609. "\u3216",
  38610. "\u0028\u110C\u1161\u0029",
  38611. "\u3217",
  38612. "\u0028\u110E\u1161\u0029",
  38613. "\u3218",
  38614. "\u0028\u110F\u1161\u0029",
  38615. "\u3219",
  38616. "\u0028\u1110\u1161\u0029",
  38617. "\u321A",
  38618. "\u0028\u1111\u1161\u0029",
  38619. "\u321B",
  38620. "\u0028\u1112\u1161\u0029",
  38621. "\u321C",
  38622. "\u0028\u110C\u116E\u0029",
  38623. "\u321D",
  38624. "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029",
  38625. "\u321E",
  38626. "\u0028\u110B\u1169\u1112\u116E\u0029",
  38627. "\u3220",
  38628. "\u0028\u4E00\u0029",
  38629. "\u3221",
  38630. "\u0028\u4E8C\u0029",
  38631. "\u3222",
  38632. "\u0028\u4E09\u0029",
  38633. "\u3223",
  38634. "\u0028\u56DB\u0029",
  38635. "\u3224",
  38636. "\u0028\u4E94\u0029",
  38637. "\u3225",
  38638. "\u0028\u516D\u0029",
  38639. "\u3226",
  38640. "\u0028\u4E03\u0029",
  38641. "\u3227",
  38642. "\u0028\u516B\u0029",
  38643. "\u3228",
  38644. "\u0028\u4E5D\u0029",
  38645. "\u3229",
  38646. "\u0028\u5341\u0029",
  38647. "\u322A",
  38648. "\u0028\u6708\u0029",
  38649. "\u322B",
  38650. "\u0028\u706B\u0029",
  38651. "\u322C",
  38652. "\u0028\u6C34\u0029",
  38653. "\u322D",
  38654. "\u0028\u6728\u0029",
  38655. "\u322E",
  38656. "\u0028\u91D1\u0029",
  38657. "\u322F",
  38658. "\u0028\u571F\u0029",
  38659. "\u3230",
  38660. "\u0028\u65E5\u0029",
  38661. "\u3231",
  38662. "\u0028\u682A\u0029",
  38663. "\u3232",
  38664. "\u0028\u6709\u0029",
  38665. "\u3233",
  38666. "\u0028\u793E\u0029",
  38667. "\u3234",
  38668. "\u0028\u540D\u0029",
  38669. "\u3235",
  38670. "\u0028\u7279\u0029",
  38671. "\u3236",
  38672. "\u0028\u8CA1\u0029",
  38673. "\u3237",
  38674. "\u0028\u795D\u0029",
  38675. "\u3238",
  38676. "\u0028\u52B4\u0029",
  38677. "\u3239",
  38678. "\u0028\u4EE3\u0029",
  38679. "\u323A",
  38680. "\u0028\u547C\u0029",
  38681. "\u323B",
  38682. "\u0028\u5B66\u0029",
  38683. "\u323C",
  38684. "\u0028\u76E3\u0029",
  38685. "\u323D",
  38686. "\u0028\u4F01\u0029",
  38687. "\u323E",
  38688. "\u0028\u8CC7\u0029",
  38689. "\u323F",
  38690. "\u0028\u5354\u0029",
  38691. "\u3240",
  38692. "\u0028\u796D\u0029",
  38693. "\u3241",
  38694. "\u0028\u4F11\u0029",
  38695. "\u3242",
  38696. "\u0028\u81EA\u0029",
  38697. "\u3243",
  38698. "\u0028\u81F3\u0029",
  38699. "\u32C0",
  38700. "\u0031\u6708",
  38701. "\u32C1",
  38702. "\u0032\u6708",
  38703. "\u32C2",
  38704. "\u0033\u6708",
  38705. "\u32C3",
  38706. "\u0034\u6708",
  38707. "\u32C4",
  38708. "\u0035\u6708",
  38709. "\u32C5",
  38710. "\u0036\u6708",
  38711. "\u32C6",
  38712. "\u0037\u6708",
  38713. "\u32C7",
  38714. "\u0038\u6708",
  38715. "\u32C8",
  38716. "\u0039\u6708",
  38717. "\u32C9",
  38718. "\u0031\u0030\u6708",
  38719. "\u32CA",
  38720. "\u0031\u0031\u6708",
  38721. "\u32CB",
  38722. "\u0031\u0032\u6708",
  38723. "\u3358",
  38724. "\u0030\u70B9",
  38725. "\u3359",
  38726. "\u0031\u70B9",
  38727. "\u335A",
  38728. "\u0032\u70B9",
  38729. "\u335B",
  38730. "\u0033\u70B9",
  38731. "\u335C",
  38732. "\u0034\u70B9",
  38733. "\u335D",
  38734. "\u0035\u70B9",
  38735. "\u335E",
  38736. "\u0036\u70B9",
  38737. "\u335F",
  38738. "\u0037\u70B9",
  38739. "\u3360",
  38740. "\u0038\u70B9",
  38741. "\u3361",
  38742. "\u0039\u70B9",
  38743. "\u3362",
  38744. "\u0031\u0030\u70B9",
  38745. "\u3363",
  38746. "\u0031\u0031\u70B9",
  38747. "\u3364",
  38748. "\u0031\u0032\u70B9",
  38749. "\u3365",
  38750. "\u0031\u0033\u70B9",
  38751. "\u3366",
  38752. "\u0031\u0034\u70B9",
  38753. "\u3367",
  38754. "\u0031\u0035\u70B9",
  38755. "\u3368",
  38756. "\u0031\u0036\u70B9",
  38757. "\u3369",
  38758. "\u0031\u0037\u70B9",
  38759. "\u336A",
  38760. "\u0031\u0038\u70B9",
  38761. "\u336B",
  38762. "\u0031\u0039\u70B9",
  38763. "\u336C",
  38764. "\u0032\u0030\u70B9",
  38765. "\u336D",
  38766. "\u0032\u0031\u70B9",
  38767. "\u336E",
  38768. "\u0032\u0032\u70B9",
  38769. "\u336F",
  38770. "\u0032\u0033\u70B9",
  38771. "\u3370",
  38772. "\u0032\u0034\u70B9",
  38773. "\u33E0",
  38774. "\u0031\u65E5",
  38775. "\u33E1",
  38776. "\u0032\u65E5",
  38777. "\u33E2",
  38778. "\u0033\u65E5",
  38779. "\u33E3",
  38780. "\u0034\u65E5",
  38781. "\u33E4",
  38782. "\u0035\u65E5",
  38783. "\u33E5",
  38784. "\u0036\u65E5",
  38785. "\u33E6",
  38786. "\u0037\u65E5",
  38787. "\u33E7",
  38788. "\u0038\u65E5",
  38789. "\u33E8",
  38790. "\u0039\u65E5",
  38791. "\u33E9",
  38792. "\u0031\u0030\u65E5",
  38793. "\u33EA",
  38794. "\u0031\u0031\u65E5",
  38795. "\u33EB",
  38796. "\u0031\u0032\u65E5",
  38797. "\u33EC",
  38798. "\u0031\u0033\u65E5",
  38799. "\u33ED",
  38800. "\u0031\u0034\u65E5",
  38801. "\u33EE",
  38802. "\u0031\u0035\u65E5",
  38803. "\u33EF",
  38804. "\u0031\u0036\u65E5",
  38805. "\u33F0",
  38806. "\u0031\u0037\u65E5",
  38807. "\u33F1",
  38808. "\u0031\u0038\u65E5",
  38809. "\u33F2",
  38810. "\u0031\u0039\u65E5",
  38811. "\u33F3",
  38812. "\u0032\u0030\u65E5",
  38813. "\u33F4",
  38814. "\u0032\u0031\u65E5",
  38815. "\u33F5",
  38816. "\u0032\u0032\u65E5",
  38817. "\u33F6",
  38818. "\u0032\u0033\u65E5",
  38819. "\u33F7",
  38820. "\u0032\u0034\u65E5",
  38821. "\u33F8",
  38822. "\u0032\u0035\u65E5",
  38823. "\u33F9",
  38824. "\u0032\u0036\u65E5",
  38825. "\u33FA",
  38826. "\u0032\u0037\u65E5",
  38827. "\u33FB",
  38828. "\u0032\u0038\u65E5",
  38829. "\u33FC",
  38830. "\u0032\u0039\u65E5",
  38831. "\u33FD",
  38832. "\u0033\u0030\u65E5",
  38833. "\u33FE",
  38834. "\u0033\u0031\u65E5",
  38835. "\uFB00",
  38836. "\u0066\u0066",
  38837. "\uFB01",
  38838. "\u0066\u0069",
  38839. "\uFB02",
  38840. "\u0066\u006C",
  38841. "\uFB03",
  38842. "\u0066\u0066\u0069",
  38843. "\uFB04",
  38844. "\u0066\u0066\u006C",
  38845. "\uFB05",
  38846. "\u017F\u0074",
  38847. "\uFB06",
  38848. "\u0073\u0074",
  38849. "\uFB13",
  38850. "\u0574\u0576",
  38851. "\uFB14",
  38852. "\u0574\u0565",
  38853. "\uFB15",
  38854. "\u0574\u056B",
  38855. "\uFB16",
  38856. "\u057E\u0576",
  38857. "\uFB17",
  38858. "\u0574\u056D",
  38859. "\uFB4F",
  38860. "\u05D0\u05DC",
  38861. "\uFB50",
  38862. "\u0671",
  38863. "\uFB51",
  38864. "\u0671",
  38865. "\uFB52",
  38866. "\u067B",
  38867. "\uFB53",
  38868. "\u067B",
  38869. "\uFB54",
  38870. "\u067B",
  38871. "\uFB55",
  38872. "\u067B",
  38873. "\uFB56",
  38874. "\u067E",
  38875. "\uFB57",
  38876. "\u067E",
  38877. "\uFB58",
  38878. "\u067E",
  38879. "\uFB59",
  38880. "\u067E",
  38881. "\uFB5A",
  38882. "\u0680",
  38883. "\uFB5B",
  38884. "\u0680",
  38885. "\uFB5C",
  38886. "\u0680",
  38887. "\uFB5D",
  38888. "\u0680",
  38889. "\uFB5E",
  38890. "\u067A",
  38891. "\uFB5F",
  38892. "\u067A",
  38893. "\uFB60",
  38894. "\u067A",
  38895. "\uFB61",
  38896. "\u067A",
  38897. "\uFB62",
  38898. "\u067F",
  38899. "\uFB63",
  38900. "\u067F",
  38901. "\uFB64",
  38902. "\u067F",
  38903. "\uFB65",
  38904. "\u067F",
  38905. "\uFB66",
  38906. "\u0679",
  38907. "\uFB67",
  38908. "\u0679",
  38909. "\uFB68",
  38910. "\u0679",
  38911. "\uFB69",
  38912. "\u0679",
  38913. "\uFB6A",
  38914. "\u06A4",
  38915. "\uFB6B",
  38916. "\u06A4",
  38917. "\uFB6C",
  38918. "\u06A4",
  38919. "\uFB6D",
  38920. "\u06A4",
  38921. "\uFB6E",
  38922. "\u06A6",
  38923. "\uFB6F",
  38924. "\u06A6",
  38925. "\uFB70",
  38926. "\u06A6",
  38927. "\uFB71",
  38928. "\u06A6",
  38929. "\uFB72",
  38930. "\u0684",
  38931. "\uFB73",
  38932. "\u0684",
  38933. "\uFB74",
  38934. "\u0684",
  38935. "\uFB75",
  38936. "\u0684",
  38937. "\uFB76",
  38938. "\u0683",
  38939. "\uFB77",
  38940. "\u0683",
  38941. "\uFB78",
  38942. "\u0683",
  38943. "\uFB79",
  38944. "\u0683",
  38945. "\uFB7A",
  38946. "\u0686",
  38947. "\uFB7B",
  38948. "\u0686",
  38949. "\uFB7C",
  38950. "\u0686",
  38951. "\uFB7D",
  38952. "\u0686",
  38953. "\uFB7E",
  38954. "\u0687",
  38955. "\uFB7F",
  38956. "\u0687",
  38957. "\uFB80",
  38958. "\u0687",
  38959. "\uFB81",
  38960. "\u0687",
  38961. "\uFB82",
  38962. "\u068D",
  38963. "\uFB83",
  38964. "\u068D",
  38965. "\uFB84",
  38966. "\u068C",
  38967. "\uFB85",
  38968. "\u068C",
  38969. "\uFB86",
  38970. "\u068E",
  38971. "\uFB87",
  38972. "\u068E",
  38973. "\uFB88",
  38974. "\u0688",
  38975. "\uFB89",
  38976. "\u0688",
  38977. "\uFB8A",
  38978. "\u0698",
  38979. "\uFB8B",
  38980. "\u0698",
  38981. "\uFB8C",
  38982. "\u0691",
  38983. "\uFB8D",
  38984. "\u0691",
  38985. "\uFB8E",
  38986. "\u06A9",
  38987. "\uFB8F",
  38988. "\u06A9",
  38989. "\uFB90",
  38990. "\u06A9",
  38991. "\uFB91",
  38992. "\u06A9",
  38993. "\uFB92",
  38994. "\u06AF",
  38995. "\uFB93",
  38996. "\u06AF",
  38997. "\uFB94",
  38998. "\u06AF",
  38999. "\uFB95",
  39000. "\u06AF",
  39001. "\uFB96",
  39002. "\u06B3",
  39003. "\uFB97",
  39004. "\u06B3",
  39005. "\uFB98",
  39006. "\u06B3",
  39007. "\uFB99",
  39008. "\u06B3",
  39009. "\uFB9A",
  39010. "\u06B1",
  39011. "\uFB9B",
  39012. "\u06B1",
  39013. "\uFB9C",
  39014. "\u06B1",
  39015. "\uFB9D",
  39016. "\u06B1",
  39017. "\uFB9E",
  39018. "\u06BA",
  39019. "\uFB9F",
  39020. "\u06BA",
  39021. "\uFBA0",
  39022. "\u06BB",
  39023. "\uFBA1",
  39024. "\u06BB",
  39025. "\uFBA2",
  39026. "\u06BB",
  39027. "\uFBA3",
  39028. "\u06BB",
  39029. "\uFBA4",
  39030. "\u06C0",
  39031. "\uFBA5",
  39032. "\u06C0",
  39033. "\uFBA6",
  39034. "\u06C1",
  39035. "\uFBA7",
  39036. "\u06C1",
  39037. "\uFBA8",
  39038. "\u06C1",
  39039. "\uFBA9",
  39040. "\u06C1",
  39041. "\uFBAA",
  39042. "\u06BE",
  39043. "\uFBAB",
  39044. "\u06BE",
  39045. "\uFBAC",
  39046. "\u06BE",
  39047. "\uFBAD",
  39048. "\u06BE",
  39049. "\uFBAE",
  39050. "\u06D2",
  39051. "\uFBAF",
  39052. "\u06D2",
  39053. "\uFBB0",
  39054. "\u06D3",
  39055. "\uFBB1",
  39056. "\u06D3",
  39057. "\uFBD3",
  39058. "\u06AD",
  39059. "\uFBD4",
  39060. "\u06AD",
  39061. "\uFBD5",
  39062. "\u06AD",
  39063. "\uFBD6",
  39064. "\u06AD",
  39065. "\uFBD7",
  39066. "\u06C7",
  39067. "\uFBD8",
  39068. "\u06C7",
  39069. "\uFBD9",
  39070. "\u06C6",
  39071. "\uFBDA",
  39072. "\u06C6",
  39073. "\uFBDB",
  39074. "\u06C8",
  39075. "\uFBDC",
  39076. "\u06C8",
  39077. "\uFBDD",
  39078. "\u0677",
  39079. "\uFBDE",
  39080. "\u06CB",
  39081. "\uFBDF",
  39082. "\u06CB",
  39083. "\uFBE0",
  39084. "\u06C5",
  39085. "\uFBE1",
  39086. "\u06C5",
  39087. "\uFBE2",
  39088. "\u06C9",
  39089. "\uFBE3",
  39090. "\u06C9",
  39091. "\uFBE4",
  39092. "\u06D0",
  39093. "\uFBE5",
  39094. "\u06D0",
  39095. "\uFBE6",
  39096. "\u06D0",
  39097. "\uFBE7",
  39098. "\u06D0",
  39099. "\uFBE8",
  39100. "\u0649",
  39101. "\uFBE9",
  39102. "\u0649",
  39103. "\uFBEA",
  39104. "\u0626\u0627",
  39105. "\uFBEB",
  39106. "\u0626\u0627",
  39107. "\uFBEC",
  39108. "\u0626\u06D5",
  39109. "\uFBED",
  39110. "\u0626\u06D5",
  39111. "\uFBEE",
  39112. "\u0626\u0648",
  39113. "\uFBEF",
  39114. "\u0626\u0648",
  39115. "\uFBF0",
  39116. "\u0626\u06C7",
  39117. "\uFBF1",
  39118. "\u0626\u06C7",
  39119. "\uFBF2",
  39120. "\u0626\u06C6",
  39121. "\uFBF3",
  39122. "\u0626\u06C6",
  39123. "\uFBF4",
  39124. "\u0626\u06C8",
  39125. "\uFBF5",
  39126. "\u0626\u06C8",
  39127. "\uFBF6",
  39128. "\u0626\u06D0",
  39129. "\uFBF7",
  39130. "\u0626\u06D0",
  39131. "\uFBF8",
  39132. "\u0626\u06D0",
  39133. "\uFBF9",
  39134. "\u0626\u0649",
  39135. "\uFBFA",
  39136. "\u0626\u0649",
  39137. "\uFBFB",
  39138. "\u0626\u0649",
  39139. "\uFBFC",
  39140. "\u06CC",
  39141. "\uFBFD",
  39142. "\u06CC",
  39143. "\uFBFE",
  39144. "\u06CC",
  39145. "\uFBFF",
  39146. "\u06CC",
  39147. "\uFC00",
  39148. "\u0626\u062C",
  39149. "\uFC01",
  39150. "\u0626\u062D",
  39151. "\uFC02",
  39152. "\u0626\u0645",
  39153. "\uFC03",
  39154. "\u0626\u0649",
  39155. "\uFC04",
  39156. "\u0626\u064A",
  39157. "\uFC05",
  39158. "\u0628\u062C",
  39159. "\uFC06",
  39160. "\u0628\u062D",
  39161. "\uFC07",
  39162. "\u0628\u062E",
  39163. "\uFC08",
  39164. "\u0628\u0645",
  39165. "\uFC09",
  39166. "\u0628\u0649",
  39167. "\uFC0A",
  39168. "\u0628\u064A",
  39169. "\uFC0B",
  39170. "\u062A\u062C",
  39171. "\uFC0C",
  39172. "\u062A\u062D",
  39173. "\uFC0D",
  39174. "\u062A\u062E",
  39175. "\uFC0E",
  39176. "\u062A\u0645",
  39177. "\uFC0F",
  39178. "\u062A\u0649",
  39179. "\uFC10",
  39180. "\u062A\u064A",
  39181. "\uFC11",
  39182. "\u062B\u062C",
  39183. "\uFC12",
  39184. "\u062B\u0645",
  39185. "\uFC13",
  39186. "\u062B\u0649",
  39187. "\uFC14",
  39188. "\u062B\u064A",
  39189. "\uFC15",
  39190. "\u062C\u062D",
  39191. "\uFC16",
  39192. "\u062C\u0645",
  39193. "\uFC17",
  39194. "\u062D\u062C",
  39195. "\uFC18",
  39196. "\u062D\u0645",
  39197. "\uFC19",
  39198. "\u062E\u062C",
  39199. "\uFC1A",
  39200. "\u062E\u062D",
  39201. "\uFC1B",
  39202. "\u062E\u0645",
  39203. "\uFC1C",
  39204. "\u0633\u062C",
  39205. "\uFC1D",
  39206. "\u0633\u062D",
  39207. "\uFC1E",
  39208. "\u0633\u062E",
  39209. "\uFC1F",
  39210. "\u0633\u0645",
  39211. "\uFC20",
  39212. "\u0635\u062D",
  39213. "\uFC21",
  39214. "\u0635\u0645",
  39215. "\uFC22",
  39216. "\u0636\u062C",
  39217. "\uFC23",
  39218. "\u0636\u062D",
  39219. "\uFC24",
  39220. "\u0636\u062E",
  39221. "\uFC25",
  39222. "\u0636\u0645",
  39223. "\uFC26",
  39224. "\u0637\u062D",
  39225. "\uFC27",
  39226. "\u0637\u0645",
  39227. "\uFC28",
  39228. "\u0638\u0645",
  39229. "\uFC29",
  39230. "\u0639\u062C",
  39231. "\uFC2A",
  39232. "\u0639\u0645",
  39233. "\uFC2B",
  39234. "\u063A\u062C",
  39235. "\uFC2C",
  39236. "\u063A\u0645",
  39237. "\uFC2D",
  39238. "\u0641\u062C",
  39239. "\uFC2E",
  39240. "\u0641\u062D",
  39241. "\uFC2F",
  39242. "\u0641\u062E",
  39243. "\uFC30",
  39244. "\u0641\u0645",
  39245. "\uFC31",
  39246. "\u0641\u0649",
  39247. "\uFC32",
  39248. "\u0641\u064A",
  39249. "\uFC33",
  39250. "\u0642\u062D",
  39251. "\uFC34",
  39252. "\u0642\u0645",
  39253. "\uFC35",
  39254. "\u0642\u0649",
  39255. "\uFC36",
  39256. "\u0642\u064A",
  39257. "\uFC37",
  39258. "\u0643\u0627",
  39259. "\uFC38",
  39260. "\u0643\u062C",
  39261. "\uFC39",
  39262. "\u0643\u062D",
  39263. "\uFC3A",
  39264. "\u0643\u062E",
  39265. "\uFC3B",
  39266. "\u0643\u0644",
  39267. "\uFC3C",
  39268. "\u0643\u0645",
  39269. "\uFC3D",
  39270. "\u0643\u0649",
  39271. "\uFC3E",
  39272. "\u0643\u064A",
  39273. "\uFC3F",
  39274. "\u0644\u062C",
  39275. "\uFC40",
  39276. "\u0644\u062D",
  39277. "\uFC41",
  39278. "\u0644\u062E",
  39279. "\uFC42",
  39280. "\u0644\u0645",
  39281. "\uFC43",
  39282. "\u0644\u0649",
  39283. "\uFC44",
  39284. "\u0644\u064A",
  39285. "\uFC45",
  39286. "\u0645\u062C",
  39287. "\uFC46",
  39288. "\u0645\u062D",
  39289. "\uFC47",
  39290. "\u0645\u062E",
  39291. "\uFC48",
  39292. "\u0645\u0645",
  39293. "\uFC49",
  39294. "\u0645\u0649",
  39295. "\uFC4A",
  39296. "\u0645\u064A",
  39297. "\uFC4B",
  39298. "\u0646\u062C",
  39299. "\uFC4C",
  39300. "\u0646\u062D",
  39301. "\uFC4D",
  39302. "\u0646\u062E",
  39303. "\uFC4E",
  39304. "\u0646\u0645",
  39305. "\uFC4F",
  39306. "\u0646\u0649",
  39307. "\uFC50",
  39308. "\u0646\u064A",
  39309. "\uFC51",
  39310. "\u0647\u062C",
  39311. "\uFC52",
  39312. "\u0647\u0645",
  39313. "\uFC53",
  39314. "\u0647\u0649",
  39315. "\uFC54",
  39316. "\u0647\u064A",
  39317. "\uFC55",
  39318. "\u064A\u062C",
  39319. "\uFC56",
  39320. "\u064A\u062D",
  39321. "\uFC57",
  39322. "\u064A\u062E",
  39323. "\uFC58",
  39324. "\u064A\u0645",
  39325. "\uFC59",
  39326. "\u064A\u0649",
  39327. "\uFC5A",
  39328. "\u064A\u064A",
  39329. "\uFC5B",
  39330. "\u0630\u0670",
  39331. "\uFC5C",
  39332. "\u0631\u0670",
  39333. "\uFC5D",
  39334. "\u0649\u0670",
  39335. "\uFC5E",
  39336. "\u0020\u064C\u0651",
  39337. "\uFC5F",
  39338. "\u0020\u064D\u0651",
  39339. "\uFC60",
  39340. "\u0020\u064E\u0651",
  39341. "\uFC61",
  39342. "\u0020\u064F\u0651",
  39343. "\uFC62",
  39344. "\u0020\u0650\u0651",
  39345. "\uFC63",
  39346. "\u0020\u0651\u0670",
  39347. "\uFC64",
  39348. "\u0626\u0631",
  39349. "\uFC65",
  39350. "\u0626\u0632",
  39351. "\uFC66",
  39352. "\u0626\u0645",
  39353. "\uFC67",
  39354. "\u0626\u0646",
  39355. "\uFC68",
  39356. "\u0626\u0649",
  39357. "\uFC69",
  39358. "\u0626\u064A",
  39359. "\uFC6A",
  39360. "\u0628\u0631",
  39361. "\uFC6B",
  39362. "\u0628\u0632",
  39363. "\uFC6C",
  39364. "\u0628\u0645",
  39365. "\uFC6D",
  39366. "\u0628\u0646",
  39367. "\uFC6E",
  39368. "\u0628\u0649",
  39369. "\uFC6F",
  39370. "\u0628\u064A",
  39371. "\uFC70",
  39372. "\u062A\u0631",
  39373. "\uFC71",
  39374. "\u062A\u0632",
  39375. "\uFC72",
  39376. "\u062A\u0645",
  39377. "\uFC73",
  39378. "\u062A\u0646",
  39379. "\uFC74",
  39380. "\u062A\u0649",
  39381. "\uFC75",
  39382. "\u062A\u064A",
  39383. "\uFC76",
  39384. "\u062B\u0631",
  39385. "\uFC77",
  39386. "\u062B\u0632",
  39387. "\uFC78",
  39388. "\u062B\u0645",
  39389. "\uFC79",
  39390. "\u062B\u0646",
  39391. "\uFC7A",
  39392. "\u062B\u0649",
  39393. "\uFC7B",
  39394. "\u062B\u064A",
  39395. "\uFC7C",
  39396. "\u0641\u0649",
  39397. "\uFC7D",
  39398. "\u0641\u064A",
  39399. "\uFC7E",
  39400. "\u0642\u0649",
  39401. "\uFC7F",
  39402. "\u0642\u064A",
  39403. "\uFC80",
  39404. "\u0643\u0627",
  39405. "\uFC81",
  39406. "\u0643\u0644",
  39407. "\uFC82",
  39408. "\u0643\u0645",
  39409. "\uFC83",
  39410. "\u0643\u0649",
  39411. "\uFC84",
  39412. "\u0643\u064A",
  39413. "\uFC85",
  39414. "\u0644\u0645",
  39415. "\uFC86",
  39416. "\u0644\u0649",
  39417. "\uFC87",
  39418. "\u0644\u064A",
  39419. "\uFC88",
  39420. "\u0645\u0627",
  39421. "\uFC89",
  39422. "\u0645\u0645",
  39423. "\uFC8A",
  39424. "\u0646\u0631",
  39425. "\uFC8B",
  39426. "\u0646\u0632",
  39427. "\uFC8C",
  39428. "\u0646\u0645",
  39429. "\uFC8D",
  39430. "\u0646\u0646",
  39431. "\uFC8E",
  39432. "\u0646\u0649",
  39433. "\uFC8F",
  39434. "\u0646\u064A",
  39435. "\uFC90",
  39436. "\u0649\u0670",
  39437. "\uFC91",
  39438. "\u064A\u0631",
  39439. "\uFC92",
  39440. "\u064A\u0632",
  39441. "\uFC93",
  39442. "\u064A\u0645",
  39443. "\uFC94",
  39444. "\u064A\u0646",
  39445. "\uFC95",
  39446. "\u064A\u0649",
  39447. "\uFC96",
  39448. "\u064A\u064A",
  39449. "\uFC97",
  39450. "\u0626\u062C",
  39451. "\uFC98",
  39452. "\u0626\u062D",
  39453. "\uFC99",
  39454. "\u0626\u062E",
  39455. "\uFC9A",
  39456. "\u0626\u0645",
  39457. "\uFC9B",
  39458. "\u0626\u0647",
  39459. "\uFC9C",
  39460. "\u0628\u062C",
  39461. "\uFC9D",
  39462. "\u0628\u062D",
  39463. "\uFC9E",
  39464. "\u0628\u062E",
  39465. "\uFC9F",
  39466. "\u0628\u0645",
  39467. "\uFCA0",
  39468. "\u0628\u0647",
  39469. "\uFCA1",
  39470. "\u062A\u062C",
  39471. "\uFCA2",
  39472. "\u062A\u062D",
  39473. "\uFCA3",
  39474. "\u062A\u062E",
  39475. "\uFCA4",
  39476. "\u062A\u0645",
  39477. "\uFCA5",
  39478. "\u062A\u0647",
  39479. "\uFCA6",
  39480. "\u062B\u0645",
  39481. "\uFCA7",
  39482. "\u062C\u062D",
  39483. "\uFCA8",
  39484. "\u062C\u0645",
  39485. "\uFCA9",
  39486. "\u062D\u062C",
  39487. "\uFCAA",
  39488. "\u062D\u0645",
  39489. "\uFCAB",
  39490. "\u062E\u062C",
  39491. "\uFCAC",
  39492. "\u062E\u0645",
  39493. "\uFCAD",
  39494. "\u0633\u062C",
  39495. "\uFCAE",
  39496. "\u0633\u062D",
  39497. "\uFCAF",
  39498. "\u0633\u062E",
  39499. "\uFCB0",
  39500. "\u0633\u0645",
  39501. "\uFCB1",
  39502. "\u0635\u062D",
  39503. "\uFCB2",
  39504. "\u0635\u062E",
  39505. "\uFCB3",
  39506. "\u0635\u0645",
  39507. "\uFCB4",
  39508. "\u0636\u062C",
  39509. "\uFCB5",
  39510. "\u0636\u062D",
  39511. "\uFCB6",
  39512. "\u0636\u062E",
  39513. "\uFCB7",
  39514. "\u0636\u0645",
  39515. "\uFCB8",
  39516. "\u0637\u062D",
  39517. "\uFCB9",
  39518. "\u0638\u0645",
  39519. "\uFCBA",
  39520. "\u0639\u062C",
  39521. "\uFCBB",
  39522. "\u0639\u0645",
  39523. "\uFCBC",
  39524. "\u063A\u062C",
  39525. "\uFCBD",
  39526. "\u063A\u0645",
  39527. "\uFCBE",
  39528. "\u0641\u062C",
  39529. "\uFCBF",
  39530. "\u0641\u062D",
  39531. "\uFCC0",
  39532. "\u0641\u062E",
  39533. "\uFCC1",
  39534. "\u0641\u0645",
  39535. "\uFCC2",
  39536. "\u0642\u062D",
  39537. "\uFCC3",
  39538. "\u0642\u0645",
  39539. "\uFCC4",
  39540. "\u0643\u062C",
  39541. "\uFCC5",
  39542. "\u0643\u062D",
  39543. "\uFCC6",
  39544. "\u0643\u062E",
  39545. "\uFCC7",
  39546. "\u0643\u0644",
  39547. "\uFCC8",
  39548. "\u0643\u0645",
  39549. "\uFCC9",
  39550. "\u0644\u062C",
  39551. "\uFCCA",
  39552. "\u0644\u062D",
  39553. "\uFCCB",
  39554. "\u0644\u062E",
  39555. "\uFCCC",
  39556. "\u0644\u0645",
  39557. "\uFCCD",
  39558. "\u0644\u0647",
  39559. "\uFCCE",
  39560. "\u0645\u062C",
  39561. "\uFCCF",
  39562. "\u0645\u062D",
  39563. "\uFCD0",
  39564. "\u0645\u062E",
  39565. "\uFCD1",
  39566. "\u0645\u0645",
  39567. "\uFCD2",
  39568. "\u0646\u062C",
  39569. "\uFCD3",
  39570. "\u0646\u062D",
  39571. "\uFCD4",
  39572. "\u0646\u062E",
  39573. "\uFCD5",
  39574. "\u0646\u0645",
  39575. "\uFCD6",
  39576. "\u0646\u0647",
  39577. "\uFCD7",
  39578. "\u0647\u062C",
  39579. "\uFCD8",
  39580. "\u0647\u0645",
  39581. "\uFCD9",
  39582. "\u0647\u0670",
  39583. "\uFCDA",
  39584. "\u064A\u062C",
  39585. "\uFCDB",
  39586. "\u064A\u062D",
  39587. "\uFCDC",
  39588. "\u064A\u062E",
  39589. "\uFCDD",
  39590. "\u064A\u0645",
  39591. "\uFCDE",
  39592. "\u064A\u0647",
  39593. "\uFCDF",
  39594. "\u0626\u0645",
  39595. "\uFCE0",
  39596. "\u0626\u0647",
  39597. "\uFCE1",
  39598. "\u0628\u0645",
  39599. "\uFCE2",
  39600. "\u0628\u0647",
  39601. "\uFCE3",
  39602. "\u062A\u0645",
  39603. "\uFCE4",
  39604. "\u062A\u0647",
  39605. "\uFCE5",
  39606. "\u062B\u0645",
  39607. "\uFCE6",
  39608. "\u062B\u0647",
  39609. "\uFCE7",
  39610. "\u0633\u0645",
  39611. "\uFCE8",
  39612. "\u0633\u0647",
  39613. "\uFCE9",
  39614. "\u0634\u0645",
  39615. "\uFCEA",
  39616. "\u0634\u0647",
  39617. "\uFCEB",
  39618. "\u0643\u0644",
  39619. "\uFCEC",
  39620. "\u0643\u0645",
  39621. "\uFCED",
  39622. "\u0644\u0645",
  39623. "\uFCEE",
  39624. "\u0646\u0645",
  39625. "\uFCEF",
  39626. "\u0646\u0647",
  39627. "\uFCF0",
  39628. "\u064A\u0645",
  39629. "\uFCF1",
  39630. "\u064A\u0647",
  39631. "\uFCF2",
  39632. "\u0640\u064E\u0651",
  39633. "\uFCF3",
  39634. "\u0640\u064F\u0651",
  39635. "\uFCF4",
  39636. "\u0640\u0650\u0651",
  39637. "\uFCF5",
  39638. "\u0637\u0649",
  39639. "\uFCF6",
  39640. "\u0637\u064A",
  39641. "\uFCF7",
  39642. "\u0639\u0649",
  39643. "\uFCF8",
  39644. "\u0639\u064A",
  39645. "\uFCF9",
  39646. "\u063A\u0649",
  39647. "\uFCFA",
  39648. "\u063A\u064A",
  39649. "\uFCFB",
  39650. "\u0633\u0649",
  39651. "\uFCFC",
  39652. "\u0633\u064A",
  39653. "\uFCFD",
  39654. "\u0634\u0649",
  39655. "\uFCFE",
  39656. "\u0634\u064A",
  39657. "\uFCFF",
  39658. "\u062D\u0649",
  39659. "\uFD00",
  39660. "\u062D\u064A",
  39661. "\uFD01",
  39662. "\u062C\u0649",
  39663. "\uFD02",
  39664. "\u062C\u064A",
  39665. "\uFD03",
  39666. "\u062E\u0649",
  39667. "\uFD04",
  39668. "\u062E\u064A",
  39669. "\uFD05",
  39670. "\u0635\u0649",
  39671. "\uFD06",
  39672. "\u0635\u064A",
  39673. "\uFD07",
  39674. "\u0636\u0649",
  39675. "\uFD08",
  39676. "\u0636\u064A",
  39677. "\uFD09",
  39678. "\u0634\u062C",
  39679. "\uFD0A",
  39680. "\u0634\u062D",
  39681. "\uFD0B",
  39682. "\u0634\u062E",
  39683. "\uFD0C",
  39684. "\u0634\u0645",
  39685. "\uFD0D",
  39686. "\u0634\u0631",
  39687. "\uFD0E",
  39688. "\u0633\u0631",
  39689. "\uFD0F",
  39690. "\u0635\u0631",
  39691. "\uFD10",
  39692. "\u0636\u0631",
  39693. "\uFD11",
  39694. "\u0637\u0649",
  39695. "\uFD12",
  39696. "\u0637\u064A",
  39697. "\uFD13",
  39698. "\u0639\u0649",
  39699. "\uFD14",
  39700. "\u0639\u064A",
  39701. "\uFD15",
  39702. "\u063A\u0649",
  39703. "\uFD16",
  39704. "\u063A\u064A",
  39705. "\uFD17",
  39706. "\u0633\u0649",
  39707. "\uFD18",
  39708. "\u0633\u064A",
  39709. "\uFD19",
  39710. "\u0634\u0649",
  39711. "\uFD1A",
  39712. "\u0634\u064A",
  39713. "\uFD1B",
  39714. "\u062D\u0649",
  39715. "\uFD1C",
  39716. "\u062D\u064A",
  39717. "\uFD1D",
  39718. "\u062C\u0649",
  39719. "\uFD1E",
  39720. "\u062C\u064A",
  39721. "\uFD1F",
  39722. "\u062E\u0649",
  39723. "\uFD20",
  39724. "\u062E\u064A",
  39725. "\uFD21",
  39726. "\u0635\u0649",
  39727. "\uFD22",
  39728. "\u0635\u064A",
  39729. "\uFD23",
  39730. "\u0636\u0649",
  39731. "\uFD24",
  39732. "\u0636\u064A",
  39733. "\uFD25",
  39734. "\u0634\u062C",
  39735. "\uFD26",
  39736. "\u0634\u062D",
  39737. "\uFD27",
  39738. "\u0634\u062E",
  39739. "\uFD28",
  39740. "\u0634\u0645",
  39741. "\uFD29",
  39742. "\u0634\u0631",
  39743. "\uFD2A",
  39744. "\u0633\u0631",
  39745. "\uFD2B",
  39746. "\u0635\u0631",
  39747. "\uFD2C",
  39748. "\u0636\u0631",
  39749. "\uFD2D",
  39750. "\u0634\u062C",
  39751. "\uFD2E",
  39752. "\u0634\u062D",
  39753. "\uFD2F",
  39754. "\u0634\u062E",
  39755. "\uFD30",
  39756. "\u0634\u0645",
  39757. "\uFD31",
  39758. "\u0633\u0647",
  39759. "\uFD32",
  39760. "\u0634\u0647",
  39761. "\uFD33",
  39762. "\u0637\u0645",
  39763. "\uFD34",
  39764. "\u0633\u062C",
  39765. "\uFD35",
  39766. "\u0633\u062D",
  39767. "\uFD36",
  39768. "\u0633\u062E",
  39769. "\uFD37",
  39770. "\u0634\u062C",
  39771. "\uFD38",
  39772. "\u0634\u062D",
  39773. "\uFD39",
  39774. "\u0634\u062E",
  39775. "\uFD3A",
  39776. "\u0637\u0645",
  39777. "\uFD3B",
  39778. "\u0638\u0645",
  39779. "\uFD3C",
  39780. "\u0627\u064B",
  39781. "\uFD3D",
  39782. "\u0627\u064B",
  39783. "\uFD50",
  39784. "\u062A\u062C\u0645",
  39785. "\uFD51",
  39786. "\u062A\u062D\u062C",
  39787. "\uFD52",
  39788. "\u062A\u062D\u062C",
  39789. "\uFD53",
  39790. "\u062A\u062D\u0645",
  39791. "\uFD54",
  39792. "\u062A\u062E\u0645",
  39793. "\uFD55",
  39794. "\u062A\u0645\u062C",
  39795. "\uFD56",
  39796. "\u062A\u0645\u062D",
  39797. "\uFD57",
  39798. "\u062A\u0645\u062E",
  39799. "\uFD58",
  39800. "\u062C\u0645\u062D",
  39801. "\uFD59",
  39802. "\u062C\u0645\u062D",
  39803. "\uFD5A",
  39804. "\u062D\u0645\u064A",
  39805. "\uFD5B",
  39806. "\u062D\u0645\u0649",
  39807. "\uFD5C",
  39808. "\u0633\u062D\u062C",
  39809. "\uFD5D",
  39810. "\u0633\u062C\u062D",
  39811. "\uFD5E",
  39812. "\u0633\u062C\u0649",
  39813. "\uFD5F",
  39814. "\u0633\u0645\u062D",
  39815. "\uFD60",
  39816. "\u0633\u0645\u062D",
  39817. "\uFD61",
  39818. "\u0633\u0645\u062C",
  39819. "\uFD62",
  39820. "\u0633\u0645\u0645",
  39821. "\uFD63",
  39822. "\u0633\u0645\u0645",
  39823. "\uFD64",
  39824. "\u0635\u062D\u062D",
  39825. "\uFD65",
  39826. "\u0635\u062D\u062D",
  39827. "\uFD66",
  39828. "\u0635\u0645\u0645",
  39829. "\uFD67",
  39830. "\u0634\u062D\u0645",
  39831. "\uFD68",
  39832. "\u0634\u062D\u0645",
  39833. "\uFD69",
  39834. "\u0634\u062C\u064A",
  39835. "\uFD6A",
  39836. "\u0634\u0645\u062E",
  39837. "\uFD6B",
  39838. "\u0634\u0645\u062E",
  39839. "\uFD6C",
  39840. "\u0634\u0645\u0645",
  39841. "\uFD6D",
  39842. "\u0634\u0645\u0645",
  39843. "\uFD6E",
  39844. "\u0636\u062D\u0649",
  39845. "\uFD6F",
  39846. "\u0636\u062E\u0645",
  39847. "\uFD70",
  39848. "\u0636\u062E\u0645",
  39849. "\uFD71",
  39850. "\u0637\u0645\u062D",
  39851. "\uFD72",
  39852. "\u0637\u0645\u062D",
  39853. "\uFD73",
  39854. "\u0637\u0645\u0645",
  39855. "\uFD74",
  39856. "\u0637\u0645\u064A",
  39857. "\uFD75",
  39858. "\u0639\u062C\u0645",
  39859. "\uFD76",
  39860. "\u0639\u0645\u0645",
  39861. "\uFD77",
  39862. "\u0639\u0645\u0645",
  39863. "\uFD78",
  39864. "\u0639\u0645\u0649",
  39865. "\uFD79",
  39866. "\u063A\u0645\u0645",
  39867. "\uFD7A",
  39868. "\u063A\u0645\u064A",
  39869. "\uFD7B",
  39870. "\u063A\u0645\u0649",
  39871. "\uFD7C",
  39872. "\u0641\u062E\u0645",
  39873. "\uFD7D",
  39874. "\u0641\u062E\u0645",
  39875. "\uFD7E",
  39876. "\u0642\u0645\u062D",
  39877. "\uFD7F",
  39878. "\u0642\u0645\u0645",
  39879. "\uFD80",
  39880. "\u0644\u062D\u0645",
  39881. "\uFD81",
  39882. "\u0644\u062D\u064A",
  39883. "\uFD82",
  39884. "\u0644\u062D\u0649",
  39885. "\uFD83",
  39886. "\u0644\u062C\u062C",
  39887. "\uFD84",
  39888. "\u0644\u062C\u062C",
  39889. "\uFD85",
  39890. "\u0644\u062E\u0645",
  39891. "\uFD86",
  39892. "\u0644\u062E\u0645",
  39893. "\uFD87",
  39894. "\u0644\u0645\u062D",
  39895. "\uFD88",
  39896. "\u0644\u0645\u062D",
  39897. "\uFD89",
  39898. "\u0645\u062D\u062C",
  39899. "\uFD8A",
  39900. "\u0645\u062D\u0645",
  39901. "\uFD8B",
  39902. "\u0645\u062D\u064A",
  39903. "\uFD8C",
  39904. "\u0645\u062C\u062D",
  39905. "\uFD8D",
  39906. "\u0645\u062C\u0645",
  39907. "\uFD8E",
  39908. "\u0645\u062E\u062C",
  39909. "\uFD8F",
  39910. "\u0645\u062E\u0645",
  39911. "\uFD92",
  39912. "\u0645\u062C\u062E",
  39913. "\uFD93",
  39914. "\u0647\u0645\u062C",
  39915. "\uFD94",
  39916. "\u0647\u0645\u0645",
  39917. "\uFD95",
  39918. "\u0646\u062D\u0645",
  39919. "\uFD96",
  39920. "\u0646\u062D\u0649",
  39921. "\uFD97",
  39922. "\u0646\u062C\u0645",
  39923. "\uFD98",
  39924. "\u0646\u062C\u0645",
  39925. "\uFD99",
  39926. "\u0646\u062C\u0649",
  39927. "\uFD9A",
  39928. "\u0646\u0645\u064A",
  39929. "\uFD9B",
  39930. "\u0646\u0645\u0649",
  39931. "\uFD9C",
  39932. "\u064A\u0645\u0645",
  39933. "\uFD9D",
  39934. "\u064A\u0645\u0645",
  39935. "\uFD9E",
  39936. "\u0628\u062E\u064A",
  39937. "\uFD9F",
  39938. "\u062A\u062C\u064A",
  39939. "\uFDA0",
  39940. "\u062A\u062C\u0649",
  39941. "\uFDA1",
  39942. "\u062A\u062E\u064A",
  39943. "\uFDA2",
  39944. "\u062A\u062E\u0649",
  39945. "\uFDA3",
  39946. "\u062A\u0645\u064A",
  39947. "\uFDA4",
  39948. "\u062A\u0645\u0649",
  39949. "\uFDA5",
  39950. "\u062C\u0645\u064A",
  39951. "\uFDA6",
  39952. "\u062C\u062D\u0649",
  39953. "\uFDA7",
  39954. "\u062C\u0645\u0649",
  39955. "\uFDA8",
  39956. "\u0633\u062E\u0649",
  39957. "\uFDA9",
  39958. "\u0635\u062D\u064A",
  39959. "\uFDAA",
  39960. "\u0634\u062D\u064A",
  39961. "\uFDAB",
  39962. "\u0636\u062D\u064A",
  39963. "\uFDAC",
  39964. "\u0644\u062C\u064A",
  39965. "\uFDAD",
  39966. "\u0644\u0645\u064A",
  39967. "\uFDAE",
  39968. "\u064A\u062D\u064A",
  39969. "\uFDAF",
  39970. "\u064A\u062C\u064A",
  39971. "\uFDB0",
  39972. "\u064A\u0645\u064A",
  39973. "\uFDB1",
  39974. "\u0645\u0645\u064A",
  39975. "\uFDB2",
  39976. "\u0642\u0645\u064A",
  39977. "\uFDB3",
  39978. "\u0646\u062D\u064A",
  39979. "\uFDB4",
  39980. "\u0642\u0645\u062D",
  39981. "\uFDB5",
  39982. "\u0644\u062D\u0645",
  39983. "\uFDB6",
  39984. "\u0639\u0645\u064A",
  39985. "\uFDB7",
  39986. "\u0643\u0645\u064A",
  39987. "\uFDB8",
  39988. "\u0646\u062C\u062D",
  39989. "\uFDB9",
  39990. "\u0645\u062E\u064A",
  39991. "\uFDBA",
  39992. "\u0644\u062C\u0645",
  39993. "\uFDBB",
  39994. "\u0643\u0645\u0645",
  39995. "\uFDBC",
  39996. "\u0644\u062C\u0645",
  39997. "\uFDBD",
  39998. "\u0646\u062C\u062D",
  39999. "\uFDBE",
  40000. "\u062C\u062D\u064A",
  40001. "\uFDBF",
  40002. "\u062D\u062C\u064A",
  40003. "\uFDC0",
  40004. "\u0645\u062C\u064A",
  40005. "\uFDC1",
  40006. "\u0641\u0645\u064A",
  40007. "\uFDC2",
  40008. "\u0628\u062D\u064A",
  40009. "\uFDC3",
  40010. "\u0643\u0645\u0645",
  40011. "\uFDC4",
  40012. "\u0639\u062C\u0645",
  40013. "\uFDC5",
  40014. "\u0635\u0645\u0645",
  40015. "\uFDC6",
  40016. "\u0633\u062E\u064A",
  40017. "\uFDC7",
  40018. "\u0646\u062C\u064A",
  40019. "\uFE49",
  40020. "\u203E",
  40021. "\uFE4A",
  40022. "\u203E",
  40023. "\uFE4B",
  40024. "\u203E",
  40025. "\uFE4C",
  40026. "\u203E",
  40027. "\uFE4D",
  40028. "\u005F",
  40029. "\uFE4E",
  40030. "\u005F",
  40031. "\uFE4F",
  40032. "\u005F",
  40033. "\uFE80",
  40034. "\u0621",
  40035. "\uFE81",
  40036. "\u0622",
  40037. "\uFE82",
  40038. "\u0622",
  40039. "\uFE83",
  40040. "\u0623",
  40041. "\uFE84",
  40042. "\u0623",
  40043. "\uFE85",
  40044. "\u0624",
  40045. "\uFE86",
  40046. "\u0624",
  40047. "\uFE87",
  40048. "\u0625",
  40049. "\uFE88",
  40050. "\u0625",
  40051. "\uFE89",
  40052. "\u0626",
  40053. "\uFE8A",
  40054. "\u0626",
  40055. "\uFE8B",
  40056. "\u0626",
  40057. "\uFE8C",
  40058. "\u0626",
  40059. "\uFE8D",
  40060. "\u0627",
  40061. "\uFE8E",
  40062. "\u0627",
  40063. "\uFE8F",
  40064. "\u0628",
  40065. "\uFE90",
  40066. "\u0628",
  40067. "\uFE91",
  40068. "\u0628",
  40069. "\uFE92",
  40070. "\u0628",
  40071. "\uFE93",
  40072. "\u0629",
  40073. "\uFE94",
  40074. "\u0629",
  40075. "\uFE95",
  40076. "\u062A",
  40077. "\uFE96",
  40078. "\u062A",
  40079. "\uFE97",
  40080. "\u062A",
  40081. "\uFE98",
  40082. "\u062A",
  40083. "\uFE99",
  40084. "\u062B",
  40085. "\uFE9A",
  40086. "\u062B",
  40087. "\uFE9B",
  40088. "\u062B",
  40089. "\uFE9C",
  40090. "\u062B",
  40091. "\uFE9D",
  40092. "\u062C",
  40093. "\uFE9E",
  40094. "\u062C",
  40095. "\uFE9F",
  40096. "\u062C",
  40097. "\uFEA0",
  40098. "\u062C",
  40099. "\uFEA1",
  40100. "\u062D",
  40101. "\uFEA2",
  40102. "\u062D",
  40103. "\uFEA3",
  40104. "\u062D",
  40105. "\uFEA4",
  40106. "\u062D",
  40107. "\uFEA5",
  40108. "\u062E",
  40109. "\uFEA6",
  40110. "\u062E",
  40111. "\uFEA7",
  40112. "\u062E",
  40113. "\uFEA8",
  40114. "\u062E",
  40115. "\uFEA9",
  40116. "\u062F",
  40117. "\uFEAA",
  40118. "\u062F",
  40119. "\uFEAB",
  40120. "\u0630",
  40121. "\uFEAC",
  40122. "\u0630",
  40123. "\uFEAD",
  40124. "\u0631",
  40125. "\uFEAE",
  40126. "\u0631",
  40127. "\uFEAF",
  40128. "\u0632",
  40129. "\uFEB0",
  40130. "\u0632",
  40131. "\uFEB1",
  40132. "\u0633",
  40133. "\uFEB2",
  40134. "\u0633",
  40135. "\uFEB3",
  40136. "\u0633",
  40137. "\uFEB4",
  40138. "\u0633",
  40139. "\uFEB5",
  40140. "\u0634",
  40141. "\uFEB6",
  40142. "\u0634",
  40143. "\uFEB7",
  40144. "\u0634",
  40145. "\uFEB8",
  40146. "\u0634",
  40147. "\uFEB9",
  40148. "\u0635",
  40149. "\uFEBA",
  40150. "\u0635",
  40151. "\uFEBB",
  40152. "\u0635",
  40153. "\uFEBC",
  40154. "\u0635",
  40155. "\uFEBD",
  40156. "\u0636",
  40157. "\uFEBE",
  40158. "\u0636",
  40159. "\uFEBF",
  40160. "\u0636",
  40161. "\uFEC0",
  40162. "\u0636",
  40163. "\uFEC1",
  40164. "\u0637",
  40165. "\uFEC2",
  40166. "\u0637",
  40167. "\uFEC3",
  40168. "\u0637",
  40169. "\uFEC4",
  40170. "\u0637",
  40171. "\uFEC5",
  40172. "\u0638",
  40173. "\uFEC6",
  40174. "\u0638",
  40175. "\uFEC7",
  40176. "\u0638",
  40177. "\uFEC8",
  40178. "\u0638",
  40179. "\uFEC9",
  40180. "\u0639",
  40181. "\uFECA",
  40182. "\u0639",
  40183. "\uFECB",
  40184. "\u0639",
  40185. "\uFECC",
  40186. "\u0639",
  40187. "\uFECD",
  40188. "\u063A",
  40189. "\uFECE",
  40190. "\u063A",
  40191. "\uFECF",
  40192. "\u063A",
  40193. "\uFED0",
  40194. "\u063A",
  40195. "\uFED1",
  40196. "\u0641",
  40197. "\uFED2",
  40198. "\u0641",
  40199. "\uFED3",
  40200. "\u0641",
  40201. "\uFED4",
  40202. "\u0641",
  40203. "\uFED5",
  40204. "\u0642",
  40205. "\uFED6",
  40206. "\u0642",
  40207. "\uFED7",
  40208. "\u0642",
  40209. "\uFED8",
  40210. "\u0642",
  40211. "\uFED9",
  40212. "\u0643",
  40213. "\uFEDA",
  40214. "\u0643",
  40215. "\uFEDB",
  40216. "\u0643",
  40217. "\uFEDC",
  40218. "\u0643",
  40219. "\uFEDD",
  40220. "\u0644",
  40221. "\uFEDE",
  40222. "\u0644",
  40223. "\uFEDF",
  40224. "\u0644",
  40225. "\uFEE0",
  40226. "\u0644",
  40227. "\uFEE1",
  40228. "\u0645",
  40229. "\uFEE2",
  40230. "\u0645",
  40231. "\uFEE3",
  40232. "\u0645",
  40233. "\uFEE4",
  40234. "\u0645",
  40235. "\uFEE5",
  40236. "\u0646",
  40237. "\uFEE6",
  40238. "\u0646",
  40239. "\uFEE7",
  40240. "\u0646",
  40241. "\uFEE8",
  40242. "\u0646",
  40243. "\uFEE9",
  40244. "\u0647",
  40245. "\uFEEA",
  40246. "\u0647",
  40247. "\uFEEB",
  40248. "\u0647",
  40249. "\uFEEC",
  40250. "\u0647",
  40251. "\uFEED",
  40252. "\u0648",
  40253. "\uFEEE",
  40254. "\u0648",
  40255. "\uFEEF",
  40256. "\u0649",
  40257. "\uFEF0",
  40258. "\u0649",
  40259. "\uFEF1",
  40260. "\u064A",
  40261. "\uFEF2",
  40262. "\u064A",
  40263. "\uFEF3",
  40264. "\u064A",
  40265. "\uFEF4",
  40266. "\u064A",
  40267. "\uFEF5",
  40268. "\u0644\u0622",
  40269. "\uFEF6",
  40270. "\u0644\u0622",
  40271. "\uFEF7",
  40272. "\u0644\u0623",
  40273. "\uFEF8",
  40274. "\u0644\u0623",
  40275. "\uFEF9",
  40276. "\u0644\u0625",
  40277. "\uFEFA",
  40278. "\u0644\u0625",
  40279. "\uFEFB",
  40280. "\u0644\u0627",
  40281. "\uFEFC",
  40282. "\u0644\u0627"
  40283. ];
  40284. });
  40285. function reverseIfRtl(chars) {
  40286. const charsLength = chars.length;
  40287. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  40288. return chars;
  40289. }
  40290. const buf = [];
  40291. for (let ii = charsLength - 1; ii >= 0; ii--) {
  40292. buf.push(chars[ii]);
  40293. }
  40294. return buf.join("");
  40295. }
  40296. const SpecialCharRegExp = new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$", "u");
  40297. const CategoryCache = new Map();
  40298. function getCharUnicodeCategory(char) {
  40299. const cachedCategory = CategoryCache.get(char);
  40300. if (cachedCategory) {
  40301. return cachedCategory;
  40302. }
  40303. const groups = char.match(SpecialCharRegExp);
  40304. const category = {
  40305. isWhitespace: !!(groups && groups[1]),
  40306. isZeroWidthDiacritic: !!(groups && groups[2]),
  40307. isInvisibleFormatMark: !!(groups && groups[3])
  40308. };
  40309. CategoryCache.set(char, category);
  40310. return category;
  40311. }
  40312. function clearUnicodeCaches() {
  40313. CategoryCache.clear();
  40314. }
  40315. /***/ }),
  40316. /* 172 */
  40317. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  40318. "use strict";
  40319. Object.defineProperty(exports, "__esModule", ({
  40320. value: true
  40321. }));
  40322. exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = exports.getFontNameToFileMap = void 0;
  40323. exports.getStandardFontName = getStandardFontName;
  40324. exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = void 0;
  40325. var _core_utils = __w_pdfjs_require__(136);
  40326. var _fonts_utils = __w_pdfjs_require__(169);
  40327. const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  40328. t["Times-Roman"] = "Times-Roman";
  40329. t.Helvetica = "Helvetica";
  40330. t.Courier = "Courier";
  40331. t.Symbol = "Symbol";
  40332. t["Times-Bold"] = "Times-Bold";
  40333. t["Helvetica-Bold"] = "Helvetica-Bold";
  40334. t["Courier-Bold"] = "Courier-Bold";
  40335. t.ZapfDingbats = "ZapfDingbats";
  40336. t["Times-Italic"] = "Times-Italic";
  40337. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  40338. t["Courier-Oblique"] = "Courier-Oblique";
  40339. t["Times-BoldItalic"] = "Times-BoldItalic";
  40340. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  40341. t["Courier-BoldOblique"] = "Courier-BoldOblique";
  40342. t.ArialNarrow = "Helvetica";
  40343. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  40344. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  40345. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  40346. t.ArialBlack = "Helvetica";
  40347. t["ArialBlack-Bold"] = "Helvetica-Bold";
  40348. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  40349. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  40350. t["Arial-Black"] = "Helvetica";
  40351. t["Arial-Black-Bold"] = "Helvetica-Bold";
  40352. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  40353. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  40354. t.Arial = "Helvetica";
  40355. t["Arial-Bold"] = "Helvetica-Bold";
  40356. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  40357. t["Arial-Italic"] = "Helvetica-Oblique";
  40358. t.ArialMT = "Helvetica";
  40359. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  40360. t["Arial-BoldMT"] = "Helvetica-Bold";
  40361. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  40362. t.ArialUnicodeMS = "Helvetica";
  40363. t["ArialUnicodeMS-Bold"] = "Helvetica-Bold";
  40364. t["ArialUnicodeMS-BoldItalic"] = "Helvetica-BoldOblique";
  40365. t["ArialUnicodeMS-Italic"] = "Helvetica-Oblique";
  40366. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  40367. t["Courier-Italic"] = "Courier-Oblique";
  40368. t.CourierNew = "Courier";
  40369. t["CourierNew-Bold"] = "Courier-Bold";
  40370. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  40371. t["CourierNew-Italic"] = "Courier-Oblique";
  40372. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  40373. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  40374. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  40375. t.CourierNewPSMT = "Courier";
  40376. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  40377. t["Helvetica-Italic"] = "Helvetica-Oblique";
  40378. t["Symbol-Bold"] = "Symbol";
  40379. t["Symbol-BoldItalic"] = "Symbol";
  40380. t["Symbol-Italic"] = "Symbol";
  40381. t.TimesNewRoman = "Times-Roman";
  40382. t["TimesNewRoman-Bold"] = "Times-Bold";
  40383. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  40384. t["TimesNewRoman-Italic"] = "Times-Italic";
  40385. t.TimesNewRomanPS = "Times-Roman";
  40386. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  40387. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  40388. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  40389. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  40390. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  40391. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  40392. t.TimesNewRomanPSMT = "Times-Roman";
  40393. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  40394. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  40395. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  40396. });
  40397. exports.getStdFontMap = getStdFontMap;
  40398. const getFontNameToFileMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  40399. t.Courier = "FoxitFixed.pfb";
  40400. t["Courier-Bold"] = "FoxitFixedBold.pfb";
  40401. t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb";
  40402. t["Courier-Oblique"] = "FoxitFixedItalic.pfb";
  40403. t.Helvetica = "FoxitSans.pfb";
  40404. t["Helvetica-Bold"] = "FoxitSansBold.pfb";
  40405. t["Helvetica-BoldOblique"] = "FoxitSansBoldItalic.pfb";
  40406. t["Helvetica-Oblique"] = "FoxitSansItalic.pfb";
  40407. t["Times-Roman"] = "FoxitSerif.pfb";
  40408. t["Times-Bold"] = "FoxitSerifBold.pfb";
  40409. t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb";
  40410. t["Times-Italic"] = "FoxitSerifItalic.pfb";
  40411. t.Symbol = "FoxitSymbol.pfb";
  40412. t.ZapfDingbats = "FoxitDingbats.pfb";
  40413. t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf";
  40414. t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf";
  40415. t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf";
  40416. t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf";
  40417. });
  40418. exports.getFontNameToFileMap = getFontNameToFileMap;
  40419. const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  40420. t.Calibri = "Helvetica";
  40421. t["Calibri-Bold"] = "Helvetica-Bold";
  40422. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  40423. t["Calibri-Italic"] = "Helvetica-Oblique";
  40424. t.CenturyGothic = "Helvetica";
  40425. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  40426. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  40427. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  40428. t.ComicSansMS = "Comic Sans MS";
  40429. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  40430. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  40431. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  40432. t["ItcSymbol-Bold"] = "Helvetica-Bold";
  40433. t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique";
  40434. t["ItcSymbol-Book"] = "Helvetica";
  40435. t["ItcSymbol-BookItalic"] = "Helvetica-Oblique";
  40436. t["ItcSymbol-Medium"] = "Helvetica";
  40437. t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique";
  40438. t.LucidaConsole = "Courier";
  40439. t["LucidaConsole-Bold"] = "Courier-Bold";
  40440. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  40441. t["LucidaConsole-Italic"] = "Courier-Oblique";
  40442. t["LucidaSans-Demi"] = "Helvetica-Bold";
  40443. t["MS-Gothic"] = "MS Gothic";
  40444. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  40445. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  40446. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  40447. t["MS-Mincho"] = "MS Mincho";
  40448. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  40449. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  40450. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  40451. t["MS-PGothic"] = "MS PGothic";
  40452. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  40453. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  40454. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  40455. t["MS-PMincho"] = "MS PMincho";
  40456. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  40457. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  40458. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  40459. t.NuptialScript = "Times-Italic";
  40460. t.SegoeUISymbol = "Helvetica";
  40461. t.Wingdings = "ZapfDingbats";
  40462. t["Wingdings-Regular"] = "ZapfDingbats";
  40463. });
  40464. exports.getNonStdFontMap = getNonStdFontMap;
  40465. const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  40466. t["Adobe Jenson"] = true;
  40467. t["Adobe Text"] = true;
  40468. t.Albertus = true;
  40469. t.Aldus = true;
  40470. t.Alexandria = true;
  40471. t.Algerian = true;
  40472. t["American Typewriter"] = true;
  40473. t.Antiqua = true;
  40474. t.Apex = true;
  40475. t.Arno = true;
  40476. t.Aster = true;
  40477. t.Aurora = true;
  40478. t.Baskerville = true;
  40479. t.Bell = true;
  40480. t.Bembo = true;
  40481. t["Bembo Schoolbook"] = true;
  40482. t.Benguiat = true;
  40483. t["Berkeley Old Style"] = true;
  40484. t["Bernhard Modern"] = true;
  40485. t["Berthold City"] = true;
  40486. t.Bodoni = true;
  40487. t["Bauer Bodoni"] = true;
  40488. t["Book Antiqua"] = true;
  40489. t.Bookman = true;
  40490. t["Bordeaux Roman"] = true;
  40491. t["Californian FB"] = true;
  40492. t.Calisto = true;
  40493. t.Calvert = true;
  40494. t.Capitals = true;
  40495. t.Cambria = true;
  40496. t.Cartier = true;
  40497. t.Caslon = true;
  40498. t.Catull = true;
  40499. t.Centaur = true;
  40500. t["Century Old Style"] = true;
  40501. t["Century Schoolbook"] = true;
  40502. t.Chaparral = true;
  40503. t["Charis SIL"] = true;
  40504. t.Cheltenham = true;
  40505. t["Cholla Slab"] = true;
  40506. t.Clarendon = true;
  40507. t.Clearface = true;
  40508. t.Cochin = true;
  40509. t.Colonna = true;
  40510. t["Computer Modern"] = true;
  40511. t["Concrete Roman"] = true;
  40512. t.Constantia = true;
  40513. t["Cooper Black"] = true;
  40514. t.Corona = true;
  40515. t.Ecotype = true;
  40516. t.Egyptienne = true;
  40517. t.Elephant = true;
  40518. t.Excelsior = true;
  40519. t.Fairfield = true;
  40520. t["FF Scala"] = true;
  40521. t.Folkard = true;
  40522. t.Footlight = true;
  40523. t.FreeSerif = true;
  40524. t["Friz Quadrata"] = true;
  40525. t.Garamond = true;
  40526. t.Gentium = true;
  40527. t.Georgia = true;
  40528. t.Gloucester = true;
  40529. t["Goudy Old Style"] = true;
  40530. t["Goudy Schoolbook"] = true;
  40531. t["Goudy Pro Font"] = true;
  40532. t.Granjon = true;
  40533. t["Guardian Egyptian"] = true;
  40534. t.Heather = true;
  40535. t.Hercules = true;
  40536. t["High Tower Text"] = true;
  40537. t.Hiroshige = true;
  40538. t["Hoefler Text"] = true;
  40539. t["Humana Serif"] = true;
  40540. t.Imprint = true;
  40541. t["Ionic No. 5"] = true;
  40542. t.Janson = true;
  40543. t.Joanna = true;
  40544. t.Korinna = true;
  40545. t.Lexicon = true;
  40546. t.LiberationSerif = true;
  40547. t["Liberation Serif"] = true;
  40548. t["Linux Libertine"] = true;
  40549. t.Literaturnaya = true;
  40550. t.Lucida = true;
  40551. t["Lucida Bright"] = true;
  40552. t.Melior = true;
  40553. t.Memphis = true;
  40554. t.Miller = true;
  40555. t.Minion = true;
  40556. t.Modern = true;
  40557. t["Mona Lisa"] = true;
  40558. t["Mrs Eaves"] = true;
  40559. t["MS Serif"] = true;
  40560. t["Museo Slab"] = true;
  40561. t["New York"] = true;
  40562. t["Nimbus Roman"] = true;
  40563. t["NPS Rawlinson Roadway"] = true;
  40564. t.NuptialScript = true;
  40565. t.Palatino = true;
  40566. t.Perpetua = true;
  40567. t.Plantin = true;
  40568. t["Plantin Schoolbook"] = true;
  40569. t.Playbill = true;
  40570. t["Poor Richard"] = true;
  40571. t["Rawlinson Roadway"] = true;
  40572. t.Renault = true;
  40573. t.Requiem = true;
  40574. t.Rockwell = true;
  40575. t.Roman = true;
  40576. t["Rotis Serif"] = true;
  40577. t.Sabon = true;
  40578. t.Scala = true;
  40579. t.Seagull = true;
  40580. t.Sistina = true;
  40581. t.Souvenir = true;
  40582. t.STIX = true;
  40583. t["Stone Informal"] = true;
  40584. t["Stone Serif"] = true;
  40585. t.Sylfaen = true;
  40586. t.Times = true;
  40587. t.Trajan = true;
  40588. t["Trinité"] = true;
  40589. t["Trump Mediaeval"] = true;
  40590. t.Utopia = true;
  40591. t["Vale Type"] = true;
  40592. t["Bitstream Vera"] = true;
  40593. t["Vera Serif"] = true;
  40594. t.Versailles = true;
  40595. t.Wanted = true;
  40596. t.Weiss = true;
  40597. t["Wide Latin"] = true;
  40598. t.Windsor = true;
  40599. t.XITS = true;
  40600. });
  40601. exports.getSerifFonts = getSerifFonts;
  40602. const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  40603. t.Dingbats = true;
  40604. t.Symbol = true;
  40605. t.ZapfDingbats = true;
  40606. });
  40607. exports.getSymbolsFonts = getSymbolsFonts;
  40608. const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  40609. t[2] = 10;
  40610. t[3] = 32;
  40611. t[4] = 33;
  40612. t[5] = 34;
  40613. t[6] = 35;
  40614. t[7] = 36;
  40615. t[8] = 37;
  40616. t[9] = 38;
  40617. t[10] = 39;
  40618. t[11] = 40;
  40619. t[12] = 41;
  40620. t[13] = 42;
  40621. t[14] = 43;
  40622. t[15] = 44;
  40623. t[16] = 45;
  40624. t[17] = 46;
  40625. t[18] = 47;
  40626. t[19] = 48;
  40627. t[20] = 49;
  40628. t[21] = 50;
  40629. t[22] = 51;
  40630. t[23] = 52;
  40631. t[24] = 53;
  40632. t[25] = 54;
  40633. t[26] = 55;
  40634. t[27] = 56;
  40635. t[28] = 57;
  40636. t[29] = 58;
  40637. t[30] = 894;
  40638. t[31] = 60;
  40639. t[32] = 61;
  40640. t[33] = 62;
  40641. t[34] = 63;
  40642. t[35] = 64;
  40643. t[36] = 65;
  40644. t[37] = 66;
  40645. t[38] = 67;
  40646. t[39] = 68;
  40647. t[40] = 69;
  40648. t[41] = 70;
  40649. t[42] = 71;
  40650. t[43] = 72;
  40651. t[44] = 73;
  40652. t[45] = 74;
  40653. t[46] = 75;
  40654. t[47] = 76;
  40655. t[48] = 77;
  40656. t[49] = 78;
  40657. t[50] = 79;
  40658. t[51] = 80;
  40659. t[52] = 81;
  40660. t[53] = 82;
  40661. t[54] = 83;
  40662. t[55] = 84;
  40663. t[56] = 85;
  40664. t[57] = 86;
  40665. t[58] = 87;
  40666. t[59] = 88;
  40667. t[60] = 89;
  40668. t[61] = 90;
  40669. t[62] = 91;
  40670. t[63] = 92;
  40671. t[64] = 93;
  40672. t[65] = 94;
  40673. t[66] = 95;
  40674. t[67] = 96;
  40675. t[68] = 97;
  40676. t[69] = 98;
  40677. t[70] = 99;
  40678. t[71] = 100;
  40679. t[72] = 101;
  40680. t[73] = 102;
  40681. t[74] = 103;
  40682. t[75] = 104;
  40683. t[76] = 105;
  40684. t[77] = 106;
  40685. t[78] = 107;
  40686. t[79] = 108;
  40687. t[80] = 109;
  40688. t[81] = 110;
  40689. t[82] = 111;
  40690. t[83] = 112;
  40691. t[84] = 113;
  40692. t[85] = 114;
  40693. t[86] = 115;
  40694. t[87] = 116;
  40695. t[88] = 117;
  40696. t[89] = 118;
  40697. t[90] = 119;
  40698. t[91] = 120;
  40699. t[92] = 121;
  40700. t[93] = 122;
  40701. t[94] = 123;
  40702. t[95] = 124;
  40703. t[96] = 125;
  40704. t[97] = 126;
  40705. t[98] = 196;
  40706. t[99] = 197;
  40707. t[100] = 199;
  40708. t[101] = 201;
  40709. t[102] = 209;
  40710. t[103] = 214;
  40711. t[104] = 220;
  40712. t[105] = 225;
  40713. t[106] = 224;
  40714. t[107] = 226;
  40715. t[108] = 228;
  40716. t[109] = 227;
  40717. t[110] = 229;
  40718. t[111] = 231;
  40719. t[112] = 233;
  40720. t[113] = 232;
  40721. t[114] = 234;
  40722. t[115] = 235;
  40723. t[116] = 237;
  40724. t[117] = 236;
  40725. t[118] = 238;
  40726. t[119] = 239;
  40727. t[120] = 241;
  40728. t[121] = 243;
  40729. t[122] = 242;
  40730. t[123] = 244;
  40731. t[124] = 246;
  40732. t[125] = 245;
  40733. t[126] = 250;
  40734. t[127] = 249;
  40735. t[128] = 251;
  40736. t[129] = 252;
  40737. t[130] = 8224;
  40738. t[131] = 176;
  40739. t[132] = 162;
  40740. t[133] = 163;
  40741. t[134] = 167;
  40742. t[135] = 8226;
  40743. t[136] = 182;
  40744. t[137] = 223;
  40745. t[138] = 174;
  40746. t[139] = 169;
  40747. t[140] = 8482;
  40748. t[141] = 180;
  40749. t[142] = 168;
  40750. t[143] = 8800;
  40751. t[144] = 198;
  40752. t[145] = 216;
  40753. t[146] = 8734;
  40754. t[147] = 177;
  40755. t[148] = 8804;
  40756. t[149] = 8805;
  40757. t[150] = 165;
  40758. t[151] = 181;
  40759. t[152] = 8706;
  40760. t[153] = 8721;
  40761. t[154] = 8719;
  40762. t[156] = 8747;
  40763. t[157] = 170;
  40764. t[158] = 186;
  40765. t[159] = 8486;
  40766. t[160] = 230;
  40767. t[161] = 248;
  40768. t[162] = 191;
  40769. t[163] = 161;
  40770. t[164] = 172;
  40771. t[165] = 8730;
  40772. t[166] = 402;
  40773. t[167] = 8776;
  40774. t[168] = 8710;
  40775. t[169] = 171;
  40776. t[170] = 187;
  40777. t[171] = 8230;
  40778. t[179] = 8220;
  40779. t[180] = 8221;
  40780. t[181] = 8216;
  40781. t[182] = 8217;
  40782. t[200] = 193;
  40783. t[203] = 205;
  40784. t[207] = 211;
  40785. t[210] = 218;
  40786. t[223] = 711;
  40787. t[224] = 321;
  40788. t[225] = 322;
  40789. t[226] = 352;
  40790. t[227] = 353;
  40791. t[228] = 381;
  40792. t[229] = 382;
  40793. t[233] = 221;
  40794. t[234] = 253;
  40795. t[252] = 263;
  40796. t[253] = 268;
  40797. t[254] = 269;
  40798. t[258] = 258;
  40799. t[260] = 260;
  40800. t[261] = 261;
  40801. t[265] = 280;
  40802. t[266] = 281;
  40803. t[267] = 282;
  40804. t[268] = 283;
  40805. t[269] = 313;
  40806. t[275] = 323;
  40807. t[276] = 324;
  40808. t[278] = 328;
  40809. t[283] = 344;
  40810. t[284] = 345;
  40811. t[285] = 346;
  40812. t[286] = 347;
  40813. t[292] = 367;
  40814. t[295] = 377;
  40815. t[296] = 378;
  40816. t[298] = 380;
  40817. t[305] = 963;
  40818. t[306] = 964;
  40819. t[307] = 966;
  40820. t[308] = 8215;
  40821. t[309] = 8252;
  40822. t[310] = 8319;
  40823. t[311] = 8359;
  40824. t[312] = 8592;
  40825. t[313] = 8593;
  40826. t[337] = 9552;
  40827. t[493] = 1039;
  40828. t[494] = 1040;
  40829. t[672] = 1488;
  40830. t[673] = 1489;
  40831. t[674] = 1490;
  40832. t[675] = 1491;
  40833. t[676] = 1492;
  40834. t[677] = 1493;
  40835. t[678] = 1494;
  40836. t[679] = 1495;
  40837. t[680] = 1496;
  40838. t[681] = 1497;
  40839. t[682] = 1498;
  40840. t[683] = 1499;
  40841. t[684] = 1500;
  40842. t[685] = 1501;
  40843. t[686] = 1502;
  40844. t[687] = 1503;
  40845. t[688] = 1504;
  40846. t[689] = 1505;
  40847. t[690] = 1506;
  40848. t[691] = 1507;
  40849. t[692] = 1508;
  40850. t[693] = 1509;
  40851. t[694] = 1510;
  40852. t[695] = 1511;
  40853. t[696] = 1512;
  40854. t[697] = 1513;
  40855. t[698] = 1514;
  40856. t[705] = 1524;
  40857. t[706] = 8362;
  40858. t[710] = 64288;
  40859. t[711] = 64298;
  40860. t[759] = 1617;
  40861. t[761] = 1776;
  40862. t[763] = 1778;
  40863. t[775] = 1652;
  40864. t[777] = 1764;
  40865. t[778] = 1780;
  40866. t[779] = 1781;
  40867. t[780] = 1782;
  40868. t[782] = 771;
  40869. t[783] = 64726;
  40870. t[786] = 8363;
  40871. t[788] = 8532;
  40872. t[790] = 768;
  40873. t[791] = 769;
  40874. t[792] = 768;
  40875. t[795] = 803;
  40876. t[797] = 64336;
  40877. t[798] = 64337;
  40878. t[799] = 64342;
  40879. t[800] = 64343;
  40880. t[801] = 64344;
  40881. t[802] = 64345;
  40882. t[803] = 64362;
  40883. t[804] = 64363;
  40884. t[805] = 64364;
  40885. t[2424] = 7821;
  40886. t[2425] = 7822;
  40887. t[2426] = 7823;
  40888. t[2427] = 7824;
  40889. t[2428] = 7825;
  40890. t[2429] = 7826;
  40891. t[2430] = 7827;
  40892. t[2433] = 7682;
  40893. t[2678] = 8045;
  40894. t[2679] = 8046;
  40895. t[2830] = 1552;
  40896. t[2838] = 686;
  40897. t[2840] = 751;
  40898. t[2842] = 753;
  40899. t[2843] = 754;
  40900. t[2844] = 755;
  40901. t[2846] = 757;
  40902. t[2856] = 767;
  40903. t[2857] = 848;
  40904. t[2858] = 849;
  40905. t[2862] = 853;
  40906. t[2863] = 854;
  40907. t[2864] = 855;
  40908. t[2865] = 861;
  40909. t[2866] = 862;
  40910. t[2906] = 7460;
  40911. t[2908] = 7462;
  40912. t[2909] = 7463;
  40913. t[2910] = 7464;
  40914. t[2912] = 7466;
  40915. t[2913] = 7467;
  40916. t[2914] = 7468;
  40917. t[2916] = 7470;
  40918. t[2917] = 7471;
  40919. t[2918] = 7472;
  40920. t[2920] = 7474;
  40921. t[2921] = 7475;
  40922. t[2922] = 7476;
  40923. t[2924] = 7478;
  40924. t[2925] = 7479;
  40925. t[2926] = 7480;
  40926. t[2928] = 7482;
  40927. t[2929] = 7483;
  40928. t[2930] = 7484;
  40929. t[2932] = 7486;
  40930. t[2933] = 7487;
  40931. t[2934] = 7488;
  40932. t[2936] = 7490;
  40933. t[2937] = 7491;
  40934. t[2938] = 7492;
  40935. t[2940] = 7494;
  40936. t[2941] = 7495;
  40937. t[2942] = 7496;
  40938. t[2944] = 7498;
  40939. t[2946] = 7500;
  40940. t[2948] = 7502;
  40941. t[2950] = 7504;
  40942. t[2951] = 7505;
  40943. t[2952] = 7506;
  40944. t[2954] = 7508;
  40945. t[2955] = 7509;
  40946. t[2956] = 7510;
  40947. t[2958] = 7512;
  40948. t[2959] = 7513;
  40949. t[2960] = 7514;
  40950. t[2962] = 7516;
  40951. t[2963] = 7517;
  40952. t[2964] = 7518;
  40953. t[2966] = 7520;
  40954. t[2967] = 7521;
  40955. t[2968] = 7522;
  40956. t[2970] = 7524;
  40957. t[2971] = 7525;
  40958. t[2972] = 7526;
  40959. t[2974] = 7528;
  40960. t[2975] = 7529;
  40961. t[2976] = 7530;
  40962. t[2978] = 1537;
  40963. t[2979] = 1538;
  40964. t[2980] = 1539;
  40965. t[2982] = 1549;
  40966. t[2983] = 1551;
  40967. t[2984] = 1552;
  40968. t[2986] = 1554;
  40969. t[2987] = 1555;
  40970. t[2988] = 1556;
  40971. t[2990] = 1623;
  40972. t[2991] = 1624;
  40973. t[2995] = 1775;
  40974. t[2999] = 1791;
  40975. t[3002] = 64290;
  40976. t[3003] = 64291;
  40977. t[3004] = 64292;
  40978. t[3006] = 64294;
  40979. t[3007] = 64295;
  40980. t[3008] = 64296;
  40981. t[3011] = 1900;
  40982. t[3014] = 8223;
  40983. t[3015] = 8244;
  40984. t[3017] = 7532;
  40985. t[3018] = 7533;
  40986. t[3019] = 7534;
  40987. t[3075] = 7590;
  40988. t[3076] = 7591;
  40989. t[3079] = 7594;
  40990. t[3080] = 7595;
  40991. t[3083] = 7598;
  40992. t[3084] = 7599;
  40993. t[3087] = 7602;
  40994. t[3088] = 7603;
  40995. t[3091] = 7606;
  40996. t[3092] = 7607;
  40997. t[3095] = 7610;
  40998. t[3096] = 7611;
  40999. t[3099] = 7614;
  41000. t[3100] = 7615;
  41001. t[3103] = 7618;
  41002. t[3104] = 7619;
  41003. t[3107] = 8337;
  41004. t[3108] = 8338;
  41005. t[3116] = 1884;
  41006. t[3119] = 1885;
  41007. t[3120] = 1885;
  41008. t[3123] = 1886;
  41009. t[3124] = 1886;
  41010. t[3127] = 1887;
  41011. t[3128] = 1887;
  41012. t[3131] = 1888;
  41013. t[3132] = 1888;
  41014. t[3135] = 1889;
  41015. t[3136] = 1889;
  41016. t[3139] = 1890;
  41017. t[3140] = 1890;
  41018. t[3143] = 1891;
  41019. t[3144] = 1891;
  41020. t[3147] = 1892;
  41021. t[3148] = 1892;
  41022. t[3153] = 580;
  41023. t[3154] = 581;
  41024. t[3157] = 584;
  41025. t[3158] = 585;
  41026. t[3161] = 588;
  41027. t[3162] = 589;
  41028. t[3165] = 891;
  41029. t[3166] = 892;
  41030. t[3169] = 1274;
  41031. t[3170] = 1275;
  41032. t[3173] = 1278;
  41033. t[3174] = 1279;
  41034. t[3181] = 7622;
  41035. t[3182] = 7623;
  41036. t[3282] = 11799;
  41037. t[3316] = 578;
  41038. t[3379] = 42785;
  41039. t[3393] = 1159;
  41040. t[3416] = 8377;
  41041. });
  41042. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  41043. const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
  41044. t[227] = 322;
  41045. t[264] = 261;
  41046. t[291] = 346;
  41047. });
  41048. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  41049. const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
  41050. t[1] = 32;
  41051. t[4] = 65;
  41052. t[5] = 192;
  41053. t[6] = 193;
  41054. t[9] = 196;
  41055. t[17] = 66;
  41056. t[18] = 67;
  41057. t[21] = 268;
  41058. t[24] = 68;
  41059. t[28] = 69;
  41060. t[29] = 200;
  41061. t[30] = 201;
  41062. t[32] = 282;
  41063. t[38] = 70;
  41064. t[39] = 71;
  41065. t[44] = 72;
  41066. t[47] = 73;
  41067. t[48] = 204;
  41068. t[49] = 205;
  41069. t[58] = 74;
  41070. t[60] = 75;
  41071. t[62] = 76;
  41072. t[68] = 77;
  41073. t[69] = 78;
  41074. t[75] = 79;
  41075. t[76] = 210;
  41076. t[80] = 214;
  41077. t[87] = 80;
  41078. t[89] = 81;
  41079. t[90] = 82;
  41080. t[92] = 344;
  41081. t[94] = 83;
  41082. t[97] = 352;
  41083. t[100] = 84;
  41084. t[104] = 85;
  41085. t[109] = 220;
  41086. t[115] = 86;
  41087. t[116] = 87;
  41088. t[121] = 88;
  41089. t[122] = 89;
  41090. t[124] = 221;
  41091. t[127] = 90;
  41092. t[129] = 381;
  41093. t[258] = 97;
  41094. t[259] = 224;
  41095. t[260] = 225;
  41096. t[263] = 228;
  41097. t[268] = 261;
  41098. t[271] = 98;
  41099. t[272] = 99;
  41100. t[273] = 263;
  41101. t[275] = 269;
  41102. t[282] = 100;
  41103. t[286] = 101;
  41104. t[287] = 232;
  41105. t[288] = 233;
  41106. t[290] = 283;
  41107. t[295] = 281;
  41108. t[296] = 102;
  41109. t[336] = 103;
  41110. t[346] = 104;
  41111. t[349] = 105;
  41112. t[350] = 236;
  41113. t[351] = 237;
  41114. t[361] = 106;
  41115. t[364] = 107;
  41116. t[367] = 108;
  41117. t[371] = 322;
  41118. t[373] = 109;
  41119. t[374] = 110;
  41120. t[381] = 111;
  41121. t[382] = 242;
  41122. t[383] = 243;
  41123. t[386] = 246;
  41124. t[393] = 112;
  41125. t[395] = 113;
  41126. t[396] = 114;
  41127. t[398] = 345;
  41128. t[400] = 115;
  41129. t[401] = 347;
  41130. t[403] = 353;
  41131. t[410] = 116;
  41132. t[437] = 117;
  41133. t[442] = 252;
  41134. t[448] = 118;
  41135. t[449] = 119;
  41136. t[454] = 120;
  41137. t[455] = 121;
  41138. t[457] = 253;
  41139. t[460] = 122;
  41140. t[462] = 382;
  41141. t[463] = 380;
  41142. t[853] = 44;
  41143. t[855] = 58;
  41144. t[856] = 46;
  41145. t[876] = 47;
  41146. t[878] = 45;
  41147. t[882] = 45;
  41148. t[894] = 40;
  41149. t[895] = 41;
  41150. t[896] = 91;
  41151. t[897] = 93;
  41152. t[923] = 64;
  41153. t[1004] = 48;
  41154. t[1005] = 49;
  41155. t[1006] = 50;
  41156. t[1007] = 51;
  41157. t[1008] = 52;
  41158. t[1009] = 53;
  41159. t[1010] = 54;
  41160. t[1011] = 55;
  41161. t[1012] = 56;
  41162. t[1013] = 57;
  41163. t[1081] = 37;
  41164. t[1085] = 43;
  41165. t[1086] = 45;
  41166. });
  41167. exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
  41168. function getStandardFontName(name) {
  41169. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  41170. const stdFontMap = getStdFontMap();
  41171. return stdFontMap[fontName];
  41172. }
  41173. /***/ }),
  41174. /* 173 */
  41175. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41176. "use strict";
  41177. Object.defineProperty(exports, "__esModule", ({
  41178. value: true
  41179. }));
  41180. exports.ToUnicodeMap = exports.IdentityToUnicodeMap = void 0;
  41181. var _util = __w_pdfjs_require__(2);
  41182. class ToUnicodeMap {
  41183. constructor() {
  41184. let cmap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  41185. this._map = cmap;
  41186. }
  41187. get length() {
  41188. return this._map.length;
  41189. }
  41190. forEach(callback) {
  41191. for (const charCode in this._map) {
  41192. callback(charCode, this._map[charCode].charCodeAt(0));
  41193. }
  41194. }
  41195. has(i) {
  41196. return this._map[i] !== undefined;
  41197. }
  41198. get(i) {
  41199. return this._map[i];
  41200. }
  41201. charCodeOf(value) {
  41202. const map = this._map;
  41203. if (map.length <= 0x10000) {
  41204. return map.indexOf(value);
  41205. }
  41206. for (const charCode in map) {
  41207. if (map[charCode] === value) {
  41208. return charCode | 0;
  41209. }
  41210. }
  41211. return -1;
  41212. }
  41213. amend(map) {
  41214. for (const charCode in map) {
  41215. this._map[charCode] = map[charCode];
  41216. }
  41217. }
  41218. }
  41219. exports.ToUnicodeMap = ToUnicodeMap;
  41220. class IdentityToUnicodeMap {
  41221. constructor(firstChar, lastChar) {
  41222. this.firstChar = firstChar;
  41223. this.lastChar = lastChar;
  41224. }
  41225. get length() {
  41226. return this.lastChar + 1 - this.firstChar;
  41227. }
  41228. forEach(callback) {
  41229. for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  41230. callback(i, i);
  41231. }
  41232. }
  41233. has(i) {
  41234. return this.firstChar <= i && i <= this.lastChar;
  41235. }
  41236. get(i) {
  41237. if (this.firstChar <= i && i <= this.lastChar) {
  41238. return String.fromCharCode(i);
  41239. }
  41240. return undefined;
  41241. }
  41242. charCodeOf(v) {
  41243. return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  41244. }
  41245. amend(map) {
  41246. (0, _util.unreachable)("Should not call amend()");
  41247. }
  41248. }
  41249. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  41250. /***/ }),
  41251. /* 174 */
  41252. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41253. "use strict";
  41254. Object.defineProperty(exports, "__esModule", ({
  41255. value: true
  41256. }));
  41257. exports.CFFFont = void 0;
  41258. var _cff_parser = __w_pdfjs_require__(166);
  41259. var _fonts_utils = __w_pdfjs_require__(169);
  41260. var _util = __w_pdfjs_require__(2);
  41261. class CFFFont {
  41262. constructor(file, properties) {
  41263. this.properties = properties;
  41264. const parser = new _cff_parser.CFFParser(file, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  41265. this.cff = parser.parse();
  41266. this.cff.duplicateFirstGlyph();
  41267. const compiler = new _cff_parser.CFFCompiler(this.cff);
  41268. this.seacs = this.cff.seacs;
  41269. try {
  41270. this.data = compiler.compile();
  41271. } catch (e) {
  41272. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  41273. this.data = file;
  41274. }
  41275. this._createBuiltInEncoding();
  41276. }
  41277. get numGlyphs() {
  41278. return this.cff.charStrings.count;
  41279. }
  41280. getCharset() {
  41281. return this.cff.charset.charset;
  41282. }
  41283. getGlyphMapping() {
  41284. const cff = this.cff;
  41285. const properties = this.properties;
  41286. const {
  41287. cidToGidMap,
  41288. cMap
  41289. } = properties;
  41290. const charsets = cff.charset.charset;
  41291. let charCodeToGlyphId;
  41292. let glyphId;
  41293. if (properties.composite) {
  41294. let invCidToGidMap;
  41295. if (cidToGidMap && cidToGidMap.length > 0) {
  41296. invCidToGidMap = Object.create(null);
  41297. for (let i = 0, ii = cidToGidMap.length; i < ii; i++) {
  41298. const gid = cidToGidMap[i];
  41299. if (gid !== undefined) {
  41300. invCidToGidMap[gid] = i;
  41301. }
  41302. }
  41303. }
  41304. charCodeToGlyphId = Object.create(null);
  41305. let charCode;
  41306. if (cff.isCIDFont) {
  41307. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  41308. const cid = charsets[glyphId];
  41309. charCode = cMap.charCodeOf(cid);
  41310. if (invCidToGidMap && invCidToGidMap[charCode] !== undefined) {
  41311. charCode = invCidToGidMap[charCode];
  41312. }
  41313. charCodeToGlyphId[charCode] = glyphId;
  41314. }
  41315. } else {
  41316. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  41317. charCode = cMap.charCodeOf(glyphId);
  41318. charCodeToGlyphId[charCode] = glyphId;
  41319. }
  41320. }
  41321. return charCodeToGlyphId;
  41322. }
  41323. let encoding = cff.encoding ? cff.encoding.encoding : null;
  41324. if (properties.isInternalFont) {
  41325. encoding = properties.defaultEncoding;
  41326. }
  41327. charCodeToGlyphId = (0, _fonts_utils.type1FontGlyphMapping)(properties, encoding, charsets);
  41328. return charCodeToGlyphId;
  41329. }
  41330. hasGlyphId(id) {
  41331. return this.cff.hasGlyphId(id);
  41332. }
  41333. _createBuiltInEncoding() {
  41334. const {
  41335. charset,
  41336. encoding
  41337. } = this.cff;
  41338. if (!charset || !encoding) {
  41339. return;
  41340. }
  41341. const charsets = charset.charset,
  41342. encodings = encoding.encoding;
  41343. const map = [];
  41344. for (const charCode in encodings) {
  41345. const glyphId = encodings[charCode];
  41346. if (glyphId >= 0) {
  41347. const glyphName = charsets[glyphId];
  41348. if (glyphName) {
  41349. map[charCode] = glyphName;
  41350. }
  41351. }
  41352. }
  41353. if (map.length > 0) {
  41354. this.properties.builtInEncoding = map;
  41355. }
  41356. }
  41357. }
  41358. exports.CFFFont = CFFFont;
  41359. /***/ }),
  41360. /* 175 */
  41361. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41362. "use strict";
  41363. Object.defineProperty(exports, "__esModule", ({
  41364. value: true
  41365. }));
  41366. exports.FontRendererFactory = void 0;
  41367. var _util = __w_pdfjs_require__(2);
  41368. var _cff_parser = __w_pdfjs_require__(166);
  41369. var _glyphlist = __w_pdfjs_require__(170);
  41370. var _encodings = __w_pdfjs_require__(168);
  41371. var _stream = __w_pdfjs_require__(141);
  41372. function getUint32(data, offset) {
  41373. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  41374. }
  41375. function getUint16(data, offset) {
  41376. return data[offset] << 8 | data[offset + 1];
  41377. }
  41378. function getInt16(data, offset) {
  41379. return (data[offset] << 24 | data[offset + 1] << 16) >> 16;
  41380. }
  41381. function getInt8(data, offset) {
  41382. return data[offset] << 24 >> 24;
  41383. }
  41384. function getFloat214(data, offset) {
  41385. return getInt16(data, offset) / 16384;
  41386. }
  41387. function getSubroutineBias(subrs) {
  41388. const numSubrs = subrs.length;
  41389. let bias = 32768;
  41390. if (numSubrs < 1240) {
  41391. bias = 107;
  41392. } else if (numSubrs < 33900) {
  41393. bias = 1131;
  41394. }
  41395. return bias;
  41396. }
  41397. function parseCmap(data, start, end) {
  41398. const offset = getUint16(data, start + 2) === 1 ? getUint32(data, start + 8) : getUint32(data, start + 16);
  41399. const format = getUint16(data, start + offset);
  41400. let ranges, p, i;
  41401. if (format === 4) {
  41402. getUint16(data, start + offset + 2);
  41403. const segCount = getUint16(data, start + offset + 6) >> 1;
  41404. p = start + offset + 14;
  41405. ranges = [];
  41406. for (i = 0; i < segCount; i++, p += 2) {
  41407. ranges[i] = {
  41408. end: getUint16(data, p)
  41409. };
  41410. }
  41411. p += 2;
  41412. for (i = 0; i < segCount; i++, p += 2) {
  41413. ranges[i].start = getUint16(data, p);
  41414. }
  41415. for (i = 0; i < segCount; i++, p += 2) {
  41416. ranges[i].idDelta = getUint16(data, p);
  41417. }
  41418. for (i = 0; i < segCount; i++, p += 2) {
  41419. let idOffset = getUint16(data, p);
  41420. if (idOffset === 0) {
  41421. continue;
  41422. }
  41423. ranges[i].ids = [];
  41424. for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  41425. ranges[i].ids[j] = getUint16(data, p + idOffset);
  41426. idOffset += 2;
  41427. }
  41428. }
  41429. return ranges;
  41430. } else if (format === 12) {
  41431. const groups = getUint32(data, start + offset + 12);
  41432. p = start + offset + 16;
  41433. ranges = [];
  41434. for (i = 0; i < groups; i++) {
  41435. start = getUint32(data, p);
  41436. ranges.push({
  41437. start,
  41438. end: getUint32(data, p + 4),
  41439. idDelta: getUint32(data, p + 8) - start
  41440. });
  41441. p += 12;
  41442. }
  41443. return ranges;
  41444. }
  41445. throw new _util.FormatError(`unsupported cmap: ${format}`);
  41446. }
  41447. function parseCff(data, start, end, seacAnalysisEnabled) {
  41448. const properties = {};
  41449. const parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
  41450. const cff = parser.parse();
  41451. return {
  41452. glyphs: cff.charStrings.objects,
  41453. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  41454. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
  41455. isCFFCIDFont: cff.isCIDFont,
  41456. fdSelect: cff.fdSelect,
  41457. fdArray: cff.fdArray
  41458. };
  41459. }
  41460. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  41461. let itemSize, itemDecode;
  41462. if (isGlyphLocationsLong) {
  41463. itemSize = 4;
  41464. itemDecode = getUint32;
  41465. } else {
  41466. itemSize = 2;
  41467. itemDecode = (data, offset) => 2 * getUint16(data, offset);
  41468. }
  41469. const glyphs = [];
  41470. let startOffset = itemDecode(loca, 0);
  41471. for (let j = itemSize; j < loca.length; j += itemSize) {
  41472. const endOffset = itemDecode(loca, j);
  41473. glyphs.push(glyf.subarray(startOffset, endOffset));
  41474. startOffset = endOffset;
  41475. }
  41476. return glyphs;
  41477. }
  41478. function lookupCmap(ranges, unicode) {
  41479. const code = unicode.codePointAt(0);
  41480. let gid = 0,
  41481. l = 0,
  41482. r = ranges.length - 1;
  41483. while (l < r) {
  41484. const c = l + r + 1 >> 1;
  41485. if (code < ranges[c].start) {
  41486. r = c - 1;
  41487. } else {
  41488. l = c;
  41489. }
  41490. }
  41491. if (ranges[l].start <= code && code <= ranges[l].end) {
  41492. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
  41493. }
  41494. return {
  41495. charCode: code,
  41496. glyphId: gid
  41497. };
  41498. }
  41499. function compileGlyf(code, cmds, font) {
  41500. function moveTo(x, y) {
  41501. cmds.push({
  41502. cmd: "moveTo",
  41503. args: [x, y]
  41504. });
  41505. }
  41506. function lineTo(x, y) {
  41507. cmds.push({
  41508. cmd: "lineTo",
  41509. args: [x, y]
  41510. });
  41511. }
  41512. function quadraticCurveTo(xa, ya, x, y) {
  41513. cmds.push({
  41514. cmd: "quadraticCurveTo",
  41515. args: [xa, ya, x, y]
  41516. });
  41517. }
  41518. let i = 0;
  41519. const numberOfContours = getInt16(code, i);
  41520. let flags;
  41521. let x = 0,
  41522. y = 0;
  41523. i += 10;
  41524. if (numberOfContours < 0) {
  41525. do {
  41526. flags = getUint16(code, i);
  41527. const glyphIndex = getUint16(code, i + 2);
  41528. i += 4;
  41529. let arg1, arg2;
  41530. if (flags & 0x01) {
  41531. if (flags & 0x02) {
  41532. arg1 = getInt16(code, i);
  41533. arg2 = getInt16(code, i + 2);
  41534. } else {
  41535. arg1 = getUint16(code, i);
  41536. arg2 = getUint16(code, i + 2);
  41537. }
  41538. i += 4;
  41539. } else {
  41540. if (flags & 0x02) {
  41541. arg1 = getInt8(code, i++);
  41542. arg2 = getInt8(code, i++);
  41543. } else {
  41544. arg1 = code[i++];
  41545. arg2 = code[i++];
  41546. }
  41547. }
  41548. if (flags & 0x02) {
  41549. x = arg1;
  41550. y = arg2;
  41551. } else {
  41552. x = 0;
  41553. y = 0;
  41554. }
  41555. let scaleX = 1,
  41556. scaleY = 1,
  41557. scale01 = 0,
  41558. scale10 = 0;
  41559. if (flags & 0x08) {
  41560. scaleX = scaleY = getFloat214(code, i);
  41561. i += 2;
  41562. } else if (flags & 0x40) {
  41563. scaleX = getFloat214(code, i);
  41564. scaleY = getFloat214(code, i + 2);
  41565. i += 4;
  41566. } else if (flags & 0x80) {
  41567. scaleX = getFloat214(code, i);
  41568. scale01 = getFloat214(code, i + 2);
  41569. scale10 = getFloat214(code, i + 4);
  41570. scaleY = getFloat214(code, i + 6);
  41571. i += 8;
  41572. }
  41573. const subglyph = font.glyphs[glyphIndex];
  41574. if (subglyph) {
  41575. cmds.push({
  41576. cmd: "save"
  41577. }, {
  41578. cmd: "transform",
  41579. args: [scaleX, scale01, scale10, scaleY, x, y]
  41580. });
  41581. if (!(flags & 0x02)) {}
  41582. compileGlyf(subglyph, cmds, font);
  41583. cmds.push({
  41584. cmd: "restore"
  41585. });
  41586. }
  41587. } while (flags & 0x20);
  41588. } else {
  41589. const endPtsOfContours = [];
  41590. let j, jj;
  41591. for (j = 0; j < numberOfContours; j++) {
  41592. endPtsOfContours.push(getUint16(code, i));
  41593. i += 2;
  41594. }
  41595. const instructionLength = getUint16(code, i);
  41596. i += 2 + instructionLength;
  41597. const numberOfPoints = endPtsOfContours.at(-1) + 1;
  41598. const points = [];
  41599. while (points.length < numberOfPoints) {
  41600. flags = code[i++];
  41601. let repeat = 1;
  41602. if (flags & 0x08) {
  41603. repeat += code[i++];
  41604. }
  41605. while (repeat-- > 0) {
  41606. points.push({
  41607. flags
  41608. });
  41609. }
  41610. }
  41611. for (j = 0; j < numberOfPoints; j++) {
  41612. switch (points[j].flags & 0x12) {
  41613. case 0x00:
  41614. x += getInt16(code, i);
  41615. i += 2;
  41616. break;
  41617. case 0x02:
  41618. x -= code[i++];
  41619. break;
  41620. case 0x12:
  41621. x += code[i++];
  41622. break;
  41623. }
  41624. points[j].x = x;
  41625. }
  41626. for (j = 0; j < numberOfPoints; j++) {
  41627. switch (points[j].flags & 0x24) {
  41628. case 0x00:
  41629. y += getInt16(code, i);
  41630. i += 2;
  41631. break;
  41632. case 0x04:
  41633. y -= code[i++];
  41634. break;
  41635. case 0x24:
  41636. y += code[i++];
  41637. break;
  41638. }
  41639. points[j].y = y;
  41640. }
  41641. let startPoint = 0;
  41642. for (i = 0; i < numberOfContours; i++) {
  41643. const endPoint = endPtsOfContours[i];
  41644. const contour = points.slice(startPoint, endPoint + 1);
  41645. if (contour[0].flags & 1) {
  41646. contour.push(contour[0]);
  41647. } else if (contour.at(-1).flags & 1) {
  41648. contour.unshift(contour.at(-1));
  41649. } else {
  41650. const p = {
  41651. flags: 1,
  41652. x: (contour[0].x + contour.at(-1).x) / 2,
  41653. y: (contour[0].y + contour.at(-1).y) / 2
  41654. };
  41655. contour.unshift(p);
  41656. contour.push(p);
  41657. }
  41658. moveTo(contour[0].x, contour[0].y);
  41659. for (j = 1, jj = contour.length; j < jj; j++) {
  41660. if (contour[j].flags & 1) {
  41661. lineTo(contour[j].x, contour[j].y);
  41662. } else if (contour[j + 1].flags & 1) {
  41663. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  41664. j++;
  41665. } else {
  41666. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  41667. }
  41668. }
  41669. startPoint = endPoint + 1;
  41670. }
  41671. }
  41672. }
  41673. function compileCharString(charStringCode, cmds, font, glyphId) {
  41674. function moveTo(x, y) {
  41675. cmds.push({
  41676. cmd: "moveTo",
  41677. args: [x, y]
  41678. });
  41679. }
  41680. function lineTo(x, y) {
  41681. cmds.push({
  41682. cmd: "lineTo",
  41683. args: [x, y]
  41684. });
  41685. }
  41686. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  41687. cmds.push({
  41688. cmd: "bezierCurveTo",
  41689. args: [x1, y1, x2, y2, x, y]
  41690. });
  41691. }
  41692. const stack = [];
  41693. let x = 0,
  41694. y = 0;
  41695. let stems = 0;
  41696. function parse(code) {
  41697. let i = 0;
  41698. while (i < code.length) {
  41699. let stackClean = false;
  41700. let v = code[i++];
  41701. let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  41702. switch (v) {
  41703. case 1:
  41704. stems += stack.length >> 1;
  41705. stackClean = true;
  41706. break;
  41707. case 3:
  41708. stems += stack.length >> 1;
  41709. stackClean = true;
  41710. break;
  41711. case 4:
  41712. y += stack.pop();
  41713. moveTo(x, y);
  41714. stackClean = true;
  41715. break;
  41716. case 5:
  41717. while (stack.length > 0) {
  41718. x += stack.shift();
  41719. y += stack.shift();
  41720. lineTo(x, y);
  41721. }
  41722. break;
  41723. case 6:
  41724. while (stack.length > 0) {
  41725. x += stack.shift();
  41726. lineTo(x, y);
  41727. if (stack.length === 0) {
  41728. break;
  41729. }
  41730. y += stack.shift();
  41731. lineTo(x, y);
  41732. }
  41733. break;
  41734. case 7:
  41735. while (stack.length > 0) {
  41736. y += stack.shift();
  41737. lineTo(x, y);
  41738. if (stack.length === 0) {
  41739. break;
  41740. }
  41741. x += stack.shift();
  41742. lineTo(x, y);
  41743. }
  41744. break;
  41745. case 8:
  41746. while (stack.length > 0) {
  41747. xa = x + stack.shift();
  41748. ya = y + stack.shift();
  41749. xb = xa + stack.shift();
  41750. yb = ya + stack.shift();
  41751. x = xb + stack.shift();
  41752. y = yb + stack.shift();
  41753. bezierCurveTo(xa, ya, xb, yb, x, y);
  41754. }
  41755. break;
  41756. case 10:
  41757. n = stack.pop();
  41758. subrCode = null;
  41759. if (font.isCFFCIDFont) {
  41760. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  41761. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  41762. const fontDict = font.fdArray[fdIndex];
  41763. let subrs;
  41764. if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
  41765. subrs = fontDict.privateDict.subrsIndex.objects;
  41766. }
  41767. if (subrs) {
  41768. n += getSubroutineBias(subrs);
  41769. subrCode = subrs[n];
  41770. }
  41771. } else {
  41772. (0, _util.warn)("Invalid fd index for glyph index.");
  41773. }
  41774. } else {
  41775. subrCode = font.subrs[n + font.subrsBias];
  41776. }
  41777. if (subrCode) {
  41778. parse(subrCode);
  41779. }
  41780. break;
  41781. case 11:
  41782. return;
  41783. case 12:
  41784. v = code[i++];
  41785. switch (v) {
  41786. case 34:
  41787. xa = x + stack.shift();
  41788. xb = xa + stack.shift();
  41789. y1 = y + stack.shift();
  41790. x = xb + stack.shift();
  41791. bezierCurveTo(xa, y, xb, y1, x, y1);
  41792. xa = x + stack.shift();
  41793. xb = xa + stack.shift();
  41794. x = xb + stack.shift();
  41795. bezierCurveTo(xa, y1, xb, y, x, y);
  41796. break;
  41797. case 35:
  41798. xa = x + stack.shift();
  41799. ya = y + stack.shift();
  41800. xb = xa + stack.shift();
  41801. yb = ya + stack.shift();
  41802. x = xb + stack.shift();
  41803. y = yb + stack.shift();
  41804. bezierCurveTo(xa, ya, xb, yb, x, y);
  41805. xa = x + stack.shift();
  41806. ya = y + stack.shift();
  41807. xb = xa + stack.shift();
  41808. yb = ya + stack.shift();
  41809. x = xb + stack.shift();
  41810. y = yb + stack.shift();
  41811. bezierCurveTo(xa, ya, xb, yb, x, y);
  41812. stack.pop();
  41813. break;
  41814. case 36:
  41815. xa = x + stack.shift();
  41816. y1 = y + stack.shift();
  41817. xb = xa + stack.shift();
  41818. y2 = y1 + stack.shift();
  41819. x = xb + stack.shift();
  41820. bezierCurveTo(xa, y1, xb, y2, x, y2);
  41821. xa = x + stack.shift();
  41822. xb = xa + stack.shift();
  41823. y3 = y2 + stack.shift();
  41824. x = xb + stack.shift();
  41825. bezierCurveTo(xa, y2, xb, y3, x, y);
  41826. break;
  41827. case 37:
  41828. const x0 = x,
  41829. y0 = y;
  41830. xa = x + stack.shift();
  41831. ya = y + stack.shift();
  41832. xb = xa + stack.shift();
  41833. yb = ya + stack.shift();
  41834. x = xb + stack.shift();
  41835. y = yb + stack.shift();
  41836. bezierCurveTo(xa, ya, xb, yb, x, y);
  41837. xa = x + stack.shift();
  41838. ya = y + stack.shift();
  41839. xb = xa + stack.shift();
  41840. yb = ya + stack.shift();
  41841. x = xb;
  41842. y = yb;
  41843. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  41844. x += stack.shift();
  41845. } else {
  41846. y += stack.shift();
  41847. }
  41848. bezierCurveTo(xa, ya, xb, yb, x, y);
  41849. break;
  41850. default:
  41851. throw new _util.FormatError(`unknown operator: 12 ${v}`);
  41852. }
  41853. break;
  41854. case 14:
  41855. if (stack.length >= 4) {
  41856. const achar = stack.pop();
  41857. const bchar = stack.pop();
  41858. y = stack.pop();
  41859. x = stack.pop();
  41860. cmds.push({
  41861. cmd: "save"
  41862. }, {
  41863. cmd: "translate",
  41864. args: [x, y]
  41865. });
  41866. let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
  41867. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  41868. cmds.push({
  41869. cmd: "restore"
  41870. });
  41871. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
  41872. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  41873. }
  41874. return;
  41875. case 18:
  41876. stems += stack.length >> 1;
  41877. stackClean = true;
  41878. break;
  41879. case 19:
  41880. stems += stack.length >> 1;
  41881. i += stems + 7 >> 3;
  41882. stackClean = true;
  41883. break;
  41884. case 20:
  41885. stems += stack.length >> 1;
  41886. i += stems + 7 >> 3;
  41887. stackClean = true;
  41888. break;
  41889. case 21:
  41890. y += stack.pop();
  41891. x += stack.pop();
  41892. moveTo(x, y);
  41893. stackClean = true;
  41894. break;
  41895. case 22:
  41896. x += stack.pop();
  41897. moveTo(x, y);
  41898. stackClean = true;
  41899. break;
  41900. case 23:
  41901. stems += stack.length >> 1;
  41902. stackClean = true;
  41903. break;
  41904. case 24:
  41905. while (stack.length > 2) {
  41906. xa = x + stack.shift();
  41907. ya = y + stack.shift();
  41908. xb = xa + stack.shift();
  41909. yb = ya + stack.shift();
  41910. x = xb + stack.shift();
  41911. y = yb + stack.shift();
  41912. bezierCurveTo(xa, ya, xb, yb, x, y);
  41913. }
  41914. x += stack.shift();
  41915. y += stack.shift();
  41916. lineTo(x, y);
  41917. break;
  41918. case 25:
  41919. while (stack.length > 6) {
  41920. x += stack.shift();
  41921. y += stack.shift();
  41922. lineTo(x, y);
  41923. }
  41924. xa = x + stack.shift();
  41925. ya = y + stack.shift();
  41926. xb = xa + stack.shift();
  41927. yb = ya + stack.shift();
  41928. x = xb + stack.shift();
  41929. y = yb + stack.shift();
  41930. bezierCurveTo(xa, ya, xb, yb, x, y);
  41931. break;
  41932. case 26:
  41933. if (stack.length % 2) {
  41934. x += stack.shift();
  41935. }
  41936. while (stack.length > 0) {
  41937. xa = x;
  41938. ya = y + stack.shift();
  41939. xb = xa + stack.shift();
  41940. yb = ya + stack.shift();
  41941. x = xb;
  41942. y = yb + stack.shift();
  41943. bezierCurveTo(xa, ya, xb, yb, x, y);
  41944. }
  41945. break;
  41946. case 27:
  41947. if (stack.length % 2) {
  41948. y += stack.shift();
  41949. }
  41950. while (stack.length > 0) {
  41951. xa = x + stack.shift();
  41952. ya = y;
  41953. xb = xa + stack.shift();
  41954. yb = ya + stack.shift();
  41955. x = xb + stack.shift();
  41956. y = yb;
  41957. bezierCurveTo(xa, ya, xb, yb, x, y);
  41958. }
  41959. break;
  41960. case 28:
  41961. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  41962. i += 2;
  41963. break;
  41964. case 29:
  41965. n = stack.pop() + font.gsubrsBias;
  41966. subrCode = font.gsubrs[n];
  41967. if (subrCode) {
  41968. parse(subrCode);
  41969. }
  41970. break;
  41971. case 30:
  41972. while (stack.length > 0) {
  41973. xa = x;
  41974. ya = y + stack.shift();
  41975. xb = xa + stack.shift();
  41976. yb = ya + stack.shift();
  41977. x = xb + stack.shift();
  41978. y = yb + (stack.length === 1 ? stack.shift() : 0);
  41979. bezierCurveTo(xa, ya, xb, yb, x, y);
  41980. if (stack.length === 0) {
  41981. break;
  41982. }
  41983. xa = x + stack.shift();
  41984. ya = y;
  41985. xb = xa + stack.shift();
  41986. yb = ya + stack.shift();
  41987. y = yb + stack.shift();
  41988. x = xb + (stack.length === 1 ? stack.shift() : 0);
  41989. bezierCurveTo(xa, ya, xb, yb, x, y);
  41990. }
  41991. break;
  41992. case 31:
  41993. while (stack.length > 0) {
  41994. xa = x + stack.shift();
  41995. ya = y;
  41996. xb = xa + stack.shift();
  41997. yb = ya + stack.shift();
  41998. y = yb + stack.shift();
  41999. x = xb + (stack.length === 1 ? stack.shift() : 0);
  42000. bezierCurveTo(xa, ya, xb, yb, x, y);
  42001. if (stack.length === 0) {
  42002. break;
  42003. }
  42004. xa = x;
  42005. ya = y + stack.shift();
  42006. xb = xa + stack.shift();
  42007. yb = ya + stack.shift();
  42008. x = xb + stack.shift();
  42009. y = yb + (stack.length === 1 ? stack.shift() : 0);
  42010. bezierCurveTo(xa, ya, xb, yb, x, y);
  42011. }
  42012. break;
  42013. default:
  42014. if (v < 32) {
  42015. throw new _util.FormatError(`unknown operator: ${v}`);
  42016. }
  42017. if (v < 247) {
  42018. stack.push(v - 139);
  42019. } else if (v < 251) {
  42020. stack.push((v - 247) * 256 + code[i++] + 108);
  42021. } else if (v < 255) {
  42022. stack.push(-(v - 251) * 256 - code[i++] - 108);
  42023. } else {
  42024. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  42025. i += 4;
  42026. }
  42027. break;
  42028. }
  42029. if (stackClean) {
  42030. stack.length = 0;
  42031. }
  42032. }
  42033. }
  42034. parse(charStringCode);
  42035. }
  42036. const NOOP = [];
  42037. class CompiledFont {
  42038. constructor(fontMatrix) {
  42039. if (this.constructor === CompiledFont) {
  42040. (0, _util.unreachable)("Cannot initialize CompiledFont.");
  42041. }
  42042. this.fontMatrix = fontMatrix;
  42043. this.compiledGlyphs = Object.create(null);
  42044. this.compiledCharCodeToGlyphId = Object.create(null);
  42045. }
  42046. getPathJs(unicode) {
  42047. const {
  42048. charCode,
  42049. glyphId
  42050. } = lookupCmap(this.cmap, unicode);
  42051. let fn = this.compiledGlyphs[glyphId];
  42052. if (!fn) {
  42053. try {
  42054. fn = this.compileGlyph(this.glyphs[glyphId], glyphId);
  42055. this.compiledGlyphs[glyphId] = fn;
  42056. } catch (ex) {
  42057. this.compiledGlyphs[glyphId] = NOOP;
  42058. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  42059. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  42060. }
  42061. throw ex;
  42062. }
  42063. }
  42064. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  42065. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  42066. }
  42067. return fn;
  42068. }
  42069. compileGlyph(code, glyphId) {
  42070. if (!code || code.length === 0 || code[0] === 14) {
  42071. return NOOP;
  42072. }
  42073. let fontMatrix = this.fontMatrix;
  42074. if (this.isCFFCIDFont) {
  42075. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  42076. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  42077. const fontDict = this.fdArray[fdIndex];
  42078. fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
  42079. } else {
  42080. (0, _util.warn)("Invalid fd index for glyph index.");
  42081. }
  42082. }
  42083. const cmds = [{
  42084. cmd: "save"
  42085. }, {
  42086. cmd: "transform",
  42087. args: fontMatrix.slice()
  42088. }, {
  42089. cmd: "scale",
  42090. args: ["size", "-size"]
  42091. }];
  42092. this.compileGlyphImpl(code, cmds, glyphId);
  42093. cmds.push({
  42094. cmd: "restore"
  42095. });
  42096. return cmds;
  42097. }
  42098. compileGlyphImpl() {
  42099. (0, _util.unreachable)("Children classes should implement this.");
  42100. }
  42101. hasBuiltPath(unicode) {
  42102. const {
  42103. charCode,
  42104. glyphId
  42105. } = lookupCmap(this.cmap, unicode);
  42106. return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined;
  42107. }
  42108. }
  42109. class TrueTypeCompiled extends CompiledFont {
  42110. constructor(glyphs, cmap, fontMatrix) {
  42111. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  42112. this.glyphs = glyphs;
  42113. this.cmap = cmap;
  42114. }
  42115. compileGlyphImpl(code, cmds) {
  42116. compileGlyf(code, cmds, this);
  42117. }
  42118. }
  42119. class Type2Compiled extends CompiledFont {
  42120. constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
  42121. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  42122. this.glyphs = cffInfo.glyphs;
  42123. this.gsubrs = cffInfo.gsubrs || [];
  42124. this.subrs = cffInfo.subrs || [];
  42125. this.cmap = cmap;
  42126. this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
  42127. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  42128. this.subrsBias = getSubroutineBias(this.subrs);
  42129. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  42130. this.fdSelect = cffInfo.fdSelect;
  42131. this.fdArray = cffInfo.fdArray;
  42132. }
  42133. compileGlyphImpl(code, cmds, glyphId) {
  42134. compileCharString(code, cmds, this, glyphId);
  42135. }
  42136. }
  42137. class FontRendererFactory {
  42138. static create(font, seacAnalysisEnabled) {
  42139. const data = new Uint8Array(font.data);
  42140. let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  42141. const numTables = getUint16(data, 4);
  42142. for (let i = 0, p = 12; i < numTables; i++, p += 16) {
  42143. const tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
  42144. const offset = getUint32(data, p + 8);
  42145. const length = getUint32(data, p + 12);
  42146. switch (tag) {
  42147. case "cmap":
  42148. cmap = parseCmap(data, offset, offset + length);
  42149. break;
  42150. case "glyf":
  42151. glyf = data.subarray(offset, offset + length);
  42152. break;
  42153. case "loca":
  42154. loca = data.subarray(offset, offset + length);
  42155. break;
  42156. case "head":
  42157. unitsPerEm = getUint16(data, offset + 18);
  42158. indexToLocFormat = getUint16(data, offset + 50);
  42159. break;
  42160. case "CFF ":
  42161. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  42162. break;
  42163. }
  42164. }
  42165. if (glyf) {
  42166. const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  42167. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  42168. }
  42169. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  42170. }
  42171. }
  42172. exports.FontRendererFactory = FontRendererFactory;
  42173. /***/ }),
  42174. /* 176 */
  42175. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42176. "use strict";
  42177. Object.defineProperty(exports, "__esModule", ({
  42178. value: true
  42179. }));
  42180. exports.getMetrics = exports.getFontBasicMetrics = void 0;
  42181. var _core_utils = __w_pdfjs_require__(136);
  42182. const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  42183. t.Courier = 600;
  42184. t["Courier-Bold"] = 600;
  42185. t["Courier-BoldOblique"] = 600;
  42186. t["Courier-Oblique"] = 600;
  42187. t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) {
  42188. t.space = 278;
  42189. t.exclam = 278;
  42190. t.quotedbl = 355;
  42191. t.numbersign = 556;
  42192. t.dollar = 556;
  42193. t.percent = 889;
  42194. t.ampersand = 667;
  42195. t.quoteright = 222;
  42196. t.parenleft = 333;
  42197. t.parenright = 333;
  42198. t.asterisk = 389;
  42199. t.plus = 584;
  42200. t.comma = 278;
  42201. t.hyphen = 333;
  42202. t.period = 278;
  42203. t.slash = 278;
  42204. t.zero = 556;
  42205. t.one = 556;
  42206. t.two = 556;
  42207. t.three = 556;
  42208. t.four = 556;
  42209. t.five = 556;
  42210. t.six = 556;
  42211. t.seven = 556;
  42212. t.eight = 556;
  42213. t.nine = 556;
  42214. t.colon = 278;
  42215. t.semicolon = 278;
  42216. t.less = 584;
  42217. t.equal = 584;
  42218. t.greater = 584;
  42219. t.question = 556;
  42220. t.at = 1015;
  42221. t.A = 667;
  42222. t.B = 667;
  42223. t.C = 722;
  42224. t.D = 722;
  42225. t.E = 667;
  42226. t.F = 611;
  42227. t.G = 778;
  42228. t.H = 722;
  42229. t.I = 278;
  42230. t.J = 500;
  42231. t.K = 667;
  42232. t.L = 556;
  42233. t.M = 833;
  42234. t.N = 722;
  42235. t.O = 778;
  42236. t.P = 667;
  42237. t.Q = 778;
  42238. t.R = 722;
  42239. t.S = 667;
  42240. t.T = 611;
  42241. t.U = 722;
  42242. t.V = 667;
  42243. t.W = 944;
  42244. t.X = 667;
  42245. t.Y = 667;
  42246. t.Z = 611;
  42247. t.bracketleft = 278;
  42248. t.backslash = 278;
  42249. t.bracketright = 278;
  42250. t.asciicircum = 469;
  42251. t.underscore = 556;
  42252. t.quoteleft = 222;
  42253. t.a = 556;
  42254. t.b = 556;
  42255. t.c = 500;
  42256. t.d = 556;
  42257. t.e = 556;
  42258. t.f = 278;
  42259. t.g = 556;
  42260. t.h = 556;
  42261. t.i = 222;
  42262. t.j = 222;
  42263. t.k = 500;
  42264. t.l = 222;
  42265. t.m = 833;
  42266. t.n = 556;
  42267. t.o = 556;
  42268. t.p = 556;
  42269. t.q = 556;
  42270. t.r = 333;
  42271. t.s = 500;
  42272. t.t = 278;
  42273. t.u = 556;
  42274. t.v = 500;
  42275. t.w = 722;
  42276. t.x = 500;
  42277. t.y = 500;
  42278. t.z = 500;
  42279. t.braceleft = 334;
  42280. t.bar = 260;
  42281. t.braceright = 334;
  42282. t.asciitilde = 584;
  42283. t.exclamdown = 333;
  42284. t.cent = 556;
  42285. t.sterling = 556;
  42286. t.fraction = 167;
  42287. t.yen = 556;
  42288. t.florin = 556;
  42289. t.section = 556;
  42290. t.currency = 556;
  42291. t.quotesingle = 191;
  42292. t.quotedblleft = 333;
  42293. t.guillemotleft = 556;
  42294. t.guilsinglleft = 333;
  42295. t.guilsinglright = 333;
  42296. t.fi = 500;
  42297. t.fl = 500;
  42298. t.endash = 556;
  42299. t.dagger = 556;
  42300. t.daggerdbl = 556;
  42301. t.periodcentered = 278;
  42302. t.paragraph = 537;
  42303. t.bullet = 350;
  42304. t.quotesinglbase = 222;
  42305. t.quotedblbase = 333;
  42306. t.quotedblright = 333;
  42307. t.guillemotright = 556;
  42308. t.ellipsis = 1000;
  42309. t.perthousand = 1000;
  42310. t.questiondown = 611;
  42311. t.grave = 333;
  42312. t.acute = 333;
  42313. t.circumflex = 333;
  42314. t.tilde = 333;
  42315. t.macron = 333;
  42316. t.breve = 333;
  42317. t.dotaccent = 333;
  42318. t.dieresis = 333;
  42319. t.ring = 333;
  42320. t.cedilla = 333;
  42321. t.hungarumlaut = 333;
  42322. t.ogonek = 333;
  42323. t.caron = 333;
  42324. t.emdash = 1000;
  42325. t.AE = 1000;
  42326. t.ordfeminine = 370;
  42327. t.Lslash = 556;
  42328. t.Oslash = 778;
  42329. t.OE = 1000;
  42330. t.ordmasculine = 365;
  42331. t.ae = 889;
  42332. t.dotlessi = 278;
  42333. t.lslash = 222;
  42334. t.oslash = 611;
  42335. t.oe = 944;
  42336. t.germandbls = 611;
  42337. t.Idieresis = 278;
  42338. t.eacute = 556;
  42339. t.abreve = 556;
  42340. t.uhungarumlaut = 556;
  42341. t.ecaron = 556;
  42342. t.Ydieresis = 667;
  42343. t.divide = 584;
  42344. t.Yacute = 667;
  42345. t.Acircumflex = 667;
  42346. t.aacute = 556;
  42347. t.Ucircumflex = 722;
  42348. t.yacute = 500;
  42349. t.scommaaccent = 500;
  42350. t.ecircumflex = 556;
  42351. t.Uring = 722;
  42352. t.Udieresis = 722;
  42353. t.aogonek = 556;
  42354. t.Uacute = 722;
  42355. t.uogonek = 556;
  42356. t.Edieresis = 667;
  42357. t.Dcroat = 722;
  42358. t.commaaccent = 250;
  42359. t.copyright = 737;
  42360. t.Emacron = 667;
  42361. t.ccaron = 500;
  42362. t.aring = 556;
  42363. t.Ncommaaccent = 722;
  42364. t.lacute = 222;
  42365. t.agrave = 556;
  42366. t.Tcommaaccent = 611;
  42367. t.Cacute = 722;
  42368. t.atilde = 556;
  42369. t.Edotaccent = 667;
  42370. t.scaron = 500;
  42371. t.scedilla = 500;
  42372. t.iacute = 278;
  42373. t.lozenge = 471;
  42374. t.Rcaron = 722;
  42375. t.Gcommaaccent = 778;
  42376. t.ucircumflex = 556;
  42377. t.acircumflex = 556;
  42378. t.Amacron = 667;
  42379. t.rcaron = 333;
  42380. t.ccedilla = 500;
  42381. t.Zdotaccent = 611;
  42382. t.Thorn = 667;
  42383. t.Omacron = 778;
  42384. t.Racute = 722;
  42385. t.Sacute = 667;
  42386. t.dcaron = 643;
  42387. t.Umacron = 722;
  42388. t.uring = 556;
  42389. t.threesuperior = 333;
  42390. t.Ograve = 778;
  42391. t.Agrave = 667;
  42392. t.Abreve = 667;
  42393. t.multiply = 584;
  42394. t.uacute = 556;
  42395. t.Tcaron = 611;
  42396. t.partialdiff = 476;
  42397. t.ydieresis = 500;
  42398. t.Nacute = 722;
  42399. t.icircumflex = 278;
  42400. t.Ecircumflex = 667;
  42401. t.adieresis = 556;
  42402. t.edieresis = 556;
  42403. t.cacute = 500;
  42404. t.nacute = 556;
  42405. t.umacron = 556;
  42406. t.Ncaron = 722;
  42407. t.Iacute = 278;
  42408. t.plusminus = 584;
  42409. t.brokenbar = 260;
  42410. t.registered = 737;
  42411. t.Gbreve = 778;
  42412. t.Idotaccent = 278;
  42413. t.summation = 600;
  42414. t.Egrave = 667;
  42415. t.racute = 333;
  42416. t.omacron = 556;
  42417. t.Zacute = 611;
  42418. t.Zcaron = 611;
  42419. t.greaterequal = 549;
  42420. t.Eth = 722;
  42421. t.Ccedilla = 722;
  42422. t.lcommaaccent = 222;
  42423. t.tcaron = 317;
  42424. t.eogonek = 556;
  42425. t.Uogonek = 722;
  42426. t.Aacute = 667;
  42427. t.Adieresis = 667;
  42428. t.egrave = 556;
  42429. t.zacute = 500;
  42430. t.iogonek = 222;
  42431. t.Oacute = 778;
  42432. t.oacute = 556;
  42433. t.amacron = 556;
  42434. t.sacute = 500;
  42435. t.idieresis = 278;
  42436. t.Ocircumflex = 778;
  42437. t.Ugrave = 722;
  42438. t.Delta = 612;
  42439. t.thorn = 556;
  42440. t.twosuperior = 333;
  42441. t.Odieresis = 778;
  42442. t.mu = 556;
  42443. t.igrave = 278;
  42444. t.ohungarumlaut = 556;
  42445. t.Eogonek = 667;
  42446. t.dcroat = 556;
  42447. t.threequarters = 834;
  42448. t.Scedilla = 667;
  42449. t.lcaron = 299;
  42450. t.Kcommaaccent = 667;
  42451. t.Lacute = 556;
  42452. t.trademark = 1000;
  42453. t.edotaccent = 556;
  42454. t.Igrave = 278;
  42455. t.Imacron = 278;
  42456. t.Lcaron = 556;
  42457. t.onehalf = 834;
  42458. t.lessequal = 549;
  42459. t.ocircumflex = 556;
  42460. t.ntilde = 556;
  42461. t.Uhungarumlaut = 722;
  42462. t.Eacute = 667;
  42463. t.emacron = 556;
  42464. t.gbreve = 556;
  42465. t.onequarter = 834;
  42466. t.Scaron = 667;
  42467. t.Scommaaccent = 667;
  42468. t.Ohungarumlaut = 778;
  42469. t.degree = 400;
  42470. t.ograve = 556;
  42471. t.Ccaron = 722;
  42472. t.ugrave = 556;
  42473. t.radical = 453;
  42474. t.Dcaron = 722;
  42475. t.rcommaaccent = 333;
  42476. t.Ntilde = 722;
  42477. t.otilde = 556;
  42478. t.Rcommaaccent = 722;
  42479. t.Lcommaaccent = 556;
  42480. t.Atilde = 667;
  42481. t.Aogonek = 667;
  42482. t.Aring = 667;
  42483. t.Otilde = 778;
  42484. t.zdotaccent = 500;
  42485. t.Ecaron = 667;
  42486. t.Iogonek = 278;
  42487. t.kcommaaccent = 500;
  42488. t.minus = 584;
  42489. t.Icircumflex = 278;
  42490. t.ncaron = 556;
  42491. t.tcommaaccent = 278;
  42492. t.logicalnot = 584;
  42493. t.odieresis = 556;
  42494. t.udieresis = 556;
  42495. t.notequal = 549;
  42496. t.gcommaaccent = 556;
  42497. t.eth = 556;
  42498. t.zcaron = 500;
  42499. t.ncommaaccent = 556;
  42500. t.onesuperior = 333;
  42501. t.imacron = 278;
  42502. t.Euro = 556;
  42503. });
  42504. t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  42505. t.space = 278;
  42506. t.exclam = 333;
  42507. t.quotedbl = 474;
  42508. t.numbersign = 556;
  42509. t.dollar = 556;
  42510. t.percent = 889;
  42511. t.ampersand = 722;
  42512. t.quoteright = 278;
  42513. t.parenleft = 333;
  42514. t.parenright = 333;
  42515. t.asterisk = 389;
  42516. t.plus = 584;
  42517. t.comma = 278;
  42518. t.hyphen = 333;
  42519. t.period = 278;
  42520. t.slash = 278;
  42521. t.zero = 556;
  42522. t.one = 556;
  42523. t.two = 556;
  42524. t.three = 556;
  42525. t.four = 556;
  42526. t.five = 556;
  42527. t.six = 556;
  42528. t.seven = 556;
  42529. t.eight = 556;
  42530. t.nine = 556;
  42531. t.colon = 333;
  42532. t.semicolon = 333;
  42533. t.less = 584;
  42534. t.equal = 584;
  42535. t.greater = 584;
  42536. t.question = 611;
  42537. t.at = 975;
  42538. t.A = 722;
  42539. t.B = 722;
  42540. t.C = 722;
  42541. t.D = 722;
  42542. t.E = 667;
  42543. t.F = 611;
  42544. t.G = 778;
  42545. t.H = 722;
  42546. t.I = 278;
  42547. t.J = 556;
  42548. t.K = 722;
  42549. t.L = 611;
  42550. t.M = 833;
  42551. t.N = 722;
  42552. t.O = 778;
  42553. t.P = 667;
  42554. t.Q = 778;
  42555. t.R = 722;
  42556. t.S = 667;
  42557. t.T = 611;
  42558. t.U = 722;
  42559. t.V = 667;
  42560. t.W = 944;
  42561. t.X = 667;
  42562. t.Y = 667;
  42563. t.Z = 611;
  42564. t.bracketleft = 333;
  42565. t.backslash = 278;
  42566. t.bracketright = 333;
  42567. t.asciicircum = 584;
  42568. t.underscore = 556;
  42569. t.quoteleft = 278;
  42570. t.a = 556;
  42571. t.b = 611;
  42572. t.c = 556;
  42573. t.d = 611;
  42574. t.e = 556;
  42575. t.f = 333;
  42576. t.g = 611;
  42577. t.h = 611;
  42578. t.i = 278;
  42579. t.j = 278;
  42580. t.k = 556;
  42581. t.l = 278;
  42582. t.m = 889;
  42583. t.n = 611;
  42584. t.o = 611;
  42585. t.p = 611;
  42586. t.q = 611;
  42587. t.r = 389;
  42588. t.s = 556;
  42589. t.t = 333;
  42590. t.u = 611;
  42591. t.v = 556;
  42592. t.w = 778;
  42593. t.x = 556;
  42594. t.y = 556;
  42595. t.z = 500;
  42596. t.braceleft = 389;
  42597. t.bar = 280;
  42598. t.braceright = 389;
  42599. t.asciitilde = 584;
  42600. t.exclamdown = 333;
  42601. t.cent = 556;
  42602. t.sterling = 556;
  42603. t.fraction = 167;
  42604. t.yen = 556;
  42605. t.florin = 556;
  42606. t.section = 556;
  42607. t.currency = 556;
  42608. t.quotesingle = 238;
  42609. t.quotedblleft = 500;
  42610. t.guillemotleft = 556;
  42611. t.guilsinglleft = 333;
  42612. t.guilsinglright = 333;
  42613. t.fi = 611;
  42614. t.fl = 611;
  42615. t.endash = 556;
  42616. t.dagger = 556;
  42617. t.daggerdbl = 556;
  42618. t.periodcentered = 278;
  42619. t.paragraph = 556;
  42620. t.bullet = 350;
  42621. t.quotesinglbase = 278;
  42622. t.quotedblbase = 500;
  42623. t.quotedblright = 500;
  42624. t.guillemotright = 556;
  42625. t.ellipsis = 1000;
  42626. t.perthousand = 1000;
  42627. t.questiondown = 611;
  42628. t.grave = 333;
  42629. t.acute = 333;
  42630. t.circumflex = 333;
  42631. t.tilde = 333;
  42632. t.macron = 333;
  42633. t.breve = 333;
  42634. t.dotaccent = 333;
  42635. t.dieresis = 333;
  42636. t.ring = 333;
  42637. t.cedilla = 333;
  42638. t.hungarumlaut = 333;
  42639. t.ogonek = 333;
  42640. t.caron = 333;
  42641. t.emdash = 1000;
  42642. t.AE = 1000;
  42643. t.ordfeminine = 370;
  42644. t.Lslash = 611;
  42645. t.Oslash = 778;
  42646. t.OE = 1000;
  42647. t.ordmasculine = 365;
  42648. t.ae = 889;
  42649. t.dotlessi = 278;
  42650. t.lslash = 278;
  42651. t.oslash = 611;
  42652. t.oe = 944;
  42653. t.germandbls = 611;
  42654. t.Idieresis = 278;
  42655. t.eacute = 556;
  42656. t.abreve = 556;
  42657. t.uhungarumlaut = 611;
  42658. t.ecaron = 556;
  42659. t.Ydieresis = 667;
  42660. t.divide = 584;
  42661. t.Yacute = 667;
  42662. t.Acircumflex = 722;
  42663. t.aacute = 556;
  42664. t.Ucircumflex = 722;
  42665. t.yacute = 556;
  42666. t.scommaaccent = 556;
  42667. t.ecircumflex = 556;
  42668. t.Uring = 722;
  42669. t.Udieresis = 722;
  42670. t.aogonek = 556;
  42671. t.Uacute = 722;
  42672. t.uogonek = 611;
  42673. t.Edieresis = 667;
  42674. t.Dcroat = 722;
  42675. t.commaaccent = 250;
  42676. t.copyright = 737;
  42677. t.Emacron = 667;
  42678. t.ccaron = 556;
  42679. t.aring = 556;
  42680. t.Ncommaaccent = 722;
  42681. t.lacute = 278;
  42682. t.agrave = 556;
  42683. t.Tcommaaccent = 611;
  42684. t.Cacute = 722;
  42685. t.atilde = 556;
  42686. t.Edotaccent = 667;
  42687. t.scaron = 556;
  42688. t.scedilla = 556;
  42689. t.iacute = 278;
  42690. t.lozenge = 494;
  42691. t.Rcaron = 722;
  42692. t.Gcommaaccent = 778;
  42693. t.ucircumflex = 611;
  42694. t.acircumflex = 556;
  42695. t.Amacron = 722;
  42696. t.rcaron = 389;
  42697. t.ccedilla = 556;
  42698. t.Zdotaccent = 611;
  42699. t.Thorn = 667;
  42700. t.Omacron = 778;
  42701. t.Racute = 722;
  42702. t.Sacute = 667;
  42703. t.dcaron = 743;
  42704. t.Umacron = 722;
  42705. t.uring = 611;
  42706. t.threesuperior = 333;
  42707. t.Ograve = 778;
  42708. t.Agrave = 722;
  42709. t.Abreve = 722;
  42710. t.multiply = 584;
  42711. t.uacute = 611;
  42712. t.Tcaron = 611;
  42713. t.partialdiff = 494;
  42714. t.ydieresis = 556;
  42715. t.Nacute = 722;
  42716. t.icircumflex = 278;
  42717. t.Ecircumflex = 667;
  42718. t.adieresis = 556;
  42719. t.edieresis = 556;
  42720. t.cacute = 556;
  42721. t.nacute = 611;
  42722. t.umacron = 611;
  42723. t.Ncaron = 722;
  42724. t.Iacute = 278;
  42725. t.plusminus = 584;
  42726. t.brokenbar = 280;
  42727. t.registered = 737;
  42728. t.Gbreve = 778;
  42729. t.Idotaccent = 278;
  42730. t.summation = 600;
  42731. t.Egrave = 667;
  42732. t.racute = 389;
  42733. t.omacron = 611;
  42734. t.Zacute = 611;
  42735. t.Zcaron = 611;
  42736. t.greaterequal = 549;
  42737. t.Eth = 722;
  42738. t.Ccedilla = 722;
  42739. t.lcommaaccent = 278;
  42740. t.tcaron = 389;
  42741. t.eogonek = 556;
  42742. t.Uogonek = 722;
  42743. t.Aacute = 722;
  42744. t.Adieresis = 722;
  42745. t.egrave = 556;
  42746. t.zacute = 500;
  42747. t.iogonek = 278;
  42748. t.Oacute = 778;
  42749. t.oacute = 611;
  42750. t.amacron = 556;
  42751. t.sacute = 556;
  42752. t.idieresis = 278;
  42753. t.Ocircumflex = 778;
  42754. t.Ugrave = 722;
  42755. t.Delta = 612;
  42756. t.thorn = 611;
  42757. t.twosuperior = 333;
  42758. t.Odieresis = 778;
  42759. t.mu = 611;
  42760. t.igrave = 278;
  42761. t.ohungarumlaut = 611;
  42762. t.Eogonek = 667;
  42763. t.dcroat = 611;
  42764. t.threequarters = 834;
  42765. t.Scedilla = 667;
  42766. t.lcaron = 400;
  42767. t.Kcommaaccent = 722;
  42768. t.Lacute = 611;
  42769. t.trademark = 1000;
  42770. t.edotaccent = 556;
  42771. t.Igrave = 278;
  42772. t.Imacron = 278;
  42773. t.Lcaron = 611;
  42774. t.onehalf = 834;
  42775. t.lessequal = 549;
  42776. t.ocircumflex = 611;
  42777. t.ntilde = 611;
  42778. t.Uhungarumlaut = 722;
  42779. t.Eacute = 667;
  42780. t.emacron = 556;
  42781. t.gbreve = 611;
  42782. t.onequarter = 834;
  42783. t.Scaron = 667;
  42784. t.Scommaaccent = 667;
  42785. t.Ohungarumlaut = 778;
  42786. t.degree = 400;
  42787. t.ograve = 611;
  42788. t.Ccaron = 722;
  42789. t.ugrave = 611;
  42790. t.radical = 549;
  42791. t.Dcaron = 722;
  42792. t.rcommaaccent = 389;
  42793. t.Ntilde = 722;
  42794. t.otilde = 611;
  42795. t.Rcommaaccent = 722;
  42796. t.Lcommaaccent = 611;
  42797. t.Atilde = 722;
  42798. t.Aogonek = 722;
  42799. t.Aring = 722;
  42800. t.Otilde = 778;
  42801. t.zdotaccent = 500;
  42802. t.Ecaron = 667;
  42803. t.Iogonek = 278;
  42804. t.kcommaaccent = 556;
  42805. t.minus = 584;
  42806. t.Icircumflex = 278;
  42807. t.ncaron = 611;
  42808. t.tcommaaccent = 333;
  42809. t.logicalnot = 584;
  42810. t.odieresis = 611;
  42811. t.udieresis = 611;
  42812. t.notequal = 549;
  42813. t.gcommaaccent = 611;
  42814. t.eth = 611;
  42815. t.zcaron = 500;
  42816. t.ncommaaccent = 611;
  42817. t.onesuperior = 333;
  42818. t.imacron = 278;
  42819. t.Euro = 556;
  42820. });
  42821. t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  42822. t.space = 278;
  42823. t.exclam = 333;
  42824. t.quotedbl = 474;
  42825. t.numbersign = 556;
  42826. t.dollar = 556;
  42827. t.percent = 889;
  42828. t.ampersand = 722;
  42829. t.quoteright = 278;
  42830. t.parenleft = 333;
  42831. t.parenright = 333;
  42832. t.asterisk = 389;
  42833. t.plus = 584;
  42834. t.comma = 278;
  42835. t.hyphen = 333;
  42836. t.period = 278;
  42837. t.slash = 278;
  42838. t.zero = 556;
  42839. t.one = 556;
  42840. t.two = 556;
  42841. t.three = 556;
  42842. t.four = 556;
  42843. t.five = 556;
  42844. t.six = 556;
  42845. t.seven = 556;
  42846. t.eight = 556;
  42847. t.nine = 556;
  42848. t.colon = 333;
  42849. t.semicolon = 333;
  42850. t.less = 584;
  42851. t.equal = 584;
  42852. t.greater = 584;
  42853. t.question = 611;
  42854. t.at = 975;
  42855. t.A = 722;
  42856. t.B = 722;
  42857. t.C = 722;
  42858. t.D = 722;
  42859. t.E = 667;
  42860. t.F = 611;
  42861. t.G = 778;
  42862. t.H = 722;
  42863. t.I = 278;
  42864. t.J = 556;
  42865. t.K = 722;
  42866. t.L = 611;
  42867. t.M = 833;
  42868. t.N = 722;
  42869. t.O = 778;
  42870. t.P = 667;
  42871. t.Q = 778;
  42872. t.R = 722;
  42873. t.S = 667;
  42874. t.T = 611;
  42875. t.U = 722;
  42876. t.V = 667;
  42877. t.W = 944;
  42878. t.X = 667;
  42879. t.Y = 667;
  42880. t.Z = 611;
  42881. t.bracketleft = 333;
  42882. t.backslash = 278;
  42883. t.bracketright = 333;
  42884. t.asciicircum = 584;
  42885. t.underscore = 556;
  42886. t.quoteleft = 278;
  42887. t.a = 556;
  42888. t.b = 611;
  42889. t.c = 556;
  42890. t.d = 611;
  42891. t.e = 556;
  42892. t.f = 333;
  42893. t.g = 611;
  42894. t.h = 611;
  42895. t.i = 278;
  42896. t.j = 278;
  42897. t.k = 556;
  42898. t.l = 278;
  42899. t.m = 889;
  42900. t.n = 611;
  42901. t.o = 611;
  42902. t.p = 611;
  42903. t.q = 611;
  42904. t.r = 389;
  42905. t.s = 556;
  42906. t.t = 333;
  42907. t.u = 611;
  42908. t.v = 556;
  42909. t.w = 778;
  42910. t.x = 556;
  42911. t.y = 556;
  42912. t.z = 500;
  42913. t.braceleft = 389;
  42914. t.bar = 280;
  42915. t.braceright = 389;
  42916. t.asciitilde = 584;
  42917. t.exclamdown = 333;
  42918. t.cent = 556;
  42919. t.sterling = 556;
  42920. t.fraction = 167;
  42921. t.yen = 556;
  42922. t.florin = 556;
  42923. t.section = 556;
  42924. t.currency = 556;
  42925. t.quotesingle = 238;
  42926. t.quotedblleft = 500;
  42927. t.guillemotleft = 556;
  42928. t.guilsinglleft = 333;
  42929. t.guilsinglright = 333;
  42930. t.fi = 611;
  42931. t.fl = 611;
  42932. t.endash = 556;
  42933. t.dagger = 556;
  42934. t.daggerdbl = 556;
  42935. t.periodcentered = 278;
  42936. t.paragraph = 556;
  42937. t.bullet = 350;
  42938. t.quotesinglbase = 278;
  42939. t.quotedblbase = 500;
  42940. t.quotedblright = 500;
  42941. t.guillemotright = 556;
  42942. t.ellipsis = 1000;
  42943. t.perthousand = 1000;
  42944. t.questiondown = 611;
  42945. t.grave = 333;
  42946. t.acute = 333;
  42947. t.circumflex = 333;
  42948. t.tilde = 333;
  42949. t.macron = 333;
  42950. t.breve = 333;
  42951. t.dotaccent = 333;
  42952. t.dieresis = 333;
  42953. t.ring = 333;
  42954. t.cedilla = 333;
  42955. t.hungarumlaut = 333;
  42956. t.ogonek = 333;
  42957. t.caron = 333;
  42958. t.emdash = 1000;
  42959. t.AE = 1000;
  42960. t.ordfeminine = 370;
  42961. t.Lslash = 611;
  42962. t.Oslash = 778;
  42963. t.OE = 1000;
  42964. t.ordmasculine = 365;
  42965. t.ae = 889;
  42966. t.dotlessi = 278;
  42967. t.lslash = 278;
  42968. t.oslash = 611;
  42969. t.oe = 944;
  42970. t.germandbls = 611;
  42971. t.Idieresis = 278;
  42972. t.eacute = 556;
  42973. t.abreve = 556;
  42974. t.uhungarumlaut = 611;
  42975. t.ecaron = 556;
  42976. t.Ydieresis = 667;
  42977. t.divide = 584;
  42978. t.Yacute = 667;
  42979. t.Acircumflex = 722;
  42980. t.aacute = 556;
  42981. t.Ucircumflex = 722;
  42982. t.yacute = 556;
  42983. t.scommaaccent = 556;
  42984. t.ecircumflex = 556;
  42985. t.Uring = 722;
  42986. t.Udieresis = 722;
  42987. t.aogonek = 556;
  42988. t.Uacute = 722;
  42989. t.uogonek = 611;
  42990. t.Edieresis = 667;
  42991. t.Dcroat = 722;
  42992. t.commaaccent = 250;
  42993. t.copyright = 737;
  42994. t.Emacron = 667;
  42995. t.ccaron = 556;
  42996. t.aring = 556;
  42997. t.Ncommaaccent = 722;
  42998. t.lacute = 278;
  42999. t.agrave = 556;
  43000. t.Tcommaaccent = 611;
  43001. t.Cacute = 722;
  43002. t.atilde = 556;
  43003. t.Edotaccent = 667;
  43004. t.scaron = 556;
  43005. t.scedilla = 556;
  43006. t.iacute = 278;
  43007. t.lozenge = 494;
  43008. t.Rcaron = 722;
  43009. t.Gcommaaccent = 778;
  43010. t.ucircumflex = 611;
  43011. t.acircumflex = 556;
  43012. t.Amacron = 722;
  43013. t.rcaron = 389;
  43014. t.ccedilla = 556;
  43015. t.Zdotaccent = 611;
  43016. t.Thorn = 667;
  43017. t.Omacron = 778;
  43018. t.Racute = 722;
  43019. t.Sacute = 667;
  43020. t.dcaron = 743;
  43021. t.Umacron = 722;
  43022. t.uring = 611;
  43023. t.threesuperior = 333;
  43024. t.Ograve = 778;
  43025. t.Agrave = 722;
  43026. t.Abreve = 722;
  43027. t.multiply = 584;
  43028. t.uacute = 611;
  43029. t.Tcaron = 611;
  43030. t.partialdiff = 494;
  43031. t.ydieresis = 556;
  43032. t.Nacute = 722;
  43033. t.icircumflex = 278;
  43034. t.Ecircumflex = 667;
  43035. t.adieresis = 556;
  43036. t.edieresis = 556;
  43037. t.cacute = 556;
  43038. t.nacute = 611;
  43039. t.umacron = 611;
  43040. t.Ncaron = 722;
  43041. t.Iacute = 278;
  43042. t.plusminus = 584;
  43043. t.brokenbar = 280;
  43044. t.registered = 737;
  43045. t.Gbreve = 778;
  43046. t.Idotaccent = 278;
  43047. t.summation = 600;
  43048. t.Egrave = 667;
  43049. t.racute = 389;
  43050. t.omacron = 611;
  43051. t.Zacute = 611;
  43052. t.Zcaron = 611;
  43053. t.greaterequal = 549;
  43054. t.Eth = 722;
  43055. t.Ccedilla = 722;
  43056. t.lcommaaccent = 278;
  43057. t.tcaron = 389;
  43058. t.eogonek = 556;
  43059. t.Uogonek = 722;
  43060. t.Aacute = 722;
  43061. t.Adieresis = 722;
  43062. t.egrave = 556;
  43063. t.zacute = 500;
  43064. t.iogonek = 278;
  43065. t.Oacute = 778;
  43066. t.oacute = 611;
  43067. t.amacron = 556;
  43068. t.sacute = 556;
  43069. t.idieresis = 278;
  43070. t.Ocircumflex = 778;
  43071. t.Ugrave = 722;
  43072. t.Delta = 612;
  43073. t.thorn = 611;
  43074. t.twosuperior = 333;
  43075. t.Odieresis = 778;
  43076. t.mu = 611;
  43077. t.igrave = 278;
  43078. t.ohungarumlaut = 611;
  43079. t.Eogonek = 667;
  43080. t.dcroat = 611;
  43081. t.threequarters = 834;
  43082. t.Scedilla = 667;
  43083. t.lcaron = 400;
  43084. t.Kcommaaccent = 722;
  43085. t.Lacute = 611;
  43086. t.trademark = 1000;
  43087. t.edotaccent = 556;
  43088. t.Igrave = 278;
  43089. t.Imacron = 278;
  43090. t.Lcaron = 611;
  43091. t.onehalf = 834;
  43092. t.lessequal = 549;
  43093. t.ocircumflex = 611;
  43094. t.ntilde = 611;
  43095. t.Uhungarumlaut = 722;
  43096. t.Eacute = 667;
  43097. t.emacron = 556;
  43098. t.gbreve = 611;
  43099. t.onequarter = 834;
  43100. t.Scaron = 667;
  43101. t.Scommaaccent = 667;
  43102. t.Ohungarumlaut = 778;
  43103. t.degree = 400;
  43104. t.ograve = 611;
  43105. t.Ccaron = 722;
  43106. t.ugrave = 611;
  43107. t.radical = 549;
  43108. t.Dcaron = 722;
  43109. t.rcommaaccent = 389;
  43110. t.Ntilde = 722;
  43111. t.otilde = 611;
  43112. t.Rcommaaccent = 722;
  43113. t.Lcommaaccent = 611;
  43114. t.Atilde = 722;
  43115. t.Aogonek = 722;
  43116. t.Aring = 722;
  43117. t.Otilde = 778;
  43118. t.zdotaccent = 500;
  43119. t.Ecaron = 667;
  43120. t.Iogonek = 278;
  43121. t.kcommaaccent = 556;
  43122. t.minus = 584;
  43123. t.Icircumflex = 278;
  43124. t.ncaron = 611;
  43125. t.tcommaaccent = 333;
  43126. t.logicalnot = 584;
  43127. t.odieresis = 611;
  43128. t.udieresis = 611;
  43129. t.notequal = 549;
  43130. t.gcommaaccent = 611;
  43131. t.eth = 611;
  43132. t.zcaron = 500;
  43133. t.ncommaaccent = 611;
  43134. t.onesuperior = 333;
  43135. t.imacron = 278;
  43136. t.Euro = 556;
  43137. });
  43138. t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43139. t.space = 278;
  43140. t.exclam = 278;
  43141. t.quotedbl = 355;
  43142. t.numbersign = 556;
  43143. t.dollar = 556;
  43144. t.percent = 889;
  43145. t.ampersand = 667;
  43146. t.quoteright = 222;
  43147. t.parenleft = 333;
  43148. t.parenright = 333;
  43149. t.asterisk = 389;
  43150. t.plus = 584;
  43151. t.comma = 278;
  43152. t.hyphen = 333;
  43153. t.period = 278;
  43154. t.slash = 278;
  43155. t.zero = 556;
  43156. t.one = 556;
  43157. t.two = 556;
  43158. t.three = 556;
  43159. t.four = 556;
  43160. t.five = 556;
  43161. t.six = 556;
  43162. t.seven = 556;
  43163. t.eight = 556;
  43164. t.nine = 556;
  43165. t.colon = 278;
  43166. t.semicolon = 278;
  43167. t.less = 584;
  43168. t.equal = 584;
  43169. t.greater = 584;
  43170. t.question = 556;
  43171. t.at = 1015;
  43172. t.A = 667;
  43173. t.B = 667;
  43174. t.C = 722;
  43175. t.D = 722;
  43176. t.E = 667;
  43177. t.F = 611;
  43178. t.G = 778;
  43179. t.H = 722;
  43180. t.I = 278;
  43181. t.J = 500;
  43182. t.K = 667;
  43183. t.L = 556;
  43184. t.M = 833;
  43185. t.N = 722;
  43186. t.O = 778;
  43187. t.P = 667;
  43188. t.Q = 778;
  43189. t.R = 722;
  43190. t.S = 667;
  43191. t.T = 611;
  43192. t.U = 722;
  43193. t.V = 667;
  43194. t.W = 944;
  43195. t.X = 667;
  43196. t.Y = 667;
  43197. t.Z = 611;
  43198. t.bracketleft = 278;
  43199. t.backslash = 278;
  43200. t.bracketright = 278;
  43201. t.asciicircum = 469;
  43202. t.underscore = 556;
  43203. t.quoteleft = 222;
  43204. t.a = 556;
  43205. t.b = 556;
  43206. t.c = 500;
  43207. t.d = 556;
  43208. t.e = 556;
  43209. t.f = 278;
  43210. t.g = 556;
  43211. t.h = 556;
  43212. t.i = 222;
  43213. t.j = 222;
  43214. t.k = 500;
  43215. t.l = 222;
  43216. t.m = 833;
  43217. t.n = 556;
  43218. t.o = 556;
  43219. t.p = 556;
  43220. t.q = 556;
  43221. t.r = 333;
  43222. t.s = 500;
  43223. t.t = 278;
  43224. t.u = 556;
  43225. t.v = 500;
  43226. t.w = 722;
  43227. t.x = 500;
  43228. t.y = 500;
  43229. t.z = 500;
  43230. t.braceleft = 334;
  43231. t.bar = 260;
  43232. t.braceright = 334;
  43233. t.asciitilde = 584;
  43234. t.exclamdown = 333;
  43235. t.cent = 556;
  43236. t.sterling = 556;
  43237. t.fraction = 167;
  43238. t.yen = 556;
  43239. t.florin = 556;
  43240. t.section = 556;
  43241. t.currency = 556;
  43242. t.quotesingle = 191;
  43243. t.quotedblleft = 333;
  43244. t.guillemotleft = 556;
  43245. t.guilsinglleft = 333;
  43246. t.guilsinglright = 333;
  43247. t.fi = 500;
  43248. t.fl = 500;
  43249. t.endash = 556;
  43250. t.dagger = 556;
  43251. t.daggerdbl = 556;
  43252. t.periodcentered = 278;
  43253. t.paragraph = 537;
  43254. t.bullet = 350;
  43255. t.quotesinglbase = 222;
  43256. t.quotedblbase = 333;
  43257. t.quotedblright = 333;
  43258. t.guillemotright = 556;
  43259. t.ellipsis = 1000;
  43260. t.perthousand = 1000;
  43261. t.questiondown = 611;
  43262. t.grave = 333;
  43263. t.acute = 333;
  43264. t.circumflex = 333;
  43265. t.tilde = 333;
  43266. t.macron = 333;
  43267. t.breve = 333;
  43268. t.dotaccent = 333;
  43269. t.dieresis = 333;
  43270. t.ring = 333;
  43271. t.cedilla = 333;
  43272. t.hungarumlaut = 333;
  43273. t.ogonek = 333;
  43274. t.caron = 333;
  43275. t.emdash = 1000;
  43276. t.AE = 1000;
  43277. t.ordfeminine = 370;
  43278. t.Lslash = 556;
  43279. t.Oslash = 778;
  43280. t.OE = 1000;
  43281. t.ordmasculine = 365;
  43282. t.ae = 889;
  43283. t.dotlessi = 278;
  43284. t.lslash = 222;
  43285. t.oslash = 611;
  43286. t.oe = 944;
  43287. t.germandbls = 611;
  43288. t.Idieresis = 278;
  43289. t.eacute = 556;
  43290. t.abreve = 556;
  43291. t.uhungarumlaut = 556;
  43292. t.ecaron = 556;
  43293. t.Ydieresis = 667;
  43294. t.divide = 584;
  43295. t.Yacute = 667;
  43296. t.Acircumflex = 667;
  43297. t.aacute = 556;
  43298. t.Ucircumflex = 722;
  43299. t.yacute = 500;
  43300. t.scommaaccent = 500;
  43301. t.ecircumflex = 556;
  43302. t.Uring = 722;
  43303. t.Udieresis = 722;
  43304. t.aogonek = 556;
  43305. t.Uacute = 722;
  43306. t.uogonek = 556;
  43307. t.Edieresis = 667;
  43308. t.Dcroat = 722;
  43309. t.commaaccent = 250;
  43310. t.copyright = 737;
  43311. t.Emacron = 667;
  43312. t.ccaron = 500;
  43313. t.aring = 556;
  43314. t.Ncommaaccent = 722;
  43315. t.lacute = 222;
  43316. t.agrave = 556;
  43317. t.Tcommaaccent = 611;
  43318. t.Cacute = 722;
  43319. t.atilde = 556;
  43320. t.Edotaccent = 667;
  43321. t.scaron = 500;
  43322. t.scedilla = 500;
  43323. t.iacute = 278;
  43324. t.lozenge = 471;
  43325. t.Rcaron = 722;
  43326. t.Gcommaaccent = 778;
  43327. t.ucircumflex = 556;
  43328. t.acircumflex = 556;
  43329. t.Amacron = 667;
  43330. t.rcaron = 333;
  43331. t.ccedilla = 500;
  43332. t.Zdotaccent = 611;
  43333. t.Thorn = 667;
  43334. t.Omacron = 778;
  43335. t.Racute = 722;
  43336. t.Sacute = 667;
  43337. t.dcaron = 643;
  43338. t.Umacron = 722;
  43339. t.uring = 556;
  43340. t.threesuperior = 333;
  43341. t.Ograve = 778;
  43342. t.Agrave = 667;
  43343. t.Abreve = 667;
  43344. t.multiply = 584;
  43345. t.uacute = 556;
  43346. t.Tcaron = 611;
  43347. t.partialdiff = 476;
  43348. t.ydieresis = 500;
  43349. t.Nacute = 722;
  43350. t.icircumflex = 278;
  43351. t.Ecircumflex = 667;
  43352. t.adieresis = 556;
  43353. t.edieresis = 556;
  43354. t.cacute = 500;
  43355. t.nacute = 556;
  43356. t.umacron = 556;
  43357. t.Ncaron = 722;
  43358. t.Iacute = 278;
  43359. t.plusminus = 584;
  43360. t.brokenbar = 260;
  43361. t.registered = 737;
  43362. t.Gbreve = 778;
  43363. t.Idotaccent = 278;
  43364. t.summation = 600;
  43365. t.Egrave = 667;
  43366. t.racute = 333;
  43367. t.omacron = 556;
  43368. t.Zacute = 611;
  43369. t.Zcaron = 611;
  43370. t.greaterequal = 549;
  43371. t.Eth = 722;
  43372. t.Ccedilla = 722;
  43373. t.lcommaaccent = 222;
  43374. t.tcaron = 317;
  43375. t.eogonek = 556;
  43376. t.Uogonek = 722;
  43377. t.Aacute = 667;
  43378. t.Adieresis = 667;
  43379. t.egrave = 556;
  43380. t.zacute = 500;
  43381. t.iogonek = 222;
  43382. t.Oacute = 778;
  43383. t.oacute = 556;
  43384. t.amacron = 556;
  43385. t.sacute = 500;
  43386. t.idieresis = 278;
  43387. t.Ocircumflex = 778;
  43388. t.Ugrave = 722;
  43389. t.Delta = 612;
  43390. t.thorn = 556;
  43391. t.twosuperior = 333;
  43392. t.Odieresis = 778;
  43393. t.mu = 556;
  43394. t.igrave = 278;
  43395. t.ohungarumlaut = 556;
  43396. t.Eogonek = 667;
  43397. t.dcroat = 556;
  43398. t.threequarters = 834;
  43399. t.Scedilla = 667;
  43400. t.lcaron = 299;
  43401. t.Kcommaaccent = 667;
  43402. t.Lacute = 556;
  43403. t.trademark = 1000;
  43404. t.edotaccent = 556;
  43405. t.Igrave = 278;
  43406. t.Imacron = 278;
  43407. t.Lcaron = 556;
  43408. t.onehalf = 834;
  43409. t.lessequal = 549;
  43410. t.ocircumflex = 556;
  43411. t.ntilde = 556;
  43412. t.Uhungarumlaut = 722;
  43413. t.Eacute = 667;
  43414. t.emacron = 556;
  43415. t.gbreve = 556;
  43416. t.onequarter = 834;
  43417. t.Scaron = 667;
  43418. t.Scommaaccent = 667;
  43419. t.Ohungarumlaut = 778;
  43420. t.degree = 400;
  43421. t.ograve = 556;
  43422. t.Ccaron = 722;
  43423. t.ugrave = 556;
  43424. t.radical = 453;
  43425. t.Dcaron = 722;
  43426. t.rcommaaccent = 333;
  43427. t.Ntilde = 722;
  43428. t.otilde = 556;
  43429. t.Rcommaaccent = 722;
  43430. t.Lcommaaccent = 556;
  43431. t.Atilde = 667;
  43432. t.Aogonek = 667;
  43433. t.Aring = 667;
  43434. t.Otilde = 778;
  43435. t.zdotaccent = 500;
  43436. t.Ecaron = 667;
  43437. t.Iogonek = 278;
  43438. t.kcommaaccent = 500;
  43439. t.minus = 584;
  43440. t.Icircumflex = 278;
  43441. t.ncaron = 556;
  43442. t.tcommaaccent = 278;
  43443. t.logicalnot = 584;
  43444. t.odieresis = 556;
  43445. t.udieresis = 556;
  43446. t.notequal = 549;
  43447. t.gcommaaccent = 556;
  43448. t.eth = 556;
  43449. t.zcaron = 500;
  43450. t.ncommaaccent = 556;
  43451. t.onesuperior = 333;
  43452. t.imacron = 278;
  43453. t.Euro = 556;
  43454. });
  43455. t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) {
  43456. t.space = 250;
  43457. t.exclam = 333;
  43458. t.universal = 713;
  43459. t.numbersign = 500;
  43460. t.existential = 549;
  43461. t.percent = 833;
  43462. t.ampersand = 778;
  43463. t.suchthat = 439;
  43464. t.parenleft = 333;
  43465. t.parenright = 333;
  43466. t.asteriskmath = 500;
  43467. t.plus = 549;
  43468. t.comma = 250;
  43469. t.minus = 549;
  43470. t.period = 250;
  43471. t.slash = 278;
  43472. t.zero = 500;
  43473. t.one = 500;
  43474. t.two = 500;
  43475. t.three = 500;
  43476. t.four = 500;
  43477. t.five = 500;
  43478. t.six = 500;
  43479. t.seven = 500;
  43480. t.eight = 500;
  43481. t.nine = 500;
  43482. t.colon = 278;
  43483. t.semicolon = 278;
  43484. t.less = 549;
  43485. t.equal = 549;
  43486. t.greater = 549;
  43487. t.question = 444;
  43488. t.congruent = 549;
  43489. t.Alpha = 722;
  43490. t.Beta = 667;
  43491. t.Chi = 722;
  43492. t.Delta = 612;
  43493. t.Epsilon = 611;
  43494. t.Phi = 763;
  43495. t.Gamma = 603;
  43496. t.Eta = 722;
  43497. t.Iota = 333;
  43498. t.theta1 = 631;
  43499. t.Kappa = 722;
  43500. t.Lambda = 686;
  43501. t.Mu = 889;
  43502. t.Nu = 722;
  43503. t.Omicron = 722;
  43504. t.Pi = 768;
  43505. t.Theta = 741;
  43506. t.Rho = 556;
  43507. t.Sigma = 592;
  43508. t.Tau = 611;
  43509. t.Upsilon = 690;
  43510. t.sigma1 = 439;
  43511. t.Omega = 768;
  43512. t.Xi = 645;
  43513. t.Psi = 795;
  43514. t.Zeta = 611;
  43515. t.bracketleft = 333;
  43516. t.therefore = 863;
  43517. t.bracketright = 333;
  43518. t.perpendicular = 658;
  43519. t.underscore = 500;
  43520. t.radicalex = 500;
  43521. t.alpha = 631;
  43522. t.beta = 549;
  43523. t.chi = 549;
  43524. t.delta = 494;
  43525. t.epsilon = 439;
  43526. t.phi = 521;
  43527. t.gamma = 411;
  43528. t.eta = 603;
  43529. t.iota = 329;
  43530. t.phi1 = 603;
  43531. t.kappa = 549;
  43532. t.lambda = 549;
  43533. t.mu = 576;
  43534. t.nu = 521;
  43535. t.omicron = 549;
  43536. t.pi = 549;
  43537. t.theta = 521;
  43538. t.rho = 549;
  43539. t.sigma = 603;
  43540. t.tau = 439;
  43541. t.upsilon = 576;
  43542. t.omega1 = 713;
  43543. t.omega = 686;
  43544. t.xi = 493;
  43545. t.psi = 686;
  43546. t.zeta = 494;
  43547. t.braceleft = 480;
  43548. t.bar = 200;
  43549. t.braceright = 480;
  43550. t.similar = 549;
  43551. t.Euro = 750;
  43552. t.Upsilon1 = 620;
  43553. t.minute = 247;
  43554. t.lessequal = 549;
  43555. t.fraction = 167;
  43556. t.infinity = 713;
  43557. t.florin = 500;
  43558. t.club = 753;
  43559. t.diamond = 753;
  43560. t.heart = 753;
  43561. t.spade = 753;
  43562. t.arrowboth = 1042;
  43563. t.arrowleft = 987;
  43564. t.arrowup = 603;
  43565. t.arrowright = 987;
  43566. t.arrowdown = 603;
  43567. t.degree = 400;
  43568. t.plusminus = 549;
  43569. t.second = 411;
  43570. t.greaterequal = 549;
  43571. t.multiply = 549;
  43572. t.proportional = 713;
  43573. t.partialdiff = 494;
  43574. t.bullet = 460;
  43575. t.divide = 549;
  43576. t.notequal = 549;
  43577. t.equivalence = 549;
  43578. t.approxequal = 549;
  43579. t.ellipsis = 1000;
  43580. t.arrowvertex = 603;
  43581. t.arrowhorizex = 1000;
  43582. t.carriagereturn = 658;
  43583. t.aleph = 823;
  43584. t.Ifraktur = 686;
  43585. t.Rfraktur = 795;
  43586. t.weierstrass = 987;
  43587. t.circlemultiply = 768;
  43588. t.circleplus = 768;
  43589. t.emptyset = 823;
  43590. t.intersection = 768;
  43591. t.union = 768;
  43592. t.propersuperset = 713;
  43593. t.reflexsuperset = 713;
  43594. t.notsubset = 713;
  43595. t.propersubset = 713;
  43596. t.reflexsubset = 713;
  43597. t.element = 713;
  43598. t.notelement = 713;
  43599. t.angle = 768;
  43600. t.gradient = 713;
  43601. t.registerserif = 790;
  43602. t.copyrightserif = 790;
  43603. t.trademarkserif = 890;
  43604. t.product = 823;
  43605. t.radical = 549;
  43606. t.dotmath = 250;
  43607. t.logicalnot = 713;
  43608. t.logicaland = 603;
  43609. t.logicalor = 603;
  43610. t.arrowdblboth = 1042;
  43611. t.arrowdblleft = 987;
  43612. t.arrowdblup = 603;
  43613. t.arrowdblright = 987;
  43614. t.arrowdbldown = 603;
  43615. t.lozenge = 494;
  43616. t.angleleft = 329;
  43617. t.registersans = 790;
  43618. t.copyrightsans = 790;
  43619. t.trademarksans = 786;
  43620. t.summation = 713;
  43621. t.parenlefttp = 384;
  43622. t.parenleftex = 384;
  43623. t.parenleftbt = 384;
  43624. t.bracketlefttp = 384;
  43625. t.bracketleftex = 384;
  43626. t.bracketleftbt = 384;
  43627. t.bracelefttp = 494;
  43628. t.braceleftmid = 494;
  43629. t.braceleftbt = 494;
  43630. t.braceex = 494;
  43631. t.angleright = 329;
  43632. t.integral = 274;
  43633. t.integraltp = 686;
  43634. t.integralex = 686;
  43635. t.integralbt = 686;
  43636. t.parenrighttp = 384;
  43637. t.parenrightex = 384;
  43638. t.parenrightbt = 384;
  43639. t.bracketrighttp = 384;
  43640. t.bracketrightex = 384;
  43641. t.bracketrightbt = 384;
  43642. t.bracerighttp = 494;
  43643. t.bracerightmid = 494;
  43644. t.bracerightbt = 494;
  43645. t.apple = 790;
  43646. });
  43647. t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43648. t.space = 250;
  43649. t.exclam = 333;
  43650. t.quotedbl = 408;
  43651. t.numbersign = 500;
  43652. t.dollar = 500;
  43653. t.percent = 833;
  43654. t.ampersand = 778;
  43655. t.quoteright = 333;
  43656. t.parenleft = 333;
  43657. t.parenright = 333;
  43658. t.asterisk = 500;
  43659. t.plus = 564;
  43660. t.comma = 250;
  43661. t.hyphen = 333;
  43662. t.period = 250;
  43663. t.slash = 278;
  43664. t.zero = 500;
  43665. t.one = 500;
  43666. t.two = 500;
  43667. t.three = 500;
  43668. t.four = 500;
  43669. t.five = 500;
  43670. t.six = 500;
  43671. t.seven = 500;
  43672. t.eight = 500;
  43673. t.nine = 500;
  43674. t.colon = 278;
  43675. t.semicolon = 278;
  43676. t.less = 564;
  43677. t.equal = 564;
  43678. t.greater = 564;
  43679. t.question = 444;
  43680. t.at = 921;
  43681. t.A = 722;
  43682. t.B = 667;
  43683. t.C = 667;
  43684. t.D = 722;
  43685. t.E = 611;
  43686. t.F = 556;
  43687. t.G = 722;
  43688. t.H = 722;
  43689. t.I = 333;
  43690. t.J = 389;
  43691. t.K = 722;
  43692. t.L = 611;
  43693. t.M = 889;
  43694. t.N = 722;
  43695. t.O = 722;
  43696. t.P = 556;
  43697. t.Q = 722;
  43698. t.R = 667;
  43699. t.S = 556;
  43700. t.T = 611;
  43701. t.U = 722;
  43702. t.V = 722;
  43703. t.W = 944;
  43704. t.X = 722;
  43705. t.Y = 722;
  43706. t.Z = 611;
  43707. t.bracketleft = 333;
  43708. t.backslash = 278;
  43709. t.bracketright = 333;
  43710. t.asciicircum = 469;
  43711. t.underscore = 500;
  43712. t.quoteleft = 333;
  43713. t.a = 444;
  43714. t.b = 500;
  43715. t.c = 444;
  43716. t.d = 500;
  43717. t.e = 444;
  43718. t.f = 333;
  43719. t.g = 500;
  43720. t.h = 500;
  43721. t.i = 278;
  43722. t.j = 278;
  43723. t.k = 500;
  43724. t.l = 278;
  43725. t.m = 778;
  43726. t.n = 500;
  43727. t.o = 500;
  43728. t.p = 500;
  43729. t.q = 500;
  43730. t.r = 333;
  43731. t.s = 389;
  43732. t.t = 278;
  43733. t.u = 500;
  43734. t.v = 500;
  43735. t.w = 722;
  43736. t.x = 500;
  43737. t.y = 500;
  43738. t.z = 444;
  43739. t.braceleft = 480;
  43740. t.bar = 200;
  43741. t.braceright = 480;
  43742. t.asciitilde = 541;
  43743. t.exclamdown = 333;
  43744. t.cent = 500;
  43745. t.sterling = 500;
  43746. t.fraction = 167;
  43747. t.yen = 500;
  43748. t.florin = 500;
  43749. t.section = 500;
  43750. t.currency = 500;
  43751. t.quotesingle = 180;
  43752. t.quotedblleft = 444;
  43753. t.guillemotleft = 500;
  43754. t.guilsinglleft = 333;
  43755. t.guilsinglright = 333;
  43756. t.fi = 556;
  43757. t.fl = 556;
  43758. t.endash = 500;
  43759. t.dagger = 500;
  43760. t.daggerdbl = 500;
  43761. t.periodcentered = 250;
  43762. t.paragraph = 453;
  43763. t.bullet = 350;
  43764. t.quotesinglbase = 333;
  43765. t.quotedblbase = 444;
  43766. t.quotedblright = 444;
  43767. t.guillemotright = 500;
  43768. t.ellipsis = 1000;
  43769. t.perthousand = 1000;
  43770. t.questiondown = 444;
  43771. t.grave = 333;
  43772. t.acute = 333;
  43773. t.circumflex = 333;
  43774. t.tilde = 333;
  43775. t.macron = 333;
  43776. t.breve = 333;
  43777. t.dotaccent = 333;
  43778. t.dieresis = 333;
  43779. t.ring = 333;
  43780. t.cedilla = 333;
  43781. t.hungarumlaut = 333;
  43782. t.ogonek = 333;
  43783. t.caron = 333;
  43784. t.emdash = 1000;
  43785. t.AE = 889;
  43786. t.ordfeminine = 276;
  43787. t.Lslash = 611;
  43788. t.Oslash = 722;
  43789. t.OE = 889;
  43790. t.ordmasculine = 310;
  43791. t.ae = 667;
  43792. t.dotlessi = 278;
  43793. t.lslash = 278;
  43794. t.oslash = 500;
  43795. t.oe = 722;
  43796. t.germandbls = 500;
  43797. t.Idieresis = 333;
  43798. t.eacute = 444;
  43799. t.abreve = 444;
  43800. t.uhungarumlaut = 500;
  43801. t.ecaron = 444;
  43802. t.Ydieresis = 722;
  43803. t.divide = 564;
  43804. t.Yacute = 722;
  43805. t.Acircumflex = 722;
  43806. t.aacute = 444;
  43807. t.Ucircumflex = 722;
  43808. t.yacute = 500;
  43809. t.scommaaccent = 389;
  43810. t.ecircumflex = 444;
  43811. t.Uring = 722;
  43812. t.Udieresis = 722;
  43813. t.aogonek = 444;
  43814. t.Uacute = 722;
  43815. t.uogonek = 500;
  43816. t.Edieresis = 611;
  43817. t.Dcroat = 722;
  43818. t.commaaccent = 250;
  43819. t.copyright = 760;
  43820. t.Emacron = 611;
  43821. t.ccaron = 444;
  43822. t.aring = 444;
  43823. t.Ncommaaccent = 722;
  43824. t.lacute = 278;
  43825. t.agrave = 444;
  43826. t.Tcommaaccent = 611;
  43827. t.Cacute = 667;
  43828. t.atilde = 444;
  43829. t.Edotaccent = 611;
  43830. t.scaron = 389;
  43831. t.scedilla = 389;
  43832. t.iacute = 278;
  43833. t.lozenge = 471;
  43834. t.Rcaron = 667;
  43835. t.Gcommaaccent = 722;
  43836. t.ucircumflex = 500;
  43837. t.acircumflex = 444;
  43838. t.Amacron = 722;
  43839. t.rcaron = 333;
  43840. t.ccedilla = 444;
  43841. t.Zdotaccent = 611;
  43842. t.Thorn = 556;
  43843. t.Omacron = 722;
  43844. t.Racute = 667;
  43845. t.Sacute = 556;
  43846. t.dcaron = 588;
  43847. t.Umacron = 722;
  43848. t.uring = 500;
  43849. t.threesuperior = 300;
  43850. t.Ograve = 722;
  43851. t.Agrave = 722;
  43852. t.Abreve = 722;
  43853. t.multiply = 564;
  43854. t.uacute = 500;
  43855. t.Tcaron = 611;
  43856. t.partialdiff = 476;
  43857. t.ydieresis = 500;
  43858. t.Nacute = 722;
  43859. t.icircumflex = 278;
  43860. t.Ecircumflex = 611;
  43861. t.adieresis = 444;
  43862. t.edieresis = 444;
  43863. t.cacute = 444;
  43864. t.nacute = 500;
  43865. t.umacron = 500;
  43866. t.Ncaron = 722;
  43867. t.Iacute = 333;
  43868. t.plusminus = 564;
  43869. t.brokenbar = 200;
  43870. t.registered = 760;
  43871. t.Gbreve = 722;
  43872. t.Idotaccent = 333;
  43873. t.summation = 600;
  43874. t.Egrave = 611;
  43875. t.racute = 333;
  43876. t.omacron = 500;
  43877. t.Zacute = 611;
  43878. t.Zcaron = 611;
  43879. t.greaterequal = 549;
  43880. t.Eth = 722;
  43881. t.Ccedilla = 667;
  43882. t.lcommaaccent = 278;
  43883. t.tcaron = 326;
  43884. t.eogonek = 444;
  43885. t.Uogonek = 722;
  43886. t.Aacute = 722;
  43887. t.Adieresis = 722;
  43888. t.egrave = 444;
  43889. t.zacute = 444;
  43890. t.iogonek = 278;
  43891. t.Oacute = 722;
  43892. t.oacute = 500;
  43893. t.amacron = 444;
  43894. t.sacute = 389;
  43895. t.idieresis = 278;
  43896. t.Ocircumflex = 722;
  43897. t.Ugrave = 722;
  43898. t.Delta = 612;
  43899. t.thorn = 500;
  43900. t.twosuperior = 300;
  43901. t.Odieresis = 722;
  43902. t.mu = 500;
  43903. t.igrave = 278;
  43904. t.ohungarumlaut = 500;
  43905. t.Eogonek = 611;
  43906. t.dcroat = 500;
  43907. t.threequarters = 750;
  43908. t.Scedilla = 556;
  43909. t.lcaron = 344;
  43910. t.Kcommaaccent = 722;
  43911. t.Lacute = 611;
  43912. t.trademark = 980;
  43913. t.edotaccent = 444;
  43914. t.Igrave = 333;
  43915. t.Imacron = 333;
  43916. t.Lcaron = 611;
  43917. t.onehalf = 750;
  43918. t.lessequal = 549;
  43919. t.ocircumflex = 500;
  43920. t.ntilde = 500;
  43921. t.Uhungarumlaut = 722;
  43922. t.Eacute = 611;
  43923. t.emacron = 444;
  43924. t.gbreve = 500;
  43925. t.onequarter = 750;
  43926. t.Scaron = 556;
  43927. t.Scommaaccent = 556;
  43928. t.Ohungarumlaut = 722;
  43929. t.degree = 400;
  43930. t.ograve = 500;
  43931. t.Ccaron = 667;
  43932. t.ugrave = 500;
  43933. t.radical = 453;
  43934. t.Dcaron = 722;
  43935. t.rcommaaccent = 333;
  43936. t.Ntilde = 722;
  43937. t.otilde = 500;
  43938. t.Rcommaaccent = 667;
  43939. t.Lcommaaccent = 611;
  43940. t.Atilde = 722;
  43941. t.Aogonek = 722;
  43942. t.Aring = 722;
  43943. t.Otilde = 722;
  43944. t.zdotaccent = 444;
  43945. t.Ecaron = 611;
  43946. t.Iogonek = 333;
  43947. t.kcommaaccent = 500;
  43948. t.minus = 564;
  43949. t.Icircumflex = 333;
  43950. t.ncaron = 500;
  43951. t.tcommaaccent = 278;
  43952. t.logicalnot = 564;
  43953. t.odieresis = 500;
  43954. t.udieresis = 500;
  43955. t.notequal = 549;
  43956. t.gcommaaccent = 500;
  43957. t.eth = 500;
  43958. t.zcaron = 444;
  43959. t.ncommaaccent = 500;
  43960. t.onesuperior = 300;
  43961. t.imacron = 278;
  43962. t.Euro = 500;
  43963. });
  43964. t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43965. t.space = 250;
  43966. t.exclam = 333;
  43967. t.quotedbl = 555;
  43968. t.numbersign = 500;
  43969. t.dollar = 500;
  43970. t.percent = 1000;
  43971. t.ampersand = 833;
  43972. t.quoteright = 333;
  43973. t.parenleft = 333;
  43974. t.parenright = 333;
  43975. t.asterisk = 500;
  43976. t.plus = 570;
  43977. t.comma = 250;
  43978. t.hyphen = 333;
  43979. t.period = 250;
  43980. t.slash = 278;
  43981. t.zero = 500;
  43982. t.one = 500;
  43983. t.two = 500;
  43984. t.three = 500;
  43985. t.four = 500;
  43986. t.five = 500;
  43987. t.six = 500;
  43988. t.seven = 500;
  43989. t.eight = 500;
  43990. t.nine = 500;
  43991. t.colon = 333;
  43992. t.semicolon = 333;
  43993. t.less = 570;
  43994. t.equal = 570;
  43995. t.greater = 570;
  43996. t.question = 500;
  43997. t.at = 930;
  43998. t.A = 722;
  43999. t.B = 667;
  44000. t.C = 722;
  44001. t.D = 722;
  44002. t.E = 667;
  44003. t.F = 611;
  44004. t.G = 778;
  44005. t.H = 778;
  44006. t.I = 389;
  44007. t.J = 500;
  44008. t.K = 778;
  44009. t.L = 667;
  44010. t.M = 944;
  44011. t.N = 722;
  44012. t.O = 778;
  44013. t.P = 611;
  44014. t.Q = 778;
  44015. t.R = 722;
  44016. t.S = 556;
  44017. t.T = 667;
  44018. t.U = 722;
  44019. t.V = 722;
  44020. t.W = 1000;
  44021. t.X = 722;
  44022. t.Y = 722;
  44023. t.Z = 667;
  44024. t.bracketleft = 333;
  44025. t.backslash = 278;
  44026. t.bracketright = 333;
  44027. t.asciicircum = 581;
  44028. t.underscore = 500;
  44029. t.quoteleft = 333;
  44030. t.a = 500;
  44031. t.b = 556;
  44032. t.c = 444;
  44033. t.d = 556;
  44034. t.e = 444;
  44035. t.f = 333;
  44036. t.g = 500;
  44037. t.h = 556;
  44038. t.i = 278;
  44039. t.j = 333;
  44040. t.k = 556;
  44041. t.l = 278;
  44042. t.m = 833;
  44043. t.n = 556;
  44044. t.o = 500;
  44045. t.p = 556;
  44046. t.q = 556;
  44047. t.r = 444;
  44048. t.s = 389;
  44049. t.t = 333;
  44050. t.u = 556;
  44051. t.v = 500;
  44052. t.w = 722;
  44053. t.x = 500;
  44054. t.y = 500;
  44055. t.z = 444;
  44056. t.braceleft = 394;
  44057. t.bar = 220;
  44058. t.braceright = 394;
  44059. t.asciitilde = 520;
  44060. t.exclamdown = 333;
  44061. t.cent = 500;
  44062. t.sterling = 500;
  44063. t.fraction = 167;
  44064. t.yen = 500;
  44065. t.florin = 500;
  44066. t.section = 500;
  44067. t.currency = 500;
  44068. t.quotesingle = 278;
  44069. t.quotedblleft = 500;
  44070. t.guillemotleft = 500;
  44071. t.guilsinglleft = 333;
  44072. t.guilsinglright = 333;
  44073. t.fi = 556;
  44074. t.fl = 556;
  44075. t.endash = 500;
  44076. t.dagger = 500;
  44077. t.daggerdbl = 500;
  44078. t.periodcentered = 250;
  44079. t.paragraph = 540;
  44080. t.bullet = 350;
  44081. t.quotesinglbase = 333;
  44082. t.quotedblbase = 500;
  44083. t.quotedblright = 500;
  44084. t.guillemotright = 500;
  44085. t.ellipsis = 1000;
  44086. t.perthousand = 1000;
  44087. t.questiondown = 500;
  44088. t.grave = 333;
  44089. t.acute = 333;
  44090. t.circumflex = 333;
  44091. t.tilde = 333;
  44092. t.macron = 333;
  44093. t.breve = 333;
  44094. t.dotaccent = 333;
  44095. t.dieresis = 333;
  44096. t.ring = 333;
  44097. t.cedilla = 333;
  44098. t.hungarumlaut = 333;
  44099. t.ogonek = 333;
  44100. t.caron = 333;
  44101. t.emdash = 1000;
  44102. t.AE = 1000;
  44103. t.ordfeminine = 300;
  44104. t.Lslash = 667;
  44105. t.Oslash = 778;
  44106. t.OE = 1000;
  44107. t.ordmasculine = 330;
  44108. t.ae = 722;
  44109. t.dotlessi = 278;
  44110. t.lslash = 278;
  44111. t.oslash = 500;
  44112. t.oe = 722;
  44113. t.germandbls = 556;
  44114. t.Idieresis = 389;
  44115. t.eacute = 444;
  44116. t.abreve = 500;
  44117. t.uhungarumlaut = 556;
  44118. t.ecaron = 444;
  44119. t.Ydieresis = 722;
  44120. t.divide = 570;
  44121. t.Yacute = 722;
  44122. t.Acircumflex = 722;
  44123. t.aacute = 500;
  44124. t.Ucircumflex = 722;
  44125. t.yacute = 500;
  44126. t.scommaaccent = 389;
  44127. t.ecircumflex = 444;
  44128. t.Uring = 722;
  44129. t.Udieresis = 722;
  44130. t.aogonek = 500;
  44131. t.Uacute = 722;
  44132. t.uogonek = 556;
  44133. t.Edieresis = 667;
  44134. t.Dcroat = 722;
  44135. t.commaaccent = 250;
  44136. t.copyright = 747;
  44137. t.Emacron = 667;
  44138. t.ccaron = 444;
  44139. t.aring = 500;
  44140. t.Ncommaaccent = 722;
  44141. t.lacute = 278;
  44142. t.agrave = 500;
  44143. t.Tcommaaccent = 667;
  44144. t.Cacute = 722;
  44145. t.atilde = 500;
  44146. t.Edotaccent = 667;
  44147. t.scaron = 389;
  44148. t.scedilla = 389;
  44149. t.iacute = 278;
  44150. t.lozenge = 494;
  44151. t.Rcaron = 722;
  44152. t.Gcommaaccent = 778;
  44153. t.ucircumflex = 556;
  44154. t.acircumflex = 500;
  44155. t.Amacron = 722;
  44156. t.rcaron = 444;
  44157. t.ccedilla = 444;
  44158. t.Zdotaccent = 667;
  44159. t.Thorn = 611;
  44160. t.Omacron = 778;
  44161. t.Racute = 722;
  44162. t.Sacute = 556;
  44163. t.dcaron = 672;
  44164. t.Umacron = 722;
  44165. t.uring = 556;
  44166. t.threesuperior = 300;
  44167. t.Ograve = 778;
  44168. t.Agrave = 722;
  44169. t.Abreve = 722;
  44170. t.multiply = 570;
  44171. t.uacute = 556;
  44172. t.Tcaron = 667;
  44173. t.partialdiff = 494;
  44174. t.ydieresis = 500;
  44175. t.Nacute = 722;
  44176. t.icircumflex = 278;
  44177. t.Ecircumflex = 667;
  44178. t.adieresis = 500;
  44179. t.edieresis = 444;
  44180. t.cacute = 444;
  44181. t.nacute = 556;
  44182. t.umacron = 556;
  44183. t.Ncaron = 722;
  44184. t.Iacute = 389;
  44185. t.plusminus = 570;
  44186. t.brokenbar = 220;
  44187. t.registered = 747;
  44188. t.Gbreve = 778;
  44189. t.Idotaccent = 389;
  44190. t.summation = 600;
  44191. t.Egrave = 667;
  44192. t.racute = 444;
  44193. t.omacron = 500;
  44194. t.Zacute = 667;
  44195. t.Zcaron = 667;
  44196. t.greaterequal = 549;
  44197. t.Eth = 722;
  44198. t.Ccedilla = 722;
  44199. t.lcommaaccent = 278;
  44200. t.tcaron = 416;
  44201. t.eogonek = 444;
  44202. t.Uogonek = 722;
  44203. t.Aacute = 722;
  44204. t.Adieresis = 722;
  44205. t.egrave = 444;
  44206. t.zacute = 444;
  44207. t.iogonek = 278;
  44208. t.Oacute = 778;
  44209. t.oacute = 500;
  44210. t.amacron = 500;
  44211. t.sacute = 389;
  44212. t.idieresis = 278;
  44213. t.Ocircumflex = 778;
  44214. t.Ugrave = 722;
  44215. t.Delta = 612;
  44216. t.thorn = 556;
  44217. t.twosuperior = 300;
  44218. t.Odieresis = 778;
  44219. t.mu = 556;
  44220. t.igrave = 278;
  44221. t.ohungarumlaut = 500;
  44222. t.Eogonek = 667;
  44223. t.dcroat = 556;
  44224. t.threequarters = 750;
  44225. t.Scedilla = 556;
  44226. t.lcaron = 394;
  44227. t.Kcommaaccent = 778;
  44228. t.Lacute = 667;
  44229. t.trademark = 1000;
  44230. t.edotaccent = 444;
  44231. t.Igrave = 389;
  44232. t.Imacron = 389;
  44233. t.Lcaron = 667;
  44234. t.onehalf = 750;
  44235. t.lessequal = 549;
  44236. t.ocircumflex = 500;
  44237. t.ntilde = 556;
  44238. t.Uhungarumlaut = 722;
  44239. t.Eacute = 667;
  44240. t.emacron = 444;
  44241. t.gbreve = 500;
  44242. t.onequarter = 750;
  44243. t.Scaron = 556;
  44244. t.Scommaaccent = 556;
  44245. t.Ohungarumlaut = 778;
  44246. t.degree = 400;
  44247. t.ograve = 500;
  44248. t.Ccaron = 722;
  44249. t.ugrave = 556;
  44250. t.radical = 549;
  44251. t.Dcaron = 722;
  44252. t.rcommaaccent = 444;
  44253. t.Ntilde = 722;
  44254. t.otilde = 500;
  44255. t.Rcommaaccent = 722;
  44256. t.Lcommaaccent = 667;
  44257. t.Atilde = 722;
  44258. t.Aogonek = 722;
  44259. t.Aring = 722;
  44260. t.Otilde = 778;
  44261. t.zdotaccent = 444;
  44262. t.Ecaron = 667;
  44263. t.Iogonek = 389;
  44264. t.kcommaaccent = 556;
  44265. t.minus = 570;
  44266. t.Icircumflex = 389;
  44267. t.ncaron = 556;
  44268. t.tcommaaccent = 333;
  44269. t.logicalnot = 570;
  44270. t.odieresis = 500;
  44271. t.udieresis = 556;
  44272. t.notequal = 549;
  44273. t.gcommaaccent = 500;
  44274. t.eth = 500;
  44275. t.zcaron = 444;
  44276. t.ncommaaccent = 556;
  44277. t.onesuperior = 300;
  44278. t.imacron = 278;
  44279. t.Euro = 500;
  44280. });
  44281. t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  44282. t.space = 250;
  44283. t.exclam = 389;
  44284. t.quotedbl = 555;
  44285. t.numbersign = 500;
  44286. t.dollar = 500;
  44287. t.percent = 833;
  44288. t.ampersand = 778;
  44289. t.quoteright = 333;
  44290. t.parenleft = 333;
  44291. t.parenright = 333;
  44292. t.asterisk = 500;
  44293. t.plus = 570;
  44294. t.comma = 250;
  44295. t.hyphen = 333;
  44296. t.period = 250;
  44297. t.slash = 278;
  44298. t.zero = 500;
  44299. t.one = 500;
  44300. t.two = 500;
  44301. t.three = 500;
  44302. t.four = 500;
  44303. t.five = 500;
  44304. t.six = 500;
  44305. t.seven = 500;
  44306. t.eight = 500;
  44307. t.nine = 500;
  44308. t.colon = 333;
  44309. t.semicolon = 333;
  44310. t.less = 570;
  44311. t.equal = 570;
  44312. t.greater = 570;
  44313. t.question = 500;
  44314. t.at = 832;
  44315. t.A = 667;
  44316. t.B = 667;
  44317. t.C = 667;
  44318. t.D = 722;
  44319. t.E = 667;
  44320. t.F = 667;
  44321. t.G = 722;
  44322. t.H = 778;
  44323. t.I = 389;
  44324. t.J = 500;
  44325. t.K = 667;
  44326. t.L = 611;
  44327. t.M = 889;
  44328. t.N = 722;
  44329. t.O = 722;
  44330. t.P = 611;
  44331. t.Q = 722;
  44332. t.R = 667;
  44333. t.S = 556;
  44334. t.T = 611;
  44335. t.U = 722;
  44336. t.V = 667;
  44337. t.W = 889;
  44338. t.X = 667;
  44339. t.Y = 611;
  44340. t.Z = 611;
  44341. t.bracketleft = 333;
  44342. t.backslash = 278;
  44343. t.bracketright = 333;
  44344. t.asciicircum = 570;
  44345. t.underscore = 500;
  44346. t.quoteleft = 333;
  44347. t.a = 500;
  44348. t.b = 500;
  44349. t.c = 444;
  44350. t.d = 500;
  44351. t.e = 444;
  44352. t.f = 333;
  44353. t.g = 500;
  44354. t.h = 556;
  44355. t.i = 278;
  44356. t.j = 278;
  44357. t.k = 500;
  44358. t.l = 278;
  44359. t.m = 778;
  44360. t.n = 556;
  44361. t.o = 500;
  44362. t.p = 500;
  44363. t.q = 500;
  44364. t.r = 389;
  44365. t.s = 389;
  44366. t.t = 278;
  44367. t.u = 556;
  44368. t.v = 444;
  44369. t.w = 667;
  44370. t.x = 500;
  44371. t.y = 444;
  44372. t.z = 389;
  44373. t.braceleft = 348;
  44374. t.bar = 220;
  44375. t.braceright = 348;
  44376. t.asciitilde = 570;
  44377. t.exclamdown = 389;
  44378. t.cent = 500;
  44379. t.sterling = 500;
  44380. t.fraction = 167;
  44381. t.yen = 500;
  44382. t.florin = 500;
  44383. t.section = 500;
  44384. t.currency = 500;
  44385. t.quotesingle = 278;
  44386. t.quotedblleft = 500;
  44387. t.guillemotleft = 500;
  44388. t.guilsinglleft = 333;
  44389. t.guilsinglright = 333;
  44390. t.fi = 556;
  44391. t.fl = 556;
  44392. t.endash = 500;
  44393. t.dagger = 500;
  44394. t.daggerdbl = 500;
  44395. t.periodcentered = 250;
  44396. t.paragraph = 500;
  44397. t.bullet = 350;
  44398. t.quotesinglbase = 333;
  44399. t.quotedblbase = 500;
  44400. t.quotedblright = 500;
  44401. t.guillemotright = 500;
  44402. t.ellipsis = 1000;
  44403. t.perthousand = 1000;
  44404. t.questiondown = 500;
  44405. t.grave = 333;
  44406. t.acute = 333;
  44407. t.circumflex = 333;
  44408. t.tilde = 333;
  44409. t.macron = 333;
  44410. t.breve = 333;
  44411. t.dotaccent = 333;
  44412. t.dieresis = 333;
  44413. t.ring = 333;
  44414. t.cedilla = 333;
  44415. t.hungarumlaut = 333;
  44416. t.ogonek = 333;
  44417. t.caron = 333;
  44418. t.emdash = 1000;
  44419. t.AE = 944;
  44420. t.ordfeminine = 266;
  44421. t.Lslash = 611;
  44422. t.Oslash = 722;
  44423. t.OE = 944;
  44424. t.ordmasculine = 300;
  44425. t.ae = 722;
  44426. t.dotlessi = 278;
  44427. t.lslash = 278;
  44428. t.oslash = 500;
  44429. t.oe = 722;
  44430. t.germandbls = 500;
  44431. t.Idieresis = 389;
  44432. t.eacute = 444;
  44433. t.abreve = 500;
  44434. t.uhungarumlaut = 556;
  44435. t.ecaron = 444;
  44436. t.Ydieresis = 611;
  44437. t.divide = 570;
  44438. t.Yacute = 611;
  44439. t.Acircumflex = 667;
  44440. t.aacute = 500;
  44441. t.Ucircumflex = 722;
  44442. t.yacute = 444;
  44443. t.scommaaccent = 389;
  44444. t.ecircumflex = 444;
  44445. t.Uring = 722;
  44446. t.Udieresis = 722;
  44447. t.aogonek = 500;
  44448. t.Uacute = 722;
  44449. t.uogonek = 556;
  44450. t.Edieresis = 667;
  44451. t.Dcroat = 722;
  44452. t.commaaccent = 250;
  44453. t.copyright = 747;
  44454. t.Emacron = 667;
  44455. t.ccaron = 444;
  44456. t.aring = 500;
  44457. t.Ncommaaccent = 722;
  44458. t.lacute = 278;
  44459. t.agrave = 500;
  44460. t.Tcommaaccent = 611;
  44461. t.Cacute = 667;
  44462. t.atilde = 500;
  44463. t.Edotaccent = 667;
  44464. t.scaron = 389;
  44465. t.scedilla = 389;
  44466. t.iacute = 278;
  44467. t.lozenge = 494;
  44468. t.Rcaron = 667;
  44469. t.Gcommaaccent = 722;
  44470. t.ucircumflex = 556;
  44471. t.acircumflex = 500;
  44472. t.Amacron = 667;
  44473. t.rcaron = 389;
  44474. t.ccedilla = 444;
  44475. t.Zdotaccent = 611;
  44476. t.Thorn = 611;
  44477. t.Omacron = 722;
  44478. t.Racute = 667;
  44479. t.Sacute = 556;
  44480. t.dcaron = 608;
  44481. t.Umacron = 722;
  44482. t.uring = 556;
  44483. t.threesuperior = 300;
  44484. t.Ograve = 722;
  44485. t.Agrave = 667;
  44486. t.Abreve = 667;
  44487. t.multiply = 570;
  44488. t.uacute = 556;
  44489. t.Tcaron = 611;
  44490. t.partialdiff = 494;
  44491. t.ydieresis = 444;
  44492. t.Nacute = 722;
  44493. t.icircumflex = 278;
  44494. t.Ecircumflex = 667;
  44495. t.adieresis = 500;
  44496. t.edieresis = 444;
  44497. t.cacute = 444;
  44498. t.nacute = 556;
  44499. t.umacron = 556;
  44500. t.Ncaron = 722;
  44501. t.Iacute = 389;
  44502. t.plusminus = 570;
  44503. t.brokenbar = 220;
  44504. t.registered = 747;
  44505. t.Gbreve = 722;
  44506. t.Idotaccent = 389;
  44507. t.summation = 600;
  44508. t.Egrave = 667;
  44509. t.racute = 389;
  44510. t.omacron = 500;
  44511. t.Zacute = 611;
  44512. t.Zcaron = 611;
  44513. t.greaterequal = 549;
  44514. t.Eth = 722;
  44515. t.Ccedilla = 667;
  44516. t.lcommaaccent = 278;
  44517. t.tcaron = 366;
  44518. t.eogonek = 444;
  44519. t.Uogonek = 722;
  44520. t.Aacute = 667;
  44521. t.Adieresis = 667;
  44522. t.egrave = 444;
  44523. t.zacute = 389;
  44524. t.iogonek = 278;
  44525. t.Oacute = 722;
  44526. t.oacute = 500;
  44527. t.amacron = 500;
  44528. t.sacute = 389;
  44529. t.idieresis = 278;
  44530. t.Ocircumflex = 722;
  44531. t.Ugrave = 722;
  44532. t.Delta = 612;
  44533. t.thorn = 500;
  44534. t.twosuperior = 300;
  44535. t.Odieresis = 722;
  44536. t.mu = 576;
  44537. t.igrave = 278;
  44538. t.ohungarumlaut = 500;
  44539. t.Eogonek = 667;
  44540. t.dcroat = 500;
  44541. t.threequarters = 750;
  44542. t.Scedilla = 556;
  44543. t.lcaron = 382;
  44544. t.Kcommaaccent = 667;
  44545. t.Lacute = 611;
  44546. t.trademark = 1000;
  44547. t.edotaccent = 444;
  44548. t.Igrave = 389;
  44549. t.Imacron = 389;
  44550. t.Lcaron = 611;
  44551. t.onehalf = 750;
  44552. t.lessequal = 549;
  44553. t.ocircumflex = 500;
  44554. t.ntilde = 556;
  44555. t.Uhungarumlaut = 722;
  44556. t.Eacute = 667;
  44557. t.emacron = 444;
  44558. t.gbreve = 500;
  44559. t.onequarter = 750;
  44560. t.Scaron = 556;
  44561. t.Scommaaccent = 556;
  44562. t.Ohungarumlaut = 722;
  44563. t.degree = 400;
  44564. t.ograve = 500;
  44565. t.Ccaron = 667;
  44566. t.ugrave = 556;
  44567. t.radical = 549;
  44568. t.Dcaron = 722;
  44569. t.rcommaaccent = 389;
  44570. t.Ntilde = 722;
  44571. t.otilde = 500;
  44572. t.Rcommaaccent = 667;
  44573. t.Lcommaaccent = 611;
  44574. t.Atilde = 667;
  44575. t.Aogonek = 667;
  44576. t.Aring = 667;
  44577. t.Otilde = 722;
  44578. t.zdotaccent = 389;
  44579. t.Ecaron = 667;
  44580. t.Iogonek = 389;
  44581. t.kcommaaccent = 500;
  44582. t.minus = 606;
  44583. t.Icircumflex = 389;
  44584. t.ncaron = 556;
  44585. t.tcommaaccent = 278;
  44586. t.logicalnot = 606;
  44587. t.odieresis = 500;
  44588. t.udieresis = 556;
  44589. t.notequal = 549;
  44590. t.gcommaaccent = 500;
  44591. t.eth = 500;
  44592. t.zcaron = 389;
  44593. t.ncommaaccent = 556;
  44594. t.onesuperior = 300;
  44595. t.imacron = 278;
  44596. t.Euro = 500;
  44597. });
  44598. t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  44599. t.space = 250;
  44600. t.exclam = 333;
  44601. t.quotedbl = 420;
  44602. t.numbersign = 500;
  44603. t.dollar = 500;
  44604. t.percent = 833;
  44605. t.ampersand = 778;
  44606. t.quoteright = 333;
  44607. t.parenleft = 333;
  44608. t.parenright = 333;
  44609. t.asterisk = 500;
  44610. t.plus = 675;
  44611. t.comma = 250;
  44612. t.hyphen = 333;
  44613. t.period = 250;
  44614. t.slash = 278;
  44615. t.zero = 500;
  44616. t.one = 500;
  44617. t.two = 500;
  44618. t.three = 500;
  44619. t.four = 500;
  44620. t.five = 500;
  44621. t.six = 500;
  44622. t.seven = 500;
  44623. t.eight = 500;
  44624. t.nine = 500;
  44625. t.colon = 333;
  44626. t.semicolon = 333;
  44627. t.less = 675;
  44628. t.equal = 675;
  44629. t.greater = 675;
  44630. t.question = 500;
  44631. t.at = 920;
  44632. t.A = 611;
  44633. t.B = 611;
  44634. t.C = 667;
  44635. t.D = 722;
  44636. t.E = 611;
  44637. t.F = 611;
  44638. t.G = 722;
  44639. t.H = 722;
  44640. t.I = 333;
  44641. t.J = 444;
  44642. t.K = 667;
  44643. t.L = 556;
  44644. t.M = 833;
  44645. t.N = 667;
  44646. t.O = 722;
  44647. t.P = 611;
  44648. t.Q = 722;
  44649. t.R = 611;
  44650. t.S = 500;
  44651. t.T = 556;
  44652. t.U = 722;
  44653. t.V = 611;
  44654. t.W = 833;
  44655. t.X = 611;
  44656. t.Y = 556;
  44657. t.Z = 556;
  44658. t.bracketleft = 389;
  44659. t.backslash = 278;
  44660. t.bracketright = 389;
  44661. t.asciicircum = 422;
  44662. t.underscore = 500;
  44663. t.quoteleft = 333;
  44664. t.a = 500;
  44665. t.b = 500;
  44666. t.c = 444;
  44667. t.d = 500;
  44668. t.e = 444;
  44669. t.f = 278;
  44670. t.g = 500;
  44671. t.h = 500;
  44672. t.i = 278;
  44673. t.j = 278;
  44674. t.k = 444;
  44675. t.l = 278;
  44676. t.m = 722;
  44677. t.n = 500;
  44678. t.o = 500;
  44679. t.p = 500;
  44680. t.q = 500;
  44681. t.r = 389;
  44682. t.s = 389;
  44683. t.t = 278;
  44684. t.u = 500;
  44685. t.v = 444;
  44686. t.w = 667;
  44687. t.x = 444;
  44688. t.y = 444;
  44689. t.z = 389;
  44690. t.braceleft = 400;
  44691. t.bar = 275;
  44692. t.braceright = 400;
  44693. t.asciitilde = 541;
  44694. t.exclamdown = 389;
  44695. t.cent = 500;
  44696. t.sterling = 500;
  44697. t.fraction = 167;
  44698. t.yen = 500;
  44699. t.florin = 500;
  44700. t.section = 500;
  44701. t.currency = 500;
  44702. t.quotesingle = 214;
  44703. t.quotedblleft = 556;
  44704. t.guillemotleft = 500;
  44705. t.guilsinglleft = 333;
  44706. t.guilsinglright = 333;
  44707. t.fi = 500;
  44708. t.fl = 500;
  44709. t.endash = 500;
  44710. t.dagger = 500;
  44711. t.daggerdbl = 500;
  44712. t.periodcentered = 250;
  44713. t.paragraph = 523;
  44714. t.bullet = 350;
  44715. t.quotesinglbase = 333;
  44716. t.quotedblbase = 556;
  44717. t.quotedblright = 556;
  44718. t.guillemotright = 500;
  44719. t.ellipsis = 889;
  44720. t.perthousand = 1000;
  44721. t.questiondown = 500;
  44722. t.grave = 333;
  44723. t.acute = 333;
  44724. t.circumflex = 333;
  44725. t.tilde = 333;
  44726. t.macron = 333;
  44727. t.breve = 333;
  44728. t.dotaccent = 333;
  44729. t.dieresis = 333;
  44730. t.ring = 333;
  44731. t.cedilla = 333;
  44732. t.hungarumlaut = 333;
  44733. t.ogonek = 333;
  44734. t.caron = 333;
  44735. t.emdash = 889;
  44736. t.AE = 889;
  44737. t.ordfeminine = 276;
  44738. t.Lslash = 556;
  44739. t.Oslash = 722;
  44740. t.OE = 944;
  44741. t.ordmasculine = 310;
  44742. t.ae = 667;
  44743. t.dotlessi = 278;
  44744. t.lslash = 278;
  44745. t.oslash = 500;
  44746. t.oe = 667;
  44747. t.germandbls = 500;
  44748. t.Idieresis = 333;
  44749. t.eacute = 444;
  44750. t.abreve = 500;
  44751. t.uhungarumlaut = 500;
  44752. t.ecaron = 444;
  44753. t.Ydieresis = 556;
  44754. t.divide = 675;
  44755. t.Yacute = 556;
  44756. t.Acircumflex = 611;
  44757. t.aacute = 500;
  44758. t.Ucircumflex = 722;
  44759. t.yacute = 444;
  44760. t.scommaaccent = 389;
  44761. t.ecircumflex = 444;
  44762. t.Uring = 722;
  44763. t.Udieresis = 722;
  44764. t.aogonek = 500;
  44765. t.Uacute = 722;
  44766. t.uogonek = 500;
  44767. t.Edieresis = 611;
  44768. t.Dcroat = 722;
  44769. t.commaaccent = 250;
  44770. t.copyright = 760;
  44771. t.Emacron = 611;
  44772. t.ccaron = 444;
  44773. t.aring = 500;
  44774. t.Ncommaaccent = 667;
  44775. t.lacute = 278;
  44776. t.agrave = 500;
  44777. t.Tcommaaccent = 556;
  44778. t.Cacute = 667;
  44779. t.atilde = 500;
  44780. t.Edotaccent = 611;
  44781. t.scaron = 389;
  44782. t.scedilla = 389;
  44783. t.iacute = 278;
  44784. t.lozenge = 471;
  44785. t.Rcaron = 611;
  44786. t.Gcommaaccent = 722;
  44787. t.ucircumflex = 500;
  44788. t.acircumflex = 500;
  44789. t.Amacron = 611;
  44790. t.rcaron = 389;
  44791. t.ccedilla = 444;
  44792. t.Zdotaccent = 556;
  44793. t.Thorn = 611;
  44794. t.Omacron = 722;
  44795. t.Racute = 611;
  44796. t.Sacute = 500;
  44797. t.dcaron = 544;
  44798. t.Umacron = 722;
  44799. t.uring = 500;
  44800. t.threesuperior = 300;
  44801. t.Ograve = 722;
  44802. t.Agrave = 611;
  44803. t.Abreve = 611;
  44804. t.multiply = 675;
  44805. t.uacute = 500;
  44806. t.Tcaron = 556;
  44807. t.partialdiff = 476;
  44808. t.ydieresis = 444;
  44809. t.Nacute = 667;
  44810. t.icircumflex = 278;
  44811. t.Ecircumflex = 611;
  44812. t.adieresis = 500;
  44813. t.edieresis = 444;
  44814. t.cacute = 444;
  44815. t.nacute = 500;
  44816. t.umacron = 500;
  44817. t.Ncaron = 667;
  44818. t.Iacute = 333;
  44819. t.plusminus = 675;
  44820. t.brokenbar = 275;
  44821. t.registered = 760;
  44822. t.Gbreve = 722;
  44823. t.Idotaccent = 333;
  44824. t.summation = 600;
  44825. t.Egrave = 611;
  44826. t.racute = 389;
  44827. t.omacron = 500;
  44828. t.Zacute = 556;
  44829. t.Zcaron = 556;
  44830. t.greaterequal = 549;
  44831. t.Eth = 722;
  44832. t.Ccedilla = 667;
  44833. t.lcommaaccent = 278;
  44834. t.tcaron = 300;
  44835. t.eogonek = 444;
  44836. t.Uogonek = 722;
  44837. t.Aacute = 611;
  44838. t.Adieresis = 611;
  44839. t.egrave = 444;
  44840. t.zacute = 389;
  44841. t.iogonek = 278;
  44842. t.Oacute = 722;
  44843. t.oacute = 500;
  44844. t.amacron = 500;
  44845. t.sacute = 389;
  44846. t.idieresis = 278;
  44847. t.Ocircumflex = 722;
  44848. t.Ugrave = 722;
  44849. t.Delta = 612;
  44850. t.thorn = 500;
  44851. t.twosuperior = 300;
  44852. t.Odieresis = 722;
  44853. t.mu = 500;
  44854. t.igrave = 278;
  44855. t.ohungarumlaut = 500;
  44856. t.Eogonek = 611;
  44857. t.dcroat = 500;
  44858. t.threequarters = 750;
  44859. t.Scedilla = 500;
  44860. t.lcaron = 300;
  44861. t.Kcommaaccent = 667;
  44862. t.Lacute = 556;
  44863. t.trademark = 980;
  44864. t.edotaccent = 444;
  44865. t.Igrave = 333;
  44866. t.Imacron = 333;
  44867. t.Lcaron = 611;
  44868. t.onehalf = 750;
  44869. t.lessequal = 549;
  44870. t.ocircumflex = 500;
  44871. t.ntilde = 500;
  44872. t.Uhungarumlaut = 722;
  44873. t.Eacute = 611;
  44874. t.emacron = 444;
  44875. t.gbreve = 500;
  44876. t.onequarter = 750;
  44877. t.Scaron = 500;
  44878. t.Scommaaccent = 500;
  44879. t.Ohungarumlaut = 722;
  44880. t.degree = 400;
  44881. t.ograve = 500;
  44882. t.Ccaron = 667;
  44883. t.ugrave = 500;
  44884. t.radical = 453;
  44885. t.Dcaron = 722;
  44886. t.rcommaaccent = 389;
  44887. t.Ntilde = 667;
  44888. t.otilde = 500;
  44889. t.Rcommaaccent = 611;
  44890. t.Lcommaaccent = 556;
  44891. t.Atilde = 611;
  44892. t.Aogonek = 611;
  44893. t.Aring = 611;
  44894. t.Otilde = 722;
  44895. t.zdotaccent = 389;
  44896. t.Ecaron = 611;
  44897. t.Iogonek = 333;
  44898. t.kcommaaccent = 444;
  44899. t.minus = 675;
  44900. t.Icircumflex = 333;
  44901. t.ncaron = 500;
  44902. t.tcommaaccent = 278;
  44903. t.logicalnot = 675;
  44904. t.odieresis = 500;
  44905. t.udieresis = 500;
  44906. t.notequal = 549;
  44907. t.gcommaaccent = 500;
  44908. t.eth = 500;
  44909. t.zcaron = 389;
  44910. t.ncommaaccent = 500;
  44911. t.onesuperior = 300;
  44912. t.imacron = 278;
  44913. t.Euro = 500;
  44914. });
  44915. t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) {
  44916. t.space = 278;
  44917. t.a1 = 974;
  44918. t.a2 = 961;
  44919. t.a202 = 974;
  44920. t.a3 = 980;
  44921. t.a4 = 719;
  44922. t.a5 = 789;
  44923. t.a119 = 790;
  44924. t.a118 = 791;
  44925. t.a117 = 690;
  44926. t.a11 = 960;
  44927. t.a12 = 939;
  44928. t.a13 = 549;
  44929. t.a14 = 855;
  44930. t.a15 = 911;
  44931. t.a16 = 933;
  44932. t.a105 = 911;
  44933. t.a17 = 945;
  44934. t.a18 = 974;
  44935. t.a19 = 755;
  44936. t.a20 = 846;
  44937. t.a21 = 762;
  44938. t.a22 = 761;
  44939. t.a23 = 571;
  44940. t.a24 = 677;
  44941. t.a25 = 763;
  44942. t.a26 = 760;
  44943. t.a27 = 759;
  44944. t.a28 = 754;
  44945. t.a6 = 494;
  44946. t.a7 = 552;
  44947. t.a8 = 537;
  44948. t.a9 = 577;
  44949. t.a10 = 692;
  44950. t.a29 = 786;
  44951. t.a30 = 788;
  44952. t.a31 = 788;
  44953. t.a32 = 790;
  44954. t.a33 = 793;
  44955. t.a34 = 794;
  44956. t.a35 = 816;
  44957. t.a36 = 823;
  44958. t.a37 = 789;
  44959. t.a38 = 841;
  44960. t.a39 = 823;
  44961. t.a40 = 833;
  44962. t.a41 = 816;
  44963. t.a42 = 831;
  44964. t.a43 = 923;
  44965. t.a44 = 744;
  44966. t.a45 = 723;
  44967. t.a46 = 749;
  44968. t.a47 = 790;
  44969. t.a48 = 792;
  44970. t.a49 = 695;
  44971. t.a50 = 776;
  44972. t.a51 = 768;
  44973. t.a52 = 792;
  44974. t.a53 = 759;
  44975. t.a54 = 707;
  44976. t.a55 = 708;
  44977. t.a56 = 682;
  44978. t.a57 = 701;
  44979. t.a58 = 826;
  44980. t.a59 = 815;
  44981. t.a60 = 789;
  44982. t.a61 = 789;
  44983. t.a62 = 707;
  44984. t.a63 = 687;
  44985. t.a64 = 696;
  44986. t.a65 = 689;
  44987. t.a66 = 786;
  44988. t.a67 = 787;
  44989. t.a68 = 713;
  44990. t.a69 = 791;
  44991. t.a70 = 785;
  44992. t.a71 = 791;
  44993. t.a72 = 873;
  44994. t.a73 = 761;
  44995. t.a74 = 762;
  44996. t.a203 = 762;
  44997. t.a75 = 759;
  44998. t.a204 = 759;
  44999. t.a76 = 892;
  45000. t.a77 = 892;
  45001. t.a78 = 788;
  45002. t.a79 = 784;
  45003. t.a81 = 438;
  45004. t.a82 = 138;
  45005. t.a83 = 277;
  45006. t.a84 = 415;
  45007. t.a97 = 392;
  45008. t.a98 = 392;
  45009. t.a99 = 668;
  45010. t.a100 = 668;
  45011. t.a89 = 390;
  45012. t.a90 = 390;
  45013. t.a93 = 317;
  45014. t.a94 = 317;
  45015. t.a91 = 276;
  45016. t.a92 = 276;
  45017. t.a205 = 509;
  45018. t.a85 = 509;
  45019. t.a206 = 410;
  45020. t.a86 = 410;
  45021. t.a87 = 234;
  45022. t.a88 = 234;
  45023. t.a95 = 334;
  45024. t.a96 = 334;
  45025. t.a101 = 732;
  45026. t.a102 = 544;
  45027. t.a103 = 544;
  45028. t.a104 = 910;
  45029. t.a106 = 667;
  45030. t.a107 = 760;
  45031. t.a108 = 760;
  45032. t.a112 = 776;
  45033. t.a111 = 595;
  45034. t.a110 = 694;
  45035. t.a109 = 626;
  45036. t.a120 = 788;
  45037. t.a121 = 788;
  45038. t.a122 = 788;
  45039. t.a123 = 788;
  45040. t.a124 = 788;
  45041. t.a125 = 788;
  45042. t.a126 = 788;
  45043. t.a127 = 788;
  45044. t.a128 = 788;
  45045. t.a129 = 788;
  45046. t.a130 = 788;
  45047. t.a131 = 788;
  45048. t.a132 = 788;
  45049. t.a133 = 788;
  45050. t.a134 = 788;
  45051. t.a135 = 788;
  45052. t.a136 = 788;
  45053. t.a137 = 788;
  45054. t.a138 = 788;
  45055. t.a139 = 788;
  45056. t.a140 = 788;
  45057. t.a141 = 788;
  45058. t.a142 = 788;
  45059. t.a143 = 788;
  45060. t.a144 = 788;
  45061. t.a145 = 788;
  45062. t.a146 = 788;
  45063. t.a147 = 788;
  45064. t.a148 = 788;
  45065. t.a149 = 788;
  45066. t.a150 = 788;
  45067. t.a151 = 788;
  45068. t.a152 = 788;
  45069. t.a153 = 788;
  45070. t.a154 = 788;
  45071. t.a155 = 788;
  45072. t.a156 = 788;
  45073. t.a157 = 788;
  45074. t.a158 = 788;
  45075. t.a159 = 788;
  45076. t.a160 = 894;
  45077. t.a161 = 838;
  45078. t.a163 = 1016;
  45079. t.a164 = 458;
  45080. t.a196 = 748;
  45081. t.a165 = 924;
  45082. t.a192 = 748;
  45083. t.a166 = 918;
  45084. t.a167 = 927;
  45085. t.a168 = 928;
  45086. t.a169 = 928;
  45087. t.a170 = 834;
  45088. t.a171 = 873;
  45089. t.a172 = 828;
  45090. t.a173 = 924;
  45091. t.a162 = 924;
  45092. t.a174 = 917;
  45093. t.a175 = 930;
  45094. t.a176 = 931;
  45095. t.a177 = 463;
  45096. t.a178 = 883;
  45097. t.a179 = 836;
  45098. t.a193 = 836;
  45099. t.a180 = 867;
  45100. t.a199 = 867;
  45101. t.a181 = 696;
  45102. t.a200 = 696;
  45103. t.a182 = 874;
  45104. t.a201 = 874;
  45105. t.a183 = 760;
  45106. t.a184 = 946;
  45107. t.a197 = 771;
  45108. t.a185 = 865;
  45109. t.a194 = 771;
  45110. t.a198 = 888;
  45111. t.a186 = 967;
  45112. t.a195 = 888;
  45113. t.a187 = 831;
  45114. t.a188 = 873;
  45115. t.a189 = 927;
  45116. t.a190 = 970;
  45117. t.a191 = 918;
  45118. });
  45119. });
  45120. exports.getMetrics = getMetrics;
  45121. const getFontBasicMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  45122. t.Courier = {
  45123. ascent: 629,
  45124. descent: -157,
  45125. capHeight: 562,
  45126. xHeight: -426
  45127. };
  45128. t["Courier-Bold"] = {
  45129. ascent: 629,
  45130. descent: -157,
  45131. capHeight: 562,
  45132. xHeight: 439
  45133. };
  45134. t["Courier-Oblique"] = {
  45135. ascent: 629,
  45136. descent: -157,
  45137. capHeight: 562,
  45138. xHeight: 426
  45139. };
  45140. t["Courier-BoldOblique"] = {
  45141. ascent: 629,
  45142. descent: -157,
  45143. capHeight: 562,
  45144. xHeight: 426
  45145. };
  45146. t.Helvetica = {
  45147. ascent: 718,
  45148. descent: -207,
  45149. capHeight: 718,
  45150. xHeight: 523
  45151. };
  45152. t["Helvetica-Bold"] = {
  45153. ascent: 718,
  45154. descent: -207,
  45155. capHeight: 718,
  45156. xHeight: 532
  45157. };
  45158. t["Helvetica-Oblique"] = {
  45159. ascent: 718,
  45160. descent: -207,
  45161. capHeight: 718,
  45162. xHeight: 523
  45163. };
  45164. t["Helvetica-BoldOblique"] = {
  45165. ascent: 718,
  45166. descent: -207,
  45167. capHeight: 718,
  45168. xHeight: 532
  45169. };
  45170. t["Times-Roman"] = {
  45171. ascent: 683,
  45172. descent: -217,
  45173. capHeight: 662,
  45174. xHeight: 450
  45175. };
  45176. t["Times-Bold"] = {
  45177. ascent: 683,
  45178. descent: -217,
  45179. capHeight: 676,
  45180. xHeight: 461
  45181. };
  45182. t["Times-Italic"] = {
  45183. ascent: 683,
  45184. descent: -217,
  45185. capHeight: 653,
  45186. xHeight: 441
  45187. };
  45188. t["Times-BoldItalic"] = {
  45189. ascent: 683,
  45190. descent: -217,
  45191. capHeight: 669,
  45192. xHeight: 462
  45193. };
  45194. t.Symbol = {
  45195. ascent: Math.NaN,
  45196. descent: Math.NaN,
  45197. capHeight: Math.NaN,
  45198. xHeight: Math.NaN
  45199. };
  45200. t.ZapfDingbats = {
  45201. ascent: Math.NaN,
  45202. descent: Math.NaN,
  45203. capHeight: Math.NaN,
  45204. xHeight: Math.NaN
  45205. };
  45206. });
  45207. exports.getFontBasicMetrics = getFontBasicMetrics;
  45208. /***/ }),
  45209. /* 177 */
  45210. /***/ ((__unused_webpack_module, exports) => {
  45211. "use strict";
  45212. Object.defineProperty(exports, "__esModule", ({
  45213. value: true
  45214. }));
  45215. exports.GlyfTable = void 0;
  45216. const ON_CURVE_POINT = 1 << 0;
  45217. const X_SHORT_VECTOR = 1 << 1;
  45218. const Y_SHORT_VECTOR = 1 << 2;
  45219. const REPEAT_FLAG = 1 << 3;
  45220. const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4;
  45221. const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5;
  45222. const OVERLAP_SIMPLE = 1 << 6;
  45223. const ARG_1_AND_2_ARE_WORDS = 1 << 0;
  45224. const ARGS_ARE_XY_VALUES = 1 << 1;
  45225. const WE_HAVE_A_SCALE = 1 << 3;
  45226. const MORE_COMPONENTS = 1 << 5;
  45227. const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6;
  45228. const WE_HAVE_A_TWO_BY_TWO = 1 << 7;
  45229. const WE_HAVE_INSTRUCTIONS = 1 << 8;
  45230. class GlyfTable {
  45231. constructor(_ref) {
  45232. let {
  45233. glyfTable,
  45234. isGlyphLocationsLong,
  45235. locaTable,
  45236. numGlyphs
  45237. } = _ref;
  45238. this.glyphs = [];
  45239. const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength);
  45240. const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength);
  45241. const offsetSize = isGlyphLocationsLong ? 4 : 2;
  45242. let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0);
  45243. let pos = 0;
  45244. for (let i = 0; i < numGlyphs; i++) {
  45245. pos += offsetSize;
  45246. const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos);
  45247. if (next === prev) {
  45248. this.glyphs.push(new Glyph({}));
  45249. continue;
  45250. }
  45251. const glyph = Glyph.parse(prev, glyf);
  45252. this.glyphs.push(glyph);
  45253. prev = next;
  45254. }
  45255. }
  45256. getSize() {
  45257. return this.glyphs.reduce((a, g) => {
  45258. const size = g.getSize();
  45259. return a + (size + 3 & ~3);
  45260. }, 0);
  45261. }
  45262. write() {
  45263. const totalSize = this.getSize();
  45264. const glyfTable = new DataView(new ArrayBuffer(totalSize));
  45265. const isLocationLong = totalSize > 0x1fffe;
  45266. const offsetSize = isLocationLong ? 4 : 2;
  45267. const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize));
  45268. if (isLocationLong) {
  45269. locaTable.setUint32(0, 0);
  45270. } else {
  45271. locaTable.setUint16(0, 0);
  45272. }
  45273. let pos = 0;
  45274. let locaIndex = 0;
  45275. for (const glyph of this.glyphs) {
  45276. pos += glyph.write(pos, glyfTable);
  45277. pos = pos + 3 & ~3;
  45278. locaIndex += offsetSize;
  45279. if (isLocationLong) {
  45280. locaTable.setUint32(locaIndex, pos);
  45281. } else {
  45282. locaTable.setUint16(locaIndex, pos >> 1);
  45283. }
  45284. }
  45285. return {
  45286. isLocationLong,
  45287. loca: new Uint8Array(locaTable.buffer),
  45288. glyf: new Uint8Array(glyfTable.buffer)
  45289. };
  45290. }
  45291. scale(factors) {
  45292. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  45293. this.glyphs[i].scale(factors[i]);
  45294. }
  45295. }
  45296. }
  45297. exports.GlyfTable = GlyfTable;
  45298. class Glyph {
  45299. constructor(_ref2) {
  45300. let {
  45301. header = null,
  45302. simple = null,
  45303. composites = null
  45304. } = _ref2;
  45305. this.header = header;
  45306. this.simple = simple;
  45307. this.composites = composites;
  45308. }
  45309. static parse(pos, glyf) {
  45310. const [read, header] = GlyphHeader.parse(pos, glyf);
  45311. pos += read;
  45312. if (header.numberOfContours < 0) {
  45313. const composites = [];
  45314. while (true) {
  45315. const [n, composite] = CompositeGlyph.parse(pos, glyf);
  45316. pos += n;
  45317. composites.push(composite);
  45318. if (!(composite.flags & MORE_COMPONENTS)) {
  45319. break;
  45320. }
  45321. }
  45322. return new Glyph({
  45323. header,
  45324. composites
  45325. });
  45326. }
  45327. const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours);
  45328. return new Glyph({
  45329. header,
  45330. simple
  45331. });
  45332. }
  45333. getSize() {
  45334. if (!this.header) {
  45335. return 0;
  45336. }
  45337. const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0);
  45338. return this.header.getSize() + size;
  45339. }
  45340. write(pos, buf) {
  45341. if (!this.header) {
  45342. return 0;
  45343. }
  45344. const spos = pos;
  45345. pos += this.header.write(pos, buf);
  45346. if (this.simple) {
  45347. pos += this.simple.write(pos, buf);
  45348. } else {
  45349. for (const composite of this.composites) {
  45350. pos += composite.write(pos, buf);
  45351. }
  45352. }
  45353. return pos - spos;
  45354. }
  45355. scale(factor) {
  45356. if (!this.header) {
  45357. return;
  45358. }
  45359. const xMiddle = (this.header.xMin + this.header.xMax) / 2;
  45360. this.header.scale(xMiddle, factor);
  45361. if (this.simple) {
  45362. this.simple.scale(xMiddle, factor);
  45363. } else {
  45364. for (const composite of this.composites) {
  45365. composite.scale(xMiddle, factor);
  45366. }
  45367. }
  45368. }
  45369. }
  45370. class GlyphHeader {
  45371. constructor(_ref3) {
  45372. let {
  45373. numberOfContours,
  45374. xMin,
  45375. yMin,
  45376. xMax,
  45377. yMax
  45378. } = _ref3;
  45379. this.numberOfContours = numberOfContours;
  45380. this.xMin = xMin;
  45381. this.yMin = yMin;
  45382. this.xMax = xMax;
  45383. this.yMax = yMax;
  45384. }
  45385. static parse(pos, glyf) {
  45386. return [10, new GlyphHeader({
  45387. numberOfContours: glyf.getInt16(pos),
  45388. xMin: glyf.getInt16(pos + 2),
  45389. yMin: glyf.getInt16(pos + 4),
  45390. xMax: glyf.getInt16(pos + 6),
  45391. yMax: glyf.getInt16(pos + 8)
  45392. })];
  45393. }
  45394. getSize() {
  45395. return 10;
  45396. }
  45397. write(pos, buf) {
  45398. buf.setInt16(pos, this.numberOfContours);
  45399. buf.setInt16(pos + 2, this.xMin);
  45400. buf.setInt16(pos + 4, this.yMin);
  45401. buf.setInt16(pos + 6, this.xMax);
  45402. buf.setInt16(pos + 8, this.yMax);
  45403. return 10;
  45404. }
  45405. scale(x, factor) {
  45406. this.xMin = Math.round(x + (this.xMin - x) * factor);
  45407. this.xMax = Math.round(x + (this.xMax - x) * factor);
  45408. }
  45409. }
  45410. class Contour {
  45411. constructor(_ref4) {
  45412. let {
  45413. flags,
  45414. xCoordinates,
  45415. yCoordinates
  45416. } = _ref4;
  45417. this.xCoordinates = xCoordinates;
  45418. this.yCoordinates = yCoordinates;
  45419. this.flags = flags;
  45420. }
  45421. }
  45422. class SimpleGlyph {
  45423. constructor(_ref5) {
  45424. let {
  45425. contours,
  45426. instructions
  45427. } = _ref5;
  45428. this.contours = contours;
  45429. this.instructions = instructions;
  45430. }
  45431. static parse(pos, glyf, numberOfContours) {
  45432. const endPtsOfContours = [];
  45433. for (let i = 0; i < numberOfContours; i++) {
  45434. const endPt = glyf.getUint16(pos);
  45435. pos += 2;
  45436. endPtsOfContours.push(endPt);
  45437. }
  45438. const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1;
  45439. const instructionLength = glyf.getUint16(pos);
  45440. pos += 2;
  45441. const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  45442. pos += instructionLength;
  45443. const flags = [];
  45444. for (let i = 0; i < numberOfPt; pos++, i++) {
  45445. let flag = glyf.getUint8(pos);
  45446. flags.push(flag);
  45447. if (flag & REPEAT_FLAG) {
  45448. const count = glyf.getUint8(++pos);
  45449. flag ^= REPEAT_FLAG;
  45450. for (let m = 0; m < count; m++) {
  45451. flags.push(flag);
  45452. }
  45453. i += count;
  45454. }
  45455. }
  45456. const allXCoordinates = [];
  45457. let xCoordinates = [];
  45458. let yCoordinates = [];
  45459. let pointFlags = [];
  45460. const contours = [];
  45461. let endPtsOfContoursIndex = 0;
  45462. let lastCoordinate = 0;
  45463. for (let i = 0; i < numberOfPt; i++) {
  45464. const flag = flags[i];
  45465. if (flag & X_SHORT_VECTOR) {
  45466. const x = glyf.getUint8(pos++);
  45467. lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x;
  45468. xCoordinates.push(lastCoordinate);
  45469. } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) {
  45470. xCoordinates.push(lastCoordinate);
  45471. } else {
  45472. lastCoordinate += glyf.getInt16(pos);
  45473. pos += 2;
  45474. xCoordinates.push(lastCoordinate);
  45475. }
  45476. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  45477. endPtsOfContoursIndex++;
  45478. allXCoordinates.push(xCoordinates);
  45479. xCoordinates = [];
  45480. }
  45481. }
  45482. lastCoordinate = 0;
  45483. endPtsOfContoursIndex = 0;
  45484. for (let i = 0; i < numberOfPt; i++) {
  45485. const flag = flags[i];
  45486. if (flag & Y_SHORT_VECTOR) {
  45487. const y = glyf.getUint8(pos++);
  45488. lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y;
  45489. yCoordinates.push(lastCoordinate);
  45490. } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) {
  45491. yCoordinates.push(lastCoordinate);
  45492. } else {
  45493. lastCoordinate += glyf.getInt16(pos);
  45494. pos += 2;
  45495. yCoordinates.push(lastCoordinate);
  45496. }
  45497. pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE);
  45498. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  45499. xCoordinates = allXCoordinates[endPtsOfContoursIndex];
  45500. endPtsOfContoursIndex++;
  45501. contours.push(new Contour({
  45502. flags: pointFlags,
  45503. xCoordinates,
  45504. yCoordinates
  45505. }));
  45506. yCoordinates = [];
  45507. pointFlags = [];
  45508. }
  45509. }
  45510. return new SimpleGlyph({
  45511. contours,
  45512. instructions
  45513. });
  45514. }
  45515. getSize() {
  45516. let size = this.contours.length * 2 + 2 + this.instructions.length;
  45517. let lastX = 0;
  45518. let lastY = 0;
  45519. for (const contour of this.contours) {
  45520. size += contour.flags.length;
  45521. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  45522. const x = contour.xCoordinates[i];
  45523. const y = contour.yCoordinates[i];
  45524. let abs = Math.abs(x - lastX);
  45525. if (abs > 255) {
  45526. size += 2;
  45527. } else if (abs > 0) {
  45528. size += 1;
  45529. }
  45530. lastX = x;
  45531. abs = Math.abs(y - lastY);
  45532. if (abs > 255) {
  45533. size += 2;
  45534. } else if (abs > 0) {
  45535. size += 1;
  45536. }
  45537. lastY = y;
  45538. }
  45539. }
  45540. return size;
  45541. }
  45542. write(pos, buf) {
  45543. const spos = pos;
  45544. const xCoordinates = [];
  45545. const yCoordinates = [];
  45546. const flags = [];
  45547. let lastX = 0;
  45548. let lastY = 0;
  45549. for (const contour of this.contours) {
  45550. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  45551. let flag = contour.flags[i];
  45552. const x = contour.xCoordinates[i];
  45553. let delta = x - lastX;
  45554. if (delta === 0) {
  45555. flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR;
  45556. xCoordinates.push(0);
  45557. } else {
  45558. const abs = Math.abs(delta);
  45559. if (abs <= 255) {
  45560. flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR;
  45561. xCoordinates.push(abs);
  45562. } else {
  45563. xCoordinates.push(delta);
  45564. }
  45565. }
  45566. lastX = x;
  45567. const y = contour.yCoordinates[i];
  45568. delta = y - lastY;
  45569. if (delta === 0) {
  45570. flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR;
  45571. yCoordinates.push(0);
  45572. } else {
  45573. const abs = Math.abs(delta);
  45574. if (abs <= 255) {
  45575. flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR;
  45576. yCoordinates.push(abs);
  45577. } else {
  45578. yCoordinates.push(delta);
  45579. }
  45580. }
  45581. lastY = y;
  45582. flags.push(flag);
  45583. }
  45584. buf.setUint16(pos, xCoordinates.length - 1);
  45585. pos += 2;
  45586. }
  45587. buf.setUint16(pos, this.instructions.length);
  45588. pos += 2;
  45589. if (this.instructions.length) {
  45590. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  45591. pos += this.instructions.length;
  45592. }
  45593. for (const flag of flags) {
  45594. buf.setUint8(pos++, flag);
  45595. }
  45596. for (let i = 0, ii = xCoordinates.length; i < ii; i++) {
  45597. const x = xCoordinates[i];
  45598. const flag = flags[i];
  45599. if (flag & X_SHORT_VECTOR) {
  45600. buf.setUint8(pos++, x);
  45601. } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) {
  45602. buf.setInt16(pos, x);
  45603. pos += 2;
  45604. }
  45605. }
  45606. for (let i = 0, ii = yCoordinates.length; i < ii; i++) {
  45607. const y = yCoordinates[i];
  45608. const flag = flags[i];
  45609. if (flag & Y_SHORT_VECTOR) {
  45610. buf.setUint8(pos++, y);
  45611. } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) {
  45612. buf.setInt16(pos, y);
  45613. pos += 2;
  45614. }
  45615. }
  45616. return pos - spos;
  45617. }
  45618. scale(x, factor) {
  45619. for (const contour of this.contours) {
  45620. if (contour.xCoordinates.length === 0) {
  45621. continue;
  45622. }
  45623. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  45624. contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor);
  45625. }
  45626. }
  45627. }
  45628. }
  45629. class CompositeGlyph {
  45630. constructor(_ref6) {
  45631. let {
  45632. flags,
  45633. glyphIndex,
  45634. argument1,
  45635. argument2,
  45636. transf,
  45637. instructions
  45638. } = _ref6;
  45639. this.flags = flags;
  45640. this.glyphIndex = glyphIndex;
  45641. this.argument1 = argument1;
  45642. this.argument2 = argument2;
  45643. this.transf = transf;
  45644. this.instructions = instructions;
  45645. }
  45646. static parse(pos, glyf) {
  45647. const spos = pos;
  45648. const transf = [];
  45649. let flags = glyf.getUint16(pos);
  45650. const glyphIndex = glyf.getUint16(pos + 2);
  45651. pos += 4;
  45652. let argument1, argument2;
  45653. if (flags & ARG_1_AND_2_ARE_WORDS) {
  45654. if (flags & ARGS_ARE_XY_VALUES) {
  45655. argument1 = glyf.getInt16(pos);
  45656. argument2 = glyf.getInt16(pos + 2);
  45657. } else {
  45658. argument1 = glyf.getUint16(pos);
  45659. argument2 = glyf.getUint16(pos + 2);
  45660. }
  45661. pos += 4;
  45662. flags ^= ARG_1_AND_2_ARE_WORDS;
  45663. } else {
  45664. if (flags & ARGS_ARE_XY_VALUES) {
  45665. argument1 = glyf.getInt8(pos);
  45666. argument2 = glyf.getInt8(pos + 1);
  45667. } else {
  45668. argument1 = glyf.getUint8(pos);
  45669. argument2 = glyf.getUint8(pos + 1);
  45670. }
  45671. pos += 2;
  45672. }
  45673. if (flags & WE_HAVE_A_SCALE) {
  45674. transf.push(glyf.getUint16(pos));
  45675. pos += 2;
  45676. } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
  45677. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2));
  45678. pos += 4;
  45679. } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
  45680. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6));
  45681. pos += 8;
  45682. }
  45683. let instructions = null;
  45684. if (flags & WE_HAVE_INSTRUCTIONS) {
  45685. const instructionLength = glyf.getUint16(pos);
  45686. pos += 2;
  45687. instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  45688. pos += instructionLength;
  45689. }
  45690. return [pos - spos, new CompositeGlyph({
  45691. flags,
  45692. glyphIndex,
  45693. argument1,
  45694. argument2,
  45695. transf,
  45696. instructions
  45697. })];
  45698. }
  45699. getSize() {
  45700. let size = 2 + 2 + this.transf.length * 2;
  45701. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  45702. size += 2 + this.instructions.length;
  45703. }
  45704. size += 2;
  45705. if (this.flags & 2) {
  45706. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  45707. size += 2;
  45708. }
  45709. } else {
  45710. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  45711. size += 2;
  45712. }
  45713. }
  45714. return size;
  45715. }
  45716. write(pos, buf) {
  45717. const spos = pos;
  45718. if (this.flags & ARGS_ARE_XY_VALUES) {
  45719. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  45720. this.flags |= ARG_1_AND_2_ARE_WORDS;
  45721. }
  45722. } else {
  45723. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  45724. this.flags |= ARG_1_AND_2_ARE_WORDS;
  45725. }
  45726. }
  45727. buf.setUint16(pos, this.flags);
  45728. buf.setUint16(pos + 2, this.glyphIndex);
  45729. pos += 4;
  45730. if (this.flags & ARG_1_AND_2_ARE_WORDS) {
  45731. if (this.flags & ARGS_ARE_XY_VALUES) {
  45732. buf.setInt16(pos, this.argument1);
  45733. buf.setInt16(pos + 2, this.argument2);
  45734. } else {
  45735. buf.setUint16(pos, this.argument1);
  45736. buf.setUint16(pos + 2, this.argument2);
  45737. }
  45738. pos += 4;
  45739. } else {
  45740. buf.setUint8(pos, this.argument1);
  45741. buf.setUint8(pos + 1, this.argument2);
  45742. pos += 2;
  45743. }
  45744. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  45745. buf.setUint16(pos, this.instructions.length);
  45746. pos += 2;
  45747. if (this.instructions.length) {
  45748. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  45749. pos += this.instructions.length;
  45750. }
  45751. }
  45752. return pos - spos;
  45753. }
  45754. scale(x, factor) {}
  45755. }
  45756. /***/ }),
  45757. /* 178 */
  45758. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45759. "use strict";
  45760. Object.defineProperty(exports, "__esModule", ({
  45761. value: true
  45762. }));
  45763. exports.OpenTypeFileBuilder = void 0;
  45764. var _core_utils = __w_pdfjs_require__(136);
  45765. var _util = __w_pdfjs_require__(2);
  45766. function writeInt16(dest, offset, num) {
  45767. dest[offset] = num >> 8 & 0xff;
  45768. dest[offset + 1] = num & 0xff;
  45769. }
  45770. function writeInt32(dest, offset, num) {
  45771. dest[offset] = num >> 24 & 0xff;
  45772. dest[offset + 1] = num >> 16 & 0xff;
  45773. dest[offset + 2] = num >> 8 & 0xff;
  45774. dest[offset + 3] = num & 0xff;
  45775. }
  45776. function writeData(dest, offset, data) {
  45777. if (data instanceof Uint8Array) {
  45778. dest.set(data, offset);
  45779. } else if (typeof data === "string") {
  45780. for (let i = 0, ii = data.length; i < ii; i++) {
  45781. dest[offset++] = data.charCodeAt(i) & 0xff;
  45782. }
  45783. } else {
  45784. for (const num of data) {
  45785. dest[offset++] = num & 0xff;
  45786. }
  45787. }
  45788. }
  45789. const OTF_HEADER_SIZE = 12;
  45790. const OTF_TABLE_ENTRY_SIZE = 16;
  45791. class OpenTypeFileBuilder {
  45792. constructor(sfnt) {
  45793. this.sfnt = sfnt;
  45794. this.tables = Object.create(null);
  45795. }
  45796. static getSearchParams(entriesCount, entrySize) {
  45797. let maxPower2 = 1,
  45798. log2 = 0;
  45799. while ((maxPower2 ^ entriesCount) > maxPower2) {
  45800. maxPower2 <<= 1;
  45801. log2++;
  45802. }
  45803. const searchRange = maxPower2 * entrySize;
  45804. return {
  45805. range: searchRange,
  45806. entry: log2,
  45807. rangeShift: entrySize * entriesCount - searchRange
  45808. };
  45809. }
  45810. toArray() {
  45811. let sfnt = this.sfnt;
  45812. const tables = this.tables;
  45813. const tablesNames = Object.keys(tables);
  45814. tablesNames.sort();
  45815. const numTables = tablesNames.length;
  45816. let i, j, jj, table, tableName;
  45817. let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  45818. const tableOffsets = [offset];
  45819. for (i = 0; i < numTables; i++) {
  45820. table = tables[tablesNames[i]];
  45821. const paddedLength = (table.length + 3 & ~3) >>> 0;
  45822. offset += paddedLength;
  45823. tableOffsets.push(offset);
  45824. }
  45825. const file = new Uint8Array(offset);
  45826. for (i = 0; i < numTables; i++) {
  45827. table = tables[tablesNames[i]];
  45828. writeData(file, tableOffsets[i], table);
  45829. }
  45830. if (sfnt === "true") {
  45831. sfnt = (0, _util.string32)(0x00010000);
  45832. }
  45833. file[0] = sfnt.charCodeAt(0) & 0xff;
  45834. file[1] = sfnt.charCodeAt(1) & 0xff;
  45835. file[2] = sfnt.charCodeAt(2) & 0xff;
  45836. file[3] = sfnt.charCodeAt(3) & 0xff;
  45837. writeInt16(file, 4, numTables);
  45838. const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  45839. writeInt16(file, 6, searchParams.range);
  45840. writeInt16(file, 8, searchParams.entry);
  45841. writeInt16(file, 10, searchParams.rangeShift);
  45842. offset = OTF_HEADER_SIZE;
  45843. for (i = 0; i < numTables; i++) {
  45844. tableName = tablesNames[i];
  45845. file[offset] = tableName.charCodeAt(0) & 0xff;
  45846. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  45847. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  45848. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  45849. let checksum = 0;
  45850. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  45851. const quad = (0, _core_utils.readUint32)(file, j);
  45852. checksum = checksum + quad >>> 0;
  45853. }
  45854. writeInt32(file, offset + 4, checksum);
  45855. writeInt32(file, offset + 8, tableOffsets[i]);
  45856. writeInt32(file, offset + 12, tables[tableName].length);
  45857. offset += OTF_TABLE_ENTRY_SIZE;
  45858. }
  45859. return file;
  45860. }
  45861. addTable(tag, data) {
  45862. if (tag in this.tables) {
  45863. throw new Error("Table " + tag + " already exists");
  45864. }
  45865. this.tables[tag] = data;
  45866. }
  45867. }
  45868. exports.OpenTypeFileBuilder = OpenTypeFileBuilder;
  45869. /***/ }),
  45870. /* 179 */
  45871. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45872. "use strict";
  45873. Object.defineProperty(exports, "__esModule", ({
  45874. value: true
  45875. }));
  45876. exports.Type1Font = void 0;
  45877. var _cff_parser = __w_pdfjs_require__(166);
  45878. var _util = __w_pdfjs_require__(2);
  45879. var _fonts_utils = __w_pdfjs_require__(169);
  45880. var _core_utils = __w_pdfjs_require__(136);
  45881. var _stream = __w_pdfjs_require__(141);
  45882. var _type1_parser = __w_pdfjs_require__(180);
  45883. function findBlock(streamBytes, signature, startIndex) {
  45884. const streamBytesLength = streamBytes.length;
  45885. const signatureLength = signature.length;
  45886. const scanLength = streamBytesLength - signatureLength;
  45887. let i = startIndex,
  45888. found = false;
  45889. while (i < scanLength) {
  45890. let j = 0;
  45891. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  45892. j++;
  45893. }
  45894. if (j >= signatureLength) {
  45895. i += j;
  45896. while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) {
  45897. i++;
  45898. }
  45899. found = true;
  45900. break;
  45901. }
  45902. i++;
  45903. }
  45904. return {
  45905. found,
  45906. length: i
  45907. };
  45908. }
  45909. function getHeaderBlock(stream, suggestedLength) {
  45910. const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  45911. const streamStartPos = stream.pos;
  45912. let headerBytes, headerBytesLength, block;
  45913. try {
  45914. headerBytes = stream.getBytes(suggestedLength);
  45915. headerBytesLength = headerBytes.length;
  45916. } catch (ex) {}
  45917. if (headerBytesLength === suggestedLength) {
  45918. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  45919. if (block.found && block.length === suggestedLength) {
  45920. return {
  45921. stream: new _stream.Stream(headerBytes),
  45922. length: suggestedLength
  45923. };
  45924. }
  45925. }
  45926. (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
  45927. stream.pos = streamStartPos;
  45928. const SCAN_BLOCK_LENGTH = 2048;
  45929. let actualLength;
  45930. while (true) {
  45931. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  45932. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  45933. if (block.length === 0) {
  45934. break;
  45935. }
  45936. stream.pos += block.length;
  45937. if (block.found) {
  45938. actualLength = stream.pos - streamStartPos;
  45939. break;
  45940. }
  45941. }
  45942. stream.pos = streamStartPos;
  45943. if (actualLength) {
  45944. return {
  45945. stream: new _stream.Stream(stream.getBytes(actualLength)),
  45946. length: actualLength
  45947. };
  45948. }
  45949. (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
  45950. return {
  45951. stream: new _stream.Stream(stream.getBytes(suggestedLength)),
  45952. length: suggestedLength
  45953. };
  45954. }
  45955. function getEexecBlock(stream, suggestedLength) {
  45956. const eexecBytes = stream.getBytes();
  45957. if (eexecBytes.length === 0) {
  45958. throw new _util.FormatError("getEexecBlock - no font program found.");
  45959. }
  45960. return {
  45961. stream: new _stream.Stream(eexecBytes),
  45962. length: eexecBytes.length
  45963. };
  45964. }
  45965. class Type1Font {
  45966. constructor(name, file, properties) {
  45967. const PFB_HEADER_SIZE = 6;
  45968. let headerBlockLength = properties.length1;
  45969. let eexecBlockLength = properties.length2;
  45970. let pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  45971. const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  45972. if (pfbHeaderPresent) {
  45973. file.skip(PFB_HEADER_SIZE);
  45974. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  45975. }
  45976. const headerBlock = getHeaderBlock(file, headerBlockLength);
  45977. const headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  45978. headerBlockParser.extractFontHeader(properties);
  45979. if (pfbHeaderPresent) {
  45980. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  45981. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  45982. }
  45983. const eexecBlock = getEexecBlock(file, eexecBlockLength);
  45984. const eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  45985. const data = eexecBlockParser.extractFontProgram(properties);
  45986. for (const key in data.properties) {
  45987. properties[key] = data.properties[key];
  45988. }
  45989. const charstrings = data.charstrings;
  45990. const type2Charstrings = this.getType2Charstrings(charstrings);
  45991. const subrs = this.getType2Subrs(data.subrs);
  45992. this.charstrings = charstrings;
  45993. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  45994. this.seacs = this.getSeacs(data.charstrings);
  45995. }
  45996. get numGlyphs() {
  45997. return this.charstrings.length + 1;
  45998. }
  45999. getCharset() {
  46000. const charset = [".notdef"];
  46001. for (const {
  46002. glyphName
  46003. } of this.charstrings) {
  46004. charset.push(glyphName);
  46005. }
  46006. return charset;
  46007. }
  46008. getGlyphMapping(properties) {
  46009. const charstrings = this.charstrings;
  46010. if (properties.composite) {
  46011. const charCodeToGlyphId = Object.create(null);
  46012. for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
  46013. const charCode = properties.cMap.charCodeOf(glyphId);
  46014. charCodeToGlyphId[charCode] = glyphId + 1;
  46015. }
  46016. return charCodeToGlyphId;
  46017. }
  46018. const glyphNames = [".notdef"];
  46019. let builtInEncoding, glyphId;
  46020. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  46021. glyphNames.push(charstrings[glyphId].glyphName);
  46022. }
  46023. const encoding = properties.builtInEncoding;
  46024. if (encoding) {
  46025. builtInEncoding = Object.create(null);
  46026. for (const charCode in encoding) {
  46027. glyphId = glyphNames.indexOf(encoding[charCode]);
  46028. if (glyphId >= 0) {
  46029. builtInEncoding[charCode] = glyphId;
  46030. }
  46031. }
  46032. }
  46033. return (0, _fonts_utils.type1FontGlyphMapping)(properties, builtInEncoding, glyphNames);
  46034. }
  46035. hasGlyphId(id) {
  46036. if (id < 0 || id >= this.numGlyphs) {
  46037. return false;
  46038. }
  46039. if (id === 0) {
  46040. return true;
  46041. }
  46042. const glyph = this.charstrings[id - 1];
  46043. return glyph.charstring.length > 0;
  46044. }
  46045. getSeacs(charstrings) {
  46046. const seacMap = [];
  46047. for (let i = 0, ii = charstrings.length; i < ii; i++) {
  46048. const charstring = charstrings[i];
  46049. if (charstring.seac) {
  46050. seacMap[i + 1] = charstring.seac;
  46051. }
  46052. }
  46053. return seacMap;
  46054. }
  46055. getType2Charstrings(type1Charstrings) {
  46056. const type2Charstrings = [];
  46057. for (const type1Charstring of type1Charstrings) {
  46058. type2Charstrings.push(type1Charstring.charstring);
  46059. }
  46060. return type2Charstrings;
  46061. }
  46062. getType2Subrs(type1Subrs) {
  46063. let bias = 0;
  46064. const count = type1Subrs.length;
  46065. if (count < 1133) {
  46066. bias = 107;
  46067. } else if (count < 33769) {
  46068. bias = 1131;
  46069. } else {
  46070. bias = 32768;
  46071. }
  46072. const type2Subrs = [];
  46073. let i;
  46074. for (i = 0; i < bias; i++) {
  46075. type2Subrs.push([0x0b]);
  46076. }
  46077. for (i = 0; i < count; i++) {
  46078. type2Subrs.push(type1Subrs[i]);
  46079. }
  46080. return type2Subrs;
  46081. }
  46082. wrap(name, glyphs, charstrings, subrs, properties) {
  46083. const cff = new _cff_parser.CFF();
  46084. cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
  46085. cff.names = [name];
  46086. const topDict = new _cff_parser.CFFTopDict();
  46087. topDict.setByName("version", 391);
  46088. topDict.setByName("Notice", 392);
  46089. topDict.setByName("FullName", 393);
  46090. topDict.setByName("FamilyName", 394);
  46091. topDict.setByName("Weight", 395);
  46092. topDict.setByName("Encoding", null);
  46093. topDict.setByName("FontMatrix", properties.fontMatrix);
  46094. topDict.setByName("FontBBox", properties.bbox);
  46095. topDict.setByName("charset", null);
  46096. topDict.setByName("CharStrings", null);
  46097. topDict.setByName("Private", null);
  46098. cff.topDict = topDict;
  46099. const strings = new _cff_parser.CFFStrings();
  46100. strings.add("Version 0.11");
  46101. strings.add("See original notice");
  46102. strings.add(name);
  46103. strings.add(name);
  46104. strings.add("Medium");
  46105. cff.strings = strings;
  46106. cff.globalSubrIndex = new _cff_parser.CFFIndex();
  46107. const count = glyphs.length;
  46108. const charsetArray = [".notdef"];
  46109. let i, ii;
  46110. for (i = 0; i < count; i++) {
  46111. const glyphName = charstrings[i].glyphName;
  46112. const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
  46113. if (index === -1) {
  46114. strings.add(glyphName);
  46115. }
  46116. charsetArray.push(glyphName);
  46117. }
  46118. cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
  46119. const charStringsIndex = new _cff_parser.CFFIndex();
  46120. charStringsIndex.add([0x8b, 0x0e]);
  46121. for (i = 0; i < count; i++) {
  46122. charStringsIndex.add(glyphs[i]);
  46123. }
  46124. cff.charStrings = charStringsIndex;
  46125. const privateDict = new _cff_parser.CFFPrivateDict();
  46126. privateDict.setByName("Subrs", null);
  46127. const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
  46128. for (i = 0, ii = fields.length; i < ii; i++) {
  46129. const field = fields[i];
  46130. if (!(field in properties.privateData)) {
  46131. continue;
  46132. }
  46133. const value = properties.privateData[field];
  46134. if (Array.isArray(value)) {
  46135. for (let j = value.length - 1; j > 0; j--) {
  46136. value[j] -= value[j - 1];
  46137. }
  46138. }
  46139. privateDict.setByName(field, value);
  46140. }
  46141. cff.topDict.privateDict = privateDict;
  46142. const subrIndex = new _cff_parser.CFFIndex();
  46143. for (i = 0, ii = subrs.length; i < ii; i++) {
  46144. subrIndex.add(subrs[i]);
  46145. }
  46146. privateDict.subrsIndex = subrIndex;
  46147. const compiler = new _cff_parser.CFFCompiler(cff);
  46148. return compiler.compile();
  46149. }
  46150. }
  46151. exports.Type1Font = Type1Font;
  46152. /***/ }),
  46153. /* 180 */
  46154. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46155. "use strict";
  46156. Object.defineProperty(exports, "__esModule", ({
  46157. value: true
  46158. }));
  46159. exports.Type1Parser = void 0;
  46160. var _encodings = __w_pdfjs_require__(168);
  46161. var _core_utils = __w_pdfjs_require__(136);
  46162. var _stream = __w_pdfjs_require__(141);
  46163. var _util = __w_pdfjs_require__(2);
  46164. const HINTING_ENABLED = false;
  46165. const COMMAND_MAP = {
  46166. hstem: [1],
  46167. vstem: [3],
  46168. vmoveto: [4],
  46169. rlineto: [5],
  46170. hlineto: [6],
  46171. vlineto: [7],
  46172. rrcurveto: [8],
  46173. callsubr: [10],
  46174. flex: [12, 35],
  46175. drop: [12, 18],
  46176. endchar: [14],
  46177. rmoveto: [21],
  46178. hmoveto: [22],
  46179. vhcurveto: [30],
  46180. hvcurveto: [31]
  46181. };
  46182. class Type1CharString {
  46183. constructor() {
  46184. this.width = 0;
  46185. this.lsb = 0;
  46186. this.flexing = false;
  46187. this.output = [];
  46188. this.stack = [];
  46189. }
  46190. convert(encoded, subrs, seacAnalysisEnabled) {
  46191. const count = encoded.length;
  46192. let error = false;
  46193. let wx, sbx, subrNumber;
  46194. for (let i = 0; i < count; i++) {
  46195. let value = encoded[i];
  46196. if (value < 32) {
  46197. if (value === 12) {
  46198. value = (value << 8) + encoded[++i];
  46199. }
  46200. switch (value) {
  46201. case 1:
  46202. if (!HINTING_ENABLED) {
  46203. this.stack = [];
  46204. break;
  46205. }
  46206. error = this.executeCommand(2, COMMAND_MAP.hstem);
  46207. break;
  46208. case 3:
  46209. if (!HINTING_ENABLED) {
  46210. this.stack = [];
  46211. break;
  46212. }
  46213. error = this.executeCommand(2, COMMAND_MAP.vstem);
  46214. break;
  46215. case 4:
  46216. if (this.flexing) {
  46217. if (this.stack.length < 1) {
  46218. error = true;
  46219. break;
  46220. }
  46221. const dy = this.stack.pop();
  46222. this.stack.push(0, dy);
  46223. break;
  46224. }
  46225. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  46226. break;
  46227. case 5:
  46228. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  46229. break;
  46230. case 6:
  46231. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  46232. break;
  46233. case 7:
  46234. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  46235. break;
  46236. case 8:
  46237. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  46238. break;
  46239. case 9:
  46240. this.stack = [];
  46241. break;
  46242. case 10:
  46243. if (this.stack.length < 1) {
  46244. error = true;
  46245. break;
  46246. }
  46247. subrNumber = this.stack.pop();
  46248. if (!subrs[subrNumber]) {
  46249. error = true;
  46250. break;
  46251. }
  46252. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  46253. break;
  46254. case 11:
  46255. return error;
  46256. case 13:
  46257. if (this.stack.length < 2) {
  46258. error = true;
  46259. break;
  46260. }
  46261. wx = this.stack.pop();
  46262. sbx = this.stack.pop();
  46263. this.lsb = sbx;
  46264. this.width = wx;
  46265. this.stack.push(wx, sbx);
  46266. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  46267. break;
  46268. case 14:
  46269. this.output.push(COMMAND_MAP.endchar[0]);
  46270. break;
  46271. case 21:
  46272. if (this.flexing) {
  46273. break;
  46274. }
  46275. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  46276. break;
  46277. case 22:
  46278. if (this.flexing) {
  46279. this.stack.push(0);
  46280. break;
  46281. }
  46282. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  46283. break;
  46284. case 30:
  46285. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  46286. break;
  46287. case 31:
  46288. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  46289. break;
  46290. case (12 << 8) + 0:
  46291. this.stack = [];
  46292. break;
  46293. case (12 << 8) + 1:
  46294. if (!HINTING_ENABLED) {
  46295. this.stack = [];
  46296. break;
  46297. }
  46298. error = this.executeCommand(2, COMMAND_MAP.vstem);
  46299. break;
  46300. case (12 << 8) + 2:
  46301. if (!HINTING_ENABLED) {
  46302. this.stack = [];
  46303. break;
  46304. }
  46305. error = this.executeCommand(2, COMMAND_MAP.hstem);
  46306. break;
  46307. case (12 << 8) + 6:
  46308. if (seacAnalysisEnabled) {
  46309. const asb = this.stack.at(-5);
  46310. this.seac = this.stack.splice(-4, 4);
  46311. this.seac[0] += this.lsb - asb;
  46312. error = this.executeCommand(0, COMMAND_MAP.endchar);
  46313. } else {
  46314. error = this.executeCommand(4, COMMAND_MAP.endchar);
  46315. }
  46316. break;
  46317. case (12 << 8) + 7:
  46318. if (this.stack.length < 4) {
  46319. error = true;
  46320. break;
  46321. }
  46322. this.stack.pop();
  46323. wx = this.stack.pop();
  46324. const sby = this.stack.pop();
  46325. sbx = this.stack.pop();
  46326. this.lsb = sbx;
  46327. this.width = wx;
  46328. this.stack.push(wx, sbx, sby);
  46329. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  46330. break;
  46331. case (12 << 8) + 12:
  46332. if (this.stack.length < 2) {
  46333. error = true;
  46334. break;
  46335. }
  46336. const num2 = this.stack.pop();
  46337. const num1 = this.stack.pop();
  46338. this.stack.push(num1 / num2);
  46339. break;
  46340. case (12 << 8) + 16:
  46341. if (this.stack.length < 2) {
  46342. error = true;
  46343. break;
  46344. }
  46345. subrNumber = this.stack.pop();
  46346. const numArgs = this.stack.pop();
  46347. if (subrNumber === 0 && numArgs === 3) {
  46348. const flexArgs = this.stack.splice(this.stack.length - 17, 17);
  46349. 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]);
  46350. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  46351. this.flexing = false;
  46352. this.stack.push(flexArgs[15], flexArgs[16]);
  46353. } else if (subrNumber === 1 && numArgs === 0) {
  46354. this.flexing = true;
  46355. }
  46356. break;
  46357. case (12 << 8) + 17:
  46358. break;
  46359. case (12 << 8) + 33:
  46360. this.stack = [];
  46361. break;
  46362. default:
  46363. (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
  46364. break;
  46365. }
  46366. if (error) {
  46367. break;
  46368. }
  46369. continue;
  46370. } else if (value <= 246) {
  46371. value -= 139;
  46372. } else if (value <= 250) {
  46373. value = (value - 247) * 256 + encoded[++i] + 108;
  46374. } else if (value <= 254) {
  46375. value = -((value - 251) * 256) - encoded[++i] - 108;
  46376. } else {
  46377. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  46378. }
  46379. this.stack.push(value);
  46380. }
  46381. return error;
  46382. }
  46383. executeCommand(howManyArgs, command, keepStack) {
  46384. const stackLength = this.stack.length;
  46385. if (howManyArgs > stackLength) {
  46386. return true;
  46387. }
  46388. const start = stackLength - howManyArgs;
  46389. for (let i = start; i < stackLength; i++) {
  46390. let value = this.stack[i];
  46391. if (Number.isInteger(value)) {
  46392. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  46393. } else {
  46394. value = 65536 * value | 0;
  46395. this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  46396. }
  46397. }
  46398. this.output.push(...command);
  46399. if (keepStack) {
  46400. this.stack.splice(start, howManyArgs);
  46401. } else {
  46402. this.stack.length = 0;
  46403. }
  46404. return false;
  46405. }
  46406. }
  46407. const EEXEC_ENCRYPT_KEY = 55665;
  46408. const CHAR_STRS_ENCRYPT_KEY = 4330;
  46409. function isHexDigit(code) {
  46410. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  46411. }
  46412. function decrypt(data, key, discardNumber) {
  46413. if (discardNumber >= data.length) {
  46414. return new Uint8Array(0);
  46415. }
  46416. const c1 = 52845,
  46417. c2 = 22719;
  46418. let r = key | 0,
  46419. i,
  46420. j;
  46421. for (i = 0; i < discardNumber; i++) {
  46422. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  46423. }
  46424. const count = data.length - discardNumber;
  46425. const decrypted = new Uint8Array(count);
  46426. for (i = discardNumber, j = 0; j < count; i++, j++) {
  46427. const value = data[i];
  46428. decrypted[j] = value ^ r >> 8;
  46429. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  46430. }
  46431. return decrypted;
  46432. }
  46433. function decryptAscii(data, key, discardNumber) {
  46434. const c1 = 52845,
  46435. c2 = 22719;
  46436. let r = key | 0;
  46437. const count = data.length,
  46438. maybeLength = count >>> 1;
  46439. const decrypted = new Uint8Array(maybeLength);
  46440. let i, j;
  46441. for (i = 0, j = 0; i < count; i++) {
  46442. const digit1 = data[i];
  46443. if (!isHexDigit(digit1)) {
  46444. continue;
  46445. }
  46446. i++;
  46447. let digit2;
  46448. while (i < count && !isHexDigit(digit2 = data[i])) {
  46449. i++;
  46450. }
  46451. if (i < count) {
  46452. const value = parseInt(String.fromCharCode(digit1, digit2), 16);
  46453. decrypted[j++] = value ^ r >> 8;
  46454. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  46455. }
  46456. }
  46457. return decrypted.slice(discardNumber, j);
  46458. }
  46459. function isSpecial(c) {
  46460. return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
  46461. }
  46462. class Type1Parser {
  46463. constructor(stream, encrypted, seacAnalysisEnabled) {
  46464. if (encrypted) {
  46465. const data = stream.getBytes();
  46466. 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]));
  46467. stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  46468. }
  46469. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  46470. this.stream = stream;
  46471. this.nextChar();
  46472. }
  46473. readNumberArray() {
  46474. this.getToken();
  46475. const array = [];
  46476. while (true) {
  46477. const token = this.getToken();
  46478. if (token === null || token === "]" || token === "}") {
  46479. break;
  46480. }
  46481. array.push(parseFloat(token || 0));
  46482. }
  46483. return array;
  46484. }
  46485. readNumber() {
  46486. const token = this.getToken();
  46487. return parseFloat(token || 0);
  46488. }
  46489. readInt() {
  46490. const token = this.getToken();
  46491. return parseInt(token || 0, 10) | 0;
  46492. }
  46493. readBoolean() {
  46494. const token = this.getToken();
  46495. return token === "true" ? 1 : 0;
  46496. }
  46497. nextChar() {
  46498. return this.currentChar = this.stream.getByte();
  46499. }
  46500. prevChar() {
  46501. this.stream.skip(-2);
  46502. return this.currentChar = this.stream.getByte();
  46503. }
  46504. getToken() {
  46505. let comment = false;
  46506. let ch = this.currentChar;
  46507. while (true) {
  46508. if (ch === -1) {
  46509. return null;
  46510. }
  46511. if (comment) {
  46512. if (ch === 0x0a || ch === 0x0d) {
  46513. comment = false;
  46514. }
  46515. } else if (ch === 0x25) {
  46516. comment = true;
  46517. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  46518. break;
  46519. }
  46520. ch = this.nextChar();
  46521. }
  46522. if (isSpecial(ch)) {
  46523. this.nextChar();
  46524. return String.fromCharCode(ch);
  46525. }
  46526. let token = "";
  46527. do {
  46528. token += String.fromCharCode(ch);
  46529. ch = this.nextChar();
  46530. } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch));
  46531. return token;
  46532. }
  46533. readCharStrings(bytes, lenIV) {
  46534. if (lenIV === -1) {
  46535. return bytes;
  46536. }
  46537. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  46538. }
  46539. extractFontProgram(properties) {
  46540. const stream = this.stream;
  46541. const subrs = [],
  46542. charstrings = [];
  46543. const privateData = Object.create(null);
  46544. privateData.lenIV = 4;
  46545. const program = {
  46546. subrs: [],
  46547. charstrings: [],
  46548. properties: {
  46549. privateData
  46550. }
  46551. };
  46552. let token, length, data, lenIV;
  46553. while ((token = this.getToken()) !== null) {
  46554. if (token !== "/") {
  46555. continue;
  46556. }
  46557. token = this.getToken();
  46558. switch (token) {
  46559. case "CharStrings":
  46560. this.getToken();
  46561. this.getToken();
  46562. this.getToken();
  46563. this.getToken();
  46564. while (true) {
  46565. token = this.getToken();
  46566. if (token === null || token === "end") {
  46567. break;
  46568. }
  46569. if (token !== "/") {
  46570. continue;
  46571. }
  46572. const glyph = this.getToken();
  46573. length = this.readInt();
  46574. this.getToken();
  46575. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  46576. lenIV = program.properties.privateData.lenIV;
  46577. const encoded = this.readCharStrings(data, lenIV);
  46578. this.nextChar();
  46579. token = this.getToken();
  46580. if (token === "noaccess") {
  46581. this.getToken();
  46582. } else if (token === "/") {
  46583. this.prevChar();
  46584. }
  46585. charstrings.push({
  46586. glyph,
  46587. encoded
  46588. });
  46589. }
  46590. break;
  46591. case "Subrs":
  46592. this.readInt();
  46593. this.getToken();
  46594. while (this.getToken() === "dup") {
  46595. const index = this.readInt();
  46596. length = this.readInt();
  46597. this.getToken();
  46598. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  46599. lenIV = program.properties.privateData.lenIV;
  46600. const encoded = this.readCharStrings(data, lenIV);
  46601. this.nextChar();
  46602. token = this.getToken();
  46603. if (token === "noaccess") {
  46604. this.getToken();
  46605. }
  46606. subrs[index] = encoded;
  46607. }
  46608. break;
  46609. case "BlueValues":
  46610. case "OtherBlues":
  46611. case "FamilyBlues":
  46612. case "FamilyOtherBlues":
  46613. const blueArray = this.readNumberArray();
  46614. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  46615. program.properties.privateData[token] = blueArray;
  46616. }
  46617. break;
  46618. case "StemSnapH":
  46619. case "StemSnapV":
  46620. program.properties.privateData[token] = this.readNumberArray();
  46621. break;
  46622. case "StdHW":
  46623. case "StdVW":
  46624. program.properties.privateData[token] = this.readNumberArray()[0];
  46625. break;
  46626. case "BlueShift":
  46627. case "lenIV":
  46628. case "BlueFuzz":
  46629. case "BlueScale":
  46630. case "LanguageGroup":
  46631. program.properties.privateData[token] = this.readNumber();
  46632. break;
  46633. case "ExpansionFactor":
  46634. program.properties.privateData[token] = this.readNumber() || 0.06;
  46635. break;
  46636. case "ForceBold":
  46637. program.properties.privateData[token] = this.readBoolean();
  46638. break;
  46639. }
  46640. }
  46641. for (const {
  46642. encoded,
  46643. glyph
  46644. } of charstrings) {
  46645. const charString = new Type1CharString();
  46646. const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  46647. let output = charString.output;
  46648. if (error) {
  46649. output = [14];
  46650. }
  46651. const charStringObject = {
  46652. glyphName: glyph,
  46653. charstring: output,
  46654. width: charString.width,
  46655. lsb: charString.lsb,
  46656. seac: charString.seac
  46657. };
  46658. if (glyph === ".notdef") {
  46659. program.charstrings.unshift(charStringObject);
  46660. } else {
  46661. program.charstrings.push(charStringObject);
  46662. }
  46663. if (properties.builtInEncoding) {
  46664. const index = properties.builtInEncoding.indexOf(glyph);
  46665. if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
  46666. properties.widths[index] = charString.width;
  46667. }
  46668. }
  46669. }
  46670. return program;
  46671. }
  46672. extractFontHeader(properties) {
  46673. let token;
  46674. while ((token = this.getToken()) !== null) {
  46675. if (token !== "/") {
  46676. continue;
  46677. }
  46678. token = this.getToken();
  46679. switch (token) {
  46680. case "FontMatrix":
  46681. const matrix = this.readNumberArray();
  46682. properties.fontMatrix = matrix;
  46683. break;
  46684. case "Encoding":
  46685. const encodingArg = this.getToken();
  46686. let encoding;
  46687. if (!/^\d+$/.test(encodingArg)) {
  46688. encoding = (0, _encodings.getEncoding)(encodingArg);
  46689. } else {
  46690. encoding = [];
  46691. const size = parseInt(encodingArg, 10) | 0;
  46692. this.getToken();
  46693. for (let j = 0; j < size; j++) {
  46694. token = this.getToken();
  46695. while (token !== "dup" && token !== "def") {
  46696. token = this.getToken();
  46697. if (token === null) {
  46698. return;
  46699. }
  46700. }
  46701. if (token === "def") {
  46702. break;
  46703. }
  46704. const index = this.readInt();
  46705. this.getToken();
  46706. const glyph = this.getToken();
  46707. encoding[index] = glyph;
  46708. this.getToken();
  46709. }
  46710. }
  46711. properties.builtInEncoding = encoding;
  46712. break;
  46713. case "FontBBox":
  46714. const fontBBox = this.readNumberArray();
  46715. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  46716. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  46717. properties.ascentScaled = true;
  46718. break;
  46719. }
  46720. }
  46721. }
  46722. }
  46723. exports.Type1Parser = Type1Parser;
  46724. /***/ }),
  46725. /* 181 */
  46726. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46727. "use strict";
  46728. Object.defineProperty(exports, "__esModule", ({
  46729. value: true
  46730. }));
  46731. exports.Pattern = void 0;
  46732. exports.getTilingPatternIR = getTilingPatternIR;
  46733. var _util = __w_pdfjs_require__(2);
  46734. var _base_stream = __w_pdfjs_require__(138);
  46735. var _colorspace = __w_pdfjs_require__(145);
  46736. var _core_utils = __w_pdfjs_require__(136);
  46737. const ShadingType = {
  46738. FUNCTION_BASED: 1,
  46739. AXIAL: 2,
  46740. RADIAL: 3,
  46741. FREE_FORM_MESH: 4,
  46742. LATTICE_FORM_MESH: 5,
  46743. COONS_PATCH_MESH: 6,
  46744. TENSOR_PATCH_MESH: 7
  46745. };
  46746. class Pattern {
  46747. constructor() {
  46748. (0, _util.unreachable)("Cannot initialize Pattern.");
  46749. }
  46750. static parseShading(shading, xref, res, handler, pdfFunctionFactory, localColorSpaceCache) {
  46751. const dict = shading instanceof _base_stream.BaseStream ? shading.dict : shading;
  46752. const type = dict.get("ShadingType");
  46753. try {
  46754. switch (type) {
  46755. case ShadingType.AXIAL:
  46756. case ShadingType.RADIAL:
  46757. return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, localColorSpaceCache);
  46758. case ShadingType.FREE_FORM_MESH:
  46759. case ShadingType.LATTICE_FORM_MESH:
  46760. case ShadingType.COONS_PATCH_MESH:
  46761. case ShadingType.TENSOR_PATCH_MESH:
  46762. return new MeshShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache);
  46763. default:
  46764. throw new _util.FormatError("Unsupported ShadingType: " + type);
  46765. }
  46766. } catch (ex) {
  46767. if (ex instanceof _core_utils.MissingDataException) {
  46768. throw ex;
  46769. }
  46770. handler.send("UnsupportedFeature", {
  46771. featureId: _util.UNSUPPORTED_FEATURES.shadingPattern
  46772. });
  46773. (0, _util.warn)(ex);
  46774. return new DummyShading();
  46775. }
  46776. }
  46777. }
  46778. exports.Pattern = Pattern;
  46779. class BaseShading {
  46780. static get SMALL_NUMBER() {
  46781. return (0, _util.shadow)(this, "SMALL_NUMBER", 1e-6);
  46782. }
  46783. constructor() {
  46784. if (this.constructor === BaseShading) {
  46785. (0, _util.unreachable)("Cannot initialize BaseShading.");
  46786. }
  46787. }
  46788. getIR() {
  46789. (0, _util.unreachable)("Abstract method `getIR` called.");
  46790. }
  46791. }
  46792. class RadialAxialShading extends BaseShading {
  46793. constructor(dict, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  46794. super();
  46795. this.coordsArr = dict.getArray("Coords");
  46796. this.shadingType = dict.get("ShadingType");
  46797. const cs = _colorspace.ColorSpace.parse({
  46798. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  46799. xref,
  46800. resources,
  46801. pdfFunctionFactory,
  46802. localColorSpaceCache
  46803. });
  46804. const bbox = dict.getArray("BBox");
  46805. if (Array.isArray(bbox) && bbox.length === 4) {
  46806. this.bbox = _util.Util.normalizeRect(bbox);
  46807. } else {
  46808. this.bbox = null;
  46809. }
  46810. let t0 = 0.0,
  46811. t1 = 1.0;
  46812. if (dict.has("Domain")) {
  46813. const domainArr = dict.getArray("Domain");
  46814. t0 = domainArr[0];
  46815. t1 = domainArr[1];
  46816. }
  46817. let extendStart = false,
  46818. extendEnd = false;
  46819. if (dict.has("Extend")) {
  46820. const extendArr = dict.getArray("Extend");
  46821. extendStart = extendArr[0];
  46822. extendEnd = extendArr[1];
  46823. }
  46824. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  46825. const [x1, y1, r1, x2, y2, r2] = this.coordsArr;
  46826. const distance = Math.hypot(x1 - x2, y1 - y2);
  46827. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  46828. (0, _util.warn)("Unsupported radial gradient.");
  46829. }
  46830. }
  46831. this.extendStart = extendStart;
  46832. this.extendEnd = extendEnd;
  46833. const fnObj = dict.getRaw("Function");
  46834. const fn = pdfFunctionFactory.createFromArray(fnObj);
  46835. const NUMBER_OF_SAMPLES = 10;
  46836. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  46837. const colorStops = this.colorStops = [];
  46838. if (t0 >= t1 || step <= 0) {
  46839. (0, _util.info)("Bad shading domain.");
  46840. return;
  46841. }
  46842. const color = new Float32Array(cs.numComps),
  46843. ratio = new Float32Array(1);
  46844. let rgbColor;
  46845. for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
  46846. ratio[0] = t0 + i * step;
  46847. fn(ratio, 0, color, 0);
  46848. rgbColor = cs.getRgb(color, 0);
  46849. const cssColor = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  46850. colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
  46851. }
  46852. let background = "transparent";
  46853. if (dict.has("Background")) {
  46854. rgbColor = cs.getRgb(dict.get("Background"), 0);
  46855. background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  46856. }
  46857. if (!extendStart) {
  46858. colorStops.unshift([0, background]);
  46859. colorStops[1][0] += BaseShading.SMALL_NUMBER;
  46860. }
  46861. if (!extendEnd) {
  46862. colorStops.at(-1)[0] -= BaseShading.SMALL_NUMBER;
  46863. colorStops.push([1, background]);
  46864. }
  46865. this.colorStops = colorStops;
  46866. }
  46867. getIR() {
  46868. const coordsArr = this.coordsArr;
  46869. const shadingType = this.shadingType;
  46870. let type, p0, p1, r0, r1;
  46871. if (shadingType === ShadingType.AXIAL) {
  46872. p0 = [coordsArr[0], coordsArr[1]];
  46873. p1 = [coordsArr[2], coordsArr[3]];
  46874. r0 = null;
  46875. r1 = null;
  46876. type = "axial";
  46877. } else if (shadingType === ShadingType.RADIAL) {
  46878. p0 = [coordsArr[0], coordsArr[1]];
  46879. p1 = [coordsArr[3], coordsArr[4]];
  46880. r0 = coordsArr[2];
  46881. r1 = coordsArr[5];
  46882. type = "radial";
  46883. } else {
  46884. (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
  46885. }
  46886. return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
  46887. }
  46888. }
  46889. class MeshStreamReader {
  46890. constructor(stream, context) {
  46891. this.stream = stream;
  46892. this.context = context;
  46893. this.buffer = 0;
  46894. this.bufferLength = 0;
  46895. const numComps = context.numComps;
  46896. this.tmpCompsBuf = new Float32Array(numComps);
  46897. const csNumComps = context.colorSpace.numComps;
  46898. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  46899. }
  46900. get hasData() {
  46901. if (this.stream.end) {
  46902. return this.stream.pos < this.stream.end;
  46903. }
  46904. if (this.bufferLength > 0) {
  46905. return true;
  46906. }
  46907. const nextByte = this.stream.getByte();
  46908. if (nextByte < 0) {
  46909. return false;
  46910. }
  46911. this.buffer = nextByte;
  46912. this.bufferLength = 8;
  46913. return true;
  46914. }
  46915. readBits(n) {
  46916. let buffer = this.buffer;
  46917. let bufferLength = this.bufferLength;
  46918. if (n === 32) {
  46919. if (bufferLength === 0) {
  46920. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  46921. }
  46922. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  46923. const nextByte = this.stream.getByte();
  46924. this.buffer = nextByte & (1 << bufferLength) - 1;
  46925. return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
  46926. }
  46927. if (n === 8 && bufferLength === 0) {
  46928. return this.stream.getByte();
  46929. }
  46930. while (bufferLength < n) {
  46931. buffer = buffer << 8 | this.stream.getByte();
  46932. bufferLength += 8;
  46933. }
  46934. bufferLength -= n;
  46935. this.bufferLength = bufferLength;
  46936. this.buffer = buffer & (1 << bufferLength) - 1;
  46937. return buffer >> bufferLength;
  46938. }
  46939. align() {
  46940. this.buffer = 0;
  46941. this.bufferLength = 0;
  46942. }
  46943. readFlag() {
  46944. return this.readBits(this.context.bitsPerFlag);
  46945. }
  46946. readCoordinate() {
  46947. const bitsPerCoordinate = this.context.bitsPerCoordinate;
  46948. const xi = this.readBits(bitsPerCoordinate);
  46949. const yi = this.readBits(bitsPerCoordinate);
  46950. const decode = this.context.decode;
  46951. const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  46952. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  46953. }
  46954. readComponents() {
  46955. const numComps = this.context.numComps;
  46956. const bitsPerComponent = this.context.bitsPerComponent;
  46957. const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  46958. const decode = this.context.decode;
  46959. const components = this.tmpCompsBuf;
  46960. for (let i = 0, j = 4; i < numComps; i++, j += 2) {
  46961. const ci = this.readBits(bitsPerComponent);
  46962. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  46963. }
  46964. const color = this.tmpCsCompsBuf;
  46965. if (this.context.colorFn) {
  46966. this.context.colorFn(components, 0, color, 0);
  46967. }
  46968. return this.context.colorSpace.getRgb(color, 0);
  46969. }
  46970. }
  46971. const getB = function getBClosure() {
  46972. function buildB(count) {
  46973. const lut = [];
  46974. for (let i = 0; i <= count; i++) {
  46975. const t = i / count,
  46976. t_ = 1 - t;
  46977. lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
  46978. }
  46979. return lut;
  46980. }
  46981. const cache = [];
  46982. return function (count) {
  46983. if (!cache[count]) {
  46984. cache[count] = buildB(count);
  46985. }
  46986. return cache[count];
  46987. };
  46988. }();
  46989. class MeshShading extends BaseShading {
  46990. static get MIN_SPLIT_PATCH_CHUNKS_AMOUNT() {
  46991. return (0, _util.shadow)(this, "MIN_SPLIT_PATCH_CHUNKS_AMOUNT", 3);
  46992. }
  46993. static get MAX_SPLIT_PATCH_CHUNKS_AMOUNT() {
  46994. return (0, _util.shadow)(this, "MAX_SPLIT_PATCH_CHUNKS_AMOUNT", 20);
  46995. }
  46996. static get TRIANGLE_DENSITY() {
  46997. return (0, _util.shadow)(this, "TRIANGLE_DENSITY", 20);
  46998. }
  46999. constructor(stream, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  47000. super();
  47001. if (!(stream instanceof _base_stream.BaseStream)) {
  47002. throw new _util.FormatError("Mesh data is not a stream");
  47003. }
  47004. const dict = stream.dict;
  47005. this.shadingType = dict.get("ShadingType");
  47006. const bbox = dict.getArray("BBox");
  47007. if (Array.isArray(bbox) && bbox.length === 4) {
  47008. this.bbox = _util.Util.normalizeRect(bbox);
  47009. } else {
  47010. this.bbox = null;
  47011. }
  47012. const cs = _colorspace.ColorSpace.parse({
  47013. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  47014. xref,
  47015. resources,
  47016. pdfFunctionFactory,
  47017. localColorSpaceCache
  47018. });
  47019. this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
  47020. const fnObj = dict.getRaw("Function");
  47021. const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  47022. this.coords = [];
  47023. this.colors = [];
  47024. this.figures = [];
  47025. const decodeContext = {
  47026. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  47027. bitsPerComponent: dict.get("BitsPerComponent"),
  47028. bitsPerFlag: dict.get("BitsPerFlag"),
  47029. decode: dict.getArray("Decode"),
  47030. colorFn: fn,
  47031. colorSpace: cs,
  47032. numComps: fn ? 1 : cs.numComps
  47033. };
  47034. const reader = new MeshStreamReader(stream, decodeContext);
  47035. let patchMesh = false;
  47036. switch (this.shadingType) {
  47037. case ShadingType.FREE_FORM_MESH:
  47038. this._decodeType4Shading(reader);
  47039. break;
  47040. case ShadingType.LATTICE_FORM_MESH:
  47041. const verticesPerRow = dict.get("VerticesPerRow") | 0;
  47042. if (verticesPerRow < 2) {
  47043. throw new _util.FormatError("Invalid VerticesPerRow");
  47044. }
  47045. this._decodeType5Shading(reader, verticesPerRow);
  47046. break;
  47047. case ShadingType.COONS_PATCH_MESH:
  47048. this._decodeType6Shading(reader);
  47049. patchMesh = true;
  47050. break;
  47051. case ShadingType.TENSOR_PATCH_MESH:
  47052. this._decodeType7Shading(reader);
  47053. patchMesh = true;
  47054. break;
  47055. default:
  47056. (0, _util.unreachable)("Unsupported mesh type.");
  47057. break;
  47058. }
  47059. if (patchMesh) {
  47060. this._updateBounds();
  47061. for (let i = 0, ii = this.figures.length; i < ii; i++) {
  47062. this._buildFigureFromPatch(i);
  47063. }
  47064. }
  47065. this._updateBounds();
  47066. this._packData();
  47067. }
  47068. _decodeType4Shading(reader) {
  47069. const coords = this.coords;
  47070. const colors = this.colors;
  47071. const operators = [];
  47072. const ps = [];
  47073. let verticesLeft = 0;
  47074. while (reader.hasData) {
  47075. const f = reader.readFlag();
  47076. const coord = reader.readCoordinate();
  47077. const color = reader.readComponents();
  47078. if (verticesLeft === 0) {
  47079. if (!(0 <= f && f <= 2)) {
  47080. throw new _util.FormatError("Unknown type4 flag");
  47081. }
  47082. switch (f) {
  47083. case 0:
  47084. verticesLeft = 3;
  47085. break;
  47086. case 1:
  47087. ps.push(ps.at(-2), ps.at(-1));
  47088. verticesLeft = 1;
  47089. break;
  47090. case 2:
  47091. ps.push(ps.at(-3), ps.at(-1));
  47092. verticesLeft = 1;
  47093. break;
  47094. }
  47095. operators.push(f);
  47096. }
  47097. ps.push(coords.length);
  47098. coords.push(coord);
  47099. colors.push(color);
  47100. verticesLeft--;
  47101. reader.align();
  47102. }
  47103. this.figures.push({
  47104. type: "triangles",
  47105. coords: new Int32Array(ps),
  47106. colors: new Int32Array(ps)
  47107. });
  47108. }
  47109. _decodeType5Shading(reader, verticesPerRow) {
  47110. const coords = this.coords;
  47111. const colors = this.colors;
  47112. const ps = [];
  47113. while (reader.hasData) {
  47114. const coord = reader.readCoordinate();
  47115. const color = reader.readComponents();
  47116. ps.push(coords.length);
  47117. coords.push(coord);
  47118. colors.push(color);
  47119. }
  47120. this.figures.push({
  47121. type: "lattice",
  47122. coords: new Int32Array(ps),
  47123. colors: new Int32Array(ps),
  47124. verticesPerRow
  47125. });
  47126. }
  47127. _decodeType6Shading(reader) {
  47128. const coords = this.coords;
  47129. const colors = this.colors;
  47130. const ps = new Int32Array(16);
  47131. const cs = new Int32Array(4);
  47132. while (reader.hasData) {
  47133. const f = reader.readFlag();
  47134. if (!(0 <= f && f <= 3)) {
  47135. throw new _util.FormatError("Unknown type6 flag");
  47136. }
  47137. const pi = coords.length;
  47138. for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  47139. coords.push(reader.readCoordinate());
  47140. }
  47141. const ci = colors.length;
  47142. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  47143. colors.push(reader.readComponents());
  47144. }
  47145. let tmp1, tmp2, tmp3, tmp4;
  47146. switch (f) {
  47147. case 0:
  47148. ps[12] = pi + 3;
  47149. ps[13] = pi + 4;
  47150. ps[14] = pi + 5;
  47151. ps[15] = pi + 6;
  47152. ps[8] = pi + 2;
  47153. ps[11] = pi + 7;
  47154. ps[4] = pi + 1;
  47155. ps[7] = pi + 8;
  47156. ps[0] = pi;
  47157. ps[1] = pi + 11;
  47158. ps[2] = pi + 10;
  47159. ps[3] = pi + 9;
  47160. cs[2] = ci + 1;
  47161. cs[3] = ci + 2;
  47162. cs[0] = ci;
  47163. cs[1] = ci + 3;
  47164. break;
  47165. case 1:
  47166. tmp1 = ps[12];
  47167. tmp2 = ps[13];
  47168. tmp3 = ps[14];
  47169. tmp4 = ps[15];
  47170. ps[12] = tmp4;
  47171. ps[13] = pi + 0;
  47172. ps[14] = pi + 1;
  47173. ps[15] = pi + 2;
  47174. ps[8] = tmp3;
  47175. ps[11] = pi + 3;
  47176. ps[4] = tmp2;
  47177. ps[7] = pi + 4;
  47178. ps[0] = tmp1;
  47179. ps[1] = pi + 7;
  47180. ps[2] = pi + 6;
  47181. ps[3] = pi + 5;
  47182. tmp1 = cs[2];
  47183. tmp2 = cs[3];
  47184. cs[2] = tmp2;
  47185. cs[3] = ci;
  47186. cs[0] = tmp1;
  47187. cs[1] = ci + 1;
  47188. break;
  47189. case 2:
  47190. tmp1 = ps[15];
  47191. tmp2 = ps[11];
  47192. ps[12] = ps[3];
  47193. ps[13] = pi + 0;
  47194. ps[14] = pi + 1;
  47195. ps[15] = pi + 2;
  47196. ps[8] = ps[7];
  47197. ps[11] = pi + 3;
  47198. ps[4] = tmp2;
  47199. ps[7] = pi + 4;
  47200. ps[0] = tmp1;
  47201. ps[1] = pi + 7;
  47202. ps[2] = pi + 6;
  47203. ps[3] = pi + 5;
  47204. tmp1 = cs[3];
  47205. cs[2] = cs[1];
  47206. cs[3] = ci;
  47207. cs[0] = tmp1;
  47208. cs[1] = ci + 1;
  47209. break;
  47210. case 3:
  47211. ps[12] = ps[0];
  47212. ps[13] = pi + 0;
  47213. ps[14] = pi + 1;
  47214. ps[15] = pi + 2;
  47215. ps[8] = ps[1];
  47216. ps[11] = pi + 3;
  47217. ps[4] = ps[2];
  47218. ps[7] = pi + 4;
  47219. ps[0] = ps[3];
  47220. ps[1] = pi + 7;
  47221. ps[2] = pi + 6;
  47222. ps[3] = pi + 5;
  47223. cs[2] = cs[0];
  47224. cs[3] = ci;
  47225. cs[0] = cs[1];
  47226. cs[1] = ci + 1;
  47227. break;
  47228. }
  47229. ps[5] = coords.length;
  47230. 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]);
  47231. ps[6] = coords.length;
  47232. 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]);
  47233. ps[9] = coords.length;
  47234. 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]);
  47235. ps[10] = coords.length;
  47236. 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]);
  47237. this.figures.push({
  47238. type: "patch",
  47239. coords: new Int32Array(ps),
  47240. colors: new Int32Array(cs)
  47241. });
  47242. }
  47243. }
  47244. _decodeType7Shading(reader) {
  47245. const coords = this.coords;
  47246. const colors = this.colors;
  47247. const ps = new Int32Array(16);
  47248. const cs = new Int32Array(4);
  47249. while (reader.hasData) {
  47250. const f = reader.readFlag();
  47251. if (!(0 <= f && f <= 3)) {
  47252. throw new _util.FormatError("Unknown type7 flag");
  47253. }
  47254. const pi = coords.length;
  47255. for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  47256. coords.push(reader.readCoordinate());
  47257. }
  47258. const ci = colors.length;
  47259. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  47260. colors.push(reader.readComponents());
  47261. }
  47262. let tmp1, tmp2, tmp3, tmp4;
  47263. switch (f) {
  47264. case 0:
  47265. ps[12] = pi + 3;
  47266. ps[13] = pi + 4;
  47267. ps[14] = pi + 5;
  47268. ps[15] = pi + 6;
  47269. ps[8] = pi + 2;
  47270. ps[9] = pi + 13;
  47271. ps[10] = pi + 14;
  47272. ps[11] = pi + 7;
  47273. ps[4] = pi + 1;
  47274. ps[5] = pi + 12;
  47275. ps[6] = pi + 15;
  47276. ps[7] = pi + 8;
  47277. ps[0] = pi;
  47278. ps[1] = pi + 11;
  47279. ps[2] = pi + 10;
  47280. ps[3] = pi + 9;
  47281. cs[2] = ci + 1;
  47282. cs[3] = ci + 2;
  47283. cs[0] = ci;
  47284. cs[1] = ci + 3;
  47285. break;
  47286. case 1:
  47287. tmp1 = ps[12];
  47288. tmp2 = ps[13];
  47289. tmp3 = ps[14];
  47290. tmp4 = ps[15];
  47291. ps[12] = tmp4;
  47292. ps[13] = pi + 0;
  47293. ps[14] = pi + 1;
  47294. ps[15] = pi + 2;
  47295. ps[8] = tmp3;
  47296. ps[9] = pi + 9;
  47297. ps[10] = pi + 10;
  47298. ps[11] = pi + 3;
  47299. ps[4] = tmp2;
  47300. ps[5] = pi + 8;
  47301. ps[6] = pi + 11;
  47302. ps[7] = pi + 4;
  47303. ps[0] = tmp1;
  47304. ps[1] = pi + 7;
  47305. ps[2] = pi + 6;
  47306. ps[3] = pi + 5;
  47307. tmp1 = cs[2];
  47308. tmp2 = cs[3];
  47309. cs[2] = tmp2;
  47310. cs[3] = ci;
  47311. cs[0] = tmp1;
  47312. cs[1] = ci + 1;
  47313. break;
  47314. case 2:
  47315. tmp1 = ps[15];
  47316. tmp2 = ps[11];
  47317. ps[12] = ps[3];
  47318. ps[13] = pi + 0;
  47319. ps[14] = pi + 1;
  47320. ps[15] = pi + 2;
  47321. ps[8] = ps[7];
  47322. ps[9] = pi + 9;
  47323. ps[10] = pi + 10;
  47324. ps[11] = pi + 3;
  47325. ps[4] = tmp2;
  47326. ps[5] = pi + 8;
  47327. ps[6] = pi + 11;
  47328. ps[7] = pi + 4;
  47329. ps[0] = tmp1;
  47330. ps[1] = pi + 7;
  47331. ps[2] = pi + 6;
  47332. ps[3] = pi + 5;
  47333. tmp1 = cs[3];
  47334. cs[2] = cs[1];
  47335. cs[3] = ci;
  47336. cs[0] = tmp1;
  47337. cs[1] = ci + 1;
  47338. break;
  47339. case 3:
  47340. ps[12] = ps[0];
  47341. ps[13] = pi + 0;
  47342. ps[14] = pi + 1;
  47343. ps[15] = pi + 2;
  47344. ps[8] = ps[1];
  47345. ps[9] = pi + 9;
  47346. ps[10] = pi + 10;
  47347. ps[11] = pi + 3;
  47348. ps[4] = ps[2];
  47349. ps[5] = pi + 8;
  47350. ps[6] = pi + 11;
  47351. ps[7] = pi + 4;
  47352. ps[0] = ps[3];
  47353. ps[1] = pi + 7;
  47354. ps[2] = pi + 6;
  47355. ps[3] = pi + 5;
  47356. cs[2] = cs[0];
  47357. cs[3] = ci;
  47358. cs[0] = cs[1];
  47359. cs[1] = ci + 1;
  47360. break;
  47361. }
  47362. this.figures.push({
  47363. type: "patch",
  47364. coords: new Int32Array(ps),
  47365. colors: new Int32Array(cs)
  47366. });
  47367. }
  47368. }
  47369. _buildFigureFromPatch(index) {
  47370. const figure = this.figures[index];
  47371. (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure");
  47372. const coords = this.coords,
  47373. colors = this.colors;
  47374. const pi = figure.coords;
  47375. const ci = figure.colors;
  47376. const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  47377. const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  47378. const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  47379. const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  47380. let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0]));
  47381. splitXBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  47382. let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1]));
  47383. splitYBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  47384. const verticesPerRow = splitXBy + 1;
  47385. const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  47386. const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  47387. let k = 0;
  47388. const cl = new Uint8Array(3),
  47389. cr = new Uint8Array(3);
  47390. const c0 = colors[ci[0]],
  47391. c1 = colors[ci[1]],
  47392. c2 = colors[ci[2]],
  47393. c3 = colors[ci[3]];
  47394. const bRow = getB(splitYBy),
  47395. bCol = getB(splitXBy);
  47396. for (let row = 0; row <= splitYBy; row++) {
  47397. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  47398. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  47399. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  47400. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  47401. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  47402. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  47403. for (let col = 0; col <= splitXBy; col++, k++) {
  47404. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  47405. continue;
  47406. }
  47407. let x = 0,
  47408. y = 0;
  47409. let q = 0;
  47410. for (let i = 0; i <= 3; i++) {
  47411. for (let j = 0; j <= 3; j++, q++) {
  47412. const m = bRow[row][i] * bCol[col][j];
  47413. x += coords[pi[q]][0] * m;
  47414. y += coords[pi[q]][1] * m;
  47415. }
  47416. }
  47417. figureCoords[k] = coords.length;
  47418. coords.push([x, y]);
  47419. figureColors[k] = colors.length;
  47420. const newColor = new Uint8Array(3);
  47421. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  47422. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  47423. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  47424. colors.push(newColor);
  47425. }
  47426. }
  47427. figureCoords[0] = pi[0];
  47428. figureColors[0] = ci[0];
  47429. figureCoords[splitXBy] = pi[3];
  47430. figureColors[splitXBy] = ci[1];
  47431. figureCoords[verticesPerRow * splitYBy] = pi[12];
  47432. figureColors[verticesPerRow * splitYBy] = ci[2];
  47433. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  47434. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  47435. this.figures[index] = {
  47436. type: "lattice",
  47437. coords: figureCoords,
  47438. colors: figureColors,
  47439. verticesPerRow
  47440. };
  47441. }
  47442. _updateBounds() {
  47443. let minX = this.coords[0][0],
  47444. minY = this.coords[0][1],
  47445. maxX = minX,
  47446. maxY = minY;
  47447. for (let i = 1, ii = this.coords.length; i < ii; i++) {
  47448. const x = this.coords[i][0],
  47449. y = this.coords[i][1];
  47450. minX = minX > x ? x : minX;
  47451. minY = minY > y ? y : minY;
  47452. maxX = maxX < x ? x : maxX;
  47453. maxY = maxY < y ? y : maxY;
  47454. }
  47455. this.bounds = [minX, minY, maxX, maxY];
  47456. }
  47457. _packData() {
  47458. let i, ii, j, jj;
  47459. const coords = this.coords;
  47460. const coordsPacked = new Float32Array(coords.length * 2);
  47461. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  47462. const xy = coords[i];
  47463. coordsPacked[j++] = xy[0];
  47464. coordsPacked[j++] = xy[1];
  47465. }
  47466. this.coords = coordsPacked;
  47467. const colors = this.colors;
  47468. const colorsPacked = new Uint8Array(colors.length * 3);
  47469. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  47470. const c = colors[i];
  47471. colorsPacked[j++] = c[0];
  47472. colorsPacked[j++] = c[1];
  47473. colorsPacked[j++] = c[2];
  47474. }
  47475. this.colors = colorsPacked;
  47476. const figures = this.figures;
  47477. for (i = 0, ii = figures.length; i < ii; i++) {
  47478. const figure = figures[i],
  47479. ps = figure.coords,
  47480. cs = figure.colors;
  47481. for (j = 0, jj = ps.length; j < jj; j++) {
  47482. ps[j] *= 2;
  47483. cs[j] *= 3;
  47484. }
  47485. }
  47486. }
  47487. getIR() {
  47488. return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.bbox, this.background];
  47489. }
  47490. }
  47491. class DummyShading extends BaseShading {
  47492. getIR() {
  47493. return ["Dummy"];
  47494. }
  47495. }
  47496. function getTilingPatternIR(operatorList, dict, color) {
  47497. const matrix = dict.getArray("Matrix");
  47498. const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
  47499. const xstep = dict.get("XStep");
  47500. const ystep = dict.get("YStep");
  47501. const paintType = dict.get("PaintType");
  47502. const tilingType = dict.get("TilingType");
  47503. if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  47504. throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
  47505. }
  47506. return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  47507. }
  47508. /***/ }),
  47509. /* 182 */
  47510. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47511. "use strict";
  47512. Object.defineProperty(exports, "__esModule", ({
  47513. value: true
  47514. }));
  47515. exports.getXfaFontDict = getXfaFontDict;
  47516. exports.getXfaFontName = getXfaFontName;
  47517. var _calibri_factors = __w_pdfjs_require__(183);
  47518. var _primitives = __w_pdfjs_require__(137);
  47519. var _helvetica_factors = __w_pdfjs_require__(184);
  47520. var _liberationsans_widths = __w_pdfjs_require__(185);
  47521. var _myriadpro_factors = __w_pdfjs_require__(186);
  47522. var _segoeui_factors = __w_pdfjs_require__(187);
  47523. var _core_utils = __w_pdfjs_require__(136);
  47524. var _fonts_utils = __w_pdfjs_require__(169);
  47525. const getXFAFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  47526. t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = {
  47527. name: "LiberationSans-Regular",
  47528. factors: _myriadpro_factors.MyriadProRegularFactors,
  47529. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47530. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  47531. metrics: _myriadpro_factors.MyriadProRegularMetrics
  47532. };
  47533. t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = {
  47534. name: "LiberationSans-Bold",
  47535. factors: _myriadpro_factors.MyriadProBoldFactors,
  47536. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47537. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  47538. metrics: _myriadpro_factors.MyriadProBoldMetrics
  47539. };
  47540. t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = {
  47541. name: "LiberationSans-Italic",
  47542. factors: _myriadpro_factors.MyriadProItalicFactors,
  47543. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47544. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  47545. metrics: _myriadpro_factors.MyriadProItalicMetrics
  47546. };
  47547. t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = {
  47548. name: "LiberationSans-BoldItalic",
  47549. factors: _myriadpro_factors.MyriadProBoldItalicFactors,
  47550. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47551. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  47552. metrics: _myriadpro_factors.MyriadProBoldItalicMetrics
  47553. };
  47554. t.ArialMT = t.Arial = t["Arial-Regular"] = {
  47555. name: "LiberationSans-Regular",
  47556. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47557. baseMapping: _liberationsans_widths.LiberationSansRegularMapping
  47558. };
  47559. t["Arial-BoldMT"] = t["Arial-Bold"] = {
  47560. name: "LiberationSans-Bold",
  47561. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47562. baseMapping: _liberationsans_widths.LiberationSansBoldMapping
  47563. };
  47564. t["Arial-ItalicMT"] = t["Arial-Italic"] = {
  47565. name: "LiberationSans-Italic",
  47566. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47567. baseMapping: _liberationsans_widths.LiberationSansItalicMapping
  47568. };
  47569. t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = {
  47570. name: "LiberationSans-BoldItalic",
  47571. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47572. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping
  47573. };
  47574. t["Calibri-Regular"] = {
  47575. name: "LiberationSans-Regular",
  47576. factors: _calibri_factors.CalibriRegularFactors,
  47577. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47578. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  47579. metrics: _calibri_factors.CalibriRegularMetrics
  47580. };
  47581. t["Calibri-Bold"] = {
  47582. name: "LiberationSans-Bold",
  47583. factors: _calibri_factors.CalibriBoldFactors,
  47584. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47585. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  47586. metrics: _calibri_factors.CalibriBoldMetrics
  47587. };
  47588. t["Calibri-Italic"] = {
  47589. name: "LiberationSans-Italic",
  47590. factors: _calibri_factors.CalibriItalicFactors,
  47591. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47592. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  47593. metrics: _calibri_factors.CalibriItalicMetrics
  47594. };
  47595. t["Calibri-BoldItalic"] = {
  47596. name: "LiberationSans-BoldItalic",
  47597. factors: _calibri_factors.CalibriBoldItalicFactors,
  47598. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47599. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  47600. metrics: _calibri_factors.CalibriBoldItalicMetrics
  47601. };
  47602. t["Segoeui-Regular"] = {
  47603. name: "LiberationSans-Regular",
  47604. factors: _segoeui_factors.SegoeuiRegularFactors,
  47605. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47606. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  47607. metrics: _segoeui_factors.SegoeuiRegularMetrics
  47608. };
  47609. t["Segoeui-Bold"] = {
  47610. name: "LiberationSans-Bold",
  47611. factors: _segoeui_factors.SegoeuiBoldFactors,
  47612. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47613. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  47614. metrics: _segoeui_factors.SegoeuiBoldMetrics
  47615. };
  47616. t["Segoeui-Italic"] = {
  47617. name: "LiberationSans-Italic",
  47618. factors: _segoeui_factors.SegoeuiItalicFactors,
  47619. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47620. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  47621. metrics: _segoeui_factors.SegoeuiItalicMetrics
  47622. };
  47623. t["Segoeui-BoldItalic"] = {
  47624. name: "LiberationSans-BoldItalic",
  47625. factors: _segoeui_factors.SegoeuiBoldItalicFactors,
  47626. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47627. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  47628. metrics: _segoeui_factors.SegoeuiBoldItalicMetrics
  47629. };
  47630. t["Helvetica-Regular"] = t.Helvetica = {
  47631. name: "LiberationSans-Regular",
  47632. factors: _helvetica_factors.HelveticaRegularFactors,
  47633. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47634. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  47635. metrics: _helvetica_factors.HelveticaRegularMetrics
  47636. };
  47637. t["Helvetica-Bold"] = {
  47638. name: "LiberationSans-Bold",
  47639. factors: _helvetica_factors.HelveticaBoldFactors,
  47640. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47641. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  47642. metrics: _helvetica_factors.HelveticaBoldMetrics
  47643. };
  47644. t["Helvetica-Italic"] = {
  47645. name: "LiberationSans-Italic",
  47646. factors: _helvetica_factors.HelveticaItalicFactors,
  47647. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47648. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  47649. metrics: _helvetica_factors.HelveticaItalicMetrics
  47650. };
  47651. t["Helvetica-BoldItalic"] = {
  47652. name: "LiberationSans-BoldItalic",
  47653. factors: _helvetica_factors.HelveticaBoldItalicFactors,
  47654. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47655. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  47656. metrics: _helvetica_factors.HelveticaBoldItalicMetrics
  47657. };
  47658. });
  47659. function getXfaFontName(name) {
  47660. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  47661. const fontMap = getXFAFontMap();
  47662. return fontMap[fontName];
  47663. }
  47664. function getXfaFontWidths(name) {
  47665. const info = getXfaFontName(name);
  47666. if (!info) {
  47667. return null;
  47668. }
  47669. const {
  47670. baseWidths,
  47671. baseMapping,
  47672. factors
  47673. } = info;
  47674. let rescaledBaseWidths;
  47675. if (!factors) {
  47676. rescaledBaseWidths = baseWidths;
  47677. } else {
  47678. rescaledBaseWidths = baseWidths.map((w, i) => w * factors[i]);
  47679. }
  47680. let currentCode = -2;
  47681. let currentArray;
  47682. const newWidths = [];
  47683. for (const [unicode, glyphIndex] of baseMapping.map((charUnicode, index) => [charUnicode, index]).sort((_ref, _ref2) => {
  47684. let [unicode1] = _ref;
  47685. let [unicode2] = _ref2;
  47686. return unicode1 - unicode2;
  47687. })) {
  47688. if (unicode === -1) {
  47689. continue;
  47690. }
  47691. if (unicode === currentCode + 1) {
  47692. currentArray.push(rescaledBaseWidths[glyphIndex]);
  47693. currentCode += 1;
  47694. } else {
  47695. currentCode = unicode;
  47696. currentArray = [rescaledBaseWidths[glyphIndex]];
  47697. newWidths.push(unicode, currentArray);
  47698. }
  47699. }
  47700. return newWidths;
  47701. }
  47702. function getXfaFontDict(name) {
  47703. const widths = getXfaFontWidths(name);
  47704. const dict = new _primitives.Dict(null);
  47705. dict.set("BaseFont", _primitives.Name.get(name));
  47706. dict.set("Type", _primitives.Name.get("Font"));
  47707. dict.set("Subtype", _primitives.Name.get("CIDFontType2"));
  47708. dict.set("Encoding", _primitives.Name.get("Identity-H"));
  47709. dict.set("CIDToGIDMap", _primitives.Name.get("Identity"));
  47710. dict.set("W", widths);
  47711. dict.set("FirstChar", widths[0]);
  47712. dict.set("LastChar", widths.at(-2) + widths.at(-1).length - 1);
  47713. const descriptor = new _primitives.Dict(null);
  47714. dict.set("FontDescriptor", descriptor);
  47715. const systemInfo = new _primitives.Dict(null);
  47716. systemInfo.set("Ordering", "Identity");
  47717. systemInfo.set("Registry", "Adobe");
  47718. systemInfo.set("Supplement", 0);
  47719. dict.set("CIDSystemInfo", systemInfo);
  47720. return dict;
  47721. }
  47722. /***/ }),
  47723. /* 183 */
  47724. /***/ ((__unused_webpack_module, exports) => {
  47725. "use strict";
  47726. Object.defineProperty(exports, "__esModule", ({
  47727. value: true
  47728. }));
  47729. exports.CalibriRegularMetrics = exports.CalibriRegularFactors = exports.CalibriItalicMetrics = exports.CalibriItalicFactors = exports.CalibriBoldMetrics = exports.CalibriBoldItalicMetrics = exports.CalibriBoldItalicFactors = exports.CalibriBoldFactors = void 0;
  47730. 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];
  47731. exports.CalibriBoldFactors = CalibriBoldFactors;
  47732. const CalibriBoldMetrics = {
  47733. lineHeight: 1.2207,
  47734. lineGap: 0.2207
  47735. };
  47736. exports.CalibriBoldMetrics = CalibriBoldMetrics;
  47737. 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];
  47738. exports.CalibriBoldItalicFactors = CalibriBoldItalicFactors;
  47739. const CalibriBoldItalicMetrics = {
  47740. lineHeight: 1.2207,
  47741. lineGap: 0.2207
  47742. };
  47743. exports.CalibriBoldItalicMetrics = CalibriBoldItalicMetrics;
  47744. 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];
  47745. exports.CalibriItalicFactors = CalibriItalicFactors;
  47746. const CalibriItalicMetrics = {
  47747. lineHeight: 1.2207,
  47748. lineGap: 0.2207
  47749. };
  47750. exports.CalibriItalicMetrics = CalibriItalicMetrics;
  47751. 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];
  47752. exports.CalibriRegularFactors = CalibriRegularFactors;
  47753. const CalibriRegularMetrics = {
  47754. lineHeight: 1.2207,
  47755. lineGap: 0.2207
  47756. };
  47757. exports.CalibriRegularMetrics = CalibriRegularMetrics;
  47758. /***/ }),
  47759. /* 184 */
  47760. /***/ ((__unused_webpack_module, exports) => {
  47761. "use strict";
  47762. Object.defineProperty(exports, "__esModule", ({
  47763. value: true
  47764. }));
  47765. exports.HelveticaRegularMetrics = exports.HelveticaRegularFactors = exports.HelveticaItalicMetrics = exports.HelveticaItalicFactors = exports.HelveticaBoldMetrics = exports.HelveticaBoldItalicMetrics = exports.HelveticaBoldItalicFactors = exports.HelveticaBoldFactors = void 0;
  47766. 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];
  47767. exports.HelveticaBoldFactors = HelveticaBoldFactors;
  47768. const HelveticaBoldMetrics = {
  47769. lineHeight: 1.2,
  47770. lineGap: 0.2
  47771. };
  47772. exports.HelveticaBoldMetrics = HelveticaBoldMetrics;
  47773. 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];
  47774. exports.HelveticaBoldItalicFactors = HelveticaBoldItalicFactors;
  47775. const HelveticaBoldItalicMetrics = {
  47776. lineHeight: 1.35,
  47777. lineGap: 0.2
  47778. };
  47779. exports.HelveticaBoldItalicMetrics = HelveticaBoldItalicMetrics;
  47780. 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];
  47781. exports.HelveticaItalicFactors = HelveticaItalicFactors;
  47782. const HelveticaItalicMetrics = {
  47783. lineHeight: 1.35,
  47784. lineGap: 0.2
  47785. };
  47786. exports.HelveticaItalicMetrics = HelveticaItalicMetrics;
  47787. 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];
  47788. exports.HelveticaRegularFactors = HelveticaRegularFactors;
  47789. const HelveticaRegularMetrics = {
  47790. lineHeight: 1.2,
  47791. lineGap: 0.2
  47792. };
  47793. exports.HelveticaRegularMetrics = HelveticaRegularMetrics;
  47794. /***/ }),
  47795. /* 185 */
  47796. /***/ ((__unused_webpack_module, exports) => {
  47797. "use strict";
  47798. Object.defineProperty(exports, "__esModule", ({
  47799. value: true
  47800. }));
  47801. exports.LiberationSansRegularWidths = exports.LiberationSansRegularMapping = exports.LiberationSansItalicWidths = exports.LiberationSansItalicMapping = exports.LiberationSansBoldWidths = exports.LiberationSansBoldMapping = exports.LiberationSansBoldItalicWidths = exports.LiberationSansBoldItalicMapping = void 0;
  47802. 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];
  47803. exports.LiberationSansBoldWidths = LiberationSansBoldWidths;
  47804. 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];
  47805. exports.LiberationSansBoldMapping = LiberationSansBoldMapping;
  47806. 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];
  47807. exports.LiberationSansBoldItalicWidths = LiberationSansBoldItalicWidths;
  47808. 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];
  47809. exports.LiberationSansBoldItalicMapping = LiberationSansBoldItalicMapping;
  47810. 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];
  47811. exports.LiberationSansItalicWidths = LiberationSansItalicWidths;
  47812. 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];
  47813. exports.LiberationSansItalicMapping = LiberationSansItalicMapping;
  47814. 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];
  47815. exports.LiberationSansRegularWidths = LiberationSansRegularWidths;
  47816. 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];
  47817. exports.LiberationSansRegularMapping = LiberationSansRegularMapping;
  47818. /***/ }),
  47819. /* 186 */
  47820. /***/ ((__unused_webpack_module, exports) => {
  47821. "use strict";
  47822. Object.defineProperty(exports, "__esModule", ({
  47823. value: true
  47824. }));
  47825. exports.MyriadProRegularMetrics = exports.MyriadProRegularFactors = exports.MyriadProItalicMetrics = exports.MyriadProItalicFactors = exports.MyriadProBoldMetrics = exports.MyriadProBoldItalicMetrics = exports.MyriadProBoldItalicFactors = exports.MyriadProBoldFactors = void 0;
  47826. 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];
  47827. exports.MyriadProBoldFactors = MyriadProBoldFactors;
  47828. const MyriadProBoldMetrics = {
  47829. lineHeight: 1.2,
  47830. lineGap: 0.2
  47831. };
  47832. exports.MyriadProBoldMetrics = MyriadProBoldMetrics;
  47833. 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];
  47834. exports.MyriadProBoldItalicFactors = MyriadProBoldItalicFactors;
  47835. const MyriadProBoldItalicMetrics = {
  47836. lineHeight: 1.2,
  47837. lineGap: 0.2
  47838. };
  47839. exports.MyriadProBoldItalicMetrics = MyriadProBoldItalicMetrics;
  47840. 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];
  47841. exports.MyriadProItalicFactors = MyriadProItalicFactors;
  47842. const MyriadProItalicMetrics = {
  47843. lineHeight: 1.2,
  47844. lineGap: 0.2
  47845. };
  47846. exports.MyriadProItalicMetrics = MyriadProItalicMetrics;
  47847. 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];
  47848. exports.MyriadProRegularFactors = MyriadProRegularFactors;
  47849. const MyriadProRegularMetrics = {
  47850. lineHeight: 1.2,
  47851. lineGap: 0.2
  47852. };
  47853. exports.MyriadProRegularMetrics = MyriadProRegularMetrics;
  47854. /***/ }),
  47855. /* 187 */
  47856. /***/ ((__unused_webpack_module, exports) => {
  47857. "use strict";
  47858. Object.defineProperty(exports, "__esModule", ({
  47859. value: true
  47860. }));
  47861. exports.SegoeuiRegularMetrics = exports.SegoeuiRegularFactors = exports.SegoeuiItalicMetrics = exports.SegoeuiItalicFactors = exports.SegoeuiBoldMetrics = exports.SegoeuiBoldItalicMetrics = exports.SegoeuiBoldItalicFactors = exports.SegoeuiBoldFactors = void 0;
  47862. 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];
  47863. exports.SegoeuiBoldFactors = SegoeuiBoldFactors;
  47864. const SegoeuiBoldMetrics = {
  47865. lineHeight: 1.33008,
  47866. lineGap: 0
  47867. };
  47868. exports.SegoeuiBoldMetrics = SegoeuiBoldMetrics;
  47869. 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];
  47870. exports.SegoeuiBoldItalicFactors = SegoeuiBoldItalicFactors;
  47871. const SegoeuiBoldItalicMetrics = {
  47872. lineHeight: 1.33008,
  47873. lineGap: 0
  47874. };
  47875. exports.SegoeuiBoldItalicMetrics = SegoeuiBoldItalicMetrics;
  47876. 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];
  47877. exports.SegoeuiItalicFactors = SegoeuiItalicFactors;
  47878. const SegoeuiItalicMetrics = {
  47879. lineHeight: 1.33008,
  47880. lineGap: 0
  47881. };
  47882. exports.SegoeuiItalicMetrics = SegoeuiItalicMetrics;
  47883. 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];
  47884. exports.SegoeuiRegularFactors = SegoeuiRegularFactors;
  47885. const SegoeuiRegularMetrics = {
  47886. lineHeight: 1.33008,
  47887. lineGap: 0
  47888. };
  47889. exports.SegoeuiRegularMetrics = SegoeuiRegularMetrics;
  47890. /***/ }),
  47891. /* 188 */
  47892. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47893. "use strict";
  47894. Object.defineProperty(exports, "__esModule", ({
  47895. value: true
  47896. }));
  47897. exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0;
  47898. exports.isPDFFunction = isPDFFunction;
  47899. var _primitives = __w_pdfjs_require__(137);
  47900. var _util = __w_pdfjs_require__(2);
  47901. var _ps_parser = __w_pdfjs_require__(189);
  47902. var _base_stream = __w_pdfjs_require__(138);
  47903. var _image_utils = __w_pdfjs_require__(190);
  47904. class PDFFunctionFactory {
  47905. constructor(_ref) {
  47906. let {
  47907. xref,
  47908. isEvalSupported = true
  47909. } = _ref;
  47910. this.xref = xref;
  47911. this.isEvalSupported = isEvalSupported !== false;
  47912. }
  47913. create(fn) {
  47914. const cachedFunction = this.getCached(fn);
  47915. if (cachedFunction) {
  47916. return cachedFunction;
  47917. }
  47918. const parsedFunction = PDFFunction.parse({
  47919. xref: this.xref,
  47920. isEvalSupported: this.isEvalSupported,
  47921. fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn
  47922. });
  47923. this._cache(fn, parsedFunction);
  47924. return parsedFunction;
  47925. }
  47926. createFromArray(fnObj) {
  47927. const cachedFunction = this.getCached(fnObj);
  47928. if (cachedFunction) {
  47929. return cachedFunction;
  47930. }
  47931. const parsedFunction = PDFFunction.parseArray({
  47932. xref: this.xref,
  47933. isEvalSupported: this.isEvalSupported,
  47934. fnObj: fnObj instanceof _primitives.Ref ? this.xref.fetch(fnObj) : fnObj
  47935. });
  47936. this._cache(fnObj, parsedFunction);
  47937. return parsedFunction;
  47938. }
  47939. getCached(cacheKey) {
  47940. let fnRef;
  47941. if (cacheKey instanceof _primitives.Ref) {
  47942. fnRef = cacheKey;
  47943. } else if (cacheKey instanceof _primitives.Dict) {
  47944. fnRef = cacheKey.objId;
  47945. } else if (cacheKey instanceof _base_stream.BaseStream) {
  47946. fnRef = cacheKey.dict && cacheKey.dict.objId;
  47947. }
  47948. if (fnRef) {
  47949. const localFunction = this._localFunctionCache.getByRef(fnRef);
  47950. if (localFunction) {
  47951. return localFunction;
  47952. }
  47953. }
  47954. return null;
  47955. }
  47956. _cache(cacheKey, parsedFunction) {
  47957. if (!parsedFunction) {
  47958. throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.');
  47959. }
  47960. let fnRef;
  47961. if (cacheKey instanceof _primitives.Ref) {
  47962. fnRef = cacheKey;
  47963. } else if (cacheKey instanceof _primitives.Dict) {
  47964. fnRef = cacheKey.objId;
  47965. } else if (cacheKey instanceof _base_stream.BaseStream) {
  47966. fnRef = cacheKey.dict && cacheKey.dict.objId;
  47967. }
  47968. if (fnRef) {
  47969. this._localFunctionCache.set(null, fnRef, parsedFunction);
  47970. }
  47971. }
  47972. get _localFunctionCache() {
  47973. return (0, _util.shadow)(this, "_localFunctionCache", new _image_utils.LocalFunctionCache());
  47974. }
  47975. }
  47976. exports.PDFFunctionFactory = PDFFunctionFactory;
  47977. function toNumberArray(arr) {
  47978. if (!Array.isArray(arr)) {
  47979. return null;
  47980. }
  47981. const length = arr.length;
  47982. for (let i = 0; i < length; i++) {
  47983. if (typeof arr[i] !== "number") {
  47984. const result = new Array(length);
  47985. for (let j = 0; j < length; j++) {
  47986. result[j] = +arr[j];
  47987. }
  47988. return result;
  47989. }
  47990. }
  47991. return arr;
  47992. }
  47993. class PDFFunction {
  47994. static getSampleArray(size, outputSize, bps, stream) {
  47995. let i, ii;
  47996. let length = 1;
  47997. for (i = 0, ii = size.length; i < ii; i++) {
  47998. length *= size[i];
  47999. }
  48000. length *= outputSize;
  48001. const array = new Array(length);
  48002. let codeSize = 0;
  48003. let codeBuf = 0;
  48004. const sampleMul = 1.0 / (2.0 ** bps - 1);
  48005. const strBytes = stream.getBytes((length * bps + 7) / 8);
  48006. let strIdx = 0;
  48007. for (i = 0; i < length; i++) {
  48008. while (codeSize < bps) {
  48009. codeBuf <<= 8;
  48010. codeBuf |= strBytes[strIdx++];
  48011. codeSize += 8;
  48012. }
  48013. codeSize -= bps;
  48014. array[i] = (codeBuf >> codeSize) * sampleMul;
  48015. codeBuf &= (1 << codeSize) - 1;
  48016. }
  48017. return array;
  48018. }
  48019. static parse(_ref2) {
  48020. let {
  48021. xref,
  48022. isEvalSupported,
  48023. fn
  48024. } = _ref2;
  48025. const dict = fn.dict || fn;
  48026. const typeNum = dict.get("FunctionType");
  48027. switch (typeNum) {
  48028. case 0:
  48029. return this.constructSampled({
  48030. xref,
  48031. isEvalSupported,
  48032. fn,
  48033. dict
  48034. });
  48035. case 1:
  48036. break;
  48037. case 2:
  48038. return this.constructInterpolated({
  48039. xref,
  48040. isEvalSupported,
  48041. dict
  48042. });
  48043. case 3:
  48044. return this.constructStiched({
  48045. xref,
  48046. isEvalSupported,
  48047. dict
  48048. });
  48049. case 4:
  48050. return this.constructPostScript({
  48051. xref,
  48052. isEvalSupported,
  48053. fn,
  48054. dict
  48055. });
  48056. }
  48057. throw new _util.FormatError("Unknown type of function");
  48058. }
  48059. static parseArray(_ref3) {
  48060. let {
  48061. xref,
  48062. isEvalSupported,
  48063. fnObj
  48064. } = _ref3;
  48065. if (!Array.isArray(fnObj)) {
  48066. return this.parse({
  48067. xref,
  48068. isEvalSupported,
  48069. fn: fnObj
  48070. });
  48071. }
  48072. const fnArray = [];
  48073. for (const fn of fnObj) {
  48074. fnArray.push(this.parse({
  48075. xref,
  48076. isEvalSupported,
  48077. fn: xref.fetchIfRef(fn)
  48078. }));
  48079. }
  48080. return function (src, srcOffset, dest, destOffset) {
  48081. for (let i = 0, ii = fnArray.length; i < ii; i++) {
  48082. fnArray[i](src, srcOffset, dest, destOffset + i);
  48083. }
  48084. };
  48085. }
  48086. static constructSampled(_ref4) {
  48087. let {
  48088. xref,
  48089. isEvalSupported,
  48090. fn,
  48091. dict
  48092. } = _ref4;
  48093. function toMultiArray(arr) {
  48094. const inputLength = arr.length;
  48095. const out = [];
  48096. let index = 0;
  48097. for (let i = 0; i < inputLength; i += 2) {
  48098. out[index++] = [arr[i], arr[i + 1]];
  48099. }
  48100. return out;
  48101. }
  48102. function interpolate(x, xmin, xmax, ymin, ymax) {
  48103. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  48104. }
  48105. let domain = toNumberArray(dict.getArray("Domain"));
  48106. let range = toNumberArray(dict.getArray("Range"));
  48107. if (!domain || !range) {
  48108. throw new _util.FormatError("No domain or range");
  48109. }
  48110. const inputSize = domain.length / 2;
  48111. const outputSize = range.length / 2;
  48112. domain = toMultiArray(domain);
  48113. range = toMultiArray(range);
  48114. const size = toNumberArray(dict.getArray("Size"));
  48115. const bps = dict.get("BitsPerSample");
  48116. const order = dict.get("Order") || 1;
  48117. if (order !== 1) {
  48118. (0, _util.info)("No support for cubic spline interpolation: " + order);
  48119. }
  48120. let encode = toNumberArray(dict.getArray("Encode"));
  48121. if (!encode) {
  48122. encode = [];
  48123. for (let i = 0; i < inputSize; ++i) {
  48124. encode.push([0, size[i] - 1]);
  48125. }
  48126. } else {
  48127. encode = toMultiArray(encode);
  48128. }
  48129. let decode = toNumberArray(dict.getArray("Decode"));
  48130. if (!decode) {
  48131. decode = range;
  48132. } else {
  48133. decode = toMultiArray(decode);
  48134. }
  48135. const samples = this.getSampleArray(size, outputSize, bps, fn);
  48136. return function constructSampledFn(src, srcOffset, dest, destOffset) {
  48137. const cubeVertices = 1 << inputSize;
  48138. const cubeN = new Float64Array(cubeVertices);
  48139. const cubeVertex = new Uint32Array(cubeVertices);
  48140. let i, j;
  48141. for (j = 0; j < cubeVertices; j++) {
  48142. cubeN[j] = 1;
  48143. }
  48144. let k = outputSize,
  48145. pos = 1;
  48146. for (i = 0; i < inputSize; ++i) {
  48147. const domain_2i = domain[i][0];
  48148. const domain_2i_1 = domain[i][1];
  48149. const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  48150. let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  48151. const size_i = size[i];
  48152. e = Math.min(Math.max(e, 0), size_i - 1);
  48153. const e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  48154. const n0 = e0 + 1 - e;
  48155. const n1 = e - e0;
  48156. const offset0 = e0 * k;
  48157. const offset1 = offset0 + k;
  48158. for (j = 0; j < cubeVertices; j++) {
  48159. if (j & pos) {
  48160. cubeN[j] *= n1;
  48161. cubeVertex[j] += offset1;
  48162. } else {
  48163. cubeN[j] *= n0;
  48164. cubeVertex[j] += offset0;
  48165. }
  48166. }
  48167. k *= size_i;
  48168. pos <<= 1;
  48169. }
  48170. for (j = 0; j < outputSize; ++j) {
  48171. let rj = 0;
  48172. for (i = 0; i < cubeVertices; i++) {
  48173. rj += samples[cubeVertex[i] + j] * cubeN[i];
  48174. }
  48175. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  48176. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  48177. }
  48178. };
  48179. }
  48180. static constructInterpolated(_ref5) {
  48181. let {
  48182. xref,
  48183. isEvalSupported,
  48184. dict
  48185. } = _ref5;
  48186. const c0 = toNumberArray(dict.getArray("C0")) || [0];
  48187. const c1 = toNumberArray(dict.getArray("C1")) || [1];
  48188. const n = dict.get("N");
  48189. const diff = [];
  48190. for (let i = 0, ii = c0.length; i < ii; ++i) {
  48191. diff.push(c1[i] - c0[i]);
  48192. }
  48193. const length = diff.length;
  48194. return function constructInterpolatedFn(src, srcOffset, dest, destOffset) {
  48195. const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  48196. for (let j = 0; j < length; ++j) {
  48197. dest[destOffset + j] = c0[j] + x * diff[j];
  48198. }
  48199. };
  48200. }
  48201. static constructStiched(_ref6) {
  48202. let {
  48203. xref,
  48204. isEvalSupported,
  48205. dict
  48206. } = _ref6;
  48207. const domain = toNumberArray(dict.getArray("Domain"));
  48208. if (!domain) {
  48209. throw new _util.FormatError("No domain");
  48210. }
  48211. const inputSize = domain.length / 2;
  48212. if (inputSize !== 1) {
  48213. throw new _util.FormatError("Bad domain for stiched function");
  48214. }
  48215. const fns = [];
  48216. for (const fn of dict.get("Functions")) {
  48217. fns.push(this.parse({
  48218. xref,
  48219. isEvalSupported,
  48220. fn: xref.fetchIfRef(fn)
  48221. }));
  48222. }
  48223. const bounds = toNumberArray(dict.getArray("Bounds"));
  48224. const encode = toNumberArray(dict.getArray("Encode"));
  48225. const tmpBuf = new Float32Array(1);
  48226. return function constructStichedFn(src, srcOffset, dest, destOffset) {
  48227. const clip = function constructStichedFromIRClip(v, min, max) {
  48228. if (v > max) {
  48229. v = max;
  48230. } else if (v < min) {
  48231. v = min;
  48232. }
  48233. return v;
  48234. };
  48235. const v = clip(src[srcOffset], domain[0], domain[1]);
  48236. const length = bounds.length;
  48237. let i;
  48238. for (i = 0; i < length; ++i) {
  48239. if (v < bounds[i]) {
  48240. break;
  48241. }
  48242. }
  48243. let dmin = domain[0];
  48244. if (i > 0) {
  48245. dmin = bounds[i - 1];
  48246. }
  48247. let dmax = domain[1];
  48248. if (i < bounds.length) {
  48249. dmax = bounds[i];
  48250. }
  48251. const rmin = encode[2 * i];
  48252. const rmax = encode[2 * i + 1];
  48253. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  48254. fns[i](tmpBuf, 0, dest, destOffset);
  48255. };
  48256. }
  48257. static constructPostScript(_ref7) {
  48258. let {
  48259. xref,
  48260. isEvalSupported,
  48261. fn,
  48262. dict
  48263. } = _ref7;
  48264. const domain = toNumberArray(dict.getArray("Domain"));
  48265. const range = toNumberArray(dict.getArray("Range"));
  48266. if (!domain) {
  48267. throw new _util.FormatError("No domain.");
  48268. }
  48269. if (!range) {
  48270. throw new _util.FormatError("No range.");
  48271. }
  48272. const lexer = new _ps_parser.PostScriptLexer(fn);
  48273. const parser = new _ps_parser.PostScriptParser(lexer);
  48274. const code = parser.parse();
  48275. if (isEvalSupported && _util.FeatureTest.isEvalSupported) {
  48276. const compiled = new PostScriptCompiler().compile(code, domain, range);
  48277. if (compiled) {
  48278. return new Function("src", "srcOffset", "dest", "destOffset", compiled);
  48279. }
  48280. }
  48281. (0, _util.info)("Unable to compile PS function");
  48282. const numOutputs = range.length >> 1;
  48283. const numInputs = domain.length >> 1;
  48284. const evaluator = new PostScriptEvaluator(code);
  48285. const cache = Object.create(null);
  48286. const MAX_CACHE_SIZE = 2048 * 4;
  48287. let cache_available = MAX_CACHE_SIZE;
  48288. const tmpBuf = new Float32Array(numInputs);
  48289. return function constructPostScriptFn(src, srcOffset, dest, destOffset) {
  48290. let i, value;
  48291. let key = "";
  48292. const input = tmpBuf;
  48293. for (i = 0; i < numInputs; i++) {
  48294. value = src[srcOffset + i];
  48295. input[i] = value;
  48296. key += value + "_";
  48297. }
  48298. const cachedValue = cache[key];
  48299. if (cachedValue !== undefined) {
  48300. dest.set(cachedValue, destOffset);
  48301. return;
  48302. }
  48303. const output = new Float32Array(numOutputs);
  48304. const stack = evaluator.execute(input);
  48305. const stackIndex = stack.length - numOutputs;
  48306. for (i = 0; i < numOutputs; i++) {
  48307. value = stack[stackIndex + i];
  48308. let bound = range[i * 2];
  48309. if (value < bound) {
  48310. value = bound;
  48311. } else {
  48312. bound = range[i * 2 + 1];
  48313. if (value > bound) {
  48314. value = bound;
  48315. }
  48316. }
  48317. output[i] = value;
  48318. }
  48319. if (cache_available > 0) {
  48320. cache_available--;
  48321. cache[key] = output;
  48322. }
  48323. dest.set(output, destOffset);
  48324. };
  48325. }
  48326. }
  48327. function isPDFFunction(v) {
  48328. let fnDict;
  48329. if (typeof v !== "object") {
  48330. return false;
  48331. } else if (v instanceof _primitives.Dict) {
  48332. fnDict = v;
  48333. } else if (v instanceof _base_stream.BaseStream) {
  48334. fnDict = v.dict;
  48335. } else {
  48336. return false;
  48337. }
  48338. return fnDict.has("FunctionType");
  48339. }
  48340. class PostScriptStack {
  48341. static get MAX_STACK_SIZE() {
  48342. return (0, _util.shadow)(this, "MAX_STACK_SIZE", 100);
  48343. }
  48344. constructor(initialStack) {
  48345. this.stack = initialStack ? Array.from(initialStack) : [];
  48346. }
  48347. push(value) {
  48348. if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) {
  48349. throw new Error("PostScript function stack overflow.");
  48350. }
  48351. this.stack.push(value);
  48352. }
  48353. pop() {
  48354. if (this.stack.length <= 0) {
  48355. throw new Error("PostScript function stack underflow.");
  48356. }
  48357. return this.stack.pop();
  48358. }
  48359. copy(n) {
  48360. if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) {
  48361. throw new Error("PostScript function stack overflow.");
  48362. }
  48363. const stack = this.stack;
  48364. for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  48365. stack.push(stack[i]);
  48366. }
  48367. }
  48368. index(n) {
  48369. this.push(this.stack[this.stack.length - n - 1]);
  48370. }
  48371. roll(n, p) {
  48372. const stack = this.stack;
  48373. const l = stack.length - n;
  48374. const r = stack.length - 1;
  48375. const c = l + (p - Math.floor(p / n) * n);
  48376. for (let i = l, j = r; i < j; i++, j--) {
  48377. const t = stack[i];
  48378. stack[i] = stack[j];
  48379. stack[j] = t;
  48380. }
  48381. for (let i = l, j = c - 1; i < j; i++, j--) {
  48382. const t = stack[i];
  48383. stack[i] = stack[j];
  48384. stack[j] = t;
  48385. }
  48386. for (let i = c, j = r; i < j; i++, j--) {
  48387. const t = stack[i];
  48388. stack[i] = stack[j];
  48389. stack[j] = t;
  48390. }
  48391. }
  48392. }
  48393. class PostScriptEvaluator {
  48394. constructor(operators) {
  48395. this.operators = operators;
  48396. }
  48397. execute(initialStack) {
  48398. const stack = new PostScriptStack(initialStack);
  48399. let counter = 0;
  48400. const operators = this.operators;
  48401. const length = operators.length;
  48402. let operator, a, b;
  48403. while (counter < length) {
  48404. operator = operators[counter++];
  48405. if (typeof operator === "number") {
  48406. stack.push(operator);
  48407. continue;
  48408. }
  48409. switch (operator) {
  48410. case "jz":
  48411. b = stack.pop();
  48412. a = stack.pop();
  48413. if (!a) {
  48414. counter = b;
  48415. }
  48416. break;
  48417. case "j":
  48418. a = stack.pop();
  48419. counter = a;
  48420. break;
  48421. case "abs":
  48422. a = stack.pop();
  48423. stack.push(Math.abs(a));
  48424. break;
  48425. case "add":
  48426. b = stack.pop();
  48427. a = stack.pop();
  48428. stack.push(a + b);
  48429. break;
  48430. case "and":
  48431. b = stack.pop();
  48432. a = stack.pop();
  48433. if (typeof a === "boolean" && typeof b === "boolean") {
  48434. stack.push(a && b);
  48435. } else {
  48436. stack.push(a & b);
  48437. }
  48438. break;
  48439. case "atan":
  48440. a = stack.pop();
  48441. stack.push(Math.atan(a));
  48442. break;
  48443. case "bitshift":
  48444. b = stack.pop();
  48445. a = stack.pop();
  48446. if (a > 0) {
  48447. stack.push(a << b);
  48448. } else {
  48449. stack.push(a >> b);
  48450. }
  48451. break;
  48452. case "ceiling":
  48453. a = stack.pop();
  48454. stack.push(Math.ceil(a));
  48455. break;
  48456. case "copy":
  48457. a = stack.pop();
  48458. stack.copy(a);
  48459. break;
  48460. case "cos":
  48461. a = stack.pop();
  48462. stack.push(Math.cos(a));
  48463. break;
  48464. case "cvi":
  48465. a = stack.pop() | 0;
  48466. stack.push(a);
  48467. break;
  48468. case "cvr":
  48469. break;
  48470. case "div":
  48471. b = stack.pop();
  48472. a = stack.pop();
  48473. stack.push(a / b);
  48474. break;
  48475. case "dup":
  48476. stack.copy(1);
  48477. break;
  48478. case "eq":
  48479. b = stack.pop();
  48480. a = stack.pop();
  48481. stack.push(a === b);
  48482. break;
  48483. case "exch":
  48484. stack.roll(2, 1);
  48485. break;
  48486. case "exp":
  48487. b = stack.pop();
  48488. a = stack.pop();
  48489. stack.push(a ** b);
  48490. break;
  48491. case "false":
  48492. stack.push(false);
  48493. break;
  48494. case "floor":
  48495. a = stack.pop();
  48496. stack.push(Math.floor(a));
  48497. break;
  48498. case "ge":
  48499. b = stack.pop();
  48500. a = stack.pop();
  48501. stack.push(a >= b);
  48502. break;
  48503. case "gt":
  48504. b = stack.pop();
  48505. a = stack.pop();
  48506. stack.push(a > b);
  48507. break;
  48508. case "idiv":
  48509. b = stack.pop();
  48510. a = stack.pop();
  48511. stack.push(a / b | 0);
  48512. break;
  48513. case "index":
  48514. a = stack.pop();
  48515. stack.index(a);
  48516. break;
  48517. case "le":
  48518. b = stack.pop();
  48519. a = stack.pop();
  48520. stack.push(a <= b);
  48521. break;
  48522. case "ln":
  48523. a = stack.pop();
  48524. stack.push(Math.log(a));
  48525. break;
  48526. case "log":
  48527. a = stack.pop();
  48528. stack.push(Math.log(a) / Math.LN10);
  48529. break;
  48530. case "lt":
  48531. b = stack.pop();
  48532. a = stack.pop();
  48533. stack.push(a < b);
  48534. break;
  48535. case "mod":
  48536. b = stack.pop();
  48537. a = stack.pop();
  48538. stack.push(a % b);
  48539. break;
  48540. case "mul":
  48541. b = stack.pop();
  48542. a = stack.pop();
  48543. stack.push(a * b);
  48544. break;
  48545. case "ne":
  48546. b = stack.pop();
  48547. a = stack.pop();
  48548. stack.push(a !== b);
  48549. break;
  48550. case "neg":
  48551. a = stack.pop();
  48552. stack.push(-a);
  48553. break;
  48554. case "not":
  48555. a = stack.pop();
  48556. if (typeof a === "boolean") {
  48557. stack.push(!a);
  48558. } else {
  48559. stack.push(~a);
  48560. }
  48561. break;
  48562. case "or":
  48563. b = stack.pop();
  48564. a = stack.pop();
  48565. if (typeof a === "boolean" && typeof b === "boolean") {
  48566. stack.push(a || b);
  48567. } else {
  48568. stack.push(a | b);
  48569. }
  48570. break;
  48571. case "pop":
  48572. stack.pop();
  48573. break;
  48574. case "roll":
  48575. b = stack.pop();
  48576. a = stack.pop();
  48577. stack.roll(a, b);
  48578. break;
  48579. case "round":
  48580. a = stack.pop();
  48581. stack.push(Math.round(a));
  48582. break;
  48583. case "sin":
  48584. a = stack.pop();
  48585. stack.push(Math.sin(a));
  48586. break;
  48587. case "sqrt":
  48588. a = stack.pop();
  48589. stack.push(Math.sqrt(a));
  48590. break;
  48591. case "sub":
  48592. b = stack.pop();
  48593. a = stack.pop();
  48594. stack.push(a - b);
  48595. break;
  48596. case "true":
  48597. stack.push(true);
  48598. break;
  48599. case "truncate":
  48600. a = stack.pop();
  48601. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  48602. stack.push(a);
  48603. break;
  48604. case "xor":
  48605. b = stack.pop();
  48606. a = stack.pop();
  48607. if (typeof a === "boolean" && typeof b === "boolean") {
  48608. stack.push(a !== b);
  48609. } else {
  48610. stack.push(a ^ b);
  48611. }
  48612. break;
  48613. default:
  48614. throw new _util.FormatError(`Unknown operator ${operator}`);
  48615. }
  48616. }
  48617. return stack.stack;
  48618. }
  48619. }
  48620. exports.PostScriptEvaluator = PostScriptEvaluator;
  48621. class AstNode {
  48622. constructor(type) {
  48623. this.type = type;
  48624. }
  48625. visit(visitor) {
  48626. (0, _util.unreachable)("abstract method");
  48627. }
  48628. }
  48629. class AstArgument extends AstNode {
  48630. constructor(index, min, max) {
  48631. super("args");
  48632. this.index = index;
  48633. this.min = min;
  48634. this.max = max;
  48635. }
  48636. visit(visitor) {
  48637. visitor.visitArgument(this);
  48638. }
  48639. }
  48640. class AstLiteral extends AstNode {
  48641. constructor(number) {
  48642. super("literal");
  48643. this.number = number;
  48644. this.min = number;
  48645. this.max = number;
  48646. }
  48647. visit(visitor) {
  48648. visitor.visitLiteral(this);
  48649. }
  48650. }
  48651. class AstBinaryOperation extends AstNode {
  48652. constructor(op, arg1, arg2, min, max) {
  48653. super("binary");
  48654. this.op = op;
  48655. this.arg1 = arg1;
  48656. this.arg2 = arg2;
  48657. this.min = min;
  48658. this.max = max;
  48659. }
  48660. visit(visitor) {
  48661. visitor.visitBinaryOperation(this);
  48662. }
  48663. }
  48664. class AstMin extends AstNode {
  48665. constructor(arg, max) {
  48666. super("max");
  48667. this.arg = arg;
  48668. this.min = arg.min;
  48669. this.max = max;
  48670. }
  48671. visit(visitor) {
  48672. visitor.visitMin(this);
  48673. }
  48674. }
  48675. class AstVariable extends AstNode {
  48676. constructor(index, min, max) {
  48677. super("var");
  48678. this.index = index;
  48679. this.min = min;
  48680. this.max = max;
  48681. }
  48682. visit(visitor) {
  48683. visitor.visitVariable(this);
  48684. }
  48685. }
  48686. class AstVariableDefinition extends AstNode {
  48687. constructor(variable, arg) {
  48688. super("definition");
  48689. this.variable = variable;
  48690. this.arg = arg;
  48691. }
  48692. visit(visitor) {
  48693. visitor.visitVariableDefinition(this);
  48694. }
  48695. }
  48696. class ExpressionBuilderVisitor {
  48697. constructor() {
  48698. this.parts = [];
  48699. }
  48700. visitArgument(arg) {
  48701. this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
  48702. }
  48703. visitVariable(variable) {
  48704. this.parts.push("v", variable.index);
  48705. }
  48706. visitLiteral(literal) {
  48707. this.parts.push(literal.number);
  48708. }
  48709. visitBinaryOperation(operation) {
  48710. this.parts.push("(");
  48711. operation.arg1.visit(this);
  48712. this.parts.push(" ", operation.op, " ");
  48713. operation.arg2.visit(this);
  48714. this.parts.push(")");
  48715. }
  48716. visitVariableDefinition(definition) {
  48717. this.parts.push("var ");
  48718. definition.variable.visit(this);
  48719. this.parts.push(" = ");
  48720. definition.arg.visit(this);
  48721. this.parts.push(";");
  48722. }
  48723. visitMin(max) {
  48724. this.parts.push("Math.min(");
  48725. max.arg.visit(this);
  48726. this.parts.push(", ", max.max, ")");
  48727. }
  48728. toString() {
  48729. return this.parts.join("");
  48730. }
  48731. }
  48732. function buildAddOperation(num1, num2) {
  48733. if (num2.type === "literal" && num2.number === 0) {
  48734. return num1;
  48735. }
  48736. if (num1.type === "literal" && num1.number === 0) {
  48737. return num2;
  48738. }
  48739. if (num2.type === "literal" && num1.type === "literal") {
  48740. return new AstLiteral(num1.number + num2.number);
  48741. }
  48742. return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
  48743. }
  48744. function buildMulOperation(num1, num2) {
  48745. if (num2.type === "literal") {
  48746. if (num2.number === 0) {
  48747. return new AstLiteral(0);
  48748. } else if (num2.number === 1) {
  48749. return num1;
  48750. } else if (num1.type === "literal") {
  48751. return new AstLiteral(num1.number * num2.number);
  48752. }
  48753. }
  48754. if (num1.type === "literal") {
  48755. if (num1.number === 0) {
  48756. return new AstLiteral(0);
  48757. } else if (num1.number === 1) {
  48758. return num2;
  48759. }
  48760. }
  48761. const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  48762. const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  48763. return new AstBinaryOperation("*", num1, num2, min, max);
  48764. }
  48765. function buildSubOperation(num1, num2) {
  48766. if (num2.type === "literal") {
  48767. if (num2.number === 0) {
  48768. return num1;
  48769. } else if (num1.type === "literal") {
  48770. return new AstLiteral(num1.number - num2.number);
  48771. }
  48772. }
  48773. if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
  48774. return num2.arg2;
  48775. }
  48776. return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
  48777. }
  48778. function buildMinOperation(num1, max) {
  48779. if (num1.min >= max) {
  48780. return new AstLiteral(max);
  48781. } else if (num1.max <= max) {
  48782. return num1;
  48783. }
  48784. return new AstMin(num1, max);
  48785. }
  48786. class PostScriptCompiler {
  48787. compile(code, domain, range) {
  48788. const stack = [];
  48789. const instructions = [];
  48790. const inputSize = domain.length >> 1,
  48791. outputSize = range.length >> 1;
  48792. let lastRegister = 0;
  48793. let n, j;
  48794. let num1, num2, ast1, ast2, tmpVar, item;
  48795. for (let i = 0; i < inputSize; i++) {
  48796. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  48797. }
  48798. for (let i = 0, ii = code.length; i < ii; i++) {
  48799. item = code[i];
  48800. if (typeof item === "number") {
  48801. stack.push(new AstLiteral(item));
  48802. continue;
  48803. }
  48804. switch (item) {
  48805. case "add":
  48806. if (stack.length < 2) {
  48807. return null;
  48808. }
  48809. num2 = stack.pop();
  48810. num1 = stack.pop();
  48811. stack.push(buildAddOperation(num1, num2));
  48812. break;
  48813. case "cvr":
  48814. if (stack.length < 1) {
  48815. return null;
  48816. }
  48817. break;
  48818. case "mul":
  48819. if (stack.length < 2) {
  48820. return null;
  48821. }
  48822. num2 = stack.pop();
  48823. num1 = stack.pop();
  48824. stack.push(buildMulOperation(num1, num2));
  48825. break;
  48826. case "sub":
  48827. if (stack.length < 2) {
  48828. return null;
  48829. }
  48830. num2 = stack.pop();
  48831. num1 = stack.pop();
  48832. stack.push(buildSubOperation(num1, num2));
  48833. break;
  48834. case "exch":
  48835. if (stack.length < 2) {
  48836. return null;
  48837. }
  48838. ast1 = stack.pop();
  48839. ast2 = stack.pop();
  48840. stack.push(ast1, ast2);
  48841. break;
  48842. case "pop":
  48843. if (stack.length < 1) {
  48844. return null;
  48845. }
  48846. stack.pop();
  48847. break;
  48848. case "index":
  48849. if (stack.length < 1) {
  48850. return null;
  48851. }
  48852. num1 = stack.pop();
  48853. if (num1.type !== "literal") {
  48854. return null;
  48855. }
  48856. n = num1.number;
  48857. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  48858. return null;
  48859. }
  48860. ast1 = stack[stack.length - n - 1];
  48861. if (ast1.type === "literal" || ast1.type === "var") {
  48862. stack.push(ast1);
  48863. break;
  48864. }
  48865. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  48866. stack[stack.length - n - 1] = tmpVar;
  48867. stack.push(tmpVar);
  48868. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  48869. break;
  48870. case "dup":
  48871. if (stack.length < 1) {
  48872. return null;
  48873. }
  48874. 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]) {
  48875. num1 = stack.pop();
  48876. stack.push(buildMinOperation(num1, code[i + 1]));
  48877. i += 6;
  48878. break;
  48879. }
  48880. ast1 = stack.at(-1);
  48881. if (ast1.type === "literal" || ast1.type === "var") {
  48882. stack.push(ast1);
  48883. break;
  48884. }
  48885. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  48886. stack[stack.length - 1] = tmpVar;
  48887. stack.push(tmpVar);
  48888. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  48889. break;
  48890. case "roll":
  48891. if (stack.length < 2) {
  48892. return null;
  48893. }
  48894. num2 = stack.pop();
  48895. num1 = stack.pop();
  48896. if (num2.type !== "literal" || num1.type !== "literal") {
  48897. return null;
  48898. }
  48899. j = num2.number;
  48900. n = num1.number;
  48901. if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
  48902. return null;
  48903. }
  48904. j = (j % n + n) % n;
  48905. if (j === 0) {
  48906. break;
  48907. }
  48908. stack.push(...stack.splice(stack.length - n, n - j));
  48909. break;
  48910. default:
  48911. return null;
  48912. }
  48913. }
  48914. if (stack.length !== outputSize) {
  48915. return null;
  48916. }
  48917. const result = [];
  48918. for (const instruction of instructions) {
  48919. const statementBuilder = new ExpressionBuilderVisitor();
  48920. instruction.visit(statementBuilder);
  48921. result.push(statementBuilder.toString());
  48922. }
  48923. for (let i = 0, ii = stack.length; i < ii; i++) {
  48924. const expr = stack[i],
  48925. statementBuilder = new ExpressionBuilderVisitor();
  48926. expr.visit(statementBuilder);
  48927. const min = range[i * 2],
  48928. max = range[i * 2 + 1];
  48929. const out = [statementBuilder.toString()];
  48930. if (min > expr.min) {
  48931. out.unshift("Math.max(", min, ", ");
  48932. out.push(")");
  48933. }
  48934. if (max < expr.max) {
  48935. out.unshift("Math.min(", max, ", ");
  48936. out.push(")");
  48937. }
  48938. out.unshift("dest[destOffset + ", i, "] = ");
  48939. out.push(";");
  48940. result.push(out.join(""));
  48941. }
  48942. return result.join("\n");
  48943. }
  48944. }
  48945. exports.PostScriptCompiler = PostScriptCompiler;
  48946. /***/ }),
  48947. /* 189 */
  48948. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48949. "use strict";
  48950. Object.defineProperty(exports, "__esModule", ({
  48951. value: true
  48952. }));
  48953. exports.PostScriptParser = exports.PostScriptLexer = void 0;
  48954. var _util = __w_pdfjs_require__(2);
  48955. var _primitives = __w_pdfjs_require__(137);
  48956. var _core_utils = __w_pdfjs_require__(136);
  48957. class PostScriptParser {
  48958. constructor(lexer) {
  48959. this.lexer = lexer;
  48960. this.operators = [];
  48961. this.token = null;
  48962. this.prev = null;
  48963. }
  48964. nextToken() {
  48965. this.prev = this.token;
  48966. this.token = this.lexer.getToken();
  48967. }
  48968. accept(type) {
  48969. if (this.token.type === type) {
  48970. this.nextToken();
  48971. return true;
  48972. }
  48973. return false;
  48974. }
  48975. expect(type) {
  48976. if (this.accept(type)) {
  48977. return true;
  48978. }
  48979. throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
  48980. }
  48981. parse() {
  48982. this.nextToken();
  48983. this.expect(PostScriptTokenTypes.LBRACE);
  48984. this.parseBlock();
  48985. this.expect(PostScriptTokenTypes.RBRACE);
  48986. return this.operators;
  48987. }
  48988. parseBlock() {
  48989. while (true) {
  48990. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  48991. this.operators.push(this.prev.value);
  48992. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  48993. this.operators.push(this.prev.value);
  48994. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  48995. this.parseCondition();
  48996. } else {
  48997. return;
  48998. }
  48999. }
  49000. }
  49001. parseCondition() {
  49002. const conditionLocation = this.operators.length;
  49003. this.operators.push(null, null);
  49004. this.parseBlock();
  49005. this.expect(PostScriptTokenTypes.RBRACE);
  49006. if (this.accept(PostScriptTokenTypes.IF)) {
  49007. this.operators[conditionLocation] = this.operators.length;
  49008. this.operators[conditionLocation + 1] = "jz";
  49009. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  49010. const jumpLocation = this.operators.length;
  49011. this.operators.push(null, null);
  49012. const endOfTrue = this.operators.length;
  49013. this.parseBlock();
  49014. this.expect(PostScriptTokenTypes.RBRACE);
  49015. this.expect(PostScriptTokenTypes.IFELSE);
  49016. this.operators[jumpLocation] = this.operators.length;
  49017. this.operators[jumpLocation + 1] = "j";
  49018. this.operators[conditionLocation] = endOfTrue;
  49019. this.operators[conditionLocation + 1] = "jz";
  49020. } else {
  49021. throw new _util.FormatError("PS Function: error parsing conditional.");
  49022. }
  49023. }
  49024. }
  49025. exports.PostScriptParser = PostScriptParser;
  49026. const PostScriptTokenTypes = {
  49027. LBRACE: 0,
  49028. RBRACE: 1,
  49029. NUMBER: 2,
  49030. OPERATOR: 3,
  49031. IF: 4,
  49032. IFELSE: 5
  49033. };
  49034. class PostScriptToken {
  49035. static get opCache() {
  49036. return (0, _util.shadow)(this, "opCache", Object.create(null));
  49037. }
  49038. constructor(type, value) {
  49039. this.type = type;
  49040. this.value = value;
  49041. }
  49042. static getOperator(op) {
  49043. const opValue = PostScriptToken.opCache[op];
  49044. if (opValue) {
  49045. return opValue;
  49046. }
  49047. return PostScriptToken.opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  49048. }
  49049. static get LBRACE() {
  49050. return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
  49051. }
  49052. static get RBRACE() {
  49053. return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
  49054. }
  49055. static get IF() {
  49056. return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
  49057. }
  49058. static get IFELSE() {
  49059. return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
  49060. }
  49061. }
  49062. class PostScriptLexer {
  49063. constructor(stream) {
  49064. this.stream = stream;
  49065. this.nextChar();
  49066. this.strBuf = [];
  49067. }
  49068. nextChar() {
  49069. return this.currentChar = this.stream.getByte();
  49070. }
  49071. getToken() {
  49072. let comment = false;
  49073. let ch = this.currentChar;
  49074. while (true) {
  49075. if (ch < 0) {
  49076. return _primitives.EOF;
  49077. }
  49078. if (comment) {
  49079. if (ch === 0x0a || ch === 0x0d) {
  49080. comment = false;
  49081. }
  49082. } else if (ch === 0x25) {
  49083. comment = true;
  49084. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  49085. break;
  49086. }
  49087. ch = this.nextChar();
  49088. }
  49089. switch (ch | 0) {
  49090. case 0x30:
  49091. case 0x31:
  49092. case 0x32:
  49093. case 0x33:
  49094. case 0x34:
  49095. case 0x35:
  49096. case 0x36:
  49097. case 0x37:
  49098. case 0x38:
  49099. case 0x39:
  49100. case 0x2b:
  49101. case 0x2d:
  49102. case 0x2e:
  49103. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  49104. case 0x7b:
  49105. this.nextChar();
  49106. return PostScriptToken.LBRACE;
  49107. case 0x7d:
  49108. this.nextChar();
  49109. return PostScriptToken.RBRACE;
  49110. }
  49111. const strBuf = this.strBuf;
  49112. strBuf.length = 0;
  49113. strBuf[0] = String.fromCharCode(ch);
  49114. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
  49115. strBuf.push(String.fromCharCode(ch));
  49116. }
  49117. const str = strBuf.join("");
  49118. switch (str.toLowerCase()) {
  49119. case "if":
  49120. return PostScriptToken.IF;
  49121. case "ifelse":
  49122. return PostScriptToken.IFELSE;
  49123. default:
  49124. return PostScriptToken.getOperator(str);
  49125. }
  49126. }
  49127. getNumber() {
  49128. let ch = this.currentChar;
  49129. const strBuf = this.strBuf;
  49130. strBuf.length = 0;
  49131. strBuf[0] = String.fromCharCode(ch);
  49132. while ((ch = this.nextChar()) >= 0) {
  49133. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
  49134. strBuf.push(String.fromCharCode(ch));
  49135. } else {
  49136. break;
  49137. }
  49138. }
  49139. const value = parseFloat(strBuf.join(""));
  49140. if (isNaN(value)) {
  49141. throw new _util.FormatError(`Invalid floating point number: ${value}`);
  49142. }
  49143. return value;
  49144. }
  49145. }
  49146. exports.PostScriptLexer = PostScriptLexer;
  49147. /***/ }),
  49148. /* 190 */
  49149. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49150. "use strict";
  49151. Object.defineProperty(exports, "__esModule", ({
  49152. value: true
  49153. }));
  49154. exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0;
  49155. var _util = __w_pdfjs_require__(2);
  49156. var _primitives = __w_pdfjs_require__(137);
  49157. class BaseLocalCache {
  49158. constructor(options) {
  49159. if (this.constructor === BaseLocalCache) {
  49160. (0, _util.unreachable)("Cannot initialize BaseLocalCache.");
  49161. }
  49162. this._onlyRefs = (options && options.onlyRefs) === true;
  49163. if (!this._onlyRefs) {
  49164. this._nameRefMap = new Map();
  49165. this._imageMap = new Map();
  49166. }
  49167. this._imageCache = new _primitives.RefSetCache();
  49168. }
  49169. getByName(name) {
  49170. if (this._onlyRefs) {
  49171. (0, _util.unreachable)("Should not call `getByName` method.");
  49172. }
  49173. const ref = this._nameRefMap.get(name);
  49174. if (ref) {
  49175. return this.getByRef(ref);
  49176. }
  49177. return this._imageMap.get(name) || null;
  49178. }
  49179. getByRef(ref) {
  49180. return this._imageCache.get(ref) || null;
  49181. }
  49182. set(name, ref, data) {
  49183. (0, _util.unreachable)("Abstract method `set` called.");
  49184. }
  49185. }
  49186. class LocalImageCache extends BaseLocalCache {
  49187. set(name) {
  49188. let ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  49189. let data = arguments.length > 2 ? arguments[2] : undefined;
  49190. if (typeof name !== "string") {
  49191. throw new Error('LocalImageCache.set - expected "name" argument.');
  49192. }
  49193. if (ref) {
  49194. if (this._imageCache.has(ref)) {
  49195. return;
  49196. }
  49197. this._nameRefMap.set(name, ref);
  49198. this._imageCache.put(ref, data);
  49199. return;
  49200. }
  49201. if (this._imageMap.has(name)) {
  49202. return;
  49203. }
  49204. this._imageMap.set(name, data);
  49205. }
  49206. }
  49207. exports.LocalImageCache = LocalImageCache;
  49208. class LocalColorSpaceCache extends BaseLocalCache {
  49209. set() {
  49210. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  49211. let ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  49212. let data = arguments.length > 2 ? arguments[2] : undefined;
  49213. if (typeof name !== "string" && !ref) {
  49214. throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');
  49215. }
  49216. if (ref) {
  49217. if (this._imageCache.has(ref)) {
  49218. return;
  49219. }
  49220. if (name !== null) {
  49221. this._nameRefMap.set(name, ref);
  49222. }
  49223. this._imageCache.put(ref, data);
  49224. return;
  49225. }
  49226. if (this._imageMap.has(name)) {
  49227. return;
  49228. }
  49229. this._imageMap.set(name, data);
  49230. }
  49231. }
  49232. exports.LocalColorSpaceCache = LocalColorSpaceCache;
  49233. class LocalFunctionCache extends BaseLocalCache {
  49234. constructor(options) {
  49235. super({
  49236. onlyRefs: true
  49237. });
  49238. }
  49239. set() {
  49240. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  49241. let ref = arguments.length > 1 ? arguments[1] : undefined;
  49242. let data = arguments.length > 2 ? arguments[2] : undefined;
  49243. if (!ref) {
  49244. throw new Error('LocalFunctionCache.set - expected "ref" argument.');
  49245. }
  49246. if (this._imageCache.has(ref)) {
  49247. return;
  49248. }
  49249. this._imageCache.put(ref, data);
  49250. }
  49251. }
  49252. exports.LocalFunctionCache = LocalFunctionCache;
  49253. class LocalGStateCache extends BaseLocalCache {
  49254. set(name) {
  49255. let ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  49256. let data = arguments.length > 2 ? arguments[2] : undefined;
  49257. if (typeof name !== "string") {
  49258. throw new Error('LocalGStateCache.set - expected "name" argument.');
  49259. }
  49260. if (ref) {
  49261. if (this._imageCache.has(ref)) {
  49262. return;
  49263. }
  49264. this._nameRefMap.set(name, ref);
  49265. this._imageCache.put(ref, data);
  49266. return;
  49267. }
  49268. if (this._imageMap.has(name)) {
  49269. return;
  49270. }
  49271. this._imageMap.set(name, data);
  49272. }
  49273. }
  49274. exports.LocalGStateCache = LocalGStateCache;
  49275. class LocalTilingPatternCache extends BaseLocalCache {
  49276. constructor(options) {
  49277. super({
  49278. onlyRefs: true
  49279. });
  49280. }
  49281. set() {
  49282. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  49283. let ref = arguments.length > 1 ? arguments[1] : undefined;
  49284. let data = arguments.length > 2 ? arguments[2] : undefined;
  49285. if (!ref) {
  49286. throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');
  49287. }
  49288. if (this._imageCache.has(ref)) {
  49289. return;
  49290. }
  49291. this._imageCache.put(ref, data);
  49292. }
  49293. }
  49294. exports.LocalTilingPatternCache = LocalTilingPatternCache;
  49295. class GlobalImageCache {
  49296. static get NUM_PAGES_THRESHOLD() {
  49297. return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
  49298. }
  49299. static get MIN_IMAGES_TO_CACHE() {
  49300. return (0, _util.shadow)(this, "MIN_IMAGES_TO_CACHE", 10);
  49301. }
  49302. static get MAX_BYTE_SIZE() {
  49303. return (0, _util.shadow)(this, "MAX_BYTE_SIZE", 40e6);
  49304. }
  49305. constructor() {
  49306. this._refCache = new _primitives.RefSetCache();
  49307. this._imageCache = new _primitives.RefSetCache();
  49308. }
  49309. get _byteSize() {
  49310. let byteSize = 0;
  49311. for (const imageData of this._imageCache) {
  49312. byteSize += imageData.byteSize;
  49313. }
  49314. return byteSize;
  49315. }
  49316. get _cacheLimitReached() {
  49317. if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) {
  49318. return false;
  49319. }
  49320. if (this._byteSize < GlobalImageCache.MAX_BYTE_SIZE) {
  49321. return false;
  49322. }
  49323. return true;
  49324. }
  49325. shouldCache(ref, pageIndex) {
  49326. const pageIndexSet = this._refCache.get(ref);
  49327. const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1;
  49328. if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  49329. return false;
  49330. }
  49331. if (!this._imageCache.has(ref) && this._cacheLimitReached) {
  49332. return false;
  49333. }
  49334. return true;
  49335. }
  49336. addPageIndex(ref, pageIndex) {
  49337. let pageIndexSet = this._refCache.get(ref);
  49338. if (!pageIndexSet) {
  49339. pageIndexSet = new Set();
  49340. this._refCache.put(ref, pageIndexSet);
  49341. }
  49342. pageIndexSet.add(pageIndex);
  49343. }
  49344. addByteSize(ref, byteSize) {
  49345. const imageData = this._imageCache.get(ref);
  49346. if (!imageData) {
  49347. return;
  49348. }
  49349. if (imageData.byteSize) {
  49350. return;
  49351. }
  49352. imageData.byteSize = byteSize;
  49353. }
  49354. getData(ref, pageIndex) {
  49355. const pageIndexSet = this._refCache.get(ref);
  49356. if (!pageIndexSet) {
  49357. return null;
  49358. }
  49359. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  49360. return null;
  49361. }
  49362. const imageData = this._imageCache.get(ref);
  49363. if (!imageData) {
  49364. return null;
  49365. }
  49366. pageIndexSet.add(pageIndex);
  49367. return imageData;
  49368. }
  49369. setData(ref, data) {
  49370. if (!this._refCache.has(ref)) {
  49371. throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.');
  49372. }
  49373. if (this._imageCache.has(ref)) {
  49374. return;
  49375. }
  49376. if (this._cacheLimitReached) {
  49377. (0, _util.warn)("GlobalImageCache.setData - cache limit reached.");
  49378. return;
  49379. }
  49380. this._imageCache.put(ref, data);
  49381. }
  49382. clear() {
  49383. let onlyData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  49384. if (!onlyData) {
  49385. this._refCache.clear();
  49386. }
  49387. this._imageCache.clear();
  49388. }
  49389. }
  49390. exports.GlobalImageCache = GlobalImageCache;
  49391. /***/ }),
  49392. /* 191 */
  49393. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49394. "use strict";
  49395. Object.defineProperty(exports, "__esModule", ({
  49396. value: true
  49397. }));
  49398. exports.bidi = bidi;
  49399. var _util = __w_pdfjs_require__(2);
  49400. 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"];
  49401. 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"];
  49402. function isOdd(i) {
  49403. return (i & 1) !== 0;
  49404. }
  49405. function isEven(i) {
  49406. return (i & 1) === 0;
  49407. }
  49408. function findUnequal(arr, start, value) {
  49409. let j, jj;
  49410. for (j = start, jj = arr.length; j < jj; ++j) {
  49411. if (arr[j] !== value) {
  49412. return j;
  49413. }
  49414. }
  49415. return j;
  49416. }
  49417. function setValues(arr, start, end, value) {
  49418. for (let j = start; j < end; ++j) {
  49419. arr[j] = value;
  49420. }
  49421. }
  49422. function reverseValues(arr, start, end) {
  49423. for (let i = start, j = end - 1; i < j; ++i, --j) {
  49424. const temp = arr[i];
  49425. arr[i] = arr[j];
  49426. arr[j] = temp;
  49427. }
  49428. }
  49429. function createBidiText(str, isLTR) {
  49430. let vertical = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  49431. let dir = "ltr";
  49432. if (vertical) {
  49433. dir = "ttb";
  49434. } else if (!isLTR) {
  49435. dir = "rtl";
  49436. }
  49437. return {
  49438. str,
  49439. dir
  49440. };
  49441. }
  49442. const chars = [];
  49443. const types = [];
  49444. function bidi(str) {
  49445. let startLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
  49446. let vertical = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  49447. let isLTR = true;
  49448. const strLength = str.length;
  49449. if (strLength === 0 || vertical) {
  49450. return createBidiText(str, isLTR, vertical);
  49451. }
  49452. chars.length = strLength;
  49453. types.length = strLength;
  49454. let numBidi = 0;
  49455. let i, ii;
  49456. for (i = 0; i < strLength; ++i) {
  49457. chars[i] = str.charAt(i);
  49458. const charCode = str.charCodeAt(i);
  49459. let charType = "L";
  49460. if (charCode <= 0x00ff) {
  49461. charType = baseTypes[charCode];
  49462. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  49463. charType = "R";
  49464. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  49465. charType = arabicTypes[charCode & 0xff];
  49466. if (!charType) {
  49467. (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16));
  49468. }
  49469. } else if (0x0700 <= charCode && charCode <= 0x08ac) {
  49470. charType = "AL";
  49471. }
  49472. if (charType === "R" || charType === "AL" || charType === "AN") {
  49473. numBidi++;
  49474. }
  49475. types[i] = charType;
  49476. }
  49477. if (numBidi === 0) {
  49478. isLTR = true;
  49479. return createBidiText(str, isLTR);
  49480. }
  49481. if (startLevel === -1) {
  49482. if (numBidi / strLength < 0.3 && strLength > 4) {
  49483. isLTR = true;
  49484. startLevel = 0;
  49485. } else {
  49486. isLTR = false;
  49487. startLevel = 1;
  49488. }
  49489. }
  49490. const levels = [];
  49491. for (i = 0; i < strLength; ++i) {
  49492. levels[i] = startLevel;
  49493. }
  49494. const e = isOdd(startLevel) ? "R" : "L";
  49495. const sor = e;
  49496. const eor = sor;
  49497. let lastType = sor;
  49498. for (i = 0; i < strLength; ++i) {
  49499. if (types[i] === "NSM") {
  49500. types[i] = lastType;
  49501. } else {
  49502. lastType = types[i];
  49503. }
  49504. }
  49505. lastType = sor;
  49506. let t;
  49507. for (i = 0; i < strLength; ++i) {
  49508. t = types[i];
  49509. if (t === "EN") {
  49510. types[i] = lastType === "AL" ? "AN" : "EN";
  49511. } else if (t === "R" || t === "L" || t === "AL") {
  49512. lastType = t;
  49513. }
  49514. }
  49515. for (i = 0; i < strLength; ++i) {
  49516. t = types[i];
  49517. if (t === "AL") {
  49518. types[i] = "R";
  49519. }
  49520. }
  49521. for (i = 1; i < strLength - 1; ++i) {
  49522. if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
  49523. types[i] = "EN";
  49524. }
  49525. if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
  49526. types[i] = types[i - 1];
  49527. }
  49528. }
  49529. for (i = 0; i < strLength; ++i) {
  49530. if (types[i] === "EN") {
  49531. for (let j = i - 1; j >= 0; --j) {
  49532. if (types[j] !== "ET") {
  49533. break;
  49534. }
  49535. types[j] = "EN";
  49536. }
  49537. for (let j = i + 1; j < strLength; ++j) {
  49538. if (types[j] !== "ET") {
  49539. break;
  49540. }
  49541. types[j] = "EN";
  49542. }
  49543. }
  49544. }
  49545. for (i = 0; i < strLength; ++i) {
  49546. t = types[i];
  49547. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  49548. types[i] = "ON";
  49549. }
  49550. }
  49551. lastType = sor;
  49552. for (i = 0; i < strLength; ++i) {
  49553. t = types[i];
  49554. if (t === "EN") {
  49555. types[i] = lastType === "L" ? "L" : "EN";
  49556. } else if (t === "R" || t === "L") {
  49557. lastType = t;
  49558. }
  49559. }
  49560. for (i = 0; i < strLength; ++i) {
  49561. if (types[i] === "ON") {
  49562. const end = findUnequal(types, i + 1, "ON");
  49563. let before = sor;
  49564. if (i > 0) {
  49565. before = types[i - 1];
  49566. }
  49567. let after = eor;
  49568. if (end + 1 < strLength) {
  49569. after = types[end + 1];
  49570. }
  49571. if (before !== "L") {
  49572. before = "R";
  49573. }
  49574. if (after !== "L") {
  49575. after = "R";
  49576. }
  49577. if (before === after) {
  49578. setValues(types, i, end, before);
  49579. }
  49580. i = end - 1;
  49581. }
  49582. }
  49583. for (i = 0; i < strLength; ++i) {
  49584. if (types[i] === "ON") {
  49585. types[i] = e;
  49586. }
  49587. }
  49588. for (i = 0; i < strLength; ++i) {
  49589. t = types[i];
  49590. if (isEven(levels[i])) {
  49591. if (t === "R") {
  49592. levels[i] += 1;
  49593. } else if (t === "AN" || t === "EN") {
  49594. levels[i] += 2;
  49595. }
  49596. } else {
  49597. if (t === "L" || t === "AN" || t === "EN") {
  49598. levels[i] += 1;
  49599. }
  49600. }
  49601. }
  49602. let highestLevel = -1;
  49603. let lowestOddLevel = 99;
  49604. let level;
  49605. for (i = 0, ii = levels.length; i < ii; ++i) {
  49606. level = levels[i];
  49607. if (highestLevel < level) {
  49608. highestLevel = level;
  49609. }
  49610. if (lowestOddLevel > level && isOdd(level)) {
  49611. lowestOddLevel = level;
  49612. }
  49613. }
  49614. for (level = highestLevel; level >= lowestOddLevel; --level) {
  49615. let start = -1;
  49616. for (i = 0, ii = levels.length; i < ii; ++i) {
  49617. if (levels[i] < level) {
  49618. if (start >= 0) {
  49619. reverseValues(chars, start, i);
  49620. start = -1;
  49621. }
  49622. } else if (start < 0) {
  49623. start = i;
  49624. }
  49625. }
  49626. if (start >= 0) {
  49627. reverseValues(chars, start, levels.length);
  49628. }
  49629. }
  49630. for (i = 0, ii = chars.length; i < ii; ++i) {
  49631. const ch = chars[i];
  49632. if (ch === "<" || ch === ">") {
  49633. chars[i] = "";
  49634. }
  49635. }
  49636. return createBidiText(chars.join(""), isLTR);
  49637. }
  49638. /***/ }),
  49639. /* 192 */
  49640. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49641. "use strict";
  49642. Object.defineProperty(exports, "__esModule", ({
  49643. value: true
  49644. }));
  49645. exports.MurmurHash3_64 = void 0;
  49646. var _util = __w_pdfjs_require__(2);
  49647. const SEED = 0xc3d2e1f0;
  49648. const MASK_HIGH = 0xffff0000;
  49649. const MASK_LOW = 0xffff;
  49650. class MurmurHash3_64 {
  49651. constructor(seed) {
  49652. this.h1 = seed ? seed & 0xffffffff : SEED;
  49653. this.h2 = seed ? seed & 0xffffffff : SEED;
  49654. }
  49655. update(input) {
  49656. let data, length;
  49657. if (typeof input === "string") {
  49658. data = new Uint8Array(input.length * 2);
  49659. length = 0;
  49660. for (let i = 0, ii = input.length; i < ii; i++) {
  49661. const code = input.charCodeAt(i);
  49662. if (code <= 0xff) {
  49663. data[length++] = code;
  49664. } else {
  49665. data[length++] = code >>> 8;
  49666. data[length++] = code & 0xff;
  49667. }
  49668. }
  49669. } else if ((0, _util.isArrayBuffer)(input)) {
  49670. data = input.slice();
  49671. length = data.byteLength;
  49672. } else {
  49673. throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
  49674. }
  49675. const blockCounts = length >> 2;
  49676. const tailLength = length - blockCounts * 4;
  49677. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  49678. let k1 = 0,
  49679. k2 = 0;
  49680. let h1 = this.h1,
  49681. h2 = this.h2;
  49682. const C1 = 0xcc9e2d51,
  49683. C2 = 0x1b873593;
  49684. const C1_LOW = C1 & MASK_LOW,
  49685. C2_LOW = C2 & MASK_LOW;
  49686. for (let i = 0; i < blockCounts; i++) {
  49687. if (i & 1) {
  49688. k1 = dataUint32[i];
  49689. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  49690. k1 = k1 << 15 | k1 >>> 17;
  49691. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  49692. h1 ^= k1;
  49693. h1 = h1 << 13 | h1 >>> 19;
  49694. h1 = h1 * 5 + 0xe6546b64;
  49695. } else {
  49696. k2 = dataUint32[i];
  49697. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  49698. k2 = k2 << 15 | k2 >>> 17;
  49699. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  49700. h2 ^= k2;
  49701. h2 = h2 << 13 | h2 >>> 19;
  49702. h2 = h2 * 5 + 0xe6546b64;
  49703. }
  49704. }
  49705. k1 = 0;
  49706. switch (tailLength) {
  49707. case 3:
  49708. k1 ^= data[blockCounts * 4 + 2] << 16;
  49709. case 2:
  49710. k1 ^= data[blockCounts * 4 + 1] << 8;
  49711. case 1:
  49712. k1 ^= data[blockCounts * 4];
  49713. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  49714. k1 = k1 << 15 | k1 >>> 17;
  49715. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  49716. if (blockCounts & 1) {
  49717. h1 ^= k1;
  49718. } else {
  49719. h2 ^= k1;
  49720. }
  49721. }
  49722. this.h1 = h1;
  49723. this.h2 = h2;
  49724. }
  49725. hexdigest() {
  49726. let h1 = this.h1,
  49727. h2 = this.h2;
  49728. h1 ^= h2 >>> 1;
  49729. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  49730. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  49731. h1 ^= h2 >>> 1;
  49732. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  49733. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  49734. h1 ^= h2 >>> 1;
  49735. return (h1 >>> 0).toString(16).padStart(8, "0") + (h2 >>> 0).toString(16).padStart(8, "0");
  49736. }
  49737. }
  49738. exports.MurmurHash3_64 = MurmurHash3_64;
  49739. /***/ }),
  49740. /* 193 */
  49741. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49742. "use strict";
  49743. Object.defineProperty(exports, "__esModule", ({
  49744. value: true
  49745. }));
  49746. exports.OperatorList = void 0;
  49747. var _util = __w_pdfjs_require__(2);
  49748. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  49749. let state = parentState;
  49750. for (let i = 0, ii = pattern.length - 1; i < ii; i++) {
  49751. const item = pattern[i];
  49752. state = state[item] || (state[item] = []);
  49753. }
  49754. state[pattern.at(-1)] = {
  49755. checkFn,
  49756. iterateFn,
  49757. processFn
  49758. };
  49759. }
  49760. const InitialState = [];
  49761. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
  49762. const fnArray = context.fnArray;
  49763. const iFirstSave = context.iCurr - 3;
  49764. const pos = (i - iFirstSave) % 4;
  49765. switch (pos) {
  49766. case 0:
  49767. return fnArray[i] === _util.OPS.save;
  49768. case 1:
  49769. return fnArray[i] === _util.OPS.transform;
  49770. case 2:
  49771. return fnArray[i] === _util.OPS.paintInlineImageXObject;
  49772. case 3:
  49773. return fnArray[i] === _util.OPS.restore;
  49774. }
  49775. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  49776. }, function foundInlineImageGroup(context, i) {
  49777. const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  49778. const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  49779. const MAX_WIDTH = 1000;
  49780. const IMAGE_PADDING = 1;
  49781. const fnArray = context.fnArray,
  49782. argsArray = context.argsArray;
  49783. const curr = context.iCurr;
  49784. const iFirstSave = curr - 3;
  49785. const iFirstTransform = curr - 2;
  49786. const iFirstPIIXO = curr - 1;
  49787. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  49788. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  49789. return i - (i - iFirstSave) % 4;
  49790. }
  49791. let maxX = 0;
  49792. const map = [];
  49793. let maxLineHeight = 0;
  49794. let currentX = IMAGE_PADDING,
  49795. currentY = IMAGE_PADDING;
  49796. for (let q = 0; q < count; q++) {
  49797. const transform = argsArray[iFirstTransform + (q << 2)];
  49798. const img = argsArray[iFirstPIIXO + (q << 2)][0];
  49799. if (currentX + img.width > MAX_WIDTH) {
  49800. maxX = Math.max(maxX, currentX);
  49801. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  49802. currentX = 0;
  49803. maxLineHeight = 0;
  49804. }
  49805. map.push({
  49806. transform,
  49807. x: currentX,
  49808. y: currentY,
  49809. w: img.width,
  49810. h: img.height
  49811. });
  49812. currentX += img.width + 2 * IMAGE_PADDING;
  49813. maxLineHeight = Math.max(maxLineHeight, img.height);
  49814. }
  49815. const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  49816. const imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  49817. const imgData = new Uint8Array(imgWidth * imgHeight * 4);
  49818. const imgRowSize = imgWidth << 2;
  49819. for (let q = 0; q < count; q++) {
  49820. const data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  49821. const rowSize = map[q].w << 2;
  49822. let dataOffset = 0;
  49823. let offset = map[q].x + map[q].y * imgWidth << 2;
  49824. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  49825. for (let k = 0, kk = map[q].h; k < kk; k++) {
  49826. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  49827. dataOffset += rowSize;
  49828. offset += imgRowSize;
  49829. }
  49830. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  49831. while (offset >= 0) {
  49832. data[offset - 4] = data[offset];
  49833. data[offset - 3] = data[offset + 1];
  49834. data[offset - 2] = data[offset + 2];
  49835. data[offset - 1] = data[offset + 3];
  49836. data[offset + rowSize] = data[offset + rowSize - 4];
  49837. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  49838. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  49839. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  49840. offset -= imgRowSize;
  49841. }
  49842. }
  49843. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
  49844. argsArray.splice(iFirstSave, count * 4, [{
  49845. width: imgWidth,
  49846. height: imgHeight,
  49847. kind: _util.ImageKind.RGBA_32BPP,
  49848. data: imgData
  49849. }, map]);
  49850. return iFirstSave + 1;
  49851. });
  49852. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
  49853. const fnArray = context.fnArray;
  49854. const iFirstSave = context.iCurr - 3;
  49855. const pos = (i - iFirstSave) % 4;
  49856. switch (pos) {
  49857. case 0:
  49858. return fnArray[i] === _util.OPS.save;
  49859. case 1:
  49860. return fnArray[i] === _util.OPS.transform;
  49861. case 2:
  49862. return fnArray[i] === _util.OPS.paintImageMaskXObject;
  49863. case 3:
  49864. return fnArray[i] === _util.OPS.restore;
  49865. }
  49866. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  49867. }, function foundImageMaskGroup(context, i) {
  49868. const MIN_IMAGES_IN_MASKS_BLOCK = 10;
  49869. const MAX_IMAGES_IN_MASKS_BLOCK = 100;
  49870. const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  49871. const fnArray = context.fnArray,
  49872. argsArray = context.argsArray;
  49873. const curr = context.iCurr;
  49874. const iFirstSave = curr - 3;
  49875. const iFirstTransform = curr - 2;
  49876. const iFirstPIMXO = curr - 1;
  49877. let count = Math.floor((i - iFirstSave) / 4);
  49878. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  49879. return i - (i - iFirstSave) % 4;
  49880. }
  49881. let isSameImage = false;
  49882. let iTransform, transformArgs;
  49883. const firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  49884. const firstTransformArg0 = argsArray[iFirstTransform][0],
  49885. firstTransformArg1 = argsArray[iFirstTransform][1],
  49886. firstTransformArg2 = argsArray[iFirstTransform][2],
  49887. firstTransformArg3 = argsArray[iFirstTransform][3];
  49888. if (firstTransformArg1 === firstTransformArg2) {
  49889. isSameImage = true;
  49890. iTransform = iFirstTransform + 4;
  49891. let iPIMXO = iFirstPIMXO + 4;
  49892. for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  49893. transformArgs = argsArray[iTransform];
  49894. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) {
  49895. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  49896. isSameImage = false;
  49897. } else {
  49898. count = q;
  49899. }
  49900. break;
  49901. }
  49902. }
  49903. }
  49904. if (isSameImage) {
  49905. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  49906. const positions = new Float32Array(count * 2);
  49907. iTransform = iFirstTransform;
  49908. for (let q = 0; q < count; q++, iTransform += 4) {
  49909. transformArgs = argsArray[iTransform];
  49910. positions[q << 1] = transformArgs[4];
  49911. positions[(q << 1) + 1] = transformArgs[5];
  49912. }
  49913. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
  49914. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]);
  49915. } else {
  49916. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  49917. const images = [];
  49918. for (let q = 0; q < count; q++) {
  49919. transformArgs = argsArray[iFirstTransform + (q << 2)];
  49920. const maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  49921. images.push({
  49922. data: maskParams.data,
  49923. width: maskParams.width,
  49924. height: maskParams.height,
  49925. interpolate: maskParams.interpolate,
  49926. count: maskParams.count,
  49927. transform: transformArgs
  49928. });
  49929. }
  49930. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
  49931. argsArray.splice(iFirstSave, count * 4, [images]);
  49932. }
  49933. return iFirstSave + 1;
  49934. });
  49935. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
  49936. const argsArray = context.argsArray;
  49937. const iFirstTransform = context.iCurr - 2;
  49938. return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
  49939. }, function iterateImageGroup(context, i) {
  49940. const fnArray = context.fnArray,
  49941. argsArray = context.argsArray;
  49942. const iFirstSave = context.iCurr - 3;
  49943. const pos = (i - iFirstSave) % 4;
  49944. switch (pos) {
  49945. case 0:
  49946. return fnArray[i] === _util.OPS.save;
  49947. case 1:
  49948. if (fnArray[i] !== _util.OPS.transform) {
  49949. return false;
  49950. }
  49951. const iFirstTransform = context.iCurr - 2;
  49952. const firstTransformArg0 = argsArray[iFirstTransform][0];
  49953. const firstTransformArg3 = argsArray[iFirstTransform][3];
  49954. if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
  49955. return false;
  49956. }
  49957. return true;
  49958. case 2:
  49959. if (fnArray[i] !== _util.OPS.paintImageXObject) {
  49960. return false;
  49961. }
  49962. const iFirstPIXO = context.iCurr - 1;
  49963. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  49964. if (argsArray[i][0] !== firstPIXOArg0) {
  49965. return false;
  49966. }
  49967. return true;
  49968. case 3:
  49969. return fnArray[i] === _util.OPS.restore;
  49970. }
  49971. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  49972. }, function (context, i) {
  49973. const MIN_IMAGES_IN_BLOCK = 3;
  49974. const MAX_IMAGES_IN_BLOCK = 1000;
  49975. const fnArray = context.fnArray,
  49976. argsArray = context.argsArray;
  49977. const curr = context.iCurr;
  49978. const iFirstSave = curr - 3;
  49979. const iFirstTransform = curr - 2;
  49980. const iFirstPIXO = curr - 1;
  49981. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  49982. const firstTransformArg0 = argsArray[iFirstTransform][0];
  49983. const firstTransformArg3 = argsArray[iFirstTransform][3];
  49984. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
  49985. if (count < MIN_IMAGES_IN_BLOCK) {
  49986. return i - (i - iFirstSave) % 4;
  49987. }
  49988. const positions = new Float32Array(count * 2);
  49989. let iTransform = iFirstTransform;
  49990. for (let q = 0; q < count; q++, iTransform += 4) {
  49991. const transformArgs = argsArray[iTransform];
  49992. positions[q << 1] = transformArgs[4];
  49993. positions[(q << 1) + 1] = transformArgs[5];
  49994. }
  49995. const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  49996. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
  49997. argsArray.splice(iFirstSave, count * 4, args);
  49998. return iFirstSave + 1;
  49999. });
  50000. addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
  50001. const fnArray = context.fnArray,
  50002. argsArray = context.argsArray;
  50003. const iFirstSave = context.iCurr - 4;
  50004. const pos = (i - iFirstSave) % 5;
  50005. switch (pos) {
  50006. case 0:
  50007. return fnArray[i] === _util.OPS.beginText;
  50008. case 1:
  50009. return fnArray[i] === _util.OPS.setFont;
  50010. case 2:
  50011. return fnArray[i] === _util.OPS.setTextMatrix;
  50012. case 3:
  50013. if (fnArray[i] !== _util.OPS.showText) {
  50014. return false;
  50015. }
  50016. const iFirstSetFont = context.iCurr - 3;
  50017. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  50018. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  50019. if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
  50020. return false;
  50021. }
  50022. return true;
  50023. case 4:
  50024. return fnArray[i] === _util.OPS.endText;
  50025. }
  50026. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  50027. }, function (context, i) {
  50028. const MIN_CHARS_IN_BLOCK = 3;
  50029. const MAX_CHARS_IN_BLOCK = 1000;
  50030. const fnArray = context.fnArray,
  50031. argsArray = context.argsArray;
  50032. const curr = context.iCurr;
  50033. const iFirstBeginText = curr - 4;
  50034. const iFirstSetFont = curr - 3;
  50035. const iFirstSetTextMatrix = curr - 2;
  50036. const iFirstShowText = curr - 1;
  50037. const iFirstEndText = curr;
  50038. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  50039. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  50040. let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
  50041. if (count < MIN_CHARS_IN_BLOCK) {
  50042. return i - (i - iFirstBeginText) % 5;
  50043. }
  50044. let iFirst = iFirstBeginText;
  50045. 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) {
  50046. count++;
  50047. iFirst -= 5;
  50048. }
  50049. let iEndText = iFirst + 4;
  50050. for (let q = 1; q < count; q++) {
  50051. fnArray.splice(iEndText, 3);
  50052. argsArray.splice(iEndText, 3);
  50053. iEndText += 2;
  50054. }
  50055. return iEndText + 1;
  50056. });
  50057. class NullOptimizer {
  50058. constructor(queue) {
  50059. this.queue = queue;
  50060. }
  50061. _optimize() {}
  50062. push(fn, args) {
  50063. this.queue.fnArray.push(fn);
  50064. this.queue.argsArray.push(args);
  50065. this._optimize();
  50066. }
  50067. flush() {}
  50068. reset() {}
  50069. }
  50070. class QueueOptimizer extends NullOptimizer {
  50071. constructor(queue) {
  50072. super(queue);
  50073. this.state = null;
  50074. this.context = {
  50075. iCurr: 0,
  50076. fnArray: queue.fnArray,
  50077. argsArray: queue.argsArray
  50078. };
  50079. this.match = null;
  50080. this.lastProcessed = 0;
  50081. }
  50082. _optimize() {
  50083. const fnArray = this.queue.fnArray;
  50084. let i = this.lastProcessed,
  50085. ii = fnArray.length;
  50086. let state = this.state;
  50087. let match = this.match;
  50088. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  50089. this.lastProcessed = ii;
  50090. return;
  50091. }
  50092. const context = this.context;
  50093. while (i < ii) {
  50094. if (match) {
  50095. const iterate = (0, match.iterateFn)(context, i);
  50096. if (iterate) {
  50097. i++;
  50098. continue;
  50099. }
  50100. i = (0, match.processFn)(context, i + 1);
  50101. ii = fnArray.length;
  50102. match = null;
  50103. state = null;
  50104. if (i >= ii) {
  50105. break;
  50106. }
  50107. }
  50108. state = (state || InitialState)[fnArray[i]];
  50109. if (!state || Array.isArray(state)) {
  50110. i++;
  50111. continue;
  50112. }
  50113. context.iCurr = i;
  50114. i++;
  50115. if (state.checkFn && !(0, state.checkFn)(context)) {
  50116. state = null;
  50117. continue;
  50118. }
  50119. match = state;
  50120. state = null;
  50121. }
  50122. this.state = state;
  50123. this.match = match;
  50124. this.lastProcessed = i;
  50125. }
  50126. flush() {
  50127. while (this.match) {
  50128. const length = this.queue.fnArray.length;
  50129. this.lastProcessed = (0, this.match.processFn)(this.context, length);
  50130. this.match = null;
  50131. this.state = null;
  50132. this._optimize();
  50133. }
  50134. }
  50135. reset() {
  50136. this.state = null;
  50137. this.match = null;
  50138. this.lastProcessed = 0;
  50139. }
  50140. }
  50141. class OperatorList {
  50142. static get CHUNK_SIZE() {
  50143. return (0, _util.shadow)(this, "CHUNK_SIZE", 1000);
  50144. }
  50145. static get CHUNK_SIZE_ABOUT() {
  50146. return (0, _util.shadow)(this, "CHUNK_SIZE_ABOUT", this.CHUNK_SIZE - 5);
  50147. }
  50148. constructor() {
  50149. let intent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  50150. let streamSink = arguments.length > 1 ? arguments[1] : undefined;
  50151. this._streamSink = streamSink;
  50152. this.fnArray = [];
  50153. this.argsArray = [];
  50154. if (streamSink && !(intent & _util.RenderingIntentFlag.OPLIST)) {
  50155. this.optimizer = new QueueOptimizer(this);
  50156. } else {
  50157. this.optimizer = new NullOptimizer(this);
  50158. }
  50159. this.dependencies = new Set();
  50160. this._totalLength = 0;
  50161. this.weight = 0;
  50162. this._resolved = streamSink ? null : Promise.resolve();
  50163. }
  50164. get length() {
  50165. return this.argsArray.length;
  50166. }
  50167. get ready() {
  50168. return this._resolved || this._streamSink.ready;
  50169. }
  50170. get totalLength() {
  50171. return this._totalLength + this.length;
  50172. }
  50173. addOp(fn, args) {
  50174. this.optimizer.push(fn, args);
  50175. this.weight++;
  50176. if (this._streamSink) {
  50177. if (this.weight >= OperatorList.CHUNK_SIZE) {
  50178. this.flush();
  50179. } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
  50180. this.flush();
  50181. }
  50182. }
  50183. }
  50184. addImageOps(fn, args, optionalContent) {
  50185. if (optionalContent !== undefined) {
  50186. this.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  50187. }
  50188. this.addOp(fn, args);
  50189. if (optionalContent !== undefined) {
  50190. this.addOp(_util.OPS.endMarkedContent, []);
  50191. }
  50192. }
  50193. addDependency(dependency) {
  50194. if (this.dependencies.has(dependency)) {
  50195. return;
  50196. }
  50197. this.dependencies.add(dependency);
  50198. this.addOp(_util.OPS.dependency, [dependency]);
  50199. }
  50200. addDependencies(dependencies) {
  50201. for (const dependency of dependencies) {
  50202. this.addDependency(dependency);
  50203. }
  50204. }
  50205. addOpList(opList) {
  50206. if (!(opList instanceof OperatorList)) {
  50207. (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
  50208. return;
  50209. }
  50210. for (const dependency of opList.dependencies) {
  50211. this.dependencies.add(dependency);
  50212. }
  50213. for (let i = 0, ii = opList.length; i < ii; i++) {
  50214. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  50215. }
  50216. }
  50217. getIR() {
  50218. return {
  50219. fnArray: this.fnArray,
  50220. argsArray: this.argsArray,
  50221. length: this.length
  50222. };
  50223. }
  50224. get _transfers() {
  50225. const transfers = [];
  50226. const {
  50227. fnArray,
  50228. argsArray,
  50229. length
  50230. } = this;
  50231. for (let i = 0; i < length; i++) {
  50232. switch (fnArray[i]) {
  50233. case _util.OPS.paintInlineImageXObject:
  50234. case _util.OPS.paintInlineImageXObjectGroup:
  50235. case _util.OPS.paintImageMaskXObject:
  50236. const arg = argsArray[i][0];
  50237. if (!arg.cached && arg.data && arg.data.buffer instanceof ArrayBuffer) {
  50238. transfers.push(arg.data.buffer);
  50239. }
  50240. break;
  50241. }
  50242. }
  50243. return transfers;
  50244. }
  50245. flush() {
  50246. let lastChunk = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  50247. let separateAnnots = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  50248. this.optimizer.flush();
  50249. const length = this.length;
  50250. this._totalLength += length;
  50251. this._streamSink.enqueue({
  50252. fnArray: this.fnArray,
  50253. argsArray: this.argsArray,
  50254. lastChunk,
  50255. separateAnnots,
  50256. length
  50257. }, 1, this._transfers);
  50258. this.dependencies.clear();
  50259. this.fnArray.length = 0;
  50260. this.argsArray.length = 0;
  50261. this.weight = 0;
  50262. this.optimizer.reset();
  50263. }
  50264. }
  50265. exports.OperatorList = OperatorList;
  50266. /***/ }),
  50267. /* 194 */
  50268. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50269. "use strict";
  50270. Object.defineProperty(exports, "__esModule", ({
  50271. value: true
  50272. }));
  50273. exports.PDFImage = void 0;
  50274. var _util = __w_pdfjs_require__(2);
  50275. var _image_utils = __w_pdfjs_require__(195);
  50276. var _base_stream = __w_pdfjs_require__(138);
  50277. var _colorspace = __w_pdfjs_require__(145);
  50278. var _decode_stream = __w_pdfjs_require__(150);
  50279. var _jpeg_stream = __w_pdfjs_require__(158);
  50280. var _jpx = __w_pdfjs_require__(161);
  50281. var _primitives = __w_pdfjs_require__(137);
  50282. function decodeAndClamp(value, addend, coefficient, max) {
  50283. value = addend + value * coefficient;
  50284. if (value < 0) {
  50285. value = 0;
  50286. } else if (value > max) {
  50287. value = max;
  50288. }
  50289. return value;
  50290. }
  50291. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  50292. const length = w2 * h2;
  50293. let dest;
  50294. if (bpc <= 8) {
  50295. dest = new Uint8Array(length);
  50296. } else if (bpc <= 16) {
  50297. dest = new Uint16Array(length);
  50298. } else {
  50299. dest = new Uint32Array(length);
  50300. }
  50301. const xRatio = w1 / w2;
  50302. const yRatio = h1 / h2;
  50303. let i,
  50304. j,
  50305. py,
  50306. newIndex = 0,
  50307. oldIndex;
  50308. const xScaled = new Uint16Array(w2);
  50309. const w1Scanline = w1;
  50310. for (i = 0; i < w2; i++) {
  50311. xScaled[i] = Math.floor(i * xRatio);
  50312. }
  50313. for (i = 0; i < h2; i++) {
  50314. py = Math.floor(i * yRatio) * w1Scanline;
  50315. for (j = 0; j < w2; j++) {
  50316. oldIndex = py + xScaled[j];
  50317. dest[newIndex++] = src[oldIndex];
  50318. }
  50319. }
  50320. return dest;
  50321. }
  50322. class PDFImage {
  50323. constructor(_ref) {
  50324. let {
  50325. xref,
  50326. res,
  50327. image,
  50328. isInline = false,
  50329. smask = null,
  50330. mask = null,
  50331. isMask = false,
  50332. pdfFunctionFactory,
  50333. localColorSpaceCache
  50334. } = _ref;
  50335. this.image = image;
  50336. const dict = image.dict;
  50337. const filter = dict.get("F", "Filter");
  50338. let filterName;
  50339. if (filter instanceof _primitives.Name) {
  50340. filterName = filter.name;
  50341. } else if (Array.isArray(filter)) {
  50342. const filterZero = xref.fetchIfRef(filter[0]);
  50343. if (filterZero instanceof _primitives.Name) {
  50344. filterName = filterZero.name;
  50345. }
  50346. }
  50347. switch (filterName) {
  50348. case "JPXDecode":
  50349. const jpxImage = new _jpx.JpxImage();
  50350. jpxImage.parseImageProperties(image.stream);
  50351. image.stream.reset();
  50352. image.width = jpxImage.width;
  50353. image.height = jpxImage.height;
  50354. image.bitsPerComponent = jpxImage.bitsPerComponent;
  50355. image.numComps = jpxImage.componentsCount;
  50356. break;
  50357. case "JBIG2Decode":
  50358. image.bitsPerComponent = 1;
  50359. image.numComps = 1;
  50360. break;
  50361. }
  50362. let width = dict.get("W", "Width");
  50363. let height = dict.get("H", "Height");
  50364. if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
  50365. (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
  50366. width = image.width;
  50367. height = image.height;
  50368. }
  50369. if (width < 1 || height < 1) {
  50370. throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`);
  50371. }
  50372. this.width = width;
  50373. this.height = height;
  50374. this.interpolate = dict.get("I", "Interpolate");
  50375. this.imageMask = dict.get("IM", "ImageMask") || false;
  50376. this.matte = dict.get("Matte") || false;
  50377. let bitsPerComponent = image.bitsPerComponent;
  50378. if (!bitsPerComponent) {
  50379. bitsPerComponent = dict.get("BPC", "BitsPerComponent");
  50380. if (!bitsPerComponent) {
  50381. if (this.imageMask) {
  50382. bitsPerComponent = 1;
  50383. } else {
  50384. throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`);
  50385. }
  50386. }
  50387. }
  50388. this.bpc = bitsPerComponent;
  50389. if (!this.imageMask) {
  50390. let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace");
  50391. if (!colorSpace) {
  50392. (0, _util.info)("JPX images (which do not require color spaces)");
  50393. switch (image.numComps) {
  50394. case 1:
  50395. colorSpace = _primitives.Name.get("DeviceGray");
  50396. break;
  50397. case 3:
  50398. colorSpace = _primitives.Name.get("DeviceRGB");
  50399. break;
  50400. case 4:
  50401. colorSpace = _primitives.Name.get("DeviceCMYK");
  50402. break;
  50403. default:
  50404. throw new Error(`JPX images with ${image.numComps} color components not supported.`);
  50405. }
  50406. }
  50407. this.colorSpace = _colorspace.ColorSpace.parse({
  50408. cs: colorSpace,
  50409. xref,
  50410. resources: isInline ? res : null,
  50411. pdfFunctionFactory,
  50412. localColorSpaceCache
  50413. });
  50414. this.numComps = this.colorSpace.numComps;
  50415. }
  50416. this.decode = dict.getArray("D", "Decode");
  50417. this.needsDecode = false;
  50418. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
  50419. this.needsDecode = true;
  50420. const max = (1 << bitsPerComponent) - 1;
  50421. this.decodeCoefficients = [];
  50422. this.decodeAddends = [];
  50423. const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed";
  50424. for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  50425. const dmin = this.decode[i];
  50426. const dmax = this.decode[i + 1];
  50427. this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
  50428. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  50429. }
  50430. }
  50431. if (smask) {
  50432. this.smask = new PDFImage({
  50433. xref,
  50434. res,
  50435. image: smask,
  50436. isInline,
  50437. pdfFunctionFactory,
  50438. localColorSpaceCache
  50439. });
  50440. } else if (mask) {
  50441. if (mask instanceof _base_stream.BaseStream) {
  50442. const maskDict = mask.dict,
  50443. imageMask = maskDict.get("IM", "ImageMask");
  50444. if (!imageMask) {
  50445. (0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
  50446. } else {
  50447. this.mask = new PDFImage({
  50448. xref,
  50449. res,
  50450. image: mask,
  50451. isInline,
  50452. isMask: true,
  50453. pdfFunctionFactory,
  50454. localColorSpaceCache
  50455. });
  50456. }
  50457. } else {
  50458. this.mask = mask;
  50459. }
  50460. }
  50461. }
  50462. static async buildImage(_ref2) {
  50463. let {
  50464. xref,
  50465. res,
  50466. image,
  50467. isInline = false,
  50468. pdfFunctionFactory,
  50469. localColorSpaceCache
  50470. } = _ref2;
  50471. const imageData = image;
  50472. let smaskData = null;
  50473. let maskData = null;
  50474. const smask = image.dict.get("SMask");
  50475. const mask = image.dict.get("Mask");
  50476. if (smask) {
  50477. if (smask instanceof _base_stream.BaseStream) {
  50478. smaskData = smask;
  50479. } else {
  50480. (0, _util.warn)("Unsupported /SMask format.");
  50481. }
  50482. } else if (mask) {
  50483. if (mask instanceof _base_stream.BaseStream || Array.isArray(mask)) {
  50484. maskData = mask;
  50485. } else {
  50486. (0, _util.warn)("Unsupported /Mask format.");
  50487. }
  50488. }
  50489. return new PDFImage({
  50490. xref,
  50491. res,
  50492. image: imageData,
  50493. isInline,
  50494. smask: smaskData,
  50495. mask: maskData,
  50496. pdfFunctionFactory,
  50497. localColorSpaceCache
  50498. });
  50499. }
  50500. static createRawMask(_ref3) {
  50501. let {
  50502. imgArray,
  50503. width,
  50504. height,
  50505. imageIsFromDecodeStream,
  50506. inverseDecode,
  50507. interpolate
  50508. } = _ref3;
  50509. const computedLength = (width + 7 >> 3) * height;
  50510. const actualLength = imgArray.byteLength;
  50511. const haveFullData = computedLength === actualLength;
  50512. let data, i;
  50513. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  50514. data = imgArray;
  50515. } else if (!inverseDecode) {
  50516. data = new Uint8Array(imgArray);
  50517. } else {
  50518. data = new Uint8Array(computedLength);
  50519. data.set(imgArray);
  50520. data.fill(0xff, actualLength);
  50521. }
  50522. if (inverseDecode) {
  50523. for (i = 0; i < actualLength; i++) {
  50524. data[i] ^= 0xff;
  50525. }
  50526. }
  50527. return {
  50528. data,
  50529. width,
  50530. height,
  50531. interpolate
  50532. };
  50533. }
  50534. static createMask(_ref4) {
  50535. let {
  50536. imgArray,
  50537. width,
  50538. height,
  50539. imageIsFromDecodeStream,
  50540. inverseDecode,
  50541. interpolate,
  50542. isOffscreenCanvasSupported = true
  50543. } = _ref4;
  50544. const isSingleOpaquePixel = width === 1 && height === 1 && inverseDecode === (imgArray.length === 0 || !!(imgArray[0] & 128));
  50545. if (isSingleOpaquePixel) {
  50546. return {
  50547. isSingleOpaquePixel
  50548. };
  50549. }
  50550. if (isOffscreenCanvasSupported && _util.FeatureTest.isOffscreenCanvasSupported) {
  50551. const canvas = new OffscreenCanvas(width, height);
  50552. const ctx = canvas.getContext("2d");
  50553. const imgData = ctx.createImageData(width, height);
  50554. (0, _image_utils.applyMaskImageData)({
  50555. src: imgArray,
  50556. dest: imgData.data,
  50557. width,
  50558. height,
  50559. inverseDecode
  50560. });
  50561. ctx.putImageData(imgData, 0, 0);
  50562. const bitmap = canvas.transferToImageBitmap();
  50563. return {
  50564. data: null,
  50565. width,
  50566. height,
  50567. interpolate,
  50568. bitmap
  50569. };
  50570. }
  50571. return this.createRawMask({
  50572. imgArray,
  50573. width,
  50574. height,
  50575. inverseDecode,
  50576. imageIsFromDecodeStream,
  50577. interpolate
  50578. });
  50579. }
  50580. get drawWidth() {
  50581. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  50582. }
  50583. get drawHeight() {
  50584. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  50585. }
  50586. decodeBuffer(buffer) {
  50587. const bpc = this.bpc;
  50588. const numComps = this.numComps;
  50589. const decodeAddends = this.decodeAddends;
  50590. const decodeCoefficients = this.decodeCoefficients;
  50591. const max = (1 << bpc) - 1;
  50592. let i, ii;
  50593. if (bpc === 1) {
  50594. for (i = 0, ii = buffer.length; i < ii; i++) {
  50595. buffer[i] = +!buffer[i];
  50596. }
  50597. return;
  50598. }
  50599. let index = 0;
  50600. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  50601. for (let j = 0; j < numComps; j++) {
  50602. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  50603. index++;
  50604. }
  50605. }
  50606. }
  50607. getComponents(buffer) {
  50608. const bpc = this.bpc;
  50609. if (bpc === 8) {
  50610. return buffer;
  50611. }
  50612. const width = this.width;
  50613. const height = this.height;
  50614. const numComps = this.numComps;
  50615. const length = width * height * numComps;
  50616. let bufferPos = 0;
  50617. let output;
  50618. if (bpc <= 8) {
  50619. output = new Uint8Array(length);
  50620. } else if (bpc <= 16) {
  50621. output = new Uint16Array(length);
  50622. } else {
  50623. output = new Uint32Array(length);
  50624. }
  50625. const rowComps = width * numComps;
  50626. const max = (1 << bpc) - 1;
  50627. let i = 0,
  50628. ii,
  50629. buf;
  50630. if (bpc === 1) {
  50631. let mask, loop1End, loop2End;
  50632. for (let j = 0; j < height; j++) {
  50633. loop1End = i + (rowComps & ~7);
  50634. loop2End = i + rowComps;
  50635. while (i < loop1End) {
  50636. buf = buffer[bufferPos++];
  50637. output[i] = buf >> 7 & 1;
  50638. output[i + 1] = buf >> 6 & 1;
  50639. output[i + 2] = buf >> 5 & 1;
  50640. output[i + 3] = buf >> 4 & 1;
  50641. output[i + 4] = buf >> 3 & 1;
  50642. output[i + 5] = buf >> 2 & 1;
  50643. output[i + 6] = buf >> 1 & 1;
  50644. output[i + 7] = buf & 1;
  50645. i += 8;
  50646. }
  50647. if (i < loop2End) {
  50648. buf = buffer[bufferPos++];
  50649. mask = 128;
  50650. while (i < loop2End) {
  50651. output[i++] = +!!(buf & mask);
  50652. mask >>= 1;
  50653. }
  50654. }
  50655. }
  50656. } else {
  50657. let bits = 0;
  50658. buf = 0;
  50659. for (i = 0, ii = length; i < ii; ++i) {
  50660. if (i % rowComps === 0) {
  50661. buf = 0;
  50662. bits = 0;
  50663. }
  50664. while (bits < bpc) {
  50665. buf = buf << 8 | buffer[bufferPos++];
  50666. bits += 8;
  50667. }
  50668. const remainingBits = bits - bpc;
  50669. let value = buf >> remainingBits;
  50670. if (value < 0) {
  50671. value = 0;
  50672. } else if (value > max) {
  50673. value = max;
  50674. }
  50675. output[i] = value;
  50676. buf &= (1 << remainingBits) - 1;
  50677. bits = remainingBits;
  50678. }
  50679. }
  50680. return output;
  50681. }
  50682. fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  50683. const smask = this.smask;
  50684. const mask = this.mask;
  50685. let alphaBuf, sw, sh, i, ii, j;
  50686. if (smask) {
  50687. sw = smask.width;
  50688. sh = smask.height;
  50689. alphaBuf = new Uint8ClampedArray(sw * sh);
  50690. smask.fillGrayBuffer(alphaBuf);
  50691. if (sw !== width || sh !== height) {
  50692. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  50693. }
  50694. } else if (mask) {
  50695. if (mask instanceof PDFImage) {
  50696. sw = mask.width;
  50697. sh = mask.height;
  50698. alphaBuf = new Uint8ClampedArray(sw * sh);
  50699. mask.numComps = 1;
  50700. mask.fillGrayBuffer(alphaBuf);
  50701. for (i = 0, ii = sw * sh; i < ii; ++i) {
  50702. alphaBuf[i] = 255 - alphaBuf[i];
  50703. }
  50704. if (sw !== width || sh !== height) {
  50705. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  50706. }
  50707. } else if (Array.isArray(mask)) {
  50708. alphaBuf = new Uint8ClampedArray(width * height);
  50709. const numComps = this.numComps;
  50710. for (i = 0, ii = width * height; i < ii; ++i) {
  50711. let opacity = 0;
  50712. const imageOffset = i * numComps;
  50713. for (j = 0; j < numComps; ++j) {
  50714. const color = image[imageOffset + j];
  50715. const maskOffset = j * 2;
  50716. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  50717. opacity = 255;
  50718. break;
  50719. }
  50720. }
  50721. alphaBuf[i] = opacity;
  50722. }
  50723. } else {
  50724. throw new _util.FormatError("Unknown mask format.");
  50725. }
  50726. }
  50727. if (alphaBuf) {
  50728. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  50729. rgbaBuf[j] = alphaBuf[i];
  50730. }
  50731. } else {
  50732. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  50733. rgbaBuf[j] = 255;
  50734. }
  50735. }
  50736. }
  50737. undoPreblend(buffer, width, height) {
  50738. const matte = this.smask && this.smask.matte;
  50739. if (!matte) {
  50740. return;
  50741. }
  50742. const matteRgb = this.colorSpace.getRgb(matte, 0);
  50743. const matteR = matteRgb[0];
  50744. const matteG = matteRgb[1];
  50745. const matteB = matteRgb[2];
  50746. const length = width * height * 4;
  50747. for (let i = 0; i < length; i += 4) {
  50748. const alpha = buffer[i + 3];
  50749. if (alpha === 0) {
  50750. buffer[i] = 255;
  50751. buffer[i + 1] = 255;
  50752. buffer[i + 2] = 255;
  50753. continue;
  50754. }
  50755. const k = 255 / alpha;
  50756. buffer[i] = (buffer[i] - matteR) * k + matteR;
  50757. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  50758. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  50759. }
  50760. }
  50761. createImageData() {
  50762. let forceRGBA = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  50763. const drawWidth = this.drawWidth;
  50764. const drawHeight = this.drawHeight;
  50765. const imgData = {
  50766. width: drawWidth,
  50767. height: drawHeight,
  50768. interpolate: this.interpolate,
  50769. kind: 0,
  50770. data: null
  50771. };
  50772. const numComps = this.numComps;
  50773. const originalWidth = this.width;
  50774. const originalHeight = this.height;
  50775. const bpc = this.bpc;
  50776. const rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  50777. if (!forceRGBA) {
  50778. let kind;
  50779. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  50780. kind = _util.ImageKind.GRAYSCALE_1BPP;
  50781. } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
  50782. kind = _util.ImageKind.RGB_24BPP;
  50783. }
  50784. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  50785. imgData.kind = kind;
  50786. imgData.data = this.getImageBytes(originalHeight * rowBytes, {});
  50787. if (this.needsDecode) {
  50788. (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
  50789. const buffer = imgData.data;
  50790. for (let i = 0, ii = buffer.length; i < ii; i++) {
  50791. buffer[i] ^= 0xff;
  50792. }
  50793. }
  50794. return imgData;
  50795. }
  50796. if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
  50797. let imageLength = originalHeight * rowBytes;
  50798. switch (this.colorSpace.name) {
  50799. case "DeviceGray":
  50800. imageLength *= 3;
  50801. case "DeviceRGB":
  50802. case "DeviceCMYK":
  50803. imgData.kind = _util.ImageKind.RGB_24BPP;
  50804. imgData.data = this.getImageBytes(imageLength, {
  50805. drawWidth,
  50806. drawHeight,
  50807. forceRGB: true
  50808. });
  50809. return imgData;
  50810. }
  50811. }
  50812. }
  50813. const imgArray = this.getImageBytes(originalHeight * rowBytes, {
  50814. internal: true
  50815. });
  50816. const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  50817. const comps = this.getComponents(imgArray);
  50818. let alpha01, maybeUndoPreblend;
  50819. if (!forceRGBA && !this.smask && !this.mask) {
  50820. imgData.kind = _util.ImageKind.RGB_24BPP;
  50821. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  50822. alpha01 = 0;
  50823. maybeUndoPreblend = false;
  50824. } else {
  50825. imgData.kind = _util.ImageKind.RGBA_32BPP;
  50826. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  50827. alpha01 = 1;
  50828. maybeUndoPreblend = true;
  50829. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  50830. }
  50831. if (this.needsDecode) {
  50832. this.decodeBuffer(comps);
  50833. }
  50834. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  50835. if (maybeUndoPreblend) {
  50836. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  50837. }
  50838. return imgData;
  50839. }
  50840. fillGrayBuffer(buffer) {
  50841. const numComps = this.numComps;
  50842. if (numComps !== 1) {
  50843. throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`);
  50844. }
  50845. const width = this.width;
  50846. const height = this.height;
  50847. const bpc = this.bpc;
  50848. const rowBytes = width * numComps * bpc + 7 >> 3;
  50849. const imgArray = this.getImageBytes(height * rowBytes, {
  50850. internal: true
  50851. });
  50852. const comps = this.getComponents(imgArray);
  50853. let i, length;
  50854. if (bpc === 1) {
  50855. length = width * height;
  50856. if (this.needsDecode) {
  50857. for (i = 0; i < length; ++i) {
  50858. buffer[i] = comps[i] - 1 & 255;
  50859. }
  50860. } else {
  50861. for (i = 0; i < length; ++i) {
  50862. buffer[i] = -comps[i] & 255;
  50863. }
  50864. }
  50865. return;
  50866. }
  50867. if (this.needsDecode) {
  50868. this.decodeBuffer(comps);
  50869. }
  50870. length = width * height;
  50871. const scale = 255 / ((1 << bpc) - 1);
  50872. for (i = 0; i < length; ++i) {
  50873. buffer[i] = scale * comps[i];
  50874. }
  50875. }
  50876. getImageBytes(length, _ref5) {
  50877. let {
  50878. drawWidth,
  50879. drawHeight,
  50880. forceRGB = false,
  50881. internal = false
  50882. } = _ref5;
  50883. this.image.reset();
  50884. this.image.drawWidth = drawWidth || this.width;
  50885. this.image.drawHeight = drawHeight || this.height;
  50886. this.image.forceRGB = !!forceRGB;
  50887. const imageBytes = this.image.getBytes(length);
  50888. if (internal || this.image instanceof _decode_stream.DecodeStream) {
  50889. return imageBytes;
  50890. }
  50891. (0, _util.assert)(imageBytes instanceof Uint8Array, 'PDFImage.getImageBytes: Unsupported "imageBytes" type.');
  50892. return new Uint8Array(imageBytes);
  50893. }
  50894. }
  50895. exports.PDFImage = PDFImage;
  50896. /***/ }),
  50897. /* 195 */
  50898. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50899. "use strict";
  50900. Object.defineProperty(exports, "__esModule", ({
  50901. value: true
  50902. }));
  50903. exports.applyMaskImageData = applyMaskImageData;
  50904. var _util = __w_pdfjs_require__(2);
  50905. function applyMaskImageData(_ref) {
  50906. let {
  50907. src,
  50908. srcPos = 0,
  50909. dest,
  50910. destPos = 0,
  50911. width,
  50912. height,
  50913. inverseDecode = false
  50914. } = _ref;
  50915. const opaque = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
  50916. const [zeroMapping, oneMapping] = !inverseDecode ? [opaque, 0] : [0, opaque];
  50917. const widthInSource = width >> 3;
  50918. const widthRemainder = width & 7;
  50919. const srcLength = src.length;
  50920. dest = new Uint32Array(dest.buffer);
  50921. for (let i = 0; i < height; i++) {
  50922. for (const max = srcPos + widthInSource; srcPos < max; srcPos++) {
  50923. const elem = srcPos < srcLength ? src[srcPos] : 255;
  50924. dest[destPos++] = elem & 0b10000000 ? oneMapping : zeroMapping;
  50925. dest[destPos++] = elem & 0b1000000 ? oneMapping : zeroMapping;
  50926. dest[destPos++] = elem & 0b100000 ? oneMapping : zeroMapping;
  50927. dest[destPos++] = elem & 0b10000 ? oneMapping : zeroMapping;
  50928. dest[destPos++] = elem & 0b1000 ? oneMapping : zeroMapping;
  50929. dest[destPos++] = elem & 0b100 ? oneMapping : zeroMapping;
  50930. dest[destPos++] = elem & 0b10 ? oneMapping : zeroMapping;
  50931. dest[destPos++] = elem & 0b1 ? oneMapping : zeroMapping;
  50932. }
  50933. if (widthRemainder === 0) {
  50934. continue;
  50935. }
  50936. const elem = srcPos < srcLength ? src[srcPos++] : 255;
  50937. for (let j = 0; j < widthRemainder; j++) {
  50938. dest[destPos++] = elem & 1 << 7 - j ? oneMapping : zeroMapping;
  50939. }
  50940. }
  50941. return {
  50942. srcPos,
  50943. destPos
  50944. };
  50945. }
  50946. /***/ }),
  50947. /* 196 */
  50948. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50949. "use strict";
  50950. Object.defineProperty(exports, "__esModule", ({
  50951. value: true
  50952. }));
  50953. exports.incrementalUpdate = incrementalUpdate;
  50954. exports.writeDict = writeDict;
  50955. exports.writeObject = writeObject;
  50956. var _util = __w_pdfjs_require__(2);
  50957. var _primitives = __w_pdfjs_require__(137);
  50958. var _core_utils = __w_pdfjs_require__(136);
  50959. var _xml_parser = __w_pdfjs_require__(197);
  50960. var _base_stream = __w_pdfjs_require__(138);
  50961. var _crypto = __w_pdfjs_require__(198);
  50962. function writeObject(ref, obj, buffer, transform) {
  50963. buffer.push(`${ref.num} ${ref.gen} obj\n`);
  50964. if (obj instanceof _primitives.Dict) {
  50965. writeDict(obj, buffer, transform);
  50966. } else if (obj instanceof _base_stream.BaseStream) {
  50967. writeStream(obj, buffer, transform);
  50968. }
  50969. buffer.push("\nendobj\n");
  50970. }
  50971. function writeDict(dict, buffer, transform) {
  50972. buffer.push("<<");
  50973. for (const key of dict.getKeys()) {
  50974. buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `);
  50975. writeValue(dict.getRaw(key), buffer, transform);
  50976. }
  50977. buffer.push(">>");
  50978. }
  50979. function writeStream(stream, buffer, transform) {
  50980. let string = stream.getString();
  50981. if (transform !== null) {
  50982. string = transform.encryptString(string);
  50983. }
  50984. stream.dict.set("Length", string.length);
  50985. writeDict(stream.dict, buffer, transform);
  50986. buffer.push(" stream\n", string, "\nendstream");
  50987. }
  50988. function writeArray(array, buffer, transform) {
  50989. buffer.push("[");
  50990. let first = true;
  50991. for (const val of array) {
  50992. if (!first) {
  50993. buffer.push(" ");
  50994. } else {
  50995. first = false;
  50996. }
  50997. writeValue(val, buffer, transform);
  50998. }
  50999. buffer.push("]");
  51000. }
  51001. function writeValue(value, buffer, transform) {
  51002. if (value instanceof _primitives.Name) {
  51003. buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`);
  51004. } else if (value instanceof _primitives.Ref) {
  51005. buffer.push(`${value.num} ${value.gen} R`);
  51006. } else if (Array.isArray(value)) {
  51007. writeArray(value, buffer, transform);
  51008. } else if (typeof value === "string") {
  51009. if (transform !== null) {
  51010. value = transform.encryptString(value);
  51011. }
  51012. buffer.push(`(${(0, _core_utils.escapeString)(value)})`);
  51013. } else if (typeof value === "number") {
  51014. buffer.push((0, _core_utils.numberToString)(value));
  51015. } else if (typeof value === "boolean") {
  51016. buffer.push(value.toString());
  51017. } else if (value instanceof _primitives.Dict) {
  51018. writeDict(value, buffer, transform);
  51019. } else if (value instanceof _base_stream.BaseStream) {
  51020. writeStream(value, buffer, transform);
  51021. } else if (value === null) {
  51022. buffer.push("null");
  51023. } else {
  51024. (0, _util.warn)(`Unhandled value in writer: ${typeof value}, please file a bug.`);
  51025. }
  51026. }
  51027. function writeInt(number, size, offset, buffer) {
  51028. for (let i = size + offset - 1; i > offset - 1; i--) {
  51029. buffer[i] = number & 0xff;
  51030. number >>= 8;
  51031. }
  51032. return offset + size;
  51033. }
  51034. function writeString(string, offset, buffer) {
  51035. for (let i = 0, len = string.length; i < len; i++) {
  51036. buffer[offset + i] = string.charCodeAt(i) & 0xff;
  51037. }
  51038. }
  51039. function computeMD5(filesize, xrefInfo) {
  51040. const time = Math.floor(Date.now() / 1000);
  51041. const filename = xrefInfo.filename || "";
  51042. const md5Buffer = [time.toString(), filename, filesize.toString()];
  51043. let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0);
  51044. for (const value of Object.values(xrefInfo.info)) {
  51045. md5Buffer.push(value);
  51046. md5BufferLen += value.length;
  51047. }
  51048. const array = new Uint8Array(md5BufferLen);
  51049. let offset = 0;
  51050. for (const str of md5Buffer) {
  51051. writeString(str, offset, array);
  51052. offset += str.length;
  51053. }
  51054. return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array));
  51055. }
  51056. function writeXFADataForAcroform(str, newRefs) {
  51057. const xml = new _xml_parser.SimpleXMLParser({
  51058. hasAttributes: true
  51059. }).parseFromString(str);
  51060. for (const {
  51061. xfa
  51062. } of newRefs) {
  51063. if (!xfa) {
  51064. continue;
  51065. }
  51066. const {
  51067. path,
  51068. value
  51069. } = xfa;
  51070. if (!path) {
  51071. continue;
  51072. }
  51073. const nodePath = (0, _core_utils.parseXFAPath)(path);
  51074. let node = xml.documentElement.searchNode(nodePath, 0);
  51075. if (!node && nodePath.length > 1) {
  51076. node = xml.documentElement.searchNode([nodePath.at(-1)], 0);
  51077. }
  51078. if (node) {
  51079. if (Array.isArray(value)) {
  51080. node.childNodes = value.map(val => new _xml_parser.SimpleDOMNode("value", val));
  51081. } else {
  51082. node.childNodes = [new _xml_parser.SimpleDOMNode("#text", value)];
  51083. }
  51084. } else {
  51085. (0, _util.warn)(`Node not found for path: ${path}`);
  51086. }
  51087. }
  51088. const buffer = [];
  51089. xml.documentElement.dump(buffer);
  51090. return buffer.join("");
  51091. }
  51092. function updateAcroform(_ref) {
  51093. let {
  51094. xref,
  51095. acroForm,
  51096. acroFormRef,
  51097. hasXfa,
  51098. hasXfaDatasetsEntry,
  51099. xfaDatasetsRef,
  51100. needAppearances,
  51101. newRefs
  51102. } = _ref;
  51103. if (hasXfa && !hasXfaDatasetsEntry && !xfaDatasetsRef) {
  51104. (0, _util.warn)("XFA - Cannot save it");
  51105. }
  51106. if (!needAppearances && (!hasXfa || !xfaDatasetsRef)) {
  51107. return;
  51108. }
  51109. const dict = new _primitives.Dict(xref);
  51110. for (const key of acroForm.getKeys()) {
  51111. dict.set(key, acroForm.getRaw(key));
  51112. }
  51113. if (hasXfa && !hasXfaDatasetsEntry) {
  51114. const newXfa = acroForm.get("XFA").slice();
  51115. newXfa.splice(2, 0, "datasets");
  51116. newXfa.splice(3, 0, xfaDatasetsRef);
  51117. dict.set("XFA", newXfa);
  51118. }
  51119. if (needAppearances) {
  51120. dict.set("NeedAppearances", true);
  51121. }
  51122. const encrypt = xref.encrypt;
  51123. let transform = null;
  51124. if (encrypt) {
  51125. transform = encrypt.createCipherTransform(acroFormRef.num, acroFormRef.gen);
  51126. }
  51127. const buffer = [];
  51128. writeObject(acroFormRef, dict, buffer, transform);
  51129. newRefs.push({
  51130. ref: acroFormRef,
  51131. data: buffer.join("")
  51132. });
  51133. }
  51134. function updateXFA(_ref2) {
  51135. let {
  51136. xfaData,
  51137. xfaDatasetsRef,
  51138. newRefs,
  51139. xref
  51140. } = _ref2;
  51141. if (xfaData === null) {
  51142. const datasets = xref.fetchIfRef(xfaDatasetsRef);
  51143. xfaData = writeXFADataForAcroform(datasets.getString(), newRefs);
  51144. }
  51145. const encrypt = xref.encrypt;
  51146. if (encrypt) {
  51147. const transform = encrypt.createCipherTransform(xfaDatasetsRef.num, xfaDatasetsRef.gen);
  51148. xfaData = transform.encryptString(xfaData);
  51149. }
  51150. const data = `${xfaDatasetsRef.num} ${xfaDatasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n";
  51151. newRefs.push({
  51152. ref: xfaDatasetsRef,
  51153. data
  51154. });
  51155. }
  51156. function incrementalUpdate(_ref3) {
  51157. let {
  51158. originalData,
  51159. xrefInfo,
  51160. newRefs,
  51161. xref = null,
  51162. hasXfa = false,
  51163. xfaDatasetsRef = null,
  51164. hasXfaDatasetsEntry = false,
  51165. needAppearances,
  51166. acroFormRef = null,
  51167. acroForm = null,
  51168. xfaData = null
  51169. } = _ref3;
  51170. updateAcroform({
  51171. xref,
  51172. acroForm,
  51173. acroFormRef,
  51174. hasXfa,
  51175. hasXfaDatasetsEntry,
  51176. xfaDatasetsRef,
  51177. needAppearances,
  51178. newRefs
  51179. });
  51180. if (hasXfa) {
  51181. updateXFA({
  51182. xfaData,
  51183. xfaDatasetsRef,
  51184. newRefs,
  51185. xref
  51186. });
  51187. }
  51188. const newXref = new _primitives.Dict(null);
  51189. const refForXrefTable = xrefInfo.newRef;
  51190. let buffer, baseOffset;
  51191. const lastByte = originalData.at(-1);
  51192. if (lastByte === 0x0a || lastByte === 0x0d) {
  51193. buffer = [];
  51194. baseOffset = originalData.length;
  51195. } else {
  51196. buffer = ["\n"];
  51197. baseOffset = originalData.length + 1;
  51198. }
  51199. newXref.set("Size", refForXrefTable.num + 1);
  51200. newXref.set("Prev", xrefInfo.startXRef);
  51201. newXref.set("Type", _primitives.Name.get("XRef"));
  51202. if (xrefInfo.rootRef !== null) {
  51203. newXref.set("Root", xrefInfo.rootRef);
  51204. }
  51205. if (xrefInfo.infoRef !== null) {
  51206. newXref.set("Info", xrefInfo.infoRef);
  51207. }
  51208. if (xrefInfo.encryptRef !== null) {
  51209. newXref.set("Encrypt", xrefInfo.encryptRef);
  51210. }
  51211. newRefs.push({
  51212. ref: refForXrefTable,
  51213. data: ""
  51214. });
  51215. newRefs = newRefs.sort((a, b) => {
  51216. return a.ref.num - b.ref.num;
  51217. });
  51218. const xrefTableData = [[0, 1, 0xffff]];
  51219. const indexes = [0, 1];
  51220. let maxOffset = 0;
  51221. for (const {
  51222. ref,
  51223. data
  51224. } of newRefs) {
  51225. maxOffset = Math.max(maxOffset, baseOffset);
  51226. xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]);
  51227. baseOffset += data.length;
  51228. indexes.push(ref.num, 1);
  51229. buffer.push(data);
  51230. }
  51231. newXref.set("Index", indexes);
  51232. if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) {
  51233. const md5 = computeMD5(baseOffset, xrefInfo);
  51234. newXref.set("ID", [xrefInfo.fileIds[0], md5]);
  51235. }
  51236. const offsetSize = Math.ceil(Math.log2(maxOffset) / 8);
  51237. const sizes = [1, offsetSize, 2];
  51238. const structSize = sizes[0] + sizes[1] + sizes[2];
  51239. const tableLength = structSize * xrefTableData.length;
  51240. newXref.set("W", sizes);
  51241. newXref.set("Length", tableLength);
  51242. buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`);
  51243. writeDict(newXref, buffer, null);
  51244. buffer.push(" stream\n");
  51245. const bufferLen = buffer.reduce((a, str) => a + str.length, 0);
  51246. const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`;
  51247. const array = new Uint8Array(originalData.length + bufferLen + tableLength + footer.length);
  51248. array.set(originalData);
  51249. let offset = originalData.length;
  51250. for (const str of buffer) {
  51251. writeString(str, offset, array);
  51252. offset += str.length;
  51253. }
  51254. for (const [type, objOffset, gen] of xrefTableData) {
  51255. offset = writeInt(type, sizes[0], offset, array);
  51256. offset = writeInt(objOffset, sizes[1], offset, array);
  51257. offset = writeInt(gen, sizes[2], offset, array);
  51258. }
  51259. writeString(footer, offset, array);
  51260. return array;
  51261. }
  51262. /***/ }),
  51263. /* 197 */
  51264. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51265. "use strict";
  51266. Object.defineProperty(exports, "__esModule", ({
  51267. value: true
  51268. }));
  51269. exports.XMLParserErrorCode = exports.XMLParserBase = exports.SimpleXMLParser = exports.SimpleDOMNode = void 0;
  51270. var _core_utils = __w_pdfjs_require__(136);
  51271. const XMLParserErrorCode = {
  51272. NoError: 0,
  51273. EndOfDocument: -1,
  51274. UnterminatedCdat: -2,
  51275. UnterminatedXmlDeclaration: -3,
  51276. UnterminatedDoctypeDeclaration: -4,
  51277. UnterminatedComment: -5,
  51278. MalformedElement: -6,
  51279. OutOfMemory: -7,
  51280. UnterminatedAttributeValue: -8,
  51281. UnterminatedElement: -9,
  51282. ElementNeverBegun: -10
  51283. };
  51284. exports.XMLParserErrorCode = XMLParserErrorCode;
  51285. function isWhitespace(s, index) {
  51286. const ch = s[index];
  51287. return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
  51288. }
  51289. function isWhitespaceString(s) {
  51290. for (let i = 0, ii = s.length; i < ii; i++) {
  51291. if (!isWhitespace(s, i)) {
  51292. return false;
  51293. }
  51294. }
  51295. return true;
  51296. }
  51297. class XMLParserBase {
  51298. _resolveEntities(s) {
  51299. return s.replace(/&([^;]+);/g, (all, entity) => {
  51300. if (entity.substring(0, 2) === "#x") {
  51301. return String.fromCodePoint(parseInt(entity.substring(2), 16));
  51302. } else if (entity.substring(0, 1) === "#") {
  51303. return String.fromCodePoint(parseInt(entity.substring(1), 10));
  51304. }
  51305. switch (entity) {
  51306. case "lt":
  51307. return "<";
  51308. case "gt":
  51309. return ">";
  51310. case "amp":
  51311. return "&";
  51312. case "quot":
  51313. return '"';
  51314. case "apos":
  51315. return "'";
  51316. }
  51317. return this.onResolveEntity(entity);
  51318. });
  51319. }
  51320. _parseContent(s, start) {
  51321. const attributes = [];
  51322. let pos = start;
  51323. function skipWs() {
  51324. while (pos < s.length && isWhitespace(s, pos)) {
  51325. ++pos;
  51326. }
  51327. }
  51328. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  51329. ++pos;
  51330. }
  51331. const name = s.substring(start, pos);
  51332. skipWs();
  51333. while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
  51334. skipWs();
  51335. let attrName = "",
  51336. attrValue = "";
  51337. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
  51338. attrName += s[pos];
  51339. ++pos;
  51340. }
  51341. skipWs();
  51342. if (s[pos] !== "=") {
  51343. return null;
  51344. }
  51345. ++pos;
  51346. skipWs();
  51347. const attrEndChar = s[pos];
  51348. if (attrEndChar !== '"' && attrEndChar !== "'") {
  51349. return null;
  51350. }
  51351. const attrEndIndex = s.indexOf(attrEndChar, ++pos);
  51352. if (attrEndIndex < 0) {
  51353. return null;
  51354. }
  51355. attrValue = s.substring(pos, attrEndIndex);
  51356. attributes.push({
  51357. name: attrName,
  51358. value: this._resolveEntities(attrValue)
  51359. });
  51360. pos = attrEndIndex + 1;
  51361. skipWs();
  51362. }
  51363. return {
  51364. name,
  51365. attributes,
  51366. parsed: pos - start
  51367. };
  51368. }
  51369. _parseProcessingInstruction(s, start) {
  51370. let pos = start;
  51371. function skipWs() {
  51372. while (pos < s.length && isWhitespace(s, pos)) {
  51373. ++pos;
  51374. }
  51375. }
  51376. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") {
  51377. ++pos;
  51378. }
  51379. const name = s.substring(start, pos);
  51380. skipWs();
  51381. const attrStart = pos;
  51382. while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
  51383. ++pos;
  51384. }
  51385. const value = s.substring(attrStart, pos);
  51386. return {
  51387. name,
  51388. value,
  51389. parsed: pos - start
  51390. };
  51391. }
  51392. parseXml(s) {
  51393. let i = 0;
  51394. while (i < s.length) {
  51395. const ch = s[i];
  51396. let j = i;
  51397. if (ch === "<") {
  51398. ++j;
  51399. const ch2 = s[j];
  51400. let q;
  51401. switch (ch2) {
  51402. case "/":
  51403. ++j;
  51404. q = s.indexOf(">", j);
  51405. if (q < 0) {
  51406. this.onError(XMLParserErrorCode.UnterminatedElement);
  51407. return;
  51408. }
  51409. this.onEndElement(s.substring(j, q));
  51410. j = q + 1;
  51411. break;
  51412. case "?":
  51413. ++j;
  51414. const pi = this._parseProcessingInstruction(s, j);
  51415. if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
  51416. this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
  51417. return;
  51418. }
  51419. this.onPi(pi.name, pi.value);
  51420. j += pi.parsed + 2;
  51421. break;
  51422. case "!":
  51423. if (s.substring(j + 1, j + 3) === "--") {
  51424. q = s.indexOf("-->", j + 3);
  51425. if (q < 0) {
  51426. this.onError(XMLParserErrorCode.UnterminatedComment);
  51427. return;
  51428. }
  51429. this.onComment(s.substring(j + 3, q));
  51430. j = q + 3;
  51431. } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
  51432. q = s.indexOf("]]>", j + 8);
  51433. if (q < 0) {
  51434. this.onError(XMLParserErrorCode.UnterminatedCdat);
  51435. return;
  51436. }
  51437. this.onCdata(s.substring(j + 8, q));
  51438. j = q + 3;
  51439. } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
  51440. const q2 = s.indexOf("[", j + 8);
  51441. let complexDoctype = false;
  51442. q = s.indexOf(">", j + 8);
  51443. if (q < 0) {
  51444. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  51445. return;
  51446. }
  51447. if (q2 > 0 && q > q2) {
  51448. q = s.indexOf("]>", j + 8);
  51449. if (q < 0) {
  51450. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  51451. return;
  51452. }
  51453. complexDoctype = true;
  51454. }
  51455. const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
  51456. this.onDoctype(doctypeContent);
  51457. j = q + (complexDoctype ? 2 : 1);
  51458. } else {
  51459. this.onError(XMLParserErrorCode.MalformedElement);
  51460. return;
  51461. }
  51462. break;
  51463. default:
  51464. const content = this._parseContent(s, j);
  51465. if (content === null) {
  51466. this.onError(XMLParserErrorCode.MalformedElement);
  51467. return;
  51468. }
  51469. let isClosed = false;
  51470. if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
  51471. isClosed = true;
  51472. } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
  51473. this.onError(XMLParserErrorCode.UnterminatedElement);
  51474. return;
  51475. }
  51476. this.onBeginElement(content.name, content.attributes, isClosed);
  51477. j += content.parsed + (isClosed ? 2 : 1);
  51478. break;
  51479. }
  51480. } else {
  51481. while (j < s.length && s[j] !== "<") {
  51482. j++;
  51483. }
  51484. const text = s.substring(i, j);
  51485. this.onText(this._resolveEntities(text));
  51486. }
  51487. i = j;
  51488. }
  51489. }
  51490. onResolveEntity(name) {
  51491. return `&${name};`;
  51492. }
  51493. onPi(name, value) {}
  51494. onComment(text) {}
  51495. onCdata(text) {}
  51496. onDoctype(doctypeContent) {}
  51497. onText(text) {}
  51498. onBeginElement(name, attributes, isEmpty) {}
  51499. onEndElement(name) {}
  51500. onError(code) {}
  51501. }
  51502. exports.XMLParserBase = XMLParserBase;
  51503. class SimpleDOMNode {
  51504. constructor(nodeName, nodeValue) {
  51505. this.nodeName = nodeName;
  51506. this.nodeValue = nodeValue;
  51507. Object.defineProperty(this, "parentNode", {
  51508. value: null,
  51509. writable: true
  51510. });
  51511. }
  51512. get firstChild() {
  51513. return this.childNodes && this.childNodes[0];
  51514. }
  51515. get nextSibling() {
  51516. const childNodes = this.parentNode.childNodes;
  51517. if (!childNodes) {
  51518. return undefined;
  51519. }
  51520. const index = childNodes.indexOf(this);
  51521. if (index === -1) {
  51522. return undefined;
  51523. }
  51524. return childNodes[index + 1];
  51525. }
  51526. get textContent() {
  51527. if (!this.childNodes) {
  51528. return this.nodeValue || "";
  51529. }
  51530. return this.childNodes.map(function (child) {
  51531. return child.textContent;
  51532. }).join("");
  51533. }
  51534. get children() {
  51535. return this.childNodes || [];
  51536. }
  51537. hasChildNodes() {
  51538. return this.childNodes && this.childNodes.length > 0;
  51539. }
  51540. searchNode(paths, pos) {
  51541. if (pos >= paths.length) {
  51542. return this;
  51543. }
  51544. const component = paths[pos];
  51545. const stack = [];
  51546. let node = this;
  51547. while (true) {
  51548. if (component.name === node.nodeName) {
  51549. if (component.pos === 0) {
  51550. const res = node.searchNode(paths, pos + 1);
  51551. if (res !== null) {
  51552. return res;
  51553. }
  51554. } else if (stack.length === 0) {
  51555. return null;
  51556. } else {
  51557. const [parent] = stack.pop();
  51558. let siblingPos = 0;
  51559. for (const child of parent.childNodes) {
  51560. if (component.name === child.nodeName) {
  51561. if (siblingPos === component.pos) {
  51562. return child.searchNode(paths, pos + 1);
  51563. }
  51564. siblingPos++;
  51565. }
  51566. }
  51567. return node.searchNode(paths, pos + 1);
  51568. }
  51569. }
  51570. if (node.childNodes && node.childNodes.length !== 0) {
  51571. stack.push([node, 0]);
  51572. node = node.childNodes[0];
  51573. } else if (stack.length === 0) {
  51574. return null;
  51575. } else {
  51576. while (stack.length !== 0) {
  51577. const [parent, currentPos] = stack.pop();
  51578. const newPos = currentPos + 1;
  51579. if (newPos < parent.childNodes.length) {
  51580. stack.push([parent, newPos]);
  51581. node = parent.childNodes[newPos];
  51582. break;
  51583. }
  51584. }
  51585. if (stack.length === 0) {
  51586. return null;
  51587. }
  51588. }
  51589. }
  51590. }
  51591. dump(buffer) {
  51592. if (this.nodeName === "#text") {
  51593. buffer.push((0, _core_utils.encodeToXmlString)(this.nodeValue));
  51594. return;
  51595. }
  51596. buffer.push(`<${this.nodeName}`);
  51597. if (this.attributes) {
  51598. for (const attribute of this.attributes) {
  51599. buffer.push(` ${attribute.name}="${(0, _core_utils.encodeToXmlString)(attribute.value)}"`);
  51600. }
  51601. }
  51602. if (this.hasChildNodes()) {
  51603. buffer.push(">");
  51604. for (const child of this.childNodes) {
  51605. child.dump(buffer);
  51606. }
  51607. buffer.push(`</${this.nodeName}>`);
  51608. } else if (this.nodeValue) {
  51609. buffer.push(`>${(0, _core_utils.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`);
  51610. } else {
  51611. buffer.push("/>");
  51612. }
  51613. }
  51614. }
  51615. exports.SimpleDOMNode = SimpleDOMNode;
  51616. class SimpleXMLParser extends XMLParserBase {
  51617. constructor(_ref) {
  51618. let {
  51619. hasAttributes = false,
  51620. lowerCaseName = false
  51621. } = _ref;
  51622. super();
  51623. this._currentFragment = null;
  51624. this._stack = null;
  51625. this._errorCode = XMLParserErrorCode.NoError;
  51626. this._hasAttributes = hasAttributes;
  51627. this._lowerCaseName = lowerCaseName;
  51628. }
  51629. parseFromString(data) {
  51630. this._currentFragment = [];
  51631. this._stack = [];
  51632. this._errorCode = XMLParserErrorCode.NoError;
  51633. this.parseXml(data);
  51634. if (this._errorCode !== XMLParserErrorCode.NoError) {
  51635. return undefined;
  51636. }
  51637. const [documentElement] = this._currentFragment;
  51638. if (!documentElement) {
  51639. return undefined;
  51640. }
  51641. return {
  51642. documentElement
  51643. };
  51644. }
  51645. onText(text) {
  51646. if (isWhitespaceString(text)) {
  51647. return;
  51648. }
  51649. const node = new SimpleDOMNode("#text", text);
  51650. this._currentFragment.push(node);
  51651. }
  51652. onCdata(text) {
  51653. const node = new SimpleDOMNode("#text", text);
  51654. this._currentFragment.push(node);
  51655. }
  51656. onBeginElement(name, attributes, isEmpty) {
  51657. if (this._lowerCaseName) {
  51658. name = name.toLowerCase();
  51659. }
  51660. const node = new SimpleDOMNode(name);
  51661. node.childNodes = [];
  51662. if (this._hasAttributes) {
  51663. node.attributes = attributes;
  51664. }
  51665. this._currentFragment.push(node);
  51666. if (isEmpty) {
  51667. return;
  51668. }
  51669. this._stack.push(this._currentFragment);
  51670. this._currentFragment = node.childNodes;
  51671. }
  51672. onEndElement(name) {
  51673. this._currentFragment = this._stack.pop() || [];
  51674. const lastElement = this._currentFragment.at(-1);
  51675. if (!lastElement) {
  51676. return null;
  51677. }
  51678. for (const childNode of lastElement.childNodes) {
  51679. childNode.parentNode = lastElement;
  51680. }
  51681. return lastElement;
  51682. }
  51683. onError(code) {
  51684. this._errorCode = code;
  51685. }
  51686. }
  51687. exports.SimpleXMLParser = SimpleXMLParser;
  51688. /***/ }),
  51689. /* 198 */
  51690. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51691. "use strict";
  51692. Object.defineProperty(exports, "__esModule", ({
  51693. value: true
  51694. }));
  51695. exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
  51696. exports.calculateSHA384 = calculateSHA384;
  51697. exports.calculateSHA512 = void 0;
  51698. var _util = __w_pdfjs_require__(2);
  51699. var _primitives = __w_pdfjs_require__(137);
  51700. var _decrypt_stream = __w_pdfjs_require__(199);
  51701. class ARCFourCipher {
  51702. constructor(key) {
  51703. this.a = 0;
  51704. this.b = 0;
  51705. const s = new Uint8Array(256);
  51706. const keyLength = key.length;
  51707. for (let i = 0; i < 256; ++i) {
  51708. s[i] = i;
  51709. }
  51710. for (let i = 0, j = 0; i < 256; ++i) {
  51711. const tmp = s[i];
  51712. j = j + tmp + key[i % keyLength] & 0xff;
  51713. s[i] = s[j];
  51714. s[j] = tmp;
  51715. }
  51716. this.s = s;
  51717. }
  51718. encryptBlock(data) {
  51719. let a = this.a,
  51720. b = this.b;
  51721. const s = this.s;
  51722. const n = data.length;
  51723. const output = new Uint8Array(n);
  51724. for (let i = 0; i < n; ++i) {
  51725. a = a + 1 & 0xff;
  51726. const tmp = s[a];
  51727. b = b + tmp & 0xff;
  51728. const tmp2 = s[b];
  51729. s[a] = tmp2;
  51730. s[b] = tmp;
  51731. output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
  51732. }
  51733. this.a = a;
  51734. this.b = b;
  51735. return output;
  51736. }
  51737. decryptBlock(data) {
  51738. return this.encryptBlock(data);
  51739. }
  51740. encrypt(data) {
  51741. return this.encryptBlock(data);
  51742. }
  51743. }
  51744. exports.ARCFourCipher = ARCFourCipher;
  51745. const calculateMD5 = function calculateMD5Closure() {
  51746. 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]);
  51747. 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]);
  51748. function hash(data, offset, length) {
  51749. let h0 = 1732584193,
  51750. h1 = -271733879,
  51751. h2 = -1732584194,
  51752. h3 = 271733878;
  51753. const paddedLength = length + 72 & ~63;
  51754. const padded = new Uint8Array(paddedLength);
  51755. let i, j;
  51756. for (i = 0; i < length; ++i) {
  51757. padded[i] = data[offset++];
  51758. }
  51759. padded[i++] = 0x80;
  51760. const n = paddedLength - 8;
  51761. while (i < n) {
  51762. padded[i++] = 0;
  51763. }
  51764. padded[i++] = length << 3 & 0xff;
  51765. padded[i++] = length >> 5 & 0xff;
  51766. padded[i++] = length >> 13 & 0xff;
  51767. padded[i++] = length >> 21 & 0xff;
  51768. padded[i++] = length >>> 29 & 0xff;
  51769. padded[i++] = 0;
  51770. padded[i++] = 0;
  51771. padded[i++] = 0;
  51772. const w = new Int32Array(16);
  51773. for (i = 0; i < paddedLength;) {
  51774. for (j = 0; j < 16; ++j, i += 4) {
  51775. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  51776. }
  51777. let a = h0,
  51778. b = h1,
  51779. c = h2,
  51780. d = h3,
  51781. f,
  51782. g;
  51783. for (j = 0; j < 64; ++j) {
  51784. if (j < 16) {
  51785. f = b & c | ~b & d;
  51786. g = j;
  51787. } else if (j < 32) {
  51788. f = d & b | ~d & c;
  51789. g = 5 * j + 1 & 15;
  51790. } else if (j < 48) {
  51791. f = b ^ c ^ d;
  51792. g = 3 * j + 5 & 15;
  51793. } else {
  51794. f = c ^ (b | ~d);
  51795. g = 7 * j & 15;
  51796. }
  51797. const tmp = d,
  51798. rotateArg = a + f + k[j] + w[g] | 0,
  51799. rotate = r[j];
  51800. d = c;
  51801. c = b;
  51802. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  51803. a = tmp;
  51804. }
  51805. h0 = h0 + a | 0;
  51806. h1 = h1 + b | 0;
  51807. h2 = h2 + c | 0;
  51808. h3 = h3 + d | 0;
  51809. }
  51810. 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]);
  51811. }
  51812. return hash;
  51813. }();
  51814. exports.calculateMD5 = calculateMD5;
  51815. class Word64 {
  51816. constructor(highInteger, lowInteger) {
  51817. this.high = highInteger | 0;
  51818. this.low = lowInteger | 0;
  51819. }
  51820. and(word) {
  51821. this.high &= word.high;
  51822. this.low &= word.low;
  51823. }
  51824. xor(word) {
  51825. this.high ^= word.high;
  51826. this.low ^= word.low;
  51827. }
  51828. or(word) {
  51829. this.high |= word.high;
  51830. this.low |= word.low;
  51831. }
  51832. shiftRight(places) {
  51833. if (places >= 32) {
  51834. this.low = this.high >>> places - 32 | 0;
  51835. this.high = 0;
  51836. } else {
  51837. this.low = this.low >>> places | this.high << 32 - places;
  51838. this.high = this.high >>> places | 0;
  51839. }
  51840. }
  51841. shiftLeft(places) {
  51842. if (places >= 32) {
  51843. this.high = this.low << places - 32;
  51844. this.low = 0;
  51845. } else {
  51846. this.high = this.high << places | this.low >>> 32 - places;
  51847. this.low <<= places;
  51848. }
  51849. }
  51850. rotateRight(places) {
  51851. let low, high;
  51852. if (places & 32) {
  51853. high = this.low;
  51854. low = this.high;
  51855. } else {
  51856. low = this.low;
  51857. high = this.high;
  51858. }
  51859. places &= 31;
  51860. this.low = low >>> places | high << 32 - places;
  51861. this.high = high >>> places | low << 32 - places;
  51862. }
  51863. not() {
  51864. this.high = ~this.high;
  51865. this.low = ~this.low;
  51866. }
  51867. add(word) {
  51868. const lowAdd = (this.low >>> 0) + (word.low >>> 0);
  51869. let highAdd = (this.high >>> 0) + (word.high >>> 0);
  51870. if (lowAdd > 0xffffffff) {
  51871. highAdd += 1;
  51872. }
  51873. this.low = lowAdd | 0;
  51874. this.high = highAdd | 0;
  51875. }
  51876. copyTo(bytes, offset) {
  51877. bytes[offset] = this.high >>> 24 & 0xff;
  51878. bytes[offset + 1] = this.high >> 16 & 0xff;
  51879. bytes[offset + 2] = this.high >> 8 & 0xff;
  51880. bytes[offset + 3] = this.high & 0xff;
  51881. bytes[offset + 4] = this.low >>> 24 & 0xff;
  51882. bytes[offset + 5] = this.low >> 16 & 0xff;
  51883. bytes[offset + 6] = this.low >> 8 & 0xff;
  51884. bytes[offset + 7] = this.low & 0xff;
  51885. }
  51886. assign(word) {
  51887. this.high = word.high;
  51888. this.low = word.low;
  51889. }
  51890. }
  51891. const calculateSHA256 = function calculateSHA256Closure() {
  51892. function rotr(x, n) {
  51893. return x >>> n | x << 32 - n;
  51894. }
  51895. function ch(x, y, z) {
  51896. return x & y ^ ~x & z;
  51897. }
  51898. function maj(x, y, z) {
  51899. return x & y ^ x & z ^ y & z;
  51900. }
  51901. function sigma(x) {
  51902. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  51903. }
  51904. function sigmaPrime(x) {
  51905. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  51906. }
  51907. function littleSigma(x) {
  51908. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  51909. }
  51910. function littleSigmaPrime(x) {
  51911. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  51912. }
  51913. 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];
  51914. function hash(data, offset, length) {
  51915. let h0 = 0x6a09e667,
  51916. h1 = 0xbb67ae85,
  51917. h2 = 0x3c6ef372,
  51918. h3 = 0xa54ff53a,
  51919. h4 = 0x510e527f,
  51920. h5 = 0x9b05688c,
  51921. h6 = 0x1f83d9ab,
  51922. h7 = 0x5be0cd19;
  51923. const paddedLength = Math.ceil((length + 9) / 64) * 64;
  51924. const padded = new Uint8Array(paddedLength);
  51925. let i, j;
  51926. for (i = 0; i < length; ++i) {
  51927. padded[i] = data[offset++];
  51928. }
  51929. padded[i++] = 0x80;
  51930. const n = paddedLength - 8;
  51931. while (i < n) {
  51932. padded[i++] = 0;
  51933. }
  51934. padded[i++] = 0;
  51935. padded[i++] = 0;
  51936. padded[i++] = 0;
  51937. padded[i++] = length >>> 29 & 0xff;
  51938. padded[i++] = length >> 21 & 0xff;
  51939. padded[i++] = length >> 13 & 0xff;
  51940. padded[i++] = length >> 5 & 0xff;
  51941. padded[i++] = length << 3 & 0xff;
  51942. const w = new Uint32Array(64);
  51943. for (i = 0; i < paddedLength;) {
  51944. for (j = 0; j < 16; ++j) {
  51945. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  51946. i += 4;
  51947. }
  51948. for (j = 16; j < 64; ++j) {
  51949. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  51950. }
  51951. let a = h0,
  51952. b = h1,
  51953. c = h2,
  51954. d = h3,
  51955. e = h4,
  51956. f = h5,
  51957. g = h6,
  51958. h = h7,
  51959. t1,
  51960. t2;
  51961. for (j = 0; j < 64; ++j) {
  51962. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  51963. t2 = sigma(a) + maj(a, b, c);
  51964. h = g;
  51965. g = f;
  51966. f = e;
  51967. e = d + t1 | 0;
  51968. d = c;
  51969. c = b;
  51970. b = a;
  51971. a = t1 + t2 | 0;
  51972. }
  51973. h0 = h0 + a | 0;
  51974. h1 = h1 + b | 0;
  51975. h2 = h2 + c | 0;
  51976. h3 = h3 + d | 0;
  51977. h4 = h4 + e | 0;
  51978. h5 = h5 + f | 0;
  51979. h6 = h6 + g | 0;
  51980. h7 = h7 + h | 0;
  51981. }
  51982. 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]);
  51983. }
  51984. return hash;
  51985. }();
  51986. exports.calculateSHA256 = calculateSHA256;
  51987. const calculateSHA512 = function calculateSHA512Closure() {
  51988. function ch(result, x, y, z, tmp) {
  51989. result.assign(x);
  51990. result.and(y);
  51991. tmp.assign(x);
  51992. tmp.not();
  51993. tmp.and(z);
  51994. result.xor(tmp);
  51995. }
  51996. function maj(result, x, y, z, tmp) {
  51997. result.assign(x);
  51998. result.and(y);
  51999. tmp.assign(x);
  52000. tmp.and(z);
  52001. result.xor(tmp);
  52002. tmp.assign(y);
  52003. tmp.and(z);
  52004. result.xor(tmp);
  52005. }
  52006. function sigma(result, x, tmp) {
  52007. result.assign(x);
  52008. result.rotateRight(28);
  52009. tmp.assign(x);
  52010. tmp.rotateRight(34);
  52011. result.xor(tmp);
  52012. tmp.assign(x);
  52013. tmp.rotateRight(39);
  52014. result.xor(tmp);
  52015. }
  52016. function sigmaPrime(result, x, tmp) {
  52017. result.assign(x);
  52018. result.rotateRight(14);
  52019. tmp.assign(x);
  52020. tmp.rotateRight(18);
  52021. result.xor(tmp);
  52022. tmp.assign(x);
  52023. tmp.rotateRight(41);
  52024. result.xor(tmp);
  52025. }
  52026. function littleSigma(result, x, tmp) {
  52027. result.assign(x);
  52028. result.rotateRight(1);
  52029. tmp.assign(x);
  52030. tmp.rotateRight(8);
  52031. result.xor(tmp);
  52032. tmp.assign(x);
  52033. tmp.shiftRight(7);
  52034. result.xor(tmp);
  52035. }
  52036. function littleSigmaPrime(result, x, tmp) {
  52037. result.assign(x);
  52038. result.rotateRight(19);
  52039. tmp.assign(x);
  52040. tmp.rotateRight(61);
  52041. result.xor(tmp);
  52042. tmp.assign(x);
  52043. tmp.shiftRight(6);
  52044. result.xor(tmp);
  52045. }
  52046. 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)];
  52047. function hash(data, offset, length) {
  52048. let mode384 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  52049. let h0, h1, h2, h3, h4, h5, h6, h7;
  52050. if (!mode384) {
  52051. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  52052. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  52053. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  52054. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  52055. h4 = new Word64(0x510e527f, 0xade682d1);
  52056. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  52057. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  52058. h7 = new Word64(0x5be0cd19, 0x137e2179);
  52059. } else {
  52060. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  52061. h1 = new Word64(0x629a292a, 0x367cd507);
  52062. h2 = new Word64(0x9159015a, 0x3070dd17);
  52063. h3 = new Word64(0x152fecd8, 0xf70e5939);
  52064. h4 = new Word64(0x67332667, 0xffc00b31);
  52065. h5 = new Word64(0x8eb44a87, 0x68581511);
  52066. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  52067. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  52068. }
  52069. const paddedLength = Math.ceil((length + 17) / 128) * 128;
  52070. const padded = new Uint8Array(paddedLength);
  52071. let i, j;
  52072. for (i = 0; i < length; ++i) {
  52073. padded[i] = data[offset++];
  52074. }
  52075. padded[i++] = 0x80;
  52076. const n = paddedLength - 16;
  52077. while (i < n) {
  52078. padded[i++] = 0;
  52079. }
  52080. padded[i++] = 0;
  52081. padded[i++] = 0;
  52082. padded[i++] = 0;
  52083. padded[i++] = 0;
  52084. padded[i++] = 0;
  52085. padded[i++] = 0;
  52086. padded[i++] = 0;
  52087. padded[i++] = 0;
  52088. padded[i++] = 0;
  52089. padded[i++] = 0;
  52090. padded[i++] = 0;
  52091. padded[i++] = length >>> 29 & 0xff;
  52092. padded[i++] = length >> 21 & 0xff;
  52093. padded[i++] = length >> 13 & 0xff;
  52094. padded[i++] = length >> 5 & 0xff;
  52095. padded[i++] = length << 3 & 0xff;
  52096. const w = new Array(80);
  52097. for (i = 0; i < 80; i++) {
  52098. w[i] = new Word64(0, 0);
  52099. }
  52100. let a = new Word64(0, 0),
  52101. b = new Word64(0, 0),
  52102. c = new Word64(0, 0);
  52103. let d = new Word64(0, 0),
  52104. e = new Word64(0, 0),
  52105. f = new Word64(0, 0);
  52106. let g = new Word64(0, 0),
  52107. h = new Word64(0, 0);
  52108. const t1 = new Word64(0, 0),
  52109. t2 = new Word64(0, 0);
  52110. const tmp1 = new Word64(0, 0),
  52111. tmp2 = new Word64(0, 0);
  52112. let tmp3;
  52113. for (i = 0; i < paddedLength;) {
  52114. for (j = 0; j < 16; ++j) {
  52115. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  52116. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  52117. i += 8;
  52118. }
  52119. for (j = 16; j < 80; ++j) {
  52120. tmp3 = w[j];
  52121. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  52122. tmp3.add(w[j - 7]);
  52123. littleSigma(tmp1, w[j - 15], tmp2);
  52124. tmp3.add(tmp1);
  52125. tmp3.add(w[j - 16]);
  52126. }
  52127. a.assign(h0);
  52128. b.assign(h1);
  52129. c.assign(h2);
  52130. d.assign(h3);
  52131. e.assign(h4);
  52132. f.assign(h5);
  52133. g.assign(h6);
  52134. h.assign(h7);
  52135. for (j = 0; j < 80; ++j) {
  52136. t1.assign(h);
  52137. sigmaPrime(tmp1, e, tmp2);
  52138. t1.add(tmp1);
  52139. ch(tmp1, e, f, g, tmp2);
  52140. t1.add(tmp1);
  52141. t1.add(k[j]);
  52142. t1.add(w[j]);
  52143. sigma(t2, a, tmp2);
  52144. maj(tmp1, a, b, c, tmp2);
  52145. t2.add(tmp1);
  52146. tmp3 = h;
  52147. h = g;
  52148. g = f;
  52149. f = e;
  52150. d.add(t1);
  52151. e = d;
  52152. d = c;
  52153. c = b;
  52154. b = a;
  52155. tmp3.assign(t1);
  52156. tmp3.add(t2);
  52157. a = tmp3;
  52158. }
  52159. h0.add(a);
  52160. h1.add(b);
  52161. h2.add(c);
  52162. h3.add(d);
  52163. h4.add(e);
  52164. h5.add(f);
  52165. h6.add(g);
  52166. h7.add(h);
  52167. }
  52168. let result;
  52169. if (!mode384) {
  52170. result = new Uint8Array(64);
  52171. h0.copyTo(result, 0);
  52172. h1.copyTo(result, 8);
  52173. h2.copyTo(result, 16);
  52174. h3.copyTo(result, 24);
  52175. h4.copyTo(result, 32);
  52176. h5.copyTo(result, 40);
  52177. h6.copyTo(result, 48);
  52178. h7.copyTo(result, 56);
  52179. } else {
  52180. result = new Uint8Array(48);
  52181. h0.copyTo(result, 0);
  52182. h1.copyTo(result, 8);
  52183. h2.copyTo(result, 16);
  52184. h3.copyTo(result, 24);
  52185. h4.copyTo(result, 32);
  52186. h5.copyTo(result, 40);
  52187. }
  52188. return result;
  52189. }
  52190. return hash;
  52191. }();
  52192. exports.calculateSHA512 = calculateSHA512;
  52193. function calculateSHA384(data, offset, length) {
  52194. return calculateSHA512(data, offset, length, true);
  52195. }
  52196. class NullCipher {
  52197. decryptBlock(data) {
  52198. return data;
  52199. }
  52200. encrypt(data) {
  52201. return data;
  52202. }
  52203. }
  52204. class AESBaseCipher {
  52205. constructor() {
  52206. if (this.constructor === AESBaseCipher) {
  52207. (0, _util.unreachable)("Cannot initialize AESBaseCipher.");
  52208. }
  52209. 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]);
  52210. 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]);
  52211. 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]);
  52212. this._mixCol = new Uint8Array(256);
  52213. for (let i = 0; i < 256; i++) {
  52214. if (i < 128) {
  52215. this._mixCol[i] = i << 1;
  52216. } else {
  52217. this._mixCol[i] = i << 1 ^ 0x1b;
  52218. }
  52219. }
  52220. this.buffer = new Uint8Array(16);
  52221. this.bufferPosition = 0;
  52222. }
  52223. _expandKey(cipherKey) {
  52224. (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
  52225. }
  52226. _decrypt(input, key) {
  52227. let t, u, v;
  52228. const state = new Uint8Array(16);
  52229. state.set(input);
  52230. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  52231. state[j] ^= key[k];
  52232. }
  52233. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  52234. t = state[13];
  52235. state[13] = state[9];
  52236. state[9] = state[5];
  52237. state[5] = state[1];
  52238. state[1] = t;
  52239. t = state[14];
  52240. u = state[10];
  52241. state[14] = state[6];
  52242. state[10] = state[2];
  52243. state[6] = t;
  52244. state[2] = u;
  52245. t = state[15];
  52246. u = state[11];
  52247. v = state[7];
  52248. state[15] = state[3];
  52249. state[11] = t;
  52250. state[7] = u;
  52251. state[3] = v;
  52252. for (let j = 0; j < 16; ++j) {
  52253. state[j] = this._inv_s[state[j]];
  52254. }
  52255. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  52256. state[j] ^= key[k];
  52257. }
  52258. for (let j = 0; j < 16; j += 4) {
  52259. const s0 = this._mix[state[j]];
  52260. const s1 = this._mix[state[j + 1]];
  52261. const s2 = this._mix[state[j + 2]];
  52262. const s3 = this._mix[state[j + 3]];
  52263. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  52264. state[j] = t >>> 24 & 0xff;
  52265. state[j + 1] = t >> 16 & 0xff;
  52266. state[j + 2] = t >> 8 & 0xff;
  52267. state[j + 3] = t & 0xff;
  52268. }
  52269. }
  52270. t = state[13];
  52271. state[13] = state[9];
  52272. state[9] = state[5];
  52273. state[5] = state[1];
  52274. state[1] = t;
  52275. t = state[14];
  52276. u = state[10];
  52277. state[14] = state[6];
  52278. state[10] = state[2];
  52279. state[6] = t;
  52280. state[2] = u;
  52281. t = state[15];
  52282. u = state[11];
  52283. v = state[7];
  52284. state[15] = state[3];
  52285. state[11] = t;
  52286. state[7] = u;
  52287. state[3] = v;
  52288. for (let j = 0; j < 16; ++j) {
  52289. state[j] = this._inv_s[state[j]];
  52290. state[j] ^= key[j];
  52291. }
  52292. return state;
  52293. }
  52294. _encrypt(input, key) {
  52295. const s = this._s;
  52296. let t, u, v;
  52297. const state = new Uint8Array(16);
  52298. state.set(input);
  52299. for (let j = 0; j < 16; ++j) {
  52300. state[j] ^= key[j];
  52301. }
  52302. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  52303. for (let j = 0; j < 16; ++j) {
  52304. state[j] = s[state[j]];
  52305. }
  52306. v = state[1];
  52307. state[1] = state[5];
  52308. state[5] = state[9];
  52309. state[9] = state[13];
  52310. state[13] = v;
  52311. v = state[2];
  52312. u = state[6];
  52313. state[2] = state[10];
  52314. state[6] = state[14];
  52315. state[10] = v;
  52316. state[14] = u;
  52317. v = state[3];
  52318. u = state[7];
  52319. t = state[11];
  52320. state[3] = state[15];
  52321. state[7] = v;
  52322. state[11] = u;
  52323. state[15] = t;
  52324. for (let j = 0; j < 16; j += 4) {
  52325. const s0 = state[j + 0];
  52326. const s1 = state[j + 1];
  52327. const s2 = state[j + 2];
  52328. const s3 = state[j + 3];
  52329. t = s0 ^ s1 ^ s2 ^ s3;
  52330. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  52331. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  52332. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  52333. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  52334. }
  52335. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  52336. state[j] ^= key[k];
  52337. }
  52338. }
  52339. for (let j = 0; j < 16; ++j) {
  52340. state[j] = s[state[j]];
  52341. }
  52342. v = state[1];
  52343. state[1] = state[5];
  52344. state[5] = state[9];
  52345. state[9] = state[13];
  52346. state[13] = v;
  52347. v = state[2];
  52348. u = state[6];
  52349. state[2] = state[10];
  52350. state[6] = state[14];
  52351. state[10] = v;
  52352. state[14] = u;
  52353. v = state[3];
  52354. u = state[7];
  52355. t = state[11];
  52356. state[3] = state[15];
  52357. state[7] = v;
  52358. state[11] = u;
  52359. state[15] = t;
  52360. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  52361. state[j] ^= key[k];
  52362. }
  52363. return state;
  52364. }
  52365. _decryptBlock2(data, finalize) {
  52366. const sourceLength = data.length;
  52367. let buffer = this.buffer,
  52368. bufferLength = this.bufferPosition;
  52369. const result = [];
  52370. let iv = this.iv;
  52371. for (let i = 0; i < sourceLength; ++i) {
  52372. buffer[bufferLength] = data[i];
  52373. ++bufferLength;
  52374. if (bufferLength < 16) {
  52375. continue;
  52376. }
  52377. const plain = this._decrypt(buffer, this._key);
  52378. for (let j = 0; j < 16; ++j) {
  52379. plain[j] ^= iv[j];
  52380. }
  52381. iv = buffer;
  52382. result.push(plain);
  52383. buffer = new Uint8Array(16);
  52384. bufferLength = 0;
  52385. }
  52386. this.buffer = buffer;
  52387. this.bufferLength = bufferLength;
  52388. this.iv = iv;
  52389. if (result.length === 0) {
  52390. return new Uint8Array(0);
  52391. }
  52392. let outputLength = 16 * result.length;
  52393. if (finalize) {
  52394. const lastBlock = result.at(-1);
  52395. let psLen = lastBlock[15];
  52396. if (psLen <= 16) {
  52397. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  52398. if (lastBlock[i] !== psLen) {
  52399. psLen = 0;
  52400. break;
  52401. }
  52402. }
  52403. outputLength -= psLen;
  52404. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  52405. }
  52406. }
  52407. const output = new Uint8Array(outputLength);
  52408. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  52409. output.set(result[i], j);
  52410. }
  52411. return output;
  52412. }
  52413. decryptBlock(data, finalize) {
  52414. let iv = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  52415. const sourceLength = data.length;
  52416. const buffer = this.buffer;
  52417. let bufferLength = this.bufferPosition;
  52418. if (iv) {
  52419. this.iv = iv;
  52420. } else {
  52421. for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  52422. buffer[bufferLength] = data[i];
  52423. }
  52424. if (bufferLength < 16) {
  52425. this.bufferLength = bufferLength;
  52426. return new Uint8Array(0);
  52427. }
  52428. this.iv = buffer;
  52429. data = data.subarray(16);
  52430. }
  52431. this.buffer = new Uint8Array(16);
  52432. this.bufferLength = 0;
  52433. this.decryptBlock = this._decryptBlock2;
  52434. return this.decryptBlock(data, finalize);
  52435. }
  52436. encrypt(data, iv) {
  52437. const sourceLength = data.length;
  52438. let buffer = this.buffer,
  52439. bufferLength = this.bufferPosition;
  52440. const result = [];
  52441. if (!iv) {
  52442. iv = new Uint8Array(16);
  52443. }
  52444. for (let i = 0; i < sourceLength; ++i) {
  52445. buffer[bufferLength] = data[i];
  52446. ++bufferLength;
  52447. if (bufferLength < 16) {
  52448. continue;
  52449. }
  52450. for (let j = 0; j < 16; ++j) {
  52451. buffer[j] ^= iv[j];
  52452. }
  52453. const cipher = this._encrypt(buffer, this._key);
  52454. iv = cipher;
  52455. result.push(cipher);
  52456. buffer = new Uint8Array(16);
  52457. bufferLength = 0;
  52458. }
  52459. this.buffer = buffer;
  52460. this.bufferLength = bufferLength;
  52461. this.iv = iv;
  52462. if (result.length === 0) {
  52463. return new Uint8Array(0);
  52464. }
  52465. const outputLength = 16 * result.length;
  52466. const output = new Uint8Array(outputLength);
  52467. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  52468. output.set(result[i], j);
  52469. }
  52470. return output;
  52471. }
  52472. }
  52473. class AES128Cipher extends AESBaseCipher {
  52474. constructor(key) {
  52475. super();
  52476. this._cyclesOfRepetition = 10;
  52477. this._keySize = 160;
  52478. 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]);
  52479. this._key = this._expandKey(key);
  52480. }
  52481. _expandKey(cipherKey) {
  52482. const b = 176;
  52483. const s = this._s;
  52484. const rcon = this._rcon;
  52485. const result = new Uint8Array(b);
  52486. result.set(cipherKey);
  52487. for (let j = 16, i = 1; j < b; ++i) {
  52488. let t1 = result[j - 3];
  52489. let t2 = result[j - 2];
  52490. let t3 = result[j - 1];
  52491. let t4 = result[j - 4];
  52492. t1 = s[t1];
  52493. t2 = s[t2];
  52494. t3 = s[t3];
  52495. t4 = s[t4];
  52496. t1 ^= rcon[i];
  52497. for (let n = 0; n < 4; ++n) {
  52498. result[j] = t1 ^= result[j - 16];
  52499. j++;
  52500. result[j] = t2 ^= result[j - 16];
  52501. j++;
  52502. result[j] = t3 ^= result[j - 16];
  52503. j++;
  52504. result[j] = t4 ^= result[j - 16];
  52505. j++;
  52506. }
  52507. }
  52508. return result;
  52509. }
  52510. }
  52511. exports.AES128Cipher = AES128Cipher;
  52512. class AES256Cipher extends AESBaseCipher {
  52513. constructor(key) {
  52514. super();
  52515. this._cyclesOfRepetition = 14;
  52516. this._keySize = 224;
  52517. this._key = this._expandKey(key);
  52518. }
  52519. _expandKey(cipherKey) {
  52520. const b = 240;
  52521. const s = this._s;
  52522. const result = new Uint8Array(b);
  52523. result.set(cipherKey);
  52524. let r = 1;
  52525. let t1, t2, t3, t4;
  52526. for (let j = 32, i = 1; j < b; ++i) {
  52527. if (j % 32 === 16) {
  52528. t1 = s[t1];
  52529. t2 = s[t2];
  52530. t3 = s[t3];
  52531. t4 = s[t4];
  52532. } else if (j % 32 === 0) {
  52533. t1 = result[j - 3];
  52534. t2 = result[j - 2];
  52535. t3 = result[j - 1];
  52536. t4 = result[j - 4];
  52537. t1 = s[t1];
  52538. t2 = s[t2];
  52539. t3 = s[t3];
  52540. t4 = s[t4];
  52541. t1 ^= r;
  52542. if ((r <<= 1) >= 256) {
  52543. r = (r ^ 0x1b) & 0xff;
  52544. }
  52545. }
  52546. for (let n = 0; n < 4; ++n) {
  52547. result[j] = t1 ^= result[j - 32];
  52548. j++;
  52549. result[j] = t2 ^= result[j - 32];
  52550. j++;
  52551. result[j] = t3 ^= result[j - 32];
  52552. j++;
  52553. result[j] = t4 ^= result[j - 32];
  52554. j++;
  52555. }
  52556. }
  52557. return result;
  52558. }
  52559. }
  52560. exports.AES256Cipher = AES256Cipher;
  52561. class PDF17 {
  52562. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  52563. const hashData = new Uint8Array(password.length + 56);
  52564. hashData.set(password, 0);
  52565. hashData.set(ownerValidationSalt, password.length);
  52566. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  52567. const result = calculateSHA256(hashData, 0, hashData.length);
  52568. return (0, _util.isArrayEqual)(result, ownerPassword);
  52569. }
  52570. checkUserPassword(password, userValidationSalt, userPassword) {
  52571. const hashData = new Uint8Array(password.length + 8);
  52572. hashData.set(password, 0);
  52573. hashData.set(userValidationSalt, password.length);
  52574. const result = calculateSHA256(hashData, 0, hashData.length);
  52575. return (0, _util.isArrayEqual)(result, userPassword);
  52576. }
  52577. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  52578. const hashData = new Uint8Array(password.length + 56);
  52579. hashData.set(password, 0);
  52580. hashData.set(ownerKeySalt, password.length);
  52581. hashData.set(userBytes, password.length + ownerKeySalt.length);
  52582. const key = calculateSHA256(hashData, 0, hashData.length);
  52583. const cipher = new AES256Cipher(key);
  52584. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  52585. }
  52586. getUserKey(password, userKeySalt, userEncryption) {
  52587. const hashData = new Uint8Array(password.length + 8);
  52588. hashData.set(password, 0);
  52589. hashData.set(userKeySalt, password.length);
  52590. const key = calculateSHA256(hashData, 0, hashData.length);
  52591. const cipher = new AES256Cipher(key);
  52592. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  52593. }
  52594. }
  52595. exports.PDF17 = PDF17;
  52596. const PDF20 = function PDF20Closure() {
  52597. function calculatePDF20Hash(password, input, userBytes) {
  52598. let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  52599. let e = [0];
  52600. let i = 0;
  52601. while (i < 64 || e.at(-1) > i - 32) {
  52602. const combinedLength = password.length + k.length + userBytes.length,
  52603. combinedArray = new Uint8Array(combinedLength);
  52604. let writeOffset = 0;
  52605. combinedArray.set(password, writeOffset);
  52606. writeOffset += password.length;
  52607. combinedArray.set(k, writeOffset);
  52608. writeOffset += k.length;
  52609. combinedArray.set(userBytes, writeOffset);
  52610. const k1 = new Uint8Array(combinedLength * 64);
  52611. for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) {
  52612. k1.set(combinedArray, pos);
  52613. }
  52614. const cipher = new AES128Cipher(k.subarray(0, 16));
  52615. e = cipher.encrypt(k1, k.subarray(16, 32));
  52616. const remainder = e.slice(0, 16).reduce((a, b) => a + b, 0) % 3;
  52617. if (remainder === 0) {
  52618. k = calculateSHA256(e, 0, e.length);
  52619. } else if (remainder === 1) {
  52620. k = calculateSHA384(e, 0, e.length);
  52621. } else if (remainder === 2) {
  52622. k = calculateSHA512(e, 0, e.length);
  52623. }
  52624. i++;
  52625. }
  52626. return k.subarray(0, 32);
  52627. }
  52628. class PDF20 {
  52629. hash(password, concatBytes, userBytes) {
  52630. return calculatePDF20Hash(password, concatBytes, userBytes);
  52631. }
  52632. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  52633. const hashData = new Uint8Array(password.length + 56);
  52634. hashData.set(password, 0);
  52635. hashData.set(ownerValidationSalt, password.length);
  52636. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  52637. const result = calculatePDF20Hash(password, hashData, userBytes);
  52638. return (0, _util.isArrayEqual)(result, ownerPassword);
  52639. }
  52640. checkUserPassword(password, userValidationSalt, userPassword) {
  52641. const hashData = new Uint8Array(password.length + 8);
  52642. hashData.set(password, 0);
  52643. hashData.set(userValidationSalt, password.length);
  52644. const result = calculatePDF20Hash(password, hashData, []);
  52645. return (0, _util.isArrayEqual)(result, userPassword);
  52646. }
  52647. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  52648. const hashData = new Uint8Array(password.length + 56);
  52649. hashData.set(password, 0);
  52650. hashData.set(ownerKeySalt, password.length);
  52651. hashData.set(userBytes, password.length + ownerKeySalt.length);
  52652. const key = calculatePDF20Hash(password, hashData, userBytes);
  52653. const cipher = new AES256Cipher(key);
  52654. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  52655. }
  52656. getUserKey(password, userKeySalt, userEncryption) {
  52657. const hashData = new Uint8Array(password.length + 8);
  52658. hashData.set(password, 0);
  52659. hashData.set(userKeySalt, password.length);
  52660. const key = calculatePDF20Hash(password, hashData, []);
  52661. const cipher = new AES256Cipher(key);
  52662. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  52663. }
  52664. }
  52665. return PDF20;
  52666. }();
  52667. exports.PDF20 = PDF20;
  52668. class CipherTransform {
  52669. constructor(stringCipherConstructor, streamCipherConstructor) {
  52670. this.StringCipherConstructor = stringCipherConstructor;
  52671. this.StreamCipherConstructor = streamCipherConstructor;
  52672. }
  52673. createStream(stream, length) {
  52674. const cipher = new this.StreamCipherConstructor();
  52675. return new _decrypt_stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  52676. return cipher.decryptBlock(data, finalize);
  52677. });
  52678. }
  52679. decryptString(s) {
  52680. const cipher = new this.StringCipherConstructor();
  52681. let data = (0, _util.stringToBytes)(s);
  52682. data = cipher.decryptBlock(data, true);
  52683. return (0, _util.bytesToString)(data);
  52684. }
  52685. encryptString(s) {
  52686. const cipher = new this.StringCipherConstructor();
  52687. if (cipher instanceof AESBaseCipher) {
  52688. const strLen = s.length;
  52689. const pad = 16 - strLen % 16;
  52690. s += String.fromCharCode(pad).repeat(pad);
  52691. const iv = new Uint8Array(16);
  52692. if (typeof crypto !== "undefined") {
  52693. crypto.getRandomValues(iv);
  52694. } else {
  52695. for (let i = 0; i < 16; i++) {
  52696. iv[i] = Math.floor(256 * Math.random());
  52697. }
  52698. }
  52699. let data = (0, _util.stringToBytes)(s);
  52700. data = cipher.encrypt(data, iv);
  52701. const buf = new Uint8Array(16 + data.length);
  52702. buf.set(iv);
  52703. buf.set(data, 16);
  52704. return (0, _util.bytesToString)(buf);
  52705. }
  52706. let data = (0, _util.stringToBytes)(s);
  52707. data = cipher.encrypt(data);
  52708. return (0, _util.bytesToString)(data);
  52709. }
  52710. }
  52711. const CipherTransformFactory = function CipherTransformFactoryClosure() {
  52712. 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]);
  52713. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  52714. if (password) {
  52715. const passwordLength = Math.min(127, password.length);
  52716. password = password.subarray(0, passwordLength);
  52717. } else {
  52718. password = [];
  52719. }
  52720. let pdfAlgorithm;
  52721. if (revision === 6) {
  52722. pdfAlgorithm = new PDF20();
  52723. } else {
  52724. pdfAlgorithm = new PDF17();
  52725. }
  52726. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  52727. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  52728. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  52729. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  52730. }
  52731. return null;
  52732. }
  52733. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  52734. const hashDataSize = 40 + ownerPassword.length + fileId.length;
  52735. const hashData = new Uint8Array(hashDataSize);
  52736. let i = 0,
  52737. j,
  52738. n;
  52739. if (password) {
  52740. n = Math.min(32, password.length);
  52741. for (; i < n; ++i) {
  52742. hashData[i] = password[i];
  52743. }
  52744. }
  52745. j = 0;
  52746. while (i < 32) {
  52747. hashData[i++] = defaultPasswordBytes[j++];
  52748. }
  52749. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  52750. hashData[i++] = ownerPassword[j];
  52751. }
  52752. hashData[i++] = flags & 0xff;
  52753. hashData[i++] = flags >> 8 & 0xff;
  52754. hashData[i++] = flags >> 16 & 0xff;
  52755. hashData[i++] = flags >>> 24 & 0xff;
  52756. for (j = 0, n = fileId.length; j < n; ++j) {
  52757. hashData[i++] = fileId[j];
  52758. }
  52759. if (revision >= 4 && !encryptMetadata) {
  52760. hashData[i++] = 0xff;
  52761. hashData[i++] = 0xff;
  52762. hashData[i++] = 0xff;
  52763. hashData[i++] = 0xff;
  52764. }
  52765. let hash = calculateMD5(hashData, 0, i);
  52766. const keyLengthInBytes = keyLength >> 3;
  52767. if (revision >= 3) {
  52768. for (j = 0; j < 50; ++j) {
  52769. hash = calculateMD5(hash, 0, keyLengthInBytes);
  52770. }
  52771. }
  52772. const encryptionKey = hash.subarray(0, keyLengthInBytes);
  52773. let cipher, checkData;
  52774. if (revision >= 3) {
  52775. for (i = 0; i < 32; ++i) {
  52776. hashData[i] = defaultPasswordBytes[i];
  52777. }
  52778. for (j = 0, n = fileId.length; j < n; ++j) {
  52779. hashData[i++] = fileId[j];
  52780. }
  52781. cipher = new ARCFourCipher(encryptionKey);
  52782. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  52783. n = encryptionKey.length;
  52784. const derivedKey = new Uint8Array(n);
  52785. for (j = 1; j <= 19; ++j) {
  52786. for (let k = 0; k < n; ++k) {
  52787. derivedKey[k] = encryptionKey[k] ^ j;
  52788. }
  52789. cipher = new ARCFourCipher(derivedKey);
  52790. checkData = cipher.encryptBlock(checkData);
  52791. }
  52792. for (j = 0, n = checkData.length; j < n; ++j) {
  52793. if (userPassword[j] !== checkData[j]) {
  52794. return null;
  52795. }
  52796. }
  52797. } else {
  52798. cipher = new ARCFourCipher(encryptionKey);
  52799. checkData = cipher.encryptBlock(defaultPasswordBytes);
  52800. for (j = 0, n = checkData.length; j < n; ++j) {
  52801. if (userPassword[j] !== checkData[j]) {
  52802. return null;
  52803. }
  52804. }
  52805. }
  52806. return encryptionKey;
  52807. }
  52808. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  52809. const hashData = new Uint8Array(32);
  52810. let i = 0;
  52811. const n = Math.min(32, password.length);
  52812. for (; i < n; ++i) {
  52813. hashData[i] = password[i];
  52814. }
  52815. let j = 0;
  52816. while (i < 32) {
  52817. hashData[i++] = defaultPasswordBytes[j++];
  52818. }
  52819. let hash = calculateMD5(hashData, 0, i);
  52820. const keyLengthInBytes = keyLength >> 3;
  52821. if (revision >= 3) {
  52822. for (j = 0; j < 50; ++j) {
  52823. hash = calculateMD5(hash, 0, hash.length);
  52824. }
  52825. }
  52826. let cipher, userPassword;
  52827. if (revision >= 3) {
  52828. userPassword = ownerPassword;
  52829. const derivedKey = new Uint8Array(keyLengthInBytes);
  52830. for (j = 19; j >= 0; j--) {
  52831. for (let k = 0; k < keyLengthInBytes; ++k) {
  52832. derivedKey[k] = hash[k] ^ j;
  52833. }
  52834. cipher = new ARCFourCipher(derivedKey);
  52835. userPassword = cipher.encryptBlock(userPassword);
  52836. }
  52837. } else {
  52838. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  52839. userPassword = cipher.encryptBlock(ownerPassword);
  52840. }
  52841. return userPassword;
  52842. }
  52843. const identityName = _primitives.Name.get("Identity");
  52844. function buildObjectKey(num, gen, encryptionKey) {
  52845. let isAes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  52846. const key = new Uint8Array(encryptionKey.length + 9);
  52847. const n = encryptionKey.length;
  52848. let i;
  52849. for (i = 0; i < n; ++i) {
  52850. key[i] = encryptionKey[i];
  52851. }
  52852. key[i++] = num & 0xff;
  52853. key[i++] = num >> 8 & 0xff;
  52854. key[i++] = num >> 16 & 0xff;
  52855. key[i++] = gen & 0xff;
  52856. key[i++] = gen >> 8 & 0xff;
  52857. if (isAes) {
  52858. key[i++] = 0x73;
  52859. key[i++] = 0x41;
  52860. key[i++] = 0x6c;
  52861. key[i++] = 0x54;
  52862. }
  52863. const hash = calculateMD5(key, 0, i);
  52864. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  52865. }
  52866. function buildCipherConstructor(cf, name, num, gen, key) {
  52867. if (!(name instanceof _primitives.Name)) {
  52868. throw new _util.FormatError("Invalid crypt filter name.");
  52869. }
  52870. const cryptFilter = cf.get(name.name);
  52871. let cfm;
  52872. if (cryptFilter !== null && cryptFilter !== undefined) {
  52873. cfm = cryptFilter.get("CFM");
  52874. }
  52875. if (!cfm || cfm.name === "None") {
  52876. return function cipherTransformFactoryBuildCipherConstructorNone() {
  52877. return new NullCipher();
  52878. };
  52879. }
  52880. if (cfm.name === "V2") {
  52881. return function cipherTransformFactoryBuildCipherConstructorV2() {
  52882. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  52883. };
  52884. }
  52885. if (cfm.name === "AESV2") {
  52886. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  52887. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  52888. };
  52889. }
  52890. if (cfm.name === "AESV3") {
  52891. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  52892. return new AES256Cipher(key);
  52893. };
  52894. }
  52895. throw new _util.FormatError("Unknown crypto method");
  52896. }
  52897. class CipherTransformFactory {
  52898. constructor(dict, fileId, password) {
  52899. const filter = dict.get("Filter");
  52900. if (!(0, _primitives.isName)(filter, "Standard")) {
  52901. throw new _util.FormatError("unknown encryption method");
  52902. }
  52903. this.filterName = filter.name;
  52904. this.dict = dict;
  52905. const algorithm = dict.get("V");
  52906. if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  52907. throw new _util.FormatError("unsupported encryption algorithm");
  52908. }
  52909. this.algorithm = algorithm;
  52910. let keyLength = dict.get("Length");
  52911. if (!keyLength) {
  52912. if (algorithm <= 3) {
  52913. keyLength = 40;
  52914. } else {
  52915. const cfDict = dict.get("CF");
  52916. const streamCryptoName = dict.get("StmF");
  52917. if (cfDict instanceof _primitives.Dict && streamCryptoName instanceof _primitives.Name) {
  52918. cfDict.suppressEncryption = true;
  52919. const handlerDict = cfDict.get(streamCryptoName.name);
  52920. keyLength = handlerDict && handlerDict.get("Length") || 128;
  52921. if (keyLength < 40) {
  52922. keyLength <<= 3;
  52923. }
  52924. }
  52925. }
  52926. }
  52927. if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  52928. throw new _util.FormatError("invalid key length");
  52929. }
  52930. const ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32);
  52931. const userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32);
  52932. const flags = dict.get("P");
  52933. const revision = dict.get("R");
  52934. const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
  52935. this.encryptMetadata = encryptMetadata;
  52936. const fileIdBytes = (0, _util.stringToBytes)(fileId);
  52937. let passwordBytes;
  52938. if (password) {
  52939. if (revision === 6) {
  52940. try {
  52941. password = (0, _util.utf8StringToString)(password);
  52942. } catch (ex) {
  52943. (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password.");
  52944. }
  52945. }
  52946. passwordBytes = (0, _util.stringToBytes)(password);
  52947. }
  52948. let encryptionKey;
  52949. if (algorithm !== 5) {
  52950. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  52951. } else {
  52952. const ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40);
  52953. const ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48);
  52954. const uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48);
  52955. const userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40);
  52956. const userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48);
  52957. const ownerEncryption = (0, _util.stringToBytes)(dict.get("OE"));
  52958. const userEncryption = (0, _util.stringToBytes)(dict.get("UE"));
  52959. const perms = (0, _util.stringToBytes)(dict.get("Perms"));
  52960. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  52961. }
  52962. if (!encryptionKey && !password) {
  52963. throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD);
  52964. } else if (!encryptionKey && password) {
  52965. const decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  52966. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  52967. }
  52968. if (!encryptionKey) {
  52969. throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD);
  52970. }
  52971. this.encryptionKey = encryptionKey;
  52972. if (algorithm >= 4) {
  52973. const cf = dict.get("CF");
  52974. if (cf instanceof _primitives.Dict) {
  52975. cf.suppressEncryption = true;
  52976. }
  52977. this.cf = cf;
  52978. this.stmf = dict.get("StmF") || identityName;
  52979. this.strf = dict.get("StrF") || identityName;
  52980. this.eff = dict.get("EFF") || this.stmf;
  52981. }
  52982. }
  52983. createCipherTransform(num, gen) {
  52984. if (this.algorithm === 4 || this.algorithm === 5) {
  52985. return new CipherTransform(buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey));
  52986. }
  52987. const key = buildObjectKey(num, gen, this.encryptionKey, false);
  52988. const cipherConstructor = function buildCipherCipherConstructor() {
  52989. return new ARCFourCipher(key);
  52990. };
  52991. return new CipherTransform(cipherConstructor, cipherConstructor);
  52992. }
  52993. }
  52994. return CipherTransformFactory;
  52995. }();
  52996. exports.CipherTransformFactory = CipherTransformFactory;
  52997. /***/ }),
  52998. /* 199 */
  52999. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  53000. "use strict";
  53001. Object.defineProperty(exports, "__esModule", ({
  53002. value: true
  53003. }));
  53004. exports.DecryptStream = void 0;
  53005. var _decode_stream = __w_pdfjs_require__(150);
  53006. const chunkSize = 512;
  53007. class DecryptStream extends _decode_stream.DecodeStream {
  53008. constructor(str, maybeLength, decrypt) {
  53009. super(maybeLength);
  53010. this.str = str;
  53011. this.dict = str.dict;
  53012. this.decrypt = decrypt;
  53013. this.nextChunk = null;
  53014. this.initialized = false;
  53015. }
  53016. readBlock() {
  53017. let chunk;
  53018. if (this.initialized) {
  53019. chunk = this.nextChunk;
  53020. } else {
  53021. chunk = this.str.getBytes(chunkSize);
  53022. this.initialized = true;
  53023. }
  53024. if (!chunk || chunk.length === 0) {
  53025. this.eof = true;
  53026. return;
  53027. }
  53028. this.nextChunk = this.str.getBytes(chunkSize);
  53029. const hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  53030. const decrypt = this.decrypt;
  53031. chunk = decrypt(chunk, !hasMoreData);
  53032. const bufferLength = this.bufferLength,
  53033. newLength = bufferLength + chunk.length,
  53034. buffer = this.ensureBuffer(newLength);
  53035. buffer.set(chunk, bufferLength);
  53036. this.bufferLength = newLength;
  53037. }
  53038. }
  53039. exports.DecryptStream = DecryptStream;
  53040. /***/ }),
  53041. /* 200 */
  53042. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  53043. "use strict";
  53044. Object.defineProperty(exports, "__esModule", ({
  53045. value: true
  53046. }));
  53047. exports.Catalog = void 0;
  53048. var _core_utils = __w_pdfjs_require__(136);
  53049. var _util = __w_pdfjs_require__(2);
  53050. var _primitives = __w_pdfjs_require__(137);
  53051. var _name_number_tree = __w_pdfjs_require__(201);
  53052. var _base_stream = __w_pdfjs_require__(138);
  53053. var _cleanup_helper = __w_pdfjs_require__(202);
  53054. var _colorspace = __w_pdfjs_require__(145);
  53055. var _file_spec = __w_pdfjs_require__(203);
  53056. var _image_utils = __w_pdfjs_require__(190);
  53057. var _metadata_parser = __w_pdfjs_require__(204);
  53058. var _struct_tree = __w_pdfjs_require__(205);
  53059. function fetchDestination(dest) {
  53060. if (dest instanceof _primitives.Dict) {
  53061. dest = dest.get("D");
  53062. }
  53063. return Array.isArray(dest) ? dest : null;
  53064. }
  53065. class Catalog {
  53066. constructor(pdfManager, xref) {
  53067. this.pdfManager = pdfManager;
  53068. this.xref = xref;
  53069. this._catDict = xref.getCatalogObj();
  53070. if (!(this._catDict instanceof _primitives.Dict)) {
  53071. throw new _util.FormatError("Catalog object is not a dictionary.");
  53072. }
  53073. this.toplevelPagesDict;
  53074. this._actualNumPages = null;
  53075. this.fontCache = new _primitives.RefSetCache();
  53076. this.builtInCMapCache = new Map();
  53077. this.standardFontDataCache = new Map();
  53078. this.globalImageCache = new _image_utils.GlobalImageCache();
  53079. this.pageKidsCountCache = new _primitives.RefSetCache();
  53080. this.pageIndexCache = new _primitives.RefSetCache();
  53081. this.nonBlendModesSet = new _primitives.RefSet();
  53082. }
  53083. get version() {
  53084. const version = this._catDict.get("Version");
  53085. if (version instanceof _primitives.Name) {
  53086. if (_core_utils.PDF_VERSION_REGEXP.test(version.name)) {
  53087. return (0, _util.shadow)(this, "version", version.name);
  53088. }
  53089. (0, _util.warn)(`Invalid PDF catalog version: ${version.name}`);
  53090. }
  53091. return (0, _util.shadow)(this, "version", null);
  53092. }
  53093. get lang() {
  53094. const lang = this._catDict.get("Lang");
  53095. return (0, _util.shadow)(this, "lang", typeof lang === "string" ? (0, _util.stringToPDFString)(lang) : null);
  53096. }
  53097. get needsRendering() {
  53098. const needsRendering = this._catDict.get("NeedsRendering");
  53099. return (0, _util.shadow)(this, "needsRendering", typeof needsRendering === "boolean" ? needsRendering : false);
  53100. }
  53101. get collection() {
  53102. let collection = null;
  53103. try {
  53104. const obj = this._catDict.get("Collection");
  53105. if (obj instanceof _primitives.Dict && obj.size > 0) {
  53106. collection = obj;
  53107. }
  53108. } catch (ex) {
  53109. if (ex instanceof _core_utils.MissingDataException) {
  53110. throw ex;
  53111. }
  53112. (0, _util.info)("Cannot fetch Collection entry; assuming no collection is present.");
  53113. }
  53114. return (0, _util.shadow)(this, "collection", collection);
  53115. }
  53116. get acroForm() {
  53117. let acroForm = null;
  53118. try {
  53119. const obj = this._catDict.get("AcroForm");
  53120. if (obj instanceof _primitives.Dict && obj.size > 0) {
  53121. acroForm = obj;
  53122. }
  53123. } catch (ex) {
  53124. if (ex instanceof _core_utils.MissingDataException) {
  53125. throw ex;
  53126. }
  53127. (0, _util.info)("Cannot fetch AcroForm entry; assuming no forms are present.");
  53128. }
  53129. return (0, _util.shadow)(this, "acroForm", acroForm);
  53130. }
  53131. get acroFormRef() {
  53132. const value = this._catDict.getRaw("AcroForm");
  53133. return (0, _util.shadow)(this, "acroFormRef", value instanceof _primitives.Ref ? value : null);
  53134. }
  53135. get metadata() {
  53136. const streamRef = this._catDict.getRaw("Metadata");
  53137. if (!(streamRef instanceof _primitives.Ref)) {
  53138. return (0, _util.shadow)(this, "metadata", null);
  53139. }
  53140. let metadata = null;
  53141. try {
  53142. const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
  53143. const stream = this.xref.fetch(streamRef, suppressEncryption);
  53144. if (stream instanceof _base_stream.BaseStream && stream.dict instanceof _primitives.Dict) {
  53145. const type = stream.dict.get("Type");
  53146. const subtype = stream.dict.get("Subtype");
  53147. if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
  53148. const data = (0, _util.stringToUTF8String)(stream.getString());
  53149. if (data) {
  53150. metadata = new _metadata_parser.MetadataParser(data).serializable;
  53151. }
  53152. }
  53153. }
  53154. } catch (ex) {
  53155. if (ex instanceof _core_utils.MissingDataException) {
  53156. throw ex;
  53157. }
  53158. (0, _util.info)(`Skipping invalid Metadata: "${ex}".`);
  53159. }
  53160. return (0, _util.shadow)(this, "metadata", metadata);
  53161. }
  53162. get markInfo() {
  53163. let markInfo = null;
  53164. try {
  53165. markInfo = this._readMarkInfo();
  53166. } catch (ex) {
  53167. if (ex instanceof _core_utils.MissingDataException) {
  53168. throw ex;
  53169. }
  53170. (0, _util.warn)("Unable to read mark info.");
  53171. }
  53172. return (0, _util.shadow)(this, "markInfo", markInfo);
  53173. }
  53174. _readMarkInfo() {
  53175. const obj = this._catDict.get("MarkInfo");
  53176. if (!(obj instanceof _primitives.Dict)) {
  53177. return null;
  53178. }
  53179. const markInfo = {
  53180. Marked: false,
  53181. UserProperties: false,
  53182. Suspects: false
  53183. };
  53184. for (const key in markInfo) {
  53185. const value = obj.get(key);
  53186. if (typeof value === "boolean") {
  53187. markInfo[key] = value;
  53188. }
  53189. }
  53190. return markInfo;
  53191. }
  53192. get structTreeRoot() {
  53193. let structTree = null;
  53194. try {
  53195. structTree = this._readStructTreeRoot();
  53196. } catch (ex) {
  53197. if (ex instanceof _core_utils.MissingDataException) {
  53198. throw ex;
  53199. }
  53200. (0, _util.warn)("Unable read to structTreeRoot info.");
  53201. }
  53202. return (0, _util.shadow)(this, "structTreeRoot", structTree);
  53203. }
  53204. _readStructTreeRoot() {
  53205. const obj = this._catDict.get("StructTreeRoot");
  53206. if (!(obj instanceof _primitives.Dict)) {
  53207. return null;
  53208. }
  53209. const root = new _struct_tree.StructTreeRoot(obj);
  53210. root.init();
  53211. return root;
  53212. }
  53213. get toplevelPagesDict() {
  53214. const pagesObj = this._catDict.get("Pages");
  53215. if (!(pagesObj instanceof _primitives.Dict)) {
  53216. throw new _util.FormatError("Invalid top-level pages dictionary.");
  53217. }
  53218. return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
  53219. }
  53220. get documentOutline() {
  53221. let obj = null;
  53222. try {
  53223. obj = this._readDocumentOutline();
  53224. } catch (ex) {
  53225. if (ex instanceof _core_utils.MissingDataException) {
  53226. throw ex;
  53227. }
  53228. (0, _util.warn)("Unable to read document outline.");
  53229. }
  53230. return (0, _util.shadow)(this, "documentOutline", obj);
  53231. }
  53232. _readDocumentOutline() {
  53233. let obj = this._catDict.get("Outlines");
  53234. if (!(obj instanceof _primitives.Dict)) {
  53235. return null;
  53236. }
  53237. obj = obj.getRaw("First");
  53238. if (!(obj instanceof _primitives.Ref)) {
  53239. return null;
  53240. }
  53241. const root = {
  53242. items: []
  53243. };
  53244. const queue = [{
  53245. obj,
  53246. parent: root
  53247. }];
  53248. const processed = new _primitives.RefSet();
  53249. processed.put(obj);
  53250. const xref = this.xref,
  53251. blackColor = new Uint8ClampedArray(3);
  53252. while (queue.length > 0) {
  53253. const i = queue.shift();
  53254. const outlineDict = xref.fetchIfRef(i.obj);
  53255. if (outlineDict === null) {
  53256. continue;
  53257. }
  53258. if (!outlineDict.has("Title")) {
  53259. throw new _util.FormatError("Invalid outline item encountered.");
  53260. }
  53261. const data = {
  53262. url: null,
  53263. dest: null,
  53264. action: null
  53265. };
  53266. Catalog.parseDestDictionary({
  53267. destDict: outlineDict,
  53268. resultObj: data,
  53269. docBaseUrl: this.pdfManager.docBaseUrl,
  53270. docAttachments: this.attachments
  53271. });
  53272. const title = outlineDict.get("Title");
  53273. const flags = outlineDict.get("F") || 0;
  53274. const color = outlineDict.getArray("C");
  53275. const count = outlineDict.get("Count");
  53276. let rgbColor = blackColor;
  53277. if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  53278. rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
  53279. }
  53280. const outlineItem = {
  53281. action: data.action,
  53282. attachment: data.attachment,
  53283. dest: data.dest,
  53284. url: data.url,
  53285. unsafeUrl: data.unsafeUrl,
  53286. newWindow: data.newWindow,
  53287. setOCGState: data.setOCGState,
  53288. title: (0, _util.stringToPDFString)(title),
  53289. color: rgbColor,
  53290. count: Number.isInteger(count) ? count : undefined,
  53291. bold: !!(flags & 2),
  53292. italic: !!(flags & 1),
  53293. items: []
  53294. };
  53295. i.parent.items.push(outlineItem);
  53296. obj = outlineDict.getRaw("First");
  53297. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  53298. queue.push({
  53299. obj,
  53300. parent: outlineItem
  53301. });
  53302. processed.put(obj);
  53303. }
  53304. obj = outlineDict.getRaw("Next");
  53305. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  53306. queue.push({
  53307. obj,
  53308. parent: i.parent
  53309. });
  53310. processed.put(obj);
  53311. }
  53312. }
  53313. return root.items.length > 0 ? root.items : null;
  53314. }
  53315. get permissions() {
  53316. let permissions = null;
  53317. try {
  53318. permissions = this._readPermissions();
  53319. } catch (ex) {
  53320. if (ex instanceof _core_utils.MissingDataException) {
  53321. throw ex;
  53322. }
  53323. (0, _util.warn)("Unable to read permissions.");
  53324. }
  53325. return (0, _util.shadow)(this, "permissions", permissions);
  53326. }
  53327. _readPermissions() {
  53328. const encrypt = this.xref.trailer.get("Encrypt");
  53329. if (!(encrypt instanceof _primitives.Dict)) {
  53330. return null;
  53331. }
  53332. let flags = encrypt.get("P");
  53333. if (typeof flags !== "number") {
  53334. return null;
  53335. }
  53336. flags += 2 ** 32;
  53337. const permissions = [];
  53338. for (const key in _util.PermissionFlag) {
  53339. const value = _util.PermissionFlag[key];
  53340. if (flags & value) {
  53341. permissions.push(value);
  53342. }
  53343. }
  53344. return permissions;
  53345. }
  53346. get optionalContentConfig() {
  53347. let config = null;
  53348. try {
  53349. const properties = this._catDict.get("OCProperties");
  53350. if (!properties) {
  53351. return (0, _util.shadow)(this, "optionalContentConfig", null);
  53352. }
  53353. const defaultConfig = properties.get("D");
  53354. if (!defaultConfig) {
  53355. return (0, _util.shadow)(this, "optionalContentConfig", null);
  53356. }
  53357. const groupsData = properties.get("OCGs");
  53358. if (!Array.isArray(groupsData)) {
  53359. return (0, _util.shadow)(this, "optionalContentConfig", null);
  53360. }
  53361. const groups = [];
  53362. const groupRefs = [];
  53363. for (const groupRef of groupsData) {
  53364. if (!(groupRef instanceof _primitives.Ref)) {
  53365. continue;
  53366. }
  53367. groupRefs.push(groupRef);
  53368. const group = this.xref.fetchIfRef(groupRef);
  53369. groups.push({
  53370. id: groupRef.toString(),
  53371. name: typeof group.get("Name") === "string" ? (0, _util.stringToPDFString)(group.get("Name")) : null,
  53372. intent: typeof group.get("Intent") === "string" ? (0, _util.stringToPDFString)(group.get("Intent")) : null
  53373. });
  53374. }
  53375. config = this._readOptionalContentConfig(defaultConfig, groupRefs);
  53376. config.groups = groups;
  53377. } catch (ex) {
  53378. if (ex instanceof _core_utils.MissingDataException) {
  53379. throw ex;
  53380. }
  53381. (0, _util.warn)(`Unable to read optional content config: ${ex}`);
  53382. }
  53383. return (0, _util.shadow)(this, "optionalContentConfig", config);
  53384. }
  53385. _readOptionalContentConfig(config, contentGroupRefs) {
  53386. function parseOnOff(refs) {
  53387. const onParsed = [];
  53388. if (Array.isArray(refs)) {
  53389. for (const value of refs) {
  53390. if (!(value instanceof _primitives.Ref)) {
  53391. continue;
  53392. }
  53393. if (contentGroupRefs.includes(value)) {
  53394. onParsed.push(value.toString());
  53395. }
  53396. }
  53397. }
  53398. return onParsed;
  53399. }
  53400. function parseOrder(refs) {
  53401. let nestedLevels = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  53402. if (!Array.isArray(refs)) {
  53403. return null;
  53404. }
  53405. const order = [];
  53406. for (const value of refs) {
  53407. if (value instanceof _primitives.Ref && contentGroupRefs.includes(value)) {
  53408. parsedOrderRefs.put(value);
  53409. order.push(value.toString());
  53410. continue;
  53411. }
  53412. const nestedOrder = parseNestedOrder(value, nestedLevels);
  53413. if (nestedOrder) {
  53414. order.push(nestedOrder);
  53415. }
  53416. }
  53417. if (nestedLevels > 0) {
  53418. return order;
  53419. }
  53420. const hiddenGroups = [];
  53421. for (const groupRef of contentGroupRefs) {
  53422. if (parsedOrderRefs.has(groupRef)) {
  53423. continue;
  53424. }
  53425. hiddenGroups.push(groupRef.toString());
  53426. }
  53427. if (hiddenGroups.length) {
  53428. order.push({
  53429. name: null,
  53430. order: hiddenGroups
  53431. });
  53432. }
  53433. return order;
  53434. }
  53435. function parseNestedOrder(ref, nestedLevels) {
  53436. if (++nestedLevels > MAX_NESTED_LEVELS) {
  53437. (0, _util.warn)("parseNestedOrder - reached MAX_NESTED_LEVELS.");
  53438. return null;
  53439. }
  53440. const value = xref.fetchIfRef(ref);
  53441. if (!Array.isArray(value)) {
  53442. return null;
  53443. }
  53444. const nestedName = xref.fetchIfRef(value[0]);
  53445. if (typeof nestedName !== "string") {
  53446. return null;
  53447. }
  53448. const nestedOrder = parseOrder(value.slice(1), nestedLevels);
  53449. if (!nestedOrder || !nestedOrder.length) {
  53450. return null;
  53451. }
  53452. return {
  53453. name: (0, _util.stringToPDFString)(nestedName),
  53454. order: nestedOrder
  53455. };
  53456. }
  53457. const xref = this.xref,
  53458. parsedOrderRefs = new _primitives.RefSet(),
  53459. MAX_NESTED_LEVELS = 10;
  53460. return {
  53461. name: typeof config.get("Name") === "string" ? (0, _util.stringToPDFString)(config.get("Name")) : null,
  53462. creator: typeof config.get("Creator") === "string" ? (0, _util.stringToPDFString)(config.get("Creator")) : null,
  53463. baseState: config.get("BaseState") instanceof _primitives.Name ? config.get("BaseState").name : null,
  53464. on: parseOnOff(config.get("ON")),
  53465. off: parseOnOff(config.get("OFF")),
  53466. order: parseOrder(config.get("Order")),
  53467. groups: null
  53468. };
  53469. }
  53470. setActualNumPages() {
  53471. let num = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  53472. this._actualNumPages = num;
  53473. }
  53474. get hasActualNumPages() {
  53475. return this._actualNumPages !== null;
  53476. }
  53477. get _pagesCount() {
  53478. const obj = this.toplevelPagesDict.get("Count");
  53479. if (!Number.isInteger(obj)) {
  53480. throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
  53481. }
  53482. return (0, _util.shadow)(this, "_pagesCount", obj);
  53483. }
  53484. get numPages() {
  53485. return this.hasActualNumPages ? this._actualNumPages : this._pagesCount;
  53486. }
  53487. get destinations() {
  53488. const obj = this._readDests(),
  53489. dests = Object.create(null);
  53490. if (obj instanceof _name_number_tree.NameTree) {
  53491. for (const [key, value] of obj.getAll()) {
  53492. const dest = fetchDestination(value);
  53493. if (dest) {
  53494. dests[(0, _util.stringToPDFString)(key)] = dest;
  53495. }
  53496. }
  53497. } else if (obj instanceof _primitives.Dict) {
  53498. obj.forEach(function (key, value) {
  53499. const dest = fetchDestination(value);
  53500. if (dest) {
  53501. dests[key] = dest;
  53502. }
  53503. });
  53504. }
  53505. return (0, _util.shadow)(this, "destinations", dests);
  53506. }
  53507. getDestination(id) {
  53508. const obj = this._readDests();
  53509. if (obj instanceof _name_number_tree.NameTree) {
  53510. const dest = fetchDestination(obj.get(id));
  53511. if (dest) {
  53512. return dest;
  53513. }
  53514. const allDest = this.destinations[id];
  53515. if (allDest) {
  53516. (0, _util.warn)(`Found "${id}" at an incorrect position in the NameTree.`);
  53517. return allDest;
  53518. }
  53519. } else if (obj instanceof _primitives.Dict) {
  53520. const dest = fetchDestination(obj.get(id));
  53521. if (dest) {
  53522. return dest;
  53523. }
  53524. }
  53525. return null;
  53526. }
  53527. _readDests() {
  53528. const obj = this._catDict.get("Names");
  53529. if (obj && obj.has("Dests")) {
  53530. return new _name_number_tree.NameTree(obj.getRaw("Dests"), this.xref);
  53531. } else if (this._catDict.has("Dests")) {
  53532. return this._catDict.get("Dests");
  53533. }
  53534. return undefined;
  53535. }
  53536. get pageLabels() {
  53537. let obj = null;
  53538. try {
  53539. obj = this._readPageLabels();
  53540. } catch (ex) {
  53541. if (ex instanceof _core_utils.MissingDataException) {
  53542. throw ex;
  53543. }
  53544. (0, _util.warn)("Unable to read page labels.");
  53545. }
  53546. return (0, _util.shadow)(this, "pageLabels", obj);
  53547. }
  53548. _readPageLabels() {
  53549. const obj = this._catDict.getRaw("PageLabels");
  53550. if (!obj) {
  53551. return null;
  53552. }
  53553. const pageLabels = new Array(this.numPages);
  53554. let style = null,
  53555. prefix = "";
  53556. const numberTree = new _name_number_tree.NumberTree(obj, this.xref);
  53557. const nums = numberTree.getAll();
  53558. let currentLabel = "",
  53559. currentIndex = 1;
  53560. for (let i = 0, ii = this.numPages; i < ii; i++) {
  53561. const labelDict = nums.get(i);
  53562. if (labelDict !== undefined) {
  53563. if (!(labelDict instanceof _primitives.Dict)) {
  53564. throw new _util.FormatError("PageLabel is not a dictionary.");
  53565. }
  53566. if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
  53567. throw new _util.FormatError("Invalid type in PageLabel dictionary.");
  53568. }
  53569. if (labelDict.has("S")) {
  53570. const s = labelDict.get("S");
  53571. if (!(s instanceof _primitives.Name)) {
  53572. throw new _util.FormatError("Invalid style in PageLabel dictionary.");
  53573. }
  53574. style = s.name;
  53575. } else {
  53576. style = null;
  53577. }
  53578. if (labelDict.has("P")) {
  53579. const p = labelDict.get("P");
  53580. if (typeof p !== "string") {
  53581. throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
  53582. }
  53583. prefix = (0, _util.stringToPDFString)(p);
  53584. } else {
  53585. prefix = "";
  53586. }
  53587. if (labelDict.has("St")) {
  53588. const st = labelDict.get("St");
  53589. if (!(Number.isInteger(st) && st >= 1)) {
  53590. throw new _util.FormatError("Invalid start in PageLabel dictionary.");
  53591. }
  53592. currentIndex = st;
  53593. } else {
  53594. currentIndex = 1;
  53595. }
  53596. }
  53597. switch (style) {
  53598. case "D":
  53599. currentLabel = currentIndex;
  53600. break;
  53601. case "R":
  53602. case "r":
  53603. currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
  53604. break;
  53605. case "A":
  53606. case "a":
  53607. const LIMIT = 26;
  53608. const A_UPPER_CASE = 0x41,
  53609. A_LOWER_CASE = 0x61;
  53610. const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  53611. const letterIndex = currentIndex - 1;
  53612. const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  53613. currentLabel = character.repeat(Math.floor(letterIndex / LIMIT) + 1);
  53614. break;
  53615. default:
  53616. if (style) {
  53617. throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
  53618. }
  53619. currentLabel = "";
  53620. }
  53621. pageLabels[i] = prefix + currentLabel;
  53622. currentIndex++;
  53623. }
  53624. return pageLabels;
  53625. }
  53626. get pageLayout() {
  53627. const obj = this._catDict.get("PageLayout");
  53628. let pageLayout = "";
  53629. if (obj instanceof _primitives.Name) {
  53630. switch (obj.name) {
  53631. case "SinglePage":
  53632. case "OneColumn":
  53633. case "TwoColumnLeft":
  53634. case "TwoColumnRight":
  53635. case "TwoPageLeft":
  53636. case "TwoPageRight":
  53637. pageLayout = obj.name;
  53638. }
  53639. }
  53640. return (0, _util.shadow)(this, "pageLayout", pageLayout);
  53641. }
  53642. get pageMode() {
  53643. const obj = this._catDict.get("PageMode");
  53644. let pageMode = "UseNone";
  53645. if (obj instanceof _primitives.Name) {
  53646. switch (obj.name) {
  53647. case "UseNone":
  53648. case "UseOutlines":
  53649. case "UseThumbs":
  53650. case "FullScreen":
  53651. case "UseOC":
  53652. case "UseAttachments":
  53653. pageMode = obj.name;
  53654. }
  53655. }
  53656. return (0, _util.shadow)(this, "pageMode", pageMode);
  53657. }
  53658. get viewerPreferences() {
  53659. const obj = this._catDict.get("ViewerPreferences");
  53660. if (!(obj instanceof _primitives.Dict)) {
  53661. return (0, _util.shadow)(this, "viewerPreferences", null);
  53662. }
  53663. let prefs = null;
  53664. for (const key of obj.getKeys()) {
  53665. const value = obj.get(key);
  53666. let prefValue;
  53667. switch (key) {
  53668. case "HideToolbar":
  53669. case "HideMenubar":
  53670. case "HideWindowUI":
  53671. case "FitWindow":
  53672. case "CenterWindow":
  53673. case "DisplayDocTitle":
  53674. case "PickTrayByPDFSize":
  53675. if (typeof value === "boolean") {
  53676. prefValue = value;
  53677. }
  53678. break;
  53679. case "NonFullScreenPageMode":
  53680. if (value instanceof _primitives.Name) {
  53681. switch (value.name) {
  53682. case "UseNone":
  53683. case "UseOutlines":
  53684. case "UseThumbs":
  53685. case "UseOC":
  53686. prefValue = value.name;
  53687. break;
  53688. default:
  53689. prefValue = "UseNone";
  53690. }
  53691. }
  53692. break;
  53693. case "Direction":
  53694. if (value instanceof _primitives.Name) {
  53695. switch (value.name) {
  53696. case "L2R":
  53697. case "R2L":
  53698. prefValue = value.name;
  53699. break;
  53700. default:
  53701. prefValue = "L2R";
  53702. }
  53703. }
  53704. break;
  53705. case "ViewArea":
  53706. case "ViewClip":
  53707. case "PrintArea":
  53708. case "PrintClip":
  53709. if (value instanceof _primitives.Name) {
  53710. switch (value.name) {
  53711. case "MediaBox":
  53712. case "CropBox":
  53713. case "BleedBox":
  53714. case "TrimBox":
  53715. case "ArtBox":
  53716. prefValue = value.name;
  53717. break;
  53718. default:
  53719. prefValue = "CropBox";
  53720. }
  53721. }
  53722. break;
  53723. case "PrintScaling":
  53724. if (value instanceof _primitives.Name) {
  53725. switch (value.name) {
  53726. case "None":
  53727. case "AppDefault":
  53728. prefValue = value.name;
  53729. break;
  53730. default:
  53731. prefValue = "AppDefault";
  53732. }
  53733. }
  53734. break;
  53735. case "Duplex":
  53736. if (value instanceof _primitives.Name) {
  53737. switch (value.name) {
  53738. case "Simplex":
  53739. case "DuplexFlipShortEdge":
  53740. case "DuplexFlipLongEdge":
  53741. prefValue = value.name;
  53742. break;
  53743. default:
  53744. prefValue = "None";
  53745. }
  53746. }
  53747. break;
  53748. case "PrintPageRange":
  53749. if (Array.isArray(value) && value.length % 2 === 0) {
  53750. const isValid = value.every((page, i, arr) => {
  53751. return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;
  53752. });
  53753. if (isValid) {
  53754. prefValue = value;
  53755. }
  53756. }
  53757. break;
  53758. case "NumCopies":
  53759. if (Number.isInteger(value) && value > 0) {
  53760. prefValue = value;
  53761. }
  53762. break;
  53763. default:
  53764. (0, _util.warn)(`Ignoring non-standard key in ViewerPreferences: ${key}.`);
  53765. continue;
  53766. }
  53767. if (prefValue === undefined) {
  53768. (0, _util.warn)(`Bad value, for key "${key}", in ViewerPreferences: ${value}.`);
  53769. continue;
  53770. }
  53771. if (!prefs) {
  53772. prefs = Object.create(null);
  53773. }
  53774. prefs[key] = prefValue;
  53775. }
  53776. return (0, _util.shadow)(this, "viewerPreferences", prefs);
  53777. }
  53778. get openAction() {
  53779. const obj = this._catDict.get("OpenAction");
  53780. const openAction = Object.create(null);
  53781. if (obj instanceof _primitives.Dict) {
  53782. const destDict = new _primitives.Dict(this.xref);
  53783. destDict.set("A", obj);
  53784. const resultObj = {
  53785. url: null,
  53786. dest: null,
  53787. action: null
  53788. };
  53789. Catalog.parseDestDictionary({
  53790. destDict,
  53791. resultObj
  53792. });
  53793. if (Array.isArray(resultObj.dest)) {
  53794. openAction.dest = resultObj.dest;
  53795. } else if (resultObj.action) {
  53796. openAction.action = resultObj.action;
  53797. }
  53798. } else if (Array.isArray(obj)) {
  53799. openAction.dest = obj;
  53800. }
  53801. return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null);
  53802. }
  53803. get attachments() {
  53804. const obj = this._catDict.get("Names");
  53805. let attachments = null;
  53806. if (obj instanceof _primitives.Dict && obj.has("EmbeddedFiles")) {
  53807. const nameTree = new _name_number_tree.NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
  53808. for (const [key, value] of nameTree.getAll()) {
  53809. const fs = new _file_spec.FileSpec(value, this.xref);
  53810. if (!attachments) {
  53811. attachments = Object.create(null);
  53812. }
  53813. attachments[(0, _util.stringToPDFString)(key)] = fs.serializable;
  53814. }
  53815. }
  53816. return (0, _util.shadow)(this, "attachments", attachments);
  53817. }
  53818. get xfaImages() {
  53819. const obj = this._catDict.get("Names");
  53820. let xfaImages = null;
  53821. if (obj instanceof _primitives.Dict && obj.has("XFAImages")) {
  53822. const nameTree = new _name_number_tree.NameTree(obj.getRaw("XFAImages"), this.xref);
  53823. for (const [key, value] of nameTree.getAll()) {
  53824. if (!xfaImages) {
  53825. xfaImages = new _primitives.Dict(this.xref);
  53826. }
  53827. xfaImages.set((0, _util.stringToPDFString)(key), value);
  53828. }
  53829. }
  53830. return (0, _util.shadow)(this, "xfaImages", xfaImages);
  53831. }
  53832. _collectJavaScript() {
  53833. const obj = this._catDict.get("Names");
  53834. let javaScript = null;
  53835. function appendIfJavaScriptDict(name, jsDict) {
  53836. if (!(jsDict instanceof _primitives.Dict)) {
  53837. return;
  53838. }
  53839. if (!(0, _primitives.isName)(jsDict.get("S"), "JavaScript")) {
  53840. return;
  53841. }
  53842. let js = jsDict.get("JS");
  53843. if (js instanceof _base_stream.BaseStream) {
  53844. js = js.getString();
  53845. } else if (typeof js !== "string") {
  53846. return;
  53847. }
  53848. if (javaScript === null) {
  53849. javaScript = new Map();
  53850. }
  53851. js = (0, _util.stringToPDFString)(js).replace(/\u0000/g, "");
  53852. javaScript.set(name, js);
  53853. }
  53854. if (obj instanceof _primitives.Dict && obj.has("JavaScript")) {
  53855. const nameTree = new _name_number_tree.NameTree(obj.getRaw("JavaScript"), this.xref);
  53856. for (const [key, value] of nameTree.getAll()) {
  53857. appendIfJavaScriptDict((0, _util.stringToPDFString)(key), value);
  53858. }
  53859. }
  53860. const openAction = this._catDict.get("OpenAction");
  53861. if (openAction) {
  53862. appendIfJavaScriptDict("OpenAction", openAction);
  53863. }
  53864. return javaScript;
  53865. }
  53866. get javaScript() {
  53867. const javaScript = this._collectJavaScript();
  53868. return (0, _util.shadow)(this, "javaScript", javaScript ? [...javaScript.values()] : null);
  53869. }
  53870. get jsActions() {
  53871. const javaScript = this._collectJavaScript();
  53872. let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType);
  53873. if (javaScript) {
  53874. if (!actions) {
  53875. actions = Object.create(null);
  53876. }
  53877. for (const [key, val] of javaScript) {
  53878. if (key in actions) {
  53879. actions[key].push(val);
  53880. } else {
  53881. actions[key] = [val];
  53882. }
  53883. }
  53884. }
  53885. return (0, _util.shadow)(this, "jsActions", actions);
  53886. }
  53887. async fontFallback(id, handler) {
  53888. const translatedFonts = await Promise.all(this.fontCache);
  53889. for (const translatedFont of translatedFonts) {
  53890. if (translatedFont.loadedName === id) {
  53891. translatedFont.fallback(handler);
  53892. return;
  53893. }
  53894. }
  53895. }
  53896. async cleanup() {
  53897. let manuallyTriggered = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  53898. (0, _cleanup_helper.clearGlobalCaches)();
  53899. this.globalImageCache.clear(manuallyTriggered);
  53900. this.pageKidsCountCache.clear();
  53901. this.pageIndexCache.clear();
  53902. this.nonBlendModesSet.clear();
  53903. const translatedFonts = await Promise.all(this.fontCache);
  53904. for (const {
  53905. dict
  53906. } of translatedFonts) {
  53907. delete dict.cacheKey;
  53908. }
  53909. this.fontCache.clear();
  53910. this.builtInCMapCache.clear();
  53911. this.standardFontDataCache.clear();
  53912. }
  53913. async getPageDict(pageIndex) {
  53914. const nodesToVisit = [this.toplevelPagesDict];
  53915. const visitedNodes = new _primitives.RefSet();
  53916. const pagesRef = this._catDict.getRaw("Pages");
  53917. if (pagesRef instanceof _primitives.Ref) {
  53918. visitedNodes.put(pagesRef);
  53919. }
  53920. const xref = this.xref,
  53921. pageKidsCountCache = this.pageKidsCountCache,
  53922. pageIndexCache = this.pageIndexCache;
  53923. let currentPageIndex = 0;
  53924. while (nodesToVisit.length) {
  53925. const currentNode = nodesToVisit.pop();
  53926. if (currentNode instanceof _primitives.Ref) {
  53927. const count = pageKidsCountCache.get(currentNode);
  53928. if (count >= 0 && currentPageIndex + count <= pageIndex) {
  53929. currentPageIndex += count;
  53930. continue;
  53931. }
  53932. if (visitedNodes.has(currentNode)) {
  53933. throw new _util.FormatError("Pages tree contains circular reference.");
  53934. }
  53935. visitedNodes.put(currentNode);
  53936. const obj = await xref.fetchAsync(currentNode);
  53937. if (obj instanceof _primitives.Dict) {
  53938. let type = obj.getRaw("Type");
  53939. if (type instanceof _primitives.Ref) {
  53940. type = await xref.fetchAsync(type);
  53941. }
  53942. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  53943. if (!pageKidsCountCache.has(currentNode)) {
  53944. pageKidsCountCache.put(currentNode, 1);
  53945. }
  53946. if (!pageIndexCache.has(currentNode)) {
  53947. pageIndexCache.put(currentNode, currentPageIndex);
  53948. }
  53949. if (currentPageIndex === pageIndex) {
  53950. return [obj, currentNode];
  53951. }
  53952. currentPageIndex++;
  53953. continue;
  53954. }
  53955. }
  53956. nodesToVisit.push(obj);
  53957. continue;
  53958. }
  53959. if (!(currentNode instanceof _primitives.Dict)) {
  53960. throw new _util.FormatError("Page dictionary kid reference points to wrong type of object.");
  53961. }
  53962. const {
  53963. objId
  53964. } = currentNode;
  53965. let count = currentNode.getRaw("Count");
  53966. if (count instanceof _primitives.Ref) {
  53967. count = await xref.fetchAsync(count);
  53968. }
  53969. if (Number.isInteger(count) && count >= 0) {
  53970. if (objId && !pageKidsCountCache.has(objId)) {
  53971. pageKidsCountCache.put(objId, count);
  53972. }
  53973. if (currentPageIndex + count <= pageIndex) {
  53974. currentPageIndex += count;
  53975. continue;
  53976. }
  53977. }
  53978. let kids = currentNode.getRaw("Kids");
  53979. if (kids instanceof _primitives.Ref) {
  53980. kids = await xref.fetchAsync(kids);
  53981. }
  53982. if (!Array.isArray(kids)) {
  53983. let type = currentNode.getRaw("Type");
  53984. if (type instanceof _primitives.Ref) {
  53985. type = await xref.fetchAsync(type);
  53986. }
  53987. if ((0, _primitives.isName)(type, "Page") || !currentNode.has("Kids")) {
  53988. if (currentPageIndex === pageIndex) {
  53989. return [currentNode, null];
  53990. }
  53991. currentPageIndex++;
  53992. continue;
  53993. }
  53994. throw new _util.FormatError("Page dictionary kids object is not an array.");
  53995. }
  53996. for (let last = kids.length - 1; last >= 0; last--) {
  53997. nodesToVisit.push(kids[last]);
  53998. }
  53999. }
  54000. throw new Error(`Page index ${pageIndex} not found.`);
  54001. }
  54002. async getAllPageDicts() {
  54003. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  54004. const {
  54005. ignoreErrors
  54006. } = this.pdfManager.evaluatorOptions;
  54007. const queue = [{
  54008. currentNode: this.toplevelPagesDict,
  54009. posInKids: 0
  54010. }];
  54011. const visitedNodes = new _primitives.RefSet();
  54012. const pagesRef = this._catDict.getRaw("Pages");
  54013. if (pagesRef instanceof _primitives.Ref) {
  54014. visitedNodes.put(pagesRef);
  54015. }
  54016. const map = new Map(),
  54017. xref = this.xref,
  54018. pageIndexCache = this.pageIndexCache;
  54019. let pageIndex = 0;
  54020. function addPageDict(pageDict, pageRef) {
  54021. if (pageRef && !pageIndexCache.has(pageRef)) {
  54022. pageIndexCache.put(pageRef, pageIndex);
  54023. }
  54024. map.set(pageIndex++, [pageDict, pageRef]);
  54025. }
  54026. function addPageError(error) {
  54027. if (error instanceof _core_utils.XRefEntryException && !recoveryMode) {
  54028. throw error;
  54029. }
  54030. if (recoveryMode && ignoreErrors && pageIndex === 0) {
  54031. (0, _util.warn)(`getAllPageDicts - Skipping invalid first page: "${error}".`);
  54032. error = _primitives.Dict.empty;
  54033. }
  54034. map.set(pageIndex++, [error, null]);
  54035. }
  54036. while (queue.length > 0) {
  54037. const queueItem = queue.at(-1);
  54038. const {
  54039. currentNode,
  54040. posInKids
  54041. } = queueItem;
  54042. let kids = currentNode.getRaw("Kids");
  54043. if (kids instanceof _primitives.Ref) {
  54044. try {
  54045. kids = await xref.fetchAsync(kids);
  54046. } catch (ex) {
  54047. addPageError(ex);
  54048. break;
  54049. }
  54050. }
  54051. if (!Array.isArray(kids)) {
  54052. addPageError(new _util.FormatError("Page dictionary kids object is not an array."));
  54053. break;
  54054. }
  54055. if (posInKids >= kids.length) {
  54056. queue.pop();
  54057. continue;
  54058. }
  54059. const kidObj = kids[posInKids];
  54060. let obj;
  54061. if (kidObj instanceof _primitives.Ref) {
  54062. if (visitedNodes.has(kidObj)) {
  54063. addPageError(new _util.FormatError("Pages tree contains circular reference."));
  54064. break;
  54065. }
  54066. visitedNodes.put(kidObj);
  54067. try {
  54068. obj = await xref.fetchAsync(kidObj);
  54069. } catch (ex) {
  54070. addPageError(ex);
  54071. break;
  54072. }
  54073. } else {
  54074. obj = kidObj;
  54075. }
  54076. if (!(obj instanceof _primitives.Dict)) {
  54077. addPageError(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
  54078. break;
  54079. }
  54080. let type = obj.getRaw("Type");
  54081. if (type instanceof _primitives.Ref) {
  54082. try {
  54083. type = await xref.fetchAsync(type);
  54084. } catch (ex) {
  54085. addPageError(ex);
  54086. break;
  54087. }
  54088. }
  54089. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  54090. addPageDict(obj, kidObj instanceof _primitives.Ref ? kidObj : null);
  54091. } else {
  54092. queue.push({
  54093. currentNode: obj,
  54094. posInKids: 0
  54095. });
  54096. }
  54097. queueItem.posInKids++;
  54098. }
  54099. return map;
  54100. }
  54101. getPageIndex(pageRef) {
  54102. const cachedPageIndex = this.pageIndexCache.get(pageRef);
  54103. if (cachedPageIndex !== undefined) {
  54104. return Promise.resolve(cachedPageIndex);
  54105. }
  54106. const xref = this.xref;
  54107. function pagesBeforeRef(kidRef) {
  54108. let total = 0,
  54109. parentRef;
  54110. return xref.fetchAsync(kidRef).then(function (node) {
  54111. if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !(node instanceof _primitives.Dict && !node.has("Type") && node.has("Contents"))) {
  54112. throw new _util.FormatError("The reference does not point to a /Page dictionary.");
  54113. }
  54114. if (!node) {
  54115. return null;
  54116. }
  54117. if (!(node instanceof _primitives.Dict)) {
  54118. throw new _util.FormatError("Node must be a dictionary.");
  54119. }
  54120. parentRef = node.getRaw("Parent");
  54121. return node.getAsync("Parent");
  54122. }).then(function (parent) {
  54123. if (!parent) {
  54124. return null;
  54125. }
  54126. if (!(parent instanceof _primitives.Dict)) {
  54127. throw new _util.FormatError("Parent must be a dictionary.");
  54128. }
  54129. return parent.getAsync("Kids");
  54130. }).then(function (kids) {
  54131. if (!kids) {
  54132. return null;
  54133. }
  54134. const kidPromises = [];
  54135. let found = false;
  54136. for (const kid of kids) {
  54137. if (!(kid instanceof _primitives.Ref)) {
  54138. throw new _util.FormatError("Kid must be a reference.");
  54139. }
  54140. if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
  54141. found = true;
  54142. break;
  54143. }
  54144. kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
  54145. if (!(obj instanceof _primitives.Dict)) {
  54146. throw new _util.FormatError("Kid node must be a dictionary.");
  54147. }
  54148. if (obj.has("Count")) {
  54149. total += obj.get("Count");
  54150. } else {
  54151. total++;
  54152. }
  54153. }));
  54154. }
  54155. if (!found) {
  54156. throw new _util.FormatError("Kid reference not found in parent's kids.");
  54157. }
  54158. return Promise.all(kidPromises).then(function () {
  54159. return [total, parentRef];
  54160. });
  54161. });
  54162. }
  54163. let total = 0;
  54164. const next = ref => pagesBeforeRef(ref).then(args => {
  54165. if (!args) {
  54166. this.pageIndexCache.put(pageRef, total);
  54167. return total;
  54168. }
  54169. const [count, parentRef] = args;
  54170. total += count;
  54171. return next(parentRef);
  54172. });
  54173. return next(pageRef);
  54174. }
  54175. get baseUrl() {
  54176. const uri = this._catDict.get("URI");
  54177. if (uri instanceof _primitives.Dict) {
  54178. const base = uri.get("Base");
  54179. if (typeof base === "string") {
  54180. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(base, null, {
  54181. tryConvertEncoding: true
  54182. });
  54183. if (absoluteUrl) {
  54184. return (0, _util.shadow)(this, "baseUrl", absoluteUrl.href);
  54185. }
  54186. }
  54187. }
  54188. return (0, _util.shadow)(this, "baseUrl", null);
  54189. }
  54190. static parseDestDictionary(params) {
  54191. const destDict = params.destDict;
  54192. if (!(destDict instanceof _primitives.Dict)) {
  54193. (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
  54194. return;
  54195. }
  54196. const resultObj = params.resultObj;
  54197. if (typeof resultObj !== "object") {
  54198. (0, _util.warn)("parseDestDictionary: `resultObj` must be an object.");
  54199. return;
  54200. }
  54201. const docBaseUrl = params.docBaseUrl || null;
  54202. const docAttachments = params.docAttachments || null;
  54203. let action = destDict.get("A"),
  54204. url,
  54205. dest;
  54206. if (!(action instanceof _primitives.Dict)) {
  54207. if (destDict.has("Dest")) {
  54208. action = destDict.get("Dest");
  54209. } else {
  54210. action = destDict.get("AA");
  54211. if (action instanceof _primitives.Dict) {
  54212. if (action.has("D")) {
  54213. action = action.get("D");
  54214. } else if (action.has("U")) {
  54215. action = action.get("U");
  54216. }
  54217. }
  54218. }
  54219. }
  54220. if (action instanceof _primitives.Dict) {
  54221. const actionType = action.get("S");
  54222. if (!(actionType instanceof _primitives.Name)) {
  54223. (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
  54224. return;
  54225. }
  54226. const actionName = actionType.name;
  54227. switch (actionName) {
  54228. case "ResetForm":
  54229. const flags = action.get("Flags");
  54230. const include = ((typeof flags === "number" ? flags : 0) & 1) === 0;
  54231. const fields = [];
  54232. const refs = [];
  54233. for (const obj of action.get("Fields") || []) {
  54234. if (obj instanceof _primitives.Ref) {
  54235. refs.push(obj.toString());
  54236. } else if (typeof obj === "string") {
  54237. fields.push((0, _util.stringToPDFString)(obj));
  54238. }
  54239. }
  54240. resultObj.resetForm = {
  54241. fields,
  54242. refs,
  54243. include
  54244. };
  54245. break;
  54246. case "URI":
  54247. url = action.get("URI");
  54248. if (url instanceof _primitives.Name) {
  54249. url = "/" + url.name;
  54250. }
  54251. break;
  54252. case "GoTo":
  54253. dest = action.get("D");
  54254. break;
  54255. case "Launch":
  54256. case "GoToR":
  54257. const urlDict = action.get("F");
  54258. if (urlDict instanceof _primitives.Dict) {
  54259. url = urlDict.get("F") || null;
  54260. } else if (typeof urlDict === "string") {
  54261. url = urlDict;
  54262. }
  54263. let remoteDest = action.get("D");
  54264. if (remoteDest) {
  54265. if (remoteDest instanceof _primitives.Name) {
  54266. remoteDest = remoteDest.name;
  54267. }
  54268. if (typeof url === "string") {
  54269. const baseUrl = url.split("#")[0];
  54270. if (typeof remoteDest === "string") {
  54271. url = baseUrl + "#" + remoteDest;
  54272. } else if (Array.isArray(remoteDest)) {
  54273. url = baseUrl + "#" + JSON.stringify(remoteDest);
  54274. }
  54275. }
  54276. }
  54277. const newWindow = action.get("NewWindow");
  54278. if (typeof newWindow === "boolean") {
  54279. resultObj.newWindow = newWindow;
  54280. }
  54281. break;
  54282. case "GoToE":
  54283. const target = action.get("T");
  54284. let attachment;
  54285. if (docAttachments && target instanceof _primitives.Dict) {
  54286. const relationship = target.get("R");
  54287. const name = target.get("N");
  54288. if ((0, _primitives.isName)(relationship, "C") && typeof name === "string") {
  54289. attachment = docAttachments[(0, _util.stringToPDFString)(name)];
  54290. }
  54291. }
  54292. if (attachment) {
  54293. resultObj.attachment = attachment;
  54294. } else {
  54295. (0, _util.warn)(`parseDestDictionary - unimplemented "GoToE" action.`);
  54296. }
  54297. break;
  54298. case "Named":
  54299. const namedAction = action.get("N");
  54300. if (namedAction instanceof _primitives.Name) {
  54301. resultObj.action = namedAction.name;
  54302. }
  54303. break;
  54304. case "SetOCGState":
  54305. const state = action.get("State");
  54306. const preserveRB = action.get("PreserveRB");
  54307. if (!Array.isArray(state) || state.length === 0) {
  54308. break;
  54309. }
  54310. const stateArr = [];
  54311. for (const elem of state) {
  54312. if (elem instanceof _primitives.Name) {
  54313. switch (elem.name) {
  54314. case "ON":
  54315. case "OFF":
  54316. case "Toggle":
  54317. stateArr.push(elem.name);
  54318. break;
  54319. }
  54320. } else if (elem instanceof _primitives.Ref) {
  54321. stateArr.push(elem.toString());
  54322. }
  54323. }
  54324. if (stateArr.length !== state.length) {
  54325. break;
  54326. }
  54327. resultObj.setOCGState = {
  54328. state: stateArr,
  54329. preserveRB: typeof preserveRB === "boolean" ? preserveRB : true
  54330. };
  54331. break;
  54332. case "JavaScript":
  54333. const jsAction = action.get("JS");
  54334. let js;
  54335. if (jsAction instanceof _base_stream.BaseStream) {
  54336. js = jsAction.getString();
  54337. } else if (typeof jsAction === "string") {
  54338. js = jsAction;
  54339. }
  54340. const jsURL = js && (0, _core_utils.recoverJsURL)((0, _util.stringToPDFString)(js));
  54341. if (jsURL) {
  54342. url = jsURL.url;
  54343. resultObj.newWindow = jsURL.newWindow;
  54344. break;
  54345. }
  54346. default:
  54347. if (actionName === "JavaScript" || actionName === "SubmitForm") {
  54348. break;
  54349. }
  54350. (0, _util.warn)(`parseDestDictionary - unsupported action: "${actionName}".`);
  54351. break;
  54352. }
  54353. } else if (destDict.has("Dest")) {
  54354. dest = destDict.get("Dest");
  54355. }
  54356. if (typeof url === "string") {
  54357. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl, {
  54358. addDefaultProtocol: true,
  54359. tryConvertEncoding: true
  54360. });
  54361. if (absoluteUrl) {
  54362. resultObj.url = absoluteUrl.href;
  54363. }
  54364. resultObj.unsafeUrl = url;
  54365. }
  54366. if (dest) {
  54367. if (dest instanceof _primitives.Name) {
  54368. dest = dest.name;
  54369. }
  54370. if (typeof dest === "string") {
  54371. resultObj.dest = (0, _util.stringToPDFString)(dest);
  54372. } else if (Array.isArray(dest)) {
  54373. resultObj.dest = dest;
  54374. }
  54375. }
  54376. }
  54377. }
  54378. exports.Catalog = Catalog;
  54379. /***/ }),
  54380. /* 201 */
  54381. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54382. "use strict";
  54383. Object.defineProperty(exports, "__esModule", ({
  54384. value: true
  54385. }));
  54386. exports.NumberTree = exports.NameTree = void 0;
  54387. var _primitives = __w_pdfjs_require__(137);
  54388. var _util = __w_pdfjs_require__(2);
  54389. class NameOrNumberTree {
  54390. constructor(root, xref, type) {
  54391. if (this.constructor === NameOrNumberTree) {
  54392. (0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
  54393. }
  54394. this.root = root;
  54395. this.xref = xref;
  54396. this._type = type;
  54397. }
  54398. getAll() {
  54399. const map = new Map();
  54400. if (!this.root) {
  54401. return map;
  54402. }
  54403. const xref = this.xref;
  54404. const processed = new _primitives.RefSet();
  54405. processed.put(this.root);
  54406. const queue = [this.root];
  54407. while (queue.length > 0) {
  54408. const obj = xref.fetchIfRef(queue.shift());
  54409. if (!(obj instanceof _primitives.Dict)) {
  54410. continue;
  54411. }
  54412. if (obj.has("Kids")) {
  54413. const kids = obj.get("Kids");
  54414. if (!Array.isArray(kids)) {
  54415. continue;
  54416. }
  54417. for (const kid of kids) {
  54418. if (processed.has(kid)) {
  54419. throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`);
  54420. }
  54421. queue.push(kid);
  54422. processed.put(kid);
  54423. }
  54424. continue;
  54425. }
  54426. const entries = obj.get(this._type);
  54427. if (!Array.isArray(entries)) {
  54428. continue;
  54429. }
  54430. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  54431. map.set(xref.fetchIfRef(entries[i]), xref.fetchIfRef(entries[i + 1]));
  54432. }
  54433. }
  54434. return map;
  54435. }
  54436. get(key) {
  54437. if (!this.root) {
  54438. return null;
  54439. }
  54440. const xref = this.xref;
  54441. let kidsOrEntries = xref.fetchIfRef(this.root);
  54442. let loopCount = 0;
  54443. const MAX_LEVELS = 10;
  54444. while (kidsOrEntries.has("Kids")) {
  54445. if (++loopCount > MAX_LEVELS) {
  54446. (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`);
  54447. return null;
  54448. }
  54449. const kids = kidsOrEntries.get("Kids");
  54450. if (!Array.isArray(kids)) {
  54451. return null;
  54452. }
  54453. let l = 0,
  54454. r = kids.length - 1;
  54455. while (l <= r) {
  54456. const m = l + r >> 1;
  54457. const kid = xref.fetchIfRef(kids[m]);
  54458. const limits = kid.get("Limits");
  54459. if (key < xref.fetchIfRef(limits[0])) {
  54460. r = m - 1;
  54461. } else if (key > xref.fetchIfRef(limits[1])) {
  54462. l = m + 1;
  54463. } else {
  54464. kidsOrEntries = kid;
  54465. break;
  54466. }
  54467. }
  54468. if (l > r) {
  54469. return null;
  54470. }
  54471. }
  54472. const entries = kidsOrEntries.get(this._type);
  54473. if (Array.isArray(entries)) {
  54474. let l = 0,
  54475. r = entries.length - 2;
  54476. while (l <= r) {
  54477. const tmp = l + r >> 1,
  54478. m = tmp + (tmp & 1);
  54479. const currentKey = xref.fetchIfRef(entries[m]);
  54480. if (key < currentKey) {
  54481. r = m - 2;
  54482. } else if (key > currentKey) {
  54483. l = m + 2;
  54484. } else {
  54485. return xref.fetchIfRef(entries[m + 1]);
  54486. }
  54487. }
  54488. }
  54489. return null;
  54490. }
  54491. }
  54492. class NameTree extends NameOrNumberTree {
  54493. constructor(root, xref) {
  54494. super(root, xref, "Names");
  54495. }
  54496. }
  54497. exports.NameTree = NameTree;
  54498. class NumberTree extends NameOrNumberTree {
  54499. constructor(root, xref) {
  54500. super(root, xref, "Nums");
  54501. }
  54502. }
  54503. exports.NumberTree = NumberTree;
  54504. /***/ }),
  54505. /* 202 */
  54506. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54507. "use strict";
  54508. Object.defineProperty(exports, "__esModule", ({
  54509. value: true
  54510. }));
  54511. exports.clearGlobalCaches = clearGlobalCaches;
  54512. var _primitives = __w_pdfjs_require__(137);
  54513. var _unicode = __w_pdfjs_require__(171);
  54514. function clearGlobalCaches() {
  54515. (0, _primitives.clearPrimitiveCaches)();
  54516. (0, _unicode.clearUnicodeCaches)();
  54517. }
  54518. /***/ }),
  54519. /* 203 */
  54520. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54521. "use strict";
  54522. Object.defineProperty(exports, "__esModule", ({
  54523. value: true
  54524. }));
  54525. exports.FileSpec = void 0;
  54526. var _util = __w_pdfjs_require__(2);
  54527. var _base_stream = __w_pdfjs_require__(138);
  54528. var _primitives = __w_pdfjs_require__(137);
  54529. function pickPlatformItem(dict) {
  54530. if (dict.has("UF")) {
  54531. return dict.get("UF");
  54532. } else if (dict.has("F")) {
  54533. return dict.get("F");
  54534. } else if (dict.has("Unix")) {
  54535. return dict.get("Unix");
  54536. } else if (dict.has("Mac")) {
  54537. return dict.get("Mac");
  54538. } else if (dict.has("DOS")) {
  54539. return dict.get("DOS");
  54540. }
  54541. return null;
  54542. }
  54543. class FileSpec {
  54544. constructor(root, xref) {
  54545. if (!(root instanceof _primitives.Dict)) {
  54546. return;
  54547. }
  54548. this.xref = xref;
  54549. this.root = root;
  54550. if (root.has("FS")) {
  54551. this.fs = root.get("FS");
  54552. }
  54553. this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : "";
  54554. if (root.has("RF")) {
  54555. (0, _util.warn)("Related file specifications are not supported");
  54556. }
  54557. this.contentAvailable = true;
  54558. if (!root.has("EF")) {
  54559. this.contentAvailable = false;
  54560. (0, _util.warn)("Non-embedded file specifications are not supported");
  54561. }
  54562. }
  54563. get filename() {
  54564. if (!this._filename && this.root) {
  54565. const filename = pickPlatformItem(this.root) || "unnamed";
  54566. this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/");
  54567. }
  54568. return this._filename;
  54569. }
  54570. get content() {
  54571. if (!this.contentAvailable) {
  54572. return null;
  54573. }
  54574. if (!this.contentRef && this.root) {
  54575. this.contentRef = pickPlatformItem(this.root.get("EF"));
  54576. }
  54577. let content = null;
  54578. if (this.contentRef) {
  54579. const fileObj = this.xref.fetchIfRef(this.contentRef);
  54580. if (fileObj instanceof _base_stream.BaseStream) {
  54581. content = fileObj.getBytes();
  54582. } else {
  54583. (0, _util.warn)("Embedded file specification points to non-existing/invalid content");
  54584. }
  54585. } else {
  54586. (0, _util.warn)("Embedded file specification does not have a content");
  54587. }
  54588. return content;
  54589. }
  54590. get serializable() {
  54591. return {
  54592. filename: this.filename,
  54593. content: this.content
  54594. };
  54595. }
  54596. }
  54597. exports.FileSpec = FileSpec;
  54598. /***/ }),
  54599. /* 204 */
  54600. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54601. "use strict";
  54602. Object.defineProperty(exports, "__esModule", ({
  54603. value: true
  54604. }));
  54605. exports.MetadataParser = void 0;
  54606. var _xml_parser = __w_pdfjs_require__(197);
  54607. class MetadataParser {
  54608. constructor(data) {
  54609. data = this._repair(data);
  54610. const parser = new _xml_parser.SimpleXMLParser({
  54611. lowerCaseName: true
  54612. });
  54613. const xmlDocument = parser.parseFromString(data);
  54614. this._metadataMap = new Map();
  54615. this._data = data;
  54616. if (xmlDocument) {
  54617. this._parse(xmlDocument);
  54618. }
  54619. }
  54620. _repair(data) {
  54621. return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) {
  54622. const bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
  54623. return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
  54624. }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
  54625. switch (name) {
  54626. case "amp":
  54627. return "&";
  54628. case "apos":
  54629. return "'";
  54630. case "gt":
  54631. return ">";
  54632. case "lt":
  54633. return "<";
  54634. case "quot":
  54635. return '"';
  54636. }
  54637. throw new Error(`_repair: ${name} isn't defined.`);
  54638. });
  54639. const charBuf = [">"];
  54640. for (let i = 0, ii = bytes.length; i < ii; i += 2) {
  54641. const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
  54642. if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
  54643. charBuf.push(String.fromCharCode(code));
  54644. } else {
  54645. charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";");
  54646. }
  54647. }
  54648. return charBuf.join("");
  54649. });
  54650. }
  54651. _getSequence(entry) {
  54652. const name = entry.nodeName;
  54653. if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") {
  54654. return null;
  54655. }
  54656. return entry.childNodes.filter(node => node.nodeName === "rdf:li");
  54657. }
  54658. _parseArray(entry) {
  54659. if (!entry.hasChildNodes()) {
  54660. return;
  54661. }
  54662. const [seqNode] = entry.childNodes;
  54663. const sequence = this._getSequence(seqNode) || [];
  54664. this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim()));
  54665. }
  54666. _parse(xmlDocument) {
  54667. let rdf = xmlDocument.documentElement;
  54668. if (rdf.nodeName !== "rdf:rdf") {
  54669. rdf = rdf.firstChild;
  54670. while (rdf && rdf.nodeName !== "rdf:rdf") {
  54671. rdf = rdf.nextSibling;
  54672. }
  54673. }
  54674. if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
  54675. return;
  54676. }
  54677. for (const desc of rdf.childNodes) {
  54678. if (desc.nodeName !== "rdf:description") {
  54679. continue;
  54680. }
  54681. for (const entry of desc.childNodes) {
  54682. const name = entry.nodeName;
  54683. switch (name) {
  54684. case "#text":
  54685. continue;
  54686. case "dc:creator":
  54687. case "dc:subject":
  54688. this._parseArray(entry);
  54689. continue;
  54690. }
  54691. this._metadataMap.set(name, entry.textContent.trim());
  54692. }
  54693. }
  54694. }
  54695. get serializable() {
  54696. return {
  54697. parsedData: this._metadataMap,
  54698. rawData: this._data
  54699. };
  54700. }
  54701. }
  54702. exports.MetadataParser = MetadataParser;
  54703. /***/ }),
  54704. /* 205 */
  54705. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54706. "use strict";
  54707. Object.defineProperty(exports, "__esModule", ({
  54708. value: true
  54709. }));
  54710. exports.StructTreeRoot = exports.StructTreePage = void 0;
  54711. var _primitives = __w_pdfjs_require__(137);
  54712. var _util = __w_pdfjs_require__(2);
  54713. var _name_number_tree = __w_pdfjs_require__(201);
  54714. const MAX_DEPTH = 40;
  54715. const StructElementType = {
  54716. PAGE_CONTENT: "PAGE_CONTENT",
  54717. STREAM_CONTENT: "STREAM_CONTENT",
  54718. OBJECT: "OBJECT",
  54719. ELEMENT: "ELEMENT"
  54720. };
  54721. class StructTreeRoot {
  54722. constructor(rootDict) {
  54723. this.dict = rootDict;
  54724. this.roleMap = new Map();
  54725. }
  54726. init() {
  54727. this.readRoleMap();
  54728. }
  54729. readRoleMap() {
  54730. const roleMapDict = this.dict.get("RoleMap");
  54731. if (!(roleMapDict instanceof _primitives.Dict)) {
  54732. return;
  54733. }
  54734. roleMapDict.forEach((key, value) => {
  54735. if (!(value instanceof _primitives.Name)) {
  54736. return;
  54737. }
  54738. this.roleMap.set(key, value.name);
  54739. });
  54740. }
  54741. }
  54742. exports.StructTreeRoot = StructTreeRoot;
  54743. class StructElementNode {
  54744. constructor(tree, dict) {
  54745. this.tree = tree;
  54746. this.dict = dict;
  54747. this.kids = [];
  54748. this.parseKids();
  54749. }
  54750. get role() {
  54751. const nameObj = this.dict.get("S");
  54752. const name = nameObj instanceof _primitives.Name ? nameObj.name : "";
  54753. const {
  54754. root
  54755. } = this.tree;
  54756. if (root.roleMap.has(name)) {
  54757. return root.roleMap.get(name);
  54758. }
  54759. return name;
  54760. }
  54761. parseKids() {
  54762. let pageObjId = null;
  54763. const objRef = this.dict.getRaw("Pg");
  54764. if (objRef instanceof _primitives.Ref) {
  54765. pageObjId = objRef.toString();
  54766. }
  54767. const kids = this.dict.get("K");
  54768. if (Array.isArray(kids)) {
  54769. for (const kid of kids) {
  54770. const element = this.parseKid(pageObjId, kid);
  54771. if (element) {
  54772. this.kids.push(element);
  54773. }
  54774. }
  54775. } else {
  54776. const element = this.parseKid(pageObjId, kids);
  54777. if (element) {
  54778. this.kids.push(element);
  54779. }
  54780. }
  54781. }
  54782. parseKid(pageObjId, kid) {
  54783. if (Number.isInteger(kid)) {
  54784. if (this.tree.pageDict.objId !== pageObjId) {
  54785. return null;
  54786. }
  54787. return new StructElement({
  54788. type: StructElementType.PAGE_CONTENT,
  54789. mcid: kid,
  54790. pageObjId
  54791. });
  54792. }
  54793. let kidDict = null;
  54794. if (kid instanceof _primitives.Ref) {
  54795. kidDict = this.dict.xref.fetch(kid);
  54796. } else if (kid instanceof _primitives.Dict) {
  54797. kidDict = kid;
  54798. }
  54799. if (!kidDict) {
  54800. return null;
  54801. }
  54802. const pageRef = kidDict.getRaw("Pg");
  54803. if (pageRef instanceof _primitives.Ref) {
  54804. pageObjId = pageRef.toString();
  54805. }
  54806. const type = kidDict.get("Type") instanceof _primitives.Name ? kidDict.get("Type").name : null;
  54807. if (type === "MCR") {
  54808. if (this.tree.pageDict.objId !== pageObjId) {
  54809. return null;
  54810. }
  54811. return new StructElement({
  54812. type: StructElementType.STREAM_CONTENT,
  54813. refObjId: kidDict.getRaw("Stm") instanceof _primitives.Ref ? kidDict.getRaw("Stm").toString() : null,
  54814. pageObjId,
  54815. mcid: kidDict.get("MCID")
  54816. });
  54817. }
  54818. if (type === "OBJR") {
  54819. if (this.tree.pageDict.objId !== pageObjId) {
  54820. return null;
  54821. }
  54822. return new StructElement({
  54823. type: StructElementType.OBJECT,
  54824. refObjId: kidDict.getRaw("Obj") instanceof _primitives.Ref ? kidDict.getRaw("Obj").toString() : null,
  54825. pageObjId
  54826. });
  54827. }
  54828. return new StructElement({
  54829. type: StructElementType.ELEMENT,
  54830. dict: kidDict
  54831. });
  54832. }
  54833. }
  54834. class StructElement {
  54835. constructor(_ref) {
  54836. let {
  54837. type,
  54838. dict = null,
  54839. mcid = null,
  54840. pageObjId = null,
  54841. refObjId = null
  54842. } = _ref;
  54843. this.type = type;
  54844. this.dict = dict;
  54845. this.mcid = mcid;
  54846. this.pageObjId = pageObjId;
  54847. this.refObjId = refObjId;
  54848. this.parentNode = null;
  54849. }
  54850. }
  54851. class StructTreePage {
  54852. constructor(structTreeRoot, pageDict) {
  54853. this.root = structTreeRoot;
  54854. this.rootDict = structTreeRoot ? structTreeRoot.dict : null;
  54855. this.pageDict = pageDict;
  54856. this.nodes = [];
  54857. }
  54858. parse() {
  54859. if (!this.root || !this.rootDict) {
  54860. return;
  54861. }
  54862. const parentTree = this.rootDict.get("ParentTree");
  54863. if (!parentTree) {
  54864. return;
  54865. }
  54866. const id = this.pageDict.get("StructParents");
  54867. if (!Number.isInteger(id)) {
  54868. return;
  54869. }
  54870. const numberTree = new _name_number_tree.NumberTree(parentTree, this.rootDict.xref);
  54871. const parentArray = numberTree.get(id);
  54872. if (!Array.isArray(parentArray)) {
  54873. return;
  54874. }
  54875. const map = new Map();
  54876. for (const ref of parentArray) {
  54877. if (ref instanceof _primitives.Ref) {
  54878. this.addNode(this.rootDict.xref.fetch(ref), map);
  54879. }
  54880. }
  54881. }
  54882. addNode(dict, map) {
  54883. let level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  54884. if (level > MAX_DEPTH) {
  54885. (0, _util.warn)("StructTree MAX_DEPTH reached.");
  54886. return null;
  54887. }
  54888. if (map.has(dict)) {
  54889. return map.get(dict);
  54890. }
  54891. const element = new StructElementNode(this, dict);
  54892. map.set(dict, element);
  54893. const parent = dict.get("P");
  54894. if (!parent || (0, _primitives.isName)(parent.get("Type"), "StructTreeRoot")) {
  54895. if (!this.addTopLevelNode(dict, element)) {
  54896. map.delete(dict);
  54897. }
  54898. return element;
  54899. }
  54900. const parentNode = this.addNode(parent, map, level + 1);
  54901. if (!parentNode) {
  54902. return element;
  54903. }
  54904. let save = false;
  54905. for (const kid of parentNode.kids) {
  54906. if (kid.type === StructElementType.ELEMENT && kid.dict === dict) {
  54907. kid.parentNode = element;
  54908. save = true;
  54909. }
  54910. }
  54911. if (!save) {
  54912. map.delete(dict);
  54913. }
  54914. return element;
  54915. }
  54916. addTopLevelNode(dict, element) {
  54917. const obj = this.rootDict.get("K");
  54918. if (!obj) {
  54919. return false;
  54920. }
  54921. if (obj instanceof _primitives.Dict) {
  54922. if (obj.objId !== dict.objId) {
  54923. return false;
  54924. }
  54925. this.nodes[0] = element;
  54926. return true;
  54927. }
  54928. if (!Array.isArray(obj)) {
  54929. return true;
  54930. }
  54931. let save = false;
  54932. for (let i = 0; i < obj.length; i++) {
  54933. const kidRef = obj[i];
  54934. if (kidRef && kidRef.toString() === dict.objId) {
  54935. this.nodes[i] = element;
  54936. save = true;
  54937. }
  54938. }
  54939. return save;
  54940. }
  54941. get serializable() {
  54942. function nodeToSerializable(node, parent) {
  54943. let level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  54944. if (level > MAX_DEPTH) {
  54945. (0, _util.warn)("StructTree too deep to be fully serialized.");
  54946. return;
  54947. }
  54948. const obj = Object.create(null);
  54949. obj.role = node.role;
  54950. obj.children = [];
  54951. parent.children.push(obj);
  54952. const alt = node.dict.get("Alt");
  54953. if (typeof alt === "string") {
  54954. obj.alt = (0, _util.stringToPDFString)(alt);
  54955. }
  54956. const lang = node.dict.get("Lang");
  54957. if (typeof lang === "string") {
  54958. obj.lang = (0, _util.stringToPDFString)(lang);
  54959. }
  54960. for (const kid of node.kids) {
  54961. const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null;
  54962. if (kidElement) {
  54963. nodeToSerializable(kidElement, obj, level + 1);
  54964. continue;
  54965. } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) {
  54966. obj.children.push({
  54967. type: "content",
  54968. id: `page${kid.pageObjId}_mcid${kid.mcid}`
  54969. });
  54970. } else if (kid.type === StructElementType.OBJECT) {
  54971. obj.children.push({
  54972. type: "object",
  54973. id: kid.refObjId
  54974. });
  54975. }
  54976. }
  54977. }
  54978. const root = Object.create(null);
  54979. root.children = [];
  54980. root.role = "Root";
  54981. for (const child of this.nodes) {
  54982. if (!child) {
  54983. continue;
  54984. }
  54985. nodeToSerializable(child, root);
  54986. }
  54987. return root;
  54988. }
  54989. }
  54990. exports.StructTreePage = StructTreePage;
  54991. /***/ }),
  54992. /* 206 */
  54993. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54994. "use strict";
  54995. Object.defineProperty(exports, "__esModule", ({
  54996. value: true
  54997. }));
  54998. exports.ObjectLoader = void 0;
  54999. var _primitives = __w_pdfjs_require__(137);
  55000. var _base_stream = __w_pdfjs_require__(138);
  55001. var _core_utils = __w_pdfjs_require__(136);
  55002. var _util = __w_pdfjs_require__(2);
  55003. function mayHaveChildren(value) {
  55004. return value instanceof _primitives.Ref || value instanceof _primitives.Dict || value instanceof _base_stream.BaseStream || Array.isArray(value);
  55005. }
  55006. function addChildren(node, nodesToVisit) {
  55007. if (node instanceof _primitives.Dict) {
  55008. node = node.getRawValues();
  55009. } else if (node instanceof _base_stream.BaseStream) {
  55010. node = node.dict.getRawValues();
  55011. } else if (!Array.isArray(node)) {
  55012. return;
  55013. }
  55014. for (const rawValue of node) {
  55015. if (mayHaveChildren(rawValue)) {
  55016. nodesToVisit.push(rawValue);
  55017. }
  55018. }
  55019. }
  55020. class ObjectLoader {
  55021. constructor(dict, keys, xref) {
  55022. this.dict = dict;
  55023. this.keys = keys;
  55024. this.xref = xref;
  55025. this.refSet = null;
  55026. }
  55027. async load() {
  55028. if (this.xref.stream.isDataLoaded) {
  55029. return undefined;
  55030. }
  55031. const {
  55032. keys,
  55033. dict
  55034. } = this;
  55035. this.refSet = new _primitives.RefSet();
  55036. const nodesToVisit = [];
  55037. for (const key of keys) {
  55038. const rawValue = dict.getRaw(key);
  55039. if (rawValue !== undefined) {
  55040. nodesToVisit.push(rawValue);
  55041. }
  55042. }
  55043. return this._walk(nodesToVisit);
  55044. }
  55045. async _walk(nodesToVisit) {
  55046. const nodesToRevisit = [];
  55047. const pendingRequests = [];
  55048. while (nodesToVisit.length) {
  55049. let currentNode = nodesToVisit.pop();
  55050. if (currentNode instanceof _primitives.Ref) {
  55051. if (this.refSet.has(currentNode)) {
  55052. continue;
  55053. }
  55054. try {
  55055. this.refSet.put(currentNode);
  55056. currentNode = this.xref.fetch(currentNode);
  55057. } catch (ex) {
  55058. if (!(ex instanceof _core_utils.MissingDataException)) {
  55059. (0, _util.warn)(`ObjectLoader._walk - requesting all data: "${ex}".`);
  55060. this.refSet = null;
  55061. const {
  55062. manager
  55063. } = this.xref.stream;
  55064. return manager.requestAllChunks();
  55065. }
  55066. nodesToRevisit.push(currentNode);
  55067. pendingRequests.push({
  55068. begin: ex.begin,
  55069. end: ex.end
  55070. });
  55071. }
  55072. }
  55073. if (currentNode instanceof _base_stream.BaseStream) {
  55074. const baseStreams = currentNode.getBaseStreams();
  55075. if (baseStreams) {
  55076. let foundMissingData = false;
  55077. for (const stream of baseStreams) {
  55078. if (stream.isDataLoaded) {
  55079. continue;
  55080. }
  55081. foundMissingData = true;
  55082. pendingRequests.push({
  55083. begin: stream.start,
  55084. end: stream.end
  55085. });
  55086. }
  55087. if (foundMissingData) {
  55088. nodesToRevisit.push(currentNode);
  55089. }
  55090. }
  55091. }
  55092. addChildren(currentNode, nodesToVisit);
  55093. }
  55094. if (pendingRequests.length) {
  55095. await this.xref.stream.manager.requestRanges(pendingRequests);
  55096. for (const node of nodesToRevisit) {
  55097. if (node instanceof _primitives.Ref) {
  55098. this.refSet.remove(node);
  55099. }
  55100. }
  55101. return this._walk(nodesToRevisit);
  55102. }
  55103. this.refSet = null;
  55104. return undefined;
  55105. }
  55106. }
  55107. exports.ObjectLoader = ObjectLoader;
  55108. /***/ }),
  55109. /* 207 */
  55110. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  55111. "use strict";
  55112. Object.defineProperty(exports, "__esModule", ({
  55113. value: true
  55114. }));
  55115. exports.XFAFactory = void 0;
  55116. var _xfa_object = __w_pdfjs_require__(208);
  55117. var _bind = __w_pdfjs_require__(212);
  55118. var _data = __w_pdfjs_require__(218);
  55119. var _fonts = __w_pdfjs_require__(216);
  55120. var _utils = __w_pdfjs_require__(209);
  55121. var _util = __w_pdfjs_require__(2);
  55122. var _parser = __w_pdfjs_require__(219);
  55123. var _xhtml = __w_pdfjs_require__(229);
  55124. class XFAFactory {
  55125. constructor(data) {
  55126. try {
  55127. this.root = new _parser.XFAParser().parse(XFAFactory._createDocument(data));
  55128. const binder = new _bind.Binder(this.root);
  55129. this.form = binder.bind();
  55130. this.dataHandler = new _data.DataHandler(this.root, binder.getData());
  55131. this.form[_xfa_object.$globalData].template = this.form;
  55132. } catch (e) {
  55133. (0, _util.warn)(`XFA - an error occurred during parsing and binding: ${e}`);
  55134. }
  55135. }
  55136. isValid() {
  55137. return this.root && this.form;
  55138. }
  55139. _createPagesHelper() {
  55140. const iterator = this.form[_xfa_object.$toPages]();
  55141. return new Promise((resolve, reject) => {
  55142. const nextIteration = () => {
  55143. try {
  55144. const value = iterator.next();
  55145. if (value.done) {
  55146. resolve(value.value);
  55147. } else {
  55148. setTimeout(nextIteration, 0);
  55149. }
  55150. } catch (e) {
  55151. reject(e);
  55152. }
  55153. };
  55154. setTimeout(nextIteration, 0);
  55155. });
  55156. }
  55157. async _createPages() {
  55158. try {
  55159. this.pages = await this._createPagesHelper();
  55160. this.dims = this.pages.children.map(c => {
  55161. const {
  55162. width,
  55163. height
  55164. } = c.attributes.style;
  55165. return [0, 0, parseInt(width), parseInt(height)];
  55166. });
  55167. } catch (e) {
  55168. (0, _util.warn)(`XFA - an error occurred during layout: ${e}`);
  55169. }
  55170. }
  55171. getBoundingBox(pageIndex) {
  55172. return this.dims[pageIndex];
  55173. }
  55174. async getNumPages() {
  55175. if (!this.pages) {
  55176. await this._createPages();
  55177. }
  55178. return this.dims.length;
  55179. }
  55180. setImages(images) {
  55181. this.form[_xfa_object.$globalData].images = images;
  55182. }
  55183. setFonts(fonts) {
  55184. this.form[_xfa_object.$globalData].fontFinder = new _fonts.FontFinder(fonts);
  55185. const missingFonts = [];
  55186. for (let typeface of this.form[_xfa_object.$globalData].usedTypefaces) {
  55187. typeface = (0, _utils.stripQuotes)(typeface);
  55188. const font = this.form[_xfa_object.$globalData].fontFinder.find(typeface);
  55189. if (!font) {
  55190. missingFonts.push(typeface);
  55191. }
  55192. }
  55193. if (missingFonts.length > 0) {
  55194. return missingFonts;
  55195. }
  55196. return null;
  55197. }
  55198. appendFonts(fonts, reallyMissingFonts) {
  55199. this.form[_xfa_object.$globalData].fontFinder.add(fonts, reallyMissingFonts);
  55200. }
  55201. async getPages() {
  55202. if (!this.pages) {
  55203. await this._createPages();
  55204. }
  55205. const pages = this.pages;
  55206. this.pages = null;
  55207. return pages;
  55208. }
  55209. serializeData(storage) {
  55210. return this.dataHandler.serialize(storage);
  55211. }
  55212. static _createDocument(data) {
  55213. if (!data["/xdp:xdp"]) {
  55214. return data["xdp:xdp"];
  55215. }
  55216. return Object.values(data).join("");
  55217. }
  55218. static getRichTextAsHtml(rc) {
  55219. if (!rc || typeof rc !== "string") {
  55220. return null;
  55221. }
  55222. try {
  55223. let root = new _parser.XFAParser(_xhtml.XhtmlNamespace, true).parse(rc);
  55224. if (!["body", "xhtml"].includes(root[_xfa_object.$nodeName])) {
  55225. const newRoot = _xhtml.XhtmlNamespace.body({});
  55226. newRoot[_xfa_object.$appendChild](root);
  55227. root = newRoot;
  55228. }
  55229. const result = root[_xfa_object.$toHTML]();
  55230. if (!result.success) {
  55231. return null;
  55232. }
  55233. const {
  55234. html
  55235. } = result;
  55236. const {
  55237. attributes
  55238. } = html;
  55239. if (attributes) {
  55240. if (attributes.class) {
  55241. attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa"));
  55242. }
  55243. attributes.dir = "auto";
  55244. }
  55245. return {
  55246. html,
  55247. str: root[_xfa_object.$text]()
  55248. };
  55249. } catch (e) {
  55250. (0, _util.warn)(`XFA - an error occurred during parsing of rich text: ${e}`);
  55251. }
  55252. return null;
  55253. }
  55254. }
  55255. exports.XFAFactory = XFAFactory;
  55256. /***/ }),
  55257. /* 208 */
  55258. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  55259. "use strict";
  55260. Object.defineProperty(exports, "__esModule", ({
  55261. value: true
  55262. }));
  55263. 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;
  55264. var _utils = __w_pdfjs_require__(209);
  55265. var _util = __w_pdfjs_require__(2);
  55266. var _core_utils = __w_pdfjs_require__(136);
  55267. var _namespaces = __w_pdfjs_require__(210);
  55268. var _som = __w_pdfjs_require__(211);
  55269. const $acceptWhitespace = Symbol();
  55270. exports.$acceptWhitespace = $acceptWhitespace;
  55271. const $addHTML = Symbol();
  55272. exports.$addHTML = $addHTML;
  55273. const $appendChild = Symbol();
  55274. exports.$appendChild = $appendChild;
  55275. const $childrenToHTML = Symbol();
  55276. exports.$childrenToHTML = $childrenToHTML;
  55277. const $clean = Symbol();
  55278. exports.$clean = $clean;
  55279. const $cleanPage = Symbol();
  55280. exports.$cleanPage = $cleanPage;
  55281. const $cleanup = Symbol();
  55282. exports.$cleanup = $cleanup;
  55283. const $clone = Symbol();
  55284. exports.$clone = $clone;
  55285. const $consumed = Symbol();
  55286. exports.$consumed = $consumed;
  55287. const $content = Symbol("content");
  55288. exports.$content = $content;
  55289. const $data = Symbol("data");
  55290. exports.$data = $data;
  55291. const $dump = Symbol();
  55292. exports.$dump = $dump;
  55293. const $extra = Symbol("extra");
  55294. exports.$extra = $extra;
  55295. const $finalize = Symbol();
  55296. exports.$finalize = $finalize;
  55297. const $flushHTML = Symbol();
  55298. exports.$flushHTML = $flushHTML;
  55299. const $getAttributeIt = Symbol();
  55300. exports.$getAttributeIt = $getAttributeIt;
  55301. const $getAttributes = Symbol();
  55302. exports.$getAttributes = $getAttributes;
  55303. const $getAvailableSpace = Symbol();
  55304. exports.$getAvailableSpace = $getAvailableSpace;
  55305. const $getChildrenByClass = Symbol();
  55306. exports.$getChildrenByClass = $getChildrenByClass;
  55307. const $getChildrenByName = Symbol();
  55308. exports.$getChildrenByName = $getChildrenByName;
  55309. const $getChildrenByNameIt = Symbol();
  55310. exports.$getChildrenByNameIt = $getChildrenByNameIt;
  55311. const $getDataValue = Symbol();
  55312. exports.$getDataValue = $getDataValue;
  55313. const $getExtra = Symbol();
  55314. exports.$getExtra = $getExtra;
  55315. const $getRealChildrenByNameIt = Symbol();
  55316. exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt;
  55317. const $getChildren = Symbol();
  55318. exports.$getChildren = $getChildren;
  55319. const $getContainedChildren = Symbol();
  55320. exports.$getContainedChildren = $getContainedChildren;
  55321. const $getNextPage = Symbol();
  55322. exports.$getNextPage = $getNextPage;
  55323. const $getSubformParent = Symbol();
  55324. exports.$getSubformParent = $getSubformParent;
  55325. const $getParent = Symbol();
  55326. exports.$getParent = $getParent;
  55327. const $getTemplateRoot = Symbol();
  55328. exports.$getTemplateRoot = $getTemplateRoot;
  55329. const $globalData = Symbol();
  55330. exports.$globalData = $globalData;
  55331. const $hasSettableValue = Symbol();
  55332. exports.$hasSettableValue = $hasSettableValue;
  55333. const $ids = Symbol();
  55334. exports.$ids = $ids;
  55335. const $indexOf = Symbol();
  55336. exports.$indexOf = $indexOf;
  55337. const $insertAt = Symbol();
  55338. exports.$insertAt = $insertAt;
  55339. const $isCDATAXml = Symbol();
  55340. exports.$isCDATAXml = $isCDATAXml;
  55341. const $isBindable = Symbol();
  55342. exports.$isBindable = $isBindable;
  55343. const $isDataValue = Symbol();
  55344. exports.$isDataValue = $isDataValue;
  55345. const $isDescendent = Symbol();
  55346. exports.$isDescendent = $isDescendent;
  55347. const $isNsAgnostic = Symbol();
  55348. exports.$isNsAgnostic = $isNsAgnostic;
  55349. const $isSplittable = Symbol();
  55350. exports.$isSplittable = $isSplittable;
  55351. const $isThereMoreWidth = Symbol();
  55352. exports.$isThereMoreWidth = $isThereMoreWidth;
  55353. const $isTransparent = Symbol();
  55354. exports.$isTransparent = $isTransparent;
  55355. const $isUsable = Symbol();
  55356. exports.$isUsable = $isUsable;
  55357. const $lastAttribute = Symbol();
  55358. const $namespaceId = Symbol("namespaceId");
  55359. exports.$namespaceId = $namespaceId;
  55360. const $nodeName = Symbol("nodeName");
  55361. exports.$nodeName = $nodeName;
  55362. const $nsAttributes = Symbol();
  55363. exports.$nsAttributes = $nsAttributes;
  55364. const $onChild = Symbol();
  55365. exports.$onChild = $onChild;
  55366. const $onChildCheck = Symbol();
  55367. exports.$onChildCheck = $onChildCheck;
  55368. const $onText = Symbol();
  55369. exports.$onText = $onText;
  55370. const $pushGlyphs = Symbol();
  55371. exports.$pushGlyphs = $pushGlyphs;
  55372. const $popPara = Symbol();
  55373. exports.$popPara = $popPara;
  55374. const $pushPara = Symbol();
  55375. exports.$pushPara = $pushPara;
  55376. const $removeChild = Symbol();
  55377. exports.$removeChild = $removeChild;
  55378. const $root = Symbol("root");
  55379. exports.$root = $root;
  55380. const $resolvePrototypes = Symbol();
  55381. exports.$resolvePrototypes = $resolvePrototypes;
  55382. const $searchNode = Symbol();
  55383. exports.$searchNode = $searchNode;
  55384. const $setId = Symbol();
  55385. exports.$setId = $setId;
  55386. const $setSetAttributes = Symbol();
  55387. exports.$setSetAttributes = $setSetAttributes;
  55388. const $setValue = Symbol();
  55389. exports.$setValue = $setValue;
  55390. const $tabIndex = Symbol();
  55391. exports.$tabIndex = $tabIndex;
  55392. const $text = Symbol();
  55393. exports.$text = $text;
  55394. const $toPages = Symbol();
  55395. exports.$toPages = $toPages;
  55396. const $toHTML = Symbol();
  55397. exports.$toHTML = $toHTML;
  55398. const $toString = Symbol();
  55399. exports.$toString = $toString;
  55400. const $toStyle = Symbol();
  55401. exports.$toStyle = $toStyle;
  55402. const $uid = Symbol("uid");
  55403. exports.$uid = $uid;
  55404. const _applyPrototype = Symbol();
  55405. const _attributes = Symbol();
  55406. const _attributeNames = Symbol();
  55407. const _children = Symbol("_children");
  55408. const _cloneAttribute = Symbol();
  55409. const _dataValue = Symbol();
  55410. const _defaultValue = Symbol();
  55411. const _filteredChildrenGenerator = Symbol();
  55412. const _getPrototype = Symbol();
  55413. const _getUnsetAttributes = Symbol();
  55414. const _hasChildren = Symbol();
  55415. const _max = Symbol();
  55416. const _options = Symbol();
  55417. const _parent = Symbol("parent");
  55418. const _resolvePrototypesHelper = Symbol();
  55419. const _setAttributes = Symbol();
  55420. const _validator = Symbol();
  55421. let uid = 0;
  55422. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  55423. class XFAObject {
  55424. constructor(nsId, name) {
  55425. let hasChildren = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  55426. this[$namespaceId] = nsId;
  55427. this[$nodeName] = name;
  55428. this[_hasChildren] = hasChildren;
  55429. this[_parent] = null;
  55430. this[_children] = [];
  55431. this[$uid] = `${name}${uid++}`;
  55432. this[$globalData] = null;
  55433. }
  55434. [$onChild](child) {
  55435. if (!this[_hasChildren] || !this[$onChildCheck](child)) {
  55436. return false;
  55437. }
  55438. const name = child[$nodeName];
  55439. const node = this[name];
  55440. if (node instanceof XFAObjectArray) {
  55441. if (node.push(child)) {
  55442. this[$appendChild](child);
  55443. return true;
  55444. }
  55445. } else {
  55446. if (node !== null) {
  55447. this[$removeChild](node);
  55448. }
  55449. this[name] = child;
  55450. this[$appendChild](child);
  55451. return true;
  55452. }
  55453. let id = "";
  55454. if (this.id) {
  55455. id = ` (id: ${this.id})`;
  55456. } else if (this.name) {
  55457. id = ` (name: ${this.name} ${this.h.value})`;
  55458. }
  55459. (0, _util.warn)(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`);
  55460. return false;
  55461. }
  55462. [$onChildCheck](child) {
  55463. return this.hasOwnProperty(child[$nodeName]) && child[$namespaceId] === this[$namespaceId];
  55464. }
  55465. [$isNsAgnostic]() {
  55466. return false;
  55467. }
  55468. [$acceptWhitespace]() {
  55469. return false;
  55470. }
  55471. [$isCDATAXml]() {
  55472. return false;
  55473. }
  55474. [$isBindable]() {
  55475. return false;
  55476. }
  55477. [$popPara]() {
  55478. if (this.para) {
  55479. this[$getTemplateRoot]()[$extra].paraStack.pop();
  55480. }
  55481. }
  55482. [$pushPara]() {
  55483. this[$getTemplateRoot]()[$extra].paraStack.push(this.para);
  55484. }
  55485. [$setId](ids) {
  55486. if (this.id && this[$namespaceId] === _namespaces.NamespaceIds.template.id) {
  55487. ids.set(this.id, this);
  55488. }
  55489. }
  55490. [$getTemplateRoot]() {
  55491. return this[$globalData].template;
  55492. }
  55493. [$isSplittable]() {
  55494. return false;
  55495. }
  55496. [$isThereMoreWidth]() {
  55497. return false;
  55498. }
  55499. [$appendChild](child) {
  55500. child[_parent] = this;
  55501. this[_children].push(child);
  55502. if (!child[$globalData] && this[$globalData]) {
  55503. child[$globalData] = this[$globalData];
  55504. }
  55505. }
  55506. [$removeChild](child) {
  55507. const i = this[_children].indexOf(child);
  55508. this[_children].splice(i, 1);
  55509. }
  55510. [$hasSettableValue]() {
  55511. return this.hasOwnProperty("value");
  55512. }
  55513. [$setValue](_) {}
  55514. [$onText](_) {}
  55515. [$finalize]() {}
  55516. [$clean](builder) {
  55517. delete this[_hasChildren];
  55518. if (this[$cleanup]) {
  55519. builder.clean(this[$cleanup]);
  55520. delete this[$cleanup];
  55521. }
  55522. }
  55523. [$indexOf](child) {
  55524. return this[_children].indexOf(child);
  55525. }
  55526. [$insertAt](i, child) {
  55527. child[_parent] = this;
  55528. this[_children].splice(i, 0, child);
  55529. if (!child[$globalData] && this[$globalData]) {
  55530. child[$globalData] = this[$globalData];
  55531. }
  55532. }
  55533. [$isTransparent]() {
  55534. return !this.name;
  55535. }
  55536. [$lastAttribute]() {
  55537. return "";
  55538. }
  55539. [$text]() {
  55540. if (this[_children].length === 0) {
  55541. return this[$content];
  55542. }
  55543. return this[_children].map(c => c[$text]()).join("");
  55544. }
  55545. get [_attributeNames]() {
  55546. const proto = Object.getPrototypeOf(this);
  55547. if (!proto._attributes) {
  55548. const attributes = proto._attributes = new Set();
  55549. for (const name of Object.getOwnPropertyNames(this)) {
  55550. if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) {
  55551. break;
  55552. }
  55553. attributes.add(name);
  55554. }
  55555. }
  55556. return (0, _util.shadow)(this, _attributeNames, proto._attributes);
  55557. }
  55558. [$isDescendent](parent) {
  55559. let node = this;
  55560. while (node) {
  55561. if (node === parent) {
  55562. return true;
  55563. }
  55564. node = node[$getParent]();
  55565. }
  55566. return false;
  55567. }
  55568. [$getParent]() {
  55569. return this[_parent];
  55570. }
  55571. [$getSubformParent]() {
  55572. return this[$getParent]();
  55573. }
  55574. [$getChildren]() {
  55575. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  55576. if (!name) {
  55577. return this[_children];
  55578. }
  55579. return this[name];
  55580. }
  55581. [$dump]() {
  55582. const dumped = Object.create(null);
  55583. if (this[$content]) {
  55584. dumped.$content = this[$content];
  55585. }
  55586. for (const name of Object.getOwnPropertyNames(this)) {
  55587. const value = this[name];
  55588. if (value === null) {
  55589. continue;
  55590. }
  55591. if (value instanceof XFAObject) {
  55592. dumped[name] = value[$dump]();
  55593. } else if (value instanceof XFAObjectArray) {
  55594. if (!value.isEmpty()) {
  55595. dumped[name] = value.dump();
  55596. }
  55597. } else {
  55598. dumped[name] = value;
  55599. }
  55600. }
  55601. return dumped;
  55602. }
  55603. [$toStyle]() {
  55604. return null;
  55605. }
  55606. [$toHTML]() {
  55607. return _utils.HTMLResult.EMPTY;
  55608. }
  55609. *[$getContainedChildren]() {
  55610. for (const node of this[$getChildren]()) {
  55611. yield node;
  55612. }
  55613. }
  55614. *[_filteredChildrenGenerator](filter, include) {
  55615. for (const node of this[$getContainedChildren]()) {
  55616. if (!filter || include === filter.has(node[$nodeName])) {
  55617. const availableSpace = this[$getAvailableSpace]();
  55618. const res = node[$toHTML](availableSpace);
  55619. if (!res.success) {
  55620. this[$extra].failingNode = node;
  55621. }
  55622. yield res;
  55623. }
  55624. }
  55625. }
  55626. [$flushHTML]() {
  55627. return null;
  55628. }
  55629. [$addHTML](html, bbox) {
  55630. this[$extra].children.push(html);
  55631. }
  55632. [$getAvailableSpace]() {}
  55633. [$childrenToHTML](_ref) {
  55634. let {
  55635. filter = null,
  55636. include = true
  55637. } = _ref;
  55638. if (!this[$extra].generator) {
  55639. this[$extra].generator = this[_filteredChildrenGenerator](filter, include);
  55640. } else {
  55641. const availableSpace = this[$getAvailableSpace]();
  55642. const res = this[$extra].failingNode[$toHTML](availableSpace);
  55643. if (!res.success) {
  55644. return res;
  55645. }
  55646. if (res.html) {
  55647. this[$addHTML](res.html, res.bbox);
  55648. }
  55649. delete this[$extra].failingNode;
  55650. }
  55651. while (true) {
  55652. const gen = this[$extra].generator.next();
  55653. if (gen.done) {
  55654. break;
  55655. }
  55656. const res = gen.value;
  55657. if (!res.success) {
  55658. return res;
  55659. }
  55660. if (res.html) {
  55661. this[$addHTML](res.html, res.bbox);
  55662. }
  55663. }
  55664. this[$extra].generator = null;
  55665. return _utils.HTMLResult.EMPTY;
  55666. }
  55667. [$setSetAttributes](attributes) {
  55668. this[_setAttributes] = new Set(Object.keys(attributes));
  55669. }
  55670. [_getUnsetAttributes](protoAttributes) {
  55671. const allAttr = this[_attributeNames];
  55672. const setAttr = this[_setAttributes];
  55673. return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x));
  55674. }
  55675. [$resolvePrototypes](ids) {
  55676. let ancestors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Set();
  55677. for (const child of this[_children]) {
  55678. child[_resolvePrototypesHelper](ids, ancestors);
  55679. }
  55680. }
  55681. [_resolvePrototypesHelper](ids, ancestors) {
  55682. const proto = this[_getPrototype](ids, ancestors);
  55683. if (proto) {
  55684. this[_applyPrototype](proto, ids, ancestors);
  55685. } else {
  55686. this[$resolvePrototypes](ids, ancestors);
  55687. }
  55688. }
  55689. [_getPrototype](ids, ancestors) {
  55690. const {
  55691. use,
  55692. usehref
  55693. } = this;
  55694. if (!use && !usehref) {
  55695. return null;
  55696. }
  55697. let proto = null;
  55698. let somExpression = null;
  55699. let id = null;
  55700. let ref = use;
  55701. if (usehref) {
  55702. ref = usehref;
  55703. if (usehref.startsWith("#som(") && usehref.endsWith(")")) {
  55704. somExpression = usehref.slice("#som(".length, usehref.length - 1);
  55705. } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) {
  55706. somExpression = usehref.slice(".#som(".length, usehref.length - 1);
  55707. } else if (usehref.startsWith("#")) {
  55708. id = usehref.slice(1);
  55709. } else if (usehref.startsWith(".#")) {
  55710. id = usehref.slice(2);
  55711. }
  55712. } else if (use.startsWith("#")) {
  55713. id = use.slice(1);
  55714. } else {
  55715. somExpression = use;
  55716. }
  55717. this.use = this.usehref = "";
  55718. if (id) {
  55719. proto = ids.get(id);
  55720. } else {
  55721. proto = (0, _som.searchNode)(ids.get($root), this, somExpression, true, false);
  55722. if (proto) {
  55723. proto = proto[0];
  55724. }
  55725. }
  55726. if (!proto) {
  55727. (0, _util.warn)(`XFA - Invalid prototype reference: ${ref}.`);
  55728. return null;
  55729. }
  55730. if (proto[$nodeName] !== this[$nodeName]) {
  55731. (0, _util.warn)(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`);
  55732. return null;
  55733. }
  55734. if (ancestors.has(proto)) {
  55735. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  55736. return null;
  55737. }
  55738. ancestors.add(proto);
  55739. const protoProto = proto[_getPrototype](ids, ancestors);
  55740. if (protoProto) {
  55741. proto[_applyPrototype](protoProto, ids, ancestors);
  55742. }
  55743. proto[$resolvePrototypes](ids, ancestors);
  55744. ancestors.delete(proto);
  55745. return proto;
  55746. }
  55747. [_applyPrototype](proto, ids, ancestors) {
  55748. if (ancestors.has(proto)) {
  55749. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  55750. return;
  55751. }
  55752. if (!this[$content] && proto[$content]) {
  55753. this[$content] = proto[$content];
  55754. }
  55755. const newAncestors = new Set(ancestors);
  55756. newAncestors.add(proto);
  55757. for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) {
  55758. this[unsetAttrName] = proto[unsetAttrName];
  55759. if (this[_setAttributes]) {
  55760. this[_setAttributes].add(unsetAttrName);
  55761. }
  55762. }
  55763. for (const name of Object.getOwnPropertyNames(this)) {
  55764. if (this[_attributeNames].has(name)) {
  55765. continue;
  55766. }
  55767. const value = this[name];
  55768. const protoValue = proto[name];
  55769. if (value instanceof XFAObjectArray) {
  55770. for (const child of value[_children]) {
  55771. child[_resolvePrototypesHelper](ids, ancestors);
  55772. }
  55773. for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) {
  55774. const child = proto[_children][i][$clone]();
  55775. if (value.push(child)) {
  55776. child[_parent] = this;
  55777. this[_children].push(child);
  55778. child[_resolvePrototypesHelper](ids, ancestors);
  55779. } else {
  55780. break;
  55781. }
  55782. }
  55783. continue;
  55784. }
  55785. if (value !== null) {
  55786. value[$resolvePrototypes](ids, ancestors);
  55787. if (protoValue) {
  55788. value[_applyPrototype](protoValue, ids, ancestors);
  55789. }
  55790. continue;
  55791. }
  55792. if (protoValue !== null) {
  55793. const child = protoValue[$clone]();
  55794. child[_parent] = this;
  55795. this[name] = child;
  55796. this[_children].push(child);
  55797. child[_resolvePrototypesHelper](ids, ancestors);
  55798. }
  55799. }
  55800. }
  55801. static [_cloneAttribute](obj) {
  55802. if (Array.isArray(obj)) {
  55803. return obj.map(x => XFAObject[_cloneAttribute](x));
  55804. }
  55805. if (typeof obj === "object" && obj !== null) {
  55806. return Object.assign({}, obj);
  55807. }
  55808. return obj;
  55809. }
  55810. [$clone]() {
  55811. const clone = Object.create(Object.getPrototypeOf(this));
  55812. for (const $symbol of Object.getOwnPropertySymbols(this)) {
  55813. try {
  55814. clone[$symbol] = this[$symbol];
  55815. } catch (_) {
  55816. (0, _util.shadow)(clone, $symbol, this[$symbol]);
  55817. }
  55818. }
  55819. clone[$uid] = `${clone[$nodeName]}${uid++}`;
  55820. clone[_children] = [];
  55821. for (const name of Object.getOwnPropertyNames(this)) {
  55822. if (this[_attributeNames].has(name)) {
  55823. clone[name] = XFAObject[_cloneAttribute](this[name]);
  55824. continue;
  55825. }
  55826. const value = this[name];
  55827. if (value instanceof XFAObjectArray) {
  55828. clone[name] = new XFAObjectArray(value[_max]);
  55829. } else {
  55830. clone[name] = null;
  55831. }
  55832. }
  55833. for (const child of this[_children]) {
  55834. const name = child[$nodeName];
  55835. const clonedChild = child[$clone]();
  55836. clone[_children].push(clonedChild);
  55837. clonedChild[_parent] = clone;
  55838. if (clone[name] === null) {
  55839. clone[name] = clonedChild;
  55840. } else {
  55841. clone[name][_children].push(clonedChild);
  55842. }
  55843. }
  55844. return clone;
  55845. }
  55846. [$getChildren]() {
  55847. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  55848. if (!name) {
  55849. return this[_children];
  55850. }
  55851. return this[_children].filter(c => c[$nodeName] === name);
  55852. }
  55853. [$getChildrenByClass](name) {
  55854. return this[name];
  55855. }
  55856. [$getChildrenByName](name, allTransparent) {
  55857. let first = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  55858. return Array.from(this[$getChildrenByNameIt](name, allTransparent, first));
  55859. }
  55860. [$getChildrenByNameIt](name, allTransparent) {
  55861. var _this = this;
  55862. let first = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  55863. return function* () {
  55864. if (name === "parent") {
  55865. yield _this[_parent];
  55866. return;
  55867. }
  55868. for (const child of _this[_children]) {
  55869. if (child[$nodeName] === name) {
  55870. yield child;
  55871. }
  55872. if (child.name === name) {
  55873. yield child;
  55874. }
  55875. if (allTransparent || child[$isTransparent]()) {
  55876. yield* child[$getChildrenByNameIt](name, allTransparent, false);
  55877. }
  55878. }
  55879. if (first && _this[_attributeNames].has(name)) {
  55880. yield new XFAAttribute(_this, name, _this[name]);
  55881. }
  55882. }();
  55883. }
  55884. }
  55885. exports.XFAObject = XFAObject;
  55886. class XFAObjectArray {
  55887. constructor() {
  55888. let max = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Infinity;
  55889. this[_max] = max;
  55890. this[_children] = [];
  55891. }
  55892. push(child) {
  55893. const len = this[_children].length;
  55894. if (len <= this[_max]) {
  55895. this[_children].push(child);
  55896. return true;
  55897. }
  55898. (0, _util.warn)(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`);
  55899. return false;
  55900. }
  55901. isEmpty() {
  55902. return this[_children].length === 0;
  55903. }
  55904. dump() {
  55905. return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]());
  55906. }
  55907. [$clone]() {
  55908. const clone = new XFAObjectArray(this[_max]);
  55909. clone[_children] = this[_children].map(c => c[$clone]());
  55910. return clone;
  55911. }
  55912. get children() {
  55913. return this[_children];
  55914. }
  55915. clear() {
  55916. this[_children].length = 0;
  55917. }
  55918. }
  55919. exports.XFAObjectArray = XFAObjectArray;
  55920. class XFAAttribute {
  55921. constructor(node, name, value) {
  55922. this[_parent] = node;
  55923. this[$nodeName] = name;
  55924. this[$content] = value;
  55925. this[$consumed] = false;
  55926. this[$uid] = `attribute${uid++}`;
  55927. }
  55928. [$getParent]() {
  55929. return this[_parent];
  55930. }
  55931. [$isDataValue]() {
  55932. return true;
  55933. }
  55934. [$getDataValue]() {
  55935. return this[$content].trim();
  55936. }
  55937. [$setValue](value) {
  55938. value = value.value || "";
  55939. this[$content] = value.toString();
  55940. }
  55941. [$text]() {
  55942. return this[$content];
  55943. }
  55944. [$isDescendent](parent) {
  55945. return this[_parent] === parent || this[_parent][$isDescendent](parent);
  55946. }
  55947. }
  55948. exports.XFAAttribute = XFAAttribute;
  55949. class XmlObject extends XFAObject {
  55950. constructor(nsId, name) {
  55951. let attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  55952. super(nsId, name);
  55953. this[$content] = "";
  55954. this[_dataValue] = null;
  55955. if (name !== "#text") {
  55956. const map = new Map();
  55957. this[_attributes] = map;
  55958. for (const [attrName, value] of Object.entries(attributes)) {
  55959. map.set(attrName, new XFAAttribute(this, attrName, value));
  55960. }
  55961. if (attributes.hasOwnProperty($nsAttributes)) {
  55962. const dataNode = attributes[$nsAttributes].xfa.dataNode;
  55963. if (dataNode !== undefined) {
  55964. if (dataNode === "dataGroup") {
  55965. this[_dataValue] = false;
  55966. } else if (dataNode === "dataValue") {
  55967. this[_dataValue] = true;
  55968. }
  55969. }
  55970. }
  55971. }
  55972. this[$consumed] = false;
  55973. }
  55974. [$toString](buf) {
  55975. const tagName = this[$nodeName];
  55976. if (tagName === "#text") {
  55977. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  55978. return;
  55979. }
  55980. const utf8TagName = (0, _util.utf8StringToString)(tagName);
  55981. const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : "";
  55982. buf.push(`<${prefix}${utf8TagName}`);
  55983. for (const [name, value] of this[_attributes].entries()) {
  55984. const utf8Name = (0, _util.utf8StringToString)(name);
  55985. buf.push(` ${utf8Name}="${(0, _core_utils.encodeToXmlString)(value[$content])}"`);
  55986. }
  55987. if (this[_dataValue] !== null) {
  55988. if (this[_dataValue]) {
  55989. buf.push(` xfa:dataNode="dataValue"`);
  55990. } else {
  55991. buf.push(` xfa:dataNode="dataGroup"`);
  55992. }
  55993. }
  55994. if (!this[$content] && this[_children].length === 0) {
  55995. buf.push("/>");
  55996. return;
  55997. }
  55998. buf.push(">");
  55999. if (this[$content]) {
  56000. if (typeof this[$content] === "string") {
  56001. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  56002. } else {
  56003. this[$content][$toString](buf);
  56004. }
  56005. } else {
  56006. for (const child of this[_children]) {
  56007. child[$toString](buf);
  56008. }
  56009. }
  56010. buf.push(`</${prefix}${utf8TagName}>`);
  56011. }
  56012. [$onChild](child) {
  56013. if (this[$content]) {
  56014. const node = new XmlObject(this[$namespaceId], "#text");
  56015. this[$appendChild](node);
  56016. node[$content] = this[$content];
  56017. this[$content] = "";
  56018. }
  56019. this[$appendChild](child);
  56020. return true;
  56021. }
  56022. [$onText](str) {
  56023. this[$content] += str;
  56024. }
  56025. [$finalize]() {
  56026. if (this[$content] && this[_children].length > 0) {
  56027. const node = new XmlObject(this[$namespaceId], "#text");
  56028. this[$appendChild](node);
  56029. node[$content] = this[$content];
  56030. delete this[$content];
  56031. }
  56032. }
  56033. [$toHTML]() {
  56034. if (this[$nodeName] === "#text") {
  56035. return _utils.HTMLResult.success({
  56036. name: "#text",
  56037. value: this[$content]
  56038. });
  56039. }
  56040. return _utils.HTMLResult.EMPTY;
  56041. }
  56042. [$getChildren]() {
  56043. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  56044. if (!name) {
  56045. return this[_children];
  56046. }
  56047. return this[_children].filter(c => c[$nodeName] === name);
  56048. }
  56049. [$getAttributes]() {
  56050. return this[_attributes];
  56051. }
  56052. [$getChildrenByClass](name) {
  56053. const value = this[_attributes].get(name);
  56054. if (value !== undefined) {
  56055. return value;
  56056. }
  56057. return this[$getChildren](name);
  56058. }
  56059. *[$getChildrenByNameIt](name, allTransparent) {
  56060. const value = this[_attributes].get(name);
  56061. if (value) {
  56062. yield value;
  56063. }
  56064. for (const child of this[_children]) {
  56065. if (child[$nodeName] === name) {
  56066. yield child;
  56067. }
  56068. if (allTransparent) {
  56069. yield* child[$getChildrenByNameIt](name, allTransparent);
  56070. }
  56071. }
  56072. }
  56073. *[$getAttributeIt](name, skipConsumed) {
  56074. const value = this[_attributes].get(name);
  56075. if (value && (!skipConsumed || !value[$consumed])) {
  56076. yield value;
  56077. }
  56078. for (const child of this[_children]) {
  56079. yield* child[$getAttributeIt](name, skipConsumed);
  56080. }
  56081. }
  56082. *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {
  56083. for (const child of this[_children]) {
  56084. if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) {
  56085. yield child;
  56086. }
  56087. if (allTransparent) {
  56088. yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed);
  56089. }
  56090. }
  56091. }
  56092. [$isDataValue]() {
  56093. if (this[_dataValue] === null) {
  56094. return this[_children].length === 0 || this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id;
  56095. }
  56096. return this[_dataValue];
  56097. }
  56098. [$getDataValue]() {
  56099. if (this[_dataValue] === null) {
  56100. if (this[_children].length === 0) {
  56101. return this[$content].trim();
  56102. }
  56103. if (this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  56104. return this[_children][0][$text]().trim();
  56105. }
  56106. return null;
  56107. }
  56108. return this[$content].trim();
  56109. }
  56110. [$setValue](value) {
  56111. value = value.value || "";
  56112. this[$content] = value.toString();
  56113. }
  56114. [$dump]() {
  56115. let hasNS = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  56116. const dumped = Object.create(null);
  56117. if (hasNS) {
  56118. dumped.$ns = this[$namespaceId];
  56119. }
  56120. if (this[$content]) {
  56121. dumped.$content = this[$content];
  56122. }
  56123. dumped.$name = this[$nodeName];
  56124. dumped.children = [];
  56125. for (const child of this[_children]) {
  56126. dumped.children.push(child[$dump](hasNS));
  56127. }
  56128. dumped.attributes = Object.create(null);
  56129. for (const [name, value] of this[_attributes]) {
  56130. dumped.attributes[name] = value[$content];
  56131. }
  56132. return dumped;
  56133. }
  56134. }
  56135. exports.XmlObject = XmlObject;
  56136. class ContentObject extends XFAObject {
  56137. constructor(nsId, name) {
  56138. super(nsId, name);
  56139. this[$content] = "";
  56140. }
  56141. [$onText](text) {
  56142. this[$content] += text;
  56143. }
  56144. [$finalize]() {}
  56145. }
  56146. exports.ContentObject = ContentObject;
  56147. class OptionObject extends ContentObject {
  56148. constructor(nsId, name, options) {
  56149. super(nsId, name);
  56150. this[_options] = options;
  56151. }
  56152. [$finalize]() {
  56153. this[$content] = (0, _utils.getKeyword)({
  56154. data: this[$content],
  56155. defaultValue: this[_options][0],
  56156. validate: k => this[_options].includes(k)
  56157. });
  56158. }
  56159. [$clean](builder) {
  56160. super[$clean](builder);
  56161. delete this[_options];
  56162. }
  56163. }
  56164. exports.OptionObject = OptionObject;
  56165. class StringObject extends ContentObject {
  56166. [$finalize]() {
  56167. this[$content] = this[$content].trim();
  56168. }
  56169. }
  56170. exports.StringObject = StringObject;
  56171. class IntegerObject extends ContentObject {
  56172. constructor(nsId, name, defaultValue, validator) {
  56173. super(nsId, name);
  56174. this[_defaultValue] = defaultValue;
  56175. this[_validator] = validator;
  56176. }
  56177. [$finalize]() {
  56178. this[$content] = (0, _utils.getInteger)({
  56179. data: this[$content],
  56180. defaultValue: this[_defaultValue],
  56181. validate: this[_validator]
  56182. });
  56183. }
  56184. [$clean](builder) {
  56185. super[$clean](builder);
  56186. delete this[_defaultValue];
  56187. delete this[_validator];
  56188. }
  56189. }
  56190. exports.IntegerObject = IntegerObject;
  56191. class Option01 extends IntegerObject {
  56192. constructor(nsId, name) {
  56193. super(nsId, name, 0, n => n === 1);
  56194. }
  56195. }
  56196. exports.Option01 = Option01;
  56197. class Option10 extends IntegerObject {
  56198. constructor(nsId, name) {
  56199. super(nsId, name, 1, n => n === 0);
  56200. }
  56201. }
  56202. exports.Option10 = Option10;
  56203. /***/ }),
  56204. /* 209 */
  56205. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56206. "use strict";
  56207. Object.defineProperty(exports, "__esModule", ({
  56208. value: true
  56209. }));
  56210. exports.HTMLResult = void 0;
  56211. exports.getBBox = getBBox;
  56212. exports.getColor = getColor;
  56213. exports.getFloat = getFloat;
  56214. exports.getInteger = getInteger;
  56215. exports.getKeyword = getKeyword;
  56216. exports.getMeasurement = getMeasurement;
  56217. exports.getRatio = getRatio;
  56218. exports.getRelevant = getRelevant;
  56219. exports.getStringOption = getStringOption;
  56220. exports.stripQuotes = stripQuotes;
  56221. var _util = __w_pdfjs_require__(2);
  56222. const dimConverters = {
  56223. pt: x => x,
  56224. cm: x => x / 2.54 * 72,
  56225. mm: x => x / (10 * 2.54) * 72,
  56226. in: x => x * 72,
  56227. px: x => x
  56228. };
  56229. const measurementPattern = /([+-]?\d+\.?\d*)(.*)/;
  56230. function stripQuotes(str) {
  56231. if (str.startsWith("'") || str.startsWith('"')) {
  56232. return str.slice(1, str.length - 1);
  56233. }
  56234. return str;
  56235. }
  56236. function getInteger(_ref) {
  56237. let {
  56238. data,
  56239. defaultValue,
  56240. validate
  56241. } = _ref;
  56242. if (!data) {
  56243. return defaultValue;
  56244. }
  56245. data = data.trim();
  56246. const n = parseInt(data, 10);
  56247. if (!isNaN(n) && validate(n)) {
  56248. return n;
  56249. }
  56250. return defaultValue;
  56251. }
  56252. function getFloat(_ref2) {
  56253. let {
  56254. data,
  56255. defaultValue,
  56256. validate
  56257. } = _ref2;
  56258. if (!data) {
  56259. return defaultValue;
  56260. }
  56261. data = data.trim();
  56262. const n = parseFloat(data);
  56263. if (!isNaN(n) && validate(n)) {
  56264. return n;
  56265. }
  56266. return defaultValue;
  56267. }
  56268. function getKeyword(_ref3) {
  56269. let {
  56270. data,
  56271. defaultValue,
  56272. validate
  56273. } = _ref3;
  56274. if (!data) {
  56275. return defaultValue;
  56276. }
  56277. data = data.trim();
  56278. if (validate(data)) {
  56279. return data;
  56280. }
  56281. return defaultValue;
  56282. }
  56283. function getStringOption(data, options) {
  56284. return getKeyword({
  56285. data,
  56286. defaultValue: options[0],
  56287. validate: k => options.includes(k)
  56288. });
  56289. }
  56290. function getMeasurement(str) {
  56291. let def = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "0";
  56292. def = def || "0";
  56293. if (!str) {
  56294. return getMeasurement(def);
  56295. }
  56296. const match = str.trim().match(measurementPattern);
  56297. if (!match) {
  56298. return getMeasurement(def);
  56299. }
  56300. const [, valueStr, unit] = match;
  56301. const value = parseFloat(valueStr);
  56302. if (isNaN(value)) {
  56303. return getMeasurement(def);
  56304. }
  56305. if (value === 0) {
  56306. return 0;
  56307. }
  56308. const conv = dimConverters[unit];
  56309. if (conv) {
  56310. return conv(value);
  56311. }
  56312. return value;
  56313. }
  56314. function getRatio(data) {
  56315. if (!data) {
  56316. return {
  56317. num: 1,
  56318. den: 1
  56319. };
  56320. }
  56321. const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x));
  56322. if (ratio.length === 1) {
  56323. ratio.push(1);
  56324. }
  56325. if (ratio.length === 0) {
  56326. return {
  56327. num: 1,
  56328. den: 1
  56329. };
  56330. }
  56331. const [num, den] = ratio;
  56332. return {
  56333. num,
  56334. den
  56335. };
  56336. }
  56337. function getRelevant(data) {
  56338. if (!data) {
  56339. return [];
  56340. }
  56341. return data.trim().split(/\s+/).map(e => {
  56342. return {
  56343. excluded: e[0] === "-",
  56344. viewname: e.substring(1)
  56345. };
  56346. });
  56347. }
  56348. function getColor(data) {
  56349. let def = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0];
  56350. let [r, g, b] = def;
  56351. if (!data) {
  56352. return {
  56353. r,
  56354. g,
  56355. b
  56356. };
  56357. }
  56358. 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);
  56359. if (color.length < 3) {
  56360. return {
  56361. r,
  56362. g,
  56363. b
  56364. };
  56365. }
  56366. [r, g, b] = color;
  56367. return {
  56368. r,
  56369. g,
  56370. b
  56371. };
  56372. }
  56373. function getBBox(data) {
  56374. const def = -1;
  56375. if (!data) {
  56376. return {
  56377. x: def,
  56378. y: def,
  56379. width: def,
  56380. height: def
  56381. };
  56382. }
  56383. const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1"));
  56384. if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {
  56385. return {
  56386. x: def,
  56387. y: def,
  56388. width: def,
  56389. height: def
  56390. };
  56391. }
  56392. const [x, y, width, height] = bbox;
  56393. return {
  56394. x,
  56395. y,
  56396. width,
  56397. height
  56398. };
  56399. }
  56400. class HTMLResult {
  56401. static get FAILURE() {
  56402. return (0, _util.shadow)(this, "FAILURE", new HTMLResult(false, null, null, null));
  56403. }
  56404. static get EMPTY() {
  56405. return (0, _util.shadow)(this, "EMPTY", new HTMLResult(true, null, null, null));
  56406. }
  56407. constructor(success, html, bbox, breakNode) {
  56408. this.success = success;
  56409. this.html = html;
  56410. this.bbox = bbox;
  56411. this.breakNode = breakNode;
  56412. }
  56413. isBreak() {
  56414. return !!this.breakNode;
  56415. }
  56416. static breakNode(node) {
  56417. return new HTMLResult(false, null, null, node);
  56418. }
  56419. static success(html) {
  56420. let bbox = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  56421. return new HTMLResult(true, html, bbox, null);
  56422. }
  56423. }
  56424. exports.HTMLResult = HTMLResult;
  56425. /***/ }),
  56426. /* 210 */
  56427. /***/ ((__unused_webpack_module, exports) => {
  56428. "use strict";
  56429. Object.defineProperty(exports, "__esModule", ({
  56430. value: true
  56431. }));
  56432. exports.NamespaceIds = exports.$buildXFAObject = void 0;
  56433. const $buildXFAObject = Symbol();
  56434. exports.$buildXFAObject = $buildXFAObject;
  56435. const NamespaceIds = {
  56436. config: {
  56437. id: 0,
  56438. check: ns => ns.startsWith("http://www.xfa.org/schema/xci/")
  56439. },
  56440. connectionSet: {
  56441. id: 1,
  56442. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/")
  56443. },
  56444. datasets: {
  56445. id: 2,
  56446. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/")
  56447. },
  56448. form: {
  56449. id: 3,
  56450. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/")
  56451. },
  56452. localeSet: {
  56453. id: 4,
  56454. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/")
  56455. },
  56456. pdf: {
  56457. id: 5,
  56458. check: ns => ns === "http://ns.adobe.com/xdp/pdf/"
  56459. },
  56460. signature: {
  56461. id: 6,
  56462. check: ns => ns === "http://www.w3.org/2000/09/xmldsig#"
  56463. },
  56464. sourceSet: {
  56465. id: 7,
  56466. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/")
  56467. },
  56468. stylesheet: {
  56469. id: 8,
  56470. check: ns => ns === "http://www.w3.org/1999/XSL/Transform"
  56471. },
  56472. template: {
  56473. id: 9,
  56474. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/")
  56475. },
  56476. xdc: {
  56477. id: 10,
  56478. check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/")
  56479. },
  56480. xdp: {
  56481. id: 11,
  56482. check: ns => ns === "http://ns.adobe.com/xdp/"
  56483. },
  56484. xfdf: {
  56485. id: 12,
  56486. check: ns => ns === "http://ns.adobe.com/xfdf/"
  56487. },
  56488. xhtml: {
  56489. id: 13,
  56490. check: ns => ns === "http://www.w3.org/1999/xhtml"
  56491. },
  56492. xmpmeta: {
  56493. id: 14,
  56494. check: ns => ns === "http://ns.adobe.com/xmpmeta/"
  56495. }
  56496. };
  56497. exports.NamespaceIds = NamespaceIds;
  56498. /***/ }),
  56499. /* 211 */
  56500. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56501. "use strict";
  56502. Object.defineProperty(exports, "__esModule", ({
  56503. value: true
  56504. }));
  56505. exports.createDataNode = createDataNode;
  56506. exports.searchNode = searchNode;
  56507. var _xfa_object = __w_pdfjs_require__(208);
  56508. var _namespaces = __w_pdfjs_require__(210);
  56509. var _util = __w_pdfjs_require__(2);
  56510. const namePattern = /^[^.[]+/;
  56511. const indexPattern = /^[^\]]+/;
  56512. const operators = {
  56513. dot: 0,
  56514. dotDot: 1,
  56515. dotHash: 2,
  56516. dotBracket: 3,
  56517. dotParen: 4
  56518. };
  56519. 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]]);
  56520. const somCache = new WeakMap();
  56521. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  56522. function parseIndex(index) {
  56523. index = index.trim();
  56524. if (index === "*") {
  56525. return Infinity;
  56526. }
  56527. return parseInt(index, 10) || 0;
  56528. }
  56529. function parseExpression(expr, dotDotAllowed) {
  56530. let noExpr = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  56531. let match = expr.match(namePattern);
  56532. if (!match) {
  56533. return null;
  56534. }
  56535. let [name] = match;
  56536. const parsed = [{
  56537. name,
  56538. cacheName: "." + name,
  56539. index: 0,
  56540. js: null,
  56541. formCalc: null,
  56542. operator: operators.dot
  56543. }];
  56544. let pos = name.length;
  56545. while (pos < expr.length) {
  56546. const spos = pos;
  56547. const char = expr.charAt(pos++);
  56548. if (char === "[") {
  56549. match = expr.slice(pos).match(indexPattern);
  56550. if (!match) {
  56551. (0, _util.warn)("XFA - Invalid index in SOM expression");
  56552. return null;
  56553. }
  56554. parsed.at(-1).index = parseIndex(match[0]);
  56555. pos += match[0].length + 1;
  56556. continue;
  56557. }
  56558. let operator;
  56559. switch (expr.charAt(pos)) {
  56560. case ".":
  56561. if (!dotDotAllowed) {
  56562. return null;
  56563. }
  56564. pos++;
  56565. operator = operators.dotDot;
  56566. break;
  56567. case "#":
  56568. pos++;
  56569. operator = operators.dotHash;
  56570. break;
  56571. case "[":
  56572. if (noExpr) {
  56573. (0, _util.warn)("XFA - SOM expression contains a FormCalc subexpression which is not supported for now.");
  56574. return null;
  56575. }
  56576. operator = operators.dotBracket;
  56577. break;
  56578. case "(":
  56579. if (noExpr) {
  56580. (0, _util.warn)("XFA - SOM expression contains a JavaScript subexpression which is not supported for now.");
  56581. return null;
  56582. }
  56583. operator = operators.dotParen;
  56584. break;
  56585. default:
  56586. operator = operators.dot;
  56587. break;
  56588. }
  56589. match = expr.slice(pos).match(namePattern);
  56590. if (!match) {
  56591. break;
  56592. }
  56593. [name] = match;
  56594. pos += name.length;
  56595. parsed.push({
  56596. name,
  56597. cacheName: expr.slice(spos, pos),
  56598. operator,
  56599. index: 0,
  56600. js: null,
  56601. formCalc: null
  56602. });
  56603. }
  56604. return parsed;
  56605. }
  56606. function searchNode(root, container, expr) {
  56607. let dotDotAllowed = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
  56608. let useCache = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  56609. const parsed = parseExpression(expr, dotDotAllowed);
  56610. if (!parsed) {
  56611. return null;
  56612. }
  56613. const fn = shortcuts.get(parsed[0].name);
  56614. let i = 0;
  56615. let isQualified;
  56616. if (fn) {
  56617. isQualified = true;
  56618. root = [fn(root, container)];
  56619. i = 1;
  56620. } else {
  56621. isQualified = container === null;
  56622. root = [container || root];
  56623. }
  56624. for (let ii = parsed.length; i < ii; i++) {
  56625. const {
  56626. name,
  56627. cacheName,
  56628. operator,
  56629. index
  56630. } = parsed[i];
  56631. const nodes = [];
  56632. for (const node of root) {
  56633. if (!(node instanceof _xfa_object.XFAObject)) {
  56634. continue;
  56635. }
  56636. let children, cached;
  56637. if (useCache) {
  56638. cached = somCache.get(node);
  56639. if (!cached) {
  56640. cached = new Map();
  56641. somCache.set(node, cached);
  56642. }
  56643. children = cached.get(cacheName);
  56644. }
  56645. if (!children) {
  56646. switch (operator) {
  56647. case operators.dot:
  56648. children = node[_xfa_object.$getChildrenByName](name, false);
  56649. break;
  56650. case operators.dotDot:
  56651. children = node[_xfa_object.$getChildrenByName](name, true);
  56652. break;
  56653. case operators.dotHash:
  56654. children = node[_xfa_object.$getChildrenByClass](name);
  56655. if (children instanceof _xfa_object.XFAObjectArray) {
  56656. children = children.children;
  56657. } else {
  56658. children = [children];
  56659. }
  56660. break;
  56661. default:
  56662. break;
  56663. }
  56664. if (useCache) {
  56665. cached.set(cacheName, children);
  56666. }
  56667. }
  56668. if (children.length > 0) {
  56669. nodes.push(children);
  56670. }
  56671. }
  56672. if (nodes.length === 0 && !isQualified && i === 0) {
  56673. const parent = container[_xfa_object.$getParent]();
  56674. container = parent;
  56675. if (!container) {
  56676. return null;
  56677. }
  56678. i = -1;
  56679. root = [container];
  56680. continue;
  56681. }
  56682. if (isFinite(index)) {
  56683. root = nodes.filter(node => index < node.length).map(node => node[index]);
  56684. } else {
  56685. root = nodes.flat();
  56686. }
  56687. }
  56688. if (root.length === 0) {
  56689. return null;
  56690. }
  56691. return root;
  56692. }
  56693. function createNodes(root, path) {
  56694. let node = null;
  56695. for (const {
  56696. name,
  56697. index
  56698. } of path) {
  56699. for (let i = 0, ii = !isFinite(index) ? 0 : index; i <= ii; i++) {
  56700. const nsId = root[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : root[_xfa_object.$namespaceId];
  56701. node = new _xfa_object.XmlObject(nsId, name);
  56702. root[_xfa_object.$appendChild](node);
  56703. }
  56704. root = node;
  56705. }
  56706. return node;
  56707. }
  56708. function createDataNode(root, container, expr) {
  56709. const parsed = parseExpression(expr);
  56710. if (!parsed) {
  56711. return null;
  56712. }
  56713. if (parsed.some(x => x.operator === operators.dotDot)) {
  56714. return null;
  56715. }
  56716. const fn = shortcuts.get(parsed[0].name);
  56717. let i = 0;
  56718. if (fn) {
  56719. root = fn(root, container);
  56720. i = 1;
  56721. } else {
  56722. root = container || root;
  56723. }
  56724. for (let ii = parsed.length; i < ii; i++) {
  56725. const {
  56726. name,
  56727. operator,
  56728. index
  56729. } = parsed[i];
  56730. if (!isFinite(index)) {
  56731. parsed[i].index = 0;
  56732. return createNodes(root, parsed.slice(i));
  56733. }
  56734. let children;
  56735. switch (operator) {
  56736. case operators.dot:
  56737. children = root[_xfa_object.$getChildrenByName](name, false);
  56738. break;
  56739. case operators.dotDot:
  56740. children = root[_xfa_object.$getChildrenByName](name, true);
  56741. break;
  56742. case operators.dotHash:
  56743. children = root[_xfa_object.$getChildrenByClass](name);
  56744. if (children instanceof _xfa_object.XFAObjectArray) {
  56745. children = children.children;
  56746. } else {
  56747. children = [children];
  56748. }
  56749. break;
  56750. default:
  56751. break;
  56752. }
  56753. if (children.length === 0) {
  56754. return createNodes(root, parsed.slice(i));
  56755. }
  56756. if (index < children.length) {
  56757. const child = children[index];
  56758. if (!(child instanceof _xfa_object.XFAObject)) {
  56759. (0, _util.warn)(`XFA - Cannot create a node.`);
  56760. return null;
  56761. }
  56762. root = child;
  56763. } else {
  56764. parsed[i].index = index - children.length;
  56765. return createNodes(root, parsed.slice(i));
  56766. }
  56767. }
  56768. return null;
  56769. }
  56770. /***/ }),
  56771. /* 212 */
  56772. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56773. "use strict";
  56774. Object.defineProperty(exports, "__esModule", ({
  56775. value: true
  56776. }));
  56777. exports.Binder = void 0;
  56778. var _xfa_object = __w_pdfjs_require__(208);
  56779. var _template = __w_pdfjs_require__(213);
  56780. var _som = __w_pdfjs_require__(211);
  56781. var _namespaces = __w_pdfjs_require__(210);
  56782. var _util = __w_pdfjs_require__(2);
  56783. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  56784. function createText(content) {
  56785. const node = new _template.Text({});
  56786. node[_xfa_object.$content] = content;
  56787. return node;
  56788. }
  56789. class Binder {
  56790. constructor(root) {
  56791. this.root = root;
  56792. this.datasets = root.datasets;
  56793. if (root.datasets && root.datasets.data) {
  56794. this.data = root.datasets.data;
  56795. } else {
  56796. this.data = new _xfa_object.XmlObject(_namespaces.NamespaceIds.datasets.id, "data");
  56797. }
  56798. this.emptyMerge = this.data[_xfa_object.$getChildren]().length === 0;
  56799. this.root.form = this.form = root.template[_xfa_object.$clone]();
  56800. }
  56801. _isConsumeData() {
  56802. return !this.emptyMerge && this._mergeMode;
  56803. }
  56804. _isMatchTemplate() {
  56805. return !this._isConsumeData();
  56806. }
  56807. bind() {
  56808. this._bindElement(this.form, this.data);
  56809. return this.form;
  56810. }
  56811. getData() {
  56812. return this.data;
  56813. }
  56814. _bindValue(formNode, data, picture) {
  56815. formNode[_xfa_object.$data] = data;
  56816. if (formNode[_xfa_object.$hasSettableValue]()) {
  56817. if (data[_xfa_object.$isDataValue]()) {
  56818. const value = data[_xfa_object.$getDataValue]();
  56819. formNode[_xfa_object.$setValue](createText(value));
  56820. } else if (formNode instanceof _template.Field && formNode.ui && formNode.ui.choiceList && formNode.ui.choiceList.open === "multiSelect") {
  56821. const value = data[_xfa_object.$getChildren]().map(child => child[_xfa_object.$content].trim()).join("\n");
  56822. formNode[_xfa_object.$setValue](createText(value));
  56823. } else if (this._isConsumeData()) {
  56824. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  56825. }
  56826. } else if (!data[_xfa_object.$isDataValue]() || this._isMatchTemplate()) {
  56827. this._bindElement(formNode, data);
  56828. } else {
  56829. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  56830. }
  56831. }
  56832. _findDataByNameToConsume(name, isValue, dataNode, global) {
  56833. if (!name) {
  56834. return null;
  56835. }
  56836. let generator, match;
  56837. for (let i = 0; i < 3; i++) {
  56838. generator = dataNode[_xfa_object.$getRealChildrenByNameIt](name, false, true);
  56839. while (true) {
  56840. match = generator.next().value;
  56841. if (!match) {
  56842. break;
  56843. }
  56844. if (isValue === match[_xfa_object.$isDataValue]()) {
  56845. return match;
  56846. }
  56847. }
  56848. if (dataNode[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.datasets.id && dataNode[_xfa_object.$nodeName] === "data") {
  56849. break;
  56850. }
  56851. dataNode = dataNode[_xfa_object.$getParent]();
  56852. }
  56853. if (!global) {
  56854. return null;
  56855. }
  56856. generator = this.data[_xfa_object.$getRealChildrenByNameIt](name, true, false);
  56857. match = generator.next().value;
  56858. if (match) {
  56859. return match;
  56860. }
  56861. generator = this.data[_xfa_object.$getAttributeIt](name, true);
  56862. match = generator.next().value;
  56863. if (match && match[_xfa_object.$isDataValue]()) {
  56864. return match;
  56865. }
  56866. return null;
  56867. }
  56868. _setProperties(formNode, dataNode) {
  56869. if (!formNode.hasOwnProperty("setProperty")) {
  56870. return;
  56871. }
  56872. for (const {
  56873. ref,
  56874. target,
  56875. connection
  56876. } of formNode.setProperty.children) {
  56877. if (connection) {
  56878. continue;
  56879. }
  56880. if (!ref) {
  56881. continue;
  56882. }
  56883. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  56884. if (!nodes) {
  56885. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  56886. continue;
  56887. }
  56888. const [node] = nodes;
  56889. if (!node[_xfa_object.$isDescendent](this.data)) {
  56890. (0, _util.warn)(`XFA - Invalid node: must be a data node.`);
  56891. continue;
  56892. }
  56893. const targetNodes = (0, _som.searchNode)(this.root, formNode, target, false, false);
  56894. if (!targetNodes) {
  56895. (0, _util.warn)(`XFA - Invalid target: ${target}.`);
  56896. continue;
  56897. }
  56898. const [targetNode] = targetNodes;
  56899. if (!targetNode[_xfa_object.$isDescendent](formNode)) {
  56900. (0, _util.warn)(`XFA - Invalid target: must be a property or subproperty.`);
  56901. continue;
  56902. }
  56903. const targetParent = targetNode[_xfa_object.$getParent]();
  56904. if (targetNode instanceof _template.SetProperty || targetParent instanceof _template.SetProperty) {
  56905. (0, _util.warn)(`XFA - Invalid target: cannot be a setProperty or one of its properties.`);
  56906. continue;
  56907. }
  56908. if (targetNode instanceof _template.BindItems || targetParent instanceof _template.BindItems) {
  56909. (0, _util.warn)(`XFA - Invalid target: cannot be a bindItems or one of its properties.`);
  56910. continue;
  56911. }
  56912. const content = node[_xfa_object.$text]();
  56913. const name = targetNode[_xfa_object.$nodeName];
  56914. if (targetNode instanceof _xfa_object.XFAAttribute) {
  56915. const attrs = Object.create(null);
  56916. attrs[name] = content;
  56917. const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]);
  56918. targetParent[name] = obj[name];
  56919. continue;
  56920. }
  56921. if (!targetNode.hasOwnProperty(_xfa_object.$content)) {
  56922. (0, _util.warn)(`XFA - Invalid node to use in setProperty`);
  56923. continue;
  56924. }
  56925. targetNode[_xfa_object.$data] = node;
  56926. targetNode[_xfa_object.$content] = content;
  56927. targetNode[_xfa_object.$finalize]();
  56928. }
  56929. }
  56930. _bindItems(formNode, dataNode) {
  56931. if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) {
  56932. return;
  56933. }
  56934. for (const item of formNode.items.children) {
  56935. formNode[_xfa_object.$removeChild](item);
  56936. }
  56937. formNode.items.clear();
  56938. const labels = new _template.Items({});
  56939. const values = new _template.Items({});
  56940. formNode[_xfa_object.$appendChild](labels);
  56941. formNode.items.push(labels);
  56942. formNode[_xfa_object.$appendChild](values);
  56943. formNode.items.push(values);
  56944. for (const {
  56945. ref,
  56946. labelRef,
  56947. valueRef,
  56948. connection
  56949. } of formNode.bindItems.children) {
  56950. if (connection) {
  56951. continue;
  56952. }
  56953. if (!ref) {
  56954. continue;
  56955. }
  56956. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  56957. if (!nodes) {
  56958. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  56959. continue;
  56960. }
  56961. for (const node of nodes) {
  56962. if (!node[_xfa_object.$isDescendent](this.datasets)) {
  56963. (0, _util.warn)(`XFA - Invalid ref (${ref}): must be a datasets child.`);
  56964. continue;
  56965. }
  56966. const labelNodes = (0, _som.searchNode)(this.root, node, labelRef, true, false);
  56967. if (!labelNodes) {
  56968. (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`);
  56969. continue;
  56970. }
  56971. const [labelNode] = labelNodes;
  56972. if (!labelNode[_xfa_object.$isDescendent](this.datasets)) {
  56973. (0, _util.warn)(`XFA - Invalid label: must be a datasets child.`);
  56974. continue;
  56975. }
  56976. const valueNodes = (0, _som.searchNode)(this.root, node, valueRef, true, false);
  56977. if (!valueNodes) {
  56978. (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`);
  56979. continue;
  56980. }
  56981. const [valueNode] = valueNodes;
  56982. if (!valueNode[_xfa_object.$isDescendent](this.datasets)) {
  56983. (0, _util.warn)(`XFA - Invalid value: must be a datasets child.`);
  56984. continue;
  56985. }
  56986. const label = createText(labelNode[_xfa_object.$text]());
  56987. const value = createText(valueNode[_xfa_object.$text]());
  56988. labels[_xfa_object.$appendChild](label);
  56989. labels.text.push(label);
  56990. values[_xfa_object.$appendChild](value);
  56991. values.text.push(value);
  56992. }
  56993. }
  56994. }
  56995. _bindOccurrences(formNode, matches, picture) {
  56996. let baseClone;
  56997. if (matches.length > 1) {
  56998. baseClone = formNode[_xfa_object.$clone]();
  56999. baseClone[_xfa_object.$removeChild](baseClone.occur);
  57000. baseClone.occur = null;
  57001. }
  57002. this._bindValue(formNode, matches[0], picture);
  57003. this._setProperties(formNode, matches[0]);
  57004. this._bindItems(formNode, matches[0]);
  57005. if (matches.length === 1) {
  57006. return;
  57007. }
  57008. const parent = formNode[_xfa_object.$getParent]();
  57009. const name = formNode[_xfa_object.$nodeName];
  57010. const pos = parent[_xfa_object.$indexOf](formNode);
  57011. for (let i = 1, ii = matches.length; i < ii; i++) {
  57012. const match = matches[i];
  57013. const clone = baseClone[_xfa_object.$clone]();
  57014. parent[name].push(clone);
  57015. parent[_xfa_object.$insertAt](pos + i, clone);
  57016. this._bindValue(clone, match, picture);
  57017. this._setProperties(clone, match);
  57018. this._bindItems(clone, match);
  57019. }
  57020. }
  57021. _createOccurrences(formNode) {
  57022. if (!this.emptyMerge) {
  57023. return;
  57024. }
  57025. const {
  57026. occur
  57027. } = formNode;
  57028. if (!occur || occur.initial <= 1) {
  57029. return;
  57030. }
  57031. const parent = formNode[_xfa_object.$getParent]();
  57032. const name = formNode[_xfa_object.$nodeName];
  57033. if (!(parent[name] instanceof _xfa_object.XFAObjectArray)) {
  57034. return;
  57035. }
  57036. let currentNumber;
  57037. if (formNode.name) {
  57038. currentNumber = parent[name].children.filter(e => e.name === formNode.name).length;
  57039. } else {
  57040. currentNumber = parent[name].children.length;
  57041. }
  57042. const pos = parent[_xfa_object.$indexOf](formNode) + 1;
  57043. const ii = occur.initial - currentNumber;
  57044. if (ii) {
  57045. const nodeClone = formNode[_xfa_object.$clone]();
  57046. nodeClone[_xfa_object.$removeChild](nodeClone.occur);
  57047. nodeClone.occur = null;
  57048. parent[name].push(nodeClone);
  57049. parent[_xfa_object.$insertAt](pos, nodeClone);
  57050. for (let i = 1; i < ii; i++) {
  57051. const clone = nodeClone[_xfa_object.$clone]();
  57052. parent[name].push(clone);
  57053. parent[_xfa_object.$insertAt](pos + i, clone);
  57054. }
  57055. }
  57056. }
  57057. _getOccurInfo(formNode) {
  57058. const {
  57059. name,
  57060. occur
  57061. } = formNode;
  57062. if (!occur || !name) {
  57063. return [1, 1];
  57064. }
  57065. const max = occur.max === -1 ? Infinity : occur.max;
  57066. return [occur.min, max];
  57067. }
  57068. _setAndBind(formNode, dataNode) {
  57069. this._setProperties(formNode, dataNode);
  57070. this._bindItems(formNode, dataNode);
  57071. this._bindElement(formNode, dataNode);
  57072. }
  57073. _bindElement(formNode, dataNode) {
  57074. const uselessNodes = [];
  57075. this._createOccurrences(formNode);
  57076. for (const child of formNode[_xfa_object.$getChildren]()) {
  57077. if (child[_xfa_object.$data]) {
  57078. continue;
  57079. }
  57080. if (this._mergeMode === undefined && child[_xfa_object.$nodeName] === "subform") {
  57081. this._mergeMode = child.mergeMode === "consumeData";
  57082. const dataChildren = dataNode[_xfa_object.$getChildren]();
  57083. if (dataChildren.length > 0) {
  57084. this._bindOccurrences(child, [dataChildren[0]], null);
  57085. } else if (this.emptyMerge) {
  57086. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  57087. const dataChild = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name || "root");
  57088. dataNode[_xfa_object.$appendChild](dataChild);
  57089. this._bindElement(child, dataChild);
  57090. }
  57091. continue;
  57092. }
  57093. if (!child[_xfa_object.$isBindable]()) {
  57094. continue;
  57095. }
  57096. let global = false;
  57097. let picture = null;
  57098. let ref = null;
  57099. let match = null;
  57100. if (child.bind) {
  57101. switch (child.bind.match) {
  57102. case "none":
  57103. this._setAndBind(child, dataNode);
  57104. continue;
  57105. case "global":
  57106. global = true;
  57107. break;
  57108. case "dataRef":
  57109. if (!child.bind.ref) {
  57110. (0, _util.warn)(`XFA - ref is empty in node ${child[_xfa_object.$nodeName]}.`);
  57111. this._setAndBind(child, dataNode);
  57112. continue;
  57113. }
  57114. ref = child.bind.ref;
  57115. break;
  57116. default:
  57117. break;
  57118. }
  57119. if (child.bind.picture) {
  57120. picture = child.bind.picture[_xfa_object.$content];
  57121. }
  57122. }
  57123. const [min, max] = this._getOccurInfo(child);
  57124. if (ref) {
  57125. match = (0, _som.searchNode)(this.root, dataNode, ref, true, false);
  57126. if (match === null) {
  57127. match = (0, _som.createDataNode)(this.data, dataNode, ref);
  57128. if (!match) {
  57129. continue;
  57130. }
  57131. if (this._isConsumeData()) {
  57132. match[_xfa_object.$consumed] = true;
  57133. }
  57134. this._setAndBind(child, match);
  57135. continue;
  57136. } else {
  57137. if (this._isConsumeData()) {
  57138. match = match.filter(node => !node[_xfa_object.$consumed]);
  57139. }
  57140. if (match.length > max) {
  57141. match = match.slice(0, max);
  57142. } else if (match.length === 0) {
  57143. match = null;
  57144. }
  57145. if (match && this._isConsumeData()) {
  57146. match.forEach(node => {
  57147. node[_xfa_object.$consumed] = true;
  57148. });
  57149. }
  57150. }
  57151. } else {
  57152. if (!child.name) {
  57153. this._setAndBind(child, dataNode);
  57154. continue;
  57155. }
  57156. if (this._isConsumeData()) {
  57157. const matches = [];
  57158. while (matches.length < max) {
  57159. const found = this._findDataByNameToConsume(child.name, child[_xfa_object.$hasSettableValue](), dataNode, global);
  57160. if (!found) {
  57161. break;
  57162. }
  57163. found[_xfa_object.$consumed] = true;
  57164. matches.push(found);
  57165. }
  57166. match = matches.length > 0 ? matches : null;
  57167. } else {
  57168. match = dataNode[_xfa_object.$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value;
  57169. if (!match) {
  57170. if (min === 0) {
  57171. uselessNodes.push(child);
  57172. continue;
  57173. }
  57174. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  57175. match = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name);
  57176. if (this.emptyMerge) {
  57177. match[_xfa_object.$consumed] = true;
  57178. }
  57179. dataNode[_xfa_object.$appendChild](match);
  57180. this._setAndBind(child, match);
  57181. continue;
  57182. }
  57183. if (this.emptyMerge) {
  57184. match[_xfa_object.$consumed] = true;
  57185. }
  57186. match = [match];
  57187. }
  57188. }
  57189. if (match) {
  57190. this._bindOccurrences(child, match, picture);
  57191. } else if (min > 0) {
  57192. this._setAndBind(child, dataNode);
  57193. } else {
  57194. uselessNodes.push(child);
  57195. }
  57196. }
  57197. uselessNodes.forEach(node => node[_xfa_object.$getParent]()[_xfa_object.$removeChild](node));
  57198. }
  57199. }
  57200. exports.Binder = Binder;
  57201. /***/ }),
  57202. /* 213 */
  57203. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57204. "use strict";
  57205. Object.defineProperty(exports, "__esModule", ({
  57206. value: true
  57207. }));
  57208. exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0;
  57209. var _xfa_object = __w_pdfjs_require__(208);
  57210. var _namespaces = __w_pdfjs_require__(210);
  57211. var _layout = __w_pdfjs_require__(214);
  57212. var _html_utils = __w_pdfjs_require__(215);
  57213. var _utils = __w_pdfjs_require__(209);
  57214. var _util = __w_pdfjs_require__(2);
  57215. var _fonts = __w_pdfjs_require__(216);
  57216. var _core_utils = __w_pdfjs_require__(136);
  57217. var _som = __w_pdfjs_require__(211);
  57218. const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id;
  57219. const SVG_NS = "http://www.w3.org/2000/svg";
  57220. const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2;
  57221. const MAX_EMPTY_PAGES = 3;
  57222. const DEFAULT_TAB_INDEX = 5000;
  57223. const HEADING_PATTERN = /^H(\d+)$/;
  57224. 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"]);
  57225. 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"]];
  57226. function getBorderDims(node) {
  57227. if (!node || !node.border) {
  57228. return {
  57229. w: 0,
  57230. h: 0
  57231. };
  57232. }
  57233. const borderExtra = node.border[_xfa_object.$getExtra]();
  57234. if (!borderExtra) {
  57235. return {
  57236. w: 0,
  57237. h: 0
  57238. };
  57239. }
  57240. return {
  57241. w: borderExtra.widths[0] + borderExtra.widths[2] + borderExtra.insets[0] + borderExtra.insets[2],
  57242. h: borderExtra.widths[1] + borderExtra.widths[3] + borderExtra.insets[1] + borderExtra.insets[3]
  57243. };
  57244. }
  57245. function hasMargin(node) {
  57246. return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset);
  57247. }
  57248. function _setValue(templateNode, value) {
  57249. if (!templateNode.value) {
  57250. const nodeValue = new Value({});
  57251. templateNode[_xfa_object.$appendChild](nodeValue);
  57252. templateNode.value = nodeValue;
  57253. }
  57254. templateNode.value[_xfa_object.$setValue](value);
  57255. }
  57256. function* getContainedChildren(node) {
  57257. for (const child of node[_xfa_object.$getChildren]()) {
  57258. if (child instanceof SubformSet) {
  57259. yield* child[_xfa_object.$getContainedChildren]();
  57260. continue;
  57261. }
  57262. yield child;
  57263. }
  57264. }
  57265. function isRequired(node) {
  57266. return node.validate && node.validate.nullTest === "error";
  57267. }
  57268. function setTabIndex(node) {
  57269. while (node) {
  57270. if (!node.traversal) {
  57271. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  57272. return;
  57273. }
  57274. if (node[_xfa_object.$tabIndex]) {
  57275. return;
  57276. }
  57277. let next = null;
  57278. for (const child of node.traversal[_xfa_object.$getChildren]()) {
  57279. if (child.operation === "next") {
  57280. next = child;
  57281. break;
  57282. }
  57283. }
  57284. if (!next || !next.ref) {
  57285. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  57286. return;
  57287. }
  57288. const root = node[_xfa_object.$getTemplateRoot]();
  57289. node[_xfa_object.$tabIndex] = ++root[_xfa_object.$tabIndex];
  57290. const ref = root[_xfa_object.$searchNode](next.ref, node);
  57291. if (!ref) {
  57292. return;
  57293. }
  57294. node = ref[0];
  57295. }
  57296. }
  57297. function applyAssist(obj, attributes) {
  57298. const assist = obj.assist;
  57299. if (assist) {
  57300. const assistTitle = assist[_xfa_object.$toHTML]();
  57301. if (assistTitle) {
  57302. attributes.title = assistTitle;
  57303. }
  57304. const role = assist.role;
  57305. const match = role.match(HEADING_PATTERN);
  57306. if (match) {
  57307. const ariaRole = "heading";
  57308. const ariaLevel = match[1];
  57309. attributes.role = ariaRole;
  57310. attributes["aria-level"] = ariaLevel;
  57311. }
  57312. }
  57313. if (obj.layout === "table") {
  57314. attributes.role = "table";
  57315. } else if (obj.layout === "row") {
  57316. attributes.role = "row";
  57317. } else {
  57318. const parent = obj[_xfa_object.$getParent]();
  57319. if (parent.layout === "row") {
  57320. if (parent.assist && parent.assist.role === "TH") {
  57321. attributes.role = "columnheader";
  57322. } else {
  57323. attributes.role = "cell";
  57324. }
  57325. }
  57326. }
  57327. }
  57328. function ariaLabel(obj) {
  57329. if (!obj.assist) {
  57330. return null;
  57331. }
  57332. const assist = obj.assist;
  57333. if (assist.speak && assist.speak[_xfa_object.$content] !== "") {
  57334. return assist.speak[_xfa_object.$content];
  57335. }
  57336. if (assist.toolTip) {
  57337. return assist.toolTip[_xfa_object.$content];
  57338. }
  57339. return null;
  57340. }
  57341. function valueToHtml(value) {
  57342. return _utils.HTMLResult.success({
  57343. name: "div",
  57344. attributes: {
  57345. class: ["xfaRich"],
  57346. style: Object.create(null)
  57347. },
  57348. children: [{
  57349. name: "span",
  57350. attributes: {
  57351. style: Object.create(null)
  57352. },
  57353. value
  57354. }]
  57355. });
  57356. }
  57357. function setFirstUnsplittable(node) {
  57358. const root = node[_xfa_object.$getTemplateRoot]();
  57359. if (root[_xfa_object.$extra].firstUnsplittable === null) {
  57360. root[_xfa_object.$extra].firstUnsplittable = node;
  57361. root[_xfa_object.$extra].noLayoutFailure = true;
  57362. }
  57363. }
  57364. function unsetFirstUnsplittable(node) {
  57365. const root = node[_xfa_object.$getTemplateRoot]();
  57366. if (root[_xfa_object.$extra].firstUnsplittable === node) {
  57367. root[_xfa_object.$extra].noLayoutFailure = false;
  57368. }
  57369. }
  57370. function handleBreak(node) {
  57371. if (node[_xfa_object.$extra]) {
  57372. return false;
  57373. }
  57374. node[_xfa_object.$extra] = Object.create(null);
  57375. if (node.targetType === "auto") {
  57376. return false;
  57377. }
  57378. const root = node[_xfa_object.$getTemplateRoot]();
  57379. let target = null;
  57380. if (node.target) {
  57381. target = root[_xfa_object.$searchNode](node.target, node[_xfa_object.$getParent]());
  57382. if (!target) {
  57383. return false;
  57384. }
  57385. target = target[0];
  57386. }
  57387. const {
  57388. currentPageArea,
  57389. currentContentArea
  57390. } = root[_xfa_object.$extra];
  57391. if (node.targetType === "pageArea") {
  57392. if (!(target instanceof PageArea)) {
  57393. target = null;
  57394. }
  57395. if (node.startNew) {
  57396. node[_xfa_object.$extra].target = target || currentPageArea;
  57397. return true;
  57398. } else if (target && target !== currentPageArea) {
  57399. node[_xfa_object.$extra].target = target;
  57400. return true;
  57401. }
  57402. return false;
  57403. }
  57404. if (!(target instanceof ContentArea)) {
  57405. target = null;
  57406. }
  57407. const pageArea = target && target[_xfa_object.$getParent]();
  57408. let index;
  57409. let nextPageArea = pageArea;
  57410. if (node.startNew) {
  57411. if (target) {
  57412. const contentAreas = pageArea.contentArea.children;
  57413. const indexForCurrent = contentAreas.indexOf(currentContentArea);
  57414. const indexForTarget = contentAreas.indexOf(target);
  57415. if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) {
  57416. nextPageArea = null;
  57417. }
  57418. index = indexForTarget - 1;
  57419. } else {
  57420. index = currentPageArea.contentArea.children.indexOf(currentContentArea);
  57421. }
  57422. } else if (target && target !== currentContentArea) {
  57423. const contentAreas = pageArea.contentArea.children;
  57424. index = contentAreas.indexOf(target) - 1;
  57425. nextPageArea = pageArea === currentPageArea ? null : pageArea;
  57426. } else {
  57427. return false;
  57428. }
  57429. node[_xfa_object.$extra].target = nextPageArea;
  57430. node[_xfa_object.$extra].index = index;
  57431. return true;
  57432. }
  57433. function handleOverflow(node, extraNode, space) {
  57434. const root = node[_xfa_object.$getTemplateRoot]();
  57435. const saved = root[_xfa_object.$extra].noLayoutFailure;
  57436. const savedMethod = extraNode[_xfa_object.$getSubformParent];
  57437. extraNode[_xfa_object.$getSubformParent] = () => node;
  57438. root[_xfa_object.$extra].noLayoutFailure = true;
  57439. const res = extraNode[_xfa_object.$toHTML](space);
  57440. node[_xfa_object.$addHTML](res.html, res.bbox);
  57441. root[_xfa_object.$extra].noLayoutFailure = saved;
  57442. extraNode[_xfa_object.$getSubformParent] = savedMethod;
  57443. }
  57444. class AppearanceFilter extends _xfa_object.StringObject {
  57445. constructor(attributes) {
  57446. super(TEMPLATE_NS_ID, "appearanceFilter");
  57447. this.id = attributes.id || "";
  57448. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  57449. this.use = attributes.use || "";
  57450. this.usehref = attributes.usehref || "";
  57451. }
  57452. }
  57453. class Arc extends _xfa_object.XFAObject {
  57454. constructor(attributes) {
  57455. super(TEMPLATE_NS_ID, "arc", true);
  57456. this.circular = (0, _utils.getInteger)({
  57457. data: attributes.circular,
  57458. defaultValue: 0,
  57459. validate: x => x === 1
  57460. });
  57461. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  57462. this.id = attributes.id || "";
  57463. this.startAngle = (0, _utils.getFloat)({
  57464. data: attributes.startAngle,
  57465. defaultValue: 0,
  57466. validate: x => true
  57467. });
  57468. this.sweepAngle = (0, _utils.getFloat)({
  57469. data: attributes.sweepAngle,
  57470. defaultValue: 360,
  57471. validate: x => true
  57472. });
  57473. this.use = attributes.use || "";
  57474. this.usehref = attributes.usehref || "";
  57475. this.edge = null;
  57476. this.fill = null;
  57477. }
  57478. [_xfa_object.$toHTML]() {
  57479. const edge = this.edge || new Edge({});
  57480. const edgeStyle = edge[_xfa_object.$toStyle]();
  57481. const style = Object.create(null);
  57482. if (this.fill && this.fill.presence === "visible") {
  57483. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  57484. } else {
  57485. style.fill = "transparent";
  57486. }
  57487. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  57488. style.stroke = edgeStyle.color;
  57489. let arc;
  57490. const attributes = {
  57491. xmlns: SVG_NS,
  57492. style: {
  57493. width: "100%",
  57494. height: "100%",
  57495. overflow: "visible"
  57496. }
  57497. };
  57498. if (this.sweepAngle === 360) {
  57499. arc = {
  57500. name: "ellipse",
  57501. attributes: {
  57502. xmlns: SVG_NS,
  57503. cx: "50%",
  57504. cy: "50%",
  57505. rx: "50%",
  57506. ry: "50%",
  57507. style
  57508. }
  57509. };
  57510. } else {
  57511. const startAngle = this.startAngle * Math.PI / 180;
  57512. const sweepAngle = this.sweepAngle * Math.PI / 180;
  57513. const largeArc = this.sweepAngle > 180 ? 1 : 0;
  57514. 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))];
  57515. arc = {
  57516. name: "path",
  57517. attributes: {
  57518. xmlns: SVG_NS,
  57519. d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`,
  57520. vectorEffect: "non-scaling-stroke",
  57521. style
  57522. }
  57523. };
  57524. Object.assign(attributes, {
  57525. viewBox: "0 0 100 100",
  57526. preserveAspectRatio: "none"
  57527. });
  57528. }
  57529. const svg = {
  57530. name: "svg",
  57531. children: [arc],
  57532. attributes
  57533. };
  57534. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  57535. if (hasMargin(parent)) {
  57536. return _utils.HTMLResult.success({
  57537. name: "div",
  57538. attributes: {
  57539. style: {
  57540. display: "inline",
  57541. width: "100%",
  57542. height: "100%"
  57543. }
  57544. },
  57545. children: [svg]
  57546. });
  57547. }
  57548. svg.attributes.style.position = "absolute";
  57549. return _utils.HTMLResult.success(svg);
  57550. }
  57551. }
  57552. class Area extends _xfa_object.XFAObject {
  57553. constructor(attributes) {
  57554. super(TEMPLATE_NS_ID, "area", true);
  57555. this.colSpan = (0, _utils.getInteger)({
  57556. data: attributes.colSpan,
  57557. defaultValue: 1,
  57558. validate: n => n >= 1 || n === -1
  57559. });
  57560. this.id = attributes.id || "";
  57561. this.name = attributes.name || "";
  57562. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  57563. this.use = attributes.use || "";
  57564. this.usehref = attributes.usehref || "";
  57565. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  57566. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  57567. this.desc = null;
  57568. this.extras = null;
  57569. this.area = new _xfa_object.XFAObjectArray();
  57570. this.draw = new _xfa_object.XFAObjectArray();
  57571. this.exObject = new _xfa_object.XFAObjectArray();
  57572. this.exclGroup = new _xfa_object.XFAObjectArray();
  57573. this.field = new _xfa_object.XFAObjectArray();
  57574. this.subform = new _xfa_object.XFAObjectArray();
  57575. this.subformSet = new _xfa_object.XFAObjectArray();
  57576. }
  57577. *[_xfa_object.$getContainedChildren]() {
  57578. yield* getContainedChildren(this);
  57579. }
  57580. [_xfa_object.$isTransparent]() {
  57581. return true;
  57582. }
  57583. [_xfa_object.$isBindable]() {
  57584. return true;
  57585. }
  57586. [_xfa_object.$addHTML](html, bbox) {
  57587. const [x, y, w, h] = bbox;
  57588. this[_xfa_object.$extra].width = Math.max(this[_xfa_object.$extra].width, x + w);
  57589. this[_xfa_object.$extra].height = Math.max(this[_xfa_object.$extra].height, y + h);
  57590. this[_xfa_object.$extra].children.push(html);
  57591. }
  57592. [_xfa_object.$getAvailableSpace]() {
  57593. return this[_xfa_object.$extra].availableSpace;
  57594. }
  57595. [_xfa_object.$toHTML](availableSpace) {
  57596. const style = (0, _html_utils.toStyle)(this, "position");
  57597. const attributes = {
  57598. style,
  57599. id: this[_xfa_object.$uid],
  57600. class: ["xfaArea"]
  57601. };
  57602. if ((0, _html_utils.isPrintOnly)(this)) {
  57603. attributes.class.push("xfaPrintOnly");
  57604. }
  57605. if (this.name) {
  57606. attributes.xfaName = this.name;
  57607. }
  57608. const children = [];
  57609. this[_xfa_object.$extra] = {
  57610. children,
  57611. width: 0,
  57612. height: 0,
  57613. availableSpace
  57614. };
  57615. const result = this[_xfa_object.$childrenToHTML]({
  57616. filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]),
  57617. include: true
  57618. });
  57619. if (!result.success) {
  57620. if (result.isBreak()) {
  57621. return result;
  57622. }
  57623. delete this[_xfa_object.$extra];
  57624. return _utils.HTMLResult.FAILURE;
  57625. }
  57626. style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width);
  57627. style.height = (0, _html_utils.measureToString)(this[_xfa_object.$extra].height);
  57628. const html = {
  57629. name: "div",
  57630. attributes,
  57631. children
  57632. };
  57633. const bbox = [this.x, this.y, this[_xfa_object.$extra].width, this[_xfa_object.$extra].height];
  57634. delete this[_xfa_object.$extra];
  57635. return _utils.HTMLResult.success(html, bbox);
  57636. }
  57637. }
  57638. class Assist extends _xfa_object.XFAObject {
  57639. constructor(attributes) {
  57640. super(TEMPLATE_NS_ID, "assist", true);
  57641. this.id = attributes.id || "";
  57642. this.role = attributes.role || "";
  57643. this.use = attributes.use || "";
  57644. this.usehref = attributes.usehref || "";
  57645. this.speak = null;
  57646. this.toolTip = null;
  57647. }
  57648. [_xfa_object.$toHTML]() {
  57649. return this.toolTip && this.toolTip[_xfa_object.$content] ? this.toolTip[_xfa_object.$content] : null;
  57650. }
  57651. }
  57652. class Barcode extends _xfa_object.XFAObject {
  57653. constructor(attributes) {
  57654. super(TEMPLATE_NS_ID, "barcode", true);
  57655. this.charEncoding = (0, _utils.getKeyword)({
  57656. data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "",
  57657. defaultValue: "",
  57658. 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}/)
  57659. });
  57660. this.checksum = (0, _utils.getStringOption)(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]);
  57661. this.dataColumnCount = (0, _utils.getInteger)({
  57662. data: attributes.dataColumnCount,
  57663. defaultValue: -1,
  57664. validate: x => x >= 0
  57665. });
  57666. this.dataLength = (0, _utils.getInteger)({
  57667. data: attributes.dataLength,
  57668. defaultValue: -1,
  57669. validate: x => x >= 0
  57670. });
  57671. this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, ["none", "flateCompress"]);
  57672. this.dataRowCount = (0, _utils.getInteger)({
  57673. data: attributes.dataRowCount,
  57674. defaultValue: -1,
  57675. validate: x => x >= 0
  57676. });
  57677. this.endChar = attributes.endChar || "";
  57678. this.errorCorrectionLevel = (0, _utils.getInteger)({
  57679. data: attributes.errorCorrectionLevel,
  57680. defaultValue: -1,
  57681. validate: x => x >= 0 && x <= 8
  57682. });
  57683. this.id = attributes.id || "";
  57684. this.moduleHeight = (0, _utils.getMeasurement)(attributes.moduleHeight, "5mm");
  57685. this.moduleWidth = (0, _utils.getMeasurement)(attributes.moduleWidth, "0.25mm");
  57686. this.printCheckDigit = (0, _utils.getInteger)({
  57687. data: attributes.printCheckDigit,
  57688. defaultValue: 0,
  57689. validate: x => x === 1
  57690. });
  57691. this.rowColumnRatio = (0, _utils.getRatio)(attributes.rowColumnRatio);
  57692. this.startChar = attributes.startChar || "";
  57693. this.textLocation = (0, _utils.getStringOption)(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]);
  57694. this.truncate = (0, _utils.getInteger)({
  57695. data: attributes.truncate,
  57696. defaultValue: 0,
  57697. validate: x => x === 1
  57698. });
  57699. 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"]);
  57700. this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]);
  57701. this.use = attributes.use || "";
  57702. this.usehref = attributes.usehref || "";
  57703. this.wideNarrowRatio = (0, _utils.getRatio)(attributes.wideNarrowRatio);
  57704. this.encrypt = null;
  57705. this.extras = null;
  57706. }
  57707. }
  57708. class Bind extends _xfa_object.XFAObject {
  57709. constructor(attributes) {
  57710. super(TEMPLATE_NS_ID, "bind", true);
  57711. this.match = (0, _utils.getStringOption)(attributes.match, ["once", "dataRef", "global", "none"]);
  57712. this.ref = attributes.ref || "";
  57713. this.picture = null;
  57714. }
  57715. }
  57716. class BindItems extends _xfa_object.XFAObject {
  57717. constructor(attributes) {
  57718. super(TEMPLATE_NS_ID, "bindItems");
  57719. this.connection = attributes.connection || "";
  57720. this.labelRef = attributes.labelRef || "";
  57721. this.ref = attributes.ref || "";
  57722. this.valueRef = attributes.valueRef || "";
  57723. }
  57724. }
  57725. exports.BindItems = BindItems;
  57726. class Bookend extends _xfa_object.XFAObject {
  57727. constructor(attributes) {
  57728. super(TEMPLATE_NS_ID, "bookend");
  57729. this.id = attributes.id || "";
  57730. this.leader = attributes.leader || "";
  57731. this.trailer = attributes.trailer || "";
  57732. this.use = attributes.use || "";
  57733. this.usehref = attributes.usehref || "";
  57734. }
  57735. }
  57736. class BooleanElement extends _xfa_object.Option01 {
  57737. constructor(attributes) {
  57738. super(TEMPLATE_NS_ID, "boolean");
  57739. this.id = attributes.id || "";
  57740. this.name = attributes.name || "";
  57741. this.use = attributes.use || "";
  57742. this.usehref = attributes.usehref || "";
  57743. }
  57744. [_xfa_object.$toHTML](availableSpace) {
  57745. return valueToHtml(this[_xfa_object.$content] === 1 ? "1" : "0");
  57746. }
  57747. }
  57748. class Border extends _xfa_object.XFAObject {
  57749. constructor(attributes) {
  57750. super(TEMPLATE_NS_ID, "border", true);
  57751. this.break = (0, _utils.getStringOption)(attributes.break, ["close", "open"]);
  57752. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  57753. this.id = attributes.id || "";
  57754. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  57755. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  57756. this.use = attributes.use || "";
  57757. this.usehref = attributes.usehref || "";
  57758. this.corner = new _xfa_object.XFAObjectArray(4);
  57759. this.edge = new _xfa_object.XFAObjectArray(4);
  57760. this.extras = null;
  57761. this.fill = null;
  57762. this.margin = null;
  57763. }
  57764. [_xfa_object.$getExtra]() {
  57765. if (!this[_xfa_object.$extra]) {
  57766. const edges = this.edge.children.slice();
  57767. if (edges.length < 4) {
  57768. const defaultEdge = edges.at(-1) || new Edge({});
  57769. for (let i = edges.length; i < 4; i++) {
  57770. edges.push(defaultEdge);
  57771. }
  57772. }
  57773. const widths = edges.map(edge => edge.thickness);
  57774. const insets = [0, 0, 0, 0];
  57775. if (this.margin) {
  57776. insets[0] = this.margin.topInset;
  57777. insets[1] = this.margin.rightInset;
  57778. insets[2] = this.margin.bottomInset;
  57779. insets[3] = this.margin.leftInset;
  57780. }
  57781. this[_xfa_object.$extra] = {
  57782. widths,
  57783. insets,
  57784. edges
  57785. };
  57786. }
  57787. return this[_xfa_object.$extra];
  57788. }
  57789. [_xfa_object.$toStyle]() {
  57790. const {
  57791. edges
  57792. } = this[_xfa_object.$getExtra]();
  57793. const edgeStyles = edges.map(node => {
  57794. const style = node[_xfa_object.$toStyle]();
  57795. style.color = style.color || "#000000";
  57796. return style;
  57797. });
  57798. const style = Object.create(null);
  57799. if (this.margin) {
  57800. Object.assign(style, this.margin[_xfa_object.$toStyle]());
  57801. }
  57802. if (this.fill && this.fill.presence === "visible") {
  57803. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  57804. }
  57805. if (this.corner.children.some(node => node.radius !== 0)) {
  57806. const cornerStyles = this.corner.children.map(node => node[_xfa_object.$toStyle]());
  57807. if (cornerStyles.length === 2 || cornerStyles.length === 3) {
  57808. const last = cornerStyles.at(-1);
  57809. for (let i = cornerStyles.length; i < 4; i++) {
  57810. cornerStyles.push(last);
  57811. }
  57812. }
  57813. style.borderRadius = cornerStyles.map(s => s.radius).join(" ");
  57814. }
  57815. switch (this.presence) {
  57816. case "invisible":
  57817. case "hidden":
  57818. style.borderStyle = "";
  57819. break;
  57820. case "inactive":
  57821. style.borderStyle = "none";
  57822. break;
  57823. default:
  57824. style.borderStyle = edgeStyles.map(s => s.style).join(" ");
  57825. break;
  57826. }
  57827. style.borderWidth = edgeStyles.map(s => s.width).join(" ");
  57828. style.borderColor = edgeStyles.map(s => s.color).join(" ");
  57829. return style;
  57830. }
  57831. }
  57832. class Break extends _xfa_object.XFAObject {
  57833. constructor(attributes) {
  57834. super(TEMPLATE_NS_ID, "break", true);
  57835. this.after = (0, _utils.getStringOption)(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  57836. this.afterTarget = attributes.afterTarget || "";
  57837. this.before = (0, _utils.getStringOption)(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  57838. this.beforeTarget = attributes.beforeTarget || "";
  57839. this.bookendLeader = attributes.bookendLeader || "";
  57840. this.bookendTrailer = attributes.bookendTrailer || "";
  57841. this.id = attributes.id || "";
  57842. this.overflowLeader = attributes.overflowLeader || "";
  57843. this.overflowTarget = attributes.overflowTarget || "";
  57844. this.overflowTrailer = attributes.overflowTrailer || "";
  57845. this.startNew = (0, _utils.getInteger)({
  57846. data: attributes.startNew,
  57847. defaultValue: 0,
  57848. validate: x => x === 1
  57849. });
  57850. this.use = attributes.use || "";
  57851. this.usehref = attributes.usehref || "";
  57852. this.extras = null;
  57853. }
  57854. }
  57855. class BreakAfter extends _xfa_object.XFAObject {
  57856. constructor(attributes) {
  57857. super(TEMPLATE_NS_ID, "breakAfter", true);
  57858. this.id = attributes.id || "";
  57859. this.leader = attributes.leader || "";
  57860. this.startNew = (0, _utils.getInteger)({
  57861. data: attributes.startNew,
  57862. defaultValue: 0,
  57863. validate: x => x === 1
  57864. });
  57865. this.target = attributes.target || "";
  57866. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  57867. this.trailer = attributes.trailer || "";
  57868. this.use = attributes.use || "";
  57869. this.usehref = attributes.usehref || "";
  57870. this.script = null;
  57871. }
  57872. }
  57873. class BreakBefore extends _xfa_object.XFAObject {
  57874. constructor(attributes) {
  57875. super(TEMPLATE_NS_ID, "breakBefore", true);
  57876. this.id = attributes.id || "";
  57877. this.leader = attributes.leader || "";
  57878. this.startNew = (0, _utils.getInteger)({
  57879. data: attributes.startNew,
  57880. defaultValue: 0,
  57881. validate: x => x === 1
  57882. });
  57883. this.target = attributes.target || "";
  57884. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  57885. this.trailer = attributes.trailer || "";
  57886. this.use = attributes.use || "";
  57887. this.usehref = attributes.usehref || "";
  57888. this.script = null;
  57889. }
  57890. [_xfa_object.$toHTML](availableSpace) {
  57891. this[_xfa_object.$extra] = {};
  57892. return _utils.HTMLResult.FAILURE;
  57893. }
  57894. }
  57895. class Button extends _xfa_object.XFAObject {
  57896. constructor(attributes) {
  57897. super(TEMPLATE_NS_ID, "button", true);
  57898. this.highlight = (0, _utils.getStringOption)(attributes.highlight, ["inverted", "none", "outline", "push"]);
  57899. this.id = attributes.id || "";
  57900. this.use = attributes.use || "";
  57901. this.usehref = attributes.usehref || "";
  57902. this.extras = null;
  57903. }
  57904. [_xfa_object.$toHTML](availableSpace) {
  57905. const parent = this[_xfa_object.$getParent]();
  57906. const grandpa = parent[_xfa_object.$getParent]();
  57907. const htmlButton = {
  57908. name: "button",
  57909. attributes: {
  57910. id: this[_xfa_object.$uid],
  57911. class: ["xfaButton"],
  57912. style: {}
  57913. },
  57914. children: []
  57915. };
  57916. for (const event of grandpa.event.children) {
  57917. if (event.activity !== "click" || !event.script) {
  57918. continue;
  57919. }
  57920. const jsURL = (0, _core_utils.recoverJsURL)(event.script[_xfa_object.$content]);
  57921. if (!jsURL) {
  57922. continue;
  57923. }
  57924. const href = (0, _html_utils.fixURL)(jsURL.url);
  57925. if (!href) {
  57926. continue;
  57927. }
  57928. htmlButton.children.push({
  57929. name: "a",
  57930. attributes: {
  57931. id: "link" + this[_xfa_object.$uid],
  57932. href,
  57933. newWindow: jsURL.newWindow,
  57934. class: ["xfaLink"],
  57935. style: {}
  57936. },
  57937. children: []
  57938. });
  57939. }
  57940. return _utils.HTMLResult.success(htmlButton);
  57941. }
  57942. }
  57943. class Calculate extends _xfa_object.XFAObject {
  57944. constructor(attributes) {
  57945. super(TEMPLATE_NS_ID, "calculate", true);
  57946. this.id = attributes.id || "";
  57947. this.override = (0, _utils.getStringOption)(attributes.override, ["disabled", "error", "ignore", "warning"]);
  57948. this.use = attributes.use || "";
  57949. this.usehref = attributes.usehref || "";
  57950. this.extras = null;
  57951. this.message = null;
  57952. this.script = null;
  57953. }
  57954. }
  57955. class Caption extends _xfa_object.XFAObject {
  57956. constructor(attributes) {
  57957. super(TEMPLATE_NS_ID, "caption", true);
  57958. this.id = attributes.id || "";
  57959. this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]);
  57960. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  57961. this.reserve = Math.ceil((0, _utils.getMeasurement)(attributes.reserve));
  57962. this.use = attributes.use || "";
  57963. this.usehref = attributes.usehref || "";
  57964. this.extras = null;
  57965. this.font = null;
  57966. this.margin = null;
  57967. this.para = null;
  57968. this.value = null;
  57969. }
  57970. [_xfa_object.$setValue](value) {
  57971. _setValue(this, value);
  57972. }
  57973. [_xfa_object.$getExtra](availableSpace) {
  57974. if (!this[_xfa_object.$extra]) {
  57975. let {
  57976. width,
  57977. height
  57978. } = availableSpace;
  57979. switch (this.placement) {
  57980. case "left":
  57981. case "right":
  57982. case "inline":
  57983. width = this.reserve <= 0 ? width : this.reserve;
  57984. break;
  57985. case "top":
  57986. case "bottom":
  57987. height = this.reserve <= 0 ? height : this.reserve;
  57988. break;
  57989. }
  57990. this[_xfa_object.$extra] = (0, _html_utils.layoutNode)(this, {
  57991. width,
  57992. height
  57993. });
  57994. }
  57995. return this[_xfa_object.$extra];
  57996. }
  57997. [_xfa_object.$toHTML](availableSpace) {
  57998. if (!this.value) {
  57999. return _utils.HTMLResult.EMPTY;
  58000. }
  58001. this[_xfa_object.$pushPara]();
  58002. const value = this.value[_xfa_object.$toHTML](availableSpace).html;
  58003. if (!value) {
  58004. this[_xfa_object.$popPara]();
  58005. return _utils.HTMLResult.EMPTY;
  58006. }
  58007. const savedReserve = this.reserve;
  58008. if (this.reserve <= 0) {
  58009. const {
  58010. w,
  58011. h
  58012. } = this[_xfa_object.$getExtra](availableSpace);
  58013. switch (this.placement) {
  58014. case "left":
  58015. case "right":
  58016. case "inline":
  58017. this.reserve = w;
  58018. break;
  58019. case "top":
  58020. case "bottom":
  58021. this.reserve = h;
  58022. break;
  58023. }
  58024. }
  58025. const children = [];
  58026. if (typeof value === "string") {
  58027. children.push({
  58028. name: "#text",
  58029. value
  58030. });
  58031. } else {
  58032. children.push(value);
  58033. }
  58034. const style = (0, _html_utils.toStyle)(this, "font", "margin", "visibility");
  58035. switch (this.placement) {
  58036. case "left":
  58037. case "right":
  58038. if (this.reserve > 0) {
  58039. style.width = (0, _html_utils.measureToString)(this.reserve);
  58040. }
  58041. break;
  58042. case "top":
  58043. case "bottom":
  58044. if (this.reserve > 0) {
  58045. style.height = (0, _html_utils.measureToString)(this.reserve);
  58046. }
  58047. break;
  58048. }
  58049. (0, _html_utils.setPara)(this, null, value);
  58050. this[_xfa_object.$popPara]();
  58051. this.reserve = savedReserve;
  58052. return _utils.HTMLResult.success({
  58053. name: "div",
  58054. attributes: {
  58055. style,
  58056. class: ["xfaCaption"]
  58057. },
  58058. children
  58059. });
  58060. }
  58061. }
  58062. class Certificate extends _xfa_object.StringObject {
  58063. constructor(attributes) {
  58064. super(TEMPLATE_NS_ID, "certificate");
  58065. this.id = attributes.id || "";
  58066. this.name = attributes.name || "";
  58067. this.use = attributes.use || "";
  58068. this.usehref = attributes.usehref || "";
  58069. }
  58070. }
  58071. class Certificates extends _xfa_object.XFAObject {
  58072. constructor(attributes) {
  58073. super(TEMPLATE_NS_ID, "certificates", true);
  58074. this.credentialServerPolicy = (0, _utils.getStringOption)(attributes.credentialServerPolicy, ["optional", "required"]);
  58075. this.id = attributes.id || "";
  58076. this.url = attributes.url || "";
  58077. this.urlPolicy = attributes.urlPolicy || "";
  58078. this.use = attributes.use || "";
  58079. this.usehref = attributes.usehref || "";
  58080. this.encryption = null;
  58081. this.issuers = null;
  58082. this.keyUsage = null;
  58083. this.oids = null;
  58084. this.signing = null;
  58085. this.subjectDNs = null;
  58086. }
  58087. }
  58088. class CheckButton extends _xfa_object.XFAObject {
  58089. constructor(attributes) {
  58090. super(TEMPLATE_NS_ID, "checkButton", true);
  58091. this.id = attributes.id || "";
  58092. this.mark = (0, _utils.getStringOption)(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]);
  58093. this.shape = (0, _utils.getStringOption)(attributes.shape, ["square", "round"]);
  58094. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  58095. this.use = attributes.use || "";
  58096. this.usehref = attributes.usehref || "";
  58097. this.border = null;
  58098. this.extras = null;
  58099. this.margin = null;
  58100. }
  58101. [_xfa_object.$toHTML](availableSpace) {
  58102. const style = (0, _html_utils.toStyle)("margin");
  58103. const size = (0, _html_utils.measureToString)(this.size);
  58104. style.width = style.height = size;
  58105. let type;
  58106. let className;
  58107. let groupId;
  58108. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  58109. const items = field.items.children.length && field.items.children[0][_xfa_object.$toHTML]().html || [];
  58110. const exportedValue = {
  58111. on: (items[0] !== undefined ? items[0] : "on").toString(),
  58112. off: (items[1] !== undefined ? items[1] : "off").toString()
  58113. };
  58114. const value = field.value && field.value[_xfa_object.$text]() || "off";
  58115. const checked = value === exportedValue.on || undefined;
  58116. const container = field[_xfa_object.$getSubformParent]();
  58117. const fieldId = field[_xfa_object.$uid];
  58118. let dataId;
  58119. if (container instanceof ExclGroup) {
  58120. groupId = container[_xfa_object.$uid];
  58121. type = "radio";
  58122. className = "xfaRadio";
  58123. dataId = container[_xfa_object.$data] && container[_xfa_object.$data][_xfa_object.$uid] || container[_xfa_object.$uid];
  58124. } else {
  58125. type = "checkbox";
  58126. className = "xfaCheckbox";
  58127. dataId = field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid];
  58128. }
  58129. const input = {
  58130. name: "input",
  58131. attributes: {
  58132. class: [className],
  58133. style,
  58134. fieldId,
  58135. dataId,
  58136. type,
  58137. checked,
  58138. xfaOn: exportedValue.on,
  58139. xfaOff: exportedValue.off,
  58140. "aria-label": ariaLabel(field),
  58141. "aria-required": false
  58142. }
  58143. };
  58144. if (groupId) {
  58145. input.attributes.name = groupId;
  58146. }
  58147. if (isRequired(field)) {
  58148. input.attributes["aria-required"] = true;
  58149. input.attributes.required = true;
  58150. }
  58151. return _utils.HTMLResult.success({
  58152. name: "label",
  58153. attributes: {
  58154. class: ["xfaLabel"]
  58155. },
  58156. children: [input]
  58157. });
  58158. }
  58159. }
  58160. class ChoiceList extends _xfa_object.XFAObject {
  58161. constructor(attributes) {
  58162. super(TEMPLATE_NS_ID, "choiceList", true);
  58163. this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, ["select", "exit"]);
  58164. this.id = attributes.id || "";
  58165. this.open = (0, _utils.getStringOption)(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]);
  58166. this.textEntry = (0, _utils.getInteger)({
  58167. data: attributes.textEntry,
  58168. defaultValue: 0,
  58169. validate: x => x === 1
  58170. });
  58171. this.use = attributes.use || "";
  58172. this.usehref = attributes.usehref || "";
  58173. this.border = null;
  58174. this.extras = null;
  58175. this.margin = null;
  58176. }
  58177. [_xfa_object.$toHTML](availableSpace) {
  58178. const style = (0, _html_utils.toStyle)(this, "border", "margin");
  58179. const ui = this[_xfa_object.$getParent]();
  58180. const field = ui[_xfa_object.$getParent]();
  58181. const fontSize = field.font && field.font.size || 10;
  58182. const optionStyle = {
  58183. fontSize: `calc(${fontSize}px * var(--scale-factor))`
  58184. };
  58185. const children = [];
  58186. if (field.items.children.length > 0) {
  58187. const items = field.items;
  58188. let displayedIndex = 0;
  58189. let saveIndex = 0;
  58190. if (items.children.length === 2) {
  58191. displayedIndex = items.children[0].save;
  58192. saveIndex = 1 - displayedIndex;
  58193. }
  58194. const displayed = items.children[displayedIndex][_xfa_object.$toHTML]().html;
  58195. const values = items.children[saveIndex][_xfa_object.$toHTML]().html;
  58196. let selected = false;
  58197. const value = field.value && field.value[_xfa_object.$text]() || "";
  58198. for (let i = 0, ii = displayed.length; i < ii; i++) {
  58199. const option = {
  58200. name: "option",
  58201. attributes: {
  58202. value: values[i] || displayed[i],
  58203. style: optionStyle
  58204. },
  58205. value: displayed[i]
  58206. };
  58207. if (values[i] === value) {
  58208. option.attributes.selected = selected = true;
  58209. }
  58210. children.push(option);
  58211. }
  58212. if (!selected) {
  58213. children.splice(0, 0, {
  58214. name: "option",
  58215. attributes: {
  58216. hidden: true,
  58217. selected: true
  58218. },
  58219. value: " "
  58220. });
  58221. }
  58222. }
  58223. const selectAttributes = {
  58224. class: ["xfaSelect"],
  58225. fieldId: field[_xfa_object.$uid],
  58226. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  58227. style,
  58228. "aria-label": ariaLabel(field),
  58229. "aria-required": false
  58230. };
  58231. if (isRequired(field)) {
  58232. selectAttributes["aria-required"] = true;
  58233. selectAttributes.required = true;
  58234. }
  58235. if (this.open === "multiSelect") {
  58236. selectAttributes.multiple = true;
  58237. }
  58238. return _utils.HTMLResult.success({
  58239. name: "label",
  58240. attributes: {
  58241. class: ["xfaLabel"]
  58242. },
  58243. children: [{
  58244. name: "select",
  58245. children,
  58246. attributes: selectAttributes
  58247. }]
  58248. });
  58249. }
  58250. }
  58251. class Color extends _xfa_object.XFAObject {
  58252. constructor(attributes) {
  58253. super(TEMPLATE_NS_ID, "color", true);
  58254. this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, ["SRGB"]);
  58255. this.id = attributes.id || "";
  58256. this.use = attributes.use || "";
  58257. this.usehref = attributes.usehref || "";
  58258. this.value = attributes.value ? (0, _utils.getColor)(attributes.value) : "";
  58259. this.extras = null;
  58260. }
  58261. [_xfa_object.$hasSettableValue]() {
  58262. return false;
  58263. }
  58264. [_xfa_object.$toStyle]() {
  58265. return this.value ? _util.Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null;
  58266. }
  58267. }
  58268. class Comb extends _xfa_object.XFAObject {
  58269. constructor(attributes) {
  58270. super(TEMPLATE_NS_ID, "comb");
  58271. this.id = attributes.id || "";
  58272. this.numberOfCells = (0, _utils.getInteger)({
  58273. data: attributes.numberOfCells,
  58274. defaultValue: 0,
  58275. validate: x => x >= 0
  58276. });
  58277. this.use = attributes.use || "";
  58278. this.usehref = attributes.usehref || "";
  58279. }
  58280. }
  58281. class Connect extends _xfa_object.XFAObject {
  58282. constructor(attributes) {
  58283. super(TEMPLATE_NS_ID, "connect", true);
  58284. this.connection = attributes.connection || "";
  58285. this.id = attributes.id || "";
  58286. this.ref = attributes.ref || "";
  58287. this.usage = (0, _utils.getStringOption)(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]);
  58288. this.use = attributes.use || "";
  58289. this.usehref = attributes.usehref || "";
  58290. this.picture = null;
  58291. }
  58292. }
  58293. class ContentArea extends _xfa_object.XFAObject {
  58294. constructor(attributes) {
  58295. super(TEMPLATE_NS_ID, "contentArea", true);
  58296. this.h = (0, _utils.getMeasurement)(attributes.h);
  58297. this.id = attributes.id || "";
  58298. this.name = attributes.name || "";
  58299. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  58300. this.use = attributes.use || "";
  58301. this.usehref = attributes.usehref || "";
  58302. this.w = (0, _utils.getMeasurement)(attributes.w);
  58303. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  58304. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  58305. this.desc = null;
  58306. this.extras = null;
  58307. }
  58308. [_xfa_object.$toHTML](availableSpace) {
  58309. const left = (0, _html_utils.measureToString)(this.x);
  58310. const top = (0, _html_utils.measureToString)(this.y);
  58311. const style = {
  58312. left,
  58313. top,
  58314. width: (0, _html_utils.measureToString)(this.w),
  58315. height: (0, _html_utils.measureToString)(this.h)
  58316. };
  58317. const classNames = ["xfaContentarea"];
  58318. if ((0, _html_utils.isPrintOnly)(this)) {
  58319. classNames.push("xfaPrintOnly");
  58320. }
  58321. return _utils.HTMLResult.success({
  58322. name: "div",
  58323. children: [],
  58324. attributes: {
  58325. style,
  58326. class: classNames,
  58327. id: this[_xfa_object.$uid]
  58328. }
  58329. });
  58330. }
  58331. }
  58332. class Corner extends _xfa_object.XFAObject {
  58333. constructor(attributes) {
  58334. super(TEMPLATE_NS_ID, "corner", true);
  58335. this.id = attributes.id || "";
  58336. this.inverted = (0, _utils.getInteger)({
  58337. data: attributes.inverted,
  58338. defaultValue: 0,
  58339. validate: x => x === 1
  58340. });
  58341. this.join = (0, _utils.getStringOption)(attributes.join, ["square", "round"]);
  58342. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  58343. this.radius = (0, _utils.getMeasurement)(attributes.radius);
  58344. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  58345. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  58346. this.use = attributes.use || "";
  58347. this.usehref = attributes.usehref || "";
  58348. this.color = null;
  58349. this.extras = null;
  58350. }
  58351. [_xfa_object.$toStyle]() {
  58352. const style = (0, _html_utils.toStyle)(this, "visibility");
  58353. style.radius = (0, _html_utils.measureToString)(this.join === "square" ? 0 : this.radius);
  58354. return style;
  58355. }
  58356. }
  58357. class DateElement extends _xfa_object.ContentObject {
  58358. constructor(attributes) {
  58359. super(TEMPLATE_NS_ID, "date");
  58360. this.id = attributes.id || "";
  58361. this.name = attributes.name || "";
  58362. this.use = attributes.use || "";
  58363. this.usehref = attributes.usehref || "";
  58364. }
  58365. [_xfa_object.$finalize]() {
  58366. const date = this[_xfa_object.$content].trim();
  58367. this[_xfa_object.$content] = date ? new Date(date) : null;
  58368. }
  58369. [_xfa_object.$toHTML](availableSpace) {
  58370. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  58371. }
  58372. }
  58373. class DateTime extends _xfa_object.ContentObject {
  58374. constructor(attributes) {
  58375. super(TEMPLATE_NS_ID, "dateTime");
  58376. this.id = attributes.id || "";
  58377. this.name = attributes.name || "";
  58378. this.use = attributes.use || "";
  58379. this.usehref = attributes.usehref || "";
  58380. }
  58381. [_xfa_object.$finalize]() {
  58382. const date = this[_xfa_object.$content].trim();
  58383. this[_xfa_object.$content] = date ? new Date(date) : null;
  58384. }
  58385. [_xfa_object.$toHTML](availableSpace) {
  58386. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  58387. }
  58388. }
  58389. class DateTimeEdit extends _xfa_object.XFAObject {
  58390. constructor(attributes) {
  58391. super(TEMPLATE_NS_ID, "dateTimeEdit", true);
  58392. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  58393. this.id = attributes.id || "";
  58394. this.picker = (0, _utils.getStringOption)(attributes.picker, ["host", "none"]);
  58395. this.use = attributes.use || "";
  58396. this.usehref = attributes.usehref || "";
  58397. this.border = null;
  58398. this.comb = null;
  58399. this.extras = null;
  58400. this.margin = null;
  58401. }
  58402. [_xfa_object.$toHTML](availableSpace) {
  58403. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  58404. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  58405. const html = {
  58406. name: "input",
  58407. attributes: {
  58408. type: "text",
  58409. fieldId: field[_xfa_object.$uid],
  58410. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  58411. class: ["xfaTextfield"],
  58412. style,
  58413. "aria-label": ariaLabel(field),
  58414. "aria-required": false
  58415. }
  58416. };
  58417. if (isRequired(field)) {
  58418. html.attributes["aria-required"] = true;
  58419. html.attributes.required = true;
  58420. }
  58421. return _utils.HTMLResult.success({
  58422. name: "label",
  58423. attributes: {
  58424. class: ["xfaLabel"]
  58425. },
  58426. children: [html]
  58427. });
  58428. }
  58429. }
  58430. class Decimal extends _xfa_object.ContentObject {
  58431. constructor(attributes) {
  58432. super(TEMPLATE_NS_ID, "decimal");
  58433. this.fracDigits = (0, _utils.getInteger)({
  58434. data: attributes.fracDigits,
  58435. defaultValue: 2,
  58436. validate: x => true
  58437. });
  58438. this.id = attributes.id || "";
  58439. this.leadDigits = (0, _utils.getInteger)({
  58440. data: attributes.leadDigits,
  58441. defaultValue: -1,
  58442. validate: x => true
  58443. });
  58444. this.name = attributes.name || "";
  58445. this.use = attributes.use || "";
  58446. this.usehref = attributes.usehref || "";
  58447. }
  58448. [_xfa_object.$finalize]() {
  58449. const number = parseFloat(this[_xfa_object.$content].trim());
  58450. this[_xfa_object.$content] = isNaN(number) ? null : number;
  58451. }
  58452. [_xfa_object.$toHTML](availableSpace) {
  58453. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  58454. }
  58455. }
  58456. class DefaultUi extends _xfa_object.XFAObject {
  58457. constructor(attributes) {
  58458. super(TEMPLATE_NS_ID, "defaultUi", true);
  58459. this.id = attributes.id || "";
  58460. this.use = attributes.use || "";
  58461. this.usehref = attributes.usehref || "";
  58462. this.extras = null;
  58463. }
  58464. }
  58465. class Desc extends _xfa_object.XFAObject {
  58466. constructor(attributes) {
  58467. super(TEMPLATE_NS_ID, "desc", true);
  58468. this.id = attributes.id || "";
  58469. this.use = attributes.use || "";
  58470. this.usehref = attributes.usehref || "";
  58471. this.boolean = new _xfa_object.XFAObjectArray();
  58472. this.date = new _xfa_object.XFAObjectArray();
  58473. this.dateTime = new _xfa_object.XFAObjectArray();
  58474. this.decimal = new _xfa_object.XFAObjectArray();
  58475. this.exData = new _xfa_object.XFAObjectArray();
  58476. this.float = new _xfa_object.XFAObjectArray();
  58477. this.image = new _xfa_object.XFAObjectArray();
  58478. this.integer = new _xfa_object.XFAObjectArray();
  58479. this.text = new _xfa_object.XFAObjectArray();
  58480. this.time = new _xfa_object.XFAObjectArray();
  58481. }
  58482. }
  58483. class DigestMethod extends _xfa_object.OptionObject {
  58484. constructor(attributes) {
  58485. super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]);
  58486. this.id = attributes.id || "";
  58487. this.use = attributes.use || "";
  58488. this.usehref = attributes.usehref || "";
  58489. }
  58490. }
  58491. class DigestMethods extends _xfa_object.XFAObject {
  58492. constructor(attributes) {
  58493. super(TEMPLATE_NS_ID, "digestMethods", true);
  58494. this.id = attributes.id || "";
  58495. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  58496. this.use = attributes.use || "";
  58497. this.usehref = attributes.usehref || "";
  58498. this.digestMethod = new _xfa_object.XFAObjectArray();
  58499. }
  58500. }
  58501. class Draw extends _xfa_object.XFAObject {
  58502. constructor(attributes) {
  58503. super(TEMPLATE_NS_ID, "draw", true);
  58504. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  58505. this.colSpan = (0, _utils.getInteger)({
  58506. data: attributes.colSpan,
  58507. defaultValue: 1,
  58508. validate: n => n >= 1 || n === -1
  58509. });
  58510. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  58511. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  58512. this.id = attributes.id || "";
  58513. this.locale = attributes.locale || "";
  58514. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  58515. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  58516. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  58517. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  58518. this.name = attributes.name || "";
  58519. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  58520. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  58521. this.rotate = (0, _utils.getInteger)({
  58522. data: attributes.rotate,
  58523. defaultValue: 0,
  58524. validate: x => x % 90 === 0
  58525. });
  58526. this.use = attributes.use || "";
  58527. this.usehref = attributes.usehref || "";
  58528. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  58529. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  58530. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  58531. this.assist = null;
  58532. this.border = null;
  58533. this.caption = null;
  58534. this.desc = null;
  58535. this.extras = null;
  58536. this.font = null;
  58537. this.keep = null;
  58538. this.margin = null;
  58539. this.para = null;
  58540. this.traversal = null;
  58541. this.ui = null;
  58542. this.value = null;
  58543. this.setProperty = new _xfa_object.XFAObjectArray();
  58544. }
  58545. [_xfa_object.$setValue](value) {
  58546. _setValue(this, value);
  58547. }
  58548. [_xfa_object.$toHTML](availableSpace) {
  58549. setTabIndex(this);
  58550. if (this.presence === "hidden" || this.presence === "inactive") {
  58551. return _utils.HTMLResult.EMPTY;
  58552. }
  58553. (0, _html_utils.fixDimensions)(this);
  58554. this[_xfa_object.$pushPara]();
  58555. const savedW = this.w;
  58556. const savedH = this.h;
  58557. const {
  58558. w,
  58559. h,
  58560. isBroken
  58561. } = (0, _html_utils.layoutNode)(this, availableSpace);
  58562. if (w && this.w === "") {
  58563. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  58564. this[_xfa_object.$popPara]();
  58565. return _utils.HTMLResult.FAILURE;
  58566. }
  58567. this.w = w;
  58568. }
  58569. if (h && this.h === "") {
  58570. this.h = h;
  58571. }
  58572. setFirstUnsplittable(this);
  58573. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  58574. this.w = savedW;
  58575. this.h = savedH;
  58576. this[_xfa_object.$popPara]();
  58577. return _utils.HTMLResult.FAILURE;
  58578. }
  58579. unsetFirstUnsplittable(this);
  58580. const style = (0, _html_utils.toStyle)(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin");
  58581. (0, _html_utils.setMinMaxDimensions)(this, style);
  58582. if (style.margin) {
  58583. style.padding = style.margin;
  58584. delete style.margin;
  58585. }
  58586. const classNames = ["xfaDraw"];
  58587. if (this.font) {
  58588. classNames.push("xfaFont");
  58589. }
  58590. if ((0, _html_utils.isPrintOnly)(this)) {
  58591. classNames.push("xfaPrintOnly");
  58592. }
  58593. const attributes = {
  58594. style,
  58595. id: this[_xfa_object.$uid],
  58596. class: classNames
  58597. };
  58598. if (this.name) {
  58599. attributes.xfaName = this.name;
  58600. }
  58601. const html = {
  58602. name: "div",
  58603. attributes,
  58604. children: []
  58605. };
  58606. applyAssist(this, attributes);
  58607. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  58608. const value = this.value ? this.value[_xfa_object.$toHTML](availableSpace).html : null;
  58609. if (value === null) {
  58610. this.w = savedW;
  58611. this.h = savedH;
  58612. this[_xfa_object.$popPara]();
  58613. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  58614. }
  58615. html.children.push(value);
  58616. (0, _html_utils.setPara)(this, style, value);
  58617. this.w = savedW;
  58618. this.h = savedH;
  58619. this[_xfa_object.$popPara]();
  58620. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  58621. }
  58622. }
  58623. class Edge extends _xfa_object.XFAObject {
  58624. constructor(attributes) {
  58625. super(TEMPLATE_NS_ID, "edge", true);
  58626. this.cap = (0, _utils.getStringOption)(attributes.cap, ["square", "butt", "round"]);
  58627. this.id = attributes.id || "";
  58628. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  58629. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  58630. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  58631. this.use = attributes.use || "";
  58632. this.usehref = attributes.usehref || "";
  58633. this.color = null;
  58634. this.extras = null;
  58635. }
  58636. [_xfa_object.$toStyle]() {
  58637. const style = (0, _html_utils.toStyle)(this, "visibility");
  58638. Object.assign(style, {
  58639. linecap: this.cap,
  58640. width: (0, _html_utils.measureToString)(this.thickness),
  58641. color: this.color ? this.color[_xfa_object.$toStyle]() : "#000000",
  58642. style: ""
  58643. });
  58644. if (this.presence !== "visible") {
  58645. style.style = "none";
  58646. } else {
  58647. switch (this.stroke) {
  58648. case "solid":
  58649. style.style = "solid";
  58650. break;
  58651. case "dashDot":
  58652. style.style = "dashed";
  58653. break;
  58654. case "dashDotDot":
  58655. style.style = "dashed";
  58656. break;
  58657. case "dashed":
  58658. style.style = "dashed";
  58659. break;
  58660. case "dotted":
  58661. style.style = "dotted";
  58662. break;
  58663. case "embossed":
  58664. style.style = "ridge";
  58665. break;
  58666. case "etched":
  58667. style.style = "groove";
  58668. break;
  58669. case "lowered":
  58670. style.style = "inset";
  58671. break;
  58672. case "raised":
  58673. style.style = "outset";
  58674. break;
  58675. }
  58676. }
  58677. return style;
  58678. }
  58679. }
  58680. class Encoding extends _xfa_object.OptionObject {
  58681. constructor(attributes) {
  58682. super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]);
  58683. this.id = attributes.id || "";
  58684. this.use = attributes.use || "";
  58685. this.usehref = attributes.usehref || "";
  58686. }
  58687. }
  58688. class Encodings extends _xfa_object.XFAObject {
  58689. constructor(attributes) {
  58690. super(TEMPLATE_NS_ID, "encodings", true);
  58691. this.id = attributes.id || "";
  58692. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  58693. this.use = attributes.use || "";
  58694. this.usehref = attributes.usehref || "";
  58695. this.encoding = new _xfa_object.XFAObjectArray();
  58696. }
  58697. }
  58698. class Encrypt extends _xfa_object.XFAObject {
  58699. constructor(attributes) {
  58700. super(TEMPLATE_NS_ID, "encrypt", true);
  58701. this.id = attributes.id || "";
  58702. this.use = attributes.use || "";
  58703. this.usehref = attributes.usehref || "";
  58704. this.certificate = null;
  58705. }
  58706. }
  58707. class EncryptData extends _xfa_object.XFAObject {
  58708. constructor(attributes) {
  58709. super(TEMPLATE_NS_ID, "encryptData", true);
  58710. this.id = attributes.id || "";
  58711. this.operation = (0, _utils.getStringOption)(attributes.operation, ["encrypt", "decrypt"]);
  58712. this.target = attributes.target || "";
  58713. this.use = attributes.use || "";
  58714. this.usehref = attributes.usehref || "";
  58715. this.filter = null;
  58716. this.manifest = null;
  58717. }
  58718. }
  58719. class Encryption extends _xfa_object.XFAObject {
  58720. constructor(attributes) {
  58721. super(TEMPLATE_NS_ID, "encryption", true);
  58722. this.id = attributes.id || "";
  58723. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  58724. this.use = attributes.use || "";
  58725. this.usehref = attributes.usehref || "";
  58726. this.certificate = new _xfa_object.XFAObjectArray();
  58727. }
  58728. }
  58729. class EncryptionMethod extends _xfa_object.OptionObject {
  58730. constructor(attributes) {
  58731. super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]);
  58732. this.id = attributes.id || "";
  58733. this.use = attributes.use || "";
  58734. this.usehref = attributes.usehref || "";
  58735. }
  58736. }
  58737. class EncryptionMethods extends _xfa_object.XFAObject {
  58738. constructor(attributes) {
  58739. super(TEMPLATE_NS_ID, "encryptionMethods", true);
  58740. this.id = attributes.id || "";
  58741. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  58742. this.use = attributes.use || "";
  58743. this.usehref = attributes.usehref || "";
  58744. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  58745. }
  58746. }
  58747. class Event extends _xfa_object.XFAObject {
  58748. constructor(attributes) {
  58749. super(TEMPLATE_NS_ID, "event", true);
  58750. 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"]);
  58751. this.id = attributes.id || "";
  58752. this.listen = (0, _utils.getStringOption)(attributes.listen, ["refOnly", "refAndDescendents"]);
  58753. this.name = attributes.name || "";
  58754. this.ref = attributes.ref || "";
  58755. this.use = attributes.use || "";
  58756. this.usehref = attributes.usehref || "";
  58757. this.extras = null;
  58758. this.encryptData = null;
  58759. this.execute = null;
  58760. this.script = null;
  58761. this.signData = null;
  58762. this.submit = null;
  58763. }
  58764. }
  58765. class ExData extends _xfa_object.ContentObject {
  58766. constructor(attributes) {
  58767. super(TEMPLATE_NS_ID, "exData");
  58768. this.contentType = attributes.contentType || "";
  58769. this.href = attributes.href || "";
  58770. this.id = attributes.id || "";
  58771. this.maxLength = (0, _utils.getInteger)({
  58772. data: attributes.maxLength,
  58773. defaultValue: -1,
  58774. validate: x => x >= -1
  58775. });
  58776. this.name = attributes.name || "";
  58777. this.rid = attributes.rid || "";
  58778. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["none", "base64", "package"]);
  58779. this.use = attributes.use || "";
  58780. this.usehref = attributes.usehref || "";
  58781. }
  58782. [_xfa_object.$isCDATAXml]() {
  58783. return this.contentType === "text/html";
  58784. }
  58785. [_xfa_object.$onChild](child) {
  58786. if (this.contentType === "text/html" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  58787. this[_xfa_object.$content] = child;
  58788. return true;
  58789. }
  58790. if (this.contentType === "text/xml") {
  58791. this[_xfa_object.$content] = child;
  58792. return true;
  58793. }
  58794. return false;
  58795. }
  58796. [_xfa_object.$toHTML](availableSpace) {
  58797. if (this.contentType !== "text/html" || !this[_xfa_object.$content]) {
  58798. return _utils.HTMLResult.EMPTY;
  58799. }
  58800. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  58801. }
  58802. }
  58803. class ExObject extends _xfa_object.XFAObject {
  58804. constructor(attributes) {
  58805. super(TEMPLATE_NS_ID, "exObject", true);
  58806. this.archive = attributes.archive || "";
  58807. this.classId = attributes.classId || "";
  58808. this.codeBase = attributes.codeBase || "";
  58809. this.codeType = attributes.codeType || "";
  58810. this.id = attributes.id || "";
  58811. this.name = attributes.name || "";
  58812. this.use = attributes.use || "";
  58813. this.usehref = attributes.usehref || "";
  58814. this.extras = null;
  58815. this.boolean = new _xfa_object.XFAObjectArray();
  58816. this.date = new _xfa_object.XFAObjectArray();
  58817. this.dateTime = new _xfa_object.XFAObjectArray();
  58818. this.decimal = new _xfa_object.XFAObjectArray();
  58819. this.exData = new _xfa_object.XFAObjectArray();
  58820. this.exObject = new _xfa_object.XFAObjectArray();
  58821. this.float = new _xfa_object.XFAObjectArray();
  58822. this.image = new _xfa_object.XFAObjectArray();
  58823. this.integer = new _xfa_object.XFAObjectArray();
  58824. this.text = new _xfa_object.XFAObjectArray();
  58825. this.time = new _xfa_object.XFAObjectArray();
  58826. }
  58827. }
  58828. class ExclGroup extends _xfa_object.XFAObject {
  58829. constructor(attributes) {
  58830. super(TEMPLATE_NS_ID, "exclGroup", true);
  58831. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  58832. this.accessKey = attributes.accessKey || "";
  58833. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  58834. this.colSpan = (0, _utils.getInteger)({
  58835. data: attributes.colSpan,
  58836. defaultValue: 1,
  58837. validate: n => n >= 1 || n === -1
  58838. });
  58839. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  58840. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  58841. this.id = attributes.id || "";
  58842. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  58843. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  58844. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  58845. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  58846. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  58847. this.name = attributes.name || "";
  58848. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  58849. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  58850. this.use = attributes.use || "";
  58851. this.usehref = attributes.usehref || "";
  58852. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  58853. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  58854. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  58855. this.assist = null;
  58856. this.bind = null;
  58857. this.border = null;
  58858. this.calculate = null;
  58859. this.caption = null;
  58860. this.desc = null;
  58861. this.extras = null;
  58862. this.margin = null;
  58863. this.para = null;
  58864. this.traversal = null;
  58865. this.validate = null;
  58866. this.connect = new _xfa_object.XFAObjectArray();
  58867. this.event = new _xfa_object.XFAObjectArray();
  58868. this.field = new _xfa_object.XFAObjectArray();
  58869. this.setProperty = new _xfa_object.XFAObjectArray();
  58870. }
  58871. [_xfa_object.$isBindable]() {
  58872. return true;
  58873. }
  58874. [_xfa_object.$hasSettableValue]() {
  58875. return true;
  58876. }
  58877. [_xfa_object.$setValue](value) {
  58878. for (const field of this.field.children) {
  58879. if (!field.value) {
  58880. const nodeValue = new Value({});
  58881. field[_xfa_object.$appendChild](nodeValue);
  58882. field.value = nodeValue;
  58883. }
  58884. field.value[_xfa_object.$setValue](value);
  58885. }
  58886. }
  58887. [_xfa_object.$isThereMoreWidth]() {
  58888. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  58889. }
  58890. [_xfa_object.$isSplittable]() {
  58891. const parent = this[_xfa_object.$getSubformParent]();
  58892. if (!parent[_xfa_object.$isSplittable]()) {
  58893. return false;
  58894. }
  58895. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  58896. return this[_xfa_object.$extra]._isSplittable;
  58897. }
  58898. if (this.layout === "position" || this.layout.includes("row")) {
  58899. this[_xfa_object.$extra]._isSplittable = false;
  58900. return false;
  58901. }
  58902. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  58903. return false;
  58904. }
  58905. this[_xfa_object.$extra]._isSplittable = true;
  58906. return true;
  58907. }
  58908. [_xfa_object.$flushHTML]() {
  58909. return (0, _layout.flushHTML)(this);
  58910. }
  58911. [_xfa_object.$addHTML](html, bbox) {
  58912. (0, _layout.addHTML)(this, html, bbox);
  58913. }
  58914. [_xfa_object.$getAvailableSpace]() {
  58915. return (0, _layout.getAvailableSpace)(this);
  58916. }
  58917. [_xfa_object.$toHTML](availableSpace) {
  58918. setTabIndex(this);
  58919. if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  58920. return _utils.HTMLResult.EMPTY;
  58921. }
  58922. (0, _html_utils.fixDimensions)(this);
  58923. const children = [];
  58924. const attributes = {
  58925. id: this[_xfa_object.$uid],
  58926. class: []
  58927. };
  58928. (0, _html_utils.setAccess)(this, attributes.class);
  58929. if (!this[_xfa_object.$extra]) {
  58930. this[_xfa_object.$extra] = Object.create(null);
  58931. }
  58932. Object.assign(this[_xfa_object.$extra], {
  58933. children,
  58934. attributes,
  58935. attempt: 0,
  58936. line: null,
  58937. numberInLine: 0,
  58938. availableSpace: {
  58939. width: Math.min(this.w || Infinity, availableSpace.width),
  58940. height: Math.min(this.h || Infinity, availableSpace.height)
  58941. },
  58942. width: 0,
  58943. height: 0,
  58944. prevHeight: 0,
  58945. currentWidth: 0
  58946. });
  58947. const isSplittable = this[_xfa_object.$isSplittable]();
  58948. if (!isSplittable) {
  58949. setFirstUnsplittable(this);
  58950. }
  58951. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  58952. return _utils.HTMLResult.FAILURE;
  58953. }
  58954. const filter = new Set(["field"]);
  58955. if (this.layout.includes("row")) {
  58956. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  58957. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  58958. this[_xfa_object.$extra].columnWidths = columnWidths;
  58959. this[_xfa_object.$extra].currentColumn = 0;
  58960. }
  58961. }
  58962. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  58963. const classNames = ["xfaExclgroup"];
  58964. const cl = (0, _html_utils.layoutClass)(this);
  58965. if (cl) {
  58966. classNames.push(cl);
  58967. }
  58968. if ((0, _html_utils.isPrintOnly)(this)) {
  58969. classNames.push("xfaPrintOnly");
  58970. }
  58971. attributes.style = style;
  58972. attributes.class = classNames;
  58973. if (this.name) {
  58974. attributes.xfaName = this.name;
  58975. }
  58976. this[_xfa_object.$pushPara]();
  58977. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  58978. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  58979. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  58980. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  58981. this[_xfa_object.$extra].numberInLine = 0;
  58982. }
  58983. const result = this[_xfa_object.$childrenToHTML]({
  58984. filter,
  58985. include: true
  58986. });
  58987. if (result.success) {
  58988. break;
  58989. }
  58990. if (result.isBreak()) {
  58991. this[_xfa_object.$popPara]();
  58992. return result;
  58993. }
  58994. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58995. this[_xfa_object.$extra].attempt = maxRun;
  58996. break;
  58997. }
  58998. }
  58999. this[_xfa_object.$popPara]();
  59000. if (!isSplittable) {
  59001. unsetFirstUnsplittable(this);
  59002. }
  59003. if (this[_xfa_object.$extra].attempt === maxRun) {
  59004. if (!isSplittable) {
  59005. delete this[_xfa_object.$extra];
  59006. }
  59007. return _utils.HTMLResult.FAILURE;
  59008. }
  59009. let marginH = 0;
  59010. let marginV = 0;
  59011. if (this.margin) {
  59012. marginH = this.margin.leftInset + this.margin.rightInset;
  59013. marginV = this.margin.topInset + this.margin.bottomInset;
  59014. }
  59015. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  59016. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  59017. const bbox = [this.x, this.y, width, height];
  59018. if (this.w === "") {
  59019. style.width = (0, _html_utils.measureToString)(width);
  59020. }
  59021. if (this.h === "") {
  59022. style.height = (0, _html_utils.measureToString)(height);
  59023. }
  59024. const html = {
  59025. name: "div",
  59026. attributes,
  59027. children
  59028. };
  59029. applyAssist(this, attributes);
  59030. delete this[_xfa_object.$extra];
  59031. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  59032. }
  59033. }
  59034. class Execute extends _xfa_object.XFAObject {
  59035. constructor(attributes) {
  59036. super(TEMPLATE_NS_ID, "execute");
  59037. this.connection = attributes.connection || "";
  59038. this.executeType = (0, _utils.getStringOption)(attributes.executeType, ["import", "remerge"]);
  59039. this.id = attributes.id || "";
  59040. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  59041. this.use = attributes.use || "";
  59042. this.usehref = attributes.usehref || "";
  59043. }
  59044. }
  59045. class Extras extends _xfa_object.XFAObject {
  59046. constructor(attributes) {
  59047. super(TEMPLATE_NS_ID, "extras", true);
  59048. this.id = attributes.id || "";
  59049. this.name = attributes.name || "";
  59050. this.use = attributes.use || "";
  59051. this.usehref = attributes.usehref || "";
  59052. this.boolean = new _xfa_object.XFAObjectArray();
  59053. this.date = new _xfa_object.XFAObjectArray();
  59054. this.dateTime = new _xfa_object.XFAObjectArray();
  59055. this.decimal = new _xfa_object.XFAObjectArray();
  59056. this.exData = new _xfa_object.XFAObjectArray();
  59057. this.extras = new _xfa_object.XFAObjectArray();
  59058. this.float = new _xfa_object.XFAObjectArray();
  59059. this.image = new _xfa_object.XFAObjectArray();
  59060. this.integer = new _xfa_object.XFAObjectArray();
  59061. this.text = new _xfa_object.XFAObjectArray();
  59062. this.time = new _xfa_object.XFAObjectArray();
  59063. }
  59064. }
  59065. class Field extends _xfa_object.XFAObject {
  59066. constructor(attributes) {
  59067. super(TEMPLATE_NS_ID, "field", true);
  59068. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  59069. this.accessKey = attributes.accessKey || "";
  59070. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  59071. this.colSpan = (0, _utils.getInteger)({
  59072. data: attributes.colSpan,
  59073. defaultValue: 1,
  59074. validate: n => n >= 1 || n === -1
  59075. });
  59076. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  59077. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  59078. this.id = attributes.id || "";
  59079. this.locale = attributes.locale || "";
  59080. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  59081. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  59082. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  59083. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  59084. this.name = attributes.name || "";
  59085. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  59086. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  59087. this.rotate = (0, _utils.getInteger)({
  59088. data: attributes.rotate,
  59089. defaultValue: 0,
  59090. validate: x => x % 90 === 0
  59091. });
  59092. this.use = attributes.use || "";
  59093. this.usehref = attributes.usehref || "";
  59094. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  59095. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  59096. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  59097. this.assist = null;
  59098. this.bind = null;
  59099. this.border = null;
  59100. this.calculate = null;
  59101. this.caption = null;
  59102. this.desc = null;
  59103. this.extras = null;
  59104. this.font = null;
  59105. this.format = null;
  59106. this.items = new _xfa_object.XFAObjectArray(2);
  59107. this.keep = null;
  59108. this.margin = null;
  59109. this.para = null;
  59110. this.traversal = null;
  59111. this.ui = null;
  59112. this.validate = null;
  59113. this.value = null;
  59114. this.bindItems = new _xfa_object.XFAObjectArray();
  59115. this.connect = new _xfa_object.XFAObjectArray();
  59116. this.event = new _xfa_object.XFAObjectArray();
  59117. this.setProperty = new _xfa_object.XFAObjectArray();
  59118. }
  59119. [_xfa_object.$isBindable]() {
  59120. return true;
  59121. }
  59122. [_xfa_object.$setValue](value) {
  59123. _setValue(this, value);
  59124. }
  59125. [_xfa_object.$toHTML](availableSpace) {
  59126. setTabIndex(this);
  59127. if (!this.ui) {
  59128. this.ui = new Ui({});
  59129. this.ui[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  59130. this[_xfa_object.$appendChild](this.ui);
  59131. let node;
  59132. switch (this.items.children.length) {
  59133. case 0:
  59134. node = new TextEdit({});
  59135. this.ui.textEdit = node;
  59136. break;
  59137. case 1:
  59138. node = new CheckButton({});
  59139. this.ui.checkButton = node;
  59140. break;
  59141. case 2:
  59142. node = new ChoiceList({});
  59143. this.ui.choiceList = node;
  59144. break;
  59145. }
  59146. this.ui[_xfa_object.$appendChild](node);
  59147. }
  59148. if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  59149. return _utils.HTMLResult.EMPTY;
  59150. }
  59151. if (this.caption) {
  59152. delete this.caption[_xfa_object.$extra];
  59153. }
  59154. this[_xfa_object.$pushPara]();
  59155. const caption = this.caption ? this.caption[_xfa_object.$toHTML](availableSpace).html : null;
  59156. const savedW = this.w;
  59157. const savedH = this.h;
  59158. let marginH = 0;
  59159. let marginV = 0;
  59160. if (this.margin) {
  59161. marginH = this.margin.leftInset + this.margin.rightInset;
  59162. marginV = this.margin.topInset + this.margin.bottomInset;
  59163. }
  59164. let borderDims = null;
  59165. if (this.w === "" || this.h === "") {
  59166. let width = null;
  59167. let height = null;
  59168. let uiW = 0;
  59169. let uiH = 0;
  59170. if (this.ui.checkButton) {
  59171. uiW = uiH = this.ui.checkButton.size;
  59172. } else {
  59173. const {
  59174. w,
  59175. h
  59176. } = (0, _html_utils.layoutNode)(this, availableSpace);
  59177. if (w !== null) {
  59178. uiW = w;
  59179. uiH = h;
  59180. } else {
  59181. uiH = (0, _fonts.getMetrics)(this.font, true).lineNoGap;
  59182. }
  59183. }
  59184. borderDims = getBorderDims(this.ui[_xfa_object.$getExtra]());
  59185. uiW += borderDims.w;
  59186. uiH += borderDims.h;
  59187. if (this.caption) {
  59188. const {
  59189. w,
  59190. h,
  59191. isBroken
  59192. } = this.caption[_xfa_object.$getExtra](availableSpace);
  59193. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  59194. this[_xfa_object.$popPara]();
  59195. return _utils.HTMLResult.FAILURE;
  59196. }
  59197. width = w;
  59198. height = h;
  59199. switch (this.caption.placement) {
  59200. case "left":
  59201. case "right":
  59202. case "inline":
  59203. width += uiW;
  59204. break;
  59205. case "top":
  59206. case "bottom":
  59207. height += uiH;
  59208. break;
  59209. }
  59210. } else {
  59211. width = uiW;
  59212. height = uiH;
  59213. }
  59214. if (width && this.w === "") {
  59215. width += marginH;
  59216. this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW);
  59217. }
  59218. if (height && this.h === "") {
  59219. height += marginV;
  59220. this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH);
  59221. }
  59222. }
  59223. this[_xfa_object.$popPara]();
  59224. (0, _html_utils.fixDimensions)(this);
  59225. setFirstUnsplittable(this);
  59226. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  59227. this.w = savedW;
  59228. this.h = savedH;
  59229. this[_xfa_object.$popPara]();
  59230. return _utils.HTMLResult.FAILURE;
  59231. }
  59232. unsetFirstUnsplittable(this);
  59233. const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign");
  59234. (0, _html_utils.setMinMaxDimensions)(this, style);
  59235. const classNames = ["xfaField"];
  59236. if (this.font) {
  59237. classNames.push("xfaFont");
  59238. }
  59239. if ((0, _html_utils.isPrintOnly)(this)) {
  59240. classNames.push("xfaPrintOnly");
  59241. }
  59242. const attributes = {
  59243. style,
  59244. id: this[_xfa_object.$uid],
  59245. class: classNames
  59246. };
  59247. if (style.margin) {
  59248. style.padding = style.margin;
  59249. delete style.margin;
  59250. }
  59251. (0, _html_utils.setAccess)(this, classNames);
  59252. if (this.name) {
  59253. attributes.xfaName = this.name;
  59254. }
  59255. const children = [];
  59256. const html = {
  59257. name: "div",
  59258. attributes,
  59259. children
  59260. };
  59261. applyAssist(this, attributes);
  59262. const borderStyle = this.border ? this.border[_xfa_object.$toStyle]() : null;
  59263. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  59264. const ui = this.ui[_xfa_object.$toHTML]().html;
  59265. if (!ui) {
  59266. Object.assign(style, borderStyle);
  59267. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  59268. }
  59269. if (this[_xfa_object.$tabIndex]) {
  59270. if (ui.children && ui.children[0]) {
  59271. ui.children[0].attributes.tabindex = this[_xfa_object.$tabIndex];
  59272. } else {
  59273. ui.attributes.tabindex = this[_xfa_object.$tabIndex];
  59274. }
  59275. }
  59276. if (!ui.attributes.style) {
  59277. ui.attributes.style = Object.create(null);
  59278. }
  59279. let aElement = null;
  59280. if (this.ui.button) {
  59281. if (ui.children.length === 1) {
  59282. [aElement] = ui.children.splice(0, 1);
  59283. }
  59284. Object.assign(ui.attributes.style, borderStyle);
  59285. } else {
  59286. Object.assign(style, borderStyle);
  59287. }
  59288. children.push(ui);
  59289. if (this.value) {
  59290. if (this.ui.imageEdit) {
  59291. ui.children.push(this.value[_xfa_object.$toHTML]().html);
  59292. } else if (!this.ui.button) {
  59293. let value = "";
  59294. if (this.value.exData) {
  59295. value = this.value.exData[_xfa_object.$text]();
  59296. } else if (this.value.text) {
  59297. value = this.value.text[_xfa_object.$getExtra]();
  59298. } else {
  59299. const htmlValue = this.value[_xfa_object.$toHTML]().html;
  59300. if (htmlValue !== null) {
  59301. value = htmlValue.children[0].value;
  59302. }
  59303. }
  59304. if (this.ui.textEdit && this.value.text && this.value.text.maxChars) {
  59305. ui.children[0].attributes.maxLength = this.value.text.maxChars;
  59306. }
  59307. if (value) {
  59308. if (this.ui.numericEdit) {
  59309. value = parseFloat(value);
  59310. value = isNaN(value) ? "" : value.toString();
  59311. }
  59312. if (ui.children[0].name === "textarea") {
  59313. ui.children[0].attributes.textContent = value;
  59314. } else {
  59315. ui.children[0].attributes.value = value;
  59316. }
  59317. }
  59318. }
  59319. }
  59320. if (!this.ui.imageEdit && ui.children && ui.children[0] && this.h) {
  59321. borderDims = borderDims || getBorderDims(this.ui[_xfa_object.$getExtra]());
  59322. let captionHeight = 0;
  59323. if (this.caption && ["top", "bottom"].includes(this.caption.placement)) {
  59324. captionHeight = this.caption.reserve;
  59325. if (captionHeight <= 0) {
  59326. captionHeight = this.caption[_xfa_object.$getExtra](availableSpace).h;
  59327. }
  59328. const inputHeight = this.h - captionHeight - marginV - borderDims.h;
  59329. ui.children[0].attributes.style.height = (0, _html_utils.measureToString)(inputHeight);
  59330. } else {
  59331. ui.children[0].attributes.style.height = "100%";
  59332. }
  59333. }
  59334. if (aElement) {
  59335. ui.children.push(aElement);
  59336. }
  59337. if (!caption) {
  59338. if (ui.attributes.class) {
  59339. ui.attributes.class.push("xfaLeft");
  59340. }
  59341. this.w = savedW;
  59342. this.h = savedH;
  59343. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  59344. }
  59345. if (this.ui.button) {
  59346. if (style.padding) {
  59347. delete style.padding;
  59348. }
  59349. if (caption.name === "div") {
  59350. caption.name = "span";
  59351. }
  59352. ui.children.push(caption);
  59353. return _utils.HTMLResult.success(html, bbox);
  59354. } else if (this.ui.checkButton) {
  59355. caption.attributes.class[0] = "xfaCaptionForCheckButton";
  59356. }
  59357. if (!ui.attributes.class) {
  59358. ui.attributes.class = [];
  59359. }
  59360. ui.children.splice(0, 0, caption);
  59361. switch (this.caption.placement) {
  59362. case "left":
  59363. ui.attributes.class.push("xfaLeft");
  59364. break;
  59365. case "right":
  59366. ui.attributes.class.push("xfaRight");
  59367. break;
  59368. case "top":
  59369. ui.attributes.class.push("xfaTop");
  59370. break;
  59371. case "bottom":
  59372. ui.attributes.class.push("xfaBottom");
  59373. break;
  59374. case "inline":
  59375. ui.attributes.class.push("xfaLeft");
  59376. break;
  59377. }
  59378. this.w = savedW;
  59379. this.h = savedH;
  59380. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  59381. }
  59382. }
  59383. exports.Field = Field;
  59384. class Fill extends _xfa_object.XFAObject {
  59385. constructor(attributes) {
  59386. super(TEMPLATE_NS_ID, "fill", true);
  59387. this.id = attributes.id || "";
  59388. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  59389. this.use = attributes.use || "";
  59390. this.usehref = attributes.usehref || "";
  59391. this.color = null;
  59392. this.extras = null;
  59393. this.linear = null;
  59394. this.pattern = null;
  59395. this.radial = null;
  59396. this.solid = null;
  59397. this.stipple = null;
  59398. }
  59399. [_xfa_object.$toStyle]() {
  59400. const parent = this[_xfa_object.$getParent]();
  59401. const grandpa = parent[_xfa_object.$getParent]();
  59402. const ggrandpa = grandpa[_xfa_object.$getParent]();
  59403. const style = Object.create(null);
  59404. let propName = "color";
  59405. let altPropName = propName;
  59406. if (parent instanceof Border) {
  59407. propName = "background-color";
  59408. altPropName = "background";
  59409. if (ggrandpa instanceof Ui) {
  59410. style.backgroundColor = "white";
  59411. }
  59412. }
  59413. if (parent instanceof Rectangle || parent instanceof Arc) {
  59414. propName = altPropName = "fill";
  59415. style.fill = "white";
  59416. }
  59417. for (const name of Object.getOwnPropertyNames(this)) {
  59418. if (name === "extras" || name === "color") {
  59419. continue;
  59420. }
  59421. const obj = this[name];
  59422. if (!(obj instanceof _xfa_object.XFAObject)) {
  59423. continue;
  59424. }
  59425. const color = obj[_xfa_object.$toStyle](this.color);
  59426. if (color) {
  59427. style[color.startsWith("#") ? propName : altPropName] = color;
  59428. }
  59429. return style;
  59430. }
  59431. if (this.color && this.color.value) {
  59432. const color = this.color[_xfa_object.$toStyle]();
  59433. style[color.startsWith("#") ? propName : altPropName] = color;
  59434. }
  59435. return style;
  59436. }
  59437. }
  59438. class Filter extends _xfa_object.XFAObject {
  59439. constructor(attributes) {
  59440. super(TEMPLATE_NS_ID, "filter", true);
  59441. this.addRevocationInfo = (0, _utils.getStringOption)(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
  59442. this.id = attributes.id || "";
  59443. this.name = attributes.name || "";
  59444. this.use = attributes.use || "";
  59445. this.usehref = attributes.usehref || "";
  59446. this.version = (0, _utils.getInteger)({
  59447. data: this.version,
  59448. defaultValue: 5,
  59449. validate: x => x >= 1 && x <= 5
  59450. });
  59451. this.appearanceFilter = null;
  59452. this.certificates = null;
  59453. this.digestMethods = null;
  59454. this.encodings = null;
  59455. this.encryptionMethods = null;
  59456. this.handler = null;
  59457. this.lockDocument = null;
  59458. this.mdp = null;
  59459. this.reasons = null;
  59460. this.timeStamp = null;
  59461. }
  59462. }
  59463. class Float extends _xfa_object.ContentObject {
  59464. constructor(attributes) {
  59465. super(TEMPLATE_NS_ID, "float");
  59466. this.id = attributes.id || "";
  59467. this.name = attributes.name || "";
  59468. this.use = attributes.use || "";
  59469. this.usehref = attributes.usehref || "";
  59470. }
  59471. [_xfa_object.$finalize]() {
  59472. const number = parseFloat(this[_xfa_object.$content].trim());
  59473. this[_xfa_object.$content] = isNaN(number) ? null : number;
  59474. }
  59475. [_xfa_object.$toHTML](availableSpace) {
  59476. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  59477. }
  59478. }
  59479. class Font extends _xfa_object.XFAObject {
  59480. constructor(attributes) {
  59481. super(TEMPLATE_NS_ID, "font", true);
  59482. this.baselineShift = (0, _utils.getMeasurement)(attributes.baselineShift);
  59483. this.fontHorizontalScale = (0, _utils.getFloat)({
  59484. data: attributes.fontHorizontalScale,
  59485. defaultValue: 100,
  59486. validate: x => x >= 0
  59487. });
  59488. this.fontVerticalScale = (0, _utils.getFloat)({
  59489. data: attributes.fontVerticalScale,
  59490. defaultValue: 100,
  59491. validate: x => x >= 0
  59492. });
  59493. this.id = attributes.id || "";
  59494. this.kerningMode = (0, _utils.getStringOption)(attributes.kerningMode, ["none", "pair"]);
  59495. this.letterSpacing = (0, _utils.getMeasurement)(attributes.letterSpacing, "0");
  59496. this.lineThrough = (0, _utils.getInteger)({
  59497. data: attributes.lineThrough,
  59498. defaultValue: 0,
  59499. validate: x => x === 1 || x === 2
  59500. });
  59501. this.lineThroughPeriod = (0, _utils.getStringOption)(attributes.lineThroughPeriod, ["all", "word"]);
  59502. this.overline = (0, _utils.getInteger)({
  59503. data: attributes.overline,
  59504. defaultValue: 0,
  59505. validate: x => x === 1 || x === 2
  59506. });
  59507. this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]);
  59508. this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]);
  59509. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  59510. this.typeface = attributes.typeface || "Courier";
  59511. this.underline = (0, _utils.getInteger)({
  59512. data: attributes.underline,
  59513. defaultValue: 0,
  59514. validate: x => x === 1 || x === 2
  59515. });
  59516. this.underlinePeriod = (0, _utils.getStringOption)(attributes.underlinePeriod, ["all", "word"]);
  59517. this.use = attributes.use || "";
  59518. this.usehref = attributes.usehref || "";
  59519. this.weight = (0, _utils.getStringOption)(attributes.weight, ["normal", "bold"]);
  59520. this.extras = null;
  59521. this.fill = null;
  59522. }
  59523. [_xfa_object.$clean](builder) {
  59524. super[_xfa_object.$clean](builder);
  59525. this[_xfa_object.$globalData].usedTypefaces.add(this.typeface);
  59526. }
  59527. [_xfa_object.$toStyle]() {
  59528. const style = (0, _html_utils.toStyle)(this, "fill");
  59529. const color = style.color;
  59530. if (color) {
  59531. if (color === "#000000") {
  59532. delete style.color;
  59533. } else if (!color.startsWith("#")) {
  59534. style.background = color;
  59535. style.backgroundClip = "text";
  59536. style.color = "transparent";
  59537. }
  59538. }
  59539. if (this.baselineShift) {
  59540. style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift);
  59541. }
  59542. style.fontKerning = this.kerningMode === "none" ? "none" : "normal";
  59543. style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing);
  59544. if (this.lineThrough !== 0) {
  59545. style.textDecoration = "line-through";
  59546. if (this.lineThrough === 2) {
  59547. style.textDecorationStyle = "double";
  59548. }
  59549. }
  59550. if (this.overline !== 0) {
  59551. style.textDecoration = "overline";
  59552. if (this.overline === 2) {
  59553. style.textDecorationStyle = "double";
  59554. }
  59555. }
  59556. style.fontStyle = this.posture;
  59557. style.fontSize = (0, _html_utils.measureToString)(0.99 * this.size);
  59558. (0, _html_utils.setFontFamily)(this, this, this[_xfa_object.$globalData].fontFinder, style);
  59559. if (this.underline !== 0) {
  59560. style.textDecoration = "underline";
  59561. if (this.underline === 2) {
  59562. style.textDecorationStyle = "double";
  59563. }
  59564. }
  59565. style.fontWeight = this.weight;
  59566. return style;
  59567. }
  59568. }
  59569. class Format extends _xfa_object.XFAObject {
  59570. constructor(attributes) {
  59571. super(TEMPLATE_NS_ID, "format", true);
  59572. this.id = attributes.id || "";
  59573. this.use = attributes.use || "";
  59574. this.usehref = attributes.usehref || "";
  59575. this.extras = null;
  59576. this.picture = null;
  59577. }
  59578. }
  59579. class Handler extends _xfa_object.StringObject {
  59580. constructor(attributes) {
  59581. super(TEMPLATE_NS_ID, "handler");
  59582. this.id = attributes.id || "";
  59583. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  59584. this.use = attributes.use || "";
  59585. this.usehref = attributes.usehref || "";
  59586. }
  59587. }
  59588. class Hyphenation extends _xfa_object.XFAObject {
  59589. constructor(attributes) {
  59590. super(TEMPLATE_NS_ID, "hyphenation");
  59591. this.excludeAllCaps = (0, _utils.getInteger)({
  59592. data: attributes.excludeAllCaps,
  59593. defaultValue: 0,
  59594. validate: x => x === 1
  59595. });
  59596. this.excludeInitialCap = (0, _utils.getInteger)({
  59597. data: attributes.excludeInitialCap,
  59598. defaultValue: 0,
  59599. validate: x => x === 1
  59600. });
  59601. this.hyphenate = (0, _utils.getInteger)({
  59602. data: attributes.hyphenate,
  59603. defaultValue: 0,
  59604. validate: x => x === 1
  59605. });
  59606. this.id = attributes.id || "";
  59607. this.pushCharacterCount = (0, _utils.getInteger)({
  59608. data: attributes.pushCharacterCount,
  59609. defaultValue: 3,
  59610. validate: x => x >= 0
  59611. });
  59612. this.remainCharacterCount = (0, _utils.getInteger)({
  59613. data: attributes.remainCharacterCount,
  59614. defaultValue: 3,
  59615. validate: x => x >= 0
  59616. });
  59617. this.use = attributes.use || "";
  59618. this.usehref = attributes.usehref || "";
  59619. this.wordCharacterCount = (0, _utils.getInteger)({
  59620. data: attributes.wordCharacterCount,
  59621. defaultValue: 7,
  59622. validate: x => x >= 0
  59623. });
  59624. }
  59625. }
  59626. class Image extends _xfa_object.StringObject {
  59627. constructor(attributes) {
  59628. super(TEMPLATE_NS_ID, "image");
  59629. this.aspect = (0, _utils.getStringOption)(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
  59630. this.contentType = attributes.contentType || "";
  59631. this.href = attributes.href || "";
  59632. this.id = attributes.id || "";
  59633. this.name = attributes.name || "";
  59634. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["base64", "none", "package"]);
  59635. this.use = attributes.use || "";
  59636. this.usehref = attributes.usehref || "";
  59637. }
  59638. [_xfa_object.$toHTML]() {
  59639. if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) {
  59640. return _utils.HTMLResult.EMPTY;
  59641. }
  59642. let buffer = this[_xfa_object.$globalData].images && this[_xfa_object.$globalData].images.get(this.href);
  59643. if (!buffer && (this.href || !this[_xfa_object.$content])) {
  59644. return _utils.HTMLResult.EMPTY;
  59645. }
  59646. if (!buffer && this.transferEncoding === "base64") {
  59647. buffer = (0, _util.stringToBytes)(atob(this[_xfa_object.$content]));
  59648. }
  59649. if (!buffer) {
  59650. return _utils.HTMLResult.EMPTY;
  59651. }
  59652. if (!this.contentType) {
  59653. for (const [header, type] of IMAGES_HEADERS) {
  59654. if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) {
  59655. this.contentType = type;
  59656. break;
  59657. }
  59658. }
  59659. if (!this.contentType) {
  59660. return _utils.HTMLResult.EMPTY;
  59661. }
  59662. }
  59663. const blob = new Blob([buffer], {
  59664. type: this.contentType
  59665. });
  59666. let style;
  59667. switch (this.aspect) {
  59668. case "fit":
  59669. case "actual":
  59670. break;
  59671. case "height":
  59672. style = {
  59673. height: "100%",
  59674. objectFit: "fill"
  59675. };
  59676. break;
  59677. case "none":
  59678. style = {
  59679. width: "100%",
  59680. height: "100%",
  59681. objectFit: "fill"
  59682. };
  59683. break;
  59684. case "width":
  59685. style = {
  59686. width: "100%",
  59687. objectFit: "fill"
  59688. };
  59689. break;
  59690. }
  59691. const parent = this[_xfa_object.$getParent]();
  59692. return _utils.HTMLResult.success({
  59693. name: "img",
  59694. attributes: {
  59695. class: ["xfaImage"],
  59696. style,
  59697. src: URL.createObjectURL(blob),
  59698. alt: parent ? ariaLabel(parent[_xfa_object.$getParent]()) : null
  59699. }
  59700. });
  59701. }
  59702. }
  59703. class ImageEdit extends _xfa_object.XFAObject {
  59704. constructor(attributes) {
  59705. super(TEMPLATE_NS_ID, "imageEdit", true);
  59706. this.data = (0, _utils.getStringOption)(attributes.data, ["link", "embed"]);
  59707. this.id = attributes.id || "";
  59708. this.use = attributes.use || "";
  59709. this.usehref = attributes.usehref || "";
  59710. this.border = null;
  59711. this.extras = null;
  59712. this.margin = null;
  59713. }
  59714. [_xfa_object.$toHTML](availableSpace) {
  59715. if (this.data === "embed") {
  59716. return _utils.HTMLResult.success({
  59717. name: "div",
  59718. children: [],
  59719. attributes: {}
  59720. });
  59721. }
  59722. return _utils.HTMLResult.EMPTY;
  59723. }
  59724. }
  59725. class Integer extends _xfa_object.ContentObject {
  59726. constructor(attributes) {
  59727. super(TEMPLATE_NS_ID, "integer");
  59728. this.id = attributes.id || "";
  59729. this.name = attributes.name || "";
  59730. this.use = attributes.use || "";
  59731. this.usehref = attributes.usehref || "";
  59732. }
  59733. [_xfa_object.$finalize]() {
  59734. const number = parseInt(this[_xfa_object.$content].trim(), 10);
  59735. this[_xfa_object.$content] = isNaN(number) ? null : number;
  59736. }
  59737. [_xfa_object.$toHTML](availableSpace) {
  59738. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  59739. }
  59740. }
  59741. class Issuers extends _xfa_object.XFAObject {
  59742. constructor(attributes) {
  59743. super(TEMPLATE_NS_ID, "issuers", true);
  59744. this.id = attributes.id || "";
  59745. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  59746. this.use = attributes.use || "";
  59747. this.usehref = attributes.usehref || "";
  59748. this.certificate = new _xfa_object.XFAObjectArray();
  59749. }
  59750. }
  59751. class Items extends _xfa_object.XFAObject {
  59752. constructor(attributes) {
  59753. super(TEMPLATE_NS_ID, "items", true);
  59754. this.id = attributes.id || "";
  59755. this.name = attributes.name || "";
  59756. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  59757. this.ref = attributes.ref || "";
  59758. this.save = (0, _utils.getInteger)({
  59759. data: attributes.save,
  59760. defaultValue: 0,
  59761. validate: x => x === 1
  59762. });
  59763. this.use = attributes.use || "";
  59764. this.usehref = attributes.usehref || "";
  59765. this.boolean = new _xfa_object.XFAObjectArray();
  59766. this.date = new _xfa_object.XFAObjectArray();
  59767. this.dateTime = new _xfa_object.XFAObjectArray();
  59768. this.decimal = new _xfa_object.XFAObjectArray();
  59769. this.exData = new _xfa_object.XFAObjectArray();
  59770. this.float = new _xfa_object.XFAObjectArray();
  59771. this.image = new _xfa_object.XFAObjectArray();
  59772. this.integer = new _xfa_object.XFAObjectArray();
  59773. this.text = new _xfa_object.XFAObjectArray();
  59774. this.time = new _xfa_object.XFAObjectArray();
  59775. }
  59776. [_xfa_object.$toHTML]() {
  59777. const output = [];
  59778. for (const child of this[_xfa_object.$getChildren]()) {
  59779. output.push(child[_xfa_object.$text]());
  59780. }
  59781. return _utils.HTMLResult.success(output);
  59782. }
  59783. }
  59784. exports.Items = Items;
  59785. class Keep extends _xfa_object.XFAObject {
  59786. constructor(attributes) {
  59787. super(TEMPLATE_NS_ID, "keep", true);
  59788. this.id = attributes.id || "";
  59789. const options = ["none", "contentArea", "pageArea"];
  59790. this.intact = (0, _utils.getStringOption)(attributes.intact, options);
  59791. this.next = (0, _utils.getStringOption)(attributes.next, options);
  59792. this.previous = (0, _utils.getStringOption)(attributes.previous, options);
  59793. this.use = attributes.use || "";
  59794. this.usehref = attributes.usehref || "";
  59795. this.extras = null;
  59796. }
  59797. }
  59798. class KeyUsage extends _xfa_object.XFAObject {
  59799. constructor(attributes) {
  59800. super(TEMPLATE_NS_ID, "keyUsage");
  59801. const options = ["", "yes", "no"];
  59802. this.crlSign = (0, _utils.getStringOption)(attributes.crlSign, options);
  59803. this.dataEncipherment = (0, _utils.getStringOption)(attributes.dataEncipherment, options);
  59804. this.decipherOnly = (0, _utils.getStringOption)(attributes.decipherOnly, options);
  59805. this.digitalSignature = (0, _utils.getStringOption)(attributes.digitalSignature, options);
  59806. this.encipherOnly = (0, _utils.getStringOption)(attributes.encipherOnly, options);
  59807. this.id = attributes.id || "";
  59808. this.keyAgreement = (0, _utils.getStringOption)(attributes.keyAgreement, options);
  59809. this.keyCertSign = (0, _utils.getStringOption)(attributes.keyCertSign, options);
  59810. this.keyEncipherment = (0, _utils.getStringOption)(attributes.keyEncipherment, options);
  59811. this.nonRepudiation = (0, _utils.getStringOption)(attributes.nonRepudiation, options);
  59812. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  59813. this.use = attributes.use || "";
  59814. this.usehref = attributes.usehref || "";
  59815. }
  59816. }
  59817. class Line extends _xfa_object.XFAObject {
  59818. constructor(attributes) {
  59819. super(TEMPLATE_NS_ID, "line", true);
  59820. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  59821. this.id = attributes.id || "";
  59822. this.slope = (0, _utils.getStringOption)(attributes.slope, ["\\", "/"]);
  59823. this.use = attributes.use || "";
  59824. this.usehref = attributes.usehref || "";
  59825. this.edge = null;
  59826. }
  59827. [_xfa_object.$toHTML]() {
  59828. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  59829. const edge = this.edge || new Edge({});
  59830. const edgeStyle = edge[_xfa_object.$toStyle]();
  59831. const style = Object.create(null);
  59832. const thickness = edge.presence === "visible" ? edge.thickness : 0;
  59833. style.strokeWidth = (0, _html_utils.measureToString)(thickness);
  59834. style.stroke = edgeStyle.color;
  59835. let x1, y1, x2, y2;
  59836. let width = "100%";
  59837. let height = "100%";
  59838. if (parent.w <= thickness) {
  59839. [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"];
  59840. width = style.strokeWidth;
  59841. } else if (parent.h <= thickness) {
  59842. [x1, y1, x2, y2] = [0, "50%", "100%", "50%"];
  59843. height = style.strokeWidth;
  59844. } else {
  59845. if (this.slope === "\\") {
  59846. [x1, y1, x2, y2] = [0, 0, "100%", "100%"];
  59847. } else {
  59848. [x1, y1, x2, y2] = [0, "100%", "100%", 0];
  59849. }
  59850. }
  59851. const line = {
  59852. name: "line",
  59853. attributes: {
  59854. xmlns: SVG_NS,
  59855. x1,
  59856. y1,
  59857. x2,
  59858. y2,
  59859. style
  59860. }
  59861. };
  59862. const svg = {
  59863. name: "svg",
  59864. children: [line],
  59865. attributes: {
  59866. xmlns: SVG_NS,
  59867. width,
  59868. height,
  59869. style: {
  59870. overflow: "visible"
  59871. }
  59872. }
  59873. };
  59874. if (hasMargin(parent)) {
  59875. return _utils.HTMLResult.success({
  59876. name: "div",
  59877. attributes: {
  59878. style: {
  59879. display: "inline",
  59880. width: "100%",
  59881. height: "100%"
  59882. }
  59883. },
  59884. children: [svg]
  59885. });
  59886. }
  59887. svg.attributes.style.position = "absolute";
  59888. return _utils.HTMLResult.success(svg);
  59889. }
  59890. }
  59891. class Linear extends _xfa_object.XFAObject {
  59892. constructor(attributes) {
  59893. super(TEMPLATE_NS_ID, "linear", true);
  59894. this.id = attributes.id || "";
  59895. this.type = (0, _utils.getStringOption)(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]);
  59896. this.use = attributes.use || "";
  59897. this.usehref = attributes.usehref || "";
  59898. this.color = null;
  59899. this.extras = null;
  59900. }
  59901. [_xfa_object.$toStyle](startColor) {
  59902. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  59903. const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
  59904. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  59905. return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
  59906. }
  59907. }
  59908. class LockDocument extends _xfa_object.ContentObject {
  59909. constructor(attributes) {
  59910. super(TEMPLATE_NS_ID, "lockDocument");
  59911. this.id = attributes.id || "";
  59912. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  59913. this.use = attributes.use || "";
  59914. this.usehref = attributes.usehref || "";
  59915. }
  59916. [_xfa_object.$finalize]() {
  59917. this[_xfa_object.$content] = (0, _utils.getStringOption)(this[_xfa_object.$content], ["auto", "0", "1"]);
  59918. }
  59919. }
  59920. class Manifest extends _xfa_object.XFAObject {
  59921. constructor(attributes) {
  59922. super(TEMPLATE_NS_ID, "manifest", true);
  59923. this.action = (0, _utils.getStringOption)(attributes.action, ["include", "all", "exclude"]);
  59924. this.id = attributes.id || "";
  59925. this.name = attributes.name || "";
  59926. this.use = attributes.use || "";
  59927. this.usehref = attributes.usehref || "";
  59928. this.extras = null;
  59929. this.ref = new _xfa_object.XFAObjectArray();
  59930. }
  59931. }
  59932. class Margin extends _xfa_object.XFAObject {
  59933. constructor(attributes) {
  59934. super(TEMPLATE_NS_ID, "margin", true);
  59935. this.bottomInset = (0, _utils.getMeasurement)(attributes.bottomInset, "0");
  59936. this.id = attributes.id || "";
  59937. this.leftInset = (0, _utils.getMeasurement)(attributes.leftInset, "0");
  59938. this.rightInset = (0, _utils.getMeasurement)(attributes.rightInset, "0");
  59939. this.topInset = (0, _utils.getMeasurement)(attributes.topInset, "0");
  59940. this.use = attributes.use || "";
  59941. this.usehref = attributes.usehref || "";
  59942. this.extras = null;
  59943. }
  59944. [_xfa_object.$toStyle]() {
  59945. return {
  59946. 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)
  59947. };
  59948. }
  59949. }
  59950. class Mdp extends _xfa_object.XFAObject {
  59951. constructor(attributes) {
  59952. super(TEMPLATE_NS_ID, "mdp");
  59953. this.id = attributes.id || "";
  59954. this.permissions = (0, _utils.getInteger)({
  59955. data: attributes.permissions,
  59956. defaultValue: 2,
  59957. validate: x => x === 1 || x === 3
  59958. });
  59959. this.signatureType = (0, _utils.getStringOption)(attributes.signatureType, ["filler", "author"]);
  59960. this.use = attributes.use || "";
  59961. this.usehref = attributes.usehref || "";
  59962. }
  59963. }
  59964. class Medium extends _xfa_object.XFAObject {
  59965. constructor(attributes) {
  59966. super(TEMPLATE_NS_ID, "medium");
  59967. this.id = attributes.id || "";
  59968. this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox);
  59969. this.long = (0, _utils.getMeasurement)(attributes.long);
  59970. this.orientation = (0, _utils.getStringOption)(attributes.orientation, ["portrait", "landscape"]);
  59971. this.short = (0, _utils.getMeasurement)(attributes.short);
  59972. this.stock = attributes.stock || "";
  59973. this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, ["auto", "delegate", "pageFront"]);
  59974. this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, ["auto", "delegate"]);
  59975. this.use = attributes.use || "";
  59976. this.usehref = attributes.usehref || "";
  59977. }
  59978. }
  59979. class Message extends _xfa_object.XFAObject {
  59980. constructor(attributes) {
  59981. super(TEMPLATE_NS_ID, "message", true);
  59982. this.id = attributes.id || "";
  59983. this.use = attributes.use || "";
  59984. this.usehref = attributes.usehref || "";
  59985. this.text = new _xfa_object.XFAObjectArray();
  59986. }
  59987. }
  59988. class NumericEdit extends _xfa_object.XFAObject {
  59989. constructor(attributes) {
  59990. super(TEMPLATE_NS_ID, "numericEdit", true);
  59991. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  59992. this.id = attributes.id || "";
  59993. this.use = attributes.use || "";
  59994. this.usehref = attributes.usehref || "";
  59995. this.border = null;
  59996. this.comb = null;
  59997. this.extras = null;
  59998. this.margin = null;
  59999. }
  60000. [_xfa_object.$toHTML](availableSpace) {
  60001. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  60002. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  60003. const html = {
  60004. name: "input",
  60005. attributes: {
  60006. type: "text",
  60007. fieldId: field[_xfa_object.$uid],
  60008. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  60009. class: ["xfaTextfield"],
  60010. style,
  60011. "aria-label": ariaLabel(field),
  60012. "aria-required": false
  60013. }
  60014. };
  60015. if (isRequired(field)) {
  60016. html.attributes["aria-required"] = true;
  60017. html.attributes.required = true;
  60018. }
  60019. return _utils.HTMLResult.success({
  60020. name: "label",
  60021. attributes: {
  60022. class: ["xfaLabel"]
  60023. },
  60024. children: [html]
  60025. });
  60026. }
  60027. }
  60028. class Occur extends _xfa_object.XFAObject {
  60029. constructor(attributes) {
  60030. super(TEMPLATE_NS_ID, "occur", true);
  60031. this.id = attributes.id || "";
  60032. this.initial = attributes.initial !== "" ? (0, _utils.getInteger)({
  60033. data: attributes.initial,
  60034. defaultValue: "",
  60035. validate: x => true
  60036. }) : "";
  60037. this.max = attributes.max !== "" ? (0, _utils.getInteger)({
  60038. data: attributes.max,
  60039. defaultValue: 1,
  60040. validate: x => true
  60041. }) : "";
  60042. this.min = attributes.min !== "" ? (0, _utils.getInteger)({
  60043. data: attributes.min,
  60044. defaultValue: 1,
  60045. validate: x => true
  60046. }) : "";
  60047. this.use = attributes.use || "";
  60048. this.usehref = attributes.usehref || "";
  60049. this.extras = null;
  60050. }
  60051. [_xfa_object.$clean]() {
  60052. const parent = this[_xfa_object.$getParent]();
  60053. const originalMin = this.min;
  60054. if (this.min === "") {
  60055. this.min = parent instanceof PageArea || parent instanceof PageSet ? 0 : 1;
  60056. }
  60057. if (this.max === "") {
  60058. if (originalMin === "") {
  60059. this.max = parent instanceof PageArea || parent instanceof PageSet ? -1 : 1;
  60060. } else {
  60061. this.max = this.min;
  60062. }
  60063. }
  60064. if (this.max !== -1 && this.max < this.min) {
  60065. this.max = this.min;
  60066. }
  60067. if (this.initial === "") {
  60068. this.initial = parent instanceof Template ? 1 : this.min;
  60069. }
  60070. }
  60071. }
  60072. class Oid extends _xfa_object.StringObject {
  60073. constructor(attributes) {
  60074. super(TEMPLATE_NS_ID, "oid");
  60075. this.id = attributes.id || "";
  60076. this.name = attributes.name || "";
  60077. this.use = attributes.use || "";
  60078. this.usehref = attributes.usehref || "";
  60079. }
  60080. }
  60081. class Oids extends _xfa_object.XFAObject {
  60082. constructor(attributes) {
  60083. super(TEMPLATE_NS_ID, "oids", true);
  60084. this.id = attributes.id || "";
  60085. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  60086. this.use = attributes.use || "";
  60087. this.usehref = attributes.usehref || "";
  60088. this.oid = new _xfa_object.XFAObjectArray();
  60089. }
  60090. }
  60091. class Overflow extends _xfa_object.XFAObject {
  60092. constructor(attributes) {
  60093. super(TEMPLATE_NS_ID, "overflow");
  60094. this.id = attributes.id || "";
  60095. this.leader = attributes.leader || "";
  60096. this.target = attributes.target || "";
  60097. this.trailer = attributes.trailer || "";
  60098. this.use = attributes.use || "";
  60099. this.usehref = attributes.usehref || "";
  60100. }
  60101. [_xfa_object.$getExtra]() {
  60102. if (!this[_xfa_object.$extra]) {
  60103. const parent = this[_xfa_object.$getParent]();
  60104. const root = this[_xfa_object.$getTemplateRoot]();
  60105. const target = root[_xfa_object.$searchNode](this.target, parent);
  60106. const leader = root[_xfa_object.$searchNode](this.leader, parent);
  60107. const trailer = root[_xfa_object.$searchNode](this.trailer, parent);
  60108. this[_xfa_object.$extra] = {
  60109. target: target && target[0] || null,
  60110. leader: leader && leader[0] || null,
  60111. trailer: trailer && trailer[0] || null,
  60112. addLeader: false,
  60113. addTrailer: false
  60114. };
  60115. }
  60116. return this[_xfa_object.$extra];
  60117. }
  60118. }
  60119. class PageArea extends _xfa_object.XFAObject {
  60120. constructor(attributes) {
  60121. super(TEMPLATE_NS_ID, "pageArea", true);
  60122. this.blankOrNotBlank = (0, _utils.getStringOption)(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]);
  60123. this.id = attributes.id || "";
  60124. this.initialNumber = (0, _utils.getInteger)({
  60125. data: attributes.initialNumber,
  60126. defaultValue: 1,
  60127. validate: x => true
  60128. });
  60129. this.name = attributes.name || "";
  60130. this.numbered = (0, _utils.getInteger)({
  60131. data: attributes.numbered,
  60132. defaultValue: 1,
  60133. validate: x => true
  60134. });
  60135. this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, ["any", "even", "odd"]);
  60136. this.pagePosition = (0, _utils.getStringOption)(attributes.pagePosition, ["any", "first", "last", "only", "rest"]);
  60137. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  60138. this.use = attributes.use || "";
  60139. this.usehref = attributes.usehref || "";
  60140. this.desc = null;
  60141. this.extras = null;
  60142. this.medium = null;
  60143. this.occur = null;
  60144. this.area = new _xfa_object.XFAObjectArray();
  60145. this.contentArea = new _xfa_object.XFAObjectArray();
  60146. this.draw = new _xfa_object.XFAObjectArray();
  60147. this.exclGroup = new _xfa_object.XFAObjectArray();
  60148. this.field = new _xfa_object.XFAObjectArray();
  60149. this.subform = new _xfa_object.XFAObjectArray();
  60150. }
  60151. [_xfa_object.$isUsable]() {
  60152. if (!this[_xfa_object.$extra]) {
  60153. this[_xfa_object.$extra] = {
  60154. numberOfUse: 0
  60155. };
  60156. return true;
  60157. }
  60158. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  60159. }
  60160. [_xfa_object.$cleanPage]() {
  60161. delete this[_xfa_object.$extra];
  60162. }
  60163. [_xfa_object.$getNextPage]() {
  60164. if (!this[_xfa_object.$extra]) {
  60165. this[_xfa_object.$extra] = {
  60166. numberOfUse: 0
  60167. };
  60168. }
  60169. const parent = this[_xfa_object.$getParent]();
  60170. if (parent.relation === "orderedOccurrence") {
  60171. if (this[_xfa_object.$isUsable]()) {
  60172. this[_xfa_object.$extra].numberOfUse += 1;
  60173. return this;
  60174. }
  60175. }
  60176. return parent[_xfa_object.$getNextPage]();
  60177. }
  60178. [_xfa_object.$getAvailableSpace]() {
  60179. return this[_xfa_object.$extra].space || {
  60180. width: 0,
  60181. height: 0
  60182. };
  60183. }
  60184. [_xfa_object.$toHTML]() {
  60185. if (!this[_xfa_object.$extra]) {
  60186. this[_xfa_object.$extra] = {
  60187. numberOfUse: 1
  60188. };
  60189. }
  60190. const children = [];
  60191. this[_xfa_object.$extra].children = children;
  60192. const style = Object.create(null);
  60193. if (this.medium && this.medium.short && this.medium.long) {
  60194. style.width = (0, _html_utils.measureToString)(this.medium.short);
  60195. style.height = (0, _html_utils.measureToString)(this.medium.long);
  60196. this[_xfa_object.$extra].space = {
  60197. width: this.medium.short,
  60198. height: this.medium.long
  60199. };
  60200. if (this.medium.orientation === "landscape") {
  60201. const x = style.width;
  60202. style.width = style.height;
  60203. style.height = x;
  60204. this[_xfa_object.$extra].space = {
  60205. width: this.medium.long,
  60206. height: this.medium.short
  60207. };
  60208. }
  60209. } else {
  60210. (0, _util.warn)("XFA - No medium specified in pageArea: please file a bug.");
  60211. }
  60212. this[_xfa_object.$childrenToHTML]({
  60213. filter: new Set(["area", "draw", "field", "subform"]),
  60214. include: true
  60215. });
  60216. this[_xfa_object.$childrenToHTML]({
  60217. filter: new Set(["contentArea"]),
  60218. include: true
  60219. });
  60220. return _utils.HTMLResult.success({
  60221. name: "div",
  60222. children,
  60223. attributes: {
  60224. class: ["xfaPage"],
  60225. id: this[_xfa_object.$uid],
  60226. style,
  60227. xfaName: this.name
  60228. }
  60229. });
  60230. }
  60231. }
  60232. class PageSet extends _xfa_object.XFAObject {
  60233. constructor(attributes) {
  60234. super(TEMPLATE_NS_ID, "pageSet", true);
  60235. this.duplexImposition = (0, _utils.getStringOption)(attributes.duplexImposition, ["longEdge", "shortEdge"]);
  60236. this.id = attributes.id || "";
  60237. this.name = attributes.name || "";
  60238. this.relation = (0, _utils.getStringOption)(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
  60239. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  60240. this.use = attributes.use || "";
  60241. this.usehref = attributes.usehref || "";
  60242. this.extras = null;
  60243. this.occur = null;
  60244. this.pageArea = new _xfa_object.XFAObjectArray();
  60245. this.pageSet = new _xfa_object.XFAObjectArray();
  60246. }
  60247. [_xfa_object.$cleanPage]() {
  60248. for (const page of this.pageArea.children) {
  60249. page[_xfa_object.$cleanPage]();
  60250. }
  60251. for (const page of this.pageSet.children) {
  60252. page[_xfa_object.$cleanPage]();
  60253. }
  60254. }
  60255. [_xfa_object.$isUsable]() {
  60256. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  60257. }
  60258. [_xfa_object.$getNextPage]() {
  60259. if (!this[_xfa_object.$extra]) {
  60260. this[_xfa_object.$extra] = {
  60261. numberOfUse: 1,
  60262. pageIndex: -1,
  60263. pageSetIndex: -1
  60264. };
  60265. }
  60266. if (this.relation === "orderedOccurrence") {
  60267. if (this[_xfa_object.$extra].pageIndex + 1 < this.pageArea.children.length) {
  60268. this[_xfa_object.$extra].pageIndex += 1;
  60269. const pageArea = this.pageArea.children[this[_xfa_object.$extra].pageIndex];
  60270. return pageArea[_xfa_object.$getNextPage]();
  60271. }
  60272. if (this[_xfa_object.$extra].pageSetIndex + 1 < this.pageSet.children.length) {
  60273. this[_xfa_object.$extra].pageSetIndex += 1;
  60274. return this.pageSet.children[this[_xfa_object.$extra].pageSetIndex][_xfa_object.$getNextPage]();
  60275. }
  60276. if (this[_xfa_object.$isUsable]()) {
  60277. this[_xfa_object.$extra].numberOfUse += 1;
  60278. this[_xfa_object.$extra].pageIndex = -1;
  60279. this[_xfa_object.$extra].pageSetIndex = -1;
  60280. return this[_xfa_object.$getNextPage]();
  60281. }
  60282. const parent = this[_xfa_object.$getParent]();
  60283. if (parent instanceof PageSet) {
  60284. return parent[_xfa_object.$getNextPage]();
  60285. }
  60286. this[_xfa_object.$cleanPage]();
  60287. return this[_xfa_object.$getNextPage]();
  60288. }
  60289. const pageNumber = this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].pageNumber;
  60290. const parity = pageNumber % 2 === 0 ? "even" : "odd";
  60291. const position = pageNumber === 0 ? "first" : "rest";
  60292. let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position);
  60293. if (page) {
  60294. return page;
  60295. }
  60296. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position);
  60297. if (page) {
  60298. return page;
  60299. }
  60300. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any");
  60301. if (page) {
  60302. return page;
  60303. }
  60304. return this.pageArea.children[0];
  60305. }
  60306. }
  60307. class Para extends _xfa_object.XFAObject {
  60308. constructor(attributes) {
  60309. super(TEMPLATE_NS_ID, "para", true);
  60310. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  60311. this.id = attributes.id || "";
  60312. this.lineHeight = attributes.lineHeight ? (0, _utils.getMeasurement)(attributes.lineHeight, "0pt") : "";
  60313. this.marginLeft = attributes.marginLeft ? (0, _utils.getMeasurement)(attributes.marginLeft, "0pt") : "";
  60314. this.marginRight = attributes.marginRight ? (0, _utils.getMeasurement)(attributes.marginRight, "0pt") : "";
  60315. this.orphans = (0, _utils.getInteger)({
  60316. data: attributes.orphans,
  60317. defaultValue: 0,
  60318. validate: x => x >= 0
  60319. });
  60320. this.preserve = attributes.preserve || "";
  60321. this.radixOffset = attributes.radixOffset ? (0, _utils.getMeasurement)(attributes.radixOffset, "0pt") : "";
  60322. this.spaceAbove = attributes.spaceAbove ? (0, _utils.getMeasurement)(attributes.spaceAbove, "0pt") : "";
  60323. this.spaceBelow = attributes.spaceBelow ? (0, _utils.getMeasurement)(attributes.spaceBelow, "0pt") : "";
  60324. this.tabDefault = attributes.tabDefault ? (0, _utils.getMeasurement)(this.tabDefault) : "";
  60325. this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x);
  60326. this.textIndent = attributes.textIndent ? (0, _utils.getMeasurement)(attributes.textIndent, "0pt") : "";
  60327. this.use = attributes.use || "";
  60328. this.usehref = attributes.usehref || "";
  60329. this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, ["top", "bottom", "middle"]);
  60330. this.widows = (0, _utils.getInteger)({
  60331. data: attributes.widows,
  60332. defaultValue: 0,
  60333. validate: x => x >= 0
  60334. });
  60335. this.hyphenation = null;
  60336. }
  60337. [_xfa_object.$toStyle]() {
  60338. const style = (0, _html_utils.toStyle)(this, "hAlign");
  60339. if (this.marginLeft !== "") {
  60340. style.paddingLeft = (0, _html_utils.measureToString)(this.marginLeft);
  60341. }
  60342. if (this.marginRight !== "") {
  60343. style.paddingight = (0, _html_utils.measureToString)(this.marginRight);
  60344. }
  60345. if (this.spaceAbove !== "") {
  60346. style.paddingTop = (0, _html_utils.measureToString)(this.spaceAbove);
  60347. }
  60348. if (this.spaceBelow !== "") {
  60349. style.paddingBottom = (0, _html_utils.measureToString)(this.spaceBelow);
  60350. }
  60351. if (this.textIndent !== "") {
  60352. style.textIndent = (0, _html_utils.measureToString)(this.textIndent);
  60353. (0, _html_utils.fixTextIndent)(style);
  60354. }
  60355. if (this.lineHeight > 0) {
  60356. style.lineHeight = (0, _html_utils.measureToString)(this.lineHeight);
  60357. }
  60358. if (this.tabDefault !== "") {
  60359. style.tabSize = (0, _html_utils.measureToString)(this.tabDefault);
  60360. }
  60361. if (this.tabStops.length > 0) {}
  60362. if (this.hyphenatation) {
  60363. Object.assign(style, this.hyphenatation[_xfa_object.$toStyle]());
  60364. }
  60365. return style;
  60366. }
  60367. }
  60368. class PasswordEdit extends _xfa_object.XFAObject {
  60369. constructor(attributes) {
  60370. super(TEMPLATE_NS_ID, "passwordEdit", true);
  60371. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  60372. this.id = attributes.id || "";
  60373. this.passwordChar = attributes.passwordChar || "*";
  60374. this.use = attributes.use || "";
  60375. this.usehref = attributes.usehref || "";
  60376. this.border = null;
  60377. this.extras = null;
  60378. this.margin = null;
  60379. }
  60380. }
  60381. class Pattern extends _xfa_object.XFAObject {
  60382. constructor(attributes) {
  60383. super(TEMPLATE_NS_ID, "pattern", true);
  60384. this.id = attributes.id || "";
  60385. this.type = (0, _utils.getStringOption)(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
  60386. this.use = attributes.use || "";
  60387. this.usehref = attributes.usehref || "";
  60388. this.color = null;
  60389. this.extras = null;
  60390. }
  60391. [_xfa_object.$toStyle](startColor) {
  60392. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  60393. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  60394. const width = 5;
  60395. const cmd = "repeating-linear-gradient";
  60396. const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
  60397. switch (this.type) {
  60398. case "crossHatch":
  60399. return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
  60400. case "crossDiagonal":
  60401. return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
  60402. case "diagonalLeft":
  60403. return `${cmd}(45deg,${colors})`;
  60404. case "diagonalRight":
  60405. return `${cmd}(-45deg,${colors})`;
  60406. case "horizontal":
  60407. return `${cmd}(to top,${colors})`;
  60408. case "vertical":
  60409. return `${cmd}(to right,${colors})`;
  60410. }
  60411. return "";
  60412. }
  60413. }
  60414. class Picture extends _xfa_object.StringObject {
  60415. constructor(attributes) {
  60416. super(TEMPLATE_NS_ID, "picture");
  60417. this.id = attributes.id || "";
  60418. this.use = attributes.use || "";
  60419. this.usehref = attributes.usehref || "";
  60420. }
  60421. }
  60422. class Proto extends _xfa_object.XFAObject {
  60423. constructor(attributes) {
  60424. super(TEMPLATE_NS_ID, "proto", true);
  60425. this.appearanceFilter = new _xfa_object.XFAObjectArray();
  60426. this.arc = new _xfa_object.XFAObjectArray();
  60427. this.area = new _xfa_object.XFAObjectArray();
  60428. this.assist = new _xfa_object.XFAObjectArray();
  60429. this.barcode = new _xfa_object.XFAObjectArray();
  60430. this.bindItems = new _xfa_object.XFAObjectArray();
  60431. this.bookend = new _xfa_object.XFAObjectArray();
  60432. this.boolean = new _xfa_object.XFAObjectArray();
  60433. this.border = new _xfa_object.XFAObjectArray();
  60434. this.break = new _xfa_object.XFAObjectArray();
  60435. this.breakAfter = new _xfa_object.XFAObjectArray();
  60436. this.breakBefore = new _xfa_object.XFAObjectArray();
  60437. this.button = new _xfa_object.XFAObjectArray();
  60438. this.calculate = new _xfa_object.XFAObjectArray();
  60439. this.caption = new _xfa_object.XFAObjectArray();
  60440. this.certificate = new _xfa_object.XFAObjectArray();
  60441. this.certificates = new _xfa_object.XFAObjectArray();
  60442. this.checkButton = new _xfa_object.XFAObjectArray();
  60443. this.choiceList = new _xfa_object.XFAObjectArray();
  60444. this.color = new _xfa_object.XFAObjectArray();
  60445. this.comb = new _xfa_object.XFAObjectArray();
  60446. this.connect = new _xfa_object.XFAObjectArray();
  60447. this.contentArea = new _xfa_object.XFAObjectArray();
  60448. this.corner = new _xfa_object.XFAObjectArray();
  60449. this.date = new _xfa_object.XFAObjectArray();
  60450. this.dateTime = new _xfa_object.XFAObjectArray();
  60451. this.dateTimeEdit = new _xfa_object.XFAObjectArray();
  60452. this.decimal = new _xfa_object.XFAObjectArray();
  60453. this.defaultUi = new _xfa_object.XFAObjectArray();
  60454. this.desc = new _xfa_object.XFAObjectArray();
  60455. this.digestMethod = new _xfa_object.XFAObjectArray();
  60456. this.digestMethods = new _xfa_object.XFAObjectArray();
  60457. this.draw = new _xfa_object.XFAObjectArray();
  60458. this.edge = new _xfa_object.XFAObjectArray();
  60459. this.encoding = new _xfa_object.XFAObjectArray();
  60460. this.encodings = new _xfa_object.XFAObjectArray();
  60461. this.encrypt = new _xfa_object.XFAObjectArray();
  60462. this.encryptData = new _xfa_object.XFAObjectArray();
  60463. this.encryption = new _xfa_object.XFAObjectArray();
  60464. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  60465. this.encryptionMethods = new _xfa_object.XFAObjectArray();
  60466. this.event = new _xfa_object.XFAObjectArray();
  60467. this.exData = new _xfa_object.XFAObjectArray();
  60468. this.exObject = new _xfa_object.XFAObjectArray();
  60469. this.exclGroup = new _xfa_object.XFAObjectArray();
  60470. this.execute = new _xfa_object.XFAObjectArray();
  60471. this.extras = new _xfa_object.XFAObjectArray();
  60472. this.field = new _xfa_object.XFAObjectArray();
  60473. this.fill = new _xfa_object.XFAObjectArray();
  60474. this.filter = new _xfa_object.XFAObjectArray();
  60475. this.float = new _xfa_object.XFAObjectArray();
  60476. this.font = new _xfa_object.XFAObjectArray();
  60477. this.format = new _xfa_object.XFAObjectArray();
  60478. this.handler = new _xfa_object.XFAObjectArray();
  60479. this.hyphenation = new _xfa_object.XFAObjectArray();
  60480. this.image = new _xfa_object.XFAObjectArray();
  60481. this.imageEdit = new _xfa_object.XFAObjectArray();
  60482. this.integer = new _xfa_object.XFAObjectArray();
  60483. this.issuers = new _xfa_object.XFAObjectArray();
  60484. this.items = new _xfa_object.XFAObjectArray();
  60485. this.keep = new _xfa_object.XFAObjectArray();
  60486. this.keyUsage = new _xfa_object.XFAObjectArray();
  60487. this.line = new _xfa_object.XFAObjectArray();
  60488. this.linear = new _xfa_object.XFAObjectArray();
  60489. this.lockDocument = new _xfa_object.XFAObjectArray();
  60490. this.manifest = new _xfa_object.XFAObjectArray();
  60491. this.margin = new _xfa_object.XFAObjectArray();
  60492. this.mdp = new _xfa_object.XFAObjectArray();
  60493. this.medium = new _xfa_object.XFAObjectArray();
  60494. this.message = new _xfa_object.XFAObjectArray();
  60495. this.numericEdit = new _xfa_object.XFAObjectArray();
  60496. this.occur = new _xfa_object.XFAObjectArray();
  60497. this.oid = new _xfa_object.XFAObjectArray();
  60498. this.oids = new _xfa_object.XFAObjectArray();
  60499. this.overflow = new _xfa_object.XFAObjectArray();
  60500. this.pageArea = new _xfa_object.XFAObjectArray();
  60501. this.pageSet = new _xfa_object.XFAObjectArray();
  60502. this.para = new _xfa_object.XFAObjectArray();
  60503. this.passwordEdit = new _xfa_object.XFAObjectArray();
  60504. this.pattern = new _xfa_object.XFAObjectArray();
  60505. this.picture = new _xfa_object.XFAObjectArray();
  60506. this.radial = new _xfa_object.XFAObjectArray();
  60507. this.reason = new _xfa_object.XFAObjectArray();
  60508. this.reasons = new _xfa_object.XFAObjectArray();
  60509. this.rectangle = new _xfa_object.XFAObjectArray();
  60510. this.ref = new _xfa_object.XFAObjectArray();
  60511. this.script = new _xfa_object.XFAObjectArray();
  60512. this.setProperty = new _xfa_object.XFAObjectArray();
  60513. this.signData = new _xfa_object.XFAObjectArray();
  60514. this.signature = new _xfa_object.XFAObjectArray();
  60515. this.signing = new _xfa_object.XFAObjectArray();
  60516. this.solid = new _xfa_object.XFAObjectArray();
  60517. this.speak = new _xfa_object.XFAObjectArray();
  60518. this.stipple = new _xfa_object.XFAObjectArray();
  60519. this.subform = new _xfa_object.XFAObjectArray();
  60520. this.subformSet = new _xfa_object.XFAObjectArray();
  60521. this.subjectDN = new _xfa_object.XFAObjectArray();
  60522. this.subjectDNs = new _xfa_object.XFAObjectArray();
  60523. this.submit = new _xfa_object.XFAObjectArray();
  60524. this.text = new _xfa_object.XFAObjectArray();
  60525. this.textEdit = new _xfa_object.XFAObjectArray();
  60526. this.time = new _xfa_object.XFAObjectArray();
  60527. this.timeStamp = new _xfa_object.XFAObjectArray();
  60528. this.toolTip = new _xfa_object.XFAObjectArray();
  60529. this.traversal = new _xfa_object.XFAObjectArray();
  60530. this.traverse = new _xfa_object.XFAObjectArray();
  60531. this.ui = new _xfa_object.XFAObjectArray();
  60532. this.validate = new _xfa_object.XFAObjectArray();
  60533. this.value = new _xfa_object.XFAObjectArray();
  60534. this.variables = new _xfa_object.XFAObjectArray();
  60535. }
  60536. }
  60537. class Radial extends _xfa_object.XFAObject {
  60538. constructor(attributes) {
  60539. super(TEMPLATE_NS_ID, "radial", true);
  60540. this.id = attributes.id || "";
  60541. this.type = (0, _utils.getStringOption)(attributes.type, ["toEdge", "toCenter"]);
  60542. this.use = attributes.use || "";
  60543. this.usehref = attributes.usehref || "";
  60544. this.color = null;
  60545. this.extras = null;
  60546. }
  60547. [_xfa_object.$toStyle](startColor) {
  60548. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  60549. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  60550. const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
  60551. return `radial-gradient(circle at center, ${colors})`;
  60552. }
  60553. }
  60554. class Reason extends _xfa_object.StringObject {
  60555. constructor(attributes) {
  60556. super(TEMPLATE_NS_ID, "reason");
  60557. this.id = attributes.id || "";
  60558. this.name = attributes.name || "";
  60559. this.use = attributes.use || "";
  60560. this.usehref = attributes.usehref || "";
  60561. }
  60562. }
  60563. class Reasons extends _xfa_object.XFAObject {
  60564. constructor(attributes) {
  60565. super(TEMPLATE_NS_ID, "reasons", true);
  60566. this.id = attributes.id || "";
  60567. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  60568. this.use = attributes.use || "";
  60569. this.usehref = attributes.usehref || "";
  60570. this.reason = new _xfa_object.XFAObjectArray();
  60571. }
  60572. }
  60573. class Rectangle extends _xfa_object.XFAObject {
  60574. constructor(attributes) {
  60575. super(TEMPLATE_NS_ID, "rectangle", true);
  60576. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  60577. this.id = attributes.id || "";
  60578. this.use = attributes.use || "";
  60579. this.usehref = attributes.usehref || "";
  60580. this.corner = new _xfa_object.XFAObjectArray(4);
  60581. this.edge = new _xfa_object.XFAObjectArray(4);
  60582. this.fill = null;
  60583. }
  60584. [_xfa_object.$toHTML]() {
  60585. const edge = this.edge.children.length ? this.edge.children[0] : new Edge({});
  60586. const edgeStyle = edge[_xfa_object.$toStyle]();
  60587. const style = Object.create(null);
  60588. if (this.fill && this.fill.presence === "visible") {
  60589. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  60590. } else {
  60591. style.fill = "transparent";
  60592. }
  60593. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  60594. style.stroke = edgeStyle.color;
  60595. const corner = this.corner.children.length ? this.corner.children[0] : new Corner({});
  60596. const cornerStyle = corner[_xfa_object.$toStyle]();
  60597. const rect = {
  60598. name: "rect",
  60599. attributes: {
  60600. xmlns: SVG_NS,
  60601. width: "100%",
  60602. height: "100%",
  60603. x: 0,
  60604. y: 0,
  60605. rx: cornerStyle.radius,
  60606. ry: cornerStyle.radius,
  60607. style
  60608. }
  60609. };
  60610. const svg = {
  60611. name: "svg",
  60612. children: [rect],
  60613. attributes: {
  60614. xmlns: SVG_NS,
  60615. style: {
  60616. overflow: "visible"
  60617. },
  60618. width: "100%",
  60619. height: "100%"
  60620. }
  60621. };
  60622. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  60623. if (hasMargin(parent)) {
  60624. return _utils.HTMLResult.success({
  60625. name: "div",
  60626. attributes: {
  60627. style: {
  60628. display: "inline",
  60629. width: "100%",
  60630. height: "100%"
  60631. }
  60632. },
  60633. children: [svg]
  60634. });
  60635. }
  60636. svg.attributes.style.position = "absolute";
  60637. return _utils.HTMLResult.success(svg);
  60638. }
  60639. }
  60640. class RefElement extends _xfa_object.StringObject {
  60641. constructor(attributes) {
  60642. super(TEMPLATE_NS_ID, "ref");
  60643. this.id = attributes.id || "";
  60644. this.use = attributes.use || "";
  60645. this.usehref = attributes.usehref || "";
  60646. }
  60647. }
  60648. class Script extends _xfa_object.StringObject {
  60649. constructor(attributes) {
  60650. super(TEMPLATE_NS_ID, "script");
  60651. this.binding = attributes.binding || "";
  60652. this.contentType = attributes.contentType || "";
  60653. this.id = attributes.id || "";
  60654. this.name = attributes.name || "";
  60655. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  60656. this.use = attributes.use || "";
  60657. this.usehref = attributes.usehref || "";
  60658. }
  60659. }
  60660. class SetProperty extends _xfa_object.XFAObject {
  60661. constructor(attributes) {
  60662. super(TEMPLATE_NS_ID, "setProperty");
  60663. this.connection = attributes.connection || "";
  60664. this.ref = attributes.ref || "";
  60665. this.target = attributes.target || "";
  60666. }
  60667. }
  60668. exports.SetProperty = SetProperty;
  60669. class SignData extends _xfa_object.XFAObject {
  60670. constructor(attributes) {
  60671. super(TEMPLATE_NS_ID, "signData", true);
  60672. this.id = attributes.id || "";
  60673. this.operation = (0, _utils.getStringOption)(attributes.operation, ["sign", "clear", "verify"]);
  60674. this.ref = attributes.ref || "";
  60675. this.target = attributes.target || "";
  60676. this.use = attributes.use || "";
  60677. this.usehref = attributes.usehref || "";
  60678. this.filter = null;
  60679. this.manifest = null;
  60680. }
  60681. }
  60682. class Signature extends _xfa_object.XFAObject {
  60683. constructor(attributes) {
  60684. super(TEMPLATE_NS_ID, "signature", true);
  60685. this.id = attributes.id || "";
  60686. this.type = (0, _utils.getStringOption)(attributes.type, ["PDF1.3", "PDF1.6"]);
  60687. this.use = attributes.use || "";
  60688. this.usehref = attributes.usehref || "";
  60689. this.border = null;
  60690. this.extras = null;
  60691. this.filter = null;
  60692. this.manifest = null;
  60693. this.margin = null;
  60694. }
  60695. }
  60696. class Signing extends _xfa_object.XFAObject {
  60697. constructor(attributes) {
  60698. super(TEMPLATE_NS_ID, "signing", true);
  60699. this.id = attributes.id || "";
  60700. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  60701. this.use = attributes.use || "";
  60702. this.usehref = attributes.usehref || "";
  60703. this.certificate = new _xfa_object.XFAObjectArray();
  60704. }
  60705. }
  60706. class Solid extends _xfa_object.XFAObject {
  60707. constructor(attributes) {
  60708. super(TEMPLATE_NS_ID, "solid", true);
  60709. this.id = attributes.id || "";
  60710. this.use = attributes.use || "";
  60711. this.usehref = attributes.usehref || "";
  60712. this.extras = null;
  60713. }
  60714. [_xfa_object.$toStyle](startColor) {
  60715. return startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  60716. }
  60717. }
  60718. class Speak extends _xfa_object.StringObject {
  60719. constructor(attributes) {
  60720. super(TEMPLATE_NS_ID, "speak");
  60721. this.disable = (0, _utils.getInteger)({
  60722. data: attributes.disable,
  60723. defaultValue: 0,
  60724. validate: x => x === 1
  60725. });
  60726. this.id = attributes.id || "";
  60727. this.priority = (0, _utils.getStringOption)(attributes.priority, ["custom", "caption", "name", "toolTip"]);
  60728. this.rid = attributes.rid || "";
  60729. this.use = attributes.use || "";
  60730. this.usehref = attributes.usehref || "";
  60731. }
  60732. }
  60733. class Stipple extends _xfa_object.XFAObject {
  60734. constructor(attributes) {
  60735. super(TEMPLATE_NS_ID, "stipple", true);
  60736. this.id = attributes.id || "";
  60737. this.rate = (0, _utils.getInteger)({
  60738. data: attributes.rate,
  60739. defaultValue: 50,
  60740. validate: x => x >= 0 && x <= 100
  60741. });
  60742. this.use = attributes.use || "";
  60743. this.usehref = attributes.usehref || "";
  60744. this.color = null;
  60745. this.extras = null;
  60746. }
  60747. [_xfa_object.$toStyle](bgColor) {
  60748. const alpha = this.rate / 100;
  60749. 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));
  60750. }
  60751. }
  60752. class Subform extends _xfa_object.XFAObject {
  60753. constructor(attributes) {
  60754. super(TEMPLATE_NS_ID, "subform", true);
  60755. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  60756. this.allowMacro = (0, _utils.getInteger)({
  60757. data: attributes.allowMacro,
  60758. defaultValue: 0,
  60759. validate: x => x === 1
  60760. });
  60761. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  60762. this.colSpan = (0, _utils.getInteger)({
  60763. data: attributes.colSpan,
  60764. defaultValue: 1,
  60765. validate: n => n >= 1 || n === -1
  60766. });
  60767. this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : (0, _utils.getMeasurement)(x));
  60768. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  60769. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  60770. this.id = attributes.id || "";
  60771. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  60772. this.locale = attributes.locale || "";
  60773. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  60774. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  60775. this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, ["consumeData", "matchTemplate"]);
  60776. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  60777. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  60778. this.name = attributes.name || "";
  60779. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  60780. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  60781. this.restoreState = (0, _utils.getStringOption)(attributes.restoreState, ["manual", "auto"]);
  60782. this.scope = (0, _utils.getStringOption)(attributes.scope, ["name", "none"]);
  60783. this.use = attributes.use || "";
  60784. this.usehref = attributes.usehref || "";
  60785. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  60786. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  60787. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  60788. this.assist = null;
  60789. this.bind = null;
  60790. this.bookend = null;
  60791. this.border = null;
  60792. this.break = null;
  60793. this.calculate = null;
  60794. this.desc = null;
  60795. this.extras = null;
  60796. this.keep = null;
  60797. this.margin = null;
  60798. this.occur = null;
  60799. this.overflow = null;
  60800. this.pageSet = null;
  60801. this.para = null;
  60802. this.traversal = null;
  60803. this.validate = null;
  60804. this.variables = null;
  60805. this.area = new _xfa_object.XFAObjectArray();
  60806. this.breakAfter = new _xfa_object.XFAObjectArray();
  60807. this.breakBefore = new _xfa_object.XFAObjectArray();
  60808. this.connect = new _xfa_object.XFAObjectArray();
  60809. this.draw = new _xfa_object.XFAObjectArray();
  60810. this.event = new _xfa_object.XFAObjectArray();
  60811. this.exObject = new _xfa_object.XFAObjectArray();
  60812. this.exclGroup = new _xfa_object.XFAObjectArray();
  60813. this.field = new _xfa_object.XFAObjectArray();
  60814. this.proto = new _xfa_object.XFAObjectArray();
  60815. this.setProperty = new _xfa_object.XFAObjectArray();
  60816. this.subform = new _xfa_object.XFAObjectArray();
  60817. this.subformSet = new _xfa_object.XFAObjectArray();
  60818. }
  60819. [_xfa_object.$getSubformParent]() {
  60820. const parent = this[_xfa_object.$getParent]();
  60821. if (parent instanceof SubformSet) {
  60822. return parent[_xfa_object.$getSubformParent]();
  60823. }
  60824. return parent;
  60825. }
  60826. [_xfa_object.$isBindable]() {
  60827. return true;
  60828. }
  60829. [_xfa_object.$isThereMoreWidth]() {
  60830. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  60831. }
  60832. *[_xfa_object.$getContainedChildren]() {
  60833. yield* getContainedChildren(this);
  60834. }
  60835. [_xfa_object.$flushHTML]() {
  60836. return (0, _layout.flushHTML)(this);
  60837. }
  60838. [_xfa_object.$addHTML](html, bbox) {
  60839. (0, _layout.addHTML)(this, html, bbox);
  60840. }
  60841. [_xfa_object.$getAvailableSpace]() {
  60842. return (0, _layout.getAvailableSpace)(this);
  60843. }
  60844. [_xfa_object.$isSplittable]() {
  60845. const parent = this[_xfa_object.$getSubformParent]();
  60846. if (!parent[_xfa_object.$isSplittable]()) {
  60847. return false;
  60848. }
  60849. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  60850. return this[_xfa_object.$extra]._isSplittable;
  60851. }
  60852. if (this.layout === "position" || this.layout.includes("row")) {
  60853. this[_xfa_object.$extra]._isSplittable = false;
  60854. return false;
  60855. }
  60856. if (this.keep && this.keep.intact !== "none") {
  60857. this[_xfa_object.$extra]._isSplittable = false;
  60858. return false;
  60859. }
  60860. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  60861. return false;
  60862. }
  60863. this[_xfa_object.$extra]._isSplittable = true;
  60864. return true;
  60865. }
  60866. [_xfa_object.$toHTML](availableSpace) {
  60867. setTabIndex(this);
  60868. if (this.break) {
  60869. if (this.break.after !== "auto" || this.break.afterTarget !== "") {
  60870. const node = new BreakAfter({
  60871. targetType: this.break.after,
  60872. target: this.break.afterTarget,
  60873. startNew: this.break.startNew.toString()
  60874. });
  60875. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  60876. this[_xfa_object.$appendChild](node);
  60877. this.breakAfter.push(node);
  60878. }
  60879. if (this.break.before !== "auto" || this.break.beforeTarget !== "") {
  60880. const node = new BreakBefore({
  60881. targetType: this.break.before,
  60882. target: this.break.beforeTarget,
  60883. startNew: this.break.startNew.toString()
  60884. });
  60885. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  60886. this[_xfa_object.$appendChild](node);
  60887. this.breakBefore.push(node);
  60888. }
  60889. if (this.break.overflowTarget !== "") {
  60890. const node = new Overflow({
  60891. target: this.break.overflowTarget,
  60892. leader: this.break.overflowLeader,
  60893. trailer: this.break.overflowTrailer
  60894. });
  60895. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  60896. this[_xfa_object.$appendChild](node);
  60897. this.overflow.push(node);
  60898. }
  60899. this[_xfa_object.$removeChild](this.break);
  60900. this.break = null;
  60901. }
  60902. if (this.presence === "hidden" || this.presence === "inactive") {
  60903. return _utils.HTMLResult.EMPTY;
  60904. }
  60905. if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) {
  60906. (0, _util.warn)("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");
  60907. }
  60908. if (this.breakBefore.children.length >= 1) {
  60909. const breakBefore = this.breakBefore.children[0];
  60910. if (handleBreak(breakBefore)) {
  60911. return _utils.HTMLResult.breakNode(breakBefore);
  60912. }
  60913. }
  60914. if (this[_xfa_object.$extra] && this[_xfa_object.$extra].afterBreakAfter) {
  60915. return _utils.HTMLResult.EMPTY;
  60916. }
  60917. (0, _html_utils.fixDimensions)(this);
  60918. const children = [];
  60919. const attributes = {
  60920. id: this[_xfa_object.$uid],
  60921. class: []
  60922. };
  60923. (0, _html_utils.setAccess)(this, attributes.class);
  60924. if (!this[_xfa_object.$extra]) {
  60925. this[_xfa_object.$extra] = Object.create(null);
  60926. }
  60927. Object.assign(this[_xfa_object.$extra], {
  60928. children,
  60929. line: null,
  60930. attributes,
  60931. attempt: 0,
  60932. numberInLine: 0,
  60933. availableSpace: {
  60934. width: Math.min(this.w || Infinity, availableSpace.width),
  60935. height: Math.min(this.h || Infinity, availableSpace.height)
  60936. },
  60937. width: 0,
  60938. height: 0,
  60939. prevHeight: 0,
  60940. currentWidth: 0
  60941. });
  60942. const root = this[_xfa_object.$getTemplateRoot]();
  60943. const savedNoLayoutFailure = root[_xfa_object.$extra].noLayoutFailure;
  60944. const isSplittable = this[_xfa_object.$isSplittable]();
  60945. if (!isSplittable) {
  60946. setFirstUnsplittable(this);
  60947. }
  60948. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  60949. return _utils.HTMLResult.FAILURE;
  60950. }
  60951. const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]);
  60952. if (this.layout.includes("row")) {
  60953. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  60954. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  60955. this[_xfa_object.$extra].columnWidths = columnWidths;
  60956. this[_xfa_object.$extra].currentColumn = 0;
  60957. }
  60958. }
  60959. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  60960. const classNames = ["xfaSubform"];
  60961. const cl = (0, _html_utils.layoutClass)(this);
  60962. if (cl) {
  60963. classNames.push(cl);
  60964. }
  60965. attributes.style = style;
  60966. attributes.class = classNames;
  60967. if (this.name) {
  60968. attributes.xfaName = this.name;
  60969. }
  60970. if (this.overflow) {
  60971. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  60972. if (overflowExtra.addLeader) {
  60973. overflowExtra.addLeader = false;
  60974. handleOverflow(this, overflowExtra.leader, availableSpace);
  60975. }
  60976. }
  60977. this[_xfa_object.$pushPara]();
  60978. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  60979. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  60980. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  60981. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  60982. this[_xfa_object.$extra].numberInLine = 0;
  60983. }
  60984. const result = this[_xfa_object.$childrenToHTML]({
  60985. filter,
  60986. include: true
  60987. });
  60988. if (result.success) {
  60989. break;
  60990. }
  60991. if (result.isBreak()) {
  60992. this[_xfa_object.$popPara]();
  60993. return result;
  60994. }
  60995. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !root[_xfa_object.$extra].noLayoutFailure) {
  60996. this[_xfa_object.$extra].attempt = maxRun;
  60997. break;
  60998. }
  60999. }
  61000. this[_xfa_object.$popPara]();
  61001. if (!isSplittable) {
  61002. unsetFirstUnsplittable(this);
  61003. }
  61004. root[_xfa_object.$extra].noLayoutFailure = savedNoLayoutFailure;
  61005. if (this[_xfa_object.$extra].attempt === maxRun) {
  61006. if (this.overflow) {
  61007. this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].overflowNode = this.overflow;
  61008. }
  61009. if (!isSplittable) {
  61010. delete this[_xfa_object.$extra];
  61011. }
  61012. return _utils.HTMLResult.FAILURE;
  61013. }
  61014. if (this.overflow) {
  61015. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  61016. if (overflowExtra.addTrailer) {
  61017. overflowExtra.addTrailer = false;
  61018. handleOverflow(this, overflowExtra.trailer, availableSpace);
  61019. }
  61020. }
  61021. let marginH = 0;
  61022. let marginV = 0;
  61023. if (this.margin) {
  61024. marginH = this.margin.leftInset + this.margin.rightInset;
  61025. marginV = this.margin.topInset + this.margin.bottomInset;
  61026. }
  61027. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  61028. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  61029. const bbox = [this.x, this.y, width, height];
  61030. if (this.w === "") {
  61031. style.width = (0, _html_utils.measureToString)(width);
  61032. }
  61033. if (this.h === "") {
  61034. style.height = (0, _html_utils.measureToString)(height);
  61035. }
  61036. if ((style.width === "0px" || style.height === "0px") && children.length === 0) {
  61037. return _utils.HTMLResult.EMPTY;
  61038. }
  61039. const html = {
  61040. name: "div",
  61041. attributes,
  61042. children
  61043. };
  61044. applyAssist(this, attributes);
  61045. const result = _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  61046. if (this.breakAfter.children.length >= 1) {
  61047. const breakAfter = this.breakAfter.children[0];
  61048. if (handleBreak(breakAfter)) {
  61049. this[_xfa_object.$extra].afterBreakAfter = result;
  61050. return _utils.HTMLResult.breakNode(breakAfter);
  61051. }
  61052. }
  61053. delete this[_xfa_object.$extra];
  61054. return result;
  61055. }
  61056. }
  61057. class SubformSet extends _xfa_object.XFAObject {
  61058. constructor(attributes) {
  61059. super(TEMPLATE_NS_ID, "subformSet", true);
  61060. this.id = attributes.id || "";
  61061. this.name = attributes.name || "";
  61062. this.relation = (0, _utils.getStringOption)(attributes.relation, ["ordered", "choice", "unordered"]);
  61063. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  61064. this.use = attributes.use || "";
  61065. this.usehref = attributes.usehref || "";
  61066. this.bookend = null;
  61067. this.break = null;
  61068. this.desc = null;
  61069. this.extras = null;
  61070. this.occur = null;
  61071. this.overflow = null;
  61072. this.breakAfter = new _xfa_object.XFAObjectArray();
  61073. this.breakBefore = new _xfa_object.XFAObjectArray();
  61074. this.subform = new _xfa_object.XFAObjectArray();
  61075. this.subformSet = new _xfa_object.XFAObjectArray();
  61076. }
  61077. *[_xfa_object.$getContainedChildren]() {
  61078. yield* getContainedChildren(this);
  61079. }
  61080. [_xfa_object.$getSubformParent]() {
  61081. let parent = this[_xfa_object.$getParent]();
  61082. while (!(parent instanceof Subform)) {
  61083. parent = parent[_xfa_object.$getParent]();
  61084. }
  61085. return parent;
  61086. }
  61087. [_xfa_object.$isBindable]() {
  61088. return true;
  61089. }
  61090. }
  61091. class SubjectDN extends _xfa_object.ContentObject {
  61092. constructor(attributes) {
  61093. super(TEMPLATE_NS_ID, "subjectDN");
  61094. this.delimiter = attributes.delimiter || ",";
  61095. this.id = attributes.id || "";
  61096. this.name = attributes.name || "";
  61097. this.use = attributes.use || "";
  61098. this.usehref = attributes.usehref || "";
  61099. }
  61100. [_xfa_object.$finalize]() {
  61101. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].split(this.delimiter).map(kv => {
  61102. kv = kv.split("=", 2);
  61103. kv[0] = kv[0].trim();
  61104. return kv;
  61105. }));
  61106. }
  61107. }
  61108. class SubjectDNs extends _xfa_object.XFAObject {
  61109. constructor(attributes) {
  61110. super(TEMPLATE_NS_ID, "subjectDNs", true);
  61111. this.id = attributes.id || "";
  61112. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  61113. this.use = attributes.use || "";
  61114. this.usehref = attributes.usehref || "";
  61115. this.subjectDN = new _xfa_object.XFAObjectArray();
  61116. }
  61117. }
  61118. class Submit extends _xfa_object.XFAObject {
  61119. constructor(attributes) {
  61120. super(TEMPLATE_NS_ID, "submit", true);
  61121. this.embedPDF = (0, _utils.getInteger)({
  61122. data: attributes.embedPDF,
  61123. defaultValue: 0,
  61124. validate: x => x === 1
  61125. });
  61126. this.format = (0, _utils.getStringOption)(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]);
  61127. this.id = attributes.id || "";
  61128. this.target = attributes.target || "";
  61129. this.textEncoding = (0, _utils.getKeyword)({
  61130. data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "",
  61131. defaultValue: "",
  61132. 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}/)
  61133. });
  61134. this.use = attributes.use || "";
  61135. this.usehref = attributes.usehref || "";
  61136. this.xdpContent = attributes.xdpContent || "";
  61137. this.encrypt = null;
  61138. this.encryptData = new _xfa_object.XFAObjectArray();
  61139. this.signData = new _xfa_object.XFAObjectArray();
  61140. }
  61141. }
  61142. class Template extends _xfa_object.XFAObject {
  61143. constructor(attributes) {
  61144. super(TEMPLATE_NS_ID, "template", true);
  61145. this.baseProfile = (0, _utils.getStringOption)(attributes.baseProfile, ["full", "interactiveForms"]);
  61146. this.extras = null;
  61147. this.subform = new _xfa_object.XFAObjectArray();
  61148. }
  61149. [_xfa_object.$finalize]() {
  61150. if (this.subform.children.length === 0) {
  61151. (0, _util.warn)("XFA - No subforms in template node.");
  61152. }
  61153. if (this.subform.children.length >= 2) {
  61154. (0, _util.warn)("XFA - Several subforms in template node: please file a bug.");
  61155. }
  61156. this[_xfa_object.$tabIndex] = DEFAULT_TAB_INDEX;
  61157. }
  61158. [_xfa_object.$isSplittable]() {
  61159. return true;
  61160. }
  61161. [_xfa_object.$searchNode](expr, container) {
  61162. if (expr.startsWith("#")) {
  61163. return [this[_xfa_object.$ids].get(expr.slice(1))];
  61164. }
  61165. return (0, _som.searchNode)(this, container, expr, true, true);
  61166. }
  61167. *[_xfa_object.$toPages]() {
  61168. if (!this.subform.children.length) {
  61169. return _utils.HTMLResult.success({
  61170. name: "div",
  61171. children: []
  61172. });
  61173. }
  61174. this[_xfa_object.$extra] = {
  61175. overflowNode: null,
  61176. firstUnsplittable: null,
  61177. currentContentArea: null,
  61178. currentPageArea: null,
  61179. noLayoutFailure: false,
  61180. pageNumber: 1,
  61181. pagePosition: "first",
  61182. oddOrEven: "odd",
  61183. blankOrNotBlank: "nonBlank",
  61184. paraStack: []
  61185. };
  61186. const root = this.subform.children[0];
  61187. root.pageSet[_xfa_object.$cleanPage]();
  61188. const pageAreas = root.pageSet.pageArea.children;
  61189. const mainHtml = {
  61190. name: "div",
  61191. children: []
  61192. };
  61193. let pageArea = null;
  61194. let breakBefore = null;
  61195. let breakBeforeTarget = null;
  61196. if (root.breakBefore.children.length >= 1) {
  61197. breakBefore = root.breakBefore.children[0];
  61198. breakBeforeTarget = breakBefore.target;
  61199. } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) {
  61200. breakBefore = root.subform.children[0].breakBefore.children[0];
  61201. breakBeforeTarget = breakBefore.target;
  61202. } else if (root.break && root.break.beforeTarget) {
  61203. breakBefore = root.break;
  61204. breakBeforeTarget = breakBefore.beforeTarget;
  61205. } else if (root.subform.children.length >= 1 && root.subform.children[0].break && root.subform.children[0].break.beforeTarget) {
  61206. breakBefore = root.subform.children[0].break;
  61207. breakBeforeTarget = breakBefore.beforeTarget;
  61208. }
  61209. if (breakBefore) {
  61210. const target = this[_xfa_object.$searchNode](breakBeforeTarget, breakBefore[_xfa_object.$getParent]());
  61211. if (target instanceof PageArea) {
  61212. pageArea = target;
  61213. breakBefore[_xfa_object.$extra] = {};
  61214. }
  61215. }
  61216. if (!pageArea) {
  61217. pageArea = pageAreas[0];
  61218. }
  61219. pageArea[_xfa_object.$extra] = {
  61220. numberOfUse: 1
  61221. };
  61222. const pageAreaParent = pageArea[_xfa_object.$getParent]();
  61223. pageAreaParent[_xfa_object.$extra] = {
  61224. numberOfUse: 1,
  61225. pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea),
  61226. pageSetIndex: 0
  61227. };
  61228. let targetPageArea;
  61229. let leader = null;
  61230. let trailer = null;
  61231. let hasSomething = true;
  61232. let hasSomethingCounter = 0;
  61233. let startIndex = 0;
  61234. while (true) {
  61235. if (!hasSomething) {
  61236. mainHtml.children.pop();
  61237. if (++hasSomethingCounter === MAX_EMPTY_PAGES) {
  61238. (0, _util.warn)("XFA - Something goes wrong: please file a bug.");
  61239. return mainHtml;
  61240. }
  61241. } else {
  61242. hasSomethingCounter = 0;
  61243. }
  61244. targetPageArea = null;
  61245. this[_xfa_object.$extra].currentPageArea = pageArea;
  61246. const page = pageArea[_xfa_object.$toHTML]().html;
  61247. mainHtml.children.push(page);
  61248. if (leader) {
  61249. this[_xfa_object.$extra].noLayoutFailure = true;
  61250. page.children.push(leader[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  61251. leader = null;
  61252. }
  61253. if (trailer) {
  61254. this[_xfa_object.$extra].noLayoutFailure = true;
  61255. page.children.push(trailer[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  61256. trailer = null;
  61257. }
  61258. const contentAreas = pageArea.contentArea.children;
  61259. const htmlContentAreas = page.children.filter(node => node.attributes.class.includes("xfaContentarea"));
  61260. hasSomething = false;
  61261. this[_xfa_object.$extra].firstUnsplittable = null;
  61262. this[_xfa_object.$extra].noLayoutFailure = false;
  61263. const flush = index => {
  61264. const html = root[_xfa_object.$flushHTML]();
  61265. if (html) {
  61266. hasSomething = hasSomething || html.children && html.children.length !== 0;
  61267. htmlContentAreas[index].children.push(html);
  61268. }
  61269. };
  61270. for (let i = startIndex, ii = contentAreas.length; i < ii; i++) {
  61271. const contentArea = this[_xfa_object.$extra].currentContentArea = contentAreas[i];
  61272. const space = {
  61273. width: contentArea.w,
  61274. height: contentArea.h
  61275. };
  61276. startIndex = 0;
  61277. if (leader) {
  61278. htmlContentAreas[i].children.push(leader[_xfa_object.$toHTML](space).html);
  61279. leader = null;
  61280. }
  61281. if (trailer) {
  61282. htmlContentAreas[i].children.push(trailer[_xfa_object.$toHTML](space).html);
  61283. trailer = null;
  61284. }
  61285. const html = root[_xfa_object.$toHTML](space);
  61286. if (html.success) {
  61287. if (html.html) {
  61288. hasSomething = hasSomething || html.html.children && html.html.children.length !== 0;
  61289. htmlContentAreas[i].children.push(html.html);
  61290. } else if (!hasSomething && mainHtml.children.length > 1) {
  61291. mainHtml.children.pop();
  61292. }
  61293. return mainHtml;
  61294. }
  61295. if (html.isBreak()) {
  61296. const node = html.breakNode;
  61297. flush(i);
  61298. if (node.targetType === "auto") {
  61299. continue;
  61300. }
  61301. if (node.leader) {
  61302. leader = this[_xfa_object.$searchNode](node.leader, node[_xfa_object.$getParent]());
  61303. leader = leader ? leader[0] : null;
  61304. }
  61305. if (node.trailer) {
  61306. trailer = this[_xfa_object.$searchNode](node.trailer, node[_xfa_object.$getParent]());
  61307. trailer = trailer ? trailer[0] : null;
  61308. }
  61309. if (node.targetType === "pageArea") {
  61310. targetPageArea = node[_xfa_object.$extra].target;
  61311. i = Infinity;
  61312. } else if (!node[_xfa_object.$extra].target) {
  61313. i = node[_xfa_object.$extra].index;
  61314. } else {
  61315. targetPageArea = node[_xfa_object.$extra].target;
  61316. startIndex = node[_xfa_object.$extra].index + 1;
  61317. i = Infinity;
  61318. }
  61319. continue;
  61320. }
  61321. if (this[_xfa_object.$extra].overflowNode) {
  61322. const node = this[_xfa_object.$extra].overflowNode;
  61323. this[_xfa_object.$extra].overflowNode = null;
  61324. const overflowExtra = node[_xfa_object.$getExtra]();
  61325. const target = overflowExtra.target;
  61326. overflowExtra.addLeader = overflowExtra.leader !== null;
  61327. overflowExtra.addTrailer = overflowExtra.trailer !== null;
  61328. flush(i);
  61329. const currentIndex = i;
  61330. i = Infinity;
  61331. if (target instanceof PageArea) {
  61332. targetPageArea = target;
  61333. } else if (target instanceof ContentArea) {
  61334. const index = contentAreas.indexOf(target);
  61335. if (index !== -1) {
  61336. if (index > currentIndex) {
  61337. i = index - 1;
  61338. } else {
  61339. startIndex = index;
  61340. }
  61341. } else {
  61342. targetPageArea = target[_xfa_object.$getParent]();
  61343. startIndex = targetPageArea.contentArea.children.indexOf(target);
  61344. }
  61345. }
  61346. continue;
  61347. }
  61348. flush(i);
  61349. }
  61350. this[_xfa_object.$extra].pageNumber += 1;
  61351. if (targetPageArea) {
  61352. if (targetPageArea[_xfa_object.$isUsable]()) {
  61353. targetPageArea[_xfa_object.$extra].numberOfUse += 1;
  61354. } else {
  61355. targetPageArea = null;
  61356. }
  61357. }
  61358. pageArea = targetPageArea || pageArea[_xfa_object.$getNextPage]();
  61359. yield null;
  61360. }
  61361. }
  61362. }
  61363. exports.Template = Template;
  61364. class Text extends _xfa_object.ContentObject {
  61365. constructor(attributes) {
  61366. super(TEMPLATE_NS_ID, "text");
  61367. this.id = attributes.id || "";
  61368. this.maxChars = (0, _utils.getInteger)({
  61369. data: attributes.maxChars,
  61370. defaultValue: 0,
  61371. validate: x => x >= 0
  61372. });
  61373. this.name = attributes.name || "";
  61374. this.rid = attributes.rid || "";
  61375. this.use = attributes.use || "";
  61376. this.usehref = attributes.usehref || "";
  61377. }
  61378. [_xfa_object.$acceptWhitespace]() {
  61379. return true;
  61380. }
  61381. [_xfa_object.$onChild](child) {
  61382. if (child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  61383. this[_xfa_object.$content] = child;
  61384. return true;
  61385. }
  61386. (0, _util.warn)(`XFA - Invalid content in Text: ${child[_xfa_object.$nodeName]}.`);
  61387. return false;
  61388. }
  61389. [_xfa_object.$onText](str) {
  61390. if (this[_xfa_object.$content] instanceof _xfa_object.XFAObject) {
  61391. return;
  61392. }
  61393. super[_xfa_object.$onText](str);
  61394. }
  61395. [_xfa_object.$finalize]() {
  61396. if (typeof this[_xfa_object.$content] === "string") {
  61397. this[_xfa_object.$content] = this[_xfa_object.$content].replace(/\r\n/g, "\n");
  61398. }
  61399. }
  61400. [_xfa_object.$getExtra]() {
  61401. if (typeof this[_xfa_object.$content] === "string") {
  61402. return this[_xfa_object.$content].split(/[\u2029\u2028\n]/).reduce((acc, line) => {
  61403. if (line) {
  61404. acc.push(line);
  61405. }
  61406. return acc;
  61407. }, []).join("\n");
  61408. }
  61409. return this[_xfa_object.$content][_xfa_object.$text]();
  61410. }
  61411. [_xfa_object.$toHTML](availableSpace) {
  61412. if (typeof this[_xfa_object.$content] === "string") {
  61413. const html = valueToHtml(this[_xfa_object.$content]).html;
  61414. if (this[_xfa_object.$content].includes("\u2029")) {
  61415. html.name = "div";
  61416. html.children = [];
  61417. this[_xfa_object.$content].split("\u2029").map(para => para.split(/[\u2028\n]/).reduce((acc, line) => {
  61418. acc.push({
  61419. name: "span",
  61420. value: line
  61421. }, {
  61422. name: "br"
  61423. });
  61424. return acc;
  61425. }, [])).forEach(lines => {
  61426. html.children.push({
  61427. name: "p",
  61428. children: lines
  61429. });
  61430. });
  61431. } else if (/[\u2028\n]/.test(this[_xfa_object.$content])) {
  61432. html.name = "div";
  61433. html.children = [];
  61434. this[_xfa_object.$content].split(/[\u2028\n]/).forEach(line => {
  61435. html.children.push({
  61436. name: "span",
  61437. value: line
  61438. }, {
  61439. name: "br"
  61440. });
  61441. });
  61442. }
  61443. return _utils.HTMLResult.success(html);
  61444. }
  61445. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  61446. }
  61447. }
  61448. exports.Text = Text;
  61449. class TextEdit extends _xfa_object.XFAObject {
  61450. constructor(attributes) {
  61451. super(TEMPLATE_NS_ID, "textEdit", true);
  61452. this.allowRichText = (0, _utils.getInteger)({
  61453. data: attributes.allowRichText,
  61454. defaultValue: 0,
  61455. validate: x => x === 1
  61456. });
  61457. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  61458. this.id = attributes.id || "";
  61459. this.multiLine = (0, _utils.getInteger)({
  61460. data: attributes.multiLine,
  61461. defaultValue: "",
  61462. validate: x => x === 0 || x === 1
  61463. });
  61464. this.use = attributes.use || "";
  61465. this.usehref = attributes.usehref || "";
  61466. this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]);
  61467. this.border = null;
  61468. this.comb = null;
  61469. this.extras = null;
  61470. this.margin = null;
  61471. }
  61472. [_xfa_object.$toHTML](availableSpace) {
  61473. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  61474. let html;
  61475. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  61476. if (this.multiLine === "") {
  61477. this.multiLine = field instanceof Draw ? 1 : 0;
  61478. }
  61479. if (this.multiLine === 1) {
  61480. html = {
  61481. name: "textarea",
  61482. attributes: {
  61483. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  61484. fieldId: field[_xfa_object.$uid],
  61485. class: ["xfaTextfield"],
  61486. style,
  61487. "aria-label": ariaLabel(field),
  61488. "aria-required": false
  61489. }
  61490. };
  61491. } else {
  61492. html = {
  61493. name: "input",
  61494. attributes: {
  61495. type: "text",
  61496. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  61497. fieldId: field[_xfa_object.$uid],
  61498. class: ["xfaTextfield"],
  61499. style,
  61500. "aria-label": ariaLabel(field),
  61501. "aria-required": false
  61502. }
  61503. };
  61504. }
  61505. if (isRequired(field)) {
  61506. html.attributes["aria-required"] = true;
  61507. html.attributes.required = true;
  61508. }
  61509. return _utils.HTMLResult.success({
  61510. name: "label",
  61511. attributes: {
  61512. class: ["xfaLabel"]
  61513. },
  61514. children: [html]
  61515. });
  61516. }
  61517. }
  61518. class Time extends _xfa_object.StringObject {
  61519. constructor(attributes) {
  61520. super(TEMPLATE_NS_ID, "time");
  61521. this.id = attributes.id || "";
  61522. this.name = attributes.name || "";
  61523. this.use = attributes.use || "";
  61524. this.usehref = attributes.usehref || "";
  61525. }
  61526. [_xfa_object.$finalize]() {
  61527. const date = this[_xfa_object.$content].trim();
  61528. this[_xfa_object.$content] = date ? new Date(date) : null;
  61529. }
  61530. [_xfa_object.$toHTML](availableSpace) {
  61531. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  61532. }
  61533. }
  61534. class TimeStamp extends _xfa_object.XFAObject {
  61535. constructor(attributes) {
  61536. super(TEMPLATE_NS_ID, "timeStamp");
  61537. this.id = attributes.id || "";
  61538. this.server = attributes.server || "";
  61539. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  61540. this.use = attributes.use || "";
  61541. this.usehref = attributes.usehref || "";
  61542. }
  61543. }
  61544. class ToolTip extends _xfa_object.StringObject {
  61545. constructor(attributes) {
  61546. super(TEMPLATE_NS_ID, "toolTip");
  61547. this.id = attributes.id || "";
  61548. this.rid = attributes.rid || "";
  61549. this.use = attributes.use || "";
  61550. this.usehref = attributes.usehref || "";
  61551. }
  61552. }
  61553. class Traversal extends _xfa_object.XFAObject {
  61554. constructor(attributes) {
  61555. super(TEMPLATE_NS_ID, "traversal", true);
  61556. this.id = attributes.id || "";
  61557. this.use = attributes.use || "";
  61558. this.usehref = attributes.usehref || "";
  61559. this.extras = null;
  61560. this.traverse = new _xfa_object.XFAObjectArray();
  61561. }
  61562. }
  61563. class Traverse extends _xfa_object.XFAObject {
  61564. constructor(attributes) {
  61565. super(TEMPLATE_NS_ID, "traverse", true);
  61566. this.id = attributes.id || "";
  61567. this.operation = (0, _utils.getStringOption)(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]);
  61568. this.ref = attributes.ref || "";
  61569. this.use = attributes.use || "";
  61570. this.usehref = attributes.usehref || "";
  61571. this.extras = null;
  61572. this.script = null;
  61573. }
  61574. get name() {
  61575. return this.operation;
  61576. }
  61577. [_xfa_object.$isTransparent]() {
  61578. return false;
  61579. }
  61580. }
  61581. class Ui extends _xfa_object.XFAObject {
  61582. constructor(attributes) {
  61583. super(TEMPLATE_NS_ID, "ui", true);
  61584. this.id = attributes.id || "";
  61585. this.use = attributes.use || "";
  61586. this.usehref = attributes.usehref || "";
  61587. this.extras = null;
  61588. this.picture = null;
  61589. this.barcode = null;
  61590. this.button = null;
  61591. this.checkButton = null;
  61592. this.choiceList = null;
  61593. this.dateTimeEdit = null;
  61594. this.defaultUi = null;
  61595. this.imageEdit = null;
  61596. this.numericEdit = null;
  61597. this.passwordEdit = null;
  61598. this.signature = null;
  61599. this.textEdit = null;
  61600. }
  61601. [_xfa_object.$getExtra]() {
  61602. if (this[_xfa_object.$extra] === undefined) {
  61603. for (const name of Object.getOwnPropertyNames(this)) {
  61604. if (name === "extras" || name === "picture") {
  61605. continue;
  61606. }
  61607. const obj = this[name];
  61608. if (!(obj instanceof _xfa_object.XFAObject)) {
  61609. continue;
  61610. }
  61611. this[_xfa_object.$extra] = obj;
  61612. return obj;
  61613. }
  61614. this[_xfa_object.$extra] = null;
  61615. }
  61616. return this[_xfa_object.$extra];
  61617. }
  61618. [_xfa_object.$toHTML](availableSpace) {
  61619. const obj = this[_xfa_object.$getExtra]();
  61620. if (obj) {
  61621. return obj[_xfa_object.$toHTML](availableSpace);
  61622. }
  61623. return _utils.HTMLResult.EMPTY;
  61624. }
  61625. }
  61626. class Validate extends _xfa_object.XFAObject {
  61627. constructor(attributes) {
  61628. super(TEMPLATE_NS_ID, "validate", true);
  61629. this.formatTest = (0, _utils.getStringOption)(attributes.formatTest, ["warning", "disabled", "error"]);
  61630. this.id = attributes.id || "";
  61631. this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, ["disabled", "error", "warning"]);
  61632. this.scriptTest = (0, _utils.getStringOption)(attributes.scriptTest, ["error", "disabled", "warning"]);
  61633. this.use = attributes.use || "";
  61634. this.usehref = attributes.usehref || "";
  61635. this.extras = null;
  61636. this.message = null;
  61637. this.picture = null;
  61638. this.script = null;
  61639. }
  61640. }
  61641. class Value extends _xfa_object.XFAObject {
  61642. constructor(attributes) {
  61643. super(TEMPLATE_NS_ID, "value", true);
  61644. this.id = attributes.id || "";
  61645. this.override = (0, _utils.getInteger)({
  61646. data: attributes.override,
  61647. defaultValue: 0,
  61648. validate: x => x === 1
  61649. });
  61650. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  61651. this.use = attributes.use || "";
  61652. this.usehref = attributes.usehref || "";
  61653. this.arc = null;
  61654. this.boolean = null;
  61655. this.date = null;
  61656. this.dateTime = null;
  61657. this.decimal = null;
  61658. this.exData = null;
  61659. this.float = null;
  61660. this.image = null;
  61661. this.integer = null;
  61662. this.line = null;
  61663. this.rectangle = null;
  61664. this.text = null;
  61665. this.time = null;
  61666. }
  61667. [_xfa_object.$setValue](value) {
  61668. const parent = this[_xfa_object.$getParent]();
  61669. if (parent instanceof Field) {
  61670. if (parent.ui && parent.ui.imageEdit) {
  61671. if (!this.image) {
  61672. this.image = new Image({});
  61673. this[_xfa_object.$appendChild](this.image);
  61674. }
  61675. this.image[_xfa_object.$content] = value[_xfa_object.$content];
  61676. return;
  61677. }
  61678. }
  61679. const valueName = value[_xfa_object.$nodeName];
  61680. if (this[valueName] !== null) {
  61681. this[valueName][_xfa_object.$content] = value[_xfa_object.$content];
  61682. return;
  61683. }
  61684. for (const name of Object.getOwnPropertyNames(this)) {
  61685. const obj = this[name];
  61686. if (obj instanceof _xfa_object.XFAObject) {
  61687. this[name] = null;
  61688. this[_xfa_object.$removeChild](obj);
  61689. }
  61690. }
  61691. this[value[_xfa_object.$nodeName]] = value;
  61692. this[_xfa_object.$appendChild](value);
  61693. }
  61694. [_xfa_object.$text]() {
  61695. if (this.exData) {
  61696. if (typeof this.exData[_xfa_object.$content] === "string") {
  61697. return this.exData[_xfa_object.$content].trim();
  61698. }
  61699. return this.exData[_xfa_object.$content][_xfa_object.$text]().trim();
  61700. }
  61701. for (const name of Object.getOwnPropertyNames(this)) {
  61702. if (name === "image") {
  61703. continue;
  61704. }
  61705. const obj = this[name];
  61706. if (obj instanceof _xfa_object.XFAObject) {
  61707. return (obj[_xfa_object.$content] || "").toString().trim();
  61708. }
  61709. }
  61710. return null;
  61711. }
  61712. [_xfa_object.$toHTML](availableSpace) {
  61713. for (const name of Object.getOwnPropertyNames(this)) {
  61714. const obj = this[name];
  61715. if (!(obj instanceof _xfa_object.XFAObject)) {
  61716. continue;
  61717. }
  61718. return obj[_xfa_object.$toHTML](availableSpace);
  61719. }
  61720. return _utils.HTMLResult.EMPTY;
  61721. }
  61722. }
  61723. exports.Value = Value;
  61724. class Variables extends _xfa_object.XFAObject {
  61725. constructor(attributes) {
  61726. super(TEMPLATE_NS_ID, "variables", true);
  61727. this.id = attributes.id || "";
  61728. this.use = attributes.use || "";
  61729. this.usehref = attributes.usehref || "";
  61730. this.boolean = new _xfa_object.XFAObjectArray();
  61731. this.date = new _xfa_object.XFAObjectArray();
  61732. this.dateTime = new _xfa_object.XFAObjectArray();
  61733. this.decimal = new _xfa_object.XFAObjectArray();
  61734. this.exData = new _xfa_object.XFAObjectArray();
  61735. this.float = new _xfa_object.XFAObjectArray();
  61736. this.image = new _xfa_object.XFAObjectArray();
  61737. this.integer = new _xfa_object.XFAObjectArray();
  61738. this.manifest = new _xfa_object.XFAObjectArray();
  61739. this.script = new _xfa_object.XFAObjectArray();
  61740. this.text = new _xfa_object.XFAObjectArray();
  61741. this.time = new _xfa_object.XFAObjectArray();
  61742. }
  61743. [_xfa_object.$isTransparent]() {
  61744. return true;
  61745. }
  61746. }
  61747. class TemplateNamespace {
  61748. static [_namespaces.$buildXFAObject](name, attributes) {
  61749. if (TemplateNamespace.hasOwnProperty(name)) {
  61750. const node = TemplateNamespace[name](attributes);
  61751. node[_xfa_object.$setSetAttributes](attributes);
  61752. return node;
  61753. }
  61754. return undefined;
  61755. }
  61756. static appearanceFilter(attrs) {
  61757. return new AppearanceFilter(attrs);
  61758. }
  61759. static arc(attrs) {
  61760. return new Arc(attrs);
  61761. }
  61762. static area(attrs) {
  61763. return new Area(attrs);
  61764. }
  61765. static assist(attrs) {
  61766. return new Assist(attrs);
  61767. }
  61768. static barcode(attrs) {
  61769. return new Barcode(attrs);
  61770. }
  61771. static bind(attrs) {
  61772. return new Bind(attrs);
  61773. }
  61774. static bindItems(attrs) {
  61775. return new BindItems(attrs);
  61776. }
  61777. static bookend(attrs) {
  61778. return new Bookend(attrs);
  61779. }
  61780. static boolean(attrs) {
  61781. return new BooleanElement(attrs);
  61782. }
  61783. static border(attrs) {
  61784. return new Border(attrs);
  61785. }
  61786. static break(attrs) {
  61787. return new Break(attrs);
  61788. }
  61789. static breakAfter(attrs) {
  61790. return new BreakAfter(attrs);
  61791. }
  61792. static breakBefore(attrs) {
  61793. return new BreakBefore(attrs);
  61794. }
  61795. static button(attrs) {
  61796. return new Button(attrs);
  61797. }
  61798. static calculate(attrs) {
  61799. return new Calculate(attrs);
  61800. }
  61801. static caption(attrs) {
  61802. return new Caption(attrs);
  61803. }
  61804. static certificate(attrs) {
  61805. return new Certificate(attrs);
  61806. }
  61807. static certificates(attrs) {
  61808. return new Certificates(attrs);
  61809. }
  61810. static checkButton(attrs) {
  61811. return new CheckButton(attrs);
  61812. }
  61813. static choiceList(attrs) {
  61814. return new ChoiceList(attrs);
  61815. }
  61816. static color(attrs) {
  61817. return new Color(attrs);
  61818. }
  61819. static comb(attrs) {
  61820. return new Comb(attrs);
  61821. }
  61822. static connect(attrs) {
  61823. return new Connect(attrs);
  61824. }
  61825. static contentArea(attrs) {
  61826. return new ContentArea(attrs);
  61827. }
  61828. static corner(attrs) {
  61829. return new Corner(attrs);
  61830. }
  61831. static date(attrs) {
  61832. return new DateElement(attrs);
  61833. }
  61834. static dateTime(attrs) {
  61835. return new DateTime(attrs);
  61836. }
  61837. static dateTimeEdit(attrs) {
  61838. return new DateTimeEdit(attrs);
  61839. }
  61840. static decimal(attrs) {
  61841. return new Decimal(attrs);
  61842. }
  61843. static defaultUi(attrs) {
  61844. return new DefaultUi(attrs);
  61845. }
  61846. static desc(attrs) {
  61847. return new Desc(attrs);
  61848. }
  61849. static digestMethod(attrs) {
  61850. return new DigestMethod(attrs);
  61851. }
  61852. static digestMethods(attrs) {
  61853. return new DigestMethods(attrs);
  61854. }
  61855. static draw(attrs) {
  61856. return new Draw(attrs);
  61857. }
  61858. static edge(attrs) {
  61859. return new Edge(attrs);
  61860. }
  61861. static encoding(attrs) {
  61862. return new Encoding(attrs);
  61863. }
  61864. static encodings(attrs) {
  61865. return new Encodings(attrs);
  61866. }
  61867. static encrypt(attrs) {
  61868. return new Encrypt(attrs);
  61869. }
  61870. static encryptData(attrs) {
  61871. return new EncryptData(attrs);
  61872. }
  61873. static encryption(attrs) {
  61874. return new Encryption(attrs);
  61875. }
  61876. static encryptionMethod(attrs) {
  61877. return new EncryptionMethod(attrs);
  61878. }
  61879. static encryptionMethods(attrs) {
  61880. return new EncryptionMethods(attrs);
  61881. }
  61882. static event(attrs) {
  61883. return new Event(attrs);
  61884. }
  61885. static exData(attrs) {
  61886. return new ExData(attrs);
  61887. }
  61888. static exObject(attrs) {
  61889. return new ExObject(attrs);
  61890. }
  61891. static exclGroup(attrs) {
  61892. return new ExclGroup(attrs);
  61893. }
  61894. static execute(attrs) {
  61895. return new Execute(attrs);
  61896. }
  61897. static extras(attrs) {
  61898. return new Extras(attrs);
  61899. }
  61900. static field(attrs) {
  61901. return new Field(attrs);
  61902. }
  61903. static fill(attrs) {
  61904. return new Fill(attrs);
  61905. }
  61906. static filter(attrs) {
  61907. return new Filter(attrs);
  61908. }
  61909. static float(attrs) {
  61910. return new Float(attrs);
  61911. }
  61912. static font(attrs) {
  61913. return new Font(attrs);
  61914. }
  61915. static format(attrs) {
  61916. return new Format(attrs);
  61917. }
  61918. static handler(attrs) {
  61919. return new Handler(attrs);
  61920. }
  61921. static hyphenation(attrs) {
  61922. return new Hyphenation(attrs);
  61923. }
  61924. static image(attrs) {
  61925. return new Image(attrs);
  61926. }
  61927. static imageEdit(attrs) {
  61928. return new ImageEdit(attrs);
  61929. }
  61930. static integer(attrs) {
  61931. return new Integer(attrs);
  61932. }
  61933. static issuers(attrs) {
  61934. return new Issuers(attrs);
  61935. }
  61936. static items(attrs) {
  61937. return new Items(attrs);
  61938. }
  61939. static keep(attrs) {
  61940. return new Keep(attrs);
  61941. }
  61942. static keyUsage(attrs) {
  61943. return new KeyUsage(attrs);
  61944. }
  61945. static line(attrs) {
  61946. return new Line(attrs);
  61947. }
  61948. static linear(attrs) {
  61949. return new Linear(attrs);
  61950. }
  61951. static lockDocument(attrs) {
  61952. return new LockDocument(attrs);
  61953. }
  61954. static manifest(attrs) {
  61955. return new Manifest(attrs);
  61956. }
  61957. static margin(attrs) {
  61958. return new Margin(attrs);
  61959. }
  61960. static mdp(attrs) {
  61961. return new Mdp(attrs);
  61962. }
  61963. static medium(attrs) {
  61964. return new Medium(attrs);
  61965. }
  61966. static message(attrs) {
  61967. return new Message(attrs);
  61968. }
  61969. static numericEdit(attrs) {
  61970. return new NumericEdit(attrs);
  61971. }
  61972. static occur(attrs) {
  61973. return new Occur(attrs);
  61974. }
  61975. static oid(attrs) {
  61976. return new Oid(attrs);
  61977. }
  61978. static oids(attrs) {
  61979. return new Oids(attrs);
  61980. }
  61981. static overflow(attrs) {
  61982. return new Overflow(attrs);
  61983. }
  61984. static pageArea(attrs) {
  61985. return new PageArea(attrs);
  61986. }
  61987. static pageSet(attrs) {
  61988. return new PageSet(attrs);
  61989. }
  61990. static para(attrs) {
  61991. return new Para(attrs);
  61992. }
  61993. static passwordEdit(attrs) {
  61994. return new PasswordEdit(attrs);
  61995. }
  61996. static pattern(attrs) {
  61997. return new Pattern(attrs);
  61998. }
  61999. static picture(attrs) {
  62000. return new Picture(attrs);
  62001. }
  62002. static proto(attrs) {
  62003. return new Proto(attrs);
  62004. }
  62005. static radial(attrs) {
  62006. return new Radial(attrs);
  62007. }
  62008. static reason(attrs) {
  62009. return new Reason(attrs);
  62010. }
  62011. static reasons(attrs) {
  62012. return new Reasons(attrs);
  62013. }
  62014. static rectangle(attrs) {
  62015. return new Rectangle(attrs);
  62016. }
  62017. static ref(attrs) {
  62018. return new RefElement(attrs);
  62019. }
  62020. static script(attrs) {
  62021. return new Script(attrs);
  62022. }
  62023. static setProperty(attrs) {
  62024. return new SetProperty(attrs);
  62025. }
  62026. static signData(attrs) {
  62027. return new SignData(attrs);
  62028. }
  62029. static signature(attrs) {
  62030. return new Signature(attrs);
  62031. }
  62032. static signing(attrs) {
  62033. return new Signing(attrs);
  62034. }
  62035. static solid(attrs) {
  62036. return new Solid(attrs);
  62037. }
  62038. static speak(attrs) {
  62039. return new Speak(attrs);
  62040. }
  62041. static stipple(attrs) {
  62042. return new Stipple(attrs);
  62043. }
  62044. static subform(attrs) {
  62045. return new Subform(attrs);
  62046. }
  62047. static subformSet(attrs) {
  62048. return new SubformSet(attrs);
  62049. }
  62050. static subjectDN(attrs) {
  62051. return new SubjectDN(attrs);
  62052. }
  62053. static subjectDNs(attrs) {
  62054. return new SubjectDNs(attrs);
  62055. }
  62056. static submit(attrs) {
  62057. return new Submit(attrs);
  62058. }
  62059. static template(attrs) {
  62060. return new Template(attrs);
  62061. }
  62062. static text(attrs) {
  62063. return new Text(attrs);
  62064. }
  62065. static textEdit(attrs) {
  62066. return new TextEdit(attrs);
  62067. }
  62068. static time(attrs) {
  62069. return new Time(attrs);
  62070. }
  62071. static timeStamp(attrs) {
  62072. return new TimeStamp(attrs);
  62073. }
  62074. static toolTip(attrs) {
  62075. return new ToolTip(attrs);
  62076. }
  62077. static traversal(attrs) {
  62078. return new Traversal(attrs);
  62079. }
  62080. static traverse(attrs) {
  62081. return new Traverse(attrs);
  62082. }
  62083. static ui(attrs) {
  62084. return new Ui(attrs);
  62085. }
  62086. static validate(attrs) {
  62087. return new Validate(attrs);
  62088. }
  62089. static value(attrs) {
  62090. return new Value(attrs);
  62091. }
  62092. static variables(attrs) {
  62093. return new Variables(attrs);
  62094. }
  62095. }
  62096. exports.TemplateNamespace = TemplateNamespace;
  62097. /***/ }),
  62098. /* 214 */
  62099. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62100. "use strict";
  62101. Object.defineProperty(exports, "__esModule", ({
  62102. value: true
  62103. }));
  62104. exports.addHTML = addHTML;
  62105. exports.checkDimensions = checkDimensions;
  62106. exports.flushHTML = flushHTML;
  62107. exports.getAvailableSpace = getAvailableSpace;
  62108. var _xfa_object = __w_pdfjs_require__(208);
  62109. var _html_utils = __w_pdfjs_require__(215);
  62110. function createLine(node, children) {
  62111. return {
  62112. name: "div",
  62113. attributes: {
  62114. class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"]
  62115. },
  62116. children
  62117. };
  62118. }
  62119. function flushHTML(node) {
  62120. if (!node[_xfa_object.$extra]) {
  62121. return null;
  62122. }
  62123. const attributes = node[_xfa_object.$extra].attributes;
  62124. const html = {
  62125. name: "div",
  62126. attributes,
  62127. children: node[_xfa_object.$extra].children
  62128. };
  62129. if (node[_xfa_object.$extra].failingNode) {
  62130. const htmlFromFailing = node[_xfa_object.$extra].failingNode[_xfa_object.$flushHTML]();
  62131. if (htmlFromFailing) {
  62132. if (node.layout.endsWith("-tb")) {
  62133. html.children.push(createLine(node, [htmlFromFailing]));
  62134. } else {
  62135. html.children.push(htmlFromFailing);
  62136. }
  62137. }
  62138. }
  62139. if (html.children.length === 0) {
  62140. return null;
  62141. }
  62142. return html;
  62143. }
  62144. function addHTML(node, html, bbox) {
  62145. const extra = node[_xfa_object.$extra];
  62146. const availableSpace = extra.availableSpace;
  62147. const [x, y, w, h] = bbox;
  62148. switch (node.layout) {
  62149. case "position":
  62150. {
  62151. extra.width = Math.max(extra.width, x + w);
  62152. extra.height = Math.max(extra.height, y + h);
  62153. extra.children.push(html);
  62154. break;
  62155. }
  62156. case "lr-tb":
  62157. case "rl-tb":
  62158. if (!extra.line || extra.attempt === 1) {
  62159. extra.line = createLine(node, []);
  62160. extra.children.push(extra.line);
  62161. extra.numberInLine = 0;
  62162. }
  62163. extra.numberInLine += 1;
  62164. extra.line.children.push(html);
  62165. if (extra.attempt === 0) {
  62166. extra.currentWidth += w;
  62167. extra.height = Math.max(extra.height, extra.prevHeight + h);
  62168. } else {
  62169. extra.currentWidth = w;
  62170. extra.prevHeight = extra.height;
  62171. extra.height += h;
  62172. extra.attempt = 0;
  62173. }
  62174. extra.width = Math.max(extra.width, extra.currentWidth);
  62175. break;
  62176. case "rl-row":
  62177. case "row":
  62178. {
  62179. extra.children.push(html);
  62180. extra.width += w;
  62181. extra.height = Math.max(extra.height, h);
  62182. const height = (0, _html_utils.measureToString)(extra.height);
  62183. for (const child of extra.children) {
  62184. child.attributes.style.height = height;
  62185. }
  62186. break;
  62187. }
  62188. case "table":
  62189. {
  62190. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  62191. extra.height += h;
  62192. extra.children.push(html);
  62193. break;
  62194. }
  62195. case "tb":
  62196. {
  62197. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  62198. extra.height += h;
  62199. extra.children.push(html);
  62200. break;
  62201. }
  62202. }
  62203. }
  62204. function getAvailableSpace(node) {
  62205. const availableSpace = node[_xfa_object.$extra].availableSpace;
  62206. const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0;
  62207. const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0;
  62208. switch (node.layout) {
  62209. case "lr-tb":
  62210. case "rl-tb":
  62211. if (node[_xfa_object.$extra].attempt === 0) {
  62212. return {
  62213. width: availableSpace.width - marginH - node[_xfa_object.$extra].currentWidth,
  62214. height: availableSpace.height - marginV - node[_xfa_object.$extra].prevHeight
  62215. };
  62216. }
  62217. return {
  62218. width: availableSpace.width - marginH,
  62219. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  62220. };
  62221. case "rl-row":
  62222. case "row":
  62223. const width = node[_xfa_object.$extra].columnWidths.slice(node[_xfa_object.$extra].currentColumn).reduce((a, x) => a + x);
  62224. return {
  62225. width,
  62226. height: availableSpace.height - marginH
  62227. };
  62228. case "table":
  62229. case "tb":
  62230. return {
  62231. width: availableSpace.width - marginH,
  62232. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  62233. };
  62234. case "position":
  62235. default:
  62236. return availableSpace;
  62237. }
  62238. }
  62239. function getTransformedBBox(node) {
  62240. let w = node.w === "" ? NaN : node.w;
  62241. let h = node.h === "" ? NaN : node.h;
  62242. let [centerX, centerY] = [0, 0];
  62243. switch (node.anchorType || "") {
  62244. case "bottomCenter":
  62245. [centerX, centerY] = [w / 2, h];
  62246. break;
  62247. case "bottomLeft":
  62248. [centerX, centerY] = [0, h];
  62249. break;
  62250. case "bottomRight":
  62251. [centerX, centerY] = [w, h];
  62252. break;
  62253. case "middleCenter":
  62254. [centerX, centerY] = [w / 2, h / 2];
  62255. break;
  62256. case "middleLeft":
  62257. [centerX, centerY] = [0, h / 2];
  62258. break;
  62259. case "middleRight":
  62260. [centerX, centerY] = [w, h / 2];
  62261. break;
  62262. case "topCenter":
  62263. [centerX, centerY] = [w / 2, 0];
  62264. break;
  62265. case "topRight":
  62266. [centerX, centerY] = [w, 0];
  62267. break;
  62268. }
  62269. let x, y;
  62270. switch (node.rotate || 0) {
  62271. case 0:
  62272. [x, y] = [-centerX, -centerY];
  62273. break;
  62274. case 90:
  62275. [x, y] = [-centerY, centerX];
  62276. [w, h] = [h, -w];
  62277. break;
  62278. case 180:
  62279. [x, y] = [centerX, centerY];
  62280. [w, h] = [-w, -h];
  62281. break;
  62282. case 270:
  62283. [x, y] = [centerY, -centerX];
  62284. [w, h] = [-h, w];
  62285. break;
  62286. }
  62287. return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)];
  62288. }
  62289. function checkDimensions(node, space) {
  62290. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].firstUnsplittable === null) {
  62291. return true;
  62292. }
  62293. if (node.w === 0 || node.h === 0) {
  62294. return true;
  62295. }
  62296. const ERROR = 2;
  62297. const parent = node[_xfa_object.$getSubformParent]();
  62298. const attempt = parent[_xfa_object.$extra] && parent[_xfa_object.$extra].attempt || 0;
  62299. const [, y, w, h] = getTransformedBBox(node);
  62300. switch (parent.layout) {
  62301. case "lr-tb":
  62302. case "rl-tb":
  62303. if (attempt === 0) {
  62304. if (!node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  62305. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  62306. return false;
  62307. }
  62308. if (node.w !== "") {
  62309. if (Math.round(w - space.width) <= ERROR) {
  62310. return true;
  62311. }
  62312. if (parent[_xfa_object.$extra].numberInLine === 0) {
  62313. return space.height > ERROR;
  62314. }
  62315. return false;
  62316. }
  62317. return space.width > ERROR;
  62318. }
  62319. if (node.w !== "") {
  62320. return Math.round(w - space.width) <= ERROR;
  62321. }
  62322. return space.width > ERROR;
  62323. }
  62324. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  62325. return true;
  62326. }
  62327. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  62328. return false;
  62329. }
  62330. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  62331. return space.height > ERROR;
  62332. }
  62333. if (parent[_xfa_object.$isThereMoreWidth]()) {
  62334. return false;
  62335. }
  62336. return space.height > ERROR;
  62337. case "table":
  62338. case "tb":
  62339. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  62340. return true;
  62341. }
  62342. if (node.h !== "" && !node[_xfa_object.$isSplittable]()) {
  62343. return Math.round(h - space.height) <= ERROR;
  62344. }
  62345. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  62346. return space.height > ERROR;
  62347. }
  62348. if (parent[_xfa_object.$isThereMoreWidth]()) {
  62349. return false;
  62350. }
  62351. return space.height > ERROR;
  62352. case "position":
  62353. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  62354. return true;
  62355. }
  62356. if (node.h === "" || Math.round(h + y - space.height) <= ERROR) {
  62357. return true;
  62358. }
  62359. const area = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].currentContentArea;
  62360. return h + y > area.h;
  62361. case "rl-row":
  62362. case "row":
  62363. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  62364. return true;
  62365. }
  62366. if (node.h !== "") {
  62367. return Math.round(h - space.height) <= ERROR;
  62368. }
  62369. return true;
  62370. default:
  62371. return true;
  62372. }
  62373. }
  62374. /***/ }),
  62375. /* 215 */
  62376. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62377. "use strict";
  62378. Object.defineProperty(exports, "__esModule", ({
  62379. value: true
  62380. }));
  62381. exports.computeBbox = computeBbox;
  62382. exports.createWrapper = createWrapper;
  62383. exports.fixDimensions = fixDimensions;
  62384. exports.fixTextIndent = fixTextIndent;
  62385. exports.fixURL = fixURL;
  62386. exports.isPrintOnly = isPrintOnly;
  62387. exports.layoutClass = layoutClass;
  62388. exports.layoutNode = layoutNode;
  62389. exports.measureToString = measureToString;
  62390. exports.setAccess = setAccess;
  62391. exports.setFontFamily = setFontFamily;
  62392. exports.setMinMaxDimensions = setMinMaxDimensions;
  62393. exports.setPara = setPara;
  62394. exports.toStyle = toStyle;
  62395. var _xfa_object = __w_pdfjs_require__(208);
  62396. var _util = __w_pdfjs_require__(2);
  62397. var _utils = __w_pdfjs_require__(209);
  62398. var _fonts = __w_pdfjs_require__(216);
  62399. var _text = __w_pdfjs_require__(217);
  62400. function measureToString(m) {
  62401. if (typeof m === "string") {
  62402. return "0px";
  62403. }
  62404. return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;
  62405. }
  62406. const converters = {
  62407. anchorType(node, style) {
  62408. const parent = node[_xfa_object.$getSubformParent]();
  62409. if (!parent || parent.layout && parent.layout !== "position") {
  62410. return;
  62411. }
  62412. if (!("transform" in style)) {
  62413. style.transform = "";
  62414. }
  62415. switch (node.anchorType) {
  62416. case "bottomCenter":
  62417. style.transform += "translate(-50%, -100%)";
  62418. break;
  62419. case "bottomLeft":
  62420. style.transform += "translate(0,-100%)";
  62421. break;
  62422. case "bottomRight":
  62423. style.transform += "translate(-100%,-100%)";
  62424. break;
  62425. case "middleCenter":
  62426. style.transform += "translate(-50%,-50%)";
  62427. break;
  62428. case "middleLeft":
  62429. style.transform += "translate(0,-50%)";
  62430. break;
  62431. case "middleRight":
  62432. style.transform += "translate(-100%,-50%)";
  62433. break;
  62434. case "topCenter":
  62435. style.transform += "translate(-50%,0)";
  62436. break;
  62437. case "topRight":
  62438. style.transform += "translate(-100%,0)";
  62439. break;
  62440. }
  62441. },
  62442. dimensions(node, style) {
  62443. const parent = node[_xfa_object.$getSubformParent]();
  62444. let width = node.w;
  62445. const height = node.h;
  62446. if (parent.layout && parent.layout.includes("row")) {
  62447. const extra = parent[_xfa_object.$extra];
  62448. const colSpan = node.colSpan;
  62449. let w;
  62450. if (colSpan === -1) {
  62451. w = extra.columnWidths.slice(extra.currentColumn).reduce((a, x) => a + x, 0);
  62452. extra.currentColumn = 0;
  62453. } else {
  62454. w = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, x) => a + x, 0);
  62455. extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length;
  62456. }
  62457. if (!isNaN(w)) {
  62458. width = node.w = w;
  62459. }
  62460. }
  62461. if (width !== "") {
  62462. style.width = measureToString(width);
  62463. } else {
  62464. style.width = "auto";
  62465. }
  62466. if (height !== "") {
  62467. style.height = measureToString(height);
  62468. } else {
  62469. style.height = "auto";
  62470. }
  62471. },
  62472. position(node, style) {
  62473. const parent = node[_xfa_object.$getSubformParent]();
  62474. if (parent && parent.layout && parent.layout !== "position") {
  62475. return;
  62476. }
  62477. style.position = "absolute";
  62478. style.left = measureToString(node.x);
  62479. style.top = measureToString(node.y);
  62480. },
  62481. rotate(node, style) {
  62482. if (node.rotate) {
  62483. if (!("transform" in style)) {
  62484. style.transform = "";
  62485. }
  62486. style.transform += `rotate(-${node.rotate}deg)`;
  62487. style.transformOrigin = "top left";
  62488. }
  62489. },
  62490. presence(node, style) {
  62491. switch (node.presence) {
  62492. case "invisible":
  62493. style.visibility = "hidden";
  62494. break;
  62495. case "hidden":
  62496. case "inactive":
  62497. style.display = "none";
  62498. break;
  62499. }
  62500. },
  62501. hAlign(node, style) {
  62502. if (node[_xfa_object.$nodeName] === "para") {
  62503. switch (node.hAlign) {
  62504. case "justifyAll":
  62505. style.textAlign = "justify-all";
  62506. break;
  62507. case "radix":
  62508. style.textAlign = "left";
  62509. break;
  62510. default:
  62511. style.textAlign = node.hAlign;
  62512. }
  62513. } else {
  62514. switch (node.hAlign) {
  62515. case "left":
  62516. style.alignSelf = "start";
  62517. break;
  62518. case "center":
  62519. style.alignSelf = "center";
  62520. break;
  62521. case "right":
  62522. style.alignSelf = "end";
  62523. break;
  62524. }
  62525. }
  62526. },
  62527. margin(node, style) {
  62528. if (node.margin) {
  62529. style.margin = node.margin[_xfa_object.$toStyle]().margin;
  62530. }
  62531. }
  62532. };
  62533. function setMinMaxDimensions(node, style) {
  62534. const parent = node[_xfa_object.$getSubformParent]();
  62535. if (parent.layout === "position") {
  62536. if (node.minW > 0) {
  62537. style.minWidth = measureToString(node.minW);
  62538. }
  62539. if (node.maxW > 0) {
  62540. style.maxWidth = measureToString(node.maxW);
  62541. }
  62542. if (node.minH > 0) {
  62543. style.minHeight = measureToString(node.minH);
  62544. }
  62545. if (node.maxH > 0) {
  62546. style.maxHeight = measureToString(node.maxH);
  62547. }
  62548. }
  62549. }
  62550. function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) {
  62551. const measure = new _text.TextMeasure(xfaFont, margin, lineHeight, fontFinder);
  62552. if (typeof text === "string") {
  62553. measure.addString(text);
  62554. } else {
  62555. text[_xfa_object.$pushGlyphs](measure);
  62556. }
  62557. return measure.compute(width);
  62558. }
  62559. function layoutNode(node, availableSpace) {
  62560. let height = null;
  62561. let width = null;
  62562. let isBroken = false;
  62563. if ((!node.w || !node.h) && node.value) {
  62564. let marginH = 0;
  62565. let marginV = 0;
  62566. if (node.margin) {
  62567. marginH = node.margin.leftInset + node.margin.rightInset;
  62568. marginV = node.margin.topInset + node.margin.bottomInset;
  62569. }
  62570. let lineHeight = null;
  62571. let margin = null;
  62572. if (node.para) {
  62573. margin = Object.create(null);
  62574. lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight;
  62575. margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove;
  62576. margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow;
  62577. margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft;
  62578. margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight;
  62579. }
  62580. let font = node.font;
  62581. if (!font) {
  62582. const root = node[_xfa_object.$getTemplateRoot]();
  62583. let parent = node[_xfa_object.$getParent]();
  62584. while (parent && parent !== root) {
  62585. if (parent.font) {
  62586. font = parent.font;
  62587. break;
  62588. }
  62589. parent = parent[_xfa_object.$getParent]();
  62590. }
  62591. }
  62592. const maxWidth = (node.w || availableSpace.width) - marginH;
  62593. const fontFinder = node[_xfa_object.$globalData].fontFinder;
  62594. if (node.value.exData && node.value.exData[_xfa_object.$content] && node.value.exData.contentType === "text/html") {
  62595. const res = layoutText(node.value.exData[_xfa_object.$content], font, margin, lineHeight, fontFinder, maxWidth);
  62596. width = res.width;
  62597. height = res.height;
  62598. isBroken = res.isBroken;
  62599. } else {
  62600. const text = node.value[_xfa_object.$text]();
  62601. if (text) {
  62602. const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth);
  62603. width = res.width;
  62604. height = res.height;
  62605. isBroken = res.isBroken;
  62606. }
  62607. }
  62608. if (width !== null && !node.w) {
  62609. width += marginH;
  62610. }
  62611. if (height !== null && !node.h) {
  62612. height += marginV;
  62613. }
  62614. }
  62615. return {
  62616. w: width,
  62617. h: height,
  62618. isBroken
  62619. };
  62620. }
  62621. function computeBbox(node, html, availableSpace) {
  62622. let bbox;
  62623. if (node.w !== "" && node.h !== "") {
  62624. bbox = [node.x, node.y, node.w, node.h];
  62625. } else {
  62626. if (!availableSpace) {
  62627. return null;
  62628. }
  62629. let width = node.w;
  62630. if (width === "") {
  62631. if (node.maxW === 0) {
  62632. const parent = node[_xfa_object.$getSubformParent]();
  62633. if (parent.layout === "position" && parent.w !== "") {
  62634. width = 0;
  62635. } else {
  62636. width = node.minW;
  62637. }
  62638. } else {
  62639. width = Math.min(node.maxW, availableSpace.width);
  62640. }
  62641. html.attributes.style.width = measureToString(width);
  62642. }
  62643. let height = node.h;
  62644. if (height === "") {
  62645. if (node.maxH === 0) {
  62646. const parent = node[_xfa_object.$getSubformParent]();
  62647. if (parent.layout === "position" && parent.h !== "") {
  62648. height = 0;
  62649. } else {
  62650. height = node.minH;
  62651. }
  62652. } else {
  62653. height = Math.min(node.maxH, availableSpace.height);
  62654. }
  62655. html.attributes.style.height = measureToString(height);
  62656. }
  62657. bbox = [node.x, node.y, width, height];
  62658. }
  62659. return bbox;
  62660. }
  62661. function fixDimensions(node) {
  62662. const parent = node[_xfa_object.$getSubformParent]();
  62663. if (parent.layout && parent.layout.includes("row")) {
  62664. const extra = parent[_xfa_object.$extra];
  62665. const colSpan = node.colSpan;
  62666. let width;
  62667. if (colSpan === -1) {
  62668. width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0);
  62669. } else {
  62670. width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0);
  62671. }
  62672. if (!isNaN(width)) {
  62673. node.w = width;
  62674. }
  62675. }
  62676. if (parent.layout && parent.layout !== "position") {
  62677. node.x = node.y = 0;
  62678. }
  62679. if (node.layout === "table") {
  62680. if (node.w === "" && Array.isArray(node.columnWidths)) {
  62681. node.w = node.columnWidths.reduce((a, x) => a + x, 0);
  62682. }
  62683. }
  62684. }
  62685. function layoutClass(node) {
  62686. switch (node.layout) {
  62687. case "position":
  62688. return "xfaPosition";
  62689. case "lr-tb":
  62690. return "xfaLrTb";
  62691. case "rl-row":
  62692. return "xfaRlRow";
  62693. case "rl-tb":
  62694. return "xfaRlTb";
  62695. case "row":
  62696. return "xfaRow";
  62697. case "table":
  62698. return "xfaTable";
  62699. case "tb":
  62700. return "xfaTb";
  62701. default:
  62702. return "xfaPosition";
  62703. }
  62704. }
  62705. function toStyle(node) {
  62706. const style = Object.create(null);
  62707. for (var _len = arguments.length, names = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  62708. names[_key - 1] = arguments[_key];
  62709. }
  62710. for (const name of names) {
  62711. const value = node[name];
  62712. if (value === null) {
  62713. continue;
  62714. }
  62715. if (converters.hasOwnProperty(name)) {
  62716. converters[name](node, style);
  62717. continue;
  62718. }
  62719. if (value instanceof _xfa_object.XFAObject) {
  62720. const newStyle = value[_xfa_object.$toStyle]();
  62721. if (newStyle) {
  62722. Object.assign(style, newStyle);
  62723. } else {
  62724. (0, _util.warn)(`(DEBUG) - XFA - style for ${name} not implemented yet`);
  62725. }
  62726. }
  62727. }
  62728. return style;
  62729. }
  62730. function createWrapper(node, html) {
  62731. const {
  62732. attributes
  62733. } = html;
  62734. const {
  62735. style
  62736. } = attributes;
  62737. const wrapper = {
  62738. name: "div",
  62739. attributes: {
  62740. class: ["xfaWrapper"],
  62741. style: Object.create(null)
  62742. },
  62743. children: []
  62744. };
  62745. attributes.class.push("xfaWrapped");
  62746. if (node.border) {
  62747. const {
  62748. widths,
  62749. insets
  62750. } = node.border[_xfa_object.$extra];
  62751. let width, height;
  62752. let top = insets[0];
  62753. let left = insets[3];
  62754. const insetsH = insets[0] + insets[2];
  62755. const insetsW = insets[1] + insets[3];
  62756. switch (node.border.hand) {
  62757. case "even":
  62758. top -= widths[0] / 2;
  62759. left -= widths[3] / 2;
  62760. width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
  62761. height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;
  62762. break;
  62763. case "left":
  62764. top -= widths[0];
  62765. left -= widths[3];
  62766. width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
  62767. height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
  62768. break;
  62769. case "right":
  62770. width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
  62771. height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
  62772. break;
  62773. }
  62774. const classNames = ["xfaBorder"];
  62775. if (isPrintOnly(node.border)) {
  62776. classNames.push("xfaPrintOnly");
  62777. }
  62778. const border = {
  62779. name: "div",
  62780. attributes: {
  62781. class: classNames,
  62782. style: {
  62783. top: `${top}px`,
  62784. left: `${left}px`,
  62785. width,
  62786. height
  62787. }
  62788. },
  62789. children: []
  62790. };
  62791. for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) {
  62792. if (style[key] !== undefined) {
  62793. border.attributes.style[key] = style[key];
  62794. delete style[key];
  62795. }
  62796. }
  62797. wrapper.children.push(border, html);
  62798. } else {
  62799. wrapper.children.push(html);
  62800. }
  62801. for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) {
  62802. if (style[key] !== undefined) {
  62803. wrapper.attributes.style[key] = style[key];
  62804. delete style[key];
  62805. }
  62806. }
  62807. if (style.position === "absolute") {
  62808. wrapper.attributes.style.position = "absolute";
  62809. } else {
  62810. wrapper.attributes.style.position = "relative";
  62811. }
  62812. delete style.position;
  62813. if (style.alignSelf) {
  62814. wrapper.attributes.style.alignSelf = style.alignSelf;
  62815. delete style.alignSelf;
  62816. }
  62817. return wrapper;
  62818. }
  62819. function fixTextIndent(styles) {
  62820. const indent = (0, _utils.getMeasurement)(styles.textIndent, "0px");
  62821. if (indent >= 0) {
  62822. return;
  62823. }
  62824. const align = styles.textAlign === "right" ? "right" : "left";
  62825. const name = "padding" + (align === "left" ? "Left" : "Right");
  62826. const padding = (0, _utils.getMeasurement)(styles[name], "0px");
  62827. styles[name] = `${padding - indent}px`;
  62828. }
  62829. function setAccess(node, classNames) {
  62830. switch (node.access) {
  62831. case "nonInteractive":
  62832. classNames.push("xfaNonInteractive");
  62833. break;
  62834. case "readOnly":
  62835. classNames.push("xfaReadOnly");
  62836. break;
  62837. case "protected":
  62838. classNames.push("xfaDisabled");
  62839. break;
  62840. }
  62841. }
  62842. function isPrintOnly(node) {
  62843. return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print";
  62844. }
  62845. function getCurrentPara(node) {
  62846. const stack = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].paraStack;
  62847. return stack.length ? stack.at(-1) : null;
  62848. }
  62849. function setPara(node, nodeStyle, value) {
  62850. if (value.attributes.class && value.attributes.class.includes("xfaRich")) {
  62851. if (nodeStyle) {
  62852. if (node.h === "") {
  62853. nodeStyle.height = "auto";
  62854. }
  62855. if (node.w === "") {
  62856. nodeStyle.width = "auto";
  62857. }
  62858. }
  62859. const para = getCurrentPara(node);
  62860. if (para) {
  62861. const valueStyle = value.attributes.style;
  62862. valueStyle.display = "flex";
  62863. valueStyle.flexDirection = "column";
  62864. switch (para.vAlign) {
  62865. case "top":
  62866. valueStyle.justifyContent = "start";
  62867. break;
  62868. case "bottom":
  62869. valueStyle.justifyContent = "end";
  62870. break;
  62871. case "middle":
  62872. valueStyle.justifyContent = "center";
  62873. break;
  62874. }
  62875. const paraStyle = para[_xfa_object.$toStyle]();
  62876. for (const [key, val] of Object.entries(paraStyle)) {
  62877. if (!(key in valueStyle)) {
  62878. valueStyle[key] = val;
  62879. }
  62880. }
  62881. }
  62882. }
  62883. }
  62884. function setFontFamily(xfaFont, node, fontFinder, style) {
  62885. if (!fontFinder) {
  62886. delete style.fontFamily;
  62887. return;
  62888. }
  62889. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  62890. style.fontFamily = `"${name}"`;
  62891. const typeface = fontFinder.find(name);
  62892. if (typeface) {
  62893. const {
  62894. fontFamily
  62895. } = typeface.regular.cssFontInfo;
  62896. if (fontFamily !== name) {
  62897. style.fontFamily = `"${fontFamily}"`;
  62898. }
  62899. const para = getCurrentPara(node);
  62900. if (para && para.lineHeight !== "") {
  62901. return;
  62902. }
  62903. if (style.lineHeight) {
  62904. return;
  62905. }
  62906. const pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  62907. if (pdfFont) {
  62908. style.lineHeight = Math.max(1.2, pdfFont.lineHeight);
  62909. }
  62910. }
  62911. }
  62912. function fixURL(str) {
  62913. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(str, null, {
  62914. addDefaultProtocol: true,
  62915. tryConvertEncoding: true
  62916. });
  62917. return absoluteUrl ? absoluteUrl.href : null;
  62918. }
  62919. /***/ }),
  62920. /* 216 */
  62921. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62922. "use strict";
  62923. Object.defineProperty(exports, "__esModule", ({
  62924. value: true
  62925. }));
  62926. exports.FontFinder = void 0;
  62927. exports.getMetrics = getMetrics;
  62928. exports.selectFont = selectFont;
  62929. var _xfa_object = __w_pdfjs_require__(208);
  62930. var _utils = __w_pdfjs_require__(209);
  62931. var _util = __w_pdfjs_require__(2);
  62932. class FontFinder {
  62933. constructor(pdfFonts) {
  62934. this.fonts = new Map();
  62935. this.cache = new Map();
  62936. this.warned = new Set();
  62937. this.defaultFont = null;
  62938. this.add(pdfFonts);
  62939. }
  62940. add(pdfFonts) {
  62941. let reallyMissingFonts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  62942. for (const pdfFont of pdfFonts) {
  62943. this.addPdfFont(pdfFont);
  62944. }
  62945. for (const pdfFont of this.fonts.values()) {
  62946. if (!pdfFont.regular) {
  62947. pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic;
  62948. }
  62949. }
  62950. if (!reallyMissingFonts || reallyMissingFonts.size === 0) {
  62951. return;
  62952. }
  62953. const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA");
  62954. for (const missing of reallyMissingFonts) {
  62955. this.fonts.set(missing, myriad);
  62956. }
  62957. }
  62958. addPdfFont(pdfFont) {
  62959. const cssFontInfo = pdfFont.cssFontInfo;
  62960. const name = cssFontInfo.fontFamily;
  62961. let font = this.fonts.get(name);
  62962. if (!font) {
  62963. font = Object.create(null);
  62964. this.fonts.set(name, font);
  62965. if (!this.defaultFont) {
  62966. this.defaultFont = font;
  62967. }
  62968. }
  62969. let property = "";
  62970. const fontWeight = parseFloat(cssFontInfo.fontWeight);
  62971. if (parseFloat(cssFontInfo.italicAngle) !== 0) {
  62972. property = fontWeight >= 700 ? "bolditalic" : "italic";
  62973. } else if (fontWeight >= 700) {
  62974. property = "bold";
  62975. }
  62976. if (!property) {
  62977. if (pdfFont.name.includes("Bold") || pdfFont.psName && pdfFont.psName.includes("Bold")) {
  62978. property = "bold";
  62979. }
  62980. if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName && (pdfFont.psName.includes("Italic") || pdfFont.psName.endsWith("It"))) {
  62981. property += "italic";
  62982. }
  62983. }
  62984. if (!property) {
  62985. property = "regular";
  62986. }
  62987. font[property] = pdfFont;
  62988. }
  62989. getDefault() {
  62990. return this.defaultFont;
  62991. }
  62992. find(fontName) {
  62993. let mustWarn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  62994. let font = this.fonts.get(fontName) || this.cache.get(fontName);
  62995. if (font) {
  62996. return font;
  62997. }
  62998. const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi;
  62999. let name = fontName.replace(pattern, "");
  63000. font = this.fonts.get(name);
  63001. if (font) {
  63002. this.cache.set(fontName, font);
  63003. return font;
  63004. }
  63005. name = name.toLowerCase();
  63006. const maybe = [];
  63007. for (const [family, pdfFont] of this.fonts.entries()) {
  63008. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  63009. maybe.push(pdfFont);
  63010. }
  63011. }
  63012. if (maybe.length === 0) {
  63013. for (const [, pdfFont] of this.fonts.entries()) {
  63014. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  63015. maybe.push(pdfFont);
  63016. }
  63017. }
  63018. }
  63019. if (maybe.length === 0) {
  63020. name = name.replace(/psmt|mt/gi, "");
  63021. for (const [family, pdfFont] of this.fonts.entries()) {
  63022. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  63023. maybe.push(pdfFont);
  63024. }
  63025. }
  63026. }
  63027. if (maybe.length === 0) {
  63028. for (const pdfFont of this.fonts.values()) {
  63029. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  63030. maybe.push(pdfFont);
  63031. }
  63032. }
  63033. }
  63034. if (maybe.length >= 1) {
  63035. if (maybe.length !== 1 && mustWarn) {
  63036. (0, _util.warn)(`XFA - Too many choices to guess the correct font: ${fontName}`);
  63037. }
  63038. this.cache.set(fontName, maybe[0]);
  63039. return maybe[0];
  63040. }
  63041. if (mustWarn && !this.warned.has(fontName)) {
  63042. this.warned.add(fontName);
  63043. (0, _util.warn)(`XFA - Cannot find the font: ${fontName}`);
  63044. }
  63045. return null;
  63046. }
  63047. }
  63048. exports.FontFinder = FontFinder;
  63049. function selectFont(xfaFont, typeface) {
  63050. if (xfaFont.posture === "italic") {
  63051. if (xfaFont.weight === "bold") {
  63052. return typeface.bolditalic;
  63053. }
  63054. return typeface.italic;
  63055. } else if (xfaFont.weight === "bold") {
  63056. return typeface.bold;
  63057. }
  63058. return typeface.regular;
  63059. }
  63060. function getMetrics(xfaFont) {
  63061. let real = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  63062. let pdfFont = null;
  63063. if (xfaFont) {
  63064. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  63065. const typeface = xfaFont[_xfa_object.$globalData].fontFinder.find(name);
  63066. pdfFont = selectFont(xfaFont, typeface);
  63067. }
  63068. if (!pdfFont) {
  63069. return {
  63070. lineHeight: 12,
  63071. lineGap: 2,
  63072. lineNoGap: 10
  63073. };
  63074. }
  63075. const size = xfaFont.size || 10;
  63076. const lineHeight = pdfFont.lineHeight ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight) : 1.2;
  63077. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  63078. return {
  63079. lineHeight: lineHeight * size,
  63080. lineGap: lineGap * size,
  63081. lineNoGap: Math.max(1, lineHeight - lineGap) * size
  63082. };
  63083. }
  63084. /***/ }),
  63085. /* 217 */
  63086. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63087. "use strict";
  63088. Object.defineProperty(exports, "__esModule", ({
  63089. value: true
  63090. }));
  63091. exports.TextMeasure = void 0;
  63092. var _fonts = __w_pdfjs_require__(216);
  63093. const WIDTH_FACTOR = 1.02;
  63094. class FontInfo {
  63095. constructor(xfaFont, margin, lineHeight, fontFinder) {
  63096. this.lineHeight = lineHeight;
  63097. this.paraMargin = margin || {
  63098. top: 0,
  63099. bottom: 0,
  63100. left: 0,
  63101. right: 0
  63102. };
  63103. if (!xfaFont) {
  63104. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  63105. return;
  63106. }
  63107. this.xfaFont = {
  63108. typeface: xfaFont.typeface,
  63109. posture: xfaFont.posture,
  63110. weight: xfaFont.weight,
  63111. size: xfaFont.size,
  63112. letterSpacing: xfaFont.letterSpacing
  63113. };
  63114. const typeface = fontFinder.find(xfaFont.typeface);
  63115. if (!typeface) {
  63116. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  63117. return;
  63118. }
  63119. this.pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  63120. if (!this.pdfFont) {
  63121. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  63122. }
  63123. }
  63124. defaultFont(fontFinder) {
  63125. const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault();
  63126. if (font && font.regular) {
  63127. const pdfFont = font.regular;
  63128. const info = pdfFont.cssFontInfo;
  63129. const xfaFont = {
  63130. typeface: info.fontFamily,
  63131. posture: "normal",
  63132. weight: "normal",
  63133. size: 10,
  63134. letterSpacing: 0
  63135. };
  63136. return [pdfFont, xfaFont];
  63137. }
  63138. const xfaFont = {
  63139. typeface: "Courier",
  63140. posture: "normal",
  63141. weight: "normal",
  63142. size: 10,
  63143. letterSpacing: 0
  63144. };
  63145. return [null, xfaFont];
  63146. }
  63147. }
  63148. class FontSelector {
  63149. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) {
  63150. this.fontFinder = fontFinder;
  63151. this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)];
  63152. }
  63153. pushData(xfaFont, margin, lineHeight) {
  63154. const lastFont = this.stack.at(-1);
  63155. for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) {
  63156. if (!xfaFont[name]) {
  63157. xfaFont[name] = lastFont.xfaFont[name];
  63158. }
  63159. }
  63160. for (const name of ["top", "bottom", "left", "right"]) {
  63161. if (isNaN(margin[name])) {
  63162. margin[name] = lastFont.paraMargin[name];
  63163. }
  63164. }
  63165. const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder);
  63166. if (!fontInfo.pdfFont) {
  63167. fontInfo.pdfFont = lastFont.pdfFont;
  63168. }
  63169. this.stack.push(fontInfo);
  63170. }
  63171. popFont() {
  63172. this.stack.pop();
  63173. }
  63174. topFont() {
  63175. return this.stack.at(-1);
  63176. }
  63177. }
  63178. class TextMeasure {
  63179. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) {
  63180. this.glyphs = [];
  63181. this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts);
  63182. this.extraHeight = 0;
  63183. }
  63184. pushData(xfaFont, margin, lineHeight) {
  63185. this.fontSelector.pushData(xfaFont, margin, lineHeight);
  63186. }
  63187. popFont(xfaFont) {
  63188. return this.fontSelector.popFont();
  63189. }
  63190. addPara() {
  63191. const lastFont = this.fontSelector.topFont();
  63192. this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom;
  63193. }
  63194. addString(str) {
  63195. if (!str) {
  63196. return;
  63197. }
  63198. const lastFont = this.fontSelector.topFont();
  63199. const fontSize = lastFont.xfaFont.size;
  63200. if (lastFont.pdfFont) {
  63201. const letterSpacing = lastFont.xfaFont.letterSpacing;
  63202. const pdfFont = lastFont.pdfFont;
  63203. const fontLineHeight = pdfFont.lineHeight || 1.2;
  63204. const lineHeight = lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize;
  63205. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  63206. const noGap = fontLineHeight - lineGap;
  63207. const firstLineHeight = Math.max(1, noGap) * fontSize;
  63208. const scale = fontSize / 1000;
  63209. const fallbackWidth = pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width;
  63210. for (const line of str.split(/[\u2029\n]/)) {
  63211. const encodedLine = pdfFont.encodeString(line).join("");
  63212. const glyphs = pdfFont.charsToGlyphs(encodedLine);
  63213. for (const glyph of glyphs) {
  63214. const width = glyph.width || fallbackWidth;
  63215. this.glyphs.push([width * scale + letterSpacing, lineHeight, firstLineHeight, glyph.unicode, false]);
  63216. }
  63217. this.glyphs.push([0, 0, 0, "\n", true]);
  63218. }
  63219. this.glyphs.pop();
  63220. return;
  63221. }
  63222. for (const line of str.split(/[\u2029\n]/)) {
  63223. for (const char of line.split("")) {
  63224. this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]);
  63225. }
  63226. this.glyphs.push([0, 0, 0, "\n", true]);
  63227. }
  63228. this.glyphs.pop();
  63229. }
  63230. compute(maxWidth) {
  63231. let lastSpacePos = -1,
  63232. lastSpaceWidth = 0,
  63233. width = 0,
  63234. height = 0,
  63235. currentLineWidth = 0,
  63236. currentLineHeight = 0;
  63237. let isBroken = false;
  63238. let isFirstLine = true;
  63239. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  63240. const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] = this.glyphs[i];
  63241. const isSpace = char === " ";
  63242. const glyphHeight = isFirstLine ? firstLineHeight : lineHeight;
  63243. if (isEOL) {
  63244. width = Math.max(width, currentLineWidth);
  63245. currentLineWidth = 0;
  63246. height += currentLineHeight;
  63247. currentLineHeight = glyphHeight;
  63248. lastSpacePos = -1;
  63249. lastSpaceWidth = 0;
  63250. isFirstLine = false;
  63251. continue;
  63252. }
  63253. if (isSpace) {
  63254. if (currentLineWidth + glyphWidth > maxWidth) {
  63255. width = Math.max(width, currentLineWidth);
  63256. currentLineWidth = 0;
  63257. height += currentLineHeight;
  63258. currentLineHeight = glyphHeight;
  63259. lastSpacePos = -1;
  63260. lastSpaceWidth = 0;
  63261. isBroken = true;
  63262. isFirstLine = false;
  63263. } else {
  63264. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  63265. lastSpaceWidth = currentLineWidth;
  63266. currentLineWidth += glyphWidth;
  63267. lastSpacePos = i;
  63268. }
  63269. continue;
  63270. }
  63271. if (currentLineWidth + glyphWidth > maxWidth) {
  63272. height += currentLineHeight;
  63273. currentLineHeight = glyphHeight;
  63274. if (lastSpacePos !== -1) {
  63275. i = lastSpacePos;
  63276. width = Math.max(width, lastSpaceWidth);
  63277. currentLineWidth = 0;
  63278. lastSpacePos = -1;
  63279. lastSpaceWidth = 0;
  63280. } else {
  63281. width = Math.max(width, currentLineWidth);
  63282. currentLineWidth = glyphWidth;
  63283. }
  63284. isBroken = true;
  63285. isFirstLine = false;
  63286. continue;
  63287. }
  63288. currentLineWidth += glyphWidth;
  63289. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  63290. }
  63291. width = Math.max(width, currentLineWidth);
  63292. height += currentLineHeight + this.extraHeight;
  63293. return {
  63294. width: WIDTH_FACTOR * width,
  63295. height,
  63296. isBroken
  63297. };
  63298. }
  63299. }
  63300. exports.TextMeasure = TextMeasure;
  63301. /***/ }),
  63302. /* 218 */
  63303. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63304. "use strict";
  63305. Object.defineProperty(exports, "__esModule", ({
  63306. value: true
  63307. }));
  63308. exports.DataHandler = void 0;
  63309. var _xfa_object = __w_pdfjs_require__(208);
  63310. class DataHandler {
  63311. constructor(root, data) {
  63312. this.data = data;
  63313. this.dataset = root.datasets || null;
  63314. }
  63315. serialize(storage) {
  63316. const stack = [[-1, this.data[_xfa_object.$getChildren]()]];
  63317. while (stack.length > 0) {
  63318. const last = stack.at(-1);
  63319. const [i, children] = last;
  63320. if (i + 1 === children.length) {
  63321. stack.pop();
  63322. continue;
  63323. }
  63324. const child = children[++last[0]];
  63325. const storageEntry = storage.get(child[_xfa_object.$uid]);
  63326. if (storageEntry) {
  63327. child[_xfa_object.$setValue](storageEntry);
  63328. } else {
  63329. const attributes = child[_xfa_object.$getAttributes]();
  63330. for (const value of attributes.values()) {
  63331. const entry = storage.get(value[_xfa_object.$uid]);
  63332. if (entry) {
  63333. value[_xfa_object.$setValue](entry);
  63334. break;
  63335. }
  63336. }
  63337. }
  63338. const nodes = child[_xfa_object.$getChildren]();
  63339. if (nodes.length > 0) {
  63340. stack.push([-1, nodes]);
  63341. }
  63342. }
  63343. const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`];
  63344. if (this.dataset) {
  63345. for (const child of this.dataset[_xfa_object.$getChildren]()) {
  63346. if (child[_xfa_object.$nodeName] !== "data") {
  63347. child[_xfa_object.$toString](buf);
  63348. }
  63349. }
  63350. }
  63351. this.data[_xfa_object.$toString](buf);
  63352. buf.push("</xfa:datasets>");
  63353. return buf.join("");
  63354. }
  63355. }
  63356. exports.DataHandler = DataHandler;
  63357. /***/ }),
  63358. /* 219 */
  63359. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63360. "use strict";
  63361. Object.defineProperty(exports, "__esModule", ({
  63362. value: true
  63363. }));
  63364. exports.XFAParser = void 0;
  63365. var _xfa_object = __w_pdfjs_require__(208);
  63366. var _xml_parser = __w_pdfjs_require__(197);
  63367. var _builder = __w_pdfjs_require__(220);
  63368. var _util = __w_pdfjs_require__(2);
  63369. class XFAParser extends _xml_parser.XMLParserBase {
  63370. constructor() {
  63371. let rootNameSpace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  63372. let richText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  63373. super();
  63374. this._builder = new _builder.Builder(rootNameSpace);
  63375. this._stack = [];
  63376. this._globalData = {
  63377. usedTypefaces: new Set()
  63378. };
  63379. this._ids = new Map();
  63380. this._current = this._builder.buildRoot(this._ids);
  63381. this._errorCode = _xml_parser.XMLParserErrorCode.NoError;
  63382. this._whiteRegex = /^\s+$/;
  63383. this._nbsps = /\xa0+/g;
  63384. this._richText = richText;
  63385. }
  63386. parse(data) {
  63387. this.parseXml(data);
  63388. if (this._errorCode !== _xml_parser.XMLParserErrorCode.NoError) {
  63389. return undefined;
  63390. }
  63391. this._current[_xfa_object.$finalize]();
  63392. return this._current.element;
  63393. }
  63394. onText(text) {
  63395. text = text.replace(this._nbsps, match => match.slice(1) + " ");
  63396. if (this._richText || this._current[_xfa_object.$acceptWhitespace]()) {
  63397. this._current[_xfa_object.$onText](text, this._richText);
  63398. return;
  63399. }
  63400. if (this._whiteRegex.test(text)) {
  63401. return;
  63402. }
  63403. this._current[_xfa_object.$onText](text.trim());
  63404. }
  63405. onCdata(text) {
  63406. this._current[_xfa_object.$onText](text);
  63407. }
  63408. _mkAttributes(attributes, tagName) {
  63409. let namespace = null;
  63410. let prefixes = null;
  63411. const attributeObj = Object.create({});
  63412. for (const {
  63413. name,
  63414. value
  63415. } of attributes) {
  63416. if (name === "xmlns") {
  63417. if (!namespace) {
  63418. namespace = value;
  63419. } else {
  63420. (0, _util.warn)(`XFA - multiple namespace definition in <${tagName}>`);
  63421. }
  63422. } else if (name.startsWith("xmlns:")) {
  63423. const prefix = name.substring("xmlns:".length);
  63424. if (!prefixes) {
  63425. prefixes = [];
  63426. }
  63427. prefixes.push({
  63428. prefix,
  63429. value
  63430. });
  63431. } else {
  63432. const i = name.indexOf(":");
  63433. if (i === -1) {
  63434. attributeObj[name] = value;
  63435. } else {
  63436. let nsAttrs = attributeObj[_xfa_object.$nsAttributes];
  63437. if (!nsAttrs) {
  63438. nsAttrs = attributeObj[_xfa_object.$nsAttributes] = Object.create(null);
  63439. }
  63440. const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
  63441. let attrs = nsAttrs[ns];
  63442. if (!attrs) {
  63443. attrs = nsAttrs[ns] = Object.create(null);
  63444. }
  63445. attrs[attrName] = value;
  63446. }
  63447. }
  63448. }
  63449. return [namespace, prefixes, attributeObj];
  63450. }
  63451. _getNameAndPrefix(name, nsAgnostic) {
  63452. const i = name.indexOf(":");
  63453. if (i === -1) {
  63454. return [name, null];
  63455. }
  63456. return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)];
  63457. }
  63458. onBeginElement(tagName, attributes, isEmpty) {
  63459. const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName);
  63460. const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic());
  63461. const node = this._builder.build({
  63462. nsPrefix,
  63463. name,
  63464. attributes: attributesObj,
  63465. namespace,
  63466. prefixes
  63467. });
  63468. node[_xfa_object.$globalData] = this._globalData;
  63469. if (isEmpty) {
  63470. node[_xfa_object.$finalize]();
  63471. if (this._current[_xfa_object.$onChild](node)) {
  63472. node[_xfa_object.$setId](this._ids);
  63473. }
  63474. node[_xfa_object.$clean](this._builder);
  63475. return;
  63476. }
  63477. this._stack.push(this._current);
  63478. this._current = node;
  63479. }
  63480. onEndElement(name) {
  63481. const node = this._current;
  63482. if (node[_xfa_object.$isCDATAXml]() && typeof node[_xfa_object.$content] === "string") {
  63483. const parser = new XFAParser();
  63484. parser._globalData = this._globalData;
  63485. const root = parser.parse(node[_xfa_object.$content]);
  63486. node[_xfa_object.$content] = null;
  63487. node[_xfa_object.$onChild](root);
  63488. }
  63489. node[_xfa_object.$finalize]();
  63490. this._current = this._stack.pop();
  63491. if (this._current[_xfa_object.$onChild](node)) {
  63492. node[_xfa_object.$setId](this._ids);
  63493. }
  63494. node[_xfa_object.$clean](this._builder);
  63495. }
  63496. onError(code) {
  63497. this._errorCode = code;
  63498. }
  63499. }
  63500. exports.XFAParser = XFAParser;
  63501. /***/ }),
  63502. /* 220 */
  63503. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63504. "use strict";
  63505. Object.defineProperty(exports, "__esModule", ({
  63506. value: true
  63507. }));
  63508. exports.Builder = void 0;
  63509. var _namespaces = __w_pdfjs_require__(210);
  63510. var _xfa_object = __w_pdfjs_require__(208);
  63511. var _setup = __w_pdfjs_require__(221);
  63512. var _template = __w_pdfjs_require__(213);
  63513. var _unknown = __w_pdfjs_require__(230);
  63514. var _util = __w_pdfjs_require__(2);
  63515. class Root extends _xfa_object.XFAObject {
  63516. constructor(ids) {
  63517. super(-1, "root", Object.create(null));
  63518. this.element = null;
  63519. this[_xfa_object.$ids] = ids;
  63520. }
  63521. [_xfa_object.$onChild](child) {
  63522. this.element = child;
  63523. return true;
  63524. }
  63525. [_xfa_object.$finalize]() {
  63526. super[_xfa_object.$finalize]();
  63527. if (this.element.template instanceof _template.Template) {
  63528. this[_xfa_object.$ids].set(_xfa_object.$root, this.element);
  63529. this.element.template[_xfa_object.$resolvePrototypes](this[_xfa_object.$ids]);
  63530. this.element.template[_xfa_object.$ids] = this[_xfa_object.$ids];
  63531. }
  63532. }
  63533. }
  63534. class Empty extends _xfa_object.XFAObject {
  63535. constructor() {
  63536. super(-1, "", Object.create(null));
  63537. }
  63538. [_xfa_object.$onChild](_) {
  63539. return false;
  63540. }
  63541. }
  63542. class Builder {
  63543. constructor() {
  63544. let rootNameSpace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  63545. this._namespaceStack = [];
  63546. this._nsAgnosticLevel = 0;
  63547. this._namespacePrefixes = new Map();
  63548. this._namespaces = new Map();
  63549. this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(_ref => {
  63550. let {
  63551. id
  63552. } = _ref;
  63553. return id;
  63554. }));
  63555. this._currentNamespace = rootNameSpace || new _unknown.UnknownNamespace(++this._nextNsId);
  63556. }
  63557. buildRoot(ids) {
  63558. return new Root(ids);
  63559. }
  63560. build(_ref2) {
  63561. let {
  63562. nsPrefix,
  63563. name,
  63564. attributes,
  63565. namespace,
  63566. prefixes
  63567. } = _ref2;
  63568. const hasNamespaceDef = namespace !== null;
  63569. if (hasNamespaceDef) {
  63570. this._namespaceStack.push(this._currentNamespace);
  63571. this._currentNamespace = this._searchNamespace(namespace);
  63572. }
  63573. if (prefixes) {
  63574. this._addNamespacePrefix(prefixes);
  63575. }
  63576. if (attributes.hasOwnProperty(_xfa_object.$nsAttributes)) {
  63577. const dataTemplate = _setup.NamespaceSetUp.datasets;
  63578. const nsAttrs = attributes[_xfa_object.$nsAttributes];
  63579. let xfaAttrs = null;
  63580. for (const [ns, attrs] of Object.entries(nsAttrs)) {
  63581. const nsToUse = this._getNamespaceToUse(ns);
  63582. if (nsToUse === dataTemplate) {
  63583. xfaAttrs = {
  63584. xfa: attrs
  63585. };
  63586. break;
  63587. }
  63588. }
  63589. if (xfaAttrs) {
  63590. attributes[_xfa_object.$nsAttributes] = xfaAttrs;
  63591. } else {
  63592. delete attributes[_xfa_object.$nsAttributes];
  63593. }
  63594. }
  63595. const namespaceToUse = this._getNamespaceToUse(nsPrefix);
  63596. const node = namespaceToUse && namespaceToUse[_namespaces.$buildXFAObject](name, attributes) || new Empty();
  63597. if (node[_xfa_object.$isNsAgnostic]()) {
  63598. this._nsAgnosticLevel++;
  63599. }
  63600. if (hasNamespaceDef || prefixes || node[_xfa_object.$isNsAgnostic]()) {
  63601. node[_xfa_object.$cleanup] = {
  63602. hasNamespace: hasNamespaceDef,
  63603. prefixes,
  63604. nsAgnostic: node[_xfa_object.$isNsAgnostic]()
  63605. };
  63606. }
  63607. return node;
  63608. }
  63609. isNsAgnostic() {
  63610. return this._nsAgnosticLevel > 0;
  63611. }
  63612. _searchNamespace(nsName) {
  63613. let ns = this._namespaces.get(nsName);
  63614. if (ns) {
  63615. return ns;
  63616. }
  63617. for (const [name, {
  63618. check
  63619. }] of Object.entries(_namespaces.NamespaceIds)) {
  63620. if (check(nsName)) {
  63621. ns = _setup.NamespaceSetUp[name];
  63622. if (ns) {
  63623. this._namespaces.set(nsName, ns);
  63624. return ns;
  63625. }
  63626. break;
  63627. }
  63628. }
  63629. ns = new _unknown.UnknownNamespace(++this._nextNsId);
  63630. this._namespaces.set(nsName, ns);
  63631. return ns;
  63632. }
  63633. _addNamespacePrefix(prefixes) {
  63634. for (const {
  63635. prefix,
  63636. value
  63637. } of prefixes) {
  63638. const namespace = this._searchNamespace(value);
  63639. let prefixStack = this._namespacePrefixes.get(prefix);
  63640. if (!prefixStack) {
  63641. prefixStack = [];
  63642. this._namespacePrefixes.set(prefix, prefixStack);
  63643. }
  63644. prefixStack.push(namespace);
  63645. }
  63646. }
  63647. _getNamespaceToUse(prefix) {
  63648. if (!prefix) {
  63649. return this._currentNamespace;
  63650. }
  63651. const prefixStack = this._namespacePrefixes.get(prefix);
  63652. if (prefixStack && prefixStack.length > 0) {
  63653. return prefixStack.at(-1);
  63654. }
  63655. (0, _util.warn)(`Unknown namespace prefix: ${prefix}.`);
  63656. return null;
  63657. }
  63658. clean(data) {
  63659. const {
  63660. hasNamespace,
  63661. prefixes,
  63662. nsAgnostic
  63663. } = data;
  63664. if (hasNamespace) {
  63665. this._currentNamespace = this._namespaceStack.pop();
  63666. }
  63667. if (prefixes) {
  63668. prefixes.forEach(_ref3 => {
  63669. let {
  63670. prefix
  63671. } = _ref3;
  63672. this._namespacePrefixes.get(prefix).pop();
  63673. });
  63674. }
  63675. if (nsAgnostic) {
  63676. this._nsAgnosticLevel--;
  63677. }
  63678. }
  63679. }
  63680. exports.Builder = Builder;
  63681. /***/ }),
  63682. /* 221 */
  63683. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63684. "use strict";
  63685. Object.defineProperty(exports, "__esModule", ({
  63686. value: true
  63687. }));
  63688. exports.NamespaceSetUp = void 0;
  63689. var _config = __w_pdfjs_require__(222);
  63690. var _connection_set = __w_pdfjs_require__(223);
  63691. var _datasets = __w_pdfjs_require__(224);
  63692. var _locale_set = __w_pdfjs_require__(225);
  63693. var _signature = __w_pdfjs_require__(226);
  63694. var _stylesheet = __w_pdfjs_require__(227);
  63695. var _template = __w_pdfjs_require__(213);
  63696. var _xdp = __w_pdfjs_require__(228);
  63697. var _xhtml = __w_pdfjs_require__(229);
  63698. const NamespaceSetUp = {
  63699. config: _config.ConfigNamespace,
  63700. connection: _connection_set.ConnectionSetNamespace,
  63701. datasets: _datasets.DatasetsNamespace,
  63702. localeSet: _locale_set.LocaleSetNamespace,
  63703. signature: _signature.SignatureNamespace,
  63704. stylesheet: _stylesheet.StylesheetNamespace,
  63705. template: _template.TemplateNamespace,
  63706. xdp: _xdp.XdpNamespace,
  63707. xhtml: _xhtml.XhtmlNamespace
  63708. };
  63709. exports.NamespaceSetUp = NamespaceSetUp;
  63710. /***/ }),
  63711. /* 222 */
  63712. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63713. "use strict";
  63714. Object.defineProperty(exports, "__esModule", ({
  63715. value: true
  63716. }));
  63717. exports.ConfigNamespace = void 0;
  63718. var _namespaces = __w_pdfjs_require__(210);
  63719. var _xfa_object = __w_pdfjs_require__(208);
  63720. var _utils = __w_pdfjs_require__(209);
  63721. var _util = __w_pdfjs_require__(2);
  63722. const CONFIG_NS_ID = _namespaces.NamespaceIds.config.id;
  63723. class Acrobat extends _xfa_object.XFAObject {
  63724. constructor(attributes) {
  63725. super(CONFIG_NS_ID, "acrobat", true);
  63726. this.acrobat7 = null;
  63727. this.autoSave = null;
  63728. this.common = null;
  63729. this.validate = null;
  63730. this.validateApprovalSignatures = null;
  63731. this.submitUrl = new _xfa_object.XFAObjectArray();
  63732. }
  63733. }
  63734. class Acrobat7 extends _xfa_object.XFAObject {
  63735. constructor(attributes) {
  63736. super(CONFIG_NS_ID, "acrobat7", true);
  63737. this.dynamicRender = null;
  63738. }
  63739. }
  63740. class ADBE_JSConsole extends _xfa_object.OptionObject {
  63741. constructor(attributes) {
  63742. super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]);
  63743. }
  63744. }
  63745. class ADBE_JSDebugger extends _xfa_object.OptionObject {
  63746. constructor(attributes) {
  63747. super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]);
  63748. }
  63749. }
  63750. class AddSilentPrint extends _xfa_object.Option01 {
  63751. constructor(attributes) {
  63752. super(CONFIG_NS_ID, "addSilentPrint");
  63753. }
  63754. }
  63755. class AddViewerPreferences extends _xfa_object.Option01 {
  63756. constructor(attributes) {
  63757. super(CONFIG_NS_ID, "addViewerPreferences");
  63758. }
  63759. }
  63760. class AdjustData extends _xfa_object.Option10 {
  63761. constructor(attributes) {
  63762. super(CONFIG_NS_ID, "adjustData");
  63763. }
  63764. }
  63765. class AdobeExtensionLevel extends _xfa_object.IntegerObject {
  63766. constructor(attributes) {
  63767. super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8);
  63768. }
  63769. }
  63770. class Agent extends _xfa_object.XFAObject {
  63771. constructor(attributes) {
  63772. super(CONFIG_NS_ID, "agent", true);
  63773. this.name = attributes.name ? attributes.name.trim() : "";
  63774. this.common = new _xfa_object.XFAObjectArray();
  63775. }
  63776. }
  63777. class AlwaysEmbed extends _xfa_object.ContentObject {
  63778. constructor(attributes) {
  63779. super(CONFIG_NS_ID, "alwaysEmbed");
  63780. }
  63781. }
  63782. class Amd extends _xfa_object.StringObject {
  63783. constructor(attributes) {
  63784. super(CONFIG_NS_ID, "amd");
  63785. }
  63786. }
  63787. class Area extends _xfa_object.XFAObject {
  63788. constructor(attributes) {
  63789. super(CONFIG_NS_ID, "area");
  63790. this.level = (0, _utils.getInteger)({
  63791. data: attributes.level,
  63792. defaultValue: 0,
  63793. validate: n => n >= 1 && n <= 3
  63794. });
  63795. this.name = (0, _utils.getStringOption)(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]);
  63796. }
  63797. }
  63798. class Attributes extends _xfa_object.OptionObject {
  63799. constructor(attributes) {
  63800. super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]);
  63801. }
  63802. }
  63803. class AutoSave extends _xfa_object.OptionObject {
  63804. constructor(attributes) {
  63805. super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]);
  63806. }
  63807. }
  63808. class Base extends _xfa_object.StringObject {
  63809. constructor(attributes) {
  63810. super(CONFIG_NS_ID, "base");
  63811. }
  63812. }
  63813. class BatchOutput extends _xfa_object.XFAObject {
  63814. constructor(attributes) {
  63815. super(CONFIG_NS_ID, "batchOutput");
  63816. this.format = (0, _utils.getStringOption)(attributes.format, ["none", "concat", "zip", "zipCompress"]);
  63817. }
  63818. }
  63819. class BehaviorOverride extends _xfa_object.ContentObject {
  63820. constructor(attributes) {
  63821. super(CONFIG_NS_ID, "behaviorOverride");
  63822. }
  63823. [_xfa_object.$finalize]() {
  63824. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2)));
  63825. }
  63826. }
  63827. class Cache extends _xfa_object.XFAObject {
  63828. constructor(attributes) {
  63829. super(CONFIG_NS_ID, "cache", true);
  63830. this.templateCache = null;
  63831. }
  63832. }
  63833. class Change extends _xfa_object.Option01 {
  63834. constructor(attributes) {
  63835. super(CONFIG_NS_ID, "change");
  63836. }
  63837. }
  63838. class Common extends _xfa_object.XFAObject {
  63839. constructor(attributes) {
  63840. super(CONFIG_NS_ID, "common", true);
  63841. this.data = null;
  63842. this.locale = null;
  63843. this.localeSet = null;
  63844. this.messaging = null;
  63845. this.suppressBanner = null;
  63846. this.template = null;
  63847. this.validationMessaging = null;
  63848. this.versionControl = null;
  63849. this.log = new _xfa_object.XFAObjectArray();
  63850. }
  63851. }
  63852. class Compress extends _xfa_object.XFAObject {
  63853. constructor(attributes) {
  63854. super(CONFIG_NS_ID, "compress");
  63855. this.scope = (0, _utils.getStringOption)(attributes.scope, ["imageOnly", "document"]);
  63856. }
  63857. }
  63858. class CompressLogicalStructure extends _xfa_object.Option01 {
  63859. constructor(attributes) {
  63860. super(CONFIG_NS_ID, "compressLogicalStructure");
  63861. }
  63862. }
  63863. class CompressObjectStream extends _xfa_object.Option10 {
  63864. constructor(attributes) {
  63865. super(CONFIG_NS_ID, "compressObjectStream");
  63866. }
  63867. }
  63868. class Compression extends _xfa_object.XFAObject {
  63869. constructor(attributes) {
  63870. super(CONFIG_NS_ID, "compression", true);
  63871. this.compressLogicalStructure = null;
  63872. this.compressObjectStream = null;
  63873. this.level = null;
  63874. this.type = null;
  63875. }
  63876. }
  63877. class Config extends _xfa_object.XFAObject {
  63878. constructor(attributes) {
  63879. super(CONFIG_NS_ID, "config", true);
  63880. this.acrobat = null;
  63881. this.present = null;
  63882. this.trace = null;
  63883. this.agent = new _xfa_object.XFAObjectArray();
  63884. }
  63885. }
  63886. class Conformance extends _xfa_object.OptionObject {
  63887. constructor(attributes) {
  63888. super(CONFIG_NS_ID, "conformance", ["A", "B"]);
  63889. }
  63890. }
  63891. class ContentCopy extends _xfa_object.Option01 {
  63892. constructor(attributes) {
  63893. super(CONFIG_NS_ID, "contentCopy");
  63894. }
  63895. }
  63896. class Copies extends _xfa_object.IntegerObject {
  63897. constructor(attributes) {
  63898. super(CONFIG_NS_ID, "copies", 1, n => n >= 1);
  63899. }
  63900. }
  63901. class Creator extends _xfa_object.StringObject {
  63902. constructor(attributes) {
  63903. super(CONFIG_NS_ID, "creator");
  63904. }
  63905. }
  63906. class CurrentPage extends _xfa_object.IntegerObject {
  63907. constructor(attributes) {
  63908. super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0);
  63909. }
  63910. }
  63911. class Data extends _xfa_object.XFAObject {
  63912. constructor(attributes) {
  63913. super(CONFIG_NS_ID, "data", true);
  63914. this.adjustData = null;
  63915. this.attributes = null;
  63916. this.incrementalLoad = null;
  63917. this.outputXSL = null;
  63918. this.range = null;
  63919. this.record = null;
  63920. this.startNode = null;
  63921. this.uri = null;
  63922. this.window = null;
  63923. this.xsl = null;
  63924. this.excludeNS = new _xfa_object.XFAObjectArray();
  63925. this.transform = new _xfa_object.XFAObjectArray();
  63926. }
  63927. }
  63928. class Debug extends _xfa_object.XFAObject {
  63929. constructor(attributes) {
  63930. super(CONFIG_NS_ID, "debug", true);
  63931. this.uri = null;
  63932. }
  63933. }
  63934. class DefaultTypeface extends _xfa_object.ContentObject {
  63935. constructor(attributes) {
  63936. super(CONFIG_NS_ID, "defaultTypeface");
  63937. this.writingScript = (0, _utils.getStringOption)(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]);
  63938. }
  63939. }
  63940. class Destination extends _xfa_object.OptionObject {
  63941. constructor(attributes) {
  63942. super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]);
  63943. }
  63944. }
  63945. class DocumentAssembly extends _xfa_object.Option01 {
  63946. constructor(attributes) {
  63947. super(CONFIG_NS_ID, "documentAssembly");
  63948. }
  63949. }
  63950. class Driver extends _xfa_object.XFAObject {
  63951. constructor(attributes) {
  63952. super(CONFIG_NS_ID, "driver", true);
  63953. this.name = attributes.name ? attributes.name.trim() : "";
  63954. this.fontInfo = null;
  63955. this.xdc = null;
  63956. }
  63957. }
  63958. class DuplexOption extends _xfa_object.OptionObject {
  63959. constructor(attributes) {
  63960. super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]);
  63961. }
  63962. }
  63963. class DynamicRender extends _xfa_object.OptionObject {
  63964. constructor(attributes) {
  63965. super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]);
  63966. }
  63967. }
  63968. class Embed extends _xfa_object.Option01 {
  63969. constructor(attributes) {
  63970. super(CONFIG_NS_ID, "embed");
  63971. }
  63972. }
  63973. class Encrypt extends _xfa_object.Option01 {
  63974. constructor(attributes) {
  63975. super(CONFIG_NS_ID, "encrypt");
  63976. }
  63977. }
  63978. class Encryption extends _xfa_object.XFAObject {
  63979. constructor(attributes) {
  63980. super(CONFIG_NS_ID, "encryption", true);
  63981. this.encrypt = null;
  63982. this.encryptionLevel = null;
  63983. this.permissions = null;
  63984. }
  63985. }
  63986. class EncryptionLevel extends _xfa_object.OptionObject {
  63987. constructor(attributes) {
  63988. super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]);
  63989. }
  63990. }
  63991. class Enforce extends _xfa_object.StringObject {
  63992. constructor(attributes) {
  63993. super(CONFIG_NS_ID, "enforce");
  63994. }
  63995. }
  63996. class Equate extends _xfa_object.XFAObject {
  63997. constructor(attributes) {
  63998. super(CONFIG_NS_ID, "equate");
  63999. this.force = (0, _utils.getInteger)({
  64000. data: attributes.force,
  64001. defaultValue: 1,
  64002. validate: n => n === 0
  64003. });
  64004. this.from = attributes.from || "";
  64005. this.to = attributes.to || "";
  64006. }
  64007. }
  64008. class EquateRange extends _xfa_object.XFAObject {
  64009. constructor(attributes) {
  64010. super(CONFIG_NS_ID, "equateRange");
  64011. this.from = attributes.from || "";
  64012. this.to = attributes.to || "";
  64013. this._unicodeRange = attributes.unicodeRange || "";
  64014. }
  64015. get unicodeRange() {
  64016. const ranges = [];
  64017. const unicodeRegex = /U\+([0-9a-fA-F]+)/;
  64018. const unicodeRange = this._unicodeRange;
  64019. for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) {
  64020. range = range.split("-", 2).map(x => {
  64021. const found = x.match(unicodeRegex);
  64022. if (!found) {
  64023. return 0;
  64024. }
  64025. return parseInt(found[1], 16);
  64026. });
  64027. if (range.length === 1) {
  64028. range.push(range[0]);
  64029. }
  64030. ranges.push(range);
  64031. }
  64032. return (0, _util.shadow)(this, "unicodeRange", ranges);
  64033. }
  64034. }
  64035. class Exclude extends _xfa_object.ContentObject {
  64036. constructor(attributes) {
  64037. super(CONFIG_NS_ID, "exclude");
  64038. }
  64039. [_xfa_object.$finalize]() {
  64040. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x));
  64041. }
  64042. }
  64043. class ExcludeNS extends _xfa_object.StringObject {
  64044. constructor(attributes) {
  64045. super(CONFIG_NS_ID, "excludeNS");
  64046. }
  64047. }
  64048. class FlipLabel extends _xfa_object.OptionObject {
  64049. constructor(attributes) {
  64050. super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]);
  64051. }
  64052. }
  64053. class FontInfo extends _xfa_object.XFAObject {
  64054. constructor(attributes) {
  64055. super(CONFIG_NS_ID, "fontInfo", true);
  64056. this.embed = null;
  64057. this.map = null;
  64058. this.subsetBelow = null;
  64059. this.alwaysEmbed = new _xfa_object.XFAObjectArray();
  64060. this.defaultTypeface = new _xfa_object.XFAObjectArray();
  64061. this.neverEmbed = new _xfa_object.XFAObjectArray();
  64062. }
  64063. }
  64064. class FormFieldFilling extends _xfa_object.Option01 {
  64065. constructor(attributes) {
  64066. super(CONFIG_NS_ID, "formFieldFilling");
  64067. }
  64068. }
  64069. class GroupParent extends _xfa_object.StringObject {
  64070. constructor(attributes) {
  64071. super(CONFIG_NS_ID, "groupParent");
  64072. }
  64073. }
  64074. class IfEmpty extends _xfa_object.OptionObject {
  64075. constructor(attributes) {
  64076. super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]);
  64077. }
  64078. }
  64079. class IncludeXDPContent extends _xfa_object.StringObject {
  64080. constructor(attributes) {
  64081. super(CONFIG_NS_ID, "includeXDPContent");
  64082. }
  64083. }
  64084. class IncrementalLoad extends _xfa_object.OptionObject {
  64085. constructor(attributes) {
  64086. super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]);
  64087. }
  64088. }
  64089. class IncrementalMerge extends _xfa_object.Option01 {
  64090. constructor(attributes) {
  64091. super(CONFIG_NS_ID, "incrementalMerge");
  64092. }
  64093. }
  64094. class Interactive extends _xfa_object.Option01 {
  64095. constructor(attributes) {
  64096. super(CONFIG_NS_ID, "interactive");
  64097. }
  64098. }
  64099. class Jog extends _xfa_object.OptionObject {
  64100. constructor(attributes) {
  64101. super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]);
  64102. }
  64103. }
  64104. class LabelPrinter extends _xfa_object.XFAObject {
  64105. constructor(attributes) {
  64106. super(CONFIG_NS_ID, "labelPrinter", true);
  64107. this.name = (0, _utils.getStringOption)(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]);
  64108. this.batchOutput = null;
  64109. this.flipLabel = null;
  64110. this.fontInfo = null;
  64111. this.xdc = null;
  64112. }
  64113. }
  64114. class Layout extends _xfa_object.OptionObject {
  64115. constructor(attributes) {
  64116. super(CONFIG_NS_ID, "layout", ["paginate", "panel"]);
  64117. }
  64118. }
  64119. class Level extends _xfa_object.IntegerObject {
  64120. constructor(attributes) {
  64121. super(CONFIG_NS_ID, "level", 0, n => n > 0);
  64122. }
  64123. }
  64124. class Linearized extends _xfa_object.Option01 {
  64125. constructor(attributes) {
  64126. super(CONFIG_NS_ID, "linearized");
  64127. }
  64128. }
  64129. class Locale extends _xfa_object.StringObject {
  64130. constructor(attributes) {
  64131. super(CONFIG_NS_ID, "locale");
  64132. }
  64133. }
  64134. class LocaleSet extends _xfa_object.StringObject {
  64135. constructor(attributes) {
  64136. super(CONFIG_NS_ID, "localeSet");
  64137. }
  64138. }
  64139. class Log extends _xfa_object.XFAObject {
  64140. constructor(attributes) {
  64141. super(CONFIG_NS_ID, "log", true);
  64142. this.mode = null;
  64143. this.threshold = null;
  64144. this.to = null;
  64145. this.uri = null;
  64146. }
  64147. }
  64148. class MapElement extends _xfa_object.XFAObject {
  64149. constructor(attributes) {
  64150. super(CONFIG_NS_ID, "map", true);
  64151. this.equate = new _xfa_object.XFAObjectArray();
  64152. this.equateRange = new _xfa_object.XFAObjectArray();
  64153. }
  64154. }
  64155. class MediumInfo extends _xfa_object.XFAObject {
  64156. constructor(attributes) {
  64157. super(CONFIG_NS_ID, "mediumInfo", true);
  64158. this.map = null;
  64159. }
  64160. }
  64161. class Message extends _xfa_object.XFAObject {
  64162. constructor(attributes) {
  64163. super(CONFIG_NS_ID, "message", true);
  64164. this.msgId = null;
  64165. this.severity = null;
  64166. }
  64167. }
  64168. class Messaging extends _xfa_object.XFAObject {
  64169. constructor(attributes) {
  64170. super(CONFIG_NS_ID, "messaging", true);
  64171. this.message = new _xfa_object.XFAObjectArray();
  64172. }
  64173. }
  64174. class Mode extends _xfa_object.OptionObject {
  64175. constructor(attributes) {
  64176. super(CONFIG_NS_ID, "mode", ["append", "overwrite"]);
  64177. }
  64178. }
  64179. class ModifyAnnots extends _xfa_object.Option01 {
  64180. constructor(attributes) {
  64181. super(CONFIG_NS_ID, "modifyAnnots");
  64182. }
  64183. }
  64184. class MsgId extends _xfa_object.IntegerObject {
  64185. constructor(attributes) {
  64186. super(CONFIG_NS_ID, "msgId", 1, n => n >= 1);
  64187. }
  64188. }
  64189. class NameAttr extends _xfa_object.StringObject {
  64190. constructor(attributes) {
  64191. super(CONFIG_NS_ID, "nameAttr");
  64192. }
  64193. }
  64194. class NeverEmbed extends _xfa_object.ContentObject {
  64195. constructor(attributes) {
  64196. super(CONFIG_NS_ID, "neverEmbed");
  64197. }
  64198. }
  64199. class NumberOfCopies extends _xfa_object.IntegerObject {
  64200. constructor(attributes) {
  64201. super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5);
  64202. }
  64203. }
  64204. class OpenAction extends _xfa_object.XFAObject {
  64205. constructor(attributes) {
  64206. super(CONFIG_NS_ID, "openAction", true);
  64207. this.destination = null;
  64208. }
  64209. }
  64210. class Output extends _xfa_object.XFAObject {
  64211. constructor(attributes) {
  64212. super(CONFIG_NS_ID, "output", true);
  64213. this.to = null;
  64214. this.type = null;
  64215. this.uri = null;
  64216. }
  64217. }
  64218. class OutputBin extends _xfa_object.StringObject {
  64219. constructor(attributes) {
  64220. super(CONFIG_NS_ID, "outputBin");
  64221. }
  64222. }
  64223. class OutputXSL extends _xfa_object.XFAObject {
  64224. constructor(attributes) {
  64225. super(CONFIG_NS_ID, "outputXSL", true);
  64226. this.uri = null;
  64227. }
  64228. }
  64229. class Overprint extends _xfa_object.OptionObject {
  64230. constructor(attributes) {
  64231. super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]);
  64232. }
  64233. }
  64234. class Packets extends _xfa_object.StringObject {
  64235. constructor(attributes) {
  64236. super(CONFIG_NS_ID, "packets");
  64237. }
  64238. [_xfa_object.$finalize]() {
  64239. if (this[_xfa_object.$content] === "*") {
  64240. return;
  64241. }
  64242. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x));
  64243. }
  64244. }
  64245. class PageOffset extends _xfa_object.XFAObject {
  64246. constructor(attributes) {
  64247. super(CONFIG_NS_ID, "pageOffset");
  64248. this.x = (0, _utils.getInteger)({
  64249. data: attributes.x,
  64250. defaultValue: "useXDCSetting",
  64251. validate: n => true
  64252. });
  64253. this.y = (0, _utils.getInteger)({
  64254. data: attributes.y,
  64255. defaultValue: "useXDCSetting",
  64256. validate: n => true
  64257. });
  64258. }
  64259. }
  64260. class PageRange extends _xfa_object.StringObject {
  64261. constructor(attributes) {
  64262. super(CONFIG_NS_ID, "pageRange");
  64263. }
  64264. [_xfa_object.$finalize]() {
  64265. const numbers = this[_xfa_object.$content].trim().split(/\s+/).map(x => parseInt(x, 10));
  64266. const ranges = [];
  64267. for (let i = 0, ii = numbers.length; i < ii; i += 2) {
  64268. ranges.push(numbers.slice(i, i + 2));
  64269. }
  64270. this[_xfa_object.$content] = ranges;
  64271. }
  64272. }
  64273. class Pagination extends _xfa_object.OptionObject {
  64274. constructor(attributes) {
  64275. super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]);
  64276. }
  64277. }
  64278. class PaginationOverride extends _xfa_object.OptionObject {
  64279. constructor(attributes) {
  64280. super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]);
  64281. }
  64282. }
  64283. class Part extends _xfa_object.IntegerObject {
  64284. constructor(attributes) {
  64285. super(CONFIG_NS_ID, "part", 1, n => false);
  64286. }
  64287. }
  64288. class Pcl extends _xfa_object.XFAObject {
  64289. constructor(attributes) {
  64290. super(CONFIG_NS_ID, "pcl", true);
  64291. this.name = attributes.name || "";
  64292. this.batchOutput = null;
  64293. this.fontInfo = null;
  64294. this.jog = null;
  64295. this.mediumInfo = null;
  64296. this.outputBin = null;
  64297. this.pageOffset = null;
  64298. this.staple = null;
  64299. this.xdc = null;
  64300. }
  64301. }
  64302. class Pdf extends _xfa_object.XFAObject {
  64303. constructor(attributes) {
  64304. super(CONFIG_NS_ID, "pdf", true);
  64305. this.name = attributes.name || "";
  64306. this.adobeExtensionLevel = null;
  64307. this.batchOutput = null;
  64308. this.compression = null;
  64309. this.creator = null;
  64310. this.encryption = null;
  64311. this.fontInfo = null;
  64312. this.interactive = null;
  64313. this.linearized = null;
  64314. this.openAction = null;
  64315. this.pdfa = null;
  64316. this.producer = null;
  64317. this.renderPolicy = null;
  64318. this.scriptModel = null;
  64319. this.silentPrint = null;
  64320. this.submitFormat = null;
  64321. this.tagged = null;
  64322. this.version = null;
  64323. this.viewerPreferences = null;
  64324. this.xdc = null;
  64325. }
  64326. }
  64327. class Pdfa extends _xfa_object.XFAObject {
  64328. constructor(attributes) {
  64329. super(CONFIG_NS_ID, "pdfa", true);
  64330. this.amd = null;
  64331. this.conformance = null;
  64332. this.includeXDPContent = null;
  64333. this.part = null;
  64334. }
  64335. }
  64336. class Permissions extends _xfa_object.XFAObject {
  64337. constructor(attributes) {
  64338. super(CONFIG_NS_ID, "permissions", true);
  64339. this.accessibleContent = null;
  64340. this.change = null;
  64341. this.contentCopy = null;
  64342. this.documentAssembly = null;
  64343. this.formFieldFilling = null;
  64344. this.modifyAnnots = null;
  64345. this.plaintextMetadata = null;
  64346. this.print = null;
  64347. this.printHighQuality = null;
  64348. }
  64349. }
  64350. class PickTrayByPDFSize extends _xfa_object.Option01 {
  64351. constructor(attributes) {
  64352. super(CONFIG_NS_ID, "pickTrayByPDFSize");
  64353. }
  64354. }
  64355. class Picture extends _xfa_object.StringObject {
  64356. constructor(attributes) {
  64357. super(CONFIG_NS_ID, "picture");
  64358. }
  64359. }
  64360. class PlaintextMetadata extends _xfa_object.Option01 {
  64361. constructor(attributes) {
  64362. super(CONFIG_NS_ID, "plaintextMetadata");
  64363. }
  64364. }
  64365. class Presence extends _xfa_object.OptionObject {
  64366. constructor(attributes) {
  64367. super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]);
  64368. }
  64369. }
  64370. class Present extends _xfa_object.XFAObject {
  64371. constructor(attributes) {
  64372. super(CONFIG_NS_ID, "present", true);
  64373. this.behaviorOverride = null;
  64374. this.cache = null;
  64375. this.common = null;
  64376. this.copies = null;
  64377. this.destination = null;
  64378. this.incrementalMerge = null;
  64379. this.layout = null;
  64380. this.output = null;
  64381. this.overprint = null;
  64382. this.pagination = null;
  64383. this.paginationOverride = null;
  64384. this.script = null;
  64385. this.validate = null;
  64386. this.xdp = null;
  64387. this.driver = new _xfa_object.XFAObjectArray();
  64388. this.labelPrinter = new _xfa_object.XFAObjectArray();
  64389. this.pcl = new _xfa_object.XFAObjectArray();
  64390. this.pdf = new _xfa_object.XFAObjectArray();
  64391. this.ps = new _xfa_object.XFAObjectArray();
  64392. this.submitUrl = new _xfa_object.XFAObjectArray();
  64393. this.webClient = new _xfa_object.XFAObjectArray();
  64394. this.zpl = new _xfa_object.XFAObjectArray();
  64395. }
  64396. }
  64397. class Print extends _xfa_object.Option01 {
  64398. constructor(attributes) {
  64399. super(CONFIG_NS_ID, "print");
  64400. }
  64401. }
  64402. class PrintHighQuality extends _xfa_object.Option01 {
  64403. constructor(attributes) {
  64404. super(CONFIG_NS_ID, "printHighQuality");
  64405. }
  64406. }
  64407. class PrintScaling extends _xfa_object.OptionObject {
  64408. constructor(attributes) {
  64409. super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]);
  64410. }
  64411. }
  64412. class PrinterName extends _xfa_object.StringObject {
  64413. constructor(attributes) {
  64414. super(CONFIG_NS_ID, "printerName");
  64415. }
  64416. }
  64417. class Producer extends _xfa_object.StringObject {
  64418. constructor(attributes) {
  64419. super(CONFIG_NS_ID, "producer");
  64420. }
  64421. }
  64422. class Ps extends _xfa_object.XFAObject {
  64423. constructor(attributes) {
  64424. super(CONFIG_NS_ID, "ps", true);
  64425. this.name = attributes.name || "";
  64426. this.batchOutput = null;
  64427. this.fontInfo = null;
  64428. this.jog = null;
  64429. this.mediumInfo = null;
  64430. this.outputBin = null;
  64431. this.staple = null;
  64432. this.xdc = null;
  64433. }
  64434. }
  64435. class Range extends _xfa_object.ContentObject {
  64436. constructor(attributes) {
  64437. super(CONFIG_NS_ID, "range");
  64438. }
  64439. [_xfa_object.$finalize]() {
  64440. 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 => {
  64441. if (range.length === 1) {
  64442. range.push(range[0]);
  64443. }
  64444. return range;
  64445. });
  64446. }
  64447. }
  64448. class Record extends _xfa_object.ContentObject {
  64449. constructor(attributes) {
  64450. super(CONFIG_NS_ID, "record");
  64451. }
  64452. [_xfa_object.$finalize]() {
  64453. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  64454. const n = parseInt(this[_xfa_object.$content], 10);
  64455. if (!isNaN(n) && n >= 0) {
  64456. this[_xfa_object.$content] = n;
  64457. }
  64458. }
  64459. }
  64460. class Relevant extends _xfa_object.ContentObject {
  64461. constructor(attributes) {
  64462. super(CONFIG_NS_ID, "relevant");
  64463. }
  64464. [_xfa_object.$finalize]() {
  64465. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/);
  64466. }
  64467. }
  64468. class Rename extends _xfa_object.ContentObject {
  64469. constructor(attributes) {
  64470. super(CONFIG_NS_ID, "rename");
  64471. }
  64472. [_xfa_object.$finalize]() {
  64473. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  64474. if (this[_xfa_object.$content].toLowerCase().startsWith("xml") || new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u").test(this[_xfa_object.$content])) {
  64475. (0, _util.warn)("XFA - Rename: invalid XFA name");
  64476. }
  64477. }
  64478. }
  64479. class RenderPolicy extends _xfa_object.OptionObject {
  64480. constructor(attributes) {
  64481. super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]);
  64482. }
  64483. }
  64484. class RunScripts extends _xfa_object.OptionObject {
  64485. constructor(attributes) {
  64486. super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]);
  64487. }
  64488. }
  64489. class Script extends _xfa_object.XFAObject {
  64490. constructor(attributes) {
  64491. super(CONFIG_NS_ID, "script", true);
  64492. this.currentPage = null;
  64493. this.exclude = null;
  64494. this.runScripts = null;
  64495. }
  64496. }
  64497. class ScriptModel extends _xfa_object.OptionObject {
  64498. constructor(attributes) {
  64499. super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]);
  64500. }
  64501. }
  64502. class Severity extends _xfa_object.OptionObject {
  64503. constructor(attributes) {
  64504. super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]);
  64505. }
  64506. }
  64507. class SilentPrint extends _xfa_object.XFAObject {
  64508. constructor(attributes) {
  64509. super(CONFIG_NS_ID, "silentPrint", true);
  64510. this.addSilentPrint = null;
  64511. this.printerName = null;
  64512. }
  64513. }
  64514. class Staple extends _xfa_object.XFAObject {
  64515. constructor(attributes) {
  64516. super(CONFIG_NS_ID, "staple");
  64517. this.mode = (0, _utils.getStringOption)(attributes.mode, ["usePrinterSetting", "on", "off"]);
  64518. }
  64519. }
  64520. class StartNode extends _xfa_object.StringObject {
  64521. constructor(attributes) {
  64522. super(CONFIG_NS_ID, "startNode");
  64523. }
  64524. }
  64525. class StartPage extends _xfa_object.IntegerObject {
  64526. constructor(attributes) {
  64527. super(CONFIG_NS_ID, "startPage", 0, n => true);
  64528. }
  64529. }
  64530. class SubmitFormat extends _xfa_object.OptionObject {
  64531. constructor(attributes) {
  64532. super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]);
  64533. }
  64534. }
  64535. class SubmitUrl extends _xfa_object.StringObject {
  64536. constructor(attributes) {
  64537. super(CONFIG_NS_ID, "submitUrl");
  64538. }
  64539. }
  64540. class SubsetBelow extends _xfa_object.IntegerObject {
  64541. constructor(attributes) {
  64542. super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100);
  64543. }
  64544. }
  64545. class SuppressBanner extends _xfa_object.Option01 {
  64546. constructor(attributes) {
  64547. super(CONFIG_NS_ID, "suppressBanner");
  64548. }
  64549. }
  64550. class Tagged extends _xfa_object.Option01 {
  64551. constructor(attributes) {
  64552. super(CONFIG_NS_ID, "tagged");
  64553. }
  64554. }
  64555. class Template extends _xfa_object.XFAObject {
  64556. constructor(attributes) {
  64557. super(CONFIG_NS_ID, "template", true);
  64558. this.base = null;
  64559. this.relevant = null;
  64560. this.startPage = null;
  64561. this.uri = null;
  64562. this.xsl = null;
  64563. }
  64564. }
  64565. class Threshold extends _xfa_object.OptionObject {
  64566. constructor(attributes) {
  64567. super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]);
  64568. }
  64569. }
  64570. class To extends _xfa_object.OptionObject {
  64571. constructor(attributes) {
  64572. super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]);
  64573. }
  64574. }
  64575. class TemplateCache extends _xfa_object.XFAObject {
  64576. constructor(attributes) {
  64577. super(CONFIG_NS_ID, "templateCache");
  64578. this.maxEntries = (0, _utils.getInteger)({
  64579. data: attributes.maxEntries,
  64580. defaultValue: 5,
  64581. validate: n => n >= 0
  64582. });
  64583. }
  64584. }
  64585. class Trace extends _xfa_object.XFAObject {
  64586. constructor(attributes) {
  64587. super(CONFIG_NS_ID, "trace", true);
  64588. this.area = new _xfa_object.XFAObjectArray();
  64589. }
  64590. }
  64591. class Transform extends _xfa_object.XFAObject {
  64592. constructor(attributes) {
  64593. super(CONFIG_NS_ID, "transform", true);
  64594. this.groupParent = null;
  64595. this.ifEmpty = null;
  64596. this.nameAttr = null;
  64597. this.picture = null;
  64598. this.presence = null;
  64599. this.rename = null;
  64600. this.whitespace = null;
  64601. }
  64602. }
  64603. class Type extends _xfa_object.OptionObject {
  64604. constructor(attributes) {
  64605. super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]);
  64606. }
  64607. }
  64608. class Uri extends _xfa_object.StringObject {
  64609. constructor(attributes) {
  64610. super(CONFIG_NS_ID, "uri");
  64611. }
  64612. }
  64613. class Validate extends _xfa_object.OptionObject {
  64614. constructor(attributes) {
  64615. super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]);
  64616. }
  64617. }
  64618. class ValidateApprovalSignatures extends _xfa_object.ContentObject {
  64619. constructor(attributes) {
  64620. super(CONFIG_NS_ID, "validateApprovalSignatures");
  64621. }
  64622. [_xfa_object.$finalize]() {
  64623. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x));
  64624. }
  64625. }
  64626. class ValidationMessaging extends _xfa_object.OptionObject {
  64627. constructor(attributes) {
  64628. super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]);
  64629. }
  64630. }
  64631. class Version extends _xfa_object.OptionObject {
  64632. constructor(attributes) {
  64633. super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]);
  64634. }
  64635. }
  64636. class VersionControl extends _xfa_object.XFAObject {
  64637. constructor(attributes) {
  64638. super(CONFIG_NS_ID, "VersionControl");
  64639. this.outputBelow = (0, _utils.getStringOption)(attributes.outputBelow, ["warn", "error", "update"]);
  64640. this.sourceAbove = (0, _utils.getStringOption)(attributes.sourceAbove, ["warn", "error"]);
  64641. this.sourceBelow = (0, _utils.getStringOption)(attributes.sourceBelow, ["update", "maintain"]);
  64642. }
  64643. }
  64644. class ViewerPreferences extends _xfa_object.XFAObject {
  64645. constructor(attributes) {
  64646. super(CONFIG_NS_ID, "viewerPreferences", true);
  64647. this.ADBE_JSConsole = null;
  64648. this.ADBE_JSDebugger = null;
  64649. this.addViewerPreferences = null;
  64650. this.duplexOption = null;
  64651. this.enforce = null;
  64652. this.numberOfCopies = null;
  64653. this.pageRange = null;
  64654. this.pickTrayByPDFSize = null;
  64655. this.printScaling = null;
  64656. }
  64657. }
  64658. class WebClient extends _xfa_object.XFAObject {
  64659. constructor(attributes) {
  64660. super(CONFIG_NS_ID, "webClient", true);
  64661. this.name = attributes.name ? attributes.name.trim() : "";
  64662. this.fontInfo = null;
  64663. this.xdc = null;
  64664. }
  64665. }
  64666. class Whitespace extends _xfa_object.OptionObject {
  64667. constructor(attributes) {
  64668. super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]);
  64669. }
  64670. }
  64671. class Window extends _xfa_object.ContentObject {
  64672. constructor(attributes) {
  64673. super(CONFIG_NS_ID, "window");
  64674. }
  64675. [_xfa_object.$finalize]() {
  64676. const pair = this[_xfa_object.$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10));
  64677. if (pair.some(x => isNaN(x))) {
  64678. this[_xfa_object.$content] = [0, 0];
  64679. return;
  64680. }
  64681. if (pair.length === 1) {
  64682. pair.push(pair[0]);
  64683. }
  64684. this[_xfa_object.$content] = pair;
  64685. }
  64686. }
  64687. class Xdc extends _xfa_object.XFAObject {
  64688. constructor(attributes) {
  64689. super(CONFIG_NS_ID, "xdc", true);
  64690. this.uri = new _xfa_object.XFAObjectArray();
  64691. this.xsl = new _xfa_object.XFAObjectArray();
  64692. }
  64693. }
  64694. class Xdp extends _xfa_object.XFAObject {
  64695. constructor(attributes) {
  64696. super(CONFIG_NS_ID, "xdp", true);
  64697. this.packets = null;
  64698. }
  64699. }
  64700. class Xsl extends _xfa_object.XFAObject {
  64701. constructor(attributes) {
  64702. super(CONFIG_NS_ID, "xsl", true);
  64703. this.debug = null;
  64704. this.uri = null;
  64705. }
  64706. }
  64707. class Zpl extends _xfa_object.XFAObject {
  64708. constructor(attributes) {
  64709. super(CONFIG_NS_ID, "zpl", true);
  64710. this.name = attributes.name ? attributes.name.trim() : "";
  64711. this.batchOutput = null;
  64712. this.flipLabel = null;
  64713. this.fontInfo = null;
  64714. this.xdc = null;
  64715. }
  64716. }
  64717. class ConfigNamespace {
  64718. static [_namespaces.$buildXFAObject](name, attributes) {
  64719. if (ConfigNamespace.hasOwnProperty(name)) {
  64720. return ConfigNamespace[name](attributes);
  64721. }
  64722. return undefined;
  64723. }
  64724. static acrobat(attrs) {
  64725. return new Acrobat(attrs);
  64726. }
  64727. static acrobat7(attrs) {
  64728. return new Acrobat7(attrs);
  64729. }
  64730. static ADBE_JSConsole(attrs) {
  64731. return new ADBE_JSConsole(attrs);
  64732. }
  64733. static ADBE_JSDebugger(attrs) {
  64734. return new ADBE_JSDebugger(attrs);
  64735. }
  64736. static addSilentPrint(attrs) {
  64737. return new AddSilentPrint(attrs);
  64738. }
  64739. static addViewerPreferences(attrs) {
  64740. return new AddViewerPreferences(attrs);
  64741. }
  64742. static adjustData(attrs) {
  64743. return new AdjustData(attrs);
  64744. }
  64745. static adobeExtensionLevel(attrs) {
  64746. return new AdobeExtensionLevel(attrs);
  64747. }
  64748. static agent(attrs) {
  64749. return new Agent(attrs);
  64750. }
  64751. static alwaysEmbed(attrs) {
  64752. return new AlwaysEmbed(attrs);
  64753. }
  64754. static amd(attrs) {
  64755. return new Amd(attrs);
  64756. }
  64757. static area(attrs) {
  64758. return new Area(attrs);
  64759. }
  64760. static attributes(attrs) {
  64761. return new Attributes(attrs);
  64762. }
  64763. static autoSave(attrs) {
  64764. return new AutoSave(attrs);
  64765. }
  64766. static base(attrs) {
  64767. return new Base(attrs);
  64768. }
  64769. static batchOutput(attrs) {
  64770. return new BatchOutput(attrs);
  64771. }
  64772. static behaviorOverride(attrs) {
  64773. return new BehaviorOverride(attrs);
  64774. }
  64775. static cache(attrs) {
  64776. return new Cache(attrs);
  64777. }
  64778. static change(attrs) {
  64779. return new Change(attrs);
  64780. }
  64781. static common(attrs) {
  64782. return new Common(attrs);
  64783. }
  64784. static compress(attrs) {
  64785. return new Compress(attrs);
  64786. }
  64787. static compressLogicalStructure(attrs) {
  64788. return new CompressLogicalStructure(attrs);
  64789. }
  64790. static compressObjectStream(attrs) {
  64791. return new CompressObjectStream(attrs);
  64792. }
  64793. static compression(attrs) {
  64794. return new Compression(attrs);
  64795. }
  64796. static config(attrs) {
  64797. return new Config(attrs);
  64798. }
  64799. static conformance(attrs) {
  64800. return new Conformance(attrs);
  64801. }
  64802. static contentCopy(attrs) {
  64803. return new ContentCopy(attrs);
  64804. }
  64805. static copies(attrs) {
  64806. return new Copies(attrs);
  64807. }
  64808. static creator(attrs) {
  64809. return new Creator(attrs);
  64810. }
  64811. static currentPage(attrs) {
  64812. return new CurrentPage(attrs);
  64813. }
  64814. static data(attrs) {
  64815. return new Data(attrs);
  64816. }
  64817. static debug(attrs) {
  64818. return new Debug(attrs);
  64819. }
  64820. static defaultTypeface(attrs) {
  64821. return new DefaultTypeface(attrs);
  64822. }
  64823. static destination(attrs) {
  64824. return new Destination(attrs);
  64825. }
  64826. static documentAssembly(attrs) {
  64827. return new DocumentAssembly(attrs);
  64828. }
  64829. static driver(attrs) {
  64830. return new Driver(attrs);
  64831. }
  64832. static duplexOption(attrs) {
  64833. return new DuplexOption(attrs);
  64834. }
  64835. static dynamicRender(attrs) {
  64836. return new DynamicRender(attrs);
  64837. }
  64838. static embed(attrs) {
  64839. return new Embed(attrs);
  64840. }
  64841. static encrypt(attrs) {
  64842. return new Encrypt(attrs);
  64843. }
  64844. static encryption(attrs) {
  64845. return new Encryption(attrs);
  64846. }
  64847. static encryptionLevel(attrs) {
  64848. return new EncryptionLevel(attrs);
  64849. }
  64850. static enforce(attrs) {
  64851. return new Enforce(attrs);
  64852. }
  64853. static equate(attrs) {
  64854. return new Equate(attrs);
  64855. }
  64856. static equateRange(attrs) {
  64857. return new EquateRange(attrs);
  64858. }
  64859. static exclude(attrs) {
  64860. return new Exclude(attrs);
  64861. }
  64862. static excludeNS(attrs) {
  64863. return new ExcludeNS(attrs);
  64864. }
  64865. static flipLabel(attrs) {
  64866. return new FlipLabel(attrs);
  64867. }
  64868. static fontInfo(attrs) {
  64869. return new FontInfo(attrs);
  64870. }
  64871. static formFieldFilling(attrs) {
  64872. return new FormFieldFilling(attrs);
  64873. }
  64874. static groupParent(attrs) {
  64875. return new GroupParent(attrs);
  64876. }
  64877. static ifEmpty(attrs) {
  64878. return new IfEmpty(attrs);
  64879. }
  64880. static includeXDPContent(attrs) {
  64881. return new IncludeXDPContent(attrs);
  64882. }
  64883. static incrementalLoad(attrs) {
  64884. return new IncrementalLoad(attrs);
  64885. }
  64886. static incrementalMerge(attrs) {
  64887. return new IncrementalMerge(attrs);
  64888. }
  64889. static interactive(attrs) {
  64890. return new Interactive(attrs);
  64891. }
  64892. static jog(attrs) {
  64893. return new Jog(attrs);
  64894. }
  64895. static labelPrinter(attrs) {
  64896. return new LabelPrinter(attrs);
  64897. }
  64898. static layout(attrs) {
  64899. return new Layout(attrs);
  64900. }
  64901. static level(attrs) {
  64902. return new Level(attrs);
  64903. }
  64904. static linearized(attrs) {
  64905. return new Linearized(attrs);
  64906. }
  64907. static locale(attrs) {
  64908. return new Locale(attrs);
  64909. }
  64910. static localeSet(attrs) {
  64911. return new LocaleSet(attrs);
  64912. }
  64913. static log(attrs) {
  64914. return new Log(attrs);
  64915. }
  64916. static map(attrs) {
  64917. return new MapElement(attrs);
  64918. }
  64919. static mediumInfo(attrs) {
  64920. return new MediumInfo(attrs);
  64921. }
  64922. static message(attrs) {
  64923. return new Message(attrs);
  64924. }
  64925. static messaging(attrs) {
  64926. return new Messaging(attrs);
  64927. }
  64928. static mode(attrs) {
  64929. return new Mode(attrs);
  64930. }
  64931. static modifyAnnots(attrs) {
  64932. return new ModifyAnnots(attrs);
  64933. }
  64934. static msgId(attrs) {
  64935. return new MsgId(attrs);
  64936. }
  64937. static nameAttr(attrs) {
  64938. return new NameAttr(attrs);
  64939. }
  64940. static neverEmbed(attrs) {
  64941. return new NeverEmbed(attrs);
  64942. }
  64943. static numberOfCopies(attrs) {
  64944. return new NumberOfCopies(attrs);
  64945. }
  64946. static openAction(attrs) {
  64947. return new OpenAction(attrs);
  64948. }
  64949. static output(attrs) {
  64950. return new Output(attrs);
  64951. }
  64952. static outputBin(attrs) {
  64953. return new OutputBin(attrs);
  64954. }
  64955. static outputXSL(attrs) {
  64956. return new OutputXSL(attrs);
  64957. }
  64958. static overprint(attrs) {
  64959. return new Overprint(attrs);
  64960. }
  64961. static packets(attrs) {
  64962. return new Packets(attrs);
  64963. }
  64964. static pageOffset(attrs) {
  64965. return new PageOffset(attrs);
  64966. }
  64967. static pageRange(attrs) {
  64968. return new PageRange(attrs);
  64969. }
  64970. static pagination(attrs) {
  64971. return new Pagination(attrs);
  64972. }
  64973. static paginationOverride(attrs) {
  64974. return new PaginationOverride(attrs);
  64975. }
  64976. static part(attrs) {
  64977. return new Part(attrs);
  64978. }
  64979. static pcl(attrs) {
  64980. return new Pcl(attrs);
  64981. }
  64982. static pdf(attrs) {
  64983. return new Pdf(attrs);
  64984. }
  64985. static pdfa(attrs) {
  64986. return new Pdfa(attrs);
  64987. }
  64988. static permissions(attrs) {
  64989. return new Permissions(attrs);
  64990. }
  64991. static pickTrayByPDFSize(attrs) {
  64992. return new PickTrayByPDFSize(attrs);
  64993. }
  64994. static picture(attrs) {
  64995. return new Picture(attrs);
  64996. }
  64997. static plaintextMetadata(attrs) {
  64998. return new PlaintextMetadata(attrs);
  64999. }
  65000. static presence(attrs) {
  65001. return new Presence(attrs);
  65002. }
  65003. static present(attrs) {
  65004. return new Present(attrs);
  65005. }
  65006. static print(attrs) {
  65007. return new Print(attrs);
  65008. }
  65009. static printHighQuality(attrs) {
  65010. return new PrintHighQuality(attrs);
  65011. }
  65012. static printScaling(attrs) {
  65013. return new PrintScaling(attrs);
  65014. }
  65015. static printerName(attrs) {
  65016. return new PrinterName(attrs);
  65017. }
  65018. static producer(attrs) {
  65019. return new Producer(attrs);
  65020. }
  65021. static ps(attrs) {
  65022. return new Ps(attrs);
  65023. }
  65024. static range(attrs) {
  65025. return new Range(attrs);
  65026. }
  65027. static record(attrs) {
  65028. return new Record(attrs);
  65029. }
  65030. static relevant(attrs) {
  65031. return new Relevant(attrs);
  65032. }
  65033. static rename(attrs) {
  65034. return new Rename(attrs);
  65035. }
  65036. static renderPolicy(attrs) {
  65037. return new RenderPolicy(attrs);
  65038. }
  65039. static runScripts(attrs) {
  65040. return new RunScripts(attrs);
  65041. }
  65042. static script(attrs) {
  65043. return new Script(attrs);
  65044. }
  65045. static scriptModel(attrs) {
  65046. return new ScriptModel(attrs);
  65047. }
  65048. static severity(attrs) {
  65049. return new Severity(attrs);
  65050. }
  65051. static silentPrint(attrs) {
  65052. return new SilentPrint(attrs);
  65053. }
  65054. static staple(attrs) {
  65055. return new Staple(attrs);
  65056. }
  65057. static startNode(attrs) {
  65058. return new StartNode(attrs);
  65059. }
  65060. static startPage(attrs) {
  65061. return new StartPage(attrs);
  65062. }
  65063. static submitFormat(attrs) {
  65064. return new SubmitFormat(attrs);
  65065. }
  65066. static submitUrl(attrs) {
  65067. return new SubmitUrl(attrs);
  65068. }
  65069. static subsetBelow(attrs) {
  65070. return new SubsetBelow(attrs);
  65071. }
  65072. static suppressBanner(attrs) {
  65073. return new SuppressBanner(attrs);
  65074. }
  65075. static tagged(attrs) {
  65076. return new Tagged(attrs);
  65077. }
  65078. static template(attrs) {
  65079. return new Template(attrs);
  65080. }
  65081. static templateCache(attrs) {
  65082. return new TemplateCache(attrs);
  65083. }
  65084. static threshold(attrs) {
  65085. return new Threshold(attrs);
  65086. }
  65087. static to(attrs) {
  65088. return new To(attrs);
  65089. }
  65090. static trace(attrs) {
  65091. return new Trace(attrs);
  65092. }
  65093. static transform(attrs) {
  65094. return new Transform(attrs);
  65095. }
  65096. static type(attrs) {
  65097. return new Type(attrs);
  65098. }
  65099. static uri(attrs) {
  65100. return new Uri(attrs);
  65101. }
  65102. static validate(attrs) {
  65103. return new Validate(attrs);
  65104. }
  65105. static validateApprovalSignatures(attrs) {
  65106. return new ValidateApprovalSignatures(attrs);
  65107. }
  65108. static validationMessaging(attrs) {
  65109. return new ValidationMessaging(attrs);
  65110. }
  65111. static version(attrs) {
  65112. return new Version(attrs);
  65113. }
  65114. static versionControl(attrs) {
  65115. return new VersionControl(attrs);
  65116. }
  65117. static viewerPreferences(attrs) {
  65118. return new ViewerPreferences(attrs);
  65119. }
  65120. static webClient(attrs) {
  65121. return new WebClient(attrs);
  65122. }
  65123. static whitespace(attrs) {
  65124. return new Whitespace(attrs);
  65125. }
  65126. static window(attrs) {
  65127. return new Window(attrs);
  65128. }
  65129. static xdc(attrs) {
  65130. return new Xdc(attrs);
  65131. }
  65132. static xdp(attrs) {
  65133. return new Xdp(attrs);
  65134. }
  65135. static xsl(attrs) {
  65136. return new Xsl(attrs);
  65137. }
  65138. static zpl(attrs) {
  65139. return new Zpl(attrs);
  65140. }
  65141. }
  65142. exports.ConfigNamespace = ConfigNamespace;
  65143. /***/ }),
  65144. /* 223 */
  65145. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65146. "use strict";
  65147. Object.defineProperty(exports, "__esModule", ({
  65148. value: true
  65149. }));
  65150. exports.ConnectionSetNamespace = void 0;
  65151. var _namespaces = __w_pdfjs_require__(210);
  65152. var _xfa_object = __w_pdfjs_require__(208);
  65153. const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id;
  65154. class ConnectionSet extends _xfa_object.XFAObject {
  65155. constructor(attributes) {
  65156. super(CONNECTION_SET_NS_ID, "connectionSet", true);
  65157. this.wsdlConnection = new _xfa_object.XFAObjectArray();
  65158. this.xmlConnection = new _xfa_object.XFAObjectArray();
  65159. this.xsdConnection = new _xfa_object.XFAObjectArray();
  65160. }
  65161. }
  65162. class EffectiveInputPolicy extends _xfa_object.XFAObject {
  65163. constructor(attributes) {
  65164. super(CONNECTION_SET_NS_ID, "effectiveInputPolicy");
  65165. this.id = attributes.id || "";
  65166. this.name = attributes.name || "";
  65167. this.use = attributes.use || "";
  65168. this.usehref = attributes.usehref || "";
  65169. }
  65170. }
  65171. class EffectiveOutputPolicy extends _xfa_object.XFAObject {
  65172. constructor(attributes) {
  65173. super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy");
  65174. this.id = attributes.id || "";
  65175. this.name = attributes.name || "";
  65176. this.use = attributes.use || "";
  65177. this.usehref = attributes.usehref || "";
  65178. }
  65179. }
  65180. class Operation extends _xfa_object.StringObject {
  65181. constructor(attributes) {
  65182. super(CONNECTION_SET_NS_ID, "operation");
  65183. this.id = attributes.id || "";
  65184. this.input = attributes.input || "";
  65185. this.name = attributes.name || "";
  65186. this.output = attributes.output || "";
  65187. this.use = attributes.use || "";
  65188. this.usehref = attributes.usehref || "";
  65189. }
  65190. }
  65191. class RootElement extends _xfa_object.StringObject {
  65192. constructor(attributes) {
  65193. super(CONNECTION_SET_NS_ID, "rootElement");
  65194. this.id = attributes.id || "";
  65195. this.name = attributes.name || "";
  65196. this.use = attributes.use || "";
  65197. this.usehref = attributes.usehref || "";
  65198. }
  65199. }
  65200. class SoapAction extends _xfa_object.StringObject {
  65201. constructor(attributes) {
  65202. super(CONNECTION_SET_NS_ID, "soapAction");
  65203. this.id = attributes.id || "";
  65204. this.name = attributes.name || "";
  65205. this.use = attributes.use || "";
  65206. this.usehref = attributes.usehref || "";
  65207. }
  65208. }
  65209. class SoapAddress extends _xfa_object.StringObject {
  65210. constructor(attributes) {
  65211. super(CONNECTION_SET_NS_ID, "soapAddress");
  65212. this.id = attributes.id || "";
  65213. this.name = attributes.name || "";
  65214. this.use = attributes.use || "";
  65215. this.usehref = attributes.usehref || "";
  65216. }
  65217. }
  65218. class Uri extends _xfa_object.StringObject {
  65219. constructor(attributes) {
  65220. super(CONNECTION_SET_NS_ID, "uri");
  65221. this.id = attributes.id || "";
  65222. this.name = attributes.name || "";
  65223. this.use = attributes.use || "";
  65224. this.usehref = attributes.usehref || "";
  65225. }
  65226. }
  65227. class WsdlAddress extends _xfa_object.StringObject {
  65228. constructor(attributes) {
  65229. super(CONNECTION_SET_NS_ID, "wsdlAddress");
  65230. this.id = attributes.id || "";
  65231. this.name = attributes.name || "";
  65232. this.use = attributes.use || "";
  65233. this.usehref = attributes.usehref || "";
  65234. }
  65235. }
  65236. class WsdlConnection extends _xfa_object.XFAObject {
  65237. constructor(attributes) {
  65238. super(CONNECTION_SET_NS_ID, "wsdlConnection", true);
  65239. this.dataDescription = attributes.dataDescription || "";
  65240. this.name = attributes.name || "";
  65241. this.effectiveInputPolicy = null;
  65242. this.effectiveOutputPolicy = null;
  65243. this.operation = null;
  65244. this.soapAction = null;
  65245. this.soapAddress = null;
  65246. this.wsdlAddress = null;
  65247. }
  65248. }
  65249. class XmlConnection extends _xfa_object.XFAObject {
  65250. constructor(attributes) {
  65251. super(CONNECTION_SET_NS_ID, "xmlConnection", true);
  65252. this.dataDescription = attributes.dataDescription || "";
  65253. this.name = attributes.name || "";
  65254. this.uri = null;
  65255. }
  65256. }
  65257. class XsdConnection extends _xfa_object.XFAObject {
  65258. constructor(attributes) {
  65259. super(CONNECTION_SET_NS_ID, "xsdConnection", true);
  65260. this.dataDescription = attributes.dataDescription || "";
  65261. this.name = attributes.name || "";
  65262. this.rootElement = null;
  65263. this.uri = null;
  65264. }
  65265. }
  65266. class ConnectionSetNamespace {
  65267. static [_namespaces.$buildXFAObject](name, attributes) {
  65268. if (ConnectionSetNamespace.hasOwnProperty(name)) {
  65269. return ConnectionSetNamespace[name](attributes);
  65270. }
  65271. return undefined;
  65272. }
  65273. static connectionSet(attrs) {
  65274. return new ConnectionSet(attrs);
  65275. }
  65276. static effectiveInputPolicy(attrs) {
  65277. return new EffectiveInputPolicy(attrs);
  65278. }
  65279. static effectiveOutputPolicy(attrs) {
  65280. return new EffectiveOutputPolicy(attrs);
  65281. }
  65282. static operation(attrs) {
  65283. return new Operation(attrs);
  65284. }
  65285. static rootElement(attrs) {
  65286. return new RootElement(attrs);
  65287. }
  65288. static soapAction(attrs) {
  65289. return new SoapAction(attrs);
  65290. }
  65291. static soapAddress(attrs) {
  65292. return new SoapAddress(attrs);
  65293. }
  65294. static uri(attrs) {
  65295. return new Uri(attrs);
  65296. }
  65297. static wsdlAddress(attrs) {
  65298. return new WsdlAddress(attrs);
  65299. }
  65300. static wsdlConnection(attrs) {
  65301. return new WsdlConnection(attrs);
  65302. }
  65303. static xmlConnection(attrs) {
  65304. return new XmlConnection(attrs);
  65305. }
  65306. static xsdConnection(attrs) {
  65307. return new XsdConnection(attrs);
  65308. }
  65309. }
  65310. exports.ConnectionSetNamespace = ConnectionSetNamespace;
  65311. /***/ }),
  65312. /* 224 */
  65313. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65314. "use strict";
  65315. Object.defineProperty(exports, "__esModule", ({
  65316. value: true
  65317. }));
  65318. exports.DatasetsNamespace = void 0;
  65319. var _xfa_object = __w_pdfjs_require__(208);
  65320. var _namespaces = __w_pdfjs_require__(210);
  65321. const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id;
  65322. class Data extends _xfa_object.XmlObject {
  65323. constructor(attributes) {
  65324. super(DATASETS_NS_ID, "data", attributes);
  65325. }
  65326. [_xfa_object.$isNsAgnostic]() {
  65327. return true;
  65328. }
  65329. }
  65330. class Datasets extends _xfa_object.XFAObject {
  65331. constructor(attributes) {
  65332. super(DATASETS_NS_ID, "datasets", true);
  65333. this.data = null;
  65334. this.Signature = null;
  65335. }
  65336. [_xfa_object.$onChild](child) {
  65337. const name = child[_xfa_object.$nodeName];
  65338. if (name === "data" && child[_xfa_object.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.signature.id) {
  65339. this[name] = child;
  65340. }
  65341. this[_xfa_object.$appendChild](child);
  65342. }
  65343. }
  65344. class DatasetsNamespace {
  65345. static [_namespaces.$buildXFAObject](name, attributes) {
  65346. if (DatasetsNamespace.hasOwnProperty(name)) {
  65347. return DatasetsNamespace[name](attributes);
  65348. }
  65349. return undefined;
  65350. }
  65351. static datasets(attributes) {
  65352. return new Datasets(attributes);
  65353. }
  65354. static data(attributes) {
  65355. return new Data(attributes);
  65356. }
  65357. }
  65358. exports.DatasetsNamespace = DatasetsNamespace;
  65359. /***/ }),
  65360. /* 225 */
  65361. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65362. "use strict";
  65363. Object.defineProperty(exports, "__esModule", ({
  65364. value: true
  65365. }));
  65366. exports.LocaleSetNamespace = void 0;
  65367. var _namespaces = __w_pdfjs_require__(210);
  65368. var _xfa_object = __w_pdfjs_require__(208);
  65369. var _utils = __w_pdfjs_require__(209);
  65370. const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id;
  65371. class CalendarSymbols extends _xfa_object.XFAObject {
  65372. constructor(attributes) {
  65373. super(LOCALE_SET_NS_ID, "calendarSymbols", true);
  65374. this.name = "gregorian";
  65375. this.dayNames = new _xfa_object.XFAObjectArray(2);
  65376. this.eraNames = null;
  65377. this.meridiemNames = null;
  65378. this.monthNames = new _xfa_object.XFAObjectArray(2);
  65379. }
  65380. }
  65381. class CurrencySymbol extends _xfa_object.StringObject {
  65382. constructor(attributes) {
  65383. super(LOCALE_SET_NS_ID, "currencySymbol");
  65384. this.name = (0, _utils.getStringOption)(attributes.name, ["symbol", "isoname", "decimal"]);
  65385. }
  65386. }
  65387. class CurrencySymbols extends _xfa_object.XFAObject {
  65388. constructor(attributes) {
  65389. super(LOCALE_SET_NS_ID, "currencySymbols", true);
  65390. this.currencySymbol = new _xfa_object.XFAObjectArray(3);
  65391. }
  65392. }
  65393. class DatePattern extends _xfa_object.StringObject {
  65394. constructor(attributes) {
  65395. super(LOCALE_SET_NS_ID, "datePattern");
  65396. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  65397. }
  65398. }
  65399. class DatePatterns extends _xfa_object.XFAObject {
  65400. constructor(attributes) {
  65401. super(LOCALE_SET_NS_ID, "datePatterns", true);
  65402. this.datePattern = new _xfa_object.XFAObjectArray(4);
  65403. }
  65404. }
  65405. class DateTimeSymbols extends _xfa_object.ContentObject {
  65406. constructor(attributes) {
  65407. super(LOCALE_SET_NS_ID, "dateTimeSymbols");
  65408. }
  65409. }
  65410. class Day extends _xfa_object.StringObject {
  65411. constructor(attributes) {
  65412. super(LOCALE_SET_NS_ID, "day");
  65413. }
  65414. }
  65415. class DayNames extends _xfa_object.XFAObject {
  65416. constructor(attributes) {
  65417. super(LOCALE_SET_NS_ID, "dayNames", true);
  65418. this.abbr = (0, _utils.getInteger)({
  65419. data: attributes.abbr,
  65420. defaultValue: 0,
  65421. validate: x => x === 1
  65422. });
  65423. this.day = new _xfa_object.XFAObjectArray(7);
  65424. }
  65425. }
  65426. class Era extends _xfa_object.StringObject {
  65427. constructor(attributes) {
  65428. super(LOCALE_SET_NS_ID, "era");
  65429. }
  65430. }
  65431. class EraNames extends _xfa_object.XFAObject {
  65432. constructor(attributes) {
  65433. super(LOCALE_SET_NS_ID, "eraNames", true);
  65434. this.era = new _xfa_object.XFAObjectArray(2);
  65435. }
  65436. }
  65437. class Locale extends _xfa_object.XFAObject {
  65438. constructor(attributes) {
  65439. super(LOCALE_SET_NS_ID, "locale", true);
  65440. this.desc = attributes.desc || "";
  65441. this.name = "isoname";
  65442. this.calendarSymbols = null;
  65443. this.currencySymbols = null;
  65444. this.datePatterns = null;
  65445. this.dateTimeSymbols = null;
  65446. this.numberPatterns = null;
  65447. this.numberSymbols = null;
  65448. this.timePatterns = null;
  65449. this.typeFaces = null;
  65450. }
  65451. }
  65452. class LocaleSet extends _xfa_object.XFAObject {
  65453. constructor(attributes) {
  65454. super(LOCALE_SET_NS_ID, "localeSet", true);
  65455. this.locale = new _xfa_object.XFAObjectArray();
  65456. }
  65457. }
  65458. class Meridiem extends _xfa_object.StringObject {
  65459. constructor(attributes) {
  65460. super(LOCALE_SET_NS_ID, "meridiem");
  65461. }
  65462. }
  65463. class MeridiemNames extends _xfa_object.XFAObject {
  65464. constructor(attributes) {
  65465. super(LOCALE_SET_NS_ID, "meridiemNames", true);
  65466. this.meridiem = new _xfa_object.XFAObjectArray(2);
  65467. }
  65468. }
  65469. class Month extends _xfa_object.StringObject {
  65470. constructor(attributes) {
  65471. super(LOCALE_SET_NS_ID, "month");
  65472. }
  65473. }
  65474. class MonthNames extends _xfa_object.XFAObject {
  65475. constructor(attributes) {
  65476. super(LOCALE_SET_NS_ID, "monthNames", true);
  65477. this.abbr = (0, _utils.getInteger)({
  65478. data: attributes.abbr,
  65479. defaultValue: 0,
  65480. validate: x => x === 1
  65481. });
  65482. this.month = new _xfa_object.XFAObjectArray(12);
  65483. }
  65484. }
  65485. class NumberPattern extends _xfa_object.StringObject {
  65486. constructor(attributes) {
  65487. super(LOCALE_SET_NS_ID, "numberPattern");
  65488. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  65489. }
  65490. }
  65491. class NumberPatterns extends _xfa_object.XFAObject {
  65492. constructor(attributes) {
  65493. super(LOCALE_SET_NS_ID, "numberPatterns", true);
  65494. this.numberPattern = new _xfa_object.XFAObjectArray(4);
  65495. }
  65496. }
  65497. class NumberSymbol extends _xfa_object.StringObject {
  65498. constructor(attributes) {
  65499. super(LOCALE_SET_NS_ID, "numberSymbol");
  65500. this.name = (0, _utils.getStringOption)(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]);
  65501. }
  65502. }
  65503. class NumberSymbols extends _xfa_object.XFAObject {
  65504. constructor(attributes) {
  65505. super(LOCALE_SET_NS_ID, "numberSymbols", true);
  65506. this.numberSymbol = new _xfa_object.XFAObjectArray(5);
  65507. }
  65508. }
  65509. class TimePattern extends _xfa_object.StringObject {
  65510. constructor(attributes) {
  65511. super(LOCALE_SET_NS_ID, "timePattern");
  65512. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  65513. }
  65514. }
  65515. class TimePatterns extends _xfa_object.XFAObject {
  65516. constructor(attributes) {
  65517. super(LOCALE_SET_NS_ID, "timePatterns", true);
  65518. this.timePattern = new _xfa_object.XFAObjectArray(4);
  65519. }
  65520. }
  65521. class TypeFace extends _xfa_object.XFAObject {
  65522. constructor(attributes) {
  65523. super(LOCALE_SET_NS_ID, "typeFace", true);
  65524. this.name = attributes.name | "";
  65525. }
  65526. }
  65527. class TypeFaces extends _xfa_object.XFAObject {
  65528. constructor(attributes) {
  65529. super(LOCALE_SET_NS_ID, "typeFaces", true);
  65530. this.typeFace = new _xfa_object.XFAObjectArray();
  65531. }
  65532. }
  65533. class LocaleSetNamespace {
  65534. static [_namespaces.$buildXFAObject](name, attributes) {
  65535. if (LocaleSetNamespace.hasOwnProperty(name)) {
  65536. return LocaleSetNamespace[name](attributes);
  65537. }
  65538. return undefined;
  65539. }
  65540. static calendarSymbols(attrs) {
  65541. return new CalendarSymbols(attrs);
  65542. }
  65543. static currencySymbol(attrs) {
  65544. return new CurrencySymbol(attrs);
  65545. }
  65546. static currencySymbols(attrs) {
  65547. return new CurrencySymbols(attrs);
  65548. }
  65549. static datePattern(attrs) {
  65550. return new DatePattern(attrs);
  65551. }
  65552. static datePatterns(attrs) {
  65553. return new DatePatterns(attrs);
  65554. }
  65555. static dateTimeSymbols(attrs) {
  65556. return new DateTimeSymbols(attrs);
  65557. }
  65558. static day(attrs) {
  65559. return new Day(attrs);
  65560. }
  65561. static dayNames(attrs) {
  65562. return new DayNames(attrs);
  65563. }
  65564. static era(attrs) {
  65565. return new Era(attrs);
  65566. }
  65567. static eraNames(attrs) {
  65568. return new EraNames(attrs);
  65569. }
  65570. static locale(attrs) {
  65571. return new Locale(attrs);
  65572. }
  65573. static localeSet(attrs) {
  65574. return new LocaleSet(attrs);
  65575. }
  65576. static meridiem(attrs) {
  65577. return new Meridiem(attrs);
  65578. }
  65579. static meridiemNames(attrs) {
  65580. return new MeridiemNames(attrs);
  65581. }
  65582. static month(attrs) {
  65583. return new Month(attrs);
  65584. }
  65585. static monthNames(attrs) {
  65586. return new MonthNames(attrs);
  65587. }
  65588. static numberPattern(attrs) {
  65589. return new NumberPattern(attrs);
  65590. }
  65591. static numberPatterns(attrs) {
  65592. return new NumberPatterns(attrs);
  65593. }
  65594. static numberSymbol(attrs) {
  65595. return new NumberSymbol(attrs);
  65596. }
  65597. static numberSymbols(attrs) {
  65598. return new NumberSymbols(attrs);
  65599. }
  65600. static timePattern(attrs) {
  65601. return new TimePattern(attrs);
  65602. }
  65603. static timePatterns(attrs) {
  65604. return new TimePatterns(attrs);
  65605. }
  65606. static typeFace(attrs) {
  65607. return new TypeFace(attrs);
  65608. }
  65609. static typeFaces(attrs) {
  65610. return new TypeFaces(attrs);
  65611. }
  65612. }
  65613. exports.LocaleSetNamespace = LocaleSetNamespace;
  65614. /***/ }),
  65615. /* 226 */
  65616. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65617. "use strict";
  65618. Object.defineProperty(exports, "__esModule", ({
  65619. value: true
  65620. }));
  65621. exports.SignatureNamespace = void 0;
  65622. var _namespaces = __w_pdfjs_require__(210);
  65623. var _xfa_object = __w_pdfjs_require__(208);
  65624. const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id;
  65625. class Signature extends _xfa_object.XFAObject {
  65626. constructor(attributes) {
  65627. super(SIGNATURE_NS_ID, "signature", true);
  65628. }
  65629. }
  65630. class SignatureNamespace {
  65631. static [_namespaces.$buildXFAObject](name, attributes) {
  65632. if (SignatureNamespace.hasOwnProperty(name)) {
  65633. return SignatureNamespace[name](attributes);
  65634. }
  65635. return undefined;
  65636. }
  65637. static signature(attributes) {
  65638. return new Signature(attributes);
  65639. }
  65640. }
  65641. exports.SignatureNamespace = SignatureNamespace;
  65642. /***/ }),
  65643. /* 227 */
  65644. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65645. "use strict";
  65646. Object.defineProperty(exports, "__esModule", ({
  65647. value: true
  65648. }));
  65649. exports.StylesheetNamespace = void 0;
  65650. var _namespaces = __w_pdfjs_require__(210);
  65651. var _xfa_object = __w_pdfjs_require__(208);
  65652. const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id;
  65653. class Stylesheet extends _xfa_object.XFAObject {
  65654. constructor(attributes) {
  65655. super(STYLESHEET_NS_ID, "stylesheet", true);
  65656. }
  65657. }
  65658. class StylesheetNamespace {
  65659. static [_namespaces.$buildXFAObject](name, attributes) {
  65660. if (StylesheetNamespace.hasOwnProperty(name)) {
  65661. return StylesheetNamespace[name](attributes);
  65662. }
  65663. return undefined;
  65664. }
  65665. static stylesheet(attributes) {
  65666. return new Stylesheet(attributes);
  65667. }
  65668. }
  65669. exports.StylesheetNamespace = StylesheetNamespace;
  65670. /***/ }),
  65671. /* 228 */
  65672. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65673. "use strict";
  65674. Object.defineProperty(exports, "__esModule", ({
  65675. value: true
  65676. }));
  65677. exports.XdpNamespace = void 0;
  65678. var _namespaces = __w_pdfjs_require__(210);
  65679. var _xfa_object = __w_pdfjs_require__(208);
  65680. const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id;
  65681. class Xdp extends _xfa_object.XFAObject {
  65682. constructor(attributes) {
  65683. super(XDP_NS_ID, "xdp", true);
  65684. this.uuid = attributes.uuid || "";
  65685. this.timeStamp = attributes.timeStamp || "";
  65686. this.config = null;
  65687. this.connectionSet = null;
  65688. this.datasets = null;
  65689. this.localeSet = null;
  65690. this.stylesheet = new _xfa_object.XFAObjectArray();
  65691. this.template = null;
  65692. }
  65693. [_xfa_object.$onChildCheck](child) {
  65694. const ns = _namespaces.NamespaceIds[child[_xfa_object.$nodeName]];
  65695. return ns && child[_xfa_object.$namespaceId] === ns.id;
  65696. }
  65697. }
  65698. class XdpNamespace {
  65699. static [_namespaces.$buildXFAObject](name, attributes) {
  65700. if (XdpNamespace.hasOwnProperty(name)) {
  65701. return XdpNamespace[name](attributes);
  65702. }
  65703. return undefined;
  65704. }
  65705. static xdp(attributes) {
  65706. return new Xdp(attributes);
  65707. }
  65708. }
  65709. exports.XdpNamespace = XdpNamespace;
  65710. /***/ }),
  65711. /* 229 */
  65712. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65713. "use strict";
  65714. Object.defineProperty(exports, "__esModule", ({
  65715. value: true
  65716. }));
  65717. exports.XhtmlNamespace = void 0;
  65718. var _xfa_object = __w_pdfjs_require__(208);
  65719. var _namespaces = __w_pdfjs_require__(210);
  65720. var _html_utils = __w_pdfjs_require__(215);
  65721. var _utils = __w_pdfjs_require__(209);
  65722. const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id;
  65723. const $richText = Symbol();
  65724. 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"]);
  65725. 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) => {
  65726. value = original.fontSize = (0, _utils.getMeasurement)(value);
  65727. return (0, _html_utils.measureToString)(0.99 * value);
  65728. }], ["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))]]);
  65729. const spacesRegExp = /\s+/g;
  65730. const crlfRegExp = /[\r\n]+/g;
  65731. const crlfForRichTextRegExp = /\r\n?/g;
  65732. function mapStyle(styleStr, node, richText) {
  65733. const style = Object.create(null);
  65734. if (!styleStr) {
  65735. return style;
  65736. }
  65737. const original = Object.create(null);
  65738. for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) {
  65739. const mapping = StyleMapping.get(key);
  65740. if (mapping === "") {
  65741. continue;
  65742. }
  65743. let newValue = value;
  65744. if (mapping) {
  65745. if (typeof mapping === "string") {
  65746. newValue = mapping;
  65747. } else {
  65748. newValue = mapping(value, original);
  65749. }
  65750. }
  65751. if (key.endsWith("scale")) {
  65752. if (style.transform) {
  65753. style.transform = `${style[key]} ${newValue}`;
  65754. } else {
  65755. style.transform = newValue;
  65756. }
  65757. } else {
  65758. style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue;
  65759. }
  65760. }
  65761. if (style.fontFamily) {
  65762. (0, _html_utils.setFontFamily)({
  65763. typeface: style.fontFamily,
  65764. weight: style.fontWeight || "normal",
  65765. posture: style.fontStyle || "normal",
  65766. size: original.fontSize || 0
  65767. }, node, node[_xfa_object.$globalData].fontFinder, style);
  65768. }
  65769. if (richText && style.verticalAlign && style.verticalAlign !== "0px" && style.fontSize) {
  65770. const SUB_SUPER_SCRIPT_FACTOR = 0.583;
  65771. const VERTICAL_FACTOR = 0.333;
  65772. const fontSize = (0, _utils.getMeasurement)(style.fontSize);
  65773. style.fontSize = (0, _html_utils.measureToString)(fontSize * SUB_SUPER_SCRIPT_FACTOR);
  65774. style.verticalAlign = (0, _html_utils.measureToString)(Math.sign((0, _utils.getMeasurement)(style.verticalAlign)) * fontSize * VERTICAL_FACTOR);
  65775. }
  65776. if (richText && style.fontSize) {
  65777. style.fontSize = `calc(${style.fontSize} * var(--scale-factor))`;
  65778. }
  65779. (0, _html_utils.fixTextIndent)(style);
  65780. return style;
  65781. }
  65782. function checkStyle(node) {
  65783. if (!node.style) {
  65784. return "";
  65785. }
  65786. return node.style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(_ref => {
  65787. let [key, value] = _ref;
  65788. if (key === "font-family") {
  65789. node[_xfa_object.$globalData].usedTypefaces.add(value);
  65790. }
  65791. return VALID_STYLES.has(key);
  65792. }).map(kv => kv.join(":")).join(";");
  65793. }
  65794. const NoWhites = new Set(["body", "html"]);
  65795. class XhtmlObject extends _xfa_object.XmlObject {
  65796. constructor(attributes, name) {
  65797. super(XHTML_NS_ID, name);
  65798. this[$richText] = false;
  65799. this.style = attributes.style || "";
  65800. }
  65801. [_xfa_object.$clean](builder) {
  65802. super[_xfa_object.$clean](builder);
  65803. this.style = checkStyle(this);
  65804. }
  65805. [_xfa_object.$acceptWhitespace]() {
  65806. return !NoWhites.has(this[_xfa_object.$nodeName]);
  65807. }
  65808. [_xfa_object.$onText](str) {
  65809. let richText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  65810. if (!richText) {
  65811. str = str.replace(crlfRegExp, "");
  65812. if (!this.style.includes("xfa-spacerun:yes")) {
  65813. str = str.replace(spacesRegExp, " ");
  65814. }
  65815. } else {
  65816. this[$richText] = true;
  65817. }
  65818. if (str) {
  65819. this[_xfa_object.$content] += str;
  65820. }
  65821. }
  65822. [_xfa_object.$pushGlyphs](measure) {
  65823. let mustPop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  65824. const xfaFont = Object.create(null);
  65825. const margin = {
  65826. top: NaN,
  65827. bottom: NaN,
  65828. left: NaN,
  65829. right: NaN
  65830. };
  65831. let lineHeight = null;
  65832. for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) {
  65833. switch (key) {
  65834. case "font-family":
  65835. xfaFont.typeface = (0, _utils.stripQuotes)(value);
  65836. break;
  65837. case "font-size":
  65838. xfaFont.size = (0, _utils.getMeasurement)(value);
  65839. break;
  65840. case "font-weight":
  65841. xfaFont.weight = value;
  65842. break;
  65843. case "font-style":
  65844. xfaFont.posture = value;
  65845. break;
  65846. case "letter-spacing":
  65847. xfaFont.letterSpacing = (0, _utils.getMeasurement)(value);
  65848. break;
  65849. case "margin":
  65850. const values = value.split(/ \t/).map(x => (0, _utils.getMeasurement)(x));
  65851. switch (values.length) {
  65852. case 1:
  65853. margin.top = margin.bottom = margin.left = margin.right = values[0];
  65854. break;
  65855. case 2:
  65856. margin.top = margin.bottom = values[0];
  65857. margin.left = margin.right = values[1];
  65858. break;
  65859. case 3:
  65860. margin.top = values[0];
  65861. margin.bottom = values[2];
  65862. margin.left = margin.right = values[1];
  65863. break;
  65864. case 4:
  65865. margin.top = values[0];
  65866. margin.left = values[1];
  65867. margin.bottom = values[2];
  65868. margin.right = values[3];
  65869. break;
  65870. }
  65871. break;
  65872. case "margin-top":
  65873. margin.top = (0, _utils.getMeasurement)(value);
  65874. break;
  65875. case "margin-bottom":
  65876. margin.bottom = (0, _utils.getMeasurement)(value);
  65877. break;
  65878. case "margin-left":
  65879. margin.left = (0, _utils.getMeasurement)(value);
  65880. break;
  65881. case "margin-right":
  65882. margin.right = (0, _utils.getMeasurement)(value);
  65883. break;
  65884. case "line-height":
  65885. lineHeight = (0, _utils.getMeasurement)(value);
  65886. break;
  65887. }
  65888. }
  65889. measure.pushData(xfaFont, margin, lineHeight);
  65890. if (this[_xfa_object.$content]) {
  65891. measure.addString(this[_xfa_object.$content]);
  65892. } else {
  65893. for (const child of this[_xfa_object.$getChildren]()) {
  65894. if (child[_xfa_object.$nodeName] === "#text") {
  65895. measure.addString(child[_xfa_object.$content]);
  65896. continue;
  65897. }
  65898. child[_xfa_object.$pushGlyphs](measure);
  65899. }
  65900. }
  65901. if (mustPop) {
  65902. measure.popFont();
  65903. }
  65904. }
  65905. [_xfa_object.$toHTML](availableSpace) {
  65906. const children = [];
  65907. this[_xfa_object.$extra] = {
  65908. children
  65909. };
  65910. this[_xfa_object.$childrenToHTML]({});
  65911. if (children.length === 0 && !this[_xfa_object.$content]) {
  65912. return _utils.HTMLResult.EMPTY;
  65913. }
  65914. let value;
  65915. if (this[$richText]) {
  65916. value = this[_xfa_object.$content] ? this[_xfa_object.$content].replace(crlfForRichTextRegExp, "\n") : undefined;
  65917. } else {
  65918. value = this[_xfa_object.$content] || undefined;
  65919. }
  65920. return _utils.HTMLResult.success({
  65921. name: this[_xfa_object.$nodeName],
  65922. attributes: {
  65923. href: this.href,
  65924. style: mapStyle(this.style, this, this[$richText])
  65925. },
  65926. children,
  65927. value
  65928. });
  65929. }
  65930. }
  65931. class A extends XhtmlObject {
  65932. constructor(attributes) {
  65933. super(attributes, "a");
  65934. this.href = (0, _html_utils.fixURL)(attributes.href) || "";
  65935. }
  65936. }
  65937. class B extends XhtmlObject {
  65938. constructor(attributes) {
  65939. super(attributes, "b");
  65940. }
  65941. [_xfa_object.$pushGlyphs](measure) {
  65942. measure.pushFont({
  65943. weight: "bold"
  65944. });
  65945. super[_xfa_object.$pushGlyphs](measure);
  65946. measure.popFont();
  65947. }
  65948. }
  65949. class Body extends XhtmlObject {
  65950. constructor(attributes) {
  65951. super(attributes, "body");
  65952. }
  65953. [_xfa_object.$toHTML](availableSpace) {
  65954. const res = super[_xfa_object.$toHTML](availableSpace);
  65955. const {
  65956. html
  65957. } = res;
  65958. if (!html) {
  65959. return _utils.HTMLResult.EMPTY;
  65960. }
  65961. html.name = "div";
  65962. html.attributes.class = ["xfaRich"];
  65963. return res;
  65964. }
  65965. }
  65966. class Br extends XhtmlObject {
  65967. constructor(attributes) {
  65968. super(attributes, "br");
  65969. }
  65970. [_xfa_object.$text]() {
  65971. return "\n";
  65972. }
  65973. [_xfa_object.$pushGlyphs](measure) {
  65974. measure.addString("\n");
  65975. }
  65976. [_xfa_object.$toHTML](availableSpace) {
  65977. return _utils.HTMLResult.success({
  65978. name: "br"
  65979. });
  65980. }
  65981. }
  65982. class Html extends XhtmlObject {
  65983. constructor(attributes) {
  65984. super(attributes, "html");
  65985. }
  65986. [_xfa_object.$toHTML](availableSpace) {
  65987. const children = [];
  65988. this[_xfa_object.$extra] = {
  65989. children
  65990. };
  65991. this[_xfa_object.$childrenToHTML]({});
  65992. if (children.length === 0) {
  65993. return _utils.HTMLResult.success({
  65994. name: "div",
  65995. attributes: {
  65996. class: ["xfaRich"],
  65997. style: {}
  65998. },
  65999. value: this[_xfa_object.$content] || ""
  66000. });
  66001. }
  66002. if (children.length === 1) {
  66003. const child = children[0];
  66004. if (child.attributes && child.attributes.class.includes("xfaRich")) {
  66005. return _utils.HTMLResult.success(child);
  66006. }
  66007. }
  66008. return _utils.HTMLResult.success({
  66009. name: "div",
  66010. attributes: {
  66011. class: ["xfaRich"],
  66012. style: {}
  66013. },
  66014. children
  66015. });
  66016. }
  66017. }
  66018. class I extends XhtmlObject {
  66019. constructor(attributes) {
  66020. super(attributes, "i");
  66021. }
  66022. [_xfa_object.$pushGlyphs](measure) {
  66023. measure.pushFont({
  66024. posture: "italic"
  66025. });
  66026. super[_xfa_object.$pushGlyphs](measure);
  66027. measure.popFont();
  66028. }
  66029. }
  66030. class Li extends XhtmlObject {
  66031. constructor(attributes) {
  66032. super(attributes, "li");
  66033. }
  66034. }
  66035. class Ol extends XhtmlObject {
  66036. constructor(attributes) {
  66037. super(attributes, "ol");
  66038. }
  66039. }
  66040. class P extends XhtmlObject {
  66041. constructor(attributes) {
  66042. super(attributes, "p");
  66043. }
  66044. [_xfa_object.$pushGlyphs](measure) {
  66045. super[_xfa_object.$pushGlyphs](measure, false);
  66046. measure.addString("\n");
  66047. measure.addPara();
  66048. measure.popFont();
  66049. }
  66050. [_xfa_object.$text]() {
  66051. const siblings = this[_xfa_object.$getParent]()[_xfa_object.$getChildren]();
  66052. if (siblings.at(-1) === this) {
  66053. return super[_xfa_object.$text]();
  66054. }
  66055. return super[_xfa_object.$text]() + "\n";
  66056. }
  66057. }
  66058. class Span extends XhtmlObject {
  66059. constructor(attributes) {
  66060. super(attributes, "span");
  66061. }
  66062. }
  66063. class Sub extends XhtmlObject {
  66064. constructor(attributes) {
  66065. super(attributes, "sub");
  66066. }
  66067. }
  66068. class Sup extends XhtmlObject {
  66069. constructor(attributes) {
  66070. super(attributes, "sup");
  66071. }
  66072. }
  66073. class Ul extends XhtmlObject {
  66074. constructor(attributes) {
  66075. super(attributes, "ul");
  66076. }
  66077. }
  66078. class XhtmlNamespace {
  66079. static [_namespaces.$buildXFAObject](name, attributes) {
  66080. if (XhtmlNamespace.hasOwnProperty(name)) {
  66081. return XhtmlNamespace[name](attributes);
  66082. }
  66083. return undefined;
  66084. }
  66085. static a(attributes) {
  66086. return new A(attributes);
  66087. }
  66088. static b(attributes) {
  66089. return new B(attributes);
  66090. }
  66091. static body(attributes) {
  66092. return new Body(attributes);
  66093. }
  66094. static br(attributes) {
  66095. return new Br(attributes);
  66096. }
  66097. static html(attributes) {
  66098. return new Html(attributes);
  66099. }
  66100. static i(attributes) {
  66101. return new I(attributes);
  66102. }
  66103. static li(attributes) {
  66104. return new Li(attributes);
  66105. }
  66106. static ol(attributes) {
  66107. return new Ol(attributes);
  66108. }
  66109. static p(attributes) {
  66110. return new P(attributes);
  66111. }
  66112. static span(attributes) {
  66113. return new Span(attributes);
  66114. }
  66115. static sub(attributes) {
  66116. return new Sub(attributes);
  66117. }
  66118. static sup(attributes) {
  66119. return new Sup(attributes);
  66120. }
  66121. static ul(attributes) {
  66122. return new Ul(attributes);
  66123. }
  66124. }
  66125. exports.XhtmlNamespace = XhtmlNamespace;
  66126. /***/ }),
  66127. /* 230 */
  66128. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  66129. "use strict";
  66130. Object.defineProperty(exports, "__esModule", ({
  66131. value: true
  66132. }));
  66133. exports.UnknownNamespace = void 0;
  66134. var _namespaces = __w_pdfjs_require__(210);
  66135. var _xfa_object = __w_pdfjs_require__(208);
  66136. class UnknownNamespace {
  66137. constructor(nsId) {
  66138. this.namespaceId = nsId;
  66139. }
  66140. [_namespaces.$buildXFAObject](name, attributes) {
  66141. return new _xfa_object.XmlObject(this.namespaceId, name, attributes);
  66142. }
  66143. }
  66144. exports.UnknownNamespace = UnknownNamespace;
  66145. /***/ }),
  66146. /* 231 */
  66147. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  66148. "use strict";
  66149. Object.defineProperty(exports, "__esModule", ({
  66150. value: true
  66151. }));
  66152. exports.DatasetReader = void 0;
  66153. var _util = __w_pdfjs_require__(2);
  66154. var _core_utils = __w_pdfjs_require__(136);
  66155. var _xml_parser = __w_pdfjs_require__(197);
  66156. function decodeString(str) {
  66157. try {
  66158. return (0, _util.stringToUTF8String)(str);
  66159. } catch (ex) {
  66160. (0, _util.warn)(`UTF-8 decoding failed: "${ex}".`);
  66161. return str;
  66162. }
  66163. }
  66164. class DatasetXMLParser extends _xml_parser.SimpleXMLParser {
  66165. constructor(options) {
  66166. super(options);
  66167. this.node = null;
  66168. }
  66169. onEndElement(name) {
  66170. const node = super.onEndElement(name);
  66171. if (node && name === "xfa:datasets") {
  66172. this.node = node;
  66173. throw new Error("Aborting DatasetXMLParser.");
  66174. }
  66175. }
  66176. }
  66177. class DatasetReader {
  66178. constructor(data) {
  66179. if (data.datasets) {
  66180. this.node = new _xml_parser.SimpleXMLParser({
  66181. hasAttributes: true
  66182. }).parseFromString(data.datasets).documentElement;
  66183. } else {
  66184. const parser = new DatasetXMLParser({
  66185. hasAttributes: true
  66186. });
  66187. try {
  66188. parser.parseFromString(data["xdp:xdp"]);
  66189. } catch (_) {}
  66190. this.node = parser.node;
  66191. }
  66192. }
  66193. getValue(path) {
  66194. if (!this.node || !path) {
  66195. return "";
  66196. }
  66197. const node = this.node.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  66198. if (!node) {
  66199. return "";
  66200. }
  66201. const first = node.firstChild;
  66202. if (first && first.nodeName === "value") {
  66203. return node.children.map(child => decodeString(child.textContent));
  66204. }
  66205. return decodeString(node.textContent);
  66206. }
  66207. }
  66208. exports.DatasetReader = DatasetReader;
  66209. /***/ }),
  66210. /* 232 */
  66211. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  66212. "use strict";
  66213. Object.defineProperty(exports, "__esModule", ({
  66214. value: true
  66215. }));
  66216. exports.XRef = void 0;
  66217. var _util = __w_pdfjs_require__(2);
  66218. var _primitives = __w_pdfjs_require__(137);
  66219. var _parser = __w_pdfjs_require__(148);
  66220. var _core_utils = __w_pdfjs_require__(136);
  66221. var _base_stream = __w_pdfjs_require__(138);
  66222. var _crypto = __w_pdfjs_require__(198);
  66223. class XRef {
  66224. constructor(stream, pdfManager) {
  66225. this.stream = stream;
  66226. this.pdfManager = pdfManager;
  66227. this.entries = [];
  66228. this.xrefstms = Object.create(null);
  66229. this._cacheMap = new Map();
  66230. this._pendingRefs = new _primitives.RefSet();
  66231. this._newPersistentRefNum = null;
  66232. this._newTemporaryRefNum = null;
  66233. }
  66234. getNewPersistentRef(obj) {
  66235. if (this._newPersistentRefNum === null) {
  66236. this._newPersistentRefNum = this.entries.length || 1;
  66237. }
  66238. const num = this._newPersistentRefNum++;
  66239. this._cacheMap.set(num, obj);
  66240. return _primitives.Ref.get(num, 0);
  66241. }
  66242. getNewTemporaryRef() {
  66243. if (this._newTemporaryRefNum === null) {
  66244. this._newTemporaryRefNum = this.entries.length || 1;
  66245. }
  66246. return _primitives.Ref.get(this._newTemporaryRefNum++, 0);
  66247. }
  66248. resetNewTemporaryRef() {
  66249. this._newTemporaryRefNum = null;
  66250. }
  66251. setStartXRef(startXRef) {
  66252. this.startXRefQueue = [startXRef];
  66253. }
  66254. parse() {
  66255. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  66256. let trailerDict;
  66257. if (!recoveryMode) {
  66258. trailerDict = this.readXRef();
  66259. } else {
  66260. (0, _util.warn)("Indexing all PDF objects");
  66261. trailerDict = this.indexObjects();
  66262. }
  66263. trailerDict.assignXref(this);
  66264. this.trailer = trailerDict;
  66265. let encrypt;
  66266. try {
  66267. encrypt = trailerDict.get("Encrypt");
  66268. } catch (ex) {
  66269. if (ex instanceof _core_utils.MissingDataException) {
  66270. throw ex;
  66271. }
  66272. (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
  66273. }
  66274. if (encrypt instanceof _primitives.Dict) {
  66275. const ids = trailerDict.get("ID");
  66276. const fileId = ids && ids.length ? ids[0] : "";
  66277. encrypt.suppressEncryption = true;
  66278. this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  66279. }
  66280. let root;
  66281. try {
  66282. root = trailerDict.get("Root");
  66283. } catch (ex) {
  66284. if (ex instanceof _core_utils.MissingDataException) {
  66285. throw ex;
  66286. }
  66287. (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
  66288. }
  66289. if (root instanceof _primitives.Dict) {
  66290. try {
  66291. const pages = root.get("Pages");
  66292. if (pages instanceof _primitives.Dict) {
  66293. this.root = root;
  66294. return;
  66295. }
  66296. } catch (ex) {
  66297. if (ex instanceof _core_utils.MissingDataException) {
  66298. throw ex;
  66299. }
  66300. (0, _util.warn)(`XRef.parse - Invalid "Pages" reference: "${ex}".`);
  66301. }
  66302. }
  66303. if (!recoveryMode) {
  66304. throw new _core_utils.XRefParseException();
  66305. }
  66306. throw new _util.InvalidPDFException("Invalid Root reference.");
  66307. }
  66308. processXRefTable(parser) {
  66309. if (!("tableState" in this)) {
  66310. this.tableState = {
  66311. entryNum: 0,
  66312. streamPos: parser.lexer.stream.pos,
  66313. parserBuf1: parser.buf1,
  66314. parserBuf2: parser.buf2
  66315. };
  66316. }
  66317. const obj = this.readXRefTable(parser);
  66318. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  66319. throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary");
  66320. }
  66321. let dict = parser.getObj();
  66322. if (!(dict instanceof _primitives.Dict) && dict.dict) {
  66323. dict = dict.dict;
  66324. }
  66325. if (!(dict instanceof _primitives.Dict)) {
  66326. throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary");
  66327. }
  66328. delete this.tableState;
  66329. return dict;
  66330. }
  66331. readXRefTable(parser) {
  66332. const stream = parser.lexer.stream;
  66333. const tableState = this.tableState;
  66334. stream.pos = tableState.streamPos;
  66335. parser.buf1 = tableState.parserBuf1;
  66336. parser.buf2 = tableState.parserBuf2;
  66337. let obj;
  66338. while (true) {
  66339. if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
  66340. if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) {
  66341. break;
  66342. }
  66343. tableState.firstEntryNum = obj;
  66344. tableState.entryCount = parser.getObj();
  66345. }
  66346. let first = tableState.firstEntryNum;
  66347. const count = tableState.entryCount;
  66348. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  66349. throw new _util.FormatError("Invalid XRef table: wrong types in subsection header");
  66350. }
  66351. for (let i = tableState.entryNum; i < count; i++) {
  66352. tableState.streamPos = stream.pos;
  66353. tableState.entryNum = i;
  66354. tableState.parserBuf1 = parser.buf1;
  66355. tableState.parserBuf2 = parser.buf2;
  66356. const entry = {};
  66357. entry.offset = parser.getObj();
  66358. entry.gen = parser.getObj();
  66359. const type = parser.getObj();
  66360. if (type instanceof _primitives.Cmd) {
  66361. switch (type.cmd) {
  66362. case "f":
  66363. entry.free = true;
  66364. break;
  66365. case "n":
  66366. entry.uncompressed = true;
  66367. break;
  66368. }
  66369. }
  66370. if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
  66371. throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
  66372. }
  66373. if (i === 0 && entry.free && first === 1) {
  66374. first = 0;
  66375. }
  66376. if (!this.entries[i + first]) {
  66377. this.entries[i + first] = entry;
  66378. }
  66379. }
  66380. tableState.entryNum = 0;
  66381. tableState.streamPos = stream.pos;
  66382. tableState.parserBuf1 = parser.buf1;
  66383. tableState.parserBuf2 = parser.buf2;
  66384. delete tableState.firstEntryNum;
  66385. delete tableState.entryCount;
  66386. }
  66387. if (this.entries[0] && !this.entries[0].free) {
  66388. throw new _util.FormatError("Invalid XRef table: unexpected first object");
  66389. }
  66390. return obj;
  66391. }
  66392. processXRefStream(stream) {
  66393. if (!("streamState" in this)) {
  66394. const streamParameters = stream.dict;
  66395. const byteWidths = streamParameters.get("W");
  66396. let range = streamParameters.get("Index");
  66397. if (!range) {
  66398. range = [0, streamParameters.get("Size")];
  66399. }
  66400. this.streamState = {
  66401. entryRanges: range,
  66402. byteWidths,
  66403. entryNum: 0,
  66404. streamPos: stream.pos
  66405. };
  66406. }
  66407. this.readXRefStream(stream);
  66408. delete this.streamState;
  66409. return stream.dict;
  66410. }
  66411. readXRefStream(stream) {
  66412. const streamState = this.streamState;
  66413. stream.pos = streamState.streamPos;
  66414. const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths;
  66415. const entryRanges = streamState.entryRanges;
  66416. while (entryRanges.length > 0) {
  66417. const [first, n] = entryRanges;
  66418. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  66419. throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
  66420. }
  66421. if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
  66422. throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
  66423. }
  66424. for (let i = streamState.entryNum; i < n; ++i) {
  66425. streamState.entryNum = i;
  66426. streamState.streamPos = stream.pos;
  66427. let type = 0,
  66428. offset = 0,
  66429. generation = 0;
  66430. for (let j = 0; j < typeFieldWidth; ++j) {
  66431. const typeByte = stream.getByte();
  66432. if (typeByte === -1) {
  66433. throw new _util.FormatError("Invalid XRef byteWidths 'type'.");
  66434. }
  66435. type = type << 8 | typeByte;
  66436. }
  66437. if (typeFieldWidth === 0) {
  66438. type = 1;
  66439. }
  66440. for (let j = 0; j < offsetFieldWidth; ++j) {
  66441. const offsetByte = stream.getByte();
  66442. if (offsetByte === -1) {
  66443. throw new _util.FormatError("Invalid XRef byteWidths 'offset'.");
  66444. }
  66445. offset = offset << 8 | offsetByte;
  66446. }
  66447. for (let j = 0; j < generationFieldWidth; ++j) {
  66448. const generationByte = stream.getByte();
  66449. if (generationByte === -1) {
  66450. throw new _util.FormatError("Invalid XRef byteWidths 'generation'.");
  66451. }
  66452. generation = generation << 8 | generationByte;
  66453. }
  66454. const entry = {};
  66455. entry.offset = offset;
  66456. entry.gen = generation;
  66457. switch (type) {
  66458. case 0:
  66459. entry.free = true;
  66460. break;
  66461. case 1:
  66462. entry.uncompressed = true;
  66463. break;
  66464. case 2:
  66465. break;
  66466. default:
  66467. throw new _util.FormatError(`Invalid XRef entry type: ${type}`);
  66468. }
  66469. if (!this.entries[first + i]) {
  66470. this.entries[first + i] = entry;
  66471. }
  66472. }
  66473. streamState.entryNum = 0;
  66474. streamState.streamPos = stream.pos;
  66475. entryRanges.splice(0, 2);
  66476. }
  66477. }
  66478. indexObjects() {
  66479. const TAB = 0x9,
  66480. LF = 0xa,
  66481. CR = 0xd,
  66482. SPACE = 0x20;
  66483. const PERCENT = 0x25,
  66484. LT = 0x3c;
  66485. function readToken(data, offset) {
  66486. let token = "",
  66487. ch = data[offset];
  66488. while (ch !== LF && ch !== CR && ch !== LT) {
  66489. if (++offset >= data.length) {
  66490. break;
  66491. }
  66492. token += String.fromCharCode(ch);
  66493. ch = data[offset];
  66494. }
  66495. return token;
  66496. }
  66497. function skipUntil(data, offset, what) {
  66498. const length = what.length,
  66499. dataLength = data.length;
  66500. let skipped = 0;
  66501. while (offset < dataLength) {
  66502. let i = 0;
  66503. while (i < length && data[offset + i] === what[i]) {
  66504. ++i;
  66505. }
  66506. if (i >= length) {
  66507. break;
  66508. }
  66509. offset++;
  66510. skipped++;
  66511. }
  66512. return skipped;
  66513. }
  66514. const gEndobjRegExp = /\b(endobj|\d+\s+\d+\s+obj|xref|trailer)\b/g;
  66515. const gStartxrefRegExp = /\b(startxref|\d+\s+\d+\s+obj)\b/g;
  66516. const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  66517. const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  66518. const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  66519. const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  66520. this.entries.length = 0;
  66521. this._cacheMap.clear();
  66522. const stream = this.stream;
  66523. stream.pos = 0;
  66524. const buffer = stream.getBytes(),
  66525. bufferStr = (0, _util.bytesToString)(buffer),
  66526. length = buffer.length;
  66527. let position = stream.start;
  66528. const trailers = [],
  66529. xrefStms = [];
  66530. while (position < length) {
  66531. let ch = buffer[position];
  66532. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  66533. ++position;
  66534. continue;
  66535. }
  66536. if (ch === PERCENT) {
  66537. do {
  66538. ++position;
  66539. if (position >= length) {
  66540. break;
  66541. }
  66542. ch = buffer[position];
  66543. } while (ch !== LF && ch !== CR);
  66544. continue;
  66545. }
  66546. const token = readToken(buffer, position);
  66547. let m;
  66548. if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
  66549. position += skipUntil(buffer, position, trailerBytes);
  66550. trailers.push(position);
  66551. position += skipUntil(buffer, position, startxrefBytes);
  66552. } else if (m = objRegExp.exec(token)) {
  66553. const num = m[1] | 0,
  66554. gen = m[2] | 0;
  66555. const startPos = position + token.length;
  66556. let contentLength,
  66557. updateEntries = false;
  66558. if (!this.entries[num]) {
  66559. updateEntries = true;
  66560. } else if (this.entries[num].gen === gen) {
  66561. try {
  66562. const parser = new _parser.Parser({
  66563. lexer: new _parser.Lexer(stream.makeSubStream(startPos))
  66564. });
  66565. parser.getObj();
  66566. updateEntries = true;
  66567. } catch (ex) {
  66568. if (ex instanceof _core_utils.ParserEOFException) {
  66569. (0, _util.warn)(`indexObjects -- checking object (${token}): "${ex}".`);
  66570. } else {
  66571. updateEntries = true;
  66572. }
  66573. }
  66574. }
  66575. if (updateEntries) {
  66576. this.entries[num] = {
  66577. offset: position - stream.start,
  66578. gen,
  66579. uncompressed: true
  66580. };
  66581. }
  66582. gEndobjRegExp.lastIndex = startPos;
  66583. const match = gEndobjRegExp.exec(bufferStr);
  66584. if (match) {
  66585. const endPos = gEndobjRegExp.lastIndex + 1;
  66586. contentLength = endPos - position;
  66587. if (match[1] !== "endobj") {
  66588. (0, _util.warn)(`indexObjects: Found "${match[1]}" inside of another "obj", ` + 'caused by missing "endobj" -- trying to recover.');
  66589. contentLength -= match[1].length + 1;
  66590. }
  66591. } else {
  66592. contentLength = length - position;
  66593. }
  66594. const content = buffer.subarray(position, position + contentLength);
  66595. const xrefTagOffset = skipUntil(content, 0, xrefBytes);
  66596. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  66597. xrefStms.push(position - stream.start);
  66598. this.xrefstms[position - stream.start] = 1;
  66599. }
  66600. position += contentLength;
  66601. } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
  66602. trailers.push(position);
  66603. const startPos = position + token.length;
  66604. let contentLength;
  66605. gStartxrefRegExp.lastIndex = startPos;
  66606. const match = gStartxrefRegExp.exec(bufferStr);
  66607. if (match) {
  66608. const endPos = gStartxrefRegExp.lastIndex + 1;
  66609. contentLength = endPos - position;
  66610. if (match[1] !== "startxref") {
  66611. (0, _util.warn)(`indexObjects: Found "${match[1]}" after "trailer", ` + 'caused by missing "startxref" -- trying to recover.');
  66612. contentLength -= match[1].length + 1;
  66613. }
  66614. } else {
  66615. contentLength = length - position;
  66616. }
  66617. position += contentLength;
  66618. } else {
  66619. position += token.length + 1;
  66620. }
  66621. }
  66622. for (const xrefStm of xrefStms) {
  66623. this.startXRefQueue.push(xrefStm);
  66624. this.readXRef(true);
  66625. }
  66626. const trailerDicts = [];
  66627. let isEncrypted = false;
  66628. for (const trailer of trailers) {
  66629. stream.pos = trailer;
  66630. const parser = new _parser.Parser({
  66631. lexer: new _parser.Lexer(stream),
  66632. xref: this,
  66633. allowStreams: true,
  66634. recoveryMode: true
  66635. });
  66636. const obj = parser.getObj();
  66637. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  66638. continue;
  66639. }
  66640. const dict = parser.getObj();
  66641. if (!(dict instanceof _primitives.Dict)) {
  66642. continue;
  66643. }
  66644. trailerDicts.push(dict);
  66645. if (dict.has("Encrypt")) {
  66646. isEncrypted = true;
  66647. }
  66648. }
  66649. let trailerDict, trailerError;
  66650. for (const dict of [...trailerDicts, "genFallback", ...trailerDicts]) {
  66651. if (dict === "genFallback") {
  66652. if (!trailerError) {
  66653. break;
  66654. }
  66655. this._generationFallback = true;
  66656. continue;
  66657. }
  66658. let validPagesDict = false;
  66659. try {
  66660. const rootDict = dict.get("Root");
  66661. if (!(rootDict instanceof _primitives.Dict)) {
  66662. continue;
  66663. }
  66664. const pagesDict = rootDict.get("Pages");
  66665. if (!(pagesDict instanceof _primitives.Dict)) {
  66666. continue;
  66667. }
  66668. const pagesCount = pagesDict.get("Count");
  66669. if (Number.isInteger(pagesCount)) {
  66670. validPagesDict = true;
  66671. }
  66672. } catch (ex) {
  66673. trailerError = ex;
  66674. continue;
  66675. }
  66676. if (validPagesDict && (!isEncrypted || dict.has("Encrypt")) && dict.has("ID")) {
  66677. return dict;
  66678. }
  66679. trailerDict = dict;
  66680. }
  66681. if (trailerDict) {
  66682. return trailerDict;
  66683. }
  66684. if (this.topDict) {
  66685. return this.topDict;
  66686. }
  66687. throw new _util.InvalidPDFException("Invalid PDF structure.");
  66688. }
  66689. readXRef() {
  66690. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  66691. const stream = this.stream;
  66692. const startXRefParsedCache = new Set();
  66693. while (this.startXRefQueue.length) {
  66694. try {
  66695. const startXRef = this.startXRefQueue[0];
  66696. if (startXRefParsedCache.has(startXRef)) {
  66697. (0, _util.warn)("readXRef - skipping XRef table since it was already parsed.");
  66698. this.startXRefQueue.shift();
  66699. continue;
  66700. }
  66701. startXRefParsedCache.add(startXRef);
  66702. stream.pos = startXRef + stream.start;
  66703. const parser = new _parser.Parser({
  66704. lexer: new _parser.Lexer(stream),
  66705. xref: this,
  66706. allowStreams: true
  66707. });
  66708. let obj = parser.getObj();
  66709. let dict;
  66710. if ((0, _primitives.isCmd)(obj, "xref")) {
  66711. dict = this.processXRefTable(parser);
  66712. if (!this.topDict) {
  66713. this.topDict = dict;
  66714. }
  66715. obj = dict.get("XRefStm");
  66716. if (Number.isInteger(obj)) {
  66717. const pos = obj;
  66718. if (!(pos in this.xrefstms)) {
  66719. this.xrefstms[pos] = 1;
  66720. this.startXRefQueue.push(pos);
  66721. }
  66722. }
  66723. } else if (Number.isInteger(obj)) {
  66724. if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !((obj = parser.getObj()) instanceof _base_stream.BaseStream)) {
  66725. throw new _util.FormatError("Invalid XRef stream");
  66726. }
  66727. dict = this.processXRefStream(obj);
  66728. if (!this.topDict) {
  66729. this.topDict = dict;
  66730. }
  66731. if (!dict) {
  66732. throw new _util.FormatError("Failed to read XRef stream");
  66733. }
  66734. } else {
  66735. throw new _util.FormatError("Invalid XRef stream header");
  66736. }
  66737. obj = dict.get("Prev");
  66738. if (Number.isInteger(obj)) {
  66739. this.startXRefQueue.push(obj);
  66740. } else if (obj instanceof _primitives.Ref) {
  66741. this.startXRefQueue.push(obj.num);
  66742. }
  66743. } catch (e) {
  66744. if (e instanceof _core_utils.MissingDataException) {
  66745. throw e;
  66746. }
  66747. (0, _util.info)("(while reading XRef): " + e);
  66748. }
  66749. this.startXRefQueue.shift();
  66750. }
  66751. if (this.topDict) {
  66752. return this.topDict;
  66753. }
  66754. if (recoveryMode) {
  66755. return undefined;
  66756. }
  66757. throw new _core_utils.XRefParseException();
  66758. }
  66759. getEntry(i) {
  66760. const xrefEntry = this.entries[i];
  66761. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  66762. return xrefEntry;
  66763. }
  66764. return null;
  66765. }
  66766. fetchIfRef(obj) {
  66767. let suppressEncryption = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  66768. if (obj instanceof _primitives.Ref) {
  66769. return this.fetch(obj, suppressEncryption);
  66770. }
  66771. return obj;
  66772. }
  66773. fetch(ref) {
  66774. let suppressEncryption = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  66775. if (!(ref instanceof _primitives.Ref)) {
  66776. throw new Error("ref object is not a reference");
  66777. }
  66778. const num = ref.num;
  66779. const cacheEntry = this._cacheMap.get(num);
  66780. if (cacheEntry !== undefined) {
  66781. if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
  66782. cacheEntry.objId = ref.toString();
  66783. }
  66784. return cacheEntry;
  66785. }
  66786. let xrefEntry = this.getEntry(num);
  66787. if (xrefEntry === null) {
  66788. this._cacheMap.set(num, xrefEntry);
  66789. return xrefEntry;
  66790. }
  66791. if (this._pendingRefs.has(ref)) {
  66792. this._pendingRefs.remove(ref);
  66793. (0, _util.warn)(`Ignoring circular reference: ${ref}.`);
  66794. return _primitives.CIRCULAR_REF;
  66795. }
  66796. this._pendingRefs.put(ref);
  66797. try {
  66798. if (xrefEntry.uncompressed) {
  66799. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  66800. } else {
  66801. xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
  66802. }
  66803. this._pendingRefs.remove(ref);
  66804. } catch (ex) {
  66805. this._pendingRefs.remove(ref);
  66806. throw ex;
  66807. }
  66808. if (xrefEntry instanceof _primitives.Dict) {
  66809. xrefEntry.objId = ref.toString();
  66810. } else if (xrefEntry instanceof _base_stream.BaseStream) {
  66811. xrefEntry.dict.objId = ref.toString();
  66812. }
  66813. return xrefEntry;
  66814. }
  66815. fetchUncompressed(ref, xrefEntry) {
  66816. let suppressEncryption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  66817. const gen = ref.gen;
  66818. let num = ref.num;
  66819. if (xrefEntry.gen !== gen) {
  66820. const msg = `Inconsistent generation in XRef: ${ref}`;
  66821. if (this._generationFallback && xrefEntry.gen < gen) {
  66822. (0, _util.warn)(msg);
  66823. return this.fetchUncompressed(_primitives.Ref.get(num, xrefEntry.gen), xrefEntry, suppressEncryption);
  66824. }
  66825. throw new _core_utils.XRefEntryException(msg);
  66826. }
  66827. const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  66828. const parser = new _parser.Parser({
  66829. lexer: new _parser.Lexer(stream),
  66830. xref: this,
  66831. allowStreams: true
  66832. });
  66833. const obj1 = parser.getObj();
  66834. const obj2 = parser.getObj();
  66835. const obj3 = parser.getObj();
  66836. if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
  66837. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  66838. }
  66839. if (obj3.cmd !== "obj") {
  66840. if (obj3.cmd.startsWith("obj")) {
  66841. num = parseInt(obj3.cmd.substring(3), 10);
  66842. if (!Number.isNaN(num)) {
  66843. return num;
  66844. }
  66845. }
  66846. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  66847. }
  66848. if (this.encrypt && !suppressEncryption) {
  66849. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  66850. } else {
  66851. xrefEntry = parser.getObj();
  66852. }
  66853. if (!(xrefEntry instanceof _base_stream.BaseStream)) {
  66854. this._cacheMap.set(num, xrefEntry);
  66855. }
  66856. return xrefEntry;
  66857. }
  66858. fetchCompressed(ref, xrefEntry) {
  66859. let suppressEncryption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  66860. const tableOffset = xrefEntry.offset;
  66861. const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
  66862. if (!(stream instanceof _base_stream.BaseStream)) {
  66863. throw new _util.FormatError("bad ObjStm stream");
  66864. }
  66865. const first = stream.dict.get("First");
  66866. const n = stream.dict.get("N");
  66867. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  66868. throw new _util.FormatError("invalid first and n parameters for ObjStm stream");
  66869. }
  66870. let parser = new _parser.Parser({
  66871. lexer: new _parser.Lexer(stream),
  66872. xref: this,
  66873. allowStreams: true
  66874. });
  66875. const nums = new Array(n);
  66876. const offsets = new Array(n);
  66877. for (let i = 0; i < n; ++i) {
  66878. const num = parser.getObj();
  66879. if (!Number.isInteger(num)) {
  66880. throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
  66881. }
  66882. const offset = parser.getObj();
  66883. if (!Number.isInteger(offset)) {
  66884. throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
  66885. }
  66886. nums[i] = num;
  66887. offsets[i] = offset;
  66888. }
  66889. const start = (stream.start || 0) + first;
  66890. const entries = new Array(n);
  66891. for (let i = 0; i < n; ++i) {
  66892. const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;
  66893. if (length < 0) {
  66894. throw new _util.FormatError("Invalid offset in the ObjStm stream.");
  66895. }
  66896. parser = new _parser.Parser({
  66897. lexer: new _parser.Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)),
  66898. xref: this,
  66899. allowStreams: true
  66900. });
  66901. const obj = parser.getObj();
  66902. entries[i] = obj;
  66903. if (obj instanceof _base_stream.BaseStream) {
  66904. continue;
  66905. }
  66906. const num = nums[i],
  66907. entry = this.entries[num];
  66908. if (entry && entry.offset === tableOffset && entry.gen === i) {
  66909. this._cacheMap.set(num, obj);
  66910. }
  66911. }
  66912. xrefEntry = entries[xrefEntry.gen];
  66913. if (xrefEntry === undefined) {
  66914. throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
  66915. }
  66916. return xrefEntry;
  66917. }
  66918. async fetchIfRefAsync(obj, suppressEncryption) {
  66919. if (obj instanceof _primitives.Ref) {
  66920. return this.fetchAsync(obj, suppressEncryption);
  66921. }
  66922. return obj;
  66923. }
  66924. async fetchAsync(ref, suppressEncryption) {
  66925. try {
  66926. return this.fetch(ref, suppressEncryption);
  66927. } catch (ex) {
  66928. if (!(ex instanceof _core_utils.MissingDataException)) {
  66929. throw ex;
  66930. }
  66931. await this.pdfManager.requestRange(ex.begin, ex.end);
  66932. return this.fetchAsync(ref, suppressEncryption);
  66933. }
  66934. }
  66935. getCatalogObj() {
  66936. return this.root;
  66937. }
  66938. }
  66939. exports.XRef = XRef;
  66940. /***/ }),
  66941. /* 233 */
  66942. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  66943. "use strict";
  66944. Object.defineProperty(exports, "__esModule", ({
  66945. value: true
  66946. }));
  66947. exports.MessageHandler = void 0;
  66948. var _util = __w_pdfjs_require__(2);
  66949. const CallbackKind = {
  66950. UNKNOWN: 0,
  66951. DATA: 1,
  66952. ERROR: 2
  66953. };
  66954. const StreamKind = {
  66955. UNKNOWN: 0,
  66956. CANCEL: 1,
  66957. CANCEL_COMPLETE: 2,
  66958. CLOSE: 3,
  66959. ENQUEUE: 4,
  66960. ERROR: 5,
  66961. PULL: 6,
  66962. PULL_COMPLETE: 7,
  66963. START_COMPLETE: 8
  66964. };
  66965. function wrapReason(reason) {
  66966. if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) {
  66967. (0, _util.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
  66968. }
  66969. switch (reason.name) {
  66970. case "AbortException":
  66971. return new _util.AbortException(reason.message);
  66972. case "MissingPDFException":
  66973. return new _util.MissingPDFException(reason.message);
  66974. case "PasswordException":
  66975. return new _util.PasswordException(reason.message, reason.code);
  66976. case "UnexpectedResponseException":
  66977. return new _util.UnexpectedResponseException(reason.message, reason.status);
  66978. case "UnknownErrorException":
  66979. return new _util.UnknownErrorException(reason.message, reason.details);
  66980. default:
  66981. return new _util.UnknownErrorException(reason.message, reason.toString());
  66982. }
  66983. }
  66984. class MessageHandler {
  66985. constructor(sourceName, targetName, comObj) {
  66986. this.sourceName = sourceName;
  66987. this.targetName = targetName;
  66988. this.comObj = comObj;
  66989. this.callbackId = 1;
  66990. this.streamId = 1;
  66991. this.streamSinks = Object.create(null);
  66992. this.streamControllers = Object.create(null);
  66993. this.callbackCapabilities = Object.create(null);
  66994. this.actionHandler = Object.create(null);
  66995. this._onComObjOnMessage = event => {
  66996. const data = event.data;
  66997. if (data.targetName !== this.sourceName) {
  66998. return;
  66999. }
  67000. if (data.stream) {
  67001. this._processStreamMessage(data);
  67002. return;
  67003. }
  67004. if (data.callback) {
  67005. const callbackId = data.callbackId;
  67006. const capability = this.callbackCapabilities[callbackId];
  67007. if (!capability) {
  67008. throw new Error(`Cannot resolve callback ${callbackId}`);
  67009. }
  67010. delete this.callbackCapabilities[callbackId];
  67011. if (data.callback === CallbackKind.DATA) {
  67012. capability.resolve(data.data);
  67013. } else if (data.callback === CallbackKind.ERROR) {
  67014. capability.reject(wrapReason(data.reason));
  67015. } else {
  67016. throw new Error("Unexpected callback case");
  67017. }
  67018. return;
  67019. }
  67020. const action = this.actionHandler[data.action];
  67021. if (!action) {
  67022. throw new Error(`Unknown action from worker: ${data.action}`);
  67023. }
  67024. if (data.callbackId) {
  67025. const cbSourceName = this.sourceName;
  67026. const cbTargetName = data.sourceName;
  67027. new Promise(function (resolve) {
  67028. resolve(action(data.data));
  67029. }).then(function (result) {
  67030. comObj.postMessage({
  67031. sourceName: cbSourceName,
  67032. targetName: cbTargetName,
  67033. callback: CallbackKind.DATA,
  67034. callbackId: data.callbackId,
  67035. data: result
  67036. });
  67037. }, function (reason) {
  67038. comObj.postMessage({
  67039. sourceName: cbSourceName,
  67040. targetName: cbTargetName,
  67041. callback: CallbackKind.ERROR,
  67042. callbackId: data.callbackId,
  67043. reason: wrapReason(reason)
  67044. });
  67045. });
  67046. return;
  67047. }
  67048. if (data.streamId) {
  67049. this._createStreamSink(data);
  67050. return;
  67051. }
  67052. action(data.data);
  67053. };
  67054. comObj.addEventListener("message", this._onComObjOnMessage);
  67055. }
  67056. on(actionName, handler) {
  67057. const ah = this.actionHandler;
  67058. if (ah[actionName]) {
  67059. throw new Error(`There is already an actionName called "${actionName}"`);
  67060. }
  67061. ah[actionName] = handler;
  67062. }
  67063. send(actionName, data, transfers) {
  67064. this.comObj.postMessage({
  67065. sourceName: this.sourceName,
  67066. targetName: this.targetName,
  67067. action: actionName,
  67068. data
  67069. }, transfers);
  67070. }
  67071. sendWithPromise(actionName, data, transfers) {
  67072. const callbackId = this.callbackId++;
  67073. const capability = (0, _util.createPromiseCapability)();
  67074. this.callbackCapabilities[callbackId] = capability;
  67075. try {
  67076. this.comObj.postMessage({
  67077. sourceName: this.sourceName,
  67078. targetName: this.targetName,
  67079. action: actionName,
  67080. callbackId,
  67081. data
  67082. }, transfers);
  67083. } catch (ex) {
  67084. capability.reject(ex);
  67085. }
  67086. return capability.promise;
  67087. }
  67088. sendWithStream(actionName, data, queueingStrategy, transfers) {
  67089. const streamId = this.streamId++,
  67090. sourceName = this.sourceName,
  67091. targetName = this.targetName,
  67092. comObj = this.comObj;
  67093. return new ReadableStream({
  67094. start: controller => {
  67095. const startCapability = (0, _util.createPromiseCapability)();
  67096. this.streamControllers[streamId] = {
  67097. controller,
  67098. startCall: startCapability,
  67099. pullCall: null,
  67100. cancelCall: null,
  67101. isClosed: false
  67102. };
  67103. comObj.postMessage({
  67104. sourceName,
  67105. targetName,
  67106. action: actionName,
  67107. streamId,
  67108. data,
  67109. desiredSize: controller.desiredSize
  67110. }, transfers);
  67111. return startCapability.promise;
  67112. },
  67113. pull: controller => {
  67114. const pullCapability = (0, _util.createPromiseCapability)();
  67115. this.streamControllers[streamId].pullCall = pullCapability;
  67116. comObj.postMessage({
  67117. sourceName,
  67118. targetName,
  67119. stream: StreamKind.PULL,
  67120. streamId,
  67121. desiredSize: controller.desiredSize
  67122. });
  67123. return pullCapability.promise;
  67124. },
  67125. cancel: reason => {
  67126. (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
  67127. const cancelCapability = (0, _util.createPromiseCapability)();
  67128. this.streamControllers[streamId].cancelCall = cancelCapability;
  67129. this.streamControllers[streamId].isClosed = true;
  67130. comObj.postMessage({
  67131. sourceName,
  67132. targetName,
  67133. stream: StreamKind.CANCEL,
  67134. streamId,
  67135. reason: wrapReason(reason)
  67136. });
  67137. return cancelCapability.promise;
  67138. }
  67139. }, queueingStrategy);
  67140. }
  67141. _createStreamSink(data) {
  67142. const streamId = data.streamId,
  67143. sourceName = this.sourceName,
  67144. targetName = data.sourceName,
  67145. comObj = this.comObj;
  67146. const self = this,
  67147. action = this.actionHandler[data.action];
  67148. const streamSink = {
  67149. enqueue(chunk) {
  67150. let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
  67151. let transfers = arguments.length > 2 ? arguments[2] : undefined;
  67152. if (this.isCancelled) {
  67153. return;
  67154. }
  67155. const lastDesiredSize = this.desiredSize;
  67156. this.desiredSize -= size;
  67157. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  67158. this.sinkCapability = (0, _util.createPromiseCapability)();
  67159. this.ready = this.sinkCapability.promise;
  67160. }
  67161. comObj.postMessage({
  67162. sourceName,
  67163. targetName,
  67164. stream: StreamKind.ENQUEUE,
  67165. streamId,
  67166. chunk
  67167. }, transfers);
  67168. },
  67169. close() {
  67170. if (this.isCancelled) {
  67171. return;
  67172. }
  67173. this.isCancelled = true;
  67174. comObj.postMessage({
  67175. sourceName,
  67176. targetName,
  67177. stream: StreamKind.CLOSE,
  67178. streamId
  67179. });
  67180. delete self.streamSinks[streamId];
  67181. },
  67182. error(reason) {
  67183. (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
  67184. if (this.isCancelled) {
  67185. return;
  67186. }
  67187. this.isCancelled = true;
  67188. comObj.postMessage({
  67189. sourceName,
  67190. targetName,
  67191. stream: StreamKind.ERROR,
  67192. streamId,
  67193. reason: wrapReason(reason)
  67194. });
  67195. },
  67196. sinkCapability: (0, _util.createPromiseCapability)(),
  67197. onPull: null,
  67198. onCancel: null,
  67199. isCancelled: false,
  67200. desiredSize: data.desiredSize,
  67201. ready: null
  67202. };
  67203. streamSink.sinkCapability.resolve();
  67204. streamSink.ready = streamSink.sinkCapability.promise;
  67205. this.streamSinks[streamId] = streamSink;
  67206. new Promise(function (resolve) {
  67207. resolve(action(data.data, streamSink));
  67208. }).then(function () {
  67209. comObj.postMessage({
  67210. sourceName,
  67211. targetName,
  67212. stream: StreamKind.START_COMPLETE,
  67213. streamId,
  67214. success: true
  67215. });
  67216. }, function (reason) {
  67217. comObj.postMessage({
  67218. sourceName,
  67219. targetName,
  67220. stream: StreamKind.START_COMPLETE,
  67221. streamId,
  67222. reason: wrapReason(reason)
  67223. });
  67224. });
  67225. }
  67226. _processStreamMessage(data) {
  67227. const streamId = data.streamId,
  67228. sourceName = this.sourceName,
  67229. targetName = data.sourceName,
  67230. comObj = this.comObj;
  67231. const streamController = this.streamControllers[streamId],
  67232. streamSink = this.streamSinks[streamId];
  67233. switch (data.stream) {
  67234. case StreamKind.START_COMPLETE:
  67235. if (data.success) {
  67236. streamController.startCall.resolve();
  67237. } else {
  67238. streamController.startCall.reject(wrapReason(data.reason));
  67239. }
  67240. break;
  67241. case StreamKind.PULL_COMPLETE:
  67242. if (data.success) {
  67243. streamController.pullCall.resolve();
  67244. } else {
  67245. streamController.pullCall.reject(wrapReason(data.reason));
  67246. }
  67247. break;
  67248. case StreamKind.PULL:
  67249. if (!streamSink) {
  67250. comObj.postMessage({
  67251. sourceName,
  67252. targetName,
  67253. stream: StreamKind.PULL_COMPLETE,
  67254. streamId,
  67255. success: true
  67256. });
  67257. break;
  67258. }
  67259. if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
  67260. streamSink.sinkCapability.resolve();
  67261. }
  67262. streamSink.desiredSize = data.desiredSize;
  67263. new Promise(function (resolve) {
  67264. resolve(streamSink.onPull && streamSink.onPull());
  67265. }).then(function () {
  67266. comObj.postMessage({
  67267. sourceName,
  67268. targetName,
  67269. stream: StreamKind.PULL_COMPLETE,
  67270. streamId,
  67271. success: true
  67272. });
  67273. }, function (reason) {
  67274. comObj.postMessage({
  67275. sourceName,
  67276. targetName,
  67277. stream: StreamKind.PULL_COMPLETE,
  67278. streamId,
  67279. reason: wrapReason(reason)
  67280. });
  67281. });
  67282. break;
  67283. case StreamKind.ENQUEUE:
  67284. (0, _util.assert)(streamController, "enqueue should have stream controller");
  67285. if (streamController.isClosed) {
  67286. break;
  67287. }
  67288. streamController.controller.enqueue(data.chunk);
  67289. break;
  67290. case StreamKind.CLOSE:
  67291. (0, _util.assert)(streamController, "close should have stream controller");
  67292. if (streamController.isClosed) {
  67293. break;
  67294. }
  67295. streamController.isClosed = true;
  67296. streamController.controller.close();
  67297. this._deleteStreamController(streamController, streamId);
  67298. break;
  67299. case StreamKind.ERROR:
  67300. (0, _util.assert)(streamController, "error should have stream controller");
  67301. streamController.controller.error(wrapReason(data.reason));
  67302. this._deleteStreamController(streamController, streamId);
  67303. break;
  67304. case StreamKind.CANCEL_COMPLETE:
  67305. if (data.success) {
  67306. streamController.cancelCall.resolve();
  67307. } else {
  67308. streamController.cancelCall.reject(wrapReason(data.reason));
  67309. }
  67310. this._deleteStreamController(streamController, streamId);
  67311. break;
  67312. case StreamKind.CANCEL:
  67313. if (!streamSink) {
  67314. break;
  67315. }
  67316. new Promise(function (resolve) {
  67317. resolve(streamSink.onCancel && streamSink.onCancel(wrapReason(data.reason)));
  67318. }).then(function () {
  67319. comObj.postMessage({
  67320. sourceName,
  67321. targetName,
  67322. stream: StreamKind.CANCEL_COMPLETE,
  67323. streamId,
  67324. success: true
  67325. });
  67326. }, function (reason) {
  67327. comObj.postMessage({
  67328. sourceName,
  67329. targetName,
  67330. stream: StreamKind.CANCEL_COMPLETE,
  67331. streamId,
  67332. reason: wrapReason(reason)
  67333. });
  67334. });
  67335. streamSink.sinkCapability.reject(wrapReason(data.reason));
  67336. streamSink.isCancelled = true;
  67337. delete this.streamSinks[streamId];
  67338. break;
  67339. default:
  67340. throw new Error("Unexpected stream case");
  67341. }
  67342. }
  67343. async _deleteStreamController(streamController, streamId) {
  67344. await Promise.allSettled([streamController.startCall && streamController.startCall.promise, streamController.pullCall && streamController.pullCall.promise, streamController.cancelCall && streamController.cancelCall.promise]);
  67345. delete this.streamControllers[streamId];
  67346. }
  67347. destroy() {
  67348. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  67349. }
  67350. }
  67351. exports.MessageHandler = MessageHandler;
  67352. /***/ }),
  67353. /* 234 */
  67354. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  67355. "use strict";
  67356. Object.defineProperty(exports, "__esModule", ({
  67357. value: true
  67358. }));
  67359. exports.PDFWorkerStream = void 0;
  67360. var _util = __w_pdfjs_require__(2);
  67361. class PDFWorkerStream {
  67362. constructor(msgHandler) {
  67363. this._msgHandler = msgHandler;
  67364. this._contentLength = null;
  67365. this._fullRequestReader = null;
  67366. this._rangeRequestReaders = [];
  67367. }
  67368. getFullReader() {
  67369. (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
  67370. this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
  67371. return this._fullRequestReader;
  67372. }
  67373. getRangeReader(begin, end) {
  67374. const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
  67375. this._rangeRequestReaders.push(reader);
  67376. return reader;
  67377. }
  67378. cancelAllRequests(reason) {
  67379. if (this._fullRequestReader) {
  67380. this._fullRequestReader.cancel(reason);
  67381. }
  67382. for (const reader of this._rangeRequestReaders.slice(0)) {
  67383. reader.cancel(reason);
  67384. }
  67385. }
  67386. }
  67387. exports.PDFWorkerStream = PDFWorkerStream;
  67388. class PDFWorkerStreamReader {
  67389. constructor(msgHandler) {
  67390. this._msgHandler = msgHandler;
  67391. this.onProgress = null;
  67392. this._contentLength = null;
  67393. this._isRangeSupported = false;
  67394. this._isStreamingSupported = false;
  67395. const readableStream = this._msgHandler.sendWithStream("GetReader");
  67396. this._reader = readableStream.getReader();
  67397. this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
  67398. this._isStreamingSupported = data.isStreamingSupported;
  67399. this._isRangeSupported = data.isRangeSupported;
  67400. this._contentLength = data.contentLength;
  67401. });
  67402. }
  67403. get headersReady() {
  67404. return this._headersReady;
  67405. }
  67406. get contentLength() {
  67407. return this._contentLength;
  67408. }
  67409. get isStreamingSupported() {
  67410. return this._isStreamingSupported;
  67411. }
  67412. get isRangeSupported() {
  67413. return this._isRangeSupported;
  67414. }
  67415. async read() {
  67416. const {
  67417. value,
  67418. done
  67419. } = await this._reader.read();
  67420. if (done) {
  67421. return {
  67422. value: undefined,
  67423. done: true
  67424. };
  67425. }
  67426. return {
  67427. value: value.buffer,
  67428. done: false
  67429. };
  67430. }
  67431. cancel(reason) {
  67432. this._reader.cancel(reason);
  67433. }
  67434. }
  67435. class PDFWorkerStreamRangeReader {
  67436. constructor(begin, end, msgHandler) {
  67437. this._msgHandler = msgHandler;
  67438. this.onProgress = null;
  67439. const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
  67440. begin,
  67441. end
  67442. });
  67443. this._reader = readableStream.getReader();
  67444. }
  67445. get isStreamingSupported() {
  67446. return false;
  67447. }
  67448. async read() {
  67449. const {
  67450. value,
  67451. done
  67452. } = await this._reader.read();
  67453. if (done) {
  67454. return {
  67455. value: undefined,
  67456. done: true
  67457. };
  67458. }
  67459. return {
  67460. value: value.buffer,
  67461. done: false
  67462. };
  67463. }
  67464. cancel(reason) {
  67465. this._reader.cancel(reason);
  67466. }
  67467. }
  67468. /***/ })
  67469. /******/ ]);
  67470. /************************************************************************/
  67471. /******/ // The module cache
  67472. /******/ var __webpack_module_cache__ = {};
  67473. /******/
  67474. /******/ // The require function
  67475. /******/ function __w_pdfjs_require__(moduleId) {
  67476. /******/ // Check if module is in cache
  67477. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  67478. /******/ if (cachedModule !== undefined) {
  67479. /******/ return cachedModule.exports;
  67480. /******/ }
  67481. /******/ // Create a new module (and put it into the cache)
  67482. /******/ var module = __webpack_module_cache__[moduleId] = {
  67483. /******/ // no module.id needed
  67484. /******/ // no module.loaded needed
  67485. /******/ exports: {}
  67486. /******/ };
  67487. /******/
  67488. /******/ // Execute the module function
  67489. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  67490. /******/
  67491. /******/ // Return the exports of the module
  67492. /******/ return module.exports;
  67493. /******/ }
  67494. /******/
  67495. /************************************************************************/
  67496. /******/ /* webpack/runtime/define property getters */
  67497. /******/ (() => {
  67498. /******/ // define getter functions for harmony exports
  67499. /******/ __w_pdfjs_require__.d = (exports, definition) => {
  67500. /******/ for(var key in definition) {
  67501. /******/ if(__w_pdfjs_require__.o(definition, key) && !__w_pdfjs_require__.o(exports, key)) {
  67502. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  67503. /******/ }
  67504. /******/ }
  67505. /******/ };
  67506. /******/ })();
  67507. /******/
  67508. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  67509. /******/ (() => {
  67510. /******/ __w_pdfjs_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  67511. /******/ })();
  67512. /******/
  67513. /******/ /* webpack/runtime/make namespace object */
  67514. /******/ (() => {
  67515. /******/ // define __esModule on exports
  67516. /******/ __w_pdfjs_require__.r = (exports) => {
  67517. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  67518. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  67519. /******/ }
  67520. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  67521. /******/ };
  67522. /******/ })();
  67523. /******/
  67524. /************************************************************************/
  67525. var __webpack_exports__ = {};
  67526. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  67527. (() => {
  67528. "use strict";
  67529. var exports = __webpack_exports__;
  67530. Object.defineProperty(exports, "__esModule", ({
  67531. value: true
  67532. }));
  67533. Object.defineProperty(exports, "WorkerMessageHandler", ({
  67534. enumerable: true,
  67535. get: function () {
  67536. return _worker.WorkerMessageHandler;
  67537. }
  67538. }));
  67539. var _worker = __w_pdfjs_require__(1);
  67540. const pdfjsVersion = '3.4.120';
  67541. const pdfjsBuild = 'af6414988';
  67542. })();
  67543. /******/ return __webpack_exports__;
  67544. /******/ })()
  67545. ;
  67546. });
  67547. //# sourceMappingURL=pdf.worker.js.map