pdf.worker.js 2.0 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983689846898568986689876898868989689906899168992689936899468995689966899768998689996900069001690026900369004690056900669007690086900969010690116901269013690146901569016690176901869019690206902169022690236902469025690266902769028690296903069031690326903369034690356903669037690386903969040690416904269043690446904569046690476904869049690506905169052690536905469055690566905769058690596906069061690626906369064690656906669067690686906969070690716907269073690746907569076690776907869079690806908169082690836908469085690866908769088690896909069091690926909369094690956909669097690986909969100691016910269103691046910569106691076910869109691106911169112691136911469115691166911769118691196912069121691226912369124691256912669127691286912969130691316913269133691346913569136691376913869139691406914169142691436914469145691466914769148691496915069151691526915369154691556915669157691586915969160691616916269163691646916569166691676916869169691706917169172691736917469175691766917769178691796918069181691826918369184691856918669187691886918969190691916919269193691946919569196691976919869199692006920169202692036920469205692066920769208692096921069211692126921369214692156921669217692186921969220692216922269223692246922569226692276922869229692306923169232692336923469235692366923769238692396924069241692426924369244692456924669247692486924969250692516925269253692546925569256692576925869259692606926169262692636926469265692666926769268692696927069271692726927369274692756927669277692786927969280692816928269283692846928569286692876928869289692906929169292692936929469295692966929769298692996930069301693026930369304693056930669307693086930969310693116931269313693146931569316693176931869319693206932169322693236932469325693266932769328693296933069331693326933369334693356933669337693386933969340693416934269343693446934569346693476934869349693506935169352693536935469355693566935769358693596936069361693626936369364693656936669367693686936969370693716937269373693746937569376693776937869379693806938169382693836938469385693866938769388693896939069391693926939369394693956939669397693986939969400694016940269403694046940569406694076940869409694106941169412694136941469415694166941769418694196942069421694226942369424694256942669427694286942969430694316943269433694346943569436694376943869439694406944169442694436944469445694466944769448694496945069451694526945369454694556945669457694586945969460694616946269463694646946569466694676946869469694706947169472694736947469475694766947769478694796948069481694826948369484694856948669487694886948969490694916949269493694946949569496694976949869499695006950169502695036950469505695066950769508695096951069511695126951369514695156951669517695186951969520695216952269523695246952569526695276952869529695306953169532695336953469535695366953769538695396954069541695426954369544695456954669547695486954969550695516955269553695546955569556695576955869559695606956169562695636956469565695666956769568695696957069571695726957369574695756957669577695786957969580695816958269583695846958569586695876958869589695906959169592695936959469595695966959769598695996960069601696026960369604696056960669607696086960969610696116961269613696146961569616696176961869619696206962169622696236962469625696266962769628696296963069631696326963369634696356963669637696386963969640696416964269643696446964569646696476964869649696506965169652696536965469655696566965769658696596966069661696626966369664696656966669667696686966969670696716967269673696746967569676696776967869679696806968169682696836968469685696866968769688696896969069691696926969369694696956969669697696986969969700697016970269703697046970569706697076970869709697106971169712697136971469715697166971769718697196972069721697226972369724697256972669727697286972969730697316973269733697346973569736697376973869739697406974169742697436974469745697466974769748697496975069751697526975369754697556975669757697586975969760697616976269763697646976569766697676976869769697706977169772697736977469775697766977769778697796978069781697826978369784697856978669787697886978969790697916979269793697946979569796697976979869799698006980169802698036980469805698066980769808698096981069811698126981369814698156981669817698186981969820698216982269823698246982569826698276982869829698306983169832698336983469835698366983769838698396984069841698426984369844698456984669847698486984969850698516985269853698546985569856698576985869859698606986169862698636986469865698666986769868698696987069871698726987369874698756987669877698786987969880698816988269883698846988569886698876988869889698906989169892698936989469895698966989769898698996990069901699026990369904699056990669907699086990969910699116991269913699146991569916699176991869919699206992169922699236992469925699266992769928699296993069931699326993369934699356993669937699386993969940699416994269943699446994569946699476994869949699506995169952699536995469955699566995769958699596996069961699626996369964699656996669967699686996969970699716997269973699746997569976699776997869979699806998169982699836998469985699866998769988699896999069991699926999369994699956999669997699986999970000700017000270003700047000570006700077000870009700107001170012700137001470015700167001770018700197002070021700227002370024700257002670027700287002970030700317003270033700347003570036700377003870039700407004170042700437004470045700467004770048700497005070051700527005370054700557005670057700587005970060700617006270063700647006570066700677006870069700707007170072700737007470075700767007770078700797008070081700827008370084700857008670087700887008970090700917009270093700947009570096700977009870099701007010170102701037010470105701067010770108701097011070111701127011370114701157011670117701187011970120701217012270123701247012570126701277012870129701307013170132701337013470135701367013770138701397014070141701427014370144701457014670147701487014970150701517015270153701547015570156701577015870159701607016170162701637016470165701667016770168701697017070171701727017370174701757017670177701787017970180701817018270183701847018570186701877018870189701907019170192701937019470195701967019770198701997020070201702027020370204702057020670207702087020970210702117021270213702147021570216702177021870219702207022170222702237022470225702267022770228702297023070231702327023370234702357023670237702387023970240702417024270243702447024570246702477024870249702507025170252702537025470255702567025770258702597026070261702627026370264702657026670267702687026970270702717027270273702747027570276702777027870279702807028170282702837028470285702867028770288702897029070291702927029370294702957029670297702987029970300703017030270303703047030570306703077030870309703107031170312703137031470315703167031770318703197032070321703227032370324703257032670327703287032970330703317033270333703347033570336703377033870339703407034170342703437034470345703467034770348703497035070351703527035370354703557035670357703587035970360703617036270363703647036570366703677036870369703707037170372703737037470375703767037770378703797038070381703827038370384703857038670387703887038970390703917039270393703947039570396703977039870399704007040170402704037040470405704067040770408704097041070411704127041370414704157041670417704187041970420704217042270423704247042570426704277042870429704307043170432704337043470435704367043770438704397044070441704427044370444704457044670447704487044970450704517045270453704547045570456704577045870459704607046170462704637046470465704667046770468704697047070471704727047370474704757047670477704787047970480704817048270483704847048570486704877048870489704907049170492704937049470495704967049770498704997050070501705027050370504705057050670507705087050970510705117051270513705147051570516705177051870519705207052170522705237052470525705267052770528705297053070531705327053370534705357053670537705387053970540705417054270543705447054570546705477054870549705507055170552705537055470555705567055770558705597056070561705627056370564705657056670567705687056970570705717057270573705747057570576705777057870579705807058170582705837058470585705867058770588705897059070591705927059370594705957059670597705987059970600706017060270603706047060570606706077060870609706107061170612706137061470615706167061770618706197062070621706227062370624706257062670627706287062970630706317063270633706347063570636706377063870639706407064170642706437064470645706467064770648706497065070651706527065370654706557065670657706587065970660706617066270663706647066570666706677066870669706707067170672706737067470675706767067770678706797068070681706827068370684706857068670687706887068970690706917069270693706947069570696706977069870699707007070170702707037070470705707067070770708707097071070711707127071370714707157071670717707187071970720707217072270723707247072570726707277072870729707307073170732707337073470735707367073770738707397074070741707427074370744707457074670747707487074970750707517075270753707547075570756707577075870759707607076170762707637076470765707667076770768707697077070771707727077370774707757077670777707787077970780707817078270783707847078570786707877078870789707907079170792707937079470795707967079770798707997080070801708027080370804708057080670807708087080970810708117081270813708147081570816708177081870819708207082170822708237082470825708267082770828708297083070831708327083370834708357083670837708387083970840708417084270843708447084570846708477084870849708507085170852708537085470855708567085770858708597086070861708627086370864708657086670867708687086970870708717087270873708747087570876708777087870879708807088170882708837088470885708867088770888708897089070891708927089370894708957089670897708987089970900709017090270903709047090570906709077090870909709107091170912709137091470915709167091770918709197092070921709227092370924709257092670927709287092970930709317093270933709347093570936709377093870939709407094170942709437094470945709467094770948709497095070951709527095370954709557095670957709587095970960709617096270963709647096570966709677096870969709707097170972709737097470975709767097770978709797098070981709827098370984709857098670987709887098970990709917099270993709947099570996709977099870999710007100171002710037100471005710067100771008710097101071011710127101371014710157101671017710187101971020710217102271023710247102571026710277102871029710307103171032710337103471035710367103771038710397104071041710427104371044710457104671047710487104971050710517105271053710547105571056710577105871059710607106171062710637106471065710667106771068710697107071071710727107371074710757107671077710787107971080710817108271083710847108571086710877108871089710907109171092710937109471095710967109771098710997110071101711027110371104711057110671107711087110971110711117111271113711147111571116711177111871119711207112171122711237112471125711267112771128711297113071131711327113371134711357113671137711387113971140711417114271143711447114571146711477114871149711507115171152711537115471155711567115771158711597116071161711627116371164711657116671167711687116971170711717117271173711747117571176711777117871179711807118171182711837118471185711867118771188711897119071191711927119371194711957119671197711987119971200712017120271203712047120571206712077120871209712107121171212712137121471215712167121771218712197122071221712227122371224712257122671227712287122971230712317123271233712347123571236712377123871239712407124171242712437124471245712467124771248712497125071251712527125371254712557125671257712587125971260712617126271263712647126571266712677126871269712707127171272712737127471275712767127771278712797128071281712827128371284712857128671287712887128971290712917129271293712947129571296712977129871299713007130171302713037130471305713067130771308713097131071311713127131371314713157131671317713187131971320713217132271323713247132571326713277132871329713307133171332713337133471335713367133771338713397134071341713427134371344713457134671347713487134971350713517135271353713547135571356713577135871359713607136171362713637136471365713667136771368713697137071371713727137371374713757137671377713787137971380713817138271383713847138571386713877138871389713907139171392713937139471395713967139771398713997140071401714027140371404714057140671407714087140971410714117141271413714147141571416714177141871419714207142171422714237142471425714267142771428714297143071431714327143371434714357143671437714387143971440714417144271443714447144571446714477144871449714507145171452714537145471455714567145771458714597146071461714627146371464714657146671467714687146971470714717147271473714747147571476714777147871479714807148171482714837148471485714867148771488714897149071491714927149371494714957149671497714987149971500715017150271503715047150571506715077150871509715107151171512715137151471515715167151771518715197152071521715227152371524715257152671527715287152971530715317153271533715347153571536715377153871539715407154171542715437154471545715467154771548715497155071551715527155371554715557155671557715587155971560715617156271563715647156571566715677156871569715707157171572715737157471575715767157771578715797158071581715827158371584715857158671587715887158971590715917159271593715947159571596715977159871599716007160171602716037160471605716067160771608716097161071611716127161371614716157161671617716187161971620716217162271623716247162571626716277162871629716307163171632716337163471635716367163771638716397164071641716427164371644716457164671647716487164971650716517165271653716547165571656716577165871659716607166171662716637166471665716667166771668716697167071671716727167371674716757167671677716787167971680716817168271683716847168571686716877168871689716907169171692716937169471695716967169771698716997170071701717027170371704717057170671707717087170971710717117171271713717147171571716717177171871719717207172171722717237172471725717267172771728717297173071731717327173371734717357173671737717387173971740717417174271743717447174571746717477174871749717507175171752717537175471755717567175771758717597176071761717627176371764717657176671767717687176971770717717177271773717747177571776717777177871779717807178171782717837178471785717867178771788717897179071791717927179371794717957179671797717987179971800718017180271803718047180571806718077180871809718107181171812718137181471815718167181771818718197182071821718227182371824718257182671827718287182971830718317183271833718347183571836718377183871839718407184171842718437184471845718467184771848718497185071851718527185371854718557185671857718587185971860718617186271863718647186571866718677186871869718707187171872718737187471875718767187771878718797188071881718827188371884718857188671887718887188971890718917189271893718947189571896718977189871899719007190171902719037190471905719067190771908719097191071911719127191371914719157191671917719187191971920719217192271923719247192571926719277192871929719307193171932719337193471935719367193771938719397194071941719427194371944719457194671947719487194971950719517195271953719547195571956719577195871959719607196171962719637196471965719667196771968719697197071971719727197371974719757197671977719787197971980719817198271983719847198571986719877198871989719907199171992719937199471995719967199771998719997200072001720027200372004720057200672007720087200972010720117201272013720147201572016720177201872019720207202172022720237202472025720267202772028720297203072031720327203372034720357203672037720387203972040720417204272043720447204572046720477204872049720507205172052720537205472055720567205772058720597206072061720627206372064720657206672067720687206972070720717207272073720747207572076720777207872079720807208172082720837208472085720867208772088720897209072091720927209372094720957209672097720987209972100721017210272103721047210572106721077210872109721107211172112721137211472115721167211772118721197212072121721227212372124721257212672127721287212972130721317213272133721347213572136721377213872139721407214172142721437214472145721467214772148721497215072151721527215372154721557215672157721587215972160721617216272163721647216572166721677216872169721707217172172721737217472175721767217772178721797218072181721827218372184721857218672187721887218972190721917219272193721947219572196721977219872199722007220172202722037220472205722067220772208722097221072211722127221372214722157221672217722187221972220722217222272223722247222572226722277222872229722307223172232722337223472235722367223772238722397224072241722427224372244722457224672247722487224972250722517225272253722547225572256722577225872259722607226172262722637226472265722667226772268722697227072271722727227372274722757227672277722787227972280722817228272283722847228572286722877228872289722907229172292722937229472295722967229772298722997230072301723027230372304723057230672307723087230972310723117231272313723147231572316723177231872319723207232172322723237232472325723267232772328723297233072331723327233372334723357233672337723387233972340723417234272343723447234572346723477234872349723507235172352723537235472355723567235772358723597236072361723627236372364723657236672367723687236972370723717237272373723747237572376723777237872379723807238172382723837238472385723867238772388723897239072391723927239372394723957239672397723987239972400724017240272403724047240572406724077240872409724107241172412724137241472415724167241772418724197242072421724227242372424724257242672427724287242972430724317243272433724347243572436724377243872439724407244172442724437244472445724467244772448724497245072451724527245372454724557245672457724587245972460724617246272463724647246572466724677246872469724707247172472724737247472475724767247772478724797248072481724827248372484724857248672487724887248972490724917249272493724947249572496724977249872499725007250172502725037250472505725067250772508725097251072511725127251372514725157251672517725187251972520725217252272523725247252572526725277252872529725307253172532725337253472535725367253772538725397254072541725427254372544725457254672547725487254972550725517255272553725547255572556725577255872559725607256172562725637256472565725667256772568725697257072571725727257372574725757257672577725787257972580725817258272583725847258572586725877258872589725907259172592725937259472595725967259772598725997260072601726027260372604726057260672607726087260972610726117261272613726147261572616726177261872619726207262172622726237262472625726267262772628726297263072631726327263372634726357263672637726387263972640726417264272643726447264572646726477264872649726507265172652726537265472655726567265772658726597266072661726627266372664726657266672667726687266972670726717267272673726747267572676726777267872679726807268172682726837268472685726867268772688726897269072691726927269372694726957269672697726987269972700727017270272703727047270572706727077270872709727107271172712727137271472715727167271772718727197272072721727227272372724727257272672727727287272972730727317273272733727347273572736727377273872739727407274172742727437274472745727467274772748727497275072751727527275372754727557275672757727587275972760727617276272763727647276572766727677276872769727707277172772727737277472775727767277772778727797278072781727827278372784727857278672787727887278972790727917279272793727947279572796727977279872799728007280172802728037280472805728067280772808728097281072811728127281372814728157281672817728187281972820728217282272823728247282572826728277282872829728307283172832728337283472835728367283772838728397284072841728427284372844728457284672847728487284972850728517285272853728547285572856728577285872859728607286172862728637286472865728667286772868728697287072871728727287372874728757287672877728787287972880728817288272883728847288572886728877288872889728907289172892728937289472895728967289772898728997290072901729027290372904729057290672907729087290972910729117291272913729147291572916729177291872919729207292172922729237292472925729267292772928729297293072931729327293372934729357293672937729387293972940729417294272943729447294572946729477294872949729507295172952729537295472955729567295772958729597296072961729627296372964729657296672967729687296972970729717297272973729747297572976729777297872979729807298172982729837298472985729867298772988729897299072991729927299372994729957299672997729987299973000730017300273003730047300573006730077300873009730107301173012730137301473015730167301773018730197302073021730227302373024730257302673027730287302973030730317303273033730347303573036730377303873039730407304173042730437304473045730467304773048730497305073051730527305373054730557305673057730587305973060730617306273063730647306573066730677306873069730707307173072730737307473075730767307773078730797308073081730827308373084730857308673087730887308973090730917309273093730947309573096730977309873099731007310173102731037310473105731067310773108731097311073111731127311373114731157311673117731187311973120731217312273123731247312573126731277312873129731307313173132731337313473135731367313773138731397314073141731427314373144731457314673147731487314973150731517315273153731547315573156731577315873159731607316173162731637316473165731667316773168731697317073171731727317373174731757317673177731787317973180731817318273183731847318573186731877318873189731907319173192731937319473195731967319773198731997320073201732027320373204732057320673207732087320973210732117321273213732147321573216732177321873219732207322173222732237322473225732267322773228732297323073231732327323373234732357323673237732387323973240732417324273243732447324573246732477324873249732507325173252732537325473255732567325773258732597326073261732627326373264732657326673267732687326973270732717327273273732747327573276732777327873279732807328173282732837328473285732867328773288732897329073291732927329373294732957329673297732987329973300733017330273303733047330573306733077330873309733107331173312733137331473315733167331773318733197332073321733227332373324733257332673327733287332973330733317333273333733347333573336733377333873339733407334173342733437334473345733467334773348733497335073351733527335373354733557335673357733587335973360733617336273363733647336573366733677336873369733707337173372733737337473375733767337773378733797338073381733827338373384733857338673387733887338973390733917339273393733947339573396733977339873399734007340173402734037340473405734067340773408734097341073411734127341373414734157341673417734187341973420734217342273423734247342573426734277342873429734307343173432734337343473435734367343773438734397344073441734427344373444734457344673447734487344973450734517345273453734547345573456734577345873459734607346173462734637346473465734667346773468734697347073471734727347373474734757347673477734787347973480734817348273483734847348573486734877348873489734907349173492734937349473495734967349773498734997350073501735027350373504735057350673507735087350973510735117351273513735147351573516735177351873519735207352173522735237352473525735267352773528735297353073531735327353373534735357353673537735387353973540735417354273543735447354573546735477354873549735507355173552735537355473555735567355773558735597356073561735627356373564735657356673567735687356973570735717357273573735747357573576735777357873579735807358173582735837358473585735867358773588735897359073591735927359373594735957359673597735987359973600736017360273603736047360573606736077360873609736107361173612736137361473615736167361773618736197362073621736227362373624736257362673627736287362973630736317363273633736347363573636736377363873639736407364173642736437364473645736467364773648736497365073651736527365373654736557365673657736587365973660736617366273663736647366573666736677366873669736707367173672736737367473675736767367773678736797368073681736827368373684736857368673687736887368973690736917369273693736947369573696736977369873699737007370173702737037370473705737067370773708737097371073711737127371373714737157371673717737187371973720737217372273723737247372573726737277372873729737307373173732737337373473735737367373773738737397374073741737427374373744737457374673747737487374973750737517375273753737547375573756737577375873759737607376173762737637376473765737667376773768737697377073771737727377373774737757377673777737787377973780737817378273783737847378573786737877378873789737907379173792737937379473795737967379773798737997380073801738027380373804738057380673807738087380973810738117381273813738147381573816738177381873819738207382173822738237382473825738267382773828738297383073831738327383373834738357383673837738387383973840738417384273843738447384573846738477384873849738507385173852738537385473855738567385773858738597386073861738627386373864738657386673867738687386973870738717387273873738747387573876738777387873879738807388173882738837388473885738867388773888738897389073891738927389373894738957389673897738987389973900739017390273903739047390573906739077390873909739107391173912739137391473915739167391773918739197392073921739227392373924739257392673927739287392973930739317393273933739347393573936739377393873939739407394173942739437394473945739467394773948739497395073951739527395373954739557395673957739587395973960739617396273963739647396573966739677396873969739707397173972739737397473975739767397773978739797398073981739827398373984739857398673987739887398973990739917399273993739947399573996739977399873999740007400174002740037400474005740067400774008740097401074011740127401374014740157401674017740187401974020740217402274023740247402574026740277402874029740307403174032740337403474035740367403774038740397404074041740427404374044740457404674047740487404974050740517405274053740547405574056740577405874059740607406174062740637406474065740667406774068740697407074071740727407374074740757407674077740787407974080740817408274083740847408574086740877408874089740907409174092740937409474095740967409774098740997410074101741027410374104741057410674107741087410974110741117411274113741147411574116741177411874119741207412174122741237412474125741267412774128741297413074131741327413374134741357413674137741387413974140741417414274143741447414574146741477414874149741507415174152741537415474155741567415774158741597416074161741627416374164741657416674167741687416974170741717417274173741747417574176741777417874179741807418174182741837418474185741867418774188741897419074191741927419374194741957419674197741987419974200742017420274203742047420574206742077420874209742107421174212742137421474215742167421774218742197422074221742227422374224742257422674227742287422974230742317423274233742347423574236742377423874239742407424174242742437424474245742467424774248742497425074251742527425374254742557425674257742587425974260742617426274263742647426574266742677426874269742707427174272742737427474275742767427774278742797428074281742827428374284742857428674287742887428974290742917429274293742947429574296742977429874299743007430174302743037430474305743067430774308743097431074311743127431374314743157431674317743187431974320743217432274323743247432574326743277432874329743307433174332743337433474335743367433774338743397434074341743427434374344743457434674347743487434974350743517435274353743547435574356743577435874359743607436174362743637436474365743667436774368743697437074371743727437374374743757437674377743787437974380743817438274383743847438574386743877438874389743907439174392743937439474395743967439774398743997440074401744027440374404744057440674407744087440974410744117441274413744147441574416744177441874419744207442174422744237442474425744267442774428744297443074431744327443374434744357443674437744387443974440744417444274443744447444574446744477444874449744507445174452744537445474455744567445774458744597446074461744627446374464744657446674467744687446974470744717447274473744747447574476744777447874479744807448174482744837448474485744867448774488744897449074491744927449374494744957449674497744987449974500745017450274503745047450574506745077450874509745107451174512745137451474515745167451774518745197452074521745227452374524745257452674527745287452974530745317453274533745347453574536745377453874539745407454174542745437454474545745467454774548745497455074551745527455374554745557455674557745587455974560745617456274563745647456574566745677456874569745707457174572745737457474575745767457774578745797458074581745827458374584745857458674587745887458974590745917459274593745947459574596745977459874599746007460174602746037460474605746067460774608746097461074611746127461374614746157461674617746187461974620746217462274623746247462574626746277462874629746307463174632746337463474635746367463774638746397464074641746427464374644746457464674647746487464974650746517465274653746547465574656746577465874659746607466174662746637466474665746667466774668746697467074671746727467374674746757467674677746787467974680746817468274683746847468574686746877468874689746907469174692746937469474695746967469774698746997470074701747027470374704747057470674707747087470974710747117471274713747147471574716747177471874719747207472174722747237472474725747267472774728747297473074731747327473374734747357473674737747387473974740747417474274743747447474574746747477474874749747507475174752747537475474755747567475774758747597476074761747627476374764747657476674767747687476974770747717477274773747747477574776747777477874779747807478174782747837478474785747867478774788747897479074791747927479374794747957479674797747987479974800748017480274803748047480574806748077480874809748107481174812748137481474815748167481774818748197482074821748227482374824748257482674827748287482974830748317483274833748347483574836748377483874839748407484174842748437484474845748467484774848748497485074851748527485374854748557485674857748587485974860748617486274863748647486574866748677486874869748707487174872748737487474875748767487774878748797488074881748827488374884748857488674887748887488974890748917489274893748947489574896748977489874899749007490174902749037490474905749067490774908749097491074911749127491374914749157491674917749187491974920749217492274923749247492574926749277492874929749307493174932749337493474935749367493774938749397494074941749427494374944749457494674947749487494974950749517495274953749547495574956749577495874959749607496174962749637496474965749667496774968749697497074971749727497374974749757497674977749787497974980749817498274983749847498574986749877498874989749907499174992749937499474995749967499774998749997500075001750027500375004750057500675007750087500975010750117501275013750147501575016750177501875019750207502175022750237502475025750267502775028750297503075031750327503375034750357503675037750387503975040750417504275043750447504575046750477504875049750507505175052750537505475055750567505775058750597506075061750627506375064750657506675067750687506975070750717507275073750747507575076750777507875079750807508175082750837508475085750867508775088750897509075091750927509375094750957509675097750987509975100751017510275103751047510575106751077510875109751107511175112751137511475115751167511775118751197512075121751227512375124751257512675127751287512975130751317513275133751347513575136751377513875139751407514175142751437514475145751467514775148751497515075151751527515375154751557515675157751587515975160751617516275163751647516575166751677516875169751707517175172751737517475175751767517775178751797518075181751827518375184751857518675187751887518975190751917519275193751947519575196751977519875199752007520175202752037520475205752067520775208752097521075211752127521375214752157521675217752187521975220752217522275223752247522575226752277522875229752307523175232752337523475235752367523775238752397524075241752427524375244752457524675247752487524975250752517525275253752547525575256752577525875259752607526175262752637526475265752667526775268752697527075271752727527375274752757527675277752787527975280752817528275283752847528575286752877528875289752907529175292752937529475295752967529775298752997530075301753027530375304753057530675307753087530975310753117531275313753147531575316753177531875319753207532175322753237532475325753267532775328753297533075331753327533375334753357533675337753387533975340753417534275343753447534575346753477534875349753507535175352753537535475355753567535775358753597536075361753627536375364753657536675367753687536975370753717537275373753747537575376753777537875379753807538175382753837538475385753867538775388753897539075391753927539375394753957539675397753987539975400754017540275403754047540575406754077540875409754107541175412754137541475415754167541775418754197542075421754227542375424754257542675427754287542975430754317543275433754347543575436754377543875439754407544175442754437544475445754467544775448754497545075451754527545375454754557545675457754587545975460754617546275463754647546575466754677546875469754707547175472754737547475475754767547775478754797548075481754827548375484754857548675487754887548975490754917549275493754947549575496754977549875499755007550175502755037550475505755067550775508755097551075511755127551375514755157551675517755187551975520755217552275523755247552575526755277552875529755307553175532755337553475535755367553775538755397554075541755427554375544755457554675547755487554975550755517555275553755547555575556755577555875559755607556175562755637556475565755667556775568755697557075571755727557375574755757557675577755787557975580755817558275583755847558575586755877558875589755907559175592755937559475595755967559775598755997560075601756027560375604756057560675607756087560975610756117561275613756147561575616756177561875619756207562175622756237562475625756267562775628756297563075631756327563375634756357563675637756387563975640756417564275643756447564575646756477564875649756507565175652756537565475655756567565775658756597566075661756627566375664756657566675667756687566975670756717567275673756747567575676756777567875679756807568175682756837568475685756867568775688756897569075691756927569375694756957569675697756987569975700757017570275703757047570575706757077570875709757107571175712757137571475715757167571775718757197572075721757227572375724757257572675727757287572975730757317573275733757347573575736757377573875739757407574175742757437574475745757467574775748757497575075751757527575375754757557575675757757587575975760757617576275763757647576575766757677576875769757707577175772757737577475775757767577775778757797578075781757827578375784757857578675787757887578975790757917579275793757947579575796757977579875799758007580175802758037580475805758067580775808758097581075811758127581375814758157581675817758187581975820758217582275823758247582575826758277582875829758307583175832758337583475835758367583775838758397584075841758427584375844758457584675847758487584975850758517585275853758547585575856758577585875859758607586175862758637586475865758667586775868758697587075871758727587375874758757587675877758787587975880758817588275883758847588575886758877588875889758907589175892758937589475895758967589775898758997590075901759027590375904759057590675907759087590975910759117591275913759147591575916759177591875919759207592175922759237592475925759267592775928759297593075931759327593375934759357593675937759387593975940759417594275943759447594575946759477594875949759507595175952759537595475955759567595775958759597596075961759627596375964759657596675967759687596975970759717597275973759747597575976759777597875979759807598175982759837598475985759867598775988759897599075991759927599375994759957599675997759987599976000760017600276003760047600576006760077600876009760107601176012760137601476015760167601776018760197602076021760227602376024760257602676027760287602976030760317603276033760347603576036760377603876039760407604176042760437604476045760467604776048760497605076051760527605376054760557605676057760587605976060760617606276063760647606576066760677606876069760707607176072760737607476075760767607776078760797608076081760827608376084760857608676087760887608976090760917609276093760947609576096760977609876099761007610176102761037610476105761067610776108761097611076111761127611376114761157611676117761187611976120761217612276123761247612576126761277612876129761307613176132761337613476135761367613776138761397614076141761427614376144761457614676147761487614976150761517615276153761547615576156761577615876159761607616176162761637616476165761667616776168761697617076171761727617376174761757617676177761787617976180761817618276183761847618576186761877618876189761907619176192761937619476195761967619776198761997620076201762027620376204762057620676207762087620976210762117621276213762147621576216762177621876219762207622176222762237622476225762267622776228762297623076231762327623376234762357623676237762387623976240762417624276243762447624576246762477624876249762507625176252762537625476255762567625776258762597626076261762627626376264762657626676267762687626976270762717627276273762747627576276762777627876279762807628176282762837628476285762867628776288762897629076291762927629376294762957629676297762987629976300763017630276303763047630576306763077630876309763107631176312763137631476315763167631776318763197632076321763227632376324763257632676327763287632976330763317633276333763347633576336763377633876339763407634176342763437634476345763467634776348763497635076351763527635376354763557635676357763587635976360763617636276363763647636576366763677636876369763707637176372763737637476375763767637776378763797638076381763827638376384763857638676387763887638976390763917639276393763947639576396763977639876399764007640176402764037640476405764067640776408764097641076411764127641376414764157641676417764187641976420764217642276423764247642576426764277642876429764307643176432764337643476435764367643776438764397644076441764427644376444764457644676447764487644976450764517645276453764547645576456764577645876459764607646176462764637646476465764667646776468764697647076471764727647376474764757647676477764787647976480764817648276483764847648576486764877648876489764907649176492764937649476495764967649776498764997650076501765027650376504765057650676507765087650976510765117651276513765147651576516765177651876519765207652176522765237652476525765267652776528765297653076531765327653376534765357653676537765387653976540765417654276543765447654576546765477654876549765507655176552765537655476555765567655776558765597656076561765627656376564765657656676567765687656976570765717657276573765747657576576765777657876579765807658176582765837658476585765867658776588765897659076591765927659376594765957659676597765987659976600766017660276603766047660576606766077660876609766107661176612766137661476615766167661776618766197662076621766227662376624766257662676627766287662976630766317663276633766347663576636766377663876639766407664176642766437664476645766467664776648766497665076651766527665376654766557665676657766587665976660766617666276663766647666576666766677666876669766707667176672766737667476675766767667776678766797668076681766827668376684766857668676687766887668976690766917669276693766947669576696766977669876699767007670176702767037670476705767067670776708767097671076711767127671376714767157671676717767187671976720767217672276723767247672576726767277672876729767307673176732767337673476735767367673776738767397674076741767427674376744767457674676747767487674976750767517675276753767547675576756767577675876759767607676176762767637676476765767667676776768767697677076771767727677376774767757677676777767787677976780767817678276783767847678576786767877678876789767907679176792767937679476795767967679776798767997680076801768027680376804768057680676807768087680976810768117681276813768147681576816768177681876819768207682176822768237682476825768267682776828768297683076831768327683376834768357683676837768387683976840768417684276843768447684576846768477684876849768507685176852768537685476855768567685776858768597686076861768627686376864768657686676867768687686976870768717687276873768747687576876768777687876879768807688176882768837688476885768867688776888768897689076891768927689376894768957689676897768987689976900769017690276903769047690576906769077690876909769107691176912769137691476915769167691776918769197692076921769227692376924769257692676927769287692976930769317693276933769347693576936769377693876939769407694176942769437694476945769467694776948769497695076951769527695376954769557695676957769587695976960769617696276963769647696576966769677696876969769707697176972769737697476975769767697776978769797698076981769827698376984769857698676987769887698976990769917699276993769947699576996769977699876999770007700177002770037700477005770067700777008770097701077011770127701377014770157701677017770187701977020770217702277023770247702577026770277702877029770307703177032770337703477035770367703777038770397704077041770427704377044770457704677047770487704977050770517705277053770547705577056770577705877059770607706177062770637706477065770667706777068770697707077071770727707377074770757707677077770787707977080770817708277083770847708577086770877708877089770907709177092770937709477095770967709777098770997710077101771027710377104771057710677107771087710977110771117711277113771147711577116771177711877119771207712177122771237712477125771267712777128771297713077131771327713377134771357713677137771387713977140771417714277143771447714577146771477714877149771507715177152771537715477155771567715777158771597716077161771627716377164771657716677167771687716977170771717717277173771747717577176771777717877179771807718177182771837718477185771867718777188771897719077191771927719377194771957719677197771987719977200772017720277203772047720577206772077720877209772107721177212772137721477215772167721777218772197722077221772227722377224772257722677227772287722977230772317723277233772347723577236772377723877239772407724177242772437724477245772467724777248772497725077251772527725377254772557725677257772587725977260772617726277263772647726577266772677726877269772707727177272772737727477275772767727777278772797728077281772827728377284772857728677287772887728977290772917729277293772947729577296772977729877299773007730177302773037730477305773067730777308773097731077311773127731377314773157731677317773187731977320773217732277323773247732577326773277732877329773307733177332773337733477335773367733777338773397734077341773427734377344773457734677347773487734977350773517735277353773547735577356773577735877359773607736177362773637736477365773667736777368773697737077371773727737377374773757737677377773787737977380773817738277383773847738577386773877738877389773907739177392773937739477395773967739777398773997740077401774027740377404774057740677407774087740977410774117741277413774147741577416774177741877419774207742177422774237742477425774267742777428774297743077431774327743377434774357743677437774387743977440774417744277443774447744577446774477744877449774507745177452774537745477455774567745777458774597746077461774627746377464774657746677467774687746977470774717747277473774747747577476774777747877479774807748177482774837748477485774867748777488774897749077491774927749377494774957749677497774987749977500775017750277503775047750577506775077750877509775107751177512775137751477515775167751777518775197752077521775227752377524775257752677527775287752977530775317753277533775347753577536775377753877539775407754177542775437754477545775467754777548775497755077551775527755377554775557755677557775587755977560775617756277563775647756577566775677756877569775707757177572775737757477575775767757777578775797758077581775827758377584775857758677587775887758977590775917759277593775947759577596775977759877599776007760177602776037760477605776067760777608776097761077611776127761377614776157761677617776187761977620776217762277623776247762577626776277762877629776307763177632776337763477635776367763777638776397764077641776427764377644776457764677647776487764977650776517765277653776547765577656776577765877659776607766177662776637766477665776667766777668776697767077671776727767377674776757767677677776787767977680776817768277683776847768577686776877768877689776907769177692776937769477695776967769777698776997770077701777027770377704777057770677707777087770977710777117771277713777147771577716777177771877719777207772177722777237772477725777267772777728777297773077731777327773377734777357773677737777387773977740777417774277743777447774577746777477774877749777507775177752777537775477755777567775777758777597776077761777627776377764777657776677767777687776977770777717777277773777747777577776777777777877779777807778177782777837778477785777867778777788777897779077791777927779377794777957779677797777987779977800778017780277803778047780577806778077780877809778107781177812778137781477815778167781777818778197782077821778227782377824778257782677827778287782977830778317783277833778347783577836778377783877839778407784177842778437784477845778467784777848778497785077851778527785377854778557785677857778587785977860778617786277863778647786577866778677786877869778707787177872778737787477875778767787777878778797788077881778827788377884778857788677887778887788977890778917789277893778947789577896778977789877899779007790177902779037790477905779067790777908779097791077911779127791377914779157791677917779187791977920779217792277923779247792577926779277792877929779307793177932779337793477935779367793777938779397794077941779427794377944779457794677947779487794977950779517795277953779547795577956779577795877959779607796177962779637796477965779667796777968779697797077971779727797377974779757797677977779787797977980779817798277983779847798577986779877798877989779907799177992779937799477995779967799777998779997800078001780027800378004780057800678007780087800978010780117801278013780147801578016780177801878019780207802178022780237802478025780267802778028780297803078031780327803378034780357803678037780387803978040780417804278043780447804578046780477804878049780507805178052780537805478055780567805778058780597806078061780627806378064780657806678067780687806978070780717807278073780747807578076780777807878079780807808178082780837808478085780867808778088780897809078091780927809378094780957809678097780987809978100781017810278103781047810578106781077810878109781107811178112781137811478115781167811778118781197812078121781227812378124781257812678127781287812978130781317813278133781347813578136781377813878139781407814178142781437814478145781467814778148781497815078151781527815378154781557815678157781587815978160781617816278163781647816578166781677816878169781707817178172781737817478175781767817778178781797818078181781827818378184781857818678187781887818978190781917819278193781947819578196781977819878199782007820178202782037820478205782067820778208782097821078211782127821378214782157821678217782187821978220782217822278223782247822578226782277822878229782307823178232782337823478235782367823778238782397824078241782427824378244782457824678247782487824978250782517825278253782547825578256782577825878259782607826178262782637826478265782667826778268782697827078271782727827378274782757827678277782787827978280782817828278283782847828578286782877828878289782907829178292782937829478295782967829778298782997830078301783027830378304783057830678307783087830978310783117831278313783147831578316783177831878319783207832178322783237832478325783267832778328783297833078331783327833378334783357833678337783387833978340783417834278343783447834578346783477834878349783507835178352783537835478355783567835778358783597836078361783627836378364783657836678367783687836978370783717837278373783747837578376783777837878379783807838178382783837838478385783867838778388783897839078391783927839378394783957839678397783987839978400784017840278403784047840578406784077840878409784107841178412784137841478415784167841778418784197842078421784227842378424784257842678427784287842978430784317843278433784347843578436784377843878439784407844178442784437844478445784467844778448784497845078451784527845378454784557845678457784587845978460784617846278463784647846578466784677846878469784707847178472784737847478475784767847778478784797848078481784827848378484784857848678487784887848978490784917849278493784947849578496784977849878499785007850178502785037850478505785067850778508785097851078511785127851378514785157851678517785187851978520785217852278523785247852578526785277852878529785307853178532785337853478535785367853778538785397854078541785427854378544785457854678547785487854978550785517855278553785547855578556785577855878559785607856178562785637856478565785667856778568785697857078571785727857378574785757857678577785787857978580785817858278583785847858578586785877858878589785907859178592785937859478595785967859778598785997860078601786027860378604786057860678607786087860978610786117861278613786147861578616786177861878619786207862178622786237862478625786267862778628786297863078631786327863378634786357863678637786387863978640786417864278643786447864578646786477864878649786507865178652786537865478655786567865778658786597866078661786627866378664786657866678667786687866978670786717867278673786747867578676786777867878679786807868178682786837868478685786867868778688786897869078691786927869378694786957869678697786987869978700787017870278703787047870578706787077870878709787107871178712787137871478715787167871778718787197872078721787227872378724787257872678727787287872978730787317873278733787347873578736787377873878739787407874178742787437874478745787467874778748787497875078751787527875378754787557875678757787587875978760787617876278763787647876578766787677876878769787707877178772787737877478775787767877778778787797878078781787827878378784787857878678787787887878978790787917879278793787947879578796787977879878799788007880178802788037880478805788067880778808788097881078811788127881378814788157881678817788187881978820788217882278823788247882578826788277882878829788307883178832788337883478835788367883778838788397884078841788427884378844788457884678847788487884978850788517885278853788547885578856788577885878859788607886178862788637886478865788667886778868788697887078871788727887378874788757887678877788787887978880788817888278883788847888578886788877888878889788907889178892788937889478895788967889778898788997890078901789027890378904789057890678907789087890978910789117891278913789147891578916789177891878919789207892178922789237892478925789267892778928789297893078931789327893378934789357893678937789387893978940789417894278943789447894578946789477894878949789507895178952789537895478955789567895778958789597896078961789627896378964789657896678967789687896978970789717897278973789747897578976789777897878979789807898178982789837898478985789867898778988789897899078991789927899378994789957899678997789987899979000790017900279003790047900579006790077900879009790107901179012790137901479015790167901779018790197902079021790227902379024790257902679027790287902979030790317903279033790347903579036790377903879039790407904179042790437904479045790467904779048790497905079051790527905379054790557905679057790587905979060790617906279063
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * JavaScript code in this page
  4. *
  5. * Copyright 2022 Mozilla Foundation
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. *
  19. * @licend The above is the entire license notice for the
  20. * JavaScript code in this page
  21. */
  22. (function webpackUniversalModuleDefinition(root, factory) {
  23. if(typeof exports === 'object' && typeof module === 'object')
  24. module.exports = factory();
  25. else if(typeof define === 'function' && define.amd)
  26. define("pdfjs-dist/build/pdf.worker", [], factory);
  27. else if(typeof exports === 'object')
  28. exports["pdfjs-dist/build/pdf.worker"] = factory();
  29. else
  30. root["pdfjs-dist/build/pdf.worker"] = root.pdfjsWorker = factory();
  31. })(globalThis, () => {
  32. return /******/ (() => { // webpackBootstrap
  33. /******/ 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 _primitives = __w_pdfjs_require__(130);
  44. var _core_utils = __w_pdfjs_require__(131);
  45. var _pdf_manager = __w_pdfjs_require__(133);
  46. var _cleanup_helper = __w_pdfjs_require__(196);
  47. var _writer = __w_pdfjs_require__(190);
  48. var _is_node = __w_pdfjs_require__(4);
  49. var _message_handler = __w_pdfjs_require__(227);
  50. var _worker_stream = __w_pdfjs_require__(228);
  51. class WorkerTask {
  52. constructor(name) {
  53. this.name = name;
  54. this.terminated = false;
  55. this._capability = (0, _util.createPromiseCapability)();
  56. }
  57. get finished() {
  58. return this._capability.promise;
  59. }
  60. finish() {
  61. this._capability.resolve();
  62. }
  63. terminate() {
  64. this.terminated = true;
  65. }
  66. ensureNotTerminated() {
  67. if (this.terminated) {
  68. throw new Error("Worker task was terminated");
  69. }
  70. }
  71. }
  72. exports.WorkerTask = WorkerTask;
  73. class WorkerMessageHandler {
  74. static setup(handler, port) {
  75. let testMessageProcessed = false;
  76. handler.on("test", function wphSetupTest(data) {
  77. if (testMessageProcessed) {
  78. return;
  79. }
  80. testMessageProcessed = true;
  81. handler.send("test", data instanceof Uint8Array);
  82. });
  83. handler.on("configure", function wphConfigure(data) {
  84. (0, _util.setVerbosityLevel)(data.verbosity);
  85. });
  86. handler.on("GetDocRequest", function wphSetupDoc(data) {
  87. return WorkerMessageHandler.createDocumentHandler(data, port);
  88. });
  89. }
  90. static createDocumentHandler(docParams, port) {
  91. let pdfManager;
  92. let terminated = false;
  93. let cancelXHRs = null;
  94. const WorkerTasks = [];
  95. const verbosity = (0, _util.getVerbosityLevel)();
  96. const apiVersion = docParams.apiVersion;
  97. const workerVersion = '2.16.105';
  98. if (apiVersion !== workerVersion) {
  99. throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
  100. }
  101. const enumerableProperties = [];
  102. for (const property in []) {
  103. enumerableProperties.push(property);
  104. }
  105. if (enumerableProperties.length) {
  106. throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s.");
  107. }
  108. if (typeof ReadableStream === "undefined") {
  109. const partialMsg = "The browser/environment lacks native support for critical " + "functionality used by the PDF.js library (e.g. `ReadableStream`); ";
  110. if (_is_node.isNodeJS) {
  111. throw new Error(partialMsg + "please use a `legacy`-build instead.");
  112. }
  113. throw new Error(partialMsg + "please update to a supported browser.");
  114. }
  115. const docId = docParams.docId;
  116. const docBaseUrl = docParams.docBaseUrl;
  117. const workerHandlerName = docParams.docId + "_worker";
  118. let handler = new _message_handler.MessageHandler(workerHandlerName, docId, port);
  119. function ensureNotTerminated() {
  120. if (terminated) {
  121. throw new Error("Worker was terminated");
  122. }
  123. }
  124. function startWorkerTask(task) {
  125. WorkerTasks.push(task);
  126. }
  127. function finishWorkerTask(task) {
  128. task.finish();
  129. const i = WorkerTasks.indexOf(task);
  130. WorkerTasks.splice(i, 1);
  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(data, evaluatorOptions, enableXfa) {
  153. const pdfManagerCapability = (0, _util.createPromiseCapability)();
  154. let newPdfManager;
  155. const source = data.source;
  156. if (source.data) {
  157. try {
  158. newPdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, handler, evaluatorOptions, enableXfa, docBaseUrl);
  159. pdfManagerCapability.resolve(newPdfManager);
  160. } catch (ex) {
  161. pdfManagerCapability.reject(ex);
  162. }
  163. return pdfManagerCapability.promise;
  164. }
  165. let pdfStream,
  166. cachedChunks = [];
  167. try {
  168. pdfStream = new _worker_stream.PDFWorkerStream(handler);
  169. } catch (ex) {
  170. pdfManagerCapability.reject(ex);
  171. return pdfManagerCapability.promise;
  172. }
  173. const fullRequest = pdfStream.getFullReader();
  174. fullRequest.headersReady.then(function () {
  175. if (!fullRequest.isRangeSupported) {
  176. return;
  177. }
  178. const disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
  179. newPdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {
  180. msgHandler: handler,
  181. password: source.password,
  182. length: fullRequest.contentLength,
  183. disableAutoFetch,
  184. rangeChunkSize: source.rangeChunkSize
  185. }, evaluatorOptions, enableXfa, docBaseUrl);
  186. for (const chunk of cachedChunks) {
  187. newPdfManager.sendProgressiveData(chunk);
  188. }
  189. cachedChunks = [];
  190. pdfManagerCapability.resolve(newPdfManager);
  191. cancelXHRs = null;
  192. }).catch(function (reason) {
  193. pdfManagerCapability.reject(reason);
  194. cancelXHRs = null;
  195. });
  196. let loaded = 0;
  197. const flushChunks = function () {
  198. const pdfFile = (0, _util.arraysToBytes)(cachedChunks);
  199. if (source.length && pdfFile.length !== source.length) {
  200. (0, _util.warn)("reported HTTP length is different from actual");
  201. }
  202. try {
  203. newPdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, handler, evaluatorOptions, enableXfa, docBaseUrl);
  204. pdfManagerCapability.resolve(newPdfManager);
  205. } catch (ex) {
  206. pdfManagerCapability.reject(ex);
  207. }
  208. cachedChunks = [];
  209. };
  210. const readPromise = new Promise(function (resolve, reject) {
  211. const readChunk = function (_ref) {
  212. let {
  213. value,
  214. done
  215. } = _ref;
  216. try {
  217. ensureNotTerminated();
  218. if (done) {
  219. if (!newPdfManager) {
  220. flushChunks();
  221. }
  222. cancelXHRs = null;
  223. return;
  224. }
  225. loaded += (0, _util.arrayByteLength)(value);
  226. if (!fullRequest.isStreamingSupported) {
  227. handler.send("DocProgress", {
  228. loaded,
  229. total: Math.max(loaded, fullRequest.contentLength || 0)
  230. });
  231. }
  232. if (newPdfManager) {
  233. newPdfManager.sendProgressiveData(value);
  234. } else {
  235. cachedChunks.push(value);
  236. }
  237. fullRequest.read().then(readChunk, reject);
  238. } catch (e) {
  239. reject(e);
  240. }
  241. };
  242. fullRequest.read().then(readChunk, reject);
  243. });
  244. readPromise.catch(function (e) {
  245. pdfManagerCapability.reject(e);
  246. cancelXHRs = null;
  247. });
  248. cancelXHRs = function (reason) {
  249. pdfStream.cancelAllRequests(reason);
  250. };
  251. return pdfManagerCapability.promise;
  252. }
  253. function setupDoc(data) {
  254. function onSuccess(doc) {
  255. ensureNotTerminated();
  256. handler.send("GetDoc", {
  257. pdfInfo: doc
  258. });
  259. }
  260. function onFailure(ex) {
  261. ensureNotTerminated();
  262. if (ex instanceof _util.PasswordException) {
  263. const task = new WorkerTask(`PasswordException: response ${ex.code}`);
  264. startWorkerTask(task);
  265. handler.sendWithPromise("PasswordRequest", ex).then(function (_ref2) {
  266. let {
  267. password
  268. } = _ref2;
  269. finishWorkerTask(task);
  270. pdfManager.updatePassword(password);
  271. pdfManagerReady();
  272. }).catch(function () {
  273. finishWorkerTask(task);
  274. handler.send("DocException", ex);
  275. });
  276. } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) {
  277. handler.send("DocException", ex);
  278. } else {
  279. handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString()));
  280. }
  281. }
  282. function pdfManagerReady() {
  283. ensureNotTerminated();
  284. loadDocument(false).then(onSuccess, function (reason) {
  285. ensureNotTerminated();
  286. if (!(reason instanceof _core_utils.XRefParseException)) {
  287. onFailure(reason);
  288. return;
  289. }
  290. pdfManager.requestLoadedStream();
  291. pdfManager.onLoadedStream().then(function () {
  292. ensureNotTerminated();
  293. loadDocument(true).then(onSuccess, onFailure);
  294. });
  295. });
  296. }
  297. ensureNotTerminated();
  298. const evaluatorOptions = {
  299. maxImageSize: data.maxImageSize,
  300. disableFontFace: data.disableFontFace,
  301. ignoreErrors: data.ignoreErrors,
  302. isEvalSupported: data.isEvalSupported,
  303. fontExtraProperties: data.fontExtraProperties,
  304. useSystemFonts: data.useSystemFonts,
  305. cMapUrl: data.cMapUrl,
  306. standardFontDataUrl: data.standardFontDataUrl
  307. };
  308. getPdfManager(data, evaluatorOptions, data.enableXfa).then(function (newPdfManager) {
  309. if (terminated) {
  310. newPdfManager.terminate(new _util.AbortException("Worker was terminated."));
  311. throw new Error("Worker was terminated");
  312. }
  313. pdfManager = newPdfManager;
  314. pdfManager.onLoadedStream().then(function (stream) {
  315. handler.send("DataLoaded", {
  316. length: stream.bytes.byteLength
  317. });
  318. });
  319. }).then(pdfManagerReady, onFailure);
  320. }
  321. handler.on("GetPage", function wphSetupGetPage(data) {
  322. return pdfManager.getPage(data.pageIndex).then(function (page) {
  323. return Promise.all([pdfManager.ensure(page, "rotate"), pdfManager.ensure(page, "ref"), pdfManager.ensure(page, "userUnit"), pdfManager.ensure(page, "view")]).then(function (_ref3) {
  324. let [rotate, ref, userUnit, view] = _ref3;
  325. return {
  326. rotate,
  327. ref,
  328. userUnit,
  329. view
  330. };
  331. });
  332. });
  333. });
  334. handler.on("GetPageIndex", function wphSetupGetPageIndex(data) {
  335. const pageRef = _primitives.Ref.get(data.num, data.gen);
  336. return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  337. });
  338. handler.on("GetDestinations", function wphSetupGetDestinations(data) {
  339. return pdfManager.ensureCatalog("destinations");
  340. });
  341. handler.on("GetDestination", function wphSetupGetDestination(data) {
  342. return pdfManager.ensureCatalog("getDestination", [data.id]);
  343. });
  344. handler.on("GetPageLabels", function wphSetupGetPageLabels(data) {
  345. return pdfManager.ensureCatalog("pageLabels");
  346. });
  347. handler.on("GetPageLayout", function wphSetupGetPageLayout(data) {
  348. return pdfManager.ensureCatalog("pageLayout");
  349. });
  350. handler.on("GetPageMode", function wphSetupGetPageMode(data) {
  351. return pdfManager.ensureCatalog("pageMode");
  352. });
  353. handler.on("GetViewerPreferences", function (data) {
  354. return pdfManager.ensureCatalog("viewerPreferences");
  355. });
  356. handler.on("GetOpenAction", function (data) {
  357. return pdfManager.ensureCatalog("openAction");
  358. });
  359. handler.on("GetAttachments", function wphSetupGetAttachments(data) {
  360. return pdfManager.ensureCatalog("attachments");
  361. });
  362. handler.on("GetJavaScript", function wphSetupGetJavaScript(data) {
  363. return pdfManager.ensureCatalog("javaScript");
  364. });
  365. handler.on("GetDocJSActions", function wphSetupGetDocJSActions(data) {
  366. return pdfManager.ensureCatalog("jsActions");
  367. });
  368. handler.on("GetPageJSActions", function (_ref4) {
  369. let {
  370. pageIndex
  371. } = _ref4;
  372. return pdfManager.getPage(pageIndex).then(function (page) {
  373. return pdfManager.ensure(page, "jsActions");
  374. });
  375. });
  376. handler.on("GetOutline", function wphSetupGetOutline(data) {
  377. return pdfManager.ensureCatalog("documentOutline");
  378. });
  379. handler.on("GetOptionalContentConfig", function (data) {
  380. return pdfManager.ensureCatalog("optionalContentConfig");
  381. });
  382. handler.on("GetPermissions", function (data) {
  383. return pdfManager.ensureCatalog("permissions");
  384. });
  385. handler.on("GetMetadata", function wphSetupGetMetadata(data) {
  386. return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]);
  387. });
  388. handler.on("GetMarkInfo", function wphSetupGetMarkInfo(data) {
  389. return pdfManager.ensureCatalog("markInfo");
  390. });
  391. handler.on("GetData", function wphSetupGetData(data) {
  392. pdfManager.requestLoadedStream();
  393. return pdfManager.onLoadedStream().then(function (stream) {
  394. return stream.bytes;
  395. });
  396. });
  397. handler.on("GetAnnotations", function (_ref5) {
  398. let {
  399. pageIndex,
  400. intent
  401. } = _ref5;
  402. return pdfManager.getPage(pageIndex).then(function (page) {
  403. const task = new WorkerTask(`GetAnnotations: page ${pageIndex}`);
  404. startWorkerTask(task);
  405. return page.getAnnotationsData(handler, task, intent).then(data => {
  406. finishWorkerTask(task);
  407. return data;
  408. }, reason => {
  409. finishWorkerTask(task);
  410. });
  411. });
  412. });
  413. handler.on("GetFieldObjects", function (data) {
  414. return pdfManager.ensureDoc("fieldObjects");
  415. });
  416. handler.on("HasJSActions", function (data) {
  417. return pdfManager.ensureDoc("hasJSActions");
  418. });
  419. handler.on("GetCalculationOrderIds", function (data) {
  420. return pdfManager.ensureDoc("calculationOrderIds");
  421. });
  422. handler.on("SaveDocument", function (_ref6) {
  423. let {
  424. isPureXfa,
  425. numPages,
  426. annotationStorage,
  427. filename
  428. } = _ref6;
  429. pdfManager.requestLoadedStream();
  430. const newAnnotationsByPage = !isPureXfa ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null;
  431. const promises = [pdfManager.onLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("startXRef")];
  432. if (newAnnotationsByPage) {
  433. for (const [pageIndex, annotations] of newAnnotationsByPage) {
  434. promises.push(pdfManager.getPage(pageIndex).then(page => {
  435. const task = new WorkerTask(`Save (editor): page ${pageIndex}`);
  436. return page.saveNewAnnotations(handler, task, annotations).finally(function () {
  437. finishWorkerTask(task);
  438. });
  439. }));
  440. }
  441. }
  442. if (isPureXfa) {
  443. promises.push(pdfManager.serializeXfaData(annotationStorage));
  444. } else {
  445. for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
  446. promises.push(pdfManager.getPage(pageIndex).then(function (page) {
  447. const task = new WorkerTask(`Save: page ${pageIndex}`);
  448. return page.save(handler, task, annotationStorage).finally(function () {
  449. finishWorkerTask(task);
  450. });
  451. }));
  452. }
  453. }
  454. return Promise.all(promises).then(function (_ref7) {
  455. let [stream, acroForm, acroFormRef, xref, startXRef, ...refs] = _ref7;
  456. let newRefs = [];
  457. let xfaData = null;
  458. if (isPureXfa) {
  459. xfaData = refs[0];
  460. if (!xfaData) {
  461. return stream.bytes;
  462. }
  463. } else {
  464. newRefs = refs.flat(2);
  465. if (newRefs.length === 0) {
  466. return stream.bytes;
  467. }
  468. }
  469. const xfa = acroForm instanceof _primitives.Dict && acroForm.get("XFA") || null;
  470. let xfaDatasetsRef = null;
  471. let hasXfaDatasetsEntry = false;
  472. if (Array.isArray(xfa)) {
  473. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  474. if (xfa[i] === "datasets") {
  475. xfaDatasetsRef = xfa[i + 1];
  476. acroFormRef = null;
  477. hasXfaDatasetsEntry = true;
  478. }
  479. }
  480. if (xfaDatasetsRef === null) {
  481. xfaDatasetsRef = xref.getNewRef();
  482. }
  483. } else if (xfa) {
  484. acroFormRef = null;
  485. (0, _util.warn)("Unsupported XFA type.");
  486. }
  487. let newXrefInfo = Object.create(null);
  488. if (xref.trailer) {
  489. const infoObj = Object.create(null);
  490. const xrefInfo = xref.trailer.get("Info") || null;
  491. if (xrefInfo instanceof _primitives.Dict) {
  492. xrefInfo.forEach((key, value) => {
  493. if (typeof value === "string") {
  494. infoObj[key] = (0, _util.stringToPDFString)(value);
  495. }
  496. });
  497. }
  498. newXrefInfo = {
  499. rootRef: xref.trailer.getRaw("Root") || null,
  500. encryptRef: xref.trailer.getRaw("Encrypt") || null,
  501. newRef: xref.getNewRef(),
  502. infoRef: xref.trailer.getRaw("Info") || null,
  503. info: infoObj,
  504. fileIds: xref.trailer.get("ID") || null,
  505. startXRef,
  506. filename
  507. };
  508. }
  509. xref.resetNewRef();
  510. return (0, _writer.incrementalUpdate)({
  511. originalData: stream.bytes,
  512. xrefInfo: newXrefInfo,
  513. newRefs,
  514. xref,
  515. hasXfa: !!xfa,
  516. xfaDatasetsRef,
  517. hasXfaDatasetsEntry,
  518. acroFormRef,
  519. acroForm,
  520. xfaData
  521. });
  522. });
  523. });
  524. handler.on("GetOperatorList", function wphSetupRenderPage(data, sink) {
  525. const pageIndex = data.pageIndex;
  526. pdfManager.getPage(pageIndex).then(function (page) {
  527. const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
  528. startWorkerTask(task);
  529. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  530. page.getOperatorList({
  531. handler,
  532. sink,
  533. task,
  534. intent: data.intent,
  535. cacheKey: data.cacheKey,
  536. annotationStorage: data.annotationStorage
  537. }).then(function (operatorListInfo) {
  538. finishWorkerTask(task);
  539. if (start) {
  540. (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
  541. }
  542. sink.close();
  543. }, function (reason) {
  544. finishWorkerTask(task);
  545. if (task.terminated) {
  546. return;
  547. }
  548. handler.send("UnsupportedFeature", {
  549. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  550. });
  551. sink.error(reason);
  552. });
  553. });
  554. });
  555. handler.on("GetTextContent", function wphExtractText(data, sink) {
  556. const pageIndex = data.pageIndex;
  557. pdfManager.getPage(pageIndex).then(function (page) {
  558. const task = new WorkerTask("GetTextContent: page " + pageIndex);
  559. startWorkerTask(task);
  560. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  561. page.extractTextContent({
  562. handler,
  563. task,
  564. sink,
  565. includeMarkedContent: data.includeMarkedContent,
  566. combineTextItems: data.combineTextItems
  567. }).then(function () {
  568. finishWorkerTask(task);
  569. if (start) {
  570. (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
  571. }
  572. sink.close();
  573. }, function (reason) {
  574. finishWorkerTask(task);
  575. if (task.terminated) {
  576. return;
  577. }
  578. sink.error(reason);
  579. });
  580. });
  581. });
  582. handler.on("GetStructTree", function wphGetStructTree(data) {
  583. return pdfManager.getPage(data.pageIndex).then(function (page) {
  584. return pdfManager.ensure(page, "getStructTree");
  585. });
  586. });
  587. handler.on("FontFallback", function (data) {
  588. return pdfManager.fontFallback(data.id, handler);
  589. });
  590. handler.on("Cleanup", function wphCleanup(data) {
  591. return pdfManager.cleanup(true);
  592. });
  593. handler.on("Terminate", function wphTerminate(data) {
  594. terminated = true;
  595. const waitOn = [];
  596. if (pdfManager) {
  597. pdfManager.terminate(new _util.AbortException("Worker was terminated."));
  598. const cleanupPromise = pdfManager.cleanup();
  599. waitOn.push(cleanupPromise);
  600. pdfManager = null;
  601. } else {
  602. (0, _cleanup_helper.clearGlobalCaches)();
  603. }
  604. if (cancelXHRs) {
  605. cancelXHRs(new _util.AbortException("Worker was terminated."));
  606. }
  607. for (const task of WorkerTasks) {
  608. waitOn.push(task.finished);
  609. task.terminate();
  610. }
  611. return Promise.all(waitOn).then(function () {
  612. handler.destroy();
  613. handler = null;
  614. });
  615. });
  616. handler.on("Ready", function wphReady(data) {
  617. setupDoc(docParams);
  618. docParams = null;
  619. });
  620. return workerHandlerName;
  621. }
  622. static initializeFromPort(port) {
  623. const handler = new _message_handler.MessageHandler("worker", "main", port);
  624. WorkerMessageHandler.setup(handler, port);
  625. handler.send("ready", null);
  626. }
  627. }
  628. exports.WorkerMessageHandler = WorkerMessageHandler;
  629. function isMessagePort(maybePort) {
  630. return typeof maybePort.postMessage === "function" && "onmessage" in maybePort;
  631. }
  632. if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) {
  633. WorkerMessageHandler.initializeFromPort(self);
  634. }
  635. /***/ }),
  636. /* 2 */
  637. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  638. "use strict";
  639. Object.defineProperty(exports, "__esModule", ({
  640. value: true
  641. }));
  642. exports.VerbosityLevel = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.UNSUPPORTED_FEATURES = exports.TextRenderingMode = exports.StreamType = exports.RenderingIntentFlag = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.LINE_FACTOR = exports.LINE_DESCENT_FACTOR = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FontType = exports.FeatureTest = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = exports.CMapCompressionType = exports.BaseException = exports.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;
  643. exports.arrayByteLength = arrayByteLength;
  644. exports.arraysToBytes = arraysToBytes;
  645. exports.assert = assert;
  646. exports.bytesToString = bytesToString;
  647. exports.createPromiseCapability = createPromiseCapability;
  648. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  649. exports.escapeString = escapeString;
  650. exports.getModificationDate = getModificationDate;
  651. exports.getVerbosityLevel = getVerbosityLevel;
  652. exports.info = info;
  653. exports.isArrayBuffer = isArrayBuffer;
  654. exports.isArrayEqual = isArrayEqual;
  655. exports.isAscii = isAscii;
  656. exports.objectFromMap = objectFromMap;
  657. exports.objectSize = objectSize;
  658. exports.setVerbosityLevel = setVerbosityLevel;
  659. exports.shadow = shadow;
  660. exports.string32 = string32;
  661. exports.stringToBytes = stringToBytes;
  662. exports.stringToPDFString = stringToPDFString;
  663. exports.stringToUTF16BEString = stringToUTF16BEString;
  664. exports.stringToUTF8String = stringToUTF8String;
  665. exports.unreachable = unreachable;
  666. exports.utf8StringToString = utf8StringToString;
  667. exports.warn = warn;
  668. __w_pdfjs_require__(3);
  669. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  670. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  671. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  672. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  673. const LINE_FACTOR = 1.35;
  674. exports.LINE_FACTOR = LINE_FACTOR;
  675. const LINE_DESCENT_FACTOR = 0.35;
  676. exports.LINE_DESCENT_FACTOR = LINE_DESCENT_FACTOR;
  677. const RenderingIntentFlag = {
  678. ANY: 0x01,
  679. DISPLAY: 0x02,
  680. PRINT: 0x04,
  681. ANNOTATIONS_FORMS: 0x10,
  682. ANNOTATIONS_STORAGE: 0x20,
  683. ANNOTATIONS_DISABLE: 0x40,
  684. OPLIST: 0x100
  685. };
  686. exports.RenderingIntentFlag = RenderingIntentFlag;
  687. const AnnotationMode = {
  688. DISABLE: 0,
  689. ENABLE: 1,
  690. ENABLE_FORMS: 2,
  691. ENABLE_STORAGE: 3
  692. };
  693. exports.AnnotationMode = AnnotationMode;
  694. const AnnotationEditorPrefix = "pdfjs_internal_editor_";
  695. exports.AnnotationEditorPrefix = AnnotationEditorPrefix;
  696. const AnnotationEditorType = {
  697. DISABLE: -1,
  698. NONE: 0,
  699. FREETEXT: 3,
  700. INK: 15
  701. };
  702. exports.AnnotationEditorType = AnnotationEditorType;
  703. const AnnotationEditorParamsType = {
  704. FREETEXT_SIZE: 1,
  705. FREETEXT_COLOR: 2,
  706. FREETEXT_OPACITY: 3,
  707. INK_COLOR: 11,
  708. INK_THICKNESS: 12,
  709. INK_OPACITY: 13
  710. };
  711. exports.AnnotationEditorParamsType = AnnotationEditorParamsType;
  712. const PermissionFlag = {
  713. PRINT: 0x04,
  714. MODIFY_CONTENTS: 0x08,
  715. COPY: 0x10,
  716. MODIFY_ANNOTATIONS: 0x20,
  717. FILL_INTERACTIVE_FORMS: 0x100,
  718. COPY_FOR_ACCESSIBILITY: 0x200,
  719. ASSEMBLE: 0x400,
  720. PRINT_HIGH_QUALITY: 0x800
  721. };
  722. exports.PermissionFlag = PermissionFlag;
  723. const TextRenderingMode = {
  724. FILL: 0,
  725. STROKE: 1,
  726. FILL_STROKE: 2,
  727. INVISIBLE: 3,
  728. FILL_ADD_TO_PATH: 4,
  729. STROKE_ADD_TO_PATH: 5,
  730. FILL_STROKE_ADD_TO_PATH: 6,
  731. ADD_TO_PATH: 7,
  732. FILL_STROKE_MASK: 3,
  733. ADD_TO_PATH_FLAG: 4
  734. };
  735. exports.TextRenderingMode = TextRenderingMode;
  736. const ImageKind = {
  737. GRAYSCALE_1BPP: 1,
  738. RGB_24BPP: 2,
  739. RGBA_32BPP: 3
  740. };
  741. exports.ImageKind = ImageKind;
  742. const AnnotationType = {
  743. TEXT: 1,
  744. LINK: 2,
  745. FREETEXT: 3,
  746. LINE: 4,
  747. SQUARE: 5,
  748. CIRCLE: 6,
  749. POLYGON: 7,
  750. POLYLINE: 8,
  751. HIGHLIGHT: 9,
  752. UNDERLINE: 10,
  753. SQUIGGLY: 11,
  754. STRIKEOUT: 12,
  755. STAMP: 13,
  756. CARET: 14,
  757. INK: 15,
  758. POPUP: 16,
  759. FILEATTACHMENT: 17,
  760. SOUND: 18,
  761. MOVIE: 19,
  762. WIDGET: 20,
  763. SCREEN: 21,
  764. PRINTERMARK: 22,
  765. TRAPNET: 23,
  766. WATERMARK: 24,
  767. THREED: 25,
  768. REDACT: 26
  769. };
  770. exports.AnnotationType = AnnotationType;
  771. const AnnotationStateModelType = {
  772. MARKED: "Marked",
  773. REVIEW: "Review"
  774. };
  775. exports.AnnotationStateModelType = AnnotationStateModelType;
  776. const AnnotationMarkedState = {
  777. MARKED: "Marked",
  778. UNMARKED: "Unmarked"
  779. };
  780. exports.AnnotationMarkedState = AnnotationMarkedState;
  781. const AnnotationReviewState = {
  782. ACCEPTED: "Accepted",
  783. REJECTED: "Rejected",
  784. CANCELLED: "Cancelled",
  785. COMPLETED: "Completed",
  786. NONE: "None"
  787. };
  788. exports.AnnotationReviewState = AnnotationReviewState;
  789. const AnnotationReplyType = {
  790. GROUP: "Group",
  791. REPLY: "R"
  792. };
  793. exports.AnnotationReplyType = AnnotationReplyType;
  794. const AnnotationFlag = {
  795. INVISIBLE: 0x01,
  796. HIDDEN: 0x02,
  797. PRINT: 0x04,
  798. NOZOOM: 0x08,
  799. NOROTATE: 0x10,
  800. NOVIEW: 0x20,
  801. READONLY: 0x40,
  802. LOCKED: 0x80,
  803. TOGGLENOVIEW: 0x100,
  804. LOCKEDCONTENTS: 0x200
  805. };
  806. exports.AnnotationFlag = AnnotationFlag;
  807. const AnnotationFieldFlag = {
  808. READONLY: 0x0000001,
  809. REQUIRED: 0x0000002,
  810. NOEXPORT: 0x0000004,
  811. MULTILINE: 0x0001000,
  812. PASSWORD: 0x0002000,
  813. NOTOGGLETOOFF: 0x0004000,
  814. RADIO: 0x0008000,
  815. PUSHBUTTON: 0x0010000,
  816. COMBO: 0x0020000,
  817. EDIT: 0x0040000,
  818. SORT: 0x0080000,
  819. FILESELECT: 0x0100000,
  820. MULTISELECT: 0x0200000,
  821. DONOTSPELLCHECK: 0x0400000,
  822. DONOTSCROLL: 0x0800000,
  823. COMB: 0x1000000,
  824. RICHTEXT: 0x2000000,
  825. RADIOSINUNISON: 0x2000000,
  826. COMMITONSELCHANGE: 0x4000000
  827. };
  828. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  829. const AnnotationBorderStyleType = {
  830. SOLID: 1,
  831. DASHED: 2,
  832. BEVELED: 3,
  833. INSET: 4,
  834. UNDERLINE: 5
  835. };
  836. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  837. const AnnotationActionEventType = {
  838. E: "Mouse Enter",
  839. X: "Mouse Exit",
  840. D: "Mouse Down",
  841. U: "Mouse Up",
  842. Fo: "Focus",
  843. Bl: "Blur",
  844. PO: "PageOpen",
  845. PC: "PageClose",
  846. PV: "PageVisible",
  847. PI: "PageInvisible",
  848. K: "Keystroke",
  849. F: "Format",
  850. V: "Validate",
  851. C: "Calculate"
  852. };
  853. exports.AnnotationActionEventType = AnnotationActionEventType;
  854. const DocumentActionEventType = {
  855. WC: "WillClose",
  856. WS: "WillSave",
  857. DS: "DidSave",
  858. WP: "WillPrint",
  859. DP: "DidPrint"
  860. };
  861. exports.DocumentActionEventType = DocumentActionEventType;
  862. const PageActionEventType = {
  863. O: "PageOpen",
  864. C: "PageClose"
  865. };
  866. exports.PageActionEventType = PageActionEventType;
  867. const StreamType = {
  868. UNKNOWN: "UNKNOWN",
  869. FLATE: "FLATE",
  870. LZW: "LZW",
  871. DCT: "DCT",
  872. JPX: "JPX",
  873. JBIG: "JBIG",
  874. A85: "A85",
  875. AHX: "AHX",
  876. CCF: "CCF",
  877. RLX: "RLX"
  878. };
  879. exports.StreamType = StreamType;
  880. const FontType = {
  881. UNKNOWN: "UNKNOWN",
  882. TYPE1: "TYPE1",
  883. TYPE1STANDARD: "TYPE1STANDARD",
  884. TYPE1C: "TYPE1C",
  885. CIDFONTTYPE0: "CIDFONTTYPE0",
  886. CIDFONTTYPE0C: "CIDFONTTYPE0C",
  887. TRUETYPE: "TRUETYPE",
  888. CIDFONTTYPE2: "CIDFONTTYPE2",
  889. TYPE3: "TYPE3",
  890. OPENTYPE: "OPENTYPE",
  891. TYPE0: "TYPE0",
  892. MMTYPE1: "MMTYPE1"
  893. };
  894. exports.FontType = FontType;
  895. const VerbosityLevel = {
  896. ERRORS: 0,
  897. WARNINGS: 1,
  898. INFOS: 5
  899. };
  900. exports.VerbosityLevel = VerbosityLevel;
  901. const CMapCompressionType = {
  902. NONE: 0,
  903. BINARY: 1,
  904. STREAM: 2
  905. };
  906. exports.CMapCompressionType = CMapCompressionType;
  907. const OPS = {
  908. dependency: 1,
  909. setLineWidth: 2,
  910. setLineCap: 3,
  911. setLineJoin: 4,
  912. setMiterLimit: 5,
  913. setDash: 6,
  914. setRenderingIntent: 7,
  915. setFlatness: 8,
  916. setGState: 9,
  917. save: 10,
  918. restore: 11,
  919. transform: 12,
  920. moveTo: 13,
  921. lineTo: 14,
  922. curveTo: 15,
  923. curveTo2: 16,
  924. curveTo3: 17,
  925. closePath: 18,
  926. rectangle: 19,
  927. stroke: 20,
  928. closeStroke: 21,
  929. fill: 22,
  930. eoFill: 23,
  931. fillStroke: 24,
  932. eoFillStroke: 25,
  933. closeFillStroke: 26,
  934. closeEOFillStroke: 27,
  935. endPath: 28,
  936. clip: 29,
  937. eoClip: 30,
  938. beginText: 31,
  939. endText: 32,
  940. setCharSpacing: 33,
  941. setWordSpacing: 34,
  942. setHScale: 35,
  943. setLeading: 36,
  944. setFont: 37,
  945. setTextRenderingMode: 38,
  946. setTextRise: 39,
  947. moveText: 40,
  948. setLeadingMoveText: 41,
  949. setTextMatrix: 42,
  950. nextLine: 43,
  951. showText: 44,
  952. showSpacedText: 45,
  953. nextLineShowText: 46,
  954. nextLineSetSpacingShowText: 47,
  955. setCharWidth: 48,
  956. setCharWidthAndBounds: 49,
  957. setStrokeColorSpace: 50,
  958. setFillColorSpace: 51,
  959. setStrokeColor: 52,
  960. setStrokeColorN: 53,
  961. setFillColor: 54,
  962. setFillColorN: 55,
  963. setStrokeGray: 56,
  964. setFillGray: 57,
  965. setStrokeRGBColor: 58,
  966. setFillRGBColor: 59,
  967. setStrokeCMYKColor: 60,
  968. setFillCMYKColor: 61,
  969. shadingFill: 62,
  970. beginInlineImage: 63,
  971. beginImageData: 64,
  972. endInlineImage: 65,
  973. paintXObject: 66,
  974. markPoint: 67,
  975. markPointProps: 68,
  976. beginMarkedContent: 69,
  977. beginMarkedContentProps: 70,
  978. endMarkedContent: 71,
  979. beginCompat: 72,
  980. endCompat: 73,
  981. paintFormXObjectBegin: 74,
  982. paintFormXObjectEnd: 75,
  983. beginGroup: 76,
  984. endGroup: 77,
  985. beginAnnotations: 78,
  986. endAnnotations: 79,
  987. beginAnnotation: 80,
  988. endAnnotation: 81,
  989. paintJpegXObject: 82,
  990. paintImageMaskXObject: 83,
  991. paintImageMaskXObjectGroup: 84,
  992. paintImageXObject: 85,
  993. paintInlineImageXObject: 86,
  994. paintInlineImageXObjectGroup: 87,
  995. paintImageXObjectRepeat: 88,
  996. paintImageMaskXObjectRepeat: 89,
  997. paintSolidColorImageMask: 90,
  998. constructPath: 91
  999. };
  1000. exports.OPS = OPS;
  1001. const UNSUPPORTED_FEATURES = {
  1002. unknown: "unknown",
  1003. forms: "forms",
  1004. javaScript: "javaScript",
  1005. signatures: "signatures",
  1006. smask: "smask",
  1007. shadingPattern: "shadingPattern",
  1008. font: "font",
  1009. errorTilingPattern: "errorTilingPattern",
  1010. errorExtGState: "errorExtGState",
  1011. errorXObject: "errorXObject",
  1012. errorFontLoadType3: "errorFontLoadType3",
  1013. errorFontState: "errorFontState",
  1014. errorFontMissing: "errorFontMissing",
  1015. errorFontTranslate: "errorFontTranslate",
  1016. errorColorSpace: "errorColorSpace",
  1017. errorOperatorList: "errorOperatorList",
  1018. errorFontToUnicode: "errorFontToUnicode",
  1019. errorFontLoadNative: "errorFontLoadNative",
  1020. errorFontBuildPath: "errorFontBuildPath",
  1021. errorFontGetPath: "errorFontGetPath",
  1022. errorMarkedContent: "errorMarkedContent",
  1023. errorContentSubStream: "errorContentSubStream"
  1024. };
  1025. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  1026. const PasswordResponses = {
  1027. NEED_PASSWORD: 1,
  1028. INCORRECT_PASSWORD: 2
  1029. };
  1030. exports.PasswordResponses = PasswordResponses;
  1031. let verbosity = VerbosityLevel.WARNINGS;
  1032. function setVerbosityLevel(level) {
  1033. if (Number.isInteger(level)) {
  1034. verbosity = level;
  1035. }
  1036. }
  1037. function getVerbosityLevel() {
  1038. return verbosity;
  1039. }
  1040. function info(msg) {
  1041. if (verbosity >= VerbosityLevel.INFOS) {
  1042. console.log(`Info: ${msg}`);
  1043. }
  1044. }
  1045. function warn(msg) {
  1046. if (verbosity >= VerbosityLevel.WARNINGS) {
  1047. console.log(`Warning: ${msg}`);
  1048. }
  1049. }
  1050. function unreachable(msg) {
  1051. throw new Error(msg);
  1052. }
  1053. function assert(cond, msg) {
  1054. if (!cond) {
  1055. unreachable(msg);
  1056. }
  1057. }
  1058. function _isValidProtocol(url) {
  1059. if (!url) {
  1060. return false;
  1061. }
  1062. switch (url.protocol) {
  1063. case "http:":
  1064. case "https:":
  1065. case "ftp:":
  1066. case "mailto:":
  1067. case "tel:":
  1068. return true;
  1069. default:
  1070. return false;
  1071. }
  1072. }
  1073. function createValidAbsoluteUrl(url) {
  1074. let baseUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  1075. let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  1076. if (!url) {
  1077. return null;
  1078. }
  1079. try {
  1080. if (options && typeof url === "string") {
  1081. if (options.addDefaultProtocol && url.startsWith("www.")) {
  1082. const dots = url.match(/\./g);
  1083. if (dots && dots.length >= 2) {
  1084. url = `http://${url}`;
  1085. }
  1086. }
  1087. if (options.tryConvertEncoding) {
  1088. try {
  1089. url = stringToUTF8String(url);
  1090. } catch (ex) {}
  1091. }
  1092. }
  1093. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  1094. if (_isValidProtocol(absoluteUrl)) {
  1095. return absoluteUrl;
  1096. }
  1097. } catch (ex) {}
  1098. return null;
  1099. }
  1100. function shadow(obj, prop, value) {
  1101. Object.defineProperty(obj, prop, {
  1102. value,
  1103. enumerable: true,
  1104. configurable: true,
  1105. writable: false
  1106. });
  1107. return value;
  1108. }
  1109. const BaseException = function BaseExceptionClosure() {
  1110. function BaseException(message, name) {
  1111. if (this.constructor === BaseException) {
  1112. unreachable("Cannot initialize BaseException.");
  1113. }
  1114. this.message = message;
  1115. this.name = name;
  1116. }
  1117. BaseException.prototype = new Error();
  1118. BaseException.constructor = BaseException;
  1119. return BaseException;
  1120. }();
  1121. exports.BaseException = BaseException;
  1122. class PasswordException extends BaseException {
  1123. constructor(msg, code) {
  1124. super(msg, "PasswordException");
  1125. this.code = code;
  1126. }
  1127. }
  1128. exports.PasswordException = PasswordException;
  1129. class UnknownErrorException extends BaseException {
  1130. constructor(msg, details) {
  1131. super(msg, "UnknownErrorException");
  1132. this.details = details;
  1133. }
  1134. }
  1135. exports.UnknownErrorException = UnknownErrorException;
  1136. class InvalidPDFException extends BaseException {
  1137. constructor(msg) {
  1138. super(msg, "InvalidPDFException");
  1139. }
  1140. }
  1141. exports.InvalidPDFException = InvalidPDFException;
  1142. class MissingPDFException extends BaseException {
  1143. constructor(msg) {
  1144. super(msg, "MissingPDFException");
  1145. }
  1146. }
  1147. exports.MissingPDFException = MissingPDFException;
  1148. class UnexpectedResponseException extends BaseException {
  1149. constructor(msg, status) {
  1150. super(msg, "UnexpectedResponseException");
  1151. this.status = status;
  1152. }
  1153. }
  1154. exports.UnexpectedResponseException = UnexpectedResponseException;
  1155. class FormatError extends BaseException {
  1156. constructor(msg) {
  1157. super(msg, "FormatError");
  1158. }
  1159. }
  1160. exports.FormatError = FormatError;
  1161. class AbortException extends BaseException {
  1162. constructor(msg) {
  1163. super(msg, "AbortException");
  1164. }
  1165. }
  1166. exports.AbortException = AbortException;
  1167. function bytesToString(bytes) {
  1168. if (typeof bytes !== "object" || bytes === null || bytes.length === undefined) {
  1169. unreachable("Invalid argument for bytesToString");
  1170. }
  1171. const length = bytes.length;
  1172. const MAX_ARGUMENT_COUNT = 8192;
  1173. if (length < MAX_ARGUMENT_COUNT) {
  1174. return String.fromCharCode.apply(null, bytes);
  1175. }
  1176. const strBuf = [];
  1177. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  1178. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  1179. const chunk = bytes.subarray(i, chunkEnd);
  1180. strBuf.push(String.fromCharCode.apply(null, chunk));
  1181. }
  1182. return strBuf.join("");
  1183. }
  1184. function stringToBytes(str) {
  1185. if (typeof str !== "string") {
  1186. unreachable("Invalid argument for stringToBytes");
  1187. }
  1188. const length = str.length;
  1189. const bytes = new Uint8Array(length);
  1190. for (let i = 0; i < length; ++i) {
  1191. bytes[i] = str.charCodeAt(i) & 0xff;
  1192. }
  1193. return bytes;
  1194. }
  1195. function arrayByteLength(arr) {
  1196. if (arr.length !== undefined) {
  1197. return arr.length;
  1198. }
  1199. if (arr.byteLength !== undefined) {
  1200. return arr.byteLength;
  1201. }
  1202. unreachable("Invalid argument for arrayByteLength");
  1203. }
  1204. function arraysToBytes(arr) {
  1205. const length = arr.length;
  1206. if (length === 1 && arr[0] instanceof Uint8Array) {
  1207. return arr[0];
  1208. }
  1209. let resultLength = 0;
  1210. for (let i = 0; i < length; i++) {
  1211. resultLength += arrayByteLength(arr[i]);
  1212. }
  1213. let pos = 0;
  1214. const data = new Uint8Array(resultLength);
  1215. for (let i = 0; i < length; i++) {
  1216. let item = arr[i];
  1217. if (!(item instanceof Uint8Array)) {
  1218. if (typeof item === "string") {
  1219. item = stringToBytes(item);
  1220. } else {
  1221. item = new Uint8Array(item);
  1222. }
  1223. }
  1224. const itemLength = item.byteLength;
  1225. data.set(item, pos);
  1226. pos += itemLength;
  1227. }
  1228. return data;
  1229. }
  1230. function string32(value) {
  1231. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  1232. }
  1233. function objectSize(obj) {
  1234. return Object.keys(obj).length;
  1235. }
  1236. function objectFromMap(map) {
  1237. const obj = Object.create(null);
  1238. for (const [key, value] of map) {
  1239. obj[key] = value;
  1240. }
  1241. return obj;
  1242. }
  1243. function isLittleEndian() {
  1244. const buffer8 = new Uint8Array(4);
  1245. buffer8[0] = 1;
  1246. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  1247. return view32[0] === 1;
  1248. }
  1249. function isEvalSupported() {
  1250. try {
  1251. new Function("");
  1252. return true;
  1253. } catch (e) {
  1254. return false;
  1255. }
  1256. }
  1257. class FeatureTest {
  1258. static get isLittleEndian() {
  1259. return shadow(this, "isLittleEndian", isLittleEndian());
  1260. }
  1261. static get isEvalSupported() {
  1262. return shadow(this, "isEvalSupported", isEvalSupported());
  1263. }
  1264. static get isOffscreenCanvasSupported() {
  1265. return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
  1266. }
  1267. }
  1268. exports.FeatureTest = FeatureTest;
  1269. const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
  1270. class Util {
  1271. static makeHexColor(r, g, b) {
  1272. return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
  1273. }
  1274. static scaleMinMax(transform, minMax) {
  1275. let temp;
  1276. if (transform[0]) {
  1277. if (transform[0] < 0) {
  1278. temp = minMax[0];
  1279. minMax[0] = minMax[1];
  1280. minMax[1] = temp;
  1281. }
  1282. minMax[0] *= transform[0];
  1283. minMax[1] *= transform[0];
  1284. if (transform[3] < 0) {
  1285. temp = minMax[2];
  1286. minMax[2] = minMax[3];
  1287. minMax[3] = temp;
  1288. }
  1289. minMax[2] *= transform[3];
  1290. minMax[3] *= transform[3];
  1291. } else {
  1292. temp = minMax[0];
  1293. minMax[0] = minMax[2];
  1294. minMax[2] = temp;
  1295. temp = minMax[1];
  1296. minMax[1] = minMax[3];
  1297. minMax[3] = temp;
  1298. if (transform[1] < 0) {
  1299. temp = minMax[2];
  1300. minMax[2] = minMax[3];
  1301. minMax[3] = temp;
  1302. }
  1303. minMax[2] *= transform[1];
  1304. minMax[3] *= transform[1];
  1305. if (transform[2] < 0) {
  1306. temp = minMax[0];
  1307. minMax[0] = minMax[1];
  1308. minMax[1] = temp;
  1309. }
  1310. minMax[0] *= transform[2];
  1311. minMax[1] *= transform[2];
  1312. }
  1313. minMax[0] += transform[4];
  1314. minMax[1] += transform[4];
  1315. minMax[2] += transform[5];
  1316. minMax[3] += transform[5];
  1317. }
  1318. static transform(m1, m2) {
  1319. 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]];
  1320. }
  1321. static applyTransform(p, m) {
  1322. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  1323. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  1324. return [xt, yt];
  1325. }
  1326. static applyInverseTransform(p, m) {
  1327. const d = m[0] * m[3] - m[1] * m[2];
  1328. const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  1329. const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  1330. return [xt, yt];
  1331. }
  1332. static getAxialAlignedBoundingBox(r, m) {
  1333. const p1 = Util.applyTransform(r, m);
  1334. const p2 = Util.applyTransform(r.slice(2, 4), m);
  1335. const p3 = Util.applyTransform([r[0], r[3]], m);
  1336. const p4 = Util.applyTransform([r[2], r[1]], m);
  1337. 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])];
  1338. }
  1339. static inverseTransform(m) {
  1340. const d = m[0] * m[3] - m[1] * m[2];
  1341. 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];
  1342. }
  1343. static apply3dTransform(m, v) {
  1344. return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v[2]];
  1345. }
  1346. static singularValueDecompose2dScale(m) {
  1347. const transpose = [m[0], m[2], m[1], m[3]];
  1348. const a = m[0] * transpose[0] + m[1] * transpose[2];
  1349. const b = m[0] * transpose[1] + m[1] * transpose[3];
  1350. const c = m[2] * transpose[0] + m[3] * transpose[2];
  1351. const d = m[2] * transpose[1] + m[3] * transpose[3];
  1352. const first = (a + d) / 2;
  1353. const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
  1354. const sx = first + second || 1;
  1355. const sy = first - second || 1;
  1356. return [Math.sqrt(sx), Math.sqrt(sy)];
  1357. }
  1358. static normalizeRect(rect) {
  1359. const r = rect.slice(0);
  1360. if (rect[0] > rect[2]) {
  1361. r[0] = rect[2];
  1362. r[2] = rect[0];
  1363. }
  1364. if (rect[1] > rect[3]) {
  1365. r[1] = rect[3];
  1366. r[3] = rect[1];
  1367. }
  1368. return r;
  1369. }
  1370. static intersect(rect1, rect2) {
  1371. const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2]));
  1372. const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2]));
  1373. if (xLow > xHigh) {
  1374. return null;
  1375. }
  1376. const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3]));
  1377. const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3]));
  1378. if (yLow > yHigh) {
  1379. return null;
  1380. }
  1381. return [xLow, yLow, xHigh, yHigh];
  1382. }
  1383. static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {
  1384. const tvalues = [],
  1385. bounds = [[], []];
  1386. let a, b, c, t, t1, t2, b2ac, sqrtb2ac;
  1387. for (let i = 0; i < 2; ++i) {
  1388. if (i === 0) {
  1389. b = 6 * x0 - 12 * x1 + 6 * x2;
  1390. a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
  1391. c = 3 * x1 - 3 * x0;
  1392. } else {
  1393. b = 6 * y0 - 12 * y1 + 6 * y2;
  1394. a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
  1395. c = 3 * y1 - 3 * y0;
  1396. }
  1397. if (Math.abs(a) < 1e-12) {
  1398. if (Math.abs(b) < 1e-12) {
  1399. continue;
  1400. }
  1401. t = -c / b;
  1402. if (0 < t && t < 1) {
  1403. tvalues.push(t);
  1404. }
  1405. continue;
  1406. }
  1407. b2ac = b * b - 4 * c * a;
  1408. sqrtb2ac = Math.sqrt(b2ac);
  1409. if (b2ac < 0) {
  1410. continue;
  1411. }
  1412. t1 = (-b + sqrtb2ac) / (2 * a);
  1413. if (0 < t1 && t1 < 1) {
  1414. tvalues.push(t1);
  1415. }
  1416. t2 = (-b - sqrtb2ac) / (2 * a);
  1417. if (0 < t2 && t2 < 1) {
  1418. tvalues.push(t2);
  1419. }
  1420. }
  1421. let j = tvalues.length,
  1422. mt;
  1423. const jlen = j;
  1424. while (j--) {
  1425. t = tvalues[j];
  1426. mt = 1 - t;
  1427. bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
  1428. bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
  1429. }
  1430. bounds[0][jlen] = x0;
  1431. bounds[1][jlen] = y0;
  1432. bounds[0][jlen + 1] = x3;
  1433. bounds[1][jlen + 1] = y3;
  1434. bounds[0].length = bounds[1].length = jlen + 2;
  1435. return [Math.min(...bounds[0]), Math.min(...bounds[1]), Math.max(...bounds[0]), Math.max(...bounds[1])];
  1436. }
  1437. }
  1438. exports.Util = Util;
  1439. 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];
  1440. function stringToPDFString(str) {
  1441. if (str[0] >= "\xEF") {
  1442. let encoding;
  1443. if (str[0] === "\xFE" && str[1] === "\xFF") {
  1444. encoding = "utf-16be";
  1445. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  1446. encoding = "utf-16le";
  1447. } else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") {
  1448. encoding = "utf-8";
  1449. }
  1450. if (encoding) {
  1451. try {
  1452. const decoder = new TextDecoder(encoding, {
  1453. fatal: true
  1454. });
  1455. const buffer = stringToBytes(str);
  1456. return decoder.decode(buffer);
  1457. } catch (ex) {
  1458. warn(`stringToPDFString: "${ex}".`);
  1459. }
  1460. }
  1461. }
  1462. const strBuf = [];
  1463. for (let i = 0, ii = str.length; i < ii; i++) {
  1464. const code = PDFStringTranslateTable[str.charCodeAt(i)];
  1465. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1466. }
  1467. return strBuf.join("");
  1468. }
  1469. function escapeString(str) {
  1470. return str.replace(/([()\\\n\r])/g, match => {
  1471. if (match === "\n") {
  1472. return "\\n";
  1473. } else if (match === "\r") {
  1474. return "\\r";
  1475. }
  1476. return `\\${match}`;
  1477. });
  1478. }
  1479. function isAscii(str) {
  1480. return /^[\x00-\x7F]*$/.test(str);
  1481. }
  1482. function stringToUTF16BEString(str) {
  1483. const buf = ["\xFE\xFF"];
  1484. for (let i = 0, ii = str.length; i < ii; i++) {
  1485. const char = str.charCodeAt(i);
  1486. buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
  1487. }
  1488. return buf.join("");
  1489. }
  1490. function stringToUTF8String(str) {
  1491. return decodeURIComponent(escape(str));
  1492. }
  1493. function utf8StringToString(str) {
  1494. return unescape(encodeURIComponent(str));
  1495. }
  1496. function isArrayBuffer(v) {
  1497. return typeof v === "object" && v !== null && v.byteLength !== undefined;
  1498. }
  1499. function isArrayEqual(arr1, arr2) {
  1500. if (arr1.length !== arr2.length) {
  1501. return false;
  1502. }
  1503. for (let i = 0, ii = arr1.length; i < ii; i++) {
  1504. if (arr1[i] !== arr2[i]) {
  1505. return false;
  1506. }
  1507. }
  1508. return true;
  1509. }
  1510. function getModificationDate() {
  1511. let date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
  1512. 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")];
  1513. return buffer.join("");
  1514. }
  1515. function createPromiseCapability() {
  1516. const capability = Object.create(null);
  1517. let isSettled = false;
  1518. Object.defineProperty(capability, "settled", {
  1519. get() {
  1520. return isSettled;
  1521. }
  1522. });
  1523. capability.promise = new Promise(function (resolve, reject) {
  1524. capability.resolve = function (data) {
  1525. isSettled = true;
  1526. resolve(data);
  1527. };
  1528. capability.reject = function (reason) {
  1529. isSettled = true;
  1530. reject(reason);
  1531. };
  1532. });
  1533. return capability;
  1534. }
  1535. /***/ }),
  1536. /* 3 */
  1537. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1538. "use strict";
  1539. var _is_node = __w_pdfjs_require__(4);
  1540. if (!globalThis._pdfjsCompatibilityChecked) {
  1541. globalThis._pdfjsCompatibilityChecked = true;
  1542. (function checkNodeBtoa() {
  1543. if (globalThis.btoa || !_is_node.isNodeJS) {
  1544. return;
  1545. }
  1546. globalThis.btoa = function (chars) {
  1547. return Buffer.from(chars, "binary").toString("base64");
  1548. };
  1549. })();
  1550. (function checkNodeAtob() {
  1551. if (globalThis.atob || !_is_node.isNodeJS) {
  1552. return;
  1553. }
  1554. globalThis.atob = function (input) {
  1555. return Buffer.from(input, "base64").toString("binary");
  1556. };
  1557. })();
  1558. (function checkDOMMatrix() {
  1559. if (globalThis.DOMMatrix || !_is_node.isNodeJS) {
  1560. return;
  1561. }
  1562. globalThis.DOMMatrix = require("dommatrix/dist/dommatrix.js");
  1563. })();
  1564. (function checkReadableStream() {
  1565. if (globalThis.ReadableStream || !_is_node.isNodeJS) {
  1566. return;
  1567. }
  1568. globalThis.ReadableStream = require("web-streams-polyfill/dist/ponyfill.js").ReadableStream;
  1569. })();
  1570. (function checkArrayAt() {
  1571. if (Array.prototype.at) {
  1572. return;
  1573. }
  1574. __w_pdfjs_require__(5);
  1575. })();
  1576. (function checkTypedArrayAt() {
  1577. if (Uint8Array.prototype.at) {
  1578. return;
  1579. }
  1580. __w_pdfjs_require__(77);
  1581. })();
  1582. (function checkStructuredClone() {
  1583. if (globalThis.structuredClone) {
  1584. return;
  1585. }
  1586. __w_pdfjs_require__(87);
  1587. })();
  1588. }
  1589. /***/ }),
  1590. /* 4 */
  1591. /***/ ((__unused_webpack_module, exports) => {
  1592. "use strict";
  1593. Object.defineProperty(exports, "__esModule", ({
  1594. value: true
  1595. }));
  1596. exports.isNodeJS = void 0;
  1597. const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
  1598. exports.isNodeJS = isNodeJS;
  1599. /***/ }),
  1600. /* 5 */
  1601. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1602. __w_pdfjs_require__(6);
  1603. var entryUnbind = __w_pdfjs_require__(76);
  1604. module.exports = entryUnbind('Array', 'at');
  1605. /***/ }),
  1606. /* 6 */
  1607. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1608. "use strict";
  1609. var $ = __w_pdfjs_require__(7);
  1610. var toObject = __w_pdfjs_require__(42);
  1611. var lengthOfArrayLike = __w_pdfjs_require__(66);
  1612. var toIntegerOrInfinity = __w_pdfjs_require__(64);
  1613. var addToUnscopables = __w_pdfjs_require__(71);
  1614. $({
  1615. target: 'Array',
  1616. proto: true
  1617. }, {
  1618. at: function at(index) {
  1619. var O = toObject(this);
  1620. var len = lengthOfArrayLike(O);
  1621. var relativeIndex = toIntegerOrInfinity(index);
  1622. var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex;
  1623. return k < 0 || k >= len ? undefined : O[k];
  1624. }
  1625. });
  1626. addToUnscopables('at');
  1627. /***/ }),
  1628. /* 7 */
  1629. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1630. var global = __w_pdfjs_require__(8);
  1631. var getOwnPropertyDescriptor = (__w_pdfjs_require__(9).f);
  1632. var createNonEnumerableProperty = __w_pdfjs_require__(46);
  1633. var defineBuiltIn = __w_pdfjs_require__(50);
  1634. var defineGlobalProperty = __w_pdfjs_require__(40);
  1635. var copyConstructorProperties = __w_pdfjs_require__(58);
  1636. var isForced = __w_pdfjs_require__(70);
  1637. module.exports = function (options, source) {
  1638. var TARGET = options.target;
  1639. var GLOBAL = options.global;
  1640. var STATIC = options.stat;
  1641. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  1642. if (GLOBAL) {
  1643. target = global;
  1644. } else if (STATIC) {
  1645. target = global[TARGET] || defineGlobalProperty(TARGET, {});
  1646. } else {
  1647. target = (global[TARGET] || {}).prototype;
  1648. }
  1649. if (target)
  1650. for (key in source) {
  1651. sourceProperty = source[key];
  1652. if (options.dontCallGetSet) {
  1653. descriptor = getOwnPropertyDescriptor(target, key);
  1654. targetProperty = descriptor && descriptor.value;
  1655. } else
  1656. targetProperty = target[key];
  1657. FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  1658. if (!FORCED && targetProperty !== undefined) {
  1659. if (typeof sourceProperty == typeof targetProperty)
  1660. continue;
  1661. copyConstructorProperties(sourceProperty, targetProperty);
  1662. }
  1663. if (options.sham || targetProperty && targetProperty.sham) {
  1664. createNonEnumerableProperty(sourceProperty, 'sham', true);
  1665. }
  1666. defineBuiltIn(target, key, sourceProperty, options);
  1667. }
  1668. };
  1669. /***/ }),
  1670. /* 8 */
  1671. /***/ ((module) => {
  1672. var check = function (it) {
  1673. return it && it.Math == Math && it;
  1674. };
  1675. module.exports = check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || check(typeof self == 'object' && self) || check(typeof global == 'object' && global) || (function () {
  1676. return this;
  1677. }()) || Function('return this')();
  1678. /***/ }),
  1679. /* 9 */
  1680. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1681. var DESCRIPTORS = __w_pdfjs_require__(10);
  1682. var call = __w_pdfjs_require__(12);
  1683. var propertyIsEnumerableModule = __w_pdfjs_require__(14);
  1684. var createPropertyDescriptor = __w_pdfjs_require__(15);
  1685. var toIndexedObject = __w_pdfjs_require__(16);
  1686. var toPropertyKey = __w_pdfjs_require__(21);
  1687. var hasOwn = __w_pdfjs_require__(41);
  1688. var IE8_DOM_DEFINE = __w_pdfjs_require__(44);
  1689. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  1690. exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  1691. O = toIndexedObject(O);
  1692. P = toPropertyKey(P);
  1693. if (IE8_DOM_DEFINE)
  1694. try {
  1695. return $getOwnPropertyDescriptor(O, P);
  1696. } catch (error) {
  1697. }
  1698. if (hasOwn(O, P))
  1699. return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
  1700. };
  1701. /***/ }),
  1702. /* 10 */
  1703. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1704. var fails = __w_pdfjs_require__(11);
  1705. module.exports = !fails(function () {
  1706. return Object.defineProperty({}, 1, {
  1707. get: function () {
  1708. return 7;
  1709. }
  1710. })[1] != 7;
  1711. });
  1712. /***/ }),
  1713. /* 11 */
  1714. /***/ ((module) => {
  1715. module.exports = function (exec) {
  1716. try {
  1717. return !!exec();
  1718. } catch (error) {
  1719. return true;
  1720. }
  1721. };
  1722. /***/ }),
  1723. /* 12 */
  1724. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1725. var NATIVE_BIND = __w_pdfjs_require__(13);
  1726. var call = Function.prototype.call;
  1727. module.exports = NATIVE_BIND ? call.bind(call) : function () {
  1728. return call.apply(call, arguments);
  1729. };
  1730. /***/ }),
  1731. /* 13 */
  1732. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1733. var fails = __w_pdfjs_require__(11);
  1734. module.exports = !fails(function () {
  1735. var test = function () {
  1736. }.bind();
  1737. return typeof test != 'function' || test.hasOwnProperty('prototype');
  1738. });
  1739. /***/ }),
  1740. /* 14 */
  1741. /***/ ((__unused_webpack_module, exports) => {
  1742. "use strict";
  1743. var $propertyIsEnumerable = {}.propertyIsEnumerable;
  1744. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  1745. var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
  1746. exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  1747. var descriptor = getOwnPropertyDescriptor(this, V);
  1748. return !!descriptor && descriptor.enumerable;
  1749. } : $propertyIsEnumerable;
  1750. /***/ }),
  1751. /* 15 */
  1752. /***/ ((module) => {
  1753. module.exports = function (bitmap, value) {
  1754. return {
  1755. enumerable: !(bitmap & 1),
  1756. configurable: !(bitmap & 2),
  1757. writable: !(bitmap & 4),
  1758. value: value
  1759. };
  1760. };
  1761. /***/ }),
  1762. /* 16 */
  1763. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1764. var IndexedObject = __w_pdfjs_require__(17);
  1765. var requireObjectCoercible = __w_pdfjs_require__(20);
  1766. module.exports = function (it) {
  1767. return IndexedObject(requireObjectCoercible(it));
  1768. };
  1769. /***/ }),
  1770. /* 17 */
  1771. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1772. var uncurryThis = __w_pdfjs_require__(18);
  1773. var fails = __w_pdfjs_require__(11);
  1774. var classof = __w_pdfjs_require__(19);
  1775. var $Object = Object;
  1776. var split = uncurryThis(''.split);
  1777. module.exports = fails(function () {
  1778. return !$Object('z').propertyIsEnumerable(0);
  1779. }) ? function (it) {
  1780. return classof(it) == 'String' ? split(it, '') : $Object(it);
  1781. } : $Object;
  1782. /***/ }),
  1783. /* 18 */
  1784. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1785. var NATIVE_BIND = __w_pdfjs_require__(13);
  1786. var FunctionPrototype = Function.prototype;
  1787. var bind = FunctionPrototype.bind;
  1788. var call = FunctionPrototype.call;
  1789. var uncurryThis = NATIVE_BIND && bind.bind(call, call);
  1790. module.exports = NATIVE_BIND ? function (fn) {
  1791. return fn && uncurryThis(fn);
  1792. } : function (fn) {
  1793. return fn && function () {
  1794. return call.apply(fn, arguments);
  1795. };
  1796. };
  1797. /***/ }),
  1798. /* 19 */
  1799. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1800. var uncurryThis = __w_pdfjs_require__(18);
  1801. var toString = uncurryThis({}.toString);
  1802. var stringSlice = uncurryThis(''.slice);
  1803. module.exports = function (it) {
  1804. return stringSlice(toString(it), 8, -1);
  1805. };
  1806. /***/ }),
  1807. /* 20 */
  1808. /***/ ((module) => {
  1809. var $TypeError = TypeError;
  1810. module.exports = function (it) {
  1811. if (it == undefined)
  1812. throw $TypeError("Can't call method on " + it);
  1813. return it;
  1814. };
  1815. /***/ }),
  1816. /* 21 */
  1817. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1818. var toPrimitive = __w_pdfjs_require__(22);
  1819. var isSymbol = __w_pdfjs_require__(25);
  1820. module.exports = function (argument) {
  1821. var key = toPrimitive(argument, 'string');
  1822. return isSymbol(key) ? key : key + '';
  1823. };
  1824. /***/ }),
  1825. /* 22 */
  1826. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1827. var call = __w_pdfjs_require__(12);
  1828. var isObject = __w_pdfjs_require__(23);
  1829. var isSymbol = __w_pdfjs_require__(25);
  1830. var getMethod = __w_pdfjs_require__(32);
  1831. var ordinaryToPrimitive = __w_pdfjs_require__(35);
  1832. var wellKnownSymbol = __w_pdfjs_require__(36);
  1833. var $TypeError = TypeError;
  1834. var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
  1835. module.exports = function (input, pref) {
  1836. if (!isObject(input) || isSymbol(input))
  1837. return input;
  1838. var exoticToPrim = getMethod(input, TO_PRIMITIVE);
  1839. var result;
  1840. if (exoticToPrim) {
  1841. if (pref === undefined)
  1842. pref = 'default';
  1843. result = call(exoticToPrim, input, pref);
  1844. if (!isObject(result) || isSymbol(result))
  1845. return result;
  1846. throw $TypeError("Can't convert object to primitive value");
  1847. }
  1848. if (pref === undefined)
  1849. pref = 'number';
  1850. return ordinaryToPrimitive(input, pref);
  1851. };
  1852. /***/ }),
  1853. /* 23 */
  1854. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1855. var isCallable = __w_pdfjs_require__(24);
  1856. module.exports = function (it) {
  1857. return typeof it == 'object' ? it !== null : isCallable(it);
  1858. };
  1859. /***/ }),
  1860. /* 24 */
  1861. /***/ ((module) => {
  1862. module.exports = function (argument) {
  1863. return typeof argument == 'function';
  1864. };
  1865. /***/ }),
  1866. /* 25 */
  1867. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1868. var getBuiltIn = __w_pdfjs_require__(26);
  1869. var isCallable = __w_pdfjs_require__(24);
  1870. var isPrototypeOf = __w_pdfjs_require__(27);
  1871. var USE_SYMBOL_AS_UID = __w_pdfjs_require__(28);
  1872. var $Object = Object;
  1873. module.exports = USE_SYMBOL_AS_UID ? function (it) {
  1874. return typeof it == 'symbol';
  1875. } : function (it) {
  1876. var $Symbol = getBuiltIn('Symbol');
  1877. return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
  1878. };
  1879. /***/ }),
  1880. /* 26 */
  1881. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1882. var global = __w_pdfjs_require__(8);
  1883. var isCallable = __w_pdfjs_require__(24);
  1884. var aFunction = function (argument) {
  1885. return isCallable(argument) ? argument : undefined;
  1886. };
  1887. module.exports = function (namespace, method) {
  1888. return arguments.length < 2 ? aFunction(global[namespace]) : global[namespace] && global[namespace][method];
  1889. };
  1890. /***/ }),
  1891. /* 27 */
  1892. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1893. var uncurryThis = __w_pdfjs_require__(18);
  1894. module.exports = uncurryThis({}.isPrototypeOf);
  1895. /***/ }),
  1896. /* 28 */
  1897. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1898. var NATIVE_SYMBOL = __w_pdfjs_require__(29);
  1899. module.exports = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == 'symbol';
  1900. /***/ }),
  1901. /* 29 */
  1902. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1903. var V8_VERSION = __w_pdfjs_require__(30);
  1904. var fails = __w_pdfjs_require__(11);
  1905. module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
  1906. var symbol = Symbol();
  1907. return !String(symbol) || !(Object(symbol) instanceof Symbol) || !Symbol.sham && V8_VERSION && V8_VERSION < 41;
  1908. });
  1909. /***/ }),
  1910. /* 30 */
  1911. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1912. var global = __w_pdfjs_require__(8);
  1913. var userAgent = __w_pdfjs_require__(31);
  1914. var process = global.process;
  1915. var Deno = global.Deno;
  1916. var versions = process && process.versions || Deno && Deno.version;
  1917. var v8 = versions && versions.v8;
  1918. var match, version;
  1919. if (v8) {
  1920. match = v8.split('.');
  1921. version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
  1922. }
  1923. if (!version && userAgent) {
  1924. match = userAgent.match(/Edge\/(\d+)/);
  1925. if (!match || match[1] >= 74) {
  1926. match = userAgent.match(/Chrome\/(\d+)/);
  1927. if (match)
  1928. version = +match[1];
  1929. }
  1930. }
  1931. module.exports = version;
  1932. /***/ }),
  1933. /* 31 */
  1934. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1935. var getBuiltIn = __w_pdfjs_require__(26);
  1936. module.exports = getBuiltIn('navigator', 'userAgent') || '';
  1937. /***/ }),
  1938. /* 32 */
  1939. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1940. var aCallable = __w_pdfjs_require__(33);
  1941. module.exports = function (V, P) {
  1942. var func = V[P];
  1943. return func == null ? undefined : aCallable(func);
  1944. };
  1945. /***/ }),
  1946. /* 33 */
  1947. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1948. var isCallable = __w_pdfjs_require__(24);
  1949. var tryToString = __w_pdfjs_require__(34);
  1950. var $TypeError = TypeError;
  1951. module.exports = function (argument) {
  1952. if (isCallable(argument))
  1953. return argument;
  1954. throw $TypeError(tryToString(argument) + ' is not a function');
  1955. };
  1956. /***/ }),
  1957. /* 34 */
  1958. /***/ ((module) => {
  1959. var $String = String;
  1960. module.exports = function (argument) {
  1961. try {
  1962. return $String(argument);
  1963. } catch (error) {
  1964. return 'Object';
  1965. }
  1966. };
  1967. /***/ }),
  1968. /* 35 */
  1969. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1970. var call = __w_pdfjs_require__(12);
  1971. var isCallable = __w_pdfjs_require__(24);
  1972. var isObject = __w_pdfjs_require__(23);
  1973. var $TypeError = TypeError;
  1974. module.exports = function (input, pref) {
  1975. var fn, val;
  1976. if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input)))
  1977. return val;
  1978. if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input)))
  1979. return val;
  1980. if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input)))
  1981. return val;
  1982. throw $TypeError("Can't convert object to primitive value");
  1983. };
  1984. /***/ }),
  1985. /* 36 */
  1986. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1987. var global = __w_pdfjs_require__(8);
  1988. var shared = __w_pdfjs_require__(37);
  1989. var hasOwn = __w_pdfjs_require__(41);
  1990. var uid = __w_pdfjs_require__(43);
  1991. var NATIVE_SYMBOL = __w_pdfjs_require__(29);
  1992. var USE_SYMBOL_AS_UID = __w_pdfjs_require__(28);
  1993. var WellKnownSymbolsStore = shared('wks');
  1994. var Symbol = global.Symbol;
  1995. var symbolFor = Symbol && Symbol['for'];
  1996. var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
  1997. module.exports = function (name) {
  1998. if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
  1999. var description = 'Symbol.' + name;
  2000. if (NATIVE_SYMBOL && hasOwn(Symbol, name)) {
  2001. WellKnownSymbolsStore[name] = Symbol[name];
  2002. } else if (USE_SYMBOL_AS_UID && symbolFor) {
  2003. WellKnownSymbolsStore[name] = symbolFor(description);
  2004. } else {
  2005. WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
  2006. }
  2007. }
  2008. return WellKnownSymbolsStore[name];
  2009. };
  2010. /***/ }),
  2011. /* 37 */
  2012. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2013. var IS_PURE = __w_pdfjs_require__(38);
  2014. var store = __w_pdfjs_require__(39);
  2015. (module.exports = function (key, value) {
  2016. return store[key] || (store[key] = value !== undefined ? value : {});
  2017. })('versions', []).push({
  2018. version: '3.24.1',
  2019. mode: IS_PURE ? 'pure' : 'global',
  2020. copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
  2021. license: 'https://github.com/zloirock/core-js/blob/v3.24.1/LICENSE',
  2022. source: 'https://github.com/zloirock/core-js'
  2023. });
  2024. /***/ }),
  2025. /* 38 */
  2026. /***/ ((module) => {
  2027. module.exports = false;
  2028. /***/ }),
  2029. /* 39 */
  2030. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2031. var global = __w_pdfjs_require__(8);
  2032. var defineGlobalProperty = __w_pdfjs_require__(40);
  2033. var SHARED = '__core-js_shared__';
  2034. var store = global[SHARED] || defineGlobalProperty(SHARED, {});
  2035. module.exports = store;
  2036. /***/ }),
  2037. /* 40 */
  2038. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2039. var global = __w_pdfjs_require__(8);
  2040. var defineProperty = Object.defineProperty;
  2041. module.exports = function (key, value) {
  2042. try {
  2043. defineProperty(global, key, {
  2044. value: value,
  2045. configurable: true,
  2046. writable: true
  2047. });
  2048. } catch (error) {
  2049. global[key] = value;
  2050. }
  2051. return value;
  2052. };
  2053. /***/ }),
  2054. /* 41 */
  2055. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2056. var uncurryThis = __w_pdfjs_require__(18);
  2057. var toObject = __w_pdfjs_require__(42);
  2058. var hasOwnProperty = uncurryThis({}.hasOwnProperty);
  2059. module.exports = Object.hasOwn || function hasOwn(it, key) {
  2060. return hasOwnProperty(toObject(it), key);
  2061. };
  2062. /***/ }),
  2063. /* 42 */
  2064. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2065. var requireObjectCoercible = __w_pdfjs_require__(20);
  2066. var $Object = Object;
  2067. module.exports = function (argument) {
  2068. return $Object(requireObjectCoercible(argument));
  2069. };
  2070. /***/ }),
  2071. /* 43 */
  2072. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2073. var uncurryThis = __w_pdfjs_require__(18);
  2074. var id = 0;
  2075. var postfix = Math.random();
  2076. var toString = uncurryThis(1.0.toString);
  2077. module.exports = function (key) {
  2078. return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
  2079. };
  2080. /***/ }),
  2081. /* 44 */
  2082. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2083. var DESCRIPTORS = __w_pdfjs_require__(10);
  2084. var fails = __w_pdfjs_require__(11);
  2085. var createElement = __w_pdfjs_require__(45);
  2086. module.exports = !DESCRIPTORS && !fails(function () {
  2087. return Object.defineProperty(createElement('div'), 'a', {
  2088. get: function () {
  2089. return 7;
  2090. }
  2091. }).a != 7;
  2092. });
  2093. /***/ }),
  2094. /* 45 */
  2095. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2096. var global = __w_pdfjs_require__(8);
  2097. var isObject = __w_pdfjs_require__(23);
  2098. var document = global.document;
  2099. var EXISTS = isObject(document) && isObject(document.createElement);
  2100. module.exports = function (it) {
  2101. return EXISTS ? document.createElement(it) : {};
  2102. };
  2103. /***/ }),
  2104. /* 46 */
  2105. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2106. var DESCRIPTORS = __w_pdfjs_require__(10);
  2107. var definePropertyModule = __w_pdfjs_require__(47);
  2108. var createPropertyDescriptor = __w_pdfjs_require__(15);
  2109. module.exports = DESCRIPTORS ? function (object, key, value) {
  2110. return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
  2111. } : function (object, key, value) {
  2112. object[key] = value;
  2113. return object;
  2114. };
  2115. /***/ }),
  2116. /* 47 */
  2117. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2118. var DESCRIPTORS = __w_pdfjs_require__(10);
  2119. var IE8_DOM_DEFINE = __w_pdfjs_require__(44);
  2120. var V8_PROTOTYPE_DEFINE_BUG = __w_pdfjs_require__(48);
  2121. var anObject = __w_pdfjs_require__(49);
  2122. var toPropertyKey = __w_pdfjs_require__(21);
  2123. var $TypeError = TypeError;
  2124. var $defineProperty = Object.defineProperty;
  2125. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  2126. var ENUMERABLE = 'enumerable';
  2127. var CONFIGURABLE = 'configurable';
  2128. var WRITABLE = 'writable';
  2129. exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
  2130. anObject(O);
  2131. P = toPropertyKey(P);
  2132. anObject(Attributes);
  2133. if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
  2134. var current = $getOwnPropertyDescriptor(O, P);
  2135. if (current && current[WRITABLE]) {
  2136. O[P] = Attributes.value;
  2137. Attributes = {
  2138. configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
  2139. enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
  2140. writable: false
  2141. };
  2142. }
  2143. }
  2144. return $defineProperty(O, P, Attributes);
  2145. } : $defineProperty : function defineProperty(O, P, Attributes) {
  2146. anObject(O);
  2147. P = toPropertyKey(P);
  2148. anObject(Attributes);
  2149. if (IE8_DOM_DEFINE)
  2150. try {
  2151. return $defineProperty(O, P, Attributes);
  2152. } catch (error) {
  2153. }
  2154. if ('get' in Attributes || 'set' in Attributes)
  2155. throw $TypeError('Accessors not supported');
  2156. if ('value' in Attributes)
  2157. O[P] = Attributes.value;
  2158. return O;
  2159. };
  2160. /***/ }),
  2161. /* 48 */
  2162. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2163. var DESCRIPTORS = __w_pdfjs_require__(10);
  2164. var fails = __w_pdfjs_require__(11);
  2165. module.exports = DESCRIPTORS && fails(function () {
  2166. return Object.defineProperty(function () {
  2167. }, 'prototype', {
  2168. value: 42,
  2169. writable: false
  2170. }).prototype != 42;
  2171. });
  2172. /***/ }),
  2173. /* 49 */
  2174. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2175. var isObject = __w_pdfjs_require__(23);
  2176. var $String = String;
  2177. var $TypeError = TypeError;
  2178. module.exports = function (argument) {
  2179. if (isObject(argument))
  2180. return argument;
  2181. throw $TypeError($String(argument) + ' is not an object');
  2182. };
  2183. /***/ }),
  2184. /* 50 */
  2185. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2186. var isCallable = __w_pdfjs_require__(24);
  2187. var definePropertyModule = __w_pdfjs_require__(47);
  2188. var makeBuiltIn = __w_pdfjs_require__(51);
  2189. var defineGlobalProperty = __w_pdfjs_require__(40);
  2190. module.exports = function (O, key, value, options) {
  2191. if (!options)
  2192. options = {};
  2193. var simple = options.enumerable;
  2194. var name = options.name !== undefined ? options.name : key;
  2195. if (isCallable(value))
  2196. makeBuiltIn(value, name, options);
  2197. if (options.global) {
  2198. if (simple)
  2199. O[key] = value;
  2200. else
  2201. defineGlobalProperty(key, value);
  2202. } else {
  2203. try {
  2204. if (!options.unsafe)
  2205. delete O[key];
  2206. else if (O[key])
  2207. simple = true;
  2208. } catch (error) {
  2209. }
  2210. if (simple)
  2211. O[key] = value;
  2212. else
  2213. definePropertyModule.f(O, key, {
  2214. value: value,
  2215. enumerable: false,
  2216. configurable: !options.nonConfigurable,
  2217. writable: !options.nonWritable
  2218. });
  2219. }
  2220. return O;
  2221. };
  2222. /***/ }),
  2223. /* 51 */
  2224. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2225. var fails = __w_pdfjs_require__(11);
  2226. var isCallable = __w_pdfjs_require__(24);
  2227. var hasOwn = __w_pdfjs_require__(41);
  2228. var DESCRIPTORS = __w_pdfjs_require__(10);
  2229. var CONFIGURABLE_FUNCTION_NAME = (__w_pdfjs_require__(52).CONFIGURABLE);
  2230. var inspectSource = __w_pdfjs_require__(53);
  2231. var InternalStateModule = __w_pdfjs_require__(54);
  2232. var enforceInternalState = InternalStateModule.enforce;
  2233. var getInternalState = InternalStateModule.get;
  2234. var defineProperty = Object.defineProperty;
  2235. var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () {
  2236. return defineProperty(function () {
  2237. }, 'length', { value: 8 }).length !== 8;
  2238. });
  2239. var TEMPLATE = String(String).split('String');
  2240. var makeBuiltIn = module.exports = function (value, name, options) {
  2241. if (String(name).slice(0, 7) === 'Symbol(') {
  2242. name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
  2243. }
  2244. if (options && options.getter)
  2245. name = 'get ' + name;
  2246. if (options && options.setter)
  2247. name = 'set ' + name;
  2248. if (!hasOwn(value, 'name') || CONFIGURABLE_FUNCTION_NAME && value.name !== name) {
  2249. if (DESCRIPTORS)
  2250. defineProperty(value, 'name', {
  2251. value: name,
  2252. configurable: true
  2253. });
  2254. else
  2255. value.name = name;
  2256. }
  2257. if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) {
  2258. defineProperty(value, 'length', { value: options.arity });
  2259. }
  2260. try {
  2261. if (options && hasOwn(options, 'constructor') && options.constructor) {
  2262. if (DESCRIPTORS)
  2263. defineProperty(value, 'prototype', { writable: false });
  2264. } else if (value.prototype)
  2265. value.prototype = undefined;
  2266. } catch (error) {
  2267. }
  2268. var state = enforceInternalState(value);
  2269. if (!hasOwn(state, 'source')) {
  2270. state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
  2271. }
  2272. return value;
  2273. };
  2274. Function.prototype.toString = makeBuiltIn(function toString() {
  2275. return isCallable(this) && getInternalState(this).source || inspectSource(this);
  2276. }, 'toString');
  2277. /***/ }),
  2278. /* 52 */
  2279. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2280. var DESCRIPTORS = __w_pdfjs_require__(10);
  2281. var hasOwn = __w_pdfjs_require__(41);
  2282. var FunctionPrototype = Function.prototype;
  2283. var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
  2284. var EXISTS = hasOwn(FunctionPrototype, 'name');
  2285. var PROPER = EXISTS && function something() {
  2286. }.name === 'something';
  2287. var CONFIGURABLE = EXISTS && (!DESCRIPTORS || DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable);
  2288. module.exports = {
  2289. EXISTS: EXISTS,
  2290. PROPER: PROPER,
  2291. CONFIGURABLE: CONFIGURABLE
  2292. };
  2293. /***/ }),
  2294. /* 53 */
  2295. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2296. var uncurryThis = __w_pdfjs_require__(18);
  2297. var isCallable = __w_pdfjs_require__(24);
  2298. var store = __w_pdfjs_require__(39);
  2299. var functionToString = uncurryThis(Function.toString);
  2300. if (!isCallable(store.inspectSource)) {
  2301. store.inspectSource = function (it) {
  2302. return functionToString(it);
  2303. };
  2304. }
  2305. module.exports = store.inspectSource;
  2306. /***/ }),
  2307. /* 54 */
  2308. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2309. var NATIVE_WEAK_MAP = __w_pdfjs_require__(55);
  2310. var global = __w_pdfjs_require__(8);
  2311. var uncurryThis = __w_pdfjs_require__(18);
  2312. var isObject = __w_pdfjs_require__(23);
  2313. var createNonEnumerableProperty = __w_pdfjs_require__(46);
  2314. var hasOwn = __w_pdfjs_require__(41);
  2315. var shared = __w_pdfjs_require__(39);
  2316. var sharedKey = __w_pdfjs_require__(56);
  2317. var hiddenKeys = __w_pdfjs_require__(57);
  2318. var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
  2319. var TypeError = global.TypeError;
  2320. var WeakMap = global.WeakMap;
  2321. var set, get, has;
  2322. var enforce = function (it) {
  2323. return has(it) ? get(it) : set(it, {});
  2324. };
  2325. var getterFor = function (TYPE) {
  2326. return function (it) {
  2327. var state;
  2328. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  2329. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  2330. }
  2331. return state;
  2332. };
  2333. };
  2334. if (NATIVE_WEAK_MAP || shared.state) {
  2335. var store = shared.state || (shared.state = new WeakMap());
  2336. var wmget = uncurryThis(store.get);
  2337. var wmhas = uncurryThis(store.has);
  2338. var wmset = uncurryThis(store.set);
  2339. set = function (it, metadata) {
  2340. if (wmhas(store, it))
  2341. throw new TypeError(OBJECT_ALREADY_INITIALIZED);
  2342. metadata.facade = it;
  2343. wmset(store, it, metadata);
  2344. return metadata;
  2345. };
  2346. get = function (it) {
  2347. return wmget(store, it) || {};
  2348. };
  2349. has = function (it) {
  2350. return wmhas(store, it);
  2351. };
  2352. } else {
  2353. var STATE = sharedKey('state');
  2354. hiddenKeys[STATE] = true;
  2355. set = function (it, metadata) {
  2356. if (hasOwn(it, STATE))
  2357. throw new TypeError(OBJECT_ALREADY_INITIALIZED);
  2358. metadata.facade = it;
  2359. createNonEnumerableProperty(it, STATE, metadata);
  2360. return metadata;
  2361. };
  2362. get = function (it) {
  2363. return hasOwn(it, STATE) ? it[STATE] : {};
  2364. };
  2365. has = function (it) {
  2366. return hasOwn(it, STATE);
  2367. };
  2368. }
  2369. module.exports = {
  2370. set: set,
  2371. get: get,
  2372. has: has,
  2373. enforce: enforce,
  2374. getterFor: getterFor
  2375. };
  2376. /***/ }),
  2377. /* 55 */
  2378. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2379. var global = __w_pdfjs_require__(8);
  2380. var isCallable = __w_pdfjs_require__(24);
  2381. var inspectSource = __w_pdfjs_require__(53);
  2382. var WeakMap = global.WeakMap;
  2383. module.exports = isCallable(WeakMap) && /native code/.test(inspectSource(WeakMap));
  2384. /***/ }),
  2385. /* 56 */
  2386. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2387. var shared = __w_pdfjs_require__(37);
  2388. var uid = __w_pdfjs_require__(43);
  2389. var keys = shared('keys');
  2390. module.exports = function (key) {
  2391. return keys[key] || (keys[key] = uid(key));
  2392. };
  2393. /***/ }),
  2394. /* 57 */
  2395. /***/ ((module) => {
  2396. module.exports = {};
  2397. /***/ }),
  2398. /* 58 */
  2399. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2400. var hasOwn = __w_pdfjs_require__(41);
  2401. var ownKeys = __w_pdfjs_require__(59);
  2402. var getOwnPropertyDescriptorModule = __w_pdfjs_require__(9);
  2403. var definePropertyModule = __w_pdfjs_require__(47);
  2404. module.exports = function (target, source, exceptions) {
  2405. var keys = ownKeys(source);
  2406. var defineProperty = definePropertyModule.f;
  2407. var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  2408. for (var i = 0; i < keys.length; i++) {
  2409. var key = keys[i];
  2410. if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
  2411. defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  2412. }
  2413. }
  2414. };
  2415. /***/ }),
  2416. /* 59 */
  2417. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2418. var getBuiltIn = __w_pdfjs_require__(26);
  2419. var uncurryThis = __w_pdfjs_require__(18);
  2420. var getOwnPropertyNamesModule = __w_pdfjs_require__(60);
  2421. var getOwnPropertySymbolsModule = __w_pdfjs_require__(69);
  2422. var anObject = __w_pdfjs_require__(49);
  2423. var concat = uncurryThis([].concat);
  2424. module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  2425. var keys = getOwnPropertyNamesModule.f(anObject(it));
  2426. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  2427. return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
  2428. };
  2429. /***/ }),
  2430. /* 60 */
  2431. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2432. var internalObjectKeys = __w_pdfjs_require__(61);
  2433. var enumBugKeys = __w_pdfjs_require__(68);
  2434. var hiddenKeys = enumBugKeys.concat('length', 'prototype');
  2435. exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  2436. return internalObjectKeys(O, hiddenKeys);
  2437. };
  2438. /***/ }),
  2439. /* 61 */
  2440. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2441. var uncurryThis = __w_pdfjs_require__(18);
  2442. var hasOwn = __w_pdfjs_require__(41);
  2443. var toIndexedObject = __w_pdfjs_require__(16);
  2444. var indexOf = (__w_pdfjs_require__(62).indexOf);
  2445. var hiddenKeys = __w_pdfjs_require__(57);
  2446. var push = uncurryThis([].push);
  2447. module.exports = function (object, names) {
  2448. var O = toIndexedObject(object);
  2449. var i = 0;
  2450. var result = [];
  2451. var key;
  2452. for (key in O)
  2453. !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
  2454. while (names.length > i)
  2455. if (hasOwn(O, key = names[i++])) {
  2456. ~indexOf(result, key) || push(result, key);
  2457. }
  2458. return result;
  2459. };
  2460. /***/ }),
  2461. /* 62 */
  2462. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2463. var toIndexedObject = __w_pdfjs_require__(16);
  2464. var toAbsoluteIndex = __w_pdfjs_require__(63);
  2465. var lengthOfArrayLike = __w_pdfjs_require__(66);
  2466. var createMethod = function (IS_INCLUDES) {
  2467. return function ($this, el, fromIndex) {
  2468. var O = toIndexedObject($this);
  2469. var length = lengthOfArrayLike(O);
  2470. var index = toAbsoluteIndex(fromIndex, length);
  2471. var value;
  2472. if (IS_INCLUDES && el != el)
  2473. while (length > index) {
  2474. value = O[index++];
  2475. if (value != value)
  2476. return true;
  2477. }
  2478. else
  2479. for (; length > index; index++) {
  2480. if ((IS_INCLUDES || index in O) && O[index] === el)
  2481. return IS_INCLUDES || index || 0;
  2482. }
  2483. return !IS_INCLUDES && -1;
  2484. };
  2485. };
  2486. module.exports = {
  2487. includes: createMethod(true),
  2488. indexOf: createMethod(false)
  2489. };
  2490. /***/ }),
  2491. /* 63 */
  2492. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2493. var toIntegerOrInfinity = __w_pdfjs_require__(64);
  2494. var max = Math.max;
  2495. var min = Math.min;
  2496. module.exports = function (index, length) {
  2497. var integer = toIntegerOrInfinity(index);
  2498. return integer < 0 ? max(integer + length, 0) : min(integer, length);
  2499. };
  2500. /***/ }),
  2501. /* 64 */
  2502. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2503. var trunc = __w_pdfjs_require__(65);
  2504. module.exports = function (argument) {
  2505. var number = +argument;
  2506. return number !== number || number === 0 ? 0 : trunc(number);
  2507. };
  2508. /***/ }),
  2509. /* 65 */
  2510. /***/ ((module) => {
  2511. var ceil = Math.ceil;
  2512. var floor = Math.floor;
  2513. module.exports = Math.trunc || function trunc(x) {
  2514. var n = +x;
  2515. return (n > 0 ? floor : ceil)(n);
  2516. };
  2517. /***/ }),
  2518. /* 66 */
  2519. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2520. var toLength = __w_pdfjs_require__(67);
  2521. module.exports = function (obj) {
  2522. return toLength(obj.length);
  2523. };
  2524. /***/ }),
  2525. /* 67 */
  2526. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2527. var toIntegerOrInfinity = __w_pdfjs_require__(64);
  2528. var min = Math.min;
  2529. module.exports = function (argument) {
  2530. return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0;
  2531. };
  2532. /***/ }),
  2533. /* 68 */
  2534. /***/ ((module) => {
  2535. module.exports = [
  2536. 'constructor',
  2537. 'hasOwnProperty',
  2538. 'isPrototypeOf',
  2539. 'propertyIsEnumerable',
  2540. 'toLocaleString',
  2541. 'toString',
  2542. 'valueOf'
  2543. ];
  2544. /***/ }),
  2545. /* 69 */
  2546. /***/ ((__unused_webpack_module, exports) => {
  2547. exports.f = Object.getOwnPropertySymbols;
  2548. /***/ }),
  2549. /* 70 */
  2550. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2551. var fails = __w_pdfjs_require__(11);
  2552. var isCallable = __w_pdfjs_require__(24);
  2553. var replacement = /#|\.prototype\./;
  2554. var isForced = function (feature, detection) {
  2555. var value = data[normalize(feature)];
  2556. return value == POLYFILL ? true : value == NATIVE ? false : isCallable(detection) ? fails(detection) : !!detection;
  2557. };
  2558. var normalize = isForced.normalize = function (string) {
  2559. return String(string).replace(replacement, '.').toLowerCase();
  2560. };
  2561. var data = isForced.data = {};
  2562. var NATIVE = isForced.NATIVE = 'N';
  2563. var POLYFILL = isForced.POLYFILL = 'P';
  2564. module.exports = isForced;
  2565. /***/ }),
  2566. /* 71 */
  2567. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2568. var wellKnownSymbol = __w_pdfjs_require__(36);
  2569. var create = __w_pdfjs_require__(72);
  2570. var defineProperty = (__w_pdfjs_require__(47).f);
  2571. var UNSCOPABLES = wellKnownSymbol('unscopables');
  2572. var ArrayPrototype = Array.prototype;
  2573. if (ArrayPrototype[UNSCOPABLES] == undefined) {
  2574. defineProperty(ArrayPrototype, UNSCOPABLES, {
  2575. configurable: true,
  2576. value: create(null)
  2577. });
  2578. }
  2579. module.exports = function (key) {
  2580. ArrayPrototype[UNSCOPABLES][key] = true;
  2581. };
  2582. /***/ }),
  2583. /* 72 */
  2584. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2585. var anObject = __w_pdfjs_require__(49);
  2586. var definePropertiesModule = __w_pdfjs_require__(73);
  2587. var enumBugKeys = __w_pdfjs_require__(68);
  2588. var hiddenKeys = __w_pdfjs_require__(57);
  2589. var html = __w_pdfjs_require__(75);
  2590. var documentCreateElement = __w_pdfjs_require__(45);
  2591. var sharedKey = __w_pdfjs_require__(56);
  2592. var GT = '>';
  2593. var LT = '<';
  2594. var PROTOTYPE = 'prototype';
  2595. var SCRIPT = 'script';
  2596. var IE_PROTO = sharedKey('IE_PROTO');
  2597. var EmptyConstructor = function () {
  2598. };
  2599. var scriptTag = function (content) {
  2600. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  2601. };
  2602. var NullProtoObjectViaActiveX = function (activeXDocument) {
  2603. activeXDocument.write(scriptTag(''));
  2604. activeXDocument.close();
  2605. var temp = activeXDocument.parentWindow.Object;
  2606. activeXDocument = null;
  2607. return temp;
  2608. };
  2609. var NullProtoObjectViaIFrame = function () {
  2610. var iframe = documentCreateElement('iframe');
  2611. var JS = 'java' + SCRIPT + ':';
  2612. var iframeDocument;
  2613. iframe.style.display = 'none';
  2614. html.appendChild(iframe);
  2615. iframe.src = String(JS);
  2616. iframeDocument = iframe.contentWindow.document;
  2617. iframeDocument.open();
  2618. iframeDocument.write(scriptTag('document.F=Object'));
  2619. iframeDocument.close();
  2620. return iframeDocument.F;
  2621. };
  2622. var activeXDocument;
  2623. var NullProtoObject = function () {
  2624. try {
  2625. activeXDocument = new ActiveXObject('htmlfile');
  2626. } catch (error) {
  2627. }
  2628. NullProtoObject = typeof document != 'undefined' ? document.domain && activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame() : NullProtoObjectViaActiveX(activeXDocument);
  2629. var length = enumBugKeys.length;
  2630. while (length--)
  2631. delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  2632. return NullProtoObject();
  2633. };
  2634. hiddenKeys[IE_PROTO] = true;
  2635. module.exports = Object.create || function create(O, Properties) {
  2636. var result;
  2637. if (O !== null) {
  2638. EmptyConstructor[PROTOTYPE] = anObject(O);
  2639. result = new EmptyConstructor();
  2640. EmptyConstructor[PROTOTYPE] = null;
  2641. result[IE_PROTO] = O;
  2642. } else
  2643. result = NullProtoObject();
  2644. return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
  2645. };
  2646. /***/ }),
  2647. /* 73 */
  2648. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2649. var DESCRIPTORS = __w_pdfjs_require__(10);
  2650. var V8_PROTOTYPE_DEFINE_BUG = __w_pdfjs_require__(48);
  2651. var definePropertyModule = __w_pdfjs_require__(47);
  2652. var anObject = __w_pdfjs_require__(49);
  2653. var toIndexedObject = __w_pdfjs_require__(16);
  2654. var objectKeys = __w_pdfjs_require__(74);
  2655. exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
  2656. anObject(O);
  2657. var props = toIndexedObject(Properties);
  2658. var keys = objectKeys(Properties);
  2659. var length = keys.length;
  2660. var index = 0;
  2661. var key;
  2662. while (length > index)
  2663. definePropertyModule.f(O, key = keys[index++], props[key]);
  2664. return O;
  2665. };
  2666. /***/ }),
  2667. /* 74 */
  2668. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2669. var internalObjectKeys = __w_pdfjs_require__(61);
  2670. var enumBugKeys = __w_pdfjs_require__(68);
  2671. module.exports = Object.keys || function keys(O) {
  2672. return internalObjectKeys(O, enumBugKeys);
  2673. };
  2674. /***/ }),
  2675. /* 75 */
  2676. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2677. var getBuiltIn = __w_pdfjs_require__(26);
  2678. module.exports = getBuiltIn('document', 'documentElement');
  2679. /***/ }),
  2680. /* 76 */
  2681. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2682. var global = __w_pdfjs_require__(8);
  2683. var uncurryThis = __w_pdfjs_require__(18);
  2684. module.exports = function (CONSTRUCTOR, METHOD) {
  2685. return uncurryThis(global[CONSTRUCTOR].prototype[METHOD]);
  2686. };
  2687. /***/ }),
  2688. /* 77 */
  2689. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2690. __w_pdfjs_require__(78);
  2691. /***/ }),
  2692. /* 78 */
  2693. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2694. "use strict";
  2695. var ArrayBufferViewCore = __w_pdfjs_require__(79);
  2696. var lengthOfArrayLike = __w_pdfjs_require__(66);
  2697. var toIntegerOrInfinity = __w_pdfjs_require__(64);
  2698. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  2699. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  2700. exportTypedArrayMethod('at', function at(index) {
  2701. var O = aTypedArray(this);
  2702. var len = lengthOfArrayLike(O);
  2703. var relativeIndex = toIntegerOrInfinity(index);
  2704. var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex;
  2705. return k < 0 || k >= len ? undefined : O[k];
  2706. });
  2707. /***/ }),
  2708. /* 79 */
  2709. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2710. "use strict";
  2711. var NATIVE_ARRAY_BUFFER = __w_pdfjs_require__(80);
  2712. var DESCRIPTORS = __w_pdfjs_require__(10);
  2713. var global = __w_pdfjs_require__(8);
  2714. var isCallable = __w_pdfjs_require__(24);
  2715. var isObject = __w_pdfjs_require__(23);
  2716. var hasOwn = __w_pdfjs_require__(41);
  2717. var classof = __w_pdfjs_require__(81);
  2718. var tryToString = __w_pdfjs_require__(34);
  2719. var createNonEnumerableProperty = __w_pdfjs_require__(46);
  2720. var defineBuiltIn = __w_pdfjs_require__(50);
  2721. var defineProperty = (__w_pdfjs_require__(47).f);
  2722. var isPrototypeOf = __w_pdfjs_require__(27);
  2723. var getPrototypeOf = __w_pdfjs_require__(83);
  2724. var setPrototypeOf = __w_pdfjs_require__(85);
  2725. var wellKnownSymbol = __w_pdfjs_require__(36);
  2726. var uid = __w_pdfjs_require__(43);
  2727. var InternalStateModule = __w_pdfjs_require__(54);
  2728. var enforceInternalState = InternalStateModule.enforce;
  2729. var getInternalState = InternalStateModule.get;
  2730. var Int8Array = global.Int8Array;
  2731. var Int8ArrayPrototype = Int8Array && Int8Array.prototype;
  2732. var Uint8ClampedArray = global.Uint8ClampedArray;
  2733. var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype;
  2734. var TypedArray = Int8Array && getPrototypeOf(Int8Array);
  2735. var TypedArrayPrototype = Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype);
  2736. var ObjectPrototype = Object.prototype;
  2737. var TypeError = global.TypeError;
  2738. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  2739. var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG');
  2740. var TYPED_ARRAY_CONSTRUCTOR = 'TypedArrayConstructor';
  2741. var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(global.opera) !== 'Opera';
  2742. var TYPED_ARRAY_TAG_REQUIRED = false;
  2743. var NAME, Constructor, Prototype;
  2744. var TypedArrayConstructorsList = {
  2745. Int8Array: 1,
  2746. Uint8Array: 1,
  2747. Uint8ClampedArray: 1,
  2748. Int16Array: 2,
  2749. Uint16Array: 2,
  2750. Int32Array: 4,
  2751. Uint32Array: 4,
  2752. Float32Array: 4,
  2753. Float64Array: 8
  2754. };
  2755. var BigIntArrayConstructorsList = {
  2756. BigInt64Array: 8,
  2757. BigUint64Array: 8
  2758. };
  2759. var isView = function isView(it) {
  2760. if (!isObject(it))
  2761. return false;
  2762. var klass = classof(it);
  2763. return klass === 'DataView' || hasOwn(TypedArrayConstructorsList, klass) || hasOwn(BigIntArrayConstructorsList, klass);
  2764. };
  2765. var getTypedArrayConstructor = function (it) {
  2766. var proto = getPrototypeOf(it);
  2767. if (!isObject(proto))
  2768. return;
  2769. var state = getInternalState(proto);
  2770. return state && hasOwn(state, TYPED_ARRAY_CONSTRUCTOR) ? state[TYPED_ARRAY_CONSTRUCTOR] : getTypedArrayConstructor(proto);
  2771. };
  2772. var isTypedArray = function (it) {
  2773. if (!isObject(it))
  2774. return false;
  2775. var klass = classof(it);
  2776. return hasOwn(TypedArrayConstructorsList, klass) || hasOwn(BigIntArrayConstructorsList, klass);
  2777. };
  2778. var aTypedArray = function (it) {
  2779. if (isTypedArray(it))
  2780. return it;
  2781. throw TypeError('Target is not a typed array');
  2782. };
  2783. var aTypedArrayConstructor = function (C) {
  2784. if (isCallable(C) && (!setPrototypeOf || isPrototypeOf(TypedArray, C)))
  2785. return C;
  2786. throw TypeError(tryToString(C) + ' is not a typed array constructor');
  2787. };
  2788. var exportTypedArrayMethod = function (KEY, property, forced, options) {
  2789. if (!DESCRIPTORS)
  2790. return;
  2791. if (forced)
  2792. for (var ARRAY in TypedArrayConstructorsList) {
  2793. var TypedArrayConstructor = global[ARRAY];
  2794. if (TypedArrayConstructor && hasOwn(TypedArrayConstructor.prototype, KEY))
  2795. try {
  2796. delete TypedArrayConstructor.prototype[KEY];
  2797. } catch (error) {
  2798. try {
  2799. TypedArrayConstructor.prototype[KEY] = property;
  2800. } catch (error2) {
  2801. }
  2802. }
  2803. }
  2804. if (!TypedArrayPrototype[KEY] || forced) {
  2805. defineBuiltIn(TypedArrayPrototype, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property, options);
  2806. }
  2807. };
  2808. var exportTypedArrayStaticMethod = function (KEY, property, forced) {
  2809. var ARRAY, TypedArrayConstructor;
  2810. if (!DESCRIPTORS)
  2811. return;
  2812. if (setPrototypeOf) {
  2813. if (forced)
  2814. for (ARRAY in TypedArrayConstructorsList) {
  2815. TypedArrayConstructor = global[ARRAY];
  2816. if (TypedArrayConstructor && hasOwn(TypedArrayConstructor, KEY))
  2817. try {
  2818. delete TypedArrayConstructor[KEY];
  2819. } catch (error) {
  2820. }
  2821. }
  2822. if (!TypedArray[KEY] || forced) {
  2823. try {
  2824. return defineBuiltIn(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && TypedArray[KEY] || property);
  2825. } catch (error) {
  2826. }
  2827. } else
  2828. return;
  2829. }
  2830. for (ARRAY in TypedArrayConstructorsList) {
  2831. TypedArrayConstructor = global[ARRAY];
  2832. if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) {
  2833. defineBuiltIn(TypedArrayConstructor, KEY, property);
  2834. }
  2835. }
  2836. };
  2837. for (NAME in TypedArrayConstructorsList) {
  2838. Constructor = global[NAME];
  2839. Prototype = Constructor && Constructor.prototype;
  2840. if (Prototype)
  2841. enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor;
  2842. else
  2843. NATIVE_ARRAY_BUFFER_VIEWS = false;
  2844. }
  2845. for (NAME in BigIntArrayConstructorsList) {
  2846. Constructor = global[NAME];
  2847. Prototype = Constructor && Constructor.prototype;
  2848. if (Prototype)
  2849. enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor;
  2850. }
  2851. if (!NATIVE_ARRAY_BUFFER_VIEWS || !isCallable(TypedArray) || TypedArray === Function.prototype) {
  2852. TypedArray = function TypedArray() {
  2853. throw TypeError('Incorrect invocation');
  2854. };
  2855. if (NATIVE_ARRAY_BUFFER_VIEWS)
  2856. for (NAME in TypedArrayConstructorsList) {
  2857. if (global[NAME])
  2858. setPrototypeOf(global[NAME], TypedArray);
  2859. }
  2860. }
  2861. if (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) {
  2862. TypedArrayPrototype = TypedArray.prototype;
  2863. if (NATIVE_ARRAY_BUFFER_VIEWS)
  2864. for (NAME in TypedArrayConstructorsList) {
  2865. if (global[NAME])
  2866. setPrototypeOf(global[NAME].prototype, TypedArrayPrototype);
  2867. }
  2868. }
  2869. if (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) {
  2870. setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype);
  2871. }
  2872. if (DESCRIPTORS && !hasOwn(TypedArrayPrototype, TO_STRING_TAG)) {
  2873. TYPED_ARRAY_TAG_REQUIRED = true;
  2874. defineProperty(TypedArrayPrototype, TO_STRING_TAG, {
  2875. get: function () {
  2876. return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined;
  2877. }
  2878. });
  2879. for (NAME in TypedArrayConstructorsList)
  2880. if (global[NAME]) {
  2881. createNonEnumerableProperty(global[NAME], TYPED_ARRAY_TAG, NAME);
  2882. }
  2883. }
  2884. module.exports = {
  2885. NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS,
  2886. TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQUIRED && TYPED_ARRAY_TAG,
  2887. aTypedArray: aTypedArray,
  2888. aTypedArrayConstructor: aTypedArrayConstructor,
  2889. exportTypedArrayMethod: exportTypedArrayMethod,
  2890. exportTypedArrayStaticMethod: exportTypedArrayStaticMethod,
  2891. getTypedArrayConstructor: getTypedArrayConstructor,
  2892. isView: isView,
  2893. isTypedArray: isTypedArray,
  2894. TypedArray: TypedArray,
  2895. TypedArrayPrototype: TypedArrayPrototype
  2896. };
  2897. /***/ }),
  2898. /* 80 */
  2899. /***/ ((module) => {
  2900. module.exports = typeof ArrayBuffer != 'undefined' && typeof DataView != 'undefined';
  2901. /***/ }),
  2902. /* 81 */
  2903. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2904. var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(82);
  2905. var isCallable = __w_pdfjs_require__(24);
  2906. var classofRaw = __w_pdfjs_require__(19);
  2907. var wellKnownSymbol = __w_pdfjs_require__(36);
  2908. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  2909. var $Object = Object;
  2910. var CORRECT_ARGUMENTS = classofRaw((function () {
  2911. return arguments;
  2912. }())) == 'Arguments';
  2913. var tryGet = function (it, key) {
  2914. try {
  2915. return it[key];
  2916. } catch (error) {
  2917. }
  2918. };
  2919. module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
  2920. var O, tag, result;
  2921. 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;
  2922. };
  2923. /***/ }),
  2924. /* 82 */
  2925. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2926. var wellKnownSymbol = __w_pdfjs_require__(36);
  2927. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  2928. var test = {};
  2929. test[TO_STRING_TAG] = 'z';
  2930. module.exports = String(test) === '[object z]';
  2931. /***/ }),
  2932. /* 83 */
  2933. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2934. var hasOwn = __w_pdfjs_require__(41);
  2935. var isCallable = __w_pdfjs_require__(24);
  2936. var toObject = __w_pdfjs_require__(42);
  2937. var sharedKey = __w_pdfjs_require__(56);
  2938. var CORRECT_PROTOTYPE_GETTER = __w_pdfjs_require__(84);
  2939. var IE_PROTO = sharedKey('IE_PROTO');
  2940. var $Object = Object;
  2941. var ObjectPrototype = $Object.prototype;
  2942. module.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
  2943. var object = toObject(O);
  2944. if (hasOwn(object, IE_PROTO))
  2945. return object[IE_PROTO];
  2946. var constructor = object.constructor;
  2947. if (isCallable(constructor) && object instanceof constructor) {
  2948. return constructor.prototype;
  2949. }
  2950. return object instanceof $Object ? ObjectPrototype : null;
  2951. };
  2952. /***/ }),
  2953. /* 84 */
  2954. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2955. var fails = __w_pdfjs_require__(11);
  2956. module.exports = !fails(function () {
  2957. function F() {
  2958. }
  2959. F.prototype.constructor = null;
  2960. return Object.getPrototypeOf(new F()) !== F.prototype;
  2961. });
  2962. /***/ }),
  2963. /* 85 */
  2964. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2965. var uncurryThis = __w_pdfjs_require__(18);
  2966. var anObject = __w_pdfjs_require__(49);
  2967. var aPossiblePrototype = __w_pdfjs_require__(86);
  2968. module.exports = Object.setPrototypeOf || ('__proto__' in {} ? (function () {
  2969. var CORRECT_SETTER = false;
  2970. var test = {};
  2971. var setter;
  2972. try {
  2973. setter = uncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
  2974. setter(test, []);
  2975. CORRECT_SETTER = test instanceof Array;
  2976. } catch (error) {
  2977. }
  2978. return function setPrototypeOf(O, proto) {
  2979. anObject(O);
  2980. aPossiblePrototype(proto);
  2981. if (CORRECT_SETTER)
  2982. setter(O, proto);
  2983. else
  2984. O.__proto__ = proto;
  2985. return O;
  2986. };
  2987. }()) : undefined);
  2988. /***/ }),
  2989. /* 86 */
  2990. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2991. var isCallable = __w_pdfjs_require__(24);
  2992. var $String = String;
  2993. var $TypeError = TypeError;
  2994. module.exports = function (argument) {
  2995. if (typeof argument == 'object' || isCallable(argument))
  2996. return argument;
  2997. throw $TypeError("Can't set " + $String(argument) + ' as a prototype');
  2998. };
  2999. /***/ }),
  3000. /* 87 */
  3001. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3002. __w_pdfjs_require__(88);
  3003. __w_pdfjs_require__(94);
  3004. __w_pdfjs_require__(96);
  3005. __w_pdfjs_require__(118);
  3006. __w_pdfjs_require__(120);
  3007. var path = __w_pdfjs_require__(129);
  3008. module.exports = path.structuredClone;
  3009. /***/ }),
  3010. /* 88 */
  3011. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3012. "use strict";
  3013. var toIndexedObject = __w_pdfjs_require__(16);
  3014. var addToUnscopables = __w_pdfjs_require__(71);
  3015. var Iterators = __w_pdfjs_require__(89);
  3016. var InternalStateModule = __w_pdfjs_require__(54);
  3017. var defineProperty = (__w_pdfjs_require__(47).f);
  3018. var defineIterator = __w_pdfjs_require__(90);
  3019. var IS_PURE = __w_pdfjs_require__(38);
  3020. var DESCRIPTORS = __w_pdfjs_require__(10);
  3021. var ARRAY_ITERATOR = 'Array Iterator';
  3022. var setInternalState = InternalStateModule.set;
  3023. var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
  3024. module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
  3025. setInternalState(this, {
  3026. type: ARRAY_ITERATOR,
  3027. target: toIndexedObject(iterated),
  3028. index: 0,
  3029. kind: kind
  3030. });
  3031. }, function () {
  3032. var state = getInternalState(this);
  3033. var target = state.target;
  3034. var kind = state.kind;
  3035. var index = state.index++;
  3036. if (!target || index >= target.length) {
  3037. state.target = undefined;
  3038. return {
  3039. value: undefined,
  3040. done: true
  3041. };
  3042. }
  3043. if (kind == 'keys')
  3044. return {
  3045. value: index,
  3046. done: false
  3047. };
  3048. if (kind == 'values')
  3049. return {
  3050. value: target[index],
  3051. done: false
  3052. };
  3053. return {
  3054. value: [
  3055. index,
  3056. target[index]
  3057. ],
  3058. done: false
  3059. };
  3060. }, 'values');
  3061. var values = Iterators.Arguments = Iterators.Array;
  3062. addToUnscopables('keys');
  3063. addToUnscopables('values');
  3064. addToUnscopables('entries');
  3065. if (!IS_PURE && DESCRIPTORS && values.name !== 'values')
  3066. try {
  3067. defineProperty(values, 'name', { value: 'values' });
  3068. } catch (error) {
  3069. }
  3070. /***/ }),
  3071. /* 89 */
  3072. /***/ ((module) => {
  3073. module.exports = {};
  3074. /***/ }),
  3075. /* 90 */
  3076. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3077. "use strict";
  3078. var $ = __w_pdfjs_require__(7);
  3079. var call = __w_pdfjs_require__(12);
  3080. var IS_PURE = __w_pdfjs_require__(38);
  3081. var FunctionName = __w_pdfjs_require__(52);
  3082. var isCallable = __w_pdfjs_require__(24);
  3083. var createIteratorConstructor = __w_pdfjs_require__(91);
  3084. var getPrototypeOf = __w_pdfjs_require__(83);
  3085. var setPrototypeOf = __w_pdfjs_require__(85);
  3086. var setToStringTag = __w_pdfjs_require__(93);
  3087. var createNonEnumerableProperty = __w_pdfjs_require__(46);
  3088. var defineBuiltIn = __w_pdfjs_require__(50);
  3089. var wellKnownSymbol = __w_pdfjs_require__(36);
  3090. var Iterators = __w_pdfjs_require__(89);
  3091. var IteratorsCore = __w_pdfjs_require__(92);
  3092. var PROPER_FUNCTION_NAME = FunctionName.PROPER;
  3093. var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
  3094. var IteratorPrototype = IteratorsCore.IteratorPrototype;
  3095. var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
  3096. var ITERATOR = wellKnownSymbol('iterator');
  3097. var KEYS = 'keys';
  3098. var VALUES = 'values';
  3099. var ENTRIES = 'entries';
  3100. var returnThis = function () {
  3101. return this;
  3102. };
  3103. module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
  3104. createIteratorConstructor(IteratorConstructor, NAME, next);
  3105. var getIterationMethod = function (KIND) {
  3106. if (KIND === DEFAULT && defaultIterator)
  3107. return defaultIterator;
  3108. if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype)
  3109. return IterablePrototype[KIND];
  3110. switch (KIND) {
  3111. case KEYS:
  3112. return function keys() {
  3113. return new IteratorConstructor(this, KIND);
  3114. };
  3115. case VALUES:
  3116. return function values() {
  3117. return new IteratorConstructor(this, KIND);
  3118. };
  3119. case ENTRIES:
  3120. return function entries() {
  3121. return new IteratorConstructor(this, KIND);
  3122. };
  3123. }
  3124. return function () {
  3125. return new IteratorConstructor(this);
  3126. };
  3127. };
  3128. var TO_STRING_TAG = NAME + ' Iterator';
  3129. var INCORRECT_VALUES_NAME = false;
  3130. var IterablePrototype = Iterable.prototype;
  3131. var nativeIterator = IterablePrototype[ITERATOR] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT];
  3132. var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
  3133. var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
  3134. var CurrentIteratorPrototype, methods, KEY;
  3135. if (anyNativeIterator) {
  3136. CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
  3137. if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
  3138. if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
  3139. if (setPrototypeOf) {
  3140. setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
  3141. } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {
  3142. defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis);
  3143. }
  3144. }
  3145. setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
  3146. if (IS_PURE)
  3147. Iterators[TO_STRING_TAG] = returnThis;
  3148. }
  3149. }
  3150. if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
  3151. if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) {
  3152. createNonEnumerableProperty(IterablePrototype, 'name', VALUES);
  3153. } else {
  3154. INCORRECT_VALUES_NAME = true;
  3155. defaultIterator = function values() {
  3156. return call(nativeIterator, this);
  3157. };
  3158. }
  3159. }
  3160. if (DEFAULT) {
  3161. methods = {
  3162. values: getIterationMethod(VALUES),
  3163. keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
  3164. entries: getIterationMethod(ENTRIES)
  3165. };
  3166. if (FORCED)
  3167. for (KEY in methods) {
  3168. if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
  3169. defineBuiltIn(IterablePrototype, KEY, methods[KEY]);
  3170. }
  3171. }
  3172. else
  3173. $({
  3174. target: NAME,
  3175. proto: true,
  3176. forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME
  3177. }, methods);
  3178. }
  3179. if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
  3180. defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT });
  3181. }
  3182. Iterators[NAME] = defaultIterator;
  3183. return methods;
  3184. };
  3185. /***/ }),
  3186. /* 91 */
  3187. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3188. "use strict";
  3189. var IteratorPrototype = (__w_pdfjs_require__(92).IteratorPrototype);
  3190. var create = __w_pdfjs_require__(72);
  3191. var createPropertyDescriptor = __w_pdfjs_require__(15);
  3192. var setToStringTag = __w_pdfjs_require__(93);
  3193. var Iterators = __w_pdfjs_require__(89);
  3194. var returnThis = function () {
  3195. return this;
  3196. };
  3197. module.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
  3198. var TO_STRING_TAG = NAME + ' Iterator';
  3199. IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
  3200. setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
  3201. Iterators[TO_STRING_TAG] = returnThis;
  3202. return IteratorConstructor;
  3203. };
  3204. /***/ }),
  3205. /* 92 */
  3206. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3207. "use strict";
  3208. var fails = __w_pdfjs_require__(11);
  3209. var isCallable = __w_pdfjs_require__(24);
  3210. var create = __w_pdfjs_require__(72);
  3211. var getPrototypeOf = __w_pdfjs_require__(83);
  3212. var defineBuiltIn = __w_pdfjs_require__(50);
  3213. var wellKnownSymbol = __w_pdfjs_require__(36);
  3214. var IS_PURE = __w_pdfjs_require__(38);
  3215. var ITERATOR = wellKnownSymbol('iterator');
  3216. var BUGGY_SAFARI_ITERATORS = false;
  3217. var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
  3218. if ([].keys) {
  3219. arrayIterator = [].keys();
  3220. if (!('next' in arrayIterator))
  3221. BUGGY_SAFARI_ITERATORS = true;
  3222. else {
  3223. PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
  3224. if (PrototypeOfArrayIteratorPrototype !== Object.prototype)
  3225. IteratorPrototype = PrototypeOfArrayIteratorPrototype;
  3226. }
  3227. }
  3228. var NEW_ITERATOR_PROTOTYPE = IteratorPrototype == undefined || fails(function () {
  3229. var test = {};
  3230. return IteratorPrototype[ITERATOR].call(test) !== test;
  3231. });
  3232. if (NEW_ITERATOR_PROTOTYPE)
  3233. IteratorPrototype = {};
  3234. else if (IS_PURE)
  3235. IteratorPrototype = create(IteratorPrototype);
  3236. if (!isCallable(IteratorPrototype[ITERATOR])) {
  3237. defineBuiltIn(IteratorPrototype, ITERATOR, function () {
  3238. return this;
  3239. });
  3240. }
  3241. module.exports = {
  3242. IteratorPrototype: IteratorPrototype,
  3243. BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
  3244. };
  3245. /***/ }),
  3246. /* 93 */
  3247. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3248. var defineProperty = (__w_pdfjs_require__(47).f);
  3249. var hasOwn = __w_pdfjs_require__(41);
  3250. var wellKnownSymbol = __w_pdfjs_require__(36);
  3251. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  3252. module.exports = function (target, TAG, STATIC) {
  3253. if (target && !STATIC)
  3254. target = target.prototype;
  3255. if (target && !hasOwn(target, TO_STRING_TAG)) {
  3256. defineProperty(target, TO_STRING_TAG, {
  3257. configurable: true,
  3258. value: TAG
  3259. });
  3260. }
  3261. };
  3262. /***/ }),
  3263. /* 94 */
  3264. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3265. var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(82);
  3266. var defineBuiltIn = __w_pdfjs_require__(50);
  3267. var toString = __w_pdfjs_require__(95);
  3268. if (!TO_STRING_TAG_SUPPORT) {
  3269. defineBuiltIn(Object.prototype, 'toString', toString, { unsafe: true });
  3270. }
  3271. /***/ }),
  3272. /* 95 */
  3273. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3274. "use strict";
  3275. var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(82);
  3276. var classof = __w_pdfjs_require__(81);
  3277. module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
  3278. return '[object ' + classof(this) + ']';
  3279. };
  3280. /***/ }),
  3281. /* 96 */
  3282. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3283. __w_pdfjs_require__(97);
  3284. /***/ }),
  3285. /* 97 */
  3286. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3287. "use strict";
  3288. var collection = __w_pdfjs_require__(98);
  3289. var collectionStrong = __w_pdfjs_require__(115);
  3290. collection('Map', function (init) {
  3291. return function Map() {
  3292. return init(this, arguments.length ? arguments[0] : undefined);
  3293. };
  3294. }, collectionStrong);
  3295. /***/ }),
  3296. /* 98 */
  3297. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3298. "use strict";
  3299. var $ = __w_pdfjs_require__(7);
  3300. var global = __w_pdfjs_require__(8);
  3301. var uncurryThis = __w_pdfjs_require__(18);
  3302. var isForced = __w_pdfjs_require__(70);
  3303. var defineBuiltIn = __w_pdfjs_require__(50);
  3304. var InternalMetadataModule = __w_pdfjs_require__(99);
  3305. var iterate = __w_pdfjs_require__(106);
  3306. var anInstance = __w_pdfjs_require__(112);
  3307. var isCallable = __w_pdfjs_require__(24);
  3308. var isObject = __w_pdfjs_require__(23);
  3309. var fails = __w_pdfjs_require__(11);
  3310. var checkCorrectnessOfIteration = __w_pdfjs_require__(113);
  3311. var setToStringTag = __w_pdfjs_require__(93);
  3312. var inheritIfRequired = __w_pdfjs_require__(114);
  3313. module.exports = function (CONSTRUCTOR_NAME, wrapper, common) {
  3314. var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
  3315. var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
  3316. var ADDER = IS_MAP ? 'set' : 'add';
  3317. var NativeConstructor = global[CONSTRUCTOR_NAME];
  3318. var NativePrototype = NativeConstructor && NativeConstructor.prototype;
  3319. var Constructor = NativeConstructor;
  3320. var exported = {};
  3321. var fixMethod = function (KEY) {
  3322. var uncurriedNativeMethod = uncurryThis(NativePrototype[KEY]);
  3323. defineBuiltIn(NativePrototype, KEY, KEY == 'add' ? function add(value) {
  3324. uncurriedNativeMethod(this, value === 0 ? 0 : value);
  3325. return this;
  3326. } : KEY == 'delete' ? function (key) {
  3327. return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key);
  3328. } : KEY == 'get' ? function get(key) {
  3329. return IS_WEAK && !isObject(key) ? undefined : uncurriedNativeMethod(this, key === 0 ? 0 : key);
  3330. } : KEY == 'has' ? function has(key) {
  3331. return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key);
  3332. } : function set(key, value) {
  3333. uncurriedNativeMethod(this, key === 0 ? 0 : key, value);
  3334. return this;
  3335. });
  3336. };
  3337. var REPLACE = isForced(CONSTRUCTOR_NAME, !isCallable(NativeConstructor) || !(IS_WEAK || NativePrototype.forEach && !fails(function () {
  3338. new NativeConstructor().entries().next();
  3339. })));
  3340. if (REPLACE) {
  3341. Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
  3342. InternalMetadataModule.enable();
  3343. } else if (isForced(CONSTRUCTOR_NAME, true)) {
  3344. var instance = new Constructor();
  3345. var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
  3346. var THROWS_ON_PRIMITIVES = fails(function () {
  3347. instance.has(1);
  3348. });
  3349. var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) {
  3350. new NativeConstructor(iterable);
  3351. });
  3352. var BUGGY_ZERO = !IS_WEAK && fails(function () {
  3353. var $instance = new NativeConstructor();
  3354. var index = 5;
  3355. while (index--)
  3356. $instance[ADDER](index, index);
  3357. return !$instance.has(-0);
  3358. });
  3359. if (!ACCEPT_ITERABLES) {
  3360. Constructor = wrapper(function (dummy, iterable) {
  3361. anInstance(dummy, NativePrototype);
  3362. var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor);
  3363. if (iterable != undefined)
  3364. iterate(iterable, that[ADDER], {
  3365. that: that,
  3366. AS_ENTRIES: IS_MAP
  3367. });
  3368. return that;
  3369. });
  3370. Constructor.prototype = NativePrototype;
  3371. NativePrototype.constructor = Constructor;
  3372. }
  3373. if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
  3374. fixMethod('delete');
  3375. fixMethod('has');
  3376. IS_MAP && fixMethod('get');
  3377. }
  3378. if (BUGGY_ZERO || HASNT_CHAINING)
  3379. fixMethod(ADDER);
  3380. if (IS_WEAK && NativePrototype.clear)
  3381. delete NativePrototype.clear;
  3382. }
  3383. exported[CONSTRUCTOR_NAME] = Constructor;
  3384. $({
  3385. global: true,
  3386. constructor: true,
  3387. forced: Constructor != NativeConstructor
  3388. }, exported);
  3389. setToStringTag(Constructor, CONSTRUCTOR_NAME);
  3390. if (!IS_WEAK)
  3391. common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
  3392. return Constructor;
  3393. };
  3394. /***/ }),
  3395. /* 99 */
  3396. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3397. var $ = __w_pdfjs_require__(7);
  3398. var uncurryThis = __w_pdfjs_require__(18);
  3399. var hiddenKeys = __w_pdfjs_require__(57);
  3400. var isObject = __w_pdfjs_require__(23);
  3401. var hasOwn = __w_pdfjs_require__(41);
  3402. var defineProperty = (__w_pdfjs_require__(47).f);
  3403. var getOwnPropertyNamesModule = __w_pdfjs_require__(60);
  3404. var getOwnPropertyNamesExternalModule = __w_pdfjs_require__(100);
  3405. var isExtensible = __w_pdfjs_require__(103);
  3406. var uid = __w_pdfjs_require__(43);
  3407. var FREEZING = __w_pdfjs_require__(105);
  3408. var REQUIRED = false;
  3409. var METADATA = uid('meta');
  3410. var id = 0;
  3411. var setMetadata = function (it) {
  3412. defineProperty(it, METADATA, {
  3413. value: {
  3414. objectID: 'O' + id++,
  3415. weakData: {}
  3416. }
  3417. });
  3418. };
  3419. var fastKey = function (it, create) {
  3420. if (!isObject(it))
  3421. return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  3422. if (!hasOwn(it, METADATA)) {
  3423. if (!isExtensible(it))
  3424. return 'F';
  3425. if (!create)
  3426. return 'E';
  3427. setMetadata(it);
  3428. }
  3429. return it[METADATA].objectID;
  3430. };
  3431. var getWeakData = function (it, create) {
  3432. if (!hasOwn(it, METADATA)) {
  3433. if (!isExtensible(it))
  3434. return true;
  3435. if (!create)
  3436. return false;
  3437. setMetadata(it);
  3438. }
  3439. return it[METADATA].weakData;
  3440. };
  3441. var onFreeze = function (it) {
  3442. if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA))
  3443. setMetadata(it);
  3444. return it;
  3445. };
  3446. var enable = function () {
  3447. meta.enable = function () {
  3448. };
  3449. REQUIRED = true;
  3450. var getOwnPropertyNames = getOwnPropertyNamesModule.f;
  3451. var splice = uncurryThis([].splice);
  3452. var test = {};
  3453. test[METADATA] = 1;
  3454. if (getOwnPropertyNames(test).length) {
  3455. getOwnPropertyNamesModule.f = function (it) {
  3456. var result = getOwnPropertyNames(it);
  3457. for (var i = 0, length = result.length; i < length; i++) {
  3458. if (result[i] === METADATA) {
  3459. splice(result, i, 1);
  3460. break;
  3461. }
  3462. }
  3463. return result;
  3464. };
  3465. $({
  3466. target: 'Object',
  3467. stat: true,
  3468. forced: true
  3469. }, { getOwnPropertyNames: getOwnPropertyNamesExternalModule.f });
  3470. }
  3471. };
  3472. var meta = module.exports = {
  3473. enable: enable,
  3474. fastKey: fastKey,
  3475. getWeakData: getWeakData,
  3476. onFreeze: onFreeze
  3477. };
  3478. hiddenKeys[METADATA] = true;
  3479. /***/ }),
  3480. /* 100 */
  3481. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3482. var classof = __w_pdfjs_require__(19);
  3483. var toIndexedObject = __w_pdfjs_require__(16);
  3484. var $getOwnPropertyNames = (__w_pdfjs_require__(60).f);
  3485. var arraySlice = __w_pdfjs_require__(101);
  3486. var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
  3487. var getWindowNames = function (it) {
  3488. try {
  3489. return $getOwnPropertyNames(it);
  3490. } catch (error) {
  3491. return arraySlice(windowNames);
  3492. }
  3493. };
  3494. module.exports.f = function getOwnPropertyNames(it) {
  3495. return windowNames && classof(it) == 'Window' ? getWindowNames(it) : $getOwnPropertyNames(toIndexedObject(it));
  3496. };
  3497. /***/ }),
  3498. /* 101 */
  3499. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3500. var toAbsoluteIndex = __w_pdfjs_require__(63);
  3501. var lengthOfArrayLike = __w_pdfjs_require__(66);
  3502. var createProperty = __w_pdfjs_require__(102);
  3503. var $Array = Array;
  3504. var max = Math.max;
  3505. module.exports = function (O, start, end) {
  3506. var length = lengthOfArrayLike(O);
  3507. var k = toAbsoluteIndex(start, length);
  3508. var fin = toAbsoluteIndex(end === undefined ? length : end, length);
  3509. var result = $Array(max(fin - k, 0));
  3510. for (var n = 0; k < fin; k++, n++)
  3511. createProperty(result, n, O[k]);
  3512. result.length = n;
  3513. return result;
  3514. };
  3515. /***/ }),
  3516. /* 102 */
  3517. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3518. "use strict";
  3519. var toPropertyKey = __w_pdfjs_require__(21);
  3520. var definePropertyModule = __w_pdfjs_require__(47);
  3521. var createPropertyDescriptor = __w_pdfjs_require__(15);
  3522. module.exports = function (object, key, value) {
  3523. var propertyKey = toPropertyKey(key);
  3524. if (propertyKey in object)
  3525. definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
  3526. else
  3527. object[propertyKey] = value;
  3528. };
  3529. /***/ }),
  3530. /* 103 */
  3531. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3532. var fails = __w_pdfjs_require__(11);
  3533. var isObject = __w_pdfjs_require__(23);
  3534. var classof = __w_pdfjs_require__(19);
  3535. var ARRAY_BUFFER_NON_EXTENSIBLE = __w_pdfjs_require__(104);
  3536. var $isExtensible = Object.isExtensible;
  3537. var FAILS_ON_PRIMITIVES = fails(function () {
  3538. $isExtensible(1);
  3539. });
  3540. module.exports = FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE ? function isExtensible(it) {
  3541. if (!isObject(it))
  3542. return false;
  3543. if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer')
  3544. return false;
  3545. return $isExtensible ? $isExtensible(it) : true;
  3546. } : $isExtensible;
  3547. /***/ }),
  3548. /* 104 */
  3549. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3550. var fails = __w_pdfjs_require__(11);
  3551. module.exports = fails(function () {
  3552. if (typeof ArrayBuffer == 'function') {
  3553. var buffer = new ArrayBuffer(8);
  3554. if (Object.isExtensible(buffer))
  3555. Object.defineProperty(buffer, 'a', { value: 8 });
  3556. }
  3557. });
  3558. /***/ }),
  3559. /* 105 */
  3560. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3561. var fails = __w_pdfjs_require__(11);
  3562. module.exports = !fails(function () {
  3563. return Object.isExtensible(Object.preventExtensions({}));
  3564. });
  3565. /***/ }),
  3566. /* 106 */
  3567. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3568. var bind = __w_pdfjs_require__(107);
  3569. var call = __w_pdfjs_require__(12);
  3570. var anObject = __w_pdfjs_require__(49);
  3571. var tryToString = __w_pdfjs_require__(34);
  3572. var isArrayIteratorMethod = __w_pdfjs_require__(108);
  3573. var lengthOfArrayLike = __w_pdfjs_require__(66);
  3574. var isPrototypeOf = __w_pdfjs_require__(27);
  3575. var getIterator = __w_pdfjs_require__(109);
  3576. var getIteratorMethod = __w_pdfjs_require__(110);
  3577. var iteratorClose = __w_pdfjs_require__(111);
  3578. var $TypeError = TypeError;
  3579. var Result = function (stopped, result) {
  3580. this.stopped = stopped;
  3581. this.result = result;
  3582. };
  3583. var ResultPrototype = Result.prototype;
  3584. module.exports = function (iterable, unboundFunction, options) {
  3585. var that = options && options.that;
  3586. var AS_ENTRIES = !!(options && options.AS_ENTRIES);
  3587. var IS_RECORD = !!(options && options.IS_RECORD);
  3588. var IS_ITERATOR = !!(options && options.IS_ITERATOR);
  3589. var INTERRUPTED = !!(options && options.INTERRUPTED);
  3590. var fn = bind(unboundFunction, that);
  3591. var iterator, iterFn, index, length, result, next, step;
  3592. var stop = function (condition) {
  3593. if (iterator)
  3594. iteratorClose(iterator, 'normal', condition);
  3595. return new Result(true, condition);
  3596. };
  3597. var callFn = function (value) {
  3598. if (AS_ENTRIES) {
  3599. anObject(value);
  3600. return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
  3601. }
  3602. return INTERRUPTED ? fn(value, stop) : fn(value);
  3603. };
  3604. if (IS_RECORD) {
  3605. iterator = iterable.iterator;
  3606. } else if (IS_ITERATOR) {
  3607. iterator = iterable;
  3608. } else {
  3609. iterFn = getIteratorMethod(iterable);
  3610. if (!iterFn)
  3611. throw $TypeError(tryToString(iterable) + ' is not iterable');
  3612. if (isArrayIteratorMethod(iterFn)) {
  3613. for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
  3614. result = callFn(iterable[index]);
  3615. if (result && isPrototypeOf(ResultPrototype, result))
  3616. return result;
  3617. }
  3618. return new Result(false);
  3619. }
  3620. iterator = getIterator(iterable, iterFn);
  3621. }
  3622. next = IS_RECORD ? iterable.next : iterator.next;
  3623. while (!(step = call(next, iterator)).done) {
  3624. try {
  3625. result = callFn(step.value);
  3626. } catch (error) {
  3627. iteratorClose(iterator, 'throw', error);
  3628. }
  3629. if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result))
  3630. return result;
  3631. }
  3632. return new Result(false);
  3633. };
  3634. /***/ }),
  3635. /* 107 */
  3636. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3637. var uncurryThis = __w_pdfjs_require__(18);
  3638. var aCallable = __w_pdfjs_require__(33);
  3639. var NATIVE_BIND = __w_pdfjs_require__(13);
  3640. var bind = uncurryThis(uncurryThis.bind);
  3641. module.exports = function (fn, that) {
  3642. aCallable(fn);
  3643. return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function () {
  3644. return fn.apply(that, arguments);
  3645. };
  3646. };
  3647. /***/ }),
  3648. /* 108 */
  3649. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3650. var wellKnownSymbol = __w_pdfjs_require__(36);
  3651. var Iterators = __w_pdfjs_require__(89);
  3652. var ITERATOR = wellKnownSymbol('iterator');
  3653. var ArrayPrototype = Array.prototype;
  3654. module.exports = function (it) {
  3655. return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
  3656. };
  3657. /***/ }),
  3658. /* 109 */
  3659. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3660. var call = __w_pdfjs_require__(12);
  3661. var aCallable = __w_pdfjs_require__(33);
  3662. var anObject = __w_pdfjs_require__(49);
  3663. var tryToString = __w_pdfjs_require__(34);
  3664. var getIteratorMethod = __w_pdfjs_require__(110);
  3665. var $TypeError = TypeError;
  3666. module.exports = function (argument, usingIterator) {
  3667. var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
  3668. if (aCallable(iteratorMethod))
  3669. return anObject(call(iteratorMethod, argument));
  3670. throw $TypeError(tryToString(argument) + ' is not iterable');
  3671. };
  3672. /***/ }),
  3673. /* 110 */
  3674. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3675. var classof = __w_pdfjs_require__(81);
  3676. var getMethod = __w_pdfjs_require__(32);
  3677. var Iterators = __w_pdfjs_require__(89);
  3678. var wellKnownSymbol = __w_pdfjs_require__(36);
  3679. var ITERATOR = wellKnownSymbol('iterator');
  3680. module.exports = function (it) {
  3681. if (it != undefined)
  3682. return getMethod(it, ITERATOR) || getMethod(it, '@@iterator') || Iterators[classof(it)];
  3683. };
  3684. /***/ }),
  3685. /* 111 */
  3686. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3687. var call = __w_pdfjs_require__(12);
  3688. var anObject = __w_pdfjs_require__(49);
  3689. var getMethod = __w_pdfjs_require__(32);
  3690. module.exports = function (iterator, kind, value) {
  3691. var innerResult, innerError;
  3692. anObject(iterator);
  3693. try {
  3694. innerResult = getMethod(iterator, 'return');
  3695. if (!innerResult) {
  3696. if (kind === 'throw')
  3697. throw value;
  3698. return value;
  3699. }
  3700. innerResult = call(innerResult, iterator);
  3701. } catch (error) {
  3702. innerError = true;
  3703. innerResult = error;
  3704. }
  3705. if (kind === 'throw')
  3706. throw value;
  3707. if (innerError)
  3708. throw innerResult;
  3709. anObject(innerResult);
  3710. return value;
  3711. };
  3712. /***/ }),
  3713. /* 112 */
  3714. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3715. var isPrototypeOf = __w_pdfjs_require__(27);
  3716. var $TypeError = TypeError;
  3717. module.exports = function (it, Prototype) {
  3718. if (isPrototypeOf(Prototype, it))
  3719. return it;
  3720. throw $TypeError('Incorrect invocation');
  3721. };
  3722. /***/ }),
  3723. /* 113 */
  3724. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3725. var wellKnownSymbol = __w_pdfjs_require__(36);
  3726. var ITERATOR = wellKnownSymbol('iterator');
  3727. var SAFE_CLOSING = false;
  3728. try {
  3729. var called = 0;
  3730. var iteratorWithReturn = {
  3731. next: function () {
  3732. return { done: !!called++ };
  3733. },
  3734. 'return': function () {
  3735. SAFE_CLOSING = true;
  3736. }
  3737. };
  3738. iteratorWithReturn[ITERATOR] = function () {
  3739. return this;
  3740. };
  3741. Array.from(iteratorWithReturn, function () {
  3742. throw 2;
  3743. });
  3744. } catch (error) {
  3745. }
  3746. module.exports = function (exec, SKIP_CLOSING) {
  3747. if (!SKIP_CLOSING && !SAFE_CLOSING)
  3748. return false;
  3749. var ITERATION_SUPPORT = false;
  3750. try {
  3751. var object = {};
  3752. object[ITERATOR] = function () {
  3753. return {
  3754. next: function () {
  3755. return { done: ITERATION_SUPPORT = true };
  3756. }
  3757. };
  3758. };
  3759. exec(object);
  3760. } catch (error) {
  3761. }
  3762. return ITERATION_SUPPORT;
  3763. };
  3764. /***/ }),
  3765. /* 114 */
  3766. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3767. var isCallable = __w_pdfjs_require__(24);
  3768. var isObject = __w_pdfjs_require__(23);
  3769. var setPrototypeOf = __w_pdfjs_require__(85);
  3770. module.exports = function ($this, dummy, Wrapper) {
  3771. var NewTarget, NewTargetPrototype;
  3772. if (setPrototypeOf && isCallable(NewTarget = dummy.constructor) && NewTarget !== Wrapper && isObject(NewTargetPrototype = NewTarget.prototype) && NewTargetPrototype !== Wrapper.prototype)
  3773. setPrototypeOf($this, NewTargetPrototype);
  3774. return $this;
  3775. };
  3776. /***/ }),
  3777. /* 115 */
  3778. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3779. "use strict";
  3780. var defineProperty = (__w_pdfjs_require__(47).f);
  3781. var create = __w_pdfjs_require__(72);
  3782. var defineBuiltIns = __w_pdfjs_require__(116);
  3783. var bind = __w_pdfjs_require__(107);
  3784. var anInstance = __w_pdfjs_require__(112);
  3785. var iterate = __w_pdfjs_require__(106);
  3786. var defineIterator = __w_pdfjs_require__(90);
  3787. var setSpecies = __w_pdfjs_require__(117);
  3788. var DESCRIPTORS = __w_pdfjs_require__(10);
  3789. var fastKey = (__w_pdfjs_require__(99).fastKey);
  3790. var InternalStateModule = __w_pdfjs_require__(54);
  3791. var setInternalState = InternalStateModule.set;
  3792. var internalStateGetterFor = InternalStateModule.getterFor;
  3793. module.exports = {
  3794. getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
  3795. var Constructor = wrapper(function (that, iterable) {
  3796. anInstance(that, Prototype);
  3797. setInternalState(that, {
  3798. type: CONSTRUCTOR_NAME,
  3799. index: create(null),
  3800. first: undefined,
  3801. last: undefined,
  3802. size: 0
  3803. });
  3804. if (!DESCRIPTORS)
  3805. that.size = 0;
  3806. if (iterable != undefined)
  3807. iterate(iterable, that[ADDER], {
  3808. that: that,
  3809. AS_ENTRIES: IS_MAP
  3810. });
  3811. });
  3812. var Prototype = Constructor.prototype;
  3813. var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
  3814. var define = function (that, key, value) {
  3815. var state = getInternalState(that);
  3816. var entry = getEntry(that, key);
  3817. var previous, index;
  3818. if (entry) {
  3819. entry.value = value;
  3820. } else {
  3821. state.last = entry = {
  3822. index: index = fastKey(key, true),
  3823. key: key,
  3824. value: value,
  3825. previous: previous = state.last,
  3826. next: undefined,
  3827. removed: false
  3828. };
  3829. if (!state.first)
  3830. state.first = entry;
  3831. if (previous)
  3832. previous.next = entry;
  3833. if (DESCRIPTORS)
  3834. state.size++;
  3835. else
  3836. that.size++;
  3837. if (index !== 'F')
  3838. state.index[index] = entry;
  3839. }
  3840. return that;
  3841. };
  3842. var getEntry = function (that, key) {
  3843. var state = getInternalState(that);
  3844. var index = fastKey(key);
  3845. var entry;
  3846. if (index !== 'F')
  3847. return state.index[index];
  3848. for (entry = state.first; entry; entry = entry.next) {
  3849. if (entry.key == key)
  3850. return entry;
  3851. }
  3852. };
  3853. defineBuiltIns(Prototype, {
  3854. clear: function clear() {
  3855. var that = this;
  3856. var state = getInternalState(that);
  3857. var data = state.index;
  3858. var entry = state.first;
  3859. while (entry) {
  3860. entry.removed = true;
  3861. if (entry.previous)
  3862. entry.previous = entry.previous.next = undefined;
  3863. delete data[entry.index];
  3864. entry = entry.next;
  3865. }
  3866. state.first = state.last = undefined;
  3867. if (DESCRIPTORS)
  3868. state.size = 0;
  3869. else
  3870. that.size = 0;
  3871. },
  3872. 'delete': function (key) {
  3873. var that = this;
  3874. var state = getInternalState(that);
  3875. var entry = getEntry(that, key);
  3876. if (entry) {
  3877. var next = entry.next;
  3878. var prev = entry.previous;
  3879. delete state.index[entry.index];
  3880. entry.removed = true;
  3881. if (prev)
  3882. prev.next = next;
  3883. if (next)
  3884. next.previous = prev;
  3885. if (state.first == entry)
  3886. state.first = next;
  3887. if (state.last == entry)
  3888. state.last = prev;
  3889. if (DESCRIPTORS)
  3890. state.size--;
  3891. else
  3892. that.size--;
  3893. }
  3894. return !!entry;
  3895. },
  3896. forEach: function forEach(callbackfn) {
  3897. var state = getInternalState(this);
  3898. var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  3899. var entry;
  3900. while (entry = entry ? entry.next : state.first) {
  3901. boundFunction(entry.value, entry.key, this);
  3902. while (entry && entry.removed)
  3903. entry = entry.previous;
  3904. }
  3905. },
  3906. has: function has(key) {
  3907. return !!getEntry(this, key);
  3908. }
  3909. });
  3910. defineBuiltIns(Prototype, IS_MAP ? {
  3911. get: function get(key) {
  3912. var entry = getEntry(this, key);
  3913. return entry && entry.value;
  3914. },
  3915. set: function set(key, value) {
  3916. return define(this, key === 0 ? 0 : key, value);
  3917. }
  3918. } : {
  3919. add: function add(value) {
  3920. return define(this, value = value === 0 ? 0 : value, value);
  3921. }
  3922. });
  3923. if (DESCRIPTORS)
  3924. defineProperty(Prototype, 'size', {
  3925. get: function () {
  3926. return getInternalState(this).size;
  3927. }
  3928. });
  3929. return Constructor;
  3930. },
  3931. setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) {
  3932. var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
  3933. var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
  3934. var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
  3935. defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) {
  3936. setInternalState(this, {
  3937. type: ITERATOR_NAME,
  3938. target: iterated,
  3939. state: getInternalCollectionState(iterated),
  3940. kind: kind,
  3941. last: undefined
  3942. });
  3943. }, function () {
  3944. var state = getInternalIteratorState(this);
  3945. var kind = state.kind;
  3946. var entry = state.last;
  3947. while (entry && entry.removed)
  3948. entry = entry.previous;
  3949. if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
  3950. state.target = undefined;
  3951. return {
  3952. value: undefined,
  3953. done: true
  3954. };
  3955. }
  3956. if (kind == 'keys')
  3957. return {
  3958. value: entry.key,
  3959. done: false
  3960. };
  3961. if (kind == 'values')
  3962. return {
  3963. value: entry.value,
  3964. done: false
  3965. };
  3966. return {
  3967. value: [
  3968. entry.key,
  3969. entry.value
  3970. ],
  3971. done: false
  3972. };
  3973. }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
  3974. setSpecies(CONSTRUCTOR_NAME);
  3975. }
  3976. };
  3977. /***/ }),
  3978. /* 116 */
  3979. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3980. var defineBuiltIn = __w_pdfjs_require__(50);
  3981. module.exports = function (target, src, options) {
  3982. for (var key in src)
  3983. defineBuiltIn(target, key, src[key], options);
  3984. return target;
  3985. };
  3986. /***/ }),
  3987. /* 117 */
  3988. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3989. "use strict";
  3990. var getBuiltIn = __w_pdfjs_require__(26);
  3991. var definePropertyModule = __w_pdfjs_require__(47);
  3992. var wellKnownSymbol = __w_pdfjs_require__(36);
  3993. var DESCRIPTORS = __w_pdfjs_require__(10);
  3994. var SPECIES = wellKnownSymbol('species');
  3995. module.exports = function (CONSTRUCTOR_NAME) {
  3996. var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
  3997. var defineProperty = definePropertyModule.f;
  3998. if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
  3999. defineProperty(Constructor, SPECIES, {
  4000. configurable: true,
  4001. get: function () {
  4002. return this;
  4003. }
  4004. });
  4005. }
  4006. };
  4007. /***/ }),
  4008. /* 118 */
  4009. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4010. __w_pdfjs_require__(119);
  4011. /***/ }),
  4012. /* 119 */
  4013. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4014. "use strict";
  4015. var collection = __w_pdfjs_require__(98);
  4016. var collectionStrong = __w_pdfjs_require__(115);
  4017. collection('Set', function (init) {
  4018. return function Set() {
  4019. return init(this, arguments.length ? arguments[0] : undefined);
  4020. };
  4021. }, collectionStrong);
  4022. /***/ }),
  4023. /* 120 */
  4024. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4025. var IS_PURE = __w_pdfjs_require__(38);
  4026. var $ = __w_pdfjs_require__(7);
  4027. var global = __w_pdfjs_require__(8);
  4028. var getBuiltin = __w_pdfjs_require__(26);
  4029. var uncurryThis = __w_pdfjs_require__(18);
  4030. var fails = __w_pdfjs_require__(11);
  4031. var uid = __w_pdfjs_require__(43);
  4032. var isCallable = __w_pdfjs_require__(24);
  4033. var isConstructor = __w_pdfjs_require__(121);
  4034. var isObject = __w_pdfjs_require__(23);
  4035. var isSymbol = __w_pdfjs_require__(25);
  4036. var iterate = __w_pdfjs_require__(106);
  4037. var anObject = __w_pdfjs_require__(49);
  4038. var classof = __w_pdfjs_require__(81);
  4039. var hasOwn = __w_pdfjs_require__(41);
  4040. var createProperty = __w_pdfjs_require__(102);
  4041. var createNonEnumerableProperty = __w_pdfjs_require__(46);
  4042. var lengthOfArrayLike = __w_pdfjs_require__(66);
  4043. var validateArgumentsLength = __w_pdfjs_require__(122);
  4044. var getRegExpFlags = __w_pdfjs_require__(123);
  4045. var ERROR_STACK_INSTALLABLE = __w_pdfjs_require__(125);
  4046. var V8 = __w_pdfjs_require__(30);
  4047. var IS_BROWSER = __w_pdfjs_require__(126);
  4048. var IS_DENO = __w_pdfjs_require__(127);
  4049. var IS_NODE = __w_pdfjs_require__(128);
  4050. var Object = global.Object;
  4051. var Date = global.Date;
  4052. var Error = global.Error;
  4053. var EvalError = global.EvalError;
  4054. var RangeError = global.RangeError;
  4055. var ReferenceError = global.ReferenceError;
  4056. var SyntaxError = global.SyntaxError;
  4057. var TypeError = global.TypeError;
  4058. var URIError = global.URIError;
  4059. var PerformanceMark = global.PerformanceMark;
  4060. var WebAssembly = global.WebAssembly;
  4061. var CompileError = WebAssembly && WebAssembly.CompileError || Error;
  4062. var LinkError = WebAssembly && WebAssembly.LinkError || Error;
  4063. var RuntimeError = WebAssembly && WebAssembly.RuntimeError || Error;
  4064. var DOMException = getBuiltin('DOMException');
  4065. var Set = getBuiltin('Set');
  4066. var Map = getBuiltin('Map');
  4067. var MapPrototype = Map.prototype;
  4068. var mapHas = uncurryThis(MapPrototype.has);
  4069. var mapGet = uncurryThis(MapPrototype.get);
  4070. var mapSet = uncurryThis(MapPrototype.set);
  4071. var setAdd = uncurryThis(Set.prototype.add);
  4072. var objectKeys = getBuiltin('Object', 'keys');
  4073. var push = uncurryThis([].push);
  4074. var booleanValueOf = uncurryThis(true.valueOf);
  4075. var numberValueOf = uncurryThis(1.0.valueOf);
  4076. var stringValueOf = uncurryThis(''.valueOf);
  4077. var getTime = uncurryThis(Date.prototype.getTime);
  4078. var PERFORMANCE_MARK = uid('structuredClone');
  4079. var DATA_CLONE_ERROR = 'DataCloneError';
  4080. var TRANSFERRING = 'Transferring';
  4081. var checkBasicSemantic = function (structuredCloneImplementation) {
  4082. return !fails(function () {
  4083. var set1 = new global.Set([7]);
  4084. var set2 = structuredCloneImplementation(set1);
  4085. var number = structuredCloneImplementation(Object(7));
  4086. return set2 == set1 || !set2.has(7) || typeof number != 'object' || number != 7;
  4087. }) && structuredCloneImplementation;
  4088. };
  4089. var checkErrorsCloning = function (structuredCloneImplementation, $Error) {
  4090. return !fails(function () {
  4091. var error = new $Error();
  4092. var test = structuredCloneImplementation({
  4093. a: error,
  4094. b: error
  4095. });
  4096. return !(test && test.a === test.b && test.a instanceof $Error && test.a.stack === error.stack);
  4097. });
  4098. };
  4099. var checkNewErrorsCloningSemantic = function (structuredCloneImplementation) {
  4100. return !fails(function () {
  4101. var test = structuredCloneImplementation(new global.AggregateError([1], PERFORMANCE_MARK, { cause: 3 }));
  4102. return test.name != 'AggregateError' || test.errors[0] != 1 || test.message != PERFORMANCE_MARK || test.cause != 3;
  4103. });
  4104. };
  4105. var nativeStructuredClone = global.structuredClone;
  4106. var FORCED_REPLACEMENT = IS_PURE || !checkErrorsCloning(nativeStructuredClone, Error) || !checkErrorsCloning(nativeStructuredClone, DOMException) || !checkNewErrorsCloningSemantic(nativeStructuredClone);
  4107. var structuredCloneFromMark = !nativeStructuredClone && checkBasicSemantic(function (value) {
  4108. return new PerformanceMark(PERFORMANCE_MARK, { detail: value }).detail;
  4109. });
  4110. var nativeRestrictedStructuredClone = checkBasicSemantic(nativeStructuredClone) || structuredCloneFromMark;
  4111. var throwUncloneable = function (type) {
  4112. throw new DOMException('Uncloneable type: ' + type, DATA_CLONE_ERROR);
  4113. };
  4114. var throwUnpolyfillable = function (type, kind) {
  4115. throw new DOMException((kind || 'Cloning') + ' of ' + type + ' cannot be properly polyfilled in this engine', DATA_CLONE_ERROR);
  4116. };
  4117. var structuredCloneInternal = function (value, map) {
  4118. if (isSymbol(value))
  4119. throwUncloneable('Symbol');
  4120. if (!isObject(value))
  4121. return value;
  4122. if (map) {
  4123. if (mapHas(map, value))
  4124. return mapGet(map, value);
  4125. } else
  4126. map = new Map();
  4127. var type = classof(value);
  4128. var deep = false;
  4129. var C, name, cloned, dataTransfer, i, length, keys, key, source, target;
  4130. switch (type) {
  4131. case 'Array':
  4132. cloned = [];
  4133. deep = true;
  4134. break;
  4135. case 'Object':
  4136. cloned = {};
  4137. deep = true;
  4138. break;
  4139. case 'Map':
  4140. cloned = new Map();
  4141. deep = true;
  4142. break;
  4143. case 'Set':
  4144. cloned = new Set();
  4145. deep = true;
  4146. break;
  4147. case 'RegExp':
  4148. cloned = new RegExp(value.source, getRegExpFlags(value));
  4149. break;
  4150. case 'Error':
  4151. name = value.name;
  4152. switch (name) {
  4153. case 'AggregateError':
  4154. cloned = getBuiltin('AggregateError')([]);
  4155. break;
  4156. case 'EvalError':
  4157. cloned = EvalError();
  4158. break;
  4159. case 'RangeError':
  4160. cloned = RangeError();
  4161. break;
  4162. case 'ReferenceError':
  4163. cloned = ReferenceError();
  4164. break;
  4165. case 'SyntaxError':
  4166. cloned = SyntaxError();
  4167. break;
  4168. case 'TypeError':
  4169. cloned = TypeError();
  4170. break;
  4171. case 'URIError':
  4172. cloned = URIError();
  4173. break;
  4174. case 'CompileError':
  4175. cloned = CompileError();
  4176. break;
  4177. case 'LinkError':
  4178. cloned = LinkError();
  4179. break;
  4180. case 'RuntimeError':
  4181. cloned = RuntimeError();
  4182. break;
  4183. default:
  4184. cloned = Error();
  4185. }
  4186. deep = true;
  4187. break;
  4188. case 'DOMException':
  4189. cloned = new DOMException(value.message, value.name);
  4190. deep = true;
  4191. break;
  4192. case 'DataView':
  4193. case 'Int8Array':
  4194. case 'Uint8Array':
  4195. case 'Uint8ClampedArray':
  4196. case 'Int16Array':
  4197. case 'Uint16Array':
  4198. case 'Int32Array':
  4199. case 'Uint32Array':
  4200. case 'Float32Array':
  4201. case 'Float64Array':
  4202. case 'BigInt64Array':
  4203. case 'BigUint64Array':
  4204. C = global[type];
  4205. if (!isObject(C))
  4206. throwUnpolyfillable(type);
  4207. cloned = new C(structuredCloneInternal(value.buffer, map), value.byteOffset, type === 'DataView' ? value.byteLength : value.length);
  4208. break;
  4209. case 'DOMQuad':
  4210. try {
  4211. cloned = new DOMQuad(structuredCloneInternal(value.p1, map), structuredCloneInternal(value.p2, map), structuredCloneInternal(value.p3, map), structuredCloneInternal(value.p4, map));
  4212. } catch (error) {
  4213. if (nativeRestrictedStructuredClone) {
  4214. cloned = nativeRestrictedStructuredClone(value);
  4215. } else
  4216. throwUnpolyfillable(type);
  4217. }
  4218. break;
  4219. case 'FileList':
  4220. C = global.DataTransfer;
  4221. if (isConstructor(C)) {
  4222. dataTransfer = new C();
  4223. for (i = 0, length = lengthOfArrayLike(value); i < length; i++) {
  4224. dataTransfer.items.add(structuredCloneInternal(value[i], map));
  4225. }
  4226. cloned = dataTransfer.files;
  4227. } else if (nativeRestrictedStructuredClone) {
  4228. cloned = nativeRestrictedStructuredClone(value);
  4229. } else
  4230. throwUnpolyfillable(type);
  4231. break;
  4232. case 'ImageData':
  4233. try {
  4234. cloned = new ImageData(structuredCloneInternal(value.data, map), value.width, value.height, { colorSpace: value.colorSpace });
  4235. } catch (error) {
  4236. if (nativeRestrictedStructuredClone) {
  4237. cloned = nativeRestrictedStructuredClone(value);
  4238. } else
  4239. throwUnpolyfillable(type);
  4240. }
  4241. break;
  4242. default:
  4243. if (nativeRestrictedStructuredClone) {
  4244. cloned = nativeRestrictedStructuredClone(value);
  4245. } else
  4246. switch (type) {
  4247. case 'BigInt':
  4248. cloned = Object(value.valueOf());
  4249. break;
  4250. case 'Boolean':
  4251. cloned = Object(booleanValueOf(value));
  4252. break;
  4253. case 'Number':
  4254. cloned = Object(numberValueOf(value));
  4255. break;
  4256. case 'String':
  4257. cloned = Object(stringValueOf(value));
  4258. break;
  4259. case 'Date':
  4260. cloned = new Date(getTime(value));
  4261. break;
  4262. case 'ArrayBuffer':
  4263. C = global.DataView;
  4264. if (!C && typeof value.slice != 'function')
  4265. throwUnpolyfillable(type);
  4266. try {
  4267. if (typeof value.slice == 'function') {
  4268. cloned = value.slice(0);
  4269. } else {
  4270. length = value.byteLength;
  4271. cloned = new ArrayBuffer(length);
  4272. source = new C(value);
  4273. target = new C(cloned);
  4274. for (i = 0; i < length; i++) {
  4275. target.setUint8(i, source.getUint8(i));
  4276. }
  4277. }
  4278. } catch (error) {
  4279. throw new DOMException('ArrayBuffer is detached', DATA_CLONE_ERROR);
  4280. }
  4281. break;
  4282. case 'SharedArrayBuffer':
  4283. cloned = value;
  4284. break;
  4285. case 'Blob':
  4286. try {
  4287. cloned = value.slice(0, value.size, value.type);
  4288. } catch (error) {
  4289. throwUnpolyfillable(type);
  4290. }
  4291. break;
  4292. case 'DOMPoint':
  4293. case 'DOMPointReadOnly':
  4294. C = global[type];
  4295. try {
  4296. cloned = C.fromPoint ? C.fromPoint(value) : new C(value.x, value.y, value.z, value.w);
  4297. } catch (error) {
  4298. throwUnpolyfillable(type);
  4299. }
  4300. break;
  4301. case 'DOMRect':
  4302. case 'DOMRectReadOnly':
  4303. C = global[type];
  4304. try {
  4305. cloned = C.fromRect ? C.fromRect(value) : new C(value.x, value.y, value.width, value.height);
  4306. } catch (error) {
  4307. throwUnpolyfillable(type);
  4308. }
  4309. break;
  4310. case 'DOMMatrix':
  4311. case 'DOMMatrixReadOnly':
  4312. C = global[type];
  4313. try {
  4314. cloned = C.fromMatrix ? C.fromMatrix(value) : new C(value);
  4315. } catch (error) {
  4316. throwUnpolyfillable(type);
  4317. }
  4318. break;
  4319. case 'AudioData':
  4320. case 'VideoFrame':
  4321. if (!isCallable(value.clone))
  4322. throwUnpolyfillable(type);
  4323. try {
  4324. cloned = value.clone();
  4325. } catch (error) {
  4326. throwUncloneable(type);
  4327. }
  4328. break;
  4329. case 'File':
  4330. try {
  4331. cloned = new File([value], value.name, value);
  4332. } catch (error) {
  4333. throwUnpolyfillable(type);
  4334. }
  4335. break;
  4336. case 'CryptoKey':
  4337. case 'GPUCompilationMessage':
  4338. case 'GPUCompilationInfo':
  4339. case 'ImageBitmap':
  4340. case 'RTCCertificate':
  4341. case 'WebAssembly.Module':
  4342. throwUnpolyfillable(type);
  4343. default:
  4344. throwUncloneable(type);
  4345. }
  4346. }
  4347. mapSet(map, value, cloned);
  4348. if (deep)
  4349. switch (type) {
  4350. case 'Array':
  4351. case 'Object':
  4352. keys = objectKeys(value);
  4353. for (i = 0, length = lengthOfArrayLike(keys); i < length; i++) {
  4354. key = keys[i];
  4355. createProperty(cloned, key, structuredCloneInternal(value[key], map));
  4356. }
  4357. break;
  4358. case 'Map':
  4359. value.forEach(function (v, k) {
  4360. mapSet(cloned, structuredCloneInternal(k, map), structuredCloneInternal(v, map));
  4361. });
  4362. break;
  4363. case 'Set':
  4364. value.forEach(function (v) {
  4365. setAdd(cloned, structuredCloneInternal(v, map));
  4366. });
  4367. break;
  4368. case 'Error':
  4369. createNonEnumerableProperty(cloned, 'message', structuredCloneInternal(value.message, map));
  4370. if (hasOwn(value, 'cause')) {
  4371. createNonEnumerableProperty(cloned, 'cause', structuredCloneInternal(value.cause, map));
  4372. }
  4373. if (name == 'AggregateError') {
  4374. cloned.errors = structuredCloneInternal(value.errors, map);
  4375. }
  4376. case 'DOMException':
  4377. if (ERROR_STACK_INSTALLABLE) {
  4378. createNonEnumerableProperty(cloned, 'stack', structuredCloneInternal(value.stack, map));
  4379. }
  4380. }
  4381. return cloned;
  4382. };
  4383. var PROPER_TRANSFER = nativeStructuredClone && !fails(function () {
  4384. if (IS_DENO && V8 > 92 || IS_NODE && V8 > 94 || IS_BROWSER && V8 > 97)
  4385. return false;
  4386. var buffer = new ArrayBuffer(8);
  4387. var clone = nativeStructuredClone(buffer, { transfer: [buffer] });
  4388. return buffer.byteLength != 0 || clone.byteLength != 8;
  4389. });
  4390. var tryToTransfer = function (rawTransfer, map) {
  4391. if (!isObject(rawTransfer))
  4392. throw TypeError('Transfer option cannot be converted to a sequence');
  4393. var transfer = [];
  4394. iterate(rawTransfer, function (value) {
  4395. push(transfer, anObject(value));
  4396. });
  4397. var i = 0;
  4398. var length = lengthOfArrayLike(transfer);
  4399. var value, type, C, transferredArray, transferred, canvas, context;
  4400. if (PROPER_TRANSFER) {
  4401. transferredArray = nativeStructuredClone(transfer, { transfer: transfer });
  4402. while (i < length)
  4403. mapSet(map, transfer[i], transferredArray[i++]);
  4404. } else
  4405. while (i < length) {
  4406. value = transfer[i++];
  4407. if (mapHas(map, value))
  4408. throw new DOMException('Duplicate transferable', DATA_CLONE_ERROR);
  4409. type = classof(value);
  4410. switch (type) {
  4411. case 'ImageBitmap':
  4412. C = global.OffscreenCanvas;
  4413. if (!isConstructor(C))
  4414. throwUnpolyfillable(type, TRANSFERRING);
  4415. try {
  4416. canvas = new C(value.width, value.height);
  4417. context = canvas.getContext('bitmaprenderer');
  4418. context.transferFromImageBitmap(value);
  4419. transferred = canvas.transferToImageBitmap();
  4420. } catch (error) {
  4421. }
  4422. break;
  4423. case 'AudioData':
  4424. case 'VideoFrame':
  4425. if (!isCallable(value.clone) || !isCallable(value.close))
  4426. throwUnpolyfillable(type, TRANSFERRING);
  4427. try {
  4428. transferred = value.clone();
  4429. value.close();
  4430. } catch (error) {
  4431. }
  4432. break;
  4433. case 'ArrayBuffer':
  4434. case 'MessagePort':
  4435. case 'OffscreenCanvas':
  4436. case 'ReadableStream':
  4437. case 'TransformStream':
  4438. case 'WritableStream':
  4439. throwUnpolyfillable(type, TRANSFERRING);
  4440. }
  4441. if (transferred === undefined)
  4442. throw new DOMException('This object cannot be transferred: ' + type, DATA_CLONE_ERROR);
  4443. mapSet(map, value, transferred);
  4444. }
  4445. };
  4446. $({
  4447. global: true,
  4448. enumerable: true,
  4449. sham: !PROPER_TRANSFER,
  4450. forced: FORCED_REPLACEMENT
  4451. }, {
  4452. structuredClone: function structuredClone(value) {
  4453. var options = validateArgumentsLength(arguments.length, 1) > 1 && arguments[1] != null ? anObject(arguments[1]) : undefined;
  4454. var transfer = options ? options.transfer : undefined;
  4455. var map;
  4456. if (transfer !== undefined) {
  4457. map = new Map();
  4458. tryToTransfer(transfer, map);
  4459. }
  4460. return structuredCloneInternal(value, map);
  4461. }
  4462. });
  4463. /***/ }),
  4464. /* 121 */
  4465. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4466. var uncurryThis = __w_pdfjs_require__(18);
  4467. var fails = __w_pdfjs_require__(11);
  4468. var isCallable = __w_pdfjs_require__(24);
  4469. var classof = __w_pdfjs_require__(81);
  4470. var getBuiltIn = __w_pdfjs_require__(26);
  4471. var inspectSource = __w_pdfjs_require__(53);
  4472. var noop = function () {
  4473. };
  4474. var empty = [];
  4475. var construct = getBuiltIn('Reflect', 'construct');
  4476. var constructorRegExp = /^\s*(?:class|function)\b/;
  4477. var exec = uncurryThis(constructorRegExp.exec);
  4478. var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
  4479. var isConstructorModern = function isConstructor(argument) {
  4480. if (!isCallable(argument))
  4481. return false;
  4482. try {
  4483. construct(noop, empty, argument);
  4484. return true;
  4485. } catch (error) {
  4486. return false;
  4487. }
  4488. };
  4489. var isConstructorLegacy = function isConstructor(argument) {
  4490. if (!isCallable(argument))
  4491. return false;
  4492. switch (classof(argument)) {
  4493. case 'AsyncFunction':
  4494. case 'GeneratorFunction':
  4495. case 'AsyncGeneratorFunction':
  4496. return false;
  4497. }
  4498. try {
  4499. return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
  4500. } catch (error) {
  4501. return true;
  4502. }
  4503. };
  4504. isConstructorLegacy.sham = true;
  4505. module.exports = !construct || fails(function () {
  4506. var called;
  4507. return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function () {
  4508. called = true;
  4509. }) || called;
  4510. }) ? isConstructorLegacy : isConstructorModern;
  4511. /***/ }),
  4512. /* 122 */
  4513. /***/ ((module) => {
  4514. var $TypeError = TypeError;
  4515. module.exports = function (passed, required) {
  4516. if (passed < required)
  4517. throw $TypeError('Not enough arguments');
  4518. return passed;
  4519. };
  4520. /***/ }),
  4521. /* 123 */
  4522. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4523. var call = __w_pdfjs_require__(12);
  4524. var hasOwn = __w_pdfjs_require__(41);
  4525. var isPrototypeOf = __w_pdfjs_require__(27);
  4526. var regExpFlags = __w_pdfjs_require__(124);
  4527. var RegExpPrototype = RegExp.prototype;
  4528. module.exports = function (R) {
  4529. var flags = R.flags;
  4530. return flags === undefined && !('flags' in RegExpPrototype) && !hasOwn(R, 'flags') && isPrototypeOf(RegExpPrototype, R) ? call(regExpFlags, R) : flags;
  4531. };
  4532. /***/ }),
  4533. /* 124 */
  4534. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4535. "use strict";
  4536. var anObject = __w_pdfjs_require__(49);
  4537. module.exports = function () {
  4538. var that = anObject(this);
  4539. var result = '';
  4540. if (that.hasIndices)
  4541. result += 'd';
  4542. if (that.global)
  4543. result += 'g';
  4544. if (that.ignoreCase)
  4545. result += 'i';
  4546. if (that.multiline)
  4547. result += 'm';
  4548. if (that.dotAll)
  4549. result += 's';
  4550. if (that.unicode)
  4551. result += 'u';
  4552. if (that.unicodeSets)
  4553. result += 'v';
  4554. if (that.sticky)
  4555. result += 'y';
  4556. return result;
  4557. };
  4558. /***/ }),
  4559. /* 125 */
  4560. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4561. var fails = __w_pdfjs_require__(11);
  4562. var createPropertyDescriptor = __w_pdfjs_require__(15);
  4563. module.exports = !fails(function () {
  4564. var error = Error('a');
  4565. if (!('stack' in error))
  4566. return true;
  4567. Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));
  4568. return error.stack !== 7;
  4569. });
  4570. /***/ }),
  4571. /* 126 */
  4572. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4573. var IS_DENO = __w_pdfjs_require__(127);
  4574. var IS_NODE = __w_pdfjs_require__(128);
  4575. module.exports = !IS_DENO && !IS_NODE && typeof window == 'object' && typeof document == 'object';
  4576. /***/ }),
  4577. /* 127 */
  4578. /***/ ((module) => {
  4579. module.exports = typeof Deno == 'object' && Deno && typeof Deno.version == 'object';
  4580. /***/ }),
  4581. /* 128 */
  4582. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4583. var classof = __w_pdfjs_require__(19);
  4584. var global = __w_pdfjs_require__(8);
  4585. module.exports = classof(global.process) == 'process';
  4586. /***/ }),
  4587. /* 129 */
  4588. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4589. var global = __w_pdfjs_require__(8);
  4590. module.exports = global;
  4591. /***/ }),
  4592. /* 130 */
  4593. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4594. "use strict";
  4595. Object.defineProperty(exports, "__esModule", ({
  4596. value: true
  4597. }));
  4598. exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd = exports.CIRCULAR_REF = void 0;
  4599. exports.clearPrimitiveCaches = clearPrimitiveCaches;
  4600. exports.isCmd = isCmd;
  4601. exports.isDict = isDict;
  4602. exports.isName = isName;
  4603. exports.isRefsEqual = isRefsEqual;
  4604. var _util = __w_pdfjs_require__(2);
  4605. const CIRCULAR_REF = Symbol("CIRCULAR_REF");
  4606. exports.CIRCULAR_REF = CIRCULAR_REF;
  4607. const EOF = Symbol("EOF");
  4608. exports.EOF = EOF;
  4609. const Name = function NameClosure() {
  4610. let nameCache = Object.create(null);
  4611. class Name {
  4612. constructor(name) {
  4613. this.name = name;
  4614. }
  4615. static get(name) {
  4616. return nameCache[name] || (nameCache[name] = new Name(name));
  4617. }
  4618. static _clearCache() {
  4619. nameCache = Object.create(null);
  4620. }
  4621. }
  4622. return Name;
  4623. }();
  4624. exports.Name = Name;
  4625. const Cmd = function CmdClosure() {
  4626. let cmdCache = Object.create(null);
  4627. class Cmd {
  4628. constructor(cmd) {
  4629. this.cmd = cmd;
  4630. }
  4631. static get(cmd) {
  4632. return cmdCache[cmd] || (cmdCache[cmd] = new Cmd(cmd));
  4633. }
  4634. static _clearCache() {
  4635. cmdCache = Object.create(null);
  4636. }
  4637. }
  4638. return Cmd;
  4639. }();
  4640. exports.Cmd = Cmd;
  4641. const nonSerializable = function nonSerializableClosure() {
  4642. return nonSerializable;
  4643. };
  4644. class Dict {
  4645. constructor() {
  4646. let xref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  4647. this._map = Object.create(null);
  4648. this.xref = xref;
  4649. this.objId = null;
  4650. this.suppressEncryption = false;
  4651. this.__nonSerializable__ = nonSerializable;
  4652. }
  4653. assignXref(newXref) {
  4654. this.xref = newXref;
  4655. }
  4656. get size() {
  4657. return Object.keys(this._map).length;
  4658. }
  4659. get(key1, key2, key3) {
  4660. let value = this._map[key1];
  4661. if (value === undefined && key2 !== undefined) {
  4662. value = this._map[key2];
  4663. if (value === undefined && key3 !== undefined) {
  4664. value = this._map[key3];
  4665. }
  4666. }
  4667. if (value instanceof Ref && this.xref) {
  4668. return this.xref.fetch(value, this.suppressEncryption);
  4669. }
  4670. return value;
  4671. }
  4672. async getAsync(key1, key2, key3) {
  4673. let value = this._map[key1];
  4674. if (value === undefined && key2 !== undefined) {
  4675. value = this._map[key2];
  4676. if (value === undefined && key3 !== undefined) {
  4677. value = this._map[key3];
  4678. }
  4679. }
  4680. if (value instanceof Ref && this.xref) {
  4681. return this.xref.fetchAsync(value, this.suppressEncryption);
  4682. }
  4683. return value;
  4684. }
  4685. getArray(key1, key2, key3) {
  4686. let value = this._map[key1];
  4687. if (value === undefined && key2 !== undefined) {
  4688. value = this._map[key2];
  4689. if (value === undefined && key3 !== undefined) {
  4690. value = this._map[key3];
  4691. }
  4692. }
  4693. if (value instanceof Ref && this.xref) {
  4694. value = this.xref.fetch(value, this.suppressEncryption);
  4695. }
  4696. if (Array.isArray(value)) {
  4697. value = value.slice();
  4698. for (let i = 0, ii = value.length; i < ii; i++) {
  4699. if (value[i] instanceof Ref && this.xref) {
  4700. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  4701. }
  4702. }
  4703. }
  4704. return value;
  4705. }
  4706. getRaw(key) {
  4707. return this._map[key];
  4708. }
  4709. getKeys() {
  4710. return Object.keys(this._map);
  4711. }
  4712. getRawValues() {
  4713. return Object.values(this._map);
  4714. }
  4715. set(key, value) {
  4716. this._map[key] = value;
  4717. }
  4718. has(key) {
  4719. return this._map[key] !== undefined;
  4720. }
  4721. forEach(callback) {
  4722. for (const key in this._map) {
  4723. callback(key, this.get(key));
  4724. }
  4725. }
  4726. static get empty() {
  4727. const emptyDict = new Dict(null);
  4728. emptyDict.set = (key, value) => {
  4729. (0, _util.unreachable)("Should not call `set` on the empty dictionary.");
  4730. };
  4731. return (0, _util.shadow)(this, "empty", emptyDict);
  4732. }
  4733. static merge(_ref) {
  4734. let {
  4735. xref,
  4736. dictArray,
  4737. mergeSubDicts = false
  4738. } = _ref;
  4739. const mergedDict = new Dict(xref),
  4740. properties = new Map();
  4741. for (const dict of dictArray) {
  4742. if (!(dict instanceof Dict)) {
  4743. continue;
  4744. }
  4745. for (const [key, value] of Object.entries(dict._map)) {
  4746. let property = properties.get(key);
  4747. if (property === undefined) {
  4748. property = [];
  4749. properties.set(key, property);
  4750. } else if (!mergeSubDicts || !(value instanceof Dict)) {
  4751. continue;
  4752. }
  4753. property.push(value);
  4754. }
  4755. }
  4756. for (const [name, values] of properties) {
  4757. if (values.length === 1 || !(values[0] instanceof Dict)) {
  4758. mergedDict._map[name] = values[0];
  4759. continue;
  4760. }
  4761. const subDict = new Dict(xref);
  4762. for (const dict of values) {
  4763. for (const [key, value] of Object.entries(dict._map)) {
  4764. if (subDict._map[key] === undefined) {
  4765. subDict._map[key] = value;
  4766. }
  4767. }
  4768. }
  4769. if (subDict.size > 0) {
  4770. mergedDict._map[name] = subDict;
  4771. }
  4772. }
  4773. properties.clear();
  4774. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  4775. }
  4776. }
  4777. exports.Dict = Dict;
  4778. const Ref = function RefClosure() {
  4779. let refCache = Object.create(null);
  4780. class Ref {
  4781. constructor(num, gen) {
  4782. this.num = num;
  4783. this.gen = gen;
  4784. }
  4785. toString() {
  4786. if (this.gen === 0) {
  4787. return `${this.num}R`;
  4788. }
  4789. return `${this.num}R${this.gen}`;
  4790. }
  4791. static get(num, gen) {
  4792. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  4793. return refCache[key] || (refCache[key] = new Ref(num, gen));
  4794. }
  4795. static _clearCache() {
  4796. refCache = Object.create(null);
  4797. }
  4798. }
  4799. return Ref;
  4800. }();
  4801. exports.Ref = Ref;
  4802. class RefSet {
  4803. constructor() {
  4804. let parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  4805. this._set = new Set(parent && parent._set);
  4806. }
  4807. has(ref) {
  4808. return this._set.has(ref.toString());
  4809. }
  4810. put(ref) {
  4811. this._set.add(ref.toString());
  4812. }
  4813. remove(ref) {
  4814. this._set.delete(ref.toString());
  4815. }
  4816. [Symbol.iterator]() {
  4817. return this._set.values();
  4818. }
  4819. clear() {
  4820. this._set.clear();
  4821. }
  4822. }
  4823. exports.RefSet = RefSet;
  4824. class RefSetCache {
  4825. constructor() {
  4826. this._map = new Map();
  4827. }
  4828. get size() {
  4829. return this._map.size;
  4830. }
  4831. get(ref) {
  4832. return this._map.get(ref.toString());
  4833. }
  4834. has(ref) {
  4835. return this._map.has(ref.toString());
  4836. }
  4837. put(ref, obj) {
  4838. this._map.set(ref.toString(), obj);
  4839. }
  4840. putAlias(ref, aliasRef) {
  4841. this._map.set(ref.toString(), this.get(aliasRef));
  4842. }
  4843. [Symbol.iterator]() {
  4844. return this._map.values();
  4845. }
  4846. clear() {
  4847. this._map.clear();
  4848. }
  4849. }
  4850. exports.RefSetCache = RefSetCache;
  4851. function isName(v, name) {
  4852. return v instanceof Name && (name === undefined || v.name === name);
  4853. }
  4854. function isCmd(v, cmd) {
  4855. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  4856. }
  4857. function isDict(v, type) {
  4858. return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
  4859. }
  4860. function isRefsEqual(v1, v2) {
  4861. return v1.num === v2.num && v1.gen === v2.gen;
  4862. }
  4863. function clearPrimitiveCaches() {
  4864. Cmd._clearCache();
  4865. Name._clearCache();
  4866. Ref._clearCache();
  4867. }
  4868. /***/ }),
  4869. /* 131 */
  4870. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4871. "use strict";
  4872. Object.defineProperty(exports, "__esModule", ({
  4873. value: true
  4874. }));
  4875. exports.XRefParseException = exports.XRefEntryException = exports.ParserEOFException = exports.MissingDataException = exports.DocStats = void 0;
  4876. exports.collectActions = collectActions;
  4877. exports.encodeToXmlString = encodeToXmlString;
  4878. exports.escapePDFName = escapePDFName;
  4879. exports.getArrayLookupTableFactory = getArrayLookupTableFactory;
  4880. exports.getInheritableProperty = getInheritableProperty;
  4881. exports.getLookupTableFactory = getLookupTableFactory;
  4882. exports.getNewAnnotationsMap = getNewAnnotationsMap;
  4883. exports.isWhiteSpace = isWhiteSpace;
  4884. exports.log2 = log2;
  4885. exports.numberToString = numberToString;
  4886. exports.parseXFAPath = parseXFAPath;
  4887. exports.readInt8 = readInt8;
  4888. exports.readUint16 = readUint16;
  4889. exports.readUint32 = readUint32;
  4890. exports.recoverJsURL = recoverJsURL;
  4891. exports.toRomanNumerals = toRomanNumerals;
  4892. exports.validateCSSFont = validateCSSFont;
  4893. var _util = __w_pdfjs_require__(2);
  4894. var _primitives = __w_pdfjs_require__(130);
  4895. var _base_stream = __w_pdfjs_require__(132);
  4896. function getLookupTableFactory(initializer) {
  4897. let lookup;
  4898. return function () {
  4899. if (initializer) {
  4900. lookup = Object.create(null);
  4901. initializer(lookup);
  4902. initializer = null;
  4903. }
  4904. return lookup;
  4905. };
  4906. }
  4907. function getArrayLookupTableFactory(initializer) {
  4908. let lookup;
  4909. return function () {
  4910. if (initializer) {
  4911. let arr = initializer();
  4912. initializer = null;
  4913. lookup = Object.create(null);
  4914. for (let i = 0, ii = arr.length; i < ii; i += 2) {
  4915. lookup[arr[i]] = arr[i + 1];
  4916. }
  4917. arr = null;
  4918. }
  4919. return lookup;
  4920. };
  4921. }
  4922. class MissingDataException extends _util.BaseException {
  4923. constructor(begin, end) {
  4924. super(`Missing data [${begin}, ${end})`, "MissingDataException");
  4925. this.begin = begin;
  4926. this.end = end;
  4927. }
  4928. }
  4929. exports.MissingDataException = MissingDataException;
  4930. class ParserEOFException extends _util.BaseException {
  4931. constructor(msg) {
  4932. super(msg, "ParserEOFException");
  4933. }
  4934. }
  4935. exports.ParserEOFException = ParserEOFException;
  4936. class XRefEntryException extends _util.BaseException {
  4937. constructor(msg) {
  4938. super(msg, "XRefEntryException");
  4939. }
  4940. }
  4941. exports.XRefEntryException = XRefEntryException;
  4942. class XRefParseException extends _util.BaseException {
  4943. constructor(msg) {
  4944. super(msg, "XRefParseException");
  4945. }
  4946. }
  4947. exports.XRefParseException = XRefParseException;
  4948. class DocStats {
  4949. constructor(handler) {
  4950. this._handler = handler;
  4951. this._streamTypes = new Set();
  4952. this._fontTypes = new Set();
  4953. }
  4954. _send() {
  4955. const streamTypes = Object.create(null),
  4956. fontTypes = Object.create(null);
  4957. for (const type of this._streamTypes) {
  4958. streamTypes[type] = true;
  4959. }
  4960. for (const type of this._fontTypes) {
  4961. fontTypes[type] = true;
  4962. }
  4963. this._handler.send("DocStats", {
  4964. streamTypes,
  4965. fontTypes
  4966. });
  4967. }
  4968. addStreamType(type) {
  4969. if (this._streamTypes.has(type)) {
  4970. return;
  4971. }
  4972. this._streamTypes.add(type);
  4973. this._send();
  4974. }
  4975. addFontType(type) {
  4976. if (this._fontTypes.has(type)) {
  4977. return;
  4978. }
  4979. this._fontTypes.add(type);
  4980. this._send();
  4981. }
  4982. }
  4983. exports.DocStats = DocStats;
  4984. function getInheritableProperty(_ref) {
  4985. let {
  4986. dict,
  4987. key,
  4988. getArray = false,
  4989. stopWhenFound = true
  4990. } = _ref;
  4991. let values;
  4992. const visited = new _primitives.RefSet();
  4993. while (dict instanceof _primitives.Dict && !(dict.objId && visited.has(dict.objId))) {
  4994. if (dict.objId) {
  4995. visited.put(dict.objId);
  4996. }
  4997. const value = getArray ? dict.getArray(key) : dict.get(key);
  4998. if (value !== undefined) {
  4999. if (stopWhenFound) {
  5000. return value;
  5001. }
  5002. if (!values) {
  5003. values = [];
  5004. }
  5005. values.push(value);
  5006. }
  5007. dict = dict.get("Parent");
  5008. }
  5009. return values;
  5010. }
  5011. 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"];
  5012. function toRomanNumerals(number) {
  5013. let lowerCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  5014. (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
  5015. const romanBuf = [];
  5016. let pos;
  5017. while (number >= 1000) {
  5018. number -= 1000;
  5019. romanBuf.push("M");
  5020. }
  5021. pos = number / 100 | 0;
  5022. number %= 100;
  5023. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  5024. pos = number / 10 | 0;
  5025. number %= 10;
  5026. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  5027. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  5028. const romanStr = romanBuf.join("");
  5029. return lowerCase ? romanStr.toLowerCase() : romanStr;
  5030. }
  5031. function log2(x) {
  5032. if (x <= 0) {
  5033. return 0;
  5034. }
  5035. return Math.ceil(Math.log2(x));
  5036. }
  5037. function readInt8(data, offset) {
  5038. return data[offset] << 24 >> 24;
  5039. }
  5040. function readUint16(data, offset) {
  5041. return data[offset] << 8 | data[offset + 1];
  5042. }
  5043. function readUint32(data, offset) {
  5044. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  5045. }
  5046. function isWhiteSpace(ch) {
  5047. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  5048. }
  5049. function parseXFAPath(path) {
  5050. const positionPattern = /(.+)\[(\d+)\]$/;
  5051. return path.split(".").map(component => {
  5052. const m = component.match(positionPattern);
  5053. if (m) {
  5054. return {
  5055. name: m[1],
  5056. pos: parseInt(m[2], 10)
  5057. };
  5058. }
  5059. return {
  5060. name: component,
  5061. pos: 0
  5062. };
  5063. });
  5064. }
  5065. function escapePDFName(str) {
  5066. const buffer = [];
  5067. let start = 0;
  5068. for (let i = 0, ii = str.length; i < ii; i++) {
  5069. const char = str.charCodeAt(i);
  5070. 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) {
  5071. if (start < i) {
  5072. buffer.push(str.substring(start, i));
  5073. }
  5074. buffer.push(`#${char.toString(16)}`);
  5075. start = i + 1;
  5076. }
  5077. }
  5078. if (buffer.length === 0) {
  5079. return str;
  5080. }
  5081. if (start < str.length) {
  5082. buffer.push(str.substring(start, str.length));
  5083. }
  5084. return buffer.join("");
  5085. }
  5086. function _collectJS(entry, xref, list, parents) {
  5087. if (!entry) {
  5088. return;
  5089. }
  5090. let parent = null;
  5091. if (entry instanceof _primitives.Ref) {
  5092. if (parents.has(entry)) {
  5093. return;
  5094. }
  5095. parent = entry;
  5096. parents.put(parent);
  5097. entry = xref.fetch(entry);
  5098. }
  5099. if (Array.isArray(entry)) {
  5100. for (const element of entry) {
  5101. _collectJS(element, xref, list, parents);
  5102. }
  5103. } else if (entry instanceof _primitives.Dict) {
  5104. if ((0, _primitives.isName)(entry.get("S"), "JavaScript")) {
  5105. const js = entry.get("JS");
  5106. let code;
  5107. if (js instanceof _base_stream.BaseStream) {
  5108. code = js.getString();
  5109. } else if (typeof js === "string") {
  5110. code = js;
  5111. }
  5112. code = code && (0, _util.stringToPDFString)(code).replace(/\u0000/g, "");
  5113. if (code) {
  5114. list.push(code);
  5115. }
  5116. }
  5117. _collectJS(entry.getRaw("Next"), xref, list, parents);
  5118. }
  5119. if (parent) {
  5120. parents.remove(parent);
  5121. }
  5122. }
  5123. function collectActions(xref, dict, eventType) {
  5124. const actions = Object.create(null);
  5125. const additionalActionsDicts = getInheritableProperty({
  5126. dict,
  5127. key: "AA",
  5128. stopWhenFound: false
  5129. });
  5130. if (additionalActionsDicts) {
  5131. for (let i = additionalActionsDicts.length - 1; i >= 0; i--) {
  5132. const additionalActions = additionalActionsDicts[i];
  5133. if (!(additionalActions instanceof _primitives.Dict)) {
  5134. continue;
  5135. }
  5136. for (const key of additionalActions.getKeys()) {
  5137. const action = eventType[key];
  5138. if (!action) {
  5139. continue;
  5140. }
  5141. const actionDict = additionalActions.getRaw(key);
  5142. const parents = new _primitives.RefSet();
  5143. const list = [];
  5144. _collectJS(actionDict, xref, list, parents);
  5145. if (list.length > 0) {
  5146. actions[action] = list;
  5147. }
  5148. }
  5149. }
  5150. }
  5151. if (dict.has("A")) {
  5152. const actionDict = dict.get("A");
  5153. const parents = new _primitives.RefSet();
  5154. const list = [];
  5155. _collectJS(actionDict, xref, list, parents);
  5156. if (list.length > 0) {
  5157. actions.Action = list;
  5158. }
  5159. }
  5160. return (0, _util.objectSize)(actions) > 0 ? actions : null;
  5161. }
  5162. const XMLEntities = {
  5163. 0x3c: "&lt;",
  5164. 0x3e: "&gt;",
  5165. 0x26: "&amp;",
  5166. 0x22: "&quot;",
  5167. 0x27: "&apos;"
  5168. };
  5169. function encodeToXmlString(str) {
  5170. const buffer = [];
  5171. let start = 0;
  5172. for (let i = 0, ii = str.length; i < ii; i++) {
  5173. const char = str.codePointAt(i);
  5174. if (0x20 <= char && char <= 0x7e) {
  5175. const entity = XMLEntities[char];
  5176. if (entity) {
  5177. if (start < i) {
  5178. buffer.push(str.substring(start, i));
  5179. }
  5180. buffer.push(entity);
  5181. start = i + 1;
  5182. }
  5183. } else {
  5184. if (start < i) {
  5185. buffer.push(str.substring(start, i));
  5186. }
  5187. buffer.push(`&#x${char.toString(16).toUpperCase()};`);
  5188. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  5189. i++;
  5190. }
  5191. start = i + 1;
  5192. }
  5193. }
  5194. if (buffer.length === 0) {
  5195. return str;
  5196. }
  5197. if (start < str.length) {
  5198. buffer.push(str.substring(start, str.length));
  5199. }
  5200. return buffer.join("");
  5201. }
  5202. function validateCSSFont(cssFontInfo) {
  5203. const DEFAULT_CSS_FONT_OBLIQUE = "14";
  5204. const DEFAULT_CSS_FONT_WEIGHT = "400";
  5205. const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]);
  5206. const {
  5207. fontFamily,
  5208. fontWeight,
  5209. italicAngle
  5210. } = cssFontInfo;
  5211. if (/^".*"$/.test(fontFamily)) {
  5212. if (/[^\\]"/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  5213. (0, _util.warn)(`XFA - FontFamily contains some unescaped ": ${fontFamily}.`);
  5214. return false;
  5215. }
  5216. } else if (/^'.*'$/.test(fontFamily)) {
  5217. if (/[^\\]'/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  5218. (0, _util.warn)(`XFA - FontFamily contains some unescaped ': ${fontFamily}.`);
  5219. return false;
  5220. }
  5221. } else {
  5222. for (const ident of fontFamily.split(/[ \t]+/)) {
  5223. if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) {
  5224. (0, _util.warn)(`XFA - FontFamily contains some invalid <custom-ident>: ${fontFamily}.`);
  5225. return false;
  5226. }
  5227. }
  5228. }
  5229. const weight = fontWeight ? fontWeight.toString() : "";
  5230. cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT;
  5231. const angle = parseFloat(italicAngle);
  5232. cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString();
  5233. return true;
  5234. }
  5235. function recoverJsURL(str) {
  5236. const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"];
  5237. const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
  5238. const jsUrl = regex.exec(str);
  5239. if (jsUrl && jsUrl[2]) {
  5240. const url = jsUrl[2];
  5241. let newWindow = false;
  5242. if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
  5243. newWindow = true;
  5244. }
  5245. return {
  5246. url,
  5247. newWindow
  5248. };
  5249. }
  5250. return null;
  5251. }
  5252. function numberToString(value) {
  5253. if (Number.isInteger(value)) {
  5254. return value.toString();
  5255. }
  5256. const roundedValue = Math.round(value * 100);
  5257. if (roundedValue % 100 === 0) {
  5258. return (roundedValue / 100).toString();
  5259. }
  5260. if (roundedValue % 10 === 0) {
  5261. return value.toFixed(1);
  5262. }
  5263. return value.toFixed(2);
  5264. }
  5265. function getNewAnnotationsMap(annotationStorage) {
  5266. if (!annotationStorage) {
  5267. return null;
  5268. }
  5269. const newAnnotationsByPage = new Map();
  5270. for (const [key, value] of annotationStorage) {
  5271. if (!key.startsWith(_util.AnnotationEditorPrefix)) {
  5272. continue;
  5273. }
  5274. let annotations = newAnnotationsByPage.get(value.pageIndex);
  5275. if (!annotations) {
  5276. annotations = [];
  5277. newAnnotationsByPage.set(value.pageIndex, annotations);
  5278. }
  5279. annotations.push(value);
  5280. }
  5281. return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null;
  5282. }
  5283. /***/ }),
  5284. /* 132 */
  5285. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5286. "use strict";
  5287. Object.defineProperty(exports, "__esModule", ({
  5288. value: true
  5289. }));
  5290. exports.BaseStream = void 0;
  5291. var _util = __w_pdfjs_require__(2);
  5292. class BaseStream {
  5293. constructor() {
  5294. if (this.constructor === BaseStream) {
  5295. (0, _util.unreachable)("Cannot initialize BaseStream.");
  5296. }
  5297. }
  5298. get length() {
  5299. (0, _util.unreachable)("Abstract getter `length` accessed");
  5300. }
  5301. get isEmpty() {
  5302. (0, _util.unreachable)("Abstract getter `isEmpty` accessed");
  5303. }
  5304. get isDataLoaded() {
  5305. return (0, _util.shadow)(this, "isDataLoaded", true);
  5306. }
  5307. getByte() {
  5308. (0, _util.unreachable)("Abstract method `getByte` called");
  5309. }
  5310. getBytes(length) {
  5311. (0, _util.unreachable)("Abstract method `getBytes` called");
  5312. }
  5313. peekByte() {
  5314. const peekedByte = this.getByte();
  5315. if (peekedByte !== -1) {
  5316. this.pos--;
  5317. }
  5318. return peekedByte;
  5319. }
  5320. peekBytes(length) {
  5321. const bytes = this.getBytes(length);
  5322. this.pos -= bytes.length;
  5323. return bytes;
  5324. }
  5325. getUint16() {
  5326. const b0 = this.getByte();
  5327. const b1 = this.getByte();
  5328. if (b0 === -1 || b1 === -1) {
  5329. return -1;
  5330. }
  5331. return (b0 << 8) + b1;
  5332. }
  5333. getInt32() {
  5334. const b0 = this.getByte();
  5335. const b1 = this.getByte();
  5336. const b2 = this.getByte();
  5337. const b3 = this.getByte();
  5338. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  5339. }
  5340. getByteRange(begin, end) {
  5341. (0, _util.unreachable)("Abstract method `getByteRange` called");
  5342. }
  5343. getString(length) {
  5344. return (0, _util.bytesToString)(this.getBytes(length));
  5345. }
  5346. skip(n) {
  5347. this.pos += n || 1;
  5348. }
  5349. reset() {
  5350. (0, _util.unreachable)("Abstract method `reset` called");
  5351. }
  5352. moveStart() {
  5353. (0, _util.unreachable)("Abstract method `moveStart` called");
  5354. }
  5355. makeSubStream(start, length) {
  5356. let dict = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  5357. (0, _util.unreachable)("Abstract method `makeSubStream` called");
  5358. }
  5359. getBaseStreams() {
  5360. return null;
  5361. }
  5362. }
  5363. exports.BaseStream = BaseStream;
  5364. /***/ }),
  5365. /* 133 */
  5366. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5367. "use strict";
  5368. Object.defineProperty(exports, "__esModule", ({
  5369. value: true
  5370. }));
  5371. exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
  5372. var _util = __w_pdfjs_require__(2);
  5373. var _chunked_stream = __w_pdfjs_require__(134);
  5374. var _core_utils = __w_pdfjs_require__(131);
  5375. var _document = __w_pdfjs_require__(136);
  5376. var _stream = __w_pdfjs_require__(135);
  5377. function parseDocBaseUrl(url) {
  5378. if (url) {
  5379. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url);
  5380. if (absoluteUrl) {
  5381. return absoluteUrl.href;
  5382. }
  5383. (0, _util.warn)(`Invalid absolute docBaseUrl: "${url}".`);
  5384. }
  5385. return null;
  5386. }
  5387. class BasePdfManager {
  5388. constructor() {
  5389. if (this.constructor === BasePdfManager) {
  5390. (0, _util.unreachable)("Cannot initialize BasePdfManager.");
  5391. }
  5392. }
  5393. get docId() {
  5394. return this._docId;
  5395. }
  5396. get password() {
  5397. return this._password;
  5398. }
  5399. get docBaseUrl() {
  5400. const catalog = this.pdfDocument.catalog;
  5401. return (0, _util.shadow)(this, "docBaseUrl", catalog.baseUrl || this._docBaseUrl);
  5402. }
  5403. onLoadedStream() {
  5404. (0, _util.unreachable)("Abstract method `onLoadedStream` called");
  5405. }
  5406. ensureDoc(prop, args) {
  5407. return this.ensure(this.pdfDocument, prop, args);
  5408. }
  5409. ensureXRef(prop, args) {
  5410. return this.ensure(this.pdfDocument.xref, prop, args);
  5411. }
  5412. ensureCatalog(prop, args) {
  5413. return this.ensure(this.pdfDocument.catalog, prop, args);
  5414. }
  5415. getPage(pageIndex) {
  5416. return this.pdfDocument.getPage(pageIndex);
  5417. }
  5418. fontFallback(id, handler) {
  5419. return this.pdfDocument.fontFallback(id, handler);
  5420. }
  5421. loadXfaFonts(handler, task) {
  5422. return this.pdfDocument.loadXfaFonts(handler, task);
  5423. }
  5424. loadXfaImages() {
  5425. return this.pdfDocument.loadXfaImages();
  5426. }
  5427. serializeXfaData(annotationStorage) {
  5428. return this.pdfDocument.serializeXfaData(annotationStorage);
  5429. }
  5430. cleanup() {
  5431. let manuallyTriggered = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5432. return this.pdfDocument.cleanup(manuallyTriggered);
  5433. }
  5434. async ensure(obj, prop, args) {
  5435. (0, _util.unreachable)("Abstract method `ensure` called");
  5436. }
  5437. requestRange(begin, end) {
  5438. (0, _util.unreachable)("Abstract method `requestRange` called");
  5439. }
  5440. requestLoadedStream() {
  5441. (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
  5442. }
  5443. sendProgressiveData(chunk) {
  5444. (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
  5445. }
  5446. updatePassword(password) {
  5447. this._password = password;
  5448. }
  5449. terminate(reason) {
  5450. (0, _util.unreachable)("Abstract method `terminate` called");
  5451. }
  5452. }
  5453. class LocalPdfManager extends BasePdfManager {
  5454. constructor(docId, data, password, msgHandler, evaluatorOptions, enableXfa, docBaseUrl) {
  5455. super();
  5456. this._docId = docId;
  5457. this._password = password;
  5458. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  5459. this.msgHandler = msgHandler;
  5460. this.evaluatorOptions = evaluatorOptions;
  5461. this.enableXfa = enableXfa;
  5462. const stream = new _stream.Stream(data);
  5463. this.pdfDocument = new _document.PDFDocument(this, stream);
  5464. this._loadedStreamPromise = Promise.resolve(stream);
  5465. }
  5466. async ensure(obj, prop, args) {
  5467. const value = obj[prop];
  5468. if (typeof value === "function") {
  5469. return value.apply(obj, args);
  5470. }
  5471. return value;
  5472. }
  5473. requestRange(begin, end) {
  5474. return Promise.resolve();
  5475. }
  5476. requestLoadedStream() {}
  5477. onLoadedStream() {
  5478. return this._loadedStreamPromise;
  5479. }
  5480. terminate(reason) {}
  5481. }
  5482. exports.LocalPdfManager = LocalPdfManager;
  5483. class NetworkPdfManager extends BasePdfManager {
  5484. constructor(docId, pdfNetworkStream, args, evaluatorOptions, enableXfa, docBaseUrl) {
  5485. super();
  5486. this._docId = docId;
  5487. this._password = args.password;
  5488. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  5489. this.msgHandler = args.msgHandler;
  5490. this.evaluatorOptions = evaluatorOptions;
  5491. this.enableXfa = enableXfa;
  5492. this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
  5493. msgHandler: args.msgHandler,
  5494. length: args.length,
  5495. disableAutoFetch: args.disableAutoFetch,
  5496. rangeChunkSize: args.rangeChunkSize
  5497. });
  5498. this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
  5499. }
  5500. async ensure(obj, prop, args) {
  5501. try {
  5502. const value = obj[prop];
  5503. if (typeof value === "function") {
  5504. return value.apply(obj, args);
  5505. }
  5506. return value;
  5507. } catch (ex) {
  5508. if (!(ex instanceof _core_utils.MissingDataException)) {
  5509. throw ex;
  5510. }
  5511. await this.requestRange(ex.begin, ex.end);
  5512. return this.ensure(obj, prop, args);
  5513. }
  5514. }
  5515. requestRange(begin, end) {
  5516. return this.streamManager.requestRange(begin, end);
  5517. }
  5518. requestLoadedStream() {
  5519. this.streamManager.requestAllChunks();
  5520. }
  5521. sendProgressiveData(chunk) {
  5522. this.streamManager.onReceiveData({
  5523. chunk
  5524. });
  5525. }
  5526. onLoadedStream() {
  5527. return this.streamManager.onLoadedStream();
  5528. }
  5529. terminate(reason) {
  5530. this.streamManager.abort(reason);
  5531. }
  5532. }
  5533. exports.NetworkPdfManager = NetworkPdfManager;
  5534. /***/ }),
  5535. /* 134 */
  5536. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5537. "use strict";
  5538. Object.defineProperty(exports, "__esModule", ({
  5539. value: true
  5540. }));
  5541. exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
  5542. var _util = __w_pdfjs_require__(2);
  5543. var _core_utils = __w_pdfjs_require__(131);
  5544. var _stream = __w_pdfjs_require__(135);
  5545. class ChunkedStream extends _stream.Stream {
  5546. constructor(length, chunkSize, manager) {
  5547. super(new Uint8Array(length), 0, length, null);
  5548. this.chunkSize = chunkSize;
  5549. this._loadedChunks = new Set();
  5550. this.numChunks = Math.ceil(length / chunkSize);
  5551. this.manager = manager;
  5552. this.progressiveDataLength = 0;
  5553. this.lastSuccessfulEnsureByteChunk = -1;
  5554. }
  5555. getMissingChunks() {
  5556. const chunks = [];
  5557. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  5558. if (!this._loadedChunks.has(chunk)) {
  5559. chunks.push(chunk);
  5560. }
  5561. }
  5562. return chunks;
  5563. }
  5564. get numChunksLoaded() {
  5565. return this._loadedChunks.size;
  5566. }
  5567. get isDataLoaded() {
  5568. return this.numChunksLoaded === this.numChunks;
  5569. }
  5570. onReceiveData(begin, chunk) {
  5571. const chunkSize = this.chunkSize;
  5572. if (begin % chunkSize !== 0) {
  5573. throw new Error(`Bad begin offset: ${begin}`);
  5574. }
  5575. const end = begin + chunk.byteLength;
  5576. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  5577. throw new Error(`Bad end offset: ${end}`);
  5578. }
  5579. this.bytes.set(new Uint8Array(chunk), begin);
  5580. const beginChunk = Math.floor(begin / chunkSize);
  5581. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  5582. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  5583. this._loadedChunks.add(curChunk);
  5584. }
  5585. }
  5586. onReceiveProgressiveData(data) {
  5587. let position = this.progressiveDataLength;
  5588. const beginChunk = Math.floor(position / this.chunkSize);
  5589. this.bytes.set(new Uint8Array(data), position);
  5590. position += data.byteLength;
  5591. this.progressiveDataLength = position;
  5592. const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  5593. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  5594. this._loadedChunks.add(curChunk);
  5595. }
  5596. }
  5597. ensureByte(pos) {
  5598. if (pos < this.progressiveDataLength) {
  5599. return;
  5600. }
  5601. const chunk = Math.floor(pos / this.chunkSize);
  5602. if (chunk > this.numChunks) {
  5603. return;
  5604. }
  5605. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  5606. return;
  5607. }
  5608. if (!this._loadedChunks.has(chunk)) {
  5609. throw new _core_utils.MissingDataException(pos, pos + 1);
  5610. }
  5611. this.lastSuccessfulEnsureByteChunk = chunk;
  5612. }
  5613. ensureRange(begin, end) {
  5614. if (begin >= end) {
  5615. return;
  5616. }
  5617. if (end <= this.progressiveDataLength) {
  5618. return;
  5619. }
  5620. const beginChunk = Math.floor(begin / this.chunkSize);
  5621. if (beginChunk > this.numChunks) {
  5622. return;
  5623. }
  5624. const endChunk = Math.min(Math.floor((end - 1) / this.chunkSize) + 1, this.numChunks);
  5625. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  5626. if (!this._loadedChunks.has(chunk)) {
  5627. throw new _core_utils.MissingDataException(begin, end);
  5628. }
  5629. }
  5630. }
  5631. nextEmptyChunk(beginChunk) {
  5632. const numChunks = this.numChunks;
  5633. for (let i = 0; i < numChunks; ++i) {
  5634. const chunk = (beginChunk + i) % numChunks;
  5635. if (!this._loadedChunks.has(chunk)) {
  5636. return chunk;
  5637. }
  5638. }
  5639. return null;
  5640. }
  5641. hasChunk(chunk) {
  5642. return this._loadedChunks.has(chunk);
  5643. }
  5644. getByte() {
  5645. const pos = this.pos;
  5646. if (pos >= this.end) {
  5647. return -1;
  5648. }
  5649. if (pos >= this.progressiveDataLength) {
  5650. this.ensureByte(pos);
  5651. }
  5652. return this.bytes[this.pos++];
  5653. }
  5654. getBytes(length) {
  5655. const bytes = this.bytes;
  5656. const pos = this.pos;
  5657. const strEnd = this.end;
  5658. if (!length) {
  5659. if (strEnd > this.progressiveDataLength) {
  5660. this.ensureRange(pos, strEnd);
  5661. }
  5662. return bytes.subarray(pos, strEnd);
  5663. }
  5664. let end = pos + length;
  5665. if (end > strEnd) {
  5666. end = strEnd;
  5667. }
  5668. if (end > this.progressiveDataLength) {
  5669. this.ensureRange(pos, end);
  5670. }
  5671. this.pos = end;
  5672. return bytes.subarray(pos, end);
  5673. }
  5674. getByteRange(begin, end) {
  5675. if (begin < 0) {
  5676. begin = 0;
  5677. }
  5678. if (end > this.end) {
  5679. end = this.end;
  5680. }
  5681. if (end > this.progressiveDataLength) {
  5682. this.ensureRange(begin, end);
  5683. }
  5684. return this.bytes.subarray(begin, end);
  5685. }
  5686. makeSubStream(start, length) {
  5687. let dict = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  5688. if (length) {
  5689. if (start + length > this.progressiveDataLength) {
  5690. this.ensureRange(start, start + length);
  5691. }
  5692. } else {
  5693. if (start >= this.progressiveDataLength) {
  5694. this.ensureByte(start);
  5695. }
  5696. }
  5697. function ChunkedStreamSubstream() {}
  5698. ChunkedStreamSubstream.prototype = Object.create(this);
  5699. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  5700. const chunkSize = this.chunkSize;
  5701. const beginChunk = Math.floor(this.start / chunkSize);
  5702. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  5703. const missingChunks = [];
  5704. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  5705. if (!this._loadedChunks.has(chunk)) {
  5706. missingChunks.push(chunk);
  5707. }
  5708. }
  5709. return missingChunks;
  5710. };
  5711. Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", {
  5712. get() {
  5713. if (this.numChunksLoaded === this.numChunks) {
  5714. return true;
  5715. }
  5716. return this.getMissingChunks().length === 0;
  5717. },
  5718. configurable: true
  5719. });
  5720. const subStream = new ChunkedStreamSubstream();
  5721. subStream.pos = subStream.start = start;
  5722. subStream.end = start + length || this.end;
  5723. subStream.dict = dict;
  5724. return subStream;
  5725. }
  5726. getBaseStreams() {
  5727. return [this];
  5728. }
  5729. }
  5730. exports.ChunkedStream = ChunkedStream;
  5731. class ChunkedStreamManager {
  5732. constructor(pdfNetworkStream, args) {
  5733. this.length = args.length;
  5734. this.chunkSize = args.rangeChunkSize;
  5735. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  5736. this.pdfNetworkStream = pdfNetworkStream;
  5737. this.disableAutoFetch = args.disableAutoFetch;
  5738. this.msgHandler = args.msgHandler;
  5739. this.currRequestId = 0;
  5740. this._chunksNeededByRequest = new Map();
  5741. this._requestsByChunk = new Map();
  5742. this._promisesByRequest = new Map();
  5743. this.progressiveDataLength = 0;
  5744. this.aborted = false;
  5745. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  5746. }
  5747. onLoadedStream() {
  5748. return this._loadedStreamCapability.promise;
  5749. }
  5750. sendRequest(begin, end) {
  5751. const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  5752. if (!rangeReader.isStreamingSupported) {
  5753. rangeReader.onProgress = this.onProgress.bind(this);
  5754. }
  5755. let chunks = [],
  5756. loaded = 0;
  5757. return new Promise((resolve, reject) => {
  5758. const readChunk = chunk => {
  5759. try {
  5760. if (!chunk.done) {
  5761. const data = chunk.value;
  5762. chunks.push(data);
  5763. loaded += (0, _util.arrayByteLength)(data);
  5764. if (rangeReader.isStreamingSupported) {
  5765. this.onProgress({
  5766. loaded
  5767. });
  5768. }
  5769. rangeReader.read().then(readChunk, reject);
  5770. return;
  5771. }
  5772. const chunkData = (0, _util.arraysToBytes)(chunks);
  5773. chunks = null;
  5774. resolve(chunkData);
  5775. } catch (e) {
  5776. reject(e);
  5777. }
  5778. };
  5779. rangeReader.read().then(readChunk, reject);
  5780. }).then(data => {
  5781. if (this.aborted) {
  5782. return;
  5783. }
  5784. this.onReceiveData({
  5785. chunk: data,
  5786. begin
  5787. });
  5788. });
  5789. }
  5790. requestAllChunks() {
  5791. const missingChunks = this.stream.getMissingChunks();
  5792. this._requestChunks(missingChunks);
  5793. return this._loadedStreamCapability.promise;
  5794. }
  5795. _requestChunks(chunks) {
  5796. const requestId = this.currRequestId++;
  5797. const chunksNeeded = new Set();
  5798. this._chunksNeededByRequest.set(requestId, chunksNeeded);
  5799. for (const chunk of chunks) {
  5800. if (!this.stream.hasChunk(chunk)) {
  5801. chunksNeeded.add(chunk);
  5802. }
  5803. }
  5804. if (chunksNeeded.size === 0) {
  5805. return Promise.resolve();
  5806. }
  5807. const capability = (0, _util.createPromiseCapability)();
  5808. this._promisesByRequest.set(requestId, capability);
  5809. const chunksToRequest = [];
  5810. for (const chunk of chunksNeeded) {
  5811. let requestIds = this._requestsByChunk.get(chunk);
  5812. if (!requestIds) {
  5813. requestIds = [];
  5814. this._requestsByChunk.set(chunk, requestIds);
  5815. chunksToRequest.push(chunk);
  5816. }
  5817. requestIds.push(requestId);
  5818. }
  5819. if (chunksToRequest.length > 0) {
  5820. const groupedChunksToRequest = this.groupChunks(chunksToRequest);
  5821. for (const groupedChunk of groupedChunksToRequest) {
  5822. const begin = groupedChunk.beginChunk * this.chunkSize;
  5823. const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  5824. this.sendRequest(begin, end).catch(capability.reject);
  5825. }
  5826. }
  5827. return capability.promise.catch(reason => {
  5828. if (this.aborted) {
  5829. return;
  5830. }
  5831. throw reason;
  5832. });
  5833. }
  5834. getStream() {
  5835. return this.stream;
  5836. }
  5837. requestRange(begin, end) {
  5838. end = Math.min(end, this.length);
  5839. const beginChunk = this.getBeginChunk(begin);
  5840. const endChunk = this.getEndChunk(end);
  5841. const chunks = [];
  5842. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  5843. chunks.push(chunk);
  5844. }
  5845. return this._requestChunks(chunks);
  5846. }
  5847. requestRanges() {
  5848. let ranges = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  5849. const chunksToRequest = [];
  5850. for (const range of ranges) {
  5851. const beginChunk = this.getBeginChunk(range.begin);
  5852. const endChunk = this.getEndChunk(range.end);
  5853. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  5854. if (!chunksToRequest.includes(chunk)) {
  5855. chunksToRequest.push(chunk);
  5856. }
  5857. }
  5858. }
  5859. chunksToRequest.sort(function (a, b) {
  5860. return a - b;
  5861. });
  5862. return this._requestChunks(chunksToRequest);
  5863. }
  5864. groupChunks(chunks) {
  5865. const groupedChunks = [];
  5866. let beginChunk = -1;
  5867. let prevChunk = -1;
  5868. for (let i = 0, ii = chunks.length; i < ii; ++i) {
  5869. const chunk = chunks[i];
  5870. if (beginChunk < 0) {
  5871. beginChunk = chunk;
  5872. }
  5873. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  5874. groupedChunks.push({
  5875. beginChunk,
  5876. endChunk: prevChunk + 1
  5877. });
  5878. beginChunk = chunk;
  5879. }
  5880. if (i + 1 === chunks.length) {
  5881. groupedChunks.push({
  5882. beginChunk,
  5883. endChunk: chunk + 1
  5884. });
  5885. }
  5886. prevChunk = chunk;
  5887. }
  5888. return groupedChunks;
  5889. }
  5890. onProgress(args) {
  5891. this.msgHandler.send("DocProgress", {
  5892. loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
  5893. total: this.length
  5894. });
  5895. }
  5896. onReceiveData(args) {
  5897. const chunk = args.chunk;
  5898. const isProgressive = args.begin === undefined;
  5899. const begin = isProgressive ? this.progressiveDataLength : args.begin;
  5900. const end = begin + chunk.byteLength;
  5901. const beginChunk = Math.floor(begin / this.chunkSize);
  5902. const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  5903. if (isProgressive) {
  5904. this.stream.onReceiveProgressiveData(chunk);
  5905. this.progressiveDataLength = end;
  5906. } else {
  5907. this.stream.onReceiveData(begin, chunk);
  5908. }
  5909. if (this.stream.isDataLoaded) {
  5910. this._loadedStreamCapability.resolve(this.stream);
  5911. }
  5912. const loadedRequests = [];
  5913. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  5914. const requestIds = this._requestsByChunk.get(curChunk);
  5915. if (!requestIds) {
  5916. continue;
  5917. }
  5918. this._requestsByChunk.delete(curChunk);
  5919. for (const requestId of requestIds) {
  5920. const chunksNeeded = this._chunksNeededByRequest.get(requestId);
  5921. if (chunksNeeded.has(curChunk)) {
  5922. chunksNeeded.delete(curChunk);
  5923. }
  5924. if (chunksNeeded.size > 0) {
  5925. continue;
  5926. }
  5927. loadedRequests.push(requestId);
  5928. }
  5929. }
  5930. if (!this.disableAutoFetch && this._requestsByChunk.size === 0) {
  5931. let nextEmptyChunk;
  5932. if (this.stream.numChunksLoaded === 1) {
  5933. const lastChunk = this.stream.numChunks - 1;
  5934. if (!this.stream.hasChunk(lastChunk)) {
  5935. nextEmptyChunk = lastChunk;
  5936. }
  5937. } else {
  5938. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  5939. }
  5940. if (Number.isInteger(nextEmptyChunk)) {
  5941. this._requestChunks([nextEmptyChunk]);
  5942. }
  5943. }
  5944. for (const requestId of loadedRequests) {
  5945. const capability = this._promisesByRequest.get(requestId);
  5946. this._promisesByRequest.delete(requestId);
  5947. capability.resolve();
  5948. }
  5949. this.msgHandler.send("DocProgress", {
  5950. loaded: this.stream.numChunksLoaded * this.chunkSize,
  5951. total: this.length
  5952. });
  5953. }
  5954. onError(err) {
  5955. this._loadedStreamCapability.reject(err);
  5956. }
  5957. getBeginChunk(begin) {
  5958. return Math.floor(begin / this.chunkSize);
  5959. }
  5960. getEndChunk(end) {
  5961. return Math.floor((end - 1) / this.chunkSize) + 1;
  5962. }
  5963. abort(reason) {
  5964. this.aborted = true;
  5965. if (this.pdfNetworkStream) {
  5966. this.pdfNetworkStream.cancelAllRequests(reason);
  5967. }
  5968. for (const capability of this._promisesByRequest.values()) {
  5969. capability.reject(reason);
  5970. }
  5971. }
  5972. }
  5973. exports.ChunkedStreamManager = ChunkedStreamManager;
  5974. /***/ }),
  5975. /* 135 */
  5976. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5977. "use strict";
  5978. Object.defineProperty(exports, "__esModule", ({
  5979. value: true
  5980. }));
  5981. exports.StringStream = exports.Stream = exports.NullStream = void 0;
  5982. var _base_stream = __w_pdfjs_require__(132);
  5983. var _util = __w_pdfjs_require__(2);
  5984. class Stream extends _base_stream.BaseStream {
  5985. constructor(arrayBuffer, start, length, dict) {
  5986. super();
  5987. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  5988. this.start = start || 0;
  5989. this.pos = this.start;
  5990. this.end = start + length || this.bytes.length;
  5991. this.dict = dict;
  5992. }
  5993. get length() {
  5994. return this.end - this.start;
  5995. }
  5996. get isEmpty() {
  5997. return this.length === 0;
  5998. }
  5999. getByte() {
  6000. if (this.pos >= this.end) {
  6001. return -1;
  6002. }
  6003. return this.bytes[this.pos++];
  6004. }
  6005. getBytes(length) {
  6006. const bytes = this.bytes;
  6007. const pos = this.pos;
  6008. const strEnd = this.end;
  6009. if (!length) {
  6010. return bytes.subarray(pos, strEnd);
  6011. }
  6012. let end = pos + length;
  6013. if (end > strEnd) {
  6014. end = strEnd;
  6015. }
  6016. this.pos = end;
  6017. return bytes.subarray(pos, end);
  6018. }
  6019. getByteRange(begin, end) {
  6020. if (begin < 0) {
  6021. begin = 0;
  6022. }
  6023. if (end > this.end) {
  6024. end = this.end;
  6025. }
  6026. return this.bytes.subarray(begin, end);
  6027. }
  6028. reset() {
  6029. this.pos = this.start;
  6030. }
  6031. moveStart() {
  6032. this.start = this.pos;
  6033. }
  6034. makeSubStream(start, length) {
  6035. let dict = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  6036. return new Stream(this.bytes.buffer, start, length, dict);
  6037. }
  6038. }
  6039. exports.Stream = Stream;
  6040. class StringStream extends Stream {
  6041. constructor(str) {
  6042. super((0, _util.stringToBytes)(str));
  6043. }
  6044. }
  6045. exports.StringStream = StringStream;
  6046. class NullStream extends Stream {
  6047. constructor() {
  6048. super(new Uint8Array(0));
  6049. }
  6050. }
  6051. exports.NullStream = NullStream;
  6052. /***/ }),
  6053. /* 136 */
  6054. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  6055. "use strict";
  6056. Object.defineProperty(exports, "__esModule", ({
  6057. value: true
  6058. }));
  6059. exports.Page = exports.PDFDocument = void 0;
  6060. var _annotation = __w_pdfjs_require__(137);
  6061. var _util = __w_pdfjs_require__(2);
  6062. var _core_utils = __w_pdfjs_require__(131);
  6063. var _primitives = __w_pdfjs_require__(130);
  6064. var _xfa_fonts = __w_pdfjs_require__(176);
  6065. var _base_stream = __w_pdfjs_require__(132);
  6066. var _crypto = __w_pdfjs_require__(192);
  6067. var _catalog = __w_pdfjs_require__(194);
  6068. var _cleanup_helper = __w_pdfjs_require__(196);
  6069. var _dataset_reader = __w_pdfjs_require__(225);
  6070. var _parser = __w_pdfjs_require__(142);
  6071. var _stream = __w_pdfjs_require__(135);
  6072. var _object_loader = __w_pdfjs_require__(200);
  6073. var _operator_list = __w_pdfjs_require__(187);
  6074. var _evaluator = __w_pdfjs_require__(140);
  6075. var _decode_stream = __w_pdfjs_require__(144);
  6076. var _struct_tree = __w_pdfjs_require__(199);
  6077. var _writer = __w_pdfjs_require__(190);
  6078. var _factory = __w_pdfjs_require__(201);
  6079. var _xref = __w_pdfjs_require__(226);
  6080. const DEFAULT_USER_UNIT = 1.0;
  6081. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  6082. class Page {
  6083. constructor(_ref) {
  6084. let {
  6085. pdfManager,
  6086. xref,
  6087. pageIndex,
  6088. pageDict,
  6089. ref,
  6090. globalIdFactory,
  6091. fontCache,
  6092. builtInCMapCache,
  6093. standardFontDataCache,
  6094. globalImageCache,
  6095. nonBlendModesSet,
  6096. xfaFactory
  6097. } = _ref;
  6098. this.pdfManager = pdfManager;
  6099. this.pageIndex = pageIndex;
  6100. this.pageDict = pageDict;
  6101. this.xref = xref;
  6102. this.ref = ref;
  6103. this.fontCache = fontCache;
  6104. this.builtInCMapCache = builtInCMapCache;
  6105. this.standardFontDataCache = standardFontDataCache;
  6106. this.globalImageCache = globalImageCache;
  6107. this.nonBlendModesSet = nonBlendModesSet;
  6108. this.evaluatorOptions = pdfManager.evaluatorOptions;
  6109. this.resourcesPromise = null;
  6110. this.xfaFactory = xfaFactory;
  6111. const idCounters = {
  6112. obj: 0
  6113. };
  6114. this._localIdFactory = class extends globalIdFactory {
  6115. static createObjId() {
  6116. return `p${pageIndex}_${++idCounters.obj}`;
  6117. }
  6118. static getPageObjId() {
  6119. return `page${ref.toString()}`;
  6120. }
  6121. };
  6122. }
  6123. _getInheritableProperty(key) {
  6124. let getArray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  6125. const value = (0, _core_utils.getInheritableProperty)({
  6126. dict: this.pageDict,
  6127. key,
  6128. getArray,
  6129. stopWhenFound: false
  6130. });
  6131. if (!Array.isArray(value)) {
  6132. return value;
  6133. }
  6134. if (value.length === 1 || !(value[0] instanceof _primitives.Dict)) {
  6135. return value[0];
  6136. }
  6137. return _primitives.Dict.merge({
  6138. xref: this.xref,
  6139. dictArray: value
  6140. });
  6141. }
  6142. get content() {
  6143. return this.pageDict.getArray("Contents");
  6144. }
  6145. get resources() {
  6146. const resources = this._getInheritableProperty("Resources");
  6147. return (0, _util.shadow)(this, "resources", resources instanceof _primitives.Dict ? resources : _primitives.Dict.empty);
  6148. }
  6149. _getBoundingBox(name) {
  6150. if (this.xfaData) {
  6151. return this.xfaData.bbox;
  6152. }
  6153. const box = this._getInheritableProperty(name, true);
  6154. if (Array.isArray(box) && box.length === 4) {
  6155. if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  6156. return box;
  6157. }
  6158. (0, _util.warn)(`Empty /${name} entry.`);
  6159. }
  6160. return null;
  6161. }
  6162. get mediaBox() {
  6163. return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
  6164. }
  6165. get cropBox() {
  6166. return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
  6167. }
  6168. get userUnit() {
  6169. let obj = this.pageDict.get("UserUnit");
  6170. if (typeof obj !== "number" || obj <= 0) {
  6171. obj = DEFAULT_USER_UNIT;
  6172. }
  6173. return (0, _util.shadow)(this, "userUnit", obj);
  6174. }
  6175. get view() {
  6176. const {
  6177. cropBox,
  6178. mediaBox
  6179. } = this;
  6180. let view;
  6181. if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) {
  6182. view = mediaBox;
  6183. } else {
  6184. const box = _util.Util.intersect(cropBox, mediaBox);
  6185. if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  6186. view = box;
  6187. } else {
  6188. (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
  6189. }
  6190. }
  6191. return (0, _util.shadow)(this, "view", view || mediaBox);
  6192. }
  6193. get rotate() {
  6194. let rotate = this._getInheritableProperty("Rotate") || 0;
  6195. if (rotate % 90 !== 0) {
  6196. rotate = 0;
  6197. } else if (rotate >= 360) {
  6198. rotate %= 360;
  6199. } else if (rotate < 0) {
  6200. rotate = (rotate % 360 + 360) % 360;
  6201. }
  6202. return (0, _util.shadow)(this, "rotate", rotate);
  6203. }
  6204. _onSubStreamError(handler, reason, objId) {
  6205. if (this.evaluatorOptions.ignoreErrors) {
  6206. handler.send("UnsupportedFeature", {
  6207. featureId: _util.UNSUPPORTED_FEATURES.errorContentSubStream
  6208. });
  6209. (0, _util.warn)(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`);
  6210. return;
  6211. }
  6212. throw reason;
  6213. }
  6214. getContentStream(handler) {
  6215. return this.pdfManager.ensure(this, "content").then(content => {
  6216. if (content instanceof _base_stream.BaseStream) {
  6217. return content;
  6218. }
  6219. if (Array.isArray(content)) {
  6220. return new _decode_stream.StreamsSequenceStream(content, this._onSubStreamError.bind(this, handler));
  6221. }
  6222. return new _stream.NullStream();
  6223. });
  6224. }
  6225. get xfaData() {
  6226. return (0, _util.shadow)(this, "xfaData", this.xfaFactory ? {
  6227. bbox: this.xfaFactory.getBoundingBox(this.pageIndex)
  6228. } : null);
  6229. }
  6230. async saveNewAnnotations(handler, task, annotations) {
  6231. if (this.xfaFactory) {
  6232. throw new Error("XFA: Cannot save new annotations.");
  6233. }
  6234. const partialEvaluator = new _evaluator.PartialEvaluator({
  6235. xref: this.xref,
  6236. handler,
  6237. pageIndex: this.pageIndex,
  6238. idFactory: this._localIdFactory,
  6239. fontCache: this.fontCache,
  6240. builtInCMapCache: this.builtInCMapCache,
  6241. standardFontDataCache: this.standardFontDataCache,
  6242. globalImageCache: this.globalImageCache,
  6243. options: this.evaluatorOptions
  6244. });
  6245. const pageDict = this.pageDict;
  6246. const annotationsArray = this.annotations.slice();
  6247. const newData = await _annotation.AnnotationFactory.saveNewAnnotations(partialEvaluator, task, annotations);
  6248. for (const {
  6249. ref
  6250. } of newData.annotations) {
  6251. annotationsArray.push(ref);
  6252. }
  6253. const savedDict = pageDict.get("Annots");
  6254. pageDict.set("Annots", annotationsArray);
  6255. const buffer = [];
  6256. let transform = null;
  6257. if (this.xref.encrypt) {
  6258. transform = this.xref.encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  6259. }
  6260. (0, _writer.writeObject)(this.ref, pageDict, buffer, transform);
  6261. if (savedDict) {
  6262. pageDict.set("Annots", savedDict);
  6263. }
  6264. const objects = newData.dependencies;
  6265. objects.push({
  6266. ref: this.ref,
  6267. data: buffer.join("")
  6268. }, ...newData.annotations);
  6269. return objects;
  6270. }
  6271. save(handler, task, annotationStorage) {
  6272. const partialEvaluator = new _evaluator.PartialEvaluator({
  6273. xref: this.xref,
  6274. handler,
  6275. pageIndex: this.pageIndex,
  6276. idFactory: this._localIdFactory,
  6277. fontCache: this.fontCache,
  6278. builtInCMapCache: this.builtInCMapCache,
  6279. standardFontDataCache: this.standardFontDataCache,
  6280. globalImageCache: this.globalImageCache,
  6281. options: this.evaluatorOptions
  6282. });
  6283. return this._parsedAnnotations.then(function (annotations) {
  6284. const newRefsPromises = [];
  6285. for (const annotation of annotations) {
  6286. if (!annotation.mustBePrinted(annotationStorage)) {
  6287. continue;
  6288. }
  6289. newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) {
  6290. (0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  6291. return null;
  6292. }));
  6293. }
  6294. return Promise.all(newRefsPromises).then(function (newRefs) {
  6295. return newRefs.filter(newRef => !!newRef);
  6296. });
  6297. });
  6298. }
  6299. loadResources(keys) {
  6300. if (!this.resourcesPromise) {
  6301. this.resourcesPromise = this.pdfManager.ensure(this, "resources");
  6302. }
  6303. return this.resourcesPromise.then(() => {
  6304. const objectLoader = new _object_loader.ObjectLoader(this.resources, keys, this.xref);
  6305. return objectLoader.load();
  6306. });
  6307. }
  6308. getOperatorList(_ref2) {
  6309. let {
  6310. handler,
  6311. sink,
  6312. task,
  6313. intent,
  6314. cacheKey,
  6315. annotationStorage = null
  6316. } = _ref2;
  6317. const contentStreamPromise = this.getContentStream(handler);
  6318. const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]);
  6319. const partialEvaluator = new _evaluator.PartialEvaluator({
  6320. xref: this.xref,
  6321. handler,
  6322. pageIndex: this.pageIndex,
  6323. idFactory: this._localIdFactory,
  6324. fontCache: this.fontCache,
  6325. builtInCMapCache: this.builtInCMapCache,
  6326. standardFontDataCache: this.standardFontDataCache,
  6327. globalImageCache: this.globalImageCache,
  6328. options: this.evaluatorOptions
  6329. });
  6330. const newAnnotationsByPage = !this.xfaFactory ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null;
  6331. let newAnnotationsPromise = Promise.resolve(null);
  6332. if (newAnnotationsByPage) {
  6333. const newAnnotations = newAnnotationsByPage.get(this.pageIndex);
  6334. if (newAnnotations) {
  6335. newAnnotationsPromise = _annotation.AnnotationFactory.printNewAnnotations(partialEvaluator, task, newAnnotations);
  6336. }
  6337. }
  6338. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  6339. const pageListPromise = dataPromises.then(_ref3 => {
  6340. let [contentStream] = _ref3;
  6341. const opList = new _operator_list.OperatorList(intent, sink);
  6342. handler.send("StartRenderPage", {
  6343. transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
  6344. pageIndex: this.pageIndex,
  6345. cacheKey
  6346. });
  6347. return partialEvaluator.getOperatorList({
  6348. stream: contentStream,
  6349. task,
  6350. resources: this.resources,
  6351. operatorList: opList
  6352. }).then(function () {
  6353. return opList;
  6354. });
  6355. });
  6356. return Promise.all([pageListPromise, this._parsedAnnotations, newAnnotationsPromise]).then(function (_ref4) {
  6357. let [pageOpList, annotations, newAnnotations] = _ref4;
  6358. if (newAnnotations) {
  6359. annotations = annotations.concat(newAnnotations);
  6360. }
  6361. if (annotations.length === 0 || intent & _util.RenderingIntentFlag.ANNOTATIONS_DISABLE) {
  6362. pageOpList.flush(true);
  6363. return {
  6364. length: pageOpList.totalLength
  6365. };
  6366. }
  6367. const renderForms = !!(intent & _util.RenderingIntentFlag.ANNOTATIONS_FORMS),
  6368. intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  6369. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  6370. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  6371. const opListPromises = [];
  6372. for (const annotation of annotations) {
  6373. if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage) || intentPrint && annotation.mustBePrinted(annotationStorage)) {
  6374. opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, renderForms, annotationStorage).catch(function (reason) {
  6375. (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  6376. return null;
  6377. }));
  6378. }
  6379. }
  6380. return Promise.all(opListPromises).then(function (opLists) {
  6381. let form = false,
  6382. canvas = false;
  6383. for (const {
  6384. opList,
  6385. separateForm,
  6386. separateCanvas
  6387. } of opLists) {
  6388. pageOpList.addOpList(opList);
  6389. if (separateForm) {
  6390. form = separateForm;
  6391. }
  6392. if (separateCanvas) {
  6393. canvas = separateCanvas;
  6394. }
  6395. }
  6396. pageOpList.flush(true, {
  6397. form,
  6398. canvas
  6399. });
  6400. return {
  6401. length: pageOpList.totalLength
  6402. };
  6403. });
  6404. });
  6405. }
  6406. extractTextContent(_ref5) {
  6407. let {
  6408. handler,
  6409. task,
  6410. includeMarkedContent,
  6411. sink,
  6412. combineTextItems
  6413. } = _ref5;
  6414. const contentStreamPromise = this.getContentStream(handler);
  6415. const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]);
  6416. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  6417. return dataPromises.then(_ref6 => {
  6418. let [contentStream] = _ref6;
  6419. const partialEvaluator = new _evaluator.PartialEvaluator({
  6420. xref: this.xref,
  6421. handler,
  6422. pageIndex: this.pageIndex,
  6423. idFactory: this._localIdFactory,
  6424. fontCache: this.fontCache,
  6425. builtInCMapCache: this.builtInCMapCache,
  6426. standardFontDataCache: this.standardFontDataCache,
  6427. globalImageCache: this.globalImageCache,
  6428. options: this.evaluatorOptions
  6429. });
  6430. return partialEvaluator.getTextContent({
  6431. stream: contentStream,
  6432. task,
  6433. resources: this.resources,
  6434. includeMarkedContent,
  6435. combineTextItems,
  6436. sink,
  6437. viewBox: this.view
  6438. });
  6439. });
  6440. }
  6441. async getStructTree() {
  6442. const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot");
  6443. if (!structTreeRoot) {
  6444. return null;
  6445. }
  6446. const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]);
  6447. return structTree.serializable;
  6448. }
  6449. _parseStructTree(structTreeRoot) {
  6450. const tree = new _struct_tree.StructTreePage(structTreeRoot, this.pageDict);
  6451. tree.parse();
  6452. return tree;
  6453. }
  6454. async getAnnotationsData(handler, task, intent) {
  6455. const annotations = await this._parsedAnnotations;
  6456. if (annotations.length === 0) {
  6457. return [];
  6458. }
  6459. const textContentPromises = [];
  6460. const annotationsData = [];
  6461. let partialEvaluator;
  6462. const intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  6463. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  6464. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  6465. for (const annotation of annotations) {
  6466. const isVisible = intentAny || intentDisplay && annotation.viewable;
  6467. if (isVisible || intentPrint && annotation.printable) {
  6468. annotationsData.push(annotation.data);
  6469. }
  6470. if (annotation.hasTextContent && isVisible) {
  6471. if (!partialEvaluator) {
  6472. partialEvaluator = new _evaluator.PartialEvaluator({
  6473. xref: this.xref,
  6474. handler,
  6475. pageIndex: this.pageIndex,
  6476. idFactory: this._localIdFactory,
  6477. fontCache: this.fontCache,
  6478. builtInCMapCache: this.builtInCMapCache,
  6479. standardFontDataCache: this.standardFontDataCache,
  6480. globalImageCache: this.globalImageCache,
  6481. options: this.evaluatorOptions
  6482. });
  6483. }
  6484. textContentPromises.push(annotation.extractTextContent(partialEvaluator, task, this.view).catch(function (reason) {
  6485. (0, _util.warn)(`getAnnotationsData - ignoring textContent during "${task.name}" task: "${reason}".`);
  6486. }));
  6487. }
  6488. }
  6489. await Promise.all(textContentPromises);
  6490. return annotationsData;
  6491. }
  6492. get annotations() {
  6493. const annots = this._getInheritableProperty("Annots");
  6494. return (0, _util.shadow)(this, "annotations", Array.isArray(annots) ? annots : []);
  6495. }
  6496. get _parsedAnnotations() {
  6497. const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
  6498. const annotationPromises = [];
  6499. for (const annotationRef of this.annotations) {
  6500. annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this._localIdFactory, false).catch(function (reason) {
  6501. (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
  6502. return null;
  6503. }));
  6504. }
  6505. return Promise.all(annotationPromises).then(function (annotations) {
  6506. if (annotations.length === 0) {
  6507. return annotations;
  6508. }
  6509. const sortedAnnotations = [];
  6510. let popupAnnotations;
  6511. for (const annotation of annotations) {
  6512. if (!annotation) {
  6513. continue;
  6514. }
  6515. if (annotation instanceof _annotation.PopupAnnotation) {
  6516. if (!popupAnnotations) {
  6517. popupAnnotations = [];
  6518. }
  6519. popupAnnotations.push(annotation);
  6520. continue;
  6521. }
  6522. sortedAnnotations.push(annotation);
  6523. }
  6524. if (popupAnnotations) {
  6525. sortedAnnotations.push(...popupAnnotations);
  6526. }
  6527. return sortedAnnotations;
  6528. });
  6529. });
  6530. return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
  6531. }
  6532. get jsActions() {
  6533. const actions = (0, _core_utils.collectActions)(this.xref, this.pageDict, _util.PageActionEventType);
  6534. return (0, _util.shadow)(this, "jsActions", actions);
  6535. }
  6536. }
  6537. exports.Page = Page;
  6538. const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
  6539. const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
  6540. const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
  6541. const FINGERPRINT_FIRST_BYTES = 1024;
  6542. const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  6543. const PDF_HEADER_VERSION_REGEXP = /^[1-9]\.\d$/;
  6544. function find(stream, signature) {
  6545. let limit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1024;
  6546. let backwards = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  6547. const signatureLength = signature.length;
  6548. const scanBytes = stream.peekBytes(limit);
  6549. const scanLength = scanBytes.length - signatureLength;
  6550. if (scanLength <= 0) {
  6551. return false;
  6552. }
  6553. if (backwards) {
  6554. const signatureEnd = signatureLength - 1;
  6555. let pos = scanBytes.length - 1;
  6556. while (pos >= signatureEnd) {
  6557. let j = 0;
  6558. while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
  6559. j++;
  6560. }
  6561. if (j >= signatureLength) {
  6562. stream.pos += pos - signatureEnd;
  6563. return true;
  6564. }
  6565. pos--;
  6566. }
  6567. } else {
  6568. let pos = 0;
  6569. while (pos <= scanLength) {
  6570. let j = 0;
  6571. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  6572. j++;
  6573. }
  6574. if (j >= signatureLength) {
  6575. stream.pos += pos;
  6576. return true;
  6577. }
  6578. pos++;
  6579. }
  6580. }
  6581. return false;
  6582. }
  6583. class PDFDocument {
  6584. constructor(pdfManager, stream) {
  6585. if (stream.length <= 0) {
  6586. throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
  6587. }
  6588. this.pdfManager = pdfManager;
  6589. this.stream = stream;
  6590. this.xref = new _xref.XRef(stream, pdfManager);
  6591. this._pagePromises = new Map();
  6592. this._version = null;
  6593. const idCounters = {
  6594. font: 0
  6595. };
  6596. this._globalIdFactory = class {
  6597. static getDocId() {
  6598. return `g_${pdfManager.docId}`;
  6599. }
  6600. static createFontId() {
  6601. return `f${++idCounters.font}`;
  6602. }
  6603. static createObjId() {
  6604. (0, _util.unreachable)("Abstract method `createObjId` called.");
  6605. }
  6606. static getPageObjId() {
  6607. (0, _util.unreachable)("Abstract method `getPageObjId` called.");
  6608. }
  6609. };
  6610. }
  6611. parse(recoveryMode) {
  6612. this.xref.parse(recoveryMode);
  6613. this.catalog = new _catalog.Catalog(this.pdfManager, this.xref);
  6614. if (this.catalog.version) {
  6615. this._version = this.catalog.version;
  6616. }
  6617. }
  6618. get linearization() {
  6619. let linearization = null;
  6620. try {
  6621. linearization = _parser.Linearization.create(this.stream);
  6622. } catch (err) {
  6623. if (err instanceof _core_utils.MissingDataException) {
  6624. throw err;
  6625. }
  6626. (0, _util.info)(err);
  6627. }
  6628. return (0, _util.shadow)(this, "linearization", linearization);
  6629. }
  6630. get startXRef() {
  6631. const stream = this.stream;
  6632. let startXRef = 0;
  6633. if (this.linearization) {
  6634. stream.reset();
  6635. if (find(stream, ENDOBJ_SIGNATURE)) {
  6636. startXRef = stream.pos + 6 - stream.start;
  6637. }
  6638. } else {
  6639. const step = 1024;
  6640. const startXRefLength = STARTXREF_SIGNATURE.length;
  6641. let found = false,
  6642. pos = stream.end;
  6643. while (!found && pos > 0) {
  6644. pos -= step - startXRefLength;
  6645. if (pos < 0) {
  6646. pos = 0;
  6647. }
  6648. stream.pos = pos;
  6649. found = find(stream, STARTXREF_SIGNATURE, step, true);
  6650. }
  6651. if (found) {
  6652. stream.skip(9);
  6653. let ch;
  6654. do {
  6655. ch = stream.getByte();
  6656. } while ((0, _core_utils.isWhiteSpace)(ch));
  6657. let str = "";
  6658. while (ch >= 0x20 && ch <= 0x39) {
  6659. str += String.fromCharCode(ch);
  6660. ch = stream.getByte();
  6661. }
  6662. startXRef = parseInt(str, 10);
  6663. if (isNaN(startXRef)) {
  6664. startXRef = 0;
  6665. }
  6666. }
  6667. }
  6668. return (0, _util.shadow)(this, "startXRef", startXRef);
  6669. }
  6670. checkHeader() {
  6671. const stream = this.stream;
  6672. stream.reset();
  6673. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  6674. return;
  6675. }
  6676. stream.moveStart();
  6677. const MAX_PDF_VERSION_LENGTH = 12;
  6678. let version = "",
  6679. ch;
  6680. while ((ch = stream.getByte()) > 0x20) {
  6681. if (version.length >= MAX_PDF_VERSION_LENGTH) {
  6682. break;
  6683. }
  6684. version += String.fromCharCode(ch);
  6685. }
  6686. if (!this._version) {
  6687. this._version = version.substring(5);
  6688. }
  6689. }
  6690. parseStartXRef() {
  6691. this.xref.setStartXRef(this.startXRef);
  6692. }
  6693. get numPages() {
  6694. let num = 0;
  6695. if (this.catalog.hasActualNumPages) {
  6696. num = this.catalog.numPages;
  6697. } else if (this.xfaFactory) {
  6698. num = this.xfaFactory.getNumPages();
  6699. } else if (this.linearization) {
  6700. num = this.linearization.numPages;
  6701. } else {
  6702. num = this.catalog.numPages;
  6703. }
  6704. return (0, _util.shadow)(this, "numPages", num);
  6705. }
  6706. _hasOnlyDocumentSignatures(fields) {
  6707. let recursionDepth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  6708. const RECURSION_LIMIT = 10;
  6709. if (!Array.isArray(fields)) {
  6710. return false;
  6711. }
  6712. return fields.every(field => {
  6713. field = this.xref.fetchIfRef(field);
  6714. if (!(field instanceof _primitives.Dict)) {
  6715. return false;
  6716. }
  6717. if (field.has("Kids")) {
  6718. if (++recursionDepth > RECURSION_LIMIT) {
  6719. (0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached");
  6720. return false;
  6721. }
  6722. return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
  6723. }
  6724. const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig");
  6725. const rectangle = field.get("Rect");
  6726. const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
  6727. return isSignature && isInvisible;
  6728. });
  6729. }
  6730. get _xfaStreams() {
  6731. const acroForm = this.catalog.acroForm;
  6732. if (!acroForm) {
  6733. return null;
  6734. }
  6735. const xfa = acroForm.get("XFA");
  6736. const entries = {
  6737. "xdp:xdp": "",
  6738. template: "",
  6739. datasets: "",
  6740. config: "",
  6741. connectionSet: "",
  6742. localeSet: "",
  6743. stylesheet: "",
  6744. "/xdp:xdp": ""
  6745. };
  6746. if (xfa instanceof _base_stream.BaseStream && !xfa.isEmpty) {
  6747. entries["xdp:xdp"] = xfa;
  6748. return entries;
  6749. }
  6750. if (!Array.isArray(xfa) || xfa.length === 0) {
  6751. return null;
  6752. }
  6753. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  6754. let name;
  6755. if (i === 0) {
  6756. name = "xdp:xdp";
  6757. } else if (i === ii - 2) {
  6758. name = "/xdp:xdp";
  6759. } else {
  6760. name = xfa[i];
  6761. }
  6762. if (!entries.hasOwnProperty(name)) {
  6763. continue;
  6764. }
  6765. const data = this.xref.fetchIfRef(xfa[i + 1]);
  6766. if (!(data instanceof _base_stream.BaseStream) || data.isEmpty) {
  6767. continue;
  6768. }
  6769. entries[name] = data;
  6770. }
  6771. return entries;
  6772. }
  6773. get xfaDatasets() {
  6774. const streams = this._xfaStreams;
  6775. if (!streams) {
  6776. return (0, _util.shadow)(this, "xfaDatasets", null);
  6777. }
  6778. for (const key of ["datasets", "xdp:xdp"]) {
  6779. const stream = streams[key];
  6780. if (!stream) {
  6781. continue;
  6782. }
  6783. try {
  6784. const str = (0, _util.stringToUTF8String)(stream.getString());
  6785. const data = {
  6786. [key]: str
  6787. };
  6788. return (0, _util.shadow)(this, "xfaDatasets", new _dataset_reader.DatasetReader(data));
  6789. } catch (_) {
  6790. (0, _util.warn)("XFA - Invalid utf-8 string.");
  6791. break;
  6792. }
  6793. }
  6794. return (0, _util.shadow)(this, "xfaDatasets", null);
  6795. }
  6796. get xfaData() {
  6797. const streams = this._xfaStreams;
  6798. if (!streams) {
  6799. return null;
  6800. }
  6801. const data = Object.create(null);
  6802. for (const [key, stream] of Object.entries(streams)) {
  6803. if (!stream) {
  6804. continue;
  6805. }
  6806. try {
  6807. data[key] = (0, _util.stringToUTF8String)(stream.getString());
  6808. } catch (_) {
  6809. (0, _util.warn)("XFA - Invalid utf-8 string.");
  6810. return null;
  6811. }
  6812. }
  6813. return data;
  6814. }
  6815. get xfaFactory() {
  6816. let data;
  6817. if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
  6818. data = this.xfaData;
  6819. }
  6820. return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null);
  6821. }
  6822. get isPureXfa() {
  6823. return this.xfaFactory ? this.xfaFactory.isValid() : false;
  6824. }
  6825. get htmlForXfa() {
  6826. return this.xfaFactory ? this.xfaFactory.getPages() : null;
  6827. }
  6828. async loadXfaImages() {
  6829. const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages");
  6830. if (!xfaImagesDict) {
  6831. return;
  6832. }
  6833. const keys = xfaImagesDict.getKeys();
  6834. const objectLoader = new _object_loader.ObjectLoader(xfaImagesDict, keys, this.xref);
  6835. await objectLoader.load();
  6836. const xfaImages = new Map();
  6837. for (const key of keys) {
  6838. const stream = xfaImagesDict.get(key);
  6839. if (stream instanceof _base_stream.BaseStream) {
  6840. xfaImages.set(key, stream.getBytes());
  6841. }
  6842. }
  6843. this.xfaFactory.setImages(xfaImages);
  6844. }
  6845. async loadXfaFonts(handler, task) {
  6846. const acroForm = await this.pdfManager.ensureCatalog("acroForm");
  6847. if (!acroForm) {
  6848. return;
  6849. }
  6850. const resources = await acroForm.getAsync("DR");
  6851. if (!(resources instanceof _primitives.Dict)) {
  6852. return;
  6853. }
  6854. const objectLoader = new _object_loader.ObjectLoader(resources, ["Font"], this.xref);
  6855. await objectLoader.load();
  6856. const fontRes = resources.get("Font");
  6857. if (!(fontRes instanceof _primitives.Dict)) {
  6858. return;
  6859. }
  6860. const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions);
  6861. options.useSystemFonts = false;
  6862. const partialEvaluator = new _evaluator.PartialEvaluator({
  6863. xref: this.xref,
  6864. handler,
  6865. pageIndex: -1,
  6866. idFactory: this._globalIdFactory,
  6867. fontCache: this.catalog.fontCache,
  6868. builtInCMapCache: this.catalog.builtInCMapCache,
  6869. standardFontDataCache: this.catalog.standardFontDataCache,
  6870. options
  6871. });
  6872. const operatorList = new _operator_list.OperatorList();
  6873. const pdfFonts = [];
  6874. const initialState = {
  6875. get font() {
  6876. return pdfFonts.at(-1);
  6877. },
  6878. set font(font) {
  6879. pdfFonts.push(font);
  6880. },
  6881. clone() {
  6882. return this;
  6883. }
  6884. };
  6885. const fonts = new Map();
  6886. fontRes.forEach((fontName, font) => {
  6887. fonts.set(fontName, font);
  6888. });
  6889. const promises = [];
  6890. for (const [fontName, font] of fonts) {
  6891. const descriptor = font.get("FontDescriptor");
  6892. if (!(descriptor instanceof _primitives.Dict)) {
  6893. continue;
  6894. }
  6895. let fontFamily = descriptor.get("FontFamily");
  6896. fontFamily = fontFamily.replace(/[ ]+(\d)/g, "$1");
  6897. const fontWeight = descriptor.get("FontWeight");
  6898. const italicAngle = -descriptor.get("ItalicAngle");
  6899. const cssFontInfo = {
  6900. fontFamily,
  6901. fontWeight,
  6902. italicAngle
  6903. };
  6904. if (!(0, _core_utils.validateCSSFont)(cssFontInfo)) {
  6905. continue;
  6906. }
  6907. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(fontName), 1], null, operatorList, task, initialState, null, cssFontInfo).catch(function (reason) {
  6908. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  6909. return null;
  6910. }));
  6911. }
  6912. await Promise.all(promises);
  6913. const missingFonts = this.xfaFactory.setFonts(pdfFonts);
  6914. if (!missingFonts) {
  6915. return;
  6916. }
  6917. options.ignoreErrors = true;
  6918. promises.length = 0;
  6919. pdfFonts.length = 0;
  6920. const reallyMissingFonts = new Set();
  6921. for (const missing of missingFonts) {
  6922. if (!(0, _xfa_fonts.getXfaFontName)(`${missing}-Regular`)) {
  6923. reallyMissingFonts.add(missing);
  6924. }
  6925. }
  6926. if (reallyMissingFonts.size) {
  6927. missingFonts.push("PdfJS-Fallback");
  6928. }
  6929. for (const missing of missingFonts) {
  6930. if (reallyMissingFonts.has(missing)) {
  6931. continue;
  6932. }
  6933. for (const fontInfo of [{
  6934. name: "Regular",
  6935. fontWeight: 400,
  6936. italicAngle: 0
  6937. }, {
  6938. name: "Bold",
  6939. fontWeight: 700,
  6940. italicAngle: 0
  6941. }, {
  6942. name: "Italic",
  6943. fontWeight: 400,
  6944. italicAngle: 12
  6945. }, {
  6946. name: "BoldItalic",
  6947. fontWeight: 700,
  6948. italicAngle: 12
  6949. }]) {
  6950. const name = `${missing}-${fontInfo.name}`;
  6951. const dict = (0, _xfa_fonts.getXfaFontDict)(name);
  6952. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(name), 1], null, operatorList, task, initialState, dict, {
  6953. fontFamily: missing,
  6954. fontWeight: fontInfo.fontWeight,
  6955. italicAngle: fontInfo.italicAngle
  6956. }).catch(function (reason) {
  6957. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  6958. return null;
  6959. }));
  6960. }
  6961. }
  6962. await Promise.all(promises);
  6963. this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts);
  6964. }
  6965. async serializeXfaData(annotationStorage) {
  6966. return this.xfaFactory ? this.xfaFactory.serializeData(annotationStorage) : null;
  6967. }
  6968. get formInfo() {
  6969. const formInfo = {
  6970. hasFields: false,
  6971. hasAcroForm: false,
  6972. hasXfa: false,
  6973. hasSignatures: false
  6974. };
  6975. const acroForm = this.catalog.acroForm;
  6976. if (!acroForm) {
  6977. return (0, _util.shadow)(this, "formInfo", formInfo);
  6978. }
  6979. try {
  6980. const fields = acroForm.get("Fields");
  6981. const hasFields = Array.isArray(fields) && fields.length > 0;
  6982. formInfo.hasFields = hasFields;
  6983. const xfa = acroForm.get("XFA");
  6984. formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || xfa instanceof _base_stream.BaseStream && !xfa.isEmpty;
  6985. const sigFlags = acroForm.get("SigFlags");
  6986. const hasSignatures = !!(sigFlags & 0x1);
  6987. const hasOnlyDocumentSignatures = hasSignatures && this._hasOnlyDocumentSignatures(fields);
  6988. formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
  6989. formInfo.hasSignatures = hasSignatures;
  6990. } catch (ex) {
  6991. if (ex instanceof _core_utils.MissingDataException) {
  6992. throw ex;
  6993. }
  6994. (0, _util.warn)(`Cannot fetch form information: "${ex}".`);
  6995. }
  6996. return (0, _util.shadow)(this, "formInfo", formInfo);
  6997. }
  6998. get documentInfo() {
  6999. let version = this._version;
  7000. if (typeof version !== "string" || !PDF_HEADER_VERSION_REGEXP.test(version)) {
  7001. (0, _util.warn)(`Invalid PDF header version number: ${version}`);
  7002. version = null;
  7003. }
  7004. const docInfo = {
  7005. PDFFormatVersion: version,
  7006. Language: this.catalog.lang,
  7007. EncryptFilterName: this.xref.encrypt ? this.xref.encrypt.filterName : null,
  7008. IsLinearized: !!this.linearization,
  7009. IsAcroFormPresent: this.formInfo.hasAcroForm,
  7010. IsXFAPresent: this.formInfo.hasXfa,
  7011. IsCollectionPresent: !!this.catalog.collection,
  7012. IsSignaturesPresent: this.formInfo.hasSignatures
  7013. };
  7014. let infoDict;
  7015. try {
  7016. infoDict = this.xref.trailer.get("Info");
  7017. } catch (err) {
  7018. if (err instanceof _core_utils.MissingDataException) {
  7019. throw err;
  7020. }
  7021. (0, _util.info)("The document information dictionary is invalid.");
  7022. }
  7023. if (!(infoDict instanceof _primitives.Dict)) {
  7024. return (0, _util.shadow)(this, "documentInfo", docInfo);
  7025. }
  7026. for (const key of infoDict.getKeys()) {
  7027. const value = infoDict.get(key);
  7028. switch (key) {
  7029. case "Title":
  7030. case "Author":
  7031. case "Subject":
  7032. case "Keywords":
  7033. case "Creator":
  7034. case "Producer":
  7035. case "CreationDate":
  7036. case "ModDate":
  7037. if (typeof value === "string") {
  7038. docInfo[key] = (0, _util.stringToPDFString)(value);
  7039. continue;
  7040. }
  7041. break;
  7042. case "Trapped":
  7043. if (value instanceof _primitives.Name) {
  7044. docInfo[key] = value;
  7045. continue;
  7046. }
  7047. break;
  7048. default:
  7049. let customValue;
  7050. switch (typeof value) {
  7051. case "string":
  7052. customValue = (0, _util.stringToPDFString)(value);
  7053. break;
  7054. case "number":
  7055. case "boolean":
  7056. customValue = value;
  7057. break;
  7058. default:
  7059. if (value instanceof _primitives.Name) {
  7060. customValue = value;
  7061. }
  7062. break;
  7063. }
  7064. if (customValue === undefined) {
  7065. (0, _util.warn)(`Bad value, for custom key "${key}", in Info: ${value}.`);
  7066. continue;
  7067. }
  7068. if (!docInfo.Custom) {
  7069. docInfo.Custom = Object.create(null);
  7070. }
  7071. docInfo.Custom[key] = customValue;
  7072. continue;
  7073. }
  7074. (0, _util.warn)(`Bad value, for key "${key}", in Info: ${value}.`);
  7075. }
  7076. return (0, _util.shadow)(this, "documentInfo", docInfo);
  7077. }
  7078. get fingerprints() {
  7079. function validate(data) {
  7080. return typeof data === "string" && data.length > 0 && data !== EMPTY_FINGERPRINT;
  7081. }
  7082. function hexString(hash) {
  7083. const buf = [];
  7084. for (let i = 0, ii = hash.length; i < ii; i++) {
  7085. const hex = hash[i].toString(16);
  7086. buf.push(hex.padStart(2, "0"));
  7087. }
  7088. return buf.join("");
  7089. }
  7090. const idArray = this.xref.trailer.get("ID");
  7091. let hashOriginal, hashModified;
  7092. if (Array.isArray(idArray) && validate(idArray[0])) {
  7093. hashOriginal = (0, _util.stringToBytes)(idArray[0]);
  7094. if (idArray[1] !== idArray[0] && validate(idArray[1])) {
  7095. hashModified = (0, _util.stringToBytes)(idArray[1]);
  7096. }
  7097. } else {
  7098. hashOriginal = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  7099. }
  7100. return (0, _util.shadow)(this, "fingerprints", [hexString(hashOriginal), hashModified ? hexString(hashModified) : null]);
  7101. }
  7102. async _getLinearizationPage(pageIndex) {
  7103. const {
  7104. catalog,
  7105. linearization,
  7106. xref
  7107. } = this;
  7108. const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
  7109. try {
  7110. const obj = await xref.fetchAsync(ref);
  7111. if (obj instanceof _primitives.Dict) {
  7112. let type = obj.getRaw("Type");
  7113. if (type instanceof _primitives.Ref) {
  7114. type = await xref.fetchAsync(type);
  7115. }
  7116. if ((0, _primitives.isName)(type, "Page") || !obj.has("Type") && !obj.has("Kids")) {
  7117. if (!catalog.pageKidsCountCache.has(ref)) {
  7118. catalog.pageKidsCountCache.put(ref, 1);
  7119. }
  7120. if (!catalog.pageIndexCache.has(ref)) {
  7121. catalog.pageIndexCache.put(ref, 0);
  7122. }
  7123. return [obj, ref];
  7124. }
  7125. }
  7126. throw new _util.FormatError("The Linearization dictionary doesn't point to a valid Page dictionary.");
  7127. } catch (reason) {
  7128. (0, _util.warn)(`_getLinearizationPage: "${reason.message}".`);
  7129. return catalog.getPageDict(pageIndex);
  7130. }
  7131. }
  7132. getPage(pageIndex) {
  7133. const cachedPromise = this._pagePromises.get(pageIndex);
  7134. if (cachedPromise) {
  7135. return cachedPromise;
  7136. }
  7137. const {
  7138. catalog,
  7139. linearization,
  7140. xfaFactory
  7141. } = this;
  7142. let promise;
  7143. if (xfaFactory) {
  7144. promise = Promise.resolve([_primitives.Dict.empty, null]);
  7145. } else if (linearization && linearization.pageFirst === pageIndex) {
  7146. promise = this._getLinearizationPage(pageIndex);
  7147. } else {
  7148. promise = catalog.getPageDict(pageIndex);
  7149. }
  7150. promise = promise.then(_ref7 => {
  7151. let [pageDict, ref] = _ref7;
  7152. return new Page({
  7153. pdfManager: this.pdfManager,
  7154. xref: this.xref,
  7155. pageIndex,
  7156. pageDict,
  7157. ref,
  7158. globalIdFactory: this._globalIdFactory,
  7159. fontCache: catalog.fontCache,
  7160. builtInCMapCache: catalog.builtInCMapCache,
  7161. standardFontDataCache: catalog.standardFontDataCache,
  7162. globalImageCache: catalog.globalImageCache,
  7163. nonBlendModesSet: catalog.nonBlendModesSet,
  7164. xfaFactory
  7165. });
  7166. });
  7167. this._pagePromises.set(pageIndex, promise);
  7168. return promise;
  7169. }
  7170. async checkFirstPage() {
  7171. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  7172. if (recoveryMode) {
  7173. return;
  7174. }
  7175. try {
  7176. await this.getPage(0);
  7177. } catch (reason) {
  7178. if (reason instanceof _core_utils.XRefEntryException) {
  7179. this._pagePromises.delete(0);
  7180. await this.cleanup();
  7181. throw new _core_utils.XRefParseException();
  7182. }
  7183. }
  7184. }
  7185. async checkLastPage() {
  7186. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  7187. const {
  7188. catalog,
  7189. pdfManager
  7190. } = this;
  7191. catalog.setActualNumPages();
  7192. let numPages;
  7193. try {
  7194. await Promise.all([pdfManager.ensureDoc("xfaFactory"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("numPages")]);
  7195. if (this.xfaFactory) {
  7196. return;
  7197. } else if (this.linearization) {
  7198. numPages = this.linearization.numPages;
  7199. } else {
  7200. numPages = catalog.numPages;
  7201. }
  7202. if (!Number.isInteger(numPages)) {
  7203. throw new _util.FormatError("Page count is not an integer.");
  7204. } else if (numPages <= 1) {
  7205. return;
  7206. }
  7207. await this.getPage(numPages - 1);
  7208. } catch (reason) {
  7209. this._pagePromises.delete(numPages - 1);
  7210. await this.cleanup();
  7211. if (reason instanceof _core_utils.XRefEntryException && !recoveryMode) {
  7212. throw new _core_utils.XRefParseException();
  7213. }
  7214. (0, _util.warn)(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`);
  7215. let pagesTree;
  7216. try {
  7217. pagesTree = await catalog.getAllPageDicts(recoveryMode);
  7218. } catch (reasonAll) {
  7219. if (reasonAll instanceof _core_utils.XRefEntryException && !recoveryMode) {
  7220. throw new _core_utils.XRefParseException();
  7221. }
  7222. catalog.setActualNumPages(1);
  7223. return;
  7224. }
  7225. for (const [pageIndex, [pageDict, ref]] of pagesTree) {
  7226. let promise;
  7227. if (pageDict instanceof Error) {
  7228. promise = Promise.reject(pageDict);
  7229. promise.catch(() => {});
  7230. } else {
  7231. promise = Promise.resolve(new Page({
  7232. pdfManager,
  7233. xref: this.xref,
  7234. pageIndex,
  7235. pageDict,
  7236. ref,
  7237. globalIdFactory: this._globalIdFactory,
  7238. fontCache: catalog.fontCache,
  7239. builtInCMapCache: catalog.builtInCMapCache,
  7240. standardFontDataCache: catalog.standardFontDataCache,
  7241. globalImageCache: catalog.globalImageCache,
  7242. nonBlendModesSet: catalog.nonBlendModesSet,
  7243. xfaFactory: null
  7244. }));
  7245. }
  7246. this._pagePromises.set(pageIndex, promise);
  7247. }
  7248. catalog.setActualNumPages(pagesTree.size);
  7249. }
  7250. }
  7251. fontFallback(id, handler) {
  7252. return this.catalog.fontFallback(id, handler);
  7253. }
  7254. async cleanup() {
  7255. let manuallyTriggered = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  7256. return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _cleanup_helper.clearGlobalCaches)();
  7257. }
  7258. _collectFieldObjects(name, fieldRef, promises) {
  7259. const field = this.xref.fetchIfRef(fieldRef);
  7260. if (field.has("T")) {
  7261. const partName = (0, _util.stringToPDFString)(field.get("T"));
  7262. if (name === "") {
  7263. name = partName;
  7264. } else {
  7265. name = `${name}.${partName}`;
  7266. }
  7267. }
  7268. if (!promises.has(name)) {
  7269. promises.set(name, []);
  7270. }
  7271. promises.get(name).push(_annotation.AnnotationFactory.create(this.xref, fieldRef, this.pdfManager, this._localIdFactory, true).then(annotation => annotation && annotation.getFieldObject()).catch(function (reason) {
  7272. (0, _util.warn)(`_collectFieldObjects: "${reason}".`);
  7273. return null;
  7274. }));
  7275. if (field.has("Kids")) {
  7276. const kids = field.get("Kids");
  7277. for (const kid of kids) {
  7278. this._collectFieldObjects(name, kid, promises);
  7279. }
  7280. }
  7281. }
  7282. get fieldObjects() {
  7283. if (!this.formInfo.hasFields) {
  7284. return (0, _util.shadow)(this, "fieldObjects", Promise.resolve(null));
  7285. }
  7286. const allFields = Object.create(null);
  7287. const fieldPromises = new Map();
  7288. for (const fieldRef of this.catalog.acroForm.get("Fields")) {
  7289. this._collectFieldObjects("", fieldRef, fieldPromises);
  7290. }
  7291. const allPromises = [];
  7292. for (const [name, promises] of fieldPromises) {
  7293. allPromises.push(Promise.all(promises).then(fields => {
  7294. fields = fields.filter(field => !!field);
  7295. if (fields.length > 0) {
  7296. allFields[name] = fields;
  7297. }
  7298. }));
  7299. }
  7300. return (0, _util.shadow)(this, "fieldObjects", Promise.all(allPromises).then(() => allFields));
  7301. }
  7302. get hasJSActions() {
  7303. const promise = this.pdfManager.ensureDoc("_parseHasJSActions");
  7304. return (0, _util.shadow)(this, "hasJSActions", promise);
  7305. }
  7306. async _parseHasJSActions() {
  7307. const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]);
  7308. if (catalogJsActions) {
  7309. return true;
  7310. }
  7311. if (fieldObjects) {
  7312. return Object.values(fieldObjects).some(fieldObject => fieldObject.some(object => object.actions !== null));
  7313. }
  7314. return false;
  7315. }
  7316. get calculationOrderIds() {
  7317. const acroForm = this.catalog.acroForm;
  7318. if (!acroForm || !acroForm.has("CO")) {
  7319. return (0, _util.shadow)(this, "calculationOrderIds", null);
  7320. }
  7321. const calculationOrder = acroForm.get("CO");
  7322. if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
  7323. return (0, _util.shadow)(this, "calculationOrderIds", null);
  7324. }
  7325. const ids = [];
  7326. for (const id of calculationOrder) {
  7327. if (id instanceof _primitives.Ref) {
  7328. ids.push(id.toString());
  7329. }
  7330. }
  7331. if (ids.length === 0) {
  7332. return (0, _util.shadow)(this, "calculationOrderIds", null);
  7333. }
  7334. return (0, _util.shadow)(this, "calculationOrderIds", ids);
  7335. }
  7336. }
  7337. exports.PDFDocument = PDFDocument;
  7338. /***/ }),
  7339. /* 137 */
  7340. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  7341. "use strict";
  7342. Object.defineProperty(exports, "__esModule", ({
  7343. value: true
  7344. }));
  7345. exports.PopupAnnotation = exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
  7346. exports.getQuadPoints = getQuadPoints;
  7347. var _util = __w_pdfjs_require__(2);
  7348. var _core_utils = __w_pdfjs_require__(131);
  7349. var _default_appearance = __w_pdfjs_require__(138);
  7350. var _primitives = __w_pdfjs_require__(130);
  7351. var _writer = __w_pdfjs_require__(190);
  7352. var _base_stream = __w_pdfjs_require__(132);
  7353. var _bidi = __w_pdfjs_require__(185);
  7354. var _catalog = __w_pdfjs_require__(194);
  7355. var _colorspace = __w_pdfjs_require__(139);
  7356. var _file_spec = __w_pdfjs_require__(197);
  7357. var _object_loader = __w_pdfjs_require__(200);
  7358. var _operator_list = __w_pdfjs_require__(187);
  7359. var _stream = __w_pdfjs_require__(135);
  7360. var _factory = __w_pdfjs_require__(201);
  7361. class AnnotationFactory {
  7362. static create(xref, ref, pdfManager, idFactory, collectFields) {
  7363. return Promise.all([pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("baseUrl"), pdfManager.ensureDoc("xfaDatasets"), collectFields ? this._getPageIndex(xref, ref, pdfManager) : -1]).then(_ref => {
  7364. let [acroForm, baseUrl, xfaDatasets, pageIndex] = _ref;
  7365. return pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory, acroForm, xfaDatasets, collectFields, pageIndex]);
  7366. });
  7367. }
  7368. static _create(xref, ref, pdfManager, idFactory, acroForm, xfaDatasets, collectFields) {
  7369. let pageIndex = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : -1;
  7370. const dict = xref.fetchIfRef(ref);
  7371. if (!(dict instanceof _primitives.Dict)) {
  7372. return undefined;
  7373. }
  7374. const id = ref instanceof _primitives.Ref ? ref.toString() : `annot_${idFactory.createObjId()}`;
  7375. let subtype = dict.get("Subtype");
  7376. subtype = subtype instanceof _primitives.Name ? subtype.name : null;
  7377. const parameters = {
  7378. xref,
  7379. ref,
  7380. dict,
  7381. subtype,
  7382. id,
  7383. pdfManager,
  7384. acroForm: acroForm instanceof _primitives.Dict ? acroForm : _primitives.Dict.empty,
  7385. xfaDatasets,
  7386. collectFields,
  7387. pageIndex
  7388. };
  7389. switch (subtype) {
  7390. case "Link":
  7391. return new LinkAnnotation(parameters);
  7392. case "Text":
  7393. return new TextAnnotation(parameters);
  7394. case "Widget":
  7395. let fieldType = (0, _core_utils.getInheritableProperty)({
  7396. dict,
  7397. key: "FT"
  7398. });
  7399. fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  7400. switch (fieldType) {
  7401. case "Tx":
  7402. return new TextWidgetAnnotation(parameters);
  7403. case "Btn":
  7404. return new ButtonWidgetAnnotation(parameters);
  7405. case "Ch":
  7406. return new ChoiceWidgetAnnotation(parameters);
  7407. case "Sig":
  7408. return new SignatureWidgetAnnotation(parameters);
  7409. }
  7410. (0, _util.warn)(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type.");
  7411. return new WidgetAnnotation(parameters);
  7412. case "Popup":
  7413. return new PopupAnnotation(parameters);
  7414. case "FreeText":
  7415. return new FreeTextAnnotation(parameters);
  7416. case "Line":
  7417. return new LineAnnotation(parameters);
  7418. case "Square":
  7419. return new SquareAnnotation(parameters);
  7420. case "Circle":
  7421. return new CircleAnnotation(parameters);
  7422. case "PolyLine":
  7423. return new PolylineAnnotation(parameters);
  7424. case "Polygon":
  7425. return new PolygonAnnotation(parameters);
  7426. case "Caret":
  7427. return new CaretAnnotation(parameters);
  7428. case "Ink":
  7429. return new InkAnnotation(parameters);
  7430. case "Highlight":
  7431. return new HighlightAnnotation(parameters);
  7432. case "Underline":
  7433. return new UnderlineAnnotation(parameters);
  7434. case "Squiggly":
  7435. return new SquigglyAnnotation(parameters);
  7436. case "StrikeOut":
  7437. return new StrikeOutAnnotation(parameters);
  7438. case "Stamp":
  7439. return new StampAnnotation(parameters);
  7440. case "FileAttachment":
  7441. return new FileAttachmentAnnotation(parameters);
  7442. default:
  7443. if (!collectFields) {
  7444. if (!subtype) {
  7445. (0, _util.warn)("Annotation is missing the required /Subtype.");
  7446. } else {
  7447. (0, _util.warn)(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation.");
  7448. }
  7449. }
  7450. return new Annotation(parameters);
  7451. }
  7452. }
  7453. static async _getPageIndex(xref, ref, pdfManager) {
  7454. try {
  7455. const annotDict = await xref.fetchIfRefAsync(ref);
  7456. if (!(annotDict instanceof _primitives.Dict)) {
  7457. return -1;
  7458. }
  7459. const pageRef = annotDict.getRaw("P");
  7460. if (!(pageRef instanceof _primitives.Ref)) {
  7461. return -1;
  7462. }
  7463. const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  7464. return pageIndex;
  7465. } catch (ex) {
  7466. (0, _util.warn)(`_getPageIndex: "${ex}".`);
  7467. return -1;
  7468. }
  7469. }
  7470. static async saveNewAnnotations(evaluator, task, annotations) {
  7471. const xref = evaluator.xref;
  7472. let baseFontRef;
  7473. const dependencies = [];
  7474. const promises = [];
  7475. for (const annotation of annotations) {
  7476. switch (annotation.annotationType) {
  7477. case _util.AnnotationEditorType.FREETEXT:
  7478. if (!baseFontRef) {
  7479. const baseFont = new _primitives.Dict(xref);
  7480. baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
  7481. baseFont.set("Type", _primitives.Name.get("Font"));
  7482. baseFont.set("Subtype", _primitives.Name.get("Type1"));
  7483. baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  7484. const buffer = [];
  7485. baseFontRef = xref.getNewRef();
  7486. (0, _writer.writeObject)(baseFontRef, baseFont, buffer, null);
  7487. dependencies.push({
  7488. ref: baseFontRef,
  7489. data: buffer.join("")
  7490. });
  7491. }
  7492. promises.push(FreeTextAnnotation.createNewAnnotation(xref, annotation, dependencies, {
  7493. evaluator,
  7494. task,
  7495. baseFontRef
  7496. }));
  7497. break;
  7498. case _util.AnnotationEditorType.INK:
  7499. promises.push(InkAnnotation.createNewAnnotation(xref, annotation, dependencies));
  7500. }
  7501. }
  7502. return {
  7503. annotations: await Promise.all(promises),
  7504. dependencies
  7505. };
  7506. }
  7507. static async printNewAnnotations(evaluator, task, annotations) {
  7508. if (!annotations) {
  7509. return null;
  7510. }
  7511. const xref = evaluator.xref;
  7512. const promises = [];
  7513. for (const annotation of annotations) {
  7514. switch (annotation.annotationType) {
  7515. case _util.AnnotationEditorType.FREETEXT:
  7516. promises.push(FreeTextAnnotation.createNewPrintAnnotation(xref, annotation, {
  7517. evaluator,
  7518. task
  7519. }));
  7520. break;
  7521. case _util.AnnotationEditorType.INK:
  7522. promises.push(InkAnnotation.createNewPrintAnnotation(xref, annotation));
  7523. break;
  7524. }
  7525. }
  7526. return Promise.all(promises);
  7527. }
  7528. }
  7529. exports.AnnotationFactory = AnnotationFactory;
  7530. function getRgbColor(color) {
  7531. let defaultColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Uint8ClampedArray(3);
  7532. if (!Array.isArray(color)) {
  7533. return defaultColor;
  7534. }
  7535. const rgbColor = defaultColor || new Uint8ClampedArray(3);
  7536. switch (color.length) {
  7537. case 0:
  7538. return null;
  7539. case 1:
  7540. _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  7541. return rgbColor;
  7542. case 3:
  7543. _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  7544. return rgbColor;
  7545. case 4:
  7546. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  7547. return rgbColor;
  7548. default:
  7549. return defaultColor;
  7550. }
  7551. }
  7552. function getQuadPoints(dict, rect) {
  7553. if (!dict.has("QuadPoints")) {
  7554. return null;
  7555. }
  7556. const quadPoints = dict.getArray("QuadPoints");
  7557. if (!Array.isArray(quadPoints) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
  7558. return null;
  7559. }
  7560. const quadPointsLists = [];
  7561. for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
  7562. quadPointsLists.push([]);
  7563. for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
  7564. const x = quadPoints[j];
  7565. const y = quadPoints[j + 1];
  7566. if (rect !== null && (x < rect[0] || x > rect[2] || y < rect[1] || y > rect[3])) {
  7567. return null;
  7568. }
  7569. quadPointsLists[i].push({
  7570. x,
  7571. y
  7572. });
  7573. }
  7574. }
  7575. return quadPointsLists.map(quadPointsList => {
  7576. const [minX, maxX, minY, maxY] = quadPointsList.reduce((_ref2, quadPoint) => {
  7577. let [mX, MX, mY, MY] = _ref2;
  7578. return [Math.min(mX, quadPoint.x), Math.max(MX, quadPoint.x), Math.min(mY, quadPoint.y), Math.max(MY, quadPoint.y)];
  7579. }, [Number.MAX_VALUE, Number.MIN_VALUE, Number.MAX_VALUE, Number.MIN_VALUE]);
  7580. return [{
  7581. x: minX,
  7582. y: maxY
  7583. }, {
  7584. x: maxX,
  7585. y: maxY
  7586. }, {
  7587. x: minX,
  7588. y: minY
  7589. }, {
  7590. x: maxX,
  7591. y: minY
  7592. }];
  7593. });
  7594. }
  7595. function getTransformMatrix(rect, bbox, matrix) {
  7596. const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
  7597. if (minX === maxX || minY === maxY) {
  7598. return [1, 0, 0, 1, rect[0], rect[1]];
  7599. }
  7600. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  7601. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  7602. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  7603. }
  7604. class Annotation {
  7605. constructor(params) {
  7606. const dict = params.dict;
  7607. this.setTitle(dict.get("T"));
  7608. this.setContents(dict.get("Contents"));
  7609. this.setModificationDate(dict.get("M"));
  7610. this.setFlags(dict.get("F"));
  7611. this.setRectangle(dict.getArray("Rect"));
  7612. this.setColor(dict.getArray("C"));
  7613. this.setBorderStyle(dict);
  7614. this.setAppearance(dict);
  7615. this.setOptionalContent(dict);
  7616. const MK = dict.get("MK");
  7617. this.setBorderAndBackgroundColors(MK);
  7618. this.setRotation(MK);
  7619. this._streams = [];
  7620. if (this.appearance) {
  7621. this._streams.push(this.appearance);
  7622. }
  7623. this.data = {
  7624. annotationFlags: this.flags,
  7625. borderStyle: this.borderStyle,
  7626. color: this.color,
  7627. backgroundColor: this.backgroundColor,
  7628. borderColor: this.borderColor,
  7629. rotation: this.rotation,
  7630. contentsObj: this._contents,
  7631. hasAppearance: !!this.appearance,
  7632. id: params.id,
  7633. modificationDate: this.modificationDate,
  7634. rect: this.rectangle,
  7635. subtype: params.subtype,
  7636. hasOwnCanvas: false
  7637. };
  7638. if (params.collectFields) {
  7639. const kids = dict.get("Kids");
  7640. if (Array.isArray(kids)) {
  7641. const kidIds = [];
  7642. for (const kid of kids) {
  7643. if (kid instanceof _primitives.Ref) {
  7644. kidIds.push(kid.toString());
  7645. }
  7646. }
  7647. if (kidIds.length !== 0) {
  7648. this.data.kidIds = kidIds;
  7649. }
  7650. }
  7651. this.data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  7652. this.data.fieldName = this._constructFieldName(dict);
  7653. this.data.pageIndex = params.pageIndex;
  7654. }
  7655. this._fallbackFontDict = null;
  7656. }
  7657. _hasFlag(flags, flag) {
  7658. return !!(flags & flag);
  7659. }
  7660. _isViewable(flags) {
  7661. return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
  7662. }
  7663. _isPrintable(flags) {
  7664. return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE);
  7665. }
  7666. mustBeViewed(annotationStorage) {
  7667. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  7668. if (storageEntry && storageEntry.hidden !== undefined) {
  7669. return !storageEntry.hidden;
  7670. }
  7671. return this.viewable && !this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN);
  7672. }
  7673. mustBePrinted(annotationStorage) {
  7674. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  7675. if (storageEntry && storageEntry.print !== undefined) {
  7676. return storageEntry.print;
  7677. }
  7678. return this.printable;
  7679. }
  7680. get viewable() {
  7681. if (this.data.quadPoints === null) {
  7682. return false;
  7683. }
  7684. if (this.flags === 0) {
  7685. return true;
  7686. }
  7687. return this._isViewable(this.flags);
  7688. }
  7689. get printable() {
  7690. if (this.data.quadPoints === null) {
  7691. return false;
  7692. }
  7693. if (this.flags === 0) {
  7694. return false;
  7695. }
  7696. return this._isPrintable(this.flags);
  7697. }
  7698. _parseStringHelper(data) {
  7699. const str = typeof data === "string" ? (0, _util.stringToPDFString)(data) : "";
  7700. const dir = str && (0, _bidi.bidi)(str).dir === "rtl" ? "rtl" : "ltr";
  7701. return {
  7702. str,
  7703. dir
  7704. };
  7705. }
  7706. setTitle(title) {
  7707. this._title = this._parseStringHelper(title);
  7708. }
  7709. setContents(contents) {
  7710. this._contents = this._parseStringHelper(contents);
  7711. }
  7712. setModificationDate(modificationDate) {
  7713. this.modificationDate = typeof modificationDate === "string" ? modificationDate : null;
  7714. }
  7715. setFlags(flags) {
  7716. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  7717. }
  7718. hasFlag(flag) {
  7719. return this._hasFlag(this.flags, flag);
  7720. }
  7721. setRectangle(rectangle) {
  7722. if (Array.isArray(rectangle) && rectangle.length === 4) {
  7723. this.rectangle = _util.Util.normalizeRect(rectangle);
  7724. } else {
  7725. this.rectangle = [0, 0, 0, 0];
  7726. }
  7727. }
  7728. setColor(color) {
  7729. this.color = getRgbColor(color);
  7730. }
  7731. setLineEndings(lineEndings) {
  7732. this.lineEndings = ["None", "None"];
  7733. if (Array.isArray(lineEndings) && lineEndings.length === 2) {
  7734. for (let i = 0; i < 2; i++) {
  7735. const obj = lineEndings[i];
  7736. if (obj instanceof _primitives.Name) {
  7737. switch (obj.name) {
  7738. case "None":
  7739. continue;
  7740. case "Square":
  7741. case "Circle":
  7742. case "Diamond":
  7743. case "OpenArrow":
  7744. case "ClosedArrow":
  7745. case "Butt":
  7746. case "ROpenArrow":
  7747. case "RClosedArrow":
  7748. case "Slash":
  7749. this.lineEndings[i] = obj.name;
  7750. continue;
  7751. }
  7752. }
  7753. (0, _util.warn)(`Ignoring invalid lineEnding: ${obj}`);
  7754. }
  7755. }
  7756. }
  7757. setRotation(mk) {
  7758. this.rotation = 0;
  7759. if (mk instanceof _primitives.Dict) {
  7760. let angle = mk.get("R") || 0;
  7761. if (Number.isInteger(angle) && angle !== 0) {
  7762. angle %= 360;
  7763. if (angle < 0) {
  7764. angle += 360;
  7765. }
  7766. if (angle % 90 === 0) {
  7767. this.rotation = angle;
  7768. }
  7769. }
  7770. }
  7771. }
  7772. setBorderAndBackgroundColors(mk) {
  7773. if (mk instanceof _primitives.Dict) {
  7774. this.borderColor = getRgbColor(mk.getArray("BC"), null);
  7775. this.backgroundColor = getRgbColor(mk.getArray("BG"), null);
  7776. } else {
  7777. this.borderColor = this.backgroundColor = null;
  7778. }
  7779. }
  7780. setBorderStyle(borderStyle) {
  7781. this.borderStyle = new AnnotationBorderStyle();
  7782. if (!(borderStyle instanceof _primitives.Dict)) {
  7783. return;
  7784. }
  7785. if (borderStyle.has("BS")) {
  7786. const dict = borderStyle.get("BS");
  7787. const dictType = dict.get("Type");
  7788. if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
  7789. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  7790. this.borderStyle.setStyle(dict.get("S"));
  7791. this.borderStyle.setDashArray(dict.getArray("D"));
  7792. }
  7793. } else if (borderStyle.has("Border")) {
  7794. const array = borderStyle.getArray("Border");
  7795. if (Array.isArray(array) && array.length >= 3) {
  7796. this.borderStyle.setHorizontalCornerRadius(array[0]);
  7797. this.borderStyle.setVerticalCornerRadius(array[1]);
  7798. this.borderStyle.setWidth(array[2], this.rectangle);
  7799. if (array.length === 4) {
  7800. this.borderStyle.setDashArray(array[3], true);
  7801. }
  7802. }
  7803. } else {
  7804. this.borderStyle.setWidth(0);
  7805. }
  7806. }
  7807. setAppearance(dict) {
  7808. this.appearance = null;
  7809. const appearanceStates = dict.get("AP");
  7810. if (!(appearanceStates instanceof _primitives.Dict)) {
  7811. return;
  7812. }
  7813. const normalAppearanceState = appearanceStates.get("N");
  7814. if (normalAppearanceState instanceof _base_stream.BaseStream) {
  7815. this.appearance = normalAppearanceState;
  7816. return;
  7817. }
  7818. if (!(normalAppearanceState instanceof _primitives.Dict)) {
  7819. return;
  7820. }
  7821. const as = dict.get("AS");
  7822. if (!(as instanceof _primitives.Name) || !normalAppearanceState.has(as.name)) {
  7823. return;
  7824. }
  7825. this.appearance = normalAppearanceState.get(as.name);
  7826. }
  7827. setOptionalContent(dict) {
  7828. this.oc = null;
  7829. const oc = dict.get("OC");
  7830. if (oc instanceof _primitives.Name) {
  7831. (0, _util.warn)("setOptionalContent: Support for /Name-entry is not implemented.");
  7832. } else if (oc instanceof _primitives.Dict) {
  7833. this.oc = oc;
  7834. }
  7835. }
  7836. loadResources(keys, appearance) {
  7837. return appearance.dict.getAsync("Resources").then(resources => {
  7838. if (!resources) {
  7839. return undefined;
  7840. }
  7841. const objectLoader = new _object_loader.ObjectLoader(resources, keys, resources.xref);
  7842. return objectLoader.load().then(function () {
  7843. return resources;
  7844. });
  7845. });
  7846. }
  7847. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  7848. const data = this.data;
  7849. let appearance = this.appearance;
  7850. const isUsingOwnCanvas = !!(this.data.hasOwnCanvas && intent & _util.RenderingIntentFlag.DISPLAY);
  7851. if (!appearance) {
  7852. if (!isUsingOwnCanvas) {
  7853. return {
  7854. opList: new _operator_list.OperatorList(),
  7855. separateForm: false,
  7856. separateCanvas: false
  7857. };
  7858. }
  7859. appearance = new _stream.StringStream("");
  7860. appearance.dict = new _primitives.Dict();
  7861. }
  7862. const appearanceDict = appearance.dict;
  7863. const resources = await this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"], appearance);
  7864. const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
  7865. const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
  7866. const transform = getTransformMatrix(data.rect, bbox, matrix);
  7867. const opList = new _operator_list.OperatorList();
  7868. let optionalContent;
  7869. if (this.oc) {
  7870. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  7871. }
  7872. if (optionalContent !== undefined) {
  7873. opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  7874. }
  7875. opList.addOp(_util.OPS.beginAnnotation, [data.id, data.rect, transform, matrix, isUsingOwnCanvas]);
  7876. await evaluator.getOperatorList({
  7877. stream: appearance,
  7878. task,
  7879. resources,
  7880. operatorList: opList,
  7881. fallbackFontDict: this._fallbackFontDict
  7882. });
  7883. opList.addOp(_util.OPS.endAnnotation, []);
  7884. if (optionalContent !== undefined) {
  7885. opList.addOp(_util.OPS.endMarkedContent, []);
  7886. }
  7887. this.reset();
  7888. return {
  7889. opList,
  7890. separateForm: false,
  7891. separateCanvas: isUsingOwnCanvas
  7892. };
  7893. }
  7894. async save(evaluator, task, annotationStorage) {
  7895. return null;
  7896. }
  7897. get hasTextContent() {
  7898. return false;
  7899. }
  7900. async extractTextContent(evaluator, task, viewBox) {
  7901. if (!this.appearance) {
  7902. return;
  7903. }
  7904. const resources = await this.loadResources(["ExtGState", "Font", "Properties", "XObject"], this.appearance);
  7905. const text = [];
  7906. const buffer = [];
  7907. const sink = {
  7908. desiredSize: Math.Infinity,
  7909. ready: true,
  7910. enqueue(chunk, size) {
  7911. for (const item of chunk.items) {
  7912. buffer.push(item.str);
  7913. if (item.hasEOL) {
  7914. text.push(buffer.join(""));
  7915. buffer.length = 0;
  7916. }
  7917. }
  7918. }
  7919. };
  7920. await evaluator.getTextContent({
  7921. stream: this.appearance,
  7922. task,
  7923. resources,
  7924. includeMarkedContent: true,
  7925. combineTextItems: true,
  7926. sink,
  7927. viewBox
  7928. });
  7929. this.reset();
  7930. if (buffer.length) {
  7931. text.push(buffer.join(""));
  7932. }
  7933. if (text.length > 0) {
  7934. this.data.textContent = text;
  7935. }
  7936. }
  7937. getFieldObject() {
  7938. if (this.data.kidIds) {
  7939. return {
  7940. id: this.data.id,
  7941. actions: this.data.actions,
  7942. name: this.data.fieldName,
  7943. strokeColor: this.data.borderColor,
  7944. fillColor: this.data.backgroundColor,
  7945. type: "",
  7946. kidIds: this.data.kidIds,
  7947. page: this.data.pageIndex,
  7948. rotation: this.rotation
  7949. };
  7950. }
  7951. return null;
  7952. }
  7953. reset() {
  7954. for (const stream of this._streams) {
  7955. stream.reset();
  7956. }
  7957. }
  7958. _constructFieldName(dict) {
  7959. if (!dict.has("T") && !dict.has("Parent")) {
  7960. (0, _util.warn)("Unknown field name, falling back to empty field name.");
  7961. return "";
  7962. }
  7963. if (!dict.has("Parent")) {
  7964. return (0, _util.stringToPDFString)(dict.get("T"));
  7965. }
  7966. const fieldName = [];
  7967. if (dict.has("T")) {
  7968. fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
  7969. }
  7970. let loopDict = dict;
  7971. const visited = new _primitives.RefSet();
  7972. if (dict.objId) {
  7973. visited.put(dict.objId);
  7974. }
  7975. while (loopDict.has("Parent")) {
  7976. loopDict = loopDict.get("Parent");
  7977. if (!(loopDict instanceof _primitives.Dict) || loopDict.objId && visited.has(loopDict.objId)) {
  7978. break;
  7979. }
  7980. if (loopDict.objId) {
  7981. visited.put(loopDict.objId);
  7982. }
  7983. if (loopDict.has("T")) {
  7984. fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T")));
  7985. }
  7986. }
  7987. return fieldName.join(".");
  7988. }
  7989. }
  7990. exports.Annotation = Annotation;
  7991. class AnnotationBorderStyle {
  7992. constructor() {
  7993. this.width = 1;
  7994. this.style = _util.AnnotationBorderStyleType.SOLID;
  7995. this.dashArray = [3];
  7996. this.horizontalCornerRadius = 0;
  7997. this.verticalCornerRadius = 0;
  7998. }
  7999. setWidth(width) {
  8000. let rect = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0, 0];
  8001. if (width instanceof _primitives.Name) {
  8002. this.width = 0;
  8003. return;
  8004. }
  8005. if (typeof width === "number") {
  8006. if (width > 0) {
  8007. const maxWidth = (rect[2] - rect[0]) / 2;
  8008. const maxHeight = (rect[3] - rect[1]) / 2;
  8009. if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
  8010. (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
  8011. width = 1;
  8012. }
  8013. }
  8014. this.width = width;
  8015. }
  8016. }
  8017. setStyle(style) {
  8018. if (!(style instanceof _primitives.Name)) {
  8019. return;
  8020. }
  8021. switch (style.name) {
  8022. case "S":
  8023. this.style = _util.AnnotationBorderStyleType.SOLID;
  8024. break;
  8025. case "D":
  8026. this.style = _util.AnnotationBorderStyleType.DASHED;
  8027. break;
  8028. case "B":
  8029. this.style = _util.AnnotationBorderStyleType.BEVELED;
  8030. break;
  8031. case "I":
  8032. this.style = _util.AnnotationBorderStyleType.INSET;
  8033. break;
  8034. case "U":
  8035. this.style = _util.AnnotationBorderStyleType.UNDERLINE;
  8036. break;
  8037. default:
  8038. break;
  8039. }
  8040. }
  8041. setDashArray(dashArray) {
  8042. let forceStyle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  8043. if (Array.isArray(dashArray) && dashArray.length > 0) {
  8044. let isValid = true;
  8045. let allZeros = true;
  8046. for (const element of dashArray) {
  8047. const validNumber = +element >= 0;
  8048. if (!validNumber) {
  8049. isValid = false;
  8050. break;
  8051. } else if (element > 0) {
  8052. allZeros = false;
  8053. }
  8054. }
  8055. if (isValid && !allZeros) {
  8056. this.dashArray = dashArray;
  8057. if (forceStyle) {
  8058. this.setStyle(_primitives.Name.get("D"));
  8059. }
  8060. } else {
  8061. this.width = 0;
  8062. }
  8063. } else if (dashArray) {
  8064. this.width = 0;
  8065. }
  8066. }
  8067. setHorizontalCornerRadius(radius) {
  8068. if (Number.isInteger(radius)) {
  8069. this.horizontalCornerRadius = radius;
  8070. }
  8071. }
  8072. setVerticalCornerRadius(radius) {
  8073. if (Number.isInteger(radius)) {
  8074. this.verticalCornerRadius = radius;
  8075. }
  8076. }
  8077. }
  8078. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  8079. class MarkupAnnotation extends Annotation {
  8080. constructor(parameters) {
  8081. super(parameters);
  8082. const dict = parameters.dict;
  8083. if (dict.has("IRT")) {
  8084. const rawIRT = dict.getRaw("IRT");
  8085. this.data.inReplyTo = rawIRT instanceof _primitives.Ref ? rawIRT.toString() : null;
  8086. const rt = dict.get("RT");
  8087. this.data.replyType = rt instanceof _primitives.Name ? rt.name : _util.AnnotationReplyType.REPLY;
  8088. }
  8089. if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
  8090. const parent = dict.get("IRT");
  8091. this.setTitle(parent.get("T"));
  8092. this.data.titleObj = this._title;
  8093. this.setContents(parent.get("Contents"));
  8094. this.data.contentsObj = this._contents;
  8095. if (!parent.has("CreationDate")) {
  8096. this.data.creationDate = null;
  8097. } else {
  8098. this.setCreationDate(parent.get("CreationDate"));
  8099. this.data.creationDate = this.creationDate;
  8100. }
  8101. if (!parent.has("M")) {
  8102. this.data.modificationDate = null;
  8103. } else {
  8104. this.setModificationDate(parent.get("M"));
  8105. this.data.modificationDate = this.modificationDate;
  8106. }
  8107. this.data.hasPopup = parent.has("Popup");
  8108. if (!parent.has("C")) {
  8109. this.data.color = null;
  8110. } else {
  8111. this.setColor(parent.getArray("C"));
  8112. this.data.color = this.color;
  8113. }
  8114. } else {
  8115. this.data.titleObj = this._title;
  8116. this.setCreationDate(dict.get("CreationDate"));
  8117. this.data.creationDate = this.creationDate;
  8118. this.data.hasPopup = dict.has("Popup");
  8119. if (!dict.has("C")) {
  8120. this.data.color = null;
  8121. }
  8122. }
  8123. if (dict.has("RC")) {
  8124. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(dict.get("RC"));
  8125. }
  8126. }
  8127. setCreationDate(creationDate) {
  8128. this.creationDate = typeof creationDate === "string" ? creationDate : null;
  8129. }
  8130. _setDefaultAppearance(_ref3) {
  8131. let {
  8132. xref,
  8133. extra,
  8134. strokeColor,
  8135. fillColor,
  8136. blendMode,
  8137. strokeAlpha,
  8138. fillAlpha,
  8139. pointsCallback
  8140. } = _ref3;
  8141. let minX = Number.MAX_VALUE;
  8142. let minY = Number.MAX_VALUE;
  8143. let maxX = Number.MIN_VALUE;
  8144. let maxY = Number.MIN_VALUE;
  8145. const buffer = ["q"];
  8146. if (extra) {
  8147. buffer.push(extra);
  8148. }
  8149. if (strokeColor) {
  8150. buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`);
  8151. }
  8152. if (fillColor) {
  8153. buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
  8154. }
  8155. let pointsArray = this.data.quadPoints;
  8156. if (!pointsArray) {
  8157. pointsArray = [[{
  8158. x: this.rectangle[0],
  8159. y: this.rectangle[3]
  8160. }, {
  8161. x: this.rectangle[2],
  8162. y: this.rectangle[3]
  8163. }, {
  8164. x: this.rectangle[0],
  8165. y: this.rectangle[1]
  8166. }, {
  8167. x: this.rectangle[2],
  8168. y: this.rectangle[1]
  8169. }]];
  8170. }
  8171. for (const points of pointsArray) {
  8172. const [mX, MX, mY, MY] = pointsCallback(buffer, points);
  8173. minX = Math.min(minX, mX);
  8174. maxX = Math.max(maxX, MX);
  8175. minY = Math.min(minY, mY);
  8176. maxY = Math.max(maxY, MY);
  8177. }
  8178. buffer.push("Q");
  8179. const formDict = new _primitives.Dict(xref);
  8180. const appearanceStreamDict = new _primitives.Dict(xref);
  8181. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  8182. const appearanceStream = new _stream.StringStream(buffer.join(" "));
  8183. appearanceStream.dict = appearanceStreamDict;
  8184. formDict.set("Fm0", appearanceStream);
  8185. const gsDict = new _primitives.Dict(xref);
  8186. if (blendMode) {
  8187. gsDict.set("BM", _primitives.Name.get(blendMode));
  8188. }
  8189. if (typeof strokeAlpha === "number") {
  8190. gsDict.set("CA", strokeAlpha);
  8191. }
  8192. if (typeof fillAlpha === "number") {
  8193. gsDict.set("ca", fillAlpha);
  8194. }
  8195. const stateDict = new _primitives.Dict(xref);
  8196. stateDict.set("GS0", gsDict);
  8197. const resources = new _primitives.Dict(xref);
  8198. resources.set("ExtGState", stateDict);
  8199. resources.set("XObject", formDict);
  8200. const appearanceDict = new _primitives.Dict(xref);
  8201. appearanceDict.set("Resources", resources);
  8202. const bbox = this.data.rect = [minX, minY, maxX, maxY];
  8203. appearanceDict.set("BBox", bbox);
  8204. this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do");
  8205. this.appearance.dict = appearanceDict;
  8206. this._streams.push(this.appearance, appearanceStream);
  8207. }
  8208. static async createNewAnnotation(xref, annotation, dependencies, params) {
  8209. const annotationRef = xref.getNewRef();
  8210. const apRef = xref.getNewRef();
  8211. const annotationDict = this.createNewDict(annotation, xref, {
  8212. apRef
  8213. });
  8214. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  8215. const buffer = [];
  8216. let transform = xref.encrypt ? xref.encrypt.createCipherTransform(apRef.num, apRef.gen) : null;
  8217. (0, _writer.writeObject)(apRef, ap, buffer, transform);
  8218. dependencies.push({
  8219. ref: apRef,
  8220. data: buffer.join("")
  8221. });
  8222. buffer.length = 0;
  8223. transform = xref.encrypt ? xref.encrypt.createCipherTransform(annotationRef.num, annotationRef.gen) : null;
  8224. (0, _writer.writeObject)(annotationRef, annotationDict, buffer, transform);
  8225. return {
  8226. ref: annotationRef,
  8227. data: buffer.join("")
  8228. };
  8229. }
  8230. static async createNewPrintAnnotation(xref, annotation, params) {
  8231. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  8232. const annotationDict = this.createNewDict(annotation, xref, {
  8233. ap
  8234. });
  8235. return new this.prototype.constructor({
  8236. dict: annotationDict,
  8237. xref
  8238. });
  8239. }
  8240. }
  8241. exports.MarkupAnnotation = MarkupAnnotation;
  8242. class WidgetAnnotation extends Annotation {
  8243. constructor(params) {
  8244. super(params);
  8245. const dict = params.dict;
  8246. const data = this.data;
  8247. this.ref = params.ref;
  8248. data.annotationType = _util.AnnotationType.WIDGET;
  8249. if (data.fieldName === undefined) {
  8250. data.fieldName = this._constructFieldName(dict);
  8251. }
  8252. if (data.actions === undefined) {
  8253. data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  8254. }
  8255. let fieldValue = (0, _core_utils.getInheritableProperty)({
  8256. dict,
  8257. key: "V",
  8258. getArray: true
  8259. });
  8260. data.fieldValue = this._decodeFormValue(fieldValue);
  8261. const defaultFieldValue = (0, _core_utils.getInheritableProperty)({
  8262. dict,
  8263. key: "DV",
  8264. getArray: true
  8265. });
  8266. data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
  8267. if (fieldValue === undefined && params.xfaDatasets) {
  8268. const path = this._title.str;
  8269. if (path) {
  8270. this._hasValueFromXFA = true;
  8271. data.fieldValue = fieldValue = params.xfaDatasets.getValue(path);
  8272. }
  8273. }
  8274. if (fieldValue === undefined && data.defaultFieldValue !== null) {
  8275. data.fieldValue = data.defaultFieldValue;
  8276. }
  8277. data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || "");
  8278. const defaultAppearance = (0, _core_utils.getInheritableProperty)({
  8279. dict,
  8280. key: "DA"
  8281. }) || params.acroForm.get("DA");
  8282. this._defaultAppearance = typeof defaultAppearance === "string" ? defaultAppearance : "";
  8283. data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance);
  8284. const fieldType = (0, _core_utils.getInheritableProperty)({
  8285. dict,
  8286. key: "FT"
  8287. });
  8288. data.fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  8289. const localResources = (0, _core_utils.getInheritableProperty)({
  8290. dict,
  8291. key: "DR"
  8292. });
  8293. const acroFormResources = params.acroForm.get("DR");
  8294. const appearanceResources = this.appearance && this.appearance.dict.get("Resources");
  8295. this._fieldResources = {
  8296. localResources,
  8297. acroFormResources,
  8298. appearanceResources,
  8299. mergedResources: _primitives.Dict.merge({
  8300. xref: params.xref,
  8301. dictArray: [localResources, appearanceResources, acroFormResources],
  8302. mergeSubDicts: true
  8303. })
  8304. };
  8305. data.fieldFlags = (0, _core_utils.getInheritableProperty)({
  8306. dict,
  8307. key: "Ff"
  8308. });
  8309. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  8310. data.fieldFlags = 0;
  8311. }
  8312. data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
  8313. data.required = this.hasFieldFlag(_util.AnnotationFieldFlag.REQUIRED);
  8314. data.hidden = this._hasFlag(data.annotationFlags, _util.AnnotationFlag.HIDDEN);
  8315. }
  8316. _decodeFormValue(formValue) {
  8317. if (Array.isArray(formValue)) {
  8318. return formValue.filter(item => typeof item === "string").map(item => (0, _util.stringToPDFString)(item));
  8319. } else if (formValue instanceof _primitives.Name) {
  8320. return (0, _util.stringToPDFString)(formValue.name);
  8321. } else if (typeof formValue === "string") {
  8322. return (0, _util.stringToPDFString)(formValue);
  8323. }
  8324. return null;
  8325. }
  8326. hasFieldFlag(flag) {
  8327. return !!(this.data.fieldFlags & flag);
  8328. }
  8329. static _getRotationMatrix(rotation, width, height) {
  8330. switch (rotation) {
  8331. case 90:
  8332. return [0, 1, -1, 0, width, 0];
  8333. case 180:
  8334. return [-1, 0, 0, -1, width, height];
  8335. case 270:
  8336. return [0, -1, 1, 0, 0, height];
  8337. default:
  8338. throw new Error("Invalid rotation");
  8339. }
  8340. }
  8341. getRotationMatrix(annotationStorage) {
  8342. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  8343. let rotation = storageEntry && storageEntry.rotation;
  8344. if (rotation === undefined) {
  8345. rotation = this.rotation;
  8346. }
  8347. if (rotation === 0) {
  8348. return _util.IDENTITY_MATRIX;
  8349. }
  8350. const width = this.data.rect[2] - this.data.rect[0];
  8351. const height = this.data.rect[3] - this.data.rect[1];
  8352. return WidgetAnnotation._getRotationMatrix(rotation, width, height);
  8353. }
  8354. getBorderAndBackgroundAppearances(annotationStorage) {
  8355. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  8356. let rotation = storageEntry && storageEntry.rotation;
  8357. if (rotation === undefined) {
  8358. rotation = this.rotation;
  8359. }
  8360. if (!this.backgroundColor && !this.borderColor) {
  8361. return "";
  8362. }
  8363. const width = this.data.rect[2] - this.data.rect[0];
  8364. const height = this.data.rect[3] - this.data.rect[1];
  8365. const rect = rotation === 0 || rotation === 180 ? `0 0 ${width} ${height} re` : `0 0 ${height} ${width} re`;
  8366. let str = "";
  8367. if (this.backgroundColor) {
  8368. str = `${(0, _default_appearance.getPdfColor)(this.backgroundColor, true)} ${rect} f `;
  8369. }
  8370. if (this.borderColor) {
  8371. const borderWidth = this.borderStyle.width || 1;
  8372. str += `${borderWidth} w ${(0, _default_appearance.getPdfColor)(this.borderColor, false)} ${rect} S `;
  8373. }
  8374. return str;
  8375. }
  8376. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  8377. if (renderForms && !(this instanceof SignatureWidgetAnnotation)) {
  8378. return {
  8379. opList: new _operator_list.OperatorList(),
  8380. separateForm: true,
  8381. separateCanvas: false
  8382. };
  8383. }
  8384. if (!this._hasText) {
  8385. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  8386. }
  8387. const content = await this._getAppearance(evaluator, task, annotationStorage);
  8388. if (this.appearance && content === null) {
  8389. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  8390. }
  8391. const opList = new _operator_list.OperatorList();
  8392. if (!this._defaultAppearance || content === null) {
  8393. return {
  8394. opList,
  8395. separateForm: false,
  8396. separateCanvas: false
  8397. };
  8398. }
  8399. const matrix = [1, 0, 0, 1, 0, 0];
  8400. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  8401. const transform = getTransformMatrix(this.data.rect, bbox, matrix);
  8402. let optionalContent;
  8403. if (this.oc) {
  8404. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  8405. }
  8406. if (optionalContent !== undefined) {
  8407. opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  8408. }
  8409. opList.addOp(_util.OPS.beginAnnotation, [this.data.id, this.data.rect, transform, this.getRotationMatrix(annotationStorage), false]);
  8410. const stream = new _stream.StringStream(content);
  8411. await evaluator.getOperatorList({
  8412. stream,
  8413. task,
  8414. resources: this._fieldResources.mergedResources,
  8415. operatorList: opList
  8416. });
  8417. opList.addOp(_util.OPS.endAnnotation, []);
  8418. if (optionalContent !== undefined) {
  8419. opList.addOp(_util.OPS.endMarkedContent, []);
  8420. }
  8421. return {
  8422. opList,
  8423. separateForm: false,
  8424. separateCanvas: false
  8425. };
  8426. }
  8427. _getMKDict(rotation) {
  8428. const mk = new _primitives.Dict(null);
  8429. if (rotation) {
  8430. mk.set("R", rotation);
  8431. }
  8432. if (this.borderColor) {
  8433. mk.set("BC", Array.from(this.borderColor).map(c => c / 255));
  8434. }
  8435. if (this.backgroundColor) {
  8436. mk.set("BG", Array.from(this.backgroundColor).map(c => c / 255));
  8437. }
  8438. return mk.size > 0 ? mk : null;
  8439. }
  8440. async save(evaluator, task, annotationStorage) {
  8441. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  8442. let value = storageEntry && storageEntry.value;
  8443. let rotation = storageEntry && storageEntry.rotation;
  8444. if (value === this.data.fieldValue || value === undefined) {
  8445. if (!this._hasValueFromXFA && rotation === undefined) {
  8446. return null;
  8447. }
  8448. value = value || this.data.fieldValue;
  8449. }
  8450. 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])) {
  8451. return null;
  8452. }
  8453. if (rotation === undefined) {
  8454. rotation = this.rotation;
  8455. }
  8456. let appearance = await this._getAppearance(evaluator, task, annotationStorage);
  8457. if (appearance === null) {
  8458. return null;
  8459. }
  8460. const {
  8461. xref
  8462. } = evaluator;
  8463. const dict = xref.fetchIfRef(this.ref);
  8464. if (!(dict instanceof _primitives.Dict)) {
  8465. return null;
  8466. }
  8467. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  8468. const xfa = {
  8469. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  8470. value
  8471. };
  8472. const newRef = xref.getNewRef();
  8473. const AP = new _primitives.Dict(xref);
  8474. AP.set("N", newRef);
  8475. const encrypt = xref.encrypt;
  8476. let originalTransform = null;
  8477. let newTransform = null;
  8478. if (encrypt) {
  8479. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  8480. newTransform = encrypt.createCipherTransform(newRef.num, newRef.gen);
  8481. appearance = newTransform.encryptString(appearance);
  8482. }
  8483. const encoder = val => (0, _util.isAscii)(val) ? val : (0, _util.stringToUTF16BEString)(val);
  8484. dict.set("V", Array.isArray(value) ? value.map(encoder) : encoder(value));
  8485. dict.set("AP", AP);
  8486. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  8487. const maybeMK = this._getMKDict(rotation);
  8488. if (maybeMK) {
  8489. dict.set("MK", maybeMK);
  8490. }
  8491. const appearanceDict = new _primitives.Dict(xref);
  8492. appearanceDict.set("Length", appearance.length);
  8493. appearanceDict.set("Subtype", _primitives.Name.get("Form"));
  8494. appearanceDict.set("Resources", this._getSaveFieldResources(xref));
  8495. appearanceDict.set("BBox", bbox);
  8496. const rotationMatrix = this.getRotationMatrix(annotationStorage);
  8497. if (rotationMatrix !== _util.IDENTITY_MATRIX) {
  8498. appearanceDict.set("Matrix", rotationMatrix);
  8499. }
  8500. const bufferOriginal = [`${this.ref.num} ${this.ref.gen} obj\n`];
  8501. (0, _writer.writeDict)(dict, bufferOriginal, originalTransform);
  8502. bufferOriginal.push("\nendobj\n");
  8503. const bufferNew = [`${newRef.num} ${newRef.gen} obj\n`];
  8504. (0, _writer.writeDict)(appearanceDict, bufferNew, newTransform);
  8505. bufferNew.push(" stream\n", appearance, "\nendstream\nendobj\n");
  8506. return [{
  8507. ref: this.ref,
  8508. data: bufferOriginal.join(""),
  8509. xfa
  8510. }, {
  8511. ref: newRef,
  8512. data: bufferNew.join(""),
  8513. xfa: null
  8514. }];
  8515. }
  8516. async _getAppearance(evaluator, task, annotationStorage) {
  8517. const isPassword = this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD);
  8518. if (isPassword) {
  8519. return null;
  8520. }
  8521. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  8522. let value, rotation;
  8523. if (storageEntry) {
  8524. value = storageEntry.formattedValue || storageEntry.value;
  8525. rotation = storageEntry.rotation;
  8526. }
  8527. if (rotation === undefined && value === undefined) {
  8528. if (!this._hasValueFromXFA || this.appearance) {
  8529. return null;
  8530. }
  8531. }
  8532. if (value === undefined) {
  8533. value = this.data.fieldValue;
  8534. if (!value) {
  8535. return "";
  8536. }
  8537. }
  8538. if (Array.isArray(value) && value.length === 1) {
  8539. value = value[0];
  8540. }
  8541. (0, _util.assert)(typeof value === "string", "Expected `value` to be a string.");
  8542. value = value.trim();
  8543. if (value === "") {
  8544. return "";
  8545. }
  8546. if (rotation === undefined) {
  8547. rotation = this.rotation;
  8548. }
  8549. let lineCount = -1;
  8550. if (this.data.multiLine) {
  8551. lineCount = value.split(/\r\n|\r|\n/).length;
  8552. }
  8553. const defaultPadding = 2;
  8554. const hPadding = defaultPadding;
  8555. let totalHeight = this.data.rect[3] - this.data.rect[1];
  8556. let totalWidth = this.data.rect[2] - this.data.rect[0];
  8557. if (rotation === 90 || rotation === 270) {
  8558. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  8559. }
  8560. if (!this._defaultAppearance) {
  8561. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  8562. }
  8563. const font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  8564. const [defaultAppearance, fontSize] = this._computeFontSize(totalHeight - defaultPadding, totalWidth - 2 * hPadding, value, font, lineCount);
  8565. let descent = font.descent;
  8566. if (isNaN(descent)) {
  8567. descent = 0;
  8568. }
  8569. const defaultVPadding = Math.min(Math.floor((totalHeight - fontSize) / 2), defaultPadding);
  8570. const vPadding = defaultVPadding + Math.abs(descent) * fontSize;
  8571. const alignment = this.data.textAlignment;
  8572. if (this.data.multiLine) {
  8573. return this._getMultilineAppearance(defaultAppearance, value, font, fontSize, totalWidth, totalHeight, alignment, hPadding, vPadding, annotationStorage);
  8574. }
  8575. const encodedString = font.encodeString(value).join("");
  8576. if (this.data.comb) {
  8577. return this._getCombAppearance(defaultAppearance, font, encodedString, totalWidth, hPadding, vPadding, annotationStorage);
  8578. }
  8579. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  8580. if (alignment === 0 || alignment > 2) {
  8581. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm (${(0, _util.escapeString)(encodedString)}) Tj` + " ET Q EMC";
  8582. }
  8583. const renderedText = this._renderText(encodedString, font, fontSize, totalWidth, alignment, hPadding, vPadding);
  8584. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC";
  8585. }
  8586. static async _getFontData(evaluator, task, appearanceData, resources) {
  8587. const operatorList = new _operator_list.OperatorList();
  8588. const initialState = {
  8589. font: null,
  8590. clone() {
  8591. return this;
  8592. }
  8593. };
  8594. const {
  8595. fontName,
  8596. fontSize
  8597. } = appearanceData;
  8598. await evaluator.handleSetFont(resources, [fontName && _primitives.Name.get(fontName), fontSize], null, operatorList, task, initialState, null);
  8599. return initialState.font;
  8600. }
  8601. _getTextWidth(text, font) {
  8602. return font.charsToGlyphs(text).reduce((width, glyph) => width + glyph.width, 0) / 1000;
  8603. }
  8604. _computeFontSize(height, width, text, font, lineCount) {
  8605. let {
  8606. fontSize
  8607. } = this.data.defaultAppearanceData;
  8608. if (!fontSize) {
  8609. const roundWithTwoDigits = x => Math.floor(x * 100) / 100;
  8610. if (lineCount === -1) {
  8611. const textWidth = this._getTextWidth(text, font);
  8612. fontSize = roundWithTwoDigits(Math.min(height / _util.LINE_FACTOR, width / textWidth));
  8613. } else {
  8614. const lines = text.split(/\r\n?|\n/);
  8615. const cachedLines = [];
  8616. for (const line of lines) {
  8617. const encoded = font.encodeString(line).join("");
  8618. const glyphs = font.charsToGlyphs(encoded);
  8619. const positions = font.getCharPositions(encoded);
  8620. cachedLines.push({
  8621. line: encoded,
  8622. glyphs,
  8623. positions
  8624. });
  8625. }
  8626. const isTooBig = fsize => {
  8627. let totalHeight = 0;
  8628. for (const cache of cachedLines) {
  8629. const chunks = this._splitLine(null, font, fsize, width, cache);
  8630. totalHeight += chunks.length * fsize;
  8631. if (totalHeight > height) {
  8632. return true;
  8633. }
  8634. }
  8635. return false;
  8636. };
  8637. fontSize = 12;
  8638. let lineHeight = fontSize * _util.LINE_FACTOR;
  8639. let numberOfLines = Math.round(height / lineHeight);
  8640. numberOfLines = Math.max(numberOfLines, lineCount);
  8641. while (true) {
  8642. lineHeight = height / numberOfLines;
  8643. fontSize = roundWithTwoDigits(lineHeight / _util.LINE_FACTOR);
  8644. if (isTooBig(fontSize)) {
  8645. numberOfLines++;
  8646. continue;
  8647. }
  8648. break;
  8649. }
  8650. }
  8651. const {
  8652. fontName,
  8653. fontColor
  8654. } = this.data.defaultAppearanceData;
  8655. this._defaultAppearance = (0, _default_appearance.createDefaultAppearance)({
  8656. fontSize,
  8657. fontName,
  8658. fontColor
  8659. });
  8660. }
  8661. return [this._defaultAppearance, fontSize];
  8662. }
  8663. _renderText(text, font, fontSize, totalWidth, alignment, hPadding, vPadding) {
  8664. let shift;
  8665. if (alignment === 1) {
  8666. const width = this._getTextWidth(text, font) * fontSize;
  8667. shift = (totalWidth - width) / 2;
  8668. } else if (alignment === 2) {
  8669. const width = this._getTextWidth(text, font) * fontSize;
  8670. shift = totalWidth - width - hPadding;
  8671. } else {
  8672. shift = hPadding;
  8673. }
  8674. shift = (0, _core_utils.numberToString)(shift);
  8675. vPadding = (0, _core_utils.numberToString)(vPadding);
  8676. return `${shift} ${vPadding} Td (${(0, _util.escapeString)(text)}) Tj`;
  8677. }
  8678. _getSaveFieldResources(xref) {
  8679. const {
  8680. localResources,
  8681. appearanceResources,
  8682. acroFormResources
  8683. } = this._fieldResources;
  8684. const fontName = this.data.defaultAppearanceData && this.data.defaultAppearanceData.fontName;
  8685. if (!fontName) {
  8686. return localResources || _primitives.Dict.empty;
  8687. }
  8688. for (const resources of [localResources, appearanceResources]) {
  8689. if (resources instanceof _primitives.Dict) {
  8690. const localFont = resources.get("Font");
  8691. if (localFont instanceof _primitives.Dict && localFont.has(fontName)) {
  8692. return resources;
  8693. }
  8694. }
  8695. }
  8696. if (acroFormResources instanceof _primitives.Dict) {
  8697. const acroFormFont = acroFormResources.get("Font");
  8698. if (acroFormFont instanceof _primitives.Dict && acroFormFont.has(fontName)) {
  8699. const subFontDict = new _primitives.Dict(xref);
  8700. subFontDict.set(fontName, acroFormFont.getRaw(fontName));
  8701. const subResourcesDict = new _primitives.Dict(xref);
  8702. subResourcesDict.set("Font", subFontDict);
  8703. return _primitives.Dict.merge({
  8704. xref,
  8705. dictArray: [subResourcesDict, localResources],
  8706. mergeSubDicts: true
  8707. });
  8708. }
  8709. }
  8710. return localResources || _primitives.Dict.empty;
  8711. }
  8712. getFieldObject() {
  8713. return null;
  8714. }
  8715. }
  8716. class TextWidgetAnnotation extends WidgetAnnotation {
  8717. constructor(params) {
  8718. super(params);
  8719. this._hasText = true;
  8720. const dict = params.dict;
  8721. if (typeof this.data.fieldValue !== "string") {
  8722. this.data.fieldValue = "";
  8723. }
  8724. let alignment = (0, _core_utils.getInheritableProperty)({
  8725. dict,
  8726. key: "Q"
  8727. });
  8728. if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
  8729. alignment = null;
  8730. }
  8731. this.data.textAlignment = alignment;
  8732. let maximumLength = (0, _core_utils.getInheritableProperty)({
  8733. dict,
  8734. key: "MaxLen"
  8735. });
  8736. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  8737. maximumLength = 0;
  8738. }
  8739. this.data.maxLen = maximumLength;
  8740. this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
  8741. 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;
  8742. this.data.doNotScroll = this.hasFieldFlag(_util.AnnotationFieldFlag.DONOTSCROLL);
  8743. }
  8744. _getCombAppearance(defaultAppearance, font, text, width, hPadding, vPadding, annotationStorage) {
  8745. const combWidth = (0, _core_utils.numberToString)(width / this.data.maxLen);
  8746. const buf = [];
  8747. const positions = font.getCharPositions(text);
  8748. for (const [start, end] of positions) {
  8749. buf.push(`(${(0, _util.escapeString)(text.substring(start, end))}) Tj`);
  8750. }
  8751. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  8752. const renderedComb = buf.join(` ${combWidth} 0 Td `);
  8753. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm ${renderedComb}` + " ET Q EMC";
  8754. }
  8755. _getMultilineAppearance(defaultAppearance, text, font, fontSize, width, height, alignment, hPadding, vPadding, annotationStorage) {
  8756. const lines = text.split(/\r\n?|\n/);
  8757. const buf = [];
  8758. const totalWidth = width - 2 * hPadding;
  8759. for (const line of lines) {
  8760. const chunks = this._splitLine(line, font, fontSize, totalWidth);
  8761. for (const chunk of chunks) {
  8762. const padding = buf.length === 0 ? hPadding : 0;
  8763. buf.push(this._renderText(chunk, font, fontSize, width, alignment, padding, -fontSize));
  8764. }
  8765. }
  8766. const renderedText = buf.join("\n");
  8767. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  8768. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 ${height} Tm ${renderedText}` + " ET Q EMC";
  8769. }
  8770. _splitLine(line, font, fontSize, width) {
  8771. let cache = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
  8772. line = cache.line || font.encodeString(line).join("");
  8773. const glyphs = cache.glyphs || font.charsToGlyphs(line);
  8774. if (glyphs.length <= 1) {
  8775. return [line];
  8776. }
  8777. const positions = cache.positions || font.getCharPositions(line);
  8778. const scale = fontSize / 1000;
  8779. const chunks = [];
  8780. let lastSpacePosInStringStart = -1,
  8781. lastSpacePosInStringEnd = -1,
  8782. lastSpacePos = -1,
  8783. startChunk = 0,
  8784. currentWidth = 0;
  8785. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  8786. const [start, end] = positions[i];
  8787. const glyph = glyphs[i];
  8788. const glyphWidth = glyph.width * scale;
  8789. if (glyph.unicode === " ") {
  8790. if (currentWidth + glyphWidth > width) {
  8791. chunks.push(line.substring(startChunk, start));
  8792. startChunk = start;
  8793. currentWidth = glyphWidth;
  8794. lastSpacePosInStringStart = -1;
  8795. lastSpacePos = -1;
  8796. } else {
  8797. currentWidth += glyphWidth;
  8798. lastSpacePosInStringStart = start;
  8799. lastSpacePosInStringEnd = end;
  8800. lastSpacePos = i;
  8801. }
  8802. } else {
  8803. if (currentWidth + glyphWidth > width) {
  8804. if (lastSpacePosInStringStart !== -1) {
  8805. chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
  8806. startChunk = lastSpacePosInStringEnd;
  8807. i = lastSpacePos + 1;
  8808. lastSpacePosInStringStart = -1;
  8809. currentWidth = 0;
  8810. } else {
  8811. chunks.push(line.substring(startChunk, start));
  8812. startChunk = start;
  8813. currentWidth = glyphWidth;
  8814. }
  8815. } else {
  8816. currentWidth += glyphWidth;
  8817. }
  8818. }
  8819. }
  8820. if (startChunk < line.length) {
  8821. chunks.push(line.substring(startChunk, line.length));
  8822. }
  8823. return chunks;
  8824. }
  8825. getFieldObject() {
  8826. return {
  8827. id: this.data.id,
  8828. value: this.data.fieldValue,
  8829. defaultValue: this.data.defaultFieldValue || "",
  8830. multiline: this.data.multiLine,
  8831. password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD),
  8832. charLimit: this.data.maxLen,
  8833. comb: this.data.comb,
  8834. editable: !this.data.readOnly,
  8835. hidden: this.data.hidden,
  8836. name: this.data.fieldName,
  8837. rect: this.data.rect,
  8838. actions: this.data.actions,
  8839. page: this.data.pageIndex,
  8840. strokeColor: this.data.borderColor,
  8841. fillColor: this.data.backgroundColor,
  8842. rotation: this.rotation,
  8843. type: "text"
  8844. };
  8845. }
  8846. }
  8847. class ButtonWidgetAnnotation extends WidgetAnnotation {
  8848. constructor(params) {
  8849. super(params);
  8850. this.checkedAppearance = null;
  8851. this.uncheckedAppearance = null;
  8852. this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  8853. this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  8854. this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  8855. this.data.isTooltipOnly = false;
  8856. if (this.data.checkBox) {
  8857. this._processCheckBox(params);
  8858. } else if (this.data.radioButton) {
  8859. this._processRadioButton(params);
  8860. } else if (this.data.pushButton) {
  8861. this.data.hasOwnCanvas = true;
  8862. this._processPushButton(params);
  8863. } else {
  8864. (0, _util.warn)("Invalid field flags for button widget annotation");
  8865. }
  8866. }
  8867. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  8868. if (this.data.pushButton) {
  8869. return super.getOperatorList(evaluator, task, intent, false, annotationStorage);
  8870. }
  8871. let value = null;
  8872. let rotation = null;
  8873. if (annotationStorage) {
  8874. const storageEntry = annotationStorage.get(this.data.id);
  8875. value = storageEntry ? storageEntry.value : null;
  8876. rotation = storageEntry ? storageEntry.rotation : null;
  8877. }
  8878. if (value === null && this.appearance) {
  8879. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  8880. }
  8881. if (value === null || value === undefined) {
  8882. if (this.data.checkBox) {
  8883. value = this.data.fieldValue === this.data.exportValue;
  8884. } else {
  8885. value = this.data.fieldValue === this.data.buttonValue;
  8886. }
  8887. }
  8888. const appearance = value ? this.checkedAppearance : this.uncheckedAppearance;
  8889. if (appearance) {
  8890. const savedAppearance = this.appearance;
  8891. const savedMatrix = appearance.dict.getArray("Matrix") || _util.IDENTITY_MATRIX;
  8892. if (rotation) {
  8893. appearance.dict.set("Matrix", this.getRotationMatrix(annotationStorage));
  8894. }
  8895. this.appearance = appearance;
  8896. const operatorList = super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  8897. this.appearance = savedAppearance;
  8898. appearance.dict.set("Matrix", savedMatrix);
  8899. return operatorList;
  8900. }
  8901. return {
  8902. opList: new _operator_list.OperatorList(),
  8903. separateForm: false,
  8904. separateCanvas: false
  8905. };
  8906. }
  8907. async save(evaluator, task, annotationStorage) {
  8908. if (this.data.checkBox) {
  8909. return this._saveCheckbox(evaluator, task, annotationStorage);
  8910. }
  8911. if (this.data.radioButton) {
  8912. return this._saveRadioButton(evaluator, task, annotationStorage);
  8913. }
  8914. return null;
  8915. }
  8916. async _saveCheckbox(evaluator, task, annotationStorage) {
  8917. if (!annotationStorage) {
  8918. return null;
  8919. }
  8920. const storageEntry = annotationStorage.get(this.data.id);
  8921. let rotation = storageEntry && storageEntry.rotation;
  8922. let value = storageEntry && storageEntry.value;
  8923. if (rotation === undefined) {
  8924. if (value === undefined) {
  8925. return null;
  8926. }
  8927. const defaultValue = this.data.fieldValue === this.data.exportValue;
  8928. if (defaultValue === value) {
  8929. return null;
  8930. }
  8931. }
  8932. const dict = evaluator.xref.fetchIfRef(this.ref);
  8933. if (!(dict instanceof _primitives.Dict)) {
  8934. return null;
  8935. }
  8936. if (rotation === undefined) {
  8937. rotation = this.rotation;
  8938. }
  8939. if (value === undefined) {
  8940. value = this.data.fieldValue === this.data.exportValue;
  8941. }
  8942. const xfa = {
  8943. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  8944. value: value ? this.data.exportValue : ""
  8945. };
  8946. const name = _primitives.Name.get(value ? this.data.exportValue : "Off");
  8947. dict.set("V", name);
  8948. dict.set("AS", name);
  8949. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  8950. const maybeMK = this._getMKDict(rotation);
  8951. if (maybeMK) {
  8952. dict.set("MK", maybeMK);
  8953. }
  8954. const encrypt = evaluator.xref.encrypt;
  8955. let originalTransform = null;
  8956. if (encrypt) {
  8957. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  8958. }
  8959. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  8960. (0, _writer.writeDict)(dict, buffer, originalTransform);
  8961. buffer.push("\nendobj\n");
  8962. return [{
  8963. ref: this.ref,
  8964. data: buffer.join(""),
  8965. xfa
  8966. }];
  8967. }
  8968. async _saveRadioButton(evaluator, task, annotationStorage) {
  8969. if (!annotationStorage) {
  8970. return null;
  8971. }
  8972. const storageEntry = annotationStorage.get(this.data.id);
  8973. let rotation = storageEntry && storageEntry.rotation;
  8974. let value = storageEntry && storageEntry.value;
  8975. if (rotation === undefined) {
  8976. if (value === undefined) {
  8977. return null;
  8978. }
  8979. const defaultValue = this.data.fieldValue === this.data.buttonValue;
  8980. if (defaultValue === value) {
  8981. return null;
  8982. }
  8983. }
  8984. const dict = evaluator.xref.fetchIfRef(this.ref);
  8985. if (!(dict instanceof _primitives.Dict)) {
  8986. return null;
  8987. }
  8988. if (value === undefined) {
  8989. value = this.data.fieldValue === this.data.buttonValue;
  8990. }
  8991. if (rotation === undefined) {
  8992. rotation = this.rotation;
  8993. }
  8994. const xfa = {
  8995. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  8996. value: value ? this.data.buttonValue : ""
  8997. };
  8998. const name = _primitives.Name.get(value ? this.data.buttonValue : "Off");
  8999. let parentBuffer = null;
  9000. const encrypt = evaluator.xref.encrypt;
  9001. if (value) {
  9002. if (this.parent instanceof _primitives.Ref) {
  9003. const parent = evaluator.xref.fetch(this.parent);
  9004. let parentTransform = null;
  9005. if (encrypt) {
  9006. parentTransform = encrypt.createCipherTransform(this.parent.num, this.parent.gen);
  9007. }
  9008. parent.set("V", name);
  9009. parentBuffer = [`${this.parent.num} ${this.parent.gen} obj\n`];
  9010. (0, _writer.writeDict)(parent, parentBuffer, parentTransform);
  9011. parentBuffer.push("\nendobj\n");
  9012. } else if (this.parent instanceof _primitives.Dict) {
  9013. this.parent.set("V", name);
  9014. }
  9015. }
  9016. dict.set("AS", name);
  9017. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  9018. const maybeMK = this._getMKDict(rotation);
  9019. if (maybeMK) {
  9020. dict.set("MK", maybeMK);
  9021. }
  9022. let originalTransform = null;
  9023. if (encrypt) {
  9024. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  9025. }
  9026. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  9027. (0, _writer.writeDict)(dict, buffer, originalTransform);
  9028. buffer.push("\nendobj\n");
  9029. const newRefs = [{
  9030. ref: this.ref,
  9031. data: buffer.join(""),
  9032. xfa
  9033. }];
  9034. if (parentBuffer !== null) {
  9035. newRefs.push({
  9036. ref: this.parent,
  9037. data: parentBuffer.join(""),
  9038. xfa: null
  9039. });
  9040. }
  9041. return newRefs;
  9042. }
  9043. _getDefaultCheckedAppearance(params, type) {
  9044. const width = this.data.rect[2] - this.data.rect[0];
  9045. const height = this.data.rect[3] - this.data.rect[1];
  9046. const bbox = [0, 0, width, height];
  9047. const FONT_RATIO = 0.8;
  9048. const fontSize = Math.min(width, height) * FONT_RATIO;
  9049. let metrics, char;
  9050. if (type === "check") {
  9051. metrics = {
  9052. width: 0.755 * fontSize,
  9053. height: 0.705 * fontSize
  9054. };
  9055. char = "\x33";
  9056. } else if (type === "disc") {
  9057. metrics = {
  9058. width: 0.791 * fontSize,
  9059. height: 0.705 * fontSize
  9060. };
  9061. char = "\x6C";
  9062. } else {
  9063. (0, _util.unreachable)(`_getDefaultCheckedAppearance - unsupported type: ${type}`);
  9064. }
  9065. const xShift = (0, _core_utils.numberToString)((width - metrics.width) / 2);
  9066. const yShift = (0, _core_utils.numberToString)((height - metrics.height) / 2);
  9067. const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`;
  9068. const appearanceStreamDict = new _primitives.Dict(params.xref);
  9069. appearanceStreamDict.set("FormType", 1);
  9070. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  9071. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  9072. appearanceStreamDict.set("BBox", bbox);
  9073. appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]);
  9074. appearanceStreamDict.set("Length", appearance.length);
  9075. const resources = new _primitives.Dict(params.xref);
  9076. const font = new _primitives.Dict(params.xref);
  9077. font.set("PdfJsZaDb", this.fallbackFontDict);
  9078. resources.set("Font", font);
  9079. appearanceStreamDict.set("Resources", resources);
  9080. this.checkedAppearance = new _stream.StringStream(appearance);
  9081. this.checkedAppearance.dict = appearanceStreamDict;
  9082. this._streams.push(this.checkedAppearance);
  9083. }
  9084. _processCheckBox(params) {
  9085. const customAppearance = params.dict.get("AP");
  9086. if (!(customAppearance instanceof _primitives.Dict)) {
  9087. return;
  9088. }
  9089. const normalAppearance = customAppearance.get("N");
  9090. if (!(normalAppearance instanceof _primitives.Dict)) {
  9091. return;
  9092. }
  9093. const asValue = this._decodeFormValue(params.dict.get("AS"));
  9094. if (typeof asValue === "string") {
  9095. this.data.fieldValue = asValue;
  9096. }
  9097. const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes";
  9098. const exportValues = normalAppearance.getKeys();
  9099. if (exportValues.length === 0) {
  9100. exportValues.push("Off", yes);
  9101. } else if (exportValues.length === 1) {
  9102. if (exportValues[0] === "Off") {
  9103. exportValues.push(yes);
  9104. } else {
  9105. exportValues.unshift("Off");
  9106. }
  9107. } else if (exportValues.includes(yes)) {
  9108. exportValues.length = 0;
  9109. exportValues.push("Off", yes);
  9110. } else {
  9111. const otherYes = exportValues.find(v => v !== "Off");
  9112. exportValues.length = 0;
  9113. exportValues.push("Off", otherYes);
  9114. }
  9115. if (!exportValues.includes(this.data.fieldValue)) {
  9116. this.data.fieldValue = "Off";
  9117. }
  9118. this.data.exportValue = exportValues[1];
  9119. this.checkedAppearance = normalAppearance.get(this.data.exportValue) || null;
  9120. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  9121. if (this.checkedAppearance) {
  9122. this._streams.push(this.checkedAppearance);
  9123. } else {
  9124. this._getDefaultCheckedAppearance(params, "check");
  9125. }
  9126. if (this.uncheckedAppearance) {
  9127. this._streams.push(this.uncheckedAppearance);
  9128. }
  9129. this._fallbackFontDict = this.fallbackFontDict;
  9130. }
  9131. _processRadioButton(params) {
  9132. this.data.fieldValue = this.data.buttonValue = null;
  9133. const fieldParent = params.dict.get("Parent");
  9134. if (fieldParent instanceof _primitives.Dict) {
  9135. this.parent = params.dict.getRaw("Parent");
  9136. const fieldParentValue = fieldParent.get("V");
  9137. if (fieldParentValue instanceof _primitives.Name) {
  9138. this.data.fieldValue = this._decodeFormValue(fieldParentValue);
  9139. }
  9140. }
  9141. const appearanceStates = params.dict.get("AP");
  9142. if (!(appearanceStates instanceof _primitives.Dict)) {
  9143. return;
  9144. }
  9145. const normalAppearance = appearanceStates.get("N");
  9146. if (!(normalAppearance instanceof _primitives.Dict)) {
  9147. return;
  9148. }
  9149. for (const key of normalAppearance.getKeys()) {
  9150. if (key !== "Off") {
  9151. this.data.buttonValue = this._decodeFormValue(key);
  9152. break;
  9153. }
  9154. }
  9155. this.checkedAppearance = normalAppearance.get(this.data.buttonValue) || null;
  9156. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  9157. if (this.checkedAppearance) {
  9158. this._streams.push(this.checkedAppearance);
  9159. } else {
  9160. this._getDefaultCheckedAppearance(params, "disc");
  9161. }
  9162. if (this.uncheckedAppearance) {
  9163. this._streams.push(this.uncheckedAppearance);
  9164. }
  9165. this._fallbackFontDict = this.fallbackFontDict;
  9166. }
  9167. _processPushButton(params) {
  9168. if (!params.dict.has("A") && !params.dict.has("AA") && !this.data.alternativeText) {
  9169. (0, _util.warn)("Push buttons without action dictionaries are not supported");
  9170. return;
  9171. }
  9172. this.data.isTooltipOnly = !params.dict.has("A") && !params.dict.has("AA");
  9173. _catalog.Catalog.parseDestDictionary({
  9174. destDict: params.dict,
  9175. resultObj: this.data,
  9176. docBaseUrl: params.pdfManager.docBaseUrl
  9177. });
  9178. }
  9179. getFieldObject() {
  9180. let type = "button";
  9181. let exportValues;
  9182. if (this.data.checkBox) {
  9183. type = "checkbox";
  9184. exportValues = this.data.exportValue;
  9185. } else if (this.data.radioButton) {
  9186. type = "radiobutton";
  9187. exportValues = this.data.buttonValue;
  9188. }
  9189. return {
  9190. id: this.data.id,
  9191. value: this.data.fieldValue || "Off",
  9192. defaultValue: this.data.defaultFieldValue,
  9193. exportValues,
  9194. editable: !this.data.readOnly,
  9195. name: this.data.fieldName,
  9196. rect: this.data.rect,
  9197. hidden: this.data.hidden,
  9198. actions: this.data.actions,
  9199. page: this.data.pageIndex,
  9200. strokeColor: this.data.borderColor,
  9201. fillColor: this.data.backgroundColor,
  9202. rotation: this.rotation,
  9203. type
  9204. };
  9205. }
  9206. get fallbackFontDict() {
  9207. const dict = new _primitives.Dict();
  9208. dict.set("BaseFont", _primitives.Name.get("ZapfDingbats"));
  9209. dict.set("Type", _primitives.Name.get("FallbackType"));
  9210. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  9211. dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding"));
  9212. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  9213. }
  9214. }
  9215. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  9216. constructor(params) {
  9217. super(params);
  9218. this.data.options = [];
  9219. const options = (0, _core_utils.getInheritableProperty)({
  9220. dict: params.dict,
  9221. key: "Opt"
  9222. });
  9223. if (Array.isArray(options)) {
  9224. const xref = params.xref;
  9225. for (let i = 0, ii = options.length; i < ii; i++) {
  9226. const option = xref.fetchIfRef(options[i]);
  9227. const isOptionArray = Array.isArray(option);
  9228. this.data.options[i] = {
  9229. exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
  9230. displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
  9231. };
  9232. }
  9233. }
  9234. if (typeof this.data.fieldValue === "string") {
  9235. this.data.fieldValue = [this.data.fieldValue];
  9236. } else if (!this.data.fieldValue) {
  9237. this.data.fieldValue = [];
  9238. }
  9239. this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
  9240. this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
  9241. this._hasText = true;
  9242. }
  9243. getFieldObject() {
  9244. const type = this.data.combo ? "combobox" : "listbox";
  9245. const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
  9246. return {
  9247. id: this.data.id,
  9248. value,
  9249. defaultValue: this.data.defaultFieldValue,
  9250. editable: !this.data.readOnly,
  9251. name: this.data.fieldName,
  9252. rect: this.data.rect,
  9253. numItems: this.data.fieldValue.length,
  9254. multipleSelection: this.data.multiSelect,
  9255. hidden: this.data.hidden,
  9256. actions: this.data.actions,
  9257. items: this.data.options,
  9258. page: this.data.pageIndex,
  9259. strokeColor: this.data.borderColor,
  9260. fillColor: this.data.backgroundColor,
  9261. rotation: this.rotation,
  9262. type
  9263. };
  9264. }
  9265. async _getAppearance(evaluator, task, annotationStorage) {
  9266. if (this.data.combo) {
  9267. return super._getAppearance(evaluator, task, annotationStorage);
  9268. }
  9269. if (!annotationStorage) {
  9270. return null;
  9271. }
  9272. const storageEntry = annotationStorage.get(this.data.id);
  9273. if (!storageEntry) {
  9274. return null;
  9275. }
  9276. const rotation = storageEntry.rotation;
  9277. let exportedValue = storageEntry.value;
  9278. if (rotation === undefined && exportedValue === undefined) {
  9279. return null;
  9280. }
  9281. if (exportedValue === undefined) {
  9282. exportedValue = this.data.fieldValue;
  9283. } else if (!Array.isArray(exportedValue)) {
  9284. exportedValue = [exportedValue];
  9285. }
  9286. const defaultPadding = 2;
  9287. const hPadding = defaultPadding;
  9288. let totalHeight = this.data.rect[3] - this.data.rect[1];
  9289. let totalWidth = this.data.rect[2] - this.data.rect[0];
  9290. if (rotation === 90 || rotation === 270) {
  9291. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  9292. }
  9293. const lineCount = this.data.options.length;
  9294. const valueIndices = [];
  9295. for (let i = 0; i < lineCount; i++) {
  9296. const {
  9297. exportValue
  9298. } = this.data.options[i];
  9299. if (exportedValue.includes(exportValue)) {
  9300. valueIndices.push(i);
  9301. }
  9302. }
  9303. if (!this._defaultAppearance) {
  9304. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  9305. }
  9306. const font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  9307. let defaultAppearance;
  9308. let {
  9309. fontSize
  9310. } = this.data.defaultAppearanceData;
  9311. if (!fontSize) {
  9312. const lineHeight = (totalHeight - defaultPadding) / lineCount;
  9313. let lineWidth = -1;
  9314. let value;
  9315. for (const {
  9316. displayValue
  9317. } of this.data.options) {
  9318. const width = this._getTextWidth(displayValue, font);
  9319. if (width > lineWidth) {
  9320. lineWidth = width;
  9321. value = displayValue;
  9322. }
  9323. }
  9324. [defaultAppearance, fontSize] = this._computeFontSize(lineHeight, totalWidth - 2 * hPadding, value, font, -1);
  9325. } else {
  9326. defaultAppearance = this._defaultAppearance;
  9327. }
  9328. const lineHeight = fontSize * _util.LINE_FACTOR;
  9329. const vPadding = (lineHeight - fontSize) / 2;
  9330. const numberOfVisibleLines = Math.floor(totalHeight / lineHeight);
  9331. let firstIndex;
  9332. if (valueIndices.length === 1) {
  9333. const valuePosition = valueIndices[0];
  9334. const indexInPage = valuePosition % numberOfVisibleLines;
  9335. firstIndex = valuePosition - indexInPage;
  9336. } else {
  9337. firstIndex = valueIndices.length ? valueIndices[0] : 0;
  9338. }
  9339. const end = Math.min(firstIndex + numberOfVisibleLines + 1, lineCount);
  9340. const buf = ["/Tx BMC q", `1 1 ${totalWidth} ${totalHeight} re W n`];
  9341. if (valueIndices.length) {
  9342. buf.push("0.600006 0.756866 0.854904 rg");
  9343. for (const index of valueIndices) {
  9344. if (firstIndex <= index && index < end) {
  9345. buf.push(`1 ${totalHeight - (index - firstIndex + 1) * lineHeight} ${totalWidth} ${lineHeight} re f`);
  9346. }
  9347. }
  9348. }
  9349. buf.push("BT", defaultAppearance, `1 0 0 1 0 ${totalHeight} Tm`);
  9350. for (let i = firstIndex; i < end; i++) {
  9351. const {
  9352. displayValue
  9353. } = this.data.options[i];
  9354. const hpadding = i === firstIndex ? hPadding : 0;
  9355. const vpadding = i === firstIndex ? vPadding : 0;
  9356. buf.push(this._renderText(displayValue, font, fontSize, totalWidth, 0, hpadding, -lineHeight + vpadding));
  9357. }
  9358. buf.push("ET Q EMC");
  9359. return buf.join("\n");
  9360. }
  9361. }
  9362. class SignatureWidgetAnnotation extends WidgetAnnotation {
  9363. constructor(params) {
  9364. super(params);
  9365. this.data.fieldValue = null;
  9366. }
  9367. getFieldObject() {
  9368. return {
  9369. id: this.data.id,
  9370. value: null,
  9371. page: this.data.pageIndex,
  9372. type: "signature"
  9373. };
  9374. }
  9375. }
  9376. class TextAnnotation extends MarkupAnnotation {
  9377. constructor(parameters) {
  9378. const DEFAULT_ICON_SIZE = 22;
  9379. super(parameters);
  9380. const dict = parameters.dict;
  9381. this.data.annotationType = _util.AnnotationType.TEXT;
  9382. if (this.data.hasAppearance) {
  9383. this.data.name = "NoIcon";
  9384. } else {
  9385. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  9386. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  9387. this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
  9388. }
  9389. if (dict.has("State")) {
  9390. this.data.state = dict.get("State") || null;
  9391. this.data.stateModel = dict.get("StateModel") || null;
  9392. } else {
  9393. this.data.state = null;
  9394. this.data.stateModel = null;
  9395. }
  9396. }
  9397. }
  9398. class LinkAnnotation extends Annotation {
  9399. constructor(params) {
  9400. super(params);
  9401. this.data.annotationType = _util.AnnotationType.LINK;
  9402. const quadPoints = getQuadPoints(params.dict, this.rectangle);
  9403. if (quadPoints) {
  9404. this.data.quadPoints = quadPoints;
  9405. }
  9406. this.data.borderColor = this.data.borderColor || this.data.color;
  9407. _catalog.Catalog.parseDestDictionary({
  9408. destDict: params.dict,
  9409. resultObj: this.data,
  9410. docBaseUrl: params.pdfManager.docBaseUrl
  9411. });
  9412. }
  9413. }
  9414. class PopupAnnotation extends Annotation {
  9415. constructor(parameters) {
  9416. super(parameters);
  9417. this.data.annotationType = _util.AnnotationType.POPUP;
  9418. let parentItem = parameters.dict.get("Parent");
  9419. if (!parentItem) {
  9420. (0, _util.warn)("Popup annotation has a missing or invalid parent annotation.");
  9421. return;
  9422. }
  9423. const parentSubtype = parentItem.get("Subtype");
  9424. this.data.parentType = parentSubtype instanceof _primitives.Name ? parentSubtype.name : null;
  9425. const rawParent = parameters.dict.getRaw("Parent");
  9426. this.data.parentId = rawParent instanceof _primitives.Ref ? rawParent.toString() : null;
  9427. const parentRect = parentItem.getArray("Rect");
  9428. if (Array.isArray(parentRect) && parentRect.length === 4) {
  9429. this.data.parentRect = _util.Util.normalizeRect(parentRect);
  9430. } else {
  9431. this.data.parentRect = [0, 0, 0, 0];
  9432. }
  9433. const rt = parentItem.get("RT");
  9434. if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
  9435. parentItem = parentItem.get("IRT");
  9436. }
  9437. if (!parentItem.has("M")) {
  9438. this.data.modificationDate = null;
  9439. } else {
  9440. this.setModificationDate(parentItem.get("M"));
  9441. this.data.modificationDate = this.modificationDate;
  9442. }
  9443. if (!parentItem.has("C")) {
  9444. this.data.color = null;
  9445. } else {
  9446. this.setColor(parentItem.getArray("C"));
  9447. this.data.color = this.color;
  9448. }
  9449. if (!this.viewable) {
  9450. const parentFlags = parentItem.get("F");
  9451. if (this._isViewable(parentFlags)) {
  9452. this.setFlags(parentFlags);
  9453. }
  9454. }
  9455. this.setTitle(parentItem.get("T"));
  9456. this.data.titleObj = this._title;
  9457. this.setContents(parentItem.get("Contents"));
  9458. this.data.contentsObj = this._contents;
  9459. if (parentItem.has("RC")) {
  9460. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(parentItem.get("RC"));
  9461. }
  9462. }
  9463. }
  9464. exports.PopupAnnotation = PopupAnnotation;
  9465. class FreeTextAnnotation extends MarkupAnnotation {
  9466. constructor(parameters) {
  9467. super(parameters);
  9468. this.data.annotationType = _util.AnnotationType.FREETEXT;
  9469. }
  9470. get hasTextContent() {
  9471. return !!this.appearance;
  9472. }
  9473. static createNewDict(annotation, xref, _ref4) {
  9474. let {
  9475. apRef,
  9476. ap
  9477. } = _ref4;
  9478. const {
  9479. color,
  9480. fontSize,
  9481. rect,
  9482. rotation,
  9483. user,
  9484. value
  9485. } = annotation;
  9486. const freetext = new _primitives.Dict(xref);
  9487. freetext.set("Type", _primitives.Name.get("Annot"));
  9488. freetext.set("Subtype", _primitives.Name.get("FreeText"));
  9489. freetext.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
  9490. freetext.set("Rect", rect);
  9491. const da = `/Helv ${fontSize} Tf ${(0, _default_appearance.getPdfColor)(color, true)}`;
  9492. freetext.set("DA", da);
  9493. freetext.set("Contents", value);
  9494. freetext.set("F", 4);
  9495. freetext.set("Border", [0, 0, 0]);
  9496. freetext.set("Rotate", rotation);
  9497. if (user) {
  9498. freetext.set("T", (0, _util.stringToUTF8String)(user));
  9499. }
  9500. const n = new _primitives.Dict(xref);
  9501. freetext.set("AP", n);
  9502. if (apRef) {
  9503. n.set("N", apRef);
  9504. } else {
  9505. n.set("N", ap);
  9506. }
  9507. return freetext;
  9508. }
  9509. static async createNewAppearanceStream(annotation, xref, params) {
  9510. const {
  9511. baseFontRef,
  9512. evaluator,
  9513. task
  9514. } = params;
  9515. const {
  9516. color,
  9517. fontSize,
  9518. rect,
  9519. rotation,
  9520. value
  9521. } = annotation;
  9522. const resources = new _primitives.Dict(xref);
  9523. const font = new _primitives.Dict(xref);
  9524. if (baseFontRef) {
  9525. font.set("Helv", baseFontRef);
  9526. } else {
  9527. const baseFont = new _primitives.Dict(xref);
  9528. baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
  9529. baseFont.set("Type", _primitives.Name.get("Font"));
  9530. baseFont.set("Subtype", _primitives.Name.get("Type1"));
  9531. baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  9532. font.set("Helv", baseFont);
  9533. }
  9534. resources.set("Font", font);
  9535. const helv = await WidgetAnnotation._getFontData(evaluator, task, {
  9536. fontName: "Helvetica",
  9537. fontSize
  9538. }, resources);
  9539. const [x1, y1, x2, y2] = rect;
  9540. let w = x2 - x1;
  9541. let h = y2 - y1;
  9542. if (rotation % 180 !== 0) {
  9543. [w, h] = [h, w];
  9544. }
  9545. const lines = value.split("\n");
  9546. const scale = fontSize / 1000;
  9547. let totalWidth = -Infinity;
  9548. const encodedLines = [];
  9549. for (let line of lines) {
  9550. line = helv.encodeString(line).join("");
  9551. encodedLines.push(line);
  9552. let lineWidth = 0;
  9553. const glyphs = helv.charsToGlyphs(line);
  9554. for (const glyph of glyphs) {
  9555. lineWidth += glyph.width * scale;
  9556. }
  9557. totalWidth = Math.max(totalWidth, lineWidth);
  9558. }
  9559. let hscale = 1;
  9560. if (totalWidth > w) {
  9561. hscale = w / totalWidth;
  9562. }
  9563. let vscale = 1;
  9564. const lineHeight = _util.LINE_FACTOR * fontSize;
  9565. const lineDescent = _util.LINE_DESCENT_FACTOR * fontSize;
  9566. const totalHeight = lineHeight * lines.length;
  9567. if (totalHeight > h) {
  9568. vscale = h / totalHeight;
  9569. }
  9570. const fscale = Math.min(hscale, vscale);
  9571. const newFontSize = fontSize * fscale;
  9572. 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`];
  9573. const vShift = (0, _core_utils.numberToString)(lineHeight);
  9574. for (const line of encodedLines) {
  9575. buffer.push(`0 -${vShift} Td (${(0, _util.escapeString)(line)}) Tj`);
  9576. }
  9577. buffer.push("ET", "Q");
  9578. const appearance = buffer.join("\n");
  9579. const appearanceStreamDict = new _primitives.Dict(xref);
  9580. appearanceStreamDict.set("FormType", 1);
  9581. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  9582. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  9583. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  9584. appearanceStreamDict.set("Length", appearance.length);
  9585. appearanceStreamDict.set("Resources", resources);
  9586. if (rotation) {
  9587. const matrix = WidgetAnnotation._getRotationMatrix(rotation, w, h);
  9588. appearanceStreamDict.set("Matrix", matrix);
  9589. }
  9590. const ap = new _stream.StringStream(appearance);
  9591. ap.dict = appearanceStreamDict;
  9592. return ap;
  9593. }
  9594. }
  9595. class LineAnnotation extends MarkupAnnotation {
  9596. constructor(parameters) {
  9597. super(parameters);
  9598. const {
  9599. dict
  9600. } = parameters;
  9601. this.data.annotationType = _util.AnnotationType.LINE;
  9602. const lineCoordinates = dict.getArray("L");
  9603. this.data.lineCoordinates = _util.Util.normalizeRect(lineCoordinates);
  9604. this.setLineEndings(dict.getArray("LE"));
  9605. this.data.lineEndings = this.lineEndings;
  9606. if (!this.appearance) {
  9607. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  9608. const strokeAlpha = dict.get("CA");
  9609. let fillColor = null,
  9610. interiorColor = dict.getArray("IC");
  9611. if (interiorColor) {
  9612. interiorColor = getRgbColor(interiorColor, null);
  9613. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  9614. }
  9615. const fillAlpha = fillColor ? strokeAlpha : null;
  9616. const borderWidth = this.borderStyle.width || 1,
  9617. borderAdjust = 2 * borderWidth;
  9618. const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust];
  9619. if (!_util.Util.intersect(this.rectangle, bbox)) {
  9620. this.rectangle = bbox;
  9621. }
  9622. this._setDefaultAppearance({
  9623. xref: parameters.xref,
  9624. extra: `${borderWidth} w`,
  9625. strokeColor,
  9626. fillColor,
  9627. strokeAlpha,
  9628. fillAlpha,
  9629. pointsCallback: (buffer, points) => {
  9630. buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
  9631. return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth];
  9632. }
  9633. });
  9634. }
  9635. }
  9636. }
  9637. class SquareAnnotation extends MarkupAnnotation {
  9638. constructor(parameters) {
  9639. super(parameters);
  9640. this.data.annotationType = _util.AnnotationType.SQUARE;
  9641. if (!this.appearance) {
  9642. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  9643. const strokeAlpha = parameters.dict.get("CA");
  9644. let fillColor = null,
  9645. interiorColor = parameters.dict.getArray("IC");
  9646. if (interiorColor) {
  9647. interiorColor = getRgbColor(interiorColor, null);
  9648. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  9649. }
  9650. const fillAlpha = fillColor ? strokeAlpha : null;
  9651. if (this.borderStyle.width === 0 && !fillColor) {
  9652. return;
  9653. }
  9654. this._setDefaultAppearance({
  9655. xref: parameters.xref,
  9656. extra: `${this.borderStyle.width} w`,
  9657. strokeColor,
  9658. fillColor,
  9659. strokeAlpha,
  9660. fillAlpha,
  9661. pointsCallback: (buffer, points) => {
  9662. const x = points[2].x + this.borderStyle.width / 2;
  9663. const y = points[2].y + this.borderStyle.width / 2;
  9664. const width = points[3].x - points[2].x - this.borderStyle.width;
  9665. const height = points[1].y - points[3].y - this.borderStyle.width;
  9666. buffer.push(`${x} ${y} ${width} ${height} re`);
  9667. if (fillColor) {
  9668. buffer.push("B");
  9669. } else {
  9670. buffer.push("S");
  9671. }
  9672. return [points[0].x, points[1].x, points[3].y, points[1].y];
  9673. }
  9674. });
  9675. }
  9676. }
  9677. }
  9678. class CircleAnnotation extends MarkupAnnotation {
  9679. constructor(parameters) {
  9680. super(parameters);
  9681. this.data.annotationType = _util.AnnotationType.CIRCLE;
  9682. if (!this.appearance) {
  9683. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  9684. const strokeAlpha = parameters.dict.get("CA");
  9685. let fillColor = null;
  9686. let interiorColor = parameters.dict.getArray("IC");
  9687. if (interiorColor) {
  9688. interiorColor = getRgbColor(interiorColor, null);
  9689. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  9690. }
  9691. const fillAlpha = fillColor ? strokeAlpha : null;
  9692. if (this.borderStyle.width === 0 && !fillColor) {
  9693. return;
  9694. }
  9695. const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4));
  9696. this._setDefaultAppearance({
  9697. xref: parameters.xref,
  9698. extra: `${this.borderStyle.width} w`,
  9699. strokeColor,
  9700. fillColor,
  9701. strokeAlpha,
  9702. fillAlpha,
  9703. pointsCallback: (buffer, points) => {
  9704. const x0 = points[0].x + this.borderStyle.width / 2;
  9705. const y0 = points[0].y - this.borderStyle.width / 2;
  9706. const x1 = points[3].x - this.borderStyle.width / 2;
  9707. const y1 = points[3].y + this.borderStyle.width / 2;
  9708. const xMid = x0 + (x1 - x0) / 2;
  9709. const yMid = y0 + (y1 - y0) / 2;
  9710. const xOffset = (x1 - x0) / 2 * controlPointsDistance;
  9711. const yOffset = (y1 - y0) / 2 * controlPointsDistance;
  9712. 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");
  9713. if (fillColor) {
  9714. buffer.push("B");
  9715. } else {
  9716. buffer.push("S");
  9717. }
  9718. return [points[0].x, points[1].x, points[3].y, points[1].y];
  9719. }
  9720. });
  9721. }
  9722. }
  9723. }
  9724. class PolylineAnnotation extends MarkupAnnotation {
  9725. constructor(parameters) {
  9726. super(parameters);
  9727. const {
  9728. dict
  9729. } = parameters;
  9730. this.data.annotationType = _util.AnnotationType.POLYLINE;
  9731. this.data.vertices = [];
  9732. if (!(this instanceof PolygonAnnotation)) {
  9733. this.setLineEndings(dict.getArray("LE"));
  9734. this.data.lineEndings = this.lineEndings;
  9735. }
  9736. const rawVertices = dict.getArray("Vertices");
  9737. if (!Array.isArray(rawVertices)) {
  9738. return;
  9739. }
  9740. for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
  9741. this.data.vertices.push({
  9742. x: rawVertices[i],
  9743. y: rawVertices[i + 1]
  9744. });
  9745. }
  9746. if (!this.appearance) {
  9747. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  9748. const strokeAlpha = dict.get("CA");
  9749. const borderWidth = this.borderStyle.width || 1,
  9750. borderAdjust = 2 * borderWidth;
  9751. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  9752. for (const vertex of this.data.vertices) {
  9753. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  9754. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  9755. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  9756. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  9757. }
  9758. if (!_util.Util.intersect(this.rectangle, bbox)) {
  9759. this.rectangle = bbox;
  9760. }
  9761. this._setDefaultAppearance({
  9762. xref: parameters.xref,
  9763. extra: `${borderWidth} w`,
  9764. strokeColor,
  9765. strokeAlpha,
  9766. pointsCallback: (buffer, points) => {
  9767. const vertices = this.data.vertices;
  9768. for (let i = 0, ii = vertices.length; i < ii; i++) {
  9769. buffer.push(`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`);
  9770. }
  9771. buffer.push("S");
  9772. return [points[0].x, points[1].x, points[3].y, points[1].y];
  9773. }
  9774. });
  9775. }
  9776. }
  9777. }
  9778. class PolygonAnnotation extends PolylineAnnotation {
  9779. constructor(parameters) {
  9780. super(parameters);
  9781. this.data.annotationType = _util.AnnotationType.POLYGON;
  9782. }
  9783. }
  9784. class CaretAnnotation extends MarkupAnnotation {
  9785. constructor(parameters) {
  9786. super(parameters);
  9787. this.data.annotationType = _util.AnnotationType.CARET;
  9788. }
  9789. }
  9790. class InkAnnotation extends MarkupAnnotation {
  9791. constructor(parameters) {
  9792. super(parameters);
  9793. this.data.annotationType = _util.AnnotationType.INK;
  9794. this.data.inkLists = [];
  9795. const rawInkLists = parameters.dict.getArray("InkList");
  9796. if (!Array.isArray(rawInkLists)) {
  9797. return;
  9798. }
  9799. const xref = parameters.xref;
  9800. for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
  9801. this.data.inkLists.push([]);
  9802. for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
  9803. this.data.inkLists[i].push({
  9804. x: xref.fetchIfRef(rawInkLists[i][j]),
  9805. y: xref.fetchIfRef(rawInkLists[i][j + 1])
  9806. });
  9807. }
  9808. }
  9809. if (!this.appearance) {
  9810. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  9811. const strokeAlpha = parameters.dict.get("CA");
  9812. const borderWidth = this.borderStyle.width || 1,
  9813. borderAdjust = 2 * borderWidth;
  9814. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  9815. for (const inkLists of this.data.inkLists) {
  9816. for (const vertex of inkLists) {
  9817. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  9818. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  9819. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  9820. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  9821. }
  9822. }
  9823. if (!_util.Util.intersect(this.rectangle, bbox)) {
  9824. this.rectangle = bbox;
  9825. }
  9826. this._setDefaultAppearance({
  9827. xref: parameters.xref,
  9828. extra: `${borderWidth} w`,
  9829. strokeColor,
  9830. strokeAlpha,
  9831. pointsCallback: (buffer, points) => {
  9832. for (const inkList of this.data.inkLists) {
  9833. for (let i = 0, ii = inkList.length; i < ii; i++) {
  9834. buffer.push(`${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`);
  9835. }
  9836. buffer.push("S");
  9837. }
  9838. return [points[0].x, points[1].x, points[3].y, points[1].y];
  9839. }
  9840. });
  9841. }
  9842. }
  9843. static createNewDict(annotation, xref, _ref5) {
  9844. let {
  9845. apRef,
  9846. ap
  9847. } = _ref5;
  9848. const {
  9849. paths,
  9850. rect,
  9851. rotation
  9852. } = annotation;
  9853. const ink = new _primitives.Dict(xref);
  9854. ink.set("Type", _primitives.Name.get("Annot"));
  9855. ink.set("Subtype", _primitives.Name.get("Ink"));
  9856. ink.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
  9857. ink.set("Rect", rect);
  9858. ink.set("InkList", paths.map(p => p.points));
  9859. ink.set("F", 4);
  9860. ink.set("Border", [0, 0, 0]);
  9861. ink.set("Rotate", rotation);
  9862. const n = new _primitives.Dict(xref);
  9863. ink.set("AP", n);
  9864. if (apRef) {
  9865. n.set("N", apRef);
  9866. } else {
  9867. n.set("N", ap);
  9868. }
  9869. return ink;
  9870. }
  9871. static async createNewAppearanceStream(annotation, xref, params) {
  9872. const {
  9873. color,
  9874. rect,
  9875. rotation,
  9876. paths,
  9877. thickness,
  9878. opacity
  9879. } = annotation;
  9880. const [x1, y1, x2, y2] = rect;
  9881. let w = x2 - x1;
  9882. let h = y2 - y1;
  9883. if (rotation % 180 !== 0) {
  9884. [w, h] = [h, w];
  9885. }
  9886. const appearanceBuffer = [`${thickness} w 1 J 1 j`, `${(0, _default_appearance.getPdfColor)(color, false)}`];
  9887. if (opacity !== 1) {
  9888. appearanceBuffer.push("/R0 gs");
  9889. }
  9890. const buffer = [];
  9891. for (const {
  9892. bezier
  9893. } of paths) {
  9894. buffer.length = 0;
  9895. buffer.push(`${(0, _core_utils.numberToString)(bezier[0])} ${(0, _core_utils.numberToString)(bezier[1])} m`);
  9896. for (let i = 2, ii = bezier.length; i < ii; i += 6) {
  9897. const curve = bezier.slice(i, i + 6).map(_core_utils.numberToString).join(" ");
  9898. buffer.push(`${curve} c`);
  9899. }
  9900. buffer.push("S");
  9901. appearanceBuffer.push(buffer.join("\n"));
  9902. }
  9903. const appearance = appearanceBuffer.join("\n");
  9904. const appearanceStreamDict = new _primitives.Dict(xref);
  9905. appearanceStreamDict.set("FormType", 1);
  9906. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  9907. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  9908. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  9909. appearanceStreamDict.set("Length", appearance.length);
  9910. if (rotation) {
  9911. const matrix = WidgetAnnotation._getRotationMatrix(rotation, w, h);
  9912. appearanceStreamDict.set("Matrix", matrix);
  9913. }
  9914. if (opacity !== 1) {
  9915. const resources = new _primitives.Dict(xref);
  9916. const extGState = new _primitives.Dict(xref);
  9917. const r0 = new _primitives.Dict(xref);
  9918. r0.set("CA", opacity);
  9919. r0.set("Type", _primitives.Name.get("ExtGState"));
  9920. extGState.set("R0", r0);
  9921. resources.set("ExtGState", extGState);
  9922. appearanceStreamDict.set("Resources", resources);
  9923. }
  9924. const ap = new _stream.StringStream(appearance);
  9925. ap.dict = appearanceStreamDict;
  9926. return ap;
  9927. }
  9928. }
  9929. class HighlightAnnotation extends MarkupAnnotation {
  9930. constructor(parameters) {
  9931. super(parameters);
  9932. this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
  9933. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  9934. if (quadPoints) {
  9935. const resources = this.appearance && this.appearance.dict.get("Resources");
  9936. if (!this.appearance || !(resources && resources.has("ExtGState"))) {
  9937. if (this.appearance) {
  9938. (0, _util.warn)("HighlightAnnotation - ignoring built-in appearance stream.");
  9939. }
  9940. const fillColor = this.color ? Array.from(this.color).map(c => c / 255) : [1, 1, 0];
  9941. const fillAlpha = parameters.dict.get("CA");
  9942. this._setDefaultAppearance({
  9943. xref: parameters.xref,
  9944. fillColor,
  9945. blendMode: "Multiply",
  9946. fillAlpha,
  9947. pointsCallback: (buffer, points) => {
  9948. 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");
  9949. return [points[0].x, points[1].x, points[3].y, points[1].y];
  9950. }
  9951. });
  9952. }
  9953. } else {
  9954. this.data.hasPopup = false;
  9955. }
  9956. }
  9957. }
  9958. class UnderlineAnnotation extends MarkupAnnotation {
  9959. constructor(parameters) {
  9960. super(parameters);
  9961. this.data.annotationType = _util.AnnotationType.UNDERLINE;
  9962. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  9963. if (quadPoints) {
  9964. if (!this.appearance) {
  9965. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  9966. const strokeAlpha = parameters.dict.get("CA");
  9967. this._setDefaultAppearance({
  9968. xref: parameters.xref,
  9969. extra: "[] 0 d 1 w",
  9970. strokeColor,
  9971. strokeAlpha,
  9972. pointsCallback: (buffer, points) => {
  9973. buffer.push(`${points[2].x} ${points[2].y} m`, `${points[3].x} ${points[3].y} l`, "S");
  9974. return [points[0].x, points[1].x, points[3].y, points[1].y];
  9975. }
  9976. });
  9977. }
  9978. } else {
  9979. this.data.hasPopup = false;
  9980. }
  9981. }
  9982. }
  9983. class SquigglyAnnotation extends MarkupAnnotation {
  9984. constructor(parameters) {
  9985. super(parameters);
  9986. this.data.annotationType = _util.AnnotationType.SQUIGGLY;
  9987. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  9988. if (quadPoints) {
  9989. if (!this.appearance) {
  9990. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  9991. const strokeAlpha = parameters.dict.get("CA");
  9992. this._setDefaultAppearance({
  9993. xref: parameters.xref,
  9994. extra: "[] 0 d 1 w",
  9995. strokeColor,
  9996. strokeAlpha,
  9997. pointsCallback: (buffer, points) => {
  9998. const dy = (points[0].y - points[2].y) / 6;
  9999. let shift = dy;
  10000. let x = points[2].x;
  10001. const y = points[2].y;
  10002. const xEnd = points[3].x;
  10003. buffer.push(`${x} ${y + shift} m`);
  10004. do {
  10005. x += 2;
  10006. shift = shift === 0 ? dy : 0;
  10007. buffer.push(`${x} ${y + shift} l`);
  10008. } while (x < xEnd);
  10009. buffer.push("S");
  10010. return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy];
  10011. }
  10012. });
  10013. }
  10014. } else {
  10015. this.data.hasPopup = false;
  10016. }
  10017. }
  10018. }
  10019. class StrikeOutAnnotation extends MarkupAnnotation {
  10020. constructor(parameters) {
  10021. super(parameters);
  10022. this.data.annotationType = _util.AnnotationType.STRIKEOUT;
  10023. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  10024. if (quadPoints) {
  10025. if (!this.appearance) {
  10026. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  10027. const strokeAlpha = parameters.dict.get("CA");
  10028. this._setDefaultAppearance({
  10029. xref: parameters.xref,
  10030. extra: "[] 0 d 1 w",
  10031. strokeColor,
  10032. strokeAlpha,
  10033. pointsCallback: (buffer, points) => {
  10034. 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");
  10035. return [points[0].x, points[1].x, points[3].y, points[1].y];
  10036. }
  10037. });
  10038. }
  10039. } else {
  10040. this.data.hasPopup = false;
  10041. }
  10042. }
  10043. }
  10044. class StampAnnotation extends MarkupAnnotation {
  10045. constructor(parameters) {
  10046. super(parameters);
  10047. this.data.annotationType = _util.AnnotationType.STAMP;
  10048. }
  10049. }
  10050. class FileAttachmentAnnotation extends MarkupAnnotation {
  10051. constructor(parameters) {
  10052. super(parameters);
  10053. const file = new _file_spec.FileSpec(parameters.dict.get("FS"), parameters.xref);
  10054. this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
  10055. this.data.file = file.serializable;
  10056. }
  10057. }
  10058. /***/ }),
  10059. /* 138 */
  10060. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  10061. "use strict";
  10062. Object.defineProperty(exports, "__esModule", ({
  10063. value: true
  10064. }));
  10065. exports.createDefaultAppearance = createDefaultAppearance;
  10066. exports.getPdfColor = getPdfColor;
  10067. exports.parseDefaultAppearance = parseDefaultAppearance;
  10068. var _core_utils = __w_pdfjs_require__(131);
  10069. var _util = __w_pdfjs_require__(2);
  10070. var _colorspace = __w_pdfjs_require__(139);
  10071. var _evaluator = __w_pdfjs_require__(140);
  10072. var _primitives = __w_pdfjs_require__(130);
  10073. var _stream = __w_pdfjs_require__(135);
  10074. class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor {
  10075. constructor(str) {
  10076. super(new _stream.StringStream(str));
  10077. }
  10078. parse() {
  10079. const operation = {
  10080. fn: 0,
  10081. args: []
  10082. };
  10083. const result = {
  10084. fontSize: 0,
  10085. fontName: "",
  10086. fontColor: new Uint8ClampedArray(3)
  10087. };
  10088. try {
  10089. while (true) {
  10090. operation.args.length = 0;
  10091. if (!this.read(operation)) {
  10092. break;
  10093. }
  10094. if (this.savedStatesDepth !== 0) {
  10095. continue;
  10096. }
  10097. const {
  10098. fn,
  10099. args
  10100. } = operation;
  10101. switch (fn | 0) {
  10102. case _util.OPS.setFont:
  10103. const [fontName, fontSize] = args;
  10104. if (fontName instanceof _primitives.Name) {
  10105. result.fontName = fontName.name;
  10106. }
  10107. if (typeof fontSize === "number" && fontSize > 0) {
  10108. result.fontSize = fontSize;
  10109. }
  10110. break;
  10111. case _util.OPS.setFillRGBColor:
  10112. _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
  10113. break;
  10114. case _util.OPS.setFillGray:
  10115. _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
  10116. break;
  10117. case _util.OPS.setFillColorSpace:
  10118. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
  10119. break;
  10120. }
  10121. }
  10122. } catch (reason) {
  10123. (0, _util.warn)(`parseDefaultAppearance - ignoring errors: "${reason}".`);
  10124. }
  10125. return result;
  10126. }
  10127. }
  10128. function parseDefaultAppearance(str) {
  10129. return new DefaultAppearanceEvaluator(str).parse();
  10130. }
  10131. function getPdfColor(color, isFill) {
  10132. if (color[0] === color[1] && color[1] === color[2]) {
  10133. const gray = color[0] / 255;
  10134. return `${(0, _core_utils.numberToString)(gray)} ${isFill ? "g" : "G"}`;
  10135. }
  10136. return Array.from(color).map(c => (0, _core_utils.numberToString)(c / 255)).join(" ") + ` ${isFill ? "rg" : "RG"}`;
  10137. }
  10138. function createDefaultAppearance(_ref) {
  10139. let {
  10140. fontSize,
  10141. fontName,
  10142. fontColor
  10143. } = _ref;
  10144. return `/${(0, _core_utils.escapePDFName)(fontName)} ${fontSize} Tf ${getPdfColor(fontColor, true)}`;
  10145. }
  10146. /***/ }),
  10147. /* 139 */
  10148. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  10149. "use strict";
  10150. Object.defineProperty(exports, "__esModule", ({
  10151. value: true
  10152. }));
  10153. exports.ColorSpace = void 0;
  10154. var _util = __w_pdfjs_require__(2);
  10155. var _primitives = __w_pdfjs_require__(130);
  10156. var _base_stream = __w_pdfjs_require__(132);
  10157. var _core_utils = __w_pdfjs_require__(131);
  10158. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  10159. const COMPONENTS = 3;
  10160. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  10161. const xRatio = w1 / w2;
  10162. const yRatio = h1 / h2;
  10163. let newIndex = 0,
  10164. oldIndex;
  10165. const xScaled = new Uint16Array(w2);
  10166. const w1Scanline = w1 * COMPONENTS;
  10167. for (let i = 0; i < w2; i++) {
  10168. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  10169. }
  10170. for (let i = 0; i < h2; i++) {
  10171. const py = Math.floor(i * yRatio) * w1Scanline;
  10172. for (let j = 0; j < w2; j++) {
  10173. oldIndex = py + xScaled[j];
  10174. dest[newIndex++] = src[oldIndex++];
  10175. dest[newIndex++] = src[oldIndex++];
  10176. dest[newIndex++] = src[oldIndex++];
  10177. newIndex += alpha01;
  10178. }
  10179. }
  10180. }
  10181. class ColorSpace {
  10182. constructor(name, numComps) {
  10183. if (this.constructor === ColorSpace) {
  10184. (0, _util.unreachable)("Cannot initialize ColorSpace.");
  10185. }
  10186. this.name = name;
  10187. this.numComps = numComps;
  10188. }
  10189. getRgb(src, srcOffset) {
  10190. const rgb = new Uint8ClampedArray(3);
  10191. this.getRgbItem(src, srcOffset, rgb, 0);
  10192. return rgb;
  10193. }
  10194. getRgbItem(src, srcOffset, dest, destOffset) {
  10195. (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
  10196. }
  10197. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10198. (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
  10199. }
  10200. getOutputLength(inputLength, alpha01) {
  10201. (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
  10202. }
  10203. isPassthrough(bits) {
  10204. return false;
  10205. }
  10206. isDefaultDecode(decodeMap, bpc) {
  10207. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  10208. }
  10209. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  10210. const count = originalWidth * originalHeight;
  10211. let rgbBuf = null;
  10212. const numComponentColors = 1 << bpc;
  10213. const needsResizing = originalHeight !== height || originalWidth !== width;
  10214. if (this.isPassthrough(bpc)) {
  10215. rgbBuf = comps;
  10216. } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
  10217. const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  10218. for (let i = 0; i < numComponentColors; i++) {
  10219. allColors[i] = i;
  10220. }
  10221. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  10222. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  10223. if (!needsResizing) {
  10224. let destPos = 0;
  10225. for (let i = 0; i < count; ++i) {
  10226. const key = comps[i] * 3;
  10227. dest[destPos++] = colorMap[key];
  10228. dest[destPos++] = colorMap[key + 1];
  10229. dest[destPos++] = colorMap[key + 2];
  10230. destPos += alpha01;
  10231. }
  10232. } else {
  10233. rgbBuf = new Uint8Array(count * 3);
  10234. let rgbPos = 0;
  10235. for (let i = 0; i < count; ++i) {
  10236. const key = comps[i] * 3;
  10237. rgbBuf[rgbPos++] = colorMap[key];
  10238. rgbBuf[rgbPos++] = colorMap[key + 1];
  10239. rgbBuf[rgbPos++] = colorMap[key + 2];
  10240. }
  10241. }
  10242. } else {
  10243. if (!needsResizing) {
  10244. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  10245. } else {
  10246. rgbBuf = new Uint8ClampedArray(count * 3);
  10247. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  10248. }
  10249. }
  10250. if (rgbBuf) {
  10251. if (needsResizing) {
  10252. resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
  10253. } else {
  10254. let destPos = 0,
  10255. rgbPos = 0;
  10256. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  10257. dest[destPos++] = rgbBuf[rgbPos++];
  10258. dest[destPos++] = rgbBuf[rgbPos++];
  10259. dest[destPos++] = rgbBuf[rgbPos++];
  10260. destPos += alpha01;
  10261. }
  10262. }
  10263. }
  10264. }
  10265. get usesZeroToOneRange() {
  10266. return (0, _util.shadow)(this, "usesZeroToOneRange", true);
  10267. }
  10268. static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
  10269. if (!localColorSpaceCache) {
  10270. throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.');
  10271. }
  10272. if (!parsedColorSpace) {
  10273. throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.');
  10274. }
  10275. let csName, csRef;
  10276. if (cacheKey instanceof _primitives.Ref) {
  10277. csRef = cacheKey;
  10278. cacheKey = xref.fetch(cacheKey);
  10279. }
  10280. if (cacheKey instanceof _primitives.Name) {
  10281. csName = cacheKey.name;
  10282. }
  10283. if (csName || csRef) {
  10284. localColorSpaceCache.set(csName, csRef, parsedColorSpace);
  10285. }
  10286. }
  10287. static getCached(cacheKey, xref, localColorSpaceCache) {
  10288. if (!localColorSpaceCache) {
  10289. throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.');
  10290. }
  10291. if (cacheKey instanceof _primitives.Ref) {
  10292. const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
  10293. if (localColorSpace) {
  10294. return localColorSpace;
  10295. }
  10296. try {
  10297. cacheKey = xref.fetch(cacheKey);
  10298. } catch (ex) {
  10299. if (ex instanceof _core_utils.MissingDataException) {
  10300. throw ex;
  10301. }
  10302. }
  10303. }
  10304. if (cacheKey instanceof _primitives.Name) {
  10305. const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
  10306. if (localColorSpace) {
  10307. return localColorSpace;
  10308. }
  10309. }
  10310. return null;
  10311. }
  10312. static async parseAsync(_ref) {
  10313. let {
  10314. cs,
  10315. xref,
  10316. resources = null,
  10317. pdfFunctionFactory,
  10318. localColorSpaceCache
  10319. } = _ref;
  10320. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  10321. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  10322. return parsedColorSpace;
  10323. }
  10324. static parse(_ref2) {
  10325. let {
  10326. cs,
  10327. xref,
  10328. resources = null,
  10329. pdfFunctionFactory,
  10330. localColorSpaceCache
  10331. } = _ref2;
  10332. const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
  10333. if (cachedColorSpace) {
  10334. return cachedColorSpace;
  10335. }
  10336. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  10337. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  10338. return parsedColorSpace;
  10339. }
  10340. static _parse(cs, xref) {
  10341. let resources = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  10342. let pdfFunctionFactory = arguments.length > 3 ? arguments[3] : undefined;
  10343. cs = xref.fetchIfRef(cs);
  10344. if (cs instanceof _primitives.Name) {
  10345. switch (cs.name) {
  10346. case "G":
  10347. case "DeviceGray":
  10348. return this.singletons.gray;
  10349. case "RGB":
  10350. case "DeviceRGB":
  10351. return this.singletons.rgb;
  10352. case "CMYK":
  10353. case "DeviceCMYK":
  10354. return this.singletons.cmyk;
  10355. case "Pattern":
  10356. return new PatternCS(null);
  10357. default:
  10358. if (resources instanceof _primitives.Dict) {
  10359. const colorSpaces = resources.get("ColorSpace");
  10360. if (colorSpaces instanceof _primitives.Dict) {
  10361. const resourcesCS = colorSpaces.get(cs.name);
  10362. if (resourcesCS) {
  10363. if (resourcesCS instanceof _primitives.Name) {
  10364. return this._parse(resourcesCS, xref, resources, pdfFunctionFactory);
  10365. }
  10366. cs = resourcesCS;
  10367. break;
  10368. }
  10369. }
  10370. }
  10371. throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`);
  10372. }
  10373. }
  10374. if (Array.isArray(cs)) {
  10375. const mode = xref.fetchIfRef(cs[0]).name;
  10376. let params, numComps, baseCS, whitePoint, blackPoint, gamma;
  10377. switch (mode) {
  10378. case "G":
  10379. case "DeviceGray":
  10380. return this.singletons.gray;
  10381. case "RGB":
  10382. case "DeviceRGB":
  10383. return this.singletons.rgb;
  10384. case "CMYK":
  10385. case "DeviceCMYK":
  10386. return this.singletons.cmyk;
  10387. case "CalGray":
  10388. params = xref.fetchIfRef(cs[1]);
  10389. whitePoint = params.getArray("WhitePoint");
  10390. blackPoint = params.getArray("BlackPoint");
  10391. gamma = params.get("Gamma");
  10392. return new CalGrayCS(whitePoint, blackPoint, gamma);
  10393. case "CalRGB":
  10394. params = xref.fetchIfRef(cs[1]);
  10395. whitePoint = params.getArray("WhitePoint");
  10396. blackPoint = params.getArray("BlackPoint");
  10397. gamma = params.getArray("Gamma");
  10398. const matrix = params.getArray("Matrix");
  10399. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  10400. case "ICCBased":
  10401. const stream = xref.fetchIfRef(cs[1]);
  10402. const dict = stream.dict;
  10403. numComps = dict.get("N");
  10404. const alt = dict.get("Alternate");
  10405. if (alt) {
  10406. const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
  10407. if (altCS.numComps === numComps) {
  10408. return altCS;
  10409. }
  10410. (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
  10411. }
  10412. if (numComps === 1) {
  10413. return this.singletons.gray;
  10414. } else if (numComps === 3) {
  10415. return this.singletons.rgb;
  10416. } else if (numComps === 4) {
  10417. return this.singletons.cmyk;
  10418. }
  10419. break;
  10420. case "Pattern":
  10421. baseCS = cs[1] || null;
  10422. if (baseCS) {
  10423. baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
  10424. }
  10425. return new PatternCS(baseCS);
  10426. case "I":
  10427. case "Indexed":
  10428. baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
  10429. const hiVal = xref.fetchIfRef(cs[2]) + 1;
  10430. const lookup = xref.fetchIfRef(cs[3]);
  10431. return new IndexedCS(baseCS, hiVal, lookup);
  10432. case "Separation":
  10433. case "DeviceN":
  10434. const name = xref.fetchIfRef(cs[1]);
  10435. numComps = Array.isArray(name) ? name.length : 1;
  10436. baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
  10437. const tintFn = pdfFunctionFactory.create(cs[3]);
  10438. return new AlternateCS(numComps, baseCS, tintFn);
  10439. case "Lab":
  10440. params = xref.fetchIfRef(cs[1]);
  10441. whitePoint = params.getArray("WhitePoint");
  10442. blackPoint = params.getArray("BlackPoint");
  10443. const range = params.getArray("Range");
  10444. return new LabCS(whitePoint, blackPoint, range);
  10445. default:
  10446. throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`);
  10447. }
  10448. }
  10449. throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`);
  10450. }
  10451. static isDefaultDecode(decode, numComps) {
  10452. if (!Array.isArray(decode)) {
  10453. return true;
  10454. }
  10455. if (numComps * 2 !== decode.length) {
  10456. (0, _util.warn)("The decode map is not the correct length");
  10457. return true;
  10458. }
  10459. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  10460. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  10461. return false;
  10462. }
  10463. }
  10464. return true;
  10465. }
  10466. static get singletons() {
  10467. return (0, _util.shadow)(this, "singletons", {
  10468. get gray() {
  10469. return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
  10470. },
  10471. get rgb() {
  10472. return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
  10473. },
  10474. get cmyk() {
  10475. return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
  10476. }
  10477. });
  10478. }
  10479. }
  10480. exports.ColorSpace = ColorSpace;
  10481. class AlternateCS extends ColorSpace {
  10482. constructor(numComps, base, tintFn) {
  10483. super("Alternate", numComps);
  10484. this.base = base;
  10485. this.tintFn = tintFn;
  10486. this.tmpBuf = new Float32Array(base.numComps);
  10487. }
  10488. getRgbItem(src, srcOffset, dest, destOffset) {
  10489. const tmpBuf = this.tmpBuf;
  10490. this.tintFn(src, srcOffset, tmpBuf, 0);
  10491. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  10492. }
  10493. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10494. const tintFn = this.tintFn;
  10495. const base = this.base;
  10496. const scale = 1 / ((1 << bits) - 1);
  10497. const baseNumComps = base.numComps;
  10498. const usesZeroToOneRange = base.usesZeroToOneRange;
  10499. const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  10500. let pos = isPassthrough ? destOffset : 0;
  10501. const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
  10502. const numComps = this.numComps;
  10503. const scaled = new Float32Array(numComps);
  10504. const tinted = new Float32Array(baseNumComps);
  10505. let i, j;
  10506. for (i = 0; i < count; i++) {
  10507. for (j = 0; j < numComps; j++) {
  10508. scaled[j] = src[srcOffset++] * scale;
  10509. }
  10510. tintFn(scaled, 0, tinted, 0);
  10511. if (usesZeroToOneRange) {
  10512. for (j = 0; j < baseNumComps; j++) {
  10513. baseBuf[pos++] = tinted[j] * 255;
  10514. }
  10515. } else {
  10516. base.getRgbItem(tinted, 0, baseBuf, pos);
  10517. pos += baseNumComps;
  10518. }
  10519. }
  10520. if (!isPassthrough) {
  10521. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  10522. }
  10523. }
  10524. getOutputLength(inputLength, alpha01) {
  10525. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  10526. }
  10527. }
  10528. class PatternCS extends ColorSpace {
  10529. constructor(baseCS) {
  10530. super("Pattern", null);
  10531. this.base = baseCS;
  10532. }
  10533. isDefaultDecode(decodeMap, bpc) {
  10534. (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
  10535. }
  10536. }
  10537. class IndexedCS extends ColorSpace {
  10538. constructor(base, highVal, lookup) {
  10539. super("Indexed", 1);
  10540. this.base = base;
  10541. this.highVal = highVal;
  10542. const length = base.numComps * highVal;
  10543. this.lookup = new Uint8Array(length);
  10544. if (lookup instanceof _base_stream.BaseStream) {
  10545. const bytes = lookup.getBytes(length);
  10546. this.lookup.set(bytes);
  10547. } else if (typeof lookup === "string") {
  10548. for (let i = 0; i < length; ++i) {
  10549. this.lookup[i] = lookup.charCodeAt(i) & 0xff;
  10550. }
  10551. } else {
  10552. throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
  10553. }
  10554. }
  10555. getRgbItem(src, srcOffset, dest, destOffset) {
  10556. const numComps = this.base.numComps;
  10557. const start = src[srcOffset] * numComps;
  10558. this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
  10559. }
  10560. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10561. const base = this.base;
  10562. const numComps = base.numComps;
  10563. const outputDelta = base.getOutputLength(numComps, alpha01);
  10564. const lookup = this.lookup;
  10565. for (let i = 0; i < count; ++i) {
  10566. const lookupPos = src[srcOffset++] * numComps;
  10567. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  10568. destOffset += outputDelta;
  10569. }
  10570. }
  10571. getOutputLength(inputLength, alpha01) {
  10572. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  10573. }
  10574. isDefaultDecode(decodeMap, bpc) {
  10575. if (!Array.isArray(decodeMap)) {
  10576. return true;
  10577. }
  10578. if (decodeMap.length !== 2) {
  10579. (0, _util.warn)("Decode map length is not correct");
  10580. return true;
  10581. }
  10582. if (!Number.isInteger(bpc) || bpc < 1) {
  10583. (0, _util.warn)("Bits per component is not correct");
  10584. return true;
  10585. }
  10586. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  10587. }
  10588. }
  10589. class DeviceGrayCS extends ColorSpace {
  10590. constructor() {
  10591. super("DeviceGray", 1);
  10592. }
  10593. getRgbItem(src, srcOffset, dest, destOffset) {
  10594. const c = src[srcOffset] * 255;
  10595. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  10596. }
  10597. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10598. const scale = 255 / ((1 << bits) - 1);
  10599. let j = srcOffset,
  10600. q = destOffset;
  10601. for (let i = 0; i < count; ++i) {
  10602. const c = scale * src[j++];
  10603. dest[q++] = c;
  10604. dest[q++] = c;
  10605. dest[q++] = c;
  10606. q += alpha01;
  10607. }
  10608. }
  10609. getOutputLength(inputLength, alpha01) {
  10610. return inputLength * (3 + alpha01);
  10611. }
  10612. }
  10613. class DeviceRgbCS extends ColorSpace {
  10614. constructor() {
  10615. super("DeviceRGB", 3);
  10616. }
  10617. getRgbItem(src, srcOffset, dest, destOffset) {
  10618. dest[destOffset] = src[srcOffset] * 255;
  10619. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  10620. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  10621. }
  10622. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10623. if (bits === 8 && alpha01 === 0) {
  10624. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  10625. return;
  10626. }
  10627. const scale = 255 / ((1 << bits) - 1);
  10628. let j = srcOffset,
  10629. q = destOffset;
  10630. for (let i = 0; i < count; ++i) {
  10631. dest[q++] = scale * src[j++];
  10632. dest[q++] = scale * src[j++];
  10633. dest[q++] = scale * src[j++];
  10634. q += alpha01;
  10635. }
  10636. }
  10637. getOutputLength(inputLength, alpha01) {
  10638. return inputLength * (3 + alpha01) / 3 | 0;
  10639. }
  10640. isPassthrough(bits) {
  10641. return bits === 8;
  10642. }
  10643. }
  10644. const DeviceCmykCS = function DeviceCmykCSClosure() {
  10645. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  10646. const c = src[srcOffset] * srcScale;
  10647. const m = src[srcOffset + 1] * srcScale;
  10648. const y = src[srcOffset + 2] * srcScale;
  10649. const k = src[srcOffset + 3] * srcScale;
  10650. 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);
  10651. 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);
  10652. 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);
  10653. }
  10654. class DeviceCmykCS extends ColorSpace {
  10655. constructor() {
  10656. super("DeviceCMYK", 4);
  10657. }
  10658. getRgbItem(src, srcOffset, dest, destOffset) {
  10659. convertToRgb(src, srcOffset, 1, dest, destOffset);
  10660. }
  10661. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10662. const scale = 1 / ((1 << bits) - 1);
  10663. for (let i = 0; i < count; i++) {
  10664. convertToRgb(src, srcOffset, scale, dest, destOffset);
  10665. srcOffset += 4;
  10666. destOffset += 3 + alpha01;
  10667. }
  10668. }
  10669. getOutputLength(inputLength, alpha01) {
  10670. return inputLength / 4 * (3 + alpha01) | 0;
  10671. }
  10672. }
  10673. return DeviceCmykCS;
  10674. }();
  10675. const CalGrayCS = function CalGrayCSClosure() {
  10676. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  10677. const A = src[srcOffset] * scale;
  10678. const AG = A ** cs.G;
  10679. const L = cs.YW * AG;
  10680. const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0);
  10681. dest[destOffset] = val;
  10682. dest[destOffset + 1] = val;
  10683. dest[destOffset + 2] = val;
  10684. }
  10685. class CalGrayCS extends ColorSpace {
  10686. constructor(whitePoint, blackPoint, gamma) {
  10687. super("CalGray", 1);
  10688. if (!whitePoint) {
  10689. throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
  10690. }
  10691. blackPoint = blackPoint || [0, 0, 0];
  10692. gamma = gamma || 1;
  10693. this.XW = whitePoint[0];
  10694. this.YW = whitePoint[1];
  10695. this.ZW = whitePoint[2];
  10696. this.XB = blackPoint[0];
  10697. this.YB = blackPoint[1];
  10698. this.ZB = blackPoint[2];
  10699. this.G = gamma;
  10700. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  10701. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  10702. }
  10703. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  10704. (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
  10705. this.XB = this.YB = this.ZB = 0;
  10706. }
  10707. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  10708. (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
  10709. }
  10710. if (this.G < 1) {
  10711. (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default.");
  10712. this.G = 1;
  10713. }
  10714. }
  10715. getRgbItem(src, srcOffset, dest, destOffset) {
  10716. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  10717. }
  10718. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10719. const scale = 1 / ((1 << bits) - 1);
  10720. for (let i = 0; i < count; ++i) {
  10721. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  10722. srcOffset += 1;
  10723. destOffset += 3 + alpha01;
  10724. }
  10725. }
  10726. getOutputLength(inputLength, alpha01) {
  10727. return inputLength * (3 + alpha01);
  10728. }
  10729. }
  10730. return CalGrayCS;
  10731. }();
  10732. const CalRGBCS = function CalRGBCSClosure() {
  10733. const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  10734. 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]);
  10735. 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]);
  10736. const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  10737. const tempNormalizeMatrix = new Float32Array(3);
  10738. const tempConvertMatrix1 = new Float32Array(3);
  10739. const tempConvertMatrix2 = new Float32Array(3);
  10740. const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  10741. function matrixProduct(a, b, result) {
  10742. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  10743. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  10744. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  10745. }
  10746. function convertToFlat(sourceWhitePoint, LMS, result) {
  10747. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  10748. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  10749. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  10750. }
  10751. function convertToD65(sourceWhitePoint, LMS, result) {
  10752. const D65X = 0.95047;
  10753. const D65Y = 1;
  10754. const D65Z = 1.08883;
  10755. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  10756. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  10757. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  10758. }
  10759. function sRGBTransferFunction(color) {
  10760. if (color <= 0.0031308) {
  10761. return adjustToRange(0, 1, 12.92 * color);
  10762. }
  10763. if (color >= 0.99554525) {
  10764. return 1;
  10765. }
  10766. return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
  10767. }
  10768. function adjustToRange(min, max, value) {
  10769. return Math.max(min, Math.min(max, value));
  10770. }
  10771. function decodeL(L) {
  10772. if (L < 0) {
  10773. return -decodeL(-L);
  10774. }
  10775. if (L > 8.0) {
  10776. return ((L + 16) / 116) ** 3;
  10777. }
  10778. return L * DECODE_L_CONSTANT;
  10779. }
  10780. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  10781. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  10782. result[0] = XYZ_Flat[0];
  10783. result[1] = XYZ_Flat[1];
  10784. result[2] = XYZ_Flat[2];
  10785. return;
  10786. }
  10787. const zeroDecodeL = decodeL(0);
  10788. const X_DST = zeroDecodeL;
  10789. const X_SRC = decodeL(sourceBlackPoint[0]);
  10790. const Y_DST = zeroDecodeL;
  10791. const Y_SRC = decodeL(sourceBlackPoint[1]);
  10792. const Z_DST = zeroDecodeL;
  10793. const Z_SRC = decodeL(sourceBlackPoint[2]);
  10794. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  10795. const X_Offset = 1 - X_Scale;
  10796. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  10797. const Y_Offset = 1 - Y_Scale;
  10798. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  10799. const Z_Offset = 1 - Z_Scale;
  10800. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  10801. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  10802. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  10803. }
  10804. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  10805. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  10806. result[0] = XYZ_In[0];
  10807. result[1] = XYZ_In[1];
  10808. result[2] = XYZ_In[2];
  10809. return;
  10810. }
  10811. const LMS = result;
  10812. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  10813. const LMS_Flat = tempNormalizeMatrix;
  10814. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  10815. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  10816. }
  10817. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  10818. const LMS = result;
  10819. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  10820. const LMS_D65 = tempNormalizeMatrix;
  10821. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  10822. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  10823. }
  10824. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  10825. const A = adjustToRange(0, 1, src[srcOffset] * scale);
  10826. const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  10827. const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  10828. const AGR = A === 1 ? 1 : A ** cs.GR;
  10829. const BGG = B === 1 ? 1 : B ** cs.GG;
  10830. const CGB = C === 1 ? 1 : C ** cs.GB;
  10831. const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  10832. const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  10833. const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  10834. const XYZ = tempConvertMatrix1;
  10835. XYZ[0] = X;
  10836. XYZ[1] = Y;
  10837. XYZ[2] = Z;
  10838. const XYZ_Flat = tempConvertMatrix2;
  10839. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  10840. const XYZ_Black = tempConvertMatrix1;
  10841. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  10842. const XYZ_D65 = tempConvertMatrix2;
  10843. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  10844. const SRGB = tempConvertMatrix1;
  10845. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  10846. dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
  10847. dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
  10848. dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
  10849. }
  10850. class CalRGBCS extends ColorSpace {
  10851. constructor(whitePoint, blackPoint, gamma, matrix) {
  10852. super("CalRGB", 3);
  10853. if (!whitePoint) {
  10854. throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
  10855. }
  10856. blackPoint = blackPoint || new Float32Array(3);
  10857. gamma = gamma || new Float32Array([1, 1, 1]);
  10858. matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  10859. const XW = whitePoint[0];
  10860. const YW = whitePoint[1];
  10861. const ZW = whitePoint[2];
  10862. this.whitePoint = whitePoint;
  10863. const XB = blackPoint[0];
  10864. const YB = blackPoint[1];
  10865. const ZB = blackPoint[2];
  10866. this.blackPoint = blackPoint;
  10867. this.GR = gamma[0];
  10868. this.GG = gamma[1];
  10869. this.GB = gamma[2];
  10870. this.MXA = matrix[0];
  10871. this.MYA = matrix[1];
  10872. this.MZA = matrix[2];
  10873. this.MXB = matrix[3];
  10874. this.MYB = matrix[4];
  10875. this.MZB = matrix[5];
  10876. this.MXC = matrix[6];
  10877. this.MYC = matrix[7];
  10878. this.MZC = matrix[8];
  10879. if (XW < 0 || ZW < 0 || YW !== 1) {
  10880. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  10881. }
  10882. if (XB < 0 || YB < 0 || ZB < 0) {
  10883. (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
  10884. this.blackPoint = new Float32Array(3);
  10885. }
  10886. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  10887. (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
  10888. this.GR = this.GG = this.GB = 1;
  10889. }
  10890. }
  10891. getRgbItem(src, srcOffset, dest, destOffset) {
  10892. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  10893. }
  10894. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10895. const scale = 1 / ((1 << bits) - 1);
  10896. for (let i = 0; i < count; ++i) {
  10897. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  10898. srcOffset += 3;
  10899. destOffset += 3 + alpha01;
  10900. }
  10901. }
  10902. getOutputLength(inputLength, alpha01) {
  10903. return inputLength * (3 + alpha01) / 3 | 0;
  10904. }
  10905. }
  10906. return CalRGBCS;
  10907. }();
  10908. const LabCS = function LabCSClosure() {
  10909. function fn_g(x) {
  10910. let result;
  10911. if (x >= 6 / 29) {
  10912. result = x ** 3;
  10913. } else {
  10914. result = 108 / 841 * (x - 4 / 29);
  10915. }
  10916. return result;
  10917. }
  10918. function decode(value, high1, low2, high2) {
  10919. return low2 + value * (high2 - low2) / high1;
  10920. }
  10921. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  10922. let Ls = src[srcOffset];
  10923. let as = src[srcOffset + 1];
  10924. let bs = src[srcOffset + 2];
  10925. if (maxVal !== false) {
  10926. Ls = decode(Ls, maxVal, 0, 100);
  10927. as = decode(as, maxVal, cs.amin, cs.amax);
  10928. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  10929. }
  10930. if (as > cs.amax) {
  10931. as = cs.amax;
  10932. } else if (as < cs.amin) {
  10933. as = cs.amin;
  10934. }
  10935. if (bs > cs.bmax) {
  10936. bs = cs.bmax;
  10937. } else if (bs < cs.bmin) {
  10938. bs = cs.bmin;
  10939. }
  10940. const M = (Ls + 16) / 116;
  10941. const L = M + as / 500;
  10942. const N = M - bs / 200;
  10943. const X = cs.XW * fn_g(L);
  10944. const Y = cs.YW * fn_g(M);
  10945. const Z = cs.ZW * fn_g(N);
  10946. let r, g, b;
  10947. if (cs.ZW < 1) {
  10948. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  10949. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  10950. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  10951. } else {
  10952. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  10953. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  10954. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  10955. }
  10956. dest[destOffset] = Math.sqrt(r) * 255;
  10957. dest[destOffset + 1] = Math.sqrt(g) * 255;
  10958. dest[destOffset + 2] = Math.sqrt(b) * 255;
  10959. }
  10960. class LabCS extends ColorSpace {
  10961. constructor(whitePoint, blackPoint, range) {
  10962. super("Lab", 3);
  10963. if (!whitePoint) {
  10964. throw new _util.FormatError("WhitePoint missing - required for color space Lab");
  10965. }
  10966. blackPoint = blackPoint || [0, 0, 0];
  10967. range = range || [-100, 100, -100, 100];
  10968. this.XW = whitePoint[0];
  10969. this.YW = whitePoint[1];
  10970. this.ZW = whitePoint[2];
  10971. this.amin = range[0];
  10972. this.amax = range[1];
  10973. this.bmin = range[2];
  10974. this.bmax = range[3];
  10975. this.XB = blackPoint[0];
  10976. this.YB = blackPoint[1];
  10977. this.ZB = blackPoint[2];
  10978. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  10979. throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
  10980. }
  10981. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  10982. (0, _util.info)("Invalid BlackPoint, falling back to default");
  10983. this.XB = this.YB = this.ZB = 0;
  10984. }
  10985. if (this.amin > this.amax || this.bmin > this.bmax) {
  10986. (0, _util.info)("Invalid Range, falling back to defaults");
  10987. this.amin = -100;
  10988. this.amax = 100;
  10989. this.bmin = -100;
  10990. this.bmax = 100;
  10991. }
  10992. }
  10993. getRgbItem(src, srcOffset, dest, destOffset) {
  10994. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  10995. }
  10996. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10997. const maxVal = (1 << bits) - 1;
  10998. for (let i = 0; i < count; i++) {
  10999. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  11000. srcOffset += 3;
  11001. destOffset += 3 + alpha01;
  11002. }
  11003. }
  11004. getOutputLength(inputLength, alpha01) {
  11005. return inputLength * (3 + alpha01) / 3 | 0;
  11006. }
  11007. isDefaultDecode(decodeMap, bpc) {
  11008. return true;
  11009. }
  11010. get usesZeroToOneRange() {
  11011. return (0, _util.shadow)(this, "usesZeroToOneRange", false);
  11012. }
  11013. }
  11014. return LabCS;
  11015. }();
  11016. /***/ }),
  11017. /* 140 */
  11018. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  11019. "use strict";
  11020. Object.defineProperty(exports, "__esModule", ({
  11021. value: true
  11022. }));
  11023. exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0;
  11024. var _util = __w_pdfjs_require__(2);
  11025. var _cmap = __w_pdfjs_require__(141);
  11026. var _primitives = __w_pdfjs_require__(130);
  11027. var _fonts = __w_pdfjs_require__(159);
  11028. var _fonts_utils = __w_pdfjs_require__(163);
  11029. var _encodings = __w_pdfjs_require__(162);
  11030. var _standard_fonts = __w_pdfjs_require__(166);
  11031. var _unicode = __w_pdfjs_require__(165);
  11032. var _pattern = __w_pdfjs_require__(175);
  11033. var _xfa_fonts = __w_pdfjs_require__(176);
  11034. var _to_unicode_map = __w_pdfjs_require__(167);
  11035. var _function = __w_pdfjs_require__(182);
  11036. var _parser = __w_pdfjs_require__(142);
  11037. var _image_utils = __w_pdfjs_require__(184);
  11038. var _stream = __w_pdfjs_require__(135);
  11039. var _base_stream = __w_pdfjs_require__(132);
  11040. var _bidi = __w_pdfjs_require__(185);
  11041. var _colorspace = __w_pdfjs_require__(139);
  11042. var _decode_stream = __w_pdfjs_require__(144);
  11043. var _glyphlist = __w_pdfjs_require__(164);
  11044. var _core_utils = __w_pdfjs_require__(131);
  11045. var _metrics = __w_pdfjs_require__(170);
  11046. var _murmurhash = __w_pdfjs_require__(186);
  11047. var _operator_list = __w_pdfjs_require__(187);
  11048. var _image = __w_pdfjs_require__(188);
  11049. const DefaultPartialEvaluatorOptions = Object.freeze({
  11050. maxImageSize: -1,
  11051. disableFontFace: false,
  11052. ignoreErrors: false,
  11053. isEvalSupported: true,
  11054. fontExtraProperties: false,
  11055. useSystemFonts: true,
  11056. cMapUrl: null,
  11057. standardFontDataUrl: null
  11058. });
  11059. const PatternType = {
  11060. TILING: 1,
  11061. SHADING: 2
  11062. };
  11063. const TEXT_CHUNK_BATCH_SIZE = 10;
  11064. const deferred = Promise.resolve();
  11065. function normalizeBlendMode(value) {
  11066. let parsingArray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  11067. if (Array.isArray(value)) {
  11068. for (let i = 0, ii = value.length; i < ii; i++) {
  11069. const maybeBM = normalizeBlendMode(value[i], true);
  11070. if (maybeBM) {
  11071. return maybeBM;
  11072. }
  11073. }
  11074. (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
  11075. return "source-over";
  11076. }
  11077. if (!(value instanceof _primitives.Name)) {
  11078. if (parsingArray) {
  11079. return null;
  11080. }
  11081. return "source-over";
  11082. }
  11083. switch (value.name) {
  11084. case "Normal":
  11085. case "Compatible":
  11086. return "source-over";
  11087. case "Multiply":
  11088. return "multiply";
  11089. case "Screen":
  11090. return "screen";
  11091. case "Overlay":
  11092. return "overlay";
  11093. case "Darken":
  11094. return "darken";
  11095. case "Lighten":
  11096. return "lighten";
  11097. case "ColorDodge":
  11098. return "color-dodge";
  11099. case "ColorBurn":
  11100. return "color-burn";
  11101. case "HardLight":
  11102. return "hard-light";
  11103. case "SoftLight":
  11104. return "soft-light";
  11105. case "Difference":
  11106. return "difference";
  11107. case "Exclusion":
  11108. return "exclusion";
  11109. case "Hue":
  11110. return "hue";
  11111. case "Saturation":
  11112. return "saturation";
  11113. case "Color":
  11114. return "color";
  11115. case "Luminosity":
  11116. return "luminosity";
  11117. }
  11118. if (parsingArray) {
  11119. return null;
  11120. }
  11121. (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
  11122. return "source-over";
  11123. }
  11124. function incrementCachedImageMaskCount(data) {
  11125. if (data.fn === _util.OPS.paintImageMaskXObject && data.args[0] && data.args[0].count > 0) {
  11126. data.args[0].count++;
  11127. }
  11128. }
  11129. class TimeSlotManager {
  11130. static get TIME_SLOT_DURATION_MS() {
  11131. return (0, _util.shadow)(this, "TIME_SLOT_DURATION_MS", 20);
  11132. }
  11133. static get CHECK_TIME_EVERY() {
  11134. return (0, _util.shadow)(this, "CHECK_TIME_EVERY", 100);
  11135. }
  11136. constructor() {
  11137. this.reset();
  11138. }
  11139. check() {
  11140. if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
  11141. return false;
  11142. }
  11143. this.checked = 0;
  11144. return this.endTime <= Date.now();
  11145. }
  11146. reset() {
  11147. this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
  11148. this.checked = 0;
  11149. }
  11150. }
  11151. class PartialEvaluator {
  11152. constructor(_ref) {
  11153. let {
  11154. xref,
  11155. handler,
  11156. pageIndex,
  11157. idFactory,
  11158. fontCache,
  11159. builtInCMapCache,
  11160. standardFontDataCache,
  11161. globalImageCache,
  11162. options = null
  11163. } = _ref;
  11164. this.xref = xref;
  11165. this.handler = handler;
  11166. this.pageIndex = pageIndex;
  11167. this.idFactory = idFactory;
  11168. this.fontCache = fontCache;
  11169. this.builtInCMapCache = builtInCMapCache;
  11170. this.standardFontDataCache = standardFontDataCache;
  11171. this.globalImageCache = globalImageCache;
  11172. this.options = options || DefaultPartialEvaluatorOptions;
  11173. this.parsingType3Font = false;
  11174. this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
  11175. }
  11176. get _pdfFunctionFactory() {
  11177. const pdfFunctionFactory = new _function.PDFFunctionFactory({
  11178. xref: this.xref,
  11179. isEvalSupported: this.options.isEvalSupported
  11180. });
  11181. return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory);
  11182. }
  11183. clone() {
  11184. let newOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  11185. const newEvaluator = Object.create(this);
  11186. newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
  11187. return newEvaluator;
  11188. }
  11189. hasBlendModes(resources, nonBlendModesSet) {
  11190. if (!(resources instanceof _primitives.Dict)) {
  11191. return false;
  11192. }
  11193. if (resources.objId && nonBlendModesSet.has(resources.objId)) {
  11194. return false;
  11195. }
  11196. const processed = new _primitives.RefSet(nonBlendModesSet);
  11197. if (resources.objId) {
  11198. processed.put(resources.objId);
  11199. }
  11200. const nodes = [resources],
  11201. xref = this.xref;
  11202. while (nodes.length) {
  11203. const node = nodes.shift();
  11204. const graphicStates = node.get("ExtGState");
  11205. if (graphicStates instanceof _primitives.Dict) {
  11206. for (let graphicState of graphicStates.getRawValues()) {
  11207. if (graphicState instanceof _primitives.Ref) {
  11208. if (processed.has(graphicState)) {
  11209. continue;
  11210. }
  11211. try {
  11212. graphicState = xref.fetch(graphicState);
  11213. } catch (ex) {
  11214. processed.put(graphicState);
  11215. (0, _util.info)(`hasBlendModes - ignoring ExtGState: "${ex}".`);
  11216. continue;
  11217. }
  11218. }
  11219. if (!(graphicState instanceof _primitives.Dict)) {
  11220. continue;
  11221. }
  11222. if (graphicState.objId) {
  11223. processed.put(graphicState.objId);
  11224. }
  11225. const bm = graphicState.get("BM");
  11226. if (bm instanceof _primitives.Name) {
  11227. if (bm.name !== "Normal") {
  11228. return true;
  11229. }
  11230. continue;
  11231. }
  11232. if (bm !== undefined && Array.isArray(bm)) {
  11233. for (const element of bm) {
  11234. if (element instanceof _primitives.Name && element.name !== "Normal") {
  11235. return true;
  11236. }
  11237. }
  11238. }
  11239. }
  11240. }
  11241. const xObjects = node.get("XObject");
  11242. if (!(xObjects instanceof _primitives.Dict)) {
  11243. continue;
  11244. }
  11245. for (let xObject of xObjects.getRawValues()) {
  11246. if (xObject instanceof _primitives.Ref) {
  11247. if (processed.has(xObject)) {
  11248. continue;
  11249. }
  11250. try {
  11251. xObject = xref.fetch(xObject);
  11252. } catch (ex) {
  11253. processed.put(xObject);
  11254. (0, _util.info)(`hasBlendModes - ignoring XObject: "${ex}".`);
  11255. continue;
  11256. }
  11257. }
  11258. if (!(xObject instanceof _base_stream.BaseStream)) {
  11259. continue;
  11260. }
  11261. if (xObject.dict.objId) {
  11262. processed.put(xObject.dict.objId);
  11263. }
  11264. const xResources = xObject.dict.get("Resources");
  11265. if (!(xResources instanceof _primitives.Dict)) {
  11266. continue;
  11267. }
  11268. if (xResources.objId && processed.has(xResources.objId)) {
  11269. continue;
  11270. }
  11271. nodes.push(xResources);
  11272. if (xResources.objId) {
  11273. processed.put(xResources.objId);
  11274. }
  11275. }
  11276. }
  11277. for (const ref of processed) {
  11278. nonBlendModesSet.put(ref);
  11279. }
  11280. return false;
  11281. }
  11282. async fetchBuiltInCMap(name) {
  11283. const cachedData = this.builtInCMapCache.get(name);
  11284. if (cachedData) {
  11285. return cachedData;
  11286. }
  11287. let data;
  11288. if (this.options.cMapUrl !== null) {
  11289. const url = `${this.options.cMapUrl}${name}.bcmap`;
  11290. const response = await fetch(url);
  11291. if (!response.ok) {
  11292. throw new Error(`fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`);
  11293. }
  11294. data = {
  11295. cMapData: new Uint8Array(await response.arrayBuffer()),
  11296. compressionType: _util.CMapCompressionType.BINARY
  11297. };
  11298. } else {
  11299. data = await this.handler.sendWithPromise("FetchBuiltInCMap", {
  11300. name
  11301. });
  11302. }
  11303. if (data.compressionType !== _util.CMapCompressionType.NONE) {
  11304. this.builtInCMapCache.set(name, data);
  11305. }
  11306. return data;
  11307. }
  11308. async fetchStandardFontData(name) {
  11309. const cachedData = this.standardFontDataCache.get(name);
  11310. if (cachedData) {
  11311. return new _stream.Stream(cachedData);
  11312. }
  11313. if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") {
  11314. return null;
  11315. }
  11316. const standardFontNameToFileName = (0, _standard_fonts.getFontNameToFileMap)(),
  11317. filename = standardFontNameToFileName[name];
  11318. let data;
  11319. if (this.options.standardFontDataUrl !== null) {
  11320. const url = `${this.options.standardFontDataUrl}${filename}`;
  11321. const response = await fetch(url);
  11322. if (!response.ok) {
  11323. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`);
  11324. } else {
  11325. data = await response.arrayBuffer();
  11326. }
  11327. } else {
  11328. try {
  11329. data = await this.handler.sendWithPromise("FetchStandardFontData", {
  11330. filename
  11331. });
  11332. } catch (e) {
  11333. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`);
  11334. }
  11335. }
  11336. if (!data) {
  11337. return null;
  11338. }
  11339. this.standardFontDataCache.set(name, data);
  11340. return new _stream.Stream(data);
  11341. }
  11342. async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) {
  11343. const dict = xobj.dict;
  11344. const matrix = dict.getArray("Matrix");
  11345. let bbox = dict.getArray("BBox");
  11346. if (Array.isArray(bbox) && bbox.length === 4) {
  11347. bbox = _util.Util.normalizeRect(bbox);
  11348. } else {
  11349. bbox = null;
  11350. }
  11351. let optionalContent, groupOptions;
  11352. if (dict.has("OC")) {
  11353. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  11354. }
  11355. if (optionalContent !== undefined) {
  11356. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  11357. }
  11358. const group = dict.get("Group");
  11359. if (group) {
  11360. groupOptions = {
  11361. matrix,
  11362. bbox,
  11363. smask,
  11364. isolated: false,
  11365. knockout: false
  11366. };
  11367. const groupSubtype = group.get("S");
  11368. let colorSpace = null;
  11369. if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
  11370. groupOptions.isolated = group.get("I") || false;
  11371. groupOptions.knockout = group.get("K") || false;
  11372. if (group.has("CS")) {
  11373. const cs = group.getRaw("CS");
  11374. const cachedColorSpace = _colorspace.ColorSpace.getCached(cs, this.xref, localColorSpaceCache);
  11375. if (cachedColorSpace) {
  11376. colorSpace = cachedColorSpace;
  11377. } else {
  11378. colorSpace = await this.parseColorSpace({
  11379. cs,
  11380. resources,
  11381. localColorSpaceCache
  11382. });
  11383. }
  11384. }
  11385. }
  11386. if (smask && smask.backdrop) {
  11387. colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
  11388. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  11389. }
  11390. operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
  11391. }
  11392. const args = group ? [matrix, null] : [matrix, bbox];
  11393. operatorList.addOp(_util.OPS.paintFormXObjectBegin, args);
  11394. return this.getOperatorList({
  11395. stream: xobj,
  11396. task,
  11397. resources: dict.get("Resources") || resources,
  11398. operatorList,
  11399. initialState
  11400. }).then(function () {
  11401. operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
  11402. if (group) {
  11403. operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
  11404. }
  11405. if (optionalContent !== undefined) {
  11406. operatorList.addOp(_util.OPS.endMarkedContent, []);
  11407. }
  11408. });
  11409. }
  11410. _sendImgData(objId, imgData) {
  11411. let cacheGlobally = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  11412. const transfers = imgData ? [imgData.bitmap || imgData.data.buffer] : null;
  11413. if (this.parsingType3Font || cacheGlobally) {
  11414. return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
  11415. }
  11416. return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
  11417. }
  11418. async buildPaintImageXObject(_ref2) {
  11419. let {
  11420. resources,
  11421. image,
  11422. isInline = false,
  11423. operatorList,
  11424. cacheKey,
  11425. localImageCache,
  11426. localColorSpaceCache
  11427. } = _ref2;
  11428. const dict = image.dict;
  11429. const imageRef = dict.objId;
  11430. const w = dict.get("W", "Width");
  11431. const h = dict.get("H", "Height");
  11432. if (!(w && typeof w === "number") || !(h && typeof h === "number")) {
  11433. (0, _util.warn)("Image dimensions are missing, or not numbers.");
  11434. return;
  11435. }
  11436. const maxImageSize = this.options.maxImageSize;
  11437. if (maxImageSize !== -1 && w * h > maxImageSize) {
  11438. const msg = "Image exceeded maximum allowed size and was removed.";
  11439. if (this.options.ignoreErrors) {
  11440. (0, _util.warn)(msg);
  11441. return;
  11442. }
  11443. throw new Error(msg);
  11444. }
  11445. let optionalContent;
  11446. if (dict.has("OC")) {
  11447. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  11448. }
  11449. const imageMask = dict.get("IM", "ImageMask") || false;
  11450. let imgData, args;
  11451. if (imageMask) {
  11452. const interpolate = dict.get("I", "Interpolate");
  11453. const bitStrideLength = w + 7 >> 3;
  11454. const imgArray = image.getBytes(bitStrideLength * h);
  11455. const decode = dict.getArray("D", "Decode");
  11456. if (this.parsingType3Font) {
  11457. imgData = _image.PDFImage.createRawMask({
  11458. imgArray,
  11459. width: w,
  11460. height: h,
  11461. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  11462. inverseDecode: !!decode && decode[0] > 0,
  11463. interpolate
  11464. });
  11465. imgData.cached = !!cacheKey;
  11466. args = [imgData];
  11467. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  11468. if (cacheKey) {
  11469. localImageCache.set(cacheKey, imageRef, {
  11470. fn: _util.OPS.paintImageMaskXObject,
  11471. args,
  11472. optionalContent
  11473. });
  11474. }
  11475. return;
  11476. }
  11477. imgData = _image.PDFImage.createMask({
  11478. imgArray,
  11479. width: w,
  11480. height: h,
  11481. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  11482. inverseDecode: !!decode && decode[0] > 0,
  11483. interpolate
  11484. });
  11485. if (imgData.isSingleOpaquePixel) {
  11486. operatorList.addImageOps(_util.OPS.paintSolidColorImageMask, [], optionalContent);
  11487. if (cacheKey) {
  11488. localImageCache.set(cacheKey, imageRef, {
  11489. fn: _util.OPS.paintSolidColorImageMask,
  11490. args: [],
  11491. optionalContent
  11492. });
  11493. }
  11494. return;
  11495. }
  11496. const objId = `mask_${this.idFactory.createObjId()}`;
  11497. operatorList.addDependency(objId);
  11498. this._sendImgData(objId, imgData);
  11499. args = [{
  11500. data: objId,
  11501. width: imgData.width,
  11502. height: imgData.height,
  11503. interpolate: imgData.interpolate,
  11504. count: 1
  11505. }];
  11506. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  11507. if (cacheKey) {
  11508. localImageCache.set(cacheKey, imageRef, {
  11509. fn: _util.OPS.paintImageMaskXObject,
  11510. args,
  11511. optionalContent
  11512. });
  11513. }
  11514. return;
  11515. }
  11516. const softMask = dict.get("SM", "SMask") || false;
  11517. const mask = dict.get("Mask") || false;
  11518. const SMALL_IMAGE_DIMENSIONS = 200;
  11519. if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) {
  11520. const imageObj = new _image.PDFImage({
  11521. xref: this.xref,
  11522. res: resources,
  11523. image,
  11524. isInline,
  11525. pdfFunctionFactory: this._pdfFunctionFactory,
  11526. localColorSpaceCache
  11527. });
  11528. imgData = imageObj.createImageData(true);
  11529. operatorList.addImageOps(_util.OPS.paintInlineImageXObject, [imgData], optionalContent);
  11530. return;
  11531. }
  11532. let objId = `img_${this.idFactory.createObjId()}`,
  11533. cacheGlobally = false;
  11534. if (this.parsingType3Font) {
  11535. objId = `${this.idFactory.getDocId()}_type3_${objId}`;
  11536. } else if (imageRef) {
  11537. cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
  11538. if (cacheGlobally) {
  11539. objId = `${this.idFactory.getDocId()}_${objId}`;
  11540. }
  11541. }
  11542. operatorList.addDependency(objId);
  11543. args = [objId, w, h];
  11544. _image.PDFImage.buildImage({
  11545. xref: this.xref,
  11546. res: resources,
  11547. image,
  11548. isInline,
  11549. pdfFunctionFactory: this._pdfFunctionFactory,
  11550. localColorSpaceCache
  11551. }).then(imageObj => {
  11552. imgData = imageObj.createImageData(false);
  11553. if (cacheKey && imageRef && cacheGlobally) {
  11554. this.globalImageCache.addByteSize(imageRef, imgData.data.length);
  11555. }
  11556. return this._sendImgData(objId, imgData, cacheGlobally);
  11557. }).catch(reason => {
  11558. (0, _util.warn)(`Unable to decode image "${objId}": "${reason}".`);
  11559. return this._sendImgData(objId, null, cacheGlobally);
  11560. });
  11561. operatorList.addImageOps(_util.OPS.paintImageXObject, args, optionalContent);
  11562. if (cacheKey) {
  11563. localImageCache.set(cacheKey, imageRef, {
  11564. fn: _util.OPS.paintImageXObject,
  11565. args,
  11566. optionalContent
  11567. });
  11568. if (imageRef) {
  11569. (0, _util.assert)(!isInline, "Cannot cache an inline image globally.");
  11570. this.globalImageCache.addPageIndex(imageRef, this.pageIndex);
  11571. if (cacheGlobally) {
  11572. this.globalImageCache.setData(imageRef, {
  11573. objId,
  11574. fn: _util.OPS.paintImageXObject,
  11575. args,
  11576. optionalContent,
  11577. byteSize: 0
  11578. });
  11579. }
  11580. }
  11581. }
  11582. }
  11583. handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) {
  11584. const smaskContent = smask.get("G");
  11585. const smaskOptions = {
  11586. subtype: smask.get("S").name,
  11587. backdrop: smask.get("BC")
  11588. };
  11589. const transferObj = smask.get("TR");
  11590. if ((0, _function.isPDFFunction)(transferObj)) {
  11591. const transferFn = this._pdfFunctionFactory.create(transferObj);
  11592. const transferMap = new Uint8Array(256);
  11593. const tmp = new Float32Array(1);
  11594. for (let i = 0; i < 256; i++) {
  11595. tmp[0] = i / 255;
  11596. transferFn(tmp, 0, tmp, 0);
  11597. transferMap[i] = tmp[0] * 255 | 0;
  11598. }
  11599. smaskOptions.transferMap = transferMap;
  11600. }
  11601. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache);
  11602. }
  11603. handleTransferFunction(tr) {
  11604. let transferArray;
  11605. if (Array.isArray(tr)) {
  11606. transferArray = tr;
  11607. } else if ((0, _function.isPDFFunction)(tr)) {
  11608. transferArray = [tr];
  11609. } else {
  11610. return null;
  11611. }
  11612. const transferMaps = [];
  11613. let numFns = 0,
  11614. numEffectfulFns = 0;
  11615. for (const entry of transferArray) {
  11616. const transferObj = this.xref.fetchIfRef(entry);
  11617. numFns++;
  11618. if ((0, _primitives.isName)(transferObj, "Identity")) {
  11619. transferMaps.push(null);
  11620. continue;
  11621. } else if (!(0, _function.isPDFFunction)(transferObj)) {
  11622. return null;
  11623. }
  11624. const transferFn = this._pdfFunctionFactory.create(transferObj);
  11625. const transferMap = new Uint8Array(256),
  11626. tmp = new Float32Array(1);
  11627. for (let j = 0; j < 256; j++) {
  11628. tmp[0] = j / 255;
  11629. transferFn(tmp, 0, tmp, 0);
  11630. transferMap[j] = tmp[0] * 255 | 0;
  11631. }
  11632. transferMaps.push(transferMap);
  11633. numEffectfulFns++;
  11634. }
  11635. if (!(numFns === 1 || numFns === 4)) {
  11636. return null;
  11637. }
  11638. if (numEffectfulFns === 0) {
  11639. return null;
  11640. }
  11641. return transferMaps;
  11642. }
  11643. handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) {
  11644. const tilingOpList = new _operator_list.OperatorList();
  11645. const patternResources = _primitives.Dict.merge({
  11646. xref: this.xref,
  11647. dictArray: [patternDict.get("Resources"), resources]
  11648. });
  11649. return this.getOperatorList({
  11650. stream: pattern,
  11651. task,
  11652. resources: patternResources,
  11653. operatorList: tilingOpList
  11654. }).then(function () {
  11655. const operatorListIR = tilingOpList.getIR();
  11656. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(operatorListIR, patternDict, color);
  11657. operatorList.addDependencies(tilingOpList.dependencies);
  11658. operatorList.addOp(fn, tilingPatternIR);
  11659. if (patternDict.objId) {
  11660. localTilingPatternCache.set(null, patternDict.objId, {
  11661. operatorListIR,
  11662. dict: patternDict
  11663. });
  11664. }
  11665. }).catch(reason => {
  11666. if (reason instanceof _util.AbortException) {
  11667. return;
  11668. }
  11669. if (this.options.ignoreErrors) {
  11670. this.handler.send("UnsupportedFeature", {
  11671. featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern
  11672. });
  11673. (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`);
  11674. return;
  11675. }
  11676. throw reason;
  11677. });
  11678. }
  11679. handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) {
  11680. let fallbackFontDict = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
  11681. let cssFontInfo = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  11682. const fontName = fontArgs && fontArgs[0] instanceof _primitives.Name ? fontArgs[0].name : null;
  11683. return this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo).then(translated => {
  11684. if (!translated.font.isType3Font) {
  11685. return translated;
  11686. }
  11687. return translated.loadType3Data(this, resources, task).then(function () {
  11688. operatorList.addDependencies(translated.type3Dependencies);
  11689. return translated;
  11690. }).catch(reason => {
  11691. this.handler.send("UnsupportedFeature", {
  11692. featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3
  11693. });
  11694. return new TranslatedFont({
  11695. loadedName: "g_font_error",
  11696. font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`),
  11697. dict: translated.font,
  11698. evaluatorOptions: this.options
  11699. });
  11700. });
  11701. }).then(translated => {
  11702. state.font = translated.font;
  11703. translated.send(this.handler);
  11704. return translated.loadedName;
  11705. });
  11706. }
  11707. handleText(chars, state) {
  11708. const font = state.font;
  11709. const glyphs = font.charsToGlyphs(chars);
  11710. if (font.data) {
  11711. const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  11712. if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
  11713. PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options);
  11714. }
  11715. }
  11716. return glyphs;
  11717. }
  11718. ensureStateFont(state) {
  11719. if (state.font) {
  11720. return;
  11721. }
  11722. const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
  11723. if (this.options.ignoreErrors) {
  11724. this.handler.send("UnsupportedFeature", {
  11725. featureId: _util.UNSUPPORTED_FEATURES.errorFontState
  11726. });
  11727. (0, _util.warn)(`ensureStateFont: "${reason}".`);
  11728. return;
  11729. }
  11730. throw reason;
  11731. }
  11732. async setGState(_ref3) {
  11733. let {
  11734. resources,
  11735. gState,
  11736. operatorList,
  11737. cacheKey,
  11738. task,
  11739. stateManager,
  11740. localGStateCache,
  11741. localColorSpaceCache
  11742. } = _ref3;
  11743. const gStateRef = gState.objId;
  11744. let isSimpleGState = true;
  11745. const gStateObj = [];
  11746. const gStateKeys = gState.getKeys();
  11747. let promise = Promise.resolve();
  11748. for (let i = 0, ii = gStateKeys.length; i < ii; i++) {
  11749. const key = gStateKeys[i];
  11750. const value = gState.get(key);
  11751. switch (key) {
  11752. case "Type":
  11753. break;
  11754. case "LW":
  11755. case "LC":
  11756. case "LJ":
  11757. case "ML":
  11758. case "D":
  11759. case "RI":
  11760. case "FL":
  11761. case "CA":
  11762. case "ca":
  11763. gStateObj.push([key, value]);
  11764. break;
  11765. case "Font":
  11766. isSimpleGState = false;
  11767. promise = promise.then(() => {
  11768. return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  11769. operatorList.addDependency(loadedName);
  11770. gStateObj.push([key, [loadedName, value[1]]]);
  11771. });
  11772. });
  11773. break;
  11774. case "BM":
  11775. gStateObj.push([key, normalizeBlendMode(value)]);
  11776. break;
  11777. case "SMask":
  11778. if ((0, _primitives.isName)(value, "None")) {
  11779. gStateObj.push([key, false]);
  11780. break;
  11781. }
  11782. if (value instanceof _primitives.Dict) {
  11783. isSimpleGState = false;
  11784. promise = promise.then(() => {
  11785. return this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache);
  11786. });
  11787. gStateObj.push([key, true]);
  11788. } else {
  11789. (0, _util.warn)("Unsupported SMask type");
  11790. }
  11791. break;
  11792. case "TR":
  11793. const transferMaps = this.handleTransferFunction(value);
  11794. gStateObj.push([key, transferMaps]);
  11795. break;
  11796. case "OP":
  11797. case "op":
  11798. case "OPM":
  11799. case "BG":
  11800. case "BG2":
  11801. case "UCR":
  11802. case "UCR2":
  11803. case "TR2":
  11804. case "HT":
  11805. case "SM":
  11806. case "SA":
  11807. case "AIS":
  11808. case "TK":
  11809. (0, _util.info)("graphic state operator " + key);
  11810. break;
  11811. default:
  11812. (0, _util.info)("Unknown graphic state operator " + key);
  11813. break;
  11814. }
  11815. }
  11816. return promise.then(function () {
  11817. if (gStateObj.length > 0) {
  11818. operatorList.addOp(_util.OPS.setGState, [gStateObj]);
  11819. }
  11820. if (isSimpleGState) {
  11821. localGStateCache.set(cacheKey, gStateRef, gStateObj);
  11822. }
  11823. });
  11824. }
  11825. loadFont(fontName, font, resources) {
  11826. let fallbackFontDict = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  11827. let cssFontInfo = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  11828. const errorFont = async () => {
  11829. return new TranslatedFont({
  11830. loadedName: "g_font_error",
  11831. font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`),
  11832. dict: font,
  11833. evaluatorOptions: this.options
  11834. });
  11835. };
  11836. const xref = this.xref;
  11837. let fontRef;
  11838. if (font) {
  11839. if (font instanceof _primitives.Ref) {
  11840. fontRef = font;
  11841. }
  11842. } else {
  11843. const fontRes = resources.get("Font");
  11844. if (fontRes) {
  11845. fontRef = fontRes.getRaw(fontName);
  11846. }
  11847. }
  11848. if (!fontRef) {
  11849. const partialMsg = `Font "${fontName || font && font.toString()}" is not available`;
  11850. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  11851. (0, _util.warn)(`${partialMsg}.`);
  11852. return errorFont();
  11853. }
  11854. this.handler.send("UnsupportedFeature", {
  11855. featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing
  11856. });
  11857. (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`);
  11858. if (fallbackFontDict) {
  11859. fontRef = fallbackFontDict;
  11860. } else {
  11861. fontRef = PartialEvaluator.fallbackFontDict;
  11862. }
  11863. }
  11864. if (this.parsingType3Font && this.type3FontRefs.has(fontRef)) {
  11865. return errorFont();
  11866. }
  11867. if (this.fontCache.has(fontRef)) {
  11868. return this.fontCache.get(fontRef);
  11869. }
  11870. font = xref.fetchIfRef(fontRef);
  11871. if (!(font instanceof _primitives.Dict)) {
  11872. return errorFont();
  11873. }
  11874. if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
  11875. return this.fontCache.get(font.cacheKey);
  11876. }
  11877. const fontCapability = (0, _util.createPromiseCapability)();
  11878. let preEvaluatedFont;
  11879. try {
  11880. preEvaluatedFont = this.preEvaluateFont(font);
  11881. preEvaluatedFont.cssFontInfo = cssFontInfo;
  11882. } catch (reason) {
  11883. (0, _util.warn)(`loadFont - preEvaluateFont failed: "${reason}".`);
  11884. return errorFont();
  11885. }
  11886. const {
  11887. descriptor,
  11888. hash
  11889. } = preEvaluatedFont;
  11890. const fontRefIsRef = fontRef instanceof _primitives.Ref;
  11891. let fontID;
  11892. if (fontRefIsRef) {
  11893. fontID = `f${fontRef.toString()}`;
  11894. }
  11895. if (hash && descriptor instanceof _primitives.Dict) {
  11896. if (!descriptor.fontAliases) {
  11897. descriptor.fontAliases = Object.create(null);
  11898. }
  11899. const fontAliases = descriptor.fontAliases;
  11900. if (fontAliases[hash]) {
  11901. const aliasFontRef = fontAliases[hash].aliasRef;
  11902. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  11903. this.fontCache.putAlias(fontRef, aliasFontRef);
  11904. return this.fontCache.get(fontRef);
  11905. }
  11906. } else {
  11907. fontAliases[hash] = {
  11908. fontID: this.idFactory.createFontId()
  11909. };
  11910. }
  11911. if (fontRefIsRef) {
  11912. fontAliases[hash].aliasRef = fontRef;
  11913. }
  11914. fontID = fontAliases[hash].fontID;
  11915. }
  11916. if (fontRefIsRef) {
  11917. this.fontCache.put(fontRef, fontCapability.promise);
  11918. } else {
  11919. if (!fontID) {
  11920. fontID = this.idFactory.createFontId();
  11921. }
  11922. font.cacheKey = `cacheKey_${fontID}`;
  11923. this.fontCache.put(font.cacheKey, fontCapability.promise);
  11924. }
  11925. (0, _util.assert)(fontID && fontID.startsWith("f"), 'The "fontID" must be (correctly) defined.');
  11926. font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
  11927. this.translateFont(preEvaluatedFont).then(translatedFont => {
  11928. if (translatedFont.fontType !== undefined) {
  11929. xref.stats.addFontType(translatedFont.fontType);
  11930. }
  11931. fontCapability.resolve(new TranslatedFont({
  11932. loadedName: font.loadedName,
  11933. font: translatedFont,
  11934. dict: font,
  11935. evaluatorOptions: this.options
  11936. }));
  11937. }).catch(reason => {
  11938. this.handler.send("UnsupportedFeature", {
  11939. featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate
  11940. });
  11941. (0, _util.warn)(`loadFont - translateFont failed: "${reason}".`);
  11942. try {
  11943. const fontFile3 = descriptor && descriptor.get("FontFile3");
  11944. const subtype = fontFile3 && fontFile3.get("Subtype");
  11945. const fontType = (0, _fonts_utils.getFontType)(preEvaluatedFont.type, subtype && subtype.name);
  11946. if (fontType !== undefined) {
  11947. xref.stats.addFontType(fontType);
  11948. }
  11949. } catch (ex) {}
  11950. fontCapability.resolve(new TranslatedFont({
  11951. loadedName: font.loadedName,
  11952. font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason),
  11953. dict: font,
  11954. evaluatorOptions: this.options
  11955. }));
  11956. });
  11957. return fontCapability.promise;
  11958. }
  11959. buildPath(operatorList, fn, args) {
  11960. let parsingText = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  11961. const lastIndex = operatorList.length - 1;
  11962. if (!args) {
  11963. args = [];
  11964. }
  11965. let minMax;
  11966. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
  11967. if (parsingText) {
  11968. (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`);
  11969. operatorList.addOp(_util.OPS.save, null);
  11970. }
  11971. minMax = [Infinity, -Infinity, Infinity, -Infinity];
  11972. operatorList.addOp(_util.OPS.constructPath, [[fn], args, minMax]);
  11973. if (parsingText) {
  11974. operatorList.addOp(_util.OPS.restore, null);
  11975. }
  11976. } else {
  11977. const opArgs = operatorList.argsArray[lastIndex];
  11978. opArgs[0].push(fn);
  11979. Array.prototype.push.apply(opArgs[1], args);
  11980. minMax = opArgs[2];
  11981. }
  11982. switch (fn) {
  11983. case _util.OPS.rectangle:
  11984. minMax[0] = Math.min(minMax[0], args[0], args[0] + args[2]);
  11985. minMax[1] = Math.max(minMax[1], args[0], args[0] + args[2]);
  11986. minMax[2] = Math.min(minMax[2], args[1], args[1] + args[3]);
  11987. minMax[3] = Math.max(minMax[3], args[1], args[1] + args[3]);
  11988. break;
  11989. case _util.OPS.moveTo:
  11990. case _util.OPS.lineTo:
  11991. minMax[0] = Math.min(minMax[0], args[0]);
  11992. minMax[1] = Math.max(minMax[1], args[0]);
  11993. minMax[2] = Math.min(minMax[2], args[1]);
  11994. minMax[3] = Math.max(minMax[3], args[1]);
  11995. break;
  11996. }
  11997. }
  11998. parseColorSpace(_ref4) {
  11999. let {
  12000. cs,
  12001. resources,
  12002. localColorSpaceCache
  12003. } = _ref4;
  12004. return _colorspace.ColorSpace.parseAsync({
  12005. cs,
  12006. xref: this.xref,
  12007. resources,
  12008. pdfFunctionFactory: this._pdfFunctionFactory,
  12009. localColorSpaceCache
  12010. }).catch(reason => {
  12011. if (reason instanceof _util.AbortException) {
  12012. return null;
  12013. }
  12014. if (this.options.ignoreErrors) {
  12015. this.handler.send("UnsupportedFeature", {
  12016. featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace
  12017. });
  12018. (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
  12019. return null;
  12020. }
  12021. throw reason;
  12022. });
  12023. }
  12024. parseShading(_ref5) {
  12025. let {
  12026. shading,
  12027. resources,
  12028. localColorSpaceCache,
  12029. localShadingPatternCache
  12030. } = _ref5;
  12031. let id = localShadingPatternCache.get(shading);
  12032. if (!id) {
  12033. var shadingFill = _pattern.Pattern.parseShading(shading, this.xref, resources, this.handler, this._pdfFunctionFactory, localColorSpaceCache);
  12034. const patternIR = shadingFill.getIR();
  12035. id = `pattern_${this.idFactory.createObjId()}`;
  12036. localShadingPatternCache.set(shading, id);
  12037. this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
  12038. }
  12039. return id;
  12040. }
  12041. handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) {
  12042. const patternName = args.pop();
  12043. if (patternName instanceof _primitives.Name) {
  12044. const rawPattern = patterns.getRaw(patternName.name);
  12045. const localTilingPattern = rawPattern instanceof _primitives.Ref && localTilingPatternCache.getByRef(rawPattern);
  12046. if (localTilingPattern) {
  12047. try {
  12048. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  12049. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(localTilingPattern.operatorListIR, localTilingPattern.dict, color);
  12050. operatorList.addOp(fn, tilingPatternIR);
  12051. return undefined;
  12052. } catch (ex) {}
  12053. }
  12054. const pattern = this.xref.fetchIfRef(rawPattern);
  12055. if (pattern) {
  12056. const dict = pattern instanceof _base_stream.BaseStream ? pattern.dict : pattern;
  12057. const typeNum = dict.get("PatternType");
  12058. if (typeNum === PatternType.TILING) {
  12059. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  12060. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache);
  12061. } else if (typeNum === PatternType.SHADING) {
  12062. const shading = dict.get("Shading");
  12063. const matrix = dict.getArray("Matrix");
  12064. const objId = this.parseShading({
  12065. shading,
  12066. resources,
  12067. localColorSpaceCache,
  12068. localShadingPatternCache
  12069. });
  12070. operatorList.addOp(fn, ["Shading", objId, matrix]);
  12071. return undefined;
  12072. }
  12073. throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
  12074. }
  12075. }
  12076. throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
  12077. }
  12078. _parseVisibilityExpression(array, nestingCounter, currentResult) {
  12079. const MAX_NESTING = 10;
  12080. if (++nestingCounter > MAX_NESTING) {
  12081. (0, _util.warn)("Visibility expression is too deeply nested");
  12082. return;
  12083. }
  12084. const length = array.length;
  12085. const operator = this.xref.fetchIfRef(array[0]);
  12086. if (length < 2 || !(operator instanceof _primitives.Name)) {
  12087. (0, _util.warn)("Invalid visibility expression");
  12088. return;
  12089. }
  12090. switch (operator.name) {
  12091. case "And":
  12092. case "Or":
  12093. case "Not":
  12094. currentResult.push(operator.name);
  12095. break;
  12096. default:
  12097. (0, _util.warn)(`Invalid operator ${operator.name} in visibility expression`);
  12098. return;
  12099. }
  12100. for (let i = 1; i < length; i++) {
  12101. const raw = array[i];
  12102. const object = this.xref.fetchIfRef(raw);
  12103. if (Array.isArray(object)) {
  12104. const nestedResult = [];
  12105. currentResult.push(nestedResult);
  12106. this._parseVisibilityExpression(object, nestingCounter, nestedResult);
  12107. } else if (raw instanceof _primitives.Ref) {
  12108. currentResult.push(raw.toString());
  12109. }
  12110. }
  12111. }
  12112. async parseMarkedContentProps(contentProperties, resources) {
  12113. let optionalContent;
  12114. if (contentProperties instanceof _primitives.Name) {
  12115. const properties = resources.get("Properties");
  12116. optionalContent = properties.get(contentProperties.name);
  12117. } else if (contentProperties instanceof _primitives.Dict) {
  12118. optionalContent = contentProperties;
  12119. } else {
  12120. throw new _util.FormatError("Optional content properties malformed.");
  12121. }
  12122. const optionalContentType = optionalContent.get("Type").name;
  12123. if (optionalContentType === "OCG") {
  12124. return {
  12125. type: optionalContentType,
  12126. id: optionalContent.objId
  12127. };
  12128. } else if (optionalContentType === "OCMD") {
  12129. const expression = optionalContent.get("VE");
  12130. if (Array.isArray(expression)) {
  12131. const result = [];
  12132. this._parseVisibilityExpression(expression, 0, result);
  12133. if (result.length > 0) {
  12134. return {
  12135. type: "OCMD",
  12136. expression: result
  12137. };
  12138. }
  12139. }
  12140. const optionalContentGroups = optionalContent.get("OCGs");
  12141. if (Array.isArray(optionalContentGroups) || optionalContentGroups instanceof _primitives.Dict) {
  12142. const groupIds = [];
  12143. if (Array.isArray(optionalContentGroups)) {
  12144. for (const ocg of optionalContentGroups) {
  12145. groupIds.push(ocg.toString());
  12146. }
  12147. } else {
  12148. groupIds.push(optionalContentGroups.objId);
  12149. }
  12150. return {
  12151. type: optionalContentType,
  12152. ids: groupIds,
  12153. policy: optionalContent.get("P") instanceof _primitives.Name ? optionalContent.get("P").name : null,
  12154. expression: null
  12155. };
  12156. } else if (optionalContentGroups instanceof _primitives.Ref) {
  12157. return {
  12158. type: optionalContentType,
  12159. id: optionalContentGroups.toString()
  12160. };
  12161. }
  12162. }
  12163. return null;
  12164. }
  12165. getOperatorList(_ref6) {
  12166. let {
  12167. stream,
  12168. task,
  12169. resources,
  12170. operatorList,
  12171. initialState = null,
  12172. fallbackFontDict = null
  12173. } = _ref6;
  12174. resources = resources || _primitives.Dict.empty;
  12175. initialState = initialState || new EvalState();
  12176. if (!operatorList) {
  12177. throw new Error('getOperatorList: missing "operatorList" parameter');
  12178. }
  12179. const self = this;
  12180. const xref = this.xref;
  12181. let parsingText = false;
  12182. const localImageCache = new _image_utils.LocalImageCache();
  12183. const localColorSpaceCache = new _image_utils.LocalColorSpaceCache();
  12184. const localGStateCache = new _image_utils.LocalGStateCache();
  12185. const localTilingPatternCache = new _image_utils.LocalTilingPatternCache();
  12186. const localShadingPatternCache = new Map();
  12187. const xobjs = resources.get("XObject") || _primitives.Dict.empty;
  12188. const patterns = resources.get("Pattern") || _primitives.Dict.empty;
  12189. const stateManager = new StateManager(initialState);
  12190. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  12191. const timeSlotManager = new TimeSlotManager();
  12192. function closePendingRestoreOPS(argument) {
  12193. for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  12194. operatorList.addOp(_util.OPS.restore, []);
  12195. }
  12196. }
  12197. return new Promise(function promiseBody(resolve, reject) {
  12198. const next = function (promise) {
  12199. Promise.all([promise, operatorList.ready]).then(function () {
  12200. try {
  12201. promiseBody(resolve, reject);
  12202. } catch (ex) {
  12203. reject(ex);
  12204. }
  12205. }, reject);
  12206. };
  12207. task.ensureNotTerminated();
  12208. timeSlotManager.reset();
  12209. const operation = {};
  12210. let stop, i, ii, cs, name, isValidName;
  12211. while (!(stop = timeSlotManager.check())) {
  12212. operation.args = null;
  12213. if (!preprocessor.read(operation)) {
  12214. break;
  12215. }
  12216. let args = operation.args;
  12217. let fn = operation.fn;
  12218. switch (fn | 0) {
  12219. case _util.OPS.paintXObject:
  12220. isValidName = args[0] instanceof _primitives.Name;
  12221. name = args[0].name;
  12222. if (isValidName) {
  12223. const localImage = localImageCache.getByName(name);
  12224. if (localImage) {
  12225. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  12226. incrementCachedImageMaskCount(localImage);
  12227. args = null;
  12228. continue;
  12229. }
  12230. }
  12231. next(new Promise(function (resolveXObject, rejectXObject) {
  12232. if (!isValidName) {
  12233. throw new _util.FormatError("XObject must be referred to by name.");
  12234. }
  12235. let xobj = xobjs.getRaw(name);
  12236. if (xobj instanceof _primitives.Ref) {
  12237. const localImage = localImageCache.getByRef(xobj);
  12238. if (localImage) {
  12239. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  12240. incrementCachedImageMaskCount(localImage);
  12241. resolveXObject();
  12242. return;
  12243. }
  12244. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  12245. if (globalImage) {
  12246. operatorList.addDependency(globalImage.objId);
  12247. operatorList.addImageOps(globalImage.fn, globalImage.args, globalImage.optionalContent);
  12248. resolveXObject();
  12249. return;
  12250. }
  12251. xobj = xref.fetch(xobj);
  12252. }
  12253. if (!(xobj instanceof _base_stream.BaseStream)) {
  12254. throw new _util.FormatError("XObject should be a stream");
  12255. }
  12256. const type = xobj.dict.get("Subtype");
  12257. if (!(type instanceof _primitives.Name)) {
  12258. throw new _util.FormatError("XObject should have a Name subtype");
  12259. }
  12260. if (type.name === "Form") {
  12261. stateManager.save();
  12262. self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () {
  12263. stateManager.restore();
  12264. resolveXObject();
  12265. }, rejectXObject);
  12266. return;
  12267. } else if (type.name === "Image") {
  12268. self.buildPaintImageXObject({
  12269. resources,
  12270. image: xobj,
  12271. operatorList,
  12272. cacheKey: name,
  12273. localImageCache,
  12274. localColorSpaceCache
  12275. }).then(resolveXObject, rejectXObject);
  12276. return;
  12277. } else if (type.name === "PS") {
  12278. (0, _util.info)("Ignored XObject subtype PS");
  12279. } else {
  12280. throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);
  12281. }
  12282. resolveXObject();
  12283. }).catch(function (reason) {
  12284. if (reason instanceof _util.AbortException) {
  12285. return;
  12286. }
  12287. if (self.options.ignoreErrors) {
  12288. self.handler.send("UnsupportedFeature", {
  12289. featureId: _util.UNSUPPORTED_FEATURES.errorXObject
  12290. });
  12291. (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`);
  12292. return;
  12293. }
  12294. throw reason;
  12295. }));
  12296. return;
  12297. case _util.OPS.setFont:
  12298. var fontSize = args[1];
  12299. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) {
  12300. operatorList.addDependency(loadedName);
  12301. operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
  12302. }));
  12303. return;
  12304. case _util.OPS.beginText:
  12305. parsingText = true;
  12306. break;
  12307. case _util.OPS.endText:
  12308. parsingText = false;
  12309. break;
  12310. case _util.OPS.endInlineImage:
  12311. var cacheKey = args[0].cacheKey;
  12312. if (cacheKey) {
  12313. const localImage = localImageCache.getByName(cacheKey);
  12314. if (localImage) {
  12315. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  12316. incrementCachedImageMaskCount(localImage);
  12317. args = null;
  12318. continue;
  12319. }
  12320. }
  12321. next(self.buildPaintImageXObject({
  12322. resources,
  12323. image: args[0],
  12324. isInline: true,
  12325. operatorList,
  12326. cacheKey,
  12327. localImageCache,
  12328. localColorSpaceCache
  12329. }));
  12330. return;
  12331. case _util.OPS.showText:
  12332. if (!stateManager.state.font) {
  12333. self.ensureStateFont(stateManager.state);
  12334. continue;
  12335. }
  12336. args[0] = self.handleText(args[0], stateManager.state);
  12337. break;
  12338. case _util.OPS.showSpacedText:
  12339. if (!stateManager.state.font) {
  12340. self.ensureStateFont(stateManager.state);
  12341. continue;
  12342. }
  12343. var arr = args[0];
  12344. var combinedGlyphs = [];
  12345. var arrLength = arr.length;
  12346. var state = stateManager.state;
  12347. for (i = 0; i < arrLength; ++i) {
  12348. const arrItem = arr[i];
  12349. if (typeof arrItem === "string") {
  12350. Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
  12351. } else if (typeof arrItem === "number") {
  12352. combinedGlyphs.push(arrItem);
  12353. }
  12354. }
  12355. args[0] = combinedGlyphs;
  12356. fn = _util.OPS.showText;
  12357. break;
  12358. case _util.OPS.nextLineShowText:
  12359. if (!stateManager.state.font) {
  12360. self.ensureStateFont(stateManager.state);
  12361. continue;
  12362. }
  12363. operatorList.addOp(_util.OPS.nextLine);
  12364. args[0] = self.handleText(args[0], stateManager.state);
  12365. fn = _util.OPS.showText;
  12366. break;
  12367. case _util.OPS.nextLineSetSpacingShowText:
  12368. if (!stateManager.state.font) {
  12369. self.ensureStateFont(stateManager.state);
  12370. continue;
  12371. }
  12372. operatorList.addOp(_util.OPS.nextLine);
  12373. operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
  12374. operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
  12375. args[0] = self.handleText(args[0], stateManager.state);
  12376. fn = _util.OPS.showText;
  12377. break;
  12378. case _util.OPS.setTextRenderingMode:
  12379. stateManager.state.textRenderingMode = args[0];
  12380. break;
  12381. case _util.OPS.setFillColorSpace:
  12382. {
  12383. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  12384. if (cachedColorSpace) {
  12385. stateManager.state.fillColorSpace = cachedColorSpace;
  12386. continue;
  12387. }
  12388. next(self.parseColorSpace({
  12389. cs: args[0],
  12390. resources,
  12391. localColorSpaceCache
  12392. }).then(function (colorSpace) {
  12393. if (colorSpace) {
  12394. stateManager.state.fillColorSpace = colorSpace;
  12395. }
  12396. }));
  12397. return;
  12398. }
  12399. case _util.OPS.setStrokeColorSpace:
  12400. {
  12401. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  12402. if (cachedColorSpace) {
  12403. stateManager.state.strokeColorSpace = cachedColorSpace;
  12404. continue;
  12405. }
  12406. next(self.parseColorSpace({
  12407. cs: args[0],
  12408. resources,
  12409. localColorSpaceCache
  12410. }).then(function (colorSpace) {
  12411. if (colorSpace) {
  12412. stateManager.state.strokeColorSpace = colorSpace;
  12413. }
  12414. }));
  12415. return;
  12416. }
  12417. case _util.OPS.setFillColor:
  12418. cs = stateManager.state.fillColorSpace;
  12419. args = cs.getRgb(args, 0);
  12420. fn = _util.OPS.setFillRGBColor;
  12421. break;
  12422. case _util.OPS.setStrokeColor:
  12423. cs = stateManager.state.strokeColorSpace;
  12424. args = cs.getRgb(args, 0);
  12425. fn = _util.OPS.setStrokeRGBColor;
  12426. break;
  12427. case _util.OPS.setFillGray:
  12428. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  12429. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  12430. fn = _util.OPS.setFillRGBColor;
  12431. break;
  12432. case _util.OPS.setStrokeGray:
  12433. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  12434. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  12435. fn = _util.OPS.setStrokeRGBColor;
  12436. break;
  12437. case _util.OPS.setFillCMYKColor:
  12438. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  12439. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  12440. fn = _util.OPS.setFillRGBColor;
  12441. break;
  12442. case _util.OPS.setStrokeCMYKColor:
  12443. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  12444. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  12445. fn = _util.OPS.setStrokeRGBColor;
  12446. break;
  12447. case _util.OPS.setFillRGBColor:
  12448. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
  12449. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  12450. break;
  12451. case _util.OPS.setStrokeRGBColor:
  12452. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
  12453. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  12454. break;
  12455. case _util.OPS.setFillColorN:
  12456. cs = stateManager.state.fillColorSpace;
  12457. if (cs.name === "Pattern") {
  12458. next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  12459. return;
  12460. }
  12461. args = cs.getRgb(args, 0);
  12462. fn = _util.OPS.setFillRGBColor;
  12463. break;
  12464. case _util.OPS.setStrokeColorN:
  12465. cs = stateManager.state.strokeColorSpace;
  12466. if (cs.name === "Pattern") {
  12467. next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  12468. return;
  12469. }
  12470. args = cs.getRgb(args, 0);
  12471. fn = _util.OPS.setStrokeRGBColor;
  12472. break;
  12473. case _util.OPS.shadingFill:
  12474. var shadingRes = resources.get("Shading");
  12475. if (!shadingRes) {
  12476. throw new _util.FormatError("No shading resource found");
  12477. }
  12478. var shading = shadingRes.get(args[0].name);
  12479. if (!shading) {
  12480. throw new _util.FormatError("No shading object found");
  12481. }
  12482. const patternId = self.parseShading({
  12483. shading,
  12484. resources,
  12485. localColorSpaceCache,
  12486. localShadingPatternCache
  12487. });
  12488. args = [patternId];
  12489. fn = _util.OPS.shadingFill;
  12490. break;
  12491. case _util.OPS.setGState:
  12492. isValidName = args[0] instanceof _primitives.Name;
  12493. name = args[0].name;
  12494. if (isValidName) {
  12495. const localGStateObj = localGStateCache.getByName(name);
  12496. if (localGStateObj) {
  12497. if (localGStateObj.length > 0) {
  12498. operatorList.addOp(_util.OPS.setGState, [localGStateObj]);
  12499. }
  12500. args = null;
  12501. continue;
  12502. }
  12503. }
  12504. next(new Promise(function (resolveGState, rejectGState) {
  12505. if (!isValidName) {
  12506. throw new _util.FormatError("GState must be referred to by name.");
  12507. }
  12508. const extGState = resources.get("ExtGState");
  12509. if (!(extGState instanceof _primitives.Dict)) {
  12510. throw new _util.FormatError("ExtGState should be a dictionary.");
  12511. }
  12512. const gState = extGState.get(name);
  12513. if (!(gState instanceof _primitives.Dict)) {
  12514. throw new _util.FormatError("GState should be a dictionary.");
  12515. }
  12516. self.setGState({
  12517. resources,
  12518. gState,
  12519. operatorList,
  12520. cacheKey: name,
  12521. task,
  12522. stateManager,
  12523. localGStateCache,
  12524. localColorSpaceCache
  12525. }).then(resolveGState, rejectGState);
  12526. }).catch(function (reason) {
  12527. if (reason instanceof _util.AbortException) {
  12528. return;
  12529. }
  12530. if (self.options.ignoreErrors) {
  12531. self.handler.send("UnsupportedFeature", {
  12532. featureId: _util.UNSUPPORTED_FEATURES.errorExtGState
  12533. });
  12534. (0, _util.warn)(`getOperatorList - ignoring ExtGState: "${reason}".`);
  12535. return;
  12536. }
  12537. throw reason;
  12538. }));
  12539. return;
  12540. case _util.OPS.moveTo:
  12541. case _util.OPS.lineTo:
  12542. case _util.OPS.curveTo:
  12543. case _util.OPS.curveTo2:
  12544. case _util.OPS.curveTo3:
  12545. case _util.OPS.closePath:
  12546. case _util.OPS.rectangle:
  12547. self.buildPath(operatorList, fn, args, parsingText);
  12548. continue;
  12549. case _util.OPS.markPoint:
  12550. case _util.OPS.markPointProps:
  12551. case _util.OPS.beginCompat:
  12552. case _util.OPS.endCompat:
  12553. continue;
  12554. case _util.OPS.beginMarkedContentProps:
  12555. if (!(args[0] instanceof _primitives.Name)) {
  12556. (0, _util.warn)(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
  12557. continue;
  12558. }
  12559. if (args[0].name === "OC") {
  12560. next(self.parseMarkedContentProps(args[1], resources).then(data => {
  12561. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", data]);
  12562. }).catch(reason => {
  12563. if (reason instanceof _util.AbortException) {
  12564. return;
  12565. }
  12566. if (self.options.ignoreErrors) {
  12567. self.handler.send("UnsupportedFeature", {
  12568. featureId: _util.UNSUPPORTED_FEATURES.errorMarkedContent
  12569. });
  12570. (0, _util.warn)(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
  12571. return;
  12572. }
  12573. throw reason;
  12574. }));
  12575. return;
  12576. }
  12577. args = [args[0].name, args[1] instanceof _primitives.Dict ? args[1].get("MCID") : null];
  12578. break;
  12579. case _util.OPS.beginMarkedContent:
  12580. case _util.OPS.endMarkedContent:
  12581. default:
  12582. if (args !== null) {
  12583. for (i = 0, ii = args.length; i < ii; i++) {
  12584. if (args[i] instanceof _primitives.Dict) {
  12585. break;
  12586. }
  12587. }
  12588. if (i < ii) {
  12589. (0, _util.warn)("getOperatorList - ignoring operator: " + fn);
  12590. continue;
  12591. }
  12592. }
  12593. }
  12594. operatorList.addOp(fn, args);
  12595. }
  12596. if (stop) {
  12597. next(deferred);
  12598. return;
  12599. }
  12600. closePendingRestoreOPS();
  12601. resolve();
  12602. }).catch(reason => {
  12603. if (reason instanceof _util.AbortException) {
  12604. return;
  12605. }
  12606. if (this.options.ignoreErrors) {
  12607. this.handler.send("UnsupportedFeature", {
  12608. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  12609. });
  12610. (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  12611. closePendingRestoreOPS();
  12612. return;
  12613. }
  12614. throw reason;
  12615. });
  12616. }
  12617. getTextContent(_ref7) {
  12618. let {
  12619. stream,
  12620. task,
  12621. resources,
  12622. stateManager = null,
  12623. combineTextItems = false,
  12624. includeMarkedContent = false,
  12625. sink,
  12626. seenStyles = new Set(),
  12627. viewBox
  12628. } = _ref7;
  12629. resources = resources || _primitives.Dict.empty;
  12630. stateManager = stateManager || new StateManager(new TextState());
  12631. const NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)();
  12632. const textContent = {
  12633. items: [],
  12634. styles: Object.create(null)
  12635. };
  12636. const textContentItem = {
  12637. initialized: false,
  12638. str: [],
  12639. totalWidth: 0,
  12640. totalHeight: 0,
  12641. width: 0,
  12642. height: 0,
  12643. vertical: false,
  12644. prevTransform: null,
  12645. textAdvanceScale: 0,
  12646. spaceInFlowMin: 0,
  12647. spaceInFlowMax: 0,
  12648. trackingSpaceMin: Infinity,
  12649. negativeSpaceMax: -Infinity,
  12650. notASpace: -Infinity,
  12651. transform: null,
  12652. fontName: null,
  12653. hasEOL: false
  12654. };
  12655. const twoLastChars = [" ", " "];
  12656. let twoLastCharsPos = 0;
  12657. function saveLastChar(char) {
  12658. const nextPos = (twoLastCharsPos + 1) % 2;
  12659. const ret = twoLastChars[twoLastCharsPos] !== " " && twoLastChars[nextPos] === " ";
  12660. twoLastChars[twoLastCharsPos] = char;
  12661. twoLastCharsPos = nextPos;
  12662. return ret;
  12663. }
  12664. function resetLastChars() {
  12665. twoLastChars[0] = twoLastChars[1] = " ";
  12666. twoLastCharsPos = 0;
  12667. }
  12668. const TRACKING_SPACE_FACTOR = 0.1;
  12669. const NOT_A_SPACE_FACTOR = 0.03;
  12670. const NEGATIVE_SPACE_FACTOR = -0.2;
  12671. const SPACE_IN_FLOW_MIN_FACTOR = 0.1;
  12672. const SPACE_IN_FLOW_MAX_FACTOR = 0.6;
  12673. const self = this;
  12674. const xref = this.xref;
  12675. const showSpacedTextBuffer = [];
  12676. let xobjs = null;
  12677. const emptyXObjectCache = new _image_utils.LocalImageCache();
  12678. const emptyGStateCache = new _image_utils.LocalGStateCache();
  12679. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  12680. let textState;
  12681. function getCurrentTextTransform() {
  12682. const font = textState.font;
  12683. const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  12684. if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
  12685. const glyphHeight = font.bbox[3] - font.bbox[1];
  12686. if (glyphHeight > 0) {
  12687. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  12688. }
  12689. }
  12690. return _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
  12691. }
  12692. function ensureTextContentItem() {
  12693. if (textContentItem.initialized) {
  12694. return textContentItem;
  12695. }
  12696. const font = textState.font,
  12697. loadedName = font.loadedName;
  12698. if (!seenStyles.has(loadedName)) {
  12699. seenStyles.add(loadedName);
  12700. textContent.styles[loadedName] = {
  12701. fontFamily: font.fallbackName,
  12702. ascent: font.ascent,
  12703. descent: font.descent,
  12704. vertical: font.vertical
  12705. };
  12706. }
  12707. textContentItem.fontName = loadedName;
  12708. const trm = textContentItem.transform = getCurrentTextTransform();
  12709. if (!font.vertical) {
  12710. textContentItem.width = textContentItem.totalWidth = 0;
  12711. textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]);
  12712. textContentItem.vertical = false;
  12713. } else {
  12714. textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]);
  12715. textContentItem.height = textContentItem.totalHeight = 0;
  12716. textContentItem.vertical = true;
  12717. }
  12718. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  12719. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  12720. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  12721. textContentItem.trackingSpaceMin = textState.fontSize * TRACKING_SPACE_FACTOR;
  12722. textContentItem.notASpace = textState.fontSize * NOT_A_SPACE_FACTOR;
  12723. textContentItem.negativeSpaceMax = textState.fontSize * NEGATIVE_SPACE_FACTOR;
  12724. textContentItem.spaceInFlowMin = textState.fontSize * SPACE_IN_FLOW_MIN_FACTOR;
  12725. textContentItem.spaceInFlowMax = textState.fontSize * SPACE_IN_FLOW_MAX_FACTOR;
  12726. textContentItem.hasEOL = false;
  12727. textContentItem.initialized = true;
  12728. return textContentItem;
  12729. }
  12730. function updateAdvanceScale() {
  12731. if (!textContentItem.initialized) {
  12732. return;
  12733. }
  12734. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  12735. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  12736. const scaleFactor = scaleCtmX * scaleLineX;
  12737. if (scaleFactor === textContentItem.textAdvanceScale) {
  12738. return;
  12739. }
  12740. if (!textContentItem.vertical) {
  12741. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  12742. textContentItem.width = 0;
  12743. } else {
  12744. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  12745. textContentItem.height = 0;
  12746. }
  12747. textContentItem.textAdvanceScale = scaleFactor;
  12748. }
  12749. function runBidiTransform(textChunk) {
  12750. const text = textChunk.str.join("");
  12751. const bidiResult = (0, _bidi.bidi)(text, -1, textChunk.vertical);
  12752. return {
  12753. str: bidiResult.str,
  12754. dir: bidiResult.dir,
  12755. width: Math.abs(textChunk.totalWidth),
  12756. height: Math.abs(textChunk.totalHeight),
  12757. transform: textChunk.transform,
  12758. fontName: textChunk.fontName,
  12759. hasEOL: textChunk.hasEOL
  12760. };
  12761. }
  12762. function handleSetFont(fontName, fontRef) {
  12763. return self.loadFont(fontName, fontRef, resources).then(function (translated) {
  12764. if (!translated.font.isType3Font) {
  12765. return translated;
  12766. }
  12767. return translated.loadType3Data(self, resources, task).catch(function () {}).then(function () {
  12768. return translated;
  12769. });
  12770. }).then(function (translated) {
  12771. textState.font = translated.font;
  12772. textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  12773. });
  12774. }
  12775. function applyInverseRotation(x, y, matrix) {
  12776. const scale = Math.hypot(matrix[0], matrix[1]);
  12777. return [(matrix[0] * x + matrix[1] * y) / scale, (matrix[2] * x + matrix[3] * y) / scale];
  12778. }
  12779. function compareWithLastPosition() {
  12780. const currentTransform = getCurrentTextTransform();
  12781. let posX = currentTransform[4];
  12782. let posY = currentTransform[5];
  12783. const shiftedX = posX - viewBox[0];
  12784. const shiftedY = posY - viewBox[1];
  12785. if (shiftedX < 0 || shiftedX > viewBox[2] || shiftedY < 0 || shiftedY > viewBox[3]) {
  12786. return false;
  12787. }
  12788. if (!combineTextItems || !textState.font || !textContentItem.prevTransform) {
  12789. return true;
  12790. }
  12791. let lastPosX = textContentItem.prevTransform[4];
  12792. let lastPosY = textContentItem.prevTransform[5];
  12793. if (lastPosX === posX && lastPosY === posY) {
  12794. return true;
  12795. }
  12796. let rotate = -1;
  12797. if (currentTransform[0] && currentTransform[1] === 0 && currentTransform[2] === 0) {
  12798. rotate = currentTransform[0] > 0 ? 0 : 180;
  12799. } else if (currentTransform[1] && currentTransform[0] === 0 && currentTransform[3] === 0) {
  12800. rotate = currentTransform[1] > 0 ? 90 : 270;
  12801. }
  12802. switch (rotate) {
  12803. case 0:
  12804. break;
  12805. case 90:
  12806. [posX, posY] = [posY, posX];
  12807. [lastPosX, lastPosY] = [lastPosY, lastPosX];
  12808. break;
  12809. case 180:
  12810. [posX, posY, lastPosX, lastPosY] = [-posX, -posY, -lastPosX, -lastPosY];
  12811. break;
  12812. case 270:
  12813. [posX, posY] = [-posY, -posX];
  12814. [lastPosX, lastPosY] = [-lastPosY, -lastPosX];
  12815. break;
  12816. default:
  12817. [posX, posY] = applyInverseRotation(posX, posY, currentTransform);
  12818. [lastPosX, lastPosY] = applyInverseRotation(lastPosX, lastPosY, textContentItem.prevTransform);
  12819. }
  12820. if (textState.font.vertical) {
  12821. const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale;
  12822. const advanceX = posX - lastPosX;
  12823. const textOrientation = Math.sign(textContentItem.height);
  12824. if (advanceY < textOrientation * textContentItem.negativeSpaceMax) {
  12825. if (Math.abs(advanceX) > 0.5 * textContentItem.width) {
  12826. appendEOL();
  12827. return true;
  12828. }
  12829. resetLastChars();
  12830. flushTextContentItem();
  12831. return true;
  12832. }
  12833. if (Math.abs(advanceX) > textContentItem.width) {
  12834. appendEOL();
  12835. return true;
  12836. }
  12837. if (advanceY <= textOrientation * textContentItem.notASpace) {
  12838. resetLastChars();
  12839. }
  12840. if (advanceY <= textOrientation * textContentItem.trackingSpaceMin) {
  12841. textContentItem.height += advanceY;
  12842. } else if (!addFakeSpaces(advanceY, textContentItem.prevTransform, textOrientation)) {
  12843. if (textContentItem.str.length === 0) {
  12844. resetLastChars();
  12845. textContent.items.push({
  12846. str: " ",
  12847. dir: "ltr",
  12848. width: 0,
  12849. height: Math.abs(advanceY),
  12850. transform: textContentItem.prevTransform,
  12851. fontName: textContentItem.fontName,
  12852. hasEOL: false
  12853. });
  12854. } else {
  12855. textContentItem.height += advanceY;
  12856. }
  12857. }
  12858. return true;
  12859. }
  12860. const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
  12861. const advanceY = posY - lastPosY;
  12862. const textOrientation = Math.sign(textContentItem.width);
  12863. if (advanceX < textOrientation * textContentItem.negativeSpaceMax) {
  12864. if (Math.abs(advanceY) > 0.5 * textContentItem.height) {
  12865. appendEOL();
  12866. return true;
  12867. }
  12868. resetLastChars();
  12869. flushTextContentItem();
  12870. return true;
  12871. }
  12872. if (Math.abs(advanceY) > textContentItem.height) {
  12873. appendEOL();
  12874. return true;
  12875. }
  12876. if (advanceX <= textOrientation * textContentItem.notASpace) {
  12877. resetLastChars();
  12878. }
  12879. if (advanceX <= textOrientation * textContentItem.trackingSpaceMin) {
  12880. textContentItem.width += advanceX;
  12881. } else if (!addFakeSpaces(advanceX, textContentItem.prevTransform, textOrientation)) {
  12882. if (textContentItem.str.length === 0) {
  12883. resetLastChars();
  12884. textContent.items.push({
  12885. str: " ",
  12886. dir: "ltr",
  12887. width: Math.abs(advanceX),
  12888. height: 0,
  12889. transform: textContentItem.prevTransform,
  12890. fontName: textContentItem.fontName,
  12891. hasEOL: false
  12892. });
  12893. } else {
  12894. textContentItem.width += advanceX;
  12895. }
  12896. }
  12897. return true;
  12898. }
  12899. function buildTextContentItem(_ref8) {
  12900. let {
  12901. chars,
  12902. extraSpacing
  12903. } = _ref8;
  12904. const font = textState.font;
  12905. if (!chars) {
  12906. const charSpacing = textState.charSpacing + extraSpacing;
  12907. if (charSpacing) {
  12908. if (!font.vertical) {
  12909. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  12910. } else {
  12911. textState.translateTextMatrix(0, -charSpacing);
  12912. }
  12913. }
  12914. return;
  12915. }
  12916. const glyphs = font.charsToGlyphs(chars);
  12917. const scale = textState.fontMatrix[0] * textState.fontSize;
  12918. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  12919. const glyph = glyphs[i];
  12920. if (glyph.isInvisibleFormatMark) {
  12921. continue;
  12922. }
  12923. let charSpacing = textState.charSpacing + (i + 1 === ii ? extraSpacing : 0);
  12924. let glyphWidth = glyph.width;
  12925. if (font.vertical) {
  12926. glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth;
  12927. }
  12928. let scaledDim = glyphWidth * scale;
  12929. if (glyph.isWhitespace) {
  12930. if (!font.vertical) {
  12931. charSpacing += scaledDim + textState.wordSpacing;
  12932. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  12933. } else {
  12934. charSpacing += -scaledDim + textState.wordSpacing;
  12935. textState.translateTextMatrix(0, -charSpacing);
  12936. }
  12937. saveLastChar(" ");
  12938. continue;
  12939. }
  12940. if (!compareWithLastPosition()) {
  12941. continue;
  12942. }
  12943. const textChunk = ensureTextContentItem();
  12944. if (glyph.isZeroWidthDiacritic) {
  12945. scaledDim = 0;
  12946. }
  12947. if (!font.vertical) {
  12948. scaledDim *= textState.textHScale;
  12949. textState.translateTextMatrix(scaledDim, 0);
  12950. textChunk.width += scaledDim;
  12951. } else {
  12952. textState.translateTextMatrix(0, scaledDim);
  12953. scaledDim = Math.abs(scaledDim);
  12954. textChunk.height += scaledDim;
  12955. }
  12956. if (scaledDim) {
  12957. textChunk.prevTransform = getCurrentTextTransform();
  12958. }
  12959. let glyphUnicode = glyph.unicode;
  12960. glyphUnicode = NormalizedUnicodes[glyphUnicode] || glyphUnicode;
  12961. glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode);
  12962. if (saveLastChar(glyphUnicode)) {
  12963. textChunk.str.push(" ");
  12964. }
  12965. textChunk.str.push(glyphUnicode);
  12966. if (charSpacing) {
  12967. if (!font.vertical) {
  12968. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  12969. } else {
  12970. textState.translateTextMatrix(0, -charSpacing);
  12971. }
  12972. }
  12973. }
  12974. }
  12975. function appendEOL() {
  12976. resetLastChars();
  12977. if (textContentItem.initialized) {
  12978. textContentItem.hasEOL = true;
  12979. flushTextContentItem();
  12980. } else {
  12981. textContent.items.push({
  12982. str: "",
  12983. dir: "ltr",
  12984. width: 0,
  12985. height: 0,
  12986. transform: getCurrentTextTransform(),
  12987. fontName: textState.font.loadedName,
  12988. hasEOL: true
  12989. });
  12990. }
  12991. }
  12992. function addFakeSpaces(width, transf, textOrientation) {
  12993. if (textOrientation * textContentItem.spaceInFlowMin <= width && width <= textOrientation * textContentItem.spaceInFlowMax) {
  12994. if (textContentItem.initialized) {
  12995. resetLastChars();
  12996. textContentItem.str.push(" ");
  12997. }
  12998. return false;
  12999. }
  13000. const fontName = textContentItem.fontName;
  13001. let height = 0;
  13002. if (textContentItem.vertical) {
  13003. height = width;
  13004. width = 0;
  13005. }
  13006. flushTextContentItem();
  13007. resetLastChars();
  13008. textContent.items.push({
  13009. str: " ",
  13010. dir: "ltr",
  13011. width: Math.abs(width),
  13012. height: Math.abs(height),
  13013. transform: transf || getCurrentTextTransform(),
  13014. fontName,
  13015. hasEOL: false
  13016. });
  13017. return true;
  13018. }
  13019. function flushTextContentItem() {
  13020. if (!textContentItem.initialized || !textContentItem.str) {
  13021. return;
  13022. }
  13023. if (!textContentItem.vertical) {
  13024. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  13025. } else {
  13026. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  13027. }
  13028. textContent.items.push(runBidiTransform(textContentItem));
  13029. textContentItem.initialized = false;
  13030. textContentItem.str.length = 0;
  13031. }
  13032. function enqueueChunk() {
  13033. let batch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  13034. const length = textContent.items.length;
  13035. if (length === 0) {
  13036. return;
  13037. }
  13038. if (batch && length < TEXT_CHUNK_BATCH_SIZE) {
  13039. return;
  13040. }
  13041. sink.enqueue(textContent, length);
  13042. textContent.items = [];
  13043. textContent.styles = Object.create(null);
  13044. }
  13045. const timeSlotManager = new TimeSlotManager();
  13046. return new Promise(function promiseBody(resolve, reject) {
  13047. const next = function (promise) {
  13048. enqueueChunk(true);
  13049. Promise.all([promise, sink.ready]).then(function () {
  13050. try {
  13051. promiseBody(resolve, reject);
  13052. } catch (ex) {
  13053. reject(ex);
  13054. }
  13055. }, reject);
  13056. };
  13057. task.ensureNotTerminated();
  13058. timeSlotManager.reset();
  13059. const operation = {};
  13060. let stop,
  13061. args = [];
  13062. while (!(stop = timeSlotManager.check())) {
  13063. args.length = 0;
  13064. operation.args = args;
  13065. if (!preprocessor.read(operation)) {
  13066. break;
  13067. }
  13068. textState = stateManager.state;
  13069. const fn = operation.fn;
  13070. args = operation.args;
  13071. switch (fn | 0) {
  13072. case _util.OPS.setFont:
  13073. var fontNameArg = args[0].name,
  13074. fontSizeArg = args[1];
  13075. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  13076. break;
  13077. }
  13078. flushTextContentItem();
  13079. textState.fontName = fontNameArg;
  13080. textState.fontSize = fontSizeArg;
  13081. next(handleSetFont(fontNameArg, null));
  13082. return;
  13083. case _util.OPS.setTextRise:
  13084. textState.textRise = args[0];
  13085. break;
  13086. case _util.OPS.setHScale:
  13087. textState.textHScale = args[0] / 100;
  13088. break;
  13089. case _util.OPS.setLeading:
  13090. textState.leading = args[0];
  13091. break;
  13092. case _util.OPS.moveText:
  13093. textState.translateTextLineMatrix(args[0], args[1]);
  13094. textState.textMatrix = textState.textLineMatrix.slice();
  13095. break;
  13096. case _util.OPS.setLeadingMoveText:
  13097. textState.leading = -args[1];
  13098. textState.translateTextLineMatrix(args[0], args[1]);
  13099. textState.textMatrix = textState.textLineMatrix.slice();
  13100. break;
  13101. case _util.OPS.nextLine:
  13102. textState.carriageReturn();
  13103. break;
  13104. case _util.OPS.setTextMatrix:
  13105. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  13106. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  13107. updateAdvanceScale();
  13108. break;
  13109. case _util.OPS.setCharSpacing:
  13110. textState.charSpacing = args[0];
  13111. break;
  13112. case _util.OPS.setWordSpacing:
  13113. textState.wordSpacing = args[0];
  13114. break;
  13115. case _util.OPS.beginText:
  13116. textState.textMatrix = _util.IDENTITY_MATRIX.slice();
  13117. textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  13118. break;
  13119. case _util.OPS.showSpacedText:
  13120. if (!stateManager.state.font) {
  13121. self.ensureStateFont(stateManager.state);
  13122. continue;
  13123. }
  13124. const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000;
  13125. const elements = args[0];
  13126. for (let i = 0, ii = elements.length; i < ii - 1; i++) {
  13127. const item = elements[i];
  13128. if (typeof item === "string") {
  13129. showSpacedTextBuffer.push(item);
  13130. } else if (typeof item === "number" && item !== 0) {
  13131. const str = showSpacedTextBuffer.join("");
  13132. showSpacedTextBuffer.length = 0;
  13133. buildTextContentItem({
  13134. chars: str,
  13135. extraSpacing: item * spaceFactor
  13136. });
  13137. }
  13138. }
  13139. const item = elements.at(-1);
  13140. if (typeof item === "string") {
  13141. showSpacedTextBuffer.push(item);
  13142. }
  13143. if (showSpacedTextBuffer.length > 0) {
  13144. const str = showSpacedTextBuffer.join("");
  13145. showSpacedTextBuffer.length = 0;
  13146. buildTextContentItem({
  13147. chars: str,
  13148. extraSpacing: 0
  13149. });
  13150. }
  13151. break;
  13152. case _util.OPS.showText:
  13153. if (!stateManager.state.font) {
  13154. self.ensureStateFont(stateManager.state);
  13155. continue;
  13156. }
  13157. buildTextContentItem({
  13158. chars: args[0],
  13159. extraSpacing: 0
  13160. });
  13161. break;
  13162. case _util.OPS.nextLineShowText:
  13163. if (!stateManager.state.font) {
  13164. self.ensureStateFont(stateManager.state);
  13165. continue;
  13166. }
  13167. textState.carriageReturn();
  13168. buildTextContentItem({
  13169. chars: args[0],
  13170. extraSpacing: 0
  13171. });
  13172. break;
  13173. case _util.OPS.nextLineSetSpacingShowText:
  13174. if (!stateManager.state.font) {
  13175. self.ensureStateFont(stateManager.state);
  13176. continue;
  13177. }
  13178. textState.wordSpacing = args[0];
  13179. textState.charSpacing = args[1];
  13180. textState.carriageReturn();
  13181. buildTextContentItem({
  13182. chars: args[2],
  13183. extraSpacing: 0
  13184. });
  13185. break;
  13186. case _util.OPS.paintXObject:
  13187. flushTextContentItem();
  13188. if (!xobjs) {
  13189. xobjs = resources.get("XObject") || _primitives.Dict.empty;
  13190. }
  13191. var isValidName = args[0] instanceof _primitives.Name;
  13192. var name = args[0].name;
  13193. if (isValidName && emptyXObjectCache.getByName(name)) {
  13194. break;
  13195. }
  13196. next(new Promise(function (resolveXObject, rejectXObject) {
  13197. if (!isValidName) {
  13198. throw new _util.FormatError("XObject must be referred to by name.");
  13199. }
  13200. let xobj = xobjs.getRaw(name);
  13201. if (xobj instanceof _primitives.Ref) {
  13202. if (emptyXObjectCache.getByRef(xobj)) {
  13203. resolveXObject();
  13204. return;
  13205. }
  13206. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  13207. if (globalImage) {
  13208. resolveXObject();
  13209. return;
  13210. }
  13211. xobj = xref.fetch(xobj);
  13212. }
  13213. if (!(xobj instanceof _base_stream.BaseStream)) {
  13214. throw new _util.FormatError("XObject should be a stream");
  13215. }
  13216. const type = xobj.dict.get("Subtype");
  13217. if (!(type instanceof _primitives.Name)) {
  13218. throw new _util.FormatError("XObject should have a Name subtype");
  13219. }
  13220. if (type.name !== "Form") {
  13221. emptyXObjectCache.set(name, xobj.dict.objId, true);
  13222. resolveXObject();
  13223. return;
  13224. }
  13225. const currentState = stateManager.state.clone();
  13226. const xObjStateManager = new StateManager(currentState);
  13227. const matrix = xobj.dict.getArray("Matrix");
  13228. if (Array.isArray(matrix) && matrix.length === 6) {
  13229. xObjStateManager.transform(matrix);
  13230. }
  13231. enqueueChunk();
  13232. const sinkWrapper = {
  13233. enqueueInvoked: false,
  13234. enqueue(chunk, size) {
  13235. this.enqueueInvoked = true;
  13236. sink.enqueue(chunk, size);
  13237. },
  13238. get desiredSize() {
  13239. return sink.desiredSize;
  13240. },
  13241. get ready() {
  13242. return sink.ready;
  13243. }
  13244. };
  13245. self.getTextContent({
  13246. stream: xobj,
  13247. task,
  13248. resources: xobj.dict.get("Resources") || resources,
  13249. stateManager: xObjStateManager,
  13250. combineTextItems,
  13251. includeMarkedContent,
  13252. sink: sinkWrapper,
  13253. seenStyles,
  13254. viewBox
  13255. }).then(function () {
  13256. if (!sinkWrapper.enqueueInvoked) {
  13257. emptyXObjectCache.set(name, xobj.dict.objId, true);
  13258. }
  13259. resolveXObject();
  13260. }, rejectXObject);
  13261. }).catch(function (reason) {
  13262. if (reason instanceof _util.AbortException) {
  13263. return;
  13264. }
  13265. if (self.options.ignoreErrors) {
  13266. (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`);
  13267. return;
  13268. }
  13269. throw reason;
  13270. }));
  13271. return;
  13272. case _util.OPS.setGState:
  13273. isValidName = args[0] instanceof _primitives.Name;
  13274. name = args[0].name;
  13275. if (isValidName && emptyGStateCache.getByName(name)) {
  13276. break;
  13277. }
  13278. next(new Promise(function (resolveGState, rejectGState) {
  13279. if (!isValidName) {
  13280. throw new _util.FormatError("GState must be referred to by name.");
  13281. }
  13282. const extGState = resources.get("ExtGState");
  13283. if (!(extGState instanceof _primitives.Dict)) {
  13284. throw new _util.FormatError("ExtGState should be a dictionary.");
  13285. }
  13286. const gState = extGState.get(name);
  13287. if (!(gState instanceof _primitives.Dict)) {
  13288. throw new _util.FormatError("GState should be a dictionary.");
  13289. }
  13290. const gStateFont = gState.get("Font");
  13291. if (!gStateFont) {
  13292. emptyGStateCache.set(name, gState.objId, true);
  13293. resolveGState();
  13294. return;
  13295. }
  13296. flushTextContentItem();
  13297. textState.fontName = null;
  13298. textState.fontSize = gStateFont[1];
  13299. handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
  13300. }).catch(function (reason) {
  13301. if (reason instanceof _util.AbortException) {
  13302. return;
  13303. }
  13304. if (self.options.ignoreErrors) {
  13305. (0, _util.warn)(`getTextContent - ignoring ExtGState: "${reason}".`);
  13306. return;
  13307. }
  13308. throw reason;
  13309. }));
  13310. return;
  13311. case _util.OPS.beginMarkedContent:
  13312. flushTextContentItem();
  13313. if (includeMarkedContent) {
  13314. textContent.items.push({
  13315. type: "beginMarkedContent",
  13316. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  13317. });
  13318. }
  13319. break;
  13320. case _util.OPS.beginMarkedContentProps:
  13321. flushTextContentItem();
  13322. if (includeMarkedContent) {
  13323. let mcid = null;
  13324. if (args[1] instanceof _primitives.Dict) {
  13325. mcid = args[1].get("MCID");
  13326. }
  13327. textContent.items.push({
  13328. type: "beginMarkedContentProps",
  13329. id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mcid${mcid}` : null,
  13330. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  13331. });
  13332. }
  13333. break;
  13334. case _util.OPS.endMarkedContent:
  13335. flushTextContentItem();
  13336. if (includeMarkedContent) {
  13337. textContent.items.push({
  13338. type: "endMarkedContent"
  13339. });
  13340. }
  13341. break;
  13342. }
  13343. if (textContent.items.length >= sink.desiredSize) {
  13344. stop = true;
  13345. break;
  13346. }
  13347. }
  13348. if (stop) {
  13349. next(deferred);
  13350. return;
  13351. }
  13352. flushTextContentItem();
  13353. enqueueChunk();
  13354. resolve();
  13355. }).catch(reason => {
  13356. if (reason instanceof _util.AbortException) {
  13357. return;
  13358. }
  13359. if (this.options.ignoreErrors) {
  13360. (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  13361. flushTextContentItem();
  13362. enqueueChunk();
  13363. return;
  13364. }
  13365. throw reason;
  13366. });
  13367. }
  13368. extractDataStructures(dict, baseDict, properties) {
  13369. const xref = this.xref;
  13370. let cidToGidBytes;
  13371. const toUnicodePromise = this.readToUnicode(properties.toUnicode || dict.get("ToUnicode") || baseDict.get("ToUnicode"));
  13372. if (properties.composite) {
  13373. const cidSystemInfo = dict.get("CIDSystemInfo");
  13374. if (cidSystemInfo instanceof _primitives.Dict) {
  13375. properties.cidSystemInfo = {
  13376. registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")),
  13377. ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")),
  13378. supplement: cidSystemInfo.get("Supplement")
  13379. };
  13380. }
  13381. try {
  13382. const cidToGidMap = dict.get("CIDToGIDMap");
  13383. if (cidToGidMap instanceof _base_stream.BaseStream) {
  13384. cidToGidBytes = cidToGidMap.getBytes();
  13385. }
  13386. } catch (ex) {
  13387. if (!this.options.ignoreErrors) {
  13388. throw ex;
  13389. }
  13390. (0, _util.warn)(`extractDataStructures - ignoring CIDToGIDMap data: "${ex}".`);
  13391. }
  13392. }
  13393. const differences = [];
  13394. let baseEncodingName = null;
  13395. let encoding;
  13396. if (dict.has("Encoding")) {
  13397. encoding = dict.get("Encoding");
  13398. if (encoding instanceof _primitives.Dict) {
  13399. baseEncodingName = encoding.get("BaseEncoding");
  13400. baseEncodingName = baseEncodingName instanceof _primitives.Name ? baseEncodingName.name : null;
  13401. if (encoding.has("Differences")) {
  13402. const diffEncoding = encoding.get("Differences");
  13403. let index = 0;
  13404. for (let j = 0, jj = diffEncoding.length; j < jj; j++) {
  13405. const data = xref.fetchIfRef(diffEncoding[j]);
  13406. if (typeof data === "number") {
  13407. index = data;
  13408. } else if (data instanceof _primitives.Name) {
  13409. differences[index++] = data.name;
  13410. } else {
  13411. throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);
  13412. }
  13413. }
  13414. }
  13415. } else if (encoding instanceof _primitives.Name) {
  13416. baseEncodingName = encoding.name;
  13417. } else {
  13418. const msg = "Encoding is not a Name nor a Dict";
  13419. if (!this.options.ignoreErrors) {
  13420. throw new _util.FormatError(msg);
  13421. }
  13422. (0, _util.warn)(msg);
  13423. }
  13424. if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
  13425. baseEncodingName = null;
  13426. }
  13427. }
  13428. if (baseEncodingName) {
  13429. properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  13430. } else {
  13431. const isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  13432. const isNonsymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Nonsymbolic);
  13433. encoding = _encodings.StandardEncoding;
  13434. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  13435. encoding = _encodings.WinAnsiEncoding;
  13436. }
  13437. if (isSymbolicFont) {
  13438. encoding = _encodings.MacRomanEncoding;
  13439. if (!properties.file || properties.isInternalFont) {
  13440. if (/Symbol/i.test(properties.name)) {
  13441. encoding = _encodings.SymbolSetEncoding;
  13442. } else if (/Dingbats|Wingdings/i.test(properties.name)) {
  13443. encoding = _encodings.ZapfDingbatsEncoding;
  13444. }
  13445. }
  13446. }
  13447. properties.defaultEncoding = encoding;
  13448. }
  13449. properties.differences = differences;
  13450. properties.baseEncodingName = baseEncodingName;
  13451. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  13452. properties.dict = dict;
  13453. return toUnicodePromise.then(readToUnicode => {
  13454. properties.toUnicode = readToUnicode;
  13455. return this.buildToUnicode(properties);
  13456. }).then(builtToUnicode => {
  13457. properties.toUnicode = builtToUnicode;
  13458. if (cidToGidBytes) {
  13459. properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
  13460. }
  13461. return properties;
  13462. });
  13463. }
  13464. _simpleFontToUnicode(properties) {
  13465. let forceGlyphs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  13466. (0, _util.assert)(!properties.composite, "Must be a simple font.");
  13467. const toUnicode = [];
  13468. const encoding = properties.defaultEncoding.slice();
  13469. const baseEncodingName = properties.baseEncodingName;
  13470. const differences = properties.differences;
  13471. for (const charcode in differences) {
  13472. const glyphName = differences[charcode];
  13473. if (glyphName === ".notdef") {
  13474. continue;
  13475. }
  13476. encoding[charcode] = glyphName;
  13477. }
  13478. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  13479. for (const charcode in encoding) {
  13480. let glyphName = encoding[charcode];
  13481. if (glyphName === "") {
  13482. continue;
  13483. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  13484. let code = 0;
  13485. switch (glyphName[0]) {
  13486. case "G":
  13487. if (glyphName.length === 3) {
  13488. code = parseInt(glyphName.substring(1), 16);
  13489. }
  13490. break;
  13491. case "g":
  13492. if (glyphName.length === 5) {
  13493. code = parseInt(glyphName.substring(1), 16);
  13494. }
  13495. break;
  13496. case "C":
  13497. case "c":
  13498. if (glyphName.length >= 3 && glyphName.length <= 4) {
  13499. const codeStr = glyphName.substring(1);
  13500. if (forceGlyphs) {
  13501. code = parseInt(codeStr, 16);
  13502. break;
  13503. }
  13504. code = +codeStr;
  13505. if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
  13506. return this._simpleFontToUnicode(properties, true);
  13507. }
  13508. }
  13509. break;
  13510. default:
  13511. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  13512. if (unicode !== -1) {
  13513. code = unicode;
  13514. }
  13515. }
  13516. if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
  13517. if (baseEncodingName && code === +charcode) {
  13518. const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  13519. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  13520. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  13521. continue;
  13522. }
  13523. }
  13524. toUnicode[charcode] = String.fromCodePoint(code);
  13525. }
  13526. continue;
  13527. }
  13528. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  13529. }
  13530. return toUnicode;
  13531. }
  13532. async buildToUnicode(properties) {
  13533. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  13534. if (properties.hasIncludedToUnicodeMap) {
  13535. if (!properties.composite && properties.hasEncoding) {
  13536. properties.fallbackToUnicode = this._simpleFontToUnicode(properties);
  13537. }
  13538. return properties.toUnicode;
  13539. }
  13540. if (!properties.composite) {
  13541. return new _to_unicode_map.ToUnicodeMap(this._simpleFontToUnicode(properties));
  13542. }
  13543. 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"))) {
  13544. const {
  13545. registry,
  13546. ordering
  13547. } = properties.cidSystemInfo;
  13548. const ucs2CMapName = _primitives.Name.get(`${registry}-${ordering}-UCS2`);
  13549. const ucs2CMap = await _cmap.CMapFactory.create({
  13550. encoding: ucs2CMapName,
  13551. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  13552. useCMap: null
  13553. });
  13554. const toUnicode = [];
  13555. properties.cMap.forEach(function (charcode, cid) {
  13556. if (cid > 0xffff) {
  13557. throw new _util.FormatError("Max size of CID is 65,535");
  13558. }
  13559. const ucs2 = ucs2CMap.lookup(cid);
  13560. if (ucs2) {
  13561. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  13562. }
  13563. });
  13564. return new _to_unicode_map.ToUnicodeMap(toUnicode);
  13565. }
  13566. return new _to_unicode_map.IdentityToUnicodeMap(properties.firstChar, properties.lastChar);
  13567. }
  13568. readToUnicode(cmapObj) {
  13569. if (!cmapObj) {
  13570. return Promise.resolve(null);
  13571. }
  13572. if (cmapObj instanceof _primitives.Name) {
  13573. return _cmap.CMapFactory.create({
  13574. encoding: cmapObj,
  13575. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  13576. useCMap: null
  13577. }).then(function (cmap) {
  13578. if (cmap instanceof _cmap.IdentityCMap) {
  13579. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  13580. }
  13581. return new _to_unicode_map.ToUnicodeMap(cmap.getMap());
  13582. });
  13583. } else if (cmapObj instanceof _base_stream.BaseStream) {
  13584. return _cmap.CMapFactory.create({
  13585. encoding: cmapObj,
  13586. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  13587. useCMap: null
  13588. }).then(function (cmap) {
  13589. if (cmap instanceof _cmap.IdentityCMap) {
  13590. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  13591. }
  13592. const map = new Array(cmap.length);
  13593. cmap.forEach(function (charCode, token) {
  13594. if (typeof token === "number") {
  13595. map[charCode] = String.fromCodePoint(token);
  13596. return;
  13597. }
  13598. const str = [];
  13599. for (let k = 0; k < token.length; k += 2) {
  13600. const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  13601. if ((w1 & 0xf800) !== 0xd800) {
  13602. str.push(w1);
  13603. continue;
  13604. }
  13605. k += 2;
  13606. const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  13607. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  13608. }
  13609. map[charCode] = String.fromCodePoint(...str);
  13610. });
  13611. return new _to_unicode_map.ToUnicodeMap(map);
  13612. }, reason => {
  13613. if (reason instanceof _util.AbortException) {
  13614. return null;
  13615. }
  13616. if (this.options.ignoreErrors) {
  13617. this.handler.send("UnsupportedFeature", {
  13618. featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode
  13619. });
  13620. (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
  13621. return null;
  13622. }
  13623. throw reason;
  13624. });
  13625. }
  13626. return Promise.resolve(null);
  13627. }
  13628. readCidToGidMap(glyphsData, toUnicode) {
  13629. const result = [];
  13630. for (let j = 0, jj = glyphsData.length; j < jj; j++) {
  13631. const glyphID = glyphsData[j++] << 8 | glyphsData[j];
  13632. const code = j >> 1;
  13633. if (glyphID === 0 && !toUnicode.has(code)) {
  13634. continue;
  13635. }
  13636. result[code] = glyphID;
  13637. }
  13638. return result;
  13639. }
  13640. extractWidths(dict, descriptor, properties) {
  13641. const xref = this.xref;
  13642. let glyphsWidths = [];
  13643. let defaultWidth = 0;
  13644. const glyphsVMetrics = [];
  13645. let defaultVMetrics;
  13646. let i, ii, j, jj, start, code, widths;
  13647. if (properties.composite) {
  13648. defaultWidth = dict.has("DW") ? dict.get("DW") : 1000;
  13649. widths = dict.get("W");
  13650. if (widths) {
  13651. for (i = 0, ii = widths.length; i < ii; i++) {
  13652. start = xref.fetchIfRef(widths[i++]);
  13653. code = xref.fetchIfRef(widths[i]);
  13654. if (Array.isArray(code)) {
  13655. for (j = 0, jj = code.length; j < jj; j++) {
  13656. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  13657. }
  13658. } else {
  13659. const width = xref.fetchIfRef(widths[++i]);
  13660. for (j = start; j <= code; j++) {
  13661. glyphsWidths[j] = width;
  13662. }
  13663. }
  13664. }
  13665. }
  13666. if (properties.vertical) {
  13667. let vmetrics = dict.getArray("DW2") || [880, -1000];
  13668. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  13669. vmetrics = dict.get("W2");
  13670. if (vmetrics) {
  13671. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  13672. start = xref.fetchIfRef(vmetrics[i++]);
  13673. code = xref.fetchIfRef(vmetrics[i]);
  13674. if (Array.isArray(code)) {
  13675. for (j = 0, jj = code.length; j < jj; j++) {
  13676. glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  13677. }
  13678. } else {
  13679. const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  13680. for (j = start; j <= code; j++) {
  13681. glyphsVMetrics[j] = vmetric;
  13682. }
  13683. }
  13684. }
  13685. }
  13686. }
  13687. } else {
  13688. const firstChar = properties.firstChar;
  13689. widths = dict.get("Widths");
  13690. if (widths) {
  13691. j = firstChar;
  13692. for (i = 0, ii = widths.length; i < ii; i++) {
  13693. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  13694. }
  13695. defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0;
  13696. } else {
  13697. const baseFontName = dict.get("BaseFont");
  13698. if (baseFontName instanceof _primitives.Name) {
  13699. const metrics = this.getBaseFontMetrics(baseFontName.name);
  13700. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  13701. defaultWidth = metrics.defaultWidth;
  13702. }
  13703. }
  13704. }
  13705. let isMonospace = true;
  13706. let firstWidth = defaultWidth;
  13707. for (const glyph in glyphsWidths) {
  13708. const glyphWidth = glyphsWidths[glyph];
  13709. if (!glyphWidth) {
  13710. continue;
  13711. }
  13712. if (!firstWidth) {
  13713. firstWidth = glyphWidth;
  13714. continue;
  13715. }
  13716. if (firstWidth !== glyphWidth) {
  13717. isMonospace = false;
  13718. break;
  13719. }
  13720. }
  13721. if (isMonospace) {
  13722. properties.flags |= _fonts_utils.FontFlags.FixedPitch;
  13723. }
  13724. properties.defaultWidth = defaultWidth;
  13725. properties.widths = glyphsWidths;
  13726. properties.defaultVMetrics = defaultVMetrics;
  13727. properties.vmetrics = glyphsVMetrics;
  13728. }
  13729. isSerifFont(baseFontName) {
  13730. const fontNameWoStyle = baseFontName.split("-")[0];
  13731. return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || fontNameWoStyle.search(/serif/gi) !== -1;
  13732. }
  13733. getBaseFontMetrics(name) {
  13734. let defaultWidth = 0;
  13735. let widths = Object.create(null);
  13736. let monospace = false;
  13737. const stdFontMap = (0, _standard_fonts.getStdFontMap)();
  13738. let lookupName = stdFontMap[name] || name;
  13739. const Metrics = (0, _metrics.getMetrics)();
  13740. if (!(lookupName in Metrics)) {
  13741. if (this.isSerifFont(name)) {
  13742. lookupName = "Times-Roman";
  13743. } else {
  13744. lookupName = "Helvetica";
  13745. }
  13746. }
  13747. const glyphWidths = Metrics[lookupName];
  13748. if (typeof glyphWidths === "number") {
  13749. defaultWidth = glyphWidths;
  13750. monospace = true;
  13751. } else {
  13752. widths = glyphWidths();
  13753. }
  13754. return {
  13755. defaultWidth,
  13756. monospace,
  13757. widths
  13758. };
  13759. }
  13760. buildCharCodeToWidth(widthsByGlyphName, properties) {
  13761. const widths = Object.create(null);
  13762. const differences = properties.differences;
  13763. const encoding = properties.defaultEncoding;
  13764. for (let charCode = 0; charCode < 256; charCode++) {
  13765. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  13766. widths[charCode] = widthsByGlyphName[differences[charCode]];
  13767. continue;
  13768. }
  13769. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  13770. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  13771. continue;
  13772. }
  13773. }
  13774. return widths;
  13775. }
  13776. preEvaluateFont(dict) {
  13777. const baseDict = dict;
  13778. let type = dict.get("Subtype");
  13779. if (!(type instanceof _primitives.Name)) {
  13780. throw new _util.FormatError("invalid font Subtype");
  13781. }
  13782. let composite = false;
  13783. let hash, toUnicode;
  13784. if (type.name === "Type0") {
  13785. const df = dict.get("DescendantFonts");
  13786. if (!df) {
  13787. throw new _util.FormatError("Descendant fonts are not specified");
  13788. }
  13789. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  13790. if (!(dict instanceof _primitives.Dict)) {
  13791. throw new _util.FormatError("Descendant font is not a dictionary.");
  13792. }
  13793. type = dict.get("Subtype");
  13794. if (!(type instanceof _primitives.Name)) {
  13795. throw new _util.FormatError("invalid font Subtype");
  13796. }
  13797. composite = true;
  13798. }
  13799. const firstChar = dict.get("FirstChar") || 0,
  13800. lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
  13801. const descriptor = dict.get("FontDescriptor");
  13802. if (descriptor) {
  13803. hash = new _murmurhash.MurmurHash3_64();
  13804. const encoding = baseDict.getRaw("Encoding");
  13805. if (encoding instanceof _primitives.Name) {
  13806. hash.update(encoding.name);
  13807. } else if (encoding instanceof _primitives.Ref) {
  13808. hash.update(encoding.toString());
  13809. } else if (encoding instanceof _primitives.Dict) {
  13810. for (const entry of encoding.getRawValues()) {
  13811. if (entry instanceof _primitives.Name) {
  13812. hash.update(entry.name);
  13813. } else if (entry instanceof _primitives.Ref) {
  13814. hash.update(entry.toString());
  13815. } else if (Array.isArray(entry)) {
  13816. const diffLength = entry.length,
  13817. diffBuf = new Array(diffLength);
  13818. for (let j = 0; j < diffLength; j++) {
  13819. const diffEntry = entry[j];
  13820. if (diffEntry instanceof _primitives.Name) {
  13821. diffBuf[j] = diffEntry.name;
  13822. } else if (typeof diffEntry === "number" || diffEntry instanceof _primitives.Ref) {
  13823. diffBuf[j] = diffEntry.toString();
  13824. }
  13825. }
  13826. hash.update(diffBuf.join());
  13827. }
  13828. }
  13829. }
  13830. hash.update(`${firstChar}-${lastChar}`);
  13831. toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  13832. if (toUnicode instanceof _base_stream.BaseStream) {
  13833. const stream = toUnicode.str || toUnicode;
  13834. const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  13835. hash.update(uint8array);
  13836. } else if (toUnicode instanceof _primitives.Name) {
  13837. hash.update(toUnicode.name);
  13838. }
  13839. const widths = dict.get("Widths") || baseDict.get("Widths");
  13840. if (Array.isArray(widths)) {
  13841. const widthsBuf = [];
  13842. for (const entry of widths) {
  13843. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  13844. widthsBuf.push(entry.toString());
  13845. }
  13846. }
  13847. hash.update(widthsBuf.join());
  13848. }
  13849. if (composite) {
  13850. hash.update("compositeFont");
  13851. const compositeWidths = dict.get("W") || baseDict.get("W");
  13852. if (Array.isArray(compositeWidths)) {
  13853. const widthsBuf = [];
  13854. for (const entry of compositeWidths) {
  13855. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  13856. widthsBuf.push(entry.toString());
  13857. } else if (Array.isArray(entry)) {
  13858. const subWidthsBuf = [];
  13859. for (const element of entry) {
  13860. if (typeof element === "number" || element instanceof _primitives.Ref) {
  13861. subWidthsBuf.push(element.toString());
  13862. }
  13863. }
  13864. widthsBuf.push(`[${subWidthsBuf.join()}]`);
  13865. }
  13866. }
  13867. hash.update(widthsBuf.join());
  13868. }
  13869. const cidToGidMap = dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap");
  13870. if (cidToGidMap instanceof _primitives.Name) {
  13871. hash.update(cidToGidMap.name);
  13872. } else if (cidToGidMap instanceof _primitives.Ref) {
  13873. hash.update(cidToGidMap.toString());
  13874. } else if (cidToGidMap instanceof _base_stream.BaseStream) {
  13875. hash.update(cidToGidMap.peekBytes());
  13876. }
  13877. }
  13878. }
  13879. return {
  13880. descriptor,
  13881. dict,
  13882. baseDict,
  13883. composite,
  13884. type: type.name,
  13885. firstChar,
  13886. lastChar,
  13887. toUnicode,
  13888. hash: hash ? hash.hexdigest() : ""
  13889. };
  13890. }
  13891. async translateFont(_ref9) {
  13892. let {
  13893. descriptor,
  13894. dict,
  13895. baseDict,
  13896. composite,
  13897. type,
  13898. firstChar,
  13899. lastChar,
  13900. toUnicode,
  13901. cssFontInfo
  13902. } = _ref9;
  13903. const isType3Font = type === "Type3";
  13904. let properties;
  13905. if (!descriptor) {
  13906. if (isType3Font) {
  13907. descriptor = new _primitives.Dict(null);
  13908. descriptor.set("FontName", _primitives.Name.get(type));
  13909. descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]);
  13910. } else {
  13911. let baseFontName = dict.get("BaseFont");
  13912. if (!(baseFontName instanceof _primitives.Name)) {
  13913. throw new _util.FormatError("Base font is not specified");
  13914. }
  13915. baseFontName = baseFontName.name.replace(/[,_]/g, "-");
  13916. const metrics = this.getBaseFontMetrics(baseFontName);
  13917. const fontNameWoStyle = baseFontName.split("-")[0];
  13918. 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);
  13919. properties = {
  13920. type,
  13921. name: baseFontName,
  13922. loadedName: baseDict.loadedName,
  13923. widths: metrics.widths,
  13924. defaultWidth: metrics.defaultWidth,
  13925. isSimulatedFlags: true,
  13926. flags,
  13927. firstChar,
  13928. lastChar,
  13929. toUnicode,
  13930. xHeight: 0,
  13931. capHeight: 0,
  13932. italicAngle: 0,
  13933. isType3Font
  13934. };
  13935. const widths = dict.get("Widths");
  13936. const standardFontName = (0, _standard_fonts.getStandardFontName)(baseFontName);
  13937. let file = null;
  13938. if (standardFontName) {
  13939. properties.isStandardFont = true;
  13940. file = await this.fetchStandardFontData(standardFontName);
  13941. properties.isInternalFont = !!file;
  13942. }
  13943. return this.extractDataStructures(dict, dict, properties).then(newProperties => {
  13944. if (widths) {
  13945. const glyphWidths = [];
  13946. let j = firstChar;
  13947. for (let i = 0, ii = widths.length; i < ii; i++) {
  13948. glyphWidths[j++] = this.xref.fetchIfRef(widths[i]);
  13949. }
  13950. newProperties.widths = glyphWidths;
  13951. } else {
  13952. newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
  13953. }
  13954. return new _fonts.Font(baseFontName, file, newProperties);
  13955. });
  13956. }
  13957. }
  13958. let fontName = descriptor.get("FontName");
  13959. let baseFont = dict.get("BaseFont");
  13960. if (typeof fontName === "string") {
  13961. fontName = _primitives.Name.get(fontName);
  13962. }
  13963. if (typeof baseFont === "string") {
  13964. baseFont = _primitives.Name.get(baseFont);
  13965. }
  13966. if (!isType3Font) {
  13967. const fontNameStr = fontName && fontName.name;
  13968. const baseFontStr = baseFont && baseFont.name;
  13969. if (fontNameStr !== baseFontStr) {
  13970. (0, _util.info)(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`);
  13971. if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) {
  13972. fontName = baseFont;
  13973. }
  13974. }
  13975. }
  13976. fontName = fontName || baseFont;
  13977. if (!(fontName instanceof _primitives.Name)) {
  13978. throw new _util.FormatError("invalid font name");
  13979. }
  13980. let fontFile, subtype, length1, length2, length3;
  13981. try {
  13982. fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  13983. } catch (ex) {
  13984. if (!this.options.ignoreErrors) {
  13985. throw ex;
  13986. }
  13987. (0, _util.warn)(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
  13988. fontFile = new _stream.NullStream();
  13989. }
  13990. let isStandardFont = false;
  13991. let isInternalFont = false;
  13992. let glyphScaleFactors = null;
  13993. if (fontFile) {
  13994. if (fontFile.dict) {
  13995. const subtypeEntry = fontFile.dict.get("Subtype");
  13996. if (subtypeEntry instanceof _primitives.Name) {
  13997. subtype = subtypeEntry.name;
  13998. }
  13999. length1 = fontFile.dict.get("Length1");
  14000. length2 = fontFile.dict.get("Length2");
  14001. length3 = fontFile.dict.get("Length3");
  14002. }
  14003. } else if (cssFontInfo) {
  14004. const standardFontName = (0, _xfa_fonts.getXfaFontName)(fontName.name);
  14005. if (standardFontName) {
  14006. cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`;
  14007. cssFontInfo.metrics = standardFontName.metrics || null;
  14008. glyphScaleFactors = standardFontName.factors || null;
  14009. fontFile = await this.fetchStandardFontData(standardFontName.name);
  14010. isInternalFont = !!fontFile;
  14011. baseDict = dict = (0, _xfa_fonts.getXfaFontDict)(fontName.name);
  14012. composite = true;
  14013. }
  14014. } else if (!isType3Font) {
  14015. const standardFontName = (0, _standard_fonts.getStandardFontName)(fontName.name);
  14016. if (standardFontName) {
  14017. isStandardFont = true;
  14018. fontFile = await this.fetchStandardFontData(standardFontName);
  14019. isInternalFont = !!fontFile;
  14020. }
  14021. }
  14022. properties = {
  14023. type,
  14024. name: fontName.name,
  14025. subtype,
  14026. file: fontFile,
  14027. length1,
  14028. length2,
  14029. length3,
  14030. isStandardFont,
  14031. isInternalFont,
  14032. loadedName: baseDict.loadedName,
  14033. composite,
  14034. fixedPitch: false,
  14035. fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
  14036. firstChar,
  14037. lastChar,
  14038. toUnicode,
  14039. bbox: descriptor.getArray("FontBBox") || dict.getArray("FontBBox"),
  14040. ascent: descriptor.get("Ascent"),
  14041. descent: descriptor.get("Descent"),
  14042. xHeight: descriptor.get("XHeight") || 0,
  14043. capHeight: descriptor.get("CapHeight") || 0,
  14044. flags: descriptor.get("Flags"),
  14045. italicAngle: descriptor.get("ItalicAngle") || 0,
  14046. isType3Font,
  14047. cssFontInfo,
  14048. scaleFactors: glyphScaleFactors
  14049. };
  14050. if (composite) {
  14051. const cidEncoding = baseDict.get("Encoding");
  14052. if (cidEncoding instanceof _primitives.Name) {
  14053. properties.cidEncoding = cidEncoding.name;
  14054. }
  14055. const cMap = await _cmap.CMapFactory.create({
  14056. encoding: cidEncoding,
  14057. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  14058. useCMap: null
  14059. });
  14060. properties.cMap = cMap;
  14061. properties.vertical = properties.cMap.vertical;
  14062. }
  14063. return this.extractDataStructures(dict, baseDict, properties).then(newProperties => {
  14064. this.extractWidths(dict, descriptor, newProperties);
  14065. return new _fonts.Font(fontName.name, fontFile, newProperties);
  14066. });
  14067. }
  14068. static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
  14069. function buildPath(fontChar) {
  14070. const glyphName = `${font.loadedName}_path_${fontChar}`;
  14071. try {
  14072. if (font.renderer.hasBuiltPath(fontChar)) {
  14073. return;
  14074. }
  14075. handler.send("commonobj", [glyphName, "FontPath", font.renderer.getPathJs(fontChar)]);
  14076. } catch (reason) {
  14077. if (evaluatorOptions.ignoreErrors) {
  14078. handler.send("UnsupportedFeature", {
  14079. featureId: _util.UNSUPPORTED_FEATURES.errorFontBuildPath
  14080. });
  14081. (0, _util.warn)(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
  14082. return;
  14083. }
  14084. throw reason;
  14085. }
  14086. }
  14087. for (const glyph of glyphs) {
  14088. buildPath(glyph.fontChar);
  14089. const accent = glyph.accent;
  14090. if (accent && accent.fontChar) {
  14091. buildPath(accent.fontChar);
  14092. }
  14093. }
  14094. }
  14095. static get fallbackFontDict() {
  14096. const dict = new _primitives.Dict();
  14097. dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont"));
  14098. dict.set("Type", _primitives.Name.get("FallbackType"));
  14099. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  14100. dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  14101. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  14102. }
  14103. }
  14104. exports.PartialEvaluator = PartialEvaluator;
  14105. class TranslatedFont {
  14106. constructor(_ref10) {
  14107. let {
  14108. loadedName,
  14109. font,
  14110. dict,
  14111. evaluatorOptions
  14112. } = _ref10;
  14113. this.loadedName = loadedName;
  14114. this.font = font;
  14115. this.dict = dict;
  14116. this._evaluatorOptions = evaluatorOptions || DefaultPartialEvaluatorOptions;
  14117. this.type3Loaded = null;
  14118. this.type3Dependencies = font.isType3Font ? new Set() : null;
  14119. this.sent = false;
  14120. }
  14121. send(handler) {
  14122. if (this.sent) {
  14123. return;
  14124. }
  14125. this.sent = true;
  14126. handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._evaluatorOptions.fontExtraProperties)]);
  14127. }
  14128. fallback(handler) {
  14129. if (!this.font.data) {
  14130. return;
  14131. }
  14132. this.font.disableFontFace = true;
  14133. PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, this._evaluatorOptions);
  14134. }
  14135. loadType3Data(evaluator, resources, task) {
  14136. if (this.type3Loaded) {
  14137. return this.type3Loaded;
  14138. }
  14139. if (!this.font.isType3Font) {
  14140. throw new Error("Must be a Type3 font.");
  14141. }
  14142. const type3Evaluator = evaluator.clone({
  14143. ignoreErrors: false
  14144. });
  14145. type3Evaluator.parsingType3Font = true;
  14146. const type3FontRefs = new _primitives.RefSet(evaluator.type3FontRefs);
  14147. if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
  14148. type3FontRefs.put(this.dict.objId);
  14149. }
  14150. type3Evaluator.type3FontRefs = type3FontRefs;
  14151. const translatedFont = this.font,
  14152. type3Dependencies = this.type3Dependencies;
  14153. let loadCharProcsPromise = Promise.resolve();
  14154. const charProcs = this.dict.get("CharProcs");
  14155. const fontResources = this.dict.get("Resources") || resources;
  14156. const charProcOperatorList = Object.create(null);
  14157. const fontBBox = _util.Util.normalizeRect(translatedFont.bbox || [0, 0, 0, 0]),
  14158. width = fontBBox[2] - fontBBox[0],
  14159. height = fontBBox[3] - fontBBox[1];
  14160. const fontBBoxSize = Math.hypot(width, height);
  14161. for (const key of charProcs.getKeys()) {
  14162. loadCharProcsPromise = loadCharProcsPromise.then(() => {
  14163. const glyphStream = charProcs.get(key);
  14164. const operatorList = new _operator_list.OperatorList();
  14165. return type3Evaluator.getOperatorList({
  14166. stream: glyphStream,
  14167. task,
  14168. resources: fontResources,
  14169. operatorList
  14170. }).then(() => {
  14171. if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) {
  14172. this._removeType3ColorOperators(operatorList, fontBBoxSize);
  14173. }
  14174. charProcOperatorList[key] = operatorList.getIR();
  14175. for (const dependency of operatorList.dependencies) {
  14176. type3Dependencies.add(dependency);
  14177. }
  14178. }).catch(function (reason) {
  14179. (0, _util.warn)(`Type3 font resource "${key}" is not available.`);
  14180. const dummyOperatorList = new _operator_list.OperatorList();
  14181. charProcOperatorList[key] = dummyOperatorList.getIR();
  14182. });
  14183. });
  14184. }
  14185. this.type3Loaded = loadCharProcsPromise.then(() => {
  14186. translatedFont.charProcOperatorList = charProcOperatorList;
  14187. if (this._bbox) {
  14188. translatedFont.isCharBBox = true;
  14189. translatedFont.bbox = this._bbox;
  14190. }
  14191. });
  14192. return this.type3Loaded;
  14193. }
  14194. _removeType3ColorOperators(operatorList) {
  14195. let fontBBoxSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : NaN;
  14196. const charBBox = _util.Util.normalizeRect(operatorList.argsArray[0].slice(2)),
  14197. width = charBBox[2] - charBBox[0],
  14198. height = charBBox[3] - charBBox[1];
  14199. const charBBoxSize = Math.hypot(width, height);
  14200. if (width === 0 || height === 0) {
  14201. operatorList.fnArray.splice(0, 1);
  14202. operatorList.argsArray.splice(0, 1);
  14203. } else if (fontBBoxSize === 0 || Math.round(charBBoxSize / fontBBoxSize) >= 10) {
  14204. if (!this._bbox) {
  14205. this._bbox = [Infinity, Infinity, -Infinity, -Infinity];
  14206. }
  14207. this._bbox[0] = Math.min(this._bbox[0], charBBox[0]);
  14208. this._bbox[1] = Math.min(this._bbox[1], charBBox[1]);
  14209. this._bbox[2] = Math.max(this._bbox[2], charBBox[2]);
  14210. this._bbox[3] = Math.max(this._bbox[3], charBBox[3]);
  14211. }
  14212. let i = 0,
  14213. ii = operatorList.length;
  14214. while (i < ii) {
  14215. switch (operatorList.fnArray[i]) {
  14216. case _util.OPS.setCharWidthAndBounds:
  14217. break;
  14218. case _util.OPS.setStrokeColorSpace:
  14219. case _util.OPS.setFillColorSpace:
  14220. case _util.OPS.setStrokeColor:
  14221. case _util.OPS.setStrokeColorN:
  14222. case _util.OPS.setFillColor:
  14223. case _util.OPS.setFillColorN:
  14224. case _util.OPS.setStrokeGray:
  14225. case _util.OPS.setFillGray:
  14226. case _util.OPS.setStrokeRGBColor:
  14227. case _util.OPS.setFillRGBColor:
  14228. case _util.OPS.setStrokeCMYKColor:
  14229. case _util.OPS.setFillCMYKColor:
  14230. case _util.OPS.shadingFill:
  14231. case _util.OPS.setRenderingIntent:
  14232. operatorList.fnArray.splice(i, 1);
  14233. operatorList.argsArray.splice(i, 1);
  14234. ii--;
  14235. continue;
  14236. case _util.OPS.setGState:
  14237. const [gStateObj] = operatorList.argsArray[i];
  14238. let j = 0,
  14239. jj = gStateObj.length;
  14240. while (j < jj) {
  14241. const [gStateKey] = gStateObj[j];
  14242. switch (gStateKey) {
  14243. case "TR":
  14244. case "TR2":
  14245. case "HT":
  14246. case "BG":
  14247. case "BG2":
  14248. case "UCR":
  14249. case "UCR2":
  14250. gStateObj.splice(j, 1);
  14251. jj--;
  14252. continue;
  14253. }
  14254. j++;
  14255. }
  14256. break;
  14257. }
  14258. i++;
  14259. }
  14260. }
  14261. }
  14262. class StateManager {
  14263. constructor() {
  14264. let initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new EvalState();
  14265. this.state = initialState;
  14266. this.stateStack = [];
  14267. }
  14268. save() {
  14269. const old = this.state;
  14270. this.stateStack.push(this.state);
  14271. this.state = old.clone();
  14272. }
  14273. restore() {
  14274. const prev = this.stateStack.pop();
  14275. if (prev) {
  14276. this.state = prev;
  14277. }
  14278. }
  14279. transform(args) {
  14280. this.state.ctm = _util.Util.transform(this.state.ctm, args);
  14281. }
  14282. }
  14283. class TextState {
  14284. constructor() {
  14285. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  14286. this.fontName = null;
  14287. this.fontSize = 0;
  14288. this.font = null;
  14289. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  14290. this.textMatrix = _util.IDENTITY_MATRIX.slice();
  14291. this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  14292. this.charSpacing = 0;
  14293. this.wordSpacing = 0;
  14294. this.leading = 0;
  14295. this.textHScale = 1;
  14296. this.textRise = 0;
  14297. }
  14298. setTextMatrix(a, b, c, d, e, f) {
  14299. const m = this.textMatrix;
  14300. m[0] = a;
  14301. m[1] = b;
  14302. m[2] = c;
  14303. m[3] = d;
  14304. m[4] = e;
  14305. m[5] = f;
  14306. }
  14307. setTextLineMatrix(a, b, c, d, e, f) {
  14308. const m = this.textLineMatrix;
  14309. m[0] = a;
  14310. m[1] = b;
  14311. m[2] = c;
  14312. m[3] = d;
  14313. m[4] = e;
  14314. m[5] = f;
  14315. }
  14316. translateTextMatrix(x, y) {
  14317. const m = this.textMatrix;
  14318. m[4] = m[0] * x + m[2] * y + m[4];
  14319. m[5] = m[1] * x + m[3] * y + m[5];
  14320. }
  14321. translateTextLineMatrix(x, y) {
  14322. const m = this.textLineMatrix;
  14323. m[4] = m[0] * x + m[2] * y + m[4];
  14324. m[5] = m[1] * x + m[3] * y + m[5];
  14325. }
  14326. carriageReturn() {
  14327. this.translateTextLineMatrix(0, -this.leading);
  14328. this.textMatrix = this.textLineMatrix.slice();
  14329. }
  14330. clone() {
  14331. const clone = Object.create(this);
  14332. clone.textMatrix = this.textMatrix.slice();
  14333. clone.textLineMatrix = this.textLineMatrix.slice();
  14334. clone.fontMatrix = this.fontMatrix.slice();
  14335. return clone;
  14336. }
  14337. }
  14338. class EvalState {
  14339. constructor() {
  14340. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  14341. this.font = null;
  14342. this.textRenderingMode = _util.TextRenderingMode.FILL;
  14343. this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  14344. this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  14345. }
  14346. clone() {
  14347. return Object.create(this);
  14348. }
  14349. }
  14350. class EvaluatorPreprocessor {
  14351. static get opMap() {
  14352. const getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  14353. t.w = {
  14354. id: _util.OPS.setLineWidth,
  14355. numArgs: 1,
  14356. variableArgs: false
  14357. };
  14358. t.J = {
  14359. id: _util.OPS.setLineCap,
  14360. numArgs: 1,
  14361. variableArgs: false
  14362. };
  14363. t.j = {
  14364. id: _util.OPS.setLineJoin,
  14365. numArgs: 1,
  14366. variableArgs: false
  14367. };
  14368. t.M = {
  14369. id: _util.OPS.setMiterLimit,
  14370. numArgs: 1,
  14371. variableArgs: false
  14372. };
  14373. t.d = {
  14374. id: _util.OPS.setDash,
  14375. numArgs: 2,
  14376. variableArgs: false
  14377. };
  14378. t.ri = {
  14379. id: _util.OPS.setRenderingIntent,
  14380. numArgs: 1,
  14381. variableArgs: false
  14382. };
  14383. t.i = {
  14384. id: _util.OPS.setFlatness,
  14385. numArgs: 1,
  14386. variableArgs: false
  14387. };
  14388. t.gs = {
  14389. id: _util.OPS.setGState,
  14390. numArgs: 1,
  14391. variableArgs: false
  14392. };
  14393. t.q = {
  14394. id: _util.OPS.save,
  14395. numArgs: 0,
  14396. variableArgs: false
  14397. };
  14398. t.Q = {
  14399. id: _util.OPS.restore,
  14400. numArgs: 0,
  14401. variableArgs: false
  14402. };
  14403. t.cm = {
  14404. id: _util.OPS.transform,
  14405. numArgs: 6,
  14406. variableArgs: false
  14407. };
  14408. t.m = {
  14409. id: _util.OPS.moveTo,
  14410. numArgs: 2,
  14411. variableArgs: false
  14412. };
  14413. t.l = {
  14414. id: _util.OPS.lineTo,
  14415. numArgs: 2,
  14416. variableArgs: false
  14417. };
  14418. t.c = {
  14419. id: _util.OPS.curveTo,
  14420. numArgs: 6,
  14421. variableArgs: false
  14422. };
  14423. t.v = {
  14424. id: _util.OPS.curveTo2,
  14425. numArgs: 4,
  14426. variableArgs: false
  14427. };
  14428. t.y = {
  14429. id: _util.OPS.curveTo3,
  14430. numArgs: 4,
  14431. variableArgs: false
  14432. };
  14433. t.h = {
  14434. id: _util.OPS.closePath,
  14435. numArgs: 0,
  14436. variableArgs: false
  14437. };
  14438. t.re = {
  14439. id: _util.OPS.rectangle,
  14440. numArgs: 4,
  14441. variableArgs: false
  14442. };
  14443. t.S = {
  14444. id: _util.OPS.stroke,
  14445. numArgs: 0,
  14446. variableArgs: false
  14447. };
  14448. t.s = {
  14449. id: _util.OPS.closeStroke,
  14450. numArgs: 0,
  14451. variableArgs: false
  14452. };
  14453. t.f = {
  14454. id: _util.OPS.fill,
  14455. numArgs: 0,
  14456. variableArgs: false
  14457. };
  14458. t.F = {
  14459. id: _util.OPS.fill,
  14460. numArgs: 0,
  14461. variableArgs: false
  14462. };
  14463. t["f*"] = {
  14464. id: _util.OPS.eoFill,
  14465. numArgs: 0,
  14466. variableArgs: false
  14467. };
  14468. t.B = {
  14469. id: _util.OPS.fillStroke,
  14470. numArgs: 0,
  14471. variableArgs: false
  14472. };
  14473. t["B*"] = {
  14474. id: _util.OPS.eoFillStroke,
  14475. numArgs: 0,
  14476. variableArgs: false
  14477. };
  14478. t.b = {
  14479. id: _util.OPS.closeFillStroke,
  14480. numArgs: 0,
  14481. variableArgs: false
  14482. };
  14483. t["b*"] = {
  14484. id: _util.OPS.closeEOFillStroke,
  14485. numArgs: 0,
  14486. variableArgs: false
  14487. };
  14488. t.n = {
  14489. id: _util.OPS.endPath,
  14490. numArgs: 0,
  14491. variableArgs: false
  14492. };
  14493. t.W = {
  14494. id: _util.OPS.clip,
  14495. numArgs: 0,
  14496. variableArgs: false
  14497. };
  14498. t["W*"] = {
  14499. id: _util.OPS.eoClip,
  14500. numArgs: 0,
  14501. variableArgs: false
  14502. };
  14503. t.BT = {
  14504. id: _util.OPS.beginText,
  14505. numArgs: 0,
  14506. variableArgs: false
  14507. };
  14508. t.ET = {
  14509. id: _util.OPS.endText,
  14510. numArgs: 0,
  14511. variableArgs: false
  14512. };
  14513. t.Tc = {
  14514. id: _util.OPS.setCharSpacing,
  14515. numArgs: 1,
  14516. variableArgs: false
  14517. };
  14518. t.Tw = {
  14519. id: _util.OPS.setWordSpacing,
  14520. numArgs: 1,
  14521. variableArgs: false
  14522. };
  14523. t.Tz = {
  14524. id: _util.OPS.setHScale,
  14525. numArgs: 1,
  14526. variableArgs: false
  14527. };
  14528. t.TL = {
  14529. id: _util.OPS.setLeading,
  14530. numArgs: 1,
  14531. variableArgs: false
  14532. };
  14533. t.Tf = {
  14534. id: _util.OPS.setFont,
  14535. numArgs: 2,
  14536. variableArgs: false
  14537. };
  14538. t.Tr = {
  14539. id: _util.OPS.setTextRenderingMode,
  14540. numArgs: 1,
  14541. variableArgs: false
  14542. };
  14543. t.Ts = {
  14544. id: _util.OPS.setTextRise,
  14545. numArgs: 1,
  14546. variableArgs: false
  14547. };
  14548. t.Td = {
  14549. id: _util.OPS.moveText,
  14550. numArgs: 2,
  14551. variableArgs: false
  14552. };
  14553. t.TD = {
  14554. id: _util.OPS.setLeadingMoveText,
  14555. numArgs: 2,
  14556. variableArgs: false
  14557. };
  14558. t.Tm = {
  14559. id: _util.OPS.setTextMatrix,
  14560. numArgs: 6,
  14561. variableArgs: false
  14562. };
  14563. t["T*"] = {
  14564. id: _util.OPS.nextLine,
  14565. numArgs: 0,
  14566. variableArgs: false
  14567. };
  14568. t.Tj = {
  14569. id: _util.OPS.showText,
  14570. numArgs: 1,
  14571. variableArgs: false
  14572. };
  14573. t.TJ = {
  14574. id: _util.OPS.showSpacedText,
  14575. numArgs: 1,
  14576. variableArgs: false
  14577. };
  14578. t["'"] = {
  14579. id: _util.OPS.nextLineShowText,
  14580. numArgs: 1,
  14581. variableArgs: false
  14582. };
  14583. t['"'] = {
  14584. id: _util.OPS.nextLineSetSpacingShowText,
  14585. numArgs: 3,
  14586. variableArgs: false
  14587. };
  14588. t.d0 = {
  14589. id: _util.OPS.setCharWidth,
  14590. numArgs: 2,
  14591. variableArgs: false
  14592. };
  14593. t.d1 = {
  14594. id: _util.OPS.setCharWidthAndBounds,
  14595. numArgs: 6,
  14596. variableArgs: false
  14597. };
  14598. t.CS = {
  14599. id: _util.OPS.setStrokeColorSpace,
  14600. numArgs: 1,
  14601. variableArgs: false
  14602. };
  14603. t.cs = {
  14604. id: _util.OPS.setFillColorSpace,
  14605. numArgs: 1,
  14606. variableArgs: false
  14607. };
  14608. t.SC = {
  14609. id: _util.OPS.setStrokeColor,
  14610. numArgs: 4,
  14611. variableArgs: true
  14612. };
  14613. t.SCN = {
  14614. id: _util.OPS.setStrokeColorN,
  14615. numArgs: 33,
  14616. variableArgs: true
  14617. };
  14618. t.sc = {
  14619. id: _util.OPS.setFillColor,
  14620. numArgs: 4,
  14621. variableArgs: true
  14622. };
  14623. t.scn = {
  14624. id: _util.OPS.setFillColorN,
  14625. numArgs: 33,
  14626. variableArgs: true
  14627. };
  14628. t.G = {
  14629. id: _util.OPS.setStrokeGray,
  14630. numArgs: 1,
  14631. variableArgs: false
  14632. };
  14633. t.g = {
  14634. id: _util.OPS.setFillGray,
  14635. numArgs: 1,
  14636. variableArgs: false
  14637. };
  14638. t.RG = {
  14639. id: _util.OPS.setStrokeRGBColor,
  14640. numArgs: 3,
  14641. variableArgs: false
  14642. };
  14643. t.rg = {
  14644. id: _util.OPS.setFillRGBColor,
  14645. numArgs: 3,
  14646. variableArgs: false
  14647. };
  14648. t.K = {
  14649. id: _util.OPS.setStrokeCMYKColor,
  14650. numArgs: 4,
  14651. variableArgs: false
  14652. };
  14653. t.k = {
  14654. id: _util.OPS.setFillCMYKColor,
  14655. numArgs: 4,
  14656. variableArgs: false
  14657. };
  14658. t.sh = {
  14659. id: _util.OPS.shadingFill,
  14660. numArgs: 1,
  14661. variableArgs: false
  14662. };
  14663. t.BI = {
  14664. id: _util.OPS.beginInlineImage,
  14665. numArgs: 0,
  14666. variableArgs: false
  14667. };
  14668. t.ID = {
  14669. id: _util.OPS.beginImageData,
  14670. numArgs: 0,
  14671. variableArgs: false
  14672. };
  14673. t.EI = {
  14674. id: _util.OPS.endInlineImage,
  14675. numArgs: 1,
  14676. variableArgs: false
  14677. };
  14678. t.Do = {
  14679. id: _util.OPS.paintXObject,
  14680. numArgs: 1,
  14681. variableArgs: false
  14682. };
  14683. t.MP = {
  14684. id: _util.OPS.markPoint,
  14685. numArgs: 1,
  14686. variableArgs: false
  14687. };
  14688. t.DP = {
  14689. id: _util.OPS.markPointProps,
  14690. numArgs: 2,
  14691. variableArgs: false
  14692. };
  14693. t.BMC = {
  14694. id: _util.OPS.beginMarkedContent,
  14695. numArgs: 1,
  14696. variableArgs: false
  14697. };
  14698. t.BDC = {
  14699. id: _util.OPS.beginMarkedContentProps,
  14700. numArgs: 2,
  14701. variableArgs: false
  14702. };
  14703. t.EMC = {
  14704. id: _util.OPS.endMarkedContent,
  14705. numArgs: 0,
  14706. variableArgs: false
  14707. };
  14708. t.BX = {
  14709. id: _util.OPS.beginCompat,
  14710. numArgs: 0,
  14711. variableArgs: false
  14712. };
  14713. t.EX = {
  14714. id: _util.OPS.endCompat,
  14715. numArgs: 0,
  14716. variableArgs: false
  14717. };
  14718. t.BM = null;
  14719. t.BD = null;
  14720. t.true = null;
  14721. t.fa = null;
  14722. t.fal = null;
  14723. t.fals = null;
  14724. t.false = null;
  14725. t.nu = null;
  14726. t.nul = null;
  14727. t.null = null;
  14728. });
  14729. return (0, _util.shadow)(this, "opMap", getOPMap());
  14730. }
  14731. static get MAX_INVALID_PATH_OPS() {
  14732. return (0, _util.shadow)(this, "MAX_INVALID_PATH_OPS", 10);
  14733. }
  14734. constructor(stream, xref) {
  14735. let stateManager = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new StateManager();
  14736. this.parser = new _parser.Parser({
  14737. lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap),
  14738. xref
  14739. });
  14740. this.stateManager = stateManager;
  14741. this.nonProcessedArgs = [];
  14742. this._isPathOp = false;
  14743. this._numInvalidPathOPS = 0;
  14744. }
  14745. get savedStatesDepth() {
  14746. return this.stateManager.stateStack.length;
  14747. }
  14748. read(operation) {
  14749. let args = operation.args;
  14750. while (true) {
  14751. const obj = this.parser.getObj();
  14752. if (obj instanceof _primitives.Cmd) {
  14753. const cmd = obj.cmd;
  14754. const opSpec = EvaluatorPreprocessor.opMap[cmd];
  14755. if (!opSpec) {
  14756. (0, _util.warn)(`Unknown command "${cmd}".`);
  14757. continue;
  14758. }
  14759. const fn = opSpec.id;
  14760. const numArgs = opSpec.numArgs;
  14761. let argsLength = args !== null ? args.length : 0;
  14762. if (!this._isPathOp) {
  14763. this._numInvalidPathOPS = 0;
  14764. }
  14765. this._isPathOp = fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath;
  14766. if (!opSpec.variableArgs) {
  14767. if (argsLength !== numArgs) {
  14768. const nonProcessedArgs = this.nonProcessedArgs;
  14769. while (argsLength > numArgs) {
  14770. nonProcessedArgs.push(args.shift());
  14771. argsLength--;
  14772. }
  14773. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  14774. if (args === null) {
  14775. args = [];
  14776. }
  14777. args.unshift(nonProcessedArgs.pop());
  14778. argsLength++;
  14779. }
  14780. }
  14781. if (argsLength < numArgs) {
  14782. const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
  14783. if (this._isPathOp && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
  14784. throw new _util.FormatError(`Invalid ${partialMsg}`);
  14785. }
  14786. (0, _util.warn)(`Skipping ${partialMsg}`);
  14787. if (args !== null) {
  14788. args.length = 0;
  14789. }
  14790. continue;
  14791. }
  14792. } else if (argsLength > numArgs) {
  14793. (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
  14794. }
  14795. this.preprocessCommand(fn, args);
  14796. operation.fn = fn;
  14797. operation.args = args;
  14798. return true;
  14799. }
  14800. if (obj === _primitives.EOF) {
  14801. return false;
  14802. }
  14803. if (obj !== null) {
  14804. if (args === null) {
  14805. args = [];
  14806. }
  14807. args.push(obj);
  14808. if (args.length > 33) {
  14809. throw new _util.FormatError("Too many arguments");
  14810. }
  14811. }
  14812. }
  14813. }
  14814. preprocessCommand(fn, args) {
  14815. switch (fn | 0) {
  14816. case _util.OPS.save:
  14817. this.stateManager.save();
  14818. break;
  14819. case _util.OPS.restore:
  14820. this.stateManager.restore();
  14821. break;
  14822. case _util.OPS.transform:
  14823. this.stateManager.transform(args);
  14824. break;
  14825. }
  14826. }
  14827. }
  14828. exports.EvaluatorPreprocessor = EvaluatorPreprocessor;
  14829. /***/ }),
  14830. /* 141 */
  14831. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14832. "use strict";
  14833. Object.defineProperty(exports, "__esModule", ({
  14834. value: true
  14835. }));
  14836. exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0;
  14837. var _util = __w_pdfjs_require__(2);
  14838. var _primitives = __w_pdfjs_require__(130);
  14839. var _base_stream = __w_pdfjs_require__(132);
  14840. var _parser = __w_pdfjs_require__(142);
  14841. var _core_utils = __w_pdfjs_require__(131);
  14842. var _stream = __w_pdfjs_require__(135);
  14843. 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"];
  14844. const MAX_MAP_RANGE = 2 ** 24 - 1;
  14845. class CMap {
  14846. constructor() {
  14847. let builtInCMap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  14848. this.codespaceRanges = [[], [], [], []];
  14849. this.numCodespaceRanges = 0;
  14850. this._map = [];
  14851. this.name = "";
  14852. this.vertical = false;
  14853. this.useCMap = null;
  14854. this.builtInCMap = builtInCMap;
  14855. }
  14856. addCodespaceRange(n, low, high) {
  14857. this.codespaceRanges[n - 1].push(low, high);
  14858. this.numCodespaceRanges++;
  14859. }
  14860. mapCidRange(low, high, dstLow) {
  14861. if (high - low > MAX_MAP_RANGE) {
  14862. throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
  14863. }
  14864. while (low <= high) {
  14865. this._map[low++] = dstLow++;
  14866. }
  14867. }
  14868. mapBfRange(low, high, dstLow) {
  14869. if (high - low > MAX_MAP_RANGE) {
  14870. throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
  14871. }
  14872. const lastByte = dstLow.length - 1;
  14873. while (low <= high) {
  14874. this._map[low++] = dstLow;
  14875. const nextCharCode = dstLow.charCodeAt(lastByte) + 1;
  14876. if (nextCharCode > 0xff) {
  14877. dstLow = dstLow.substring(0, lastByte - 1) + String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 1) + "\x00";
  14878. continue;
  14879. }
  14880. dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(nextCharCode);
  14881. }
  14882. }
  14883. mapBfRangeToArray(low, high, array) {
  14884. if (high - low > MAX_MAP_RANGE) {
  14885. throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
  14886. }
  14887. const ii = array.length;
  14888. let i = 0;
  14889. while (low <= high && i < ii) {
  14890. this._map[low] = array[i++];
  14891. ++low;
  14892. }
  14893. }
  14894. mapOne(src, dst) {
  14895. this._map[src] = dst;
  14896. }
  14897. lookup(code) {
  14898. return this._map[code];
  14899. }
  14900. contains(code) {
  14901. return this._map[code] !== undefined;
  14902. }
  14903. forEach(callback) {
  14904. const map = this._map;
  14905. const length = map.length;
  14906. if (length <= 0x10000) {
  14907. for (let i = 0; i < length; i++) {
  14908. if (map[i] !== undefined) {
  14909. callback(i, map[i]);
  14910. }
  14911. }
  14912. } else {
  14913. for (const i in map) {
  14914. callback(i, map[i]);
  14915. }
  14916. }
  14917. }
  14918. charCodeOf(value) {
  14919. const map = this._map;
  14920. if (map.length <= 0x10000) {
  14921. return map.indexOf(value);
  14922. }
  14923. for (const charCode in map) {
  14924. if (map[charCode] === value) {
  14925. return charCode | 0;
  14926. }
  14927. }
  14928. return -1;
  14929. }
  14930. getMap() {
  14931. return this._map;
  14932. }
  14933. readCharCode(str, offset, out) {
  14934. let c = 0;
  14935. const codespaceRanges = this.codespaceRanges;
  14936. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  14937. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  14938. const codespaceRange = codespaceRanges[n];
  14939. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  14940. const low = codespaceRange[k++];
  14941. const high = codespaceRange[k++];
  14942. if (c >= low && c <= high) {
  14943. out.charcode = c;
  14944. out.length = n + 1;
  14945. return;
  14946. }
  14947. }
  14948. }
  14949. out.charcode = 0;
  14950. out.length = 1;
  14951. }
  14952. getCharCodeLength(charCode) {
  14953. const codespaceRanges = this.codespaceRanges;
  14954. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  14955. const codespaceRange = codespaceRanges[n];
  14956. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  14957. const low = codespaceRange[k++];
  14958. const high = codespaceRange[k++];
  14959. if (charCode >= low && charCode <= high) {
  14960. return n + 1;
  14961. }
  14962. }
  14963. }
  14964. return 1;
  14965. }
  14966. get length() {
  14967. return this._map.length;
  14968. }
  14969. get isIdentityCMap() {
  14970. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  14971. return false;
  14972. }
  14973. if (this._map.length !== 0x10000) {
  14974. return false;
  14975. }
  14976. for (let i = 0; i < 0x10000; i++) {
  14977. if (this._map[i] !== i) {
  14978. return false;
  14979. }
  14980. }
  14981. return true;
  14982. }
  14983. }
  14984. exports.CMap = CMap;
  14985. class IdentityCMap extends CMap {
  14986. constructor(vertical, n) {
  14987. super();
  14988. this.vertical = vertical;
  14989. this.addCodespaceRange(n, 0, 0xffff);
  14990. }
  14991. mapCidRange(low, high, dstLow) {
  14992. (0, _util.unreachable)("should not call mapCidRange");
  14993. }
  14994. mapBfRange(low, high, dstLow) {
  14995. (0, _util.unreachable)("should not call mapBfRange");
  14996. }
  14997. mapBfRangeToArray(low, high, array) {
  14998. (0, _util.unreachable)("should not call mapBfRangeToArray");
  14999. }
  15000. mapOne(src, dst) {
  15001. (0, _util.unreachable)("should not call mapCidOne");
  15002. }
  15003. lookup(code) {
  15004. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  15005. }
  15006. contains(code) {
  15007. return Number.isInteger(code) && code <= 0xffff;
  15008. }
  15009. forEach(callback) {
  15010. for (let i = 0; i <= 0xffff; i++) {
  15011. callback(i, i);
  15012. }
  15013. }
  15014. charCodeOf(value) {
  15015. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  15016. }
  15017. getMap() {
  15018. const map = new Array(0x10000);
  15019. for (let i = 0; i <= 0xffff; i++) {
  15020. map[i] = i;
  15021. }
  15022. return map;
  15023. }
  15024. get length() {
  15025. return 0x10000;
  15026. }
  15027. get isIdentityCMap() {
  15028. (0, _util.unreachable)("should not access .isIdentityCMap");
  15029. }
  15030. }
  15031. exports.IdentityCMap = IdentityCMap;
  15032. const BinaryCMapReader = function BinaryCMapReaderClosure() {
  15033. function hexToInt(a, size) {
  15034. let n = 0;
  15035. for (let i = 0; i <= size; i++) {
  15036. n = n << 8 | a[i];
  15037. }
  15038. return n >>> 0;
  15039. }
  15040. function hexToStr(a, size) {
  15041. if (size === 1) {
  15042. return String.fromCharCode(a[0], a[1]);
  15043. }
  15044. if (size === 3) {
  15045. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  15046. }
  15047. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  15048. }
  15049. function addHex(a, b, size) {
  15050. let c = 0;
  15051. for (let i = size; i >= 0; i--) {
  15052. c += a[i] + b[i];
  15053. a[i] = c & 255;
  15054. c >>= 8;
  15055. }
  15056. }
  15057. function incHex(a, size) {
  15058. let c = 1;
  15059. for (let i = size; i >= 0 && c > 0; i--) {
  15060. c += a[i];
  15061. a[i] = c & 255;
  15062. c >>= 8;
  15063. }
  15064. }
  15065. const MAX_NUM_SIZE = 16;
  15066. const MAX_ENCODED_NUM_SIZE = 19;
  15067. class BinaryCMapStream {
  15068. constructor(data) {
  15069. this.buffer = data;
  15070. this.pos = 0;
  15071. this.end = data.length;
  15072. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  15073. }
  15074. readByte() {
  15075. if (this.pos >= this.end) {
  15076. return -1;
  15077. }
  15078. return this.buffer[this.pos++];
  15079. }
  15080. readNumber() {
  15081. let n = 0;
  15082. let last;
  15083. do {
  15084. const b = this.readByte();
  15085. if (b < 0) {
  15086. throw new _util.FormatError("unexpected EOF in bcmap");
  15087. }
  15088. last = !(b & 0x80);
  15089. n = n << 7 | b & 0x7f;
  15090. } while (!last);
  15091. return n;
  15092. }
  15093. readSigned() {
  15094. const n = this.readNumber();
  15095. return n & 1 ? ~(n >>> 1) : n >>> 1;
  15096. }
  15097. readHex(num, size) {
  15098. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  15099. this.pos += size + 1;
  15100. }
  15101. readHexNumber(num, size) {
  15102. let last;
  15103. const stack = this.tmpBuf;
  15104. let sp = 0;
  15105. do {
  15106. const b = this.readByte();
  15107. if (b < 0) {
  15108. throw new _util.FormatError("unexpected EOF in bcmap");
  15109. }
  15110. last = !(b & 0x80);
  15111. stack[sp++] = b & 0x7f;
  15112. } while (!last);
  15113. let i = size,
  15114. buffer = 0,
  15115. bufferSize = 0;
  15116. while (i >= 0) {
  15117. while (bufferSize < 8 && stack.length > 0) {
  15118. buffer |= stack[--sp] << bufferSize;
  15119. bufferSize += 7;
  15120. }
  15121. num[i] = buffer & 255;
  15122. i--;
  15123. buffer >>= 8;
  15124. bufferSize -= 8;
  15125. }
  15126. }
  15127. readHexSigned(num, size) {
  15128. this.readHexNumber(num, size);
  15129. const sign = num[size] & 1 ? 255 : 0;
  15130. let c = 0;
  15131. for (let i = 0; i <= size; i++) {
  15132. c = (c & 1) << 8 | num[i];
  15133. num[i] = c >> 1 ^ sign;
  15134. }
  15135. }
  15136. readString() {
  15137. const len = this.readNumber();
  15138. let s = "";
  15139. for (let i = 0; i < len; i++) {
  15140. s += String.fromCharCode(this.readNumber());
  15141. }
  15142. return s;
  15143. }
  15144. }
  15145. class BinaryCMapReader {
  15146. async process(data, cMap, extend) {
  15147. const stream = new BinaryCMapStream(data);
  15148. const header = stream.readByte();
  15149. cMap.vertical = !!(header & 1);
  15150. let useCMap = null;
  15151. const start = new Uint8Array(MAX_NUM_SIZE);
  15152. const end = new Uint8Array(MAX_NUM_SIZE);
  15153. const char = new Uint8Array(MAX_NUM_SIZE);
  15154. const charCode = new Uint8Array(MAX_NUM_SIZE);
  15155. const tmp = new Uint8Array(MAX_NUM_SIZE);
  15156. let code;
  15157. let b;
  15158. while ((b = stream.readByte()) >= 0) {
  15159. const type = b >> 5;
  15160. if (type === 7) {
  15161. switch (b & 0x1f) {
  15162. case 0:
  15163. stream.readString();
  15164. break;
  15165. case 1:
  15166. useCMap = stream.readString();
  15167. break;
  15168. }
  15169. continue;
  15170. }
  15171. const sequence = !!(b & 0x10);
  15172. const dataSize = b & 15;
  15173. if (dataSize + 1 > MAX_NUM_SIZE) {
  15174. throw new Error("BinaryCMapReader.process: Invalid dataSize.");
  15175. }
  15176. const ucs2DataSize = 1;
  15177. const subitemsCount = stream.readNumber();
  15178. switch (type) {
  15179. case 0:
  15180. stream.readHex(start, dataSize);
  15181. stream.readHexNumber(end, dataSize);
  15182. addHex(end, start, dataSize);
  15183. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  15184. for (let i = 1; i < subitemsCount; i++) {
  15185. incHex(end, dataSize);
  15186. stream.readHexNumber(start, dataSize);
  15187. addHex(start, end, dataSize);
  15188. stream.readHexNumber(end, dataSize);
  15189. addHex(end, start, dataSize);
  15190. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  15191. }
  15192. break;
  15193. case 1:
  15194. stream.readHex(start, dataSize);
  15195. stream.readHexNumber(end, dataSize);
  15196. addHex(end, start, dataSize);
  15197. stream.readNumber();
  15198. for (let i = 1; i < subitemsCount; i++) {
  15199. incHex(end, dataSize);
  15200. stream.readHexNumber(start, dataSize);
  15201. addHex(start, end, dataSize);
  15202. stream.readHexNumber(end, dataSize);
  15203. addHex(end, start, dataSize);
  15204. stream.readNumber();
  15205. }
  15206. break;
  15207. case 2:
  15208. stream.readHex(char, dataSize);
  15209. code = stream.readNumber();
  15210. cMap.mapOne(hexToInt(char, dataSize), code);
  15211. for (let i = 1; i < subitemsCount; i++) {
  15212. incHex(char, dataSize);
  15213. if (!sequence) {
  15214. stream.readHexNumber(tmp, dataSize);
  15215. addHex(char, tmp, dataSize);
  15216. }
  15217. code = stream.readSigned() + (code + 1);
  15218. cMap.mapOne(hexToInt(char, dataSize), code);
  15219. }
  15220. break;
  15221. case 3:
  15222. stream.readHex(start, dataSize);
  15223. stream.readHexNumber(end, dataSize);
  15224. addHex(end, start, dataSize);
  15225. code = stream.readNumber();
  15226. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  15227. for (let i = 1; i < subitemsCount; i++) {
  15228. incHex(end, dataSize);
  15229. if (!sequence) {
  15230. stream.readHexNumber(start, dataSize);
  15231. addHex(start, end, dataSize);
  15232. } else {
  15233. start.set(end);
  15234. }
  15235. stream.readHexNumber(end, dataSize);
  15236. addHex(end, start, dataSize);
  15237. code = stream.readNumber();
  15238. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  15239. }
  15240. break;
  15241. case 4:
  15242. stream.readHex(char, ucs2DataSize);
  15243. stream.readHex(charCode, dataSize);
  15244. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  15245. for (let i = 1; i < subitemsCount; i++) {
  15246. incHex(char, ucs2DataSize);
  15247. if (!sequence) {
  15248. stream.readHexNumber(tmp, ucs2DataSize);
  15249. addHex(char, tmp, ucs2DataSize);
  15250. }
  15251. incHex(charCode, dataSize);
  15252. stream.readHexSigned(tmp, dataSize);
  15253. addHex(charCode, tmp, dataSize);
  15254. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  15255. }
  15256. break;
  15257. case 5:
  15258. stream.readHex(start, ucs2DataSize);
  15259. stream.readHexNumber(end, ucs2DataSize);
  15260. addHex(end, start, ucs2DataSize);
  15261. stream.readHex(charCode, dataSize);
  15262. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  15263. for (let i = 1; i < subitemsCount; i++) {
  15264. incHex(end, ucs2DataSize);
  15265. if (!sequence) {
  15266. stream.readHexNumber(start, ucs2DataSize);
  15267. addHex(start, end, ucs2DataSize);
  15268. } else {
  15269. start.set(end);
  15270. }
  15271. stream.readHexNumber(end, ucs2DataSize);
  15272. addHex(end, start, ucs2DataSize);
  15273. stream.readHex(charCode, dataSize);
  15274. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  15275. }
  15276. break;
  15277. default:
  15278. throw new Error(`BinaryCMapReader.process - unknown type: ${type}`);
  15279. }
  15280. }
  15281. if (useCMap) {
  15282. return extend(useCMap);
  15283. }
  15284. return cMap;
  15285. }
  15286. }
  15287. return BinaryCMapReader;
  15288. }();
  15289. const CMapFactory = function CMapFactoryClosure() {
  15290. function strToInt(str) {
  15291. let a = 0;
  15292. for (let i = 0; i < str.length; i++) {
  15293. a = a << 8 | str.charCodeAt(i);
  15294. }
  15295. return a >>> 0;
  15296. }
  15297. function expectString(obj) {
  15298. if (typeof obj !== "string") {
  15299. throw new _util.FormatError("Malformed CMap: expected string.");
  15300. }
  15301. }
  15302. function expectInt(obj) {
  15303. if (!Number.isInteger(obj)) {
  15304. throw new _util.FormatError("Malformed CMap: expected int.");
  15305. }
  15306. }
  15307. function parseBfChar(cMap, lexer) {
  15308. while (true) {
  15309. let obj = lexer.getObj();
  15310. if (obj === _primitives.EOF) {
  15311. break;
  15312. }
  15313. if ((0, _primitives.isCmd)(obj, "endbfchar")) {
  15314. return;
  15315. }
  15316. expectString(obj);
  15317. const src = strToInt(obj);
  15318. obj = lexer.getObj();
  15319. expectString(obj);
  15320. const dst = obj;
  15321. cMap.mapOne(src, dst);
  15322. }
  15323. }
  15324. function parseBfRange(cMap, lexer) {
  15325. while (true) {
  15326. let obj = lexer.getObj();
  15327. if (obj === _primitives.EOF) {
  15328. break;
  15329. }
  15330. if ((0, _primitives.isCmd)(obj, "endbfrange")) {
  15331. return;
  15332. }
  15333. expectString(obj);
  15334. const low = strToInt(obj);
  15335. obj = lexer.getObj();
  15336. expectString(obj);
  15337. const high = strToInt(obj);
  15338. obj = lexer.getObj();
  15339. if (Number.isInteger(obj) || typeof obj === "string") {
  15340. const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
  15341. cMap.mapBfRange(low, high, dstLow);
  15342. } else if ((0, _primitives.isCmd)(obj, "[")) {
  15343. obj = lexer.getObj();
  15344. const array = [];
  15345. while (!(0, _primitives.isCmd)(obj, "]") && obj !== _primitives.EOF) {
  15346. array.push(obj);
  15347. obj = lexer.getObj();
  15348. }
  15349. cMap.mapBfRangeToArray(low, high, array);
  15350. } else {
  15351. break;
  15352. }
  15353. }
  15354. throw new _util.FormatError("Invalid bf range.");
  15355. }
  15356. function parseCidChar(cMap, lexer) {
  15357. while (true) {
  15358. let obj = lexer.getObj();
  15359. if (obj === _primitives.EOF) {
  15360. break;
  15361. }
  15362. if ((0, _primitives.isCmd)(obj, "endcidchar")) {
  15363. return;
  15364. }
  15365. expectString(obj);
  15366. const src = strToInt(obj);
  15367. obj = lexer.getObj();
  15368. expectInt(obj);
  15369. const dst = obj;
  15370. cMap.mapOne(src, dst);
  15371. }
  15372. }
  15373. function parseCidRange(cMap, lexer) {
  15374. while (true) {
  15375. let obj = lexer.getObj();
  15376. if (obj === _primitives.EOF) {
  15377. break;
  15378. }
  15379. if ((0, _primitives.isCmd)(obj, "endcidrange")) {
  15380. return;
  15381. }
  15382. expectString(obj);
  15383. const low = strToInt(obj);
  15384. obj = lexer.getObj();
  15385. expectString(obj);
  15386. const high = strToInt(obj);
  15387. obj = lexer.getObj();
  15388. expectInt(obj);
  15389. const dstLow = obj;
  15390. cMap.mapCidRange(low, high, dstLow);
  15391. }
  15392. }
  15393. function parseCodespaceRange(cMap, lexer) {
  15394. while (true) {
  15395. let obj = lexer.getObj();
  15396. if (obj === _primitives.EOF) {
  15397. break;
  15398. }
  15399. if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
  15400. return;
  15401. }
  15402. if (typeof obj !== "string") {
  15403. break;
  15404. }
  15405. const low = strToInt(obj);
  15406. obj = lexer.getObj();
  15407. if (typeof obj !== "string") {
  15408. break;
  15409. }
  15410. const high = strToInt(obj);
  15411. cMap.addCodespaceRange(obj.length, low, high);
  15412. }
  15413. throw new _util.FormatError("Invalid codespace range.");
  15414. }
  15415. function parseWMode(cMap, lexer) {
  15416. const obj = lexer.getObj();
  15417. if (Number.isInteger(obj)) {
  15418. cMap.vertical = !!obj;
  15419. }
  15420. }
  15421. function parseCMapName(cMap, lexer) {
  15422. const obj = lexer.getObj();
  15423. if (obj instanceof _primitives.Name) {
  15424. cMap.name = obj.name;
  15425. }
  15426. }
  15427. async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  15428. let previous, embeddedUseCMap;
  15429. objLoop: while (true) {
  15430. try {
  15431. const obj = lexer.getObj();
  15432. if (obj === _primitives.EOF) {
  15433. break;
  15434. } else if (obj instanceof _primitives.Name) {
  15435. if (obj.name === "WMode") {
  15436. parseWMode(cMap, lexer);
  15437. } else if (obj.name === "CMapName") {
  15438. parseCMapName(cMap, lexer);
  15439. }
  15440. previous = obj;
  15441. } else if (obj instanceof _primitives.Cmd) {
  15442. switch (obj.cmd) {
  15443. case "endcmap":
  15444. break objLoop;
  15445. case "usecmap":
  15446. if (previous instanceof _primitives.Name) {
  15447. embeddedUseCMap = previous.name;
  15448. }
  15449. break;
  15450. case "begincodespacerange":
  15451. parseCodespaceRange(cMap, lexer);
  15452. break;
  15453. case "beginbfchar":
  15454. parseBfChar(cMap, lexer);
  15455. break;
  15456. case "begincidchar":
  15457. parseCidChar(cMap, lexer);
  15458. break;
  15459. case "beginbfrange":
  15460. parseBfRange(cMap, lexer);
  15461. break;
  15462. case "begincidrange":
  15463. parseCidRange(cMap, lexer);
  15464. break;
  15465. }
  15466. }
  15467. } catch (ex) {
  15468. if (ex instanceof _core_utils.MissingDataException) {
  15469. throw ex;
  15470. }
  15471. (0, _util.warn)("Invalid cMap data: " + ex);
  15472. continue;
  15473. }
  15474. }
  15475. if (!useCMap && embeddedUseCMap) {
  15476. useCMap = embeddedUseCMap;
  15477. }
  15478. if (useCMap) {
  15479. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  15480. }
  15481. return cMap;
  15482. }
  15483. async function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  15484. cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap);
  15485. if (cMap.numCodespaceRanges === 0) {
  15486. const useCodespaceRanges = cMap.useCMap.codespaceRanges;
  15487. for (let i = 0; i < useCodespaceRanges.length; i++) {
  15488. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  15489. }
  15490. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  15491. }
  15492. cMap.useCMap.forEach(function (key, value) {
  15493. if (!cMap.contains(key)) {
  15494. cMap.mapOne(key, cMap.useCMap.lookup(key));
  15495. }
  15496. });
  15497. return cMap;
  15498. }
  15499. async function createBuiltInCMap(name, fetchBuiltInCMap) {
  15500. if (name === "Identity-H") {
  15501. return new IdentityCMap(false, 2);
  15502. } else if (name === "Identity-V") {
  15503. return new IdentityCMap(true, 2);
  15504. }
  15505. if (!BUILT_IN_CMAPS.includes(name)) {
  15506. throw new Error("Unknown CMap name: " + name);
  15507. }
  15508. if (!fetchBuiltInCMap) {
  15509. throw new Error("Built-in CMap parameters are not provided.");
  15510. }
  15511. const {
  15512. cMapData,
  15513. compressionType
  15514. } = await fetchBuiltInCMap(name);
  15515. const cMap = new CMap(true);
  15516. if (compressionType === _util.CMapCompressionType.BINARY) {
  15517. return new BinaryCMapReader().process(cMapData, cMap, useCMap => {
  15518. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  15519. });
  15520. }
  15521. if (compressionType === _util.CMapCompressionType.NONE) {
  15522. const lexer = new _parser.Lexer(new _stream.Stream(cMapData));
  15523. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  15524. }
  15525. throw new Error("TODO: Only BINARY/NONE CMap compression is currently supported.");
  15526. }
  15527. return {
  15528. async create(params) {
  15529. const encoding = params.encoding;
  15530. const fetchBuiltInCMap = params.fetchBuiltInCMap;
  15531. const useCMap = params.useCMap;
  15532. if (encoding instanceof _primitives.Name) {
  15533. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  15534. } else if (encoding instanceof _base_stream.BaseStream) {
  15535. const parsedCMap = await parseCMap(new CMap(), new _parser.Lexer(encoding), fetchBuiltInCMap, useCMap);
  15536. if (parsedCMap.isIdentityCMap) {
  15537. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  15538. }
  15539. return parsedCMap;
  15540. }
  15541. throw new Error("Encoding required.");
  15542. }
  15543. };
  15544. }();
  15545. exports.CMapFactory = CMapFactory;
  15546. /***/ }),
  15547. /* 142 */
  15548. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  15549. "use strict";
  15550. Object.defineProperty(exports, "__esModule", ({
  15551. value: true
  15552. }));
  15553. exports.Parser = exports.Linearization = exports.Lexer = void 0;
  15554. var _util = __w_pdfjs_require__(2);
  15555. var _primitives = __w_pdfjs_require__(130);
  15556. var _core_utils = __w_pdfjs_require__(131);
  15557. var _ascii_85_stream = __w_pdfjs_require__(143);
  15558. var _ascii_hex_stream = __w_pdfjs_require__(145);
  15559. var _ccitt_stream = __w_pdfjs_require__(146);
  15560. var _flate_stream = __w_pdfjs_require__(148);
  15561. var _jbig2_stream = __w_pdfjs_require__(149);
  15562. var _jpeg_stream = __w_pdfjs_require__(152);
  15563. var _jpx_stream = __w_pdfjs_require__(154);
  15564. var _lzw_stream = __w_pdfjs_require__(156);
  15565. var _stream = __w_pdfjs_require__(135);
  15566. var _predictor_stream = __w_pdfjs_require__(157);
  15567. var _run_length_stream = __w_pdfjs_require__(158);
  15568. const MAX_LENGTH_TO_CACHE = 1000;
  15569. const MAX_ADLER32_LENGTH = 5552;
  15570. function computeAdler32(bytes) {
  15571. const bytesLength = bytes.length;
  15572. let a = 1,
  15573. b = 0;
  15574. for (let i = 0; i < bytesLength; ++i) {
  15575. a += bytes[i] & 0xff;
  15576. b += a;
  15577. }
  15578. return b % 65521 << 16 | a % 65521;
  15579. }
  15580. class Parser {
  15581. constructor(_ref) {
  15582. let {
  15583. lexer,
  15584. xref,
  15585. allowStreams = false,
  15586. recoveryMode = false
  15587. } = _ref;
  15588. this.lexer = lexer;
  15589. this.xref = xref;
  15590. this.allowStreams = allowStreams;
  15591. this.recoveryMode = recoveryMode;
  15592. this.imageCache = Object.create(null);
  15593. this.refill();
  15594. }
  15595. refill() {
  15596. this.buf1 = this.lexer.getObj();
  15597. this.buf2 = this.lexer.getObj();
  15598. }
  15599. shift() {
  15600. if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
  15601. this.buf1 = this.buf2;
  15602. this.buf2 = null;
  15603. } else {
  15604. this.buf1 = this.buf2;
  15605. this.buf2 = this.lexer.getObj();
  15606. }
  15607. }
  15608. tryShift() {
  15609. try {
  15610. this.shift();
  15611. return true;
  15612. } catch (e) {
  15613. if (e instanceof _core_utils.MissingDataException) {
  15614. throw e;
  15615. }
  15616. return false;
  15617. }
  15618. }
  15619. getObj() {
  15620. let cipherTransform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  15621. const buf1 = this.buf1;
  15622. this.shift();
  15623. if (buf1 instanceof _primitives.Cmd) {
  15624. switch (buf1.cmd) {
  15625. case "BI":
  15626. return this.makeInlineImage(cipherTransform);
  15627. case "[":
  15628. const array = [];
  15629. while (!(0, _primitives.isCmd)(this.buf1, "]") && this.buf1 !== _primitives.EOF) {
  15630. array.push(this.getObj(cipherTransform));
  15631. }
  15632. if (this.buf1 === _primitives.EOF) {
  15633. if (this.recoveryMode) {
  15634. return array;
  15635. }
  15636. throw new _core_utils.ParserEOFException("End of file inside array.");
  15637. }
  15638. this.shift();
  15639. return array;
  15640. case "<<":
  15641. const dict = new _primitives.Dict(this.xref);
  15642. while (!(0, _primitives.isCmd)(this.buf1, ">>") && this.buf1 !== _primitives.EOF) {
  15643. if (!(this.buf1 instanceof _primitives.Name)) {
  15644. (0, _util.info)("Malformed dictionary: key must be a name object");
  15645. this.shift();
  15646. continue;
  15647. }
  15648. const key = this.buf1.name;
  15649. this.shift();
  15650. if (this.buf1 === _primitives.EOF) {
  15651. break;
  15652. }
  15653. dict.set(key, this.getObj(cipherTransform));
  15654. }
  15655. if (this.buf1 === _primitives.EOF) {
  15656. if (this.recoveryMode) {
  15657. return dict;
  15658. }
  15659. throw new _core_utils.ParserEOFException("End of file inside dictionary.");
  15660. }
  15661. if ((0, _primitives.isCmd)(this.buf2, "stream")) {
  15662. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  15663. }
  15664. this.shift();
  15665. return dict;
  15666. default:
  15667. return buf1;
  15668. }
  15669. }
  15670. if (Number.isInteger(buf1)) {
  15671. if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
  15672. const ref = _primitives.Ref.get(buf1, this.buf1);
  15673. this.shift();
  15674. this.shift();
  15675. return ref;
  15676. }
  15677. return buf1;
  15678. }
  15679. if (typeof buf1 === "string") {
  15680. if (cipherTransform) {
  15681. return cipherTransform.decryptString(buf1);
  15682. }
  15683. return buf1;
  15684. }
  15685. return buf1;
  15686. }
  15687. findDefaultInlineStreamEnd(stream) {
  15688. const E = 0x45,
  15689. I = 0x49,
  15690. SPACE = 0x20,
  15691. LF = 0xa,
  15692. CR = 0xd,
  15693. NUL = 0x0;
  15694. const lexer = this.lexer,
  15695. startPos = stream.pos,
  15696. n = 10;
  15697. let state = 0,
  15698. ch,
  15699. maybeEIPos;
  15700. while ((ch = stream.getByte()) !== -1) {
  15701. if (state === 0) {
  15702. state = ch === E ? 1 : 0;
  15703. } else if (state === 1) {
  15704. state = ch === I ? 2 : 0;
  15705. } else {
  15706. (0, _util.assert)(state === 2, "findDefaultInlineStreamEnd - invalid state.");
  15707. if (ch === SPACE || ch === LF || ch === CR) {
  15708. maybeEIPos = stream.pos;
  15709. const followingBytes = stream.peekBytes(n);
  15710. for (let i = 0, ii = followingBytes.length; i < ii; i++) {
  15711. ch = followingBytes[i];
  15712. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  15713. continue;
  15714. }
  15715. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  15716. state = 0;
  15717. break;
  15718. }
  15719. }
  15720. if (state !== 2) {
  15721. continue;
  15722. }
  15723. if (lexer.knownCommands) {
  15724. const nextObj = lexer.peekObj();
  15725. if (nextObj instanceof _primitives.Cmd && !lexer.knownCommands[nextObj.cmd]) {
  15726. state = 0;
  15727. }
  15728. } else {
  15729. (0, _util.warn)("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");
  15730. }
  15731. if (state === 2) {
  15732. break;
  15733. }
  15734. } else {
  15735. state = 0;
  15736. }
  15737. }
  15738. }
  15739. if (ch === -1) {
  15740. (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
  15741. if (maybeEIPos) {
  15742. (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
  15743. stream.skip(-(stream.pos - maybeEIPos));
  15744. }
  15745. }
  15746. let endOffset = 4;
  15747. stream.skip(-endOffset);
  15748. ch = stream.peekByte();
  15749. stream.skip(endOffset);
  15750. if (!(0, _core_utils.isWhiteSpace)(ch)) {
  15751. endOffset--;
  15752. }
  15753. return stream.pos - endOffset - startPos;
  15754. }
  15755. findDCTDecodeInlineStreamEnd(stream) {
  15756. const startPos = stream.pos;
  15757. let foundEOI = false,
  15758. b,
  15759. markerLength;
  15760. while ((b = stream.getByte()) !== -1) {
  15761. if (b !== 0xff) {
  15762. continue;
  15763. }
  15764. switch (stream.getByte()) {
  15765. case 0x00:
  15766. break;
  15767. case 0xff:
  15768. stream.skip(-1);
  15769. break;
  15770. case 0xd9:
  15771. foundEOI = true;
  15772. break;
  15773. case 0xc0:
  15774. case 0xc1:
  15775. case 0xc2:
  15776. case 0xc3:
  15777. case 0xc5:
  15778. case 0xc6:
  15779. case 0xc7:
  15780. case 0xc9:
  15781. case 0xca:
  15782. case 0xcb:
  15783. case 0xcd:
  15784. case 0xce:
  15785. case 0xcf:
  15786. case 0xc4:
  15787. case 0xcc:
  15788. case 0xda:
  15789. case 0xdb:
  15790. case 0xdc:
  15791. case 0xdd:
  15792. case 0xde:
  15793. case 0xdf:
  15794. case 0xe0:
  15795. case 0xe1:
  15796. case 0xe2:
  15797. case 0xe3:
  15798. case 0xe4:
  15799. case 0xe5:
  15800. case 0xe6:
  15801. case 0xe7:
  15802. case 0xe8:
  15803. case 0xe9:
  15804. case 0xea:
  15805. case 0xeb:
  15806. case 0xec:
  15807. case 0xed:
  15808. case 0xee:
  15809. case 0xef:
  15810. case 0xfe:
  15811. markerLength = stream.getUint16();
  15812. if (markerLength > 2) {
  15813. stream.skip(markerLength - 2);
  15814. } else {
  15815. stream.skip(-2);
  15816. }
  15817. break;
  15818. }
  15819. if (foundEOI) {
  15820. break;
  15821. }
  15822. }
  15823. const length = stream.pos - startPos;
  15824. if (b === -1) {
  15825. (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
  15826. stream.skip(-length);
  15827. return this.findDefaultInlineStreamEnd(stream);
  15828. }
  15829. this.inlineStreamSkipEI(stream);
  15830. return length;
  15831. }
  15832. findASCII85DecodeInlineStreamEnd(stream) {
  15833. const TILDE = 0x7e,
  15834. GT = 0x3e;
  15835. const startPos = stream.pos;
  15836. let ch;
  15837. while ((ch = stream.getByte()) !== -1) {
  15838. if (ch === TILDE) {
  15839. const tildePos = stream.pos;
  15840. ch = stream.peekByte();
  15841. while ((0, _core_utils.isWhiteSpace)(ch)) {
  15842. stream.skip();
  15843. ch = stream.peekByte();
  15844. }
  15845. if (ch === GT) {
  15846. stream.skip();
  15847. break;
  15848. }
  15849. if (stream.pos > tildePos) {
  15850. const maybeEI = stream.peekBytes(2);
  15851. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  15852. break;
  15853. }
  15854. }
  15855. }
  15856. }
  15857. const length = stream.pos - startPos;
  15858. if (ch === -1) {
  15859. (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  15860. stream.skip(-length);
  15861. return this.findDefaultInlineStreamEnd(stream);
  15862. }
  15863. this.inlineStreamSkipEI(stream);
  15864. return length;
  15865. }
  15866. findASCIIHexDecodeInlineStreamEnd(stream) {
  15867. const GT = 0x3e;
  15868. const startPos = stream.pos;
  15869. let ch;
  15870. while ((ch = stream.getByte()) !== -1) {
  15871. if (ch === GT) {
  15872. break;
  15873. }
  15874. }
  15875. const length = stream.pos - startPos;
  15876. if (ch === -1) {
  15877. (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  15878. stream.skip(-length);
  15879. return this.findDefaultInlineStreamEnd(stream);
  15880. }
  15881. this.inlineStreamSkipEI(stream);
  15882. return length;
  15883. }
  15884. inlineStreamSkipEI(stream) {
  15885. const E = 0x45,
  15886. I = 0x49;
  15887. let state = 0,
  15888. ch;
  15889. while ((ch = stream.getByte()) !== -1) {
  15890. if (state === 0) {
  15891. state = ch === E ? 1 : 0;
  15892. } else if (state === 1) {
  15893. state = ch === I ? 2 : 0;
  15894. } else if (state === 2) {
  15895. break;
  15896. }
  15897. }
  15898. }
  15899. makeInlineImage(cipherTransform) {
  15900. const lexer = this.lexer;
  15901. const stream = lexer.stream;
  15902. const dict = new _primitives.Dict(this.xref);
  15903. let dictLength;
  15904. while (!(0, _primitives.isCmd)(this.buf1, "ID") && this.buf1 !== _primitives.EOF) {
  15905. if (!(this.buf1 instanceof _primitives.Name)) {
  15906. throw new _util.FormatError("Dictionary key must be a name object");
  15907. }
  15908. const key = this.buf1.name;
  15909. this.shift();
  15910. if (this.buf1 === _primitives.EOF) {
  15911. break;
  15912. }
  15913. dict.set(key, this.getObj(cipherTransform));
  15914. }
  15915. if (lexer.beginInlineImagePos !== -1) {
  15916. dictLength = stream.pos - lexer.beginInlineImagePos;
  15917. }
  15918. const filter = dict.get("F", "Filter");
  15919. let filterName;
  15920. if (filter instanceof _primitives.Name) {
  15921. filterName = filter.name;
  15922. } else if (Array.isArray(filter)) {
  15923. const filterZero = this.xref.fetchIfRef(filter[0]);
  15924. if (filterZero instanceof _primitives.Name) {
  15925. filterName = filterZero.name;
  15926. }
  15927. }
  15928. const startPos = stream.pos;
  15929. let length;
  15930. switch (filterName) {
  15931. case "DCT":
  15932. case "DCTDecode":
  15933. length = this.findDCTDecodeInlineStreamEnd(stream);
  15934. break;
  15935. case "A85":
  15936. case "ASCII85Decode":
  15937. length = this.findASCII85DecodeInlineStreamEnd(stream);
  15938. break;
  15939. case "AHx":
  15940. case "ASCIIHexDecode":
  15941. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  15942. break;
  15943. default:
  15944. length = this.findDefaultInlineStreamEnd(stream);
  15945. }
  15946. let imageStream = stream.makeSubStream(startPos, length, dict);
  15947. let cacheKey;
  15948. if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) {
  15949. const imageBytes = imageStream.getBytes();
  15950. imageStream.reset();
  15951. const initialStreamPos = stream.pos;
  15952. stream.pos = lexer.beginInlineImagePos;
  15953. const dictBytes = stream.getBytes(dictLength);
  15954. stream.pos = initialStreamPos;
  15955. cacheKey = computeAdler32(imageBytes) + "_" + computeAdler32(dictBytes);
  15956. const cacheEntry = this.imageCache[cacheKey];
  15957. if (cacheEntry !== undefined) {
  15958. this.buf2 = _primitives.Cmd.get("EI");
  15959. this.shift();
  15960. cacheEntry.reset();
  15961. return cacheEntry;
  15962. }
  15963. }
  15964. if (cipherTransform) {
  15965. imageStream = cipherTransform.createStream(imageStream, length);
  15966. }
  15967. imageStream = this.filter(imageStream, dict, length);
  15968. imageStream.dict = dict;
  15969. if (cacheKey !== undefined) {
  15970. imageStream.cacheKey = `inline_${length}_${cacheKey}`;
  15971. this.imageCache[cacheKey] = imageStream;
  15972. }
  15973. this.buf2 = _primitives.Cmd.get("EI");
  15974. this.shift();
  15975. return imageStream;
  15976. }
  15977. _findStreamLength(startPos, signature) {
  15978. const {
  15979. stream
  15980. } = this.lexer;
  15981. stream.pos = startPos;
  15982. const SCAN_BLOCK_LENGTH = 2048;
  15983. const signatureLength = signature.length;
  15984. while (stream.pos < stream.end) {
  15985. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  15986. const scanLength = scanBytes.length - signatureLength;
  15987. if (scanLength <= 0) {
  15988. break;
  15989. }
  15990. let pos = 0;
  15991. while (pos < scanLength) {
  15992. let j = 0;
  15993. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  15994. j++;
  15995. }
  15996. if (j >= signatureLength) {
  15997. stream.pos += pos;
  15998. return stream.pos - startPos;
  15999. }
  16000. pos++;
  16001. }
  16002. stream.pos += scanLength;
  16003. }
  16004. return -1;
  16005. }
  16006. makeStream(dict, cipherTransform) {
  16007. const lexer = this.lexer;
  16008. let stream = lexer.stream;
  16009. lexer.skipToNextLine();
  16010. const startPos = stream.pos - 1;
  16011. let length = dict.get("Length");
  16012. if (!Number.isInteger(length)) {
  16013. (0, _util.info)(`Bad length "${length && length.toString()}" in stream.`);
  16014. length = 0;
  16015. }
  16016. stream.pos = startPos + length;
  16017. lexer.nextChar();
  16018. if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
  16019. this.shift();
  16020. } else {
  16021. const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]);
  16022. let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
  16023. if (actualLength < 0) {
  16024. const MAX_TRUNCATION = 1;
  16025. for (let i = 1; i <= MAX_TRUNCATION; i++) {
  16026. const end = ENDSTREAM_SIGNATURE.length - i;
  16027. const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
  16028. const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
  16029. if (maybeLength >= 0) {
  16030. const lastByte = stream.peekBytes(end + 1)[end];
  16031. if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
  16032. break;
  16033. }
  16034. (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command.");
  16035. actualLength = maybeLength;
  16036. break;
  16037. }
  16038. }
  16039. if (actualLength < 0) {
  16040. throw new _util.FormatError("Missing endstream command.");
  16041. }
  16042. }
  16043. length = actualLength;
  16044. lexer.nextChar();
  16045. this.shift();
  16046. this.shift();
  16047. }
  16048. this.shift();
  16049. stream = stream.makeSubStream(startPos, length, dict);
  16050. if (cipherTransform) {
  16051. stream = cipherTransform.createStream(stream, length);
  16052. }
  16053. stream = this.filter(stream, dict, length);
  16054. stream.dict = dict;
  16055. return stream;
  16056. }
  16057. filter(stream, dict, length) {
  16058. let filter = dict.get("F", "Filter");
  16059. let params = dict.get("DP", "DecodeParms");
  16060. if (filter instanceof _primitives.Name) {
  16061. if (Array.isArray(params)) {
  16062. (0, _util.warn)("/DecodeParms should not be an Array, when /Filter is a Name.");
  16063. }
  16064. return this.makeFilter(stream, filter.name, length, params);
  16065. }
  16066. let maybeLength = length;
  16067. if (Array.isArray(filter)) {
  16068. const filterArray = filter;
  16069. const paramsArray = params;
  16070. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  16071. filter = this.xref.fetchIfRef(filterArray[i]);
  16072. if (!(filter instanceof _primitives.Name)) {
  16073. throw new _util.FormatError(`Bad filter name "${filter}"`);
  16074. }
  16075. params = null;
  16076. if (Array.isArray(paramsArray) && i in paramsArray) {
  16077. params = this.xref.fetchIfRef(paramsArray[i]);
  16078. }
  16079. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  16080. maybeLength = null;
  16081. }
  16082. }
  16083. return stream;
  16084. }
  16085. makeFilter(stream, name, maybeLength, params) {
  16086. if (maybeLength === 0) {
  16087. (0, _util.warn)(`Empty "${name}" stream.`);
  16088. return new _stream.NullStream();
  16089. }
  16090. const xrefStats = this.xref.stats;
  16091. try {
  16092. switch (name) {
  16093. case "Fl":
  16094. case "FlateDecode":
  16095. xrefStats.addStreamType(_util.StreamType.FLATE);
  16096. if (params) {
  16097. return new _predictor_stream.PredictorStream(new _flate_stream.FlateStream(stream, maybeLength), maybeLength, params);
  16098. }
  16099. return new _flate_stream.FlateStream(stream, maybeLength);
  16100. case "LZW":
  16101. case "LZWDecode":
  16102. xrefStats.addStreamType(_util.StreamType.LZW);
  16103. let earlyChange = 1;
  16104. if (params) {
  16105. if (params.has("EarlyChange")) {
  16106. earlyChange = params.get("EarlyChange");
  16107. }
  16108. return new _predictor_stream.PredictorStream(new _lzw_stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  16109. }
  16110. return new _lzw_stream.LZWStream(stream, maybeLength, earlyChange);
  16111. case "DCT":
  16112. case "DCTDecode":
  16113. xrefStats.addStreamType(_util.StreamType.DCT);
  16114. return new _jpeg_stream.JpegStream(stream, maybeLength, params);
  16115. case "JPX":
  16116. case "JPXDecode":
  16117. xrefStats.addStreamType(_util.StreamType.JPX);
  16118. return new _jpx_stream.JpxStream(stream, maybeLength, params);
  16119. case "A85":
  16120. case "ASCII85Decode":
  16121. xrefStats.addStreamType(_util.StreamType.A85);
  16122. return new _ascii_85_stream.Ascii85Stream(stream, maybeLength);
  16123. case "AHx":
  16124. case "ASCIIHexDecode":
  16125. xrefStats.addStreamType(_util.StreamType.AHX);
  16126. return new _ascii_hex_stream.AsciiHexStream(stream, maybeLength);
  16127. case "CCF":
  16128. case "CCITTFaxDecode":
  16129. xrefStats.addStreamType(_util.StreamType.CCF);
  16130. return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
  16131. case "RL":
  16132. case "RunLengthDecode":
  16133. xrefStats.addStreamType(_util.StreamType.RLX);
  16134. return new _run_length_stream.RunLengthStream(stream, maybeLength);
  16135. case "JBIG2Decode":
  16136. xrefStats.addStreamType(_util.StreamType.JBIG);
  16137. return new _jbig2_stream.Jbig2Stream(stream, maybeLength, params);
  16138. }
  16139. (0, _util.warn)(`Filter "${name}" is not supported.`);
  16140. return stream;
  16141. } catch (ex) {
  16142. if (ex instanceof _core_utils.MissingDataException) {
  16143. throw ex;
  16144. }
  16145. (0, _util.warn)(`Invalid stream: "${ex}"`);
  16146. return new _stream.NullStream();
  16147. }
  16148. }
  16149. }
  16150. exports.Parser = Parser;
  16151. 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];
  16152. function toHexDigit(ch) {
  16153. if (ch >= 0x30 && ch <= 0x39) {
  16154. return ch & 0x0f;
  16155. }
  16156. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  16157. return (ch & 0x0f) + 9;
  16158. }
  16159. return -1;
  16160. }
  16161. class Lexer {
  16162. constructor(stream) {
  16163. let knownCommands = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  16164. this.stream = stream;
  16165. this.nextChar();
  16166. this.strBuf = [];
  16167. this.knownCommands = knownCommands;
  16168. this._hexStringNumWarn = 0;
  16169. this.beginInlineImagePos = -1;
  16170. }
  16171. nextChar() {
  16172. return this.currentChar = this.stream.getByte();
  16173. }
  16174. peekChar() {
  16175. return this.stream.peekByte();
  16176. }
  16177. getNumber() {
  16178. let ch = this.currentChar;
  16179. let eNotation = false;
  16180. let divideBy = 0;
  16181. let sign = 0;
  16182. if (ch === 0x2d) {
  16183. sign = -1;
  16184. ch = this.nextChar();
  16185. if (ch === 0x2d) {
  16186. ch = this.nextChar();
  16187. }
  16188. } else if (ch === 0x2b) {
  16189. sign = 1;
  16190. ch = this.nextChar();
  16191. }
  16192. if (ch === 0x0a || ch === 0x0d) {
  16193. do {
  16194. ch = this.nextChar();
  16195. } while (ch === 0x0a || ch === 0x0d);
  16196. }
  16197. if (ch === 0x2e) {
  16198. divideBy = 10;
  16199. ch = this.nextChar();
  16200. }
  16201. if (ch < 0x30 || ch > 0x39) {
  16202. if ((0, _core_utils.isWhiteSpace)(ch) || ch === -1) {
  16203. if (divideBy === 10 && sign === 0) {
  16204. (0, _util.warn)("Lexer.getNumber - treating a single decimal point as zero.");
  16205. return 0;
  16206. }
  16207. if (divideBy === 0 && sign === -1) {
  16208. (0, _util.warn)("Lexer.getNumber - treating a single minus sign as zero.");
  16209. return 0;
  16210. }
  16211. }
  16212. throw new _util.FormatError(`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`);
  16213. }
  16214. sign = sign || 1;
  16215. let baseValue = ch - 0x30;
  16216. let powerValue = 0;
  16217. let powerValueSign = 1;
  16218. while ((ch = this.nextChar()) >= 0) {
  16219. if (ch >= 0x30 && ch <= 0x39) {
  16220. const currentDigit = ch - 0x30;
  16221. if (eNotation) {
  16222. powerValue = powerValue * 10 + currentDigit;
  16223. } else {
  16224. if (divideBy !== 0) {
  16225. divideBy *= 10;
  16226. }
  16227. baseValue = baseValue * 10 + currentDigit;
  16228. }
  16229. } else if (ch === 0x2e) {
  16230. if (divideBy === 0) {
  16231. divideBy = 1;
  16232. } else {
  16233. break;
  16234. }
  16235. } else if (ch === 0x2d) {
  16236. (0, _util.warn)("Badly formatted number: minus sign in the middle");
  16237. } else if (ch === 0x45 || ch === 0x65) {
  16238. ch = this.peekChar();
  16239. if (ch === 0x2b || ch === 0x2d) {
  16240. powerValueSign = ch === 0x2d ? -1 : 1;
  16241. this.nextChar();
  16242. } else if (ch < 0x30 || ch > 0x39) {
  16243. break;
  16244. }
  16245. eNotation = true;
  16246. } else {
  16247. break;
  16248. }
  16249. }
  16250. if (divideBy !== 0) {
  16251. baseValue /= divideBy;
  16252. }
  16253. if (eNotation) {
  16254. baseValue *= 10 ** (powerValueSign * powerValue);
  16255. }
  16256. return sign * baseValue;
  16257. }
  16258. getString() {
  16259. let numParen = 1;
  16260. let done = false;
  16261. const strBuf = this.strBuf;
  16262. strBuf.length = 0;
  16263. let ch = this.nextChar();
  16264. while (true) {
  16265. let charBuffered = false;
  16266. switch (ch | 0) {
  16267. case -1:
  16268. (0, _util.warn)("Unterminated string");
  16269. done = true;
  16270. break;
  16271. case 0x28:
  16272. ++numParen;
  16273. strBuf.push("(");
  16274. break;
  16275. case 0x29:
  16276. if (--numParen === 0) {
  16277. this.nextChar();
  16278. done = true;
  16279. } else {
  16280. strBuf.push(")");
  16281. }
  16282. break;
  16283. case 0x5c:
  16284. ch = this.nextChar();
  16285. switch (ch) {
  16286. case -1:
  16287. (0, _util.warn)("Unterminated string");
  16288. done = true;
  16289. break;
  16290. case 0x6e:
  16291. strBuf.push("\n");
  16292. break;
  16293. case 0x72:
  16294. strBuf.push("\r");
  16295. break;
  16296. case 0x74:
  16297. strBuf.push("\t");
  16298. break;
  16299. case 0x62:
  16300. strBuf.push("\b");
  16301. break;
  16302. case 0x66:
  16303. strBuf.push("\f");
  16304. break;
  16305. case 0x5c:
  16306. case 0x28:
  16307. case 0x29:
  16308. strBuf.push(String.fromCharCode(ch));
  16309. break;
  16310. case 0x30:
  16311. case 0x31:
  16312. case 0x32:
  16313. case 0x33:
  16314. case 0x34:
  16315. case 0x35:
  16316. case 0x36:
  16317. case 0x37:
  16318. let x = ch & 0x0f;
  16319. ch = this.nextChar();
  16320. charBuffered = true;
  16321. if (ch >= 0x30 && ch <= 0x37) {
  16322. x = (x << 3) + (ch & 0x0f);
  16323. ch = this.nextChar();
  16324. if (ch >= 0x30 && ch <= 0x37) {
  16325. charBuffered = false;
  16326. x = (x << 3) + (ch & 0x0f);
  16327. }
  16328. }
  16329. strBuf.push(String.fromCharCode(x));
  16330. break;
  16331. case 0x0d:
  16332. if (this.peekChar() === 0x0a) {
  16333. this.nextChar();
  16334. }
  16335. break;
  16336. case 0x0a:
  16337. break;
  16338. default:
  16339. strBuf.push(String.fromCharCode(ch));
  16340. break;
  16341. }
  16342. break;
  16343. default:
  16344. strBuf.push(String.fromCharCode(ch));
  16345. break;
  16346. }
  16347. if (done) {
  16348. break;
  16349. }
  16350. if (!charBuffered) {
  16351. ch = this.nextChar();
  16352. }
  16353. }
  16354. return strBuf.join("");
  16355. }
  16356. getName() {
  16357. let ch, previousCh;
  16358. const strBuf = this.strBuf;
  16359. strBuf.length = 0;
  16360. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  16361. if (ch === 0x23) {
  16362. ch = this.nextChar();
  16363. if (specialChars[ch]) {
  16364. (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
  16365. strBuf.push("#");
  16366. break;
  16367. }
  16368. const x = toHexDigit(ch);
  16369. if (x !== -1) {
  16370. previousCh = ch;
  16371. ch = this.nextChar();
  16372. const x2 = toHexDigit(ch);
  16373. if (x2 === -1) {
  16374. (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
  16375. strBuf.push("#", String.fromCharCode(previousCh));
  16376. if (specialChars[ch]) {
  16377. break;
  16378. }
  16379. strBuf.push(String.fromCharCode(ch));
  16380. continue;
  16381. }
  16382. strBuf.push(String.fromCharCode(x << 4 | x2));
  16383. } else {
  16384. strBuf.push("#", String.fromCharCode(ch));
  16385. }
  16386. } else {
  16387. strBuf.push(String.fromCharCode(ch));
  16388. }
  16389. }
  16390. if (strBuf.length > 127) {
  16391. (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
  16392. }
  16393. return _primitives.Name.get(strBuf.join(""));
  16394. }
  16395. _hexStringWarn(ch) {
  16396. const MAX_HEX_STRING_NUM_WARN = 5;
  16397. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  16398. (0, _util.warn)("getHexString - ignoring additional invalid characters.");
  16399. return;
  16400. }
  16401. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  16402. return;
  16403. }
  16404. (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
  16405. }
  16406. getHexString() {
  16407. const strBuf = this.strBuf;
  16408. strBuf.length = 0;
  16409. let ch = this.currentChar;
  16410. let isFirstHex = true;
  16411. let firstDigit, secondDigit;
  16412. this._hexStringNumWarn = 0;
  16413. while (true) {
  16414. if (ch < 0) {
  16415. (0, _util.warn)("Unterminated hex string");
  16416. break;
  16417. } else if (ch === 0x3e) {
  16418. this.nextChar();
  16419. break;
  16420. } else if (specialChars[ch] === 1) {
  16421. ch = this.nextChar();
  16422. continue;
  16423. } else {
  16424. if (isFirstHex) {
  16425. firstDigit = toHexDigit(ch);
  16426. if (firstDigit === -1) {
  16427. this._hexStringWarn(ch);
  16428. ch = this.nextChar();
  16429. continue;
  16430. }
  16431. } else {
  16432. secondDigit = toHexDigit(ch);
  16433. if (secondDigit === -1) {
  16434. this._hexStringWarn(ch);
  16435. ch = this.nextChar();
  16436. continue;
  16437. }
  16438. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  16439. }
  16440. isFirstHex = !isFirstHex;
  16441. ch = this.nextChar();
  16442. }
  16443. }
  16444. return strBuf.join("");
  16445. }
  16446. getObj() {
  16447. let comment = false;
  16448. let ch = this.currentChar;
  16449. while (true) {
  16450. if (ch < 0) {
  16451. return _primitives.EOF;
  16452. }
  16453. if (comment) {
  16454. if (ch === 0x0a || ch === 0x0d) {
  16455. comment = false;
  16456. }
  16457. } else if (ch === 0x25) {
  16458. comment = true;
  16459. } else if (specialChars[ch] !== 1) {
  16460. break;
  16461. }
  16462. ch = this.nextChar();
  16463. }
  16464. switch (ch | 0) {
  16465. case 0x30:
  16466. case 0x31:
  16467. case 0x32:
  16468. case 0x33:
  16469. case 0x34:
  16470. case 0x35:
  16471. case 0x36:
  16472. case 0x37:
  16473. case 0x38:
  16474. case 0x39:
  16475. case 0x2b:
  16476. case 0x2d:
  16477. case 0x2e:
  16478. return this.getNumber();
  16479. case 0x28:
  16480. return this.getString();
  16481. case 0x2f:
  16482. return this.getName();
  16483. case 0x5b:
  16484. this.nextChar();
  16485. return _primitives.Cmd.get("[");
  16486. case 0x5d:
  16487. this.nextChar();
  16488. return _primitives.Cmd.get("]");
  16489. case 0x3c:
  16490. ch = this.nextChar();
  16491. if (ch === 0x3c) {
  16492. this.nextChar();
  16493. return _primitives.Cmd.get("<<");
  16494. }
  16495. return this.getHexString();
  16496. case 0x3e:
  16497. ch = this.nextChar();
  16498. if (ch === 0x3e) {
  16499. this.nextChar();
  16500. return _primitives.Cmd.get(">>");
  16501. }
  16502. return _primitives.Cmd.get(">");
  16503. case 0x7b:
  16504. this.nextChar();
  16505. return _primitives.Cmd.get("{");
  16506. case 0x7d:
  16507. this.nextChar();
  16508. return _primitives.Cmd.get("}");
  16509. case 0x29:
  16510. this.nextChar();
  16511. throw new _util.FormatError(`Illegal character: ${ch}`);
  16512. }
  16513. let str = String.fromCharCode(ch);
  16514. if (ch < 0x20 || ch > 0x7f) {
  16515. const nextCh = this.peekChar();
  16516. if (nextCh >= 0x20 && nextCh <= 0x7f) {
  16517. this.nextChar();
  16518. return _primitives.Cmd.get(str);
  16519. }
  16520. }
  16521. const knownCommands = this.knownCommands;
  16522. let knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  16523. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  16524. const possibleCommand = str + String.fromCharCode(ch);
  16525. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  16526. break;
  16527. }
  16528. if (str.length === 128) {
  16529. throw new _util.FormatError(`Command token too long: ${str.length}`);
  16530. }
  16531. str = possibleCommand;
  16532. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  16533. }
  16534. if (str === "true") {
  16535. return true;
  16536. }
  16537. if (str === "false") {
  16538. return false;
  16539. }
  16540. if (str === "null") {
  16541. return null;
  16542. }
  16543. if (str === "BI") {
  16544. this.beginInlineImagePos = this.stream.pos;
  16545. }
  16546. return _primitives.Cmd.get(str);
  16547. }
  16548. peekObj() {
  16549. const streamPos = this.stream.pos,
  16550. currentChar = this.currentChar,
  16551. beginInlineImagePos = this.beginInlineImagePos;
  16552. let nextObj;
  16553. try {
  16554. nextObj = this.getObj();
  16555. } catch (ex) {
  16556. if (ex instanceof _core_utils.MissingDataException) {
  16557. throw ex;
  16558. }
  16559. (0, _util.warn)(`peekObj: ${ex}`);
  16560. }
  16561. this.stream.pos = streamPos;
  16562. this.currentChar = currentChar;
  16563. this.beginInlineImagePos = beginInlineImagePos;
  16564. return nextObj;
  16565. }
  16566. skipToNextLine() {
  16567. let ch = this.currentChar;
  16568. while (ch >= 0) {
  16569. if (ch === 0x0d) {
  16570. ch = this.nextChar();
  16571. if (ch === 0x0a) {
  16572. this.nextChar();
  16573. }
  16574. break;
  16575. } else if (ch === 0x0a) {
  16576. this.nextChar();
  16577. break;
  16578. }
  16579. ch = this.nextChar();
  16580. }
  16581. }
  16582. }
  16583. exports.Lexer = Lexer;
  16584. class Linearization {
  16585. static create(stream) {
  16586. function getInt(linDict, name) {
  16587. let allowZeroValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  16588. const obj = linDict.get(name);
  16589. if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  16590. return obj;
  16591. }
  16592. throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
  16593. }
  16594. function getHints(linDict) {
  16595. const hints = linDict.get("H");
  16596. let hintsLength;
  16597. if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  16598. for (let index = 0; index < hintsLength; index++) {
  16599. const hint = hints[index];
  16600. if (!(Number.isInteger(hint) && hint > 0)) {
  16601. throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
  16602. }
  16603. }
  16604. return hints;
  16605. }
  16606. throw new Error("Hint array in the linearization dictionary is invalid.");
  16607. }
  16608. const parser = new Parser({
  16609. lexer: new Lexer(stream),
  16610. xref: null
  16611. });
  16612. const obj1 = parser.getObj();
  16613. const obj2 = parser.getObj();
  16614. const obj3 = parser.getObj();
  16615. const linDict = parser.getObj();
  16616. let obj, length;
  16617. if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && linDict instanceof _primitives.Dict && typeof (obj = linDict.get("Linearized")) === "number" && obj > 0)) {
  16618. return null;
  16619. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  16620. throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
  16621. }
  16622. return {
  16623. length,
  16624. hints: getHints(linDict),
  16625. objectNumberFirst: getInt(linDict, "O"),
  16626. endFirst: getInt(linDict, "E"),
  16627. numPages: getInt(linDict, "N"),
  16628. mainXRefEntriesOffset: getInt(linDict, "T"),
  16629. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
  16630. };
  16631. }
  16632. }
  16633. exports.Linearization = Linearization;
  16634. /***/ }),
  16635. /* 143 */
  16636. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16637. "use strict";
  16638. Object.defineProperty(exports, "__esModule", ({
  16639. value: true
  16640. }));
  16641. exports.Ascii85Stream = void 0;
  16642. var _decode_stream = __w_pdfjs_require__(144);
  16643. var _core_utils = __w_pdfjs_require__(131);
  16644. class Ascii85Stream extends _decode_stream.DecodeStream {
  16645. constructor(str, maybeLength) {
  16646. if (maybeLength) {
  16647. maybeLength *= 0.8;
  16648. }
  16649. super(maybeLength);
  16650. this.str = str;
  16651. this.dict = str.dict;
  16652. this.input = new Uint8Array(5);
  16653. }
  16654. readBlock() {
  16655. const TILDA_CHAR = 0x7e;
  16656. const Z_LOWER_CHAR = 0x7a;
  16657. const EOF = -1;
  16658. const str = this.str;
  16659. let c = str.getByte();
  16660. while ((0, _core_utils.isWhiteSpace)(c)) {
  16661. c = str.getByte();
  16662. }
  16663. if (c === EOF || c === TILDA_CHAR) {
  16664. this.eof = true;
  16665. return;
  16666. }
  16667. const bufferLength = this.bufferLength;
  16668. let buffer, i;
  16669. if (c === Z_LOWER_CHAR) {
  16670. buffer = this.ensureBuffer(bufferLength + 4);
  16671. for (i = 0; i < 4; ++i) {
  16672. buffer[bufferLength + i] = 0;
  16673. }
  16674. this.bufferLength += 4;
  16675. } else {
  16676. const input = this.input;
  16677. input[0] = c;
  16678. for (i = 1; i < 5; ++i) {
  16679. c = str.getByte();
  16680. while ((0, _core_utils.isWhiteSpace)(c)) {
  16681. c = str.getByte();
  16682. }
  16683. input[i] = c;
  16684. if (c === EOF || c === TILDA_CHAR) {
  16685. break;
  16686. }
  16687. }
  16688. buffer = this.ensureBuffer(bufferLength + i - 1);
  16689. this.bufferLength += i - 1;
  16690. if (i < 5) {
  16691. for (; i < 5; ++i) {
  16692. input[i] = 0x21 + 84;
  16693. }
  16694. this.eof = true;
  16695. }
  16696. let t = 0;
  16697. for (i = 0; i < 5; ++i) {
  16698. t = t * 85 + (input[i] - 0x21);
  16699. }
  16700. for (i = 3; i >= 0; --i) {
  16701. buffer[bufferLength + i] = t & 0xff;
  16702. t >>= 8;
  16703. }
  16704. }
  16705. }
  16706. }
  16707. exports.Ascii85Stream = Ascii85Stream;
  16708. /***/ }),
  16709. /* 144 */
  16710. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16711. "use strict";
  16712. Object.defineProperty(exports, "__esModule", ({
  16713. value: true
  16714. }));
  16715. exports.StreamsSequenceStream = exports.DecodeStream = void 0;
  16716. var _base_stream = __w_pdfjs_require__(132);
  16717. var _stream = __w_pdfjs_require__(135);
  16718. const emptyBuffer = new Uint8Array(0);
  16719. class DecodeStream extends _base_stream.BaseStream {
  16720. constructor(maybeMinBufferLength) {
  16721. super();
  16722. this._rawMinBufferLength = maybeMinBufferLength || 0;
  16723. this.pos = 0;
  16724. this.bufferLength = 0;
  16725. this.eof = false;
  16726. this.buffer = emptyBuffer;
  16727. this.minBufferLength = 512;
  16728. if (maybeMinBufferLength) {
  16729. while (this.minBufferLength < maybeMinBufferLength) {
  16730. this.minBufferLength *= 2;
  16731. }
  16732. }
  16733. }
  16734. get isEmpty() {
  16735. while (!this.eof && this.bufferLength === 0) {
  16736. this.readBlock();
  16737. }
  16738. return this.bufferLength === 0;
  16739. }
  16740. ensureBuffer(requested) {
  16741. const buffer = this.buffer;
  16742. if (requested <= buffer.byteLength) {
  16743. return buffer;
  16744. }
  16745. let size = this.minBufferLength;
  16746. while (size < requested) {
  16747. size *= 2;
  16748. }
  16749. const buffer2 = new Uint8Array(size);
  16750. buffer2.set(buffer);
  16751. return this.buffer = buffer2;
  16752. }
  16753. getByte() {
  16754. const pos = this.pos;
  16755. while (this.bufferLength <= pos) {
  16756. if (this.eof) {
  16757. return -1;
  16758. }
  16759. this.readBlock();
  16760. }
  16761. return this.buffer[this.pos++];
  16762. }
  16763. getBytes(length) {
  16764. const pos = this.pos;
  16765. let end;
  16766. if (length) {
  16767. this.ensureBuffer(pos + length);
  16768. end = pos + length;
  16769. while (!this.eof && this.bufferLength < end) {
  16770. this.readBlock();
  16771. }
  16772. const bufEnd = this.bufferLength;
  16773. if (end > bufEnd) {
  16774. end = bufEnd;
  16775. }
  16776. } else {
  16777. while (!this.eof) {
  16778. this.readBlock();
  16779. }
  16780. end = this.bufferLength;
  16781. }
  16782. this.pos = end;
  16783. return this.buffer.subarray(pos, end);
  16784. }
  16785. reset() {
  16786. this.pos = 0;
  16787. }
  16788. makeSubStream(start, length) {
  16789. let dict = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  16790. if (length === undefined) {
  16791. while (!this.eof) {
  16792. this.readBlock();
  16793. }
  16794. } else {
  16795. const end = start + length;
  16796. while (this.bufferLength <= end && !this.eof) {
  16797. this.readBlock();
  16798. }
  16799. }
  16800. return new _stream.Stream(this.buffer, start, length, dict);
  16801. }
  16802. getBaseStreams() {
  16803. return this.str ? this.str.getBaseStreams() : null;
  16804. }
  16805. }
  16806. exports.DecodeStream = DecodeStream;
  16807. class StreamsSequenceStream extends DecodeStream {
  16808. constructor(streams) {
  16809. let onError = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  16810. let maybeLength = 0;
  16811. for (const stream of streams) {
  16812. maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length;
  16813. }
  16814. super(maybeLength);
  16815. this.streams = streams;
  16816. this._onError = onError;
  16817. }
  16818. readBlock() {
  16819. const streams = this.streams;
  16820. if (streams.length === 0) {
  16821. this.eof = true;
  16822. return;
  16823. }
  16824. const stream = streams.shift();
  16825. let chunk;
  16826. try {
  16827. chunk = stream.getBytes();
  16828. } catch (reason) {
  16829. if (this._onError) {
  16830. this._onError(reason, stream.dict && stream.dict.objId);
  16831. return;
  16832. }
  16833. throw reason;
  16834. }
  16835. const bufferLength = this.bufferLength;
  16836. const newLength = bufferLength + chunk.length;
  16837. const buffer = this.ensureBuffer(newLength);
  16838. buffer.set(chunk, bufferLength);
  16839. this.bufferLength = newLength;
  16840. }
  16841. getBaseStreams() {
  16842. const baseStreamsBuf = [];
  16843. for (const stream of this.streams) {
  16844. const baseStreams = stream.getBaseStreams();
  16845. if (baseStreams) {
  16846. baseStreamsBuf.push(...baseStreams);
  16847. }
  16848. }
  16849. return baseStreamsBuf.length > 0 ? baseStreamsBuf : null;
  16850. }
  16851. }
  16852. exports.StreamsSequenceStream = StreamsSequenceStream;
  16853. /***/ }),
  16854. /* 145 */
  16855. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16856. "use strict";
  16857. Object.defineProperty(exports, "__esModule", ({
  16858. value: true
  16859. }));
  16860. exports.AsciiHexStream = void 0;
  16861. var _decode_stream = __w_pdfjs_require__(144);
  16862. class AsciiHexStream extends _decode_stream.DecodeStream {
  16863. constructor(str, maybeLength) {
  16864. if (maybeLength) {
  16865. maybeLength *= 0.5;
  16866. }
  16867. super(maybeLength);
  16868. this.str = str;
  16869. this.dict = str.dict;
  16870. this.firstDigit = -1;
  16871. }
  16872. readBlock() {
  16873. const UPSTREAM_BLOCK_SIZE = 8000;
  16874. const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  16875. if (!bytes.length) {
  16876. this.eof = true;
  16877. return;
  16878. }
  16879. const maxDecodeLength = bytes.length + 1 >> 1;
  16880. const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  16881. let bufferLength = this.bufferLength;
  16882. let firstDigit = this.firstDigit;
  16883. for (const ch of bytes) {
  16884. let digit;
  16885. if (ch >= 0x30 && ch <= 0x39) {
  16886. digit = ch & 0x0f;
  16887. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  16888. digit = (ch & 0x0f) + 9;
  16889. } else if (ch === 0x3e) {
  16890. this.eof = true;
  16891. break;
  16892. } else {
  16893. continue;
  16894. }
  16895. if (firstDigit < 0) {
  16896. firstDigit = digit;
  16897. } else {
  16898. buffer[bufferLength++] = firstDigit << 4 | digit;
  16899. firstDigit = -1;
  16900. }
  16901. }
  16902. if (firstDigit >= 0 && this.eof) {
  16903. buffer[bufferLength++] = firstDigit << 4;
  16904. firstDigit = -1;
  16905. }
  16906. this.firstDigit = firstDigit;
  16907. this.bufferLength = bufferLength;
  16908. }
  16909. }
  16910. exports.AsciiHexStream = AsciiHexStream;
  16911. /***/ }),
  16912. /* 146 */
  16913. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16914. "use strict";
  16915. Object.defineProperty(exports, "__esModule", ({
  16916. value: true
  16917. }));
  16918. exports.CCITTFaxStream = void 0;
  16919. var _ccitt = __w_pdfjs_require__(147);
  16920. var _decode_stream = __w_pdfjs_require__(144);
  16921. var _primitives = __w_pdfjs_require__(130);
  16922. class CCITTFaxStream extends _decode_stream.DecodeStream {
  16923. constructor(str, maybeLength, params) {
  16924. super(maybeLength);
  16925. this.str = str;
  16926. this.dict = str.dict;
  16927. if (!(params instanceof _primitives.Dict)) {
  16928. params = _primitives.Dict.empty;
  16929. }
  16930. const source = {
  16931. next() {
  16932. return str.getByte();
  16933. }
  16934. };
  16935. this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
  16936. K: params.get("K"),
  16937. EndOfLine: params.get("EndOfLine"),
  16938. EncodedByteAlign: params.get("EncodedByteAlign"),
  16939. Columns: params.get("Columns"),
  16940. Rows: params.get("Rows"),
  16941. EndOfBlock: params.get("EndOfBlock"),
  16942. BlackIs1: params.get("BlackIs1")
  16943. });
  16944. }
  16945. readBlock() {
  16946. while (!this.eof) {
  16947. const c = this.ccittFaxDecoder.readNextChar();
  16948. if (c === -1) {
  16949. this.eof = true;
  16950. return;
  16951. }
  16952. this.ensureBuffer(this.bufferLength + 1);
  16953. this.buffer[this.bufferLength++] = c;
  16954. }
  16955. }
  16956. }
  16957. exports.CCITTFaxStream = CCITTFaxStream;
  16958. /***/ }),
  16959. /* 147 */
  16960. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16961. "use strict";
  16962. Object.defineProperty(exports, "__esModule", ({
  16963. value: true
  16964. }));
  16965. exports.CCITTFaxDecoder = void 0;
  16966. var _util = __w_pdfjs_require__(2);
  16967. const ccittEOL = -2;
  16968. const ccittEOF = -1;
  16969. const twoDimPass = 0;
  16970. const twoDimHoriz = 1;
  16971. const twoDimVert0 = 2;
  16972. const twoDimVertR1 = 3;
  16973. const twoDimVertL1 = 4;
  16974. const twoDimVertR2 = 5;
  16975. const twoDimVertL2 = 6;
  16976. const twoDimVertR3 = 7;
  16977. const twoDimVertL3 = 8;
  16978. 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]];
  16979. 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]];
  16980. 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]];
  16981. 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]];
  16982. 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]];
  16983. 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]];
  16984. class CCITTFaxDecoder {
  16985. constructor(source) {
  16986. let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  16987. if (!source || typeof source.next !== "function") {
  16988. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  16989. }
  16990. this.source = source;
  16991. this.eof = false;
  16992. this.encoding = options.K || 0;
  16993. this.eoline = options.EndOfLine || false;
  16994. this.byteAlign = options.EncodedByteAlign || false;
  16995. this.columns = options.Columns || 1728;
  16996. this.rows = options.Rows || 0;
  16997. let eoblock = options.EndOfBlock;
  16998. if (eoblock === null || eoblock === undefined) {
  16999. eoblock = true;
  17000. }
  17001. this.eoblock = eoblock;
  17002. this.black = options.BlackIs1 || false;
  17003. this.codingLine = new Uint32Array(this.columns + 1);
  17004. this.refLine = new Uint32Array(this.columns + 2);
  17005. this.codingLine[0] = this.columns;
  17006. this.codingPos = 0;
  17007. this.row = 0;
  17008. this.nextLine2D = this.encoding < 0;
  17009. this.inputBits = 0;
  17010. this.inputBuf = 0;
  17011. this.outputBits = 0;
  17012. this.rowsDone = false;
  17013. let code1;
  17014. while ((code1 = this._lookBits(12)) === 0) {
  17015. this._eatBits(1);
  17016. }
  17017. if (code1 === 1) {
  17018. this._eatBits(12);
  17019. }
  17020. if (this.encoding > 0) {
  17021. this.nextLine2D = !this._lookBits(1);
  17022. this._eatBits(1);
  17023. }
  17024. }
  17025. readNextChar() {
  17026. if (this.eof) {
  17027. return -1;
  17028. }
  17029. const refLine = this.refLine;
  17030. const codingLine = this.codingLine;
  17031. const columns = this.columns;
  17032. let refPos, blackPixels, bits, i;
  17033. if (this.outputBits === 0) {
  17034. if (this.rowsDone) {
  17035. this.eof = true;
  17036. }
  17037. if (this.eof) {
  17038. return -1;
  17039. }
  17040. this.err = false;
  17041. let code1, code2, code3;
  17042. if (this.nextLine2D) {
  17043. for (i = 0; codingLine[i] < columns; ++i) {
  17044. refLine[i] = codingLine[i];
  17045. }
  17046. refLine[i++] = columns;
  17047. refLine[i] = columns;
  17048. codingLine[0] = 0;
  17049. this.codingPos = 0;
  17050. refPos = 0;
  17051. blackPixels = 0;
  17052. while (codingLine[this.codingPos] < columns) {
  17053. code1 = this._getTwoDimCode();
  17054. switch (code1) {
  17055. case twoDimPass:
  17056. this._addPixels(refLine[refPos + 1], blackPixels);
  17057. if (refLine[refPos + 1] < columns) {
  17058. refPos += 2;
  17059. }
  17060. break;
  17061. case twoDimHoriz:
  17062. code1 = code2 = 0;
  17063. if (blackPixels) {
  17064. do {
  17065. code1 += code3 = this._getBlackCode();
  17066. } while (code3 >= 64);
  17067. do {
  17068. code2 += code3 = this._getWhiteCode();
  17069. } while (code3 >= 64);
  17070. } else {
  17071. do {
  17072. code1 += code3 = this._getWhiteCode();
  17073. } while (code3 >= 64);
  17074. do {
  17075. code2 += code3 = this._getBlackCode();
  17076. } while (code3 >= 64);
  17077. }
  17078. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  17079. if (codingLine[this.codingPos] < columns) {
  17080. this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  17081. }
  17082. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17083. refPos += 2;
  17084. }
  17085. break;
  17086. case twoDimVertR3:
  17087. this._addPixels(refLine[refPos] + 3, blackPixels);
  17088. blackPixels ^= 1;
  17089. if (codingLine[this.codingPos] < columns) {
  17090. ++refPos;
  17091. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17092. refPos += 2;
  17093. }
  17094. }
  17095. break;
  17096. case twoDimVertR2:
  17097. this._addPixels(refLine[refPos] + 2, blackPixels);
  17098. blackPixels ^= 1;
  17099. if (codingLine[this.codingPos] < columns) {
  17100. ++refPos;
  17101. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17102. refPos += 2;
  17103. }
  17104. }
  17105. break;
  17106. case twoDimVertR1:
  17107. this._addPixels(refLine[refPos] + 1, blackPixels);
  17108. blackPixels ^= 1;
  17109. if (codingLine[this.codingPos] < columns) {
  17110. ++refPos;
  17111. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17112. refPos += 2;
  17113. }
  17114. }
  17115. break;
  17116. case twoDimVert0:
  17117. this._addPixels(refLine[refPos], blackPixels);
  17118. blackPixels ^= 1;
  17119. if (codingLine[this.codingPos] < columns) {
  17120. ++refPos;
  17121. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17122. refPos += 2;
  17123. }
  17124. }
  17125. break;
  17126. case twoDimVertL3:
  17127. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  17128. blackPixels ^= 1;
  17129. if (codingLine[this.codingPos] < columns) {
  17130. if (refPos > 0) {
  17131. --refPos;
  17132. } else {
  17133. ++refPos;
  17134. }
  17135. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17136. refPos += 2;
  17137. }
  17138. }
  17139. break;
  17140. case twoDimVertL2:
  17141. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  17142. blackPixels ^= 1;
  17143. if (codingLine[this.codingPos] < columns) {
  17144. if (refPos > 0) {
  17145. --refPos;
  17146. } else {
  17147. ++refPos;
  17148. }
  17149. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17150. refPos += 2;
  17151. }
  17152. }
  17153. break;
  17154. case twoDimVertL1:
  17155. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  17156. blackPixels ^= 1;
  17157. if (codingLine[this.codingPos] < columns) {
  17158. if (refPos > 0) {
  17159. --refPos;
  17160. } else {
  17161. ++refPos;
  17162. }
  17163. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17164. refPos += 2;
  17165. }
  17166. }
  17167. break;
  17168. case ccittEOF:
  17169. this._addPixels(columns, 0);
  17170. this.eof = true;
  17171. break;
  17172. default:
  17173. (0, _util.info)("bad 2d code");
  17174. this._addPixels(columns, 0);
  17175. this.err = true;
  17176. }
  17177. }
  17178. } else {
  17179. codingLine[0] = 0;
  17180. this.codingPos = 0;
  17181. blackPixels = 0;
  17182. while (codingLine[this.codingPos] < columns) {
  17183. code1 = 0;
  17184. if (blackPixels) {
  17185. do {
  17186. code1 += code3 = this._getBlackCode();
  17187. } while (code3 >= 64);
  17188. } else {
  17189. do {
  17190. code1 += code3 = this._getWhiteCode();
  17191. } while (code3 >= 64);
  17192. }
  17193. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  17194. blackPixels ^= 1;
  17195. }
  17196. }
  17197. let gotEOL = false;
  17198. if (this.byteAlign) {
  17199. this.inputBits &= ~7;
  17200. }
  17201. if (!this.eoblock && this.row === this.rows - 1) {
  17202. this.rowsDone = true;
  17203. } else {
  17204. code1 = this._lookBits(12);
  17205. if (this.eoline) {
  17206. while (code1 !== ccittEOF && code1 !== 1) {
  17207. this._eatBits(1);
  17208. code1 = this._lookBits(12);
  17209. }
  17210. } else {
  17211. while (code1 === 0) {
  17212. this._eatBits(1);
  17213. code1 = this._lookBits(12);
  17214. }
  17215. }
  17216. if (code1 === 1) {
  17217. this._eatBits(12);
  17218. gotEOL = true;
  17219. } else if (code1 === ccittEOF) {
  17220. this.eof = true;
  17221. }
  17222. }
  17223. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  17224. this.nextLine2D = !this._lookBits(1);
  17225. this._eatBits(1);
  17226. }
  17227. if (this.eoblock && gotEOL && this.byteAlign) {
  17228. code1 = this._lookBits(12);
  17229. if (code1 === 1) {
  17230. this._eatBits(12);
  17231. if (this.encoding > 0) {
  17232. this._lookBits(1);
  17233. this._eatBits(1);
  17234. }
  17235. if (this.encoding >= 0) {
  17236. for (i = 0; i < 4; ++i) {
  17237. code1 = this._lookBits(12);
  17238. if (code1 !== 1) {
  17239. (0, _util.info)("bad rtc code: " + code1);
  17240. }
  17241. this._eatBits(12);
  17242. if (this.encoding > 0) {
  17243. this._lookBits(1);
  17244. this._eatBits(1);
  17245. }
  17246. }
  17247. }
  17248. this.eof = true;
  17249. }
  17250. } else if (this.err && this.eoline) {
  17251. while (true) {
  17252. code1 = this._lookBits(13);
  17253. if (code1 === ccittEOF) {
  17254. this.eof = true;
  17255. return -1;
  17256. }
  17257. if (code1 >> 1 === 1) {
  17258. break;
  17259. }
  17260. this._eatBits(1);
  17261. }
  17262. this._eatBits(12);
  17263. if (this.encoding > 0) {
  17264. this._eatBits(1);
  17265. this.nextLine2D = !(code1 & 1);
  17266. }
  17267. }
  17268. if (codingLine[0] > 0) {
  17269. this.outputBits = codingLine[this.codingPos = 0];
  17270. } else {
  17271. this.outputBits = codingLine[this.codingPos = 1];
  17272. }
  17273. this.row++;
  17274. }
  17275. let c;
  17276. if (this.outputBits >= 8) {
  17277. c = this.codingPos & 1 ? 0 : 0xff;
  17278. this.outputBits -= 8;
  17279. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  17280. this.codingPos++;
  17281. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  17282. }
  17283. } else {
  17284. bits = 8;
  17285. c = 0;
  17286. do {
  17287. if (typeof this.outputBits !== "number") {
  17288. throw new _util.FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.');
  17289. }
  17290. if (this.outputBits > bits) {
  17291. c <<= bits;
  17292. if (!(this.codingPos & 1)) {
  17293. c |= 0xff >> 8 - bits;
  17294. }
  17295. this.outputBits -= bits;
  17296. bits = 0;
  17297. } else {
  17298. c <<= this.outputBits;
  17299. if (!(this.codingPos & 1)) {
  17300. c |= 0xff >> 8 - this.outputBits;
  17301. }
  17302. bits -= this.outputBits;
  17303. this.outputBits = 0;
  17304. if (codingLine[this.codingPos] < columns) {
  17305. this.codingPos++;
  17306. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  17307. } else if (bits > 0) {
  17308. c <<= bits;
  17309. bits = 0;
  17310. }
  17311. }
  17312. } while (bits);
  17313. }
  17314. if (this.black) {
  17315. c ^= 0xff;
  17316. }
  17317. return c;
  17318. }
  17319. _addPixels(a1, blackPixels) {
  17320. const codingLine = this.codingLine;
  17321. let codingPos = this.codingPos;
  17322. if (a1 > codingLine[codingPos]) {
  17323. if (a1 > this.columns) {
  17324. (0, _util.info)("row is wrong length");
  17325. this.err = true;
  17326. a1 = this.columns;
  17327. }
  17328. if (codingPos & 1 ^ blackPixels) {
  17329. ++codingPos;
  17330. }
  17331. codingLine[codingPos] = a1;
  17332. }
  17333. this.codingPos = codingPos;
  17334. }
  17335. _addPixelsNeg(a1, blackPixels) {
  17336. const codingLine = this.codingLine;
  17337. let codingPos = this.codingPos;
  17338. if (a1 > codingLine[codingPos]) {
  17339. if (a1 > this.columns) {
  17340. (0, _util.info)("row is wrong length");
  17341. this.err = true;
  17342. a1 = this.columns;
  17343. }
  17344. if (codingPos & 1 ^ blackPixels) {
  17345. ++codingPos;
  17346. }
  17347. codingLine[codingPos] = a1;
  17348. } else if (a1 < codingLine[codingPos]) {
  17349. if (a1 < 0) {
  17350. (0, _util.info)("invalid code");
  17351. this.err = true;
  17352. a1 = 0;
  17353. }
  17354. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  17355. --codingPos;
  17356. }
  17357. codingLine[codingPos] = a1;
  17358. }
  17359. this.codingPos = codingPos;
  17360. }
  17361. _findTableCode(start, end, table, limit) {
  17362. const limitValue = limit || 0;
  17363. for (let i = start; i <= end; ++i) {
  17364. let code = this._lookBits(i);
  17365. if (code === ccittEOF) {
  17366. return [true, 1, false];
  17367. }
  17368. if (i < end) {
  17369. code <<= end - i;
  17370. }
  17371. if (!limitValue || code >= limitValue) {
  17372. const p = table[code - limitValue];
  17373. if (p[0] === i) {
  17374. this._eatBits(i);
  17375. return [true, p[1], true];
  17376. }
  17377. }
  17378. }
  17379. return [false, 0, false];
  17380. }
  17381. _getTwoDimCode() {
  17382. let code = 0;
  17383. let p;
  17384. if (this.eoblock) {
  17385. code = this._lookBits(7);
  17386. p = twoDimTable[code];
  17387. if (p && p[0] > 0) {
  17388. this._eatBits(p[0]);
  17389. return p[1];
  17390. }
  17391. } else {
  17392. const result = this._findTableCode(1, 7, twoDimTable);
  17393. if (result[0] && result[2]) {
  17394. return result[1];
  17395. }
  17396. }
  17397. (0, _util.info)("Bad two dim code");
  17398. return ccittEOF;
  17399. }
  17400. _getWhiteCode() {
  17401. let code = 0;
  17402. let p;
  17403. if (this.eoblock) {
  17404. code = this._lookBits(12);
  17405. if (code === ccittEOF) {
  17406. return 1;
  17407. }
  17408. if (code >> 5 === 0) {
  17409. p = whiteTable1[code];
  17410. } else {
  17411. p = whiteTable2[code >> 3];
  17412. }
  17413. if (p[0] > 0) {
  17414. this._eatBits(p[0]);
  17415. return p[1];
  17416. }
  17417. } else {
  17418. let result = this._findTableCode(1, 9, whiteTable2);
  17419. if (result[0]) {
  17420. return result[1];
  17421. }
  17422. result = this._findTableCode(11, 12, whiteTable1);
  17423. if (result[0]) {
  17424. return result[1];
  17425. }
  17426. }
  17427. (0, _util.info)("bad white code");
  17428. this._eatBits(1);
  17429. return 1;
  17430. }
  17431. _getBlackCode() {
  17432. let code, p;
  17433. if (this.eoblock) {
  17434. code = this._lookBits(13);
  17435. if (code === ccittEOF) {
  17436. return 1;
  17437. }
  17438. if (code >> 7 === 0) {
  17439. p = blackTable1[code];
  17440. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  17441. p = blackTable2[(code >> 1) - 64];
  17442. } else {
  17443. p = blackTable3[code >> 7];
  17444. }
  17445. if (p[0] > 0) {
  17446. this._eatBits(p[0]);
  17447. return p[1];
  17448. }
  17449. } else {
  17450. let result = this._findTableCode(2, 6, blackTable3);
  17451. if (result[0]) {
  17452. return result[1];
  17453. }
  17454. result = this._findTableCode(7, 12, blackTable2, 64);
  17455. if (result[0]) {
  17456. return result[1];
  17457. }
  17458. result = this._findTableCode(10, 13, blackTable1);
  17459. if (result[0]) {
  17460. return result[1];
  17461. }
  17462. }
  17463. (0, _util.info)("bad black code");
  17464. this._eatBits(1);
  17465. return 1;
  17466. }
  17467. _lookBits(n) {
  17468. let c;
  17469. while (this.inputBits < n) {
  17470. if ((c = this.source.next()) === -1) {
  17471. if (this.inputBits === 0) {
  17472. return ccittEOF;
  17473. }
  17474. return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
  17475. }
  17476. this.inputBuf = this.inputBuf << 8 | c;
  17477. this.inputBits += 8;
  17478. }
  17479. return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
  17480. }
  17481. _eatBits(n) {
  17482. if ((this.inputBits -= n) < 0) {
  17483. this.inputBits = 0;
  17484. }
  17485. }
  17486. }
  17487. exports.CCITTFaxDecoder = CCITTFaxDecoder;
  17488. /***/ }),
  17489. /* 148 */
  17490. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17491. "use strict";
  17492. Object.defineProperty(exports, "__esModule", ({
  17493. value: true
  17494. }));
  17495. exports.FlateStream = void 0;
  17496. var _decode_stream = __w_pdfjs_require__(144);
  17497. var _util = __w_pdfjs_require__(2);
  17498. const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  17499. 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]);
  17500. 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]);
  17501. 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];
  17502. 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];
  17503. class FlateStream extends _decode_stream.DecodeStream {
  17504. constructor(str, maybeLength) {
  17505. super(maybeLength);
  17506. this.str = str;
  17507. this.dict = str.dict;
  17508. const cmf = str.getByte();
  17509. const flg = str.getByte();
  17510. if (cmf === -1 || flg === -1) {
  17511. throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
  17512. }
  17513. if ((cmf & 0x0f) !== 0x08) {
  17514. throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
  17515. }
  17516. if (((cmf << 8) + flg) % 31 !== 0) {
  17517. throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
  17518. }
  17519. if (flg & 0x20) {
  17520. throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
  17521. }
  17522. this.codeSize = 0;
  17523. this.codeBuf = 0;
  17524. }
  17525. getBits(bits) {
  17526. const str = this.str;
  17527. let codeSize = this.codeSize;
  17528. let codeBuf = this.codeBuf;
  17529. let b;
  17530. while (codeSize < bits) {
  17531. if ((b = str.getByte()) === -1) {
  17532. throw new _util.FormatError("Bad encoding in flate stream");
  17533. }
  17534. codeBuf |= b << codeSize;
  17535. codeSize += 8;
  17536. }
  17537. b = codeBuf & (1 << bits) - 1;
  17538. this.codeBuf = codeBuf >> bits;
  17539. this.codeSize = codeSize -= bits;
  17540. return b;
  17541. }
  17542. getCode(table) {
  17543. const str = this.str;
  17544. const codes = table[0];
  17545. const maxLen = table[1];
  17546. let codeSize = this.codeSize;
  17547. let codeBuf = this.codeBuf;
  17548. let b;
  17549. while (codeSize < maxLen) {
  17550. if ((b = str.getByte()) === -1) {
  17551. break;
  17552. }
  17553. codeBuf |= b << codeSize;
  17554. codeSize += 8;
  17555. }
  17556. const code = codes[codeBuf & (1 << maxLen) - 1];
  17557. const codeLen = code >> 16;
  17558. const codeVal = code & 0xffff;
  17559. if (codeLen < 1 || codeSize < codeLen) {
  17560. throw new _util.FormatError("Bad encoding in flate stream");
  17561. }
  17562. this.codeBuf = codeBuf >> codeLen;
  17563. this.codeSize = codeSize - codeLen;
  17564. return codeVal;
  17565. }
  17566. generateHuffmanTable(lengths) {
  17567. const n = lengths.length;
  17568. let maxLen = 0;
  17569. let i;
  17570. for (i = 0; i < n; ++i) {
  17571. if (lengths[i] > maxLen) {
  17572. maxLen = lengths[i];
  17573. }
  17574. }
  17575. const size = 1 << maxLen;
  17576. const codes = new Int32Array(size);
  17577. for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  17578. for (let val = 0; val < n; ++val) {
  17579. if (lengths[val] === len) {
  17580. let code2 = 0;
  17581. let t = code;
  17582. for (i = 0; i < len; ++i) {
  17583. code2 = code2 << 1 | t & 1;
  17584. t >>= 1;
  17585. }
  17586. for (i = code2; i < size; i += skip) {
  17587. codes[i] = len << 16 | val;
  17588. }
  17589. ++code;
  17590. }
  17591. }
  17592. }
  17593. return [codes, maxLen];
  17594. }
  17595. readBlock() {
  17596. let buffer, len;
  17597. const str = this.str;
  17598. let hdr = this.getBits(3);
  17599. if (hdr & 1) {
  17600. this.eof = true;
  17601. }
  17602. hdr >>= 1;
  17603. if (hdr === 0) {
  17604. let b;
  17605. if ((b = str.getByte()) === -1) {
  17606. throw new _util.FormatError("Bad block header in flate stream");
  17607. }
  17608. let blockLen = b;
  17609. if ((b = str.getByte()) === -1) {
  17610. throw new _util.FormatError("Bad block header in flate stream");
  17611. }
  17612. blockLen |= b << 8;
  17613. if ((b = str.getByte()) === -1) {
  17614. throw new _util.FormatError("Bad block header in flate stream");
  17615. }
  17616. let check = b;
  17617. if ((b = str.getByte()) === -1) {
  17618. throw new _util.FormatError("Bad block header in flate stream");
  17619. }
  17620. check |= b << 8;
  17621. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  17622. throw new _util.FormatError("Bad uncompressed block length in flate stream");
  17623. }
  17624. this.codeBuf = 0;
  17625. this.codeSize = 0;
  17626. const bufferLength = this.bufferLength,
  17627. end = bufferLength + blockLen;
  17628. buffer = this.ensureBuffer(end);
  17629. this.bufferLength = end;
  17630. if (blockLen === 0) {
  17631. if (str.peekByte() === -1) {
  17632. this.eof = true;
  17633. }
  17634. } else {
  17635. const block = str.getBytes(blockLen);
  17636. buffer.set(block, bufferLength);
  17637. if (block.length < blockLen) {
  17638. this.eof = true;
  17639. }
  17640. }
  17641. return;
  17642. }
  17643. let litCodeTable;
  17644. let distCodeTable;
  17645. if (hdr === 1) {
  17646. litCodeTable = fixedLitCodeTab;
  17647. distCodeTable = fixedDistCodeTab;
  17648. } else if (hdr === 2) {
  17649. const numLitCodes = this.getBits(5) + 257;
  17650. const numDistCodes = this.getBits(5) + 1;
  17651. const numCodeLenCodes = this.getBits(4) + 4;
  17652. const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  17653. let i;
  17654. for (i = 0; i < numCodeLenCodes; ++i) {
  17655. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  17656. }
  17657. const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  17658. len = 0;
  17659. i = 0;
  17660. const codes = numLitCodes + numDistCodes;
  17661. const codeLengths = new Uint8Array(codes);
  17662. let bitsLength, bitsOffset, what;
  17663. while (i < codes) {
  17664. const code = this.getCode(codeLenCodeTab);
  17665. if (code === 16) {
  17666. bitsLength = 2;
  17667. bitsOffset = 3;
  17668. what = len;
  17669. } else if (code === 17) {
  17670. bitsLength = 3;
  17671. bitsOffset = 3;
  17672. what = len = 0;
  17673. } else if (code === 18) {
  17674. bitsLength = 7;
  17675. bitsOffset = 11;
  17676. what = len = 0;
  17677. } else {
  17678. codeLengths[i++] = len = code;
  17679. continue;
  17680. }
  17681. let repeatLength = this.getBits(bitsLength) + bitsOffset;
  17682. while (repeatLength-- > 0) {
  17683. codeLengths[i++] = what;
  17684. }
  17685. }
  17686. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  17687. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  17688. } else {
  17689. throw new _util.FormatError("Unknown block type in flate stream");
  17690. }
  17691. buffer = this.buffer;
  17692. let limit = buffer ? buffer.length : 0;
  17693. let pos = this.bufferLength;
  17694. while (true) {
  17695. let code1 = this.getCode(litCodeTable);
  17696. if (code1 < 256) {
  17697. if (pos + 1 >= limit) {
  17698. buffer = this.ensureBuffer(pos + 1);
  17699. limit = buffer.length;
  17700. }
  17701. buffer[pos++] = code1;
  17702. continue;
  17703. }
  17704. if (code1 === 256) {
  17705. this.bufferLength = pos;
  17706. return;
  17707. }
  17708. code1 -= 257;
  17709. code1 = lengthDecode[code1];
  17710. let code2 = code1 >> 16;
  17711. if (code2 > 0) {
  17712. code2 = this.getBits(code2);
  17713. }
  17714. len = (code1 & 0xffff) + code2;
  17715. code1 = this.getCode(distCodeTable);
  17716. code1 = distDecode[code1];
  17717. code2 = code1 >> 16;
  17718. if (code2 > 0) {
  17719. code2 = this.getBits(code2);
  17720. }
  17721. const dist = (code1 & 0xffff) + code2;
  17722. if (pos + len >= limit) {
  17723. buffer = this.ensureBuffer(pos + len);
  17724. limit = buffer.length;
  17725. }
  17726. for (let k = 0; k < len; ++k, ++pos) {
  17727. buffer[pos] = buffer[pos - dist];
  17728. }
  17729. }
  17730. }
  17731. }
  17732. exports.FlateStream = FlateStream;
  17733. /***/ }),
  17734. /* 149 */
  17735. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17736. "use strict";
  17737. Object.defineProperty(exports, "__esModule", ({
  17738. value: true
  17739. }));
  17740. exports.Jbig2Stream = void 0;
  17741. var _base_stream = __w_pdfjs_require__(132);
  17742. var _decode_stream = __w_pdfjs_require__(144);
  17743. var _primitives = __w_pdfjs_require__(130);
  17744. var _jbig = __w_pdfjs_require__(150);
  17745. var _util = __w_pdfjs_require__(2);
  17746. class Jbig2Stream extends _decode_stream.DecodeStream {
  17747. constructor(stream, maybeLength, params) {
  17748. super(maybeLength);
  17749. this.stream = stream;
  17750. this.dict = stream.dict;
  17751. this.maybeLength = maybeLength;
  17752. this.params = params;
  17753. }
  17754. get bytes() {
  17755. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  17756. }
  17757. ensureBuffer(requested) {}
  17758. readBlock() {
  17759. if (this.eof) {
  17760. return;
  17761. }
  17762. const jbig2Image = new _jbig.Jbig2Image();
  17763. const chunks = [];
  17764. if (this.params instanceof _primitives.Dict) {
  17765. const globalsStream = this.params.get("JBIG2Globals");
  17766. if (globalsStream instanceof _base_stream.BaseStream) {
  17767. const globals = globalsStream.getBytes();
  17768. chunks.push({
  17769. data: globals,
  17770. start: 0,
  17771. end: globals.length
  17772. });
  17773. }
  17774. }
  17775. chunks.push({
  17776. data: this.bytes,
  17777. start: 0,
  17778. end: this.bytes.length
  17779. });
  17780. const data = jbig2Image.parseChunks(chunks);
  17781. const dataLength = data.length;
  17782. for (let i = 0; i < dataLength; i++) {
  17783. data[i] ^= 0xff;
  17784. }
  17785. this.buffer = data;
  17786. this.bufferLength = dataLength;
  17787. this.eof = true;
  17788. }
  17789. }
  17790. exports.Jbig2Stream = Jbig2Stream;
  17791. /***/ }),
  17792. /* 150 */
  17793. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17794. "use strict";
  17795. Object.defineProperty(exports, "__esModule", ({
  17796. value: true
  17797. }));
  17798. exports.Jbig2Image = void 0;
  17799. var _util = __w_pdfjs_require__(2);
  17800. var _core_utils = __w_pdfjs_require__(131);
  17801. var _arithmetic_decoder = __w_pdfjs_require__(151);
  17802. var _ccitt = __w_pdfjs_require__(147);
  17803. class Jbig2Error extends _util.BaseException {
  17804. constructor(msg) {
  17805. super(`JBIG2 error: ${msg}`, "Jbig2Error");
  17806. }
  17807. }
  17808. class ContextCache {
  17809. getContexts(id) {
  17810. if (id in this) {
  17811. return this[id];
  17812. }
  17813. return this[id] = new Int8Array(1 << 16);
  17814. }
  17815. }
  17816. class DecodingContext {
  17817. constructor(data, start, end) {
  17818. this.data = data;
  17819. this.start = start;
  17820. this.end = end;
  17821. }
  17822. get decoder() {
  17823. const decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
  17824. return (0, _util.shadow)(this, "decoder", decoder);
  17825. }
  17826. get contextCache() {
  17827. const cache = new ContextCache();
  17828. return (0, _util.shadow)(this, "contextCache", cache);
  17829. }
  17830. }
  17831. function decodeInteger(contextCache, procedure, decoder) {
  17832. const contexts = contextCache.getContexts(procedure);
  17833. let prev = 1;
  17834. function readBits(length) {
  17835. let v = 0;
  17836. for (let i = 0; i < length; i++) {
  17837. const bit = decoder.readBit(contexts, prev);
  17838. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  17839. v = v << 1 | bit;
  17840. }
  17841. return v >>> 0;
  17842. }
  17843. const sign = readBits(1);
  17844. 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);
  17845. if (sign === 0) {
  17846. return value;
  17847. } else if (value > 0) {
  17848. return -value;
  17849. }
  17850. return null;
  17851. }
  17852. function decodeIAID(contextCache, decoder, codeLength) {
  17853. const contexts = contextCache.getContexts("IAID");
  17854. let prev = 1;
  17855. for (let i = 0; i < codeLength; i++) {
  17856. const bit = decoder.readBit(contexts, prev);
  17857. prev = prev << 1 | bit;
  17858. }
  17859. if (codeLength < 31) {
  17860. return prev & (1 << codeLength) - 1;
  17861. }
  17862. return prev & 0x7fffffff;
  17863. }
  17864. 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"];
  17865. const CodingTemplates = [[{
  17866. x: -1,
  17867. y: -2
  17868. }, {
  17869. x: 0,
  17870. y: -2
  17871. }, {
  17872. x: 1,
  17873. y: -2
  17874. }, {
  17875. x: -2,
  17876. y: -1
  17877. }, {
  17878. x: -1,
  17879. y: -1
  17880. }, {
  17881. x: 0,
  17882. y: -1
  17883. }, {
  17884. x: 1,
  17885. y: -1
  17886. }, {
  17887. x: 2,
  17888. y: -1
  17889. }, {
  17890. x: -4,
  17891. y: 0
  17892. }, {
  17893. x: -3,
  17894. y: 0
  17895. }, {
  17896. x: -2,
  17897. y: 0
  17898. }, {
  17899. x: -1,
  17900. y: 0
  17901. }], [{
  17902. x: -1,
  17903. y: -2
  17904. }, {
  17905. x: 0,
  17906. y: -2
  17907. }, {
  17908. x: 1,
  17909. y: -2
  17910. }, {
  17911. x: 2,
  17912. y: -2
  17913. }, {
  17914. x: -2,
  17915. y: -1
  17916. }, {
  17917. x: -1,
  17918. y: -1
  17919. }, {
  17920. x: 0,
  17921. y: -1
  17922. }, {
  17923. x: 1,
  17924. y: -1
  17925. }, {
  17926. x: 2,
  17927. y: -1
  17928. }, {
  17929. x: -3,
  17930. y: 0
  17931. }, {
  17932. x: -2,
  17933. y: 0
  17934. }, {
  17935. x: -1,
  17936. y: 0
  17937. }], [{
  17938. x: -1,
  17939. y: -2
  17940. }, {
  17941. x: 0,
  17942. y: -2
  17943. }, {
  17944. x: 1,
  17945. y: -2
  17946. }, {
  17947. x: -2,
  17948. y: -1
  17949. }, {
  17950. x: -1,
  17951. y: -1
  17952. }, {
  17953. x: 0,
  17954. y: -1
  17955. }, {
  17956. x: 1,
  17957. y: -1
  17958. }, {
  17959. x: -2,
  17960. y: 0
  17961. }, {
  17962. x: -1,
  17963. y: 0
  17964. }], [{
  17965. x: -3,
  17966. y: -1
  17967. }, {
  17968. x: -2,
  17969. y: -1
  17970. }, {
  17971. x: -1,
  17972. y: -1
  17973. }, {
  17974. x: 0,
  17975. y: -1
  17976. }, {
  17977. x: 1,
  17978. y: -1
  17979. }, {
  17980. x: -4,
  17981. y: 0
  17982. }, {
  17983. x: -3,
  17984. y: 0
  17985. }, {
  17986. x: -2,
  17987. y: 0
  17988. }, {
  17989. x: -1,
  17990. y: 0
  17991. }]];
  17992. const RefinementTemplates = [{
  17993. coding: [{
  17994. x: 0,
  17995. y: -1
  17996. }, {
  17997. x: 1,
  17998. y: -1
  17999. }, {
  18000. x: -1,
  18001. y: 0
  18002. }],
  18003. reference: [{
  18004. x: 0,
  18005. y: -1
  18006. }, {
  18007. x: 1,
  18008. y: -1
  18009. }, {
  18010. x: -1,
  18011. y: 0
  18012. }, {
  18013. x: 0,
  18014. y: 0
  18015. }, {
  18016. x: 1,
  18017. y: 0
  18018. }, {
  18019. x: -1,
  18020. y: 1
  18021. }, {
  18022. x: 0,
  18023. y: 1
  18024. }, {
  18025. x: 1,
  18026. y: 1
  18027. }]
  18028. }, {
  18029. coding: [{
  18030. x: -1,
  18031. y: -1
  18032. }, {
  18033. x: 0,
  18034. y: -1
  18035. }, {
  18036. x: 1,
  18037. y: -1
  18038. }, {
  18039. x: -1,
  18040. y: 0
  18041. }],
  18042. reference: [{
  18043. x: 0,
  18044. y: -1
  18045. }, {
  18046. x: -1,
  18047. y: 0
  18048. }, {
  18049. x: 0,
  18050. y: 0
  18051. }, {
  18052. x: 1,
  18053. y: 0
  18054. }, {
  18055. x: 0,
  18056. y: 1
  18057. }, {
  18058. x: 1,
  18059. y: 1
  18060. }]
  18061. }];
  18062. const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  18063. const RefinementReusedContexts = [0x0020, 0x0008];
  18064. function decodeBitmapTemplate0(width, height, decodingContext) {
  18065. const decoder = decodingContext.decoder;
  18066. const contexts = decodingContext.contextCache.getContexts("GB");
  18067. const bitmap = [];
  18068. let contextLabel, i, j, pixel, row, row1, row2;
  18069. const OLD_PIXEL_MASK = 0x7bf7;
  18070. for (i = 0; i < height; i++) {
  18071. row = bitmap[i] = new Uint8Array(width);
  18072. row1 = i < 1 ? row : bitmap[i - 1];
  18073. row2 = i < 2 ? row : bitmap[i - 2];
  18074. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  18075. for (j = 0; j < width; j++) {
  18076. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  18077. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  18078. }
  18079. }
  18080. return bitmap;
  18081. }
  18082. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  18083. if (mmr) {
  18084. const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  18085. return decodeMMRBitmap(input, width, height, false);
  18086. }
  18087. 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) {
  18088. return decodeBitmapTemplate0(width, height, decodingContext);
  18089. }
  18090. const useskip = !!skip;
  18091. const template = CodingTemplates[templateIndex].concat(at);
  18092. template.sort(function (a, b) {
  18093. return a.y - b.y || a.x - b.x;
  18094. });
  18095. const templateLength = template.length;
  18096. const templateX = new Int8Array(templateLength);
  18097. const templateY = new Int8Array(templateLength);
  18098. const changingTemplateEntries = [];
  18099. let reuseMask = 0,
  18100. minX = 0,
  18101. maxX = 0,
  18102. minY = 0;
  18103. let c, k;
  18104. for (k = 0; k < templateLength; k++) {
  18105. templateX[k] = template[k].x;
  18106. templateY[k] = template[k].y;
  18107. minX = Math.min(minX, template[k].x);
  18108. maxX = Math.max(maxX, template[k].x);
  18109. minY = Math.min(minY, template[k].y);
  18110. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  18111. reuseMask |= 1 << templateLength - 1 - k;
  18112. } else {
  18113. changingTemplateEntries.push(k);
  18114. }
  18115. }
  18116. const changingEntriesLength = changingTemplateEntries.length;
  18117. const changingTemplateX = new Int8Array(changingEntriesLength);
  18118. const changingTemplateY = new Int8Array(changingEntriesLength);
  18119. const changingTemplateBit = new Uint16Array(changingEntriesLength);
  18120. for (c = 0; c < changingEntriesLength; c++) {
  18121. k = changingTemplateEntries[c];
  18122. changingTemplateX[c] = template[k].x;
  18123. changingTemplateY[c] = template[k].y;
  18124. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  18125. }
  18126. const sbb_left = -minX;
  18127. const sbb_top = -minY;
  18128. const sbb_right = width - maxX;
  18129. const pseudoPixelContext = ReusedContexts[templateIndex];
  18130. let row = new Uint8Array(width);
  18131. const bitmap = [];
  18132. const decoder = decodingContext.decoder;
  18133. const contexts = decodingContext.contextCache.getContexts("GB");
  18134. let ltp = 0,
  18135. j,
  18136. i0,
  18137. j0,
  18138. contextLabel = 0,
  18139. bit,
  18140. shift;
  18141. for (let i = 0; i < height; i++) {
  18142. if (prediction) {
  18143. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  18144. ltp ^= sltp;
  18145. if (ltp) {
  18146. bitmap.push(row);
  18147. continue;
  18148. }
  18149. }
  18150. row = new Uint8Array(row);
  18151. bitmap.push(row);
  18152. for (j = 0; j < width; j++) {
  18153. if (useskip && skip[i][j]) {
  18154. row[j] = 0;
  18155. continue;
  18156. }
  18157. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  18158. contextLabel = contextLabel << 1 & reuseMask;
  18159. for (k = 0; k < changingEntriesLength; k++) {
  18160. i0 = i + changingTemplateY[k];
  18161. j0 = j + changingTemplateX[k];
  18162. bit = bitmap[i0][j0];
  18163. if (bit) {
  18164. bit = changingTemplateBit[k];
  18165. contextLabel |= bit;
  18166. }
  18167. }
  18168. } else {
  18169. contextLabel = 0;
  18170. shift = templateLength - 1;
  18171. for (k = 0; k < templateLength; k++, shift--) {
  18172. j0 = j + templateX[k];
  18173. if (j0 >= 0 && j0 < width) {
  18174. i0 = i + templateY[k];
  18175. if (i0 >= 0) {
  18176. bit = bitmap[i0][j0];
  18177. if (bit) {
  18178. contextLabel |= bit << shift;
  18179. }
  18180. }
  18181. }
  18182. }
  18183. }
  18184. const pixel = decoder.readBit(contexts, contextLabel);
  18185. row[j] = pixel;
  18186. }
  18187. }
  18188. return bitmap;
  18189. }
  18190. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  18191. let codingTemplate = RefinementTemplates[templateIndex].coding;
  18192. if (templateIndex === 0) {
  18193. codingTemplate = codingTemplate.concat([at[0]]);
  18194. }
  18195. const codingTemplateLength = codingTemplate.length;
  18196. const codingTemplateX = new Int32Array(codingTemplateLength);
  18197. const codingTemplateY = new Int32Array(codingTemplateLength);
  18198. let k;
  18199. for (k = 0; k < codingTemplateLength; k++) {
  18200. codingTemplateX[k] = codingTemplate[k].x;
  18201. codingTemplateY[k] = codingTemplate[k].y;
  18202. }
  18203. let referenceTemplate = RefinementTemplates[templateIndex].reference;
  18204. if (templateIndex === 0) {
  18205. referenceTemplate = referenceTemplate.concat([at[1]]);
  18206. }
  18207. const referenceTemplateLength = referenceTemplate.length;
  18208. const referenceTemplateX = new Int32Array(referenceTemplateLength);
  18209. const referenceTemplateY = new Int32Array(referenceTemplateLength);
  18210. for (k = 0; k < referenceTemplateLength; k++) {
  18211. referenceTemplateX[k] = referenceTemplate[k].x;
  18212. referenceTemplateY[k] = referenceTemplate[k].y;
  18213. }
  18214. const referenceWidth = referenceBitmap[0].length;
  18215. const referenceHeight = referenceBitmap.length;
  18216. const pseudoPixelContext = RefinementReusedContexts[templateIndex];
  18217. const bitmap = [];
  18218. const decoder = decodingContext.decoder;
  18219. const contexts = decodingContext.contextCache.getContexts("GR");
  18220. let ltp = 0;
  18221. for (let i = 0; i < height; i++) {
  18222. if (prediction) {
  18223. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  18224. ltp ^= sltp;
  18225. if (ltp) {
  18226. throw new Jbig2Error("prediction is not supported");
  18227. }
  18228. }
  18229. const row = new Uint8Array(width);
  18230. bitmap.push(row);
  18231. for (let j = 0; j < width; j++) {
  18232. let i0, j0;
  18233. let contextLabel = 0;
  18234. for (k = 0; k < codingTemplateLength; k++) {
  18235. i0 = i + codingTemplateY[k];
  18236. j0 = j + codingTemplateX[k];
  18237. if (i0 < 0 || j0 < 0 || j0 >= width) {
  18238. contextLabel <<= 1;
  18239. } else {
  18240. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  18241. }
  18242. }
  18243. for (k = 0; k < referenceTemplateLength; k++) {
  18244. i0 = i + referenceTemplateY[k] - offsetY;
  18245. j0 = j + referenceTemplateX[k] - offsetX;
  18246. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  18247. contextLabel <<= 1;
  18248. } else {
  18249. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  18250. }
  18251. }
  18252. const pixel = decoder.readBit(contexts, contextLabel);
  18253. row[j] = pixel;
  18254. }
  18255. }
  18256. return bitmap;
  18257. }
  18258. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
  18259. if (huffman && refinement) {
  18260. throw new Jbig2Error("symbol refinement with Huffman is not supported");
  18261. }
  18262. const newSymbols = [];
  18263. let currentHeight = 0;
  18264. let symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);
  18265. const decoder = decodingContext.decoder;
  18266. const contextCache = decodingContext.contextCache;
  18267. let tableB1, symbolWidths;
  18268. if (huffman) {
  18269. tableB1 = getStandardTable(1);
  18270. symbolWidths = [];
  18271. symbolCodeLength = Math.max(symbolCodeLength, 1);
  18272. }
  18273. while (newSymbols.length < numberOfNewSymbols) {
  18274. const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
  18275. currentHeight += deltaHeight;
  18276. let currentWidth = 0,
  18277. totalWidth = 0;
  18278. const firstSymbol = huffman ? symbolWidths.length : 0;
  18279. while (true) {
  18280. const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
  18281. if (deltaWidth === null) {
  18282. break;
  18283. }
  18284. currentWidth += deltaWidth;
  18285. totalWidth += currentWidth;
  18286. let bitmap;
  18287. if (refinement) {
  18288. const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
  18289. if (numberOfInstances > 1) {
  18290. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
  18291. } else {
  18292. const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  18293. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  18294. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  18295. const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  18296. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  18297. }
  18298. newSymbols.push(bitmap);
  18299. } else if (huffman) {
  18300. symbolWidths.push(currentWidth);
  18301. } else {
  18302. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  18303. newSymbols.push(bitmap);
  18304. }
  18305. }
  18306. if (huffman && !refinement) {
  18307. const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
  18308. huffmanInput.byteAlign();
  18309. let collectiveBitmap;
  18310. if (bitmapSize === 0) {
  18311. collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
  18312. } else {
  18313. const originalEnd = huffmanInput.end;
  18314. const bitmapEnd = huffmanInput.position + bitmapSize;
  18315. huffmanInput.end = bitmapEnd;
  18316. collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
  18317. huffmanInput.end = originalEnd;
  18318. huffmanInput.position = bitmapEnd;
  18319. }
  18320. const numberOfSymbolsDecoded = symbolWidths.length;
  18321. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  18322. newSymbols.push(collectiveBitmap);
  18323. } else {
  18324. let i,
  18325. y,
  18326. xMin = 0,
  18327. xMax,
  18328. bitmapWidth,
  18329. symbolBitmap;
  18330. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  18331. bitmapWidth = symbolWidths[i];
  18332. xMax = xMin + bitmapWidth;
  18333. symbolBitmap = [];
  18334. for (y = 0; y < currentHeight; y++) {
  18335. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  18336. }
  18337. newSymbols.push(symbolBitmap);
  18338. xMin = xMax;
  18339. }
  18340. }
  18341. }
  18342. }
  18343. const exportedSymbols = [],
  18344. flags = [];
  18345. let currentFlag = false,
  18346. i,
  18347. ii;
  18348. const totalSymbolsLength = symbols.length + numberOfNewSymbols;
  18349. while (flags.length < totalSymbolsLength) {
  18350. let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
  18351. while (runLength--) {
  18352. flags.push(currentFlag);
  18353. }
  18354. currentFlag = !currentFlag;
  18355. }
  18356. for (i = 0, ii = symbols.length; i < ii; i++) {
  18357. if (flags[i]) {
  18358. exportedSymbols.push(symbols[i]);
  18359. }
  18360. }
  18361. for (let j = 0; j < numberOfNewSymbols; i++, j++) {
  18362. if (flags[i]) {
  18363. exportedSymbols.push(newSymbols[j]);
  18364. }
  18365. }
  18366. return exportedSymbols;
  18367. }
  18368. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
  18369. if (huffman && refinement) {
  18370. throw new Jbig2Error("refinement with Huffman is not supported");
  18371. }
  18372. const bitmap = [];
  18373. let i, row;
  18374. for (i = 0; i < height; i++) {
  18375. row = new Uint8Array(width);
  18376. if (defaultPixelValue) {
  18377. for (let j = 0; j < width; j++) {
  18378. row[j] = defaultPixelValue;
  18379. }
  18380. }
  18381. bitmap.push(row);
  18382. }
  18383. const decoder = decodingContext.decoder;
  18384. const contextCache = decodingContext.contextCache;
  18385. let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
  18386. let firstS = 0;
  18387. i = 0;
  18388. while (i < numberOfSymbolInstances) {
  18389. const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
  18390. stripT += deltaT;
  18391. const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
  18392. firstS += deltaFirstS;
  18393. let currentS = firstS;
  18394. do {
  18395. let currentT = 0;
  18396. if (stripSize > 1) {
  18397. currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
  18398. }
  18399. const t = stripSize * stripT + currentT;
  18400. const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
  18401. const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
  18402. let symbolBitmap = inputSymbols[symbolId];
  18403. let symbolWidth = symbolBitmap[0].length;
  18404. let symbolHeight = symbolBitmap.length;
  18405. if (applyRefinement) {
  18406. const rdw = decodeInteger(contextCache, "IARDW", decoder);
  18407. const rdh = decodeInteger(contextCache, "IARDH", decoder);
  18408. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  18409. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  18410. symbolWidth += rdw;
  18411. symbolHeight += rdh;
  18412. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  18413. }
  18414. const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  18415. const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  18416. let s2, t2, symbolRow;
  18417. if (transposed) {
  18418. for (s2 = 0; s2 < symbolHeight; s2++) {
  18419. row = bitmap[offsetS + s2];
  18420. if (!row) {
  18421. continue;
  18422. }
  18423. symbolRow = symbolBitmap[s2];
  18424. const maxWidth = Math.min(width - offsetT, symbolWidth);
  18425. switch (combinationOperator) {
  18426. case 0:
  18427. for (t2 = 0; t2 < maxWidth; t2++) {
  18428. row[offsetT + t2] |= symbolRow[t2];
  18429. }
  18430. break;
  18431. case 2:
  18432. for (t2 = 0; t2 < maxWidth; t2++) {
  18433. row[offsetT + t2] ^= symbolRow[t2];
  18434. }
  18435. break;
  18436. default:
  18437. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  18438. }
  18439. }
  18440. currentS += symbolHeight - 1;
  18441. } else {
  18442. for (t2 = 0; t2 < symbolHeight; t2++) {
  18443. row = bitmap[offsetT + t2];
  18444. if (!row) {
  18445. continue;
  18446. }
  18447. symbolRow = symbolBitmap[t2];
  18448. switch (combinationOperator) {
  18449. case 0:
  18450. for (s2 = 0; s2 < symbolWidth; s2++) {
  18451. row[offsetS + s2] |= symbolRow[s2];
  18452. }
  18453. break;
  18454. case 2:
  18455. for (s2 = 0; s2 < symbolWidth; s2++) {
  18456. row[offsetS + s2] ^= symbolRow[s2];
  18457. }
  18458. break;
  18459. default:
  18460. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  18461. }
  18462. }
  18463. currentS += symbolWidth - 1;
  18464. }
  18465. i++;
  18466. const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
  18467. if (deltaS === null) {
  18468. break;
  18469. }
  18470. currentS += deltaS + dsOffset;
  18471. } while (true);
  18472. }
  18473. return bitmap;
  18474. }
  18475. function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
  18476. const at = [];
  18477. if (!mmr) {
  18478. at.push({
  18479. x: -patternWidth,
  18480. y: 0
  18481. });
  18482. if (template === 0) {
  18483. at.push({
  18484. x: -3,
  18485. y: -1
  18486. }, {
  18487. x: 2,
  18488. y: -2
  18489. }, {
  18490. x: -2,
  18491. y: -2
  18492. });
  18493. }
  18494. }
  18495. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  18496. const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
  18497. const patterns = [];
  18498. for (let i = 0; i <= maxPatternIndex; i++) {
  18499. const patternBitmap = [];
  18500. const xMin = patternWidth * i;
  18501. const xMax = xMin + patternWidth;
  18502. for (let y = 0; y < patternHeight; y++) {
  18503. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  18504. }
  18505. patterns.push(patternBitmap);
  18506. }
  18507. return patterns;
  18508. }
  18509. function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
  18510. const skip = null;
  18511. if (enableSkip) {
  18512. throw new Jbig2Error("skip is not supported");
  18513. }
  18514. if (combinationOperator !== 0) {
  18515. throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`);
  18516. }
  18517. const regionBitmap = [];
  18518. let i, j, row;
  18519. for (i = 0; i < regionHeight; i++) {
  18520. row = new Uint8Array(regionWidth);
  18521. if (defaultPixelValue) {
  18522. for (j = 0; j < regionWidth; j++) {
  18523. row[j] = defaultPixelValue;
  18524. }
  18525. }
  18526. regionBitmap.push(row);
  18527. }
  18528. const numberOfPatterns = patterns.length;
  18529. const pattern0 = patterns[0];
  18530. const patternWidth = pattern0[0].length,
  18531. patternHeight = pattern0.length;
  18532. const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
  18533. const at = [];
  18534. if (!mmr) {
  18535. at.push({
  18536. x: template <= 1 ? 3 : 2,
  18537. y: -1
  18538. });
  18539. if (template === 0) {
  18540. at.push({
  18541. x: -3,
  18542. y: -1
  18543. }, {
  18544. x: 2,
  18545. y: -2
  18546. }, {
  18547. x: -2,
  18548. y: -2
  18549. });
  18550. }
  18551. }
  18552. const grayScaleBitPlanes = [];
  18553. let mmrInput, bitmap;
  18554. if (mmr) {
  18555. mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  18556. }
  18557. for (i = bitsPerValue - 1; i >= 0; i--) {
  18558. if (mmr) {
  18559. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  18560. } else {
  18561. bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
  18562. }
  18563. grayScaleBitPlanes[i] = bitmap;
  18564. }
  18565. let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
  18566. for (mg = 0; mg < gridHeight; mg++) {
  18567. for (ng = 0; ng < gridWidth; ng++) {
  18568. bit = 0;
  18569. patternIndex = 0;
  18570. for (j = bitsPerValue - 1; j >= 0; j--) {
  18571. bit ^= grayScaleBitPlanes[j][mg][ng];
  18572. patternIndex |= bit << j;
  18573. }
  18574. patternBitmap = patterns[patternIndex];
  18575. x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
  18576. y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
  18577. if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
  18578. for (i = 0; i < patternHeight; i++) {
  18579. regionRow = regionBitmap[y + i];
  18580. patternRow = patternBitmap[i];
  18581. for (j = 0; j < patternWidth; j++) {
  18582. regionRow[x + j] |= patternRow[j];
  18583. }
  18584. }
  18585. } else {
  18586. let regionX, regionY;
  18587. for (i = 0; i < patternHeight; i++) {
  18588. regionY = y + i;
  18589. if (regionY < 0 || regionY >= regionHeight) {
  18590. continue;
  18591. }
  18592. regionRow = regionBitmap[regionY];
  18593. patternRow = patternBitmap[i];
  18594. for (j = 0; j < patternWidth; j++) {
  18595. regionX = x + j;
  18596. if (regionX >= 0 && regionX < regionWidth) {
  18597. regionRow[regionX] |= patternRow[j];
  18598. }
  18599. }
  18600. }
  18601. }
  18602. }
  18603. }
  18604. return regionBitmap;
  18605. }
  18606. function readSegmentHeader(data, start) {
  18607. const segmentHeader = {};
  18608. segmentHeader.number = (0, _core_utils.readUint32)(data, start);
  18609. const flags = data[start + 4];
  18610. const segmentType = flags & 0x3f;
  18611. if (!SegmentTypes[segmentType]) {
  18612. throw new Jbig2Error("invalid segment type: " + segmentType);
  18613. }
  18614. segmentHeader.type = segmentType;
  18615. segmentHeader.typeName = SegmentTypes[segmentType];
  18616. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  18617. const pageAssociationFieldSize = !!(flags & 0x40);
  18618. const referredFlags = data[start + 5];
  18619. let referredToCount = referredFlags >> 5 & 7;
  18620. const retainBits = [referredFlags & 31];
  18621. let position = start + 6;
  18622. if (referredFlags === 7) {
  18623. referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;
  18624. position += 3;
  18625. let bytes = referredToCount + 7 >> 3;
  18626. retainBits[0] = data[position++];
  18627. while (--bytes > 0) {
  18628. retainBits.push(data[position++]);
  18629. }
  18630. } else if (referredFlags === 5 || referredFlags === 6) {
  18631. throw new Jbig2Error("invalid referred-to flags");
  18632. }
  18633. segmentHeader.retainBits = retainBits;
  18634. let referredToSegmentNumberSize = 4;
  18635. if (segmentHeader.number <= 256) {
  18636. referredToSegmentNumberSize = 1;
  18637. } else if (segmentHeader.number <= 65536) {
  18638. referredToSegmentNumberSize = 2;
  18639. }
  18640. const referredTo = [];
  18641. let i, ii;
  18642. for (i = 0; i < referredToCount; i++) {
  18643. let number;
  18644. if (referredToSegmentNumberSize === 1) {
  18645. number = data[position];
  18646. } else if (referredToSegmentNumberSize === 2) {
  18647. number = (0, _core_utils.readUint16)(data, position);
  18648. } else {
  18649. number = (0, _core_utils.readUint32)(data, position);
  18650. }
  18651. referredTo.push(number);
  18652. position += referredToSegmentNumberSize;
  18653. }
  18654. segmentHeader.referredTo = referredTo;
  18655. if (!pageAssociationFieldSize) {
  18656. segmentHeader.pageAssociation = data[position++];
  18657. } else {
  18658. segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position);
  18659. position += 4;
  18660. }
  18661. segmentHeader.length = (0, _core_utils.readUint32)(data, position);
  18662. position += 4;
  18663. if (segmentHeader.length === 0xffffffff) {
  18664. if (segmentType === 38) {
  18665. const genericRegionInfo = readRegionSegmentInformation(data, position);
  18666. const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  18667. const genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  18668. const searchPatternLength = 6;
  18669. const searchPattern = new Uint8Array(searchPatternLength);
  18670. if (!genericRegionMmr) {
  18671. searchPattern[0] = 0xff;
  18672. searchPattern[1] = 0xac;
  18673. }
  18674. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
  18675. searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
  18676. searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
  18677. searchPattern[5] = genericRegionInfo.height & 0xff;
  18678. for (i = position, ii = data.length; i < ii; i++) {
  18679. let j = 0;
  18680. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  18681. j++;
  18682. }
  18683. if (j === searchPatternLength) {
  18684. segmentHeader.length = i + searchPatternLength;
  18685. break;
  18686. }
  18687. }
  18688. if (segmentHeader.length === 0xffffffff) {
  18689. throw new Jbig2Error("segment end was not found");
  18690. }
  18691. } else {
  18692. throw new Jbig2Error("invalid unknown segment length");
  18693. }
  18694. }
  18695. segmentHeader.headerEnd = position;
  18696. return segmentHeader;
  18697. }
  18698. function readSegments(header, data, start, end) {
  18699. const segments = [];
  18700. let position = start;
  18701. while (position < end) {
  18702. const segmentHeader = readSegmentHeader(data, position);
  18703. position = segmentHeader.headerEnd;
  18704. const segment = {
  18705. header: segmentHeader,
  18706. data
  18707. };
  18708. if (!header.randomAccess) {
  18709. segment.start = position;
  18710. position += segmentHeader.length;
  18711. segment.end = position;
  18712. }
  18713. segments.push(segment);
  18714. if (segmentHeader.type === 51) {
  18715. break;
  18716. }
  18717. }
  18718. if (header.randomAccess) {
  18719. for (let i = 0, ii = segments.length; i < ii; i++) {
  18720. segments[i].start = position;
  18721. position += segments[i].header.length;
  18722. segments[i].end = position;
  18723. }
  18724. }
  18725. return segments;
  18726. }
  18727. function readRegionSegmentInformation(data, start) {
  18728. return {
  18729. width: (0, _core_utils.readUint32)(data, start),
  18730. height: (0, _core_utils.readUint32)(data, start + 4),
  18731. x: (0, _core_utils.readUint32)(data, start + 8),
  18732. y: (0, _core_utils.readUint32)(data, start + 12),
  18733. combinationOperator: data[start + 16] & 7
  18734. };
  18735. }
  18736. const RegionSegmentInformationFieldLength = 17;
  18737. function processSegment(segment, visitor) {
  18738. const header = segment.header;
  18739. const data = segment.data,
  18740. end = segment.end;
  18741. let position = segment.start;
  18742. let args, at, i, atLength;
  18743. switch (header.type) {
  18744. case 0:
  18745. const dictionary = {};
  18746. const dictionaryFlags = (0, _core_utils.readUint16)(data, position);
  18747. dictionary.huffman = !!(dictionaryFlags & 1);
  18748. dictionary.refinement = !!(dictionaryFlags & 2);
  18749. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  18750. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  18751. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  18752. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  18753. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  18754. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  18755. dictionary.template = dictionaryFlags >> 10 & 3;
  18756. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  18757. position += 2;
  18758. if (!dictionary.huffman) {
  18759. atLength = dictionary.template === 0 ? 4 : 1;
  18760. at = [];
  18761. for (i = 0; i < atLength; i++) {
  18762. at.push({
  18763. x: (0, _core_utils.readInt8)(data, position),
  18764. y: (0, _core_utils.readInt8)(data, position + 1)
  18765. });
  18766. position += 2;
  18767. }
  18768. dictionary.at = at;
  18769. }
  18770. if (dictionary.refinement && !dictionary.refinementTemplate) {
  18771. at = [];
  18772. for (i = 0; i < 2; i++) {
  18773. at.push({
  18774. x: (0, _core_utils.readInt8)(data, position),
  18775. y: (0, _core_utils.readInt8)(data, position + 1)
  18776. });
  18777. position += 2;
  18778. }
  18779. dictionary.refinementAt = at;
  18780. }
  18781. dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position);
  18782. position += 4;
  18783. dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position);
  18784. position += 4;
  18785. args = [dictionary, header.number, header.referredTo, data, position, end];
  18786. break;
  18787. case 6:
  18788. case 7:
  18789. const textRegion = {};
  18790. textRegion.info = readRegionSegmentInformation(data, position);
  18791. position += RegionSegmentInformationFieldLength;
  18792. const textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position);
  18793. position += 2;
  18794. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  18795. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  18796. textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
  18797. textRegion.stripSize = 1 << textRegion.logStripSize;
  18798. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  18799. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  18800. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  18801. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  18802. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  18803. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  18804. if (textRegion.huffman) {
  18805. const textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position);
  18806. position += 2;
  18807. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  18808. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  18809. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  18810. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  18811. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  18812. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  18813. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  18814. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
  18815. }
  18816. if (textRegion.refinement && !textRegion.refinementTemplate) {
  18817. at = [];
  18818. for (i = 0; i < 2; i++) {
  18819. at.push({
  18820. x: (0, _core_utils.readInt8)(data, position),
  18821. y: (0, _core_utils.readInt8)(data, position + 1)
  18822. });
  18823. position += 2;
  18824. }
  18825. textRegion.refinementAt = at;
  18826. }
  18827. textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position);
  18828. position += 4;
  18829. args = [textRegion, header.referredTo, data, position, end];
  18830. break;
  18831. case 16:
  18832. const patternDictionary = {};
  18833. const patternDictionaryFlags = data[position++];
  18834. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  18835. patternDictionary.template = patternDictionaryFlags >> 1 & 3;
  18836. patternDictionary.patternWidth = data[position++];
  18837. patternDictionary.patternHeight = data[position++];
  18838. patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position);
  18839. position += 4;
  18840. args = [patternDictionary, header.number, data, position, end];
  18841. break;
  18842. case 22:
  18843. case 23:
  18844. const halftoneRegion = {};
  18845. halftoneRegion.info = readRegionSegmentInformation(data, position);
  18846. position += RegionSegmentInformationFieldLength;
  18847. const halftoneRegionFlags = data[position++];
  18848. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  18849. halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
  18850. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  18851. halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
  18852. halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
  18853. halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position);
  18854. position += 4;
  18855. halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position);
  18856. position += 4;
  18857. halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  18858. position += 4;
  18859. halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  18860. position += 4;
  18861. halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position);
  18862. position += 2;
  18863. halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position);
  18864. position += 2;
  18865. args = [halftoneRegion, header.referredTo, data, position, end];
  18866. break;
  18867. case 38:
  18868. case 39:
  18869. const genericRegion = {};
  18870. genericRegion.info = readRegionSegmentInformation(data, position);
  18871. position += RegionSegmentInformationFieldLength;
  18872. const genericRegionSegmentFlags = data[position++];
  18873. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  18874. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  18875. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  18876. if (!genericRegion.mmr) {
  18877. atLength = genericRegion.template === 0 ? 4 : 1;
  18878. at = [];
  18879. for (i = 0; i < atLength; i++) {
  18880. at.push({
  18881. x: (0, _core_utils.readInt8)(data, position),
  18882. y: (0, _core_utils.readInt8)(data, position + 1)
  18883. });
  18884. position += 2;
  18885. }
  18886. genericRegion.at = at;
  18887. }
  18888. args = [genericRegion, data, position, end];
  18889. break;
  18890. case 48:
  18891. const pageInfo = {
  18892. width: (0, _core_utils.readUint32)(data, position),
  18893. height: (0, _core_utils.readUint32)(data, position + 4),
  18894. resolutionX: (0, _core_utils.readUint32)(data, position + 8),
  18895. resolutionY: (0, _core_utils.readUint32)(data, position + 12)
  18896. };
  18897. if (pageInfo.height === 0xffffffff) {
  18898. delete pageInfo.height;
  18899. }
  18900. const pageSegmentFlags = data[position + 16];
  18901. (0, _core_utils.readUint16)(data, position + 17);
  18902. pageInfo.lossless = !!(pageSegmentFlags & 1);
  18903. pageInfo.refinement = !!(pageSegmentFlags & 2);
  18904. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  18905. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  18906. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  18907. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  18908. args = [pageInfo];
  18909. break;
  18910. case 49:
  18911. break;
  18912. case 50:
  18913. break;
  18914. case 51:
  18915. break;
  18916. case 53:
  18917. args = [header.number, data, position, end];
  18918. break;
  18919. case 62:
  18920. break;
  18921. default:
  18922. throw new Jbig2Error(`segment type ${header.typeName}(${header.type}) is not implemented`);
  18923. }
  18924. const callbackName = "on" + header.typeName;
  18925. if (callbackName in visitor) {
  18926. visitor[callbackName].apply(visitor, args);
  18927. }
  18928. }
  18929. function processSegments(segments, visitor) {
  18930. for (let i = 0, ii = segments.length; i < ii; i++) {
  18931. processSegment(segments[i], visitor);
  18932. }
  18933. }
  18934. function parseJbig2Chunks(chunks) {
  18935. const visitor = new SimpleSegmentVisitor();
  18936. for (let i = 0, ii = chunks.length; i < ii; i++) {
  18937. const chunk = chunks[i];
  18938. const segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  18939. processSegments(segments, visitor);
  18940. }
  18941. return visitor.buffer;
  18942. }
  18943. function parseJbig2(data) {
  18944. throw new Error("Not implemented: parseJbig2");
  18945. }
  18946. class SimpleSegmentVisitor {
  18947. onPageInformation(info) {
  18948. this.currentPageInfo = info;
  18949. const rowSize = info.width + 7 >> 3;
  18950. const buffer = new Uint8ClampedArray(rowSize * info.height);
  18951. if (info.defaultPixelValue) {
  18952. buffer.fill(0xff);
  18953. }
  18954. this.buffer = buffer;
  18955. }
  18956. drawBitmap(regionInfo, bitmap) {
  18957. const pageInfo = this.currentPageInfo;
  18958. const width = regionInfo.width,
  18959. height = regionInfo.height;
  18960. const rowSize = pageInfo.width + 7 >> 3;
  18961. const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  18962. const buffer = this.buffer;
  18963. const mask0 = 128 >> (regionInfo.x & 7);
  18964. let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  18965. let i, j, mask, offset;
  18966. switch (combinationOperator) {
  18967. case 0:
  18968. for (i = 0; i < height; i++) {
  18969. mask = mask0;
  18970. offset = offset0;
  18971. for (j = 0; j < width; j++) {
  18972. if (bitmap[i][j]) {
  18973. buffer[offset] |= mask;
  18974. }
  18975. mask >>= 1;
  18976. if (!mask) {
  18977. mask = 128;
  18978. offset++;
  18979. }
  18980. }
  18981. offset0 += rowSize;
  18982. }
  18983. break;
  18984. case 2:
  18985. for (i = 0; i < height; i++) {
  18986. mask = mask0;
  18987. offset = offset0;
  18988. for (j = 0; j < width; j++) {
  18989. if (bitmap[i][j]) {
  18990. buffer[offset] ^= mask;
  18991. }
  18992. mask >>= 1;
  18993. if (!mask) {
  18994. mask = 128;
  18995. offset++;
  18996. }
  18997. }
  18998. offset0 += rowSize;
  18999. }
  19000. break;
  19001. default:
  19002. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  19003. }
  19004. }
  19005. onImmediateGenericRegion(region, data, start, end) {
  19006. const regionInfo = region.info;
  19007. const decodingContext = new DecodingContext(data, start, end);
  19008. const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  19009. this.drawBitmap(regionInfo, bitmap);
  19010. }
  19011. onImmediateLosslessGenericRegion() {
  19012. this.onImmediateGenericRegion(...arguments);
  19013. }
  19014. onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  19015. let huffmanTables, huffmanInput;
  19016. if (dictionary.huffman) {
  19017. huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
  19018. huffmanInput = new Reader(data, start, end);
  19019. }
  19020. let symbols = this.symbols;
  19021. if (!symbols) {
  19022. this.symbols = symbols = {};
  19023. }
  19024. const inputSymbols = [];
  19025. for (const referredSegment of referredSegments) {
  19026. const referredSymbols = symbols[referredSegment];
  19027. if (referredSymbols) {
  19028. inputSymbols.push(...referredSymbols);
  19029. }
  19030. }
  19031. const decodingContext = new DecodingContext(data, start, end);
  19032. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
  19033. }
  19034. onImmediateTextRegion(region, referredSegments, data, start, end) {
  19035. const regionInfo = region.info;
  19036. let huffmanTables, huffmanInput;
  19037. const symbols = this.symbols;
  19038. const inputSymbols = [];
  19039. for (const referredSegment of referredSegments) {
  19040. const referredSymbols = symbols[referredSegment];
  19041. if (referredSymbols) {
  19042. inputSymbols.push(...referredSymbols);
  19043. }
  19044. }
  19045. const symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);
  19046. if (region.huffman) {
  19047. huffmanInput = new Reader(data, start, end);
  19048. huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
  19049. }
  19050. const decodingContext = new DecodingContext(data, start, end);
  19051. 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);
  19052. this.drawBitmap(regionInfo, bitmap);
  19053. }
  19054. onImmediateLosslessTextRegion() {
  19055. this.onImmediateTextRegion(...arguments);
  19056. }
  19057. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  19058. let patterns = this.patterns;
  19059. if (!patterns) {
  19060. this.patterns = patterns = {};
  19061. }
  19062. const decodingContext = new DecodingContext(data, start, end);
  19063. patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
  19064. }
  19065. onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
  19066. const patterns = this.patterns[referredSegments[0]];
  19067. const regionInfo = region.info;
  19068. const decodingContext = new DecodingContext(data, start, end);
  19069. 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);
  19070. this.drawBitmap(regionInfo, bitmap);
  19071. }
  19072. onImmediateLosslessHalftoneRegion() {
  19073. this.onImmediateHalftoneRegion(...arguments);
  19074. }
  19075. onTables(currentSegment, data, start, end) {
  19076. let customTables = this.customTables;
  19077. if (!customTables) {
  19078. this.customTables = customTables = {};
  19079. }
  19080. customTables[currentSegment] = decodeTablesSegment(data, start, end);
  19081. }
  19082. }
  19083. class HuffmanLine {
  19084. constructor(lineData) {
  19085. if (lineData.length === 2) {
  19086. this.isOOB = true;
  19087. this.rangeLow = 0;
  19088. this.prefixLength = lineData[0];
  19089. this.rangeLength = 0;
  19090. this.prefixCode = lineData[1];
  19091. this.isLowerRange = false;
  19092. } else {
  19093. this.isOOB = false;
  19094. this.rangeLow = lineData[0];
  19095. this.prefixLength = lineData[1];
  19096. this.rangeLength = lineData[2];
  19097. this.prefixCode = lineData[3];
  19098. this.isLowerRange = lineData[4] === "lower";
  19099. }
  19100. }
  19101. }
  19102. class HuffmanTreeNode {
  19103. constructor(line) {
  19104. this.children = [];
  19105. if (line) {
  19106. this.isLeaf = true;
  19107. this.rangeLength = line.rangeLength;
  19108. this.rangeLow = line.rangeLow;
  19109. this.isLowerRange = line.isLowerRange;
  19110. this.isOOB = line.isOOB;
  19111. } else {
  19112. this.isLeaf = false;
  19113. }
  19114. }
  19115. buildTree(line, shift) {
  19116. const bit = line.prefixCode >> shift & 1;
  19117. if (shift <= 0) {
  19118. this.children[bit] = new HuffmanTreeNode(line);
  19119. } else {
  19120. let node = this.children[bit];
  19121. if (!node) {
  19122. this.children[bit] = node = new HuffmanTreeNode(null);
  19123. }
  19124. node.buildTree(line, shift - 1);
  19125. }
  19126. }
  19127. decodeNode(reader) {
  19128. if (this.isLeaf) {
  19129. if (this.isOOB) {
  19130. return null;
  19131. }
  19132. const htOffset = reader.readBits(this.rangeLength);
  19133. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  19134. }
  19135. const node = this.children[reader.readBit()];
  19136. if (!node) {
  19137. throw new Jbig2Error("invalid Huffman data");
  19138. }
  19139. return node.decodeNode(reader);
  19140. }
  19141. }
  19142. class HuffmanTable {
  19143. constructor(lines, prefixCodesDone) {
  19144. if (!prefixCodesDone) {
  19145. this.assignPrefixCodes(lines);
  19146. }
  19147. this.rootNode = new HuffmanTreeNode(null);
  19148. for (let i = 0, ii = lines.length; i < ii; i++) {
  19149. const line = lines[i];
  19150. if (line.prefixLength > 0) {
  19151. this.rootNode.buildTree(line, line.prefixLength - 1);
  19152. }
  19153. }
  19154. }
  19155. decode(reader) {
  19156. return this.rootNode.decodeNode(reader);
  19157. }
  19158. assignPrefixCodes(lines) {
  19159. const linesLength = lines.length;
  19160. let prefixLengthMax = 0;
  19161. for (let i = 0; i < linesLength; i++) {
  19162. prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
  19163. }
  19164. const histogram = new Uint32Array(prefixLengthMax + 1);
  19165. for (let i = 0; i < linesLength; i++) {
  19166. histogram[lines[i].prefixLength]++;
  19167. }
  19168. let currentLength = 1,
  19169. firstCode = 0,
  19170. currentCode,
  19171. currentTemp,
  19172. line;
  19173. histogram[0] = 0;
  19174. while (currentLength <= prefixLengthMax) {
  19175. firstCode = firstCode + histogram[currentLength - 1] << 1;
  19176. currentCode = firstCode;
  19177. currentTemp = 0;
  19178. while (currentTemp < linesLength) {
  19179. line = lines[currentTemp];
  19180. if (line.prefixLength === currentLength) {
  19181. line.prefixCode = currentCode;
  19182. currentCode++;
  19183. }
  19184. currentTemp++;
  19185. }
  19186. currentLength++;
  19187. }
  19188. }
  19189. }
  19190. function decodeTablesSegment(data, start, end) {
  19191. const flags = data[start];
  19192. const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
  19193. const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
  19194. const reader = new Reader(data, start + 9, end);
  19195. const prefixSizeBits = (flags >> 1 & 7) + 1;
  19196. const rangeSizeBits = (flags >> 4 & 7) + 1;
  19197. const lines = [];
  19198. let prefixLength,
  19199. rangeLength,
  19200. currentRangeLow = lowestValue;
  19201. do {
  19202. prefixLength = reader.readBits(prefixSizeBits);
  19203. rangeLength = reader.readBits(rangeSizeBits);
  19204. lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
  19205. currentRangeLow += 1 << rangeLength;
  19206. } while (currentRangeLow < highestValue);
  19207. prefixLength = reader.readBits(prefixSizeBits);
  19208. lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
  19209. prefixLength = reader.readBits(prefixSizeBits);
  19210. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  19211. if (flags & 1) {
  19212. prefixLength = reader.readBits(prefixSizeBits);
  19213. lines.push(new HuffmanLine([prefixLength, 0]));
  19214. }
  19215. return new HuffmanTable(lines, false);
  19216. }
  19217. const standardTablesCache = {};
  19218. function getStandardTable(number) {
  19219. let table = standardTablesCache[number];
  19220. if (table) {
  19221. return table;
  19222. }
  19223. let lines;
  19224. switch (number) {
  19225. case 1:
  19226. lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
  19227. break;
  19228. case 2:
  19229. 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]];
  19230. break;
  19231. case 3:
  19232. 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]];
  19233. break;
  19234. case 4:
  19235. 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]];
  19236. break;
  19237. case 5:
  19238. 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]];
  19239. break;
  19240. case 6:
  19241. 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]];
  19242. break;
  19243. case 7:
  19244. 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]];
  19245. break;
  19246. case 8:
  19247. 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]];
  19248. break;
  19249. case 9:
  19250. 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]];
  19251. break;
  19252. case 10:
  19253. 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]];
  19254. break;
  19255. case 11:
  19256. 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]];
  19257. break;
  19258. case 12:
  19259. 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]];
  19260. break;
  19261. case 13:
  19262. 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]];
  19263. break;
  19264. case 14:
  19265. lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
  19266. break;
  19267. case 15:
  19268. 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]];
  19269. break;
  19270. default:
  19271. throw new Jbig2Error(`standard table B.${number} does not exist`);
  19272. }
  19273. for (let i = 0, ii = lines.length; i < ii; i++) {
  19274. lines[i] = new HuffmanLine(lines[i]);
  19275. }
  19276. table = new HuffmanTable(lines, true);
  19277. standardTablesCache[number] = table;
  19278. return table;
  19279. }
  19280. class Reader {
  19281. constructor(data, start, end) {
  19282. this.data = data;
  19283. this.start = start;
  19284. this.end = end;
  19285. this.position = start;
  19286. this.shift = -1;
  19287. this.currentByte = 0;
  19288. }
  19289. readBit() {
  19290. if (this.shift < 0) {
  19291. if (this.position >= this.end) {
  19292. throw new Jbig2Error("end of data while reading bit");
  19293. }
  19294. this.currentByte = this.data[this.position++];
  19295. this.shift = 7;
  19296. }
  19297. const bit = this.currentByte >> this.shift & 1;
  19298. this.shift--;
  19299. return bit;
  19300. }
  19301. readBits(numBits) {
  19302. let result = 0,
  19303. i;
  19304. for (i = numBits - 1; i >= 0; i--) {
  19305. result |= this.readBit() << i;
  19306. }
  19307. return result;
  19308. }
  19309. byteAlign() {
  19310. this.shift = -1;
  19311. }
  19312. next() {
  19313. if (this.position >= this.end) {
  19314. return -1;
  19315. }
  19316. return this.data[this.position++];
  19317. }
  19318. }
  19319. function getCustomHuffmanTable(index, referredTo, customTables) {
  19320. let currentIndex = 0;
  19321. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  19322. const table = customTables[referredTo[i]];
  19323. if (table) {
  19324. if (index === currentIndex) {
  19325. return table;
  19326. }
  19327. currentIndex++;
  19328. }
  19329. }
  19330. throw new Jbig2Error("can't find custom Huffman table");
  19331. }
  19332. function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
  19333. const codes = [];
  19334. for (let i = 0; i <= 34; i++) {
  19335. const codeLength = reader.readBits(4);
  19336. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  19337. }
  19338. const runCodesTable = new HuffmanTable(codes, false);
  19339. codes.length = 0;
  19340. for (let i = 0; i < numberOfSymbols;) {
  19341. const codeLength = runCodesTable.decode(reader);
  19342. if (codeLength >= 32) {
  19343. let repeatedLength, numberOfRepeats, j;
  19344. switch (codeLength) {
  19345. case 32:
  19346. if (i === 0) {
  19347. throw new Jbig2Error("no previous value in symbol ID table");
  19348. }
  19349. numberOfRepeats = reader.readBits(2) + 3;
  19350. repeatedLength = codes[i - 1].prefixLength;
  19351. break;
  19352. case 33:
  19353. numberOfRepeats = reader.readBits(3) + 3;
  19354. repeatedLength = 0;
  19355. break;
  19356. case 34:
  19357. numberOfRepeats = reader.readBits(7) + 11;
  19358. repeatedLength = 0;
  19359. break;
  19360. default:
  19361. throw new Jbig2Error("invalid code length in symbol ID table");
  19362. }
  19363. for (j = 0; j < numberOfRepeats; j++) {
  19364. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  19365. i++;
  19366. }
  19367. } else {
  19368. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  19369. i++;
  19370. }
  19371. }
  19372. reader.byteAlign();
  19373. const symbolIDTable = new HuffmanTable(codes, false);
  19374. let customIndex = 0,
  19375. tableFirstS,
  19376. tableDeltaS,
  19377. tableDeltaT;
  19378. switch (textRegion.huffmanFS) {
  19379. case 0:
  19380. case 1:
  19381. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  19382. break;
  19383. case 3:
  19384. tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19385. customIndex++;
  19386. break;
  19387. default:
  19388. throw new Jbig2Error("invalid Huffman FS selector");
  19389. }
  19390. switch (textRegion.huffmanDS) {
  19391. case 0:
  19392. case 1:
  19393. case 2:
  19394. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  19395. break;
  19396. case 3:
  19397. tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19398. customIndex++;
  19399. break;
  19400. default:
  19401. throw new Jbig2Error("invalid Huffman DS selector");
  19402. }
  19403. switch (textRegion.huffmanDT) {
  19404. case 0:
  19405. case 1:
  19406. case 2:
  19407. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  19408. break;
  19409. case 3:
  19410. tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19411. customIndex++;
  19412. break;
  19413. default:
  19414. throw new Jbig2Error("invalid Huffman DT selector");
  19415. }
  19416. if (textRegion.refinement) {
  19417. throw new Jbig2Error("refinement with Huffman is not supported");
  19418. }
  19419. return {
  19420. symbolIDTable,
  19421. tableFirstS,
  19422. tableDeltaS,
  19423. tableDeltaT
  19424. };
  19425. }
  19426. function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
  19427. let customIndex = 0,
  19428. tableDeltaHeight,
  19429. tableDeltaWidth;
  19430. switch (dictionary.huffmanDHSelector) {
  19431. case 0:
  19432. case 1:
  19433. tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
  19434. break;
  19435. case 3:
  19436. tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19437. customIndex++;
  19438. break;
  19439. default:
  19440. throw new Jbig2Error("invalid Huffman DH selector");
  19441. }
  19442. switch (dictionary.huffmanDWSelector) {
  19443. case 0:
  19444. case 1:
  19445. tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
  19446. break;
  19447. case 3:
  19448. tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19449. customIndex++;
  19450. break;
  19451. default:
  19452. throw new Jbig2Error("invalid Huffman DW selector");
  19453. }
  19454. let tableBitmapSize, tableAggregateInstances;
  19455. if (dictionary.bitmapSizeSelector) {
  19456. tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19457. customIndex++;
  19458. } else {
  19459. tableBitmapSize = getStandardTable(1);
  19460. }
  19461. if (dictionary.aggregationInstancesSelector) {
  19462. tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19463. } else {
  19464. tableAggregateInstances = getStandardTable(1);
  19465. }
  19466. return {
  19467. tableDeltaHeight,
  19468. tableDeltaWidth,
  19469. tableBitmapSize,
  19470. tableAggregateInstances
  19471. };
  19472. }
  19473. function readUncompressedBitmap(reader, width, height) {
  19474. const bitmap = [];
  19475. for (let y = 0; y < height; y++) {
  19476. const row = new Uint8Array(width);
  19477. bitmap.push(row);
  19478. for (let x = 0; x < width; x++) {
  19479. row[x] = reader.readBit();
  19480. }
  19481. reader.byteAlign();
  19482. }
  19483. return bitmap;
  19484. }
  19485. function decodeMMRBitmap(input, width, height, endOfBlock) {
  19486. const params = {
  19487. K: -1,
  19488. Columns: width,
  19489. Rows: height,
  19490. BlackIs1: true,
  19491. EndOfBlock: endOfBlock
  19492. };
  19493. const decoder = new _ccitt.CCITTFaxDecoder(input, params);
  19494. const bitmap = [];
  19495. let currentByte,
  19496. eof = false;
  19497. for (let y = 0; y < height; y++) {
  19498. const row = new Uint8Array(width);
  19499. bitmap.push(row);
  19500. let shift = -1;
  19501. for (let x = 0; x < width; x++) {
  19502. if (shift < 0) {
  19503. currentByte = decoder.readNextChar();
  19504. if (currentByte === -1) {
  19505. currentByte = 0;
  19506. eof = true;
  19507. }
  19508. shift = 7;
  19509. }
  19510. row[x] = currentByte >> shift & 1;
  19511. shift--;
  19512. }
  19513. }
  19514. if (endOfBlock && !eof) {
  19515. const lookForEOFLimit = 5;
  19516. for (let i = 0; i < lookForEOFLimit; i++) {
  19517. if (decoder.readNextChar() === -1) {
  19518. break;
  19519. }
  19520. }
  19521. }
  19522. return bitmap;
  19523. }
  19524. class Jbig2Image {
  19525. parseChunks(chunks) {
  19526. return parseJbig2Chunks(chunks);
  19527. }
  19528. parse(data) {
  19529. throw new Error("Not implemented: Jbig2Image.parse");
  19530. }
  19531. }
  19532. exports.Jbig2Image = Jbig2Image;
  19533. /***/ }),
  19534. /* 151 */
  19535. /***/ ((__unused_webpack_module, exports) => {
  19536. "use strict";
  19537. Object.defineProperty(exports, "__esModule", ({
  19538. value: true
  19539. }));
  19540. exports.ArithmeticDecoder = void 0;
  19541. const QeTable = [{
  19542. qe: 0x5601,
  19543. nmps: 1,
  19544. nlps: 1,
  19545. switchFlag: 1
  19546. }, {
  19547. qe: 0x3401,
  19548. nmps: 2,
  19549. nlps: 6,
  19550. switchFlag: 0
  19551. }, {
  19552. qe: 0x1801,
  19553. nmps: 3,
  19554. nlps: 9,
  19555. switchFlag: 0
  19556. }, {
  19557. qe: 0x0ac1,
  19558. nmps: 4,
  19559. nlps: 12,
  19560. switchFlag: 0
  19561. }, {
  19562. qe: 0x0521,
  19563. nmps: 5,
  19564. nlps: 29,
  19565. switchFlag: 0
  19566. }, {
  19567. qe: 0x0221,
  19568. nmps: 38,
  19569. nlps: 33,
  19570. switchFlag: 0
  19571. }, {
  19572. qe: 0x5601,
  19573. nmps: 7,
  19574. nlps: 6,
  19575. switchFlag: 1
  19576. }, {
  19577. qe: 0x5401,
  19578. nmps: 8,
  19579. nlps: 14,
  19580. switchFlag: 0
  19581. }, {
  19582. qe: 0x4801,
  19583. nmps: 9,
  19584. nlps: 14,
  19585. switchFlag: 0
  19586. }, {
  19587. qe: 0x3801,
  19588. nmps: 10,
  19589. nlps: 14,
  19590. switchFlag: 0
  19591. }, {
  19592. qe: 0x3001,
  19593. nmps: 11,
  19594. nlps: 17,
  19595. switchFlag: 0
  19596. }, {
  19597. qe: 0x2401,
  19598. nmps: 12,
  19599. nlps: 18,
  19600. switchFlag: 0
  19601. }, {
  19602. qe: 0x1c01,
  19603. nmps: 13,
  19604. nlps: 20,
  19605. switchFlag: 0
  19606. }, {
  19607. qe: 0x1601,
  19608. nmps: 29,
  19609. nlps: 21,
  19610. switchFlag: 0
  19611. }, {
  19612. qe: 0x5601,
  19613. nmps: 15,
  19614. nlps: 14,
  19615. switchFlag: 1
  19616. }, {
  19617. qe: 0x5401,
  19618. nmps: 16,
  19619. nlps: 14,
  19620. switchFlag: 0
  19621. }, {
  19622. qe: 0x5101,
  19623. nmps: 17,
  19624. nlps: 15,
  19625. switchFlag: 0
  19626. }, {
  19627. qe: 0x4801,
  19628. nmps: 18,
  19629. nlps: 16,
  19630. switchFlag: 0
  19631. }, {
  19632. qe: 0x3801,
  19633. nmps: 19,
  19634. nlps: 17,
  19635. switchFlag: 0
  19636. }, {
  19637. qe: 0x3401,
  19638. nmps: 20,
  19639. nlps: 18,
  19640. switchFlag: 0
  19641. }, {
  19642. qe: 0x3001,
  19643. nmps: 21,
  19644. nlps: 19,
  19645. switchFlag: 0
  19646. }, {
  19647. qe: 0x2801,
  19648. nmps: 22,
  19649. nlps: 19,
  19650. switchFlag: 0
  19651. }, {
  19652. qe: 0x2401,
  19653. nmps: 23,
  19654. nlps: 20,
  19655. switchFlag: 0
  19656. }, {
  19657. qe: 0x2201,
  19658. nmps: 24,
  19659. nlps: 21,
  19660. switchFlag: 0
  19661. }, {
  19662. qe: 0x1c01,
  19663. nmps: 25,
  19664. nlps: 22,
  19665. switchFlag: 0
  19666. }, {
  19667. qe: 0x1801,
  19668. nmps: 26,
  19669. nlps: 23,
  19670. switchFlag: 0
  19671. }, {
  19672. qe: 0x1601,
  19673. nmps: 27,
  19674. nlps: 24,
  19675. switchFlag: 0
  19676. }, {
  19677. qe: 0x1401,
  19678. nmps: 28,
  19679. nlps: 25,
  19680. switchFlag: 0
  19681. }, {
  19682. qe: 0x1201,
  19683. nmps: 29,
  19684. nlps: 26,
  19685. switchFlag: 0
  19686. }, {
  19687. qe: 0x1101,
  19688. nmps: 30,
  19689. nlps: 27,
  19690. switchFlag: 0
  19691. }, {
  19692. qe: 0x0ac1,
  19693. nmps: 31,
  19694. nlps: 28,
  19695. switchFlag: 0
  19696. }, {
  19697. qe: 0x09c1,
  19698. nmps: 32,
  19699. nlps: 29,
  19700. switchFlag: 0
  19701. }, {
  19702. qe: 0x08a1,
  19703. nmps: 33,
  19704. nlps: 30,
  19705. switchFlag: 0
  19706. }, {
  19707. qe: 0x0521,
  19708. nmps: 34,
  19709. nlps: 31,
  19710. switchFlag: 0
  19711. }, {
  19712. qe: 0x0441,
  19713. nmps: 35,
  19714. nlps: 32,
  19715. switchFlag: 0
  19716. }, {
  19717. qe: 0x02a1,
  19718. nmps: 36,
  19719. nlps: 33,
  19720. switchFlag: 0
  19721. }, {
  19722. qe: 0x0221,
  19723. nmps: 37,
  19724. nlps: 34,
  19725. switchFlag: 0
  19726. }, {
  19727. qe: 0x0141,
  19728. nmps: 38,
  19729. nlps: 35,
  19730. switchFlag: 0
  19731. }, {
  19732. qe: 0x0111,
  19733. nmps: 39,
  19734. nlps: 36,
  19735. switchFlag: 0
  19736. }, {
  19737. qe: 0x0085,
  19738. nmps: 40,
  19739. nlps: 37,
  19740. switchFlag: 0
  19741. }, {
  19742. qe: 0x0049,
  19743. nmps: 41,
  19744. nlps: 38,
  19745. switchFlag: 0
  19746. }, {
  19747. qe: 0x0025,
  19748. nmps: 42,
  19749. nlps: 39,
  19750. switchFlag: 0
  19751. }, {
  19752. qe: 0x0015,
  19753. nmps: 43,
  19754. nlps: 40,
  19755. switchFlag: 0
  19756. }, {
  19757. qe: 0x0009,
  19758. nmps: 44,
  19759. nlps: 41,
  19760. switchFlag: 0
  19761. }, {
  19762. qe: 0x0005,
  19763. nmps: 45,
  19764. nlps: 42,
  19765. switchFlag: 0
  19766. }, {
  19767. qe: 0x0001,
  19768. nmps: 45,
  19769. nlps: 43,
  19770. switchFlag: 0
  19771. }, {
  19772. qe: 0x5601,
  19773. nmps: 46,
  19774. nlps: 46,
  19775. switchFlag: 0
  19776. }];
  19777. class ArithmeticDecoder {
  19778. constructor(data, start, end) {
  19779. this.data = data;
  19780. this.bp = start;
  19781. this.dataEnd = end;
  19782. this.chigh = data[start];
  19783. this.clow = 0;
  19784. this.byteIn();
  19785. this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
  19786. this.clow = this.clow << 7 & 0xffff;
  19787. this.ct -= 7;
  19788. this.a = 0x8000;
  19789. }
  19790. byteIn() {
  19791. const data = this.data;
  19792. let bp = this.bp;
  19793. if (data[bp] === 0xff) {
  19794. if (data[bp + 1] > 0x8f) {
  19795. this.clow += 0xff00;
  19796. this.ct = 8;
  19797. } else {
  19798. bp++;
  19799. this.clow += data[bp] << 9;
  19800. this.ct = 7;
  19801. this.bp = bp;
  19802. }
  19803. } else {
  19804. bp++;
  19805. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  19806. this.ct = 8;
  19807. this.bp = bp;
  19808. }
  19809. if (this.clow > 0xffff) {
  19810. this.chigh += this.clow >> 16;
  19811. this.clow &= 0xffff;
  19812. }
  19813. }
  19814. readBit(contexts, pos) {
  19815. let cx_index = contexts[pos] >> 1,
  19816. cx_mps = contexts[pos] & 1;
  19817. const qeTableIcx = QeTable[cx_index];
  19818. const qeIcx = qeTableIcx.qe;
  19819. let d;
  19820. let a = this.a - qeIcx;
  19821. if (this.chigh < qeIcx) {
  19822. if (a < qeIcx) {
  19823. a = qeIcx;
  19824. d = cx_mps;
  19825. cx_index = qeTableIcx.nmps;
  19826. } else {
  19827. a = qeIcx;
  19828. d = 1 ^ cx_mps;
  19829. if (qeTableIcx.switchFlag === 1) {
  19830. cx_mps = d;
  19831. }
  19832. cx_index = qeTableIcx.nlps;
  19833. }
  19834. } else {
  19835. this.chigh -= qeIcx;
  19836. if ((a & 0x8000) !== 0) {
  19837. this.a = a;
  19838. return cx_mps;
  19839. }
  19840. if (a < qeIcx) {
  19841. d = 1 ^ cx_mps;
  19842. if (qeTableIcx.switchFlag === 1) {
  19843. cx_mps = d;
  19844. }
  19845. cx_index = qeTableIcx.nlps;
  19846. } else {
  19847. d = cx_mps;
  19848. cx_index = qeTableIcx.nmps;
  19849. }
  19850. }
  19851. do {
  19852. if (this.ct === 0) {
  19853. this.byteIn();
  19854. }
  19855. a <<= 1;
  19856. this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
  19857. this.clow = this.clow << 1 & 0xffff;
  19858. this.ct--;
  19859. } while ((a & 0x8000) === 0);
  19860. this.a = a;
  19861. contexts[pos] = cx_index << 1 | cx_mps;
  19862. return d;
  19863. }
  19864. }
  19865. exports.ArithmeticDecoder = ArithmeticDecoder;
  19866. /***/ }),
  19867. /* 152 */
  19868. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19869. "use strict";
  19870. Object.defineProperty(exports, "__esModule", ({
  19871. value: true
  19872. }));
  19873. exports.JpegStream = void 0;
  19874. var _decode_stream = __w_pdfjs_require__(144);
  19875. var _primitives = __w_pdfjs_require__(130);
  19876. var _jpg = __w_pdfjs_require__(153);
  19877. var _util = __w_pdfjs_require__(2);
  19878. class JpegStream extends _decode_stream.DecodeStream {
  19879. constructor(stream, maybeLength, params) {
  19880. let ch;
  19881. while ((ch = stream.getByte()) !== -1) {
  19882. if (ch === 0xff) {
  19883. stream.skip(-1);
  19884. break;
  19885. }
  19886. }
  19887. super(maybeLength);
  19888. this.stream = stream;
  19889. this.dict = stream.dict;
  19890. this.maybeLength = maybeLength;
  19891. this.params = params;
  19892. }
  19893. get bytes() {
  19894. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  19895. }
  19896. ensureBuffer(requested) {}
  19897. readBlock() {
  19898. if (this.eof) {
  19899. return;
  19900. }
  19901. const jpegOptions = {
  19902. decodeTransform: undefined,
  19903. colorTransform: undefined
  19904. };
  19905. const decodeArr = this.dict.getArray("D", "Decode");
  19906. if (this.forceRGB && Array.isArray(decodeArr)) {
  19907. const bitsPerComponent = this.dict.get("BPC", "BitsPerComponent") || 8;
  19908. const decodeArrLength = decodeArr.length;
  19909. const transform = new Int32Array(decodeArrLength);
  19910. let transformNeeded = false;
  19911. const maxValue = (1 << bitsPerComponent) - 1;
  19912. for (let i = 0; i < decodeArrLength; i += 2) {
  19913. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  19914. transform[i + 1] = decodeArr[i] * maxValue | 0;
  19915. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  19916. transformNeeded = true;
  19917. }
  19918. }
  19919. if (transformNeeded) {
  19920. jpegOptions.decodeTransform = transform;
  19921. }
  19922. }
  19923. if (this.params instanceof _primitives.Dict) {
  19924. const colorTransform = this.params.get("ColorTransform");
  19925. if (Number.isInteger(colorTransform)) {
  19926. jpegOptions.colorTransform = colorTransform;
  19927. }
  19928. }
  19929. const jpegImage = new _jpg.JpegImage(jpegOptions);
  19930. jpegImage.parse(this.bytes);
  19931. const data = jpegImage.getData({
  19932. width: this.drawWidth,
  19933. height: this.drawHeight,
  19934. forceRGB: this.forceRGB,
  19935. isSourcePDF: true
  19936. });
  19937. this.buffer = data;
  19938. this.bufferLength = data.length;
  19939. this.eof = true;
  19940. }
  19941. }
  19942. exports.JpegStream = JpegStream;
  19943. /***/ }),
  19944. /* 153 */
  19945. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19946. "use strict";
  19947. Object.defineProperty(exports, "__esModule", ({
  19948. value: true
  19949. }));
  19950. exports.JpegImage = void 0;
  19951. var _util = __w_pdfjs_require__(2);
  19952. var _core_utils = __w_pdfjs_require__(131);
  19953. class JpegError extends _util.BaseException {
  19954. constructor(msg) {
  19955. super(`JPEG error: ${msg}`, "JpegError");
  19956. }
  19957. }
  19958. class DNLMarkerError extends _util.BaseException {
  19959. constructor(message, scanLines) {
  19960. super(message, "DNLMarkerError");
  19961. this.scanLines = scanLines;
  19962. }
  19963. }
  19964. class EOIMarkerError extends _util.BaseException {
  19965. constructor(msg) {
  19966. super(msg, "EOIMarkerError");
  19967. }
  19968. }
  19969. 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]);
  19970. const dctCos1 = 4017;
  19971. const dctSin1 = 799;
  19972. const dctCos3 = 3406;
  19973. const dctSin3 = 2276;
  19974. const dctCos6 = 1567;
  19975. const dctSin6 = 3784;
  19976. const dctSqrt2 = 5793;
  19977. const dctSqrt1d2 = 2896;
  19978. function buildHuffmanTable(codeLengths, values) {
  19979. let k = 0,
  19980. i,
  19981. j,
  19982. length = 16;
  19983. while (length > 0 && !codeLengths[length - 1]) {
  19984. length--;
  19985. }
  19986. const code = [{
  19987. children: [],
  19988. index: 0
  19989. }];
  19990. let p = code[0],
  19991. q;
  19992. for (i = 0; i < length; i++) {
  19993. for (j = 0; j < codeLengths[i]; j++) {
  19994. p = code.pop();
  19995. p.children[p.index] = values[k];
  19996. while (p.index > 0) {
  19997. p = code.pop();
  19998. }
  19999. p.index++;
  20000. code.push(p);
  20001. while (code.length <= i) {
  20002. code.push(q = {
  20003. children: [],
  20004. index: 0
  20005. });
  20006. p.children[p.index] = q.children;
  20007. p = q;
  20008. }
  20009. k++;
  20010. }
  20011. if (i + 1 < length) {
  20012. code.push(q = {
  20013. children: [],
  20014. index: 0
  20015. });
  20016. p.children[p.index] = q.children;
  20017. p = q;
  20018. }
  20019. }
  20020. return code[0].children;
  20021. }
  20022. function getBlockBufferOffset(component, row, col) {
  20023. return 64 * ((component.blocksPerLine + 1) * row + col);
  20024. }
  20025. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive) {
  20026. let parseDNLMarker = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
  20027. const mcusPerLine = frame.mcusPerLine;
  20028. const progressive = frame.progressive;
  20029. const startOffset = offset;
  20030. let bitsData = 0,
  20031. bitsCount = 0;
  20032. function readBit() {
  20033. if (bitsCount > 0) {
  20034. bitsCount--;
  20035. return bitsData >> bitsCount & 1;
  20036. }
  20037. bitsData = data[offset++];
  20038. if (bitsData === 0xff) {
  20039. const nextByte = data[offset++];
  20040. if (nextByte) {
  20041. if (nextByte === 0xdc && parseDNLMarker) {
  20042. offset += 2;
  20043. const scanLines = (0, _core_utils.readUint16)(data, offset);
  20044. offset += 2;
  20045. if (scanLines > 0 && scanLines !== frame.scanLines) {
  20046. throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
  20047. }
  20048. } else if (nextByte === 0xd9) {
  20049. if (parseDNLMarker) {
  20050. const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
  20051. if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 10) {
  20052. throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
  20053. }
  20054. }
  20055. throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
  20056. }
  20057. throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
  20058. }
  20059. }
  20060. bitsCount = 7;
  20061. return bitsData >>> 7;
  20062. }
  20063. function decodeHuffman(tree) {
  20064. let node = tree;
  20065. while (true) {
  20066. node = node[readBit()];
  20067. switch (typeof node) {
  20068. case "number":
  20069. return node;
  20070. case "object":
  20071. continue;
  20072. }
  20073. throw new JpegError("invalid huffman sequence");
  20074. }
  20075. }
  20076. function receive(length) {
  20077. let n = 0;
  20078. while (length > 0) {
  20079. n = n << 1 | readBit();
  20080. length--;
  20081. }
  20082. return n;
  20083. }
  20084. function receiveAndExtend(length) {
  20085. if (length === 1) {
  20086. return readBit() === 1 ? 1 : -1;
  20087. }
  20088. const n = receive(length);
  20089. if (n >= 1 << length - 1) {
  20090. return n;
  20091. }
  20092. return n + (-1 << length) + 1;
  20093. }
  20094. function decodeBaseline(component, blockOffset) {
  20095. const t = decodeHuffman(component.huffmanTableDC);
  20096. const diff = t === 0 ? 0 : receiveAndExtend(t);
  20097. component.blockData[blockOffset] = component.pred += diff;
  20098. let k = 1;
  20099. while (k < 64) {
  20100. const rs = decodeHuffman(component.huffmanTableAC);
  20101. const s = rs & 15,
  20102. r = rs >> 4;
  20103. if (s === 0) {
  20104. if (r < 15) {
  20105. break;
  20106. }
  20107. k += 16;
  20108. continue;
  20109. }
  20110. k += r;
  20111. const z = dctZigZag[k];
  20112. component.blockData[blockOffset + z] = receiveAndExtend(s);
  20113. k++;
  20114. }
  20115. }
  20116. function decodeDCFirst(component, blockOffset) {
  20117. const t = decodeHuffman(component.huffmanTableDC);
  20118. const diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  20119. component.blockData[blockOffset] = component.pred += diff;
  20120. }
  20121. function decodeDCSuccessive(component, blockOffset) {
  20122. component.blockData[blockOffset] |= readBit() << successive;
  20123. }
  20124. let eobrun = 0;
  20125. function decodeACFirst(component, blockOffset) {
  20126. if (eobrun > 0) {
  20127. eobrun--;
  20128. return;
  20129. }
  20130. let k = spectralStart;
  20131. const e = spectralEnd;
  20132. while (k <= e) {
  20133. const rs = decodeHuffman(component.huffmanTableAC);
  20134. const s = rs & 15,
  20135. r = rs >> 4;
  20136. if (s === 0) {
  20137. if (r < 15) {
  20138. eobrun = receive(r) + (1 << r) - 1;
  20139. break;
  20140. }
  20141. k += 16;
  20142. continue;
  20143. }
  20144. k += r;
  20145. const z = dctZigZag[k];
  20146. component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
  20147. k++;
  20148. }
  20149. }
  20150. let successiveACState = 0,
  20151. successiveACNextValue;
  20152. function decodeACSuccessive(component, blockOffset) {
  20153. let k = spectralStart;
  20154. const e = spectralEnd;
  20155. let r = 0;
  20156. let s;
  20157. let rs;
  20158. while (k <= e) {
  20159. const offsetZ = blockOffset + dctZigZag[k];
  20160. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  20161. switch (successiveACState) {
  20162. case 0:
  20163. rs = decodeHuffman(component.huffmanTableAC);
  20164. s = rs & 15;
  20165. r = rs >> 4;
  20166. if (s === 0) {
  20167. if (r < 15) {
  20168. eobrun = receive(r) + (1 << r);
  20169. successiveACState = 4;
  20170. } else {
  20171. r = 16;
  20172. successiveACState = 1;
  20173. }
  20174. } else {
  20175. if (s !== 1) {
  20176. throw new JpegError("invalid ACn encoding");
  20177. }
  20178. successiveACNextValue = receiveAndExtend(s);
  20179. successiveACState = r ? 2 : 3;
  20180. }
  20181. continue;
  20182. case 1:
  20183. case 2:
  20184. if (component.blockData[offsetZ]) {
  20185. component.blockData[offsetZ] += sign * (readBit() << successive);
  20186. } else {
  20187. r--;
  20188. if (r === 0) {
  20189. successiveACState = successiveACState === 2 ? 3 : 0;
  20190. }
  20191. }
  20192. break;
  20193. case 3:
  20194. if (component.blockData[offsetZ]) {
  20195. component.blockData[offsetZ] += sign * (readBit() << successive);
  20196. } else {
  20197. component.blockData[offsetZ] = successiveACNextValue << successive;
  20198. successiveACState = 0;
  20199. }
  20200. break;
  20201. case 4:
  20202. if (component.blockData[offsetZ]) {
  20203. component.blockData[offsetZ] += sign * (readBit() << successive);
  20204. }
  20205. break;
  20206. }
  20207. k++;
  20208. }
  20209. if (successiveACState === 4) {
  20210. eobrun--;
  20211. if (eobrun === 0) {
  20212. successiveACState = 0;
  20213. }
  20214. }
  20215. }
  20216. let blockRow = 0;
  20217. function decodeMcu(component, decode, mcu, row, col) {
  20218. const mcuRow = mcu / mcusPerLine | 0;
  20219. const mcuCol = mcu % mcusPerLine;
  20220. blockRow = mcuRow * component.v + row;
  20221. const blockCol = mcuCol * component.h + col;
  20222. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  20223. decode(component, blockOffset);
  20224. }
  20225. function decodeBlock(component, decode, mcu) {
  20226. blockRow = mcu / component.blocksPerLine | 0;
  20227. const blockCol = mcu % component.blocksPerLine;
  20228. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  20229. decode(component, blockOffset);
  20230. }
  20231. const componentsLength = components.length;
  20232. let component, i, j, k, n;
  20233. let decodeFn;
  20234. if (progressive) {
  20235. if (spectralStart === 0) {
  20236. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  20237. } else {
  20238. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  20239. }
  20240. } else {
  20241. decodeFn = decodeBaseline;
  20242. }
  20243. let mcu = 0,
  20244. fileMarker;
  20245. let mcuExpected;
  20246. if (componentsLength === 1) {
  20247. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  20248. } else {
  20249. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  20250. }
  20251. let h, v;
  20252. while (mcu <= mcuExpected) {
  20253. const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  20254. if (mcuToRead > 0) {
  20255. for (i = 0; i < componentsLength; i++) {
  20256. components[i].pred = 0;
  20257. }
  20258. eobrun = 0;
  20259. if (componentsLength === 1) {
  20260. component = components[0];
  20261. for (n = 0; n < mcuToRead; n++) {
  20262. decodeBlock(component, decodeFn, mcu);
  20263. mcu++;
  20264. }
  20265. } else {
  20266. for (n = 0; n < mcuToRead; n++) {
  20267. for (i = 0; i < componentsLength; i++) {
  20268. component = components[i];
  20269. h = component.h;
  20270. v = component.v;
  20271. for (j = 0; j < v; j++) {
  20272. for (k = 0; k < h; k++) {
  20273. decodeMcu(component, decodeFn, mcu, j, k);
  20274. }
  20275. }
  20276. }
  20277. mcu++;
  20278. }
  20279. }
  20280. }
  20281. bitsCount = 0;
  20282. fileMarker = findNextFileMarker(data, offset);
  20283. if (!fileMarker) {
  20284. break;
  20285. }
  20286. if (fileMarker.invalid) {
  20287. const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
  20288. (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
  20289. offset = fileMarker.offset;
  20290. }
  20291. if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
  20292. offset += 2;
  20293. } else {
  20294. break;
  20295. }
  20296. }
  20297. return offset - startOffset;
  20298. }
  20299. function quantizeAndInverse(component, blockBufferOffset, p) {
  20300. const qt = component.quantizationTable,
  20301. blockData = component.blockData;
  20302. let v0, v1, v2, v3, v4, v5, v6, v7;
  20303. let p0, p1, p2, p3, p4, p5, p6, p7;
  20304. let t;
  20305. if (!qt) {
  20306. throw new JpegError("missing required Quantization Table.");
  20307. }
  20308. for (let row = 0; row < 64; row += 8) {
  20309. p0 = blockData[blockBufferOffset + row];
  20310. p1 = blockData[blockBufferOffset + row + 1];
  20311. p2 = blockData[blockBufferOffset + row + 2];
  20312. p3 = blockData[blockBufferOffset + row + 3];
  20313. p4 = blockData[blockBufferOffset + row + 4];
  20314. p5 = blockData[blockBufferOffset + row + 5];
  20315. p6 = blockData[blockBufferOffset + row + 6];
  20316. p7 = blockData[blockBufferOffset + row + 7];
  20317. p0 *= qt[row];
  20318. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  20319. t = dctSqrt2 * p0 + 512 >> 10;
  20320. p[row] = t;
  20321. p[row + 1] = t;
  20322. p[row + 2] = t;
  20323. p[row + 3] = t;
  20324. p[row + 4] = t;
  20325. p[row + 5] = t;
  20326. p[row + 6] = t;
  20327. p[row + 7] = t;
  20328. continue;
  20329. }
  20330. p1 *= qt[row + 1];
  20331. p2 *= qt[row + 2];
  20332. p3 *= qt[row + 3];
  20333. p4 *= qt[row + 4];
  20334. p5 *= qt[row + 5];
  20335. p6 *= qt[row + 6];
  20336. p7 *= qt[row + 7];
  20337. v0 = dctSqrt2 * p0 + 128 >> 8;
  20338. v1 = dctSqrt2 * p4 + 128 >> 8;
  20339. v2 = p2;
  20340. v3 = p6;
  20341. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  20342. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  20343. v5 = p3 << 4;
  20344. v6 = p5 << 4;
  20345. v0 = v0 + v1 + 1 >> 1;
  20346. v1 = v0 - v1;
  20347. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  20348. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  20349. v3 = t;
  20350. v4 = v4 + v6 + 1 >> 1;
  20351. v6 = v4 - v6;
  20352. v7 = v7 + v5 + 1 >> 1;
  20353. v5 = v7 - v5;
  20354. v0 = v0 + v3 + 1 >> 1;
  20355. v3 = v0 - v3;
  20356. v1 = v1 + v2 + 1 >> 1;
  20357. v2 = v1 - v2;
  20358. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  20359. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  20360. v7 = t;
  20361. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  20362. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  20363. v6 = t;
  20364. p[row] = v0 + v7;
  20365. p[row + 7] = v0 - v7;
  20366. p[row + 1] = v1 + v6;
  20367. p[row + 6] = v1 - v6;
  20368. p[row + 2] = v2 + v5;
  20369. p[row + 5] = v2 - v5;
  20370. p[row + 3] = v3 + v4;
  20371. p[row + 4] = v3 - v4;
  20372. }
  20373. for (let col = 0; col < 8; ++col) {
  20374. p0 = p[col];
  20375. p1 = p[col + 8];
  20376. p2 = p[col + 16];
  20377. p3 = p[col + 24];
  20378. p4 = p[col + 32];
  20379. p5 = p[col + 40];
  20380. p6 = p[col + 48];
  20381. p7 = p[col + 56];
  20382. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  20383. t = dctSqrt2 * p0 + 8192 >> 14;
  20384. if (t < -2040) {
  20385. t = 0;
  20386. } else if (t >= 2024) {
  20387. t = 255;
  20388. } else {
  20389. t = t + 2056 >> 4;
  20390. }
  20391. blockData[blockBufferOffset + col] = t;
  20392. blockData[blockBufferOffset + col + 8] = t;
  20393. blockData[blockBufferOffset + col + 16] = t;
  20394. blockData[blockBufferOffset + col + 24] = t;
  20395. blockData[blockBufferOffset + col + 32] = t;
  20396. blockData[blockBufferOffset + col + 40] = t;
  20397. blockData[blockBufferOffset + col + 48] = t;
  20398. blockData[blockBufferOffset + col + 56] = t;
  20399. continue;
  20400. }
  20401. v0 = dctSqrt2 * p0 + 2048 >> 12;
  20402. v1 = dctSqrt2 * p4 + 2048 >> 12;
  20403. v2 = p2;
  20404. v3 = p6;
  20405. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  20406. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  20407. v5 = p3;
  20408. v6 = p5;
  20409. v0 = (v0 + v1 + 1 >> 1) + 4112;
  20410. v1 = v0 - v1;
  20411. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  20412. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  20413. v3 = t;
  20414. v4 = v4 + v6 + 1 >> 1;
  20415. v6 = v4 - v6;
  20416. v7 = v7 + v5 + 1 >> 1;
  20417. v5 = v7 - v5;
  20418. v0 = v0 + v3 + 1 >> 1;
  20419. v3 = v0 - v3;
  20420. v1 = v1 + v2 + 1 >> 1;
  20421. v2 = v1 - v2;
  20422. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  20423. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  20424. v7 = t;
  20425. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  20426. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  20427. v6 = t;
  20428. p0 = v0 + v7;
  20429. p7 = v0 - v7;
  20430. p1 = v1 + v6;
  20431. p6 = v1 - v6;
  20432. p2 = v2 + v5;
  20433. p5 = v2 - v5;
  20434. p3 = v3 + v4;
  20435. p4 = v3 - v4;
  20436. if (p0 < 16) {
  20437. p0 = 0;
  20438. } else if (p0 >= 4080) {
  20439. p0 = 255;
  20440. } else {
  20441. p0 >>= 4;
  20442. }
  20443. if (p1 < 16) {
  20444. p1 = 0;
  20445. } else if (p1 >= 4080) {
  20446. p1 = 255;
  20447. } else {
  20448. p1 >>= 4;
  20449. }
  20450. if (p2 < 16) {
  20451. p2 = 0;
  20452. } else if (p2 >= 4080) {
  20453. p2 = 255;
  20454. } else {
  20455. p2 >>= 4;
  20456. }
  20457. if (p3 < 16) {
  20458. p3 = 0;
  20459. } else if (p3 >= 4080) {
  20460. p3 = 255;
  20461. } else {
  20462. p3 >>= 4;
  20463. }
  20464. if (p4 < 16) {
  20465. p4 = 0;
  20466. } else if (p4 >= 4080) {
  20467. p4 = 255;
  20468. } else {
  20469. p4 >>= 4;
  20470. }
  20471. if (p5 < 16) {
  20472. p5 = 0;
  20473. } else if (p5 >= 4080) {
  20474. p5 = 255;
  20475. } else {
  20476. p5 >>= 4;
  20477. }
  20478. if (p6 < 16) {
  20479. p6 = 0;
  20480. } else if (p6 >= 4080) {
  20481. p6 = 255;
  20482. } else {
  20483. p6 >>= 4;
  20484. }
  20485. if (p7 < 16) {
  20486. p7 = 0;
  20487. } else if (p7 >= 4080) {
  20488. p7 = 255;
  20489. } else {
  20490. p7 >>= 4;
  20491. }
  20492. blockData[blockBufferOffset + col] = p0;
  20493. blockData[blockBufferOffset + col + 8] = p1;
  20494. blockData[blockBufferOffset + col + 16] = p2;
  20495. blockData[blockBufferOffset + col + 24] = p3;
  20496. blockData[blockBufferOffset + col + 32] = p4;
  20497. blockData[blockBufferOffset + col + 40] = p5;
  20498. blockData[blockBufferOffset + col + 48] = p6;
  20499. blockData[blockBufferOffset + col + 56] = p7;
  20500. }
  20501. }
  20502. function buildComponentData(frame, component) {
  20503. const blocksPerLine = component.blocksPerLine;
  20504. const blocksPerColumn = component.blocksPerColumn;
  20505. const computationBuffer = new Int16Array(64);
  20506. for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  20507. for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  20508. const offset = getBlockBufferOffset(component, blockRow, blockCol);
  20509. quantizeAndInverse(component, offset, computationBuffer);
  20510. }
  20511. }
  20512. return component.blockData;
  20513. }
  20514. function findNextFileMarker(data, currentPos) {
  20515. let startPos = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : currentPos;
  20516. const maxPos = data.length - 1;
  20517. let newPos = startPos < currentPos ? startPos : currentPos;
  20518. if (currentPos >= maxPos) {
  20519. return null;
  20520. }
  20521. const currentMarker = (0, _core_utils.readUint16)(data, currentPos);
  20522. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  20523. return {
  20524. invalid: null,
  20525. marker: currentMarker,
  20526. offset: currentPos
  20527. };
  20528. }
  20529. let newMarker = (0, _core_utils.readUint16)(data, newPos);
  20530. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  20531. if (++newPos >= maxPos) {
  20532. return null;
  20533. }
  20534. newMarker = (0, _core_utils.readUint16)(data, newPos);
  20535. }
  20536. return {
  20537. invalid: currentMarker.toString(16),
  20538. marker: newMarker,
  20539. offset: newPos
  20540. };
  20541. }
  20542. class JpegImage {
  20543. constructor() {
  20544. let {
  20545. decodeTransform = null,
  20546. colorTransform = -1
  20547. } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  20548. this._decodeTransform = decodeTransform;
  20549. this._colorTransform = colorTransform;
  20550. }
  20551. parse(data) {
  20552. let {
  20553. dnlScanLines = null
  20554. } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  20555. function readDataBlock() {
  20556. const length = (0, _core_utils.readUint16)(data, offset);
  20557. offset += 2;
  20558. let endOffset = offset + length - 2;
  20559. const fileMarker = findNextFileMarker(data, endOffset, offset);
  20560. if (fileMarker && fileMarker.invalid) {
  20561. (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
  20562. endOffset = fileMarker.offset;
  20563. }
  20564. const array = data.subarray(offset, endOffset);
  20565. offset += array.length;
  20566. return array;
  20567. }
  20568. function prepareComponents(frame) {
  20569. const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  20570. const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  20571. for (let i = 0, ii = frame.components.length; i < ii; i++) {
  20572. const component = frame.components[i];
  20573. const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  20574. const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  20575. const blocksPerLineForMcu = mcusPerLine * component.h;
  20576. const blocksPerColumnForMcu = mcusPerColumn * component.v;
  20577. const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  20578. component.blockData = new Int16Array(blocksBufferSize);
  20579. component.blocksPerLine = blocksPerLine;
  20580. component.blocksPerColumn = blocksPerColumn;
  20581. }
  20582. frame.mcusPerLine = mcusPerLine;
  20583. frame.mcusPerColumn = mcusPerColumn;
  20584. }
  20585. let offset = 0;
  20586. let jfif = null;
  20587. let adobe = null;
  20588. let frame, resetInterval;
  20589. let numSOSMarkers = 0;
  20590. const quantizationTables = [];
  20591. const huffmanTablesAC = [],
  20592. huffmanTablesDC = [];
  20593. let fileMarker = (0, _core_utils.readUint16)(data, offset);
  20594. offset += 2;
  20595. if (fileMarker !== 0xffd8) {
  20596. throw new JpegError("SOI not found");
  20597. }
  20598. fileMarker = (0, _core_utils.readUint16)(data, offset);
  20599. offset += 2;
  20600. markerLoop: while (fileMarker !== 0xffd9) {
  20601. let i, j, l;
  20602. switch (fileMarker) {
  20603. case 0xffe0:
  20604. case 0xffe1:
  20605. case 0xffe2:
  20606. case 0xffe3:
  20607. case 0xffe4:
  20608. case 0xffe5:
  20609. case 0xffe6:
  20610. case 0xffe7:
  20611. case 0xffe8:
  20612. case 0xffe9:
  20613. case 0xffea:
  20614. case 0xffeb:
  20615. case 0xffec:
  20616. case 0xffed:
  20617. case 0xffee:
  20618. case 0xffef:
  20619. case 0xfffe:
  20620. const appData = readDataBlock();
  20621. if (fileMarker === 0xffe0) {
  20622. if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  20623. jfif = {
  20624. version: {
  20625. major: appData[5],
  20626. minor: appData[6]
  20627. },
  20628. densityUnits: appData[7],
  20629. xDensity: appData[8] << 8 | appData[9],
  20630. yDensity: appData[10] << 8 | appData[11],
  20631. thumbWidth: appData[12],
  20632. thumbHeight: appData[13],
  20633. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  20634. };
  20635. }
  20636. }
  20637. if (fileMarker === 0xffee) {
  20638. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
  20639. adobe = {
  20640. version: appData[5] << 8 | appData[6],
  20641. flags0: appData[7] << 8 | appData[8],
  20642. flags1: appData[9] << 8 | appData[10],
  20643. transformCode: appData[11]
  20644. };
  20645. }
  20646. }
  20647. break;
  20648. case 0xffdb:
  20649. const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
  20650. offset += 2;
  20651. const quantizationTablesEnd = quantizationTablesLength + offset - 2;
  20652. let z;
  20653. while (offset < quantizationTablesEnd) {
  20654. const quantizationTableSpec = data[offset++];
  20655. const tableData = new Uint16Array(64);
  20656. if (quantizationTableSpec >> 4 === 0) {
  20657. for (j = 0; j < 64; j++) {
  20658. z = dctZigZag[j];
  20659. tableData[z] = data[offset++];
  20660. }
  20661. } else if (quantizationTableSpec >> 4 === 1) {
  20662. for (j = 0; j < 64; j++) {
  20663. z = dctZigZag[j];
  20664. tableData[z] = (0, _core_utils.readUint16)(data, offset);
  20665. offset += 2;
  20666. }
  20667. } else {
  20668. throw new JpegError("DQT - invalid table spec");
  20669. }
  20670. quantizationTables[quantizationTableSpec & 15] = tableData;
  20671. }
  20672. break;
  20673. case 0xffc0:
  20674. case 0xffc1:
  20675. case 0xffc2:
  20676. if (frame) {
  20677. throw new JpegError("Only single frame JPEGs supported");
  20678. }
  20679. offset += 2;
  20680. frame = {};
  20681. frame.extended = fileMarker === 0xffc1;
  20682. frame.progressive = fileMarker === 0xffc2;
  20683. frame.precision = data[offset++];
  20684. const sofScanLines = (0, _core_utils.readUint16)(data, offset);
  20685. offset += 2;
  20686. frame.scanLines = dnlScanLines || sofScanLines;
  20687. frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);
  20688. offset += 2;
  20689. frame.components = [];
  20690. frame.componentIds = {};
  20691. const componentsCount = data[offset++];
  20692. let maxH = 0,
  20693. maxV = 0;
  20694. for (i = 0; i < componentsCount; i++) {
  20695. const componentId = data[offset];
  20696. const h = data[offset + 1] >> 4;
  20697. const v = data[offset + 1] & 15;
  20698. if (maxH < h) {
  20699. maxH = h;
  20700. }
  20701. if (maxV < v) {
  20702. maxV = v;
  20703. }
  20704. const qId = data[offset + 2];
  20705. l = frame.components.push({
  20706. h,
  20707. v,
  20708. quantizationId: qId,
  20709. quantizationTable: null
  20710. });
  20711. frame.componentIds[componentId] = l - 1;
  20712. offset += 3;
  20713. }
  20714. frame.maxH = maxH;
  20715. frame.maxV = maxV;
  20716. prepareComponents(frame);
  20717. break;
  20718. case 0xffc4:
  20719. const huffmanLength = (0, _core_utils.readUint16)(data, offset);
  20720. offset += 2;
  20721. for (i = 2; i < huffmanLength;) {
  20722. const huffmanTableSpec = data[offset++];
  20723. const codeLengths = new Uint8Array(16);
  20724. let codeLengthSum = 0;
  20725. for (j = 0; j < 16; j++, offset++) {
  20726. codeLengthSum += codeLengths[j] = data[offset];
  20727. }
  20728. const huffmanValues = new Uint8Array(codeLengthSum);
  20729. for (j = 0; j < codeLengthSum; j++, offset++) {
  20730. huffmanValues[j] = data[offset];
  20731. }
  20732. i += 17 + codeLengthSum;
  20733. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  20734. }
  20735. break;
  20736. case 0xffdd:
  20737. offset += 2;
  20738. resetInterval = (0, _core_utils.readUint16)(data, offset);
  20739. offset += 2;
  20740. break;
  20741. case 0xffda:
  20742. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  20743. offset += 2;
  20744. const selectorsCount = data[offset++],
  20745. components = [];
  20746. for (i = 0; i < selectorsCount; i++) {
  20747. const index = data[offset++];
  20748. const componentIndex = frame.componentIds[index];
  20749. const component = frame.components[componentIndex];
  20750. component.index = index;
  20751. const tableSpec = data[offset++];
  20752. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  20753. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  20754. components.push(component);
  20755. }
  20756. const spectralStart = data[offset++],
  20757. spectralEnd = data[offset++],
  20758. successiveApproximation = data[offset++];
  20759. try {
  20760. const processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
  20761. offset += processed;
  20762. } catch (ex) {
  20763. if (ex instanceof DNLMarkerError) {
  20764. (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);
  20765. return this.parse(data, {
  20766. dnlScanLines: ex.scanLines
  20767. });
  20768. } else if (ex instanceof EOIMarkerError) {
  20769. (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
  20770. break markerLoop;
  20771. }
  20772. throw ex;
  20773. }
  20774. break;
  20775. case 0xffdc:
  20776. offset += 4;
  20777. break;
  20778. case 0xffff:
  20779. if (data[offset] !== 0xff) {
  20780. offset--;
  20781. }
  20782. break;
  20783. default:
  20784. const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
  20785. if (nextFileMarker && nextFileMarker.invalid) {
  20786. (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
  20787. offset = nextFileMarker.offset;
  20788. break;
  20789. }
  20790. if (!nextFileMarker || offset >= data.length - 1) {
  20791. (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
  20792. break markerLoop;
  20793. }
  20794. throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
  20795. }
  20796. fileMarker = (0, _core_utils.readUint16)(data, offset);
  20797. offset += 2;
  20798. }
  20799. this.width = frame.samplesPerLine;
  20800. this.height = frame.scanLines;
  20801. this.jfif = jfif;
  20802. this.adobe = adobe;
  20803. this.components = [];
  20804. for (let i = 0, ii = frame.components.length; i < ii; i++) {
  20805. const component = frame.components[i];
  20806. const quantizationTable = quantizationTables[component.quantizationId];
  20807. if (quantizationTable) {
  20808. component.quantizationTable = quantizationTable;
  20809. }
  20810. this.components.push({
  20811. index: component.index,
  20812. output: buildComponentData(frame, component),
  20813. scaleX: component.h / frame.maxH,
  20814. scaleY: component.v / frame.maxV,
  20815. blocksPerLine: component.blocksPerLine,
  20816. blocksPerColumn: component.blocksPerColumn
  20817. });
  20818. }
  20819. this.numComponents = this.components.length;
  20820. return undefined;
  20821. }
  20822. _getLinearizedBlockData(width, height) {
  20823. let isSourcePDF = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  20824. const scaleX = this.width / width,
  20825. scaleY = this.height / height;
  20826. let component, componentScaleX, componentScaleY, blocksPerScanline;
  20827. let x, y, i, j, k;
  20828. let index;
  20829. let offset = 0;
  20830. let output;
  20831. const numComponents = this.components.length;
  20832. const dataLength = width * height * numComponents;
  20833. const data = new Uint8ClampedArray(dataLength);
  20834. const xScaleBlockOffset = new Uint32Array(width);
  20835. const mask3LSB = 0xfffffff8;
  20836. let lastComponentScaleX;
  20837. for (i = 0; i < numComponents; i++) {
  20838. component = this.components[i];
  20839. componentScaleX = component.scaleX * scaleX;
  20840. componentScaleY = component.scaleY * scaleY;
  20841. offset = i;
  20842. output = component.output;
  20843. blocksPerScanline = component.blocksPerLine + 1 << 3;
  20844. if (componentScaleX !== lastComponentScaleX) {
  20845. for (x = 0; x < width; x++) {
  20846. j = 0 | x * componentScaleX;
  20847. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  20848. }
  20849. lastComponentScaleX = componentScaleX;
  20850. }
  20851. for (y = 0; y < height; y++) {
  20852. j = 0 | y * componentScaleY;
  20853. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  20854. for (x = 0; x < width; x++) {
  20855. data[offset] = output[index + xScaleBlockOffset[x]];
  20856. offset += numComponents;
  20857. }
  20858. }
  20859. }
  20860. let transform = this._decodeTransform;
  20861. if (!isSourcePDF && numComponents === 4 && !transform) {
  20862. transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
  20863. }
  20864. if (transform) {
  20865. for (i = 0; i < dataLength;) {
  20866. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  20867. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  20868. }
  20869. }
  20870. }
  20871. return data;
  20872. }
  20873. get _isColorConversionNeeded() {
  20874. if (this.adobe) {
  20875. return !!this.adobe.transformCode;
  20876. }
  20877. if (this.numComponents === 3) {
  20878. if (this._colorTransform === 0) {
  20879. return false;
  20880. } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) {
  20881. return false;
  20882. }
  20883. return true;
  20884. }
  20885. if (this._colorTransform === 1) {
  20886. return true;
  20887. }
  20888. return false;
  20889. }
  20890. _convertYccToRgb(data) {
  20891. let Y, Cb, Cr;
  20892. for (let i = 0, length = data.length; i < length; i += 3) {
  20893. Y = data[i];
  20894. Cb = data[i + 1];
  20895. Cr = data[i + 2];
  20896. data[i] = Y - 179.456 + 1.402 * Cr;
  20897. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  20898. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  20899. }
  20900. return data;
  20901. }
  20902. _convertYcckToRgb(data) {
  20903. let Y, Cb, Cr, k;
  20904. let offset = 0;
  20905. for (let i = 0, length = data.length; i < length; i += 4) {
  20906. Y = data[i];
  20907. Cb = data[i + 1];
  20908. Cr = data[i + 2];
  20909. k = data[i + 3];
  20910. 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);
  20911. 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);
  20912. 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);
  20913. }
  20914. return data.subarray(0, offset);
  20915. }
  20916. _convertYcckToCmyk(data) {
  20917. let Y, Cb, Cr;
  20918. for (let i = 0, length = data.length; i < length; i += 4) {
  20919. Y = data[i];
  20920. Cb = data[i + 1];
  20921. Cr = data[i + 2];
  20922. data[i] = 434.456 - Y - 1.402 * Cr;
  20923. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  20924. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  20925. }
  20926. return data;
  20927. }
  20928. _convertCmykToRgb(data) {
  20929. let c, m, y, k;
  20930. let offset = 0;
  20931. for (let i = 0, length = data.length; i < length; i += 4) {
  20932. c = data[i];
  20933. m = data[i + 1];
  20934. y = data[i + 2];
  20935. k = data[i + 3];
  20936. 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);
  20937. 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);
  20938. 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);
  20939. }
  20940. return data.subarray(0, offset);
  20941. }
  20942. getData(_ref) {
  20943. let {
  20944. width,
  20945. height,
  20946. forceRGB = false,
  20947. isSourcePDF = false
  20948. } = _ref;
  20949. if (this.numComponents > 4) {
  20950. throw new JpegError("Unsupported color mode");
  20951. }
  20952. const data = this._getLinearizedBlockData(width, height, isSourcePDF);
  20953. if (this.numComponents === 1 && forceRGB) {
  20954. const dataLength = data.length;
  20955. const rgbData = new Uint8ClampedArray(dataLength * 3);
  20956. let offset = 0;
  20957. for (let i = 0; i < dataLength; i++) {
  20958. const grayColor = data[i];
  20959. rgbData[offset++] = grayColor;
  20960. rgbData[offset++] = grayColor;
  20961. rgbData[offset++] = grayColor;
  20962. }
  20963. return rgbData;
  20964. } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
  20965. return this._convertYccToRgb(data);
  20966. } else if (this.numComponents === 4) {
  20967. if (this._isColorConversionNeeded) {
  20968. if (forceRGB) {
  20969. return this._convertYcckToRgb(data);
  20970. }
  20971. return this._convertYcckToCmyk(data);
  20972. } else if (forceRGB) {
  20973. return this._convertCmykToRgb(data);
  20974. }
  20975. }
  20976. return data;
  20977. }
  20978. }
  20979. exports.JpegImage = JpegImage;
  20980. /***/ }),
  20981. /* 154 */
  20982. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20983. "use strict";
  20984. Object.defineProperty(exports, "__esModule", ({
  20985. value: true
  20986. }));
  20987. exports.JpxStream = void 0;
  20988. var _decode_stream = __w_pdfjs_require__(144);
  20989. var _jpx = __w_pdfjs_require__(155);
  20990. var _util = __w_pdfjs_require__(2);
  20991. class JpxStream extends _decode_stream.DecodeStream {
  20992. constructor(stream, maybeLength, params) {
  20993. super(maybeLength);
  20994. this.stream = stream;
  20995. this.dict = stream.dict;
  20996. this.maybeLength = maybeLength;
  20997. this.params = params;
  20998. }
  20999. get bytes() {
  21000. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  21001. }
  21002. ensureBuffer(requested) {}
  21003. readBlock() {
  21004. if (this.eof) {
  21005. return;
  21006. }
  21007. const jpxImage = new _jpx.JpxImage();
  21008. jpxImage.parse(this.bytes);
  21009. const width = jpxImage.width;
  21010. const height = jpxImage.height;
  21011. const componentsCount = jpxImage.componentsCount;
  21012. const tileCount = jpxImage.tiles.length;
  21013. if (tileCount === 1) {
  21014. this.buffer = jpxImage.tiles[0].items;
  21015. } else {
  21016. const data = new Uint8ClampedArray(width * height * componentsCount);
  21017. for (let k = 0; k < tileCount; k++) {
  21018. const tileComponents = jpxImage.tiles[k];
  21019. const tileWidth = tileComponents.width;
  21020. const tileHeight = tileComponents.height;
  21021. const tileLeft = tileComponents.left;
  21022. const tileTop = tileComponents.top;
  21023. const src = tileComponents.items;
  21024. let srcPosition = 0;
  21025. let dataPosition = (width * tileTop + tileLeft) * componentsCount;
  21026. const imgRowSize = width * componentsCount;
  21027. const tileRowSize = tileWidth * componentsCount;
  21028. for (let j = 0; j < tileHeight; j++) {
  21029. const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  21030. data.set(rowBytes, dataPosition);
  21031. srcPosition += tileRowSize;
  21032. dataPosition += imgRowSize;
  21033. }
  21034. }
  21035. this.buffer = data;
  21036. }
  21037. this.bufferLength = this.buffer.length;
  21038. this.eof = true;
  21039. }
  21040. }
  21041. exports.JpxStream = JpxStream;
  21042. /***/ }),
  21043. /* 155 */
  21044. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  21045. "use strict";
  21046. Object.defineProperty(exports, "__esModule", ({
  21047. value: true
  21048. }));
  21049. exports.JpxImage = void 0;
  21050. var _util = __w_pdfjs_require__(2);
  21051. var _core_utils = __w_pdfjs_require__(131);
  21052. var _arithmetic_decoder = __w_pdfjs_require__(151);
  21053. class JpxError extends _util.BaseException {
  21054. constructor(msg) {
  21055. super(`JPX error: ${msg}`, "JpxError");
  21056. }
  21057. }
  21058. const SubbandsGainLog2 = {
  21059. LL: 0,
  21060. LH: 1,
  21061. HL: 1,
  21062. HH: 2
  21063. };
  21064. class JpxImage {
  21065. constructor() {
  21066. this.failOnCorruptedImage = false;
  21067. }
  21068. parse(data) {
  21069. const head = (0, _core_utils.readUint16)(data, 0);
  21070. if (head === 0xff4f) {
  21071. this.parseCodestream(data, 0, data.length);
  21072. return;
  21073. }
  21074. const length = data.length;
  21075. let position = 0;
  21076. while (position < length) {
  21077. let headerSize = 8;
  21078. let lbox = (0, _core_utils.readUint32)(data, position);
  21079. const tbox = (0, _core_utils.readUint32)(data, position + 4);
  21080. position += headerSize;
  21081. if (lbox === 1) {
  21082. lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4);
  21083. position += 8;
  21084. headerSize += 8;
  21085. }
  21086. if (lbox === 0) {
  21087. lbox = length - position + headerSize;
  21088. }
  21089. if (lbox < headerSize) {
  21090. throw new JpxError("Invalid box field size");
  21091. }
  21092. const dataLength = lbox - headerSize;
  21093. let jumpDataLength = true;
  21094. switch (tbox) {
  21095. case 0x6a703268:
  21096. jumpDataLength = false;
  21097. break;
  21098. case 0x636f6c72:
  21099. const method = data[position];
  21100. if (method === 1) {
  21101. const colorspace = (0, _core_utils.readUint32)(data, position + 3);
  21102. switch (colorspace) {
  21103. case 16:
  21104. case 17:
  21105. case 18:
  21106. break;
  21107. default:
  21108. (0, _util.warn)("Unknown colorspace " + colorspace);
  21109. break;
  21110. }
  21111. } else if (method === 2) {
  21112. (0, _util.info)("ICC profile not supported");
  21113. }
  21114. break;
  21115. case 0x6a703263:
  21116. this.parseCodestream(data, position, position + dataLength);
  21117. break;
  21118. case 0x6a502020:
  21119. if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) {
  21120. (0, _util.warn)("Invalid JP2 signature");
  21121. }
  21122. break;
  21123. case 0x6a501a1a:
  21124. case 0x66747970:
  21125. case 0x72726571:
  21126. case 0x72657320:
  21127. case 0x69686472:
  21128. break;
  21129. default:
  21130. const headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff);
  21131. (0, _util.warn)(`Unsupported header type ${tbox} (${headerType}).`);
  21132. break;
  21133. }
  21134. if (jumpDataLength) {
  21135. position += dataLength;
  21136. }
  21137. }
  21138. }
  21139. parseImageProperties(stream) {
  21140. let newByte = stream.getByte();
  21141. while (newByte >= 0) {
  21142. const oldByte = newByte;
  21143. newByte = stream.getByte();
  21144. const code = oldByte << 8 | newByte;
  21145. if (code === 0xff51) {
  21146. stream.skip(4);
  21147. const Xsiz = stream.getInt32() >>> 0;
  21148. const Ysiz = stream.getInt32() >>> 0;
  21149. const XOsiz = stream.getInt32() >>> 0;
  21150. const YOsiz = stream.getInt32() >>> 0;
  21151. stream.skip(16);
  21152. const Csiz = stream.getUint16();
  21153. this.width = Xsiz - XOsiz;
  21154. this.height = Ysiz - YOsiz;
  21155. this.componentsCount = Csiz;
  21156. this.bitsPerComponent = 8;
  21157. return;
  21158. }
  21159. }
  21160. throw new JpxError("No size marker found in JPX stream");
  21161. }
  21162. parseCodestream(data, start, end) {
  21163. const context = {};
  21164. let doNotRecover = false;
  21165. try {
  21166. let position = start;
  21167. while (position + 1 < end) {
  21168. const code = (0, _core_utils.readUint16)(data, position);
  21169. position += 2;
  21170. let length = 0,
  21171. j,
  21172. sqcd,
  21173. spqcds,
  21174. spqcdSize,
  21175. scalarExpounded,
  21176. tile;
  21177. switch (code) {
  21178. case 0xff4f:
  21179. context.mainHeader = true;
  21180. break;
  21181. case 0xffd9:
  21182. break;
  21183. case 0xff51:
  21184. length = (0, _core_utils.readUint16)(data, position);
  21185. const siz = {};
  21186. siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);
  21187. siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);
  21188. siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12);
  21189. siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16);
  21190. siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20);
  21191. siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24);
  21192. siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28);
  21193. siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32);
  21194. const componentsCount = (0, _core_utils.readUint16)(data, position + 36);
  21195. siz.Csiz = componentsCount;
  21196. const components = [];
  21197. j = position + 38;
  21198. for (let i = 0; i < componentsCount; i++) {
  21199. const component = {
  21200. precision: (data[j] & 0x7f) + 1,
  21201. isSigned: !!(data[j] & 0x80),
  21202. XRsiz: data[j + 1],
  21203. YRsiz: data[j + 2]
  21204. };
  21205. j += 3;
  21206. calculateComponentDimensions(component, siz);
  21207. components.push(component);
  21208. }
  21209. context.SIZ = siz;
  21210. context.components = components;
  21211. calculateTileGrids(context, components);
  21212. context.QCC = [];
  21213. context.COC = [];
  21214. break;
  21215. case 0xff5c:
  21216. length = (0, _core_utils.readUint16)(data, position);
  21217. const qcd = {};
  21218. j = position + 2;
  21219. sqcd = data[j++];
  21220. switch (sqcd & 0x1f) {
  21221. case 0:
  21222. spqcdSize = 8;
  21223. scalarExpounded = true;
  21224. break;
  21225. case 1:
  21226. spqcdSize = 16;
  21227. scalarExpounded = false;
  21228. break;
  21229. case 2:
  21230. spqcdSize = 16;
  21231. scalarExpounded = true;
  21232. break;
  21233. default:
  21234. throw new Error("Invalid SQcd value " + sqcd);
  21235. }
  21236. qcd.noQuantization = spqcdSize === 8;
  21237. qcd.scalarExpounded = scalarExpounded;
  21238. qcd.guardBits = sqcd >> 5;
  21239. spqcds = [];
  21240. while (j < length + position) {
  21241. const spqcd = {};
  21242. if (spqcdSize === 8) {
  21243. spqcd.epsilon = data[j++] >> 3;
  21244. spqcd.mu = 0;
  21245. } else {
  21246. spqcd.epsilon = data[j] >> 3;
  21247. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  21248. j += 2;
  21249. }
  21250. spqcds.push(spqcd);
  21251. }
  21252. qcd.SPqcds = spqcds;
  21253. if (context.mainHeader) {
  21254. context.QCD = qcd;
  21255. } else {
  21256. context.currentTile.QCD = qcd;
  21257. context.currentTile.QCC = [];
  21258. }
  21259. break;
  21260. case 0xff5d:
  21261. length = (0, _core_utils.readUint16)(data, position);
  21262. const qcc = {};
  21263. j = position + 2;
  21264. let cqcc;
  21265. if (context.SIZ.Csiz < 257) {
  21266. cqcc = data[j++];
  21267. } else {
  21268. cqcc = (0, _core_utils.readUint16)(data, j);
  21269. j += 2;
  21270. }
  21271. sqcd = data[j++];
  21272. switch (sqcd & 0x1f) {
  21273. case 0:
  21274. spqcdSize = 8;
  21275. scalarExpounded = true;
  21276. break;
  21277. case 1:
  21278. spqcdSize = 16;
  21279. scalarExpounded = false;
  21280. break;
  21281. case 2:
  21282. spqcdSize = 16;
  21283. scalarExpounded = true;
  21284. break;
  21285. default:
  21286. throw new Error("Invalid SQcd value " + sqcd);
  21287. }
  21288. qcc.noQuantization = spqcdSize === 8;
  21289. qcc.scalarExpounded = scalarExpounded;
  21290. qcc.guardBits = sqcd >> 5;
  21291. spqcds = [];
  21292. while (j < length + position) {
  21293. const spqcd = {};
  21294. if (spqcdSize === 8) {
  21295. spqcd.epsilon = data[j++] >> 3;
  21296. spqcd.mu = 0;
  21297. } else {
  21298. spqcd.epsilon = data[j] >> 3;
  21299. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  21300. j += 2;
  21301. }
  21302. spqcds.push(spqcd);
  21303. }
  21304. qcc.SPqcds = spqcds;
  21305. if (context.mainHeader) {
  21306. context.QCC[cqcc] = qcc;
  21307. } else {
  21308. context.currentTile.QCC[cqcc] = qcc;
  21309. }
  21310. break;
  21311. case 0xff52:
  21312. length = (0, _core_utils.readUint16)(data, position);
  21313. const cod = {};
  21314. j = position + 2;
  21315. const scod = data[j++];
  21316. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  21317. cod.sopMarkerUsed = !!(scod & 2);
  21318. cod.ephMarkerUsed = !!(scod & 4);
  21319. cod.progressionOrder = data[j++];
  21320. cod.layersCount = (0, _core_utils.readUint16)(data, j);
  21321. j += 2;
  21322. cod.multipleComponentTransform = data[j++];
  21323. cod.decompositionLevelsCount = data[j++];
  21324. cod.xcb = (data[j++] & 0xf) + 2;
  21325. cod.ycb = (data[j++] & 0xf) + 2;
  21326. const blockStyle = data[j++];
  21327. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  21328. cod.resetContextProbabilities = !!(blockStyle & 2);
  21329. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  21330. cod.verticallyStripe = !!(blockStyle & 8);
  21331. cod.predictableTermination = !!(blockStyle & 16);
  21332. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  21333. cod.reversibleTransformation = data[j++];
  21334. if (cod.entropyCoderWithCustomPrecincts) {
  21335. const precinctsSizes = [];
  21336. while (j < length + position) {
  21337. const precinctsSize = data[j++];
  21338. precinctsSizes.push({
  21339. PPx: precinctsSize & 0xf,
  21340. PPy: precinctsSize >> 4
  21341. });
  21342. }
  21343. cod.precinctsSizes = precinctsSizes;
  21344. }
  21345. const unsupported = [];
  21346. if (cod.selectiveArithmeticCodingBypass) {
  21347. unsupported.push("selectiveArithmeticCodingBypass");
  21348. }
  21349. if (cod.terminationOnEachCodingPass) {
  21350. unsupported.push("terminationOnEachCodingPass");
  21351. }
  21352. if (cod.verticallyStripe) {
  21353. unsupported.push("verticallyStripe");
  21354. }
  21355. if (cod.predictableTermination) {
  21356. unsupported.push("predictableTermination");
  21357. }
  21358. if (unsupported.length > 0) {
  21359. doNotRecover = true;
  21360. (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`);
  21361. }
  21362. if (context.mainHeader) {
  21363. context.COD = cod;
  21364. } else {
  21365. context.currentTile.COD = cod;
  21366. context.currentTile.COC = [];
  21367. }
  21368. break;
  21369. case 0xff90:
  21370. length = (0, _core_utils.readUint16)(data, position);
  21371. tile = {};
  21372. tile.index = (0, _core_utils.readUint16)(data, position + 2);
  21373. tile.length = (0, _core_utils.readUint32)(data, position + 4);
  21374. tile.dataEnd = tile.length + position - 2;
  21375. tile.partIndex = data[position + 8];
  21376. tile.partsCount = data[position + 9];
  21377. context.mainHeader = false;
  21378. if (tile.partIndex === 0) {
  21379. tile.COD = context.COD;
  21380. tile.COC = context.COC.slice(0);
  21381. tile.QCD = context.QCD;
  21382. tile.QCC = context.QCC.slice(0);
  21383. }
  21384. context.currentTile = tile;
  21385. break;
  21386. case 0xff93:
  21387. tile = context.currentTile;
  21388. if (tile.partIndex === 0) {
  21389. initializeTile(context, tile.index);
  21390. buildPackets(context);
  21391. }
  21392. length = tile.dataEnd - position;
  21393. parseTilePackets(context, data, position, length);
  21394. break;
  21395. case 0xff53:
  21396. (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented.");
  21397. case 0xff55:
  21398. case 0xff57:
  21399. case 0xff58:
  21400. case 0xff64:
  21401. length = (0, _core_utils.readUint16)(data, position);
  21402. break;
  21403. default:
  21404. throw new Error("Unknown codestream code: " + code.toString(16));
  21405. }
  21406. position += length;
  21407. }
  21408. } catch (e) {
  21409. if (doNotRecover || this.failOnCorruptedImage) {
  21410. throw new JpxError(e.message);
  21411. } else {
  21412. (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`);
  21413. }
  21414. }
  21415. this.tiles = transformComponents(context);
  21416. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  21417. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  21418. this.componentsCount = context.SIZ.Csiz;
  21419. }
  21420. }
  21421. exports.JpxImage = JpxImage;
  21422. function calculateComponentDimensions(component, siz) {
  21423. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  21424. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  21425. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  21426. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  21427. component.width = component.x1 - component.x0;
  21428. component.height = component.y1 - component.y0;
  21429. }
  21430. function calculateTileGrids(context, components) {
  21431. const siz = context.SIZ;
  21432. const tiles = [];
  21433. let tile;
  21434. const numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  21435. const numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  21436. for (let q = 0; q < numYtiles; q++) {
  21437. for (let p = 0; p < numXtiles; p++) {
  21438. tile = {};
  21439. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  21440. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  21441. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  21442. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  21443. tile.width = tile.tx1 - tile.tx0;
  21444. tile.height = tile.ty1 - tile.ty0;
  21445. tile.components = [];
  21446. tiles.push(tile);
  21447. }
  21448. }
  21449. context.tiles = tiles;
  21450. const componentsCount = siz.Csiz;
  21451. for (let i = 0, ii = componentsCount; i < ii; i++) {
  21452. const component = components[i];
  21453. for (let j = 0, jj = tiles.length; j < jj; j++) {
  21454. const tileComponent = {};
  21455. tile = tiles[j];
  21456. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  21457. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  21458. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  21459. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  21460. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  21461. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  21462. tile.components[i] = tileComponent;
  21463. }
  21464. }
  21465. }
  21466. function getBlocksDimensions(context, component, r) {
  21467. const codOrCoc = component.codingStyleParameters;
  21468. const result = {};
  21469. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  21470. result.PPx = 15;
  21471. result.PPy = 15;
  21472. } else {
  21473. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  21474. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  21475. }
  21476. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  21477. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  21478. return result;
  21479. }
  21480. function buildPrecincts(context, resolution, dimensions) {
  21481. const precinctWidth = 1 << dimensions.PPx;
  21482. const precinctHeight = 1 << dimensions.PPy;
  21483. const isZeroRes = resolution.resLevel === 0;
  21484. const precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  21485. const precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  21486. const numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  21487. const numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  21488. const numprecincts = numprecinctswide * numprecinctshigh;
  21489. resolution.precinctParameters = {
  21490. precinctWidth,
  21491. precinctHeight,
  21492. numprecinctswide,
  21493. numprecinctshigh,
  21494. numprecincts,
  21495. precinctWidthInSubband,
  21496. precinctHeightInSubband
  21497. };
  21498. }
  21499. function buildCodeblocks(context, subband, dimensions) {
  21500. const xcb_ = dimensions.xcb_;
  21501. const ycb_ = dimensions.ycb_;
  21502. const codeblockWidth = 1 << xcb_;
  21503. const codeblockHeight = 1 << ycb_;
  21504. const cbx0 = subband.tbx0 >> xcb_;
  21505. const cby0 = subband.tby0 >> ycb_;
  21506. const cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  21507. const cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  21508. const precinctParameters = subband.resolution.precinctParameters;
  21509. const codeblocks = [];
  21510. const precincts = [];
  21511. let i, j, codeblock, precinctNumber;
  21512. for (j = cby0; j < cby1; j++) {
  21513. for (i = cbx0; i < cbx1; i++) {
  21514. codeblock = {
  21515. cbx: i,
  21516. cby: j,
  21517. tbx0: codeblockWidth * i,
  21518. tby0: codeblockHeight * j,
  21519. tbx1: codeblockWidth * (i + 1),
  21520. tby1: codeblockHeight * (j + 1)
  21521. };
  21522. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  21523. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  21524. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  21525. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  21526. const pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  21527. const pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  21528. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  21529. codeblock.precinctNumber = precinctNumber;
  21530. codeblock.subbandType = subband.type;
  21531. codeblock.Lblock = 3;
  21532. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  21533. continue;
  21534. }
  21535. codeblocks.push(codeblock);
  21536. let precinct = precincts[precinctNumber];
  21537. if (precinct !== undefined) {
  21538. if (i < precinct.cbxMin) {
  21539. precinct.cbxMin = i;
  21540. } else if (i > precinct.cbxMax) {
  21541. precinct.cbxMax = i;
  21542. }
  21543. if (j < precinct.cbyMin) {
  21544. precinct.cbxMin = j;
  21545. } else if (j > precinct.cbyMax) {
  21546. precinct.cbyMax = j;
  21547. }
  21548. } else {
  21549. precincts[precinctNumber] = precinct = {
  21550. cbxMin: i,
  21551. cbyMin: j,
  21552. cbxMax: i,
  21553. cbyMax: j
  21554. };
  21555. }
  21556. codeblock.precinct = precinct;
  21557. }
  21558. }
  21559. subband.codeblockParameters = {
  21560. codeblockWidth: xcb_,
  21561. codeblockHeight: ycb_,
  21562. numcodeblockwide: cbx1 - cbx0 + 1,
  21563. numcodeblockhigh: cby1 - cby0 + 1
  21564. };
  21565. subband.codeblocks = codeblocks;
  21566. subband.precincts = precincts;
  21567. }
  21568. function createPacket(resolution, precinctNumber, layerNumber) {
  21569. const precinctCodeblocks = [];
  21570. const subbands = resolution.subbands;
  21571. for (let i = 0, ii = subbands.length; i < ii; i++) {
  21572. const subband = subbands[i];
  21573. const codeblocks = subband.codeblocks;
  21574. for (let j = 0, jj = codeblocks.length; j < jj; j++) {
  21575. const codeblock = codeblocks[j];
  21576. if (codeblock.precinctNumber !== precinctNumber) {
  21577. continue;
  21578. }
  21579. precinctCodeblocks.push(codeblock);
  21580. }
  21581. }
  21582. return {
  21583. layerNumber,
  21584. codeblocks: precinctCodeblocks
  21585. };
  21586. }
  21587. function LayerResolutionComponentPositionIterator(context) {
  21588. const siz = context.SIZ;
  21589. const tileIndex = context.currentTile.index;
  21590. const tile = context.tiles[tileIndex];
  21591. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  21592. const componentsCount = siz.Csiz;
  21593. let maxDecompositionLevelsCount = 0;
  21594. for (let q = 0; q < componentsCount; q++) {
  21595. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  21596. }
  21597. let l = 0,
  21598. r = 0,
  21599. i = 0,
  21600. k = 0;
  21601. this.nextPacket = function JpxImage_nextPacket() {
  21602. for (; l < layersCount; l++) {
  21603. for (; r <= maxDecompositionLevelsCount; r++) {
  21604. for (; i < componentsCount; i++) {
  21605. const component = tile.components[i];
  21606. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  21607. continue;
  21608. }
  21609. const resolution = component.resolutions[r];
  21610. const numprecincts = resolution.precinctParameters.numprecincts;
  21611. for (; k < numprecincts;) {
  21612. const packet = createPacket(resolution, k, l);
  21613. k++;
  21614. return packet;
  21615. }
  21616. k = 0;
  21617. }
  21618. i = 0;
  21619. }
  21620. r = 0;
  21621. }
  21622. throw new JpxError("Out of packets");
  21623. };
  21624. }
  21625. function ResolutionLayerComponentPositionIterator(context) {
  21626. const siz = context.SIZ;
  21627. const tileIndex = context.currentTile.index;
  21628. const tile = context.tiles[tileIndex];
  21629. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  21630. const componentsCount = siz.Csiz;
  21631. let maxDecompositionLevelsCount = 0;
  21632. for (let q = 0; q < componentsCount; q++) {
  21633. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  21634. }
  21635. let r = 0,
  21636. l = 0,
  21637. i = 0,
  21638. k = 0;
  21639. this.nextPacket = function JpxImage_nextPacket() {
  21640. for (; r <= maxDecompositionLevelsCount; r++) {
  21641. for (; l < layersCount; l++) {
  21642. for (; i < componentsCount; i++) {
  21643. const component = tile.components[i];
  21644. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  21645. continue;
  21646. }
  21647. const resolution = component.resolutions[r];
  21648. const numprecincts = resolution.precinctParameters.numprecincts;
  21649. for (; k < numprecincts;) {
  21650. const packet = createPacket(resolution, k, l);
  21651. k++;
  21652. return packet;
  21653. }
  21654. k = 0;
  21655. }
  21656. i = 0;
  21657. }
  21658. l = 0;
  21659. }
  21660. throw new JpxError("Out of packets");
  21661. };
  21662. }
  21663. function ResolutionPositionComponentLayerIterator(context) {
  21664. const siz = context.SIZ;
  21665. const tileIndex = context.currentTile.index;
  21666. const tile = context.tiles[tileIndex];
  21667. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  21668. const componentsCount = siz.Csiz;
  21669. let l, r, c, p;
  21670. let maxDecompositionLevelsCount = 0;
  21671. for (c = 0; c < componentsCount; c++) {
  21672. const component = tile.components[c];
  21673. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  21674. }
  21675. const maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  21676. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  21677. let maxNumPrecincts = 0;
  21678. for (c = 0; c < componentsCount; ++c) {
  21679. const resolutions = tile.components[c].resolutions;
  21680. if (r < resolutions.length) {
  21681. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  21682. }
  21683. }
  21684. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  21685. }
  21686. l = 0;
  21687. r = 0;
  21688. c = 0;
  21689. p = 0;
  21690. this.nextPacket = function JpxImage_nextPacket() {
  21691. for (; r <= maxDecompositionLevelsCount; r++) {
  21692. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  21693. for (; c < componentsCount; c++) {
  21694. const component = tile.components[c];
  21695. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  21696. continue;
  21697. }
  21698. const resolution = component.resolutions[r];
  21699. const numprecincts = resolution.precinctParameters.numprecincts;
  21700. if (p >= numprecincts) {
  21701. continue;
  21702. }
  21703. for (; l < layersCount;) {
  21704. const packet = createPacket(resolution, p, l);
  21705. l++;
  21706. return packet;
  21707. }
  21708. l = 0;
  21709. }
  21710. c = 0;
  21711. }
  21712. p = 0;
  21713. }
  21714. throw new JpxError("Out of packets");
  21715. };
  21716. }
  21717. function PositionComponentResolutionLayerIterator(context) {
  21718. const siz = context.SIZ;
  21719. const tileIndex = context.currentTile.index;
  21720. const tile = context.tiles[tileIndex];
  21721. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  21722. const componentsCount = siz.Csiz;
  21723. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  21724. const precinctsIterationSizes = precinctsSizes;
  21725. let l = 0,
  21726. r = 0,
  21727. c = 0,
  21728. px = 0,
  21729. py = 0;
  21730. this.nextPacket = function JpxImage_nextPacket() {
  21731. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  21732. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  21733. for (; c < componentsCount; c++) {
  21734. const component = tile.components[c];
  21735. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  21736. for (; r <= decompositionLevelsCount; r++) {
  21737. const resolution = component.resolutions[r];
  21738. const sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  21739. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  21740. if (k === null) {
  21741. continue;
  21742. }
  21743. for (; l < layersCount;) {
  21744. const packet = createPacket(resolution, k, l);
  21745. l++;
  21746. return packet;
  21747. }
  21748. l = 0;
  21749. }
  21750. r = 0;
  21751. }
  21752. c = 0;
  21753. }
  21754. px = 0;
  21755. }
  21756. throw new JpxError("Out of packets");
  21757. };
  21758. }
  21759. function ComponentPositionResolutionLayerIterator(context) {
  21760. const siz = context.SIZ;
  21761. const tileIndex = context.currentTile.index;
  21762. const tile = context.tiles[tileIndex];
  21763. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  21764. const componentsCount = siz.Csiz;
  21765. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  21766. let l = 0,
  21767. r = 0,
  21768. c = 0,
  21769. px = 0,
  21770. py = 0;
  21771. this.nextPacket = function JpxImage_nextPacket() {
  21772. for (; c < componentsCount; ++c) {
  21773. const component = tile.components[c];
  21774. const precinctsIterationSizes = precinctsSizes.components[c];
  21775. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  21776. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  21777. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  21778. for (; r <= decompositionLevelsCount; r++) {
  21779. const resolution = component.resolutions[r];
  21780. const sizeInImageScale = precinctsIterationSizes.resolutions[r];
  21781. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  21782. if (k === null) {
  21783. continue;
  21784. }
  21785. for (; l < layersCount;) {
  21786. const packet = createPacket(resolution, k, l);
  21787. l++;
  21788. return packet;
  21789. }
  21790. l = 0;
  21791. }
  21792. r = 0;
  21793. }
  21794. px = 0;
  21795. }
  21796. py = 0;
  21797. }
  21798. throw new JpxError("Out of packets");
  21799. };
  21800. }
  21801. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  21802. const posX = pxIndex * precinctIterationSizes.minWidth;
  21803. const posY = pyIndex * precinctIterationSizes.minHeight;
  21804. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  21805. return null;
  21806. }
  21807. const startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  21808. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  21809. }
  21810. function getPrecinctSizesInImageScale(tile) {
  21811. const componentsCount = tile.components.length;
  21812. let minWidth = Number.MAX_VALUE;
  21813. let minHeight = Number.MAX_VALUE;
  21814. let maxNumWide = 0;
  21815. let maxNumHigh = 0;
  21816. const sizePerComponent = new Array(componentsCount);
  21817. for (let c = 0; c < componentsCount; c++) {
  21818. const component = tile.components[c];
  21819. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  21820. const sizePerResolution = new Array(decompositionLevelsCount + 1);
  21821. let minWidthCurrentComponent = Number.MAX_VALUE;
  21822. let minHeightCurrentComponent = Number.MAX_VALUE;
  21823. let maxNumWideCurrentComponent = 0;
  21824. let maxNumHighCurrentComponent = 0;
  21825. let scale = 1;
  21826. for (let r = decompositionLevelsCount; r >= 0; --r) {
  21827. const resolution = component.resolutions[r];
  21828. const widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  21829. const heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  21830. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  21831. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  21832. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  21833. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  21834. sizePerResolution[r] = {
  21835. width: widthCurrentResolution,
  21836. height: heightCurrentResolution
  21837. };
  21838. scale <<= 1;
  21839. }
  21840. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  21841. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  21842. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  21843. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  21844. sizePerComponent[c] = {
  21845. resolutions: sizePerResolution,
  21846. minWidth: minWidthCurrentComponent,
  21847. minHeight: minHeightCurrentComponent,
  21848. maxNumWide: maxNumWideCurrentComponent,
  21849. maxNumHigh: maxNumHighCurrentComponent
  21850. };
  21851. }
  21852. return {
  21853. components: sizePerComponent,
  21854. minWidth,
  21855. minHeight,
  21856. maxNumWide,
  21857. maxNumHigh
  21858. };
  21859. }
  21860. function buildPackets(context) {
  21861. const siz = context.SIZ;
  21862. const tileIndex = context.currentTile.index;
  21863. const tile = context.tiles[tileIndex];
  21864. const componentsCount = siz.Csiz;
  21865. for (let c = 0; c < componentsCount; c++) {
  21866. const component = tile.components[c];
  21867. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  21868. const resolutions = [];
  21869. const subbands = [];
  21870. for (let r = 0; r <= decompositionLevelsCount; r++) {
  21871. const blocksDimensions = getBlocksDimensions(context, component, r);
  21872. const resolution = {};
  21873. const scale = 1 << decompositionLevelsCount - r;
  21874. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  21875. resolution.try0 = Math.ceil(component.tcy0 / scale);
  21876. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  21877. resolution.try1 = Math.ceil(component.tcy1 / scale);
  21878. resolution.resLevel = r;
  21879. buildPrecincts(context, resolution, blocksDimensions);
  21880. resolutions.push(resolution);
  21881. let subband;
  21882. if (r === 0) {
  21883. subband = {};
  21884. subband.type = "LL";
  21885. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  21886. subband.tby0 = Math.ceil(component.tcy0 / scale);
  21887. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  21888. subband.tby1 = Math.ceil(component.tcy1 / scale);
  21889. subband.resolution = resolution;
  21890. buildCodeblocks(context, subband, blocksDimensions);
  21891. subbands.push(subband);
  21892. resolution.subbands = [subband];
  21893. } else {
  21894. const bscale = 1 << decompositionLevelsCount - r + 1;
  21895. const resolutionSubbands = [];
  21896. subband = {};
  21897. subband.type = "HL";
  21898. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  21899. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  21900. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  21901. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  21902. subband.resolution = resolution;
  21903. buildCodeblocks(context, subband, blocksDimensions);
  21904. subbands.push(subband);
  21905. resolutionSubbands.push(subband);
  21906. subband = {};
  21907. subband.type = "LH";
  21908. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  21909. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  21910. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  21911. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  21912. subband.resolution = resolution;
  21913. buildCodeblocks(context, subband, blocksDimensions);
  21914. subbands.push(subband);
  21915. resolutionSubbands.push(subband);
  21916. subband = {};
  21917. subband.type = "HH";
  21918. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  21919. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  21920. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  21921. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  21922. subband.resolution = resolution;
  21923. buildCodeblocks(context, subband, blocksDimensions);
  21924. subbands.push(subband);
  21925. resolutionSubbands.push(subband);
  21926. resolution.subbands = resolutionSubbands;
  21927. }
  21928. }
  21929. component.resolutions = resolutions;
  21930. component.subbands = subbands;
  21931. }
  21932. const progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  21933. switch (progressionOrder) {
  21934. case 0:
  21935. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  21936. break;
  21937. case 1:
  21938. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  21939. break;
  21940. case 2:
  21941. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  21942. break;
  21943. case 3:
  21944. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  21945. break;
  21946. case 4:
  21947. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  21948. break;
  21949. default:
  21950. throw new JpxError(`Unsupported progression order ${progressionOrder}`);
  21951. }
  21952. }
  21953. function parseTilePackets(context, data, offset, dataLength) {
  21954. let position = 0;
  21955. let buffer,
  21956. bufferSize = 0,
  21957. skipNextBit = false;
  21958. function readBits(count) {
  21959. while (bufferSize < count) {
  21960. const b = data[offset + position];
  21961. position++;
  21962. if (skipNextBit) {
  21963. buffer = buffer << 7 | b;
  21964. bufferSize += 7;
  21965. skipNextBit = false;
  21966. } else {
  21967. buffer = buffer << 8 | b;
  21968. bufferSize += 8;
  21969. }
  21970. if (b === 0xff) {
  21971. skipNextBit = true;
  21972. }
  21973. }
  21974. bufferSize -= count;
  21975. return buffer >>> bufferSize & (1 << count) - 1;
  21976. }
  21977. function skipMarkerIfEqual(value) {
  21978. if (data[offset + position - 1] === 0xff && data[offset + position] === value) {
  21979. skipBytes(1);
  21980. return true;
  21981. } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) {
  21982. skipBytes(2);
  21983. return true;
  21984. }
  21985. return false;
  21986. }
  21987. function skipBytes(count) {
  21988. position += count;
  21989. }
  21990. function alignToByte() {
  21991. bufferSize = 0;
  21992. if (skipNextBit) {
  21993. position++;
  21994. skipNextBit = false;
  21995. }
  21996. }
  21997. function readCodingpasses() {
  21998. if (readBits(1) === 0) {
  21999. return 1;
  22000. }
  22001. if (readBits(1) === 0) {
  22002. return 2;
  22003. }
  22004. let value = readBits(2);
  22005. if (value < 3) {
  22006. return value + 3;
  22007. }
  22008. value = readBits(5);
  22009. if (value < 31) {
  22010. return value + 6;
  22011. }
  22012. value = readBits(7);
  22013. return value + 37;
  22014. }
  22015. const tileIndex = context.currentTile.index;
  22016. const tile = context.tiles[tileIndex];
  22017. const sopMarkerUsed = context.COD.sopMarkerUsed;
  22018. const ephMarkerUsed = context.COD.ephMarkerUsed;
  22019. const packetsIterator = tile.packetsIterator;
  22020. while (position < dataLength) {
  22021. alignToByte();
  22022. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  22023. skipBytes(4);
  22024. }
  22025. const packet = packetsIterator.nextPacket();
  22026. if (!readBits(1)) {
  22027. continue;
  22028. }
  22029. const layerNumber = packet.layerNumber,
  22030. queue = [];
  22031. let codeblock;
  22032. for (let i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  22033. codeblock = packet.codeblocks[i];
  22034. let precinct = codeblock.precinct;
  22035. const codeblockColumn = codeblock.cbx - precinct.cbxMin;
  22036. const codeblockRow = codeblock.cby - precinct.cbyMin;
  22037. let codeblockIncluded = false;
  22038. let firstTimeInclusion = false;
  22039. let valueReady, zeroBitPlanesTree;
  22040. if (codeblock.included !== undefined) {
  22041. codeblockIncluded = !!readBits(1);
  22042. } else {
  22043. precinct = codeblock.precinct;
  22044. let inclusionTree;
  22045. if (precinct.inclusionTree !== undefined) {
  22046. inclusionTree = precinct.inclusionTree;
  22047. } else {
  22048. const width = precinct.cbxMax - precinct.cbxMin + 1;
  22049. const height = precinct.cbyMax - precinct.cbyMin + 1;
  22050. inclusionTree = new InclusionTree(width, height, layerNumber);
  22051. zeroBitPlanesTree = new TagTree(width, height);
  22052. precinct.inclusionTree = inclusionTree;
  22053. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  22054. for (let l = 0; l < layerNumber; l++) {
  22055. if (readBits(1) !== 0) {
  22056. throw new JpxError("Invalid tag tree");
  22057. }
  22058. }
  22059. }
  22060. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  22061. while (true) {
  22062. if (readBits(1)) {
  22063. valueReady = !inclusionTree.nextLevel();
  22064. if (valueReady) {
  22065. codeblock.included = true;
  22066. codeblockIncluded = firstTimeInclusion = true;
  22067. break;
  22068. }
  22069. } else {
  22070. inclusionTree.incrementValue(layerNumber);
  22071. break;
  22072. }
  22073. }
  22074. }
  22075. }
  22076. if (!codeblockIncluded) {
  22077. continue;
  22078. }
  22079. if (firstTimeInclusion) {
  22080. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  22081. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  22082. while (true) {
  22083. if (readBits(1)) {
  22084. valueReady = !zeroBitPlanesTree.nextLevel();
  22085. if (valueReady) {
  22086. break;
  22087. }
  22088. } else {
  22089. zeroBitPlanesTree.incrementValue();
  22090. }
  22091. }
  22092. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  22093. }
  22094. const codingpasses = readCodingpasses();
  22095. while (readBits(1)) {
  22096. codeblock.Lblock++;
  22097. }
  22098. const codingpassesLog2 = (0, _core_utils.log2)(codingpasses);
  22099. const bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  22100. const codedDataLength = readBits(bits);
  22101. queue.push({
  22102. codeblock,
  22103. codingpasses,
  22104. dataLength: codedDataLength
  22105. });
  22106. }
  22107. alignToByte();
  22108. if (ephMarkerUsed) {
  22109. skipMarkerIfEqual(0x92);
  22110. }
  22111. while (queue.length > 0) {
  22112. const packetItem = queue.shift();
  22113. codeblock = packetItem.codeblock;
  22114. if (codeblock.data === undefined) {
  22115. codeblock.data = [];
  22116. }
  22117. codeblock.data.push({
  22118. data,
  22119. start: offset + position,
  22120. end: offset + position + packetItem.dataLength,
  22121. codingpasses: packetItem.codingpasses
  22122. });
  22123. position += packetItem.dataLength;
  22124. }
  22125. }
  22126. return position;
  22127. }
  22128. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities) {
  22129. const x0 = subband.tbx0;
  22130. const y0 = subband.tby0;
  22131. const width = subband.tbx1 - subband.tbx0;
  22132. const codeblocks = subband.codeblocks;
  22133. const right = subband.type.charAt(0) === "H" ? 1 : 0;
  22134. const bottom = subband.type.charAt(1) === "H" ? levelWidth : 0;
  22135. for (let i = 0, ii = codeblocks.length; i < ii; ++i) {
  22136. const codeblock = codeblocks[i];
  22137. const blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  22138. const blockHeight = codeblock.tby1_ - codeblock.tby0_;
  22139. if (blockWidth === 0 || blockHeight === 0) {
  22140. continue;
  22141. }
  22142. if (codeblock.data === undefined) {
  22143. continue;
  22144. }
  22145. const bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  22146. let currentCodingpassType = 2;
  22147. const data = codeblock.data;
  22148. let totalLength = 0,
  22149. codingpasses = 0;
  22150. let j, jj, dataItem;
  22151. for (j = 0, jj = data.length; j < jj; j++) {
  22152. dataItem = data[j];
  22153. totalLength += dataItem.end - dataItem.start;
  22154. codingpasses += dataItem.codingpasses;
  22155. }
  22156. const encodedData = new Uint8Array(totalLength);
  22157. let position = 0;
  22158. for (j = 0, jj = data.length; j < jj; j++) {
  22159. dataItem = data[j];
  22160. const chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  22161. encodedData.set(chunk, position);
  22162. position += chunk.length;
  22163. }
  22164. const decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
  22165. bitModel.setDecoder(decoder);
  22166. for (j = 0; j < codingpasses; j++) {
  22167. switch (currentCodingpassType) {
  22168. case 0:
  22169. bitModel.runSignificancePropagationPass();
  22170. break;
  22171. case 1:
  22172. bitModel.runMagnitudeRefinementPass();
  22173. break;
  22174. case 2:
  22175. bitModel.runCleanupPass();
  22176. if (segmentationSymbolUsed) {
  22177. bitModel.checkSegmentationSymbol();
  22178. }
  22179. break;
  22180. }
  22181. if (resetContextProbabilities) {
  22182. bitModel.reset();
  22183. }
  22184. currentCodingpassType = (currentCodingpassType + 1) % 3;
  22185. }
  22186. let offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  22187. const sign = bitModel.coefficentsSign;
  22188. const magnitude = bitModel.coefficentsMagnitude;
  22189. const bitsDecoded = bitModel.bitsDecoded;
  22190. const magnitudeCorrection = reversible ? 0 : 0.5;
  22191. let k, n, nb;
  22192. position = 0;
  22193. const interleave = subband.type !== "LL";
  22194. for (j = 0; j < blockHeight; j++) {
  22195. const row = offset / width | 0;
  22196. const levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  22197. for (k = 0; k < blockWidth; k++) {
  22198. n = magnitude[position];
  22199. if (n !== 0) {
  22200. n = (n + magnitudeCorrection) * delta;
  22201. if (sign[position] !== 0) {
  22202. n = -n;
  22203. }
  22204. nb = bitsDecoded[position];
  22205. const pos = interleave ? levelOffset + (offset << 1) : offset;
  22206. if (reversible && nb >= mb) {
  22207. coefficients[pos] = n;
  22208. } else {
  22209. coefficients[pos] = n * (1 << mb - nb);
  22210. }
  22211. }
  22212. offset++;
  22213. position++;
  22214. }
  22215. offset += width - blockWidth;
  22216. }
  22217. }
  22218. }
  22219. function transformTile(context, tile, c) {
  22220. const component = tile.components[c];
  22221. const codingStyleParameters = component.codingStyleParameters;
  22222. const quantizationParameters = component.quantizationParameters;
  22223. const decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  22224. const spqcds = quantizationParameters.SPqcds;
  22225. const scalarExpounded = quantizationParameters.scalarExpounded;
  22226. const guardBits = quantizationParameters.guardBits;
  22227. const segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  22228. const resetContextProbabilities = codingStyleParameters.resetContextProbabilities;
  22229. const precision = context.components[c].precision;
  22230. const reversible = codingStyleParameters.reversibleTransformation;
  22231. const transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  22232. const subbandCoefficients = [];
  22233. let b = 0;
  22234. for (let i = 0; i <= decompositionLevelsCount; i++) {
  22235. const resolution = component.resolutions[i];
  22236. const width = resolution.trx1 - resolution.trx0;
  22237. const height = resolution.try1 - resolution.try0;
  22238. const coefficients = new Float32Array(width * height);
  22239. for (let j = 0, jj = resolution.subbands.length; j < jj; j++) {
  22240. let mu, epsilon;
  22241. if (!scalarExpounded) {
  22242. mu = spqcds[0].mu;
  22243. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  22244. } else {
  22245. mu = spqcds[b].mu;
  22246. epsilon = spqcds[b].epsilon;
  22247. b++;
  22248. }
  22249. const subband = resolution.subbands[j];
  22250. const gainLog2 = SubbandsGainLog2[subband.type];
  22251. const delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
  22252. const mb = guardBits + epsilon - 1;
  22253. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities);
  22254. }
  22255. subbandCoefficients.push({
  22256. width,
  22257. height,
  22258. items: coefficients
  22259. });
  22260. }
  22261. const result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  22262. return {
  22263. left: component.tcx0,
  22264. top: component.tcy0,
  22265. width: result.width,
  22266. height: result.height,
  22267. items: result.items
  22268. };
  22269. }
  22270. function transformComponents(context) {
  22271. const siz = context.SIZ;
  22272. const components = context.components;
  22273. const componentsCount = siz.Csiz;
  22274. const resultImages = [];
  22275. for (let i = 0, ii = context.tiles.length; i < ii; i++) {
  22276. const tile = context.tiles[i];
  22277. const transformedTiles = [];
  22278. for (let c = 0; c < componentsCount; c++) {
  22279. transformedTiles[c] = transformTile(context, tile, c);
  22280. }
  22281. const tile0 = transformedTiles[0];
  22282. const out = new Uint8ClampedArray(tile0.items.length * componentsCount);
  22283. const result = {
  22284. left: tile0.left,
  22285. top: tile0.top,
  22286. width: tile0.width,
  22287. height: tile0.height,
  22288. items: out
  22289. };
  22290. let shift, offset;
  22291. let pos = 0,
  22292. j,
  22293. jj,
  22294. y0,
  22295. y1,
  22296. y2;
  22297. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  22298. const fourComponents = componentsCount === 4;
  22299. const y0items = transformedTiles[0].items;
  22300. const y1items = transformedTiles[1].items;
  22301. const y2items = transformedTiles[2].items;
  22302. const y3items = fourComponents ? transformedTiles[3].items : null;
  22303. shift = components[0].precision - 8;
  22304. offset = (128 << shift) + 0.5;
  22305. const component0 = tile.components[0];
  22306. const alpha01 = componentsCount - 3;
  22307. jj = y0items.length;
  22308. if (!component0.codingStyleParameters.reversibleTransformation) {
  22309. for (j = 0; j < jj; j++, pos += alpha01) {
  22310. y0 = y0items[j] + offset;
  22311. y1 = y1items[j];
  22312. y2 = y2items[j];
  22313. out[pos++] = y0 + 1.402 * y2 >> shift;
  22314. out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
  22315. out[pos++] = y0 + 1.772 * y1 >> shift;
  22316. }
  22317. } else {
  22318. for (j = 0; j < jj; j++, pos += alpha01) {
  22319. y0 = y0items[j] + offset;
  22320. y1 = y1items[j];
  22321. y2 = y2items[j];
  22322. const g = y0 - (y2 + y1 >> 2);
  22323. out[pos++] = g + y2 >> shift;
  22324. out[pos++] = g >> shift;
  22325. out[pos++] = g + y1 >> shift;
  22326. }
  22327. }
  22328. if (fourComponents) {
  22329. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  22330. out[pos] = y3items[j] + offset >> shift;
  22331. }
  22332. }
  22333. } else {
  22334. for (let c = 0; c < componentsCount; c++) {
  22335. const items = transformedTiles[c].items;
  22336. shift = components[c].precision - 8;
  22337. offset = (128 << shift) + 0.5;
  22338. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  22339. out[pos] = items[j] + offset >> shift;
  22340. pos += componentsCount;
  22341. }
  22342. }
  22343. }
  22344. resultImages.push(result);
  22345. }
  22346. return resultImages;
  22347. }
  22348. function initializeTile(context, tileIndex) {
  22349. const siz = context.SIZ;
  22350. const componentsCount = siz.Csiz;
  22351. const tile = context.tiles[tileIndex];
  22352. for (let c = 0; c < componentsCount; c++) {
  22353. const component = tile.components[c];
  22354. const qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  22355. component.quantizationParameters = qcdOrQcc;
  22356. const codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  22357. component.codingStyleParameters = codOrCoc;
  22358. }
  22359. tile.codingStyleDefaultParameters = context.currentTile.COD;
  22360. }
  22361. class TagTree {
  22362. constructor(width, height) {
  22363. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  22364. this.levels = [];
  22365. for (let i = 0; i < levelsLength; i++) {
  22366. const level = {
  22367. width,
  22368. height,
  22369. items: []
  22370. };
  22371. this.levels.push(level);
  22372. width = Math.ceil(width / 2);
  22373. height = Math.ceil(height / 2);
  22374. }
  22375. }
  22376. reset(i, j) {
  22377. let currentLevel = 0,
  22378. value = 0,
  22379. level;
  22380. while (currentLevel < this.levels.length) {
  22381. level = this.levels[currentLevel];
  22382. const index = i + j * level.width;
  22383. if (level.items[index] !== undefined) {
  22384. value = level.items[index];
  22385. break;
  22386. }
  22387. level.index = index;
  22388. i >>= 1;
  22389. j >>= 1;
  22390. currentLevel++;
  22391. }
  22392. currentLevel--;
  22393. level = this.levels[currentLevel];
  22394. level.items[level.index] = value;
  22395. this.currentLevel = currentLevel;
  22396. delete this.value;
  22397. }
  22398. incrementValue() {
  22399. const level = this.levels[this.currentLevel];
  22400. level.items[level.index]++;
  22401. }
  22402. nextLevel() {
  22403. let currentLevel = this.currentLevel;
  22404. let level = this.levels[currentLevel];
  22405. const value = level.items[level.index];
  22406. currentLevel--;
  22407. if (currentLevel < 0) {
  22408. this.value = value;
  22409. return false;
  22410. }
  22411. this.currentLevel = currentLevel;
  22412. level = this.levels[currentLevel];
  22413. level.items[level.index] = value;
  22414. return true;
  22415. }
  22416. }
  22417. class InclusionTree {
  22418. constructor(width, height, defaultValue) {
  22419. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  22420. this.levels = [];
  22421. for (let i = 0; i < levelsLength; i++) {
  22422. const items = new Uint8Array(width * height);
  22423. for (let j = 0, jj = items.length; j < jj; j++) {
  22424. items[j] = defaultValue;
  22425. }
  22426. const level = {
  22427. width,
  22428. height,
  22429. items
  22430. };
  22431. this.levels.push(level);
  22432. width = Math.ceil(width / 2);
  22433. height = Math.ceil(height / 2);
  22434. }
  22435. }
  22436. reset(i, j, stopValue) {
  22437. let currentLevel = 0;
  22438. while (currentLevel < this.levels.length) {
  22439. const level = this.levels[currentLevel];
  22440. const index = i + j * level.width;
  22441. level.index = index;
  22442. const value = level.items[index];
  22443. if (value === 0xff) {
  22444. break;
  22445. }
  22446. if (value > stopValue) {
  22447. this.currentLevel = currentLevel;
  22448. this.propagateValues();
  22449. return false;
  22450. }
  22451. i >>= 1;
  22452. j >>= 1;
  22453. currentLevel++;
  22454. }
  22455. this.currentLevel = currentLevel - 1;
  22456. return true;
  22457. }
  22458. incrementValue(stopValue) {
  22459. const level = this.levels[this.currentLevel];
  22460. level.items[level.index] = stopValue + 1;
  22461. this.propagateValues();
  22462. }
  22463. propagateValues() {
  22464. let levelIndex = this.currentLevel;
  22465. let level = this.levels[levelIndex];
  22466. const currentValue = level.items[level.index];
  22467. while (--levelIndex >= 0) {
  22468. level = this.levels[levelIndex];
  22469. level.items[level.index] = currentValue;
  22470. }
  22471. }
  22472. nextLevel() {
  22473. let currentLevel = this.currentLevel;
  22474. let level = this.levels[currentLevel];
  22475. const value = level.items[level.index];
  22476. level.items[level.index] = 0xff;
  22477. currentLevel--;
  22478. if (currentLevel < 0) {
  22479. return false;
  22480. }
  22481. this.currentLevel = currentLevel;
  22482. level = this.levels[currentLevel];
  22483. level.items[level.index] = value;
  22484. return true;
  22485. }
  22486. }
  22487. const BitModel = function BitModelClosure() {
  22488. const UNIFORM_CONTEXT = 17;
  22489. const RUNLENGTH_CONTEXT = 18;
  22490. 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]);
  22491. 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]);
  22492. 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]);
  22493. class BitModel {
  22494. constructor(width, height, subband, zeroBitPlanes, mb) {
  22495. this.width = width;
  22496. this.height = height;
  22497. let contextLabelTable;
  22498. if (subband === "HH") {
  22499. contextLabelTable = HHContextLabel;
  22500. } else if (subband === "HL") {
  22501. contextLabelTable = HLContextLabel;
  22502. } else {
  22503. contextLabelTable = LLAndLHContextsLabel;
  22504. }
  22505. this.contextLabelTable = contextLabelTable;
  22506. const coefficientCount = width * height;
  22507. this.neighborsSignificance = new Uint8Array(coefficientCount);
  22508. this.coefficentsSign = new Uint8Array(coefficientCount);
  22509. let coefficentsMagnitude;
  22510. if (mb > 14) {
  22511. coefficentsMagnitude = new Uint32Array(coefficientCount);
  22512. } else if (mb > 6) {
  22513. coefficentsMagnitude = new Uint16Array(coefficientCount);
  22514. } else {
  22515. coefficentsMagnitude = new Uint8Array(coefficientCount);
  22516. }
  22517. this.coefficentsMagnitude = coefficentsMagnitude;
  22518. this.processingFlags = new Uint8Array(coefficientCount);
  22519. const bitsDecoded = new Uint8Array(coefficientCount);
  22520. if (zeroBitPlanes !== 0) {
  22521. for (let i = 0; i < coefficientCount; i++) {
  22522. bitsDecoded[i] = zeroBitPlanes;
  22523. }
  22524. }
  22525. this.bitsDecoded = bitsDecoded;
  22526. this.reset();
  22527. }
  22528. setDecoder(decoder) {
  22529. this.decoder = decoder;
  22530. }
  22531. reset() {
  22532. this.contexts = new Int8Array(19);
  22533. this.contexts[0] = 4 << 1 | 0;
  22534. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  22535. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  22536. }
  22537. setNeighborsSignificance(row, column, index) {
  22538. const neighborsSignificance = this.neighborsSignificance;
  22539. const width = this.width,
  22540. height = this.height;
  22541. const left = column > 0;
  22542. const right = column + 1 < width;
  22543. let i;
  22544. if (row > 0) {
  22545. i = index - width;
  22546. if (left) {
  22547. neighborsSignificance[i - 1] += 0x10;
  22548. }
  22549. if (right) {
  22550. neighborsSignificance[i + 1] += 0x10;
  22551. }
  22552. neighborsSignificance[i] += 0x04;
  22553. }
  22554. if (row + 1 < height) {
  22555. i = index + width;
  22556. if (left) {
  22557. neighborsSignificance[i - 1] += 0x10;
  22558. }
  22559. if (right) {
  22560. neighborsSignificance[i + 1] += 0x10;
  22561. }
  22562. neighborsSignificance[i] += 0x04;
  22563. }
  22564. if (left) {
  22565. neighborsSignificance[index - 1] += 0x01;
  22566. }
  22567. if (right) {
  22568. neighborsSignificance[index + 1] += 0x01;
  22569. }
  22570. neighborsSignificance[index] |= 0x80;
  22571. }
  22572. runSignificancePropagationPass() {
  22573. const decoder = this.decoder;
  22574. const width = this.width,
  22575. height = this.height;
  22576. const coefficentsMagnitude = this.coefficentsMagnitude;
  22577. const coefficentsSign = this.coefficentsSign;
  22578. const neighborsSignificance = this.neighborsSignificance;
  22579. const processingFlags = this.processingFlags;
  22580. const contexts = this.contexts;
  22581. const labels = this.contextLabelTable;
  22582. const bitsDecoded = this.bitsDecoded;
  22583. const processedInverseMask = ~1;
  22584. const processedMask = 1;
  22585. const firstMagnitudeBitMask = 2;
  22586. for (let i0 = 0; i0 < height; i0 += 4) {
  22587. for (let j = 0; j < width; j++) {
  22588. let index = i0 * width + j;
  22589. for (let i1 = 0; i1 < 4; i1++, index += width) {
  22590. const i = i0 + i1;
  22591. if (i >= height) {
  22592. break;
  22593. }
  22594. processingFlags[index] &= processedInverseMask;
  22595. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  22596. continue;
  22597. }
  22598. const contextLabel = labels[neighborsSignificance[index]];
  22599. const decision = decoder.readBit(contexts, contextLabel);
  22600. if (decision) {
  22601. const sign = this.decodeSignBit(i, j, index);
  22602. coefficentsSign[index] = sign;
  22603. coefficentsMagnitude[index] = 1;
  22604. this.setNeighborsSignificance(i, j, index);
  22605. processingFlags[index] |= firstMagnitudeBitMask;
  22606. }
  22607. bitsDecoded[index]++;
  22608. processingFlags[index] |= processedMask;
  22609. }
  22610. }
  22611. }
  22612. }
  22613. decodeSignBit(row, column, index) {
  22614. const width = this.width,
  22615. height = this.height;
  22616. const coefficentsMagnitude = this.coefficentsMagnitude;
  22617. const coefficentsSign = this.coefficentsSign;
  22618. let contribution, sign0, sign1, significance1;
  22619. let contextLabel, decoded;
  22620. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  22621. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  22622. sign1 = coefficentsSign[index + 1];
  22623. if (significance1) {
  22624. sign0 = coefficentsSign[index - 1];
  22625. contribution = 1 - sign1 - sign0;
  22626. } else {
  22627. contribution = 1 - sign1 - sign1;
  22628. }
  22629. } else if (significance1) {
  22630. sign0 = coefficentsSign[index - 1];
  22631. contribution = 1 - sign0 - sign0;
  22632. } else {
  22633. contribution = 0;
  22634. }
  22635. const horizontalContribution = 3 * contribution;
  22636. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  22637. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  22638. sign1 = coefficentsSign[index + width];
  22639. if (significance1) {
  22640. sign0 = coefficentsSign[index - width];
  22641. contribution = 1 - sign1 - sign0 + horizontalContribution;
  22642. } else {
  22643. contribution = 1 - sign1 - sign1 + horizontalContribution;
  22644. }
  22645. } else if (significance1) {
  22646. sign0 = coefficentsSign[index - width];
  22647. contribution = 1 - sign0 - sign0 + horizontalContribution;
  22648. } else {
  22649. contribution = horizontalContribution;
  22650. }
  22651. if (contribution >= 0) {
  22652. contextLabel = 9 + contribution;
  22653. decoded = this.decoder.readBit(this.contexts, contextLabel);
  22654. } else {
  22655. contextLabel = 9 - contribution;
  22656. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  22657. }
  22658. return decoded;
  22659. }
  22660. runMagnitudeRefinementPass() {
  22661. const decoder = this.decoder;
  22662. const width = this.width,
  22663. height = this.height;
  22664. const coefficentsMagnitude = this.coefficentsMagnitude;
  22665. const neighborsSignificance = this.neighborsSignificance;
  22666. const contexts = this.contexts;
  22667. const bitsDecoded = this.bitsDecoded;
  22668. const processingFlags = this.processingFlags;
  22669. const processedMask = 1;
  22670. const firstMagnitudeBitMask = 2;
  22671. const length = width * height;
  22672. const width4 = width * 4;
  22673. for (let index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  22674. indexNext = Math.min(length, index0 + width4);
  22675. for (let j = 0; j < width; j++) {
  22676. for (let index = index0 + j; index < indexNext; index += width) {
  22677. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  22678. continue;
  22679. }
  22680. let contextLabel = 16;
  22681. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  22682. processingFlags[index] ^= firstMagnitudeBitMask;
  22683. const significance = neighborsSignificance[index] & 127;
  22684. contextLabel = significance === 0 ? 15 : 14;
  22685. }
  22686. const bit = decoder.readBit(contexts, contextLabel);
  22687. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  22688. bitsDecoded[index]++;
  22689. processingFlags[index] |= processedMask;
  22690. }
  22691. }
  22692. }
  22693. }
  22694. runCleanupPass() {
  22695. const decoder = this.decoder;
  22696. const width = this.width,
  22697. height = this.height;
  22698. const neighborsSignificance = this.neighborsSignificance;
  22699. const coefficentsMagnitude = this.coefficentsMagnitude;
  22700. const coefficentsSign = this.coefficentsSign;
  22701. const contexts = this.contexts;
  22702. const labels = this.contextLabelTable;
  22703. const bitsDecoded = this.bitsDecoded;
  22704. const processingFlags = this.processingFlags;
  22705. const processedMask = 1;
  22706. const firstMagnitudeBitMask = 2;
  22707. const oneRowDown = width;
  22708. const twoRowsDown = width * 2;
  22709. const threeRowsDown = width * 3;
  22710. let iNext;
  22711. for (let i0 = 0; i0 < height; i0 = iNext) {
  22712. iNext = Math.min(i0 + 4, height);
  22713. const indexBase = i0 * width;
  22714. const checkAllEmpty = i0 + 3 < height;
  22715. for (let j = 0; j < width; j++) {
  22716. const index0 = indexBase + j;
  22717. 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;
  22718. let i1 = 0,
  22719. index = index0;
  22720. let i = i0,
  22721. sign;
  22722. if (allEmpty) {
  22723. const hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  22724. if (!hasSignificantCoefficent) {
  22725. bitsDecoded[index0]++;
  22726. bitsDecoded[index0 + oneRowDown]++;
  22727. bitsDecoded[index0 + twoRowsDown]++;
  22728. bitsDecoded[index0 + threeRowsDown]++;
  22729. continue;
  22730. }
  22731. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  22732. if (i1 !== 0) {
  22733. i = i0 + i1;
  22734. index += i1 * width;
  22735. }
  22736. sign = this.decodeSignBit(i, j, index);
  22737. coefficentsSign[index] = sign;
  22738. coefficentsMagnitude[index] = 1;
  22739. this.setNeighborsSignificance(i, j, index);
  22740. processingFlags[index] |= firstMagnitudeBitMask;
  22741. index = index0;
  22742. for (let i2 = i0; i2 <= i; i2++, index += width) {
  22743. bitsDecoded[index]++;
  22744. }
  22745. i1++;
  22746. }
  22747. for (i = i0 + i1; i < iNext; i++, index += width) {
  22748. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  22749. continue;
  22750. }
  22751. const contextLabel = labels[neighborsSignificance[index]];
  22752. const decision = decoder.readBit(contexts, contextLabel);
  22753. if (decision === 1) {
  22754. sign = this.decodeSignBit(i, j, index);
  22755. coefficentsSign[index] = sign;
  22756. coefficentsMagnitude[index] = 1;
  22757. this.setNeighborsSignificance(i, j, index);
  22758. processingFlags[index] |= firstMagnitudeBitMask;
  22759. }
  22760. bitsDecoded[index]++;
  22761. }
  22762. }
  22763. }
  22764. }
  22765. checkSegmentationSymbol() {
  22766. const decoder = this.decoder;
  22767. const contexts = this.contexts;
  22768. 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);
  22769. if (symbol !== 0xa) {
  22770. throw new JpxError("Invalid segmentation symbol");
  22771. }
  22772. }
  22773. }
  22774. return BitModel;
  22775. }();
  22776. class Transform {
  22777. constructor() {
  22778. if (this.constructor === Transform) {
  22779. (0, _util.unreachable)("Cannot initialize Transform.");
  22780. }
  22781. }
  22782. calculate(subbands, u0, v0) {
  22783. let ll = subbands[0];
  22784. for (let i = 1, ii = subbands.length; i < ii; i++) {
  22785. ll = this.iterate(ll, subbands[i], u0, v0);
  22786. }
  22787. return ll;
  22788. }
  22789. extend(buffer, offset, size) {
  22790. let i1 = offset - 1,
  22791. j1 = offset + 1;
  22792. let i2 = offset + size - 2,
  22793. j2 = offset + size;
  22794. buffer[i1--] = buffer[j1++];
  22795. buffer[j2++] = buffer[i2--];
  22796. buffer[i1--] = buffer[j1++];
  22797. buffer[j2++] = buffer[i2--];
  22798. buffer[i1--] = buffer[j1++];
  22799. buffer[j2++] = buffer[i2--];
  22800. buffer[i1] = buffer[j1];
  22801. buffer[j2] = buffer[i2];
  22802. }
  22803. filter(x, offset, length) {
  22804. (0, _util.unreachable)("Abstract method `filter` called");
  22805. }
  22806. iterate(ll, hl_lh_hh, u0, v0) {
  22807. const llWidth = ll.width,
  22808. llHeight = ll.height;
  22809. let llItems = ll.items;
  22810. const width = hl_lh_hh.width;
  22811. const height = hl_lh_hh.height;
  22812. const items = hl_lh_hh.items;
  22813. let i, j, k, l, u, v;
  22814. for (k = 0, i = 0; i < llHeight; i++) {
  22815. l = i * 2 * width;
  22816. for (j = 0; j < llWidth; j++, k++, l += 2) {
  22817. items[l] = llItems[k];
  22818. }
  22819. }
  22820. llItems = ll.items = null;
  22821. const bufferPadding = 4;
  22822. const rowBuffer = new Float32Array(width + 2 * bufferPadding);
  22823. if (width === 1) {
  22824. if ((u0 & 1) !== 0) {
  22825. for (v = 0, k = 0; v < height; v++, k += width) {
  22826. items[k] *= 0.5;
  22827. }
  22828. }
  22829. } else {
  22830. for (v = 0, k = 0; v < height; v++, k += width) {
  22831. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  22832. this.extend(rowBuffer, bufferPadding, width);
  22833. this.filter(rowBuffer, bufferPadding, width);
  22834. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  22835. }
  22836. }
  22837. let numBuffers = 16;
  22838. const colBuffers = [];
  22839. for (i = 0; i < numBuffers; i++) {
  22840. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  22841. }
  22842. let b,
  22843. currentBuffer = 0;
  22844. ll = bufferPadding + height;
  22845. if (height === 1) {
  22846. if ((v0 & 1) !== 0) {
  22847. for (u = 0; u < width; u++) {
  22848. items[u] *= 0.5;
  22849. }
  22850. }
  22851. } else {
  22852. for (u = 0; u < width; u++) {
  22853. if (currentBuffer === 0) {
  22854. numBuffers = Math.min(width - u, numBuffers);
  22855. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  22856. for (b = 0; b < numBuffers; b++) {
  22857. colBuffers[b][l] = items[k + b];
  22858. }
  22859. }
  22860. currentBuffer = numBuffers;
  22861. }
  22862. currentBuffer--;
  22863. const buffer = colBuffers[currentBuffer];
  22864. this.extend(buffer, bufferPadding, height);
  22865. this.filter(buffer, bufferPadding, height);
  22866. if (currentBuffer === 0) {
  22867. k = u - numBuffers + 1;
  22868. for (l = bufferPadding; l < ll; k += width, l++) {
  22869. for (b = 0; b < numBuffers; b++) {
  22870. items[k + b] = colBuffers[b][l];
  22871. }
  22872. }
  22873. }
  22874. }
  22875. }
  22876. return {
  22877. width,
  22878. height,
  22879. items
  22880. };
  22881. }
  22882. }
  22883. class IrreversibleTransform extends Transform {
  22884. filter(x, offset, length) {
  22885. const len = length >> 1;
  22886. offset |= 0;
  22887. let j, n, current, next;
  22888. const alpha = -1.586134342059924;
  22889. const beta = -0.052980118572961;
  22890. const gamma = 0.882911075530934;
  22891. const delta = 0.443506852043971;
  22892. const K = 1.230174104914001;
  22893. const K_ = 1 / K;
  22894. j = offset - 3;
  22895. for (n = len + 4; n--; j += 2) {
  22896. x[j] *= K_;
  22897. }
  22898. j = offset - 2;
  22899. current = delta * x[j - 1];
  22900. for (n = len + 3; n--; j += 2) {
  22901. next = delta * x[j + 1];
  22902. x[j] = K * x[j] - current - next;
  22903. if (n--) {
  22904. j += 2;
  22905. current = delta * x[j + 1];
  22906. x[j] = K * x[j] - current - next;
  22907. } else {
  22908. break;
  22909. }
  22910. }
  22911. j = offset - 1;
  22912. current = gamma * x[j - 1];
  22913. for (n = len + 2; n--; j += 2) {
  22914. next = gamma * x[j + 1];
  22915. x[j] -= current + next;
  22916. if (n--) {
  22917. j += 2;
  22918. current = gamma * x[j + 1];
  22919. x[j] -= current + next;
  22920. } else {
  22921. break;
  22922. }
  22923. }
  22924. j = offset;
  22925. current = beta * x[j - 1];
  22926. for (n = len + 1; n--; j += 2) {
  22927. next = beta * x[j + 1];
  22928. x[j] -= current + next;
  22929. if (n--) {
  22930. j += 2;
  22931. current = beta * x[j + 1];
  22932. x[j] -= current + next;
  22933. } else {
  22934. break;
  22935. }
  22936. }
  22937. if (len !== 0) {
  22938. j = offset + 1;
  22939. current = alpha * x[j - 1];
  22940. for (n = len; n--; j += 2) {
  22941. next = alpha * x[j + 1];
  22942. x[j] -= current + next;
  22943. if (n--) {
  22944. j += 2;
  22945. current = alpha * x[j + 1];
  22946. x[j] -= current + next;
  22947. } else {
  22948. break;
  22949. }
  22950. }
  22951. }
  22952. }
  22953. }
  22954. class ReversibleTransform extends Transform {
  22955. filter(x, offset, length) {
  22956. const len = length >> 1;
  22957. offset |= 0;
  22958. let j, n;
  22959. for (j = offset, n = len + 1; n--; j += 2) {
  22960. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  22961. }
  22962. for (j = offset + 1, n = len; n--; j += 2) {
  22963. x[j] += x[j - 1] + x[j + 1] >> 1;
  22964. }
  22965. }
  22966. }
  22967. /***/ }),
  22968. /* 156 */
  22969. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  22970. "use strict";
  22971. Object.defineProperty(exports, "__esModule", ({
  22972. value: true
  22973. }));
  22974. exports.LZWStream = void 0;
  22975. var _decode_stream = __w_pdfjs_require__(144);
  22976. class LZWStream extends _decode_stream.DecodeStream {
  22977. constructor(str, maybeLength, earlyChange) {
  22978. super(maybeLength);
  22979. this.str = str;
  22980. this.dict = str.dict;
  22981. this.cachedData = 0;
  22982. this.bitsCached = 0;
  22983. const maxLzwDictionarySize = 4096;
  22984. const lzwState = {
  22985. earlyChange,
  22986. codeLength: 9,
  22987. nextCode: 258,
  22988. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  22989. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  22990. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  22991. currentSequence: new Uint8Array(maxLzwDictionarySize),
  22992. currentSequenceLength: 0
  22993. };
  22994. for (let i = 0; i < 256; ++i) {
  22995. lzwState.dictionaryValues[i] = i;
  22996. lzwState.dictionaryLengths[i] = 1;
  22997. }
  22998. this.lzwState = lzwState;
  22999. }
  23000. readBits(n) {
  23001. let bitsCached = this.bitsCached;
  23002. let cachedData = this.cachedData;
  23003. while (bitsCached < n) {
  23004. const c = this.str.getByte();
  23005. if (c === -1) {
  23006. this.eof = true;
  23007. return null;
  23008. }
  23009. cachedData = cachedData << 8 | c;
  23010. bitsCached += 8;
  23011. }
  23012. this.bitsCached = bitsCached -= n;
  23013. this.cachedData = cachedData;
  23014. this.lastCode = null;
  23015. return cachedData >>> bitsCached & (1 << n) - 1;
  23016. }
  23017. readBlock() {
  23018. const blockSize = 512,
  23019. decodedSizeDelta = blockSize;
  23020. let estimatedDecodedSize = blockSize * 2;
  23021. let i, j, q;
  23022. const lzwState = this.lzwState;
  23023. if (!lzwState) {
  23024. return;
  23025. }
  23026. const earlyChange = lzwState.earlyChange;
  23027. let nextCode = lzwState.nextCode;
  23028. const dictionaryValues = lzwState.dictionaryValues;
  23029. const dictionaryLengths = lzwState.dictionaryLengths;
  23030. const dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  23031. let codeLength = lzwState.codeLength;
  23032. let prevCode = lzwState.prevCode;
  23033. const currentSequence = lzwState.currentSequence;
  23034. let currentSequenceLength = lzwState.currentSequenceLength;
  23035. let decodedLength = 0;
  23036. let currentBufferLength = this.bufferLength;
  23037. let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  23038. for (i = 0; i < blockSize; i++) {
  23039. const code = this.readBits(codeLength);
  23040. const hasPrev = currentSequenceLength > 0;
  23041. if (code < 256) {
  23042. currentSequence[0] = code;
  23043. currentSequenceLength = 1;
  23044. } else if (code >= 258) {
  23045. if (code < nextCode) {
  23046. currentSequenceLength = dictionaryLengths[code];
  23047. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  23048. currentSequence[j] = dictionaryValues[q];
  23049. q = dictionaryPrevCodes[q];
  23050. }
  23051. } else {
  23052. currentSequence[currentSequenceLength++] = currentSequence[0];
  23053. }
  23054. } else if (code === 256) {
  23055. codeLength = 9;
  23056. nextCode = 258;
  23057. currentSequenceLength = 0;
  23058. continue;
  23059. } else {
  23060. this.eof = true;
  23061. delete this.lzwState;
  23062. break;
  23063. }
  23064. if (hasPrev) {
  23065. dictionaryPrevCodes[nextCode] = prevCode;
  23066. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  23067. dictionaryValues[nextCode] = currentSequence[0];
  23068. nextCode++;
  23069. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  23070. }
  23071. prevCode = code;
  23072. decodedLength += currentSequenceLength;
  23073. if (estimatedDecodedSize < decodedLength) {
  23074. do {
  23075. estimatedDecodedSize += decodedSizeDelta;
  23076. } while (estimatedDecodedSize < decodedLength);
  23077. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  23078. }
  23079. for (j = 0; j < currentSequenceLength; j++) {
  23080. buffer[currentBufferLength++] = currentSequence[j];
  23081. }
  23082. }
  23083. lzwState.nextCode = nextCode;
  23084. lzwState.codeLength = codeLength;
  23085. lzwState.prevCode = prevCode;
  23086. lzwState.currentSequenceLength = currentSequenceLength;
  23087. this.bufferLength = currentBufferLength;
  23088. }
  23089. }
  23090. exports.LZWStream = LZWStream;
  23091. /***/ }),
  23092. /* 157 */
  23093. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23094. "use strict";
  23095. Object.defineProperty(exports, "__esModule", ({
  23096. value: true
  23097. }));
  23098. exports.PredictorStream = void 0;
  23099. var _decode_stream = __w_pdfjs_require__(144);
  23100. var _primitives = __w_pdfjs_require__(130);
  23101. var _util = __w_pdfjs_require__(2);
  23102. class PredictorStream extends _decode_stream.DecodeStream {
  23103. constructor(str, maybeLength, params) {
  23104. super(maybeLength);
  23105. if (!(params instanceof _primitives.Dict)) {
  23106. return str;
  23107. }
  23108. const predictor = this.predictor = params.get("Predictor") || 1;
  23109. if (predictor <= 1) {
  23110. return str;
  23111. }
  23112. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  23113. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  23114. }
  23115. if (predictor === 2) {
  23116. this.readBlock = this.readBlockTiff;
  23117. } else {
  23118. this.readBlock = this.readBlockPng;
  23119. }
  23120. this.str = str;
  23121. this.dict = str.dict;
  23122. const colors = this.colors = params.get("Colors") || 1;
  23123. const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8;
  23124. const columns = this.columns = params.get("Columns") || 1;
  23125. this.pixBytes = colors * bits + 7 >> 3;
  23126. this.rowBytes = columns * colors * bits + 7 >> 3;
  23127. return this;
  23128. }
  23129. readBlockTiff() {
  23130. const rowBytes = this.rowBytes;
  23131. const bufferLength = this.bufferLength;
  23132. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  23133. const bits = this.bits;
  23134. const colors = this.colors;
  23135. const rawBytes = this.str.getBytes(rowBytes);
  23136. this.eof = !rawBytes.length;
  23137. if (this.eof) {
  23138. return;
  23139. }
  23140. let inbuf = 0,
  23141. outbuf = 0;
  23142. let inbits = 0,
  23143. outbits = 0;
  23144. let pos = bufferLength;
  23145. let i;
  23146. if (bits === 1 && colors === 1) {
  23147. for (i = 0; i < rowBytes; ++i) {
  23148. let c = rawBytes[i] ^ inbuf;
  23149. c ^= c >> 1;
  23150. c ^= c >> 2;
  23151. c ^= c >> 4;
  23152. inbuf = (c & 1) << 7;
  23153. buffer[pos++] = c;
  23154. }
  23155. } else if (bits === 8) {
  23156. for (i = 0; i < colors; ++i) {
  23157. buffer[pos++] = rawBytes[i];
  23158. }
  23159. for (; i < rowBytes; ++i) {
  23160. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  23161. pos++;
  23162. }
  23163. } else if (bits === 16) {
  23164. const bytesPerPixel = colors * 2;
  23165. for (i = 0; i < bytesPerPixel; ++i) {
  23166. buffer[pos++] = rawBytes[i];
  23167. }
  23168. for (; i < rowBytes; i += 2) {
  23169. const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
  23170. buffer[pos++] = sum >> 8 & 0xff;
  23171. buffer[pos++] = sum & 0xff;
  23172. }
  23173. } else {
  23174. const compArray = new Uint8Array(colors + 1);
  23175. const bitMask = (1 << bits) - 1;
  23176. let j = 0,
  23177. k = bufferLength;
  23178. const columns = this.columns;
  23179. for (i = 0; i < columns; ++i) {
  23180. for (let kk = 0; kk < colors; ++kk) {
  23181. if (inbits < bits) {
  23182. inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
  23183. inbits += 8;
  23184. }
  23185. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  23186. inbits -= bits;
  23187. outbuf = outbuf << bits | compArray[kk];
  23188. outbits += bits;
  23189. if (outbits >= 8) {
  23190. buffer[k++] = outbuf >> outbits - 8 & 0xff;
  23191. outbits -= 8;
  23192. }
  23193. }
  23194. }
  23195. if (outbits > 0) {
  23196. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  23197. }
  23198. }
  23199. this.bufferLength += rowBytes;
  23200. }
  23201. readBlockPng() {
  23202. const rowBytes = this.rowBytes;
  23203. const pixBytes = this.pixBytes;
  23204. const predictor = this.str.getByte();
  23205. const rawBytes = this.str.getBytes(rowBytes);
  23206. this.eof = !rawBytes.length;
  23207. if (this.eof) {
  23208. return;
  23209. }
  23210. const bufferLength = this.bufferLength;
  23211. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  23212. let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  23213. if (prevRow.length === 0) {
  23214. prevRow = new Uint8Array(rowBytes);
  23215. }
  23216. let i,
  23217. j = bufferLength,
  23218. up,
  23219. c;
  23220. switch (predictor) {
  23221. case 0:
  23222. for (i = 0; i < rowBytes; ++i) {
  23223. buffer[j++] = rawBytes[i];
  23224. }
  23225. break;
  23226. case 1:
  23227. for (i = 0; i < pixBytes; ++i) {
  23228. buffer[j++] = rawBytes[i];
  23229. }
  23230. for (; i < rowBytes; ++i) {
  23231. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
  23232. j++;
  23233. }
  23234. break;
  23235. case 2:
  23236. for (i = 0; i < rowBytes; ++i) {
  23237. buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
  23238. }
  23239. break;
  23240. case 3:
  23241. for (i = 0; i < pixBytes; ++i) {
  23242. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  23243. }
  23244. for (; i < rowBytes; ++i) {
  23245. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
  23246. j++;
  23247. }
  23248. break;
  23249. case 4:
  23250. for (i = 0; i < pixBytes; ++i) {
  23251. up = prevRow[i];
  23252. c = rawBytes[i];
  23253. buffer[j++] = up + c;
  23254. }
  23255. for (; i < rowBytes; ++i) {
  23256. up = prevRow[i];
  23257. const upLeft = prevRow[i - pixBytes];
  23258. const left = buffer[j - pixBytes];
  23259. const p = left + up - upLeft;
  23260. let pa = p - left;
  23261. if (pa < 0) {
  23262. pa = -pa;
  23263. }
  23264. let pb = p - up;
  23265. if (pb < 0) {
  23266. pb = -pb;
  23267. }
  23268. let pc = p - upLeft;
  23269. if (pc < 0) {
  23270. pc = -pc;
  23271. }
  23272. c = rawBytes[i];
  23273. if (pa <= pb && pa <= pc) {
  23274. buffer[j++] = left + c;
  23275. } else if (pb <= pc) {
  23276. buffer[j++] = up + c;
  23277. } else {
  23278. buffer[j++] = upLeft + c;
  23279. }
  23280. }
  23281. break;
  23282. default:
  23283. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  23284. }
  23285. this.bufferLength += rowBytes;
  23286. }
  23287. }
  23288. exports.PredictorStream = PredictorStream;
  23289. /***/ }),
  23290. /* 158 */
  23291. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23292. "use strict";
  23293. Object.defineProperty(exports, "__esModule", ({
  23294. value: true
  23295. }));
  23296. exports.RunLengthStream = void 0;
  23297. var _decode_stream = __w_pdfjs_require__(144);
  23298. class RunLengthStream extends _decode_stream.DecodeStream {
  23299. constructor(str, maybeLength) {
  23300. super(maybeLength);
  23301. this.str = str;
  23302. this.dict = str.dict;
  23303. }
  23304. readBlock() {
  23305. const repeatHeader = this.str.getBytes(2);
  23306. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  23307. this.eof = true;
  23308. return;
  23309. }
  23310. let buffer;
  23311. let bufferLength = this.bufferLength;
  23312. let n = repeatHeader[0];
  23313. if (n < 128) {
  23314. buffer = this.ensureBuffer(bufferLength + n + 1);
  23315. buffer[bufferLength++] = repeatHeader[1];
  23316. if (n > 0) {
  23317. const source = this.str.getBytes(n);
  23318. buffer.set(source, bufferLength);
  23319. bufferLength += n;
  23320. }
  23321. } else {
  23322. n = 257 - n;
  23323. const b = repeatHeader[1];
  23324. buffer = this.ensureBuffer(bufferLength + n + 1);
  23325. for (let i = 0; i < n; i++) {
  23326. buffer[bufferLength++] = b;
  23327. }
  23328. }
  23329. this.bufferLength = bufferLength;
  23330. }
  23331. }
  23332. exports.RunLengthStream = RunLengthStream;
  23333. /***/ }),
  23334. /* 159 */
  23335. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23336. "use strict";
  23337. Object.defineProperty(exports, "__esModule", ({
  23338. value: true
  23339. }));
  23340. exports.Font = exports.ErrorFont = void 0;
  23341. var _util = __w_pdfjs_require__(2);
  23342. var _cff_parser = __w_pdfjs_require__(160);
  23343. var _fonts_utils = __w_pdfjs_require__(163);
  23344. var _unicode = __w_pdfjs_require__(165);
  23345. var _glyphlist = __w_pdfjs_require__(164);
  23346. var _encodings = __w_pdfjs_require__(162);
  23347. var _standard_fonts = __w_pdfjs_require__(166);
  23348. var _to_unicode_map = __w_pdfjs_require__(167);
  23349. var _cff_font = __w_pdfjs_require__(168);
  23350. var _font_renderer = __w_pdfjs_require__(169);
  23351. var _metrics = __w_pdfjs_require__(170);
  23352. var _glyf = __w_pdfjs_require__(171);
  23353. var _cmap = __w_pdfjs_require__(141);
  23354. var _opentype_file_builder = __w_pdfjs_require__(172);
  23355. var _core_utils = __w_pdfjs_require__(131);
  23356. var _stream = __w_pdfjs_require__(135);
  23357. var _type1_font = __w_pdfjs_require__(173);
  23358. const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
  23359. const PDF_GLYPH_SPACE_UNITS = 1000;
  23360. const EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "charProcOperatorList", "composite", "cssFontInfo", "data", "defaultVMetrics", "defaultWidth", "descent", "fallbackName", "fontMatrix", "fontType", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "subtype", "type", "vertical"];
  23361. const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
  23362. function adjustWidths(properties) {
  23363. if (!properties.fontMatrix) {
  23364. return;
  23365. }
  23366. if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
  23367. return;
  23368. }
  23369. const scale = 0.001 / properties.fontMatrix[0];
  23370. const glyphsWidths = properties.widths;
  23371. for (const glyph in glyphsWidths) {
  23372. glyphsWidths[glyph] *= scale;
  23373. }
  23374. properties.defaultWidth *= scale;
  23375. }
  23376. function adjustToUnicode(properties, builtInEncoding) {
  23377. if (properties.isInternalFont) {
  23378. return;
  23379. }
  23380. if (builtInEncoding === properties.defaultEncoding) {
  23381. return;
  23382. }
  23383. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  23384. return;
  23385. }
  23386. const toUnicode = [],
  23387. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  23388. for (const charCode in builtInEncoding) {
  23389. if (properties.hasIncludedToUnicodeMap) {
  23390. if (properties.toUnicode.has(charCode)) {
  23391. continue;
  23392. }
  23393. } else if (properties.hasEncoding) {
  23394. if (properties.differences.length === 0 || properties.differences[charCode] !== undefined) {
  23395. continue;
  23396. }
  23397. }
  23398. const glyphName = builtInEncoding[charCode];
  23399. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  23400. if (unicode !== -1) {
  23401. toUnicode[charCode] = String.fromCharCode(unicode);
  23402. }
  23403. }
  23404. if (toUnicode.length > 0) {
  23405. properties.toUnicode.amend(toUnicode);
  23406. }
  23407. }
  23408. function amendFallbackToUnicode(properties) {
  23409. if (!properties.fallbackToUnicode) {
  23410. return;
  23411. }
  23412. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  23413. return;
  23414. }
  23415. const toUnicode = [];
  23416. for (const charCode in properties.fallbackToUnicode) {
  23417. if (properties.toUnicode.has(charCode)) {
  23418. continue;
  23419. }
  23420. toUnicode[charCode] = properties.fallbackToUnicode[charCode];
  23421. }
  23422. if (toUnicode.length > 0) {
  23423. properties.toUnicode.amend(toUnicode);
  23424. }
  23425. }
  23426. class Glyph {
  23427. constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  23428. this.originalCharCode = originalCharCode;
  23429. this.fontChar = fontChar;
  23430. this.unicode = unicode;
  23431. this.accent = accent;
  23432. this.width = width;
  23433. this.vmetric = vmetric;
  23434. this.operatorListId = operatorListId;
  23435. this.isSpace = isSpace;
  23436. this.isInFont = isInFont;
  23437. const category = (0, _unicode.getCharUnicodeCategory)(unicode);
  23438. this.isWhitespace = category.isWhitespace;
  23439. this.isZeroWidthDiacritic = category.isZeroWidthDiacritic;
  23440. this.isInvisibleFormatMark = category.isInvisibleFormatMark;
  23441. }
  23442. matchesForCache(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  23443. return this.originalCharCode === originalCharCode && this.fontChar === fontChar && this.unicode === unicode && this.accent === accent && this.width === width && this.vmetric === vmetric && this.operatorListId === operatorListId && this.isSpace === isSpace && this.isInFont === isInFont;
  23444. }
  23445. }
  23446. function int16(b0, b1) {
  23447. return (b0 << 8) + b1;
  23448. }
  23449. function writeSignedInt16(bytes, index, value) {
  23450. bytes[index + 1] = value;
  23451. bytes[index] = value >>> 8;
  23452. }
  23453. function signedInt16(b0, b1) {
  23454. const value = (b0 << 8) + b1;
  23455. return value & 1 << 15 ? value - 0x10000 : value;
  23456. }
  23457. function int32(b0, b1, b2, b3) {
  23458. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  23459. }
  23460. function string16(value) {
  23461. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  23462. }
  23463. function safeString16(value) {
  23464. if (value > 0x7fff) {
  23465. value = 0x7fff;
  23466. } else if (value < -0x8000) {
  23467. value = -0x8000;
  23468. }
  23469. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  23470. }
  23471. function isTrueTypeFile(file) {
  23472. const header = file.peekBytes(4);
  23473. return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true";
  23474. }
  23475. function isTrueTypeCollectionFile(file) {
  23476. const header = file.peekBytes(4);
  23477. return (0, _util.bytesToString)(header) === "ttcf";
  23478. }
  23479. function isOpenTypeFile(file) {
  23480. const header = file.peekBytes(4);
  23481. return (0, _util.bytesToString)(header) === "OTTO";
  23482. }
  23483. function isType1File(file) {
  23484. const header = file.peekBytes(2);
  23485. if (header[0] === 0x25 && header[1] === 0x21) {
  23486. return true;
  23487. }
  23488. if (header[0] === 0x80 && header[1] === 0x01) {
  23489. return true;
  23490. }
  23491. return false;
  23492. }
  23493. function isCFFFile(file) {
  23494. const header = file.peekBytes(4);
  23495. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  23496. return true;
  23497. }
  23498. return false;
  23499. }
  23500. function getFontFileType(file, _ref) {
  23501. let {
  23502. type,
  23503. subtype,
  23504. composite
  23505. } = _ref;
  23506. let fileType, fileSubtype;
  23507. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  23508. if (composite) {
  23509. fileType = "CIDFontType2";
  23510. } else {
  23511. fileType = "TrueType";
  23512. }
  23513. } else if (isOpenTypeFile(file)) {
  23514. if (composite) {
  23515. fileType = "CIDFontType2";
  23516. } else {
  23517. fileType = "OpenType";
  23518. }
  23519. } else if (isType1File(file)) {
  23520. if (composite) {
  23521. fileType = "CIDFontType0";
  23522. } else {
  23523. fileType = type === "MMType1" ? "MMType1" : "Type1";
  23524. }
  23525. } else if (isCFFFile(file)) {
  23526. if (composite) {
  23527. fileType = "CIDFontType0";
  23528. fileSubtype = "CIDFontType0C";
  23529. } else {
  23530. fileType = type === "MMType1" ? "MMType1" : "Type1";
  23531. fileSubtype = "Type1C";
  23532. }
  23533. } else {
  23534. (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");
  23535. fileType = type;
  23536. fileSubtype = subtype;
  23537. }
  23538. return [fileType, fileSubtype];
  23539. }
  23540. function applyStandardFontGlyphMap(map, glyphMap) {
  23541. for (const charCode in glyphMap) {
  23542. map[+charCode] = glyphMap[charCode];
  23543. }
  23544. }
  23545. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  23546. const toFontChar = [];
  23547. let unicode;
  23548. for (let i = 0, ii = encoding.length; i < ii; i++) {
  23549. unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
  23550. if (unicode !== -1) {
  23551. toFontChar[i] = unicode;
  23552. }
  23553. }
  23554. for (const charCode in differences) {
  23555. unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
  23556. if (unicode !== -1) {
  23557. toFontChar[+charCode] = unicode;
  23558. }
  23559. }
  23560. return toFontChar;
  23561. }
  23562. function convertCidString(charCode, cid) {
  23563. let shouldThrow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  23564. switch (cid.length) {
  23565. case 1:
  23566. return cid.charCodeAt(0);
  23567. case 2:
  23568. return cid.charCodeAt(0) << 8 | cid.charCodeAt(1);
  23569. }
  23570. const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`;
  23571. if (shouldThrow) {
  23572. throw new _util.FormatError(msg);
  23573. }
  23574. (0, _util.warn)(msg);
  23575. return cid;
  23576. }
  23577. function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId, toUnicode) {
  23578. const newMap = Object.create(null);
  23579. const toUnicodeExtraMap = new Map();
  23580. const toFontChar = [];
  23581. const usedGlyphIds = new Set();
  23582. let privateUseAreaIndex = 0;
  23583. const privateUseOffetStart = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  23584. let nextAvailableFontCharCode = privateUseOffetStart;
  23585. let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  23586. for (let originalCharCode in charCodeToGlyphId) {
  23587. originalCharCode |= 0;
  23588. let glyphId = charCodeToGlyphId[originalCharCode];
  23589. if (!hasGlyph(glyphId)) {
  23590. continue;
  23591. }
  23592. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  23593. privateUseAreaIndex++;
  23594. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  23595. (0, _util.warn)("Ran out of space in font private use area.");
  23596. break;
  23597. }
  23598. nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  23599. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  23600. }
  23601. const fontCharCode = nextAvailableFontCharCode++;
  23602. if (glyphId === 0) {
  23603. glyphId = newGlyphZeroId;
  23604. }
  23605. let unicode = toUnicode.get(originalCharCode);
  23606. if (typeof unicode === "string") {
  23607. unicode = unicode.codePointAt(0);
  23608. }
  23609. if (unicode && unicode < privateUseOffetStart && !usedGlyphIds.has(glyphId)) {
  23610. toUnicodeExtraMap.set(unicode, glyphId);
  23611. usedGlyphIds.add(glyphId);
  23612. }
  23613. newMap[fontCharCode] = glyphId;
  23614. toFontChar[originalCharCode] = fontCharCode;
  23615. }
  23616. return {
  23617. toFontChar,
  23618. charCodeToGlyphId: newMap,
  23619. toUnicodeExtraMap,
  23620. nextAvailableFontCharCode
  23621. };
  23622. }
  23623. function getRanges(glyphs, toUnicodeExtraMap, numGlyphs) {
  23624. const codes = [];
  23625. for (const charCode in glyphs) {
  23626. if (glyphs[charCode] >= numGlyphs) {
  23627. continue;
  23628. }
  23629. codes.push({
  23630. fontCharCode: charCode | 0,
  23631. glyphId: glyphs[charCode]
  23632. });
  23633. }
  23634. if (toUnicodeExtraMap) {
  23635. for (const [unicode, glyphId] of toUnicodeExtraMap) {
  23636. if (glyphId >= numGlyphs) {
  23637. continue;
  23638. }
  23639. codes.push({
  23640. fontCharCode: unicode,
  23641. glyphId
  23642. });
  23643. }
  23644. }
  23645. if (codes.length === 0) {
  23646. codes.push({
  23647. fontCharCode: 0,
  23648. glyphId: 0
  23649. });
  23650. }
  23651. codes.sort(function fontGetRangesSort(a, b) {
  23652. return a.fontCharCode - b.fontCharCode;
  23653. });
  23654. const ranges = [];
  23655. const length = codes.length;
  23656. for (let n = 0; n < length;) {
  23657. const start = codes[n].fontCharCode;
  23658. const codeIndices = [codes[n].glyphId];
  23659. ++n;
  23660. let end = start;
  23661. while (n < length && end + 1 === codes[n].fontCharCode) {
  23662. codeIndices.push(codes[n].glyphId);
  23663. ++end;
  23664. ++n;
  23665. if (end === 0xffff) {
  23666. break;
  23667. }
  23668. }
  23669. ranges.push([start, end, codeIndices]);
  23670. }
  23671. return ranges;
  23672. }
  23673. function createCmapTable(glyphs, toUnicodeExtraMap, numGlyphs) {
  23674. const ranges = getRanges(glyphs, toUnicodeExtraMap, numGlyphs);
  23675. const numTables = ranges.at(-1)[1] > 0xffff ? 2 : 1;
  23676. let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8);
  23677. let i, ii, j, jj;
  23678. for (i = ranges.length - 1; i >= 0; --i) {
  23679. if (ranges[i][0] <= 0xffff) {
  23680. break;
  23681. }
  23682. }
  23683. const bmpLength = i + 1;
  23684. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  23685. ranges[i][1] = 0xfffe;
  23686. }
  23687. const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  23688. const segCount = bmpLength + trailingRangesCount;
  23689. const searchParams = _opentype_file_builder.OpenTypeFileBuilder.getSearchParams(segCount, 2);
  23690. let startCount = "";
  23691. let endCount = "";
  23692. let idDeltas = "";
  23693. let idRangeOffsets = "";
  23694. let glyphsIds = "";
  23695. let bias = 0;
  23696. let range, start, end, codes;
  23697. for (i = 0, ii = bmpLength; i < ii; i++) {
  23698. range = ranges[i];
  23699. start = range[0];
  23700. end = range[1];
  23701. startCount += string16(start);
  23702. endCount += string16(end);
  23703. codes = range[2];
  23704. let contiguous = true;
  23705. for (j = 1, jj = codes.length; j < jj; ++j) {
  23706. if (codes[j] !== codes[j - 1] + 1) {
  23707. contiguous = false;
  23708. break;
  23709. }
  23710. }
  23711. if (!contiguous) {
  23712. const offset = (segCount - i) * 2 + bias * 2;
  23713. bias += end - start + 1;
  23714. idDeltas += string16(0);
  23715. idRangeOffsets += string16(offset);
  23716. for (j = 0, jj = codes.length; j < jj; ++j) {
  23717. glyphsIds += string16(codes[j]);
  23718. }
  23719. } else {
  23720. const startCode = codes[0];
  23721. idDeltas += string16(startCode - start & 0xffff);
  23722. idRangeOffsets += string16(0);
  23723. }
  23724. }
  23725. if (trailingRangesCount > 0) {
  23726. endCount += "\xFF\xFF";
  23727. startCount += "\xFF\xFF";
  23728. idDeltas += "\x00\x01";
  23729. idRangeOffsets += "\x00\x00";
  23730. }
  23731. const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
  23732. let format31012 = "";
  23733. let header31012 = "";
  23734. if (numTables > 1) {
  23735. cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
  23736. format31012 = "";
  23737. for (i = 0, ii = ranges.length; i < ii; i++) {
  23738. range = ranges[i];
  23739. start = range[0];
  23740. codes = range[2];
  23741. let code = codes[0];
  23742. for (j = 1, jj = codes.length; j < jj; ++j) {
  23743. if (codes[j] !== codes[j - 1] + 1) {
  23744. end = range[0] + j - 1;
  23745. format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
  23746. start = end + 1;
  23747. code = codes[j];
  23748. }
  23749. }
  23750. format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
  23751. }
  23752. header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12);
  23753. }
  23754. return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
  23755. }
  23756. function validateOS2Table(os2, file) {
  23757. file.pos = (file.start || 0) + os2.offset;
  23758. const version = file.getUint16();
  23759. file.skip(60);
  23760. const selection = file.getUint16();
  23761. if (version < 4 && selection & 0x0300) {
  23762. return false;
  23763. }
  23764. const firstChar = file.getUint16();
  23765. const lastChar = file.getUint16();
  23766. if (firstChar > lastChar) {
  23767. return false;
  23768. }
  23769. file.skip(6);
  23770. const usWinAscent = file.getUint16();
  23771. if (usWinAscent === 0) {
  23772. return false;
  23773. }
  23774. os2.data[8] = os2.data[9] = 0;
  23775. return true;
  23776. }
  23777. function createOS2Table(properties, charstrings, override) {
  23778. override = override || {
  23779. unitsPerEm: 0,
  23780. yMax: 0,
  23781. yMin: 0,
  23782. ascent: 0,
  23783. descent: 0
  23784. };
  23785. let ulUnicodeRange1 = 0;
  23786. let ulUnicodeRange2 = 0;
  23787. let ulUnicodeRange3 = 0;
  23788. let ulUnicodeRange4 = 0;
  23789. let firstCharIndex = null;
  23790. let lastCharIndex = 0;
  23791. if (charstrings) {
  23792. for (let code in charstrings) {
  23793. code |= 0;
  23794. if (firstCharIndex > code || !firstCharIndex) {
  23795. firstCharIndex = code;
  23796. }
  23797. if (lastCharIndex < code) {
  23798. lastCharIndex = code;
  23799. }
  23800. const position = (0, _unicode.getUnicodeRangeFor)(code);
  23801. if (position < 32) {
  23802. ulUnicodeRange1 |= 1 << position;
  23803. } else if (position < 64) {
  23804. ulUnicodeRange2 |= 1 << position - 32;
  23805. } else if (position < 96) {
  23806. ulUnicodeRange3 |= 1 << position - 64;
  23807. } else if (position < 123) {
  23808. ulUnicodeRange4 |= 1 << position - 96;
  23809. } else {
  23810. throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
  23811. }
  23812. }
  23813. if (lastCharIndex > 0xffff) {
  23814. lastCharIndex = 0xffff;
  23815. }
  23816. } else {
  23817. firstCharIndex = 0;
  23818. lastCharIndex = 255;
  23819. }
  23820. const bbox = properties.bbox || [0, 0, 0, 0];
  23821. const unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  23822. const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  23823. const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  23824. let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  23825. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  23826. typoDescent = -typoDescent;
  23827. }
  23828. const winAscent = override.yMax || typoAscent;
  23829. const winDescent = -override.yMin || -typoDescent;
  23830. 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";
  23831. }
  23832. function createPostTable(properties) {
  23833. const angle = Math.floor(properties.italicAngle * 2 ** 16);
  23834. 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";
  23835. }
  23836. function createPostscriptName(name) {
  23837. return name.replace(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63);
  23838. }
  23839. function createNameTable(name, proto) {
  23840. if (!proto) {
  23841. proto = [[], []];
  23842. }
  23843. 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"];
  23844. const stringsUnicode = [];
  23845. let i, ii, j, jj, str;
  23846. for (i = 0, ii = strings.length; i < ii; i++) {
  23847. str = proto[1][i] || strings[i];
  23848. const strBufUnicode = [];
  23849. for (j = 0, jj = str.length; j < jj; j++) {
  23850. strBufUnicode.push(string16(str.charCodeAt(j)));
  23851. }
  23852. stringsUnicode.push(strBufUnicode.join(""));
  23853. }
  23854. const names = [strings, stringsUnicode];
  23855. const platforms = ["\x00\x01", "\x00\x03"];
  23856. const encodings = ["\x00\x00", "\x00\x01"];
  23857. const languages = ["\x00\x00", "\x04\x09"];
  23858. const namesRecordCount = strings.length * platforms.length;
  23859. let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  23860. let strOffset = 0;
  23861. for (i = 0, ii = platforms.length; i < ii; i++) {
  23862. const strs = names[i];
  23863. for (j = 0, jj = strs.length; j < jj; j++) {
  23864. str = strs[j];
  23865. const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  23866. nameTable += nameRecord;
  23867. strOffset += str.length;
  23868. }
  23869. }
  23870. nameTable += strings.join("") + stringsUnicode.join("");
  23871. return nameTable;
  23872. }
  23873. class Font {
  23874. constructor(name, file, properties) {
  23875. this.name = name;
  23876. this.psName = null;
  23877. this.mimetype = null;
  23878. this.disableFontFace = false;
  23879. this.loadedName = properties.loadedName;
  23880. this.isType3Font = properties.isType3Font;
  23881. this.missingFile = false;
  23882. this.cssFontInfo = properties.cssFontInfo;
  23883. this._charsCache = Object.create(null);
  23884. this._glyphCache = Object.create(null);
  23885. let isSerifFont = !!(properties.flags & _fonts_utils.FontFlags.Serif);
  23886. if (!isSerifFont && !properties.isSimulatedFlags) {
  23887. const baseName = name.replace(/[,_]/g, "-").split("-")[0],
  23888. serifFonts = (0, _standard_fonts.getSerifFonts)();
  23889. for (const namePart of baseName.split("+")) {
  23890. if (serifFonts[namePart]) {
  23891. isSerifFont = true;
  23892. break;
  23893. }
  23894. }
  23895. }
  23896. this.isSerifFont = isSerifFont;
  23897. this.isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  23898. this.isMonospace = !!(properties.flags & _fonts_utils.FontFlags.FixedPitch);
  23899. let type = properties.type;
  23900. let subtype = properties.subtype;
  23901. this.type = type;
  23902. this.subtype = subtype;
  23903. let fallbackName = "sans-serif";
  23904. if (this.isMonospace) {
  23905. fallbackName = "monospace";
  23906. } else if (this.isSerifFont) {
  23907. fallbackName = "serif";
  23908. }
  23909. this.fallbackName = fallbackName;
  23910. this.differences = properties.differences;
  23911. this.widths = properties.widths;
  23912. this.defaultWidth = properties.defaultWidth;
  23913. this.composite = properties.composite;
  23914. this.cMap = properties.cMap;
  23915. this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
  23916. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  23917. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  23918. this.lineHeight = this.ascent - this.descent;
  23919. this.fontMatrix = properties.fontMatrix;
  23920. this.bbox = properties.bbox;
  23921. this.defaultEncoding = properties.defaultEncoding;
  23922. this.toUnicode = properties.toUnicode;
  23923. this.toFontChar = [];
  23924. if (properties.type === "Type3") {
  23925. for (let charCode = 0; charCode < 256; charCode++) {
  23926. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  23927. }
  23928. this.fontType = _util.FontType.TYPE3;
  23929. return;
  23930. }
  23931. this.cidEncoding = properties.cidEncoding || "";
  23932. this.vertical = !!properties.vertical;
  23933. if (this.vertical) {
  23934. this.vmetrics = properties.vmetrics;
  23935. this.defaultVMetrics = properties.defaultVMetrics;
  23936. }
  23937. if (!file || file.isEmpty) {
  23938. if (file) {
  23939. (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")");
  23940. }
  23941. this.fallbackToSystemFont(properties);
  23942. return;
  23943. }
  23944. [type, subtype] = getFontFileType(file, properties);
  23945. if (type !== this.type || subtype !== this.subtype) {
  23946. (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
  23947. }
  23948. let data;
  23949. try {
  23950. switch (type) {
  23951. case "MMType1":
  23952. (0, _util.info)("MMType1 font (" + name + "), falling back to Type1.");
  23953. case "Type1":
  23954. case "CIDFontType0":
  23955. this.mimetype = "font/opentype";
  23956. const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new _cff_font.CFFFont(file, properties) : new _type1_font.Type1Font(name, file, properties);
  23957. adjustWidths(properties);
  23958. data = this.convert(name, cff, properties);
  23959. break;
  23960. case "OpenType":
  23961. case "TrueType":
  23962. case "CIDFontType2":
  23963. this.mimetype = "font/opentype";
  23964. data = this.checkAndRepair(name, file, properties);
  23965. if (this.isOpenType) {
  23966. adjustWidths(properties);
  23967. type = "OpenType";
  23968. }
  23969. break;
  23970. default:
  23971. throw new _util.FormatError(`Font ${type} is not supported`);
  23972. }
  23973. } catch (e) {
  23974. (0, _util.warn)(e);
  23975. this.fallbackToSystemFont(properties);
  23976. return;
  23977. }
  23978. amendFallbackToUnicode(properties);
  23979. this.data = data;
  23980. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  23981. this.fontMatrix = properties.fontMatrix;
  23982. this.widths = properties.widths;
  23983. this.defaultWidth = properties.defaultWidth;
  23984. this.toUnicode = properties.toUnicode;
  23985. this.seacMap = properties.seacMap;
  23986. }
  23987. get renderer() {
  23988. const renderer = _font_renderer.FontRendererFactory.create(this, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  23989. return (0, _util.shadow)(this, "renderer", renderer);
  23990. }
  23991. exportData() {
  23992. let extraProperties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  23993. const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
  23994. const data = Object.create(null);
  23995. let property, value;
  23996. for (property of exportDataProperties) {
  23997. value = this[property];
  23998. if (value !== undefined) {
  23999. data[property] = value;
  24000. }
  24001. }
  24002. return data;
  24003. }
  24004. fallbackToSystemFont(properties) {
  24005. this.missingFile = true;
  24006. const name = this.name;
  24007. const type = this.type;
  24008. const subtype = this.subtype;
  24009. let fontName = (0, _fonts_utils.normalizeFontName)(name);
  24010. const stdFontMap = (0, _standard_fonts.getStdFontMap)(),
  24011. nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
  24012. const isStandardFont = !!stdFontMap[fontName];
  24013. const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  24014. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  24015. const fontBasicMetricsMap = (0, _metrics.getFontBasicMetrics)();
  24016. const metrics = fontBasicMetricsMap[fontName];
  24017. if (metrics) {
  24018. if (isNaN(this.ascent)) {
  24019. this.ascent = metrics.ascent / PDF_GLYPH_SPACE_UNITS;
  24020. }
  24021. if (isNaN(this.descent)) {
  24022. this.descent = metrics.descent / PDF_GLYPH_SPACE_UNITS;
  24023. }
  24024. if (isNaN(this.capHeight)) {
  24025. this.capHeight = metrics.capHeight / PDF_GLYPH_SPACE_UNITS;
  24026. }
  24027. }
  24028. this.bold = fontName.search(/bold/gi) !== -1;
  24029. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  24030. this.black = name.search(/Black/g) !== -1;
  24031. const isNarrow = name.search(/Narrow/g) !== -1;
  24032. this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
  24033. if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
  24034. const cidToGidMap = properties.cidToGidMap;
  24035. const map = [];
  24036. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  24037. if (/Arial-?Black/i.test(name)) {
  24038. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)());
  24039. } else if (/Calibri/i.test(name)) {
  24040. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForCalibri)());
  24041. }
  24042. if (cidToGidMap) {
  24043. for (const charCode in map) {
  24044. const cid = map[charCode];
  24045. if (cidToGidMap[cid] !== undefined) {
  24046. map[+charCode] = cidToGidMap[cid];
  24047. }
  24048. }
  24049. if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  24050. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  24051. const cid = map[charCode];
  24052. if (cidToGidMap[cid] === undefined) {
  24053. map[+charCode] = unicodeCharCode;
  24054. }
  24055. });
  24056. }
  24057. }
  24058. if (!(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  24059. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  24060. map[+charCode] = unicodeCharCode;
  24061. });
  24062. }
  24063. this.toFontChar = map;
  24064. this.toUnicode = new _to_unicode_map.ToUnicodeMap(map);
  24065. } else if (/Symbol/i.test(fontName)) {
  24066. this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  24067. } else if (/Dingbats/i.test(fontName)) {
  24068. if (/Wingdings/i.test(name)) {
  24069. (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats.");
  24070. }
  24071. this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
  24072. } else if (isStandardFont) {
  24073. const map = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  24074. if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  24075. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  24076. map[+charCode] = unicodeCharCode;
  24077. });
  24078. }
  24079. this.toFontChar = map;
  24080. } else {
  24081. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  24082. const map = [];
  24083. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  24084. if (!this.composite) {
  24085. const glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
  24086. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  24087. if (unicode !== -1) {
  24088. unicodeCharCode = unicode;
  24089. }
  24090. }
  24091. map[+charCode] = unicodeCharCode;
  24092. });
  24093. if (this.composite && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  24094. if (/Verdana/i.test(name)) {
  24095. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  24096. }
  24097. }
  24098. this.toFontChar = map;
  24099. }
  24100. amendFallbackToUnicode(properties);
  24101. this.loadedName = fontName.split("-")[0];
  24102. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  24103. }
  24104. checkAndRepair(name, font, properties) {
  24105. const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
  24106. function readTables(file, numTables) {
  24107. const tables = Object.create(null);
  24108. tables["OS/2"] = null;
  24109. tables.cmap = null;
  24110. tables.head = null;
  24111. tables.hhea = null;
  24112. tables.hmtx = null;
  24113. tables.maxp = null;
  24114. tables.name = null;
  24115. tables.post = null;
  24116. for (let i = 0; i < numTables; i++) {
  24117. const table = readTableEntry(file);
  24118. if (!VALID_TABLES.includes(table.tag)) {
  24119. continue;
  24120. }
  24121. if (table.length === 0) {
  24122. continue;
  24123. }
  24124. tables[table.tag] = table;
  24125. }
  24126. return tables;
  24127. }
  24128. function readTableEntry(file) {
  24129. const tag = file.getString(4);
  24130. const checksum = file.getInt32() >>> 0;
  24131. const offset = file.getInt32() >>> 0;
  24132. const length = file.getInt32() >>> 0;
  24133. const previousPosition = file.pos;
  24134. file.pos = file.start || 0;
  24135. file.skip(offset);
  24136. const data = file.getBytes(length);
  24137. file.pos = previousPosition;
  24138. if (tag === "head") {
  24139. data[8] = data[9] = data[10] = data[11] = 0;
  24140. data[17] |= 0x20;
  24141. }
  24142. return {
  24143. tag,
  24144. checksum,
  24145. length,
  24146. offset,
  24147. data
  24148. };
  24149. }
  24150. function readOpenTypeHeader(ttf) {
  24151. return {
  24152. version: ttf.getString(4),
  24153. numTables: ttf.getUint16(),
  24154. searchRange: ttf.getUint16(),
  24155. entrySelector: ttf.getUint16(),
  24156. rangeShift: ttf.getUint16()
  24157. };
  24158. }
  24159. function readTrueTypeCollectionHeader(ttc) {
  24160. const ttcTag = ttc.getString(4);
  24161. (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font.");
  24162. const majorVersion = ttc.getUint16();
  24163. const minorVersion = ttc.getUint16();
  24164. const numFonts = ttc.getInt32() >>> 0;
  24165. const offsetTable = [];
  24166. for (let i = 0; i < numFonts; i++) {
  24167. offsetTable.push(ttc.getInt32() >>> 0);
  24168. }
  24169. const header = {
  24170. ttcTag,
  24171. majorVersion,
  24172. minorVersion,
  24173. numFonts,
  24174. offsetTable
  24175. };
  24176. switch (majorVersion) {
  24177. case 1:
  24178. return header;
  24179. case 2:
  24180. header.dsigTag = ttc.getInt32() >>> 0;
  24181. header.dsigLength = ttc.getInt32() >>> 0;
  24182. header.dsigOffset = ttc.getInt32() >>> 0;
  24183. return header;
  24184. }
  24185. throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
  24186. }
  24187. function readTrueTypeCollectionData(ttc, fontName) {
  24188. const {
  24189. numFonts,
  24190. offsetTable
  24191. } = readTrueTypeCollectionHeader(ttc);
  24192. const fontNameParts = fontName.split("+");
  24193. let fallbackData;
  24194. for (let i = 0; i < numFonts; i++) {
  24195. ttc.pos = (ttc.start || 0) + offsetTable[i];
  24196. const potentialHeader = readOpenTypeHeader(ttc);
  24197. const potentialTables = readTables(ttc, potentialHeader.numTables);
  24198. if (!potentialTables.name) {
  24199. throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
  24200. }
  24201. const nameTable = readNameTable(potentialTables.name);
  24202. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  24203. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  24204. const nameEntry = nameTable[j][k] && nameTable[j][k].replace(/\s/g, "");
  24205. if (!nameEntry) {
  24206. continue;
  24207. }
  24208. if (nameEntry === fontName) {
  24209. return {
  24210. header: potentialHeader,
  24211. tables: potentialTables
  24212. };
  24213. }
  24214. if (fontNameParts.length < 2) {
  24215. continue;
  24216. }
  24217. for (const part of fontNameParts) {
  24218. if (nameEntry === part) {
  24219. fallbackData = {
  24220. name: part,
  24221. header: potentialHeader,
  24222. tables: potentialTables
  24223. };
  24224. }
  24225. }
  24226. }
  24227. }
  24228. }
  24229. if (fallbackData) {
  24230. (0, _util.warn)(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`);
  24231. return {
  24232. header: fallbackData.header,
  24233. tables: fallbackData.tables
  24234. };
  24235. }
  24236. throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`);
  24237. }
  24238. function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
  24239. if (!cmap) {
  24240. (0, _util.warn)("No cmap table available.");
  24241. return {
  24242. platformId: -1,
  24243. encodingId: -1,
  24244. mappings: [],
  24245. hasShortCmap: false
  24246. };
  24247. }
  24248. let segment;
  24249. let start = (file.start || 0) + cmap.offset;
  24250. file.pos = start;
  24251. file.skip(2);
  24252. const numTables = file.getUint16();
  24253. let potentialTable;
  24254. let canBreak = false;
  24255. for (let i = 0; i < numTables; i++) {
  24256. const platformId = file.getUint16();
  24257. const encodingId = file.getUint16();
  24258. const offset = file.getInt32() >>> 0;
  24259. let useTable = false;
  24260. if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) {
  24261. continue;
  24262. }
  24263. if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
  24264. useTable = true;
  24265. } else if (platformId === 1 && encodingId === 0) {
  24266. useTable = true;
  24267. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  24268. useTable = true;
  24269. if (!isSymbolicFont) {
  24270. canBreak = true;
  24271. }
  24272. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  24273. useTable = true;
  24274. let correctlySorted = true;
  24275. if (i < numTables - 1) {
  24276. const nextBytes = file.peekBytes(2),
  24277. nextPlatformId = int16(nextBytes[0], nextBytes[1]);
  24278. if (nextPlatformId < platformId) {
  24279. correctlySorted = false;
  24280. }
  24281. }
  24282. if (correctlySorted) {
  24283. canBreak = true;
  24284. }
  24285. }
  24286. if (useTable) {
  24287. potentialTable = {
  24288. platformId,
  24289. encodingId,
  24290. offset
  24291. };
  24292. }
  24293. if (canBreak) {
  24294. break;
  24295. }
  24296. }
  24297. if (potentialTable) {
  24298. file.pos = start + potentialTable.offset;
  24299. }
  24300. if (!potentialTable || file.peekByte() === -1) {
  24301. (0, _util.warn)("Could not find a preferred cmap table.");
  24302. return {
  24303. platformId: -1,
  24304. encodingId: -1,
  24305. mappings: [],
  24306. hasShortCmap: false
  24307. };
  24308. }
  24309. const format = file.getUint16();
  24310. let hasShortCmap = false;
  24311. const mappings = [];
  24312. let j, glyphId;
  24313. if (format === 0) {
  24314. file.skip(2 + 2);
  24315. for (j = 0; j < 256; j++) {
  24316. const index = file.getByte();
  24317. if (!index) {
  24318. continue;
  24319. }
  24320. mappings.push({
  24321. charCode: j,
  24322. glyphId: index
  24323. });
  24324. }
  24325. hasShortCmap = true;
  24326. } else if (format === 2) {
  24327. file.skip(2 + 2);
  24328. const subHeaderKeys = [];
  24329. let maxSubHeaderKey = 0;
  24330. for (let i = 0; i < 256; i++) {
  24331. const subHeaderKey = file.getUint16() >> 3;
  24332. subHeaderKeys.push(subHeaderKey);
  24333. maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey);
  24334. }
  24335. const subHeaders = [];
  24336. for (let i = 0; i <= maxSubHeaderKey; i++) {
  24337. subHeaders.push({
  24338. firstCode: file.getUint16(),
  24339. entryCount: file.getUint16(),
  24340. idDelta: signedInt16(file.getByte(), file.getByte()),
  24341. idRangePos: file.pos + file.getUint16()
  24342. });
  24343. }
  24344. for (let i = 0; i < 256; i++) {
  24345. if (subHeaderKeys[i] === 0) {
  24346. file.pos = subHeaders[0].idRangePos + 2 * i;
  24347. glyphId = file.getUint16();
  24348. mappings.push({
  24349. charCode: i,
  24350. glyphId
  24351. });
  24352. } else {
  24353. const s = subHeaders[subHeaderKeys[i]];
  24354. for (j = 0; j < s.entryCount; j++) {
  24355. const charCode = (i << 8) + j + s.firstCode;
  24356. file.pos = s.idRangePos + 2 * j;
  24357. glyphId = file.getUint16();
  24358. if (glyphId !== 0) {
  24359. glyphId = (glyphId + s.idDelta) % 65536;
  24360. }
  24361. mappings.push({
  24362. charCode,
  24363. glyphId
  24364. });
  24365. }
  24366. }
  24367. }
  24368. } else if (format === 4) {
  24369. file.skip(2 + 2);
  24370. const segCount = file.getUint16() >> 1;
  24371. file.skip(6);
  24372. const segments = [];
  24373. let segIndex;
  24374. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24375. segments.push({
  24376. end: file.getUint16()
  24377. });
  24378. }
  24379. file.skip(2);
  24380. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24381. segments[segIndex].start = file.getUint16();
  24382. }
  24383. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24384. segments[segIndex].delta = file.getUint16();
  24385. }
  24386. let offsetsCount = 0,
  24387. offsetIndex;
  24388. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24389. segment = segments[segIndex];
  24390. const rangeOffset = file.getUint16();
  24391. if (!rangeOffset) {
  24392. segment.offsetIndex = -1;
  24393. continue;
  24394. }
  24395. offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  24396. segment.offsetIndex = offsetIndex;
  24397. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  24398. }
  24399. const offsets = [];
  24400. for (j = 0; j < offsetsCount; j++) {
  24401. offsets.push(file.getUint16());
  24402. }
  24403. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24404. segment = segments[segIndex];
  24405. start = segment.start;
  24406. const end = segment.end;
  24407. const delta = segment.delta;
  24408. offsetIndex = segment.offsetIndex;
  24409. for (j = start; j <= end; j++) {
  24410. if (j === 0xffff) {
  24411. continue;
  24412. }
  24413. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  24414. glyphId = glyphId + delta & 0xffff;
  24415. mappings.push({
  24416. charCode: j,
  24417. glyphId
  24418. });
  24419. }
  24420. }
  24421. } else if (format === 6) {
  24422. file.skip(2 + 2);
  24423. const firstCode = file.getUint16();
  24424. const entryCount = file.getUint16();
  24425. for (j = 0; j < entryCount; j++) {
  24426. glyphId = file.getUint16();
  24427. const charCode = firstCode + j;
  24428. mappings.push({
  24429. charCode,
  24430. glyphId
  24431. });
  24432. }
  24433. } else if (format === 12) {
  24434. file.skip(2 + 4 + 4);
  24435. const nGroups = file.getInt32() >>> 0;
  24436. for (j = 0; j < nGroups; j++) {
  24437. const startCharCode = file.getInt32() >>> 0;
  24438. const endCharCode = file.getInt32() >>> 0;
  24439. let glyphCode = file.getInt32() >>> 0;
  24440. for (let charCode = startCharCode; charCode <= endCharCode; charCode++) {
  24441. mappings.push({
  24442. charCode,
  24443. glyphId: glyphCode++
  24444. });
  24445. }
  24446. }
  24447. } else {
  24448. (0, _util.warn)("cmap table has unsupported format: " + format);
  24449. return {
  24450. platformId: -1,
  24451. encodingId: -1,
  24452. mappings: [],
  24453. hasShortCmap: false
  24454. };
  24455. }
  24456. mappings.sort(function (a, b) {
  24457. return a.charCode - b.charCode;
  24458. });
  24459. for (let i = 1; i < mappings.length; i++) {
  24460. if (mappings[i - 1].charCode === mappings[i].charCode) {
  24461. mappings.splice(i, 1);
  24462. i--;
  24463. }
  24464. }
  24465. return {
  24466. platformId: potentialTable.platformId,
  24467. encodingId: potentialTable.encodingId,
  24468. mappings,
  24469. hasShortCmap
  24470. };
  24471. }
  24472. function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) {
  24473. if (!header) {
  24474. if (metrics) {
  24475. metrics.data = null;
  24476. }
  24477. return;
  24478. }
  24479. file.pos = (file.start || 0) + header.offset;
  24480. file.pos += 4;
  24481. file.pos += 2;
  24482. file.pos += 2;
  24483. file.pos += 2;
  24484. file.pos += 2;
  24485. file.pos += 2;
  24486. file.pos += 2;
  24487. file.pos += 2;
  24488. file.pos += 2;
  24489. file.pos += 2;
  24490. const caretOffset = file.getUint16();
  24491. file.pos += 8;
  24492. file.pos += 2;
  24493. let numOfMetrics = file.getUint16();
  24494. if (caretOffset !== 0) {
  24495. const macStyle = int16(headTable.data[44], headTable.data[45]);
  24496. if (!(macStyle & 2)) {
  24497. header.data[22] = 0;
  24498. header.data[23] = 0;
  24499. }
  24500. }
  24501. if (numOfMetrics > numGlyphs) {
  24502. (0, _util.info)(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`);
  24503. numOfMetrics = numGlyphs;
  24504. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  24505. header.data[35] = numOfMetrics & 0x00ff;
  24506. }
  24507. const numOfSidebearings = numGlyphs - numOfMetrics;
  24508. const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  24509. if (numMissing > 0) {
  24510. const entries = new Uint8Array(metrics.length + numMissing * 2);
  24511. entries.set(metrics.data);
  24512. if (dupFirstEntry) {
  24513. entries[metrics.length] = metrics.data[2];
  24514. entries[metrics.length + 1] = metrics.data[3];
  24515. }
  24516. metrics.data = entries;
  24517. }
  24518. }
  24519. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  24520. const glyphProfile = {
  24521. length: 0,
  24522. sizeOfInstructions: 0
  24523. };
  24524. if (sourceEnd - sourceStart <= 12) {
  24525. return glyphProfile;
  24526. }
  24527. const glyf = source.subarray(sourceStart, sourceEnd);
  24528. let contoursCount = signedInt16(glyf[0], glyf[1]);
  24529. if (contoursCount < 0) {
  24530. contoursCount = -1;
  24531. writeSignedInt16(glyf, 0, contoursCount);
  24532. dest.set(glyf, destStart);
  24533. glyphProfile.length = glyf.length;
  24534. return glyphProfile;
  24535. }
  24536. let i,
  24537. j = 10,
  24538. flagsCount = 0;
  24539. for (i = 0; i < contoursCount; i++) {
  24540. const endPoint = glyf[j] << 8 | glyf[j + 1];
  24541. flagsCount = endPoint + 1;
  24542. j += 2;
  24543. }
  24544. const instructionsStart = j;
  24545. const instructionsLength = glyf[j] << 8 | glyf[j + 1];
  24546. glyphProfile.sizeOfInstructions = instructionsLength;
  24547. j += 2 + instructionsLength;
  24548. const instructionsEnd = j;
  24549. let coordinatesLength = 0;
  24550. for (i = 0; i < flagsCount; i++) {
  24551. const flag = glyf[j++];
  24552. if (flag & 0xc0) {
  24553. glyf[j - 1] = flag & 0x3f;
  24554. }
  24555. let xLength = 2;
  24556. if (flag & 2) {
  24557. xLength = 1;
  24558. } else if (flag & 16) {
  24559. xLength = 0;
  24560. }
  24561. let yLength = 2;
  24562. if (flag & 4) {
  24563. yLength = 1;
  24564. } else if (flag & 32) {
  24565. yLength = 0;
  24566. }
  24567. const xyLength = xLength + yLength;
  24568. coordinatesLength += xyLength;
  24569. if (flag & 8) {
  24570. const repeat = glyf[j++];
  24571. i += repeat;
  24572. coordinatesLength += repeat * xyLength;
  24573. }
  24574. }
  24575. if (coordinatesLength === 0) {
  24576. return glyphProfile;
  24577. }
  24578. let glyphDataLength = j + coordinatesLength;
  24579. if (glyphDataLength > glyf.length) {
  24580. return glyphProfile;
  24581. }
  24582. if (!hintsValid && instructionsLength > 0) {
  24583. dest.set(glyf.subarray(0, instructionsStart), destStart);
  24584. dest.set([0, 0], destStart + instructionsStart);
  24585. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  24586. glyphDataLength -= instructionsLength;
  24587. if (glyf.length - glyphDataLength > 3) {
  24588. glyphDataLength = glyphDataLength + 3 & ~3;
  24589. }
  24590. glyphProfile.length = glyphDataLength;
  24591. return glyphProfile;
  24592. }
  24593. if (glyf.length - glyphDataLength > 3) {
  24594. glyphDataLength = glyphDataLength + 3 & ~3;
  24595. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  24596. glyphProfile.length = glyphDataLength;
  24597. return glyphProfile;
  24598. }
  24599. dest.set(glyf, destStart);
  24600. glyphProfile.length = glyf.length;
  24601. return glyphProfile;
  24602. }
  24603. function sanitizeHead(head, numGlyphs, locaLength) {
  24604. const data = head.data;
  24605. const version = int32(data[0], data[1], data[2], data[3]);
  24606. if (version >> 16 !== 1) {
  24607. (0, _util.info)("Attempting to fix invalid version in head table: " + version);
  24608. data[0] = 0;
  24609. data[1] = 1;
  24610. data[2] = 0;
  24611. data[3] = 0;
  24612. }
  24613. const indexToLocFormat = int16(data[50], data[51]);
  24614. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  24615. (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
  24616. const numGlyphsPlusOne = numGlyphs + 1;
  24617. if (locaLength === numGlyphsPlusOne << 1) {
  24618. data[50] = 0;
  24619. data[51] = 0;
  24620. } else if (locaLength === numGlyphsPlusOne << 2) {
  24621. data[50] = 0;
  24622. data[51] = 1;
  24623. } else {
  24624. throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
  24625. }
  24626. }
  24627. }
  24628. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
  24629. let itemSize, itemDecode, itemEncode;
  24630. if (isGlyphLocationsLong) {
  24631. itemSize = 4;
  24632. itemDecode = function fontItemDecodeLong(data, offset) {
  24633. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  24634. };
  24635. itemEncode = function fontItemEncodeLong(data, offset, value) {
  24636. data[offset] = value >>> 24 & 0xff;
  24637. data[offset + 1] = value >> 16 & 0xff;
  24638. data[offset + 2] = value >> 8 & 0xff;
  24639. data[offset + 3] = value & 0xff;
  24640. };
  24641. } else {
  24642. itemSize = 2;
  24643. itemDecode = function fontItemDecode(data, offset) {
  24644. return data[offset] << 9 | data[offset + 1] << 1;
  24645. };
  24646. itemEncode = function fontItemEncode(data, offset, value) {
  24647. data[offset] = value >> 9 & 0xff;
  24648. data[offset + 1] = value >> 1 & 0xff;
  24649. };
  24650. }
  24651. const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  24652. const locaDataSize = itemSize * (1 + numGlyphsOut);
  24653. const locaData = new Uint8Array(locaDataSize);
  24654. locaData.set(loca.data.subarray(0, locaDataSize));
  24655. loca.data = locaData;
  24656. const oldGlyfData = glyf.data;
  24657. const oldGlyfDataLength = oldGlyfData.length;
  24658. const newGlyfData = new Uint8Array(oldGlyfDataLength);
  24659. let i, j;
  24660. const locaEntries = [];
  24661. for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
  24662. let offset = itemDecode(locaData, j);
  24663. if (offset > oldGlyfDataLength) {
  24664. offset = oldGlyfDataLength;
  24665. }
  24666. locaEntries.push({
  24667. index: i,
  24668. offset,
  24669. endOffset: 0
  24670. });
  24671. }
  24672. locaEntries.sort((a, b) => {
  24673. return a.offset - b.offset;
  24674. });
  24675. for (i = 0; i < numGlyphs; i++) {
  24676. locaEntries[i].endOffset = locaEntries[i + 1].offset;
  24677. }
  24678. locaEntries.sort((a, b) => {
  24679. return a.index - b.index;
  24680. });
  24681. for (i = 0; i < numGlyphs; i++) {
  24682. const {
  24683. offset,
  24684. endOffset
  24685. } = locaEntries[i];
  24686. if (offset !== 0 || endOffset !== 0) {
  24687. break;
  24688. }
  24689. const nextOffset = locaEntries[i + 1].offset;
  24690. if (nextOffset === 0) {
  24691. continue;
  24692. }
  24693. locaEntries[i].endOffset = nextOffset;
  24694. break;
  24695. }
  24696. const missingGlyphs = Object.create(null);
  24697. let writeOffset = 0;
  24698. itemEncode(locaData, 0, writeOffset);
  24699. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  24700. const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
  24701. const newLength = glyphProfile.length;
  24702. if (newLength === 0) {
  24703. missingGlyphs[i] = true;
  24704. }
  24705. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  24706. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  24707. }
  24708. writeOffset += newLength;
  24709. itemEncode(locaData, j, writeOffset);
  24710. }
  24711. if (writeOffset === 0) {
  24712. const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  24713. for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
  24714. itemEncode(locaData, j, simpleGlyph.length);
  24715. }
  24716. glyf.data = simpleGlyph;
  24717. } else if (dupFirstEntry) {
  24718. const firstEntryLength = itemDecode(locaData, itemSize);
  24719. if (newGlyfData.length > firstEntryLength + writeOffset) {
  24720. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  24721. } else {
  24722. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  24723. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  24724. }
  24725. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  24726. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  24727. } else {
  24728. glyf.data = newGlyfData.subarray(0, writeOffset);
  24729. }
  24730. return {
  24731. missingGlyphs,
  24732. maxSizeOfInstructions
  24733. };
  24734. }
  24735. function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
  24736. const start = (font.start || 0) + post.offset;
  24737. font.pos = start;
  24738. const length = post.length,
  24739. end = start + length;
  24740. const version = font.getInt32();
  24741. font.skip(28);
  24742. let glyphNames;
  24743. let valid = true;
  24744. let i;
  24745. switch (version) {
  24746. case 0x00010000:
  24747. glyphNames = _fonts_utils.MacStandardGlyphOrdering;
  24748. break;
  24749. case 0x00020000:
  24750. const numGlyphs = font.getUint16();
  24751. if (numGlyphs !== maxpNumGlyphs) {
  24752. valid = false;
  24753. break;
  24754. }
  24755. const glyphNameIndexes = [];
  24756. for (i = 0; i < numGlyphs; ++i) {
  24757. const index = font.getUint16();
  24758. if (index >= 32768) {
  24759. valid = false;
  24760. break;
  24761. }
  24762. glyphNameIndexes.push(index);
  24763. }
  24764. if (!valid) {
  24765. break;
  24766. }
  24767. const customNames = [],
  24768. strBuf = [];
  24769. while (font.pos < end) {
  24770. const stringLength = font.getByte();
  24771. strBuf.length = stringLength;
  24772. for (i = 0; i < stringLength; ++i) {
  24773. strBuf[i] = String.fromCharCode(font.getByte());
  24774. }
  24775. customNames.push(strBuf.join(""));
  24776. }
  24777. glyphNames = [];
  24778. for (i = 0; i < numGlyphs; ++i) {
  24779. const j = glyphNameIndexes[i];
  24780. if (j < 258) {
  24781. glyphNames.push(_fonts_utils.MacStandardGlyphOrdering[j]);
  24782. continue;
  24783. }
  24784. glyphNames.push(customNames[j - 258]);
  24785. }
  24786. break;
  24787. case 0x00030000:
  24788. break;
  24789. default:
  24790. (0, _util.warn)("Unknown/unsupported post table version " + version);
  24791. valid = false;
  24792. if (propertiesObj.defaultEncoding) {
  24793. glyphNames = propertiesObj.defaultEncoding;
  24794. }
  24795. break;
  24796. }
  24797. propertiesObj.glyphNames = glyphNames;
  24798. return valid;
  24799. }
  24800. function readNameTable(nameTable) {
  24801. const start = (font.start || 0) + nameTable.offset;
  24802. font.pos = start;
  24803. const names = [[], []];
  24804. const length = nameTable.length,
  24805. end = start + length;
  24806. const format = font.getUint16();
  24807. const FORMAT_0_HEADER_LENGTH = 6;
  24808. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  24809. return names;
  24810. }
  24811. const numRecords = font.getUint16();
  24812. const stringsStart = font.getUint16();
  24813. const records = [];
  24814. const NAME_RECORD_LENGTH = 12;
  24815. let i, ii;
  24816. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  24817. const r = {
  24818. platform: font.getUint16(),
  24819. encoding: font.getUint16(),
  24820. language: font.getUint16(),
  24821. name: font.getUint16(),
  24822. length: font.getUint16(),
  24823. offset: font.getUint16()
  24824. };
  24825. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  24826. records.push(r);
  24827. }
  24828. }
  24829. for (i = 0, ii = records.length; i < ii; i++) {
  24830. const record = records[i];
  24831. if (record.length <= 0) {
  24832. continue;
  24833. }
  24834. const pos = start + stringsStart + record.offset;
  24835. if (pos + record.length > end) {
  24836. continue;
  24837. }
  24838. font.pos = pos;
  24839. const nameIndex = record.name;
  24840. if (record.encoding) {
  24841. let str = "";
  24842. for (let j = 0, jj = record.length; j < jj; j += 2) {
  24843. str += String.fromCharCode(font.getUint16());
  24844. }
  24845. names[1][nameIndex] = str;
  24846. } else {
  24847. names[0][nameIndex] = font.getString(record.length);
  24848. }
  24849. }
  24850. return names;
  24851. }
  24852. 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];
  24853. function sanitizeTTProgram(table, ttContext) {
  24854. let data = table.data;
  24855. let i = 0,
  24856. j,
  24857. n,
  24858. b,
  24859. funcId,
  24860. pc,
  24861. lastEndf = 0,
  24862. lastDeff = 0;
  24863. const stack = [];
  24864. const callstack = [];
  24865. const functionsCalled = [];
  24866. let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  24867. let inFDEF = false,
  24868. ifLevel = 0,
  24869. inELSE = 0;
  24870. for (let ii = data.length; i < ii;) {
  24871. const op = data[i++];
  24872. if (op === 0x40) {
  24873. n = data[i++];
  24874. if (inFDEF || inELSE) {
  24875. i += n;
  24876. } else {
  24877. for (j = 0; j < n; j++) {
  24878. stack.push(data[i++]);
  24879. }
  24880. }
  24881. } else if (op === 0x41) {
  24882. n = data[i++];
  24883. if (inFDEF || inELSE) {
  24884. i += n * 2;
  24885. } else {
  24886. for (j = 0; j < n; j++) {
  24887. b = data[i++];
  24888. stack.push(b << 8 | data[i++]);
  24889. }
  24890. }
  24891. } else if ((op & 0xf8) === 0xb0) {
  24892. n = op - 0xb0 + 1;
  24893. if (inFDEF || inELSE) {
  24894. i += n;
  24895. } else {
  24896. for (j = 0; j < n; j++) {
  24897. stack.push(data[i++]);
  24898. }
  24899. }
  24900. } else if ((op & 0xf8) === 0xb8) {
  24901. n = op - 0xb8 + 1;
  24902. if (inFDEF || inELSE) {
  24903. i += n * 2;
  24904. } else {
  24905. for (j = 0; j < n; j++) {
  24906. b = data[i++];
  24907. stack.push(b << 8 | data[i++]);
  24908. }
  24909. }
  24910. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  24911. if (!inFDEF && !inELSE) {
  24912. funcId = stack.at(-1);
  24913. if (isNaN(funcId)) {
  24914. (0, _util.info)("TT: CALL empty stack (or invalid entry).");
  24915. } else {
  24916. ttContext.functionsUsed[funcId] = true;
  24917. if (funcId in ttContext.functionsStackDeltas) {
  24918. const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
  24919. if (newStackLength < 0) {
  24920. (0, _util.warn)("TT: CALL invalid functions stack delta.");
  24921. ttContext.hintsValid = false;
  24922. return;
  24923. }
  24924. stack.length = newStackLength;
  24925. } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
  24926. callstack.push({
  24927. data,
  24928. i,
  24929. stackTop: stack.length - 1
  24930. });
  24931. functionsCalled.push(funcId);
  24932. pc = ttContext.functionsDefined[funcId];
  24933. if (!pc) {
  24934. (0, _util.warn)("TT: CALL non-existent function");
  24935. ttContext.hintsValid = false;
  24936. return;
  24937. }
  24938. data = pc.data;
  24939. i = pc.i;
  24940. }
  24941. }
  24942. }
  24943. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  24944. if (inFDEF || inELSE) {
  24945. (0, _util.warn)("TT: nested FDEFs not allowed");
  24946. tooComplexToFollowFunctions = true;
  24947. }
  24948. inFDEF = true;
  24949. lastDeff = i;
  24950. funcId = stack.pop();
  24951. ttContext.functionsDefined[funcId] = {
  24952. data,
  24953. i
  24954. };
  24955. } else if (op === 0x2d) {
  24956. if (inFDEF) {
  24957. inFDEF = false;
  24958. lastEndf = i;
  24959. } else {
  24960. pc = callstack.pop();
  24961. if (!pc) {
  24962. (0, _util.warn)("TT: ENDF bad stack");
  24963. ttContext.hintsValid = false;
  24964. return;
  24965. }
  24966. funcId = functionsCalled.pop();
  24967. data = pc.data;
  24968. i = pc.i;
  24969. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  24970. }
  24971. } else if (op === 0x89) {
  24972. if (inFDEF || inELSE) {
  24973. (0, _util.warn)("TT: nested IDEFs not allowed");
  24974. tooComplexToFollowFunctions = true;
  24975. }
  24976. inFDEF = true;
  24977. lastDeff = i;
  24978. } else if (op === 0x58) {
  24979. ++ifLevel;
  24980. } else if (op === 0x1b) {
  24981. inELSE = ifLevel;
  24982. } else if (op === 0x59) {
  24983. if (inELSE === ifLevel) {
  24984. inELSE = 0;
  24985. }
  24986. --ifLevel;
  24987. } else if (op === 0x1c) {
  24988. if (!inFDEF && !inELSE) {
  24989. const offset = stack.at(-1);
  24990. if (offset > 0) {
  24991. i += offset - 1;
  24992. }
  24993. }
  24994. }
  24995. if (!inFDEF && !inELSE) {
  24996. let stackDelta = 0;
  24997. if (op <= 0x8e) {
  24998. stackDelta = TTOpsStackDeltas[op];
  24999. } else if (op >= 0xc0 && op <= 0xdf) {
  25000. stackDelta = -1;
  25001. } else if (op >= 0xe0) {
  25002. stackDelta = -2;
  25003. }
  25004. if (op >= 0x71 && op <= 0x75) {
  25005. n = stack.pop();
  25006. if (!isNaN(n)) {
  25007. stackDelta = -n * 2;
  25008. }
  25009. }
  25010. while (stackDelta < 0 && stack.length > 0) {
  25011. stack.pop();
  25012. stackDelta++;
  25013. }
  25014. while (stackDelta > 0) {
  25015. stack.push(NaN);
  25016. stackDelta--;
  25017. }
  25018. }
  25019. }
  25020. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  25021. const content = [data];
  25022. if (i > data.length) {
  25023. content.push(new Uint8Array(i - data.length));
  25024. }
  25025. if (lastDeff > lastEndf) {
  25026. (0, _util.warn)("TT: complementing a missing function tail");
  25027. content.push(new Uint8Array([0x22, 0x2d]));
  25028. }
  25029. foldTTTable(table, content);
  25030. }
  25031. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  25032. if (ttContext.tooComplexToFollowFunctions) {
  25033. return;
  25034. }
  25035. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  25036. (0, _util.warn)("TT: more functions defined than expected");
  25037. ttContext.hintsValid = false;
  25038. return;
  25039. }
  25040. for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  25041. if (j > maxFunctionDefs) {
  25042. (0, _util.warn)("TT: invalid function id: " + j);
  25043. ttContext.hintsValid = false;
  25044. return;
  25045. }
  25046. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  25047. (0, _util.warn)("TT: undefined function: " + j);
  25048. ttContext.hintsValid = false;
  25049. return;
  25050. }
  25051. }
  25052. }
  25053. function foldTTTable(table, content) {
  25054. if (content.length > 1) {
  25055. let newLength = 0;
  25056. let j, jj;
  25057. for (j = 0, jj = content.length; j < jj; j++) {
  25058. newLength += content[j].length;
  25059. }
  25060. newLength = newLength + 3 & ~3;
  25061. const result = new Uint8Array(newLength);
  25062. let pos = 0;
  25063. for (j = 0, jj = content.length; j < jj; j++) {
  25064. result.set(content[j], pos);
  25065. pos += content[j].length;
  25066. }
  25067. table.data = result;
  25068. table.length = newLength;
  25069. }
  25070. }
  25071. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  25072. const ttContext = {
  25073. functionsDefined: [],
  25074. functionsUsed: [],
  25075. functionsStackDeltas: [],
  25076. tooComplexToFollowFunctions: false,
  25077. hintsValid: true
  25078. };
  25079. if (fpgm) {
  25080. sanitizeTTProgram(fpgm, ttContext);
  25081. }
  25082. if (prep) {
  25083. sanitizeTTProgram(prep, ttContext);
  25084. }
  25085. if (fpgm) {
  25086. checkInvalidFunctions(ttContext, maxFunctionDefs);
  25087. }
  25088. if (cvt && cvt.length & 1) {
  25089. const cvtData = new Uint8Array(cvt.length + 1);
  25090. cvtData.set(cvt.data);
  25091. cvt.data = cvtData;
  25092. }
  25093. return ttContext.hintsValid;
  25094. }
  25095. font = new _stream.Stream(new Uint8Array(font.getBytes()));
  25096. let header, tables;
  25097. if (isTrueTypeCollectionFile(font)) {
  25098. const ttcData = readTrueTypeCollectionData(font, this.name);
  25099. header = ttcData.header;
  25100. tables = ttcData.tables;
  25101. } else {
  25102. header = readOpenTypeHeader(font);
  25103. tables = readTables(font, header.numTables);
  25104. }
  25105. let cff, cffFile;
  25106. const isTrueType = !tables["CFF "];
  25107. if (!isTrueType) {
  25108. const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
  25109. if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
  25110. cffFile = new _stream.Stream(tables["CFF "].data);
  25111. cff = new _cff_font.CFFFont(cffFile, properties);
  25112. adjustWidths(properties);
  25113. return this.convert(name, cff, properties);
  25114. }
  25115. delete tables.glyf;
  25116. delete tables.loca;
  25117. delete tables.fpgm;
  25118. delete tables.prep;
  25119. delete tables["cvt "];
  25120. this.isOpenType = true;
  25121. } else {
  25122. if (!tables.loca) {
  25123. throw new _util.FormatError('Required "loca" table is not found');
  25124. }
  25125. if (!tables.glyf) {
  25126. (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
  25127. tables.glyf = {
  25128. tag: "glyf",
  25129. data: new Uint8Array(0)
  25130. };
  25131. }
  25132. this.isOpenType = false;
  25133. }
  25134. if (!tables.maxp) {
  25135. throw new _util.FormatError('Required "maxp" table is not found');
  25136. }
  25137. font.pos = (font.start || 0) + tables.maxp.offset;
  25138. const version = font.getInt32();
  25139. const numGlyphs = font.getUint16();
  25140. if (properties.scaleFactors && properties.scaleFactors.length === numGlyphs && isTrueType) {
  25141. const {
  25142. scaleFactors
  25143. } = properties;
  25144. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  25145. const glyphs = new _glyf.GlyfTable({
  25146. glyfTable: tables.glyf.data,
  25147. isGlyphLocationsLong,
  25148. locaTable: tables.loca.data,
  25149. numGlyphs
  25150. });
  25151. glyphs.scale(scaleFactors);
  25152. const {
  25153. glyf,
  25154. loca,
  25155. isLocationLong
  25156. } = glyphs.write();
  25157. tables.glyf.data = glyf;
  25158. tables.loca.data = loca;
  25159. if (isLocationLong !== !!isGlyphLocationsLong) {
  25160. tables.head.data[50] = 0;
  25161. tables.head.data[51] = isLocationLong ? 1 : 0;
  25162. }
  25163. const metrics = tables.hmtx.data;
  25164. for (let i = 0; i < numGlyphs; i++) {
  25165. const j = 4 * i;
  25166. const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1]));
  25167. metrics[j] = advanceWidth >> 8 & 0xff;
  25168. metrics[j + 1] = advanceWidth & 0xff;
  25169. const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3]));
  25170. writeSignedInt16(metrics, j + 2, lsb);
  25171. }
  25172. }
  25173. let numGlyphsOut = numGlyphs + 1;
  25174. let dupFirstEntry = true;
  25175. if (numGlyphsOut > 0xffff) {
  25176. dupFirstEntry = false;
  25177. numGlyphsOut = numGlyphs;
  25178. (0, _util.warn)("Not enough space in glyfs to duplicate first glyph.");
  25179. }
  25180. let maxFunctionDefs = 0;
  25181. let maxSizeOfInstructions = 0;
  25182. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  25183. font.pos += 8;
  25184. const maxZones = font.getUint16();
  25185. if (maxZones > 2) {
  25186. tables.maxp.data[14] = 0;
  25187. tables.maxp.data[15] = 2;
  25188. }
  25189. font.pos += 4;
  25190. maxFunctionDefs = font.getUint16();
  25191. font.pos += 4;
  25192. maxSizeOfInstructions = font.getUint16();
  25193. }
  25194. tables.maxp.data[4] = numGlyphsOut >> 8;
  25195. tables.maxp.data[5] = numGlyphsOut & 255;
  25196. const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
  25197. if (!hintsValid) {
  25198. delete tables.fpgm;
  25199. delete tables.prep;
  25200. delete tables["cvt "];
  25201. }
  25202. sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry);
  25203. if (!tables.head) {
  25204. throw new _util.FormatError('Required "head" table is not found');
  25205. }
  25206. sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
  25207. let missingGlyphs = Object.create(null);
  25208. if (isTrueType) {
  25209. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  25210. const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
  25211. missingGlyphs = glyphsInfo.missingGlyphs;
  25212. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  25213. tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  25214. tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  25215. }
  25216. }
  25217. if (!tables.hhea) {
  25218. throw new _util.FormatError('Required "hhea" table is not found');
  25219. }
  25220. if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
  25221. tables.hhea.data[10] = 0xff;
  25222. tables.hhea.data[11] = 0xff;
  25223. }
  25224. const metricsOverride = {
  25225. unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
  25226. yMax: int16(tables.head.data[42], tables.head.data[43]),
  25227. yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
  25228. ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]),
  25229. descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]),
  25230. lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9])
  25231. };
  25232. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  25233. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  25234. this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm;
  25235. if (this.cssFontInfo && this.cssFontInfo.lineHeight) {
  25236. this.lineHeight = this.cssFontInfo.metrics.lineHeight;
  25237. this.lineGap = this.cssFontInfo.metrics.lineGap;
  25238. } else {
  25239. this.lineHeight = this.ascent - this.descent + this.lineGap;
  25240. }
  25241. if (tables.post) {
  25242. readPostScriptTable(tables.post, properties, numGlyphs);
  25243. }
  25244. tables.post = {
  25245. tag: "post",
  25246. data: createPostTable(properties)
  25247. };
  25248. const charCodeToGlyphId = [];
  25249. function hasGlyph(glyphId) {
  25250. return !missingGlyphs[glyphId];
  25251. }
  25252. if (properties.composite) {
  25253. const cidToGidMap = properties.cidToGidMap || [];
  25254. const isCidToGidMapEmpty = cidToGidMap.length === 0;
  25255. properties.cMap.forEach(function (charCode, cid) {
  25256. if (typeof cid === "string") {
  25257. cid = convertCidString(charCode, cid, true);
  25258. }
  25259. if (cid > 0xffff) {
  25260. throw new _util.FormatError("Max size of CID is 65,535");
  25261. }
  25262. let glyphId = -1;
  25263. if (isCidToGidMapEmpty) {
  25264. glyphId = cid;
  25265. } else if (cidToGidMap[cid] !== undefined) {
  25266. glyphId = cidToGidMap[cid];
  25267. }
  25268. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  25269. charCodeToGlyphId[charCode] = glyphId;
  25270. }
  25271. });
  25272. } else {
  25273. const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
  25274. const cmapPlatformId = cmapTable.platformId;
  25275. const cmapEncodingId = cmapTable.encodingId;
  25276. const cmapMappings = cmapTable.mappings;
  25277. const cmapMappingsLength = cmapMappings.length;
  25278. let baseEncoding = [],
  25279. forcePostTable = false;
  25280. if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) {
  25281. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  25282. }
  25283. if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) {
  25284. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  25285. for (let charCode = 0; charCode < 256; charCode++) {
  25286. let glyphName;
  25287. if (this.differences[charCode] !== undefined) {
  25288. glyphName = this.differences[charCode];
  25289. } else if (baseEncoding.length && baseEncoding[charCode] !== "") {
  25290. glyphName = baseEncoding[charCode];
  25291. } else {
  25292. glyphName = _encodings.StandardEncoding[charCode];
  25293. }
  25294. if (!glyphName) {
  25295. continue;
  25296. }
  25297. const standardGlyphName = (0, _fonts_utils.recoverGlyphName)(glyphName, glyphsUnicodeMap);
  25298. let unicodeOrCharCode;
  25299. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  25300. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  25301. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  25302. unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
  25303. }
  25304. if (unicodeOrCharCode === undefined) {
  25305. if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  25306. const unicode = this.toUnicode.get(charCode);
  25307. if (unicode) {
  25308. unicodeOrCharCode = unicode.codePointAt(0);
  25309. }
  25310. }
  25311. if (unicodeOrCharCode === undefined) {
  25312. continue;
  25313. }
  25314. }
  25315. for (let i = 0; i < cmapMappingsLength; ++i) {
  25316. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  25317. continue;
  25318. }
  25319. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  25320. break;
  25321. }
  25322. }
  25323. } else if (cmapPlatformId === 0) {
  25324. for (let i = 0; i < cmapMappingsLength; ++i) {
  25325. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  25326. }
  25327. forcePostTable = true;
  25328. } else {
  25329. for (let i = 0; i < cmapMappingsLength; ++i) {
  25330. let charCode = cmapMappings[i].charCode;
  25331. if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) {
  25332. charCode &= 0xff;
  25333. }
  25334. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  25335. }
  25336. }
  25337. if (properties.glyphNames && (baseEncoding.length || this.differences.length)) {
  25338. for (let i = 0; i < 256; ++i) {
  25339. if (!forcePostTable && charCodeToGlyphId[i] !== undefined) {
  25340. continue;
  25341. }
  25342. const glyphName = this.differences[i] || baseEncoding[i];
  25343. if (!glyphName) {
  25344. continue;
  25345. }
  25346. const glyphId = properties.glyphNames.indexOf(glyphName);
  25347. if (glyphId > 0 && hasGlyph(glyphId)) {
  25348. charCodeToGlyphId[i] = glyphId;
  25349. }
  25350. }
  25351. }
  25352. }
  25353. if (charCodeToGlyphId.length === 0) {
  25354. charCodeToGlyphId[0] = 0;
  25355. }
  25356. let glyphZeroId = numGlyphsOut - 1;
  25357. if (!dupFirstEntry) {
  25358. glyphZeroId = 0;
  25359. }
  25360. if (!properties.cssFontInfo) {
  25361. const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId, this.toUnicode);
  25362. this.toFontChar = newMapping.toFontChar;
  25363. tables.cmap = {
  25364. tag: "cmap",
  25365. data: createCmapTable(newMapping.charCodeToGlyphId, newMapping.toUnicodeExtraMap, numGlyphsOut)
  25366. };
  25367. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
  25368. tables["OS/2"] = {
  25369. tag: "OS/2",
  25370. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  25371. };
  25372. }
  25373. }
  25374. if (!isTrueType) {
  25375. try {
  25376. cffFile = new _stream.Stream(tables["CFF "].data);
  25377. const parser = new _cff_parser.CFFParser(cffFile, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  25378. cff = parser.parse();
  25379. cff.duplicateFirstGlyph();
  25380. const compiler = new _cff_parser.CFFCompiler(cff);
  25381. tables["CFF "].data = compiler.compile();
  25382. } catch (e) {
  25383. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  25384. }
  25385. }
  25386. if (!tables.name) {
  25387. tables.name = {
  25388. tag: "name",
  25389. data: createNameTable(this.name)
  25390. };
  25391. } else {
  25392. const namePrototype = readNameTable(tables.name);
  25393. tables.name.data = createNameTable(name, namePrototype);
  25394. this.psName = namePrototype[0][6] || null;
  25395. }
  25396. const builder = new _opentype_file_builder.OpenTypeFileBuilder(header.version);
  25397. for (const tableTag in tables) {
  25398. builder.addTable(tableTag, tables[tableTag].data);
  25399. }
  25400. return builder.toArray();
  25401. }
  25402. convert(fontName, font, properties) {
  25403. properties.fixedPitch = false;
  25404. if (properties.builtInEncoding) {
  25405. adjustToUnicode(properties, properties.builtInEncoding);
  25406. }
  25407. let glyphZeroId = 1;
  25408. if (font instanceof _cff_font.CFFFont) {
  25409. glyphZeroId = font.numGlyphs - 1;
  25410. }
  25411. const mapping = font.getGlyphMapping(properties);
  25412. let newMapping = null;
  25413. let newCharCodeToGlyphId = mapping;
  25414. let toUnicodeExtraMap = null;
  25415. if (!properties.cssFontInfo) {
  25416. newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId, this.toUnicode);
  25417. this.toFontChar = newMapping.toFontChar;
  25418. newCharCodeToGlyphId = newMapping.charCodeToGlyphId;
  25419. toUnicodeExtraMap = newMapping.toUnicodeExtraMap;
  25420. }
  25421. const numGlyphs = font.numGlyphs;
  25422. function getCharCodes(charCodeToGlyphId, glyphId) {
  25423. let charCodes = null;
  25424. for (const charCode in charCodeToGlyphId) {
  25425. if (glyphId === charCodeToGlyphId[charCode]) {
  25426. if (!charCodes) {
  25427. charCodes = [];
  25428. }
  25429. charCodes.push(charCode | 0);
  25430. }
  25431. }
  25432. return charCodes;
  25433. }
  25434. function createCharCode(charCodeToGlyphId, glyphId) {
  25435. for (const charCode in charCodeToGlyphId) {
  25436. if (glyphId === charCodeToGlyphId[charCode]) {
  25437. return charCode | 0;
  25438. }
  25439. }
  25440. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  25441. return newMapping.nextAvailableFontCharCode++;
  25442. }
  25443. const seacs = font.seacs;
  25444. if (newMapping && _fonts_utils.SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  25445. const matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  25446. const charset = font.getCharset();
  25447. const seacMap = Object.create(null);
  25448. for (let glyphId in seacs) {
  25449. glyphId |= 0;
  25450. const seac = seacs[glyphId];
  25451. const baseGlyphName = _encodings.StandardEncoding[seac[2]];
  25452. const accentGlyphName = _encodings.StandardEncoding[seac[3]];
  25453. const baseGlyphId = charset.indexOf(baseGlyphName);
  25454. const accentGlyphId = charset.indexOf(accentGlyphName);
  25455. if (baseGlyphId < 0 || accentGlyphId < 0) {
  25456. continue;
  25457. }
  25458. const accentOffset = {
  25459. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  25460. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  25461. };
  25462. const charCodes = getCharCodes(mapping, glyphId);
  25463. if (!charCodes) {
  25464. continue;
  25465. }
  25466. for (let i = 0, ii = charCodes.length; i < ii; i++) {
  25467. const charCode = charCodes[i];
  25468. const charCodeToGlyphId = newMapping.charCodeToGlyphId;
  25469. const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  25470. const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  25471. seacMap[charCode] = {
  25472. baseFontCharCode,
  25473. accentFontCharCode,
  25474. accentOffset
  25475. };
  25476. }
  25477. }
  25478. properties.seacMap = seacMap;
  25479. }
  25480. const unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  25481. const builder = new _opentype_file_builder.OpenTypeFileBuilder("\x4F\x54\x54\x4F");
  25482. builder.addTable("CFF ", font.data);
  25483. builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId));
  25484. builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, toUnicodeExtraMap, numGlyphs));
  25485. 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");
  25486. 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));
  25487. builder.addTable("hmtx", function fontFieldsHmtx() {
  25488. const charstrings = font.charstrings;
  25489. const cffWidths = font.cff ? font.cff.widths : null;
  25490. let hmtx = "\x00\x00\x00\x00";
  25491. for (let i = 1, ii = numGlyphs; i < ii; i++) {
  25492. let width = 0;
  25493. if (charstrings) {
  25494. const charstring = charstrings[i - 1];
  25495. width = "width" in charstring ? charstring.width : 0;
  25496. } else if (cffWidths) {
  25497. width = Math.ceil(cffWidths[i] || 0);
  25498. }
  25499. hmtx += string16(width) + string16(0);
  25500. }
  25501. return hmtx;
  25502. }());
  25503. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  25504. builder.addTable("name", createNameTable(fontName));
  25505. builder.addTable("post", createPostTable(properties));
  25506. return builder.toArray();
  25507. }
  25508. get spaceWidth() {
  25509. const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
  25510. let width;
  25511. for (let i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  25512. const glyphName = possibleSpaceReplacements[i];
  25513. if (glyphName in this.widths) {
  25514. width = this.widths[glyphName];
  25515. break;
  25516. }
  25517. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  25518. const glyphUnicode = glyphsUnicodeMap[glyphName];
  25519. let charcode = 0;
  25520. if (this.composite && this.cMap.contains(glyphUnicode)) {
  25521. charcode = this.cMap.lookup(glyphUnicode);
  25522. if (typeof charcode === "string") {
  25523. charcode = convertCidString(glyphUnicode, charcode);
  25524. }
  25525. }
  25526. if (!charcode && this.toUnicode) {
  25527. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  25528. }
  25529. if (charcode <= 0) {
  25530. charcode = glyphUnicode;
  25531. }
  25532. width = this.widths[charcode];
  25533. if (width) {
  25534. break;
  25535. }
  25536. }
  25537. width = width || this.defaultWidth;
  25538. return (0, _util.shadow)(this, "spaceWidth", width);
  25539. }
  25540. _charToGlyph(charcode) {
  25541. let isSpace = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  25542. let fontCharCode, width, operatorListId;
  25543. let widthCode = charcode;
  25544. if (this.cMap && this.cMap.contains(charcode)) {
  25545. widthCode = this.cMap.lookup(charcode);
  25546. if (typeof widthCode === "string") {
  25547. widthCode = convertCidString(charcode, widthCode);
  25548. }
  25549. }
  25550. width = this.widths[widthCode];
  25551. if (typeof width !== "number") {
  25552. width = this.defaultWidth;
  25553. }
  25554. const vmetric = this.vmetrics && this.vmetrics[widthCode];
  25555. let unicode = this.toUnicode.get(charcode) || charcode;
  25556. if (typeof unicode === "number") {
  25557. unicode = String.fromCharCode(unicode);
  25558. }
  25559. let isInFont = this.toFontChar[charcode] !== undefined;
  25560. fontCharCode = this.toFontChar[charcode] || charcode;
  25561. if (this.missingFile) {
  25562. const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
  25563. if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
  25564. fontCharCode = 0x20;
  25565. }
  25566. fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
  25567. }
  25568. if (this.isType3Font) {
  25569. operatorListId = fontCharCode;
  25570. }
  25571. let accent = null;
  25572. if (this.seacMap && this.seacMap[charcode]) {
  25573. isInFont = true;
  25574. const seac = this.seacMap[charcode];
  25575. fontCharCode = seac.baseFontCharCode;
  25576. accent = {
  25577. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  25578. offset: seac.accentOffset
  25579. };
  25580. }
  25581. let fontChar = "";
  25582. if (typeof fontCharCode === "number") {
  25583. if (fontCharCode <= 0x10ffff) {
  25584. fontChar = String.fromCodePoint(fontCharCode);
  25585. } else {
  25586. (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
  25587. }
  25588. }
  25589. let glyph = this._glyphCache[charcode];
  25590. if (!glyph || !glyph.matchesForCache(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  25591. glyph = new Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  25592. this._glyphCache[charcode] = glyph;
  25593. }
  25594. return glyph;
  25595. }
  25596. charsToGlyphs(chars) {
  25597. let glyphs = this._charsCache[chars];
  25598. if (glyphs) {
  25599. return glyphs;
  25600. }
  25601. glyphs = [];
  25602. if (this.cMap) {
  25603. const c = Object.create(null),
  25604. ii = chars.length;
  25605. let i = 0;
  25606. while (i < ii) {
  25607. this.cMap.readCharCode(chars, i, c);
  25608. const {
  25609. charcode,
  25610. length
  25611. } = c;
  25612. i += length;
  25613. const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20);
  25614. glyphs.push(glyph);
  25615. }
  25616. } else {
  25617. for (let i = 0, ii = chars.length; i < ii; ++i) {
  25618. const charcode = chars.charCodeAt(i);
  25619. const glyph = this._charToGlyph(charcode, charcode === 0x20);
  25620. glyphs.push(glyph);
  25621. }
  25622. }
  25623. return this._charsCache[chars] = glyphs;
  25624. }
  25625. getCharPositions(chars) {
  25626. const positions = [];
  25627. if (this.cMap) {
  25628. const c = Object.create(null);
  25629. let i = 0;
  25630. while (i < chars.length) {
  25631. this.cMap.readCharCode(chars, i, c);
  25632. const length = c.length;
  25633. positions.push([i, i + length]);
  25634. i += length;
  25635. }
  25636. } else {
  25637. for (let i = 0, ii = chars.length; i < ii; ++i) {
  25638. positions.push([i, i + 1]);
  25639. }
  25640. }
  25641. return positions;
  25642. }
  25643. get glyphCacheValues() {
  25644. return Object.values(this._glyphCache);
  25645. }
  25646. encodeString(str) {
  25647. const buffers = [];
  25648. const currentBuf = [];
  25649. const hasCurrentBufErrors = () => buffers.length % 2 === 1;
  25650. const getCharCode = this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode));
  25651. for (let i = 0, ii = str.length; i < ii; i++) {
  25652. const unicode = str.codePointAt(i);
  25653. if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
  25654. i++;
  25655. }
  25656. if (this.toUnicode) {
  25657. const charCode = getCharCode(unicode);
  25658. if (charCode !== -1) {
  25659. if (hasCurrentBufErrors()) {
  25660. buffers.push(currentBuf.join(""));
  25661. currentBuf.length = 0;
  25662. }
  25663. const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
  25664. for (let j = charCodeLength - 1; j >= 0; j--) {
  25665. currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
  25666. }
  25667. continue;
  25668. }
  25669. }
  25670. if (!hasCurrentBufErrors()) {
  25671. buffers.push(currentBuf.join(""));
  25672. currentBuf.length = 0;
  25673. }
  25674. currentBuf.push(String.fromCodePoint(unicode));
  25675. }
  25676. buffers.push(currentBuf.join(""));
  25677. return buffers;
  25678. }
  25679. }
  25680. exports.Font = Font;
  25681. class ErrorFont {
  25682. constructor(error) {
  25683. this.error = error;
  25684. this.loadedName = "g_font_error";
  25685. this.missingFile = true;
  25686. }
  25687. charsToGlyphs() {
  25688. return [];
  25689. }
  25690. encodeString(chars) {
  25691. return [chars];
  25692. }
  25693. exportData() {
  25694. let extraProperties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  25695. return {
  25696. error: this.error
  25697. };
  25698. }
  25699. }
  25700. exports.ErrorFont = ErrorFont;
  25701. /***/ }),
  25702. /* 160 */
  25703. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25704. "use strict";
  25705. Object.defineProperty(exports, "__esModule", ({
  25706. value: true
  25707. }));
  25708. exports.CFFTopDict = exports.CFFStrings = exports.CFFStandardStrings = exports.CFFPrivateDict = exports.CFFParser = exports.CFFIndex = exports.CFFHeader = exports.CFFFDSelect = exports.CFFCompiler = exports.CFFCharset = exports.CFF = void 0;
  25709. var _util = __w_pdfjs_require__(2);
  25710. var _charsets = __w_pdfjs_require__(161);
  25711. var _encodings = __w_pdfjs_require__(162);
  25712. const MAX_SUBR_NESTING = 10;
  25713. 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"];
  25714. exports.CFFStandardStrings = CFFStandardStrings;
  25715. const NUM_STANDARD_CFF_STRINGS = 391;
  25716. const CharstringValidationData = [null, {
  25717. id: "hstem",
  25718. min: 2,
  25719. stackClearing: true,
  25720. stem: true
  25721. }, null, {
  25722. id: "vstem",
  25723. min: 2,
  25724. stackClearing: true,
  25725. stem: true
  25726. }, {
  25727. id: "vmoveto",
  25728. min: 1,
  25729. stackClearing: true
  25730. }, {
  25731. id: "rlineto",
  25732. min: 2,
  25733. resetStack: true
  25734. }, {
  25735. id: "hlineto",
  25736. min: 1,
  25737. resetStack: true
  25738. }, {
  25739. id: "vlineto",
  25740. min: 1,
  25741. resetStack: true
  25742. }, {
  25743. id: "rrcurveto",
  25744. min: 6,
  25745. resetStack: true
  25746. }, null, {
  25747. id: "callsubr",
  25748. min: 1,
  25749. undefStack: true
  25750. }, {
  25751. id: "return",
  25752. min: 0,
  25753. undefStack: true
  25754. }, null, null, {
  25755. id: "endchar",
  25756. min: 0,
  25757. stackClearing: true
  25758. }, null, null, null, {
  25759. id: "hstemhm",
  25760. min: 2,
  25761. stackClearing: true,
  25762. stem: true
  25763. }, {
  25764. id: "hintmask",
  25765. min: 0,
  25766. stackClearing: true
  25767. }, {
  25768. id: "cntrmask",
  25769. min: 0,
  25770. stackClearing: true
  25771. }, {
  25772. id: "rmoveto",
  25773. min: 2,
  25774. stackClearing: true
  25775. }, {
  25776. id: "hmoveto",
  25777. min: 1,
  25778. stackClearing: true
  25779. }, {
  25780. id: "vstemhm",
  25781. min: 2,
  25782. stackClearing: true,
  25783. stem: true
  25784. }, {
  25785. id: "rcurveline",
  25786. min: 8,
  25787. resetStack: true
  25788. }, {
  25789. id: "rlinecurve",
  25790. min: 8,
  25791. resetStack: true
  25792. }, {
  25793. id: "vvcurveto",
  25794. min: 4,
  25795. resetStack: true
  25796. }, {
  25797. id: "hhcurveto",
  25798. min: 4,
  25799. resetStack: true
  25800. }, null, {
  25801. id: "callgsubr",
  25802. min: 1,
  25803. undefStack: true
  25804. }, {
  25805. id: "vhcurveto",
  25806. min: 4,
  25807. resetStack: true
  25808. }, {
  25809. id: "hvcurveto",
  25810. min: 4,
  25811. resetStack: true
  25812. }];
  25813. const CharstringValidationData12 = [null, null, null, {
  25814. id: "and",
  25815. min: 2,
  25816. stackDelta: -1
  25817. }, {
  25818. id: "or",
  25819. min: 2,
  25820. stackDelta: -1
  25821. }, {
  25822. id: "not",
  25823. min: 1,
  25824. stackDelta: 0
  25825. }, null, null, null, {
  25826. id: "abs",
  25827. min: 1,
  25828. stackDelta: 0
  25829. }, {
  25830. id: "add",
  25831. min: 2,
  25832. stackDelta: -1,
  25833. stackFn(stack, index) {
  25834. stack[index - 2] = stack[index - 2] + stack[index - 1];
  25835. }
  25836. }, {
  25837. id: "sub",
  25838. min: 2,
  25839. stackDelta: -1,
  25840. stackFn(stack, index) {
  25841. stack[index - 2] = stack[index - 2] - stack[index - 1];
  25842. }
  25843. }, {
  25844. id: "div",
  25845. min: 2,
  25846. stackDelta: -1,
  25847. stackFn(stack, index) {
  25848. stack[index - 2] = stack[index - 2] / stack[index - 1];
  25849. }
  25850. }, null, {
  25851. id: "neg",
  25852. min: 1,
  25853. stackDelta: 0,
  25854. stackFn(stack, index) {
  25855. stack[index - 1] = -stack[index - 1];
  25856. }
  25857. }, {
  25858. id: "eq",
  25859. min: 2,
  25860. stackDelta: -1
  25861. }, null, null, {
  25862. id: "drop",
  25863. min: 1,
  25864. stackDelta: -1
  25865. }, null, {
  25866. id: "put",
  25867. min: 2,
  25868. stackDelta: -2
  25869. }, {
  25870. id: "get",
  25871. min: 1,
  25872. stackDelta: 0
  25873. }, {
  25874. id: "ifelse",
  25875. min: 4,
  25876. stackDelta: -3
  25877. }, {
  25878. id: "random",
  25879. min: 0,
  25880. stackDelta: 1
  25881. }, {
  25882. id: "mul",
  25883. min: 2,
  25884. stackDelta: -1,
  25885. stackFn(stack, index) {
  25886. stack[index - 2] = stack[index - 2] * stack[index - 1];
  25887. }
  25888. }, null, {
  25889. id: "sqrt",
  25890. min: 1,
  25891. stackDelta: 0
  25892. }, {
  25893. id: "dup",
  25894. min: 1,
  25895. stackDelta: 1
  25896. }, {
  25897. id: "exch",
  25898. min: 2,
  25899. stackDelta: 0
  25900. }, {
  25901. id: "index",
  25902. min: 2,
  25903. stackDelta: 0
  25904. }, {
  25905. id: "roll",
  25906. min: 3,
  25907. stackDelta: -2
  25908. }, null, null, null, {
  25909. id: "hflex",
  25910. min: 7,
  25911. resetStack: true
  25912. }, {
  25913. id: "flex",
  25914. min: 13,
  25915. resetStack: true
  25916. }, {
  25917. id: "hflex1",
  25918. min: 9,
  25919. resetStack: true
  25920. }, {
  25921. id: "flex1",
  25922. min: 11,
  25923. resetStack: true
  25924. }];
  25925. class CFFParser {
  25926. constructor(file, properties, seacAnalysisEnabled) {
  25927. this.bytes = file.getBytes();
  25928. this.properties = properties;
  25929. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  25930. }
  25931. parse() {
  25932. const properties = this.properties;
  25933. const cff = new CFF();
  25934. this.cff = cff;
  25935. const header = this.parseHeader();
  25936. const nameIndex = this.parseIndex(header.endPos);
  25937. const topDictIndex = this.parseIndex(nameIndex.endPos);
  25938. const stringIndex = this.parseIndex(topDictIndex.endPos);
  25939. const globalSubrIndex = this.parseIndex(stringIndex.endPos);
  25940. const topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  25941. const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  25942. cff.header = header.obj;
  25943. cff.names = this.parseNameIndex(nameIndex.obj);
  25944. cff.strings = this.parseStringIndex(stringIndex.obj);
  25945. cff.topDict = topDict;
  25946. cff.globalSubrIndex = globalSubrIndex.obj;
  25947. this.parsePrivateDict(cff.topDict);
  25948. cff.isCIDFont = topDict.hasName("ROS");
  25949. const charStringOffset = topDict.getByName("CharStrings");
  25950. const charStringIndex = this.parseIndex(charStringOffset).obj;
  25951. const fontMatrix = topDict.getByName("FontMatrix");
  25952. if (fontMatrix) {
  25953. properties.fontMatrix = fontMatrix;
  25954. }
  25955. const fontBBox = topDict.getByName("FontBBox");
  25956. if (fontBBox) {
  25957. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  25958. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  25959. properties.ascentScaled = true;
  25960. }
  25961. let charset, encoding;
  25962. if (cff.isCIDFont) {
  25963. const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
  25964. for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  25965. const dictRaw = fdArrayIndex.get(i);
  25966. const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  25967. this.parsePrivateDict(fontDict);
  25968. cff.fdArray.push(fontDict);
  25969. }
  25970. encoding = null;
  25971. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
  25972. cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
  25973. } else {
  25974. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
  25975. encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
  25976. }
  25977. cff.charset = charset;
  25978. cff.encoding = encoding;
  25979. const charStringsAndSeacs = this.parseCharStrings({
  25980. charStrings: charStringIndex,
  25981. localSubrIndex: topDict.privateDict.subrsIndex,
  25982. globalSubrIndex: globalSubrIndex.obj,
  25983. fdSelect: cff.fdSelect,
  25984. fdArray: cff.fdArray,
  25985. privateDict: topDict.privateDict
  25986. });
  25987. cff.charStrings = charStringsAndSeacs.charStrings;
  25988. cff.seacs = charStringsAndSeacs.seacs;
  25989. cff.widths = charStringsAndSeacs.widths;
  25990. return cff;
  25991. }
  25992. parseHeader() {
  25993. let bytes = this.bytes;
  25994. const bytesLength = bytes.length;
  25995. let offset = 0;
  25996. while (offset < bytesLength && bytes[offset] !== 1) {
  25997. ++offset;
  25998. }
  25999. if (offset >= bytesLength) {
  26000. throw new _util.FormatError("Invalid CFF header");
  26001. }
  26002. if (offset !== 0) {
  26003. (0, _util.info)("cff data is shifted");
  26004. bytes = bytes.subarray(offset);
  26005. this.bytes = bytes;
  26006. }
  26007. const major = bytes[0];
  26008. const minor = bytes[1];
  26009. const hdrSize = bytes[2];
  26010. const offSize = bytes[3];
  26011. const header = new CFFHeader(major, minor, hdrSize, offSize);
  26012. return {
  26013. obj: header,
  26014. endPos: hdrSize
  26015. };
  26016. }
  26017. parseDict(dict) {
  26018. let pos = 0;
  26019. function parseOperand() {
  26020. let value = dict[pos++];
  26021. if (value === 30) {
  26022. return parseFloatOperand();
  26023. } else if (value === 28) {
  26024. value = dict[pos++];
  26025. value = (value << 24 | dict[pos++] << 16) >> 16;
  26026. return value;
  26027. } else if (value === 29) {
  26028. value = dict[pos++];
  26029. value = value << 8 | dict[pos++];
  26030. value = value << 8 | dict[pos++];
  26031. value = value << 8 | dict[pos++];
  26032. return value;
  26033. } else if (value >= 32 && value <= 246) {
  26034. return value - 139;
  26035. } else if (value >= 247 && value <= 250) {
  26036. return (value - 247) * 256 + dict[pos++] + 108;
  26037. } else if (value >= 251 && value <= 254) {
  26038. return -((value - 251) * 256) - dict[pos++] - 108;
  26039. }
  26040. (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
  26041. return NaN;
  26042. }
  26043. function parseFloatOperand() {
  26044. let str = "";
  26045. const eof = 15;
  26046. const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
  26047. const length = dict.length;
  26048. while (pos < length) {
  26049. const b = dict[pos++];
  26050. const b1 = b >> 4;
  26051. const b2 = b & 15;
  26052. if (b1 === eof) {
  26053. break;
  26054. }
  26055. str += lookup[b1];
  26056. if (b2 === eof) {
  26057. break;
  26058. }
  26059. str += lookup[b2];
  26060. }
  26061. return parseFloat(str);
  26062. }
  26063. let operands = [];
  26064. const entries = [];
  26065. pos = 0;
  26066. const end = dict.length;
  26067. while (pos < end) {
  26068. let b = dict[pos];
  26069. if (b <= 21) {
  26070. if (b === 12) {
  26071. b = b << 8 | dict[++pos];
  26072. }
  26073. entries.push([b, operands]);
  26074. operands = [];
  26075. ++pos;
  26076. } else {
  26077. operands.push(parseOperand());
  26078. }
  26079. }
  26080. return entries;
  26081. }
  26082. parseIndex(pos) {
  26083. const cffIndex = new CFFIndex();
  26084. const bytes = this.bytes;
  26085. const count = bytes[pos++] << 8 | bytes[pos++];
  26086. const offsets = [];
  26087. let end = pos;
  26088. let i, ii;
  26089. if (count !== 0) {
  26090. const offsetSize = bytes[pos++];
  26091. const startPos = pos + (count + 1) * offsetSize - 1;
  26092. for (i = 0, ii = count + 1; i < ii; ++i) {
  26093. let offset = 0;
  26094. for (let j = 0; j < offsetSize; ++j) {
  26095. offset <<= 8;
  26096. offset += bytes[pos++];
  26097. }
  26098. offsets.push(startPos + offset);
  26099. }
  26100. end = offsets[count];
  26101. }
  26102. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  26103. const offsetStart = offsets[i];
  26104. const offsetEnd = offsets[i + 1];
  26105. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  26106. }
  26107. return {
  26108. obj: cffIndex,
  26109. endPos: end
  26110. };
  26111. }
  26112. parseNameIndex(index) {
  26113. const names = [];
  26114. for (let i = 0, ii = index.count; i < ii; ++i) {
  26115. const name = index.get(i);
  26116. names.push((0, _util.bytesToString)(name));
  26117. }
  26118. return names;
  26119. }
  26120. parseStringIndex(index) {
  26121. const strings = new CFFStrings();
  26122. for (let i = 0, ii = index.count; i < ii; ++i) {
  26123. const data = index.get(i);
  26124. strings.add((0, _util.bytesToString)(data));
  26125. }
  26126. return strings;
  26127. }
  26128. createDict(Type, dict, strings) {
  26129. const cffDict = new Type(strings);
  26130. for (let i = 0, ii = dict.length; i < ii; ++i) {
  26131. const pair = dict[i];
  26132. const key = pair[0];
  26133. const value = pair[1];
  26134. cffDict.setByKey(key, value);
  26135. }
  26136. return cffDict;
  26137. }
  26138. parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  26139. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  26140. return false;
  26141. }
  26142. let stackSize = state.stackSize;
  26143. const stack = state.stack;
  26144. const length = data.length;
  26145. for (let j = 0; j < length;) {
  26146. const value = data[j++];
  26147. let validationCommand = null;
  26148. if (value === 12) {
  26149. const q = data[j++];
  26150. if (q === 0) {
  26151. data[j - 2] = 139;
  26152. data[j - 1] = 22;
  26153. stackSize = 0;
  26154. } else {
  26155. validationCommand = CharstringValidationData12[q];
  26156. }
  26157. } else if (value === 28) {
  26158. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  26159. j += 2;
  26160. stackSize++;
  26161. } else if (value === 14) {
  26162. if (stackSize >= 4) {
  26163. stackSize -= 4;
  26164. if (this.seacAnalysisEnabled) {
  26165. state.seac = stack.slice(stackSize, stackSize + 4);
  26166. return false;
  26167. }
  26168. }
  26169. validationCommand = CharstringValidationData[value];
  26170. } else if (value >= 32 && value <= 246) {
  26171. stack[stackSize] = value - 139;
  26172. stackSize++;
  26173. } else if (value >= 247 && value <= 254) {
  26174. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  26175. j++;
  26176. stackSize++;
  26177. } else if (value === 255) {
  26178. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  26179. j += 4;
  26180. stackSize++;
  26181. } else if (value === 19 || value === 20) {
  26182. state.hints += stackSize >> 1;
  26183. j += state.hints + 7 >> 3;
  26184. stackSize %= 2;
  26185. validationCommand = CharstringValidationData[value];
  26186. } else if (value === 10 || value === 29) {
  26187. let subrsIndex;
  26188. if (value === 10) {
  26189. subrsIndex = localSubrIndex;
  26190. } else {
  26191. subrsIndex = globalSubrIndex;
  26192. }
  26193. if (!subrsIndex) {
  26194. validationCommand = CharstringValidationData[value];
  26195. (0, _util.warn)("Missing subrsIndex for " + validationCommand.id);
  26196. return false;
  26197. }
  26198. let bias = 32768;
  26199. if (subrsIndex.count < 1240) {
  26200. bias = 107;
  26201. } else if (subrsIndex.count < 33900) {
  26202. bias = 1131;
  26203. }
  26204. const subrNumber = stack[--stackSize] + bias;
  26205. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  26206. validationCommand = CharstringValidationData[value];
  26207. (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id);
  26208. return false;
  26209. }
  26210. state.stackSize = stackSize;
  26211. state.callDepth++;
  26212. const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  26213. if (!valid) {
  26214. return false;
  26215. }
  26216. state.callDepth--;
  26217. stackSize = state.stackSize;
  26218. continue;
  26219. } else if (value === 11) {
  26220. state.stackSize = stackSize;
  26221. return true;
  26222. } else if (value === 0 && j === data.length) {
  26223. data[j - 1] = 14;
  26224. validationCommand = CharstringValidationData[14];
  26225. } else {
  26226. validationCommand = CharstringValidationData[value];
  26227. }
  26228. if (validationCommand) {
  26229. if (validationCommand.stem) {
  26230. state.hints += stackSize >> 1;
  26231. if (value === 3 || value === 23) {
  26232. state.hasVStems = true;
  26233. } else if (state.hasVStems && (value === 1 || value === 18)) {
  26234. (0, _util.warn)("CFF stem hints are in wrong order");
  26235. data[j - 1] = value === 1 ? 3 : 23;
  26236. }
  26237. }
  26238. if ("min" in validationCommand) {
  26239. if (!state.undefStack && stackSize < validationCommand.min) {
  26240. (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
  26241. if (stackSize === 0) {
  26242. data[j - 1] = 14;
  26243. return true;
  26244. }
  26245. return false;
  26246. }
  26247. }
  26248. if (state.firstStackClearing && validationCommand.stackClearing) {
  26249. state.firstStackClearing = false;
  26250. stackSize -= validationCommand.min;
  26251. if (stackSize >= 2 && validationCommand.stem) {
  26252. stackSize %= 2;
  26253. } else if (stackSize > 1) {
  26254. (0, _util.warn)("Found too many parameters for stack-clearing command");
  26255. }
  26256. if (stackSize > 0) {
  26257. state.width = stack[stackSize - 1];
  26258. }
  26259. }
  26260. if ("stackDelta" in validationCommand) {
  26261. if ("stackFn" in validationCommand) {
  26262. validationCommand.stackFn(stack, stackSize);
  26263. }
  26264. stackSize += validationCommand.stackDelta;
  26265. } else if (validationCommand.stackClearing) {
  26266. stackSize = 0;
  26267. } else if (validationCommand.resetStack) {
  26268. stackSize = 0;
  26269. state.undefStack = false;
  26270. } else if (validationCommand.undefStack) {
  26271. stackSize = 0;
  26272. state.undefStack = true;
  26273. state.firstStackClearing = false;
  26274. }
  26275. }
  26276. }
  26277. state.stackSize = stackSize;
  26278. return true;
  26279. }
  26280. parseCharStrings(_ref) {
  26281. let {
  26282. charStrings,
  26283. localSubrIndex,
  26284. globalSubrIndex,
  26285. fdSelect,
  26286. fdArray,
  26287. privateDict
  26288. } = _ref;
  26289. const seacs = [];
  26290. const widths = [];
  26291. const count = charStrings.count;
  26292. for (let i = 0; i < count; i++) {
  26293. const charstring = charStrings.get(i);
  26294. const state = {
  26295. callDepth: 0,
  26296. stackSize: 0,
  26297. stack: [],
  26298. undefStack: true,
  26299. hints: 0,
  26300. firstStackClearing: true,
  26301. seac: null,
  26302. width: null,
  26303. hasVStems: false
  26304. };
  26305. let valid = true;
  26306. let localSubrToUse = null;
  26307. let privateDictToUse = privateDict;
  26308. if (fdSelect && fdArray.length) {
  26309. const fdIndex = fdSelect.getFDIndex(i);
  26310. if (fdIndex === -1) {
  26311. (0, _util.warn)("Glyph index is not in fd select.");
  26312. valid = false;
  26313. }
  26314. if (fdIndex >= fdArray.length) {
  26315. (0, _util.warn)("Invalid fd index for glyph index.");
  26316. valid = false;
  26317. }
  26318. if (valid) {
  26319. privateDictToUse = fdArray[fdIndex].privateDict;
  26320. localSubrToUse = privateDictToUse.subrsIndex;
  26321. }
  26322. } else if (localSubrIndex) {
  26323. localSubrToUse = localSubrIndex;
  26324. }
  26325. if (valid) {
  26326. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  26327. }
  26328. if (state.width !== null) {
  26329. const nominalWidth = privateDictToUse.getByName("nominalWidthX");
  26330. widths[i] = nominalWidth + state.width;
  26331. } else {
  26332. const defaultWidth = privateDictToUse.getByName("defaultWidthX");
  26333. widths[i] = defaultWidth;
  26334. }
  26335. if (state.seac !== null) {
  26336. seacs[i] = state.seac;
  26337. }
  26338. if (!valid) {
  26339. charStrings.set(i, new Uint8Array([14]));
  26340. }
  26341. }
  26342. return {
  26343. charStrings,
  26344. seacs,
  26345. widths
  26346. };
  26347. }
  26348. emptyPrivateDictionary(parentDict) {
  26349. const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  26350. parentDict.setByKey(18, [0, 0]);
  26351. parentDict.privateDict = privateDict;
  26352. }
  26353. parsePrivateDict(parentDict) {
  26354. if (!parentDict.hasName("Private")) {
  26355. this.emptyPrivateDictionary(parentDict);
  26356. return;
  26357. }
  26358. const privateOffset = parentDict.getByName("Private");
  26359. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  26360. parentDict.removeByName("Private");
  26361. return;
  26362. }
  26363. const size = privateOffset[0];
  26364. const offset = privateOffset[1];
  26365. if (size === 0 || offset >= this.bytes.length) {
  26366. this.emptyPrivateDictionary(parentDict);
  26367. return;
  26368. }
  26369. const privateDictEnd = offset + size;
  26370. const dictData = this.bytes.subarray(offset, privateDictEnd);
  26371. const dict = this.parseDict(dictData);
  26372. const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  26373. parentDict.privateDict = privateDict;
  26374. if (!privateDict.getByName("Subrs")) {
  26375. return;
  26376. }
  26377. const subrsOffset = privateDict.getByName("Subrs");
  26378. const relativeOffset = offset + subrsOffset;
  26379. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  26380. this.emptyPrivateDictionary(parentDict);
  26381. return;
  26382. }
  26383. const subrsIndex = this.parseIndex(relativeOffset);
  26384. privateDict.subrsIndex = subrsIndex.obj;
  26385. }
  26386. parseCharsets(pos, length, strings, cid) {
  26387. if (pos === 0) {
  26388. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
  26389. } else if (pos === 1) {
  26390. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
  26391. } else if (pos === 2) {
  26392. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
  26393. }
  26394. const bytes = this.bytes;
  26395. const start = pos;
  26396. const format = bytes[pos++];
  26397. const charset = [cid ? 0 : ".notdef"];
  26398. let id, count, i;
  26399. length -= 1;
  26400. switch (format) {
  26401. case 0:
  26402. for (i = 0; i < length; i++) {
  26403. id = bytes[pos++] << 8 | bytes[pos++];
  26404. charset.push(cid ? id : strings.get(id));
  26405. }
  26406. break;
  26407. case 1:
  26408. while (charset.length <= length) {
  26409. id = bytes[pos++] << 8 | bytes[pos++];
  26410. count = bytes[pos++];
  26411. for (i = 0; i <= count; i++) {
  26412. charset.push(cid ? id++ : strings.get(id++));
  26413. }
  26414. }
  26415. break;
  26416. case 2:
  26417. while (charset.length <= length) {
  26418. id = bytes[pos++] << 8 | bytes[pos++];
  26419. count = bytes[pos++] << 8 | bytes[pos++];
  26420. for (i = 0; i <= count; i++) {
  26421. charset.push(cid ? id++ : strings.get(id++));
  26422. }
  26423. }
  26424. break;
  26425. default:
  26426. throw new _util.FormatError("Unknown charset format");
  26427. }
  26428. const end = pos;
  26429. const raw = bytes.subarray(start, end);
  26430. return new CFFCharset(false, format, charset, raw);
  26431. }
  26432. parseEncoding(pos, properties, strings, charset) {
  26433. const encoding = Object.create(null);
  26434. const bytes = this.bytes;
  26435. let predefined = false;
  26436. let format, i, ii;
  26437. let raw = null;
  26438. function readSupplement() {
  26439. const supplementsCount = bytes[pos++];
  26440. for (i = 0; i < supplementsCount; i++) {
  26441. const code = bytes[pos++];
  26442. const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  26443. encoding[code] = charset.indexOf(strings.get(sid));
  26444. }
  26445. }
  26446. if (pos === 0 || pos === 1) {
  26447. predefined = true;
  26448. format = pos;
  26449. const baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
  26450. for (i = 0, ii = charset.length; i < ii; i++) {
  26451. const index = baseEncoding.indexOf(charset[i]);
  26452. if (index !== -1) {
  26453. encoding[index] = i;
  26454. }
  26455. }
  26456. } else {
  26457. const dataStart = pos;
  26458. format = bytes[pos++];
  26459. switch (format & 0x7f) {
  26460. case 0:
  26461. const glyphsCount = bytes[pos++];
  26462. for (i = 1; i <= glyphsCount; i++) {
  26463. encoding[bytes[pos++]] = i;
  26464. }
  26465. break;
  26466. case 1:
  26467. const rangesCount = bytes[pos++];
  26468. let gid = 1;
  26469. for (i = 0; i < rangesCount; i++) {
  26470. const start = bytes[pos++];
  26471. const left = bytes[pos++];
  26472. for (let j = start; j <= start + left; j++) {
  26473. encoding[j] = gid++;
  26474. }
  26475. }
  26476. break;
  26477. default:
  26478. throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
  26479. }
  26480. const dataEnd = pos;
  26481. if (format & 0x80) {
  26482. bytes[dataStart] &= 0x7f;
  26483. readSupplement();
  26484. }
  26485. raw = bytes.subarray(dataStart, dataEnd);
  26486. }
  26487. format &= 0x7f;
  26488. return new CFFEncoding(predefined, format, encoding, raw);
  26489. }
  26490. parseFDSelect(pos, length) {
  26491. const bytes = this.bytes;
  26492. const format = bytes[pos++];
  26493. const fdSelect = [];
  26494. let i;
  26495. switch (format) {
  26496. case 0:
  26497. for (i = 0; i < length; ++i) {
  26498. const id = bytes[pos++];
  26499. fdSelect.push(id);
  26500. }
  26501. break;
  26502. case 3:
  26503. const rangesCount = bytes[pos++] << 8 | bytes[pos++];
  26504. for (i = 0; i < rangesCount; ++i) {
  26505. let first = bytes[pos++] << 8 | bytes[pos++];
  26506. if (i === 0 && first !== 0) {
  26507. (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
  26508. first = 0;
  26509. }
  26510. const fdIndex = bytes[pos++];
  26511. const next = bytes[pos] << 8 | bytes[pos + 1];
  26512. for (let j = first; j < next; ++j) {
  26513. fdSelect.push(fdIndex);
  26514. }
  26515. }
  26516. pos += 2;
  26517. break;
  26518. default:
  26519. throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
  26520. }
  26521. if (fdSelect.length !== length) {
  26522. throw new _util.FormatError("parseFDSelect: Invalid font data.");
  26523. }
  26524. return new CFFFDSelect(format, fdSelect);
  26525. }
  26526. }
  26527. exports.CFFParser = CFFParser;
  26528. class CFF {
  26529. constructor() {
  26530. this.header = null;
  26531. this.names = [];
  26532. this.topDict = null;
  26533. this.strings = new CFFStrings();
  26534. this.globalSubrIndex = null;
  26535. this.encoding = null;
  26536. this.charset = null;
  26537. this.charStrings = null;
  26538. this.fdArray = [];
  26539. this.fdSelect = null;
  26540. this.isCIDFont = false;
  26541. }
  26542. duplicateFirstGlyph() {
  26543. if (this.charStrings.count >= 65535) {
  26544. (0, _util.warn)("Not enough space in charstrings to duplicate first glyph.");
  26545. return;
  26546. }
  26547. const glyphZero = this.charStrings.get(0);
  26548. this.charStrings.add(glyphZero);
  26549. if (this.isCIDFont) {
  26550. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  26551. }
  26552. }
  26553. hasGlyphId(id) {
  26554. if (id < 0 || id >= this.charStrings.count) {
  26555. return false;
  26556. }
  26557. const glyph = this.charStrings.get(id);
  26558. return glyph.length > 0;
  26559. }
  26560. }
  26561. exports.CFF = CFF;
  26562. class CFFHeader {
  26563. constructor(major, minor, hdrSize, offSize) {
  26564. this.major = major;
  26565. this.minor = minor;
  26566. this.hdrSize = hdrSize;
  26567. this.offSize = offSize;
  26568. }
  26569. }
  26570. exports.CFFHeader = CFFHeader;
  26571. class CFFStrings {
  26572. constructor() {
  26573. this.strings = [];
  26574. }
  26575. get(index) {
  26576. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  26577. return CFFStandardStrings[index];
  26578. }
  26579. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  26580. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  26581. }
  26582. return CFFStandardStrings[0];
  26583. }
  26584. getSID(str) {
  26585. let index = CFFStandardStrings.indexOf(str);
  26586. if (index !== -1) {
  26587. return index;
  26588. }
  26589. index = this.strings.indexOf(str);
  26590. if (index !== -1) {
  26591. return index + NUM_STANDARD_CFF_STRINGS;
  26592. }
  26593. return -1;
  26594. }
  26595. add(value) {
  26596. this.strings.push(value);
  26597. }
  26598. get count() {
  26599. return this.strings.length;
  26600. }
  26601. }
  26602. exports.CFFStrings = CFFStrings;
  26603. class CFFIndex {
  26604. constructor() {
  26605. this.objects = [];
  26606. this.length = 0;
  26607. }
  26608. add(data) {
  26609. this.length += data.length;
  26610. this.objects.push(data);
  26611. }
  26612. set(index, data) {
  26613. this.length += data.length - this.objects[index].length;
  26614. this.objects[index] = data;
  26615. }
  26616. get(index) {
  26617. return this.objects[index];
  26618. }
  26619. get count() {
  26620. return this.objects.length;
  26621. }
  26622. }
  26623. exports.CFFIndex = CFFIndex;
  26624. class CFFDict {
  26625. constructor(tables, strings) {
  26626. this.keyToNameMap = tables.keyToNameMap;
  26627. this.nameToKeyMap = tables.nameToKeyMap;
  26628. this.defaults = tables.defaults;
  26629. this.types = tables.types;
  26630. this.opcodes = tables.opcodes;
  26631. this.order = tables.order;
  26632. this.strings = strings;
  26633. this.values = Object.create(null);
  26634. }
  26635. setByKey(key, value) {
  26636. if (!(key in this.keyToNameMap)) {
  26637. return false;
  26638. }
  26639. const valueLength = value.length;
  26640. if (valueLength === 0) {
  26641. return true;
  26642. }
  26643. for (let i = 0; i < valueLength; i++) {
  26644. if (isNaN(value[i])) {
  26645. (0, _util.warn)('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
  26646. return true;
  26647. }
  26648. }
  26649. const type = this.types[key];
  26650. if (type === "num" || type === "sid" || type === "offset") {
  26651. value = value[0];
  26652. }
  26653. this.values[key] = value;
  26654. return true;
  26655. }
  26656. setByName(name, value) {
  26657. if (!(name in this.nameToKeyMap)) {
  26658. throw new _util.FormatError(`Invalid dictionary name "${name}"`);
  26659. }
  26660. this.values[this.nameToKeyMap[name]] = value;
  26661. }
  26662. hasName(name) {
  26663. return this.nameToKeyMap[name] in this.values;
  26664. }
  26665. getByName(name) {
  26666. if (!(name in this.nameToKeyMap)) {
  26667. throw new _util.FormatError(`Invalid dictionary name ${name}"`);
  26668. }
  26669. const key = this.nameToKeyMap[name];
  26670. if (!(key in this.values)) {
  26671. return this.defaults[key];
  26672. }
  26673. return this.values[key];
  26674. }
  26675. removeByName(name) {
  26676. delete this.values[this.nameToKeyMap[name]];
  26677. }
  26678. static createTables(layout) {
  26679. const tables = {
  26680. keyToNameMap: {},
  26681. nameToKeyMap: {},
  26682. defaults: {},
  26683. types: {},
  26684. opcodes: {},
  26685. order: []
  26686. };
  26687. for (let i = 0, ii = layout.length; i < ii; ++i) {
  26688. const entry = layout[i];
  26689. const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  26690. tables.keyToNameMap[key] = entry[1];
  26691. tables.nameToKeyMap[entry[1]] = key;
  26692. tables.types[key] = entry[2];
  26693. tables.defaults[key] = entry[3];
  26694. tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
  26695. tables.order.push(key);
  26696. }
  26697. return tables;
  26698. }
  26699. }
  26700. 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]];
  26701. class CFFTopDict extends CFFDict {
  26702. static get tables() {
  26703. return (0, _util.shadow)(this, "tables", this.createTables(CFFTopDictLayout));
  26704. }
  26705. constructor(strings) {
  26706. super(CFFTopDict.tables, strings);
  26707. this.privateDict = null;
  26708. }
  26709. }
  26710. exports.CFFTopDict = CFFTopDict;
  26711. 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]];
  26712. class CFFPrivateDict extends CFFDict {
  26713. static get tables() {
  26714. return (0, _util.shadow)(this, "tables", this.createTables(CFFPrivateDictLayout));
  26715. }
  26716. constructor(strings) {
  26717. super(CFFPrivateDict.tables, strings);
  26718. this.subrsIndex = null;
  26719. }
  26720. }
  26721. exports.CFFPrivateDict = CFFPrivateDict;
  26722. const CFFCharsetPredefinedTypes = {
  26723. ISO_ADOBE: 0,
  26724. EXPERT: 1,
  26725. EXPERT_SUBSET: 2
  26726. };
  26727. class CFFCharset {
  26728. constructor(predefined, format, charset, raw) {
  26729. this.predefined = predefined;
  26730. this.format = format;
  26731. this.charset = charset;
  26732. this.raw = raw;
  26733. }
  26734. }
  26735. exports.CFFCharset = CFFCharset;
  26736. class CFFEncoding {
  26737. constructor(predefined, format, encoding, raw) {
  26738. this.predefined = predefined;
  26739. this.format = format;
  26740. this.encoding = encoding;
  26741. this.raw = raw;
  26742. }
  26743. }
  26744. class CFFFDSelect {
  26745. constructor(format, fdSelect) {
  26746. this.format = format;
  26747. this.fdSelect = fdSelect;
  26748. }
  26749. getFDIndex(glyphIndex) {
  26750. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  26751. return -1;
  26752. }
  26753. return this.fdSelect[glyphIndex];
  26754. }
  26755. }
  26756. exports.CFFFDSelect = CFFFDSelect;
  26757. class CFFOffsetTracker {
  26758. constructor() {
  26759. this.offsets = Object.create(null);
  26760. }
  26761. isTracking(key) {
  26762. return key in this.offsets;
  26763. }
  26764. track(key, location) {
  26765. if (key in this.offsets) {
  26766. throw new _util.FormatError(`Already tracking location of ${key}`);
  26767. }
  26768. this.offsets[key] = location;
  26769. }
  26770. offset(value) {
  26771. for (const key in this.offsets) {
  26772. this.offsets[key] += value;
  26773. }
  26774. }
  26775. setEntryLocation(key, values, output) {
  26776. if (!(key in this.offsets)) {
  26777. throw new _util.FormatError(`Not tracking location of ${key}`);
  26778. }
  26779. const data = output.data;
  26780. const dataOffset = this.offsets[key];
  26781. const size = 5;
  26782. for (let i = 0, ii = values.length; i < ii; ++i) {
  26783. const offset0 = i * size + dataOffset;
  26784. const offset1 = offset0 + 1;
  26785. const offset2 = offset0 + 2;
  26786. const offset3 = offset0 + 3;
  26787. const offset4 = offset0 + 4;
  26788. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  26789. throw new _util.FormatError("writing to an offset that is not empty");
  26790. }
  26791. const value = values[i];
  26792. data[offset0] = 0x1d;
  26793. data[offset1] = value >> 24 & 0xff;
  26794. data[offset2] = value >> 16 & 0xff;
  26795. data[offset3] = value >> 8 & 0xff;
  26796. data[offset4] = value & 0xff;
  26797. }
  26798. }
  26799. }
  26800. class CFFCompiler {
  26801. constructor(cff) {
  26802. this.cff = cff;
  26803. }
  26804. compile() {
  26805. const cff = this.cff;
  26806. const output = {
  26807. data: [],
  26808. length: 0,
  26809. add(data) {
  26810. this.data = this.data.concat(data);
  26811. this.length = this.data.length;
  26812. }
  26813. };
  26814. const header = this.compileHeader(cff.header);
  26815. output.add(header);
  26816. const nameIndex = this.compileNameIndex(cff.names);
  26817. output.add(nameIndex);
  26818. if (cff.isCIDFont) {
  26819. if (cff.topDict.hasName("FontMatrix")) {
  26820. const base = cff.topDict.getByName("FontMatrix");
  26821. cff.topDict.removeByName("FontMatrix");
  26822. for (let i = 0, ii = cff.fdArray.length; i < ii; i++) {
  26823. const subDict = cff.fdArray[i];
  26824. let matrix = base.slice(0);
  26825. if (subDict.hasName("FontMatrix")) {
  26826. matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix"));
  26827. }
  26828. subDict.setByName("FontMatrix", matrix);
  26829. }
  26830. }
  26831. }
  26832. const xuid = cff.topDict.getByName("XUID");
  26833. if (xuid && xuid.length > 16) {
  26834. cff.topDict.removeByName("XUID");
  26835. }
  26836. cff.topDict.setByName("charset", 0);
  26837. let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  26838. output.add(compiled.output);
  26839. const topDictTracker = compiled.trackers[0];
  26840. const stringIndex = this.compileStringIndex(cff.strings.strings);
  26841. output.add(stringIndex);
  26842. const globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  26843. output.add(globalSubrIndex);
  26844. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  26845. if (cff.encoding.predefined) {
  26846. topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
  26847. } else {
  26848. const encoding = this.compileEncoding(cff.encoding);
  26849. topDictTracker.setEntryLocation("Encoding", [output.length], output);
  26850. output.add(encoding);
  26851. }
  26852. }
  26853. const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
  26854. topDictTracker.setEntryLocation("charset", [output.length], output);
  26855. output.add(charset);
  26856. const charStrings = this.compileCharStrings(cff.charStrings);
  26857. topDictTracker.setEntryLocation("CharStrings", [output.length], output);
  26858. output.add(charStrings);
  26859. if (cff.isCIDFont) {
  26860. topDictTracker.setEntryLocation("FDSelect", [output.length], output);
  26861. const fdSelect = this.compileFDSelect(cff.fdSelect);
  26862. output.add(fdSelect);
  26863. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  26864. topDictTracker.setEntryLocation("FDArray", [output.length], output);
  26865. output.add(compiled.output);
  26866. const fontDictTrackers = compiled.trackers;
  26867. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  26868. }
  26869. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  26870. output.add([0]);
  26871. return output.data;
  26872. }
  26873. encodeNumber(value) {
  26874. if (Number.isInteger(value)) {
  26875. return this.encodeInteger(value);
  26876. }
  26877. return this.encodeFloat(value);
  26878. }
  26879. static get EncodeFloatRegExp() {
  26880. return (0, _util.shadow)(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/);
  26881. }
  26882. encodeFloat(num) {
  26883. let value = num.toString();
  26884. const m = CFFCompiler.EncodeFloatRegExp.exec(value);
  26885. if (m) {
  26886. const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
  26887. value = (Math.round(num * epsilon) / epsilon).toString();
  26888. }
  26889. let nibbles = "";
  26890. let i, ii;
  26891. for (i = 0, ii = value.length; i < ii; ++i) {
  26892. const a = value[i];
  26893. if (a === "e") {
  26894. nibbles += value[++i] === "-" ? "c" : "b";
  26895. } else if (a === ".") {
  26896. nibbles += "a";
  26897. } else if (a === "-") {
  26898. nibbles += "e";
  26899. } else {
  26900. nibbles += a;
  26901. }
  26902. }
  26903. nibbles += nibbles.length & 1 ? "f" : "ff";
  26904. const out = [30];
  26905. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  26906. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  26907. }
  26908. return out;
  26909. }
  26910. encodeInteger(value) {
  26911. let code;
  26912. if (value >= -107 && value <= 107) {
  26913. code = [value + 139];
  26914. } else if (value >= 108 && value <= 1131) {
  26915. value -= 108;
  26916. code = [(value >> 8) + 247, value & 0xff];
  26917. } else if (value >= -1131 && value <= -108) {
  26918. value = -value - 108;
  26919. code = [(value >> 8) + 251, value & 0xff];
  26920. } else if (value >= -32768 && value <= 32767) {
  26921. code = [0x1c, value >> 8 & 0xff, value & 0xff];
  26922. } else {
  26923. code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
  26924. }
  26925. return code;
  26926. }
  26927. compileHeader(header) {
  26928. return [header.major, header.minor, 4, header.offSize];
  26929. }
  26930. compileNameIndex(names) {
  26931. const nameIndex = new CFFIndex();
  26932. for (let i = 0, ii = names.length; i < ii; ++i) {
  26933. const name = names[i];
  26934. const length = Math.min(name.length, 127);
  26935. let sanitizedName = new Array(length);
  26936. for (let j = 0; j < length; j++) {
  26937. let char = name[j];
  26938. if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
  26939. char = "_";
  26940. }
  26941. sanitizedName[j] = char;
  26942. }
  26943. sanitizedName = sanitizedName.join("");
  26944. if (sanitizedName === "") {
  26945. sanitizedName = "Bad_Font_Name";
  26946. }
  26947. nameIndex.add((0, _util.stringToBytes)(sanitizedName));
  26948. }
  26949. return this.compileIndex(nameIndex);
  26950. }
  26951. compileTopDicts(dicts, length, removeCidKeys) {
  26952. const fontDictTrackers = [];
  26953. let fdArrayIndex = new CFFIndex();
  26954. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  26955. const fontDict = dicts[i];
  26956. if (removeCidKeys) {
  26957. fontDict.removeByName("CIDFontVersion");
  26958. fontDict.removeByName("CIDFontRevision");
  26959. fontDict.removeByName("CIDFontType");
  26960. fontDict.removeByName("CIDCount");
  26961. fontDict.removeByName("UIDBase");
  26962. }
  26963. const fontDictTracker = new CFFOffsetTracker();
  26964. const fontDictData = this.compileDict(fontDict, fontDictTracker);
  26965. fontDictTrackers.push(fontDictTracker);
  26966. fdArrayIndex.add(fontDictData);
  26967. fontDictTracker.offset(length);
  26968. }
  26969. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  26970. return {
  26971. trackers: fontDictTrackers,
  26972. output: fdArrayIndex
  26973. };
  26974. }
  26975. compilePrivateDicts(dicts, trackers, output) {
  26976. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  26977. const fontDict = dicts[i];
  26978. const privateDict = fontDict.privateDict;
  26979. if (!privateDict || !fontDict.hasName("Private")) {
  26980. throw new _util.FormatError("There must be a private dictionary.");
  26981. }
  26982. const privateDictTracker = new CFFOffsetTracker();
  26983. const privateDictData = this.compileDict(privateDict, privateDictTracker);
  26984. let outputLength = output.length;
  26985. privateDictTracker.offset(outputLength);
  26986. if (!privateDictData.length) {
  26987. outputLength = 0;
  26988. }
  26989. trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
  26990. output.add(privateDictData);
  26991. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  26992. const subrs = this.compileIndex(privateDict.subrsIndex);
  26993. privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
  26994. output.add(subrs);
  26995. }
  26996. }
  26997. }
  26998. compileDict(dict, offsetTracker) {
  26999. const out = [];
  27000. for (const key of dict.order) {
  27001. if (!(key in dict.values)) {
  27002. continue;
  27003. }
  27004. let values = dict.values[key];
  27005. let types = dict.types[key];
  27006. if (!Array.isArray(types)) {
  27007. types = [types];
  27008. }
  27009. if (!Array.isArray(values)) {
  27010. values = [values];
  27011. }
  27012. if (values.length === 0) {
  27013. continue;
  27014. }
  27015. for (let j = 0, jj = types.length; j < jj; ++j) {
  27016. const type = types[j];
  27017. const value = values[j];
  27018. switch (type) {
  27019. case "num":
  27020. case "sid":
  27021. out.push(...this.encodeNumber(value));
  27022. break;
  27023. case "offset":
  27024. const name = dict.keyToNameMap[key];
  27025. if (!offsetTracker.isTracking(name)) {
  27026. offsetTracker.track(name, out.length);
  27027. }
  27028. out.push(0x1d, 0, 0, 0, 0);
  27029. break;
  27030. case "array":
  27031. case "delta":
  27032. out.push(...this.encodeNumber(value));
  27033. for (let k = 1, kk = values.length; k < kk; ++k) {
  27034. out.push(...this.encodeNumber(values[k]));
  27035. }
  27036. break;
  27037. default:
  27038. throw new _util.FormatError(`Unknown data type of ${type}`);
  27039. }
  27040. }
  27041. out.push(...dict.opcodes[key]);
  27042. }
  27043. return out;
  27044. }
  27045. compileStringIndex(strings) {
  27046. const stringIndex = new CFFIndex();
  27047. for (let i = 0, ii = strings.length; i < ii; ++i) {
  27048. stringIndex.add((0, _util.stringToBytes)(strings[i]));
  27049. }
  27050. return this.compileIndex(stringIndex);
  27051. }
  27052. compileGlobalSubrIndex() {
  27053. const globalSubrIndex = this.cff.globalSubrIndex;
  27054. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  27055. }
  27056. compileCharStrings(charStrings) {
  27057. const charStringsIndex = new CFFIndex();
  27058. for (let i = 0; i < charStrings.count; i++) {
  27059. const glyph = charStrings.get(i);
  27060. if (glyph.length === 0) {
  27061. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  27062. continue;
  27063. }
  27064. charStringsIndex.add(glyph);
  27065. }
  27066. return this.compileIndex(charStringsIndex);
  27067. }
  27068. compileCharset(charset, numGlyphs, strings, isCIDFont) {
  27069. let out;
  27070. const numGlyphsLessNotDef = numGlyphs - 1;
  27071. if (isCIDFont) {
  27072. out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
  27073. } else {
  27074. const length = 1 + numGlyphsLessNotDef * 2;
  27075. out = new Uint8Array(length);
  27076. out[0] = 0;
  27077. let charsetIndex = 0;
  27078. const numCharsets = charset.charset.length;
  27079. let warned = false;
  27080. for (let i = 1; i < out.length; i += 2) {
  27081. let sid = 0;
  27082. if (charsetIndex < numCharsets) {
  27083. const name = charset.charset[charsetIndex++];
  27084. sid = strings.getSID(name);
  27085. if (sid === -1) {
  27086. sid = 0;
  27087. if (!warned) {
  27088. warned = true;
  27089. (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
  27090. }
  27091. }
  27092. }
  27093. out[i] = sid >> 8 & 0xff;
  27094. out[i + 1] = sid & 0xff;
  27095. }
  27096. }
  27097. return this.compileTypedArray(out);
  27098. }
  27099. compileEncoding(encoding) {
  27100. return this.compileTypedArray(encoding.raw);
  27101. }
  27102. compileFDSelect(fdSelect) {
  27103. const format = fdSelect.format;
  27104. let out, i;
  27105. switch (format) {
  27106. case 0:
  27107. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  27108. out[0] = format;
  27109. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  27110. out[i + 1] = fdSelect.fdSelect[i];
  27111. }
  27112. break;
  27113. case 3:
  27114. const start = 0;
  27115. let lastFD = fdSelect.fdSelect[0];
  27116. const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
  27117. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  27118. const currentFD = fdSelect.fdSelect[i];
  27119. if (currentFD !== lastFD) {
  27120. ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
  27121. lastFD = currentFD;
  27122. }
  27123. }
  27124. const numRanges = (ranges.length - 3) / 3;
  27125. ranges[1] = numRanges >> 8 & 0xff;
  27126. ranges[2] = numRanges & 0xff;
  27127. ranges.push(i >> 8 & 0xff, i & 0xff);
  27128. out = new Uint8Array(ranges);
  27129. break;
  27130. }
  27131. return this.compileTypedArray(out);
  27132. }
  27133. compileTypedArray(data) {
  27134. const out = [];
  27135. for (let i = 0, ii = data.length; i < ii; ++i) {
  27136. out[i] = data[i];
  27137. }
  27138. return out;
  27139. }
  27140. compileIndex(index) {
  27141. let trackers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  27142. const objects = index.objects;
  27143. const count = objects.length;
  27144. if (count === 0) {
  27145. return [0, 0];
  27146. }
  27147. const data = [count >> 8 & 0xff, count & 0xff];
  27148. let lastOffset = 1,
  27149. i;
  27150. for (i = 0; i < count; ++i) {
  27151. lastOffset += objects[i].length;
  27152. }
  27153. let offsetSize;
  27154. if (lastOffset < 0x100) {
  27155. offsetSize = 1;
  27156. } else if (lastOffset < 0x10000) {
  27157. offsetSize = 2;
  27158. } else if (lastOffset < 0x1000000) {
  27159. offsetSize = 3;
  27160. } else {
  27161. offsetSize = 4;
  27162. }
  27163. data.push(offsetSize);
  27164. let relativeOffset = 1;
  27165. for (i = 0; i < count + 1; i++) {
  27166. if (offsetSize === 1) {
  27167. data.push(relativeOffset & 0xff);
  27168. } else if (offsetSize === 2) {
  27169. data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  27170. } else if (offsetSize === 3) {
  27171. data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  27172. } else {
  27173. data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  27174. }
  27175. if (objects[i]) {
  27176. relativeOffset += objects[i].length;
  27177. }
  27178. }
  27179. for (i = 0; i < count; i++) {
  27180. if (trackers[i]) {
  27181. trackers[i].offset(data.length);
  27182. }
  27183. for (let j = 0, jj = objects[i].length; j < jj; j++) {
  27184. data.push(objects[i][j]);
  27185. }
  27186. }
  27187. return data;
  27188. }
  27189. }
  27190. exports.CFFCompiler = CFFCompiler;
  27191. /***/ }),
  27192. /* 161 */
  27193. /***/ ((__unused_webpack_module, exports) => {
  27194. "use strict";
  27195. Object.defineProperty(exports, "__esModule", ({
  27196. value: true
  27197. }));
  27198. exports.ISOAdobeCharset = exports.ExpertSubsetCharset = exports.ExpertCharset = void 0;
  27199. 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"];
  27200. exports.ISOAdobeCharset = ISOAdobeCharset;
  27201. 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"];
  27202. exports.ExpertCharset = ExpertCharset;
  27203. 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"];
  27204. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  27205. /***/ }),
  27206. /* 162 */
  27207. /***/ ((__unused_webpack_module, exports) => {
  27208. "use strict";
  27209. Object.defineProperty(exports, "__esModule", ({
  27210. value: true
  27211. }));
  27212. exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0;
  27213. exports.getEncoding = getEncoding;
  27214. 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"];
  27215. exports.ExpertEncoding = ExpertEncoding;
  27216. 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", "", "", "", ""];
  27217. 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"];
  27218. exports.MacRomanEncoding = MacRomanEncoding;
  27219. 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", "", "", "", ""];
  27220. exports.StandardEncoding = StandardEncoding;
  27221. 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"];
  27222. exports.WinAnsiEncoding = WinAnsiEncoding;
  27223. 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", ""];
  27224. exports.SymbolSetEncoding = SymbolSetEncoding;
  27225. 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", ""];
  27226. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  27227. function getEncoding(encodingName) {
  27228. switch (encodingName) {
  27229. case "WinAnsiEncoding":
  27230. return WinAnsiEncoding;
  27231. case "StandardEncoding":
  27232. return StandardEncoding;
  27233. case "MacRomanEncoding":
  27234. return MacRomanEncoding;
  27235. case "SymbolSetEncoding":
  27236. return SymbolSetEncoding;
  27237. case "ZapfDingbatsEncoding":
  27238. return ZapfDingbatsEncoding;
  27239. case "ExpertEncoding":
  27240. return ExpertEncoding;
  27241. case "MacExpertEncoding":
  27242. return MacExpertEncoding;
  27243. default:
  27244. return null;
  27245. }
  27246. }
  27247. /***/ }),
  27248. /* 163 */
  27249. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  27250. "use strict";
  27251. Object.defineProperty(exports, "__esModule", ({
  27252. value: true
  27253. }));
  27254. exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0;
  27255. exports.getFontType = getFontType;
  27256. exports.normalizeFontName = normalizeFontName;
  27257. exports.recoverGlyphName = recoverGlyphName;
  27258. exports.type1FontGlyphMapping = type1FontGlyphMapping;
  27259. var _util = __w_pdfjs_require__(2);
  27260. var _encodings = __w_pdfjs_require__(162);
  27261. var _glyphlist = __w_pdfjs_require__(164);
  27262. var _unicode = __w_pdfjs_require__(165);
  27263. const SEAC_ANALYSIS_ENABLED = true;
  27264. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  27265. const FontFlags = {
  27266. FixedPitch: 1,
  27267. Serif: 2,
  27268. Symbolic: 4,
  27269. Script: 8,
  27270. Nonsymbolic: 32,
  27271. Italic: 64,
  27272. AllCap: 65536,
  27273. SmallCap: 131072,
  27274. ForceBold: 262144
  27275. };
  27276. exports.FontFlags = FontFlags;
  27277. 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"];
  27278. exports.MacStandardGlyphOrdering = MacStandardGlyphOrdering;
  27279. function getFontType(type, subtype) {
  27280. let isStandardFont = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  27281. switch (type) {
  27282. case "Type1":
  27283. if (isStandardFont) {
  27284. return _util.FontType.TYPE1STANDARD;
  27285. }
  27286. return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1;
  27287. case "CIDFontType0":
  27288. return subtype === "CIDFontType0C" ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0;
  27289. case "OpenType":
  27290. return _util.FontType.OPENTYPE;
  27291. case "TrueType":
  27292. return _util.FontType.TRUETYPE;
  27293. case "CIDFontType2":
  27294. return _util.FontType.CIDFONTTYPE2;
  27295. case "MMType1":
  27296. return _util.FontType.MMTYPE1;
  27297. case "Type0":
  27298. return _util.FontType.TYPE0;
  27299. default:
  27300. return _util.FontType.UNKNOWN;
  27301. }
  27302. }
  27303. function recoverGlyphName(name, glyphsUnicodeMap) {
  27304. if (glyphsUnicodeMap[name] !== undefined) {
  27305. return name;
  27306. }
  27307. const unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
  27308. if (unicode !== -1) {
  27309. for (const key in glyphsUnicodeMap) {
  27310. if (glyphsUnicodeMap[key] === unicode) {
  27311. return key;
  27312. }
  27313. }
  27314. }
  27315. (0, _util.info)("Unable to recover a standard glyph name for: " + name);
  27316. return name;
  27317. }
  27318. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  27319. const charCodeToGlyphId = Object.create(null);
  27320. let glyphId, charCode, baseEncoding;
  27321. const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  27322. if (properties.isInternalFont) {
  27323. baseEncoding = builtInEncoding;
  27324. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  27325. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  27326. if (glyphId >= 0) {
  27327. charCodeToGlyphId[charCode] = glyphId;
  27328. } else {
  27329. charCodeToGlyphId[charCode] = 0;
  27330. }
  27331. }
  27332. } else if (properties.baseEncodingName) {
  27333. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  27334. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  27335. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  27336. if (glyphId >= 0) {
  27337. charCodeToGlyphId[charCode] = glyphId;
  27338. } else {
  27339. charCodeToGlyphId[charCode] = 0;
  27340. }
  27341. }
  27342. } else if (isSymbolicFont) {
  27343. for (charCode in builtInEncoding) {
  27344. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  27345. }
  27346. } else {
  27347. baseEncoding = _encodings.StandardEncoding;
  27348. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  27349. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  27350. if (glyphId >= 0) {
  27351. charCodeToGlyphId[charCode] = glyphId;
  27352. } else {
  27353. charCodeToGlyphId[charCode] = 0;
  27354. }
  27355. }
  27356. }
  27357. const differences = properties.differences;
  27358. let glyphsUnicodeMap;
  27359. if (differences) {
  27360. for (charCode in differences) {
  27361. const glyphName = differences[charCode];
  27362. glyphId = glyphNames.indexOf(glyphName);
  27363. if (glyphId === -1) {
  27364. if (!glyphsUnicodeMap) {
  27365. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  27366. }
  27367. const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  27368. if (standardGlyphName !== glyphName) {
  27369. glyphId = glyphNames.indexOf(standardGlyphName);
  27370. }
  27371. }
  27372. if (glyphId >= 0) {
  27373. charCodeToGlyphId[charCode] = glyphId;
  27374. } else {
  27375. charCodeToGlyphId[charCode] = 0;
  27376. }
  27377. }
  27378. }
  27379. return charCodeToGlyphId;
  27380. }
  27381. function normalizeFontName(name) {
  27382. return name.replace(/[,_]/g, "-").replace(/\s/g, "");
  27383. }
  27384. /***/ }),
  27385. /* 164 */
  27386. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  27387. "use strict";
  27388. __w_pdfjs_require__.r(__webpack_exports__);
  27389. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  27390. /* harmony export */ "getDingbatsGlyphsUnicode": () => (/* binding */ getDingbatsGlyphsUnicode),
  27391. /* harmony export */ "getGlyphsUnicode": () => (/* binding */ getGlyphsUnicode)
  27392. /* harmony export */ });
  27393. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(131);
  27394. const getGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  27395. return [
  27396. "A",
  27397. 0x0041,
  27398. "AE",
  27399. 0x00c6,
  27400. "AEacute",
  27401. 0x01fc,
  27402. "AEmacron",
  27403. 0x01e2,
  27404. "AEsmall",
  27405. 0xf7e6,
  27406. "Aacute",
  27407. 0x00c1,
  27408. "Aacutesmall",
  27409. 0xf7e1,
  27410. "Abreve",
  27411. 0x0102,
  27412. "Abreveacute",
  27413. 0x1eae,
  27414. "Abrevecyrillic",
  27415. 0x04d0,
  27416. "Abrevedotbelow",
  27417. 0x1eb6,
  27418. "Abrevegrave",
  27419. 0x1eb0,
  27420. "Abrevehookabove",
  27421. 0x1eb2,
  27422. "Abrevetilde",
  27423. 0x1eb4,
  27424. "Acaron",
  27425. 0x01cd,
  27426. "Acircle",
  27427. 0x24b6,
  27428. "Acircumflex",
  27429. 0x00c2,
  27430. "Acircumflexacute",
  27431. 0x1ea4,
  27432. "Acircumflexdotbelow",
  27433. 0x1eac,
  27434. "Acircumflexgrave",
  27435. 0x1ea6,
  27436. "Acircumflexhookabove",
  27437. 0x1ea8,
  27438. "Acircumflexsmall",
  27439. 0xf7e2,
  27440. "Acircumflextilde",
  27441. 0x1eaa,
  27442. "Acute",
  27443. 0xf6c9,
  27444. "Acutesmall",
  27445. 0xf7b4,
  27446. "Acyrillic",
  27447. 0x0410,
  27448. "Adblgrave",
  27449. 0x0200,
  27450. "Adieresis",
  27451. 0x00c4,
  27452. "Adieresiscyrillic",
  27453. 0x04d2,
  27454. "Adieresismacron",
  27455. 0x01de,
  27456. "Adieresissmall",
  27457. 0xf7e4,
  27458. "Adotbelow",
  27459. 0x1ea0,
  27460. "Adotmacron",
  27461. 0x01e0,
  27462. "Agrave",
  27463. 0x00c0,
  27464. "Agravesmall",
  27465. 0xf7e0,
  27466. "Ahookabove",
  27467. 0x1ea2,
  27468. "Aiecyrillic",
  27469. 0x04d4,
  27470. "Ainvertedbreve",
  27471. 0x0202,
  27472. "Alpha",
  27473. 0x0391,
  27474. "Alphatonos",
  27475. 0x0386,
  27476. "Amacron",
  27477. 0x0100,
  27478. "Amonospace",
  27479. 0xff21,
  27480. "Aogonek",
  27481. 0x0104,
  27482. "Aring",
  27483. 0x00c5,
  27484. "Aringacute",
  27485. 0x01fa,
  27486. "Aringbelow",
  27487. 0x1e00,
  27488. "Aringsmall",
  27489. 0xf7e5,
  27490. "Asmall",
  27491. 0xf761,
  27492. "Atilde",
  27493. 0x00c3,
  27494. "Atildesmall",
  27495. 0xf7e3,
  27496. "Aybarmenian",
  27497. 0x0531,
  27498. "B",
  27499. 0x0042,
  27500. "Bcircle",
  27501. 0x24b7,
  27502. "Bdotaccent",
  27503. 0x1e02,
  27504. "Bdotbelow",
  27505. 0x1e04,
  27506. "Becyrillic",
  27507. 0x0411,
  27508. "Benarmenian",
  27509. 0x0532,
  27510. "Beta",
  27511. 0x0392,
  27512. "Bhook",
  27513. 0x0181,
  27514. "Blinebelow",
  27515. 0x1e06,
  27516. "Bmonospace",
  27517. 0xff22,
  27518. "Brevesmall",
  27519. 0xf6f4,
  27520. "Bsmall",
  27521. 0xf762,
  27522. "Btopbar",
  27523. 0x0182,
  27524. "C",
  27525. 0x0043,
  27526. "Caarmenian",
  27527. 0x053e,
  27528. "Cacute",
  27529. 0x0106,
  27530. "Caron",
  27531. 0xf6ca,
  27532. "Caronsmall",
  27533. 0xf6f5,
  27534. "Ccaron",
  27535. 0x010c,
  27536. "Ccedilla",
  27537. 0x00c7,
  27538. "Ccedillaacute",
  27539. 0x1e08,
  27540. "Ccedillasmall",
  27541. 0xf7e7,
  27542. "Ccircle",
  27543. 0x24b8,
  27544. "Ccircumflex",
  27545. 0x0108,
  27546. "Cdot",
  27547. 0x010a,
  27548. "Cdotaccent",
  27549. 0x010a,
  27550. "Cedillasmall",
  27551. 0xf7b8,
  27552. "Chaarmenian",
  27553. 0x0549,
  27554. "Cheabkhasiancyrillic",
  27555. 0x04bc,
  27556. "Checyrillic",
  27557. 0x0427,
  27558. "Chedescenderabkhasiancyrillic",
  27559. 0x04be,
  27560. "Chedescendercyrillic",
  27561. 0x04b6,
  27562. "Chedieresiscyrillic",
  27563. 0x04f4,
  27564. "Cheharmenian",
  27565. 0x0543,
  27566. "Chekhakassiancyrillic",
  27567. 0x04cb,
  27568. "Cheverticalstrokecyrillic",
  27569. 0x04b8,
  27570. "Chi",
  27571. 0x03a7,
  27572. "Chook",
  27573. 0x0187,
  27574. "Circumflexsmall",
  27575. 0xf6f6,
  27576. "Cmonospace",
  27577. 0xff23,
  27578. "Coarmenian",
  27579. 0x0551,
  27580. "Csmall",
  27581. 0xf763,
  27582. "D",
  27583. 0x0044,
  27584. "DZ",
  27585. 0x01f1,
  27586. "DZcaron",
  27587. 0x01c4,
  27588. "Daarmenian",
  27589. 0x0534,
  27590. "Dafrican",
  27591. 0x0189,
  27592. "Dcaron",
  27593. 0x010e,
  27594. "Dcedilla",
  27595. 0x1e10,
  27596. "Dcircle",
  27597. 0x24b9,
  27598. "Dcircumflexbelow",
  27599. 0x1e12,
  27600. "Dcroat",
  27601. 0x0110,
  27602. "Ddotaccent",
  27603. 0x1e0a,
  27604. "Ddotbelow",
  27605. 0x1e0c,
  27606. "Decyrillic",
  27607. 0x0414,
  27608. "Deicoptic",
  27609. 0x03ee,
  27610. "Delta",
  27611. 0x2206,
  27612. "Deltagreek",
  27613. 0x0394,
  27614. "Dhook",
  27615. 0x018a,
  27616. "Dieresis",
  27617. 0xf6cb,
  27618. "DieresisAcute",
  27619. 0xf6cc,
  27620. "DieresisGrave",
  27621. 0xf6cd,
  27622. "Dieresissmall",
  27623. 0xf7a8,
  27624. "Digammagreek",
  27625. 0x03dc,
  27626. "Djecyrillic",
  27627. 0x0402,
  27628. "Dlinebelow",
  27629. 0x1e0e,
  27630. "Dmonospace",
  27631. 0xff24,
  27632. "Dotaccentsmall",
  27633. 0xf6f7,
  27634. "Dslash",
  27635. 0x0110,
  27636. "Dsmall",
  27637. 0xf764,
  27638. "Dtopbar",
  27639. 0x018b,
  27640. "Dz",
  27641. 0x01f2,
  27642. "Dzcaron",
  27643. 0x01c5,
  27644. "Dzeabkhasiancyrillic",
  27645. 0x04e0,
  27646. "Dzecyrillic",
  27647. 0x0405,
  27648. "Dzhecyrillic",
  27649. 0x040f,
  27650. "E",
  27651. 0x0045,
  27652. "Eacute",
  27653. 0x00c9,
  27654. "Eacutesmall",
  27655. 0xf7e9,
  27656. "Ebreve",
  27657. 0x0114,
  27658. "Ecaron",
  27659. 0x011a,
  27660. "Ecedillabreve",
  27661. 0x1e1c,
  27662. "Echarmenian",
  27663. 0x0535,
  27664. "Ecircle",
  27665. 0x24ba,
  27666. "Ecircumflex",
  27667. 0x00ca,
  27668. "Ecircumflexacute",
  27669. 0x1ebe,
  27670. "Ecircumflexbelow",
  27671. 0x1e18,
  27672. "Ecircumflexdotbelow",
  27673. 0x1ec6,
  27674. "Ecircumflexgrave",
  27675. 0x1ec0,
  27676. "Ecircumflexhookabove",
  27677. 0x1ec2,
  27678. "Ecircumflexsmall",
  27679. 0xf7ea,
  27680. "Ecircumflextilde",
  27681. 0x1ec4,
  27682. "Ecyrillic",
  27683. 0x0404,
  27684. "Edblgrave",
  27685. 0x0204,
  27686. "Edieresis",
  27687. 0x00cb,
  27688. "Edieresissmall",
  27689. 0xf7eb,
  27690. "Edot",
  27691. 0x0116,
  27692. "Edotaccent",
  27693. 0x0116,
  27694. "Edotbelow",
  27695. 0x1eb8,
  27696. "Efcyrillic",
  27697. 0x0424,
  27698. "Egrave",
  27699. 0x00c8,
  27700. "Egravesmall",
  27701. 0xf7e8,
  27702. "Eharmenian",
  27703. 0x0537,
  27704. "Ehookabove",
  27705. 0x1eba,
  27706. "Eightroman",
  27707. 0x2167,
  27708. "Einvertedbreve",
  27709. 0x0206,
  27710. "Eiotifiedcyrillic",
  27711. 0x0464,
  27712. "Elcyrillic",
  27713. 0x041b,
  27714. "Elevenroman",
  27715. 0x216a,
  27716. "Emacron",
  27717. 0x0112,
  27718. "Emacronacute",
  27719. 0x1e16,
  27720. "Emacrongrave",
  27721. 0x1e14,
  27722. "Emcyrillic",
  27723. 0x041c,
  27724. "Emonospace",
  27725. 0xff25,
  27726. "Encyrillic",
  27727. 0x041d,
  27728. "Endescendercyrillic",
  27729. 0x04a2,
  27730. "Eng",
  27731. 0x014a,
  27732. "Enghecyrillic",
  27733. 0x04a4,
  27734. "Enhookcyrillic",
  27735. 0x04c7,
  27736. "Eogonek",
  27737. 0x0118,
  27738. "Eopen",
  27739. 0x0190,
  27740. "Epsilon",
  27741. 0x0395,
  27742. "Epsilontonos",
  27743. 0x0388,
  27744. "Ercyrillic",
  27745. 0x0420,
  27746. "Ereversed",
  27747. 0x018e,
  27748. "Ereversedcyrillic",
  27749. 0x042d,
  27750. "Escyrillic",
  27751. 0x0421,
  27752. "Esdescendercyrillic",
  27753. 0x04aa,
  27754. "Esh",
  27755. 0x01a9,
  27756. "Esmall",
  27757. 0xf765,
  27758. "Eta",
  27759. 0x0397,
  27760. "Etarmenian",
  27761. 0x0538,
  27762. "Etatonos",
  27763. 0x0389,
  27764. "Eth",
  27765. 0x00d0,
  27766. "Ethsmall",
  27767. 0xf7f0,
  27768. "Etilde",
  27769. 0x1ebc,
  27770. "Etildebelow",
  27771. 0x1e1a,
  27772. "Euro",
  27773. 0x20ac,
  27774. "Ezh",
  27775. 0x01b7,
  27776. "Ezhcaron",
  27777. 0x01ee,
  27778. "Ezhreversed",
  27779. 0x01b8,
  27780. "F",
  27781. 0x0046,
  27782. "Fcircle",
  27783. 0x24bb,
  27784. "Fdotaccent",
  27785. 0x1e1e,
  27786. "Feharmenian",
  27787. 0x0556,
  27788. "Feicoptic",
  27789. 0x03e4,
  27790. "Fhook",
  27791. 0x0191,
  27792. "Fitacyrillic",
  27793. 0x0472,
  27794. "Fiveroman",
  27795. 0x2164,
  27796. "Fmonospace",
  27797. 0xff26,
  27798. "Fourroman",
  27799. 0x2163,
  27800. "Fsmall",
  27801. 0xf766,
  27802. "G",
  27803. 0x0047,
  27804. "GBsquare",
  27805. 0x3387,
  27806. "Gacute",
  27807. 0x01f4,
  27808. "Gamma",
  27809. 0x0393,
  27810. "Gammaafrican",
  27811. 0x0194,
  27812. "Gangiacoptic",
  27813. 0x03ea,
  27814. "Gbreve",
  27815. 0x011e,
  27816. "Gcaron",
  27817. 0x01e6,
  27818. "Gcedilla",
  27819. 0x0122,
  27820. "Gcircle",
  27821. 0x24bc,
  27822. "Gcircumflex",
  27823. 0x011c,
  27824. "Gcommaaccent",
  27825. 0x0122,
  27826. "Gdot",
  27827. 0x0120,
  27828. "Gdotaccent",
  27829. 0x0120,
  27830. "Gecyrillic",
  27831. 0x0413,
  27832. "Ghadarmenian",
  27833. 0x0542,
  27834. "Ghemiddlehookcyrillic",
  27835. 0x0494,
  27836. "Ghestrokecyrillic",
  27837. 0x0492,
  27838. "Gheupturncyrillic",
  27839. 0x0490,
  27840. "Ghook",
  27841. 0x0193,
  27842. "Gimarmenian",
  27843. 0x0533,
  27844. "Gjecyrillic",
  27845. 0x0403,
  27846. "Gmacron",
  27847. 0x1e20,
  27848. "Gmonospace",
  27849. 0xff27,
  27850. "Grave",
  27851. 0xf6ce,
  27852. "Gravesmall",
  27853. 0xf760,
  27854. "Gsmall",
  27855. 0xf767,
  27856. "Gsmallhook",
  27857. 0x029b,
  27858. "Gstroke",
  27859. 0x01e4,
  27860. "H",
  27861. 0x0048,
  27862. "H18533",
  27863. 0x25cf,
  27864. "H18543",
  27865. 0x25aa,
  27866. "H18551",
  27867. 0x25ab,
  27868. "H22073",
  27869. 0x25a1,
  27870. "HPsquare",
  27871. 0x33cb,
  27872. "Haabkhasiancyrillic",
  27873. 0x04a8,
  27874. "Hadescendercyrillic",
  27875. 0x04b2,
  27876. "Hardsigncyrillic",
  27877. 0x042a,
  27878. "Hbar",
  27879. 0x0126,
  27880. "Hbrevebelow",
  27881. 0x1e2a,
  27882. "Hcedilla",
  27883. 0x1e28,
  27884. "Hcircle",
  27885. 0x24bd,
  27886. "Hcircumflex",
  27887. 0x0124,
  27888. "Hdieresis",
  27889. 0x1e26,
  27890. "Hdotaccent",
  27891. 0x1e22,
  27892. "Hdotbelow",
  27893. 0x1e24,
  27894. "Hmonospace",
  27895. 0xff28,
  27896. "Hoarmenian",
  27897. 0x0540,
  27898. "Horicoptic",
  27899. 0x03e8,
  27900. "Hsmall",
  27901. 0xf768,
  27902. "Hungarumlaut",
  27903. 0xf6cf,
  27904. "Hungarumlautsmall",
  27905. 0xf6f8,
  27906. "Hzsquare",
  27907. 0x3390,
  27908. "I",
  27909. 0x0049,
  27910. "IAcyrillic",
  27911. 0x042f,
  27912. "IJ",
  27913. 0x0132,
  27914. "IUcyrillic",
  27915. 0x042e,
  27916. "Iacute",
  27917. 0x00cd,
  27918. "Iacutesmall",
  27919. 0xf7ed,
  27920. "Ibreve",
  27921. 0x012c,
  27922. "Icaron",
  27923. 0x01cf,
  27924. "Icircle",
  27925. 0x24be,
  27926. "Icircumflex",
  27927. 0x00ce,
  27928. "Icircumflexsmall",
  27929. 0xf7ee,
  27930. "Icyrillic",
  27931. 0x0406,
  27932. "Idblgrave",
  27933. 0x0208,
  27934. "Idieresis",
  27935. 0x00cf,
  27936. "Idieresisacute",
  27937. 0x1e2e,
  27938. "Idieresiscyrillic",
  27939. 0x04e4,
  27940. "Idieresissmall",
  27941. 0xf7ef,
  27942. "Idot",
  27943. 0x0130,
  27944. "Idotaccent",
  27945. 0x0130,
  27946. "Idotbelow",
  27947. 0x1eca,
  27948. "Iebrevecyrillic",
  27949. 0x04d6,
  27950. "Iecyrillic",
  27951. 0x0415,
  27952. "Ifraktur",
  27953. 0x2111,
  27954. "Igrave",
  27955. 0x00cc,
  27956. "Igravesmall",
  27957. 0xf7ec,
  27958. "Ihookabove",
  27959. 0x1ec8,
  27960. "Iicyrillic",
  27961. 0x0418,
  27962. "Iinvertedbreve",
  27963. 0x020a,
  27964. "Iishortcyrillic",
  27965. 0x0419,
  27966. "Imacron",
  27967. 0x012a,
  27968. "Imacroncyrillic",
  27969. 0x04e2,
  27970. "Imonospace",
  27971. 0xff29,
  27972. "Iniarmenian",
  27973. 0x053b,
  27974. "Iocyrillic",
  27975. 0x0401,
  27976. "Iogonek",
  27977. 0x012e,
  27978. "Iota",
  27979. 0x0399,
  27980. "Iotaafrican",
  27981. 0x0196,
  27982. "Iotadieresis",
  27983. 0x03aa,
  27984. "Iotatonos",
  27985. 0x038a,
  27986. "Ismall",
  27987. 0xf769,
  27988. "Istroke",
  27989. 0x0197,
  27990. "Itilde",
  27991. 0x0128,
  27992. "Itildebelow",
  27993. 0x1e2c,
  27994. "Izhitsacyrillic",
  27995. 0x0474,
  27996. "Izhitsadblgravecyrillic",
  27997. 0x0476,
  27998. "J",
  27999. 0x004a,
  28000. "Jaarmenian",
  28001. 0x0541,
  28002. "Jcircle",
  28003. 0x24bf,
  28004. "Jcircumflex",
  28005. 0x0134,
  28006. "Jecyrillic",
  28007. 0x0408,
  28008. "Jheharmenian",
  28009. 0x054b,
  28010. "Jmonospace",
  28011. 0xff2a,
  28012. "Jsmall",
  28013. 0xf76a,
  28014. "K",
  28015. 0x004b,
  28016. "KBsquare",
  28017. 0x3385,
  28018. "KKsquare",
  28019. 0x33cd,
  28020. "Kabashkircyrillic",
  28021. 0x04a0,
  28022. "Kacute",
  28023. 0x1e30,
  28024. "Kacyrillic",
  28025. 0x041a,
  28026. "Kadescendercyrillic",
  28027. 0x049a,
  28028. "Kahookcyrillic",
  28029. 0x04c3,
  28030. "Kappa",
  28031. 0x039a,
  28032. "Kastrokecyrillic",
  28033. 0x049e,
  28034. "Kaverticalstrokecyrillic",
  28035. 0x049c,
  28036. "Kcaron",
  28037. 0x01e8,
  28038. "Kcedilla",
  28039. 0x0136,
  28040. "Kcircle",
  28041. 0x24c0,
  28042. "Kcommaaccent",
  28043. 0x0136,
  28044. "Kdotbelow",
  28045. 0x1e32,
  28046. "Keharmenian",
  28047. 0x0554,
  28048. "Kenarmenian",
  28049. 0x053f,
  28050. "Khacyrillic",
  28051. 0x0425,
  28052. "Kheicoptic",
  28053. 0x03e6,
  28054. "Khook",
  28055. 0x0198,
  28056. "Kjecyrillic",
  28057. 0x040c,
  28058. "Klinebelow",
  28059. 0x1e34,
  28060. "Kmonospace",
  28061. 0xff2b,
  28062. "Koppacyrillic",
  28063. 0x0480,
  28064. "Koppagreek",
  28065. 0x03de,
  28066. "Ksicyrillic",
  28067. 0x046e,
  28068. "Ksmall",
  28069. 0xf76b,
  28070. "L",
  28071. 0x004c,
  28072. "LJ",
  28073. 0x01c7,
  28074. "LL",
  28075. 0xf6bf,
  28076. "Lacute",
  28077. 0x0139,
  28078. "Lambda",
  28079. 0x039b,
  28080. "Lcaron",
  28081. 0x013d,
  28082. "Lcedilla",
  28083. 0x013b,
  28084. "Lcircle",
  28085. 0x24c1,
  28086. "Lcircumflexbelow",
  28087. 0x1e3c,
  28088. "Lcommaaccent",
  28089. 0x013b,
  28090. "Ldot",
  28091. 0x013f,
  28092. "Ldotaccent",
  28093. 0x013f,
  28094. "Ldotbelow",
  28095. 0x1e36,
  28096. "Ldotbelowmacron",
  28097. 0x1e38,
  28098. "Liwnarmenian",
  28099. 0x053c,
  28100. "Lj",
  28101. 0x01c8,
  28102. "Ljecyrillic",
  28103. 0x0409,
  28104. "Llinebelow",
  28105. 0x1e3a,
  28106. "Lmonospace",
  28107. 0xff2c,
  28108. "Lslash",
  28109. 0x0141,
  28110. "Lslashsmall",
  28111. 0xf6f9,
  28112. "Lsmall",
  28113. 0xf76c,
  28114. "M",
  28115. 0x004d,
  28116. "MBsquare",
  28117. 0x3386,
  28118. "Macron",
  28119. 0xf6d0,
  28120. "Macronsmall",
  28121. 0xf7af,
  28122. "Macute",
  28123. 0x1e3e,
  28124. "Mcircle",
  28125. 0x24c2,
  28126. "Mdotaccent",
  28127. 0x1e40,
  28128. "Mdotbelow",
  28129. 0x1e42,
  28130. "Menarmenian",
  28131. 0x0544,
  28132. "Mmonospace",
  28133. 0xff2d,
  28134. "Msmall",
  28135. 0xf76d,
  28136. "Mturned",
  28137. 0x019c,
  28138. "Mu",
  28139. 0x039c,
  28140. "N",
  28141. 0x004e,
  28142. "NJ",
  28143. 0x01ca,
  28144. "Nacute",
  28145. 0x0143,
  28146. "Ncaron",
  28147. 0x0147,
  28148. "Ncedilla",
  28149. 0x0145,
  28150. "Ncircle",
  28151. 0x24c3,
  28152. "Ncircumflexbelow",
  28153. 0x1e4a,
  28154. "Ncommaaccent",
  28155. 0x0145,
  28156. "Ndotaccent",
  28157. 0x1e44,
  28158. "Ndotbelow",
  28159. 0x1e46,
  28160. "Nhookleft",
  28161. 0x019d,
  28162. "Nineroman",
  28163. 0x2168,
  28164. "Nj",
  28165. 0x01cb,
  28166. "Njecyrillic",
  28167. 0x040a,
  28168. "Nlinebelow",
  28169. 0x1e48,
  28170. "Nmonospace",
  28171. 0xff2e,
  28172. "Nowarmenian",
  28173. 0x0546,
  28174. "Nsmall",
  28175. 0xf76e,
  28176. "Ntilde",
  28177. 0x00d1,
  28178. "Ntildesmall",
  28179. 0xf7f1,
  28180. "Nu",
  28181. 0x039d,
  28182. "O",
  28183. 0x004f,
  28184. "OE",
  28185. 0x0152,
  28186. "OEsmall",
  28187. 0xf6fa,
  28188. "Oacute",
  28189. 0x00d3,
  28190. "Oacutesmall",
  28191. 0xf7f3,
  28192. "Obarredcyrillic",
  28193. 0x04e8,
  28194. "Obarreddieresiscyrillic",
  28195. 0x04ea,
  28196. "Obreve",
  28197. 0x014e,
  28198. "Ocaron",
  28199. 0x01d1,
  28200. "Ocenteredtilde",
  28201. 0x019f,
  28202. "Ocircle",
  28203. 0x24c4,
  28204. "Ocircumflex",
  28205. 0x00d4,
  28206. "Ocircumflexacute",
  28207. 0x1ed0,
  28208. "Ocircumflexdotbelow",
  28209. 0x1ed8,
  28210. "Ocircumflexgrave",
  28211. 0x1ed2,
  28212. "Ocircumflexhookabove",
  28213. 0x1ed4,
  28214. "Ocircumflexsmall",
  28215. 0xf7f4,
  28216. "Ocircumflextilde",
  28217. 0x1ed6,
  28218. "Ocyrillic",
  28219. 0x041e,
  28220. "Odblacute",
  28221. 0x0150,
  28222. "Odblgrave",
  28223. 0x020c,
  28224. "Odieresis",
  28225. 0x00d6,
  28226. "Odieresiscyrillic",
  28227. 0x04e6,
  28228. "Odieresissmall",
  28229. 0xf7f6,
  28230. "Odotbelow",
  28231. 0x1ecc,
  28232. "Ogoneksmall",
  28233. 0xf6fb,
  28234. "Ograve",
  28235. 0x00d2,
  28236. "Ogravesmall",
  28237. 0xf7f2,
  28238. "Oharmenian",
  28239. 0x0555,
  28240. "Ohm",
  28241. 0x2126,
  28242. "Ohookabove",
  28243. 0x1ece,
  28244. "Ohorn",
  28245. 0x01a0,
  28246. "Ohornacute",
  28247. 0x1eda,
  28248. "Ohorndotbelow",
  28249. 0x1ee2,
  28250. "Ohorngrave",
  28251. 0x1edc,
  28252. "Ohornhookabove",
  28253. 0x1ede,
  28254. "Ohorntilde",
  28255. 0x1ee0,
  28256. "Ohungarumlaut",
  28257. 0x0150,
  28258. "Oi",
  28259. 0x01a2,
  28260. "Oinvertedbreve",
  28261. 0x020e,
  28262. "Omacron",
  28263. 0x014c,
  28264. "Omacronacute",
  28265. 0x1e52,
  28266. "Omacrongrave",
  28267. 0x1e50,
  28268. "Omega",
  28269. 0x2126,
  28270. "Omegacyrillic",
  28271. 0x0460,
  28272. "Omegagreek",
  28273. 0x03a9,
  28274. "Omegaroundcyrillic",
  28275. 0x047a,
  28276. "Omegatitlocyrillic",
  28277. 0x047c,
  28278. "Omegatonos",
  28279. 0x038f,
  28280. "Omicron",
  28281. 0x039f,
  28282. "Omicrontonos",
  28283. 0x038c,
  28284. "Omonospace",
  28285. 0xff2f,
  28286. "Oneroman",
  28287. 0x2160,
  28288. "Oogonek",
  28289. 0x01ea,
  28290. "Oogonekmacron",
  28291. 0x01ec,
  28292. "Oopen",
  28293. 0x0186,
  28294. "Oslash",
  28295. 0x00d8,
  28296. "Oslashacute",
  28297. 0x01fe,
  28298. "Oslashsmall",
  28299. 0xf7f8,
  28300. "Osmall",
  28301. 0xf76f,
  28302. "Ostrokeacute",
  28303. 0x01fe,
  28304. "Otcyrillic",
  28305. 0x047e,
  28306. "Otilde",
  28307. 0x00d5,
  28308. "Otildeacute",
  28309. 0x1e4c,
  28310. "Otildedieresis",
  28311. 0x1e4e,
  28312. "Otildesmall",
  28313. 0xf7f5,
  28314. "P",
  28315. 0x0050,
  28316. "Pacute",
  28317. 0x1e54,
  28318. "Pcircle",
  28319. 0x24c5,
  28320. "Pdotaccent",
  28321. 0x1e56,
  28322. "Pecyrillic",
  28323. 0x041f,
  28324. "Peharmenian",
  28325. 0x054a,
  28326. "Pemiddlehookcyrillic",
  28327. 0x04a6,
  28328. "Phi",
  28329. 0x03a6,
  28330. "Phook",
  28331. 0x01a4,
  28332. "Pi",
  28333. 0x03a0,
  28334. "Piwrarmenian",
  28335. 0x0553,
  28336. "Pmonospace",
  28337. 0xff30,
  28338. "Psi",
  28339. 0x03a8,
  28340. "Psicyrillic",
  28341. 0x0470,
  28342. "Psmall",
  28343. 0xf770,
  28344. "Q",
  28345. 0x0051,
  28346. "Qcircle",
  28347. 0x24c6,
  28348. "Qmonospace",
  28349. 0xff31,
  28350. "Qsmall",
  28351. 0xf771,
  28352. "R",
  28353. 0x0052,
  28354. "Raarmenian",
  28355. 0x054c,
  28356. "Racute",
  28357. 0x0154,
  28358. "Rcaron",
  28359. 0x0158,
  28360. "Rcedilla",
  28361. 0x0156,
  28362. "Rcircle",
  28363. 0x24c7,
  28364. "Rcommaaccent",
  28365. 0x0156,
  28366. "Rdblgrave",
  28367. 0x0210,
  28368. "Rdotaccent",
  28369. 0x1e58,
  28370. "Rdotbelow",
  28371. 0x1e5a,
  28372. "Rdotbelowmacron",
  28373. 0x1e5c,
  28374. "Reharmenian",
  28375. 0x0550,
  28376. "Rfraktur",
  28377. 0x211c,
  28378. "Rho",
  28379. 0x03a1,
  28380. "Ringsmall",
  28381. 0xf6fc,
  28382. "Rinvertedbreve",
  28383. 0x0212,
  28384. "Rlinebelow",
  28385. 0x1e5e,
  28386. "Rmonospace",
  28387. 0xff32,
  28388. "Rsmall",
  28389. 0xf772,
  28390. "Rsmallinverted",
  28391. 0x0281,
  28392. "Rsmallinvertedsuperior",
  28393. 0x02b6,
  28394. "S",
  28395. 0x0053,
  28396. "SF010000",
  28397. 0x250c,
  28398. "SF020000",
  28399. 0x2514,
  28400. "SF030000",
  28401. 0x2510,
  28402. "SF040000",
  28403. 0x2518,
  28404. "SF050000",
  28405. 0x253c,
  28406. "SF060000",
  28407. 0x252c,
  28408. "SF070000",
  28409. 0x2534,
  28410. "SF080000",
  28411. 0x251c,
  28412. "SF090000",
  28413. 0x2524,
  28414. "SF100000",
  28415. 0x2500,
  28416. "SF110000",
  28417. 0x2502,
  28418. "SF190000",
  28419. 0x2561,
  28420. "SF200000",
  28421. 0x2562,
  28422. "SF210000",
  28423. 0x2556,
  28424. "SF220000",
  28425. 0x2555,
  28426. "SF230000",
  28427. 0x2563,
  28428. "SF240000",
  28429. 0x2551,
  28430. "SF250000",
  28431. 0x2557,
  28432. "SF260000",
  28433. 0x255d,
  28434. "SF270000",
  28435. 0x255c,
  28436. "SF280000",
  28437. 0x255b,
  28438. "SF360000",
  28439. 0x255e,
  28440. "SF370000",
  28441. 0x255f,
  28442. "SF380000",
  28443. 0x255a,
  28444. "SF390000",
  28445. 0x2554,
  28446. "SF400000",
  28447. 0x2569,
  28448. "SF410000",
  28449. 0x2566,
  28450. "SF420000",
  28451. 0x2560,
  28452. "SF430000",
  28453. 0x2550,
  28454. "SF440000",
  28455. 0x256c,
  28456. "SF450000",
  28457. 0x2567,
  28458. "SF460000",
  28459. 0x2568,
  28460. "SF470000",
  28461. 0x2564,
  28462. "SF480000",
  28463. 0x2565,
  28464. "SF490000",
  28465. 0x2559,
  28466. "SF500000",
  28467. 0x2558,
  28468. "SF510000",
  28469. 0x2552,
  28470. "SF520000",
  28471. 0x2553,
  28472. "SF530000",
  28473. 0x256b,
  28474. "SF540000",
  28475. 0x256a,
  28476. "Sacute",
  28477. 0x015a,
  28478. "Sacutedotaccent",
  28479. 0x1e64,
  28480. "Sampigreek",
  28481. 0x03e0,
  28482. "Scaron",
  28483. 0x0160,
  28484. "Scarondotaccent",
  28485. 0x1e66,
  28486. "Scaronsmall",
  28487. 0xf6fd,
  28488. "Scedilla",
  28489. 0x015e,
  28490. "Schwa",
  28491. 0x018f,
  28492. "Schwacyrillic",
  28493. 0x04d8,
  28494. "Schwadieresiscyrillic",
  28495. 0x04da,
  28496. "Scircle",
  28497. 0x24c8,
  28498. "Scircumflex",
  28499. 0x015c,
  28500. "Scommaaccent",
  28501. 0x0218,
  28502. "Sdotaccent",
  28503. 0x1e60,
  28504. "Sdotbelow",
  28505. 0x1e62,
  28506. "Sdotbelowdotaccent",
  28507. 0x1e68,
  28508. "Seharmenian",
  28509. 0x054d,
  28510. "Sevenroman",
  28511. 0x2166,
  28512. "Shaarmenian",
  28513. 0x0547,
  28514. "Shacyrillic",
  28515. 0x0428,
  28516. "Shchacyrillic",
  28517. 0x0429,
  28518. "Sheicoptic",
  28519. 0x03e2,
  28520. "Shhacyrillic",
  28521. 0x04ba,
  28522. "Shimacoptic",
  28523. 0x03ec,
  28524. "Sigma",
  28525. 0x03a3,
  28526. "Sixroman",
  28527. 0x2165,
  28528. "Smonospace",
  28529. 0xff33,
  28530. "Softsigncyrillic",
  28531. 0x042c,
  28532. "Ssmall",
  28533. 0xf773,
  28534. "Stigmagreek",
  28535. 0x03da,
  28536. "T",
  28537. 0x0054,
  28538. "Tau",
  28539. 0x03a4,
  28540. "Tbar",
  28541. 0x0166,
  28542. "Tcaron",
  28543. 0x0164,
  28544. "Tcedilla",
  28545. 0x0162,
  28546. "Tcircle",
  28547. 0x24c9,
  28548. "Tcircumflexbelow",
  28549. 0x1e70,
  28550. "Tcommaaccent",
  28551. 0x0162,
  28552. "Tdotaccent",
  28553. 0x1e6a,
  28554. "Tdotbelow",
  28555. 0x1e6c,
  28556. "Tecyrillic",
  28557. 0x0422,
  28558. "Tedescendercyrillic",
  28559. 0x04ac,
  28560. "Tenroman",
  28561. 0x2169,
  28562. "Tetsecyrillic",
  28563. 0x04b4,
  28564. "Theta",
  28565. 0x0398,
  28566. "Thook",
  28567. 0x01ac,
  28568. "Thorn",
  28569. 0x00de,
  28570. "Thornsmall",
  28571. 0xf7fe,
  28572. "Threeroman",
  28573. 0x2162,
  28574. "Tildesmall",
  28575. 0xf6fe,
  28576. "Tiwnarmenian",
  28577. 0x054f,
  28578. "Tlinebelow",
  28579. 0x1e6e,
  28580. "Tmonospace",
  28581. 0xff34,
  28582. "Toarmenian",
  28583. 0x0539,
  28584. "Tonefive",
  28585. 0x01bc,
  28586. "Tonesix",
  28587. 0x0184,
  28588. "Tonetwo",
  28589. 0x01a7,
  28590. "Tretroflexhook",
  28591. 0x01ae,
  28592. "Tsecyrillic",
  28593. 0x0426,
  28594. "Tshecyrillic",
  28595. 0x040b,
  28596. "Tsmall",
  28597. 0xf774,
  28598. "Twelveroman",
  28599. 0x216b,
  28600. "Tworoman",
  28601. 0x2161,
  28602. "U",
  28603. 0x0055,
  28604. "Uacute",
  28605. 0x00da,
  28606. "Uacutesmall",
  28607. 0xf7fa,
  28608. "Ubreve",
  28609. 0x016c,
  28610. "Ucaron",
  28611. 0x01d3,
  28612. "Ucircle",
  28613. 0x24ca,
  28614. "Ucircumflex",
  28615. 0x00db,
  28616. "Ucircumflexbelow",
  28617. 0x1e76,
  28618. "Ucircumflexsmall",
  28619. 0xf7fb,
  28620. "Ucyrillic",
  28621. 0x0423,
  28622. "Udblacute",
  28623. 0x0170,
  28624. "Udblgrave",
  28625. 0x0214,
  28626. "Udieresis",
  28627. 0x00dc,
  28628. "Udieresisacute",
  28629. 0x01d7,
  28630. "Udieresisbelow",
  28631. 0x1e72,
  28632. "Udieresiscaron",
  28633. 0x01d9,
  28634. "Udieresiscyrillic",
  28635. 0x04f0,
  28636. "Udieresisgrave",
  28637. 0x01db,
  28638. "Udieresismacron",
  28639. 0x01d5,
  28640. "Udieresissmall",
  28641. 0xf7fc,
  28642. "Udotbelow",
  28643. 0x1ee4,
  28644. "Ugrave",
  28645. 0x00d9,
  28646. "Ugravesmall",
  28647. 0xf7f9,
  28648. "Uhookabove",
  28649. 0x1ee6,
  28650. "Uhorn",
  28651. 0x01af,
  28652. "Uhornacute",
  28653. 0x1ee8,
  28654. "Uhorndotbelow",
  28655. 0x1ef0,
  28656. "Uhorngrave",
  28657. 0x1eea,
  28658. "Uhornhookabove",
  28659. 0x1eec,
  28660. "Uhorntilde",
  28661. 0x1eee,
  28662. "Uhungarumlaut",
  28663. 0x0170,
  28664. "Uhungarumlautcyrillic",
  28665. 0x04f2,
  28666. "Uinvertedbreve",
  28667. 0x0216,
  28668. "Ukcyrillic",
  28669. 0x0478,
  28670. "Umacron",
  28671. 0x016a,
  28672. "Umacroncyrillic",
  28673. 0x04ee,
  28674. "Umacrondieresis",
  28675. 0x1e7a,
  28676. "Umonospace",
  28677. 0xff35,
  28678. "Uogonek",
  28679. 0x0172,
  28680. "Upsilon",
  28681. 0x03a5,
  28682. "Upsilon1",
  28683. 0x03d2,
  28684. "Upsilonacutehooksymbolgreek",
  28685. 0x03d3,
  28686. "Upsilonafrican",
  28687. 0x01b1,
  28688. "Upsilondieresis",
  28689. 0x03ab,
  28690. "Upsilondieresishooksymbolgreek",
  28691. 0x03d4,
  28692. "Upsilonhooksymbol",
  28693. 0x03d2,
  28694. "Upsilontonos",
  28695. 0x038e,
  28696. "Uring",
  28697. 0x016e,
  28698. "Ushortcyrillic",
  28699. 0x040e,
  28700. "Usmall",
  28701. 0xf775,
  28702. "Ustraightcyrillic",
  28703. 0x04ae,
  28704. "Ustraightstrokecyrillic",
  28705. 0x04b0,
  28706. "Utilde",
  28707. 0x0168,
  28708. "Utildeacute",
  28709. 0x1e78,
  28710. "Utildebelow",
  28711. 0x1e74,
  28712. "V",
  28713. 0x0056,
  28714. "Vcircle",
  28715. 0x24cb,
  28716. "Vdotbelow",
  28717. 0x1e7e,
  28718. "Vecyrillic",
  28719. 0x0412,
  28720. "Vewarmenian",
  28721. 0x054e,
  28722. "Vhook",
  28723. 0x01b2,
  28724. "Vmonospace",
  28725. 0xff36,
  28726. "Voarmenian",
  28727. 0x0548,
  28728. "Vsmall",
  28729. 0xf776,
  28730. "Vtilde",
  28731. 0x1e7c,
  28732. "W",
  28733. 0x0057,
  28734. "Wacute",
  28735. 0x1e82,
  28736. "Wcircle",
  28737. 0x24cc,
  28738. "Wcircumflex",
  28739. 0x0174,
  28740. "Wdieresis",
  28741. 0x1e84,
  28742. "Wdotaccent",
  28743. 0x1e86,
  28744. "Wdotbelow",
  28745. 0x1e88,
  28746. "Wgrave",
  28747. 0x1e80,
  28748. "Wmonospace",
  28749. 0xff37,
  28750. "Wsmall",
  28751. 0xf777,
  28752. "X",
  28753. 0x0058,
  28754. "Xcircle",
  28755. 0x24cd,
  28756. "Xdieresis",
  28757. 0x1e8c,
  28758. "Xdotaccent",
  28759. 0x1e8a,
  28760. "Xeharmenian",
  28761. 0x053d,
  28762. "Xi",
  28763. 0x039e,
  28764. "Xmonospace",
  28765. 0xff38,
  28766. "Xsmall",
  28767. 0xf778,
  28768. "Y",
  28769. 0x0059,
  28770. "Yacute",
  28771. 0x00dd,
  28772. "Yacutesmall",
  28773. 0xf7fd,
  28774. "Yatcyrillic",
  28775. 0x0462,
  28776. "Ycircle",
  28777. 0x24ce,
  28778. "Ycircumflex",
  28779. 0x0176,
  28780. "Ydieresis",
  28781. 0x0178,
  28782. "Ydieresissmall",
  28783. 0xf7ff,
  28784. "Ydotaccent",
  28785. 0x1e8e,
  28786. "Ydotbelow",
  28787. 0x1ef4,
  28788. "Yericyrillic",
  28789. 0x042b,
  28790. "Yerudieresiscyrillic",
  28791. 0x04f8,
  28792. "Ygrave",
  28793. 0x1ef2,
  28794. "Yhook",
  28795. 0x01b3,
  28796. "Yhookabove",
  28797. 0x1ef6,
  28798. "Yiarmenian",
  28799. 0x0545,
  28800. "Yicyrillic",
  28801. 0x0407,
  28802. "Yiwnarmenian",
  28803. 0x0552,
  28804. "Ymonospace",
  28805. 0xff39,
  28806. "Ysmall",
  28807. 0xf779,
  28808. "Ytilde",
  28809. 0x1ef8,
  28810. "Yusbigcyrillic",
  28811. 0x046a,
  28812. "Yusbigiotifiedcyrillic",
  28813. 0x046c,
  28814. "Yuslittlecyrillic",
  28815. 0x0466,
  28816. "Yuslittleiotifiedcyrillic",
  28817. 0x0468,
  28818. "Z",
  28819. 0x005a,
  28820. "Zaarmenian",
  28821. 0x0536,
  28822. "Zacute",
  28823. 0x0179,
  28824. "Zcaron",
  28825. 0x017d,
  28826. "Zcaronsmall",
  28827. 0xf6ff,
  28828. "Zcircle",
  28829. 0x24cf,
  28830. "Zcircumflex",
  28831. 0x1e90,
  28832. "Zdot",
  28833. 0x017b,
  28834. "Zdotaccent",
  28835. 0x017b,
  28836. "Zdotbelow",
  28837. 0x1e92,
  28838. "Zecyrillic",
  28839. 0x0417,
  28840. "Zedescendercyrillic",
  28841. 0x0498,
  28842. "Zedieresiscyrillic",
  28843. 0x04de,
  28844. "Zeta",
  28845. 0x0396,
  28846. "Zhearmenian",
  28847. 0x053a,
  28848. "Zhebrevecyrillic",
  28849. 0x04c1,
  28850. "Zhecyrillic",
  28851. 0x0416,
  28852. "Zhedescendercyrillic",
  28853. 0x0496,
  28854. "Zhedieresiscyrillic",
  28855. 0x04dc,
  28856. "Zlinebelow",
  28857. 0x1e94,
  28858. "Zmonospace",
  28859. 0xff3a,
  28860. "Zsmall",
  28861. 0xf77a,
  28862. "Zstroke",
  28863. 0x01b5,
  28864. "a",
  28865. 0x0061,
  28866. "aabengali",
  28867. 0x0986,
  28868. "aacute",
  28869. 0x00e1,
  28870. "aadeva",
  28871. 0x0906,
  28872. "aagujarati",
  28873. 0x0a86,
  28874. "aagurmukhi",
  28875. 0x0a06,
  28876. "aamatragurmukhi",
  28877. 0x0a3e,
  28878. "aarusquare",
  28879. 0x3303,
  28880. "aavowelsignbengali",
  28881. 0x09be,
  28882. "aavowelsigndeva",
  28883. 0x093e,
  28884. "aavowelsigngujarati",
  28885. 0x0abe,
  28886. "abbreviationmarkarmenian",
  28887. 0x055f,
  28888. "abbreviationsigndeva",
  28889. 0x0970,
  28890. "abengali",
  28891. 0x0985,
  28892. "abopomofo",
  28893. 0x311a,
  28894. "abreve",
  28895. 0x0103,
  28896. "abreveacute",
  28897. 0x1eaf,
  28898. "abrevecyrillic",
  28899. 0x04d1,
  28900. "abrevedotbelow",
  28901. 0x1eb7,
  28902. "abrevegrave",
  28903. 0x1eb1,
  28904. "abrevehookabove",
  28905. 0x1eb3,
  28906. "abrevetilde",
  28907. 0x1eb5,
  28908. "acaron",
  28909. 0x01ce,
  28910. "acircle",
  28911. 0x24d0,
  28912. "acircumflex",
  28913. 0x00e2,
  28914. "acircumflexacute",
  28915. 0x1ea5,
  28916. "acircumflexdotbelow",
  28917. 0x1ead,
  28918. "acircumflexgrave",
  28919. 0x1ea7,
  28920. "acircumflexhookabove",
  28921. 0x1ea9,
  28922. "acircumflextilde",
  28923. 0x1eab,
  28924. "acute",
  28925. 0x00b4,
  28926. "acutebelowcmb",
  28927. 0x0317,
  28928. "acutecmb",
  28929. 0x0301,
  28930. "acutecomb",
  28931. 0x0301,
  28932. "acutedeva",
  28933. 0x0954,
  28934. "acutelowmod",
  28935. 0x02cf,
  28936. "acutetonecmb",
  28937. 0x0341,
  28938. "acyrillic",
  28939. 0x0430,
  28940. "adblgrave",
  28941. 0x0201,
  28942. "addakgurmukhi",
  28943. 0x0a71,
  28944. "adeva",
  28945. 0x0905,
  28946. "adieresis",
  28947. 0x00e4,
  28948. "adieresiscyrillic",
  28949. 0x04d3,
  28950. "adieresismacron",
  28951. 0x01df,
  28952. "adotbelow",
  28953. 0x1ea1,
  28954. "adotmacron",
  28955. 0x01e1,
  28956. "ae",
  28957. 0x00e6,
  28958. "aeacute",
  28959. 0x01fd,
  28960. "aekorean",
  28961. 0x3150,
  28962. "aemacron",
  28963. 0x01e3,
  28964. "afii00208",
  28965. 0x2015,
  28966. "afii08941",
  28967. 0x20a4,
  28968. "afii10017",
  28969. 0x0410,
  28970. "afii10018",
  28971. 0x0411,
  28972. "afii10019",
  28973. 0x0412,
  28974. "afii10020",
  28975. 0x0413,
  28976. "afii10021",
  28977. 0x0414,
  28978. "afii10022",
  28979. 0x0415,
  28980. "afii10023",
  28981. 0x0401,
  28982. "afii10024",
  28983. 0x0416,
  28984. "afii10025",
  28985. 0x0417,
  28986. "afii10026",
  28987. 0x0418,
  28988. "afii10027",
  28989. 0x0419,
  28990. "afii10028",
  28991. 0x041a,
  28992. "afii10029",
  28993. 0x041b,
  28994. "afii10030",
  28995. 0x041c,
  28996. "afii10031",
  28997. 0x041d,
  28998. "afii10032",
  28999. 0x041e,
  29000. "afii10033",
  29001. 0x041f,
  29002. "afii10034",
  29003. 0x0420,
  29004. "afii10035",
  29005. 0x0421,
  29006. "afii10036",
  29007. 0x0422,
  29008. "afii10037",
  29009. 0x0423,
  29010. "afii10038",
  29011. 0x0424,
  29012. "afii10039",
  29013. 0x0425,
  29014. "afii10040",
  29015. 0x0426,
  29016. "afii10041",
  29017. 0x0427,
  29018. "afii10042",
  29019. 0x0428,
  29020. "afii10043",
  29021. 0x0429,
  29022. "afii10044",
  29023. 0x042a,
  29024. "afii10045",
  29025. 0x042b,
  29026. "afii10046",
  29027. 0x042c,
  29028. "afii10047",
  29029. 0x042d,
  29030. "afii10048",
  29031. 0x042e,
  29032. "afii10049",
  29033. 0x042f,
  29034. "afii10050",
  29035. 0x0490,
  29036. "afii10051",
  29037. 0x0402,
  29038. "afii10052",
  29039. 0x0403,
  29040. "afii10053",
  29041. 0x0404,
  29042. "afii10054",
  29043. 0x0405,
  29044. "afii10055",
  29045. 0x0406,
  29046. "afii10056",
  29047. 0x0407,
  29048. "afii10057",
  29049. 0x0408,
  29050. "afii10058",
  29051. 0x0409,
  29052. "afii10059",
  29053. 0x040a,
  29054. "afii10060",
  29055. 0x040b,
  29056. "afii10061",
  29057. 0x040c,
  29058. "afii10062",
  29059. 0x040e,
  29060. "afii10063",
  29061. 0xf6c4,
  29062. "afii10064",
  29063. 0xf6c5,
  29064. "afii10065",
  29065. 0x0430,
  29066. "afii10066",
  29067. 0x0431,
  29068. "afii10067",
  29069. 0x0432,
  29070. "afii10068",
  29071. 0x0433,
  29072. "afii10069",
  29073. 0x0434,
  29074. "afii10070",
  29075. 0x0435,
  29076. "afii10071",
  29077. 0x0451,
  29078. "afii10072",
  29079. 0x0436,
  29080. "afii10073",
  29081. 0x0437,
  29082. "afii10074",
  29083. 0x0438,
  29084. "afii10075",
  29085. 0x0439,
  29086. "afii10076",
  29087. 0x043a,
  29088. "afii10077",
  29089. 0x043b,
  29090. "afii10078",
  29091. 0x043c,
  29092. "afii10079",
  29093. 0x043d,
  29094. "afii10080",
  29095. 0x043e,
  29096. "afii10081",
  29097. 0x043f,
  29098. "afii10082",
  29099. 0x0440,
  29100. "afii10083",
  29101. 0x0441,
  29102. "afii10084",
  29103. 0x0442,
  29104. "afii10085",
  29105. 0x0443,
  29106. "afii10086",
  29107. 0x0444,
  29108. "afii10087",
  29109. 0x0445,
  29110. "afii10088",
  29111. 0x0446,
  29112. "afii10089",
  29113. 0x0447,
  29114. "afii10090",
  29115. 0x0448,
  29116. "afii10091",
  29117. 0x0449,
  29118. "afii10092",
  29119. 0x044a,
  29120. "afii10093",
  29121. 0x044b,
  29122. "afii10094",
  29123. 0x044c,
  29124. "afii10095",
  29125. 0x044d,
  29126. "afii10096",
  29127. 0x044e,
  29128. "afii10097",
  29129. 0x044f,
  29130. "afii10098",
  29131. 0x0491,
  29132. "afii10099",
  29133. 0x0452,
  29134. "afii10100",
  29135. 0x0453,
  29136. "afii10101",
  29137. 0x0454,
  29138. "afii10102",
  29139. 0x0455,
  29140. "afii10103",
  29141. 0x0456,
  29142. "afii10104",
  29143. 0x0457,
  29144. "afii10105",
  29145. 0x0458,
  29146. "afii10106",
  29147. 0x0459,
  29148. "afii10107",
  29149. 0x045a,
  29150. "afii10108",
  29151. 0x045b,
  29152. "afii10109",
  29153. 0x045c,
  29154. "afii10110",
  29155. 0x045e,
  29156. "afii10145",
  29157. 0x040f,
  29158. "afii10146",
  29159. 0x0462,
  29160. "afii10147",
  29161. 0x0472,
  29162. "afii10148",
  29163. 0x0474,
  29164. "afii10192",
  29165. 0xf6c6,
  29166. "afii10193",
  29167. 0x045f,
  29168. "afii10194",
  29169. 0x0463,
  29170. "afii10195",
  29171. 0x0473,
  29172. "afii10196",
  29173. 0x0475,
  29174. "afii10831",
  29175. 0xf6c7,
  29176. "afii10832",
  29177. 0xf6c8,
  29178. "afii10846",
  29179. 0x04d9,
  29180. "afii299",
  29181. 0x200e,
  29182. "afii300",
  29183. 0x200f,
  29184. "afii301",
  29185. 0x200d,
  29186. "afii57381",
  29187. 0x066a,
  29188. "afii57388",
  29189. 0x060c,
  29190. "afii57392",
  29191. 0x0660,
  29192. "afii57393",
  29193. 0x0661,
  29194. "afii57394",
  29195. 0x0662,
  29196. "afii57395",
  29197. 0x0663,
  29198. "afii57396",
  29199. 0x0664,
  29200. "afii57397",
  29201. 0x0665,
  29202. "afii57398",
  29203. 0x0666,
  29204. "afii57399",
  29205. 0x0667,
  29206. "afii57400",
  29207. 0x0668,
  29208. "afii57401",
  29209. 0x0669,
  29210. "afii57403",
  29211. 0x061b,
  29212. "afii57407",
  29213. 0x061f,
  29214. "afii57409",
  29215. 0x0621,
  29216. "afii57410",
  29217. 0x0622,
  29218. "afii57411",
  29219. 0x0623,
  29220. "afii57412",
  29221. 0x0624,
  29222. "afii57413",
  29223. 0x0625,
  29224. "afii57414",
  29225. 0x0626,
  29226. "afii57415",
  29227. 0x0627,
  29228. "afii57416",
  29229. 0x0628,
  29230. "afii57417",
  29231. 0x0629,
  29232. "afii57418",
  29233. 0x062a,
  29234. "afii57419",
  29235. 0x062b,
  29236. "afii57420",
  29237. 0x062c,
  29238. "afii57421",
  29239. 0x062d,
  29240. "afii57422",
  29241. 0x062e,
  29242. "afii57423",
  29243. 0x062f,
  29244. "afii57424",
  29245. 0x0630,
  29246. "afii57425",
  29247. 0x0631,
  29248. "afii57426",
  29249. 0x0632,
  29250. "afii57427",
  29251. 0x0633,
  29252. "afii57428",
  29253. 0x0634,
  29254. "afii57429",
  29255. 0x0635,
  29256. "afii57430",
  29257. 0x0636,
  29258. "afii57431",
  29259. 0x0637,
  29260. "afii57432",
  29261. 0x0638,
  29262. "afii57433",
  29263. 0x0639,
  29264. "afii57434",
  29265. 0x063a,
  29266. "afii57440",
  29267. 0x0640,
  29268. "afii57441",
  29269. 0x0641,
  29270. "afii57442",
  29271. 0x0642,
  29272. "afii57443",
  29273. 0x0643,
  29274. "afii57444",
  29275. 0x0644,
  29276. "afii57445",
  29277. 0x0645,
  29278. "afii57446",
  29279. 0x0646,
  29280. "afii57448",
  29281. 0x0648,
  29282. "afii57449",
  29283. 0x0649,
  29284. "afii57450",
  29285. 0x064a,
  29286. "afii57451",
  29287. 0x064b,
  29288. "afii57452",
  29289. 0x064c,
  29290. "afii57453",
  29291. 0x064d,
  29292. "afii57454",
  29293. 0x064e,
  29294. "afii57455",
  29295. 0x064f,
  29296. "afii57456",
  29297. 0x0650,
  29298. "afii57457",
  29299. 0x0651,
  29300. "afii57458",
  29301. 0x0652,
  29302. "afii57470",
  29303. 0x0647,
  29304. "afii57505",
  29305. 0x06a4,
  29306. "afii57506",
  29307. 0x067e,
  29308. "afii57507",
  29309. 0x0686,
  29310. "afii57508",
  29311. 0x0698,
  29312. "afii57509",
  29313. 0x06af,
  29314. "afii57511",
  29315. 0x0679,
  29316. "afii57512",
  29317. 0x0688,
  29318. "afii57513",
  29319. 0x0691,
  29320. "afii57514",
  29321. 0x06ba,
  29322. "afii57519",
  29323. 0x06d2,
  29324. "afii57534",
  29325. 0x06d5,
  29326. "afii57636",
  29327. 0x20aa,
  29328. "afii57645",
  29329. 0x05be,
  29330. "afii57658",
  29331. 0x05c3,
  29332. "afii57664",
  29333. 0x05d0,
  29334. "afii57665",
  29335. 0x05d1,
  29336. "afii57666",
  29337. 0x05d2,
  29338. "afii57667",
  29339. 0x05d3,
  29340. "afii57668",
  29341. 0x05d4,
  29342. "afii57669",
  29343. 0x05d5,
  29344. "afii57670",
  29345. 0x05d6,
  29346. "afii57671",
  29347. 0x05d7,
  29348. "afii57672",
  29349. 0x05d8,
  29350. "afii57673",
  29351. 0x05d9,
  29352. "afii57674",
  29353. 0x05da,
  29354. "afii57675",
  29355. 0x05db,
  29356. "afii57676",
  29357. 0x05dc,
  29358. "afii57677",
  29359. 0x05dd,
  29360. "afii57678",
  29361. 0x05de,
  29362. "afii57679",
  29363. 0x05df,
  29364. "afii57680",
  29365. 0x05e0,
  29366. "afii57681",
  29367. 0x05e1,
  29368. "afii57682",
  29369. 0x05e2,
  29370. "afii57683",
  29371. 0x05e3,
  29372. "afii57684",
  29373. 0x05e4,
  29374. "afii57685",
  29375. 0x05e5,
  29376. "afii57686",
  29377. 0x05e6,
  29378. "afii57687",
  29379. 0x05e7,
  29380. "afii57688",
  29381. 0x05e8,
  29382. "afii57689",
  29383. 0x05e9,
  29384. "afii57690",
  29385. 0x05ea,
  29386. "afii57694",
  29387. 0xfb2a,
  29388. "afii57695",
  29389. 0xfb2b,
  29390. "afii57700",
  29391. 0xfb4b,
  29392. "afii57705",
  29393. 0xfb1f,
  29394. "afii57716",
  29395. 0x05f0,
  29396. "afii57717",
  29397. 0x05f1,
  29398. "afii57718",
  29399. 0x05f2,
  29400. "afii57723",
  29401. 0xfb35,
  29402. "afii57793",
  29403. 0x05b4,
  29404. "afii57794",
  29405. 0x05b5,
  29406. "afii57795",
  29407. 0x05b6,
  29408. "afii57796",
  29409. 0x05bb,
  29410. "afii57797",
  29411. 0x05b8,
  29412. "afii57798",
  29413. 0x05b7,
  29414. "afii57799",
  29415. 0x05b0,
  29416. "afii57800",
  29417. 0x05b2,
  29418. "afii57801",
  29419. 0x05b1,
  29420. "afii57802",
  29421. 0x05b3,
  29422. "afii57803",
  29423. 0x05c2,
  29424. "afii57804",
  29425. 0x05c1,
  29426. "afii57806",
  29427. 0x05b9,
  29428. "afii57807",
  29429. 0x05bc,
  29430. "afii57839",
  29431. 0x05bd,
  29432. "afii57841",
  29433. 0x05bf,
  29434. "afii57842",
  29435. 0x05c0,
  29436. "afii57929",
  29437. 0x02bc,
  29438. "afii61248",
  29439. 0x2105,
  29440. "afii61289",
  29441. 0x2113,
  29442. "afii61352",
  29443. 0x2116,
  29444. "afii61573",
  29445. 0x202c,
  29446. "afii61574",
  29447. 0x202d,
  29448. "afii61575",
  29449. 0x202e,
  29450. "afii61664",
  29451. 0x200c,
  29452. "afii63167",
  29453. 0x066d,
  29454. "afii64937",
  29455. 0x02bd,
  29456. "agrave",
  29457. 0x00e0,
  29458. "agujarati",
  29459. 0x0a85,
  29460. "agurmukhi",
  29461. 0x0a05,
  29462. "ahiragana",
  29463. 0x3042,
  29464. "ahookabove",
  29465. 0x1ea3,
  29466. "aibengali",
  29467. 0x0990,
  29468. "aibopomofo",
  29469. 0x311e,
  29470. "aideva",
  29471. 0x0910,
  29472. "aiecyrillic",
  29473. 0x04d5,
  29474. "aigujarati",
  29475. 0x0a90,
  29476. "aigurmukhi",
  29477. 0x0a10,
  29478. "aimatragurmukhi",
  29479. 0x0a48,
  29480. "ainarabic",
  29481. 0x0639,
  29482. "ainfinalarabic",
  29483. 0xfeca,
  29484. "aininitialarabic",
  29485. 0xfecb,
  29486. "ainmedialarabic",
  29487. 0xfecc,
  29488. "ainvertedbreve",
  29489. 0x0203,
  29490. "aivowelsignbengali",
  29491. 0x09c8,
  29492. "aivowelsigndeva",
  29493. 0x0948,
  29494. "aivowelsigngujarati",
  29495. 0x0ac8,
  29496. "akatakana",
  29497. 0x30a2,
  29498. "akatakanahalfwidth",
  29499. 0xff71,
  29500. "akorean",
  29501. 0x314f,
  29502. "alef",
  29503. 0x05d0,
  29504. "alefarabic",
  29505. 0x0627,
  29506. "alefdageshhebrew",
  29507. 0xfb30,
  29508. "aleffinalarabic",
  29509. 0xfe8e,
  29510. "alefhamzaabovearabic",
  29511. 0x0623,
  29512. "alefhamzaabovefinalarabic",
  29513. 0xfe84,
  29514. "alefhamzabelowarabic",
  29515. 0x0625,
  29516. "alefhamzabelowfinalarabic",
  29517. 0xfe88,
  29518. "alefhebrew",
  29519. 0x05d0,
  29520. "aleflamedhebrew",
  29521. 0xfb4f,
  29522. "alefmaddaabovearabic",
  29523. 0x0622,
  29524. "alefmaddaabovefinalarabic",
  29525. 0xfe82,
  29526. "alefmaksuraarabic",
  29527. 0x0649,
  29528. "alefmaksurafinalarabic",
  29529. 0xfef0,
  29530. "alefmaksurainitialarabic",
  29531. 0xfef3,
  29532. "alefmaksuramedialarabic",
  29533. 0xfef4,
  29534. "alefpatahhebrew",
  29535. 0xfb2e,
  29536. "alefqamatshebrew",
  29537. 0xfb2f,
  29538. "aleph",
  29539. 0x2135,
  29540. "allequal",
  29541. 0x224c,
  29542. "alpha",
  29543. 0x03b1,
  29544. "alphatonos",
  29545. 0x03ac,
  29546. "amacron",
  29547. 0x0101,
  29548. "amonospace",
  29549. 0xff41,
  29550. "ampersand",
  29551. 0x0026,
  29552. "ampersandmonospace",
  29553. 0xff06,
  29554. "ampersandsmall",
  29555. 0xf726,
  29556. "amsquare",
  29557. 0x33c2,
  29558. "anbopomofo",
  29559. 0x3122,
  29560. "angbopomofo",
  29561. 0x3124,
  29562. "angbracketleft",
  29563. 0x3008,
  29564. "angbracketright",
  29565. 0x3009,
  29566. "angkhankhuthai",
  29567. 0x0e5a,
  29568. "angle",
  29569. 0x2220,
  29570. "anglebracketleft",
  29571. 0x3008,
  29572. "anglebracketleftvertical",
  29573. 0xfe3f,
  29574. "anglebracketright",
  29575. 0x3009,
  29576. "anglebracketrightvertical",
  29577. 0xfe40,
  29578. "angleleft",
  29579. 0x2329,
  29580. "angleright",
  29581. 0x232a,
  29582. "angstrom",
  29583. 0x212b,
  29584. "anoteleia",
  29585. 0x0387,
  29586. "anudattadeva",
  29587. 0x0952,
  29588. "anusvarabengali",
  29589. 0x0982,
  29590. "anusvaradeva",
  29591. 0x0902,
  29592. "anusvaragujarati",
  29593. 0x0a82,
  29594. "aogonek",
  29595. 0x0105,
  29596. "apaatosquare",
  29597. 0x3300,
  29598. "aparen",
  29599. 0x249c,
  29600. "apostrophearmenian",
  29601. 0x055a,
  29602. "apostrophemod",
  29603. 0x02bc,
  29604. "apple",
  29605. 0xf8ff,
  29606. "approaches",
  29607. 0x2250,
  29608. "approxequal",
  29609. 0x2248,
  29610. "approxequalorimage",
  29611. 0x2252,
  29612. "approximatelyequal",
  29613. 0x2245,
  29614. "araeaekorean",
  29615. 0x318e,
  29616. "araeakorean",
  29617. 0x318d,
  29618. "arc",
  29619. 0x2312,
  29620. "arighthalfring",
  29621. 0x1e9a,
  29622. "aring",
  29623. 0x00e5,
  29624. "aringacute",
  29625. 0x01fb,
  29626. "aringbelow",
  29627. 0x1e01,
  29628. "arrowboth",
  29629. 0x2194,
  29630. "arrowdashdown",
  29631. 0x21e3,
  29632. "arrowdashleft",
  29633. 0x21e0,
  29634. "arrowdashright",
  29635. 0x21e2,
  29636. "arrowdashup",
  29637. 0x21e1,
  29638. "arrowdblboth",
  29639. 0x21d4,
  29640. "arrowdbldown",
  29641. 0x21d3,
  29642. "arrowdblleft",
  29643. 0x21d0,
  29644. "arrowdblright",
  29645. 0x21d2,
  29646. "arrowdblup",
  29647. 0x21d1,
  29648. "arrowdown",
  29649. 0x2193,
  29650. "arrowdownleft",
  29651. 0x2199,
  29652. "arrowdownright",
  29653. 0x2198,
  29654. "arrowdownwhite",
  29655. 0x21e9,
  29656. "arrowheaddownmod",
  29657. 0x02c5,
  29658. "arrowheadleftmod",
  29659. 0x02c2,
  29660. "arrowheadrightmod",
  29661. 0x02c3,
  29662. "arrowheadupmod",
  29663. 0x02c4,
  29664. "arrowhorizex",
  29665. 0xf8e7,
  29666. "arrowleft",
  29667. 0x2190,
  29668. "arrowleftdbl",
  29669. 0x21d0,
  29670. "arrowleftdblstroke",
  29671. 0x21cd,
  29672. "arrowleftoverright",
  29673. 0x21c6,
  29674. "arrowleftwhite",
  29675. 0x21e6,
  29676. "arrowright",
  29677. 0x2192,
  29678. "arrowrightdblstroke",
  29679. 0x21cf,
  29680. "arrowrightheavy",
  29681. 0x279e,
  29682. "arrowrightoverleft",
  29683. 0x21c4,
  29684. "arrowrightwhite",
  29685. 0x21e8,
  29686. "arrowtableft",
  29687. 0x21e4,
  29688. "arrowtabright",
  29689. 0x21e5,
  29690. "arrowup",
  29691. 0x2191,
  29692. "arrowupdn",
  29693. 0x2195,
  29694. "arrowupdnbse",
  29695. 0x21a8,
  29696. "arrowupdownbase",
  29697. 0x21a8,
  29698. "arrowupleft",
  29699. 0x2196,
  29700. "arrowupleftofdown",
  29701. 0x21c5,
  29702. "arrowupright",
  29703. 0x2197,
  29704. "arrowupwhite",
  29705. 0x21e7,
  29706. "arrowvertex",
  29707. 0xf8e6,
  29708. "asciicircum",
  29709. 0x005e,
  29710. "asciicircummonospace",
  29711. 0xff3e,
  29712. "asciitilde",
  29713. 0x007e,
  29714. "asciitildemonospace",
  29715. 0xff5e,
  29716. "ascript",
  29717. 0x0251,
  29718. "ascriptturned",
  29719. 0x0252,
  29720. "asmallhiragana",
  29721. 0x3041,
  29722. "asmallkatakana",
  29723. 0x30a1,
  29724. "asmallkatakanahalfwidth",
  29725. 0xff67,
  29726. "asterisk",
  29727. 0x002a,
  29728. "asteriskaltonearabic",
  29729. 0x066d,
  29730. "asteriskarabic",
  29731. 0x066d,
  29732. "asteriskmath",
  29733. 0x2217,
  29734. "asteriskmonospace",
  29735. 0xff0a,
  29736. "asterisksmall",
  29737. 0xfe61,
  29738. "asterism",
  29739. 0x2042,
  29740. "asuperior",
  29741. 0xf6e9,
  29742. "asymptoticallyequal",
  29743. 0x2243,
  29744. "at",
  29745. 0x0040,
  29746. "atilde",
  29747. 0x00e3,
  29748. "atmonospace",
  29749. 0xff20,
  29750. "atsmall",
  29751. 0xfe6b,
  29752. "aturned",
  29753. 0x0250,
  29754. "aubengali",
  29755. 0x0994,
  29756. "aubopomofo",
  29757. 0x3120,
  29758. "audeva",
  29759. 0x0914,
  29760. "augujarati",
  29761. 0x0a94,
  29762. "augurmukhi",
  29763. 0x0a14,
  29764. "aulengthmarkbengali",
  29765. 0x09d7,
  29766. "aumatragurmukhi",
  29767. 0x0a4c,
  29768. "auvowelsignbengali",
  29769. 0x09cc,
  29770. "auvowelsigndeva",
  29771. 0x094c,
  29772. "auvowelsigngujarati",
  29773. 0x0acc,
  29774. "avagrahadeva",
  29775. 0x093d,
  29776. "aybarmenian",
  29777. 0x0561,
  29778. "ayin",
  29779. 0x05e2,
  29780. "ayinaltonehebrew",
  29781. 0xfb20,
  29782. "ayinhebrew",
  29783. 0x05e2,
  29784. "b",
  29785. 0x0062,
  29786. "babengali",
  29787. 0x09ac,
  29788. "backslash",
  29789. 0x005c,
  29790. "backslashmonospace",
  29791. 0xff3c,
  29792. "badeva",
  29793. 0x092c,
  29794. "bagujarati",
  29795. 0x0aac,
  29796. "bagurmukhi",
  29797. 0x0a2c,
  29798. "bahiragana",
  29799. 0x3070,
  29800. "bahtthai",
  29801. 0x0e3f,
  29802. "bakatakana",
  29803. 0x30d0,
  29804. "bar",
  29805. 0x007c,
  29806. "barmonospace",
  29807. 0xff5c,
  29808. "bbopomofo",
  29809. 0x3105,
  29810. "bcircle",
  29811. 0x24d1,
  29812. "bdotaccent",
  29813. 0x1e03,
  29814. "bdotbelow",
  29815. 0x1e05,
  29816. "beamedsixteenthnotes",
  29817. 0x266c,
  29818. "because",
  29819. 0x2235,
  29820. "becyrillic",
  29821. 0x0431,
  29822. "beharabic",
  29823. 0x0628,
  29824. "behfinalarabic",
  29825. 0xfe90,
  29826. "behinitialarabic",
  29827. 0xfe91,
  29828. "behiragana",
  29829. 0x3079,
  29830. "behmedialarabic",
  29831. 0xfe92,
  29832. "behmeeminitialarabic",
  29833. 0xfc9f,
  29834. "behmeemisolatedarabic",
  29835. 0xfc08,
  29836. "behnoonfinalarabic",
  29837. 0xfc6d,
  29838. "bekatakana",
  29839. 0x30d9,
  29840. "benarmenian",
  29841. 0x0562,
  29842. "bet",
  29843. 0x05d1,
  29844. "beta",
  29845. 0x03b2,
  29846. "betasymbolgreek",
  29847. 0x03d0,
  29848. "betdagesh",
  29849. 0xfb31,
  29850. "betdageshhebrew",
  29851. 0xfb31,
  29852. "bethebrew",
  29853. 0x05d1,
  29854. "betrafehebrew",
  29855. 0xfb4c,
  29856. "bhabengali",
  29857. 0x09ad,
  29858. "bhadeva",
  29859. 0x092d,
  29860. "bhagujarati",
  29861. 0x0aad,
  29862. "bhagurmukhi",
  29863. 0x0a2d,
  29864. "bhook",
  29865. 0x0253,
  29866. "bihiragana",
  29867. 0x3073,
  29868. "bikatakana",
  29869. 0x30d3,
  29870. "bilabialclick",
  29871. 0x0298,
  29872. "bindigurmukhi",
  29873. 0x0a02,
  29874. "birusquare",
  29875. 0x3331,
  29876. "blackcircle",
  29877. 0x25cf,
  29878. "blackdiamond",
  29879. 0x25c6,
  29880. "blackdownpointingtriangle",
  29881. 0x25bc,
  29882. "blackleftpointingpointer",
  29883. 0x25c4,
  29884. "blackleftpointingtriangle",
  29885. 0x25c0,
  29886. "blacklenticularbracketleft",
  29887. 0x3010,
  29888. "blacklenticularbracketleftvertical",
  29889. 0xfe3b,
  29890. "blacklenticularbracketright",
  29891. 0x3011,
  29892. "blacklenticularbracketrightvertical",
  29893. 0xfe3c,
  29894. "blacklowerlefttriangle",
  29895. 0x25e3,
  29896. "blacklowerrighttriangle",
  29897. 0x25e2,
  29898. "blackrectangle",
  29899. 0x25ac,
  29900. "blackrightpointingpointer",
  29901. 0x25ba,
  29902. "blackrightpointingtriangle",
  29903. 0x25b6,
  29904. "blacksmallsquare",
  29905. 0x25aa,
  29906. "blacksmilingface",
  29907. 0x263b,
  29908. "blacksquare",
  29909. 0x25a0,
  29910. "blackstar",
  29911. 0x2605,
  29912. "blackupperlefttriangle",
  29913. 0x25e4,
  29914. "blackupperrighttriangle",
  29915. 0x25e5,
  29916. "blackuppointingsmalltriangle",
  29917. 0x25b4,
  29918. "blackuppointingtriangle",
  29919. 0x25b2,
  29920. "blank",
  29921. 0x2423,
  29922. "blinebelow",
  29923. 0x1e07,
  29924. "block",
  29925. 0x2588,
  29926. "bmonospace",
  29927. 0xff42,
  29928. "bobaimaithai",
  29929. 0x0e1a,
  29930. "bohiragana",
  29931. 0x307c,
  29932. "bokatakana",
  29933. 0x30dc,
  29934. "bparen",
  29935. 0x249d,
  29936. "bqsquare",
  29937. 0x33c3,
  29938. "braceex",
  29939. 0xf8f4,
  29940. "braceleft",
  29941. 0x007b,
  29942. "braceleftbt",
  29943. 0xf8f3,
  29944. "braceleftmid",
  29945. 0xf8f2,
  29946. "braceleftmonospace",
  29947. 0xff5b,
  29948. "braceleftsmall",
  29949. 0xfe5b,
  29950. "bracelefttp",
  29951. 0xf8f1,
  29952. "braceleftvertical",
  29953. 0xfe37,
  29954. "braceright",
  29955. 0x007d,
  29956. "bracerightbt",
  29957. 0xf8fe,
  29958. "bracerightmid",
  29959. 0xf8fd,
  29960. "bracerightmonospace",
  29961. 0xff5d,
  29962. "bracerightsmall",
  29963. 0xfe5c,
  29964. "bracerighttp",
  29965. 0xf8fc,
  29966. "bracerightvertical",
  29967. 0xfe38,
  29968. "bracketleft",
  29969. 0x005b,
  29970. "bracketleftbt",
  29971. 0xf8f0,
  29972. "bracketleftex",
  29973. 0xf8ef,
  29974. "bracketleftmonospace",
  29975. 0xff3b,
  29976. "bracketlefttp",
  29977. 0xf8ee,
  29978. "bracketright",
  29979. 0x005d,
  29980. "bracketrightbt",
  29981. 0xf8fb,
  29982. "bracketrightex",
  29983. 0xf8fa,
  29984. "bracketrightmonospace",
  29985. 0xff3d,
  29986. "bracketrighttp",
  29987. 0xf8f9,
  29988. "breve",
  29989. 0x02d8,
  29990. "brevebelowcmb",
  29991. 0x032e,
  29992. "brevecmb",
  29993. 0x0306,
  29994. "breveinvertedbelowcmb",
  29995. 0x032f,
  29996. "breveinvertedcmb",
  29997. 0x0311,
  29998. "breveinverteddoublecmb",
  29999. 0x0361,
  30000. "bridgebelowcmb",
  30001. 0x032a,
  30002. "bridgeinvertedbelowcmb",
  30003. 0x033a,
  30004. "brokenbar",
  30005. 0x00a6,
  30006. "bstroke",
  30007. 0x0180,
  30008. "bsuperior",
  30009. 0xf6ea,
  30010. "btopbar",
  30011. 0x0183,
  30012. "buhiragana",
  30013. 0x3076,
  30014. "bukatakana",
  30015. 0x30d6,
  30016. "bullet",
  30017. 0x2022,
  30018. "bulletinverse",
  30019. 0x25d8,
  30020. "bulletoperator",
  30021. 0x2219,
  30022. "bullseye",
  30023. 0x25ce,
  30024. "c",
  30025. 0x0063,
  30026. "caarmenian",
  30027. 0x056e,
  30028. "cabengali",
  30029. 0x099a,
  30030. "cacute",
  30031. 0x0107,
  30032. "cadeva",
  30033. 0x091a,
  30034. "cagujarati",
  30035. 0x0a9a,
  30036. "cagurmukhi",
  30037. 0x0a1a,
  30038. "calsquare",
  30039. 0x3388,
  30040. "candrabindubengali",
  30041. 0x0981,
  30042. "candrabinducmb",
  30043. 0x0310,
  30044. "candrabindudeva",
  30045. 0x0901,
  30046. "candrabindugujarati",
  30047. 0x0a81,
  30048. "capslock",
  30049. 0x21ea,
  30050. "careof",
  30051. 0x2105,
  30052. "caron",
  30053. 0x02c7,
  30054. "caronbelowcmb",
  30055. 0x032c,
  30056. "caroncmb",
  30057. 0x030c,
  30058. "carriagereturn",
  30059. 0x21b5,
  30060. "cbopomofo",
  30061. 0x3118,
  30062. "ccaron",
  30063. 0x010d,
  30064. "ccedilla",
  30065. 0x00e7,
  30066. "ccedillaacute",
  30067. 0x1e09,
  30068. "ccircle",
  30069. 0x24d2,
  30070. "ccircumflex",
  30071. 0x0109,
  30072. "ccurl",
  30073. 0x0255,
  30074. "cdot",
  30075. 0x010b,
  30076. "cdotaccent",
  30077. 0x010b,
  30078. "cdsquare",
  30079. 0x33c5,
  30080. "cedilla",
  30081. 0x00b8,
  30082. "cedillacmb",
  30083. 0x0327,
  30084. "cent",
  30085. 0x00a2,
  30086. "centigrade",
  30087. 0x2103,
  30088. "centinferior",
  30089. 0xf6df,
  30090. "centmonospace",
  30091. 0xffe0,
  30092. "centoldstyle",
  30093. 0xf7a2,
  30094. "centsuperior",
  30095. 0xf6e0,
  30096. "chaarmenian",
  30097. 0x0579,
  30098. "chabengali",
  30099. 0x099b,
  30100. "chadeva",
  30101. 0x091b,
  30102. "chagujarati",
  30103. 0x0a9b,
  30104. "chagurmukhi",
  30105. 0x0a1b,
  30106. "chbopomofo",
  30107. 0x3114,
  30108. "cheabkhasiancyrillic",
  30109. 0x04bd,
  30110. "checkmark",
  30111. 0x2713,
  30112. "checyrillic",
  30113. 0x0447,
  30114. "chedescenderabkhasiancyrillic",
  30115. 0x04bf,
  30116. "chedescendercyrillic",
  30117. 0x04b7,
  30118. "chedieresiscyrillic",
  30119. 0x04f5,
  30120. "cheharmenian",
  30121. 0x0573,
  30122. "chekhakassiancyrillic",
  30123. 0x04cc,
  30124. "cheverticalstrokecyrillic",
  30125. 0x04b9,
  30126. "chi",
  30127. 0x03c7,
  30128. "chieuchacirclekorean",
  30129. 0x3277,
  30130. "chieuchaparenkorean",
  30131. 0x3217,
  30132. "chieuchcirclekorean",
  30133. 0x3269,
  30134. "chieuchkorean",
  30135. 0x314a,
  30136. "chieuchparenkorean",
  30137. 0x3209,
  30138. "chochangthai",
  30139. 0x0e0a,
  30140. "chochanthai",
  30141. 0x0e08,
  30142. "chochingthai",
  30143. 0x0e09,
  30144. "chochoethai",
  30145. 0x0e0c,
  30146. "chook",
  30147. 0x0188,
  30148. "cieucacirclekorean",
  30149. 0x3276,
  30150. "cieucaparenkorean",
  30151. 0x3216,
  30152. "cieuccirclekorean",
  30153. 0x3268,
  30154. "cieuckorean",
  30155. 0x3148,
  30156. "cieucparenkorean",
  30157. 0x3208,
  30158. "cieucuparenkorean",
  30159. 0x321c,
  30160. "circle",
  30161. 0x25cb,
  30162. "circlecopyrt",
  30163. 0x00a9,
  30164. "circlemultiply",
  30165. 0x2297,
  30166. "circleot",
  30167. 0x2299,
  30168. "circleplus",
  30169. 0x2295,
  30170. "circlepostalmark",
  30171. 0x3036,
  30172. "circlewithlefthalfblack",
  30173. 0x25d0,
  30174. "circlewithrighthalfblack",
  30175. 0x25d1,
  30176. "circumflex",
  30177. 0x02c6,
  30178. "circumflexbelowcmb",
  30179. 0x032d,
  30180. "circumflexcmb",
  30181. 0x0302,
  30182. "clear",
  30183. 0x2327,
  30184. "clickalveolar",
  30185. 0x01c2,
  30186. "clickdental",
  30187. 0x01c0,
  30188. "clicklateral",
  30189. 0x01c1,
  30190. "clickretroflex",
  30191. 0x01c3,
  30192. "club",
  30193. 0x2663,
  30194. "clubsuitblack",
  30195. 0x2663,
  30196. "clubsuitwhite",
  30197. 0x2667,
  30198. "cmcubedsquare",
  30199. 0x33a4,
  30200. "cmonospace",
  30201. 0xff43,
  30202. "cmsquaredsquare",
  30203. 0x33a0,
  30204. "coarmenian",
  30205. 0x0581,
  30206. "colon",
  30207. 0x003a,
  30208. "colonmonetary",
  30209. 0x20a1,
  30210. "colonmonospace",
  30211. 0xff1a,
  30212. "colonsign",
  30213. 0x20a1,
  30214. "colonsmall",
  30215. 0xfe55,
  30216. "colontriangularhalfmod",
  30217. 0x02d1,
  30218. "colontriangularmod",
  30219. 0x02d0,
  30220. "comma",
  30221. 0x002c,
  30222. "commaabovecmb",
  30223. 0x0313,
  30224. "commaaboverightcmb",
  30225. 0x0315,
  30226. "commaaccent",
  30227. 0xf6c3,
  30228. "commaarabic",
  30229. 0x060c,
  30230. "commaarmenian",
  30231. 0x055d,
  30232. "commainferior",
  30233. 0xf6e1,
  30234. "commamonospace",
  30235. 0xff0c,
  30236. "commareversedabovecmb",
  30237. 0x0314,
  30238. "commareversedmod",
  30239. 0x02bd,
  30240. "commasmall",
  30241. 0xfe50,
  30242. "commasuperior",
  30243. 0xf6e2,
  30244. "commaturnedabovecmb",
  30245. 0x0312,
  30246. "commaturnedmod",
  30247. 0x02bb,
  30248. "compass",
  30249. 0x263c,
  30250. "congruent",
  30251. 0x2245,
  30252. "contourintegral",
  30253. 0x222e,
  30254. "control",
  30255. 0x2303,
  30256. "controlACK",
  30257. 0x0006,
  30258. "controlBEL",
  30259. 0x0007,
  30260. "controlBS",
  30261. 0x0008,
  30262. "controlCAN",
  30263. 0x0018,
  30264. "controlCR",
  30265. 0x000d,
  30266. "controlDC1",
  30267. 0x0011,
  30268. "controlDC2",
  30269. 0x0012,
  30270. "controlDC3",
  30271. 0x0013,
  30272. "controlDC4",
  30273. 0x0014,
  30274. "controlDEL",
  30275. 0x007f,
  30276. "controlDLE",
  30277. 0x0010,
  30278. "controlEM",
  30279. 0x0019,
  30280. "controlENQ",
  30281. 0x0005,
  30282. "controlEOT",
  30283. 0x0004,
  30284. "controlESC",
  30285. 0x001b,
  30286. "controlETB",
  30287. 0x0017,
  30288. "controlETX",
  30289. 0x0003,
  30290. "controlFF",
  30291. 0x000c,
  30292. "controlFS",
  30293. 0x001c,
  30294. "controlGS",
  30295. 0x001d,
  30296. "controlHT",
  30297. 0x0009,
  30298. "controlLF",
  30299. 0x000a,
  30300. "controlNAK",
  30301. 0x0015,
  30302. "controlNULL",
  30303. 0x0000,
  30304. "controlRS",
  30305. 0x001e,
  30306. "controlSI",
  30307. 0x000f,
  30308. "controlSO",
  30309. 0x000e,
  30310. "controlSOT",
  30311. 0x0002,
  30312. "controlSTX",
  30313. 0x0001,
  30314. "controlSUB",
  30315. 0x001a,
  30316. "controlSYN",
  30317. 0x0016,
  30318. "controlUS",
  30319. 0x001f,
  30320. "controlVT",
  30321. 0x000b,
  30322. "copyright",
  30323. 0x00a9,
  30324. "copyrightsans",
  30325. 0xf8e9,
  30326. "copyrightserif",
  30327. 0xf6d9,
  30328. "cornerbracketleft",
  30329. 0x300c,
  30330. "cornerbracketlefthalfwidth",
  30331. 0xff62,
  30332. "cornerbracketleftvertical",
  30333. 0xfe41,
  30334. "cornerbracketright",
  30335. 0x300d,
  30336. "cornerbracketrighthalfwidth",
  30337. 0xff63,
  30338. "cornerbracketrightvertical",
  30339. 0xfe42,
  30340. "corporationsquare",
  30341. 0x337f,
  30342. "cosquare",
  30343. 0x33c7,
  30344. "coverkgsquare",
  30345. 0x33c6,
  30346. "cparen",
  30347. 0x249e,
  30348. "cruzeiro",
  30349. 0x20a2,
  30350. "cstretched",
  30351. 0x0297,
  30352. "curlyand",
  30353. 0x22cf,
  30354. "curlyor",
  30355. 0x22ce,
  30356. "currency",
  30357. 0x00a4,
  30358. "cyrBreve",
  30359. 0xf6d1,
  30360. "cyrFlex",
  30361. 0xf6d2,
  30362. "cyrbreve",
  30363. 0xf6d4,
  30364. "cyrflex",
  30365. 0xf6d5,
  30366. "d",
  30367. 0x0064,
  30368. "daarmenian",
  30369. 0x0564,
  30370. "dabengali",
  30371. 0x09a6,
  30372. "dadarabic",
  30373. 0x0636,
  30374. "dadeva",
  30375. 0x0926,
  30376. "dadfinalarabic",
  30377. 0xfebe,
  30378. "dadinitialarabic",
  30379. 0xfebf,
  30380. "dadmedialarabic",
  30381. 0xfec0,
  30382. "dagesh",
  30383. 0x05bc,
  30384. "dageshhebrew",
  30385. 0x05bc,
  30386. "dagger",
  30387. 0x2020,
  30388. "daggerdbl",
  30389. 0x2021,
  30390. "dagujarati",
  30391. 0x0aa6,
  30392. "dagurmukhi",
  30393. 0x0a26,
  30394. "dahiragana",
  30395. 0x3060,
  30396. "dakatakana",
  30397. 0x30c0,
  30398. "dalarabic",
  30399. 0x062f,
  30400. "dalet",
  30401. 0x05d3,
  30402. "daletdagesh",
  30403. 0xfb33,
  30404. "daletdageshhebrew",
  30405. 0xfb33,
  30406. "dalethebrew",
  30407. 0x05d3,
  30408. "dalfinalarabic",
  30409. 0xfeaa,
  30410. "dammaarabic",
  30411. 0x064f,
  30412. "dammalowarabic",
  30413. 0x064f,
  30414. "dammatanaltonearabic",
  30415. 0x064c,
  30416. "dammatanarabic",
  30417. 0x064c,
  30418. "danda",
  30419. 0x0964,
  30420. "dargahebrew",
  30421. 0x05a7,
  30422. "dargalefthebrew",
  30423. 0x05a7,
  30424. "dasiapneumatacyrilliccmb",
  30425. 0x0485,
  30426. "dblGrave",
  30427. 0xf6d3,
  30428. "dblanglebracketleft",
  30429. 0x300a,
  30430. "dblanglebracketleftvertical",
  30431. 0xfe3d,
  30432. "dblanglebracketright",
  30433. 0x300b,
  30434. "dblanglebracketrightvertical",
  30435. 0xfe3e,
  30436. "dblarchinvertedbelowcmb",
  30437. 0x032b,
  30438. "dblarrowleft",
  30439. 0x21d4,
  30440. "dblarrowright",
  30441. 0x21d2,
  30442. "dbldanda",
  30443. 0x0965,
  30444. "dblgrave",
  30445. 0xf6d6,
  30446. "dblgravecmb",
  30447. 0x030f,
  30448. "dblintegral",
  30449. 0x222c,
  30450. "dbllowline",
  30451. 0x2017,
  30452. "dbllowlinecmb",
  30453. 0x0333,
  30454. "dbloverlinecmb",
  30455. 0x033f,
  30456. "dblprimemod",
  30457. 0x02ba,
  30458. "dblverticalbar",
  30459. 0x2016,
  30460. "dblverticallineabovecmb",
  30461. 0x030e,
  30462. "dbopomofo",
  30463. 0x3109,
  30464. "dbsquare",
  30465. 0x33c8,
  30466. "dcaron",
  30467. 0x010f,
  30468. "dcedilla",
  30469. 0x1e11,
  30470. "dcircle",
  30471. 0x24d3,
  30472. "dcircumflexbelow",
  30473. 0x1e13,
  30474. "dcroat",
  30475. 0x0111,
  30476. "ddabengali",
  30477. 0x09a1,
  30478. "ddadeva",
  30479. 0x0921,
  30480. "ddagujarati",
  30481. 0x0aa1,
  30482. "ddagurmukhi",
  30483. 0x0a21,
  30484. "ddalarabic",
  30485. 0x0688,
  30486. "ddalfinalarabic",
  30487. 0xfb89,
  30488. "dddhadeva",
  30489. 0x095c,
  30490. "ddhabengali",
  30491. 0x09a2,
  30492. "ddhadeva",
  30493. 0x0922,
  30494. "ddhagujarati",
  30495. 0x0aa2,
  30496. "ddhagurmukhi",
  30497. 0x0a22,
  30498. "ddotaccent",
  30499. 0x1e0b,
  30500. "ddotbelow",
  30501. 0x1e0d,
  30502. "decimalseparatorarabic",
  30503. 0x066b,
  30504. "decimalseparatorpersian",
  30505. 0x066b,
  30506. "decyrillic",
  30507. 0x0434,
  30508. "degree",
  30509. 0x00b0,
  30510. "dehihebrew",
  30511. 0x05ad,
  30512. "dehiragana",
  30513. 0x3067,
  30514. "deicoptic",
  30515. 0x03ef,
  30516. "dekatakana",
  30517. 0x30c7,
  30518. "deleteleft",
  30519. 0x232b,
  30520. "deleteright",
  30521. 0x2326,
  30522. "delta",
  30523. 0x03b4,
  30524. "deltaturned",
  30525. 0x018d,
  30526. "denominatorminusonenumeratorbengali",
  30527. 0x09f8,
  30528. "dezh",
  30529. 0x02a4,
  30530. "dhabengali",
  30531. 0x09a7,
  30532. "dhadeva",
  30533. 0x0927,
  30534. "dhagujarati",
  30535. 0x0aa7,
  30536. "dhagurmukhi",
  30537. 0x0a27,
  30538. "dhook",
  30539. 0x0257,
  30540. "dialytikatonos",
  30541. 0x0385,
  30542. "dialytikatonoscmb",
  30543. 0x0344,
  30544. "diamond",
  30545. 0x2666,
  30546. "diamondsuitwhite",
  30547. 0x2662,
  30548. "dieresis",
  30549. 0x00a8,
  30550. "dieresisacute",
  30551. 0xf6d7,
  30552. "dieresisbelowcmb",
  30553. 0x0324,
  30554. "dieresiscmb",
  30555. 0x0308,
  30556. "dieresisgrave",
  30557. 0xf6d8,
  30558. "dieresistonos",
  30559. 0x0385,
  30560. "dihiragana",
  30561. 0x3062,
  30562. "dikatakana",
  30563. 0x30c2,
  30564. "dittomark",
  30565. 0x3003,
  30566. "divide",
  30567. 0x00f7,
  30568. "divides",
  30569. 0x2223,
  30570. "divisionslash",
  30571. 0x2215,
  30572. "djecyrillic",
  30573. 0x0452,
  30574. "dkshade",
  30575. 0x2593,
  30576. "dlinebelow",
  30577. 0x1e0f,
  30578. "dlsquare",
  30579. 0x3397,
  30580. "dmacron",
  30581. 0x0111,
  30582. "dmonospace",
  30583. 0xff44,
  30584. "dnblock",
  30585. 0x2584,
  30586. "dochadathai",
  30587. 0x0e0e,
  30588. "dodekthai",
  30589. 0x0e14,
  30590. "dohiragana",
  30591. 0x3069,
  30592. "dokatakana",
  30593. 0x30c9,
  30594. "dollar",
  30595. 0x0024,
  30596. "dollarinferior",
  30597. 0xf6e3,
  30598. "dollarmonospace",
  30599. 0xff04,
  30600. "dollaroldstyle",
  30601. 0xf724,
  30602. "dollarsmall",
  30603. 0xfe69,
  30604. "dollarsuperior",
  30605. 0xf6e4,
  30606. "dong",
  30607. 0x20ab,
  30608. "dorusquare",
  30609. 0x3326,
  30610. "dotaccent",
  30611. 0x02d9,
  30612. "dotaccentcmb",
  30613. 0x0307,
  30614. "dotbelowcmb",
  30615. 0x0323,
  30616. "dotbelowcomb",
  30617. 0x0323,
  30618. "dotkatakana",
  30619. 0x30fb,
  30620. "dotlessi",
  30621. 0x0131,
  30622. "dotlessj",
  30623. 0xf6be,
  30624. "dotlessjstrokehook",
  30625. 0x0284,
  30626. "dotmath",
  30627. 0x22c5,
  30628. "dottedcircle",
  30629. 0x25cc,
  30630. "doubleyodpatah",
  30631. 0xfb1f,
  30632. "doubleyodpatahhebrew",
  30633. 0xfb1f,
  30634. "downtackbelowcmb",
  30635. 0x031e,
  30636. "downtackmod",
  30637. 0x02d5,
  30638. "dparen",
  30639. 0x249f,
  30640. "dsuperior",
  30641. 0xf6eb,
  30642. "dtail",
  30643. 0x0256,
  30644. "dtopbar",
  30645. 0x018c,
  30646. "duhiragana",
  30647. 0x3065,
  30648. "dukatakana",
  30649. 0x30c5,
  30650. "dz",
  30651. 0x01f3,
  30652. "dzaltone",
  30653. 0x02a3,
  30654. "dzcaron",
  30655. 0x01c6,
  30656. "dzcurl",
  30657. 0x02a5,
  30658. "dzeabkhasiancyrillic",
  30659. 0x04e1,
  30660. "dzecyrillic",
  30661. 0x0455,
  30662. "dzhecyrillic",
  30663. 0x045f,
  30664. "e",
  30665. 0x0065,
  30666. "eacute",
  30667. 0x00e9,
  30668. "earth",
  30669. 0x2641,
  30670. "ebengali",
  30671. 0x098f,
  30672. "ebopomofo",
  30673. 0x311c,
  30674. "ebreve",
  30675. 0x0115,
  30676. "ecandradeva",
  30677. 0x090d,
  30678. "ecandragujarati",
  30679. 0x0a8d,
  30680. "ecandravowelsigndeva",
  30681. 0x0945,
  30682. "ecandravowelsigngujarati",
  30683. 0x0ac5,
  30684. "ecaron",
  30685. 0x011b,
  30686. "ecedillabreve",
  30687. 0x1e1d,
  30688. "echarmenian",
  30689. 0x0565,
  30690. "echyiwnarmenian",
  30691. 0x0587,
  30692. "ecircle",
  30693. 0x24d4,
  30694. "ecircumflex",
  30695. 0x00ea,
  30696. "ecircumflexacute",
  30697. 0x1ebf,
  30698. "ecircumflexbelow",
  30699. 0x1e19,
  30700. "ecircumflexdotbelow",
  30701. 0x1ec7,
  30702. "ecircumflexgrave",
  30703. 0x1ec1,
  30704. "ecircumflexhookabove",
  30705. 0x1ec3,
  30706. "ecircumflextilde",
  30707. 0x1ec5,
  30708. "ecyrillic",
  30709. 0x0454,
  30710. "edblgrave",
  30711. 0x0205,
  30712. "edeva",
  30713. 0x090f,
  30714. "edieresis",
  30715. 0x00eb,
  30716. "edot",
  30717. 0x0117,
  30718. "edotaccent",
  30719. 0x0117,
  30720. "edotbelow",
  30721. 0x1eb9,
  30722. "eegurmukhi",
  30723. 0x0a0f,
  30724. "eematragurmukhi",
  30725. 0x0a47,
  30726. "efcyrillic",
  30727. 0x0444,
  30728. "egrave",
  30729. 0x00e8,
  30730. "egujarati",
  30731. 0x0a8f,
  30732. "eharmenian",
  30733. 0x0567,
  30734. "ehbopomofo",
  30735. 0x311d,
  30736. "ehiragana",
  30737. 0x3048,
  30738. "ehookabove",
  30739. 0x1ebb,
  30740. "eibopomofo",
  30741. 0x311f,
  30742. "eight",
  30743. 0x0038,
  30744. "eightarabic",
  30745. 0x0668,
  30746. "eightbengali",
  30747. 0x09ee,
  30748. "eightcircle",
  30749. 0x2467,
  30750. "eightcircleinversesansserif",
  30751. 0x2791,
  30752. "eightdeva",
  30753. 0x096e,
  30754. "eighteencircle",
  30755. 0x2471,
  30756. "eighteenparen",
  30757. 0x2485,
  30758. "eighteenperiod",
  30759. 0x2499,
  30760. "eightgujarati",
  30761. 0x0aee,
  30762. "eightgurmukhi",
  30763. 0x0a6e,
  30764. "eighthackarabic",
  30765. 0x0668,
  30766. "eighthangzhou",
  30767. 0x3028,
  30768. "eighthnotebeamed",
  30769. 0x266b,
  30770. "eightideographicparen",
  30771. 0x3227,
  30772. "eightinferior",
  30773. 0x2088,
  30774. "eightmonospace",
  30775. 0xff18,
  30776. "eightoldstyle",
  30777. 0xf738,
  30778. "eightparen",
  30779. 0x247b,
  30780. "eightperiod",
  30781. 0x248f,
  30782. "eightpersian",
  30783. 0x06f8,
  30784. "eightroman",
  30785. 0x2177,
  30786. "eightsuperior",
  30787. 0x2078,
  30788. "eightthai",
  30789. 0x0e58,
  30790. "einvertedbreve",
  30791. 0x0207,
  30792. "eiotifiedcyrillic",
  30793. 0x0465,
  30794. "ekatakana",
  30795. 0x30a8,
  30796. "ekatakanahalfwidth",
  30797. 0xff74,
  30798. "ekonkargurmukhi",
  30799. 0x0a74,
  30800. "ekorean",
  30801. 0x3154,
  30802. "elcyrillic",
  30803. 0x043b,
  30804. "element",
  30805. 0x2208,
  30806. "elevencircle",
  30807. 0x246a,
  30808. "elevenparen",
  30809. 0x247e,
  30810. "elevenperiod",
  30811. 0x2492,
  30812. "elevenroman",
  30813. 0x217a,
  30814. "ellipsis",
  30815. 0x2026,
  30816. "ellipsisvertical",
  30817. 0x22ee,
  30818. "emacron",
  30819. 0x0113,
  30820. "emacronacute",
  30821. 0x1e17,
  30822. "emacrongrave",
  30823. 0x1e15,
  30824. "emcyrillic",
  30825. 0x043c,
  30826. "emdash",
  30827. 0x2014,
  30828. "emdashvertical",
  30829. 0xfe31,
  30830. "emonospace",
  30831. 0xff45,
  30832. "emphasismarkarmenian",
  30833. 0x055b,
  30834. "emptyset",
  30835. 0x2205,
  30836. "enbopomofo",
  30837. 0x3123,
  30838. "encyrillic",
  30839. 0x043d,
  30840. "endash",
  30841. 0x2013,
  30842. "endashvertical",
  30843. 0xfe32,
  30844. "endescendercyrillic",
  30845. 0x04a3,
  30846. "eng",
  30847. 0x014b,
  30848. "engbopomofo",
  30849. 0x3125,
  30850. "enghecyrillic",
  30851. 0x04a5,
  30852. "enhookcyrillic",
  30853. 0x04c8,
  30854. "enspace",
  30855. 0x2002,
  30856. "eogonek",
  30857. 0x0119,
  30858. "eokorean",
  30859. 0x3153,
  30860. "eopen",
  30861. 0x025b,
  30862. "eopenclosed",
  30863. 0x029a,
  30864. "eopenreversed",
  30865. 0x025c,
  30866. "eopenreversedclosed",
  30867. 0x025e,
  30868. "eopenreversedhook",
  30869. 0x025d,
  30870. "eparen",
  30871. 0x24a0,
  30872. "epsilon",
  30873. 0x03b5,
  30874. "epsilontonos",
  30875. 0x03ad,
  30876. "equal",
  30877. 0x003d,
  30878. "equalmonospace",
  30879. 0xff1d,
  30880. "equalsmall",
  30881. 0xfe66,
  30882. "equalsuperior",
  30883. 0x207c,
  30884. "equivalence",
  30885. 0x2261,
  30886. "erbopomofo",
  30887. 0x3126,
  30888. "ercyrillic",
  30889. 0x0440,
  30890. "ereversed",
  30891. 0x0258,
  30892. "ereversedcyrillic",
  30893. 0x044d,
  30894. "escyrillic",
  30895. 0x0441,
  30896. "esdescendercyrillic",
  30897. 0x04ab,
  30898. "esh",
  30899. 0x0283,
  30900. "eshcurl",
  30901. 0x0286,
  30902. "eshortdeva",
  30903. 0x090e,
  30904. "eshortvowelsigndeva",
  30905. 0x0946,
  30906. "eshreversedloop",
  30907. 0x01aa,
  30908. "eshsquatreversed",
  30909. 0x0285,
  30910. "esmallhiragana",
  30911. 0x3047,
  30912. "esmallkatakana",
  30913. 0x30a7,
  30914. "esmallkatakanahalfwidth",
  30915. 0xff6a,
  30916. "estimated",
  30917. 0x212e,
  30918. "esuperior",
  30919. 0xf6ec,
  30920. "eta",
  30921. 0x03b7,
  30922. "etarmenian",
  30923. 0x0568,
  30924. "etatonos",
  30925. 0x03ae,
  30926. "eth",
  30927. 0x00f0,
  30928. "etilde",
  30929. 0x1ebd,
  30930. "etildebelow",
  30931. 0x1e1b,
  30932. "etnahtafoukhhebrew",
  30933. 0x0591,
  30934. "etnahtafoukhlefthebrew",
  30935. 0x0591,
  30936. "etnahtahebrew",
  30937. 0x0591,
  30938. "etnahtalefthebrew",
  30939. 0x0591,
  30940. "eturned",
  30941. 0x01dd,
  30942. "eukorean",
  30943. 0x3161,
  30944. "euro",
  30945. 0x20ac,
  30946. "evowelsignbengali",
  30947. 0x09c7,
  30948. "evowelsigndeva",
  30949. 0x0947,
  30950. "evowelsigngujarati",
  30951. 0x0ac7,
  30952. "exclam",
  30953. 0x0021,
  30954. "exclamarmenian",
  30955. 0x055c,
  30956. "exclamdbl",
  30957. 0x203c,
  30958. "exclamdown",
  30959. 0x00a1,
  30960. "exclamdownsmall",
  30961. 0xf7a1,
  30962. "exclammonospace",
  30963. 0xff01,
  30964. "exclamsmall",
  30965. 0xf721,
  30966. "existential",
  30967. 0x2203,
  30968. "ezh",
  30969. 0x0292,
  30970. "ezhcaron",
  30971. 0x01ef,
  30972. "ezhcurl",
  30973. 0x0293,
  30974. "ezhreversed",
  30975. 0x01b9,
  30976. "ezhtail",
  30977. 0x01ba,
  30978. "f",
  30979. 0x0066,
  30980. "fadeva",
  30981. 0x095e,
  30982. "fagurmukhi",
  30983. 0x0a5e,
  30984. "fahrenheit",
  30985. 0x2109,
  30986. "fathaarabic",
  30987. 0x064e,
  30988. "fathalowarabic",
  30989. 0x064e,
  30990. "fathatanarabic",
  30991. 0x064b,
  30992. "fbopomofo",
  30993. 0x3108,
  30994. "fcircle",
  30995. 0x24d5,
  30996. "fdotaccent",
  30997. 0x1e1f,
  30998. "feharabic",
  30999. 0x0641,
  31000. "feharmenian",
  31001. 0x0586,
  31002. "fehfinalarabic",
  31003. 0xfed2,
  31004. "fehinitialarabic",
  31005. 0xfed3,
  31006. "fehmedialarabic",
  31007. 0xfed4,
  31008. "feicoptic",
  31009. 0x03e5,
  31010. "female",
  31011. 0x2640,
  31012. "ff",
  31013. 0xfb00,
  31014. "f_f",
  31015. 0xfb00,
  31016. "ffi",
  31017. 0xfb03,
  31018. "ffl",
  31019. 0xfb04,
  31020. "fi",
  31021. 0xfb01,
  31022. "fifteencircle",
  31023. 0x246e,
  31024. "fifteenparen",
  31025. 0x2482,
  31026. "fifteenperiod",
  31027. 0x2496,
  31028. "figuredash",
  31029. 0x2012,
  31030. "filledbox",
  31031. 0x25a0,
  31032. "filledrect",
  31033. 0x25ac,
  31034. "finalkaf",
  31035. 0x05da,
  31036. "finalkafdagesh",
  31037. 0xfb3a,
  31038. "finalkafdageshhebrew",
  31039. 0xfb3a,
  31040. "finalkafhebrew",
  31041. 0x05da,
  31042. "finalmem",
  31043. 0x05dd,
  31044. "finalmemhebrew",
  31045. 0x05dd,
  31046. "finalnun",
  31047. 0x05df,
  31048. "finalnunhebrew",
  31049. 0x05df,
  31050. "finalpe",
  31051. 0x05e3,
  31052. "finalpehebrew",
  31053. 0x05e3,
  31054. "finaltsadi",
  31055. 0x05e5,
  31056. "finaltsadihebrew",
  31057. 0x05e5,
  31058. "firsttonechinese",
  31059. 0x02c9,
  31060. "fisheye",
  31061. 0x25c9,
  31062. "fitacyrillic",
  31063. 0x0473,
  31064. "five",
  31065. 0x0035,
  31066. "fivearabic",
  31067. 0x0665,
  31068. "fivebengali",
  31069. 0x09eb,
  31070. "fivecircle",
  31071. 0x2464,
  31072. "fivecircleinversesansserif",
  31073. 0x278e,
  31074. "fivedeva",
  31075. 0x096b,
  31076. "fiveeighths",
  31077. 0x215d,
  31078. "fivegujarati",
  31079. 0x0aeb,
  31080. "fivegurmukhi",
  31081. 0x0a6b,
  31082. "fivehackarabic",
  31083. 0x0665,
  31084. "fivehangzhou",
  31085. 0x3025,
  31086. "fiveideographicparen",
  31087. 0x3224,
  31088. "fiveinferior",
  31089. 0x2085,
  31090. "fivemonospace",
  31091. 0xff15,
  31092. "fiveoldstyle",
  31093. 0xf735,
  31094. "fiveparen",
  31095. 0x2478,
  31096. "fiveperiod",
  31097. 0x248c,
  31098. "fivepersian",
  31099. 0x06f5,
  31100. "fiveroman",
  31101. 0x2174,
  31102. "fivesuperior",
  31103. 0x2075,
  31104. "fivethai",
  31105. 0x0e55,
  31106. "fl",
  31107. 0xfb02,
  31108. "florin",
  31109. 0x0192,
  31110. "fmonospace",
  31111. 0xff46,
  31112. "fmsquare",
  31113. 0x3399,
  31114. "fofanthai",
  31115. 0x0e1f,
  31116. "fofathai",
  31117. 0x0e1d,
  31118. "fongmanthai",
  31119. 0x0e4f,
  31120. "forall",
  31121. 0x2200,
  31122. "four",
  31123. 0x0034,
  31124. "fourarabic",
  31125. 0x0664,
  31126. "fourbengali",
  31127. 0x09ea,
  31128. "fourcircle",
  31129. 0x2463,
  31130. "fourcircleinversesansserif",
  31131. 0x278d,
  31132. "fourdeva",
  31133. 0x096a,
  31134. "fourgujarati",
  31135. 0x0aea,
  31136. "fourgurmukhi",
  31137. 0x0a6a,
  31138. "fourhackarabic",
  31139. 0x0664,
  31140. "fourhangzhou",
  31141. 0x3024,
  31142. "fourideographicparen",
  31143. 0x3223,
  31144. "fourinferior",
  31145. 0x2084,
  31146. "fourmonospace",
  31147. 0xff14,
  31148. "fournumeratorbengali",
  31149. 0x09f7,
  31150. "fouroldstyle",
  31151. 0xf734,
  31152. "fourparen",
  31153. 0x2477,
  31154. "fourperiod",
  31155. 0x248b,
  31156. "fourpersian",
  31157. 0x06f4,
  31158. "fourroman",
  31159. 0x2173,
  31160. "foursuperior",
  31161. 0x2074,
  31162. "fourteencircle",
  31163. 0x246d,
  31164. "fourteenparen",
  31165. 0x2481,
  31166. "fourteenperiod",
  31167. 0x2495,
  31168. "fourthai",
  31169. 0x0e54,
  31170. "fourthtonechinese",
  31171. 0x02cb,
  31172. "fparen",
  31173. 0x24a1,
  31174. "fraction",
  31175. 0x2044,
  31176. "franc",
  31177. 0x20a3,
  31178. "g",
  31179. 0x0067,
  31180. "gabengali",
  31181. 0x0997,
  31182. "gacute",
  31183. 0x01f5,
  31184. "gadeva",
  31185. 0x0917,
  31186. "gafarabic",
  31187. 0x06af,
  31188. "gaffinalarabic",
  31189. 0xfb93,
  31190. "gafinitialarabic",
  31191. 0xfb94,
  31192. "gafmedialarabic",
  31193. 0xfb95,
  31194. "gagujarati",
  31195. 0x0a97,
  31196. "gagurmukhi",
  31197. 0x0a17,
  31198. "gahiragana",
  31199. 0x304c,
  31200. "gakatakana",
  31201. 0x30ac,
  31202. "gamma",
  31203. 0x03b3,
  31204. "gammalatinsmall",
  31205. 0x0263,
  31206. "gammasuperior",
  31207. 0x02e0,
  31208. "gangiacoptic",
  31209. 0x03eb,
  31210. "gbopomofo",
  31211. 0x310d,
  31212. "gbreve",
  31213. 0x011f,
  31214. "gcaron",
  31215. 0x01e7,
  31216. "gcedilla",
  31217. 0x0123,
  31218. "gcircle",
  31219. 0x24d6,
  31220. "gcircumflex",
  31221. 0x011d,
  31222. "gcommaaccent",
  31223. 0x0123,
  31224. "gdot",
  31225. 0x0121,
  31226. "gdotaccent",
  31227. 0x0121,
  31228. "gecyrillic",
  31229. 0x0433,
  31230. "gehiragana",
  31231. 0x3052,
  31232. "gekatakana",
  31233. 0x30b2,
  31234. "geometricallyequal",
  31235. 0x2251,
  31236. "gereshaccenthebrew",
  31237. 0x059c,
  31238. "gereshhebrew",
  31239. 0x05f3,
  31240. "gereshmuqdamhebrew",
  31241. 0x059d,
  31242. "germandbls",
  31243. 0x00df,
  31244. "gershayimaccenthebrew",
  31245. 0x059e,
  31246. "gershayimhebrew",
  31247. 0x05f4,
  31248. "getamark",
  31249. 0x3013,
  31250. "ghabengali",
  31251. 0x0998,
  31252. "ghadarmenian",
  31253. 0x0572,
  31254. "ghadeva",
  31255. 0x0918,
  31256. "ghagujarati",
  31257. 0x0a98,
  31258. "ghagurmukhi",
  31259. 0x0a18,
  31260. "ghainarabic",
  31261. 0x063a,
  31262. "ghainfinalarabic",
  31263. 0xfece,
  31264. "ghaininitialarabic",
  31265. 0xfecf,
  31266. "ghainmedialarabic",
  31267. 0xfed0,
  31268. "ghemiddlehookcyrillic",
  31269. 0x0495,
  31270. "ghestrokecyrillic",
  31271. 0x0493,
  31272. "gheupturncyrillic",
  31273. 0x0491,
  31274. "ghhadeva",
  31275. 0x095a,
  31276. "ghhagurmukhi",
  31277. 0x0a5a,
  31278. "ghook",
  31279. 0x0260,
  31280. "ghzsquare",
  31281. 0x3393,
  31282. "gihiragana",
  31283. 0x304e,
  31284. "gikatakana",
  31285. 0x30ae,
  31286. "gimarmenian",
  31287. 0x0563,
  31288. "gimel",
  31289. 0x05d2,
  31290. "gimeldagesh",
  31291. 0xfb32,
  31292. "gimeldageshhebrew",
  31293. 0xfb32,
  31294. "gimelhebrew",
  31295. 0x05d2,
  31296. "gjecyrillic",
  31297. 0x0453,
  31298. "glottalinvertedstroke",
  31299. 0x01be,
  31300. "glottalstop",
  31301. 0x0294,
  31302. "glottalstopinverted",
  31303. 0x0296,
  31304. "glottalstopmod",
  31305. 0x02c0,
  31306. "glottalstopreversed",
  31307. 0x0295,
  31308. "glottalstopreversedmod",
  31309. 0x02c1,
  31310. "glottalstopreversedsuperior",
  31311. 0x02e4,
  31312. "glottalstopstroke",
  31313. 0x02a1,
  31314. "glottalstopstrokereversed",
  31315. 0x02a2,
  31316. "gmacron",
  31317. 0x1e21,
  31318. "gmonospace",
  31319. 0xff47,
  31320. "gohiragana",
  31321. 0x3054,
  31322. "gokatakana",
  31323. 0x30b4,
  31324. "gparen",
  31325. 0x24a2,
  31326. "gpasquare",
  31327. 0x33ac,
  31328. "gradient",
  31329. 0x2207,
  31330. "grave",
  31331. 0x0060,
  31332. "gravebelowcmb",
  31333. 0x0316,
  31334. "gravecmb",
  31335. 0x0300,
  31336. "gravecomb",
  31337. 0x0300,
  31338. "gravedeva",
  31339. 0x0953,
  31340. "gravelowmod",
  31341. 0x02ce,
  31342. "gravemonospace",
  31343. 0xff40,
  31344. "gravetonecmb",
  31345. 0x0340,
  31346. "greater",
  31347. 0x003e,
  31348. "greaterequal",
  31349. 0x2265,
  31350. "greaterequalorless",
  31351. 0x22db,
  31352. "greatermonospace",
  31353. 0xff1e,
  31354. "greaterorequivalent",
  31355. 0x2273,
  31356. "greaterorless",
  31357. 0x2277,
  31358. "greateroverequal",
  31359. 0x2267,
  31360. "greatersmall",
  31361. 0xfe65,
  31362. "gscript",
  31363. 0x0261,
  31364. "gstroke",
  31365. 0x01e5,
  31366. "guhiragana",
  31367. 0x3050,
  31368. "guillemotleft",
  31369. 0x00ab,
  31370. "guillemotright",
  31371. 0x00bb,
  31372. "guilsinglleft",
  31373. 0x2039,
  31374. "guilsinglright",
  31375. 0x203a,
  31376. "gukatakana",
  31377. 0x30b0,
  31378. "guramusquare",
  31379. 0x3318,
  31380. "gysquare",
  31381. 0x33c9,
  31382. "h",
  31383. 0x0068,
  31384. "haabkhasiancyrillic",
  31385. 0x04a9,
  31386. "haaltonearabic",
  31387. 0x06c1,
  31388. "habengali",
  31389. 0x09b9,
  31390. "hadescendercyrillic",
  31391. 0x04b3,
  31392. "hadeva",
  31393. 0x0939,
  31394. "hagujarati",
  31395. 0x0ab9,
  31396. "hagurmukhi",
  31397. 0x0a39,
  31398. "haharabic",
  31399. 0x062d,
  31400. "hahfinalarabic",
  31401. 0xfea2,
  31402. "hahinitialarabic",
  31403. 0xfea3,
  31404. "hahiragana",
  31405. 0x306f,
  31406. "hahmedialarabic",
  31407. 0xfea4,
  31408. "haitusquare",
  31409. 0x332a,
  31410. "hakatakana",
  31411. 0x30cf,
  31412. "hakatakanahalfwidth",
  31413. 0xff8a,
  31414. "halantgurmukhi",
  31415. 0x0a4d,
  31416. "hamzaarabic",
  31417. 0x0621,
  31418. "hamzalowarabic",
  31419. 0x0621,
  31420. "hangulfiller",
  31421. 0x3164,
  31422. "hardsigncyrillic",
  31423. 0x044a,
  31424. "harpoonleftbarbup",
  31425. 0x21bc,
  31426. "harpoonrightbarbup",
  31427. 0x21c0,
  31428. "hasquare",
  31429. 0x33ca,
  31430. "hatafpatah",
  31431. 0x05b2,
  31432. "hatafpatah16",
  31433. 0x05b2,
  31434. "hatafpatah23",
  31435. 0x05b2,
  31436. "hatafpatah2f",
  31437. 0x05b2,
  31438. "hatafpatahhebrew",
  31439. 0x05b2,
  31440. "hatafpatahnarrowhebrew",
  31441. 0x05b2,
  31442. "hatafpatahquarterhebrew",
  31443. 0x05b2,
  31444. "hatafpatahwidehebrew",
  31445. 0x05b2,
  31446. "hatafqamats",
  31447. 0x05b3,
  31448. "hatafqamats1b",
  31449. 0x05b3,
  31450. "hatafqamats28",
  31451. 0x05b3,
  31452. "hatafqamats34",
  31453. 0x05b3,
  31454. "hatafqamatshebrew",
  31455. 0x05b3,
  31456. "hatafqamatsnarrowhebrew",
  31457. 0x05b3,
  31458. "hatafqamatsquarterhebrew",
  31459. 0x05b3,
  31460. "hatafqamatswidehebrew",
  31461. 0x05b3,
  31462. "hatafsegol",
  31463. 0x05b1,
  31464. "hatafsegol17",
  31465. 0x05b1,
  31466. "hatafsegol24",
  31467. 0x05b1,
  31468. "hatafsegol30",
  31469. 0x05b1,
  31470. "hatafsegolhebrew",
  31471. 0x05b1,
  31472. "hatafsegolnarrowhebrew",
  31473. 0x05b1,
  31474. "hatafsegolquarterhebrew",
  31475. 0x05b1,
  31476. "hatafsegolwidehebrew",
  31477. 0x05b1,
  31478. "hbar",
  31479. 0x0127,
  31480. "hbopomofo",
  31481. 0x310f,
  31482. "hbrevebelow",
  31483. 0x1e2b,
  31484. "hcedilla",
  31485. 0x1e29,
  31486. "hcircle",
  31487. 0x24d7,
  31488. "hcircumflex",
  31489. 0x0125,
  31490. "hdieresis",
  31491. 0x1e27,
  31492. "hdotaccent",
  31493. 0x1e23,
  31494. "hdotbelow",
  31495. 0x1e25,
  31496. "he",
  31497. 0x05d4,
  31498. "heart",
  31499. 0x2665,
  31500. "heartsuitblack",
  31501. 0x2665,
  31502. "heartsuitwhite",
  31503. 0x2661,
  31504. "hedagesh",
  31505. 0xfb34,
  31506. "hedageshhebrew",
  31507. 0xfb34,
  31508. "hehaltonearabic",
  31509. 0x06c1,
  31510. "heharabic",
  31511. 0x0647,
  31512. "hehebrew",
  31513. 0x05d4,
  31514. "hehfinalaltonearabic",
  31515. 0xfba7,
  31516. "hehfinalalttwoarabic",
  31517. 0xfeea,
  31518. "hehfinalarabic",
  31519. 0xfeea,
  31520. "hehhamzaabovefinalarabic",
  31521. 0xfba5,
  31522. "hehhamzaaboveisolatedarabic",
  31523. 0xfba4,
  31524. "hehinitialaltonearabic",
  31525. 0xfba8,
  31526. "hehinitialarabic",
  31527. 0xfeeb,
  31528. "hehiragana",
  31529. 0x3078,
  31530. "hehmedialaltonearabic",
  31531. 0xfba9,
  31532. "hehmedialarabic",
  31533. 0xfeec,
  31534. "heiseierasquare",
  31535. 0x337b,
  31536. "hekatakana",
  31537. 0x30d8,
  31538. "hekatakanahalfwidth",
  31539. 0xff8d,
  31540. "hekutaarusquare",
  31541. 0x3336,
  31542. "henghook",
  31543. 0x0267,
  31544. "herutusquare",
  31545. 0x3339,
  31546. "het",
  31547. 0x05d7,
  31548. "hethebrew",
  31549. 0x05d7,
  31550. "hhook",
  31551. 0x0266,
  31552. "hhooksuperior",
  31553. 0x02b1,
  31554. "hieuhacirclekorean",
  31555. 0x327b,
  31556. "hieuhaparenkorean",
  31557. 0x321b,
  31558. "hieuhcirclekorean",
  31559. 0x326d,
  31560. "hieuhkorean",
  31561. 0x314e,
  31562. "hieuhparenkorean",
  31563. 0x320d,
  31564. "hihiragana",
  31565. 0x3072,
  31566. "hikatakana",
  31567. 0x30d2,
  31568. "hikatakanahalfwidth",
  31569. 0xff8b,
  31570. "hiriq",
  31571. 0x05b4,
  31572. "hiriq14",
  31573. 0x05b4,
  31574. "hiriq21",
  31575. 0x05b4,
  31576. "hiriq2d",
  31577. 0x05b4,
  31578. "hiriqhebrew",
  31579. 0x05b4,
  31580. "hiriqnarrowhebrew",
  31581. 0x05b4,
  31582. "hiriqquarterhebrew",
  31583. 0x05b4,
  31584. "hiriqwidehebrew",
  31585. 0x05b4,
  31586. "hlinebelow",
  31587. 0x1e96,
  31588. "hmonospace",
  31589. 0xff48,
  31590. "hoarmenian",
  31591. 0x0570,
  31592. "hohipthai",
  31593. 0x0e2b,
  31594. "hohiragana",
  31595. 0x307b,
  31596. "hokatakana",
  31597. 0x30db,
  31598. "hokatakanahalfwidth",
  31599. 0xff8e,
  31600. "holam",
  31601. 0x05b9,
  31602. "holam19",
  31603. 0x05b9,
  31604. "holam26",
  31605. 0x05b9,
  31606. "holam32",
  31607. 0x05b9,
  31608. "holamhebrew",
  31609. 0x05b9,
  31610. "holamnarrowhebrew",
  31611. 0x05b9,
  31612. "holamquarterhebrew",
  31613. 0x05b9,
  31614. "holamwidehebrew",
  31615. 0x05b9,
  31616. "honokhukthai",
  31617. 0x0e2e,
  31618. "hookabovecomb",
  31619. 0x0309,
  31620. "hookcmb",
  31621. 0x0309,
  31622. "hookpalatalizedbelowcmb",
  31623. 0x0321,
  31624. "hookretroflexbelowcmb",
  31625. 0x0322,
  31626. "hoonsquare",
  31627. 0x3342,
  31628. "horicoptic",
  31629. 0x03e9,
  31630. "horizontalbar",
  31631. 0x2015,
  31632. "horncmb",
  31633. 0x031b,
  31634. "hotsprings",
  31635. 0x2668,
  31636. "house",
  31637. 0x2302,
  31638. "hparen",
  31639. 0x24a3,
  31640. "hsuperior",
  31641. 0x02b0,
  31642. "hturned",
  31643. 0x0265,
  31644. "huhiragana",
  31645. 0x3075,
  31646. "huiitosquare",
  31647. 0x3333,
  31648. "hukatakana",
  31649. 0x30d5,
  31650. "hukatakanahalfwidth",
  31651. 0xff8c,
  31652. "hungarumlaut",
  31653. 0x02dd,
  31654. "hungarumlautcmb",
  31655. 0x030b,
  31656. "hv",
  31657. 0x0195,
  31658. "hyphen",
  31659. 0x002d,
  31660. "hypheninferior",
  31661. 0xf6e5,
  31662. "hyphenmonospace",
  31663. 0xff0d,
  31664. "hyphensmall",
  31665. 0xfe63,
  31666. "hyphensuperior",
  31667. 0xf6e6,
  31668. "hyphentwo",
  31669. 0x2010,
  31670. "i",
  31671. 0x0069,
  31672. "iacute",
  31673. 0x00ed,
  31674. "iacyrillic",
  31675. 0x044f,
  31676. "ibengali",
  31677. 0x0987,
  31678. "ibopomofo",
  31679. 0x3127,
  31680. "ibreve",
  31681. 0x012d,
  31682. "icaron",
  31683. 0x01d0,
  31684. "icircle",
  31685. 0x24d8,
  31686. "icircumflex",
  31687. 0x00ee,
  31688. "icyrillic",
  31689. 0x0456,
  31690. "idblgrave",
  31691. 0x0209,
  31692. "ideographearthcircle",
  31693. 0x328f,
  31694. "ideographfirecircle",
  31695. 0x328b,
  31696. "ideographicallianceparen",
  31697. 0x323f,
  31698. "ideographiccallparen",
  31699. 0x323a,
  31700. "ideographiccentrecircle",
  31701. 0x32a5,
  31702. "ideographicclose",
  31703. 0x3006,
  31704. "ideographiccomma",
  31705. 0x3001,
  31706. "ideographiccommaleft",
  31707. 0xff64,
  31708. "ideographiccongratulationparen",
  31709. 0x3237,
  31710. "ideographiccorrectcircle",
  31711. 0x32a3,
  31712. "ideographicearthparen",
  31713. 0x322f,
  31714. "ideographicenterpriseparen",
  31715. 0x323d,
  31716. "ideographicexcellentcircle",
  31717. 0x329d,
  31718. "ideographicfestivalparen",
  31719. 0x3240,
  31720. "ideographicfinancialcircle",
  31721. 0x3296,
  31722. "ideographicfinancialparen",
  31723. 0x3236,
  31724. "ideographicfireparen",
  31725. 0x322b,
  31726. "ideographichaveparen",
  31727. 0x3232,
  31728. "ideographichighcircle",
  31729. 0x32a4,
  31730. "ideographiciterationmark",
  31731. 0x3005,
  31732. "ideographiclaborcircle",
  31733. 0x3298,
  31734. "ideographiclaborparen",
  31735. 0x3238,
  31736. "ideographicleftcircle",
  31737. 0x32a7,
  31738. "ideographiclowcircle",
  31739. 0x32a6,
  31740. "ideographicmedicinecircle",
  31741. 0x32a9,
  31742. "ideographicmetalparen",
  31743. 0x322e,
  31744. "ideographicmoonparen",
  31745. 0x322a,
  31746. "ideographicnameparen",
  31747. 0x3234,
  31748. "ideographicperiod",
  31749. 0x3002,
  31750. "ideographicprintcircle",
  31751. 0x329e,
  31752. "ideographicreachparen",
  31753. 0x3243,
  31754. "ideographicrepresentparen",
  31755. 0x3239,
  31756. "ideographicresourceparen",
  31757. 0x323e,
  31758. "ideographicrightcircle",
  31759. 0x32a8,
  31760. "ideographicsecretcircle",
  31761. 0x3299,
  31762. "ideographicselfparen",
  31763. 0x3242,
  31764. "ideographicsocietyparen",
  31765. 0x3233,
  31766. "ideographicspace",
  31767. 0x3000,
  31768. "ideographicspecialparen",
  31769. 0x3235,
  31770. "ideographicstockparen",
  31771. 0x3231,
  31772. "ideographicstudyparen",
  31773. 0x323b,
  31774. "ideographicsunparen",
  31775. 0x3230,
  31776. "ideographicsuperviseparen",
  31777. 0x323c,
  31778. "ideographicwaterparen",
  31779. 0x322c,
  31780. "ideographicwoodparen",
  31781. 0x322d,
  31782. "ideographiczero",
  31783. 0x3007,
  31784. "ideographmetalcircle",
  31785. 0x328e,
  31786. "ideographmooncircle",
  31787. 0x328a,
  31788. "ideographnamecircle",
  31789. 0x3294,
  31790. "ideographsuncircle",
  31791. 0x3290,
  31792. "ideographwatercircle",
  31793. 0x328c,
  31794. "ideographwoodcircle",
  31795. 0x328d,
  31796. "ideva",
  31797. 0x0907,
  31798. "idieresis",
  31799. 0x00ef,
  31800. "idieresisacute",
  31801. 0x1e2f,
  31802. "idieresiscyrillic",
  31803. 0x04e5,
  31804. "idotbelow",
  31805. 0x1ecb,
  31806. "iebrevecyrillic",
  31807. 0x04d7,
  31808. "iecyrillic",
  31809. 0x0435,
  31810. "ieungacirclekorean",
  31811. 0x3275,
  31812. "ieungaparenkorean",
  31813. 0x3215,
  31814. "ieungcirclekorean",
  31815. 0x3267,
  31816. "ieungkorean",
  31817. 0x3147,
  31818. "ieungparenkorean",
  31819. 0x3207,
  31820. "igrave",
  31821. 0x00ec,
  31822. "igujarati",
  31823. 0x0a87,
  31824. "igurmukhi",
  31825. 0x0a07,
  31826. "ihiragana",
  31827. 0x3044,
  31828. "ihookabove",
  31829. 0x1ec9,
  31830. "iibengali",
  31831. 0x0988,
  31832. "iicyrillic",
  31833. 0x0438,
  31834. "iideva",
  31835. 0x0908,
  31836. "iigujarati",
  31837. 0x0a88,
  31838. "iigurmukhi",
  31839. 0x0a08,
  31840. "iimatragurmukhi",
  31841. 0x0a40,
  31842. "iinvertedbreve",
  31843. 0x020b,
  31844. "iishortcyrillic",
  31845. 0x0439,
  31846. "iivowelsignbengali",
  31847. 0x09c0,
  31848. "iivowelsigndeva",
  31849. 0x0940,
  31850. "iivowelsigngujarati",
  31851. 0x0ac0,
  31852. "ij",
  31853. 0x0133,
  31854. "ikatakana",
  31855. 0x30a4,
  31856. "ikatakanahalfwidth",
  31857. 0xff72,
  31858. "ikorean",
  31859. 0x3163,
  31860. "ilde",
  31861. 0x02dc,
  31862. "iluyhebrew",
  31863. 0x05ac,
  31864. "imacron",
  31865. 0x012b,
  31866. "imacroncyrillic",
  31867. 0x04e3,
  31868. "imageorapproximatelyequal",
  31869. 0x2253,
  31870. "imatragurmukhi",
  31871. 0x0a3f,
  31872. "imonospace",
  31873. 0xff49,
  31874. "increment",
  31875. 0x2206,
  31876. "infinity",
  31877. 0x221e,
  31878. "iniarmenian",
  31879. 0x056b,
  31880. "integral",
  31881. 0x222b,
  31882. "integralbottom",
  31883. 0x2321,
  31884. "integralbt",
  31885. 0x2321,
  31886. "integralex",
  31887. 0xf8f5,
  31888. "integraltop",
  31889. 0x2320,
  31890. "integraltp",
  31891. 0x2320,
  31892. "intersection",
  31893. 0x2229,
  31894. "intisquare",
  31895. 0x3305,
  31896. "invbullet",
  31897. 0x25d8,
  31898. "invcircle",
  31899. 0x25d9,
  31900. "invsmileface",
  31901. 0x263b,
  31902. "iocyrillic",
  31903. 0x0451,
  31904. "iogonek",
  31905. 0x012f,
  31906. "iota",
  31907. 0x03b9,
  31908. "iotadieresis",
  31909. 0x03ca,
  31910. "iotadieresistonos",
  31911. 0x0390,
  31912. "iotalatin",
  31913. 0x0269,
  31914. "iotatonos",
  31915. 0x03af,
  31916. "iparen",
  31917. 0x24a4,
  31918. "irigurmukhi",
  31919. 0x0a72,
  31920. "ismallhiragana",
  31921. 0x3043,
  31922. "ismallkatakana",
  31923. 0x30a3,
  31924. "ismallkatakanahalfwidth",
  31925. 0xff68,
  31926. "issharbengali",
  31927. 0x09fa,
  31928. "istroke",
  31929. 0x0268,
  31930. "isuperior",
  31931. 0xf6ed,
  31932. "iterationhiragana",
  31933. 0x309d,
  31934. "iterationkatakana",
  31935. 0x30fd,
  31936. "itilde",
  31937. 0x0129,
  31938. "itildebelow",
  31939. 0x1e2d,
  31940. "iubopomofo",
  31941. 0x3129,
  31942. "iucyrillic",
  31943. 0x044e,
  31944. "ivowelsignbengali",
  31945. 0x09bf,
  31946. "ivowelsigndeva",
  31947. 0x093f,
  31948. "ivowelsigngujarati",
  31949. 0x0abf,
  31950. "izhitsacyrillic",
  31951. 0x0475,
  31952. "izhitsadblgravecyrillic",
  31953. 0x0477,
  31954. "j",
  31955. 0x006a,
  31956. "jaarmenian",
  31957. 0x0571,
  31958. "jabengali",
  31959. 0x099c,
  31960. "jadeva",
  31961. 0x091c,
  31962. "jagujarati",
  31963. 0x0a9c,
  31964. "jagurmukhi",
  31965. 0x0a1c,
  31966. "jbopomofo",
  31967. 0x3110,
  31968. "jcaron",
  31969. 0x01f0,
  31970. "jcircle",
  31971. 0x24d9,
  31972. "jcircumflex",
  31973. 0x0135,
  31974. "jcrossedtail",
  31975. 0x029d,
  31976. "jdotlessstroke",
  31977. 0x025f,
  31978. "jecyrillic",
  31979. 0x0458,
  31980. "jeemarabic",
  31981. 0x062c,
  31982. "jeemfinalarabic",
  31983. 0xfe9e,
  31984. "jeeminitialarabic",
  31985. 0xfe9f,
  31986. "jeemmedialarabic",
  31987. 0xfea0,
  31988. "jeharabic",
  31989. 0x0698,
  31990. "jehfinalarabic",
  31991. 0xfb8b,
  31992. "jhabengali",
  31993. 0x099d,
  31994. "jhadeva",
  31995. 0x091d,
  31996. "jhagujarati",
  31997. 0x0a9d,
  31998. "jhagurmukhi",
  31999. 0x0a1d,
  32000. "jheharmenian",
  32001. 0x057b,
  32002. "jis",
  32003. 0x3004,
  32004. "jmonospace",
  32005. 0xff4a,
  32006. "jparen",
  32007. 0x24a5,
  32008. "jsuperior",
  32009. 0x02b2,
  32010. "k",
  32011. 0x006b,
  32012. "kabashkircyrillic",
  32013. 0x04a1,
  32014. "kabengali",
  32015. 0x0995,
  32016. "kacute",
  32017. 0x1e31,
  32018. "kacyrillic",
  32019. 0x043a,
  32020. "kadescendercyrillic",
  32021. 0x049b,
  32022. "kadeva",
  32023. 0x0915,
  32024. "kaf",
  32025. 0x05db,
  32026. "kafarabic",
  32027. 0x0643,
  32028. "kafdagesh",
  32029. 0xfb3b,
  32030. "kafdageshhebrew",
  32031. 0xfb3b,
  32032. "kaffinalarabic",
  32033. 0xfeda,
  32034. "kafhebrew",
  32035. 0x05db,
  32036. "kafinitialarabic",
  32037. 0xfedb,
  32038. "kafmedialarabic",
  32039. 0xfedc,
  32040. "kafrafehebrew",
  32041. 0xfb4d,
  32042. "kagujarati",
  32043. 0x0a95,
  32044. "kagurmukhi",
  32045. 0x0a15,
  32046. "kahiragana",
  32047. 0x304b,
  32048. "kahookcyrillic",
  32049. 0x04c4,
  32050. "kakatakana",
  32051. 0x30ab,
  32052. "kakatakanahalfwidth",
  32053. 0xff76,
  32054. "kappa",
  32055. 0x03ba,
  32056. "kappasymbolgreek",
  32057. 0x03f0,
  32058. "kapyeounmieumkorean",
  32059. 0x3171,
  32060. "kapyeounphieuphkorean",
  32061. 0x3184,
  32062. "kapyeounpieupkorean",
  32063. 0x3178,
  32064. "kapyeounssangpieupkorean",
  32065. 0x3179,
  32066. "karoriisquare",
  32067. 0x330d,
  32068. "kashidaautoarabic",
  32069. 0x0640,
  32070. "kashidaautonosidebearingarabic",
  32071. 0x0640,
  32072. "kasmallkatakana",
  32073. 0x30f5,
  32074. "kasquare",
  32075. 0x3384,
  32076. "kasraarabic",
  32077. 0x0650,
  32078. "kasratanarabic",
  32079. 0x064d,
  32080. "kastrokecyrillic",
  32081. 0x049f,
  32082. "katahiraprolongmarkhalfwidth",
  32083. 0xff70,
  32084. "kaverticalstrokecyrillic",
  32085. 0x049d,
  32086. "kbopomofo",
  32087. 0x310e,
  32088. "kcalsquare",
  32089. 0x3389,
  32090. "kcaron",
  32091. 0x01e9,
  32092. "kcedilla",
  32093. 0x0137,
  32094. "kcircle",
  32095. 0x24da,
  32096. "kcommaaccent",
  32097. 0x0137,
  32098. "kdotbelow",
  32099. 0x1e33,
  32100. "keharmenian",
  32101. 0x0584,
  32102. "kehiragana",
  32103. 0x3051,
  32104. "kekatakana",
  32105. 0x30b1,
  32106. "kekatakanahalfwidth",
  32107. 0xff79,
  32108. "kenarmenian",
  32109. 0x056f,
  32110. "kesmallkatakana",
  32111. 0x30f6,
  32112. "kgreenlandic",
  32113. 0x0138,
  32114. "khabengali",
  32115. 0x0996,
  32116. "khacyrillic",
  32117. 0x0445,
  32118. "khadeva",
  32119. 0x0916,
  32120. "khagujarati",
  32121. 0x0a96,
  32122. "khagurmukhi",
  32123. 0x0a16,
  32124. "khaharabic",
  32125. 0x062e,
  32126. "khahfinalarabic",
  32127. 0xfea6,
  32128. "khahinitialarabic",
  32129. 0xfea7,
  32130. "khahmedialarabic",
  32131. 0xfea8,
  32132. "kheicoptic",
  32133. 0x03e7,
  32134. "khhadeva",
  32135. 0x0959,
  32136. "khhagurmukhi",
  32137. 0x0a59,
  32138. "khieukhacirclekorean",
  32139. 0x3278,
  32140. "khieukhaparenkorean",
  32141. 0x3218,
  32142. "khieukhcirclekorean",
  32143. 0x326a,
  32144. "khieukhkorean",
  32145. 0x314b,
  32146. "khieukhparenkorean",
  32147. 0x320a,
  32148. "khokhaithai",
  32149. 0x0e02,
  32150. "khokhonthai",
  32151. 0x0e05,
  32152. "khokhuatthai",
  32153. 0x0e03,
  32154. "khokhwaithai",
  32155. 0x0e04,
  32156. "khomutthai",
  32157. 0x0e5b,
  32158. "khook",
  32159. 0x0199,
  32160. "khorakhangthai",
  32161. 0x0e06,
  32162. "khzsquare",
  32163. 0x3391,
  32164. "kihiragana",
  32165. 0x304d,
  32166. "kikatakana",
  32167. 0x30ad,
  32168. "kikatakanahalfwidth",
  32169. 0xff77,
  32170. "kiroguramusquare",
  32171. 0x3315,
  32172. "kiromeetorusquare",
  32173. 0x3316,
  32174. "kirosquare",
  32175. 0x3314,
  32176. "kiyeokacirclekorean",
  32177. 0x326e,
  32178. "kiyeokaparenkorean",
  32179. 0x320e,
  32180. "kiyeokcirclekorean",
  32181. 0x3260,
  32182. "kiyeokkorean",
  32183. 0x3131,
  32184. "kiyeokparenkorean",
  32185. 0x3200,
  32186. "kiyeoksioskorean",
  32187. 0x3133,
  32188. "kjecyrillic",
  32189. 0x045c,
  32190. "klinebelow",
  32191. 0x1e35,
  32192. "klsquare",
  32193. 0x3398,
  32194. "kmcubedsquare",
  32195. 0x33a6,
  32196. "kmonospace",
  32197. 0xff4b,
  32198. "kmsquaredsquare",
  32199. 0x33a2,
  32200. "kohiragana",
  32201. 0x3053,
  32202. "kohmsquare",
  32203. 0x33c0,
  32204. "kokaithai",
  32205. 0x0e01,
  32206. "kokatakana",
  32207. 0x30b3,
  32208. "kokatakanahalfwidth",
  32209. 0xff7a,
  32210. "kooposquare",
  32211. 0x331e,
  32212. "koppacyrillic",
  32213. 0x0481,
  32214. "koreanstandardsymbol",
  32215. 0x327f,
  32216. "koroniscmb",
  32217. 0x0343,
  32218. "kparen",
  32219. 0x24a6,
  32220. "kpasquare",
  32221. 0x33aa,
  32222. "ksicyrillic",
  32223. 0x046f,
  32224. "ktsquare",
  32225. 0x33cf,
  32226. "kturned",
  32227. 0x029e,
  32228. "kuhiragana",
  32229. 0x304f,
  32230. "kukatakana",
  32231. 0x30af,
  32232. "kukatakanahalfwidth",
  32233. 0xff78,
  32234. "kvsquare",
  32235. 0x33b8,
  32236. "kwsquare",
  32237. 0x33be,
  32238. "l",
  32239. 0x006c,
  32240. "labengali",
  32241. 0x09b2,
  32242. "lacute",
  32243. 0x013a,
  32244. "ladeva",
  32245. 0x0932,
  32246. "lagujarati",
  32247. 0x0ab2,
  32248. "lagurmukhi",
  32249. 0x0a32,
  32250. "lakkhangyaothai",
  32251. 0x0e45,
  32252. "lamaleffinalarabic",
  32253. 0xfefc,
  32254. "lamalefhamzaabovefinalarabic",
  32255. 0xfef8,
  32256. "lamalefhamzaaboveisolatedarabic",
  32257. 0xfef7,
  32258. "lamalefhamzabelowfinalarabic",
  32259. 0xfefa,
  32260. "lamalefhamzabelowisolatedarabic",
  32261. 0xfef9,
  32262. "lamalefisolatedarabic",
  32263. 0xfefb,
  32264. "lamalefmaddaabovefinalarabic",
  32265. 0xfef6,
  32266. "lamalefmaddaaboveisolatedarabic",
  32267. 0xfef5,
  32268. "lamarabic",
  32269. 0x0644,
  32270. "lambda",
  32271. 0x03bb,
  32272. "lambdastroke",
  32273. 0x019b,
  32274. "lamed",
  32275. 0x05dc,
  32276. "lameddagesh",
  32277. 0xfb3c,
  32278. "lameddageshhebrew",
  32279. 0xfb3c,
  32280. "lamedhebrew",
  32281. 0x05dc,
  32282. "lamfinalarabic",
  32283. 0xfede,
  32284. "lamhahinitialarabic",
  32285. 0xfcca,
  32286. "laminitialarabic",
  32287. 0xfedf,
  32288. "lamjeeminitialarabic",
  32289. 0xfcc9,
  32290. "lamkhahinitialarabic",
  32291. 0xfccb,
  32292. "lamlamhehisolatedarabic",
  32293. 0xfdf2,
  32294. "lammedialarabic",
  32295. 0xfee0,
  32296. "lammeemhahinitialarabic",
  32297. 0xfd88,
  32298. "lammeeminitialarabic",
  32299. 0xfccc,
  32300. "largecircle",
  32301. 0x25ef,
  32302. "lbar",
  32303. 0x019a,
  32304. "lbelt",
  32305. 0x026c,
  32306. "lbopomofo",
  32307. 0x310c,
  32308. "lcaron",
  32309. 0x013e,
  32310. "lcedilla",
  32311. 0x013c,
  32312. "lcircle",
  32313. 0x24db,
  32314. "lcircumflexbelow",
  32315. 0x1e3d,
  32316. "lcommaaccent",
  32317. 0x013c,
  32318. "ldot",
  32319. 0x0140,
  32320. "ldotaccent",
  32321. 0x0140,
  32322. "ldotbelow",
  32323. 0x1e37,
  32324. "ldotbelowmacron",
  32325. 0x1e39,
  32326. "leftangleabovecmb",
  32327. 0x031a,
  32328. "lefttackbelowcmb",
  32329. 0x0318,
  32330. "less",
  32331. 0x003c,
  32332. "lessequal",
  32333. 0x2264,
  32334. "lessequalorgreater",
  32335. 0x22da,
  32336. "lessmonospace",
  32337. 0xff1c,
  32338. "lessorequivalent",
  32339. 0x2272,
  32340. "lessorgreater",
  32341. 0x2276,
  32342. "lessoverequal",
  32343. 0x2266,
  32344. "lesssmall",
  32345. 0xfe64,
  32346. "lezh",
  32347. 0x026e,
  32348. "lfblock",
  32349. 0x258c,
  32350. "lhookretroflex",
  32351. 0x026d,
  32352. "lira",
  32353. 0x20a4,
  32354. "liwnarmenian",
  32355. 0x056c,
  32356. "lj",
  32357. 0x01c9,
  32358. "ljecyrillic",
  32359. 0x0459,
  32360. "ll",
  32361. 0xf6c0,
  32362. "lladeva",
  32363. 0x0933,
  32364. "llagujarati",
  32365. 0x0ab3,
  32366. "llinebelow",
  32367. 0x1e3b,
  32368. "llladeva",
  32369. 0x0934,
  32370. "llvocalicbengali",
  32371. 0x09e1,
  32372. "llvocalicdeva",
  32373. 0x0961,
  32374. "llvocalicvowelsignbengali",
  32375. 0x09e3,
  32376. "llvocalicvowelsigndeva",
  32377. 0x0963,
  32378. "lmiddletilde",
  32379. 0x026b,
  32380. "lmonospace",
  32381. 0xff4c,
  32382. "lmsquare",
  32383. 0x33d0,
  32384. "lochulathai",
  32385. 0x0e2c,
  32386. "logicaland",
  32387. 0x2227,
  32388. "logicalnot",
  32389. 0x00ac,
  32390. "logicalnotreversed",
  32391. 0x2310,
  32392. "logicalor",
  32393. 0x2228,
  32394. "lolingthai",
  32395. 0x0e25,
  32396. "longs",
  32397. 0x017f,
  32398. "lowlinecenterline",
  32399. 0xfe4e,
  32400. "lowlinecmb",
  32401. 0x0332,
  32402. "lowlinedashed",
  32403. 0xfe4d,
  32404. "lozenge",
  32405. 0x25ca,
  32406. "lparen",
  32407. 0x24a7,
  32408. "lslash",
  32409. 0x0142,
  32410. "lsquare",
  32411. 0x2113,
  32412. "lsuperior",
  32413. 0xf6ee,
  32414. "ltshade",
  32415. 0x2591,
  32416. "luthai",
  32417. 0x0e26,
  32418. "lvocalicbengali",
  32419. 0x098c,
  32420. "lvocalicdeva",
  32421. 0x090c,
  32422. "lvocalicvowelsignbengali",
  32423. 0x09e2,
  32424. "lvocalicvowelsigndeva",
  32425. 0x0962,
  32426. "lxsquare",
  32427. 0x33d3,
  32428. "m",
  32429. 0x006d,
  32430. "mabengali",
  32431. 0x09ae,
  32432. "macron",
  32433. 0x00af,
  32434. "macronbelowcmb",
  32435. 0x0331,
  32436. "macroncmb",
  32437. 0x0304,
  32438. "macronlowmod",
  32439. 0x02cd,
  32440. "macronmonospace",
  32441. 0xffe3,
  32442. "macute",
  32443. 0x1e3f,
  32444. "madeva",
  32445. 0x092e,
  32446. "magujarati",
  32447. 0x0aae,
  32448. "magurmukhi",
  32449. 0x0a2e,
  32450. "mahapakhhebrew",
  32451. 0x05a4,
  32452. "mahapakhlefthebrew",
  32453. 0x05a4,
  32454. "mahiragana",
  32455. 0x307e,
  32456. "maichattawalowleftthai",
  32457. 0xf895,
  32458. "maichattawalowrightthai",
  32459. 0xf894,
  32460. "maichattawathai",
  32461. 0x0e4b,
  32462. "maichattawaupperleftthai",
  32463. 0xf893,
  32464. "maieklowleftthai",
  32465. 0xf88c,
  32466. "maieklowrightthai",
  32467. 0xf88b,
  32468. "maiekthai",
  32469. 0x0e48,
  32470. "maiekupperleftthai",
  32471. 0xf88a,
  32472. "maihanakatleftthai",
  32473. 0xf884,
  32474. "maihanakatthai",
  32475. 0x0e31,
  32476. "maitaikhuleftthai",
  32477. 0xf889,
  32478. "maitaikhuthai",
  32479. 0x0e47,
  32480. "maitholowleftthai",
  32481. 0xf88f,
  32482. "maitholowrightthai",
  32483. 0xf88e,
  32484. "maithothai",
  32485. 0x0e49,
  32486. "maithoupperleftthai",
  32487. 0xf88d,
  32488. "maitrilowleftthai",
  32489. 0xf892,
  32490. "maitrilowrightthai",
  32491. 0xf891,
  32492. "maitrithai",
  32493. 0x0e4a,
  32494. "maitriupperleftthai",
  32495. 0xf890,
  32496. "maiyamokthai",
  32497. 0x0e46,
  32498. "makatakana",
  32499. 0x30de,
  32500. "makatakanahalfwidth",
  32501. 0xff8f,
  32502. "male",
  32503. 0x2642,
  32504. "mansyonsquare",
  32505. 0x3347,
  32506. "maqafhebrew",
  32507. 0x05be,
  32508. "mars",
  32509. 0x2642,
  32510. "masoracirclehebrew",
  32511. 0x05af,
  32512. "masquare",
  32513. 0x3383,
  32514. "mbopomofo",
  32515. 0x3107,
  32516. "mbsquare",
  32517. 0x33d4,
  32518. "mcircle",
  32519. 0x24dc,
  32520. "mcubedsquare",
  32521. 0x33a5,
  32522. "mdotaccent",
  32523. 0x1e41,
  32524. "mdotbelow",
  32525. 0x1e43,
  32526. "meemarabic",
  32527. 0x0645,
  32528. "meemfinalarabic",
  32529. 0xfee2,
  32530. "meeminitialarabic",
  32531. 0xfee3,
  32532. "meemmedialarabic",
  32533. 0xfee4,
  32534. "meemmeeminitialarabic",
  32535. 0xfcd1,
  32536. "meemmeemisolatedarabic",
  32537. 0xfc48,
  32538. "meetorusquare",
  32539. 0x334d,
  32540. "mehiragana",
  32541. 0x3081,
  32542. "meizierasquare",
  32543. 0x337e,
  32544. "mekatakana",
  32545. 0x30e1,
  32546. "mekatakanahalfwidth",
  32547. 0xff92,
  32548. "mem",
  32549. 0x05de,
  32550. "memdagesh",
  32551. 0xfb3e,
  32552. "memdageshhebrew",
  32553. 0xfb3e,
  32554. "memhebrew",
  32555. 0x05de,
  32556. "menarmenian",
  32557. 0x0574,
  32558. "merkhahebrew",
  32559. 0x05a5,
  32560. "merkhakefulahebrew",
  32561. 0x05a6,
  32562. "merkhakefulalefthebrew",
  32563. 0x05a6,
  32564. "merkhalefthebrew",
  32565. 0x05a5,
  32566. "mhook",
  32567. 0x0271,
  32568. "mhzsquare",
  32569. 0x3392,
  32570. "middledotkatakanahalfwidth",
  32571. 0xff65,
  32572. "middot",
  32573. 0x00b7,
  32574. "mieumacirclekorean",
  32575. 0x3272,
  32576. "mieumaparenkorean",
  32577. 0x3212,
  32578. "mieumcirclekorean",
  32579. 0x3264,
  32580. "mieumkorean",
  32581. 0x3141,
  32582. "mieumpansioskorean",
  32583. 0x3170,
  32584. "mieumparenkorean",
  32585. 0x3204,
  32586. "mieumpieupkorean",
  32587. 0x316e,
  32588. "mieumsioskorean",
  32589. 0x316f,
  32590. "mihiragana",
  32591. 0x307f,
  32592. "mikatakana",
  32593. 0x30df,
  32594. "mikatakanahalfwidth",
  32595. 0xff90,
  32596. "minus",
  32597. 0x2212,
  32598. "minusbelowcmb",
  32599. 0x0320,
  32600. "minuscircle",
  32601. 0x2296,
  32602. "minusmod",
  32603. 0x02d7,
  32604. "minusplus",
  32605. 0x2213,
  32606. "minute",
  32607. 0x2032,
  32608. "miribaarusquare",
  32609. 0x334a,
  32610. "mirisquare",
  32611. 0x3349,
  32612. "mlonglegturned",
  32613. 0x0270,
  32614. "mlsquare",
  32615. 0x3396,
  32616. "mmcubedsquare",
  32617. 0x33a3,
  32618. "mmonospace",
  32619. 0xff4d,
  32620. "mmsquaredsquare",
  32621. 0x339f,
  32622. "mohiragana",
  32623. 0x3082,
  32624. "mohmsquare",
  32625. 0x33c1,
  32626. "mokatakana",
  32627. 0x30e2,
  32628. "mokatakanahalfwidth",
  32629. 0xff93,
  32630. "molsquare",
  32631. 0x33d6,
  32632. "momathai",
  32633. 0x0e21,
  32634. "moverssquare",
  32635. 0x33a7,
  32636. "moverssquaredsquare",
  32637. 0x33a8,
  32638. "mparen",
  32639. 0x24a8,
  32640. "mpasquare",
  32641. 0x33ab,
  32642. "mssquare",
  32643. 0x33b3,
  32644. "msuperior",
  32645. 0xf6ef,
  32646. "mturned",
  32647. 0x026f,
  32648. "mu",
  32649. 0x00b5,
  32650. "mu1",
  32651. 0x00b5,
  32652. "muasquare",
  32653. 0x3382,
  32654. "muchgreater",
  32655. 0x226b,
  32656. "muchless",
  32657. 0x226a,
  32658. "mufsquare",
  32659. 0x338c,
  32660. "mugreek",
  32661. 0x03bc,
  32662. "mugsquare",
  32663. 0x338d,
  32664. "muhiragana",
  32665. 0x3080,
  32666. "mukatakana",
  32667. 0x30e0,
  32668. "mukatakanahalfwidth",
  32669. 0xff91,
  32670. "mulsquare",
  32671. 0x3395,
  32672. "multiply",
  32673. 0x00d7,
  32674. "mumsquare",
  32675. 0x339b,
  32676. "munahhebrew",
  32677. 0x05a3,
  32678. "munahlefthebrew",
  32679. 0x05a3,
  32680. "musicalnote",
  32681. 0x266a,
  32682. "musicalnotedbl",
  32683. 0x266b,
  32684. "musicflatsign",
  32685. 0x266d,
  32686. "musicsharpsign",
  32687. 0x266f,
  32688. "mussquare",
  32689. 0x33b2,
  32690. "muvsquare",
  32691. 0x33b6,
  32692. "muwsquare",
  32693. 0x33bc,
  32694. "mvmegasquare",
  32695. 0x33b9,
  32696. "mvsquare",
  32697. 0x33b7,
  32698. "mwmegasquare",
  32699. 0x33bf,
  32700. "mwsquare",
  32701. 0x33bd,
  32702. "n",
  32703. 0x006e,
  32704. "nabengali",
  32705. 0x09a8,
  32706. "nabla",
  32707. 0x2207,
  32708. "nacute",
  32709. 0x0144,
  32710. "nadeva",
  32711. 0x0928,
  32712. "nagujarati",
  32713. 0x0aa8,
  32714. "nagurmukhi",
  32715. 0x0a28,
  32716. "nahiragana",
  32717. 0x306a,
  32718. "nakatakana",
  32719. 0x30ca,
  32720. "nakatakanahalfwidth",
  32721. 0xff85,
  32722. "napostrophe",
  32723. 0x0149,
  32724. "nasquare",
  32725. 0x3381,
  32726. "nbopomofo",
  32727. 0x310b,
  32728. "nbspace",
  32729. 0x00a0,
  32730. "ncaron",
  32731. 0x0148,
  32732. "ncedilla",
  32733. 0x0146,
  32734. "ncircle",
  32735. 0x24dd,
  32736. "ncircumflexbelow",
  32737. 0x1e4b,
  32738. "ncommaaccent",
  32739. 0x0146,
  32740. "ndotaccent",
  32741. 0x1e45,
  32742. "ndotbelow",
  32743. 0x1e47,
  32744. "nehiragana",
  32745. 0x306d,
  32746. "nekatakana",
  32747. 0x30cd,
  32748. "nekatakanahalfwidth",
  32749. 0xff88,
  32750. "newsheqelsign",
  32751. 0x20aa,
  32752. "nfsquare",
  32753. 0x338b,
  32754. "ngabengali",
  32755. 0x0999,
  32756. "ngadeva",
  32757. 0x0919,
  32758. "ngagujarati",
  32759. 0x0a99,
  32760. "ngagurmukhi",
  32761. 0x0a19,
  32762. "ngonguthai",
  32763. 0x0e07,
  32764. "nhiragana",
  32765. 0x3093,
  32766. "nhookleft",
  32767. 0x0272,
  32768. "nhookretroflex",
  32769. 0x0273,
  32770. "nieunacirclekorean",
  32771. 0x326f,
  32772. "nieunaparenkorean",
  32773. 0x320f,
  32774. "nieuncieuckorean",
  32775. 0x3135,
  32776. "nieuncirclekorean",
  32777. 0x3261,
  32778. "nieunhieuhkorean",
  32779. 0x3136,
  32780. "nieunkorean",
  32781. 0x3134,
  32782. "nieunpansioskorean",
  32783. 0x3168,
  32784. "nieunparenkorean",
  32785. 0x3201,
  32786. "nieunsioskorean",
  32787. 0x3167,
  32788. "nieuntikeutkorean",
  32789. 0x3166,
  32790. "nihiragana",
  32791. 0x306b,
  32792. "nikatakana",
  32793. 0x30cb,
  32794. "nikatakanahalfwidth",
  32795. 0xff86,
  32796. "nikhahitleftthai",
  32797. 0xf899,
  32798. "nikhahitthai",
  32799. 0x0e4d,
  32800. "nine",
  32801. 0x0039,
  32802. "ninearabic",
  32803. 0x0669,
  32804. "ninebengali",
  32805. 0x09ef,
  32806. "ninecircle",
  32807. 0x2468,
  32808. "ninecircleinversesansserif",
  32809. 0x2792,
  32810. "ninedeva",
  32811. 0x096f,
  32812. "ninegujarati",
  32813. 0x0aef,
  32814. "ninegurmukhi",
  32815. 0x0a6f,
  32816. "ninehackarabic",
  32817. 0x0669,
  32818. "ninehangzhou",
  32819. 0x3029,
  32820. "nineideographicparen",
  32821. 0x3228,
  32822. "nineinferior",
  32823. 0x2089,
  32824. "ninemonospace",
  32825. 0xff19,
  32826. "nineoldstyle",
  32827. 0xf739,
  32828. "nineparen",
  32829. 0x247c,
  32830. "nineperiod",
  32831. 0x2490,
  32832. "ninepersian",
  32833. 0x06f9,
  32834. "nineroman",
  32835. 0x2178,
  32836. "ninesuperior",
  32837. 0x2079,
  32838. "nineteencircle",
  32839. 0x2472,
  32840. "nineteenparen",
  32841. 0x2486,
  32842. "nineteenperiod",
  32843. 0x249a,
  32844. "ninethai",
  32845. 0x0e59,
  32846. "nj",
  32847. 0x01cc,
  32848. "njecyrillic",
  32849. 0x045a,
  32850. "nkatakana",
  32851. 0x30f3,
  32852. "nkatakanahalfwidth",
  32853. 0xff9d,
  32854. "nlegrightlong",
  32855. 0x019e,
  32856. "nlinebelow",
  32857. 0x1e49,
  32858. "nmonospace",
  32859. 0xff4e,
  32860. "nmsquare",
  32861. 0x339a,
  32862. "nnabengali",
  32863. 0x09a3,
  32864. "nnadeva",
  32865. 0x0923,
  32866. "nnagujarati",
  32867. 0x0aa3,
  32868. "nnagurmukhi",
  32869. 0x0a23,
  32870. "nnnadeva",
  32871. 0x0929,
  32872. "nohiragana",
  32873. 0x306e,
  32874. "nokatakana",
  32875. 0x30ce,
  32876. "nokatakanahalfwidth",
  32877. 0xff89,
  32878. "nonbreakingspace",
  32879. 0x00a0,
  32880. "nonenthai",
  32881. 0x0e13,
  32882. "nonuthai",
  32883. 0x0e19,
  32884. "noonarabic",
  32885. 0x0646,
  32886. "noonfinalarabic",
  32887. 0xfee6,
  32888. "noonghunnaarabic",
  32889. 0x06ba,
  32890. "noonghunnafinalarabic",
  32891. 0xfb9f,
  32892. "nooninitialarabic",
  32893. 0xfee7,
  32894. "noonjeeminitialarabic",
  32895. 0xfcd2,
  32896. "noonjeemisolatedarabic",
  32897. 0xfc4b,
  32898. "noonmedialarabic",
  32899. 0xfee8,
  32900. "noonmeeminitialarabic",
  32901. 0xfcd5,
  32902. "noonmeemisolatedarabic",
  32903. 0xfc4e,
  32904. "noonnoonfinalarabic",
  32905. 0xfc8d,
  32906. "notcontains",
  32907. 0x220c,
  32908. "notelement",
  32909. 0x2209,
  32910. "notelementof",
  32911. 0x2209,
  32912. "notequal",
  32913. 0x2260,
  32914. "notgreater",
  32915. 0x226f,
  32916. "notgreaternorequal",
  32917. 0x2271,
  32918. "notgreaternorless",
  32919. 0x2279,
  32920. "notidentical",
  32921. 0x2262,
  32922. "notless",
  32923. 0x226e,
  32924. "notlessnorequal",
  32925. 0x2270,
  32926. "notparallel",
  32927. 0x2226,
  32928. "notprecedes",
  32929. 0x2280,
  32930. "notsubset",
  32931. 0x2284,
  32932. "notsucceeds",
  32933. 0x2281,
  32934. "notsuperset",
  32935. 0x2285,
  32936. "nowarmenian",
  32937. 0x0576,
  32938. "nparen",
  32939. 0x24a9,
  32940. "nssquare",
  32941. 0x33b1,
  32942. "nsuperior",
  32943. 0x207f,
  32944. "ntilde",
  32945. 0x00f1,
  32946. "nu",
  32947. 0x03bd,
  32948. "nuhiragana",
  32949. 0x306c,
  32950. "nukatakana",
  32951. 0x30cc,
  32952. "nukatakanahalfwidth",
  32953. 0xff87,
  32954. "nuktabengali",
  32955. 0x09bc,
  32956. "nuktadeva",
  32957. 0x093c,
  32958. "nuktagujarati",
  32959. 0x0abc,
  32960. "nuktagurmukhi",
  32961. 0x0a3c,
  32962. "numbersign",
  32963. 0x0023,
  32964. "numbersignmonospace",
  32965. 0xff03,
  32966. "numbersignsmall",
  32967. 0xfe5f,
  32968. "numeralsigngreek",
  32969. 0x0374,
  32970. "numeralsignlowergreek",
  32971. 0x0375,
  32972. "numero",
  32973. 0x2116,
  32974. "nun",
  32975. 0x05e0,
  32976. "nundagesh",
  32977. 0xfb40,
  32978. "nundageshhebrew",
  32979. 0xfb40,
  32980. "nunhebrew",
  32981. 0x05e0,
  32982. "nvsquare",
  32983. 0x33b5,
  32984. "nwsquare",
  32985. 0x33bb,
  32986. "nyabengali",
  32987. 0x099e,
  32988. "nyadeva",
  32989. 0x091e,
  32990. "nyagujarati",
  32991. 0x0a9e,
  32992. "nyagurmukhi",
  32993. 0x0a1e,
  32994. "o",
  32995. 0x006f,
  32996. "oacute",
  32997. 0x00f3,
  32998. "oangthai",
  32999. 0x0e2d,
  33000. "obarred",
  33001. 0x0275,
  33002. "obarredcyrillic",
  33003. 0x04e9,
  33004. "obarreddieresiscyrillic",
  33005. 0x04eb,
  33006. "obengali",
  33007. 0x0993,
  33008. "obopomofo",
  33009. 0x311b,
  33010. "obreve",
  33011. 0x014f,
  33012. "ocandradeva",
  33013. 0x0911,
  33014. "ocandragujarati",
  33015. 0x0a91,
  33016. "ocandravowelsigndeva",
  33017. 0x0949,
  33018. "ocandravowelsigngujarati",
  33019. 0x0ac9,
  33020. "ocaron",
  33021. 0x01d2,
  33022. "ocircle",
  33023. 0x24de,
  33024. "ocircumflex",
  33025. 0x00f4,
  33026. "ocircumflexacute",
  33027. 0x1ed1,
  33028. "ocircumflexdotbelow",
  33029. 0x1ed9,
  33030. "ocircumflexgrave",
  33031. 0x1ed3,
  33032. "ocircumflexhookabove",
  33033. 0x1ed5,
  33034. "ocircumflextilde",
  33035. 0x1ed7,
  33036. "ocyrillic",
  33037. 0x043e,
  33038. "odblacute",
  33039. 0x0151,
  33040. "odblgrave",
  33041. 0x020d,
  33042. "odeva",
  33043. 0x0913,
  33044. "odieresis",
  33045. 0x00f6,
  33046. "odieresiscyrillic",
  33047. 0x04e7,
  33048. "odotbelow",
  33049. 0x1ecd,
  33050. "oe",
  33051. 0x0153,
  33052. "oekorean",
  33053. 0x315a,
  33054. "ogonek",
  33055. 0x02db,
  33056. "ogonekcmb",
  33057. 0x0328,
  33058. "ograve",
  33059. 0x00f2,
  33060. "ogujarati",
  33061. 0x0a93,
  33062. "oharmenian",
  33063. 0x0585,
  33064. "ohiragana",
  33065. 0x304a,
  33066. "ohookabove",
  33067. 0x1ecf,
  33068. "ohorn",
  33069. 0x01a1,
  33070. "ohornacute",
  33071. 0x1edb,
  33072. "ohorndotbelow",
  33073. 0x1ee3,
  33074. "ohorngrave",
  33075. 0x1edd,
  33076. "ohornhookabove",
  33077. 0x1edf,
  33078. "ohorntilde",
  33079. 0x1ee1,
  33080. "ohungarumlaut",
  33081. 0x0151,
  33082. "oi",
  33083. 0x01a3,
  33084. "oinvertedbreve",
  33085. 0x020f,
  33086. "okatakana",
  33087. 0x30aa,
  33088. "okatakanahalfwidth",
  33089. 0xff75,
  33090. "okorean",
  33091. 0x3157,
  33092. "olehebrew",
  33093. 0x05ab,
  33094. "omacron",
  33095. 0x014d,
  33096. "omacronacute",
  33097. 0x1e53,
  33098. "omacrongrave",
  33099. 0x1e51,
  33100. "omdeva",
  33101. 0x0950,
  33102. "omega",
  33103. 0x03c9,
  33104. "omega1",
  33105. 0x03d6,
  33106. "omegacyrillic",
  33107. 0x0461,
  33108. "omegalatinclosed",
  33109. 0x0277,
  33110. "omegaroundcyrillic",
  33111. 0x047b,
  33112. "omegatitlocyrillic",
  33113. 0x047d,
  33114. "omegatonos",
  33115. 0x03ce,
  33116. "omgujarati",
  33117. 0x0ad0,
  33118. "omicron",
  33119. 0x03bf,
  33120. "omicrontonos",
  33121. 0x03cc,
  33122. "omonospace",
  33123. 0xff4f,
  33124. "one",
  33125. 0x0031,
  33126. "onearabic",
  33127. 0x0661,
  33128. "onebengali",
  33129. 0x09e7,
  33130. "onecircle",
  33131. 0x2460,
  33132. "onecircleinversesansserif",
  33133. 0x278a,
  33134. "onedeva",
  33135. 0x0967,
  33136. "onedotenleader",
  33137. 0x2024,
  33138. "oneeighth",
  33139. 0x215b,
  33140. "onefitted",
  33141. 0xf6dc,
  33142. "onegujarati",
  33143. 0x0ae7,
  33144. "onegurmukhi",
  33145. 0x0a67,
  33146. "onehackarabic",
  33147. 0x0661,
  33148. "onehalf",
  33149. 0x00bd,
  33150. "onehangzhou",
  33151. 0x3021,
  33152. "oneideographicparen",
  33153. 0x3220,
  33154. "oneinferior",
  33155. 0x2081,
  33156. "onemonospace",
  33157. 0xff11,
  33158. "onenumeratorbengali",
  33159. 0x09f4,
  33160. "oneoldstyle",
  33161. 0xf731,
  33162. "oneparen",
  33163. 0x2474,
  33164. "oneperiod",
  33165. 0x2488,
  33166. "onepersian",
  33167. 0x06f1,
  33168. "onequarter",
  33169. 0x00bc,
  33170. "oneroman",
  33171. 0x2170,
  33172. "onesuperior",
  33173. 0x00b9,
  33174. "onethai",
  33175. 0x0e51,
  33176. "onethird",
  33177. 0x2153,
  33178. "oogonek",
  33179. 0x01eb,
  33180. "oogonekmacron",
  33181. 0x01ed,
  33182. "oogurmukhi",
  33183. 0x0a13,
  33184. "oomatragurmukhi",
  33185. 0x0a4b,
  33186. "oopen",
  33187. 0x0254,
  33188. "oparen",
  33189. 0x24aa,
  33190. "openbullet",
  33191. 0x25e6,
  33192. "option",
  33193. 0x2325,
  33194. "ordfeminine",
  33195. 0x00aa,
  33196. "ordmasculine",
  33197. 0x00ba,
  33198. "orthogonal",
  33199. 0x221f,
  33200. "oshortdeva",
  33201. 0x0912,
  33202. "oshortvowelsigndeva",
  33203. 0x094a,
  33204. "oslash",
  33205. 0x00f8,
  33206. "oslashacute",
  33207. 0x01ff,
  33208. "osmallhiragana",
  33209. 0x3049,
  33210. "osmallkatakana",
  33211. 0x30a9,
  33212. "osmallkatakanahalfwidth",
  33213. 0xff6b,
  33214. "ostrokeacute",
  33215. 0x01ff,
  33216. "osuperior",
  33217. 0xf6f0,
  33218. "otcyrillic",
  33219. 0x047f,
  33220. "otilde",
  33221. 0x00f5,
  33222. "otildeacute",
  33223. 0x1e4d,
  33224. "otildedieresis",
  33225. 0x1e4f,
  33226. "oubopomofo",
  33227. 0x3121,
  33228. "overline",
  33229. 0x203e,
  33230. "overlinecenterline",
  33231. 0xfe4a,
  33232. "overlinecmb",
  33233. 0x0305,
  33234. "overlinedashed",
  33235. 0xfe49,
  33236. "overlinedblwavy",
  33237. 0xfe4c,
  33238. "overlinewavy",
  33239. 0xfe4b,
  33240. "overscore",
  33241. 0x00af,
  33242. "ovowelsignbengali",
  33243. 0x09cb,
  33244. "ovowelsigndeva",
  33245. 0x094b,
  33246. "ovowelsigngujarati",
  33247. 0x0acb,
  33248. "p",
  33249. 0x0070,
  33250. "paampssquare",
  33251. 0x3380,
  33252. "paasentosquare",
  33253. 0x332b,
  33254. "pabengali",
  33255. 0x09aa,
  33256. "pacute",
  33257. 0x1e55,
  33258. "padeva",
  33259. 0x092a,
  33260. "pagedown",
  33261. 0x21df,
  33262. "pageup",
  33263. 0x21de,
  33264. "pagujarati",
  33265. 0x0aaa,
  33266. "pagurmukhi",
  33267. 0x0a2a,
  33268. "pahiragana",
  33269. 0x3071,
  33270. "paiyannoithai",
  33271. 0x0e2f,
  33272. "pakatakana",
  33273. 0x30d1,
  33274. "palatalizationcyrilliccmb",
  33275. 0x0484,
  33276. "palochkacyrillic",
  33277. 0x04c0,
  33278. "pansioskorean",
  33279. 0x317f,
  33280. "paragraph",
  33281. 0x00b6,
  33282. "parallel",
  33283. 0x2225,
  33284. "parenleft",
  33285. 0x0028,
  33286. "parenleftaltonearabic",
  33287. 0xfd3e,
  33288. "parenleftbt",
  33289. 0xf8ed,
  33290. "parenleftex",
  33291. 0xf8ec,
  33292. "parenleftinferior",
  33293. 0x208d,
  33294. "parenleftmonospace",
  33295. 0xff08,
  33296. "parenleftsmall",
  33297. 0xfe59,
  33298. "parenleftsuperior",
  33299. 0x207d,
  33300. "parenlefttp",
  33301. 0xf8eb,
  33302. "parenleftvertical",
  33303. 0xfe35,
  33304. "parenright",
  33305. 0x0029,
  33306. "parenrightaltonearabic",
  33307. 0xfd3f,
  33308. "parenrightbt",
  33309. 0xf8f8,
  33310. "parenrightex",
  33311. 0xf8f7,
  33312. "parenrightinferior",
  33313. 0x208e,
  33314. "parenrightmonospace",
  33315. 0xff09,
  33316. "parenrightsmall",
  33317. 0xfe5a,
  33318. "parenrightsuperior",
  33319. 0x207e,
  33320. "parenrighttp",
  33321. 0xf8f6,
  33322. "parenrightvertical",
  33323. 0xfe36,
  33324. "partialdiff",
  33325. 0x2202,
  33326. "paseqhebrew",
  33327. 0x05c0,
  33328. "pashtahebrew",
  33329. 0x0599,
  33330. "pasquare",
  33331. 0x33a9,
  33332. "patah",
  33333. 0x05b7,
  33334. "patah11",
  33335. 0x05b7,
  33336. "patah1d",
  33337. 0x05b7,
  33338. "patah2a",
  33339. 0x05b7,
  33340. "patahhebrew",
  33341. 0x05b7,
  33342. "patahnarrowhebrew",
  33343. 0x05b7,
  33344. "patahquarterhebrew",
  33345. 0x05b7,
  33346. "patahwidehebrew",
  33347. 0x05b7,
  33348. "pazerhebrew",
  33349. 0x05a1,
  33350. "pbopomofo",
  33351. 0x3106,
  33352. "pcircle",
  33353. 0x24df,
  33354. "pdotaccent",
  33355. 0x1e57,
  33356. "pe",
  33357. 0x05e4,
  33358. "pecyrillic",
  33359. 0x043f,
  33360. "pedagesh",
  33361. 0xfb44,
  33362. "pedageshhebrew",
  33363. 0xfb44,
  33364. "peezisquare",
  33365. 0x333b,
  33366. "pefinaldageshhebrew",
  33367. 0xfb43,
  33368. "peharabic",
  33369. 0x067e,
  33370. "peharmenian",
  33371. 0x057a,
  33372. "pehebrew",
  33373. 0x05e4,
  33374. "pehfinalarabic",
  33375. 0xfb57,
  33376. "pehinitialarabic",
  33377. 0xfb58,
  33378. "pehiragana",
  33379. 0x307a,
  33380. "pehmedialarabic",
  33381. 0xfb59,
  33382. "pekatakana",
  33383. 0x30da,
  33384. "pemiddlehookcyrillic",
  33385. 0x04a7,
  33386. "perafehebrew",
  33387. 0xfb4e,
  33388. "percent",
  33389. 0x0025,
  33390. "percentarabic",
  33391. 0x066a,
  33392. "percentmonospace",
  33393. 0xff05,
  33394. "percentsmall",
  33395. 0xfe6a,
  33396. "period",
  33397. 0x002e,
  33398. "periodarmenian",
  33399. 0x0589,
  33400. "periodcentered",
  33401. 0x00b7,
  33402. "periodhalfwidth",
  33403. 0xff61,
  33404. "periodinferior",
  33405. 0xf6e7,
  33406. "periodmonospace",
  33407. 0xff0e,
  33408. "periodsmall",
  33409. 0xfe52,
  33410. "periodsuperior",
  33411. 0xf6e8,
  33412. "perispomenigreekcmb",
  33413. 0x0342,
  33414. "perpendicular",
  33415. 0x22a5,
  33416. "perthousand",
  33417. 0x2030,
  33418. "peseta",
  33419. 0x20a7,
  33420. "pfsquare",
  33421. 0x338a,
  33422. "phabengali",
  33423. 0x09ab,
  33424. "phadeva",
  33425. 0x092b,
  33426. "phagujarati",
  33427. 0x0aab,
  33428. "phagurmukhi",
  33429. 0x0a2b,
  33430. "phi",
  33431. 0x03c6,
  33432. "phi1",
  33433. 0x03d5,
  33434. "phieuphacirclekorean",
  33435. 0x327a,
  33436. "phieuphaparenkorean",
  33437. 0x321a,
  33438. "phieuphcirclekorean",
  33439. 0x326c,
  33440. "phieuphkorean",
  33441. 0x314d,
  33442. "phieuphparenkorean",
  33443. 0x320c,
  33444. "philatin",
  33445. 0x0278,
  33446. "phinthuthai",
  33447. 0x0e3a,
  33448. "phisymbolgreek",
  33449. 0x03d5,
  33450. "phook",
  33451. 0x01a5,
  33452. "phophanthai",
  33453. 0x0e1e,
  33454. "phophungthai",
  33455. 0x0e1c,
  33456. "phosamphaothai",
  33457. 0x0e20,
  33458. "pi",
  33459. 0x03c0,
  33460. "pieupacirclekorean",
  33461. 0x3273,
  33462. "pieupaparenkorean",
  33463. 0x3213,
  33464. "pieupcieuckorean",
  33465. 0x3176,
  33466. "pieupcirclekorean",
  33467. 0x3265,
  33468. "pieupkiyeokkorean",
  33469. 0x3172,
  33470. "pieupkorean",
  33471. 0x3142,
  33472. "pieupparenkorean",
  33473. 0x3205,
  33474. "pieupsioskiyeokkorean",
  33475. 0x3174,
  33476. "pieupsioskorean",
  33477. 0x3144,
  33478. "pieupsiostikeutkorean",
  33479. 0x3175,
  33480. "pieupthieuthkorean",
  33481. 0x3177,
  33482. "pieuptikeutkorean",
  33483. 0x3173,
  33484. "pihiragana",
  33485. 0x3074,
  33486. "pikatakana",
  33487. 0x30d4,
  33488. "pisymbolgreek",
  33489. 0x03d6,
  33490. "piwrarmenian",
  33491. 0x0583,
  33492. "plus",
  33493. 0x002b,
  33494. "plusbelowcmb",
  33495. 0x031f,
  33496. "pluscircle",
  33497. 0x2295,
  33498. "plusminus",
  33499. 0x00b1,
  33500. "plusmod",
  33501. 0x02d6,
  33502. "plusmonospace",
  33503. 0xff0b,
  33504. "plussmall",
  33505. 0xfe62,
  33506. "plussuperior",
  33507. 0x207a,
  33508. "pmonospace",
  33509. 0xff50,
  33510. "pmsquare",
  33511. 0x33d8,
  33512. "pohiragana",
  33513. 0x307d,
  33514. "pointingindexdownwhite",
  33515. 0x261f,
  33516. "pointingindexleftwhite",
  33517. 0x261c,
  33518. "pointingindexrightwhite",
  33519. 0x261e,
  33520. "pointingindexupwhite",
  33521. 0x261d,
  33522. "pokatakana",
  33523. 0x30dd,
  33524. "poplathai",
  33525. 0x0e1b,
  33526. "postalmark",
  33527. 0x3012,
  33528. "postalmarkface",
  33529. 0x3020,
  33530. "pparen",
  33531. 0x24ab,
  33532. "precedes",
  33533. 0x227a,
  33534. "prescription",
  33535. 0x211e,
  33536. "primemod",
  33537. 0x02b9,
  33538. "primereversed",
  33539. 0x2035,
  33540. "product",
  33541. 0x220f,
  33542. "projective",
  33543. 0x2305,
  33544. "prolongedkana",
  33545. 0x30fc,
  33546. "propellor",
  33547. 0x2318,
  33548. "propersubset",
  33549. 0x2282,
  33550. "propersuperset",
  33551. 0x2283,
  33552. "proportion",
  33553. 0x2237,
  33554. "proportional",
  33555. 0x221d,
  33556. "psi",
  33557. 0x03c8,
  33558. "psicyrillic",
  33559. 0x0471,
  33560. "psilipneumatacyrilliccmb",
  33561. 0x0486,
  33562. "pssquare",
  33563. 0x33b0,
  33564. "puhiragana",
  33565. 0x3077,
  33566. "pukatakana",
  33567. 0x30d7,
  33568. "pvsquare",
  33569. 0x33b4,
  33570. "pwsquare",
  33571. 0x33ba,
  33572. "q",
  33573. 0x0071,
  33574. "qadeva",
  33575. 0x0958,
  33576. "qadmahebrew",
  33577. 0x05a8,
  33578. "qafarabic",
  33579. 0x0642,
  33580. "qaffinalarabic",
  33581. 0xfed6,
  33582. "qafinitialarabic",
  33583. 0xfed7,
  33584. "qafmedialarabic",
  33585. 0xfed8,
  33586. "qamats",
  33587. 0x05b8,
  33588. "qamats10",
  33589. 0x05b8,
  33590. "qamats1a",
  33591. 0x05b8,
  33592. "qamats1c",
  33593. 0x05b8,
  33594. "qamats27",
  33595. 0x05b8,
  33596. "qamats29",
  33597. 0x05b8,
  33598. "qamats33",
  33599. 0x05b8,
  33600. "qamatsde",
  33601. 0x05b8,
  33602. "qamatshebrew",
  33603. 0x05b8,
  33604. "qamatsnarrowhebrew",
  33605. 0x05b8,
  33606. "qamatsqatanhebrew",
  33607. 0x05b8,
  33608. "qamatsqatannarrowhebrew",
  33609. 0x05b8,
  33610. "qamatsqatanquarterhebrew",
  33611. 0x05b8,
  33612. "qamatsqatanwidehebrew",
  33613. 0x05b8,
  33614. "qamatsquarterhebrew",
  33615. 0x05b8,
  33616. "qamatswidehebrew",
  33617. 0x05b8,
  33618. "qarneyparahebrew",
  33619. 0x059f,
  33620. "qbopomofo",
  33621. 0x3111,
  33622. "qcircle",
  33623. 0x24e0,
  33624. "qhook",
  33625. 0x02a0,
  33626. "qmonospace",
  33627. 0xff51,
  33628. "qof",
  33629. 0x05e7,
  33630. "qofdagesh",
  33631. 0xfb47,
  33632. "qofdageshhebrew",
  33633. 0xfb47,
  33634. "qofhebrew",
  33635. 0x05e7,
  33636. "qparen",
  33637. 0x24ac,
  33638. "quarternote",
  33639. 0x2669,
  33640. "qubuts",
  33641. 0x05bb,
  33642. "qubuts18",
  33643. 0x05bb,
  33644. "qubuts25",
  33645. 0x05bb,
  33646. "qubuts31",
  33647. 0x05bb,
  33648. "qubutshebrew",
  33649. 0x05bb,
  33650. "qubutsnarrowhebrew",
  33651. 0x05bb,
  33652. "qubutsquarterhebrew",
  33653. 0x05bb,
  33654. "qubutswidehebrew",
  33655. 0x05bb,
  33656. "question",
  33657. 0x003f,
  33658. "questionarabic",
  33659. 0x061f,
  33660. "questionarmenian",
  33661. 0x055e,
  33662. "questiondown",
  33663. 0x00bf,
  33664. "questiondownsmall",
  33665. 0xf7bf,
  33666. "questiongreek",
  33667. 0x037e,
  33668. "questionmonospace",
  33669. 0xff1f,
  33670. "questionsmall",
  33671. 0xf73f,
  33672. "quotedbl",
  33673. 0x0022,
  33674. "quotedblbase",
  33675. 0x201e,
  33676. "quotedblleft",
  33677. 0x201c,
  33678. "quotedblmonospace",
  33679. 0xff02,
  33680. "quotedblprime",
  33681. 0x301e,
  33682. "quotedblprimereversed",
  33683. 0x301d,
  33684. "quotedblright",
  33685. 0x201d,
  33686. "quoteleft",
  33687. 0x2018,
  33688. "quoteleftreversed",
  33689. 0x201b,
  33690. "quotereversed",
  33691. 0x201b,
  33692. "quoteright",
  33693. 0x2019,
  33694. "quoterightn",
  33695. 0x0149,
  33696. "quotesinglbase",
  33697. 0x201a,
  33698. "quotesingle",
  33699. 0x0027,
  33700. "quotesinglemonospace",
  33701. 0xff07,
  33702. "r",
  33703. 0x0072,
  33704. "raarmenian",
  33705. 0x057c,
  33706. "rabengali",
  33707. 0x09b0,
  33708. "racute",
  33709. 0x0155,
  33710. "radeva",
  33711. 0x0930,
  33712. "radical",
  33713. 0x221a,
  33714. "radicalex",
  33715. 0xf8e5,
  33716. "radoverssquare",
  33717. 0x33ae,
  33718. "radoverssquaredsquare",
  33719. 0x33af,
  33720. "radsquare",
  33721. 0x33ad,
  33722. "rafe",
  33723. 0x05bf,
  33724. "rafehebrew",
  33725. 0x05bf,
  33726. "ragujarati",
  33727. 0x0ab0,
  33728. "ragurmukhi",
  33729. 0x0a30,
  33730. "rahiragana",
  33731. 0x3089,
  33732. "rakatakana",
  33733. 0x30e9,
  33734. "rakatakanahalfwidth",
  33735. 0xff97,
  33736. "ralowerdiagonalbengali",
  33737. 0x09f1,
  33738. "ramiddlediagonalbengali",
  33739. 0x09f0,
  33740. "ramshorn",
  33741. 0x0264,
  33742. "ratio",
  33743. 0x2236,
  33744. "rbopomofo",
  33745. 0x3116,
  33746. "rcaron",
  33747. 0x0159,
  33748. "rcedilla",
  33749. 0x0157,
  33750. "rcircle",
  33751. 0x24e1,
  33752. "rcommaaccent",
  33753. 0x0157,
  33754. "rdblgrave",
  33755. 0x0211,
  33756. "rdotaccent",
  33757. 0x1e59,
  33758. "rdotbelow",
  33759. 0x1e5b,
  33760. "rdotbelowmacron",
  33761. 0x1e5d,
  33762. "referencemark",
  33763. 0x203b,
  33764. "reflexsubset",
  33765. 0x2286,
  33766. "reflexsuperset",
  33767. 0x2287,
  33768. "registered",
  33769. 0x00ae,
  33770. "registersans",
  33771. 0xf8e8,
  33772. "registerserif",
  33773. 0xf6da,
  33774. "reharabic",
  33775. 0x0631,
  33776. "reharmenian",
  33777. 0x0580,
  33778. "rehfinalarabic",
  33779. 0xfeae,
  33780. "rehiragana",
  33781. 0x308c,
  33782. "rekatakana",
  33783. 0x30ec,
  33784. "rekatakanahalfwidth",
  33785. 0xff9a,
  33786. "resh",
  33787. 0x05e8,
  33788. "reshdageshhebrew",
  33789. 0xfb48,
  33790. "reshhebrew",
  33791. 0x05e8,
  33792. "reversedtilde",
  33793. 0x223d,
  33794. "reviahebrew",
  33795. 0x0597,
  33796. "reviamugrashhebrew",
  33797. 0x0597,
  33798. "revlogicalnot",
  33799. 0x2310,
  33800. "rfishhook",
  33801. 0x027e,
  33802. "rfishhookreversed",
  33803. 0x027f,
  33804. "rhabengali",
  33805. 0x09dd,
  33806. "rhadeva",
  33807. 0x095d,
  33808. "rho",
  33809. 0x03c1,
  33810. "rhook",
  33811. 0x027d,
  33812. "rhookturned",
  33813. 0x027b,
  33814. "rhookturnedsuperior",
  33815. 0x02b5,
  33816. "rhosymbolgreek",
  33817. 0x03f1,
  33818. "rhotichookmod",
  33819. 0x02de,
  33820. "rieulacirclekorean",
  33821. 0x3271,
  33822. "rieulaparenkorean",
  33823. 0x3211,
  33824. "rieulcirclekorean",
  33825. 0x3263,
  33826. "rieulhieuhkorean",
  33827. 0x3140,
  33828. "rieulkiyeokkorean",
  33829. 0x313a,
  33830. "rieulkiyeoksioskorean",
  33831. 0x3169,
  33832. "rieulkorean",
  33833. 0x3139,
  33834. "rieulmieumkorean",
  33835. 0x313b,
  33836. "rieulpansioskorean",
  33837. 0x316c,
  33838. "rieulparenkorean",
  33839. 0x3203,
  33840. "rieulphieuphkorean",
  33841. 0x313f,
  33842. "rieulpieupkorean",
  33843. 0x313c,
  33844. "rieulpieupsioskorean",
  33845. 0x316b,
  33846. "rieulsioskorean",
  33847. 0x313d,
  33848. "rieulthieuthkorean",
  33849. 0x313e,
  33850. "rieultikeutkorean",
  33851. 0x316a,
  33852. "rieulyeorinhieuhkorean",
  33853. 0x316d,
  33854. "rightangle",
  33855. 0x221f,
  33856. "righttackbelowcmb",
  33857. 0x0319,
  33858. "righttriangle",
  33859. 0x22bf,
  33860. "rihiragana",
  33861. 0x308a,
  33862. "rikatakana",
  33863. 0x30ea,
  33864. "rikatakanahalfwidth",
  33865. 0xff98,
  33866. "ring",
  33867. 0x02da,
  33868. "ringbelowcmb",
  33869. 0x0325,
  33870. "ringcmb",
  33871. 0x030a,
  33872. "ringhalfleft",
  33873. 0x02bf,
  33874. "ringhalfleftarmenian",
  33875. 0x0559,
  33876. "ringhalfleftbelowcmb",
  33877. 0x031c,
  33878. "ringhalfleftcentered",
  33879. 0x02d3,
  33880. "ringhalfright",
  33881. 0x02be,
  33882. "ringhalfrightbelowcmb",
  33883. 0x0339,
  33884. "ringhalfrightcentered",
  33885. 0x02d2,
  33886. "rinvertedbreve",
  33887. 0x0213,
  33888. "rittorusquare",
  33889. 0x3351,
  33890. "rlinebelow",
  33891. 0x1e5f,
  33892. "rlongleg",
  33893. 0x027c,
  33894. "rlonglegturned",
  33895. 0x027a,
  33896. "rmonospace",
  33897. 0xff52,
  33898. "rohiragana",
  33899. 0x308d,
  33900. "rokatakana",
  33901. 0x30ed,
  33902. "rokatakanahalfwidth",
  33903. 0xff9b,
  33904. "roruathai",
  33905. 0x0e23,
  33906. "rparen",
  33907. 0x24ad,
  33908. "rrabengali",
  33909. 0x09dc,
  33910. "rradeva",
  33911. 0x0931,
  33912. "rragurmukhi",
  33913. 0x0a5c,
  33914. "rreharabic",
  33915. 0x0691,
  33916. "rrehfinalarabic",
  33917. 0xfb8d,
  33918. "rrvocalicbengali",
  33919. 0x09e0,
  33920. "rrvocalicdeva",
  33921. 0x0960,
  33922. "rrvocalicgujarati",
  33923. 0x0ae0,
  33924. "rrvocalicvowelsignbengali",
  33925. 0x09c4,
  33926. "rrvocalicvowelsigndeva",
  33927. 0x0944,
  33928. "rrvocalicvowelsigngujarati",
  33929. 0x0ac4,
  33930. "rsuperior",
  33931. 0xf6f1,
  33932. "rtblock",
  33933. 0x2590,
  33934. "rturned",
  33935. 0x0279,
  33936. "rturnedsuperior",
  33937. 0x02b4,
  33938. "ruhiragana",
  33939. 0x308b,
  33940. "rukatakana",
  33941. 0x30eb,
  33942. "rukatakanahalfwidth",
  33943. 0xff99,
  33944. "rupeemarkbengali",
  33945. 0x09f2,
  33946. "rupeesignbengali",
  33947. 0x09f3,
  33948. "rupiah",
  33949. 0xf6dd,
  33950. "ruthai",
  33951. 0x0e24,
  33952. "rvocalicbengali",
  33953. 0x098b,
  33954. "rvocalicdeva",
  33955. 0x090b,
  33956. "rvocalicgujarati",
  33957. 0x0a8b,
  33958. "rvocalicvowelsignbengali",
  33959. 0x09c3,
  33960. "rvocalicvowelsigndeva",
  33961. 0x0943,
  33962. "rvocalicvowelsigngujarati",
  33963. 0x0ac3,
  33964. "s",
  33965. 0x0073,
  33966. "sabengali",
  33967. 0x09b8,
  33968. "sacute",
  33969. 0x015b,
  33970. "sacutedotaccent",
  33971. 0x1e65,
  33972. "sadarabic",
  33973. 0x0635,
  33974. "sadeva",
  33975. 0x0938,
  33976. "sadfinalarabic",
  33977. 0xfeba,
  33978. "sadinitialarabic",
  33979. 0xfebb,
  33980. "sadmedialarabic",
  33981. 0xfebc,
  33982. "sagujarati",
  33983. 0x0ab8,
  33984. "sagurmukhi",
  33985. 0x0a38,
  33986. "sahiragana",
  33987. 0x3055,
  33988. "sakatakana",
  33989. 0x30b5,
  33990. "sakatakanahalfwidth",
  33991. 0xff7b,
  33992. "sallallahoualayhewasallamarabic",
  33993. 0xfdfa,
  33994. "samekh",
  33995. 0x05e1,
  33996. "samekhdagesh",
  33997. 0xfb41,
  33998. "samekhdageshhebrew",
  33999. 0xfb41,
  34000. "samekhhebrew",
  34001. 0x05e1,
  34002. "saraaathai",
  34003. 0x0e32,
  34004. "saraaethai",
  34005. 0x0e41,
  34006. "saraaimaimalaithai",
  34007. 0x0e44,
  34008. "saraaimaimuanthai",
  34009. 0x0e43,
  34010. "saraamthai",
  34011. 0x0e33,
  34012. "saraathai",
  34013. 0x0e30,
  34014. "saraethai",
  34015. 0x0e40,
  34016. "saraiileftthai",
  34017. 0xf886,
  34018. "saraiithai",
  34019. 0x0e35,
  34020. "saraileftthai",
  34021. 0xf885,
  34022. "saraithai",
  34023. 0x0e34,
  34024. "saraothai",
  34025. 0x0e42,
  34026. "saraueeleftthai",
  34027. 0xf888,
  34028. "saraueethai",
  34029. 0x0e37,
  34030. "saraueleftthai",
  34031. 0xf887,
  34032. "sarauethai",
  34033. 0x0e36,
  34034. "sarauthai",
  34035. 0x0e38,
  34036. "sarauuthai",
  34037. 0x0e39,
  34038. "sbopomofo",
  34039. 0x3119,
  34040. "scaron",
  34041. 0x0161,
  34042. "scarondotaccent",
  34043. 0x1e67,
  34044. "scedilla",
  34045. 0x015f,
  34046. "schwa",
  34047. 0x0259,
  34048. "schwacyrillic",
  34049. 0x04d9,
  34050. "schwadieresiscyrillic",
  34051. 0x04db,
  34052. "schwahook",
  34053. 0x025a,
  34054. "scircle",
  34055. 0x24e2,
  34056. "scircumflex",
  34057. 0x015d,
  34058. "scommaaccent",
  34059. 0x0219,
  34060. "sdotaccent",
  34061. 0x1e61,
  34062. "sdotbelow",
  34063. 0x1e63,
  34064. "sdotbelowdotaccent",
  34065. 0x1e69,
  34066. "seagullbelowcmb",
  34067. 0x033c,
  34068. "second",
  34069. 0x2033,
  34070. "secondtonechinese",
  34071. 0x02ca,
  34072. "section",
  34073. 0x00a7,
  34074. "seenarabic",
  34075. 0x0633,
  34076. "seenfinalarabic",
  34077. 0xfeb2,
  34078. "seeninitialarabic",
  34079. 0xfeb3,
  34080. "seenmedialarabic",
  34081. 0xfeb4,
  34082. "segol",
  34083. 0x05b6,
  34084. "segol13",
  34085. 0x05b6,
  34086. "segol1f",
  34087. 0x05b6,
  34088. "segol2c",
  34089. 0x05b6,
  34090. "segolhebrew",
  34091. 0x05b6,
  34092. "segolnarrowhebrew",
  34093. 0x05b6,
  34094. "segolquarterhebrew",
  34095. 0x05b6,
  34096. "segoltahebrew",
  34097. 0x0592,
  34098. "segolwidehebrew",
  34099. 0x05b6,
  34100. "seharmenian",
  34101. 0x057d,
  34102. "sehiragana",
  34103. 0x305b,
  34104. "sekatakana",
  34105. 0x30bb,
  34106. "sekatakanahalfwidth",
  34107. 0xff7e,
  34108. "semicolon",
  34109. 0x003b,
  34110. "semicolonarabic",
  34111. 0x061b,
  34112. "semicolonmonospace",
  34113. 0xff1b,
  34114. "semicolonsmall",
  34115. 0xfe54,
  34116. "semivoicedmarkkana",
  34117. 0x309c,
  34118. "semivoicedmarkkanahalfwidth",
  34119. 0xff9f,
  34120. "sentisquare",
  34121. 0x3322,
  34122. "sentosquare",
  34123. 0x3323,
  34124. "seven",
  34125. 0x0037,
  34126. "sevenarabic",
  34127. 0x0667,
  34128. "sevenbengali",
  34129. 0x09ed,
  34130. "sevencircle",
  34131. 0x2466,
  34132. "sevencircleinversesansserif",
  34133. 0x2790,
  34134. "sevendeva",
  34135. 0x096d,
  34136. "seveneighths",
  34137. 0x215e,
  34138. "sevengujarati",
  34139. 0x0aed,
  34140. "sevengurmukhi",
  34141. 0x0a6d,
  34142. "sevenhackarabic",
  34143. 0x0667,
  34144. "sevenhangzhou",
  34145. 0x3027,
  34146. "sevenideographicparen",
  34147. 0x3226,
  34148. "seveninferior",
  34149. 0x2087,
  34150. "sevenmonospace",
  34151. 0xff17,
  34152. "sevenoldstyle",
  34153. 0xf737,
  34154. "sevenparen",
  34155. 0x247a,
  34156. "sevenperiod",
  34157. 0x248e,
  34158. "sevenpersian",
  34159. 0x06f7,
  34160. "sevenroman",
  34161. 0x2176,
  34162. "sevensuperior",
  34163. 0x2077,
  34164. "seventeencircle",
  34165. 0x2470,
  34166. "seventeenparen",
  34167. 0x2484,
  34168. "seventeenperiod",
  34169. 0x2498,
  34170. "seventhai",
  34171. 0x0e57,
  34172. "sfthyphen",
  34173. 0x00ad,
  34174. "shaarmenian",
  34175. 0x0577,
  34176. "shabengali",
  34177. 0x09b6,
  34178. "shacyrillic",
  34179. 0x0448,
  34180. "shaddaarabic",
  34181. 0x0651,
  34182. "shaddadammaarabic",
  34183. 0xfc61,
  34184. "shaddadammatanarabic",
  34185. 0xfc5e,
  34186. "shaddafathaarabic",
  34187. 0xfc60,
  34188. "shaddakasraarabic",
  34189. 0xfc62,
  34190. "shaddakasratanarabic",
  34191. 0xfc5f,
  34192. "shade",
  34193. 0x2592,
  34194. "shadedark",
  34195. 0x2593,
  34196. "shadelight",
  34197. 0x2591,
  34198. "shademedium",
  34199. 0x2592,
  34200. "shadeva",
  34201. 0x0936,
  34202. "shagujarati",
  34203. 0x0ab6,
  34204. "shagurmukhi",
  34205. 0x0a36,
  34206. "shalshelethebrew",
  34207. 0x0593,
  34208. "shbopomofo",
  34209. 0x3115,
  34210. "shchacyrillic",
  34211. 0x0449,
  34212. "sheenarabic",
  34213. 0x0634,
  34214. "sheenfinalarabic",
  34215. 0xfeb6,
  34216. "sheeninitialarabic",
  34217. 0xfeb7,
  34218. "sheenmedialarabic",
  34219. 0xfeb8,
  34220. "sheicoptic",
  34221. 0x03e3,
  34222. "sheqel",
  34223. 0x20aa,
  34224. "sheqelhebrew",
  34225. 0x20aa,
  34226. "sheva",
  34227. 0x05b0,
  34228. "sheva115",
  34229. 0x05b0,
  34230. "sheva15",
  34231. 0x05b0,
  34232. "sheva22",
  34233. 0x05b0,
  34234. "sheva2e",
  34235. 0x05b0,
  34236. "shevahebrew",
  34237. 0x05b0,
  34238. "shevanarrowhebrew",
  34239. 0x05b0,
  34240. "shevaquarterhebrew",
  34241. 0x05b0,
  34242. "shevawidehebrew",
  34243. 0x05b0,
  34244. "shhacyrillic",
  34245. 0x04bb,
  34246. "shimacoptic",
  34247. 0x03ed,
  34248. "shin",
  34249. 0x05e9,
  34250. "shindagesh",
  34251. 0xfb49,
  34252. "shindageshhebrew",
  34253. 0xfb49,
  34254. "shindageshshindot",
  34255. 0xfb2c,
  34256. "shindageshshindothebrew",
  34257. 0xfb2c,
  34258. "shindageshsindot",
  34259. 0xfb2d,
  34260. "shindageshsindothebrew",
  34261. 0xfb2d,
  34262. "shindothebrew",
  34263. 0x05c1,
  34264. "shinhebrew",
  34265. 0x05e9,
  34266. "shinshindot",
  34267. 0xfb2a,
  34268. "shinshindothebrew",
  34269. 0xfb2a,
  34270. "shinsindot",
  34271. 0xfb2b,
  34272. "shinsindothebrew",
  34273. 0xfb2b,
  34274. "shook",
  34275. 0x0282,
  34276. "sigma",
  34277. 0x03c3,
  34278. "sigma1",
  34279. 0x03c2,
  34280. "sigmafinal",
  34281. 0x03c2,
  34282. "sigmalunatesymbolgreek",
  34283. 0x03f2,
  34284. "sihiragana",
  34285. 0x3057,
  34286. "sikatakana",
  34287. 0x30b7,
  34288. "sikatakanahalfwidth",
  34289. 0xff7c,
  34290. "siluqhebrew",
  34291. 0x05bd,
  34292. "siluqlefthebrew",
  34293. 0x05bd,
  34294. "similar",
  34295. 0x223c,
  34296. "sindothebrew",
  34297. 0x05c2,
  34298. "siosacirclekorean",
  34299. 0x3274,
  34300. "siosaparenkorean",
  34301. 0x3214,
  34302. "sioscieuckorean",
  34303. 0x317e,
  34304. "sioscirclekorean",
  34305. 0x3266,
  34306. "sioskiyeokkorean",
  34307. 0x317a,
  34308. "sioskorean",
  34309. 0x3145,
  34310. "siosnieunkorean",
  34311. 0x317b,
  34312. "siosparenkorean",
  34313. 0x3206,
  34314. "siospieupkorean",
  34315. 0x317d,
  34316. "siostikeutkorean",
  34317. 0x317c,
  34318. "six",
  34319. 0x0036,
  34320. "sixarabic",
  34321. 0x0666,
  34322. "sixbengali",
  34323. 0x09ec,
  34324. "sixcircle",
  34325. 0x2465,
  34326. "sixcircleinversesansserif",
  34327. 0x278f,
  34328. "sixdeva",
  34329. 0x096c,
  34330. "sixgujarati",
  34331. 0x0aec,
  34332. "sixgurmukhi",
  34333. 0x0a6c,
  34334. "sixhackarabic",
  34335. 0x0666,
  34336. "sixhangzhou",
  34337. 0x3026,
  34338. "sixideographicparen",
  34339. 0x3225,
  34340. "sixinferior",
  34341. 0x2086,
  34342. "sixmonospace",
  34343. 0xff16,
  34344. "sixoldstyle",
  34345. 0xf736,
  34346. "sixparen",
  34347. 0x2479,
  34348. "sixperiod",
  34349. 0x248d,
  34350. "sixpersian",
  34351. 0x06f6,
  34352. "sixroman",
  34353. 0x2175,
  34354. "sixsuperior",
  34355. 0x2076,
  34356. "sixteencircle",
  34357. 0x246f,
  34358. "sixteencurrencydenominatorbengali",
  34359. 0x09f9,
  34360. "sixteenparen",
  34361. 0x2483,
  34362. "sixteenperiod",
  34363. 0x2497,
  34364. "sixthai",
  34365. 0x0e56,
  34366. "slash",
  34367. 0x002f,
  34368. "slashmonospace",
  34369. 0xff0f,
  34370. "slong",
  34371. 0x017f,
  34372. "slongdotaccent",
  34373. 0x1e9b,
  34374. "smileface",
  34375. 0x263a,
  34376. "smonospace",
  34377. 0xff53,
  34378. "sofpasuqhebrew",
  34379. 0x05c3,
  34380. "softhyphen",
  34381. 0x00ad,
  34382. "softsigncyrillic",
  34383. 0x044c,
  34384. "sohiragana",
  34385. 0x305d,
  34386. "sokatakana",
  34387. 0x30bd,
  34388. "sokatakanahalfwidth",
  34389. 0xff7f,
  34390. "soliduslongoverlaycmb",
  34391. 0x0338,
  34392. "solidusshortoverlaycmb",
  34393. 0x0337,
  34394. "sorusithai",
  34395. 0x0e29,
  34396. "sosalathai",
  34397. 0x0e28,
  34398. "sosothai",
  34399. 0x0e0b,
  34400. "sosuathai",
  34401. 0x0e2a,
  34402. "space",
  34403. 0x0020,
  34404. "spacehackarabic",
  34405. 0x0020,
  34406. "spade",
  34407. 0x2660,
  34408. "spadesuitblack",
  34409. 0x2660,
  34410. "spadesuitwhite",
  34411. 0x2664,
  34412. "sparen",
  34413. 0x24ae,
  34414. "squarebelowcmb",
  34415. 0x033b,
  34416. "squarecc",
  34417. 0x33c4,
  34418. "squarecm",
  34419. 0x339d,
  34420. "squarediagonalcrosshatchfill",
  34421. 0x25a9,
  34422. "squarehorizontalfill",
  34423. 0x25a4,
  34424. "squarekg",
  34425. 0x338f,
  34426. "squarekm",
  34427. 0x339e,
  34428. "squarekmcapital",
  34429. 0x33ce,
  34430. "squareln",
  34431. 0x33d1,
  34432. "squarelog",
  34433. 0x33d2,
  34434. "squaremg",
  34435. 0x338e,
  34436. "squaremil",
  34437. 0x33d5,
  34438. "squaremm",
  34439. 0x339c,
  34440. "squaremsquared",
  34441. 0x33a1,
  34442. "squareorthogonalcrosshatchfill",
  34443. 0x25a6,
  34444. "squareupperlefttolowerrightfill",
  34445. 0x25a7,
  34446. "squareupperrighttolowerleftfill",
  34447. 0x25a8,
  34448. "squareverticalfill",
  34449. 0x25a5,
  34450. "squarewhitewithsmallblack",
  34451. 0x25a3,
  34452. "srsquare",
  34453. 0x33db,
  34454. "ssabengali",
  34455. 0x09b7,
  34456. "ssadeva",
  34457. 0x0937,
  34458. "ssagujarati",
  34459. 0x0ab7,
  34460. "ssangcieuckorean",
  34461. 0x3149,
  34462. "ssanghieuhkorean",
  34463. 0x3185,
  34464. "ssangieungkorean",
  34465. 0x3180,
  34466. "ssangkiyeokkorean",
  34467. 0x3132,
  34468. "ssangnieunkorean",
  34469. 0x3165,
  34470. "ssangpieupkorean",
  34471. 0x3143,
  34472. "ssangsioskorean",
  34473. 0x3146,
  34474. "ssangtikeutkorean",
  34475. 0x3138,
  34476. "ssuperior",
  34477. 0xf6f2,
  34478. "sterling",
  34479. 0x00a3,
  34480. "sterlingmonospace",
  34481. 0xffe1,
  34482. "strokelongoverlaycmb",
  34483. 0x0336,
  34484. "strokeshortoverlaycmb",
  34485. 0x0335,
  34486. "subset",
  34487. 0x2282,
  34488. "subsetnotequal",
  34489. 0x228a,
  34490. "subsetorequal",
  34491. 0x2286,
  34492. "succeeds",
  34493. 0x227b,
  34494. "suchthat",
  34495. 0x220b,
  34496. "suhiragana",
  34497. 0x3059,
  34498. "sukatakana",
  34499. 0x30b9,
  34500. "sukatakanahalfwidth",
  34501. 0xff7d,
  34502. "sukunarabic",
  34503. 0x0652,
  34504. "summation",
  34505. 0x2211,
  34506. "sun",
  34507. 0x263c,
  34508. "superset",
  34509. 0x2283,
  34510. "supersetnotequal",
  34511. 0x228b,
  34512. "supersetorequal",
  34513. 0x2287,
  34514. "svsquare",
  34515. 0x33dc,
  34516. "syouwaerasquare",
  34517. 0x337c,
  34518. "t",
  34519. 0x0074,
  34520. "tabengali",
  34521. 0x09a4,
  34522. "tackdown",
  34523. 0x22a4,
  34524. "tackleft",
  34525. 0x22a3,
  34526. "tadeva",
  34527. 0x0924,
  34528. "tagujarati",
  34529. 0x0aa4,
  34530. "tagurmukhi",
  34531. 0x0a24,
  34532. "taharabic",
  34533. 0x0637,
  34534. "tahfinalarabic",
  34535. 0xfec2,
  34536. "tahinitialarabic",
  34537. 0xfec3,
  34538. "tahiragana",
  34539. 0x305f,
  34540. "tahmedialarabic",
  34541. 0xfec4,
  34542. "taisyouerasquare",
  34543. 0x337d,
  34544. "takatakana",
  34545. 0x30bf,
  34546. "takatakanahalfwidth",
  34547. 0xff80,
  34548. "tatweelarabic",
  34549. 0x0640,
  34550. "tau",
  34551. 0x03c4,
  34552. "tav",
  34553. 0x05ea,
  34554. "tavdages",
  34555. 0xfb4a,
  34556. "tavdagesh",
  34557. 0xfb4a,
  34558. "tavdageshhebrew",
  34559. 0xfb4a,
  34560. "tavhebrew",
  34561. 0x05ea,
  34562. "tbar",
  34563. 0x0167,
  34564. "tbopomofo",
  34565. 0x310a,
  34566. "tcaron",
  34567. 0x0165,
  34568. "tccurl",
  34569. 0x02a8,
  34570. "tcedilla",
  34571. 0x0163,
  34572. "tcheharabic",
  34573. 0x0686,
  34574. "tchehfinalarabic",
  34575. 0xfb7b,
  34576. "tchehinitialarabic",
  34577. 0xfb7c,
  34578. "tchehmedialarabic",
  34579. 0xfb7d,
  34580. "tcircle",
  34581. 0x24e3,
  34582. "tcircumflexbelow",
  34583. 0x1e71,
  34584. "tcommaaccent",
  34585. 0x0163,
  34586. "tdieresis",
  34587. 0x1e97,
  34588. "tdotaccent",
  34589. 0x1e6b,
  34590. "tdotbelow",
  34591. 0x1e6d,
  34592. "tecyrillic",
  34593. 0x0442,
  34594. "tedescendercyrillic",
  34595. 0x04ad,
  34596. "teharabic",
  34597. 0x062a,
  34598. "tehfinalarabic",
  34599. 0xfe96,
  34600. "tehhahinitialarabic",
  34601. 0xfca2,
  34602. "tehhahisolatedarabic",
  34603. 0xfc0c,
  34604. "tehinitialarabic",
  34605. 0xfe97,
  34606. "tehiragana",
  34607. 0x3066,
  34608. "tehjeeminitialarabic",
  34609. 0xfca1,
  34610. "tehjeemisolatedarabic",
  34611. 0xfc0b,
  34612. "tehmarbutaarabic",
  34613. 0x0629,
  34614. "tehmarbutafinalarabic",
  34615. 0xfe94,
  34616. "tehmedialarabic",
  34617. 0xfe98,
  34618. "tehmeeminitialarabic",
  34619. 0xfca4,
  34620. "tehmeemisolatedarabic",
  34621. 0xfc0e,
  34622. "tehnoonfinalarabic",
  34623. 0xfc73,
  34624. "tekatakana",
  34625. 0x30c6,
  34626. "tekatakanahalfwidth",
  34627. 0xff83,
  34628. "telephone",
  34629. 0x2121,
  34630. "telephoneblack",
  34631. 0x260e,
  34632. "telishagedolahebrew",
  34633. 0x05a0,
  34634. "telishaqetanahebrew",
  34635. 0x05a9,
  34636. "tencircle",
  34637. 0x2469,
  34638. "tenideographicparen",
  34639. 0x3229,
  34640. "tenparen",
  34641. 0x247d,
  34642. "tenperiod",
  34643. 0x2491,
  34644. "tenroman",
  34645. 0x2179,
  34646. "tesh",
  34647. 0x02a7,
  34648. "tet",
  34649. 0x05d8,
  34650. "tetdagesh",
  34651. 0xfb38,
  34652. "tetdageshhebrew",
  34653. 0xfb38,
  34654. "tethebrew",
  34655. 0x05d8,
  34656. "tetsecyrillic",
  34657. 0x04b5,
  34658. "tevirhebrew",
  34659. 0x059b,
  34660. "tevirlefthebrew",
  34661. 0x059b,
  34662. "thabengali",
  34663. 0x09a5,
  34664. "thadeva",
  34665. 0x0925,
  34666. "thagujarati",
  34667. 0x0aa5,
  34668. "thagurmukhi",
  34669. 0x0a25,
  34670. "thalarabic",
  34671. 0x0630,
  34672. "thalfinalarabic",
  34673. 0xfeac,
  34674. "thanthakhatlowleftthai",
  34675. 0xf898,
  34676. "thanthakhatlowrightthai",
  34677. 0xf897,
  34678. "thanthakhatthai",
  34679. 0x0e4c,
  34680. "thanthakhatupperleftthai",
  34681. 0xf896,
  34682. "theharabic",
  34683. 0x062b,
  34684. "thehfinalarabic",
  34685. 0xfe9a,
  34686. "thehinitialarabic",
  34687. 0xfe9b,
  34688. "thehmedialarabic",
  34689. 0xfe9c,
  34690. "thereexists",
  34691. 0x2203,
  34692. "therefore",
  34693. 0x2234,
  34694. "theta",
  34695. 0x03b8,
  34696. "theta1",
  34697. 0x03d1,
  34698. "thetasymbolgreek",
  34699. 0x03d1,
  34700. "thieuthacirclekorean",
  34701. 0x3279,
  34702. "thieuthaparenkorean",
  34703. 0x3219,
  34704. "thieuthcirclekorean",
  34705. 0x326b,
  34706. "thieuthkorean",
  34707. 0x314c,
  34708. "thieuthparenkorean",
  34709. 0x320b,
  34710. "thirteencircle",
  34711. 0x246c,
  34712. "thirteenparen",
  34713. 0x2480,
  34714. "thirteenperiod",
  34715. 0x2494,
  34716. "thonangmonthothai",
  34717. 0x0e11,
  34718. "thook",
  34719. 0x01ad,
  34720. "thophuthaothai",
  34721. 0x0e12,
  34722. "thorn",
  34723. 0x00fe,
  34724. "thothahanthai",
  34725. 0x0e17,
  34726. "thothanthai",
  34727. 0x0e10,
  34728. "thothongthai",
  34729. 0x0e18,
  34730. "thothungthai",
  34731. 0x0e16,
  34732. "thousandcyrillic",
  34733. 0x0482,
  34734. "thousandsseparatorarabic",
  34735. 0x066c,
  34736. "thousandsseparatorpersian",
  34737. 0x066c,
  34738. "three",
  34739. 0x0033,
  34740. "threearabic",
  34741. 0x0663,
  34742. "threebengali",
  34743. 0x09e9,
  34744. "threecircle",
  34745. 0x2462,
  34746. "threecircleinversesansserif",
  34747. 0x278c,
  34748. "threedeva",
  34749. 0x0969,
  34750. "threeeighths",
  34751. 0x215c,
  34752. "threegujarati",
  34753. 0x0ae9,
  34754. "threegurmukhi",
  34755. 0x0a69,
  34756. "threehackarabic",
  34757. 0x0663,
  34758. "threehangzhou",
  34759. 0x3023,
  34760. "threeideographicparen",
  34761. 0x3222,
  34762. "threeinferior",
  34763. 0x2083,
  34764. "threemonospace",
  34765. 0xff13,
  34766. "threenumeratorbengali",
  34767. 0x09f6,
  34768. "threeoldstyle",
  34769. 0xf733,
  34770. "threeparen",
  34771. 0x2476,
  34772. "threeperiod",
  34773. 0x248a,
  34774. "threepersian",
  34775. 0x06f3,
  34776. "threequarters",
  34777. 0x00be,
  34778. "threequartersemdash",
  34779. 0xf6de,
  34780. "threeroman",
  34781. 0x2172,
  34782. "threesuperior",
  34783. 0x00b3,
  34784. "threethai",
  34785. 0x0e53,
  34786. "thzsquare",
  34787. 0x3394,
  34788. "tihiragana",
  34789. 0x3061,
  34790. "tikatakana",
  34791. 0x30c1,
  34792. "tikatakanahalfwidth",
  34793. 0xff81,
  34794. "tikeutacirclekorean",
  34795. 0x3270,
  34796. "tikeutaparenkorean",
  34797. 0x3210,
  34798. "tikeutcirclekorean",
  34799. 0x3262,
  34800. "tikeutkorean",
  34801. 0x3137,
  34802. "tikeutparenkorean",
  34803. 0x3202,
  34804. "tilde",
  34805. 0x02dc,
  34806. "tildebelowcmb",
  34807. 0x0330,
  34808. "tildecmb",
  34809. 0x0303,
  34810. "tildecomb",
  34811. 0x0303,
  34812. "tildedoublecmb",
  34813. 0x0360,
  34814. "tildeoperator",
  34815. 0x223c,
  34816. "tildeoverlaycmb",
  34817. 0x0334,
  34818. "tildeverticalcmb",
  34819. 0x033e,
  34820. "timescircle",
  34821. 0x2297,
  34822. "tipehahebrew",
  34823. 0x0596,
  34824. "tipehalefthebrew",
  34825. 0x0596,
  34826. "tippigurmukhi",
  34827. 0x0a70,
  34828. "titlocyrilliccmb",
  34829. 0x0483,
  34830. "tiwnarmenian",
  34831. 0x057f,
  34832. "tlinebelow",
  34833. 0x1e6f,
  34834. "tmonospace",
  34835. 0xff54,
  34836. "toarmenian",
  34837. 0x0569,
  34838. "tohiragana",
  34839. 0x3068,
  34840. "tokatakana",
  34841. 0x30c8,
  34842. "tokatakanahalfwidth",
  34843. 0xff84,
  34844. "tonebarextrahighmod",
  34845. 0x02e5,
  34846. "tonebarextralowmod",
  34847. 0x02e9,
  34848. "tonebarhighmod",
  34849. 0x02e6,
  34850. "tonebarlowmod",
  34851. 0x02e8,
  34852. "tonebarmidmod",
  34853. 0x02e7,
  34854. "tonefive",
  34855. 0x01bd,
  34856. "tonesix",
  34857. 0x0185,
  34858. "tonetwo",
  34859. 0x01a8,
  34860. "tonos",
  34861. 0x0384,
  34862. "tonsquare",
  34863. 0x3327,
  34864. "topatakthai",
  34865. 0x0e0f,
  34866. "tortoiseshellbracketleft",
  34867. 0x3014,
  34868. "tortoiseshellbracketleftsmall",
  34869. 0xfe5d,
  34870. "tortoiseshellbracketleftvertical",
  34871. 0xfe39,
  34872. "tortoiseshellbracketright",
  34873. 0x3015,
  34874. "tortoiseshellbracketrightsmall",
  34875. 0xfe5e,
  34876. "tortoiseshellbracketrightvertical",
  34877. 0xfe3a,
  34878. "totaothai",
  34879. 0x0e15,
  34880. "tpalatalhook",
  34881. 0x01ab,
  34882. "tparen",
  34883. 0x24af,
  34884. "trademark",
  34885. 0x2122,
  34886. "trademarksans",
  34887. 0xf8ea,
  34888. "trademarkserif",
  34889. 0xf6db,
  34890. "tretroflexhook",
  34891. 0x0288,
  34892. "triagdn",
  34893. 0x25bc,
  34894. "triaglf",
  34895. 0x25c4,
  34896. "triagrt",
  34897. 0x25ba,
  34898. "triagup",
  34899. 0x25b2,
  34900. "ts",
  34901. 0x02a6,
  34902. "tsadi",
  34903. 0x05e6,
  34904. "tsadidagesh",
  34905. 0xfb46,
  34906. "tsadidageshhebrew",
  34907. 0xfb46,
  34908. "tsadihebrew",
  34909. 0x05e6,
  34910. "tsecyrillic",
  34911. 0x0446,
  34912. "tsere",
  34913. 0x05b5,
  34914. "tsere12",
  34915. 0x05b5,
  34916. "tsere1e",
  34917. 0x05b5,
  34918. "tsere2b",
  34919. 0x05b5,
  34920. "tserehebrew",
  34921. 0x05b5,
  34922. "tserenarrowhebrew",
  34923. 0x05b5,
  34924. "tserequarterhebrew",
  34925. 0x05b5,
  34926. "tserewidehebrew",
  34927. 0x05b5,
  34928. "tshecyrillic",
  34929. 0x045b,
  34930. "tsuperior",
  34931. 0xf6f3,
  34932. "ttabengali",
  34933. 0x099f,
  34934. "ttadeva",
  34935. 0x091f,
  34936. "ttagujarati",
  34937. 0x0a9f,
  34938. "ttagurmukhi",
  34939. 0x0a1f,
  34940. "tteharabic",
  34941. 0x0679,
  34942. "ttehfinalarabic",
  34943. 0xfb67,
  34944. "ttehinitialarabic",
  34945. 0xfb68,
  34946. "ttehmedialarabic",
  34947. 0xfb69,
  34948. "tthabengali",
  34949. 0x09a0,
  34950. "tthadeva",
  34951. 0x0920,
  34952. "tthagujarati",
  34953. 0x0aa0,
  34954. "tthagurmukhi",
  34955. 0x0a20,
  34956. "tturned",
  34957. 0x0287,
  34958. "tuhiragana",
  34959. 0x3064,
  34960. "tukatakana",
  34961. 0x30c4,
  34962. "tukatakanahalfwidth",
  34963. 0xff82,
  34964. "tusmallhiragana",
  34965. 0x3063,
  34966. "tusmallkatakana",
  34967. 0x30c3,
  34968. "tusmallkatakanahalfwidth",
  34969. 0xff6f,
  34970. "twelvecircle",
  34971. 0x246b,
  34972. "twelveparen",
  34973. 0x247f,
  34974. "twelveperiod",
  34975. 0x2493,
  34976. "twelveroman",
  34977. 0x217b,
  34978. "twentycircle",
  34979. 0x2473,
  34980. "twentyhangzhou",
  34981. 0x5344,
  34982. "twentyparen",
  34983. 0x2487,
  34984. "twentyperiod",
  34985. 0x249b,
  34986. "two",
  34987. 0x0032,
  34988. "twoarabic",
  34989. 0x0662,
  34990. "twobengali",
  34991. 0x09e8,
  34992. "twocircle",
  34993. 0x2461,
  34994. "twocircleinversesansserif",
  34995. 0x278b,
  34996. "twodeva",
  34997. 0x0968,
  34998. "twodotenleader",
  34999. 0x2025,
  35000. "twodotleader",
  35001. 0x2025,
  35002. "twodotleadervertical",
  35003. 0xfe30,
  35004. "twogujarati",
  35005. 0x0ae8,
  35006. "twogurmukhi",
  35007. 0x0a68,
  35008. "twohackarabic",
  35009. 0x0662,
  35010. "twohangzhou",
  35011. 0x3022,
  35012. "twoideographicparen",
  35013. 0x3221,
  35014. "twoinferior",
  35015. 0x2082,
  35016. "twomonospace",
  35017. 0xff12,
  35018. "twonumeratorbengali",
  35019. 0x09f5,
  35020. "twooldstyle",
  35021. 0xf732,
  35022. "twoparen",
  35023. 0x2475,
  35024. "twoperiod",
  35025. 0x2489,
  35026. "twopersian",
  35027. 0x06f2,
  35028. "tworoman",
  35029. 0x2171,
  35030. "twostroke",
  35031. 0x01bb,
  35032. "twosuperior",
  35033. 0x00b2,
  35034. "twothai",
  35035. 0x0e52,
  35036. "twothirds",
  35037. 0x2154,
  35038. "u",
  35039. 0x0075,
  35040. "uacute",
  35041. 0x00fa,
  35042. "ubar",
  35043. 0x0289,
  35044. "ubengali",
  35045. 0x0989,
  35046. "ubopomofo",
  35047. 0x3128,
  35048. "ubreve",
  35049. 0x016d,
  35050. "ucaron",
  35051. 0x01d4,
  35052. "ucircle",
  35053. 0x24e4,
  35054. "ucircumflex",
  35055. 0x00fb,
  35056. "ucircumflexbelow",
  35057. 0x1e77,
  35058. "ucyrillic",
  35059. 0x0443,
  35060. "udattadeva",
  35061. 0x0951,
  35062. "udblacute",
  35063. 0x0171,
  35064. "udblgrave",
  35065. 0x0215,
  35066. "udeva",
  35067. 0x0909,
  35068. "udieresis",
  35069. 0x00fc,
  35070. "udieresisacute",
  35071. 0x01d8,
  35072. "udieresisbelow",
  35073. 0x1e73,
  35074. "udieresiscaron",
  35075. 0x01da,
  35076. "udieresiscyrillic",
  35077. 0x04f1,
  35078. "udieresisgrave",
  35079. 0x01dc,
  35080. "udieresismacron",
  35081. 0x01d6,
  35082. "udotbelow",
  35083. 0x1ee5,
  35084. "ugrave",
  35085. 0x00f9,
  35086. "ugujarati",
  35087. 0x0a89,
  35088. "ugurmukhi",
  35089. 0x0a09,
  35090. "uhiragana",
  35091. 0x3046,
  35092. "uhookabove",
  35093. 0x1ee7,
  35094. "uhorn",
  35095. 0x01b0,
  35096. "uhornacute",
  35097. 0x1ee9,
  35098. "uhorndotbelow",
  35099. 0x1ef1,
  35100. "uhorngrave",
  35101. 0x1eeb,
  35102. "uhornhookabove",
  35103. 0x1eed,
  35104. "uhorntilde",
  35105. 0x1eef,
  35106. "uhungarumlaut",
  35107. 0x0171,
  35108. "uhungarumlautcyrillic",
  35109. 0x04f3,
  35110. "uinvertedbreve",
  35111. 0x0217,
  35112. "ukatakana",
  35113. 0x30a6,
  35114. "ukatakanahalfwidth",
  35115. 0xff73,
  35116. "ukcyrillic",
  35117. 0x0479,
  35118. "ukorean",
  35119. 0x315c,
  35120. "umacron",
  35121. 0x016b,
  35122. "umacroncyrillic",
  35123. 0x04ef,
  35124. "umacrondieresis",
  35125. 0x1e7b,
  35126. "umatragurmukhi",
  35127. 0x0a41,
  35128. "umonospace",
  35129. 0xff55,
  35130. "underscore",
  35131. 0x005f,
  35132. "underscoredbl",
  35133. 0x2017,
  35134. "underscoremonospace",
  35135. 0xff3f,
  35136. "underscorevertical",
  35137. 0xfe33,
  35138. "underscorewavy",
  35139. 0xfe4f,
  35140. "union",
  35141. 0x222a,
  35142. "universal",
  35143. 0x2200,
  35144. "uogonek",
  35145. 0x0173,
  35146. "uparen",
  35147. 0x24b0,
  35148. "upblock",
  35149. 0x2580,
  35150. "upperdothebrew",
  35151. 0x05c4,
  35152. "upsilon",
  35153. 0x03c5,
  35154. "upsilondieresis",
  35155. 0x03cb,
  35156. "upsilondieresistonos",
  35157. 0x03b0,
  35158. "upsilonlatin",
  35159. 0x028a,
  35160. "upsilontonos",
  35161. 0x03cd,
  35162. "uptackbelowcmb",
  35163. 0x031d,
  35164. "uptackmod",
  35165. 0x02d4,
  35166. "uragurmukhi",
  35167. 0x0a73,
  35168. "uring",
  35169. 0x016f,
  35170. "ushortcyrillic",
  35171. 0x045e,
  35172. "usmallhiragana",
  35173. 0x3045,
  35174. "usmallkatakana",
  35175. 0x30a5,
  35176. "usmallkatakanahalfwidth",
  35177. 0xff69,
  35178. "ustraightcyrillic",
  35179. 0x04af,
  35180. "ustraightstrokecyrillic",
  35181. 0x04b1,
  35182. "utilde",
  35183. 0x0169,
  35184. "utildeacute",
  35185. 0x1e79,
  35186. "utildebelow",
  35187. 0x1e75,
  35188. "uubengali",
  35189. 0x098a,
  35190. "uudeva",
  35191. 0x090a,
  35192. "uugujarati",
  35193. 0x0a8a,
  35194. "uugurmukhi",
  35195. 0x0a0a,
  35196. "uumatragurmukhi",
  35197. 0x0a42,
  35198. "uuvowelsignbengali",
  35199. 0x09c2,
  35200. "uuvowelsigndeva",
  35201. 0x0942,
  35202. "uuvowelsigngujarati",
  35203. 0x0ac2,
  35204. "uvowelsignbengali",
  35205. 0x09c1,
  35206. "uvowelsigndeva",
  35207. 0x0941,
  35208. "uvowelsigngujarati",
  35209. 0x0ac1,
  35210. "v",
  35211. 0x0076,
  35212. "vadeva",
  35213. 0x0935,
  35214. "vagujarati",
  35215. 0x0ab5,
  35216. "vagurmukhi",
  35217. 0x0a35,
  35218. "vakatakana",
  35219. 0x30f7,
  35220. "vav",
  35221. 0x05d5,
  35222. "vavdagesh",
  35223. 0xfb35,
  35224. "vavdagesh65",
  35225. 0xfb35,
  35226. "vavdageshhebrew",
  35227. 0xfb35,
  35228. "vavhebrew",
  35229. 0x05d5,
  35230. "vavholam",
  35231. 0xfb4b,
  35232. "vavholamhebrew",
  35233. 0xfb4b,
  35234. "vavvavhebrew",
  35235. 0x05f0,
  35236. "vavyodhebrew",
  35237. 0x05f1,
  35238. "vcircle",
  35239. 0x24e5,
  35240. "vdotbelow",
  35241. 0x1e7f,
  35242. "vecyrillic",
  35243. 0x0432,
  35244. "veharabic",
  35245. 0x06a4,
  35246. "vehfinalarabic",
  35247. 0xfb6b,
  35248. "vehinitialarabic",
  35249. 0xfb6c,
  35250. "vehmedialarabic",
  35251. 0xfb6d,
  35252. "vekatakana",
  35253. 0x30f9,
  35254. "venus",
  35255. 0x2640,
  35256. "verticalbar",
  35257. 0x007c,
  35258. "verticallineabovecmb",
  35259. 0x030d,
  35260. "verticallinebelowcmb",
  35261. 0x0329,
  35262. "verticallinelowmod",
  35263. 0x02cc,
  35264. "verticallinemod",
  35265. 0x02c8,
  35266. "vewarmenian",
  35267. 0x057e,
  35268. "vhook",
  35269. 0x028b,
  35270. "vikatakana",
  35271. 0x30f8,
  35272. "viramabengali",
  35273. 0x09cd,
  35274. "viramadeva",
  35275. 0x094d,
  35276. "viramagujarati",
  35277. 0x0acd,
  35278. "visargabengali",
  35279. 0x0983,
  35280. "visargadeva",
  35281. 0x0903,
  35282. "visargagujarati",
  35283. 0x0a83,
  35284. "vmonospace",
  35285. 0xff56,
  35286. "voarmenian",
  35287. 0x0578,
  35288. "voicediterationhiragana",
  35289. 0x309e,
  35290. "voicediterationkatakana",
  35291. 0x30fe,
  35292. "voicedmarkkana",
  35293. 0x309b,
  35294. "voicedmarkkanahalfwidth",
  35295. 0xff9e,
  35296. "vokatakana",
  35297. 0x30fa,
  35298. "vparen",
  35299. 0x24b1,
  35300. "vtilde",
  35301. 0x1e7d,
  35302. "vturned",
  35303. 0x028c,
  35304. "vuhiragana",
  35305. 0x3094,
  35306. "vukatakana",
  35307. 0x30f4,
  35308. "w",
  35309. 0x0077,
  35310. "wacute",
  35311. 0x1e83,
  35312. "waekorean",
  35313. 0x3159,
  35314. "wahiragana",
  35315. 0x308f,
  35316. "wakatakana",
  35317. 0x30ef,
  35318. "wakatakanahalfwidth",
  35319. 0xff9c,
  35320. "wakorean",
  35321. 0x3158,
  35322. "wasmallhiragana",
  35323. 0x308e,
  35324. "wasmallkatakana",
  35325. 0x30ee,
  35326. "wattosquare",
  35327. 0x3357,
  35328. "wavedash",
  35329. 0x301c,
  35330. "wavyunderscorevertical",
  35331. 0xfe34,
  35332. "wawarabic",
  35333. 0x0648,
  35334. "wawfinalarabic",
  35335. 0xfeee,
  35336. "wawhamzaabovearabic",
  35337. 0x0624,
  35338. "wawhamzaabovefinalarabic",
  35339. 0xfe86,
  35340. "wbsquare",
  35341. 0x33dd,
  35342. "wcircle",
  35343. 0x24e6,
  35344. "wcircumflex",
  35345. 0x0175,
  35346. "wdieresis",
  35347. 0x1e85,
  35348. "wdotaccent",
  35349. 0x1e87,
  35350. "wdotbelow",
  35351. 0x1e89,
  35352. "wehiragana",
  35353. 0x3091,
  35354. "weierstrass",
  35355. 0x2118,
  35356. "wekatakana",
  35357. 0x30f1,
  35358. "wekorean",
  35359. 0x315e,
  35360. "weokorean",
  35361. 0x315d,
  35362. "wgrave",
  35363. 0x1e81,
  35364. "whitebullet",
  35365. 0x25e6,
  35366. "whitecircle",
  35367. 0x25cb,
  35368. "whitecircleinverse",
  35369. 0x25d9,
  35370. "whitecornerbracketleft",
  35371. 0x300e,
  35372. "whitecornerbracketleftvertical",
  35373. 0xfe43,
  35374. "whitecornerbracketright",
  35375. 0x300f,
  35376. "whitecornerbracketrightvertical",
  35377. 0xfe44,
  35378. "whitediamond",
  35379. 0x25c7,
  35380. "whitediamondcontainingblacksmalldiamond",
  35381. 0x25c8,
  35382. "whitedownpointingsmalltriangle",
  35383. 0x25bf,
  35384. "whitedownpointingtriangle",
  35385. 0x25bd,
  35386. "whiteleftpointingsmalltriangle",
  35387. 0x25c3,
  35388. "whiteleftpointingtriangle",
  35389. 0x25c1,
  35390. "whitelenticularbracketleft",
  35391. 0x3016,
  35392. "whitelenticularbracketright",
  35393. 0x3017,
  35394. "whiterightpointingsmalltriangle",
  35395. 0x25b9,
  35396. "whiterightpointingtriangle",
  35397. 0x25b7,
  35398. "whitesmallsquare",
  35399. 0x25ab,
  35400. "whitesmilingface",
  35401. 0x263a,
  35402. "whitesquare",
  35403. 0x25a1,
  35404. "whitestar",
  35405. 0x2606,
  35406. "whitetelephone",
  35407. 0x260f,
  35408. "whitetortoiseshellbracketleft",
  35409. 0x3018,
  35410. "whitetortoiseshellbracketright",
  35411. 0x3019,
  35412. "whiteuppointingsmalltriangle",
  35413. 0x25b5,
  35414. "whiteuppointingtriangle",
  35415. 0x25b3,
  35416. "wihiragana",
  35417. 0x3090,
  35418. "wikatakana",
  35419. 0x30f0,
  35420. "wikorean",
  35421. 0x315f,
  35422. "wmonospace",
  35423. 0xff57,
  35424. "wohiragana",
  35425. 0x3092,
  35426. "wokatakana",
  35427. 0x30f2,
  35428. "wokatakanahalfwidth",
  35429. 0xff66,
  35430. "won",
  35431. 0x20a9,
  35432. "wonmonospace",
  35433. 0xffe6,
  35434. "wowaenthai",
  35435. 0x0e27,
  35436. "wparen",
  35437. 0x24b2,
  35438. "wring",
  35439. 0x1e98,
  35440. "wsuperior",
  35441. 0x02b7,
  35442. "wturned",
  35443. 0x028d,
  35444. "wynn",
  35445. 0x01bf,
  35446. "x",
  35447. 0x0078,
  35448. "xabovecmb",
  35449. 0x033d,
  35450. "xbopomofo",
  35451. 0x3112,
  35452. "xcircle",
  35453. 0x24e7,
  35454. "xdieresis",
  35455. 0x1e8d,
  35456. "xdotaccent",
  35457. 0x1e8b,
  35458. "xeharmenian",
  35459. 0x056d,
  35460. "xi",
  35461. 0x03be,
  35462. "xmonospace",
  35463. 0xff58,
  35464. "xparen",
  35465. 0x24b3,
  35466. "xsuperior",
  35467. 0x02e3,
  35468. "y",
  35469. 0x0079,
  35470. "yaadosquare",
  35471. 0x334e,
  35472. "yabengali",
  35473. 0x09af,
  35474. "yacute",
  35475. 0x00fd,
  35476. "yadeva",
  35477. 0x092f,
  35478. "yaekorean",
  35479. 0x3152,
  35480. "yagujarati",
  35481. 0x0aaf,
  35482. "yagurmukhi",
  35483. 0x0a2f,
  35484. "yahiragana",
  35485. 0x3084,
  35486. "yakatakana",
  35487. 0x30e4,
  35488. "yakatakanahalfwidth",
  35489. 0xff94,
  35490. "yakorean",
  35491. 0x3151,
  35492. "yamakkanthai",
  35493. 0x0e4e,
  35494. "yasmallhiragana",
  35495. 0x3083,
  35496. "yasmallkatakana",
  35497. 0x30e3,
  35498. "yasmallkatakanahalfwidth",
  35499. 0xff6c,
  35500. "yatcyrillic",
  35501. 0x0463,
  35502. "ycircle",
  35503. 0x24e8,
  35504. "ycircumflex",
  35505. 0x0177,
  35506. "ydieresis",
  35507. 0x00ff,
  35508. "ydotaccent",
  35509. 0x1e8f,
  35510. "ydotbelow",
  35511. 0x1ef5,
  35512. "yeharabic",
  35513. 0x064a,
  35514. "yehbarreearabic",
  35515. 0x06d2,
  35516. "yehbarreefinalarabic",
  35517. 0xfbaf,
  35518. "yehfinalarabic",
  35519. 0xfef2,
  35520. "yehhamzaabovearabic",
  35521. 0x0626,
  35522. "yehhamzaabovefinalarabic",
  35523. 0xfe8a,
  35524. "yehhamzaaboveinitialarabic",
  35525. 0xfe8b,
  35526. "yehhamzaabovemedialarabic",
  35527. 0xfe8c,
  35528. "yehinitialarabic",
  35529. 0xfef3,
  35530. "yehmedialarabic",
  35531. 0xfef4,
  35532. "yehmeeminitialarabic",
  35533. 0xfcdd,
  35534. "yehmeemisolatedarabic",
  35535. 0xfc58,
  35536. "yehnoonfinalarabic",
  35537. 0xfc94,
  35538. "yehthreedotsbelowarabic",
  35539. 0x06d1,
  35540. "yekorean",
  35541. 0x3156,
  35542. "yen",
  35543. 0x00a5,
  35544. "yenmonospace",
  35545. 0xffe5,
  35546. "yeokorean",
  35547. 0x3155,
  35548. "yeorinhieuhkorean",
  35549. 0x3186,
  35550. "yerahbenyomohebrew",
  35551. 0x05aa,
  35552. "yerahbenyomolefthebrew",
  35553. 0x05aa,
  35554. "yericyrillic",
  35555. 0x044b,
  35556. "yerudieresiscyrillic",
  35557. 0x04f9,
  35558. "yesieungkorean",
  35559. 0x3181,
  35560. "yesieungpansioskorean",
  35561. 0x3183,
  35562. "yesieungsioskorean",
  35563. 0x3182,
  35564. "yetivhebrew",
  35565. 0x059a,
  35566. "ygrave",
  35567. 0x1ef3,
  35568. "yhook",
  35569. 0x01b4,
  35570. "yhookabove",
  35571. 0x1ef7,
  35572. "yiarmenian",
  35573. 0x0575,
  35574. "yicyrillic",
  35575. 0x0457,
  35576. "yikorean",
  35577. 0x3162,
  35578. "yinyang",
  35579. 0x262f,
  35580. "yiwnarmenian",
  35581. 0x0582,
  35582. "ymonospace",
  35583. 0xff59,
  35584. "yod",
  35585. 0x05d9,
  35586. "yoddagesh",
  35587. 0xfb39,
  35588. "yoddageshhebrew",
  35589. 0xfb39,
  35590. "yodhebrew",
  35591. 0x05d9,
  35592. "yodyodhebrew",
  35593. 0x05f2,
  35594. "yodyodpatahhebrew",
  35595. 0xfb1f,
  35596. "yohiragana",
  35597. 0x3088,
  35598. "yoikorean",
  35599. 0x3189,
  35600. "yokatakana",
  35601. 0x30e8,
  35602. "yokatakanahalfwidth",
  35603. 0xff96,
  35604. "yokorean",
  35605. 0x315b,
  35606. "yosmallhiragana",
  35607. 0x3087,
  35608. "yosmallkatakana",
  35609. 0x30e7,
  35610. "yosmallkatakanahalfwidth",
  35611. 0xff6e,
  35612. "yotgreek",
  35613. 0x03f3,
  35614. "yoyaekorean",
  35615. 0x3188,
  35616. "yoyakorean",
  35617. 0x3187,
  35618. "yoyakthai",
  35619. 0x0e22,
  35620. "yoyingthai",
  35621. 0x0e0d,
  35622. "yparen",
  35623. 0x24b4,
  35624. "ypogegrammeni",
  35625. 0x037a,
  35626. "ypogegrammenigreekcmb",
  35627. 0x0345,
  35628. "yr",
  35629. 0x01a6,
  35630. "yring",
  35631. 0x1e99,
  35632. "ysuperior",
  35633. 0x02b8,
  35634. "ytilde",
  35635. 0x1ef9,
  35636. "yturned",
  35637. 0x028e,
  35638. "yuhiragana",
  35639. 0x3086,
  35640. "yuikorean",
  35641. 0x318c,
  35642. "yukatakana",
  35643. 0x30e6,
  35644. "yukatakanahalfwidth",
  35645. 0xff95,
  35646. "yukorean",
  35647. 0x3160,
  35648. "yusbigcyrillic",
  35649. 0x046b,
  35650. "yusbigiotifiedcyrillic",
  35651. 0x046d,
  35652. "yuslittlecyrillic",
  35653. 0x0467,
  35654. "yuslittleiotifiedcyrillic",
  35655. 0x0469,
  35656. "yusmallhiragana",
  35657. 0x3085,
  35658. "yusmallkatakana",
  35659. 0x30e5,
  35660. "yusmallkatakanahalfwidth",
  35661. 0xff6d,
  35662. "yuyekorean",
  35663. 0x318b,
  35664. "yuyeokorean",
  35665. 0x318a,
  35666. "yyabengali",
  35667. 0x09df,
  35668. "yyadeva",
  35669. 0x095f,
  35670. "z",
  35671. 0x007a,
  35672. "zaarmenian",
  35673. 0x0566,
  35674. "zacute",
  35675. 0x017a,
  35676. "zadeva",
  35677. 0x095b,
  35678. "zagurmukhi",
  35679. 0x0a5b,
  35680. "zaharabic",
  35681. 0x0638,
  35682. "zahfinalarabic",
  35683. 0xfec6,
  35684. "zahinitialarabic",
  35685. 0xfec7,
  35686. "zahiragana",
  35687. 0x3056,
  35688. "zahmedialarabic",
  35689. 0xfec8,
  35690. "zainarabic",
  35691. 0x0632,
  35692. "zainfinalarabic",
  35693. 0xfeb0,
  35694. "zakatakana",
  35695. 0x30b6,
  35696. "zaqefgadolhebrew",
  35697. 0x0595,
  35698. "zaqefqatanhebrew",
  35699. 0x0594,
  35700. "zarqahebrew",
  35701. 0x0598,
  35702. "zayin",
  35703. 0x05d6,
  35704. "zayindagesh",
  35705. 0xfb36,
  35706. "zayindageshhebrew",
  35707. 0xfb36,
  35708. "zayinhebrew",
  35709. 0x05d6,
  35710. "zbopomofo",
  35711. 0x3117,
  35712. "zcaron",
  35713. 0x017e,
  35714. "zcircle",
  35715. 0x24e9,
  35716. "zcircumflex",
  35717. 0x1e91,
  35718. "zcurl",
  35719. 0x0291,
  35720. "zdot",
  35721. 0x017c,
  35722. "zdotaccent",
  35723. 0x017c,
  35724. "zdotbelow",
  35725. 0x1e93,
  35726. "zecyrillic",
  35727. 0x0437,
  35728. "zedescendercyrillic",
  35729. 0x0499,
  35730. "zedieresiscyrillic",
  35731. 0x04df,
  35732. "zehiragana",
  35733. 0x305c,
  35734. "zekatakana",
  35735. 0x30bc,
  35736. "zero",
  35737. 0x0030,
  35738. "zeroarabic",
  35739. 0x0660,
  35740. "zerobengali",
  35741. 0x09e6,
  35742. "zerodeva",
  35743. 0x0966,
  35744. "zerogujarati",
  35745. 0x0ae6,
  35746. "zerogurmukhi",
  35747. 0x0a66,
  35748. "zerohackarabic",
  35749. 0x0660,
  35750. "zeroinferior",
  35751. 0x2080,
  35752. "zeromonospace",
  35753. 0xff10,
  35754. "zerooldstyle",
  35755. 0xf730,
  35756. "zeropersian",
  35757. 0x06f0,
  35758. "zerosuperior",
  35759. 0x2070,
  35760. "zerothai",
  35761. 0x0e50,
  35762. "zerowidthjoiner",
  35763. 0xfeff,
  35764. "zerowidthnonjoiner",
  35765. 0x200c,
  35766. "zerowidthspace",
  35767. 0x200b,
  35768. "zeta",
  35769. 0x03b6,
  35770. "zhbopomofo",
  35771. 0x3113,
  35772. "zhearmenian",
  35773. 0x056a,
  35774. "zhebrevecyrillic",
  35775. 0x04c2,
  35776. "zhecyrillic",
  35777. 0x0436,
  35778. "zhedescendercyrillic",
  35779. 0x0497,
  35780. "zhedieresiscyrillic",
  35781. 0x04dd,
  35782. "zihiragana",
  35783. 0x3058,
  35784. "zikatakana",
  35785. 0x30b8,
  35786. "zinorhebrew",
  35787. 0x05ae,
  35788. "zlinebelow",
  35789. 0x1e95,
  35790. "zmonospace",
  35791. 0xff5a,
  35792. "zohiragana",
  35793. 0x305e,
  35794. "zokatakana",
  35795. 0x30be,
  35796. "zparen",
  35797. 0x24b5,
  35798. "zretroflexhook",
  35799. 0x0290,
  35800. "zstroke",
  35801. 0x01b6,
  35802. "zuhiragana",
  35803. 0x305a,
  35804. "zukatakana",
  35805. 0x30ba,
  35806. ".notdef",
  35807. 0x0000,
  35808. "angbracketleftbig",
  35809. 0x2329,
  35810. "angbracketleftBig",
  35811. 0x2329,
  35812. "angbracketleftbigg",
  35813. 0x2329,
  35814. "angbracketleftBigg",
  35815. 0x2329,
  35816. "angbracketrightBig",
  35817. 0x232a,
  35818. "angbracketrightbig",
  35819. 0x232a,
  35820. "angbracketrightBigg",
  35821. 0x232a,
  35822. "angbracketrightbigg",
  35823. 0x232a,
  35824. "arrowhookleft",
  35825. 0x21aa,
  35826. "arrowhookright",
  35827. 0x21a9,
  35828. "arrowlefttophalf",
  35829. 0x21bc,
  35830. "arrowleftbothalf",
  35831. 0x21bd,
  35832. "arrownortheast",
  35833. 0x2197,
  35834. "arrownorthwest",
  35835. 0x2196,
  35836. "arrowrighttophalf",
  35837. 0x21c0,
  35838. "arrowrightbothalf",
  35839. 0x21c1,
  35840. "arrowsoutheast",
  35841. 0x2198,
  35842. "arrowsouthwest",
  35843. 0x2199,
  35844. "backslashbig",
  35845. 0x2216,
  35846. "backslashBig",
  35847. 0x2216,
  35848. "backslashBigg",
  35849. 0x2216,
  35850. "backslashbigg",
  35851. 0x2216,
  35852. "bardbl",
  35853. 0x2016,
  35854. "bracehtipdownleft",
  35855. 0xfe37,
  35856. "bracehtipdownright",
  35857. 0xfe37,
  35858. "bracehtipupleft",
  35859. 0xfe38,
  35860. "bracehtipupright",
  35861. 0xfe38,
  35862. "braceleftBig",
  35863. 0x007b,
  35864. "braceleftbig",
  35865. 0x007b,
  35866. "braceleftbigg",
  35867. 0x007b,
  35868. "braceleftBigg",
  35869. 0x007b,
  35870. "bracerightBig",
  35871. 0x007d,
  35872. "bracerightbig",
  35873. 0x007d,
  35874. "bracerightbigg",
  35875. 0x007d,
  35876. "bracerightBigg",
  35877. 0x007d,
  35878. "bracketleftbig",
  35879. 0x005b,
  35880. "bracketleftBig",
  35881. 0x005b,
  35882. "bracketleftbigg",
  35883. 0x005b,
  35884. "bracketleftBigg",
  35885. 0x005b,
  35886. "bracketrightBig",
  35887. 0x005d,
  35888. "bracketrightbig",
  35889. 0x005d,
  35890. "bracketrightbigg",
  35891. 0x005d,
  35892. "bracketrightBigg",
  35893. 0x005d,
  35894. "ceilingleftbig",
  35895. 0x2308,
  35896. "ceilingleftBig",
  35897. 0x2308,
  35898. "ceilingleftBigg",
  35899. 0x2308,
  35900. "ceilingleftbigg",
  35901. 0x2308,
  35902. "ceilingrightbig",
  35903. 0x2309,
  35904. "ceilingrightBig",
  35905. 0x2309,
  35906. "ceilingrightbigg",
  35907. 0x2309,
  35908. "ceilingrightBigg",
  35909. 0x2309,
  35910. "circledotdisplay",
  35911. 0x2299,
  35912. "circledottext",
  35913. 0x2299,
  35914. "circlemultiplydisplay",
  35915. 0x2297,
  35916. "circlemultiplytext",
  35917. 0x2297,
  35918. "circleplusdisplay",
  35919. 0x2295,
  35920. "circleplustext",
  35921. 0x2295,
  35922. "contintegraldisplay",
  35923. 0x222e,
  35924. "contintegraltext",
  35925. 0x222e,
  35926. "coproductdisplay",
  35927. 0x2210,
  35928. "coproducttext",
  35929. 0x2210,
  35930. "floorleftBig",
  35931. 0x230a,
  35932. "floorleftbig",
  35933. 0x230a,
  35934. "floorleftbigg",
  35935. 0x230a,
  35936. "floorleftBigg",
  35937. 0x230a,
  35938. "floorrightbig",
  35939. 0x230b,
  35940. "floorrightBig",
  35941. 0x230b,
  35942. "floorrightBigg",
  35943. 0x230b,
  35944. "floorrightbigg",
  35945. 0x230b,
  35946. "hatwide",
  35947. 0x0302,
  35948. "hatwider",
  35949. 0x0302,
  35950. "hatwidest",
  35951. 0x0302,
  35952. "intercal",
  35953. 0x1d40,
  35954. "integraldisplay",
  35955. 0x222b,
  35956. "integraltext",
  35957. 0x222b,
  35958. "intersectiondisplay",
  35959. 0x22c2,
  35960. "intersectiontext",
  35961. 0x22c2,
  35962. "logicalanddisplay",
  35963. 0x2227,
  35964. "logicalandtext",
  35965. 0x2227,
  35966. "logicalordisplay",
  35967. 0x2228,
  35968. "logicalortext",
  35969. 0x2228,
  35970. "parenleftBig",
  35971. 0x0028,
  35972. "parenleftbig",
  35973. 0x0028,
  35974. "parenleftBigg",
  35975. 0x0028,
  35976. "parenleftbigg",
  35977. 0x0028,
  35978. "parenrightBig",
  35979. 0x0029,
  35980. "parenrightbig",
  35981. 0x0029,
  35982. "parenrightBigg",
  35983. 0x0029,
  35984. "parenrightbigg",
  35985. 0x0029,
  35986. "prime",
  35987. 0x2032,
  35988. "productdisplay",
  35989. 0x220f,
  35990. "producttext",
  35991. 0x220f,
  35992. "radicalbig",
  35993. 0x221a,
  35994. "radicalBig",
  35995. 0x221a,
  35996. "radicalBigg",
  35997. 0x221a,
  35998. "radicalbigg",
  35999. 0x221a,
  36000. "radicalbt",
  36001. 0x221a,
  36002. "radicaltp",
  36003. 0x221a,
  36004. "radicalvertex",
  36005. 0x221a,
  36006. "slashbig",
  36007. 0x002f,
  36008. "slashBig",
  36009. 0x002f,
  36010. "slashBigg",
  36011. 0x002f,
  36012. "slashbigg",
  36013. 0x002f,
  36014. "summationdisplay",
  36015. 0x2211,
  36016. "summationtext",
  36017. 0x2211,
  36018. "tildewide",
  36019. 0x02dc,
  36020. "tildewider",
  36021. 0x02dc,
  36022. "tildewidest",
  36023. 0x02dc,
  36024. "uniondisplay",
  36025. 0x22c3,
  36026. "unionmultidisplay",
  36027. 0x228e,
  36028. "unionmultitext",
  36029. 0x228e,
  36030. "unionsqdisplay",
  36031. 0x2294,
  36032. "unionsqtext",
  36033. 0x2294,
  36034. "uniontext",
  36035. 0x22c3,
  36036. "vextenddouble",
  36037. 0x2225,
  36038. "vextendsingle",
  36039. 0x2223
  36040. ];
  36041. });
  36042. const getDingbatsGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  36043. return [
  36044. "space",
  36045. 0x0020,
  36046. "a1",
  36047. 0x2701,
  36048. "a2",
  36049. 0x2702,
  36050. "a202",
  36051. 0x2703,
  36052. "a3",
  36053. 0x2704,
  36054. "a4",
  36055. 0x260e,
  36056. "a5",
  36057. 0x2706,
  36058. "a119",
  36059. 0x2707,
  36060. "a118",
  36061. 0x2708,
  36062. "a117",
  36063. 0x2709,
  36064. "a11",
  36065. 0x261b,
  36066. "a12",
  36067. 0x261e,
  36068. "a13",
  36069. 0x270c,
  36070. "a14",
  36071. 0x270d,
  36072. "a15",
  36073. 0x270e,
  36074. "a16",
  36075. 0x270f,
  36076. "a105",
  36077. 0x2710,
  36078. "a17",
  36079. 0x2711,
  36080. "a18",
  36081. 0x2712,
  36082. "a19",
  36083. 0x2713,
  36084. "a20",
  36085. 0x2714,
  36086. "a21",
  36087. 0x2715,
  36088. "a22",
  36089. 0x2716,
  36090. "a23",
  36091. 0x2717,
  36092. "a24",
  36093. 0x2718,
  36094. "a25",
  36095. 0x2719,
  36096. "a26",
  36097. 0x271a,
  36098. "a27",
  36099. 0x271b,
  36100. "a28",
  36101. 0x271c,
  36102. "a6",
  36103. 0x271d,
  36104. "a7",
  36105. 0x271e,
  36106. "a8",
  36107. 0x271f,
  36108. "a9",
  36109. 0x2720,
  36110. "a10",
  36111. 0x2721,
  36112. "a29",
  36113. 0x2722,
  36114. "a30",
  36115. 0x2723,
  36116. "a31",
  36117. 0x2724,
  36118. "a32",
  36119. 0x2725,
  36120. "a33",
  36121. 0x2726,
  36122. "a34",
  36123. 0x2727,
  36124. "a35",
  36125. 0x2605,
  36126. "a36",
  36127. 0x2729,
  36128. "a37",
  36129. 0x272a,
  36130. "a38",
  36131. 0x272b,
  36132. "a39",
  36133. 0x272c,
  36134. "a40",
  36135. 0x272d,
  36136. "a41",
  36137. 0x272e,
  36138. "a42",
  36139. 0x272f,
  36140. "a43",
  36141. 0x2730,
  36142. "a44",
  36143. 0x2731,
  36144. "a45",
  36145. 0x2732,
  36146. "a46",
  36147. 0x2733,
  36148. "a47",
  36149. 0x2734,
  36150. "a48",
  36151. 0x2735,
  36152. "a49",
  36153. 0x2736,
  36154. "a50",
  36155. 0x2737,
  36156. "a51",
  36157. 0x2738,
  36158. "a52",
  36159. 0x2739,
  36160. "a53",
  36161. 0x273a,
  36162. "a54",
  36163. 0x273b,
  36164. "a55",
  36165. 0x273c,
  36166. "a56",
  36167. 0x273d,
  36168. "a57",
  36169. 0x273e,
  36170. "a58",
  36171. 0x273f,
  36172. "a59",
  36173. 0x2740,
  36174. "a60",
  36175. 0x2741,
  36176. "a61",
  36177. 0x2742,
  36178. "a62",
  36179. 0x2743,
  36180. "a63",
  36181. 0x2744,
  36182. "a64",
  36183. 0x2745,
  36184. "a65",
  36185. 0x2746,
  36186. "a66",
  36187. 0x2747,
  36188. "a67",
  36189. 0x2748,
  36190. "a68",
  36191. 0x2749,
  36192. "a69",
  36193. 0x274a,
  36194. "a70",
  36195. 0x274b,
  36196. "a71",
  36197. 0x25cf,
  36198. "a72",
  36199. 0x274d,
  36200. "a73",
  36201. 0x25a0,
  36202. "a74",
  36203. 0x274f,
  36204. "a203",
  36205. 0x2750,
  36206. "a75",
  36207. 0x2751,
  36208. "a204",
  36209. 0x2752,
  36210. "a76",
  36211. 0x25b2,
  36212. "a77",
  36213. 0x25bc,
  36214. "a78",
  36215. 0x25c6,
  36216. "a79",
  36217. 0x2756,
  36218. "a81",
  36219. 0x25d7,
  36220. "a82",
  36221. 0x2758,
  36222. "a83",
  36223. 0x2759,
  36224. "a84",
  36225. 0x275a,
  36226. "a97",
  36227. 0x275b,
  36228. "a98",
  36229. 0x275c,
  36230. "a99",
  36231. 0x275d,
  36232. "a100",
  36233. 0x275e,
  36234. "a101",
  36235. 0x2761,
  36236. "a102",
  36237. 0x2762,
  36238. "a103",
  36239. 0x2763,
  36240. "a104",
  36241. 0x2764,
  36242. "a106",
  36243. 0x2765,
  36244. "a107",
  36245. 0x2766,
  36246. "a108",
  36247. 0x2767,
  36248. "a112",
  36249. 0x2663,
  36250. "a111",
  36251. 0x2666,
  36252. "a110",
  36253. 0x2665,
  36254. "a109",
  36255. 0x2660,
  36256. "a120",
  36257. 0x2460,
  36258. "a121",
  36259. 0x2461,
  36260. "a122",
  36261. 0x2462,
  36262. "a123",
  36263. 0x2463,
  36264. "a124",
  36265. 0x2464,
  36266. "a125",
  36267. 0x2465,
  36268. "a126",
  36269. 0x2466,
  36270. "a127",
  36271. 0x2467,
  36272. "a128",
  36273. 0x2468,
  36274. "a129",
  36275. 0x2469,
  36276. "a130",
  36277. 0x2776,
  36278. "a131",
  36279. 0x2777,
  36280. "a132",
  36281. 0x2778,
  36282. "a133",
  36283. 0x2779,
  36284. "a134",
  36285. 0x277a,
  36286. "a135",
  36287. 0x277b,
  36288. "a136",
  36289. 0x277c,
  36290. "a137",
  36291. 0x277d,
  36292. "a138",
  36293. 0x277e,
  36294. "a139",
  36295. 0x277f,
  36296. "a140",
  36297. 0x2780,
  36298. "a141",
  36299. 0x2781,
  36300. "a142",
  36301. 0x2782,
  36302. "a143",
  36303. 0x2783,
  36304. "a144",
  36305. 0x2784,
  36306. "a145",
  36307. 0x2785,
  36308. "a146",
  36309. 0x2786,
  36310. "a147",
  36311. 0x2787,
  36312. "a148",
  36313. 0x2788,
  36314. "a149",
  36315. 0x2789,
  36316. "a150",
  36317. 0x278a,
  36318. "a151",
  36319. 0x278b,
  36320. "a152",
  36321. 0x278c,
  36322. "a153",
  36323. 0x278d,
  36324. "a154",
  36325. 0x278e,
  36326. "a155",
  36327. 0x278f,
  36328. "a156",
  36329. 0x2790,
  36330. "a157",
  36331. 0x2791,
  36332. "a158",
  36333. 0x2792,
  36334. "a159",
  36335. 0x2793,
  36336. "a160",
  36337. 0x2794,
  36338. "a161",
  36339. 0x2192,
  36340. "a163",
  36341. 0x2194,
  36342. "a164",
  36343. 0x2195,
  36344. "a196",
  36345. 0x2798,
  36346. "a165",
  36347. 0x2799,
  36348. "a192",
  36349. 0x279a,
  36350. "a166",
  36351. 0x279b,
  36352. "a167",
  36353. 0x279c,
  36354. "a168",
  36355. 0x279d,
  36356. "a169",
  36357. 0x279e,
  36358. "a170",
  36359. 0x279f,
  36360. "a171",
  36361. 0x27a0,
  36362. "a172",
  36363. 0x27a1,
  36364. "a173",
  36365. 0x27a2,
  36366. "a162",
  36367. 0x27a3,
  36368. "a174",
  36369. 0x27a4,
  36370. "a175",
  36371. 0x27a5,
  36372. "a176",
  36373. 0x27a6,
  36374. "a177",
  36375. 0x27a7,
  36376. "a178",
  36377. 0x27a8,
  36378. "a179",
  36379. 0x27a9,
  36380. "a193",
  36381. 0x27aa,
  36382. "a180",
  36383. 0x27ab,
  36384. "a199",
  36385. 0x27ac,
  36386. "a181",
  36387. 0x27ad,
  36388. "a200",
  36389. 0x27ae,
  36390. "a182",
  36391. 0x27af,
  36392. "a201",
  36393. 0x27b1,
  36394. "a183",
  36395. 0x27b2,
  36396. "a184",
  36397. 0x27b3,
  36398. "a197",
  36399. 0x27b4,
  36400. "a185",
  36401. 0x27b5,
  36402. "a194",
  36403. 0x27b6,
  36404. "a198",
  36405. 0x27b7,
  36406. "a186",
  36407. 0x27b8,
  36408. "a195",
  36409. 0x27b9,
  36410. "a187",
  36411. 0x27ba,
  36412. "a188",
  36413. 0x27bb,
  36414. "a189",
  36415. 0x27bc,
  36416. "a190",
  36417. 0x27bd,
  36418. "a191",
  36419. 0x27be,
  36420. "a89",
  36421. 0x2768,
  36422. "a90",
  36423. 0x2769,
  36424. "a93",
  36425. 0x276a,
  36426. "a94",
  36427. 0x276b,
  36428. "a91",
  36429. 0x276c,
  36430. "a92",
  36431. 0x276d,
  36432. "a205",
  36433. 0x276e,
  36434. "a85",
  36435. 0x276f,
  36436. "a206",
  36437. 0x2770,
  36438. "a86",
  36439. 0x2771,
  36440. "a87",
  36441. 0x2772,
  36442. "a88",
  36443. 0x2773,
  36444. "a95",
  36445. 0x2774,
  36446. "a96",
  36447. 0x2775,
  36448. ".notdef",
  36449. 0x0000
  36450. ];
  36451. });
  36452. /***/ }),
  36453. /* 165 */
  36454. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  36455. "use strict";
  36456. __w_pdfjs_require__.r(__webpack_exports__);
  36457. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  36458. /* harmony export */ "clearUnicodeCaches": () => (/* binding */ clearUnicodeCaches),
  36459. /* harmony export */ "getCharUnicodeCategory": () => (/* binding */ getCharUnicodeCategory),
  36460. /* harmony export */ "getNormalizedUnicodes": () => (/* binding */ getNormalizedUnicodes),
  36461. /* harmony export */ "getUnicodeForGlyph": () => (/* binding */ getUnicodeForGlyph),
  36462. /* harmony export */ "getUnicodeRangeFor": () => (/* binding */ getUnicodeRangeFor),
  36463. /* harmony export */ "mapSpecialUnicodeValues": () => (/* binding */ mapSpecialUnicodeValues),
  36464. /* harmony export */ "reverseIfRtl": () => (/* binding */ reverseIfRtl)
  36465. /* harmony export */ });
  36466. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(131);
  36467. const getSpecialPUASymbols = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getLookupTableFactory)(function (t) {
  36468. t[63721] = 0x00a9;
  36469. t[63193] = 0x00a9;
  36470. t[63720] = 0x00ae;
  36471. t[63194] = 0x00ae;
  36472. t[63722] = 0x2122;
  36473. t[63195] = 0x2122;
  36474. t[63729] = 0x23a7;
  36475. t[63730] = 0x23a8;
  36476. t[63731] = 0x23a9;
  36477. t[63740] = 0x23ab;
  36478. t[63741] = 0x23ac;
  36479. t[63742] = 0x23ad;
  36480. t[63726] = 0x23a1;
  36481. t[63727] = 0x23a2;
  36482. t[63728] = 0x23a3;
  36483. t[63737] = 0x23a4;
  36484. t[63738] = 0x23a5;
  36485. t[63739] = 0x23a6;
  36486. t[63723] = 0x239b;
  36487. t[63724] = 0x239c;
  36488. t[63725] = 0x239d;
  36489. t[63734] = 0x239e;
  36490. t[63735] = 0x239f;
  36491. t[63736] = 0x23a0;
  36492. });
  36493. function mapSpecialUnicodeValues(code) {
  36494. if (code >= 0xfff0 && code <= 0xffff) {
  36495. return 0;
  36496. } else if (code >= 0xf600 && code <= 0xf8ff) {
  36497. return getSpecialPUASymbols()[code] || code;
  36498. } else if (code === 0x00ad) {
  36499. return 0x002d;
  36500. }
  36501. return code;
  36502. }
  36503. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  36504. let unicode = glyphsUnicodeMap[name];
  36505. if (unicode !== undefined) {
  36506. return unicode;
  36507. }
  36508. if (!name) {
  36509. return -1;
  36510. }
  36511. if (name[0] === "u") {
  36512. const nameLen = name.length;
  36513. let hexStr;
  36514. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  36515. hexStr = name.substring(3);
  36516. } else if (nameLen >= 5 && nameLen <= 7) {
  36517. hexStr = name.substring(1);
  36518. } else {
  36519. return -1;
  36520. }
  36521. if (hexStr === hexStr.toUpperCase()) {
  36522. unicode = parseInt(hexStr, 16);
  36523. if (unicode >= 0) {
  36524. return unicode;
  36525. }
  36526. }
  36527. }
  36528. return -1;
  36529. }
  36530. const UnicodeRanges = [
  36531. {
  36532. begin: 0x0000,
  36533. end: 0x007f
  36534. },
  36535. {
  36536. begin: 0x0080,
  36537. end: 0x00ff
  36538. },
  36539. {
  36540. begin: 0x0100,
  36541. end: 0x017f
  36542. },
  36543. {
  36544. begin: 0x0180,
  36545. end: 0x024f
  36546. },
  36547. {
  36548. begin: 0x0250,
  36549. end: 0x02af
  36550. },
  36551. {
  36552. begin: 0x02b0,
  36553. end: 0x02ff
  36554. },
  36555. {
  36556. begin: 0x0300,
  36557. end: 0x036f
  36558. },
  36559. {
  36560. begin: 0x0370,
  36561. end: 0x03ff
  36562. },
  36563. {
  36564. begin: 0x2c80,
  36565. end: 0x2cff
  36566. },
  36567. {
  36568. begin: 0x0400,
  36569. end: 0x04ff
  36570. },
  36571. {
  36572. begin: 0x0530,
  36573. end: 0x058f
  36574. },
  36575. {
  36576. begin: 0x0590,
  36577. end: 0x05ff
  36578. },
  36579. {
  36580. begin: 0xa500,
  36581. end: 0xa63f
  36582. },
  36583. {
  36584. begin: 0x0600,
  36585. end: 0x06ff
  36586. },
  36587. {
  36588. begin: 0x07c0,
  36589. end: 0x07ff
  36590. },
  36591. {
  36592. begin: 0x0900,
  36593. end: 0x097f
  36594. },
  36595. {
  36596. begin: 0x0980,
  36597. end: 0x09ff
  36598. },
  36599. {
  36600. begin: 0x0a00,
  36601. end: 0x0a7f
  36602. },
  36603. {
  36604. begin: 0x0a80,
  36605. end: 0x0aff
  36606. },
  36607. {
  36608. begin: 0x0b00,
  36609. end: 0x0b7f
  36610. },
  36611. {
  36612. begin: 0x0b80,
  36613. end: 0x0bff
  36614. },
  36615. {
  36616. begin: 0x0c00,
  36617. end: 0x0c7f
  36618. },
  36619. {
  36620. begin: 0x0c80,
  36621. end: 0x0cff
  36622. },
  36623. {
  36624. begin: 0x0d00,
  36625. end: 0x0d7f
  36626. },
  36627. {
  36628. begin: 0x0e00,
  36629. end: 0x0e7f
  36630. },
  36631. {
  36632. begin: 0x0e80,
  36633. end: 0x0eff
  36634. },
  36635. {
  36636. begin: 0x10a0,
  36637. end: 0x10ff
  36638. },
  36639. {
  36640. begin: 0x1b00,
  36641. end: 0x1b7f
  36642. },
  36643. {
  36644. begin: 0x1100,
  36645. end: 0x11ff
  36646. },
  36647. {
  36648. begin: 0x1e00,
  36649. end: 0x1eff
  36650. },
  36651. {
  36652. begin: 0x1f00,
  36653. end: 0x1fff
  36654. },
  36655. {
  36656. begin: 0x2000,
  36657. end: 0x206f
  36658. },
  36659. {
  36660. begin: 0x2070,
  36661. end: 0x209f
  36662. },
  36663. {
  36664. begin: 0x20a0,
  36665. end: 0x20cf
  36666. },
  36667. {
  36668. begin: 0x20d0,
  36669. end: 0x20ff
  36670. },
  36671. {
  36672. begin: 0x2100,
  36673. end: 0x214f
  36674. },
  36675. {
  36676. begin: 0x2150,
  36677. end: 0x218f
  36678. },
  36679. {
  36680. begin: 0x2190,
  36681. end: 0x21ff
  36682. },
  36683. {
  36684. begin: 0x2200,
  36685. end: 0x22ff
  36686. },
  36687. {
  36688. begin: 0x2300,
  36689. end: 0x23ff
  36690. },
  36691. {
  36692. begin: 0x2400,
  36693. end: 0x243f
  36694. },
  36695. {
  36696. begin: 0x2440,
  36697. end: 0x245f
  36698. },
  36699. {
  36700. begin: 0x2460,
  36701. end: 0x24ff
  36702. },
  36703. {
  36704. begin: 0x2500,
  36705. end: 0x257f
  36706. },
  36707. {
  36708. begin: 0x2580,
  36709. end: 0x259f
  36710. },
  36711. {
  36712. begin: 0x25a0,
  36713. end: 0x25ff
  36714. },
  36715. {
  36716. begin: 0x2600,
  36717. end: 0x26ff
  36718. },
  36719. {
  36720. begin: 0x2700,
  36721. end: 0x27bf
  36722. },
  36723. {
  36724. begin: 0x3000,
  36725. end: 0x303f
  36726. },
  36727. {
  36728. begin: 0x3040,
  36729. end: 0x309f
  36730. },
  36731. {
  36732. begin: 0x30a0,
  36733. end: 0x30ff
  36734. },
  36735. {
  36736. begin: 0x3100,
  36737. end: 0x312f
  36738. },
  36739. {
  36740. begin: 0x3130,
  36741. end: 0x318f
  36742. },
  36743. {
  36744. begin: 0xa840,
  36745. end: 0xa87f
  36746. },
  36747. {
  36748. begin: 0x3200,
  36749. end: 0x32ff
  36750. },
  36751. {
  36752. begin: 0x3300,
  36753. end: 0x33ff
  36754. },
  36755. {
  36756. begin: 0xac00,
  36757. end: 0xd7af
  36758. },
  36759. {
  36760. begin: 0xd800,
  36761. end: 0xdfff
  36762. },
  36763. {
  36764. begin: 0x10900,
  36765. end: 0x1091f
  36766. },
  36767. {
  36768. begin: 0x4e00,
  36769. end: 0x9fff
  36770. },
  36771. {
  36772. begin: 0xe000,
  36773. end: 0xf8ff
  36774. },
  36775. {
  36776. begin: 0x31c0,
  36777. end: 0x31ef
  36778. },
  36779. {
  36780. begin: 0xfb00,
  36781. end: 0xfb4f
  36782. },
  36783. {
  36784. begin: 0xfb50,
  36785. end: 0xfdff
  36786. },
  36787. {
  36788. begin: 0xfe20,
  36789. end: 0xfe2f
  36790. },
  36791. {
  36792. begin: 0xfe10,
  36793. end: 0xfe1f
  36794. },
  36795. {
  36796. begin: 0xfe50,
  36797. end: 0xfe6f
  36798. },
  36799. {
  36800. begin: 0xfe70,
  36801. end: 0xfeff
  36802. },
  36803. {
  36804. begin: 0xff00,
  36805. end: 0xffef
  36806. },
  36807. {
  36808. begin: 0xfff0,
  36809. end: 0xffff
  36810. },
  36811. {
  36812. begin: 0x0f00,
  36813. end: 0x0fff
  36814. },
  36815. {
  36816. begin: 0x0700,
  36817. end: 0x074f
  36818. },
  36819. {
  36820. begin: 0x0780,
  36821. end: 0x07bf
  36822. },
  36823. {
  36824. begin: 0x0d80,
  36825. end: 0x0dff
  36826. },
  36827. {
  36828. begin: 0x1000,
  36829. end: 0x109f
  36830. },
  36831. {
  36832. begin: 0x1200,
  36833. end: 0x137f
  36834. },
  36835. {
  36836. begin: 0x13a0,
  36837. end: 0x13ff
  36838. },
  36839. {
  36840. begin: 0x1400,
  36841. end: 0x167f
  36842. },
  36843. {
  36844. begin: 0x1680,
  36845. end: 0x169f
  36846. },
  36847. {
  36848. begin: 0x16a0,
  36849. end: 0x16ff
  36850. },
  36851. {
  36852. begin: 0x1780,
  36853. end: 0x17ff
  36854. },
  36855. {
  36856. begin: 0x1800,
  36857. end: 0x18af
  36858. },
  36859. {
  36860. begin: 0x2800,
  36861. end: 0x28ff
  36862. },
  36863. {
  36864. begin: 0xa000,
  36865. end: 0xa48f
  36866. },
  36867. {
  36868. begin: 0x1700,
  36869. end: 0x171f
  36870. },
  36871. {
  36872. begin: 0x10300,
  36873. end: 0x1032f
  36874. },
  36875. {
  36876. begin: 0x10330,
  36877. end: 0x1034f
  36878. },
  36879. {
  36880. begin: 0x10400,
  36881. end: 0x1044f
  36882. },
  36883. {
  36884. begin: 0x1d000,
  36885. end: 0x1d0ff
  36886. },
  36887. {
  36888. begin: 0x1d400,
  36889. end: 0x1d7ff
  36890. },
  36891. {
  36892. begin: 0xff000,
  36893. end: 0xffffd
  36894. },
  36895. {
  36896. begin: 0xfe00,
  36897. end: 0xfe0f
  36898. },
  36899. {
  36900. begin: 0xe0000,
  36901. end: 0xe007f
  36902. },
  36903. {
  36904. begin: 0x1900,
  36905. end: 0x194f
  36906. },
  36907. {
  36908. begin: 0x1950,
  36909. end: 0x197f
  36910. },
  36911. {
  36912. begin: 0x1980,
  36913. end: 0x19df
  36914. },
  36915. {
  36916. begin: 0x1a00,
  36917. end: 0x1a1f
  36918. },
  36919. {
  36920. begin: 0x2c00,
  36921. end: 0x2c5f
  36922. },
  36923. {
  36924. begin: 0x2d30,
  36925. end: 0x2d7f
  36926. },
  36927. {
  36928. begin: 0x4dc0,
  36929. end: 0x4dff
  36930. },
  36931. {
  36932. begin: 0xa800,
  36933. end: 0xa82f
  36934. },
  36935. {
  36936. begin: 0x10000,
  36937. end: 0x1007f
  36938. },
  36939. {
  36940. begin: 0x10140,
  36941. end: 0x1018f
  36942. },
  36943. {
  36944. begin: 0x10380,
  36945. end: 0x1039f
  36946. },
  36947. {
  36948. begin: 0x103a0,
  36949. end: 0x103df
  36950. },
  36951. {
  36952. begin: 0x10450,
  36953. end: 0x1047f
  36954. },
  36955. {
  36956. begin: 0x10480,
  36957. end: 0x104af
  36958. },
  36959. {
  36960. begin: 0x10800,
  36961. end: 0x1083f
  36962. },
  36963. {
  36964. begin: 0x10a00,
  36965. end: 0x10a5f
  36966. },
  36967. {
  36968. begin: 0x1d300,
  36969. end: 0x1d35f
  36970. },
  36971. {
  36972. begin: 0x12000,
  36973. end: 0x123ff
  36974. },
  36975. {
  36976. begin: 0x1d360,
  36977. end: 0x1d37f
  36978. },
  36979. {
  36980. begin: 0x1b80,
  36981. end: 0x1bbf
  36982. },
  36983. {
  36984. begin: 0x1c00,
  36985. end: 0x1c4f
  36986. },
  36987. {
  36988. begin: 0x1c50,
  36989. end: 0x1c7f
  36990. },
  36991. {
  36992. begin: 0xa880,
  36993. end: 0xa8df
  36994. },
  36995. {
  36996. begin: 0xa900,
  36997. end: 0xa92f
  36998. },
  36999. {
  37000. begin: 0xa930,
  37001. end: 0xa95f
  37002. },
  37003. {
  37004. begin: 0xaa00,
  37005. end: 0xaa5f
  37006. },
  37007. {
  37008. begin: 0x10190,
  37009. end: 0x101cf
  37010. },
  37011. {
  37012. begin: 0x101d0,
  37013. end: 0x101ff
  37014. },
  37015. {
  37016. begin: 0x102a0,
  37017. end: 0x102df
  37018. },
  37019. {
  37020. begin: 0x1f030,
  37021. end: 0x1f09f
  37022. }
  37023. ];
  37024. function getUnicodeRangeFor(value) {
  37025. for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  37026. const range = UnicodeRanges[i];
  37027. if (value >= range.begin && value < range.end) {
  37028. return i;
  37029. }
  37030. }
  37031. return -1;
  37032. }
  37033. function isRTLRangeFor(value) {
  37034. let range = UnicodeRanges[13];
  37035. if (value >= range.begin && value < range.end) {
  37036. return true;
  37037. }
  37038. range = UnicodeRanges[11];
  37039. if (value >= range.begin && value < range.end) {
  37040. return true;
  37041. }
  37042. return false;
  37043. }
  37044. const getNormalizedUnicodes = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  37045. return [
  37046. "\u00A8",
  37047. "\u0020\u0308",
  37048. "\u00AF",
  37049. "\u0020\u0304",
  37050. "\u00B4",
  37051. "\u0020\u0301",
  37052. "\u00B5",
  37053. "\u03BC",
  37054. "\u00B8",
  37055. "\u0020\u0327",
  37056. "\u0132",
  37057. "\u0049\u004A",
  37058. "\u0133",
  37059. "\u0069\u006A",
  37060. "\u013F",
  37061. "\u004C\u00B7",
  37062. "\u0140",
  37063. "\u006C\u00B7",
  37064. "\u0149",
  37065. "\u02BC\u006E",
  37066. "\u017F",
  37067. "\u0073",
  37068. "\u01C4",
  37069. "\u0044\u017D",
  37070. "\u01C5",
  37071. "\u0044\u017E",
  37072. "\u01C6",
  37073. "\u0064\u017E",
  37074. "\u01C7",
  37075. "\u004C\u004A",
  37076. "\u01C8",
  37077. "\u004C\u006A",
  37078. "\u01C9",
  37079. "\u006C\u006A",
  37080. "\u01CA",
  37081. "\u004E\u004A",
  37082. "\u01CB",
  37083. "\u004E\u006A",
  37084. "\u01CC",
  37085. "\u006E\u006A",
  37086. "\u01F1",
  37087. "\u0044\u005A",
  37088. "\u01F2",
  37089. "\u0044\u007A",
  37090. "\u01F3",
  37091. "\u0064\u007A",
  37092. "\u02D8",
  37093. "\u0020\u0306",
  37094. "\u02D9",
  37095. "\u0020\u0307",
  37096. "\u02DA",
  37097. "\u0020\u030A",
  37098. "\u02DB",
  37099. "\u0020\u0328",
  37100. "\u02DC",
  37101. "\u0020\u0303",
  37102. "\u02DD",
  37103. "\u0020\u030B",
  37104. "\u037A",
  37105. "\u0020\u0345",
  37106. "\u0384",
  37107. "\u0020\u0301",
  37108. "\u03D0",
  37109. "\u03B2",
  37110. "\u03D1",
  37111. "\u03B8",
  37112. "\u03D2",
  37113. "\u03A5",
  37114. "\u03D5",
  37115. "\u03C6",
  37116. "\u03D6",
  37117. "\u03C0",
  37118. "\u03F0",
  37119. "\u03BA",
  37120. "\u03F1",
  37121. "\u03C1",
  37122. "\u03F2",
  37123. "\u03C2",
  37124. "\u03F4",
  37125. "\u0398",
  37126. "\u03F5",
  37127. "\u03B5",
  37128. "\u03F9",
  37129. "\u03A3",
  37130. "\u0587",
  37131. "\u0565\u0582",
  37132. "\u0675",
  37133. "\u0627\u0674",
  37134. "\u0676",
  37135. "\u0648\u0674",
  37136. "\u0677",
  37137. "\u06C7\u0674",
  37138. "\u0678",
  37139. "\u064A\u0674",
  37140. "\u0E33",
  37141. "\u0E4D\u0E32",
  37142. "\u0EB3",
  37143. "\u0ECD\u0EB2",
  37144. "\u0EDC",
  37145. "\u0EAB\u0E99",
  37146. "\u0EDD",
  37147. "\u0EAB\u0EA1",
  37148. "\u0F77",
  37149. "\u0FB2\u0F81",
  37150. "\u0F79",
  37151. "\u0FB3\u0F81",
  37152. "\u1E9A",
  37153. "\u0061\u02BE",
  37154. "\u1FBD",
  37155. "\u0020\u0313",
  37156. "\u1FBF",
  37157. "\u0020\u0313",
  37158. "\u1FC0",
  37159. "\u0020\u0342",
  37160. "\u1FFE",
  37161. "\u0020\u0314",
  37162. "\u2002",
  37163. "\u0020",
  37164. "\u2003",
  37165. "\u0020",
  37166. "\u2004",
  37167. "\u0020",
  37168. "\u2005",
  37169. "\u0020",
  37170. "\u2006",
  37171. "\u0020",
  37172. "\u2008",
  37173. "\u0020",
  37174. "\u2009",
  37175. "\u0020",
  37176. "\u200A",
  37177. "\u0020",
  37178. "\u2017",
  37179. "\u0020\u0333",
  37180. "\u2024",
  37181. "\u002E",
  37182. "\u2025",
  37183. "\u002E\u002E",
  37184. "\u2026",
  37185. "\u002E\u002E\u002E",
  37186. "\u2033",
  37187. "\u2032\u2032",
  37188. "\u2034",
  37189. "\u2032\u2032\u2032",
  37190. "\u2036",
  37191. "\u2035\u2035",
  37192. "\u2037",
  37193. "\u2035\u2035\u2035",
  37194. "\u203C",
  37195. "\u0021\u0021",
  37196. "\u203E",
  37197. "\u0020\u0305",
  37198. "\u2047",
  37199. "\u003F\u003F",
  37200. "\u2048",
  37201. "\u003F\u0021",
  37202. "\u2049",
  37203. "\u0021\u003F",
  37204. "\u2057",
  37205. "\u2032\u2032\u2032\u2032",
  37206. "\u205F",
  37207. "\u0020",
  37208. "\u20A8",
  37209. "\u0052\u0073",
  37210. "\u2100",
  37211. "\u0061\u002F\u0063",
  37212. "\u2101",
  37213. "\u0061\u002F\u0073",
  37214. "\u2103",
  37215. "\u00B0\u0043",
  37216. "\u2105",
  37217. "\u0063\u002F\u006F",
  37218. "\u2106",
  37219. "\u0063\u002F\u0075",
  37220. "\u2107",
  37221. "\u0190",
  37222. "\u2109",
  37223. "\u00B0\u0046",
  37224. "\u2116",
  37225. "\u004E\u006F",
  37226. "\u2121",
  37227. "\u0054\u0045\u004C",
  37228. "\u2135",
  37229. "\u05D0",
  37230. "\u2136",
  37231. "\u05D1",
  37232. "\u2137",
  37233. "\u05D2",
  37234. "\u2138",
  37235. "\u05D3",
  37236. "\u213B",
  37237. "\u0046\u0041\u0058",
  37238. "\u2160",
  37239. "\u0049",
  37240. "\u2161",
  37241. "\u0049\u0049",
  37242. "\u2162",
  37243. "\u0049\u0049\u0049",
  37244. "\u2163",
  37245. "\u0049\u0056",
  37246. "\u2164",
  37247. "\u0056",
  37248. "\u2165",
  37249. "\u0056\u0049",
  37250. "\u2166",
  37251. "\u0056\u0049\u0049",
  37252. "\u2167",
  37253. "\u0056\u0049\u0049\u0049",
  37254. "\u2168",
  37255. "\u0049\u0058",
  37256. "\u2169",
  37257. "\u0058",
  37258. "\u216A",
  37259. "\u0058\u0049",
  37260. "\u216B",
  37261. "\u0058\u0049\u0049",
  37262. "\u216C",
  37263. "\u004C",
  37264. "\u216D",
  37265. "\u0043",
  37266. "\u216E",
  37267. "\u0044",
  37268. "\u216F",
  37269. "\u004D",
  37270. "\u2170",
  37271. "\u0069",
  37272. "\u2171",
  37273. "\u0069\u0069",
  37274. "\u2172",
  37275. "\u0069\u0069\u0069",
  37276. "\u2173",
  37277. "\u0069\u0076",
  37278. "\u2174",
  37279. "\u0076",
  37280. "\u2175",
  37281. "\u0076\u0069",
  37282. "\u2176",
  37283. "\u0076\u0069\u0069",
  37284. "\u2177",
  37285. "\u0076\u0069\u0069\u0069",
  37286. "\u2178",
  37287. "\u0069\u0078",
  37288. "\u2179",
  37289. "\u0078",
  37290. "\u217A",
  37291. "\u0078\u0069",
  37292. "\u217B",
  37293. "\u0078\u0069\u0069",
  37294. "\u217C",
  37295. "\u006C",
  37296. "\u217D",
  37297. "\u0063",
  37298. "\u217E",
  37299. "\u0064",
  37300. "\u217F",
  37301. "\u006D",
  37302. "\u222C",
  37303. "\u222B\u222B",
  37304. "\u222D",
  37305. "\u222B\u222B\u222B",
  37306. "\u222F",
  37307. "\u222E\u222E",
  37308. "\u2230",
  37309. "\u222E\u222E\u222E",
  37310. "\u2474",
  37311. "\u0028\u0031\u0029",
  37312. "\u2475",
  37313. "\u0028\u0032\u0029",
  37314. "\u2476",
  37315. "\u0028\u0033\u0029",
  37316. "\u2477",
  37317. "\u0028\u0034\u0029",
  37318. "\u2478",
  37319. "\u0028\u0035\u0029",
  37320. "\u2479",
  37321. "\u0028\u0036\u0029",
  37322. "\u247A",
  37323. "\u0028\u0037\u0029",
  37324. "\u247B",
  37325. "\u0028\u0038\u0029",
  37326. "\u247C",
  37327. "\u0028\u0039\u0029",
  37328. "\u247D",
  37329. "\u0028\u0031\u0030\u0029",
  37330. "\u247E",
  37331. "\u0028\u0031\u0031\u0029",
  37332. "\u247F",
  37333. "\u0028\u0031\u0032\u0029",
  37334. "\u2480",
  37335. "\u0028\u0031\u0033\u0029",
  37336. "\u2481",
  37337. "\u0028\u0031\u0034\u0029",
  37338. "\u2482",
  37339. "\u0028\u0031\u0035\u0029",
  37340. "\u2483",
  37341. "\u0028\u0031\u0036\u0029",
  37342. "\u2484",
  37343. "\u0028\u0031\u0037\u0029",
  37344. "\u2485",
  37345. "\u0028\u0031\u0038\u0029",
  37346. "\u2486",
  37347. "\u0028\u0031\u0039\u0029",
  37348. "\u2487",
  37349. "\u0028\u0032\u0030\u0029",
  37350. "\u2488",
  37351. "\u0031\u002E",
  37352. "\u2489",
  37353. "\u0032\u002E",
  37354. "\u248A",
  37355. "\u0033\u002E",
  37356. "\u248B",
  37357. "\u0034\u002E",
  37358. "\u248C",
  37359. "\u0035\u002E",
  37360. "\u248D",
  37361. "\u0036\u002E",
  37362. "\u248E",
  37363. "\u0037\u002E",
  37364. "\u248F",
  37365. "\u0038\u002E",
  37366. "\u2490",
  37367. "\u0039\u002E",
  37368. "\u2491",
  37369. "\u0031\u0030\u002E",
  37370. "\u2492",
  37371. "\u0031\u0031\u002E",
  37372. "\u2493",
  37373. "\u0031\u0032\u002E",
  37374. "\u2494",
  37375. "\u0031\u0033\u002E",
  37376. "\u2495",
  37377. "\u0031\u0034\u002E",
  37378. "\u2496",
  37379. "\u0031\u0035\u002E",
  37380. "\u2497",
  37381. "\u0031\u0036\u002E",
  37382. "\u2498",
  37383. "\u0031\u0037\u002E",
  37384. "\u2499",
  37385. "\u0031\u0038\u002E",
  37386. "\u249A",
  37387. "\u0031\u0039\u002E",
  37388. "\u249B",
  37389. "\u0032\u0030\u002E",
  37390. "\u249C",
  37391. "\u0028\u0061\u0029",
  37392. "\u249D",
  37393. "\u0028\u0062\u0029",
  37394. "\u249E",
  37395. "\u0028\u0063\u0029",
  37396. "\u249F",
  37397. "\u0028\u0064\u0029",
  37398. "\u24A0",
  37399. "\u0028\u0065\u0029",
  37400. "\u24A1",
  37401. "\u0028\u0066\u0029",
  37402. "\u24A2",
  37403. "\u0028\u0067\u0029",
  37404. "\u24A3",
  37405. "\u0028\u0068\u0029",
  37406. "\u24A4",
  37407. "\u0028\u0069\u0029",
  37408. "\u24A5",
  37409. "\u0028\u006A\u0029",
  37410. "\u24A6",
  37411. "\u0028\u006B\u0029",
  37412. "\u24A7",
  37413. "\u0028\u006C\u0029",
  37414. "\u24A8",
  37415. "\u0028\u006D\u0029",
  37416. "\u24A9",
  37417. "\u0028\u006E\u0029",
  37418. "\u24AA",
  37419. "\u0028\u006F\u0029",
  37420. "\u24AB",
  37421. "\u0028\u0070\u0029",
  37422. "\u24AC",
  37423. "\u0028\u0071\u0029",
  37424. "\u24AD",
  37425. "\u0028\u0072\u0029",
  37426. "\u24AE",
  37427. "\u0028\u0073\u0029",
  37428. "\u24AF",
  37429. "\u0028\u0074\u0029",
  37430. "\u24B0",
  37431. "\u0028\u0075\u0029",
  37432. "\u24B1",
  37433. "\u0028\u0076\u0029",
  37434. "\u24B2",
  37435. "\u0028\u0077\u0029",
  37436. "\u24B3",
  37437. "\u0028\u0078\u0029",
  37438. "\u24B4",
  37439. "\u0028\u0079\u0029",
  37440. "\u24B5",
  37441. "\u0028\u007A\u0029",
  37442. "\u2A0C",
  37443. "\u222B\u222B\u222B\u222B",
  37444. "\u2A74",
  37445. "\u003A\u003A\u003D",
  37446. "\u2A75",
  37447. "\u003D\u003D",
  37448. "\u2A76",
  37449. "\u003D\u003D\u003D",
  37450. "\u2E9F",
  37451. "\u6BCD",
  37452. "\u2EF3",
  37453. "\u9F9F",
  37454. "\u2F00",
  37455. "\u4E00",
  37456. "\u2F01",
  37457. "\u4E28",
  37458. "\u2F02",
  37459. "\u4E36",
  37460. "\u2F03",
  37461. "\u4E3F",
  37462. "\u2F04",
  37463. "\u4E59",
  37464. "\u2F05",
  37465. "\u4E85",
  37466. "\u2F06",
  37467. "\u4E8C",
  37468. "\u2F07",
  37469. "\u4EA0",
  37470. "\u2F08",
  37471. "\u4EBA",
  37472. "\u2F09",
  37473. "\u513F",
  37474. "\u2F0A",
  37475. "\u5165",
  37476. "\u2F0B",
  37477. "\u516B",
  37478. "\u2F0C",
  37479. "\u5182",
  37480. "\u2F0D",
  37481. "\u5196",
  37482. "\u2F0E",
  37483. "\u51AB",
  37484. "\u2F0F",
  37485. "\u51E0",
  37486. "\u2F10",
  37487. "\u51F5",
  37488. "\u2F11",
  37489. "\u5200",
  37490. "\u2F12",
  37491. "\u529B",
  37492. "\u2F13",
  37493. "\u52F9",
  37494. "\u2F14",
  37495. "\u5315",
  37496. "\u2F15",
  37497. "\u531A",
  37498. "\u2F16",
  37499. "\u5338",
  37500. "\u2F17",
  37501. "\u5341",
  37502. "\u2F18",
  37503. "\u535C",
  37504. "\u2F19",
  37505. "\u5369",
  37506. "\u2F1A",
  37507. "\u5382",
  37508. "\u2F1B",
  37509. "\u53B6",
  37510. "\u2F1C",
  37511. "\u53C8",
  37512. "\u2F1D",
  37513. "\u53E3",
  37514. "\u2F1E",
  37515. "\u56D7",
  37516. "\u2F1F",
  37517. "\u571F",
  37518. "\u2F20",
  37519. "\u58EB",
  37520. "\u2F21",
  37521. "\u5902",
  37522. "\u2F22",
  37523. "\u590A",
  37524. "\u2F23",
  37525. "\u5915",
  37526. "\u2F24",
  37527. "\u5927",
  37528. "\u2F25",
  37529. "\u5973",
  37530. "\u2F26",
  37531. "\u5B50",
  37532. "\u2F27",
  37533. "\u5B80",
  37534. "\u2F28",
  37535. "\u5BF8",
  37536. "\u2F29",
  37537. "\u5C0F",
  37538. "\u2F2A",
  37539. "\u5C22",
  37540. "\u2F2B",
  37541. "\u5C38",
  37542. "\u2F2C",
  37543. "\u5C6E",
  37544. "\u2F2D",
  37545. "\u5C71",
  37546. "\u2F2E",
  37547. "\u5DDB",
  37548. "\u2F2F",
  37549. "\u5DE5",
  37550. "\u2F30",
  37551. "\u5DF1",
  37552. "\u2F31",
  37553. "\u5DFE",
  37554. "\u2F32",
  37555. "\u5E72",
  37556. "\u2F33",
  37557. "\u5E7A",
  37558. "\u2F34",
  37559. "\u5E7F",
  37560. "\u2F35",
  37561. "\u5EF4",
  37562. "\u2F36",
  37563. "\u5EFE",
  37564. "\u2F37",
  37565. "\u5F0B",
  37566. "\u2F38",
  37567. "\u5F13",
  37568. "\u2F39",
  37569. "\u5F50",
  37570. "\u2F3A",
  37571. "\u5F61",
  37572. "\u2F3B",
  37573. "\u5F73",
  37574. "\u2F3C",
  37575. "\u5FC3",
  37576. "\u2F3D",
  37577. "\u6208",
  37578. "\u2F3E",
  37579. "\u6236",
  37580. "\u2F3F",
  37581. "\u624B",
  37582. "\u2F40",
  37583. "\u652F",
  37584. "\u2F41",
  37585. "\u6534",
  37586. "\u2F42",
  37587. "\u6587",
  37588. "\u2F43",
  37589. "\u6597",
  37590. "\u2F44",
  37591. "\u65A4",
  37592. "\u2F45",
  37593. "\u65B9",
  37594. "\u2F46",
  37595. "\u65E0",
  37596. "\u2F47",
  37597. "\u65E5",
  37598. "\u2F48",
  37599. "\u66F0",
  37600. "\u2F49",
  37601. "\u6708",
  37602. "\u2F4A",
  37603. "\u6728",
  37604. "\u2F4B",
  37605. "\u6B20",
  37606. "\u2F4C",
  37607. "\u6B62",
  37608. "\u2F4D",
  37609. "\u6B79",
  37610. "\u2F4E",
  37611. "\u6BB3",
  37612. "\u2F4F",
  37613. "\u6BCB",
  37614. "\u2F50",
  37615. "\u6BD4",
  37616. "\u2F51",
  37617. "\u6BDB",
  37618. "\u2F52",
  37619. "\u6C0F",
  37620. "\u2F53",
  37621. "\u6C14",
  37622. "\u2F54",
  37623. "\u6C34",
  37624. "\u2F55",
  37625. "\u706B",
  37626. "\u2F56",
  37627. "\u722A",
  37628. "\u2F57",
  37629. "\u7236",
  37630. "\u2F58",
  37631. "\u723B",
  37632. "\u2F59",
  37633. "\u723F",
  37634. "\u2F5A",
  37635. "\u7247",
  37636. "\u2F5B",
  37637. "\u7259",
  37638. "\u2F5C",
  37639. "\u725B",
  37640. "\u2F5D",
  37641. "\u72AC",
  37642. "\u2F5E",
  37643. "\u7384",
  37644. "\u2F5F",
  37645. "\u7389",
  37646. "\u2F60",
  37647. "\u74DC",
  37648. "\u2F61",
  37649. "\u74E6",
  37650. "\u2F62",
  37651. "\u7518",
  37652. "\u2F63",
  37653. "\u751F",
  37654. "\u2F64",
  37655. "\u7528",
  37656. "\u2F65",
  37657. "\u7530",
  37658. "\u2F66",
  37659. "\u758B",
  37660. "\u2F67",
  37661. "\u7592",
  37662. "\u2F68",
  37663. "\u7676",
  37664. "\u2F69",
  37665. "\u767D",
  37666. "\u2F6A",
  37667. "\u76AE",
  37668. "\u2F6B",
  37669. "\u76BF",
  37670. "\u2F6C",
  37671. "\u76EE",
  37672. "\u2F6D",
  37673. "\u77DB",
  37674. "\u2F6E",
  37675. "\u77E2",
  37676. "\u2F6F",
  37677. "\u77F3",
  37678. "\u2F70",
  37679. "\u793A",
  37680. "\u2F71",
  37681. "\u79B8",
  37682. "\u2F72",
  37683. "\u79BE",
  37684. "\u2F73",
  37685. "\u7A74",
  37686. "\u2F74",
  37687. "\u7ACB",
  37688. "\u2F75",
  37689. "\u7AF9",
  37690. "\u2F76",
  37691. "\u7C73",
  37692. "\u2F77",
  37693. "\u7CF8",
  37694. "\u2F78",
  37695. "\u7F36",
  37696. "\u2F79",
  37697. "\u7F51",
  37698. "\u2F7A",
  37699. "\u7F8A",
  37700. "\u2F7B",
  37701. "\u7FBD",
  37702. "\u2F7C",
  37703. "\u8001",
  37704. "\u2F7D",
  37705. "\u800C",
  37706. "\u2F7E",
  37707. "\u8012",
  37708. "\u2F7F",
  37709. "\u8033",
  37710. "\u2F80",
  37711. "\u807F",
  37712. "\u2F81",
  37713. "\u8089",
  37714. "\u2F82",
  37715. "\u81E3",
  37716. "\u2F83",
  37717. "\u81EA",
  37718. "\u2F84",
  37719. "\u81F3",
  37720. "\u2F85",
  37721. "\u81FC",
  37722. "\u2F86",
  37723. "\u820C",
  37724. "\u2F87",
  37725. "\u821B",
  37726. "\u2F88",
  37727. "\u821F",
  37728. "\u2F89",
  37729. "\u826E",
  37730. "\u2F8A",
  37731. "\u8272",
  37732. "\u2F8B",
  37733. "\u8278",
  37734. "\u2F8C",
  37735. "\u864D",
  37736. "\u2F8D",
  37737. "\u866B",
  37738. "\u2F8E",
  37739. "\u8840",
  37740. "\u2F8F",
  37741. "\u884C",
  37742. "\u2F90",
  37743. "\u8863",
  37744. "\u2F91",
  37745. "\u897E",
  37746. "\u2F92",
  37747. "\u898B",
  37748. "\u2F93",
  37749. "\u89D2",
  37750. "\u2F94",
  37751. "\u8A00",
  37752. "\u2F95",
  37753. "\u8C37",
  37754. "\u2F96",
  37755. "\u8C46",
  37756. "\u2F97",
  37757. "\u8C55",
  37758. "\u2F98",
  37759. "\u8C78",
  37760. "\u2F99",
  37761. "\u8C9D",
  37762. "\u2F9A",
  37763. "\u8D64",
  37764. "\u2F9B",
  37765. "\u8D70",
  37766. "\u2F9C",
  37767. "\u8DB3",
  37768. "\u2F9D",
  37769. "\u8EAB",
  37770. "\u2F9E",
  37771. "\u8ECA",
  37772. "\u2F9F",
  37773. "\u8F9B",
  37774. "\u2FA0",
  37775. "\u8FB0",
  37776. "\u2FA1",
  37777. "\u8FB5",
  37778. "\u2FA2",
  37779. "\u9091",
  37780. "\u2FA3",
  37781. "\u9149",
  37782. "\u2FA4",
  37783. "\u91C6",
  37784. "\u2FA5",
  37785. "\u91CC",
  37786. "\u2FA6",
  37787. "\u91D1",
  37788. "\u2FA7",
  37789. "\u9577",
  37790. "\u2FA8",
  37791. "\u9580",
  37792. "\u2FA9",
  37793. "\u961C",
  37794. "\u2FAA",
  37795. "\u96B6",
  37796. "\u2FAB",
  37797. "\u96B9",
  37798. "\u2FAC",
  37799. "\u96E8",
  37800. "\u2FAD",
  37801. "\u9751",
  37802. "\u2FAE",
  37803. "\u975E",
  37804. "\u2FAF",
  37805. "\u9762",
  37806. "\u2FB0",
  37807. "\u9769",
  37808. "\u2FB1",
  37809. "\u97CB",
  37810. "\u2FB2",
  37811. "\u97ED",
  37812. "\u2FB3",
  37813. "\u97F3",
  37814. "\u2FB4",
  37815. "\u9801",
  37816. "\u2FB5",
  37817. "\u98A8",
  37818. "\u2FB6",
  37819. "\u98DB",
  37820. "\u2FB7",
  37821. "\u98DF",
  37822. "\u2FB8",
  37823. "\u9996",
  37824. "\u2FB9",
  37825. "\u9999",
  37826. "\u2FBA",
  37827. "\u99AC",
  37828. "\u2FBB",
  37829. "\u9AA8",
  37830. "\u2FBC",
  37831. "\u9AD8",
  37832. "\u2FBD",
  37833. "\u9ADF",
  37834. "\u2FBE",
  37835. "\u9B25",
  37836. "\u2FBF",
  37837. "\u9B2F",
  37838. "\u2FC0",
  37839. "\u9B32",
  37840. "\u2FC1",
  37841. "\u9B3C",
  37842. "\u2FC2",
  37843. "\u9B5A",
  37844. "\u2FC3",
  37845. "\u9CE5",
  37846. "\u2FC4",
  37847. "\u9E75",
  37848. "\u2FC5",
  37849. "\u9E7F",
  37850. "\u2FC6",
  37851. "\u9EA5",
  37852. "\u2FC7",
  37853. "\u9EBB",
  37854. "\u2FC8",
  37855. "\u9EC3",
  37856. "\u2FC9",
  37857. "\u9ECD",
  37858. "\u2FCA",
  37859. "\u9ED1",
  37860. "\u2FCB",
  37861. "\u9EF9",
  37862. "\u2FCC",
  37863. "\u9EFD",
  37864. "\u2FCD",
  37865. "\u9F0E",
  37866. "\u2FCE",
  37867. "\u9F13",
  37868. "\u2FCF",
  37869. "\u9F20",
  37870. "\u2FD0",
  37871. "\u9F3B",
  37872. "\u2FD1",
  37873. "\u9F4A",
  37874. "\u2FD2",
  37875. "\u9F52",
  37876. "\u2FD3",
  37877. "\u9F8D",
  37878. "\u2FD4",
  37879. "\u9F9C",
  37880. "\u2FD5",
  37881. "\u9FA0",
  37882. "\u3036",
  37883. "\u3012",
  37884. "\u3038",
  37885. "\u5341",
  37886. "\u3039",
  37887. "\u5344",
  37888. "\u303A",
  37889. "\u5345",
  37890. "\u309B",
  37891. "\u0020\u3099",
  37892. "\u309C",
  37893. "\u0020\u309A",
  37894. "\u3131",
  37895. "\u1100",
  37896. "\u3132",
  37897. "\u1101",
  37898. "\u3133",
  37899. "\u11AA",
  37900. "\u3134",
  37901. "\u1102",
  37902. "\u3135",
  37903. "\u11AC",
  37904. "\u3136",
  37905. "\u11AD",
  37906. "\u3137",
  37907. "\u1103",
  37908. "\u3138",
  37909. "\u1104",
  37910. "\u3139",
  37911. "\u1105",
  37912. "\u313A",
  37913. "\u11B0",
  37914. "\u313B",
  37915. "\u11B1",
  37916. "\u313C",
  37917. "\u11B2",
  37918. "\u313D",
  37919. "\u11B3",
  37920. "\u313E",
  37921. "\u11B4",
  37922. "\u313F",
  37923. "\u11B5",
  37924. "\u3140",
  37925. "\u111A",
  37926. "\u3141",
  37927. "\u1106",
  37928. "\u3142",
  37929. "\u1107",
  37930. "\u3143",
  37931. "\u1108",
  37932. "\u3144",
  37933. "\u1121",
  37934. "\u3145",
  37935. "\u1109",
  37936. "\u3146",
  37937. "\u110A",
  37938. "\u3147",
  37939. "\u110B",
  37940. "\u3148",
  37941. "\u110C",
  37942. "\u3149",
  37943. "\u110D",
  37944. "\u314A",
  37945. "\u110E",
  37946. "\u314B",
  37947. "\u110F",
  37948. "\u314C",
  37949. "\u1110",
  37950. "\u314D",
  37951. "\u1111",
  37952. "\u314E",
  37953. "\u1112",
  37954. "\u314F",
  37955. "\u1161",
  37956. "\u3150",
  37957. "\u1162",
  37958. "\u3151",
  37959. "\u1163",
  37960. "\u3152",
  37961. "\u1164",
  37962. "\u3153",
  37963. "\u1165",
  37964. "\u3154",
  37965. "\u1166",
  37966. "\u3155",
  37967. "\u1167",
  37968. "\u3156",
  37969. "\u1168",
  37970. "\u3157",
  37971. "\u1169",
  37972. "\u3158",
  37973. "\u116A",
  37974. "\u3159",
  37975. "\u116B",
  37976. "\u315A",
  37977. "\u116C",
  37978. "\u315B",
  37979. "\u116D",
  37980. "\u315C",
  37981. "\u116E",
  37982. "\u315D",
  37983. "\u116F",
  37984. "\u315E",
  37985. "\u1170",
  37986. "\u315F",
  37987. "\u1171",
  37988. "\u3160",
  37989. "\u1172",
  37990. "\u3161",
  37991. "\u1173",
  37992. "\u3162",
  37993. "\u1174",
  37994. "\u3163",
  37995. "\u1175",
  37996. "\u3164",
  37997. "\u1160",
  37998. "\u3165",
  37999. "\u1114",
  38000. "\u3166",
  38001. "\u1115",
  38002. "\u3167",
  38003. "\u11C7",
  38004. "\u3168",
  38005. "\u11C8",
  38006. "\u3169",
  38007. "\u11CC",
  38008. "\u316A",
  38009. "\u11CE",
  38010. "\u316B",
  38011. "\u11D3",
  38012. "\u316C",
  38013. "\u11D7",
  38014. "\u316D",
  38015. "\u11D9",
  38016. "\u316E",
  38017. "\u111C",
  38018. "\u316F",
  38019. "\u11DD",
  38020. "\u3170",
  38021. "\u11DF",
  38022. "\u3171",
  38023. "\u111D",
  38024. "\u3172",
  38025. "\u111E",
  38026. "\u3173",
  38027. "\u1120",
  38028. "\u3174",
  38029. "\u1122",
  38030. "\u3175",
  38031. "\u1123",
  38032. "\u3176",
  38033. "\u1127",
  38034. "\u3177",
  38035. "\u1129",
  38036. "\u3178",
  38037. "\u112B",
  38038. "\u3179",
  38039. "\u112C",
  38040. "\u317A",
  38041. "\u112D",
  38042. "\u317B",
  38043. "\u112E",
  38044. "\u317C",
  38045. "\u112F",
  38046. "\u317D",
  38047. "\u1132",
  38048. "\u317E",
  38049. "\u1136",
  38050. "\u317F",
  38051. "\u1140",
  38052. "\u3180",
  38053. "\u1147",
  38054. "\u3181",
  38055. "\u114C",
  38056. "\u3182",
  38057. "\u11F1",
  38058. "\u3183",
  38059. "\u11F2",
  38060. "\u3184",
  38061. "\u1157",
  38062. "\u3185",
  38063. "\u1158",
  38064. "\u3186",
  38065. "\u1159",
  38066. "\u3187",
  38067. "\u1184",
  38068. "\u3188",
  38069. "\u1185",
  38070. "\u3189",
  38071. "\u1188",
  38072. "\u318A",
  38073. "\u1191",
  38074. "\u318B",
  38075. "\u1192",
  38076. "\u318C",
  38077. "\u1194",
  38078. "\u318D",
  38079. "\u119E",
  38080. "\u318E",
  38081. "\u11A1",
  38082. "\u3200",
  38083. "\u0028\u1100\u0029",
  38084. "\u3201",
  38085. "\u0028\u1102\u0029",
  38086. "\u3202",
  38087. "\u0028\u1103\u0029",
  38088. "\u3203",
  38089. "\u0028\u1105\u0029",
  38090. "\u3204",
  38091. "\u0028\u1106\u0029",
  38092. "\u3205",
  38093. "\u0028\u1107\u0029",
  38094. "\u3206",
  38095. "\u0028\u1109\u0029",
  38096. "\u3207",
  38097. "\u0028\u110B\u0029",
  38098. "\u3208",
  38099. "\u0028\u110C\u0029",
  38100. "\u3209",
  38101. "\u0028\u110E\u0029",
  38102. "\u320A",
  38103. "\u0028\u110F\u0029",
  38104. "\u320B",
  38105. "\u0028\u1110\u0029",
  38106. "\u320C",
  38107. "\u0028\u1111\u0029",
  38108. "\u320D",
  38109. "\u0028\u1112\u0029",
  38110. "\u320E",
  38111. "\u0028\u1100\u1161\u0029",
  38112. "\u320F",
  38113. "\u0028\u1102\u1161\u0029",
  38114. "\u3210",
  38115. "\u0028\u1103\u1161\u0029",
  38116. "\u3211",
  38117. "\u0028\u1105\u1161\u0029",
  38118. "\u3212",
  38119. "\u0028\u1106\u1161\u0029",
  38120. "\u3213",
  38121. "\u0028\u1107\u1161\u0029",
  38122. "\u3214",
  38123. "\u0028\u1109\u1161\u0029",
  38124. "\u3215",
  38125. "\u0028\u110B\u1161\u0029",
  38126. "\u3216",
  38127. "\u0028\u110C\u1161\u0029",
  38128. "\u3217",
  38129. "\u0028\u110E\u1161\u0029",
  38130. "\u3218",
  38131. "\u0028\u110F\u1161\u0029",
  38132. "\u3219",
  38133. "\u0028\u1110\u1161\u0029",
  38134. "\u321A",
  38135. "\u0028\u1111\u1161\u0029",
  38136. "\u321B",
  38137. "\u0028\u1112\u1161\u0029",
  38138. "\u321C",
  38139. "\u0028\u110C\u116E\u0029",
  38140. "\u321D",
  38141. "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029",
  38142. "\u321E",
  38143. "\u0028\u110B\u1169\u1112\u116E\u0029",
  38144. "\u3220",
  38145. "\u0028\u4E00\u0029",
  38146. "\u3221",
  38147. "\u0028\u4E8C\u0029",
  38148. "\u3222",
  38149. "\u0028\u4E09\u0029",
  38150. "\u3223",
  38151. "\u0028\u56DB\u0029",
  38152. "\u3224",
  38153. "\u0028\u4E94\u0029",
  38154. "\u3225",
  38155. "\u0028\u516D\u0029",
  38156. "\u3226",
  38157. "\u0028\u4E03\u0029",
  38158. "\u3227",
  38159. "\u0028\u516B\u0029",
  38160. "\u3228",
  38161. "\u0028\u4E5D\u0029",
  38162. "\u3229",
  38163. "\u0028\u5341\u0029",
  38164. "\u322A",
  38165. "\u0028\u6708\u0029",
  38166. "\u322B",
  38167. "\u0028\u706B\u0029",
  38168. "\u322C",
  38169. "\u0028\u6C34\u0029",
  38170. "\u322D",
  38171. "\u0028\u6728\u0029",
  38172. "\u322E",
  38173. "\u0028\u91D1\u0029",
  38174. "\u322F",
  38175. "\u0028\u571F\u0029",
  38176. "\u3230",
  38177. "\u0028\u65E5\u0029",
  38178. "\u3231",
  38179. "\u0028\u682A\u0029",
  38180. "\u3232",
  38181. "\u0028\u6709\u0029",
  38182. "\u3233",
  38183. "\u0028\u793E\u0029",
  38184. "\u3234",
  38185. "\u0028\u540D\u0029",
  38186. "\u3235",
  38187. "\u0028\u7279\u0029",
  38188. "\u3236",
  38189. "\u0028\u8CA1\u0029",
  38190. "\u3237",
  38191. "\u0028\u795D\u0029",
  38192. "\u3238",
  38193. "\u0028\u52B4\u0029",
  38194. "\u3239",
  38195. "\u0028\u4EE3\u0029",
  38196. "\u323A",
  38197. "\u0028\u547C\u0029",
  38198. "\u323B",
  38199. "\u0028\u5B66\u0029",
  38200. "\u323C",
  38201. "\u0028\u76E3\u0029",
  38202. "\u323D",
  38203. "\u0028\u4F01\u0029",
  38204. "\u323E",
  38205. "\u0028\u8CC7\u0029",
  38206. "\u323F",
  38207. "\u0028\u5354\u0029",
  38208. "\u3240",
  38209. "\u0028\u796D\u0029",
  38210. "\u3241",
  38211. "\u0028\u4F11\u0029",
  38212. "\u3242",
  38213. "\u0028\u81EA\u0029",
  38214. "\u3243",
  38215. "\u0028\u81F3\u0029",
  38216. "\u32C0",
  38217. "\u0031\u6708",
  38218. "\u32C1",
  38219. "\u0032\u6708",
  38220. "\u32C2",
  38221. "\u0033\u6708",
  38222. "\u32C3",
  38223. "\u0034\u6708",
  38224. "\u32C4",
  38225. "\u0035\u6708",
  38226. "\u32C5",
  38227. "\u0036\u6708",
  38228. "\u32C6",
  38229. "\u0037\u6708",
  38230. "\u32C7",
  38231. "\u0038\u6708",
  38232. "\u32C8",
  38233. "\u0039\u6708",
  38234. "\u32C9",
  38235. "\u0031\u0030\u6708",
  38236. "\u32CA",
  38237. "\u0031\u0031\u6708",
  38238. "\u32CB",
  38239. "\u0031\u0032\u6708",
  38240. "\u3358",
  38241. "\u0030\u70B9",
  38242. "\u3359",
  38243. "\u0031\u70B9",
  38244. "\u335A",
  38245. "\u0032\u70B9",
  38246. "\u335B",
  38247. "\u0033\u70B9",
  38248. "\u335C",
  38249. "\u0034\u70B9",
  38250. "\u335D",
  38251. "\u0035\u70B9",
  38252. "\u335E",
  38253. "\u0036\u70B9",
  38254. "\u335F",
  38255. "\u0037\u70B9",
  38256. "\u3360",
  38257. "\u0038\u70B9",
  38258. "\u3361",
  38259. "\u0039\u70B9",
  38260. "\u3362",
  38261. "\u0031\u0030\u70B9",
  38262. "\u3363",
  38263. "\u0031\u0031\u70B9",
  38264. "\u3364",
  38265. "\u0031\u0032\u70B9",
  38266. "\u3365",
  38267. "\u0031\u0033\u70B9",
  38268. "\u3366",
  38269. "\u0031\u0034\u70B9",
  38270. "\u3367",
  38271. "\u0031\u0035\u70B9",
  38272. "\u3368",
  38273. "\u0031\u0036\u70B9",
  38274. "\u3369",
  38275. "\u0031\u0037\u70B9",
  38276. "\u336A",
  38277. "\u0031\u0038\u70B9",
  38278. "\u336B",
  38279. "\u0031\u0039\u70B9",
  38280. "\u336C",
  38281. "\u0032\u0030\u70B9",
  38282. "\u336D",
  38283. "\u0032\u0031\u70B9",
  38284. "\u336E",
  38285. "\u0032\u0032\u70B9",
  38286. "\u336F",
  38287. "\u0032\u0033\u70B9",
  38288. "\u3370",
  38289. "\u0032\u0034\u70B9",
  38290. "\u33E0",
  38291. "\u0031\u65E5",
  38292. "\u33E1",
  38293. "\u0032\u65E5",
  38294. "\u33E2",
  38295. "\u0033\u65E5",
  38296. "\u33E3",
  38297. "\u0034\u65E5",
  38298. "\u33E4",
  38299. "\u0035\u65E5",
  38300. "\u33E5",
  38301. "\u0036\u65E5",
  38302. "\u33E6",
  38303. "\u0037\u65E5",
  38304. "\u33E7",
  38305. "\u0038\u65E5",
  38306. "\u33E8",
  38307. "\u0039\u65E5",
  38308. "\u33E9",
  38309. "\u0031\u0030\u65E5",
  38310. "\u33EA",
  38311. "\u0031\u0031\u65E5",
  38312. "\u33EB",
  38313. "\u0031\u0032\u65E5",
  38314. "\u33EC",
  38315. "\u0031\u0033\u65E5",
  38316. "\u33ED",
  38317. "\u0031\u0034\u65E5",
  38318. "\u33EE",
  38319. "\u0031\u0035\u65E5",
  38320. "\u33EF",
  38321. "\u0031\u0036\u65E5",
  38322. "\u33F0",
  38323. "\u0031\u0037\u65E5",
  38324. "\u33F1",
  38325. "\u0031\u0038\u65E5",
  38326. "\u33F2",
  38327. "\u0031\u0039\u65E5",
  38328. "\u33F3",
  38329. "\u0032\u0030\u65E5",
  38330. "\u33F4",
  38331. "\u0032\u0031\u65E5",
  38332. "\u33F5",
  38333. "\u0032\u0032\u65E5",
  38334. "\u33F6",
  38335. "\u0032\u0033\u65E5",
  38336. "\u33F7",
  38337. "\u0032\u0034\u65E5",
  38338. "\u33F8",
  38339. "\u0032\u0035\u65E5",
  38340. "\u33F9",
  38341. "\u0032\u0036\u65E5",
  38342. "\u33FA",
  38343. "\u0032\u0037\u65E5",
  38344. "\u33FB",
  38345. "\u0032\u0038\u65E5",
  38346. "\u33FC",
  38347. "\u0032\u0039\u65E5",
  38348. "\u33FD",
  38349. "\u0033\u0030\u65E5",
  38350. "\u33FE",
  38351. "\u0033\u0031\u65E5",
  38352. "\uFB00",
  38353. "\u0066\u0066",
  38354. "\uFB01",
  38355. "\u0066\u0069",
  38356. "\uFB02",
  38357. "\u0066\u006C",
  38358. "\uFB03",
  38359. "\u0066\u0066\u0069",
  38360. "\uFB04",
  38361. "\u0066\u0066\u006C",
  38362. "\uFB05",
  38363. "\u017F\u0074",
  38364. "\uFB06",
  38365. "\u0073\u0074",
  38366. "\uFB13",
  38367. "\u0574\u0576",
  38368. "\uFB14",
  38369. "\u0574\u0565",
  38370. "\uFB15",
  38371. "\u0574\u056B",
  38372. "\uFB16",
  38373. "\u057E\u0576",
  38374. "\uFB17",
  38375. "\u0574\u056D",
  38376. "\uFB4F",
  38377. "\u05D0\u05DC",
  38378. "\uFB50",
  38379. "\u0671",
  38380. "\uFB51",
  38381. "\u0671",
  38382. "\uFB52",
  38383. "\u067B",
  38384. "\uFB53",
  38385. "\u067B",
  38386. "\uFB54",
  38387. "\u067B",
  38388. "\uFB55",
  38389. "\u067B",
  38390. "\uFB56",
  38391. "\u067E",
  38392. "\uFB57",
  38393. "\u067E",
  38394. "\uFB58",
  38395. "\u067E",
  38396. "\uFB59",
  38397. "\u067E",
  38398. "\uFB5A",
  38399. "\u0680",
  38400. "\uFB5B",
  38401. "\u0680",
  38402. "\uFB5C",
  38403. "\u0680",
  38404. "\uFB5D",
  38405. "\u0680",
  38406. "\uFB5E",
  38407. "\u067A",
  38408. "\uFB5F",
  38409. "\u067A",
  38410. "\uFB60",
  38411. "\u067A",
  38412. "\uFB61",
  38413. "\u067A",
  38414. "\uFB62",
  38415. "\u067F",
  38416. "\uFB63",
  38417. "\u067F",
  38418. "\uFB64",
  38419. "\u067F",
  38420. "\uFB65",
  38421. "\u067F",
  38422. "\uFB66",
  38423. "\u0679",
  38424. "\uFB67",
  38425. "\u0679",
  38426. "\uFB68",
  38427. "\u0679",
  38428. "\uFB69",
  38429. "\u0679",
  38430. "\uFB6A",
  38431. "\u06A4",
  38432. "\uFB6B",
  38433. "\u06A4",
  38434. "\uFB6C",
  38435. "\u06A4",
  38436. "\uFB6D",
  38437. "\u06A4",
  38438. "\uFB6E",
  38439. "\u06A6",
  38440. "\uFB6F",
  38441. "\u06A6",
  38442. "\uFB70",
  38443. "\u06A6",
  38444. "\uFB71",
  38445. "\u06A6",
  38446. "\uFB72",
  38447. "\u0684",
  38448. "\uFB73",
  38449. "\u0684",
  38450. "\uFB74",
  38451. "\u0684",
  38452. "\uFB75",
  38453. "\u0684",
  38454. "\uFB76",
  38455. "\u0683",
  38456. "\uFB77",
  38457. "\u0683",
  38458. "\uFB78",
  38459. "\u0683",
  38460. "\uFB79",
  38461. "\u0683",
  38462. "\uFB7A",
  38463. "\u0686",
  38464. "\uFB7B",
  38465. "\u0686",
  38466. "\uFB7C",
  38467. "\u0686",
  38468. "\uFB7D",
  38469. "\u0686",
  38470. "\uFB7E",
  38471. "\u0687",
  38472. "\uFB7F",
  38473. "\u0687",
  38474. "\uFB80",
  38475. "\u0687",
  38476. "\uFB81",
  38477. "\u0687",
  38478. "\uFB82",
  38479. "\u068D",
  38480. "\uFB83",
  38481. "\u068D",
  38482. "\uFB84",
  38483. "\u068C",
  38484. "\uFB85",
  38485. "\u068C",
  38486. "\uFB86",
  38487. "\u068E",
  38488. "\uFB87",
  38489. "\u068E",
  38490. "\uFB88",
  38491. "\u0688",
  38492. "\uFB89",
  38493. "\u0688",
  38494. "\uFB8A",
  38495. "\u0698",
  38496. "\uFB8B",
  38497. "\u0698",
  38498. "\uFB8C",
  38499. "\u0691",
  38500. "\uFB8D",
  38501. "\u0691",
  38502. "\uFB8E",
  38503. "\u06A9",
  38504. "\uFB8F",
  38505. "\u06A9",
  38506. "\uFB90",
  38507. "\u06A9",
  38508. "\uFB91",
  38509. "\u06A9",
  38510. "\uFB92",
  38511. "\u06AF",
  38512. "\uFB93",
  38513. "\u06AF",
  38514. "\uFB94",
  38515. "\u06AF",
  38516. "\uFB95",
  38517. "\u06AF",
  38518. "\uFB96",
  38519. "\u06B3",
  38520. "\uFB97",
  38521. "\u06B3",
  38522. "\uFB98",
  38523. "\u06B3",
  38524. "\uFB99",
  38525. "\u06B3",
  38526. "\uFB9A",
  38527. "\u06B1",
  38528. "\uFB9B",
  38529. "\u06B1",
  38530. "\uFB9C",
  38531. "\u06B1",
  38532. "\uFB9D",
  38533. "\u06B1",
  38534. "\uFB9E",
  38535. "\u06BA",
  38536. "\uFB9F",
  38537. "\u06BA",
  38538. "\uFBA0",
  38539. "\u06BB",
  38540. "\uFBA1",
  38541. "\u06BB",
  38542. "\uFBA2",
  38543. "\u06BB",
  38544. "\uFBA3",
  38545. "\u06BB",
  38546. "\uFBA4",
  38547. "\u06C0",
  38548. "\uFBA5",
  38549. "\u06C0",
  38550. "\uFBA6",
  38551. "\u06C1",
  38552. "\uFBA7",
  38553. "\u06C1",
  38554. "\uFBA8",
  38555. "\u06C1",
  38556. "\uFBA9",
  38557. "\u06C1",
  38558. "\uFBAA",
  38559. "\u06BE",
  38560. "\uFBAB",
  38561. "\u06BE",
  38562. "\uFBAC",
  38563. "\u06BE",
  38564. "\uFBAD",
  38565. "\u06BE",
  38566. "\uFBAE",
  38567. "\u06D2",
  38568. "\uFBAF",
  38569. "\u06D2",
  38570. "\uFBB0",
  38571. "\u06D3",
  38572. "\uFBB1",
  38573. "\u06D3",
  38574. "\uFBD3",
  38575. "\u06AD",
  38576. "\uFBD4",
  38577. "\u06AD",
  38578. "\uFBD5",
  38579. "\u06AD",
  38580. "\uFBD6",
  38581. "\u06AD",
  38582. "\uFBD7",
  38583. "\u06C7",
  38584. "\uFBD8",
  38585. "\u06C7",
  38586. "\uFBD9",
  38587. "\u06C6",
  38588. "\uFBDA",
  38589. "\u06C6",
  38590. "\uFBDB",
  38591. "\u06C8",
  38592. "\uFBDC",
  38593. "\u06C8",
  38594. "\uFBDD",
  38595. "\u0677",
  38596. "\uFBDE",
  38597. "\u06CB",
  38598. "\uFBDF",
  38599. "\u06CB",
  38600. "\uFBE0",
  38601. "\u06C5",
  38602. "\uFBE1",
  38603. "\u06C5",
  38604. "\uFBE2",
  38605. "\u06C9",
  38606. "\uFBE3",
  38607. "\u06C9",
  38608. "\uFBE4",
  38609. "\u06D0",
  38610. "\uFBE5",
  38611. "\u06D0",
  38612. "\uFBE6",
  38613. "\u06D0",
  38614. "\uFBE7",
  38615. "\u06D0",
  38616. "\uFBE8",
  38617. "\u0649",
  38618. "\uFBE9",
  38619. "\u0649",
  38620. "\uFBEA",
  38621. "\u0626\u0627",
  38622. "\uFBEB",
  38623. "\u0626\u0627",
  38624. "\uFBEC",
  38625. "\u0626\u06D5",
  38626. "\uFBED",
  38627. "\u0626\u06D5",
  38628. "\uFBEE",
  38629. "\u0626\u0648",
  38630. "\uFBEF",
  38631. "\u0626\u0648",
  38632. "\uFBF0",
  38633. "\u0626\u06C7",
  38634. "\uFBF1",
  38635. "\u0626\u06C7",
  38636. "\uFBF2",
  38637. "\u0626\u06C6",
  38638. "\uFBF3",
  38639. "\u0626\u06C6",
  38640. "\uFBF4",
  38641. "\u0626\u06C8",
  38642. "\uFBF5",
  38643. "\u0626\u06C8",
  38644. "\uFBF6",
  38645. "\u0626\u06D0",
  38646. "\uFBF7",
  38647. "\u0626\u06D0",
  38648. "\uFBF8",
  38649. "\u0626\u06D0",
  38650. "\uFBF9",
  38651. "\u0626\u0649",
  38652. "\uFBFA",
  38653. "\u0626\u0649",
  38654. "\uFBFB",
  38655. "\u0626\u0649",
  38656. "\uFBFC",
  38657. "\u06CC",
  38658. "\uFBFD",
  38659. "\u06CC",
  38660. "\uFBFE",
  38661. "\u06CC",
  38662. "\uFBFF",
  38663. "\u06CC",
  38664. "\uFC00",
  38665. "\u0626\u062C",
  38666. "\uFC01",
  38667. "\u0626\u062D",
  38668. "\uFC02",
  38669. "\u0626\u0645",
  38670. "\uFC03",
  38671. "\u0626\u0649",
  38672. "\uFC04",
  38673. "\u0626\u064A",
  38674. "\uFC05",
  38675. "\u0628\u062C",
  38676. "\uFC06",
  38677. "\u0628\u062D",
  38678. "\uFC07",
  38679. "\u0628\u062E",
  38680. "\uFC08",
  38681. "\u0628\u0645",
  38682. "\uFC09",
  38683. "\u0628\u0649",
  38684. "\uFC0A",
  38685. "\u0628\u064A",
  38686. "\uFC0B",
  38687. "\u062A\u062C",
  38688. "\uFC0C",
  38689. "\u062A\u062D",
  38690. "\uFC0D",
  38691. "\u062A\u062E",
  38692. "\uFC0E",
  38693. "\u062A\u0645",
  38694. "\uFC0F",
  38695. "\u062A\u0649",
  38696. "\uFC10",
  38697. "\u062A\u064A",
  38698. "\uFC11",
  38699. "\u062B\u062C",
  38700. "\uFC12",
  38701. "\u062B\u0645",
  38702. "\uFC13",
  38703. "\u062B\u0649",
  38704. "\uFC14",
  38705. "\u062B\u064A",
  38706. "\uFC15",
  38707. "\u062C\u062D",
  38708. "\uFC16",
  38709. "\u062C\u0645",
  38710. "\uFC17",
  38711. "\u062D\u062C",
  38712. "\uFC18",
  38713. "\u062D\u0645",
  38714. "\uFC19",
  38715. "\u062E\u062C",
  38716. "\uFC1A",
  38717. "\u062E\u062D",
  38718. "\uFC1B",
  38719. "\u062E\u0645",
  38720. "\uFC1C",
  38721. "\u0633\u062C",
  38722. "\uFC1D",
  38723. "\u0633\u062D",
  38724. "\uFC1E",
  38725. "\u0633\u062E",
  38726. "\uFC1F",
  38727. "\u0633\u0645",
  38728. "\uFC20",
  38729. "\u0635\u062D",
  38730. "\uFC21",
  38731. "\u0635\u0645",
  38732. "\uFC22",
  38733. "\u0636\u062C",
  38734. "\uFC23",
  38735. "\u0636\u062D",
  38736. "\uFC24",
  38737. "\u0636\u062E",
  38738. "\uFC25",
  38739. "\u0636\u0645",
  38740. "\uFC26",
  38741. "\u0637\u062D",
  38742. "\uFC27",
  38743. "\u0637\u0645",
  38744. "\uFC28",
  38745. "\u0638\u0645",
  38746. "\uFC29",
  38747. "\u0639\u062C",
  38748. "\uFC2A",
  38749. "\u0639\u0645",
  38750. "\uFC2B",
  38751. "\u063A\u062C",
  38752. "\uFC2C",
  38753. "\u063A\u0645",
  38754. "\uFC2D",
  38755. "\u0641\u062C",
  38756. "\uFC2E",
  38757. "\u0641\u062D",
  38758. "\uFC2F",
  38759. "\u0641\u062E",
  38760. "\uFC30",
  38761. "\u0641\u0645",
  38762. "\uFC31",
  38763. "\u0641\u0649",
  38764. "\uFC32",
  38765. "\u0641\u064A",
  38766. "\uFC33",
  38767. "\u0642\u062D",
  38768. "\uFC34",
  38769. "\u0642\u0645",
  38770. "\uFC35",
  38771. "\u0642\u0649",
  38772. "\uFC36",
  38773. "\u0642\u064A",
  38774. "\uFC37",
  38775. "\u0643\u0627",
  38776. "\uFC38",
  38777. "\u0643\u062C",
  38778. "\uFC39",
  38779. "\u0643\u062D",
  38780. "\uFC3A",
  38781. "\u0643\u062E",
  38782. "\uFC3B",
  38783. "\u0643\u0644",
  38784. "\uFC3C",
  38785. "\u0643\u0645",
  38786. "\uFC3D",
  38787. "\u0643\u0649",
  38788. "\uFC3E",
  38789. "\u0643\u064A",
  38790. "\uFC3F",
  38791. "\u0644\u062C",
  38792. "\uFC40",
  38793. "\u0644\u062D",
  38794. "\uFC41",
  38795. "\u0644\u062E",
  38796. "\uFC42",
  38797. "\u0644\u0645",
  38798. "\uFC43",
  38799. "\u0644\u0649",
  38800. "\uFC44",
  38801. "\u0644\u064A",
  38802. "\uFC45",
  38803. "\u0645\u062C",
  38804. "\uFC46",
  38805. "\u0645\u062D",
  38806. "\uFC47",
  38807. "\u0645\u062E",
  38808. "\uFC48",
  38809. "\u0645\u0645",
  38810. "\uFC49",
  38811. "\u0645\u0649",
  38812. "\uFC4A",
  38813. "\u0645\u064A",
  38814. "\uFC4B",
  38815. "\u0646\u062C",
  38816. "\uFC4C",
  38817. "\u0646\u062D",
  38818. "\uFC4D",
  38819. "\u0646\u062E",
  38820. "\uFC4E",
  38821. "\u0646\u0645",
  38822. "\uFC4F",
  38823. "\u0646\u0649",
  38824. "\uFC50",
  38825. "\u0646\u064A",
  38826. "\uFC51",
  38827. "\u0647\u062C",
  38828. "\uFC52",
  38829. "\u0647\u0645",
  38830. "\uFC53",
  38831. "\u0647\u0649",
  38832. "\uFC54",
  38833. "\u0647\u064A",
  38834. "\uFC55",
  38835. "\u064A\u062C",
  38836. "\uFC56",
  38837. "\u064A\u062D",
  38838. "\uFC57",
  38839. "\u064A\u062E",
  38840. "\uFC58",
  38841. "\u064A\u0645",
  38842. "\uFC59",
  38843. "\u064A\u0649",
  38844. "\uFC5A",
  38845. "\u064A\u064A",
  38846. "\uFC5B",
  38847. "\u0630\u0670",
  38848. "\uFC5C",
  38849. "\u0631\u0670",
  38850. "\uFC5D",
  38851. "\u0649\u0670",
  38852. "\uFC5E",
  38853. "\u0020\u064C\u0651",
  38854. "\uFC5F",
  38855. "\u0020\u064D\u0651",
  38856. "\uFC60",
  38857. "\u0020\u064E\u0651",
  38858. "\uFC61",
  38859. "\u0020\u064F\u0651",
  38860. "\uFC62",
  38861. "\u0020\u0650\u0651",
  38862. "\uFC63",
  38863. "\u0020\u0651\u0670",
  38864. "\uFC64",
  38865. "\u0626\u0631",
  38866. "\uFC65",
  38867. "\u0626\u0632",
  38868. "\uFC66",
  38869. "\u0626\u0645",
  38870. "\uFC67",
  38871. "\u0626\u0646",
  38872. "\uFC68",
  38873. "\u0626\u0649",
  38874. "\uFC69",
  38875. "\u0626\u064A",
  38876. "\uFC6A",
  38877. "\u0628\u0631",
  38878. "\uFC6B",
  38879. "\u0628\u0632",
  38880. "\uFC6C",
  38881. "\u0628\u0645",
  38882. "\uFC6D",
  38883. "\u0628\u0646",
  38884. "\uFC6E",
  38885. "\u0628\u0649",
  38886. "\uFC6F",
  38887. "\u0628\u064A",
  38888. "\uFC70",
  38889. "\u062A\u0631",
  38890. "\uFC71",
  38891. "\u062A\u0632",
  38892. "\uFC72",
  38893. "\u062A\u0645",
  38894. "\uFC73",
  38895. "\u062A\u0646",
  38896. "\uFC74",
  38897. "\u062A\u0649",
  38898. "\uFC75",
  38899. "\u062A\u064A",
  38900. "\uFC76",
  38901. "\u062B\u0631",
  38902. "\uFC77",
  38903. "\u062B\u0632",
  38904. "\uFC78",
  38905. "\u062B\u0645",
  38906. "\uFC79",
  38907. "\u062B\u0646",
  38908. "\uFC7A",
  38909. "\u062B\u0649",
  38910. "\uFC7B",
  38911. "\u062B\u064A",
  38912. "\uFC7C",
  38913. "\u0641\u0649",
  38914. "\uFC7D",
  38915. "\u0641\u064A",
  38916. "\uFC7E",
  38917. "\u0642\u0649",
  38918. "\uFC7F",
  38919. "\u0642\u064A",
  38920. "\uFC80",
  38921. "\u0643\u0627",
  38922. "\uFC81",
  38923. "\u0643\u0644",
  38924. "\uFC82",
  38925. "\u0643\u0645",
  38926. "\uFC83",
  38927. "\u0643\u0649",
  38928. "\uFC84",
  38929. "\u0643\u064A",
  38930. "\uFC85",
  38931. "\u0644\u0645",
  38932. "\uFC86",
  38933. "\u0644\u0649",
  38934. "\uFC87",
  38935. "\u0644\u064A",
  38936. "\uFC88",
  38937. "\u0645\u0627",
  38938. "\uFC89",
  38939. "\u0645\u0645",
  38940. "\uFC8A",
  38941. "\u0646\u0631",
  38942. "\uFC8B",
  38943. "\u0646\u0632",
  38944. "\uFC8C",
  38945. "\u0646\u0645",
  38946. "\uFC8D",
  38947. "\u0646\u0646",
  38948. "\uFC8E",
  38949. "\u0646\u0649",
  38950. "\uFC8F",
  38951. "\u0646\u064A",
  38952. "\uFC90",
  38953. "\u0649\u0670",
  38954. "\uFC91",
  38955. "\u064A\u0631",
  38956. "\uFC92",
  38957. "\u064A\u0632",
  38958. "\uFC93",
  38959. "\u064A\u0645",
  38960. "\uFC94",
  38961. "\u064A\u0646",
  38962. "\uFC95",
  38963. "\u064A\u0649",
  38964. "\uFC96",
  38965. "\u064A\u064A",
  38966. "\uFC97",
  38967. "\u0626\u062C",
  38968. "\uFC98",
  38969. "\u0626\u062D",
  38970. "\uFC99",
  38971. "\u0626\u062E",
  38972. "\uFC9A",
  38973. "\u0626\u0645",
  38974. "\uFC9B",
  38975. "\u0626\u0647",
  38976. "\uFC9C",
  38977. "\u0628\u062C",
  38978. "\uFC9D",
  38979. "\u0628\u062D",
  38980. "\uFC9E",
  38981. "\u0628\u062E",
  38982. "\uFC9F",
  38983. "\u0628\u0645",
  38984. "\uFCA0",
  38985. "\u0628\u0647",
  38986. "\uFCA1",
  38987. "\u062A\u062C",
  38988. "\uFCA2",
  38989. "\u062A\u062D",
  38990. "\uFCA3",
  38991. "\u062A\u062E",
  38992. "\uFCA4",
  38993. "\u062A\u0645",
  38994. "\uFCA5",
  38995. "\u062A\u0647",
  38996. "\uFCA6",
  38997. "\u062B\u0645",
  38998. "\uFCA7",
  38999. "\u062C\u062D",
  39000. "\uFCA8",
  39001. "\u062C\u0645",
  39002. "\uFCA9",
  39003. "\u062D\u062C",
  39004. "\uFCAA",
  39005. "\u062D\u0645",
  39006. "\uFCAB",
  39007. "\u062E\u062C",
  39008. "\uFCAC",
  39009. "\u062E\u0645",
  39010. "\uFCAD",
  39011. "\u0633\u062C",
  39012. "\uFCAE",
  39013. "\u0633\u062D",
  39014. "\uFCAF",
  39015. "\u0633\u062E",
  39016. "\uFCB0",
  39017. "\u0633\u0645",
  39018. "\uFCB1",
  39019. "\u0635\u062D",
  39020. "\uFCB2",
  39021. "\u0635\u062E",
  39022. "\uFCB3",
  39023. "\u0635\u0645",
  39024. "\uFCB4",
  39025. "\u0636\u062C",
  39026. "\uFCB5",
  39027. "\u0636\u062D",
  39028. "\uFCB6",
  39029. "\u0636\u062E",
  39030. "\uFCB7",
  39031. "\u0636\u0645",
  39032. "\uFCB8",
  39033. "\u0637\u062D",
  39034. "\uFCB9",
  39035. "\u0638\u0645",
  39036. "\uFCBA",
  39037. "\u0639\u062C",
  39038. "\uFCBB",
  39039. "\u0639\u0645",
  39040. "\uFCBC",
  39041. "\u063A\u062C",
  39042. "\uFCBD",
  39043. "\u063A\u0645",
  39044. "\uFCBE",
  39045. "\u0641\u062C",
  39046. "\uFCBF",
  39047. "\u0641\u062D",
  39048. "\uFCC0",
  39049. "\u0641\u062E",
  39050. "\uFCC1",
  39051. "\u0641\u0645",
  39052. "\uFCC2",
  39053. "\u0642\u062D",
  39054. "\uFCC3",
  39055. "\u0642\u0645",
  39056. "\uFCC4",
  39057. "\u0643\u062C",
  39058. "\uFCC5",
  39059. "\u0643\u062D",
  39060. "\uFCC6",
  39061. "\u0643\u062E",
  39062. "\uFCC7",
  39063. "\u0643\u0644",
  39064. "\uFCC8",
  39065. "\u0643\u0645",
  39066. "\uFCC9",
  39067. "\u0644\u062C",
  39068. "\uFCCA",
  39069. "\u0644\u062D",
  39070. "\uFCCB",
  39071. "\u0644\u062E",
  39072. "\uFCCC",
  39073. "\u0644\u0645",
  39074. "\uFCCD",
  39075. "\u0644\u0647",
  39076. "\uFCCE",
  39077. "\u0645\u062C",
  39078. "\uFCCF",
  39079. "\u0645\u062D",
  39080. "\uFCD0",
  39081. "\u0645\u062E",
  39082. "\uFCD1",
  39083. "\u0645\u0645",
  39084. "\uFCD2",
  39085. "\u0646\u062C",
  39086. "\uFCD3",
  39087. "\u0646\u062D",
  39088. "\uFCD4",
  39089. "\u0646\u062E",
  39090. "\uFCD5",
  39091. "\u0646\u0645",
  39092. "\uFCD6",
  39093. "\u0646\u0647",
  39094. "\uFCD7",
  39095. "\u0647\u062C",
  39096. "\uFCD8",
  39097. "\u0647\u0645",
  39098. "\uFCD9",
  39099. "\u0647\u0670",
  39100. "\uFCDA",
  39101. "\u064A\u062C",
  39102. "\uFCDB",
  39103. "\u064A\u062D",
  39104. "\uFCDC",
  39105. "\u064A\u062E",
  39106. "\uFCDD",
  39107. "\u064A\u0645",
  39108. "\uFCDE",
  39109. "\u064A\u0647",
  39110. "\uFCDF",
  39111. "\u0626\u0645",
  39112. "\uFCE0",
  39113. "\u0626\u0647",
  39114. "\uFCE1",
  39115. "\u0628\u0645",
  39116. "\uFCE2",
  39117. "\u0628\u0647",
  39118. "\uFCE3",
  39119. "\u062A\u0645",
  39120. "\uFCE4",
  39121. "\u062A\u0647",
  39122. "\uFCE5",
  39123. "\u062B\u0645",
  39124. "\uFCE6",
  39125. "\u062B\u0647",
  39126. "\uFCE7",
  39127. "\u0633\u0645",
  39128. "\uFCE8",
  39129. "\u0633\u0647",
  39130. "\uFCE9",
  39131. "\u0634\u0645",
  39132. "\uFCEA",
  39133. "\u0634\u0647",
  39134. "\uFCEB",
  39135. "\u0643\u0644",
  39136. "\uFCEC",
  39137. "\u0643\u0645",
  39138. "\uFCED",
  39139. "\u0644\u0645",
  39140. "\uFCEE",
  39141. "\u0646\u0645",
  39142. "\uFCEF",
  39143. "\u0646\u0647",
  39144. "\uFCF0",
  39145. "\u064A\u0645",
  39146. "\uFCF1",
  39147. "\u064A\u0647",
  39148. "\uFCF2",
  39149. "\u0640\u064E\u0651",
  39150. "\uFCF3",
  39151. "\u0640\u064F\u0651",
  39152. "\uFCF4",
  39153. "\u0640\u0650\u0651",
  39154. "\uFCF5",
  39155. "\u0637\u0649",
  39156. "\uFCF6",
  39157. "\u0637\u064A",
  39158. "\uFCF7",
  39159. "\u0639\u0649",
  39160. "\uFCF8",
  39161. "\u0639\u064A",
  39162. "\uFCF9",
  39163. "\u063A\u0649",
  39164. "\uFCFA",
  39165. "\u063A\u064A",
  39166. "\uFCFB",
  39167. "\u0633\u0649",
  39168. "\uFCFC",
  39169. "\u0633\u064A",
  39170. "\uFCFD",
  39171. "\u0634\u0649",
  39172. "\uFCFE",
  39173. "\u0634\u064A",
  39174. "\uFCFF",
  39175. "\u062D\u0649",
  39176. "\uFD00",
  39177. "\u062D\u064A",
  39178. "\uFD01",
  39179. "\u062C\u0649",
  39180. "\uFD02",
  39181. "\u062C\u064A",
  39182. "\uFD03",
  39183. "\u062E\u0649",
  39184. "\uFD04",
  39185. "\u062E\u064A",
  39186. "\uFD05",
  39187. "\u0635\u0649",
  39188. "\uFD06",
  39189. "\u0635\u064A",
  39190. "\uFD07",
  39191. "\u0636\u0649",
  39192. "\uFD08",
  39193. "\u0636\u064A",
  39194. "\uFD09",
  39195. "\u0634\u062C",
  39196. "\uFD0A",
  39197. "\u0634\u062D",
  39198. "\uFD0B",
  39199. "\u0634\u062E",
  39200. "\uFD0C",
  39201. "\u0634\u0645",
  39202. "\uFD0D",
  39203. "\u0634\u0631",
  39204. "\uFD0E",
  39205. "\u0633\u0631",
  39206. "\uFD0F",
  39207. "\u0635\u0631",
  39208. "\uFD10",
  39209. "\u0636\u0631",
  39210. "\uFD11",
  39211. "\u0637\u0649",
  39212. "\uFD12",
  39213. "\u0637\u064A",
  39214. "\uFD13",
  39215. "\u0639\u0649",
  39216. "\uFD14",
  39217. "\u0639\u064A",
  39218. "\uFD15",
  39219. "\u063A\u0649",
  39220. "\uFD16",
  39221. "\u063A\u064A",
  39222. "\uFD17",
  39223. "\u0633\u0649",
  39224. "\uFD18",
  39225. "\u0633\u064A",
  39226. "\uFD19",
  39227. "\u0634\u0649",
  39228. "\uFD1A",
  39229. "\u0634\u064A",
  39230. "\uFD1B",
  39231. "\u062D\u0649",
  39232. "\uFD1C",
  39233. "\u062D\u064A",
  39234. "\uFD1D",
  39235. "\u062C\u0649",
  39236. "\uFD1E",
  39237. "\u062C\u064A",
  39238. "\uFD1F",
  39239. "\u062E\u0649",
  39240. "\uFD20",
  39241. "\u062E\u064A",
  39242. "\uFD21",
  39243. "\u0635\u0649",
  39244. "\uFD22",
  39245. "\u0635\u064A",
  39246. "\uFD23",
  39247. "\u0636\u0649",
  39248. "\uFD24",
  39249. "\u0636\u064A",
  39250. "\uFD25",
  39251. "\u0634\u062C",
  39252. "\uFD26",
  39253. "\u0634\u062D",
  39254. "\uFD27",
  39255. "\u0634\u062E",
  39256. "\uFD28",
  39257. "\u0634\u0645",
  39258. "\uFD29",
  39259. "\u0634\u0631",
  39260. "\uFD2A",
  39261. "\u0633\u0631",
  39262. "\uFD2B",
  39263. "\u0635\u0631",
  39264. "\uFD2C",
  39265. "\u0636\u0631",
  39266. "\uFD2D",
  39267. "\u0634\u062C",
  39268. "\uFD2E",
  39269. "\u0634\u062D",
  39270. "\uFD2F",
  39271. "\u0634\u062E",
  39272. "\uFD30",
  39273. "\u0634\u0645",
  39274. "\uFD31",
  39275. "\u0633\u0647",
  39276. "\uFD32",
  39277. "\u0634\u0647",
  39278. "\uFD33",
  39279. "\u0637\u0645",
  39280. "\uFD34",
  39281. "\u0633\u062C",
  39282. "\uFD35",
  39283. "\u0633\u062D",
  39284. "\uFD36",
  39285. "\u0633\u062E",
  39286. "\uFD37",
  39287. "\u0634\u062C",
  39288. "\uFD38",
  39289. "\u0634\u062D",
  39290. "\uFD39",
  39291. "\u0634\u062E",
  39292. "\uFD3A",
  39293. "\u0637\u0645",
  39294. "\uFD3B",
  39295. "\u0638\u0645",
  39296. "\uFD3C",
  39297. "\u0627\u064B",
  39298. "\uFD3D",
  39299. "\u0627\u064B",
  39300. "\uFD50",
  39301. "\u062A\u062C\u0645",
  39302. "\uFD51",
  39303. "\u062A\u062D\u062C",
  39304. "\uFD52",
  39305. "\u062A\u062D\u062C",
  39306. "\uFD53",
  39307. "\u062A\u062D\u0645",
  39308. "\uFD54",
  39309. "\u062A\u062E\u0645",
  39310. "\uFD55",
  39311. "\u062A\u0645\u062C",
  39312. "\uFD56",
  39313. "\u062A\u0645\u062D",
  39314. "\uFD57",
  39315. "\u062A\u0645\u062E",
  39316. "\uFD58",
  39317. "\u062C\u0645\u062D",
  39318. "\uFD59",
  39319. "\u062C\u0645\u062D",
  39320. "\uFD5A",
  39321. "\u062D\u0645\u064A",
  39322. "\uFD5B",
  39323. "\u062D\u0645\u0649",
  39324. "\uFD5C",
  39325. "\u0633\u062D\u062C",
  39326. "\uFD5D",
  39327. "\u0633\u062C\u062D",
  39328. "\uFD5E",
  39329. "\u0633\u062C\u0649",
  39330. "\uFD5F",
  39331. "\u0633\u0645\u062D",
  39332. "\uFD60",
  39333. "\u0633\u0645\u062D",
  39334. "\uFD61",
  39335. "\u0633\u0645\u062C",
  39336. "\uFD62",
  39337. "\u0633\u0645\u0645",
  39338. "\uFD63",
  39339. "\u0633\u0645\u0645",
  39340. "\uFD64",
  39341. "\u0635\u062D\u062D",
  39342. "\uFD65",
  39343. "\u0635\u062D\u062D",
  39344. "\uFD66",
  39345. "\u0635\u0645\u0645",
  39346. "\uFD67",
  39347. "\u0634\u062D\u0645",
  39348. "\uFD68",
  39349. "\u0634\u062D\u0645",
  39350. "\uFD69",
  39351. "\u0634\u062C\u064A",
  39352. "\uFD6A",
  39353. "\u0634\u0645\u062E",
  39354. "\uFD6B",
  39355. "\u0634\u0645\u062E",
  39356. "\uFD6C",
  39357. "\u0634\u0645\u0645",
  39358. "\uFD6D",
  39359. "\u0634\u0645\u0645",
  39360. "\uFD6E",
  39361. "\u0636\u062D\u0649",
  39362. "\uFD6F",
  39363. "\u0636\u062E\u0645",
  39364. "\uFD70",
  39365. "\u0636\u062E\u0645",
  39366. "\uFD71",
  39367. "\u0637\u0645\u062D",
  39368. "\uFD72",
  39369. "\u0637\u0645\u062D",
  39370. "\uFD73",
  39371. "\u0637\u0645\u0645",
  39372. "\uFD74",
  39373. "\u0637\u0645\u064A",
  39374. "\uFD75",
  39375. "\u0639\u062C\u0645",
  39376. "\uFD76",
  39377. "\u0639\u0645\u0645",
  39378. "\uFD77",
  39379. "\u0639\u0645\u0645",
  39380. "\uFD78",
  39381. "\u0639\u0645\u0649",
  39382. "\uFD79",
  39383. "\u063A\u0645\u0645",
  39384. "\uFD7A",
  39385. "\u063A\u0645\u064A",
  39386. "\uFD7B",
  39387. "\u063A\u0645\u0649",
  39388. "\uFD7C",
  39389. "\u0641\u062E\u0645",
  39390. "\uFD7D",
  39391. "\u0641\u062E\u0645",
  39392. "\uFD7E",
  39393. "\u0642\u0645\u062D",
  39394. "\uFD7F",
  39395. "\u0642\u0645\u0645",
  39396. "\uFD80",
  39397. "\u0644\u062D\u0645",
  39398. "\uFD81",
  39399. "\u0644\u062D\u064A",
  39400. "\uFD82",
  39401. "\u0644\u062D\u0649",
  39402. "\uFD83",
  39403. "\u0644\u062C\u062C",
  39404. "\uFD84",
  39405. "\u0644\u062C\u062C",
  39406. "\uFD85",
  39407. "\u0644\u062E\u0645",
  39408. "\uFD86",
  39409. "\u0644\u062E\u0645",
  39410. "\uFD87",
  39411. "\u0644\u0645\u062D",
  39412. "\uFD88",
  39413. "\u0644\u0645\u062D",
  39414. "\uFD89",
  39415. "\u0645\u062D\u062C",
  39416. "\uFD8A",
  39417. "\u0645\u062D\u0645",
  39418. "\uFD8B",
  39419. "\u0645\u062D\u064A",
  39420. "\uFD8C",
  39421. "\u0645\u062C\u062D",
  39422. "\uFD8D",
  39423. "\u0645\u062C\u0645",
  39424. "\uFD8E",
  39425. "\u0645\u062E\u062C",
  39426. "\uFD8F",
  39427. "\u0645\u062E\u0645",
  39428. "\uFD92",
  39429. "\u0645\u062C\u062E",
  39430. "\uFD93",
  39431. "\u0647\u0645\u062C",
  39432. "\uFD94",
  39433. "\u0647\u0645\u0645",
  39434. "\uFD95",
  39435. "\u0646\u062D\u0645",
  39436. "\uFD96",
  39437. "\u0646\u062D\u0649",
  39438. "\uFD97",
  39439. "\u0646\u062C\u0645",
  39440. "\uFD98",
  39441. "\u0646\u062C\u0645",
  39442. "\uFD99",
  39443. "\u0646\u062C\u0649",
  39444. "\uFD9A",
  39445. "\u0646\u0645\u064A",
  39446. "\uFD9B",
  39447. "\u0646\u0645\u0649",
  39448. "\uFD9C",
  39449. "\u064A\u0645\u0645",
  39450. "\uFD9D",
  39451. "\u064A\u0645\u0645",
  39452. "\uFD9E",
  39453. "\u0628\u062E\u064A",
  39454. "\uFD9F",
  39455. "\u062A\u062C\u064A",
  39456. "\uFDA0",
  39457. "\u062A\u062C\u0649",
  39458. "\uFDA1",
  39459. "\u062A\u062E\u064A",
  39460. "\uFDA2",
  39461. "\u062A\u062E\u0649",
  39462. "\uFDA3",
  39463. "\u062A\u0645\u064A",
  39464. "\uFDA4",
  39465. "\u062A\u0645\u0649",
  39466. "\uFDA5",
  39467. "\u062C\u0645\u064A",
  39468. "\uFDA6",
  39469. "\u062C\u062D\u0649",
  39470. "\uFDA7",
  39471. "\u062C\u0645\u0649",
  39472. "\uFDA8",
  39473. "\u0633\u062E\u0649",
  39474. "\uFDA9",
  39475. "\u0635\u062D\u064A",
  39476. "\uFDAA",
  39477. "\u0634\u062D\u064A",
  39478. "\uFDAB",
  39479. "\u0636\u062D\u064A",
  39480. "\uFDAC",
  39481. "\u0644\u062C\u064A",
  39482. "\uFDAD",
  39483. "\u0644\u0645\u064A",
  39484. "\uFDAE",
  39485. "\u064A\u062D\u064A",
  39486. "\uFDAF",
  39487. "\u064A\u062C\u064A",
  39488. "\uFDB0",
  39489. "\u064A\u0645\u064A",
  39490. "\uFDB1",
  39491. "\u0645\u0645\u064A",
  39492. "\uFDB2",
  39493. "\u0642\u0645\u064A",
  39494. "\uFDB3",
  39495. "\u0646\u062D\u064A",
  39496. "\uFDB4",
  39497. "\u0642\u0645\u062D",
  39498. "\uFDB5",
  39499. "\u0644\u062D\u0645",
  39500. "\uFDB6",
  39501. "\u0639\u0645\u064A",
  39502. "\uFDB7",
  39503. "\u0643\u0645\u064A",
  39504. "\uFDB8",
  39505. "\u0646\u062C\u062D",
  39506. "\uFDB9",
  39507. "\u0645\u062E\u064A",
  39508. "\uFDBA",
  39509. "\u0644\u062C\u0645",
  39510. "\uFDBB",
  39511. "\u0643\u0645\u0645",
  39512. "\uFDBC",
  39513. "\u0644\u062C\u0645",
  39514. "\uFDBD",
  39515. "\u0646\u062C\u062D",
  39516. "\uFDBE",
  39517. "\u062C\u062D\u064A",
  39518. "\uFDBF",
  39519. "\u062D\u062C\u064A",
  39520. "\uFDC0",
  39521. "\u0645\u062C\u064A",
  39522. "\uFDC1",
  39523. "\u0641\u0645\u064A",
  39524. "\uFDC2",
  39525. "\u0628\u062D\u064A",
  39526. "\uFDC3",
  39527. "\u0643\u0645\u0645",
  39528. "\uFDC4",
  39529. "\u0639\u062C\u0645",
  39530. "\uFDC5",
  39531. "\u0635\u0645\u0645",
  39532. "\uFDC6",
  39533. "\u0633\u062E\u064A",
  39534. "\uFDC7",
  39535. "\u0646\u062C\u064A",
  39536. "\uFE49",
  39537. "\u203E",
  39538. "\uFE4A",
  39539. "\u203E",
  39540. "\uFE4B",
  39541. "\u203E",
  39542. "\uFE4C",
  39543. "\u203E",
  39544. "\uFE4D",
  39545. "\u005F",
  39546. "\uFE4E",
  39547. "\u005F",
  39548. "\uFE4F",
  39549. "\u005F",
  39550. "\uFE80",
  39551. "\u0621",
  39552. "\uFE81",
  39553. "\u0622",
  39554. "\uFE82",
  39555. "\u0622",
  39556. "\uFE83",
  39557. "\u0623",
  39558. "\uFE84",
  39559. "\u0623",
  39560. "\uFE85",
  39561. "\u0624",
  39562. "\uFE86",
  39563. "\u0624",
  39564. "\uFE87",
  39565. "\u0625",
  39566. "\uFE88",
  39567. "\u0625",
  39568. "\uFE89",
  39569. "\u0626",
  39570. "\uFE8A",
  39571. "\u0626",
  39572. "\uFE8B",
  39573. "\u0626",
  39574. "\uFE8C",
  39575. "\u0626",
  39576. "\uFE8D",
  39577. "\u0627",
  39578. "\uFE8E",
  39579. "\u0627",
  39580. "\uFE8F",
  39581. "\u0628",
  39582. "\uFE90",
  39583. "\u0628",
  39584. "\uFE91",
  39585. "\u0628",
  39586. "\uFE92",
  39587. "\u0628",
  39588. "\uFE93",
  39589. "\u0629",
  39590. "\uFE94",
  39591. "\u0629",
  39592. "\uFE95",
  39593. "\u062A",
  39594. "\uFE96",
  39595. "\u062A",
  39596. "\uFE97",
  39597. "\u062A",
  39598. "\uFE98",
  39599. "\u062A",
  39600. "\uFE99",
  39601. "\u062B",
  39602. "\uFE9A",
  39603. "\u062B",
  39604. "\uFE9B",
  39605. "\u062B",
  39606. "\uFE9C",
  39607. "\u062B",
  39608. "\uFE9D",
  39609. "\u062C",
  39610. "\uFE9E",
  39611. "\u062C",
  39612. "\uFE9F",
  39613. "\u062C",
  39614. "\uFEA0",
  39615. "\u062C",
  39616. "\uFEA1",
  39617. "\u062D",
  39618. "\uFEA2",
  39619. "\u062D",
  39620. "\uFEA3",
  39621. "\u062D",
  39622. "\uFEA4",
  39623. "\u062D",
  39624. "\uFEA5",
  39625. "\u062E",
  39626. "\uFEA6",
  39627. "\u062E",
  39628. "\uFEA7",
  39629. "\u062E",
  39630. "\uFEA8",
  39631. "\u062E",
  39632. "\uFEA9",
  39633. "\u062F",
  39634. "\uFEAA",
  39635. "\u062F",
  39636. "\uFEAB",
  39637. "\u0630",
  39638. "\uFEAC",
  39639. "\u0630",
  39640. "\uFEAD",
  39641. "\u0631",
  39642. "\uFEAE",
  39643. "\u0631",
  39644. "\uFEAF",
  39645. "\u0632",
  39646. "\uFEB0",
  39647. "\u0632",
  39648. "\uFEB1",
  39649. "\u0633",
  39650. "\uFEB2",
  39651. "\u0633",
  39652. "\uFEB3",
  39653. "\u0633",
  39654. "\uFEB4",
  39655. "\u0633",
  39656. "\uFEB5",
  39657. "\u0634",
  39658. "\uFEB6",
  39659. "\u0634",
  39660. "\uFEB7",
  39661. "\u0634",
  39662. "\uFEB8",
  39663. "\u0634",
  39664. "\uFEB9",
  39665. "\u0635",
  39666. "\uFEBA",
  39667. "\u0635",
  39668. "\uFEBB",
  39669. "\u0635",
  39670. "\uFEBC",
  39671. "\u0635",
  39672. "\uFEBD",
  39673. "\u0636",
  39674. "\uFEBE",
  39675. "\u0636",
  39676. "\uFEBF",
  39677. "\u0636",
  39678. "\uFEC0",
  39679. "\u0636",
  39680. "\uFEC1",
  39681. "\u0637",
  39682. "\uFEC2",
  39683. "\u0637",
  39684. "\uFEC3",
  39685. "\u0637",
  39686. "\uFEC4",
  39687. "\u0637",
  39688. "\uFEC5",
  39689. "\u0638",
  39690. "\uFEC6",
  39691. "\u0638",
  39692. "\uFEC7",
  39693. "\u0638",
  39694. "\uFEC8",
  39695. "\u0638",
  39696. "\uFEC9",
  39697. "\u0639",
  39698. "\uFECA",
  39699. "\u0639",
  39700. "\uFECB",
  39701. "\u0639",
  39702. "\uFECC",
  39703. "\u0639",
  39704. "\uFECD",
  39705. "\u063A",
  39706. "\uFECE",
  39707. "\u063A",
  39708. "\uFECF",
  39709. "\u063A",
  39710. "\uFED0",
  39711. "\u063A",
  39712. "\uFED1",
  39713. "\u0641",
  39714. "\uFED2",
  39715. "\u0641",
  39716. "\uFED3",
  39717. "\u0641",
  39718. "\uFED4",
  39719. "\u0641",
  39720. "\uFED5",
  39721. "\u0642",
  39722. "\uFED6",
  39723. "\u0642",
  39724. "\uFED7",
  39725. "\u0642",
  39726. "\uFED8",
  39727. "\u0642",
  39728. "\uFED9",
  39729. "\u0643",
  39730. "\uFEDA",
  39731. "\u0643",
  39732. "\uFEDB",
  39733. "\u0643",
  39734. "\uFEDC",
  39735. "\u0643",
  39736. "\uFEDD",
  39737. "\u0644",
  39738. "\uFEDE",
  39739. "\u0644",
  39740. "\uFEDF",
  39741. "\u0644",
  39742. "\uFEE0",
  39743. "\u0644",
  39744. "\uFEE1",
  39745. "\u0645",
  39746. "\uFEE2",
  39747. "\u0645",
  39748. "\uFEE3",
  39749. "\u0645",
  39750. "\uFEE4",
  39751. "\u0645",
  39752. "\uFEE5",
  39753. "\u0646",
  39754. "\uFEE6",
  39755. "\u0646",
  39756. "\uFEE7",
  39757. "\u0646",
  39758. "\uFEE8",
  39759. "\u0646",
  39760. "\uFEE9",
  39761. "\u0647",
  39762. "\uFEEA",
  39763. "\u0647",
  39764. "\uFEEB",
  39765. "\u0647",
  39766. "\uFEEC",
  39767. "\u0647",
  39768. "\uFEED",
  39769. "\u0648",
  39770. "\uFEEE",
  39771. "\u0648",
  39772. "\uFEEF",
  39773. "\u0649",
  39774. "\uFEF0",
  39775. "\u0649",
  39776. "\uFEF1",
  39777. "\u064A",
  39778. "\uFEF2",
  39779. "\u064A",
  39780. "\uFEF3",
  39781. "\u064A",
  39782. "\uFEF4",
  39783. "\u064A",
  39784. "\uFEF5",
  39785. "\u0644\u0622",
  39786. "\uFEF6",
  39787. "\u0644\u0622",
  39788. "\uFEF7",
  39789. "\u0644\u0623",
  39790. "\uFEF8",
  39791. "\u0644\u0623",
  39792. "\uFEF9",
  39793. "\u0644\u0625",
  39794. "\uFEFA",
  39795. "\u0644\u0625",
  39796. "\uFEFB",
  39797. "\u0644\u0627",
  39798. "\uFEFC",
  39799. "\u0644\u0627"
  39800. ];
  39801. });
  39802. function reverseIfRtl(chars) {
  39803. const charsLength = chars.length;
  39804. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  39805. return chars;
  39806. }
  39807. const buf = [];
  39808. for (let ii = charsLength - 1; ii >= 0; ii--) {
  39809. buf.push(chars[ii]);
  39810. }
  39811. return buf.join("");
  39812. }
  39813. const SpecialCharRegExp = new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$", "u");
  39814. const CategoryCache = new Map();
  39815. function getCharUnicodeCategory(char) {
  39816. const cachedCategory = CategoryCache.get(char);
  39817. if (cachedCategory) {
  39818. return cachedCategory;
  39819. }
  39820. const groups = char.match(SpecialCharRegExp);
  39821. const category = {
  39822. isWhitespace: !!(groups && groups[1]),
  39823. isZeroWidthDiacritic: !!(groups && groups[2]),
  39824. isInvisibleFormatMark: !!(groups && groups[3])
  39825. };
  39826. CategoryCache.set(char, category);
  39827. return category;
  39828. }
  39829. function clearUnicodeCaches() {
  39830. CategoryCache.clear();
  39831. }
  39832. /***/ }),
  39833. /* 166 */
  39834. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  39835. "use strict";
  39836. Object.defineProperty(exports, "__esModule", ({
  39837. value: true
  39838. }));
  39839. exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = exports.getFontNameToFileMap = void 0;
  39840. exports.getStandardFontName = getStandardFontName;
  39841. exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = void 0;
  39842. var _core_utils = __w_pdfjs_require__(131);
  39843. var _fonts_utils = __w_pdfjs_require__(163);
  39844. const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  39845. t["Times-Roman"] = "Times-Roman";
  39846. t.Helvetica = "Helvetica";
  39847. t.Courier = "Courier";
  39848. t.Symbol = "Symbol";
  39849. t["Times-Bold"] = "Times-Bold";
  39850. t["Helvetica-Bold"] = "Helvetica-Bold";
  39851. t["Courier-Bold"] = "Courier-Bold";
  39852. t.ZapfDingbats = "ZapfDingbats";
  39853. t["Times-Italic"] = "Times-Italic";
  39854. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  39855. t["Courier-Oblique"] = "Courier-Oblique";
  39856. t["Times-BoldItalic"] = "Times-BoldItalic";
  39857. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  39858. t["Courier-BoldOblique"] = "Courier-BoldOblique";
  39859. t.ArialNarrow = "Helvetica";
  39860. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  39861. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  39862. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  39863. t.ArialBlack = "Helvetica";
  39864. t["ArialBlack-Bold"] = "Helvetica-Bold";
  39865. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  39866. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  39867. t["Arial-Black"] = "Helvetica";
  39868. t["Arial-Black-Bold"] = "Helvetica-Bold";
  39869. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  39870. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  39871. t.Arial = "Helvetica";
  39872. t["Arial-Bold"] = "Helvetica-Bold";
  39873. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  39874. t["Arial-Italic"] = "Helvetica-Oblique";
  39875. t.ArialMT = "Helvetica";
  39876. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  39877. t["Arial-BoldMT"] = "Helvetica-Bold";
  39878. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  39879. t.ArialUnicodeMS = "Helvetica";
  39880. t["ArialUnicodeMS-Bold"] = "Helvetica-Bold";
  39881. t["ArialUnicodeMS-BoldItalic"] = "Helvetica-BoldOblique";
  39882. t["ArialUnicodeMS-Italic"] = "Helvetica-Oblique";
  39883. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  39884. t["Courier-Italic"] = "Courier-Oblique";
  39885. t.CourierNew = "Courier";
  39886. t["CourierNew-Bold"] = "Courier-Bold";
  39887. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  39888. t["CourierNew-Italic"] = "Courier-Oblique";
  39889. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  39890. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  39891. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  39892. t.CourierNewPSMT = "Courier";
  39893. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  39894. t["Helvetica-Italic"] = "Helvetica-Oblique";
  39895. t["Symbol-Bold"] = "Symbol";
  39896. t["Symbol-BoldItalic"] = "Symbol";
  39897. t["Symbol-Italic"] = "Symbol";
  39898. t.TimesNewRoman = "Times-Roman";
  39899. t["TimesNewRoman-Bold"] = "Times-Bold";
  39900. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  39901. t["TimesNewRoman-Italic"] = "Times-Italic";
  39902. t.TimesNewRomanPS = "Times-Roman";
  39903. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  39904. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  39905. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  39906. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  39907. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  39908. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  39909. t.TimesNewRomanPSMT = "Times-Roman";
  39910. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  39911. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  39912. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  39913. });
  39914. exports.getStdFontMap = getStdFontMap;
  39915. const getFontNameToFileMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  39916. t.Courier = "FoxitFixed.pfb";
  39917. t["Courier-Bold"] = "FoxitFixedBold.pfb";
  39918. t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb";
  39919. t["Courier-Oblique"] = "FoxitFixedItalic.pfb";
  39920. t.Helvetica = "FoxitSans.pfb";
  39921. t["Helvetica-Bold"] = "FoxitSansBold.pfb";
  39922. t["Helvetica-BoldOblique"] = "FoxitSansBoldItalic.pfb";
  39923. t["Helvetica-Oblique"] = "FoxitSansItalic.pfb";
  39924. t["Times-Roman"] = "FoxitSerif.pfb";
  39925. t["Times-Bold"] = "FoxitSerifBold.pfb";
  39926. t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb";
  39927. t["Times-Italic"] = "FoxitSerifItalic.pfb";
  39928. t.Symbol = "FoxitSymbol.pfb";
  39929. t.ZapfDingbats = "FoxitDingbats.pfb";
  39930. t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf";
  39931. t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf";
  39932. t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf";
  39933. t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf";
  39934. });
  39935. exports.getFontNameToFileMap = getFontNameToFileMap;
  39936. const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  39937. t.Calibri = "Helvetica";
  39938. t["Calibri-Bold"] = "Helvetica-Bold";
  39939. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  39940. t["Calibri-Italic"] = "Helvetica-Oblique";
  39941. t.CenturyGothic = "Helvetica";
  39942. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  39943. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  39944. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  39945. t.ComicSansMS = "Comic Sans MS";
  39946. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  39947. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  39948. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  39949. t["ItcSymbol-Bold"] = "Helvetica-Bold";
  39950. t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique";
  39951. t["ItcSymbol-Book"] = "Helvetica";
  39952. t["ItcSymbol-BookItalic"] = "Helvetica-Oblique";
  39953. t["ItcSymbol-Medium"] = "Helvetica";
  39954. t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique";
  39955. t.LucidaConsole = "Courier";
  39956. t["LucidaConsole-Bold"] = "Courier-Bold";
  39957. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  39958. t["LucidaConsole-Italic"] = "Courier-Oblique";
  39959. t["LucidaSans-Demi"] = "Helvetica-Bold";
  39960. t["MS-Gothic"] = "MS Gothic";
  39961. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  39962. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  39963. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  39964. t["MS-Mincho"] = "MS Mincho";
  39965. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  39966. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  39967. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  39968. t["MS-PGothic"] = "MS PGothic";
  39969. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  39970. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  39971. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  39972. t["MS-PMincho"] = "MS PMincho";
  39973. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  39974. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  39975. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  39976. t.NuptialScript = "Times-Italic";
  39977. t.SegoeUISymbol = "Helvetica";
  39978. t.Wingdings = "ZapfDingbats";
  39979. t["Wingdings-Regular"] = "ZapfDingbats";
  39980. });
  39981. exports.getNonStdFontMap = getNonStdFontMap;
  39982. const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  39983. t["Adobe Jenson"] = true;
  39984. t["Adobe Text"] = true;
  39985. t.Albertus = true;
  39986. t.Aldus = true;
  39987. t.Alexandria = true;
  39988. t.Algerian = true;
  39989. t["American Typewriter"] = true;
  39990. t.Antiqua = true;
  39991. t.Apex = true;
  39992. t.Arno = true;
  39993. t.Aster = true;
  39994. t.Aurora = true;
  39995. t.Baskerville = true;
  39996. t.Bell = true;
  39997. t.Bembo = true;
  39998. t["Bembo Schoolbook"] = true;
  39999. t.Benguiat = true;
  40000. t["Berkeley Old Style"] = true;
  40001. t["Bernhard Modern"] = true;
  40002. t["Berthold City"] = true;
  40003. t.Bodoni = true;
  40004. t["Bauer Bodoni"] = true;
  40005. t["Book Antiqua"] = true;
  40006. t.Bookman = true;
  40007. t["Bordeaux Roman"] = true;
  40008. t["Californian FB"] = true;
  40009. t.Calisto = true;
  40010. t.Calvert = true;
  40011. t.Capitals = true;
  40012. t.Cambria = true;
  40013. t.Cartier = true;
  40014. t.Caslon = true;
  40015. t.Catull = true;
  40016. t.Centaur = true;
  40017. t["Century Old Style"] = true;
  40018. t["Century Schoolbook"] = true;
  40019. t.Chaparral = true;
  40020. t["Charis SIL"] = true;
  40021. t.Cheltenham = true;
  40022. t["Cholla Slab"] = true;
  40023. t.Clarendon = true;
  40024. t.Clearface = true;
  40025. t.Cochin = true;
  40026. t.Colonna = true;
  40027. t["Computer Modern"] = true;
  40028. t["Concrete Roman"] = true;
  40029. t.Constantia = true;
  40030. t["Cooper Black"] = true;
  40031. t.Corona = true;
  40032. t.Ecotype = true;
  40033. t.Egyptienne = true;
  40034. t.Elephant = true;
  40035. t.Excelsior = true;
  40036. t.Fairfield = true;
  40037. t["FF Scala"] = true;
  40038. t.Folkard = true;
  40039. t.Footlight = true;
  40040. t.FreeSerif = true;
  40041. t["Friz Quadrata"] = true;
  40042. t.Garamond = true;
  40043. t.Gentium = true;
  40044. t.Georgia = true;
  40045. t.Gloucester = true;
  40046. t["Goudy Old Style"] = true;
  40047. t["Goudy Schoolbook"] = true;
  40048. t["Goudy Pro Font"] = true;
  40049. t.Granjon = true;
  40050. t["Guardian Egyptian"] = true;
  40051. t.Heather = true;
  40052. t.Hercules = true;
  40053. t["High Tower Text"] = true;
  40054. t.Hiroshige = true;
  40055. t["Hoefler Text"] = true;
  40056. t["Humana Serif"] = true;
  40057. t.Imprint = true;
  40058. t["Ionic No. 5"] = true;
  40059. t.Janson = true;
  40060. t.Joanna = true;
  40061. t.Korinna = true;
  40062. t.Lexicon = true;
  40063. t.LiberationSerif = true;
  40064. t["Liberation Serif"] = true;
  40065. t["Linux Libertine"] = true;
  40066. t.Literaturnaya = true;
  40067. t.Lucida = true;
  40068. t["Lucida Bright"] = true;
  40069. t.Melior = true;
  40070. t.Memphis = true;
  40071. t.Miller = true;
  40072. t.Minion = true;
  40073. t.Modern = true;
  40074. t["Mona Lisa"] = true;
  40075. t["Mrs Eaves"] = true;
  40076. t["MS Serif"] = true;
  40077. t["Museo Slab"] = true;
  40078. t["New York"] = true;
  40079. t["Nimbus Roman"] = true;
  40080. t["NPS Rawlinson Roadway"] = true;
  40081. t.NuptialScript = true;
  40082. t.Palatino = true;
  40083. t.Perpetua = true;
  40084. t.Plantin = true;
  40085. t["Plantin Schoolbook"] = true;
  40086. t.Playbill = true;
  40087. t["Poor Richard"] = true;
  40088. t["Rawlinson Roadway"] = true;
  40089. t.Renault = true;
  40090. t.Requiem = true;
  40091. t.Rockwell = true;
  40092. t.Roman = true;
  40093. t["Rotis Serif"] = true;
  40094. t.Sabon = true;
  40095. t.Scala = true;
  40096. t.Seagull = true;
  40097. t.Sistina = true;
  40098. t.Souvenir = true;
  40099. t.STIX = true;
  40100. t["Stone Informal"] = true;
  40101. t["Stone Serif"] = true;
  40102. t.Sylfaen = true;
  40103. t.Times = true;
  40104. t.Trajan = true;
  40105. t["Trinité"] = true;
  40106. t["Trump Mediaeval"] = true;
  40107. t.Utopia = true;
  40108. t["Vale Type"] = true;
  40109. t["Bitstream Vera"] = true;
  40110. t["Vera Serif"] = true;
  40111. t.Versailles = true;
  40112. t.Wanted = true;
  40113. t.Weiss = true;
  40114. t["Wide Latin"] = true;
  40115. t.Windsor = true;
  40116. t.XITS = true;
  40117. });
  40118. exports.getSerifFonts = getSerifFonts;
  40119. const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  40120. t.Dingbats = true;
  40121. t.Symbol = true;
  40122. t.ZapfDingbats = true;
  40123. });
  40124. exports.getSymbolsFonts = getSymbolsFonts;
  40125. const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  40126. t[2] = 10;
  40127. t[3] = 32;
  40128. t[4] = 33;
  40129. t[5] = 34;
  40130. t[6] = 35;
  40131. t[7] = 36;
  40132. t[8] = 37;
  40133. t[9] = 38;
  40134. t[10] = 39;
  40135. t[11] = 40;
  40136. t[12] = 41;
  40137. t[13] = 42;
  40138. t[14] = 43;
  40139. t[15] = 44;
  40140. t[16] = 45;
  40141. t[17] = 46;
  40142. t[18] = 47;
  40143. t[19] = 48;
  40144. t[20] = 49;
  40145. t[21] = 50;
  40146. t[22] = 51;
  40147. t[23] = 52;
  40148. t[24] = 53;
  40149. t[25] = 54;
  40150. t[26] = 55;
  40151. t[27] = 56;
  40152. t[28] = 57;
  40153. t[29] = 58;
  40154. t[30] = 894;
  40155. t[31] = 60;
  40156. t[32] = 61;
  40157. t[33] = 62;
  40158. t[34] = 63;
  40159. t[35] = 64;
  40160. t[36] = 65;
  40161. t[37] = 66;
  40162. t[38] = 67;
  40163. t[39] = 68;
  40164. t[40] = 69;
  40165. t[41] = 70;
  40166. t[42] = 71;
  40167. t[43] = 72;
  40168. t[44] = 73;
  40169. t[45] = 74;
  40170. t[46] = 75;
  40171. t[47] = 76;
  40172. t[48] = 77;
  40173. t[49] = 78;
  40174. t[50] = 79;
  40175. t[51] = 80;
  40176. t[52] = 81;
  40177. t[53] = 82;
  40178. t[54] = 83;
  40179. t[55] = 84;
  40180. t[56] = 85;
  40181. t[57] = 86;
  40182. t[58] = 87;
  40183. t[59] = 88;
  40184. t[60] = 89;
  40185. t[61] = 90;
  40186. t[62] = 91;
  40187. t[63] = 92;
  40188. t[64] = 93;
  40189. t[65] = 94;
  40190. t[66] = 95;
  40191. t[67] = 96;
  40192. t[68] = 97;
  40193. t[69] = 98;
  40194. t[70] = 99;
  40195. t[71] = 100;
  40196. t[72] = 101;
  40197. t[73] = 102;
  40198. t[74] = 103;
  40199. t[75] = 104;
  40200. t[76] = 105;
  40201. t[77] = 106;
  40202. t[78] = 107;
  40203. t[79] = 108;
  40204. t[80] = 109;
  40205. t[81] = 110;
  40206. t[82] = 111;
  40207. t[83] = 112;
  40208. t[84] = 113;
  40209. t[85] = 114;
  40210. t[86] = 115;
  40211. t[87] = 116;
  40212. t[88] = 117;
  40213. t[89] = 118;
  40214. t[90] = 119;
  40215. t[91] = 120;
  40216. t[92] = 121;
  40217. t[93] = 122;
  40218. t[94] = 123;
  40219. t[95] = 124;
  40220. t[96] = 125;
  40221. t[97] = 126;
  40222. t[98] = 196;
  40223. t[99] = 197;
  40224. t[100] = 199;
  40225. t[101] = 201;
  40226. t[102] = 209;
  40227. t[103] = 214;
  40228. t[104] = 220;
  40229. t[105] = 225;
  40230. t[106] = 224;
  40231. t[107] = 226;
  40232. t[108] = 228;
  40233. t[109] = 227;
  40234. t[110] = 229;
  40235. t[111] = 231;
  40236. t[112] = 233;
  40237. t[113] = 232;
  40238. t[114] = 234;
  40239. t[115] = 235;
  40240. t[116] = 237;
  40241. t[117] = 236;
  40242. t[118] = 238;
  40243. t[119] = 239;
  40244. t[120] = 241;
  40245. t[121] = 243;
  40246. t[122] = 242;
  40247. t[123] = 244;
  40248. t[124] = 246;
  40249. t[125] = 245;
  40250. t[126] = 250;
  40251. t[127] = 249;
  40252. t[128] = 251;
  40253. t[129] = 252;
  40254. t[130] = 8224;
  40255. t[131] = 176;
  40256. t[132] = 162;
  40257. t[133] = 163;
  40258. t[134] = 167;
  40259. t[135] = 8226;
  40260. t[136] = 182;
  40261. t[137] = 223;
  40262. t[138] = 174;
  40263. t[139] = 169;
  40264. t[140] = 8482;
  40265. t[141] = 180;
  40266. t[142] = 168;
  40267. t[143] = 8800;
  40268. t[144] = 198;
  40269. t[145] = 216;
  40270. t[146] = 8734;
  40271. t[147] = 177;
  40272. t[148] = 8804;
  40273. t[149] = 8805;
  40274. t[150] = 165;
  40275. t[151] = 181;
  40276. t[152] = 8706;
  40277. t[153] = 8721;
  40278. t[154] = 8719;
  40279. t[156] = 8747;
  40280. t[157] = 170;
  40281. t[158] = 186;
  40282. t[159] = 8486;
  40283. t[160] = 230;
  40284. t[161] = 248;
  40285. t[162] = 191;
  40286. t[163] = 161;
  40287. t[164] = 172;
  40288. t[165] = 8730;
  40289. t[166] = 402;
  40290. t[167] = 8776;
  40291. t[168] = 8710;
  40292. t[169] = 171;
  40293. t[170] = 187;
  40294. t[171] = 8230;
  40295. t[200] = 193;
  40296. t[203] = 205;
  40297. t[210] = 218;
  40298. t[223] = 711;
  40299. t[224] = 321;
  40300. t[225] = 322;
  40301. t[226] = 352;
  40302. t[227] = 353;
  40303. t[228] = 381;
  40304. t[229] = 382;
  40305. t[233] = 221;
  40306. t[234] = 253;
  40307. t[252] = 263;
  40308. t[253] = 268;
  40309. t[254] = 269;
  40310. t[258] = 258;
  40311. t[260] = 260;
  40312. t[261] = 261;
  40313. t[265] = 280;
  40314. t[266] = 281;
  40315. t[267] = 282;
  40316. t[268] = 283;
  40317. t[269] = 313;
  40318. t[275] = 323;
  40319. t[276] = 324;
  40320. t[278] = 328;
  40321. t[283] = 344;
  40322. t[284] = 345;
  40323. t[285] = 346;
  40324. t[286] = 347;
  40325. t[292] = 367;
  40326. t[295] = 377;
  40327. t[296] = 378;
  40328. t[298] = 380;
  40329. t[305] = 963;
  40330. t[306] = 964;
  40331. t[307] = 966;
  40332. t[308] = 8215;
  40333. t[309] = 8252;
  40334. t[310] = 8319;
  40335. t[311] = 8359;
  40336. t[312] = 8592;
  40337. t[313] = 8593;
  40338. t[337] = 9552;
  40339. t[493] = 1039;
  40340. t[494] = 1040;
  40341. t[672] = 1488;
  40342. t[673] = 1489;
  40343. t[674] = 1490;
  40344. t[675] = 1491;
  40345. t[676] = 1492;
  40346. t[677] = 1493;
  40347. t[678] = 1494;
  40348. t[679] = 1495;
  40349. t[680] = 1496;
  40350. t[681] = 1497;
  40351. t[682] = 1498;
  40352. t[683] = 1499;
  40353. t[684] = 1500;
  40354. t[685] = 1501;
  40355. t[686] = 1502;
  40356. t[687] = 1503;
  40357. t[688] = 1504;
  40358. t[689] = 1505;
  40359. t[690] = 1506;
  40360. t[691] = 1507;
  40361. t[692] = 1508;
  40362. t[693] = 1509;
  40363. t[694] = 1510;
  40364. t[695] = 1511;
  40365. t[696] = 1512;
  40366. t[697] = 1513;
  40367. t[698] = 1514;
  40368. t[705] = 1524;
  40369. t[706] = 8362;
  40370. t[710] = 64288;
  40371. t[711] = 64298;
  40372. t[759] = 1617;
  40373. t[761] = 1776;
  40374. t[763] = 1778;
  40375. t[775] = 1652;
  40376. t[777] = 1764;
  40377. t[778] = 1780;
  40378. t[779] = 1781;
  40379. t[780] = 1782;
  40380. t[782] = 771;
  40381. t[783] = 64726;
  40382. t[786] = 8363;
  40383. t[788] = 8532;
  40384. t[790] = 768;
  40385. t[791] = 769;
  40386. t[792] = 768;
  40387. t[795] = 803;
  40388. t[797] = 64336;
  40389. t[798] = 64337;
  40390. t[799] = 64342;
  40391. t[800] = 64343;
  40392. t[801] = 64344;
  40393. t[802] = 64345;
  40394. t[803] = 64362;
  40395. t[804] = 64363;
  40396. t[805] = 64364;
  40397. t[2424] = 7821;
  40398. t[2425] = 7822;
  40399. t[2426] = 7823;
  40400. t[2427] = 7824;
  40401. t[2428] = 7825;
  40402. t[2429] = 7826;
  40403. t[2430] = 7827;
  40404. t[2433] = 7682;
  40405. t[2678] = 8045;
  40406. t[2679] = 8046;
  40407. t[2830] = 1552;
  40408. t[2838] = 686;
  40409. t[2840] = 751;
  40410. t[2842] = 753;
  40411. t[2843] = 754;
  40412. t[2844] = 755;
  40413. t[2846] = 757;
  40414. t[2856] = 767;
  40415. t[2857] = 848;
  40416. t[2858] = 849;
  40417. t[2862] = 853;
  40418. t[2863] = 854;
  40419. t[2864] = 855;
  40420. t[2865] = 861;
  40421. t[2866] = 862;
  40422. t[2906] = 7460;
  40423. t[2908] = 7462;
  40424. t[2909] = 7463;
  40425. t[2910] = 7464;
  40426. t[2912] = 7466;
  40427. t[2913] = 7467;
  40428. t[2914] = 7468;
  40429. t[2916] = 7470;
  40430. t[2917] = 7471;
  40431. t[2918] = 7472;
  40432. t[2920] = 7474;
  40433. t[2921] = 7475;
  40434. t[2922] = 7476;
  40435. t[2924] = 7478;
  40436. t[2925] = 7479;
  40437. t[2926] = 7480;
  40438. t[2928] = 7482;
  40439. t[2929] = 7483;
  40440. t[2930] = 7484;
  40441. t[2932] = 7486;
  40442. t[2933] = 7487;
  40443. t[2934] = 7488;
  40444. t[2936] = 7490;
  40445. t[2937] = 7491;
  40446. t[2938] = 7492;
  40447. t[2940] = 7494;
  40448. t[2941] = 7495;
  40449. t[2942] = 7496;
  40450. t[2944] = 7498;
  40451. t[2946] = 7500;
  40452. t[2948] = 7502;
  40453. t[2950] = 7504;
  40454. t[2951] = 7505;
  40455. t[2952] = 7506;
  40456. t[2954] = 7508;
  40457. t[2955] = 7509;
  40458. t[2956] = 7510;
  40459. t[2958] = 7512;
  40460. t[2959] = 7513;
  40461. t[2960] = 7514;
  40462. t[2962] = 7516;
  40463. t[2963] = 7517;
  40464. t[2964] = 7518;
  40465. t[2966] = 7520;
  40466. t[2967] = 7521;
  40467. t[2968] = 7522;
  40468. t[2970] = 7524;
  40469. t[2971] = 7525;
  40470. t[2972] = 7526;
  40471. t[2974] = 7528;
  40472. t[2975] = 7529;
  40473. t[2976] = 7530;
  40474. t[2978] = 1537;
  40475. t[2979] = 1538;
  40476. t[2980] = 1539;
  40477. t[2982] = 1549;
  40478. t[2983] = 1551;
  40479. t[2984] = 1552;
  40480. t[2986] = 1554;
  40481. t[2987] = 1555;
  40482. t[2988] = 1556;
  40483. t[2990] = 1623;
  40484. t[2991] = 1624;
  40485. t[2995] = 1775;
  40486. t[2999] = 1791;
  40487. t[3002] = 64290;
  40488. t[3003] = 64291;
  40489. t[3004] = 64292;
  40490. t[3006] = 64294;
  40491. t[3007] = 64295;
  40492. t[3008] = 64296;
  40493. t[3011] = 1900;
  40494. t[3014] = 8223;
  40495. t[3015] = 8244;
  40496. t[3017] = 7532;
  40497. t[3018] = 7533;
  40498. t[3019] = 7534;
  40499. t[3075] = 7590;
  40500. t[3076] = 7591;
  40501. t[3079] = 7594;
  40502. t[3080] = 7595;
  40503. t[3083] = 7598;
  40504. t[3084] = 7599;
  40505. t[3087] = 7602;
  40506. t[3088] = 7603;
  40507. t[3091] = 7606;
  40508. t[3092] = 7607;
  40509. t[3095] = 7610;
  40510. t[3096] = 7611;
  40511. t[3099] = 7614;
  40512. t[3100] = 7615;
  40513. t[3103] = 7618;
  40514. t[3104] = 7619;
  40515. t[3107] = 8337;
  40516. t[3108] = 8338;
  40517. t[3116] = 1884;
  40518. t[3119] = 1885;
  40519. t[3120] = 1885;
  40520. t[3123] = 1886;
  40521. t[3124] = 1886;
  40522. t[3127] = 1887;
  40523. t[3128] = 1887;
  40524. t[3131] = 1888;
  40525. t[3132] = 1888;
  40526. t[3135] = 1889;
  40527. t[3136] = 1889;
  40528. t[3139] = 1890;
  40529. t[3140] = 1890;
  40530. t[3143] = 1891;
  40531. t[3144] = 1891;
  40532. t[3147] = 1892;
  40533. t[3148] = 1892;
  40534. t[3153] = 580;
  40535. t[3154] = 581;
  40536. t[3157] = 584;
  40537. t[3158] = 585;
  40538. t[3161] = 588;
  40539. t[3162] = 589;
  40540. t[3165] = 891;
  40541. t[3166] = 892;
  40542. t[3169] = 1274;
  40543. t[3170] = 1275;
  40544. t[3173] = 1278;
  40545. t[3174] = 1279;
  40546. t[3181] = 7622;
  40547. t[3182] = 7623;
  40548. t[3282] = 11799;
  40549. t[3316] = 578;
  40550. t[3379] = 42785;
  40551. t[3393] = 1159;
  40552. t[3416] = 8377;
  40553. });
  40554. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  40555. const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
  40556. t[227] = 322;
  40557. t[264] = 261;
  40558. t[291] = 346;
  40559. });
  40560. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  40561. const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
  40562. t[1] = 32;
  40563. t[4] = 65;
  40564. t[6] = 193;
  40565. t[17] = 66;
  40566. t[18] = 67;
  40567. t[21] = 268;
  40568. t[24] = 68;
  40569. t[28] = 69;
  40570. t[30] = 201;
  40571. t[32] = 282;
  40572. t[38] = 70;
  40573. t[39] = 71;
  40574. t[44] = 72;
  40575. t[47] = 73;
  40576. t[49] = 205;
  40577. t[58] = 74;
  40578. t[60] = 75;
  40579. t[62] = 76;
  40580. t[68] = 77;
  40581. t[69] = 78;
  40582. t[75] = 79;
  40583. t[87] = 80;
  40584. t[89] = 81;
  40585. t[90] = 82;
  40586. t[92] = 344;
  40587. t[94] = 83;
  40588. t[97] = 352;
  40589. t[100] = 84;
  40590. t[104] = 85;
  40591. t[115] = 86;
  40592. t[116] = 87;
  40593. t[121] = 88;
  40594. t[122] = 89;
  40595. t[124] = 221;
  40596. t[127] = 90;
  40597. t[129] = 381;
  40598. t[258] = 97;
  40599. t[260] = 225;
  40600. t[268] = 261;
  40601. t[271] = 98;
  40602. t[272] = 99;
  40603. t[273] = 263;
  40604. t[275] = 269;
  40605. t[282] = 100;
  40606. t[286] = 101;
  40607. t[288] = 233;
  40608. t[290] = 283;
  40609. t[295] = 281;
  40610. t[296] = 102;
  40611. t[336] = 103;
  40612. t[346] = 104;
  40613. t[349] = 105;
  40614. t[351] = 237;
  40615. t[361] = 106;
  40616. t[364] = 107;
  40617. t[367] = 108;
  40618. t[371] = 322;
  40619. t[373] = 109;
  40620. t[374] = 110;
  40621. t[381] = 111;
  40622. t[383] = 243;
  40623. t[393] = 112;
  40624. t[395] = 113;
  40625. t[396] = 114;
  40626. t[398] = 345;
  40627. t[400] = 115;
  40628. t[401] = 347;
  40629. t[403] = 353;
  40630. t[410] = 116;
  40631. t[437] = 117;
  40632. t[448] = 118;
  40633. t[449] = 119;
  40634. t[454] = 120;
  40635. t[455] = 121;
  40636. t[457] = 253;
  40637. t[460] = 122;
  40638. t[462] = 382;
  40639. t[463] = 380;
  40640. t[853] = 44;
  40641. t[855] = 58;
  40642. t[856] = 46;
  40643. t[876] = 47;
  40644. t[878] = 45;
  40645. t[882] = 45;
  40646. t[894] = 40;
  40647. t[895] = 41;
  40648. t[896] = 91;
  40649. t[897] = 93;
  40650. t[923] = 64;
  40651. t[1004] = 48;
  40652. t[1005] = 49;
  40653. t[1006] = 50;
  40654. t[1007] = 51;
  40655. t[1008] = 52;
  40656. t[1009] = 53;
  40657. t[1010] = 54;
  40658. t[1011] = 55;
  40659. t[1012] = 56;
  40660. t[1013] = 57;
  40661. t[1081] = 37;
  40662. t[1085] = 43;
  40663. t[1086] = 45;
  40664. });
  40665. exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
  40666. function getStandardFontName(name) {
  40667. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  40668. const stdFontMap = getStdFontMap();
  40669. return stdFontMap[fontName];
  40670. }
  40671. /***/ }),
  40672. /* 167 */
  40673. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  40674. "use strict";
  40675. Object.defineProperty(exports, "__esModule", ({
  40676. value: true
  40677. }));
  40678. exports.ToUnicodeMap = exports.IdentityToUnicodeMap = void 0;
  40679. var _util = __w_pdfjs_require__(2);
  40680. class ToUnicodeMap {
  40681. constructor() {
  40682. let cmap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  40683. this._map = cmap;
  40684. }
  40685. get length() {
  40686. return this._map.length;
  40687. }
  40688. forEach(callback) {
  40689. for (const charCode in this._map) {
  40690. callback(charCode, this._map[charCode].charCodeAt(0));
  40691. }
  40692. }
  40693. has(i) {
  40694. return this._map[i] !== undefined;
  40695. }
  40696. get(i) {
  40697. return this._map[i];
  40698. }
  40699. charCodeOf(value) {
  40700. const map = this._map;
  40701. if (map.length <= 0x10000) {
  40702. return map.indexOf(value);
  40703. }
  40704. for (const charCode in map) {
  40705. if (map[charCode] === value) {
  40706. return charCode | 0;
  40707. }
  40708. }
  40709. return -1;
  40710. }
  40711. amend(map) {
  40712. for (const charCode in map) {
  40713. this._map[charCode] = map[charCode];
  40714. }
  40715. }
  40716. }
  40717. exports.ToUnicodeMap = ToUnicodeMap;
  40718. class IdentityToUnicodeMap {
  40719. constructor(firstChar, lastChar) {
  40720. this.firstChar = firstChar;
  40721. this.lastChar = lastChar;
  40722. }
  40723. get length() {
  40724. return this.lastChar + 1 - this.firstChar;
  40725. }
  40726. forEach(callback) {
  40727. for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  40728. callback(i, i);
  40729. }
  40730. }
  40731. has(i) {
  40732. return this.firstChar <= i && i <= this.lastChar;
  40733. }
  40734. get(i) {
  40735. if (this.firstChar <= i && i <= this.lastChar) {
  40736. return String.fromCharCode(i);
  40737. }
  40738. return undefined;
  40739. }
  40740. charCodeOf(v) {
  40741. return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  40742. }
  40743. amend(map) {
  40744. (0, _util.unreachable)("Should not call amend()");
  40745. }
  40746. }
  40747. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  40748. /***/ }),
  40749. /* 168 */
  40750. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  40751. "use strict";
  40752. Object.defineProperty(exports, "__esModule", ({
  40753. value: true
  40754. }));
  40755. exports.CFFFont = void 0;
  40756. var _cff_parser = __w_pdfjs_require__(160);
  40757. var _fonts_utils = __w_pdfjs_require__(163);
  40758. var _util = __w_pdfjs_require__(2);
  40759. class CFFFont {
  40760. constructor(file, properties) {
  40761. this.properties = properties;
  40762. const parser = new _cff_parser.CFFParser(file, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  40763. this.cff = parser.parse();
  40764. this.cff.duplicateFirstGlyph();
  40765. const compiler = new _cff_parser.CFFCompiler(this.cff);
  40766. this.seacs = this.cff.seacs;
  40767. try {
  40768. this.data = compiler.compile();
  40769. } catch (e) {
  40770. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  40771. this.data = file;
  40772. }
  40773. this._createBuiltInEncoding();
  40774. }
  40775. get numGlyphs() {
  40776. return this.cff.charStrings.count;
  40777. }
  40778. getCharset() {
  40779. return this.cff.charset.charset;
  40780. }
  40781. getGlyphMapping() {
  40782. const cff = this.cff;
  40783. const properties = this.properties;
  40784. const charsets = cff.charset.charset;
  40785. let charCodeToGlyphId;
  40786. let glyphId;
  40787. if (properties.composite) {
  40788. charCodeToGlyphId = Object.create(null);
  40789. let charCode;
  40790. if (cff.isCIDFont) {
  40791. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  40792. const cid = charsets[glyphId];
  40793. charCode = properties.cMap.charCodeOf(cid);
  40794. charCodeToGlyphId[charCode] = glyphId;
  40795. }
  40796. } else {
  40797. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  40798. charCode = properties.cMap.charCodeOf(glyphId);
  40799. charCodeToGlyphId[charCode] = glyphId;
  40800. }
  40801. }
  40802. return charCodeToGlyphId;
  40803. }
  40804. let encoding = cff.encoding ? cff.encoding.encoding : null;
  40805. if (properties.isInternalFont) {
  40806. encoding = properties.defaultEncoding;
  40807. }
  40808. charCodeToGlyphId = (0, _fonts_utils.type1FontGlyphMapping)(properties, encoding, charsets);
  40809. return charCodeToGlyphId;
  40810. }
  40811. hasGlyphId(id) {
  40812. return this.cff.hasGlyphId(id);
  40813. }
  40814. _createBuiltInEncoding() {
  40815. const {
  40816. charset,
  40817. encoding
  40818. } = this.cff;
  40819. if (!charset || !encoding) {
  40820. return;
  40821. }
  40822. const charsets = charset.charset,
  40823. encodings = encoding.encoding;
  40824. const map = [];
  40825. for (const charCode in encodings) {
  40826. const glyphId = encodings[charCode];
  40827. if (glyphId >= 0) {
  40828. const glyphName = charsets[glyphId];
  40829. if (glyphName) {
  40830. map[charCode] = glyphName;
  40831. }
  40832. }
  40833. }
  40834. if (map.length > 0) {
  40835. this.properties.builtInEncoding = map;
  40836. }
  40837. }
  40838. }
  40839. exports.CFFFont = CFFFont;
  40840. /***/ }),
  40841. /* 169 */
  40842. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  40843. "use strict";
  40844. Object.defineProperty(exports, "__esModule", ({
  40845. value: true
  40846. }));
  40847. exports.FontRendererFactory = void 0;
  40848. var _util = __w_pdfjs_require__(2);
  40849. var _cff_parser = __w_pdfjs_require__(160);
  40850. var _glyphlist = __w_pdfjs_require__(164);
  40851. var _encodings = __w_pdfjs_require__(162);
  40852. var _stream = __w_pdfjs_require__(135);
  40853. function getUint32(data, offset) {
  40854. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  40855. }
  40856. function getUint16(data, offset) {
  40857. return data[offset] << 8 | data[offset + 1];
  40858. }
  40859. function getInt16(data, offset) {
  40860. return (data[offset] << 24 | data[offset + 1] << 16) >> 16;
  40861. }
  40862. function getInt8(data, offset) {
  40863. return data[offset] << 24 >> 24;
  40864. }
  40865. function getFloat214(data, offset) {
  40866. return getInt16(data, offset) / 16384;
  40867. }
  40868. function getSubroutineBias(subrs) {
  40869. const numSubrs = subrs.length;
  40870. let bias = 32768;
  40871. if (numSubrs < 1240) {
  40872. bias = 107;
  40873. } else if (numSubrs < 33900) {
  40874. bias = 1131;
  40875. }
  40876. return bias;
  40877. }
  40878. function parseCmap(data, start, end) {
  40879. const offset = getUint16(data, start + 2) === 1 ? getUint32(data, start + 8) : getUint32(data, start + 16);
  40880. const format = getUint16(data, start + offset);
  40881. let ranges, p, i;
  40882. if (format === 4) {
  40883. getUint16(data, start + offset + 2);
  40884. const segCount = getUint16(data, start + offset + 6) >> 1;
  40885. p = start + offset + 14;
  40886. ranges = [];
  40887. for (i = 0; i < segCount; i++, p += 2) {
  40888. ranges[i] = {
  40889. end: getUint16(data, p)
  40890. };
  40891. }
  40892. p += 2;
  40893. for (i = 0; i < segCount; i++, p += 2) {
  40894. ranges[i].start = getUint16(data, p);
  40895. }
  40896. for (i = 0; i < segCount; i++, p += 2) {
  40897. ranges[i].idDelta = getUint16(data, p);
  40898. }
  40899. for (i = 0; i < segCount; i++, p += 2) {
  40900. let idOffset = getUint16(data, p);
  40901. if (idOffset === 0) {
  40902. continue;
  40903. }
  40904. ranges[i].ids = [];
  40905. for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  40906. ranges[i].ids[j] = getUint16(data, p + idOffset);
  40907. idOffset += 2;
  40908. }
  40909. }
  40910. return ranges;
  40911. } else if (format === 12) {
  40912. const groups = getUint32(data, start + offset + 12);
  40913. p = start + offset + 16;
  40914. ranges = [];
  40915. for (i = 0; i < groups; i++) {
  40916. start = getUint32(data, p);
  40917. ranges.push({
  40918. start,
  40919. end: getUint32(data, p + 4),
  40920. idDelta: getUint32(data, p + 8) - start
  40921. });
  40922. p += 12;
  40923. }
  40924. return ranges;
  40925. }
  40926. throw new _util.FormatError(`unsupported cmap: ${format}`);
  40927. }
  40928. function parseCff(data, start, end, seacAnalysisEnabled) {
  40929. const properties = {};
  40930. const parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
  40931. const cff = parser.parse();
  40932. return {
  40933. glyphs: cff.charStrings.objects,
  40934. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  40935. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
  40936. isCFFCIDFont: cff.isCIDFont,
  40937. fdSelect: cff.fdSelect,
  40938. fdArray: cff.fdArray
  40939. };
  40940. }
  40941. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  40942. let itemSize, itemDecode;
  40943. if (isGlyphLocationsLong) {
  40944. itemSize = 4;
  40945. itemDecode = getUint32;
  40946. } else {
  40947. itemSize = 2;
  40948. itemDecode = (data, offset) => 2 * getUint16(data, offset);
  40949. }
  40950. const glyphs = [];
  40951. let startOffset = itemDecode(loca, 0);
  40952. for (let j = itemSize; j < loca.length; j += itemSize) {
  40953. const endOffset = itemDecode(loca, j);
  40954. glyphs.push(glyf.subarray(startOffset, endOffset));
  40955. startOffset = endOffset;
  40956. }
  40957. return glyphs;
  40958. }
  40959. function lookupCmap(ranges, unicode) {
  40960. const code = unicode.codePointAt(0);
  40961. let gid = 0,
  40962. l = 0,
  40963. r = ranges.length - 1;
  40964. while (l < r) {
  40965. const c = l + r + 1 >> 1;
  40966. if (code < ranges[c].start) {
  40967. r = c - 1;
  40968. } else {
  40969. l = c;
  40970. }
  40971. }
  40972. if (ranges[l].start <= code && code <= ranges[l].end) {
  40973. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
  40974. }
  40975. return {
  40976. charCode: code,
  40977. glyphId: gid
  40978. };
  40979. }
  40980. function compileGlyf(code, cmds, font) {
  40981. function moveTo(x, y) {
  40982. cmds.push({
  40983. cmd: "moveTo",
  40984. args: [x, y]
  40985. });
  40986. }
  40987. function lineTo(x, y) {
  40988. cmds.push({
  40989. cmd: "lineTo",
  40990. args: [x, y]
  40991. });
  40992. }
  40993. function quadraticCurveTo(xa, ya, x, y) {
  40994. cmds.push({
  40995. cmd: "quadraticCurveTo",
  40996. args: [xa, ya, x, y]
  40997. });
  40998. }
  40999. let i = 0;
  41000. const numberOfContours = getInt16(code, i);
  41001. let flags;
  41002. let x = 0,
  41003. y = 0;
  41004. i += 10;
  41005. if (numberOfContours < 0) {
  41006. do {
  41007. flags = getUint16(code, i);
  41008. const glyphIndex = getUint16(code, i + 2);
  41009. i += 4;
  41010. let arg1, arg2;
  41011. if (flags & 0x01) {
  41012. if (flags & 0x02) {
  41013. arg1 = getInt16(code, i);
  41014. arg2 = getInt16(code, i + 2);
  41015. } else {
  41016. arg1 = getUint16(code, i);
  41017. arg2 = getUint16(code, i + 2);
  41018. }
  41019. i += 4;
  41020. } else {
  41021. if (flags & 0x02) {
  41022. arg1 = getInt8(code, i++);
  41023. arg2 = getInt8(code, i++);
  41024. } else {
  41025. arg1 = code[i++];
  41026. arg2 = code[i++];
  41027. }
  41028. }
  41029. if (flags & 0x02) {
  41030. x = arg1;
  41031. y = arg2;
  41032. } else {
  41033. x = 0;
  41034. y = 0;
  41035. }
  41036. let scaleX = 1,
  41037. scaleY = 1,
  41038. scale01 = 0,
  41039. scale10 = 0;
  41040. if (flags & 0x08) {
  41041. scaleX = scaleY = getFloat214(code, i);
  41042. i += 2;
  41043. } else if (flags & 0x40) {
  41044. scaleX = getFloat214(code, i);
  41045. scaleY = getFloat214(code, i + 2);
  41046. i += 4;
  41047. } else if (flags & 0x80) {
  41048. scaleX = getFloat214(code, i);
  41049. scale01 = getFloat214(code, i + 2);
  41050. scale10 = getFloat214(code, i + 4);
  41051. scaleY = getFloat214(code, i + 6);
  41052. i += 8;
  41053. }
  41054. const subglyph = font.glyphs[glyphIndex];
  41055. if (subglyph) {
  41056. cmds.push({
  41057. cmd: "save"
  41058. }, {
  41059. cmd: "transform",
  41060. args: [scaleX, scale01, scale10, scaleY, x, y]
  41061. });
  41062. if (!(flags & 0x02)) {}
  41063. compileGlyf(subglyph, cmds, font);
  41064. cmds.push({
  41065. cmd: "restore"
  41066. });
  41067. }
  41068. } while (flags & 0x20);
  41069. } else {
  41070. const endPtsOfContours = [];
  41071. let j, jj;
  41072. for (j = 0; j < numberOfContours; j++) {
  41073. endPtsOfContours.push(getUint16(code, i));
  41074. i += 2;
  41075. }
  41076. const instructionLength = getUint16(code, i);
  41077. i += 2 + instructionLength;
  41078. const numberOfPoints = endPtsOfContours.at(-1) + 1;
  41079. const points = [];
  41080. while (points.length < numberOfPoints) {
  41081. flags = code[i++];
  41082. let repeat = 1;
  41083. if (flags & 0x08) {
  41084. repeat += code[i++];
  41085. }
  41086. while (repeat-- > 0) {
  41087. points.push({
  41088. flags
  41089. });
  41090. }
  41091. }
  41092. for (j = 0; j < numberOfPoints; j++) {
  41093. switch (points[j].flags & 0x12) {
  41094. case 0x00:
  41095. x += getInt16(code, i);
  41096. i += 2;
  41097. break;
  41098. case 0x02:
  41099. x -= code[i++];
  41100. break;
  41101. case 0x12:
  41102. x += code[i++];
  41103. break;
  41104. }
  41105. points[j].x = x;
  41106. }
  41107. for (j = 0; j < numberOfPoints; j++) {
  41108. switch (points[j].flags & 0x24) {
  41109. case 0x00:
  41110. y += getInt16(code, i);
  41111. i += 2;
  41112. break;
  41113. case 0x04:
  41114. y -= code[i++];
  41115. break;
  41116. case 0x24:
  41117. y += code[i++];
  41118. break;
  41119. }
  41120. points[j].y = y;
  41121. }
  41122. let startPoint = 0;
  41123. for (i = 0; i < numberOfContours; i++) {
  41124. const endPoint = endPtsOfContours[i];
  41125. const contour = points.slice(startPoint, endPoint + 1);
  41126. if (contour[0].flags & 1) {
  41127. contour.push(contour[0]);
  41128. } else if (contour.at(-1).flags & 1) {
  41129. contour.unshift(contour.at(-1));
  41130. } else {
  41131. const p = {
  41132. flags: 1,
  41133. x: (contour[0].x + contour.at(-1).x) / 2,
  41134. y: (contour[0].y + contour.at(-1).y) / 2
  41135. };
  41136. contour.unshift(p);
  41137. contour.push(p);
  41138. }
  41139. moveTo(contour[0].x, contour[0].y);
  41140. for (j = 1, jj = contour.length; j < jj; j++) {
  41141. if (contour[j].flags & 1) {
  41142. lineTo(contour[j].x, contour[j].y);
  41143. } else if (contour[j + 1].flags & 1) {
  41144. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  41145. j++;
  41146. } else {
  41147. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  41148. }
  41149. }
  41150. startPoint = endPoint + 1;
  41151. }
  41152. }
  41153. }
  41154. function compileCharString(charStringCode, cmds, font, glyphId) {
  41155. function moveTo(x, y) {
  41156. cmds.push({
  41157. cmd: "moveTo",
  41158. args: [x, y]
  41159. });
  41160. }
  41161. function lineTo(x, y) {
  41162. cmds.push({
  41163. cmd: "lineTo",
  41164. args: [x, y]
  41165. });
  41166. }
  41167. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  41168. cmds.push({
  41169. cmd: "bezierCurveTo",
  41170. args: [x1, y1, x2, y2, x, y]
  41171. });
  41172. }
  41173. const stack = [];
  41174. let x = 0,
  41175. y = 0;
  41176. let stems = 0;
  41177. function parse(code) {
  41178. let i = 0;
  41179. while (i < code.length) {
  41180. let stackClean = false;
  41181. let v = code[i++];
  41182. let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  41183. switch (v) {
  41184. case 1:
  41185. stems += stack.length >> 1;
  41186. stackClean = true;
  41187. break;
  41188. case 3:
  41189. stems += stack.length >> 1;
  41190. stackClean = true;
  41191. break;
  41192. case 4:
  41193. y += stack.pop();
  41194. moveTo(x, y);
  41195. stackClean = true;
  41196. break;
  41197. case 5:
  41198. while (stack.length > 0) {
  41199. x += stack.shift();
  41200. y += stack.shift();
  41201. lineTo(x, y);
  41202. }
  41203. break;
  41204. case 6:
  41205. while (stack.length > 0) {
  41206. x += stack.shift();
  41207. lineTo(x, y);
  41208. if (stack.length === 0) {
  41209. break;
  41210. }
  41211. y += stack.shift();
  41212. lineTo(x, y);
  41213. }
  41214. break;
  41215. case 7:
  41216. while (stack.length > 0) {
  41217. y += stack.shift();
  41218. lineTo(x, y);
  41219. if (stack.length === 0) {
  41220. break;
  41221. }
  41222. x += stack.shift();
  41223. lineTo(x, y);
  41224. }
  41225. break;
  41226. case 8:
  41227. while (stack.length > 0) {
  41228. xa = x + stack.shift();
  41229. ya = y + stack.shift();
  41230. xb = xa + stack.shift();
  41231. yb = ya + stack.shift();
  41232. x = xb + stack.shift();
  41233. y = yb + stack.shift();
  41234. bezierCurveTo(xa, ya, xb, yb, x, y);
  41235. }
  41236. break;
  41237. case 10:
  41238. n = stack.pop();
  41239. subrCode = null;
  41240. if (font.isCFFCIDFont) {
  41241. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  41242. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  41243. const fontDict = font.fdArray[fdIndex];
  41244. let subrs;
  41245. if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
  41246. subrs = fontDict.privateDict.subrsIndex.objects;
  41247. }
  41248. if (subrs) {
  41249. n += getSubroutineBias(subrs);
  41250. subrCode = subrs[n];
  41251. }
  41252. } else {
  41253. (0, _util.warn)("Invalid fd index for glyph index.");
  41254. }
  41255. } else {
  41256. subrCode = font.subrs[n + font.subrsBias];
  41257. }
  41258. if (subrCode) {
  41259. parse(subrCode);
  41260. }
  41261. break;
  41262. case 11:
  41263. return;
  41264. case 12:
  41265. v = code[i++];
  41266. switch (v) {
  41267. case 34:
  41268. xa = x + stack.shift();
  41269. xb = xa + stack.shift();
  41270. y1 = y + stack.shift();
  41271. x = xb + stack.shift();
  41272. bezierCurveTo(xa, y, xb, y1, x, y1);
  41273. xa = x + stack.shift();
  41274. xb = xa + stack.shift();
  41275. x = xb + stack.shift();
  41276. bezierCurveTo(xa, y1, xb, y, x, y);
  41277. break;
  41278. case 35:
  41279. xa = x + stack.shift();
  41280. ya = y + stack.shift();
  41281. xb = xa + stack.shift();
  41282. yb = ya + stack.shift();
  41283. x = xb + stack.shift();
  41284. y = yb + stack.shift();
  41285. bezierCurveTo(xa, ya, xb, yb, x, y);
  41286. xa = x + stack.shift();
  41287. ya = y + stack.shift();
  41288. xb = xa + stack.shift();
  41289. yb = ya + stack.shift();
  41290. x = xb + stack.shift();
  41291. y = yb + stack.shift();
  41292. bezierCurveTo(xa, ya, xb, yb, x, y);
  41293. stack.pop();
  41294. break;
  41295. case 36:
  41296. xa = x + stack.shift();
  41297. y1 = y + stack.shift();
  41298. xb = xa + stack.shift();
  41299. y2 = y1 + stack.shift();
  41300. x = xb + stack.shift();
  41301. bezierCurveTo(xa, y1, xb, y2, x, y2);
  41302. xa = x + stack.shift();
  41303. xb = xa + stack.shift();
  41304. y3 = y2 + stack.shift();
  41305. x = xb + stack.shift();
  41306. bezierCurveTo(xa, y2, xb, y3, x, y);
  41307. break;
  41308. case 37:
  41309. const x0 = x,
  41310. y0 = y;
  41311. xa = x + stack.shift();
  41312. ya = y + stack.shift();
  41313. xb = xa + stack.shift();
  41314. yb = ya + stack.shift();
  41315. x = xb + stack.shift();
  41316. y = yb + stack.shift();
  41317. bezierCurveTo(xa, ya, xb, yb, x, y);
  41318. xa = x + stack.shift();
  41319. ya = y + stack.shift();
  41320. xb = xa + stack.shift();
  41321. yb = ya + stack.shift();
  41322. x = xb;
  41323. y = yb;
  41324. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  41325. x += stack.shift();
  41326. } else {
  41327. y += stack.shift();
  41328. }
  41329. bezierCurveTo(xa, ya, xb, yb, x, y);
  41330. break;
  41331. default:
  41332. throw new _util.FormatError(`unknown operator: 12 ${v}`);
  41333. }
  41334. break;
  41335. case 14:
  41336. if (stack.length >= 4) {
  41337. const achar = stack.pop();
  41338. const bchar = stack.pop();
  41339. y = stack.pop();
  41340. x = stack.pop();
  41341. cmds.push({
  41342. cmd: "save"
  41343. }, {
  41344. cmd: "translate",
  41345. args: [x, y]
  41346. });
  41347. let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
  41348. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  41349. cmds.push({
  41350. cmd: "restore"
  41351. });
  41352. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
  41353. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  41354. }
  41355. return;
  41356. case 18:
  41357. stems += stack.length >> 1;
  41358. stackClean = true;
  41359. break;
  41360. case 19:
  41361. stems += stack.length >> 1;
  41362. i += stems + 7 >> 3;
  41363. stackClean = true;
  41364. break;
  41365. case 20:
  41366. stems += stack.length >> 1;
  41367. i += stems + 7 >> 3;
  41368. stackClean = true;
  41369. break;
  41370. case 21:
  41371. y += stack.pop();
  41372. x += stack.pop();
  41373. moveTo(x, y);
  41374. stackClean = true;
  41375. break;
  41376. case 22:
  41377. x += stack.pop();
  41378. moveTo(x, y);
  41379. stackClean = true;
  41380. break;
  41381. case 23:
  41382. stems += stack.length >> 1;
  41383. stackClean = true;
  41384. break;
  41385. case 24:
  41386. while (stack.length > 2) {
  41387. xa = x + stack.shift();
  41388. ya = y + stack.shift();
  41389. xb = xa + stack.shift();
  41390. yb = ya + stack.shift();
  41391. x = xb + stack.shift();
  41392. y = yb + stack.shift();
  41393. bezierCurveTo(xa, ya, xb, yb, x, y);
  41394. }
  41395. x += stack.shift();
  41396. y += stack.shift();
  41397. lineTo(x, y);
  41398. break;
  41399. case 25:
  41400. while (stack.length > 6) {
  41401. x += stack.shift();
  41402. y += stack.shift();
  41403. lineTo(x, y);
  41404. }
  41405. xa = x + stack.shift();
  41406. ya = y + stack.shift();
  41407. xb = xa + stack.shift();
  41408. yb = ya + stack.shift();
  41409. x = xb + stack.shift();
  41410. y = yb + stack.shift();
  41411. bezierCurveTo(xa, ya, xb, yb, x, y);
  41412. break;
  41413. case 26:
  41414. if (stack.length % 2) {
  41415. x += stack.shift();
  41416. }
  41417. while (stack.length > 0) {
  41418. xa = x;
  41419. ya = y + stack.shift();
  41420. xb = xa + stack.shift();
  41421. yb = ya + stack.shift();
  41422. x = xb;
  41423. y = yb + stack.shift();
  41424. bezierCurveTo(xa, ya, xb, yb, x, y);
  41425. }
  41426. break;
  41427. case 27:
  41428. if (stack.length % 2) {
  41429. y += stack.shift();
  41430. }
  41431. while (stack.length > 0) {
  41432. xa = x + stack.shift();
  41433. ya = y;
  41434. xb = xa + stack.shift();
  41435. yb = ya + stack.shift();
  41436. x = xb + stack.shift();
  41437. y = yb;
  41438. bezierCurveTo(xa, ya, xb, yb, x, y);
  41439. }
  41440. break;
  41441. case 28:
  41442. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  41443. i += 2;
  41444. break;
  41445. case 29:
  41446. n = stack.pop() + font.gsubrsBias;
  41447. subrCode = font.gsubrs[n];
  41448. if (subrCode) {
  41449. parse(subrCode);
  41450. }
  41451. break;
  41452. case 30:
  41453. while (stack.length > 0) {
  41454. xa = x;
  41455. ya = y + stack.shift();
  41456. xb = xa + stack.shift();
  41457. yb = ya + stack.shift();
  41458. x = xb + stack.shift();
  41459. y = yb + (stack.length === 1 ? stack.shift() : 0);
  41460. bezierCurveTo(xa, ya, xb, yb, x, y);
  41461. if (stack.length === 0) {
  41462. break;
  41463. }
  41464. xa = x + stack.shift();
  41465. ya = y;
  41466. xb = xa + stack.shift();
  41467. yb = ya + stack.shift();
  41468. y = yb + stack.shift();
  41469. x = xb + (stack.length === 1 ? stack.shift() : 0);
  41470. bezierCurveTo(xa, ya, xb, yb, x, y);
  41471. }
  41472. break;
  41473. case 31:
  41474. while (stack.length > 0) {
  41475. xa = x + stack.shift();
  41476. ya = y;
  41477. xb = xa + stack.shift();
  41478. yb = ya + stack.shift();
  41479. y = yb + stack.shift();
  41480. x = xb + (stack.length === 1 ? stack.shift() : 0);
  41481. bezierCurveTo(xa, ya, xb, yb, x, y);
  41482. if (stack.length === 0) {
  41483. break;
  41484. }
  41485. xa = x;
  41486. ya = y + stack.shift();
  41487. xb = xa + stack.shift();
  41488. yb = ya + stack.shift();
  41489. x = xb + stack.shift();
  41490. y = yb + (stack.length === 1 ? stack.shift() : 0);
  41491. bezierCurveTo(xa, ya, xb, yb, x, y);
  41492. }
  41493. break;
  41494. default:
  41495. if (v < 32) {
  41496. throw new _util.FormatError(`unknown operator: ${v}`);
  41497. }
  41498. if (v < 247) {
  41499. stack.push(v - 139);
  41500. } else if (v < 251) {
  41501. stack.push((v - 247) * 256 + code[i++] + 108);
  41502. } else if (v < 255) {
  41503. stack.push(-(v - 251) * 256 - code[i++] - 108);
  41504. } else {
  41505. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  41506. i += 4;
  41507. }
  41508. break;
  41509. }
  41510. if (stackClean) {
  41511. stack.length = 0;
  41512. }
  41513. }
  41514. }
  41515. parse(charStringCode);
  41516. }
  41517. const NOOP = [];
  41518. class CompiledFont {
  41519. constructor(fontMatrix) {
  41520. if (this.constructor === CompiledFont) {
  41521. (0, _util.unreachable)("Cannot initialize CompiledFont.");
  41522. }
  41523. this.fontMatrix = fontMatrix;
  41524. this.compiledGlyphs = Object.create(null);
  41525. this.compiledCharCodeToGlyphId = Object.create(null);
  41526. }
  41527. getPathJs(unicode) {
  41528. const {
  41529. charCode,
  41530. glyphId
  41531. } = lookupCmap(this.cmap, unicode);
  41532. let fn = this.compiledGlyphs[glyphId];
  41533. if (!fn) {
  41534. try {
  41535. fn = this.compileGlyph(this.glyphs[glyphId], glyphId);
  41536. this.compiledGlyphs[glyphId] = fn;
  41537. } catch (ex) {
  41538. this.compiledGlyphs[glyphId] = NOOP;
  41539. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  41540. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  41541. }
  41542. throw ex;
  41543. }
  41544. }
  41545. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  41546. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  41547. }
  41548. return fn;
  41549. }
  41550. compileGlyph(code, glyphId) {
  41551. if (!code || code.length === 0 || code[0] === 14) {
  41552. return NOOP;
  41553. }
  41554. let fontMatrix = this.fontMatrix;
  41555. if (this.isCFFCIDFont) {
  41556. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  41557. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  41558. const fontDict = this.fdArray[fdIndex];
  41559. fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
  41560. } else {
  41561. (0, _util.warn)("Invalid fd index for glyph index.");
  41562. }
  41563. }
  41564. const cmds = [{
  41565. cmd: "save"
  41566. }, {
  41567. cmd: "transform",
  41568. args: fontMatrix.slice()
  41569. }, {
  41570. cmd: "scale",
  41571. args: ["size", "-size"]
  41572. }];
  41573. this.compileGlyphImpl(code, cmds, glyphId);
  41574. cmds.push({
  41575. cmd: "restore"
  41576. });
  41577. return cmds;
  41578. }
  41579. compileGlyphImpl() {
  41580. (0, _util.unreachable)("Children classes should implement this.");
  41581. }
  41582. hasBuiltPath(unicode) {
  41583. const {
  41584. charCode,
  41585. glyphId
  41586. } = lookupCmap(this.cmap, unicode);
  41587. return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined;
  41588. }
  41589. }
  41590. class TrueTypeCompiled extends CompiledFont {
  41591. constructor(glyphs, cmap, fontMatrix) {
  41592. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  41593. this.glyphs = glyphs;
  41594. this.cmap = cmap;
  41595. }
  41596. compileGlyphImpl(code, cmds) {
  41597. compileGlyf(code, cmds, this);
  41598. }
  41599. }
  41600. class Type2Compiled extends CompiledFont {
  41601. constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
  41602. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  41603. this.glyphs = cffInfo.glyphs;
  41604. this.gsubrs = cffInfo.gsubrs || [];
  41605. this.subrs = cffInfo.subrs || [];
  41606. this.cmap = cmap;
  41607. this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
  41608. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  41609. this.subrsBias = getSubroutineBias(this.subrs);
  41610. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  41611. this.fdSelect = cffInfo.fdSelect;
  41612. this.fdArray = cffInfo.fdArray;
  41613. }
  41614. compileGlyphImpl(code, cmds, glyphId) {
  41615. compileCharString(code, cmds, this, glyphId);
  41616. }
  41617. }
  41618. class FontRendererFactory {
  41619. static create(font, seacAnalysisEnabled) {
  41620. const data = new Uint8Array(font.data);
  41621. let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  41622. const numTables = getUint16(data, 4);
  41623. for (let i = 0, p = 12; i < numTables; i++, p += 16) {
  41624. const tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
  41625. const offset = getUint32(data, p + 8);
  41626. const length = getUint32(data, p + 12);
  41627. switch (tag) {
  41628. case "cmap":
  41629. cmap = parseCmap(data, offset, offset + length);
  41630. break;
  41631. case "glyf":
  41632. glyf = data.subarray(offset, offset + length);
  41633. break;
  41634. case "loca":
  41635. loca = data.subarray(offset, offset + length);
  41636. break;
  41637. case "head":
  41638. unitsPerEm = getUint16(data, offset + 18);
  41639. indexToLocFormat = getUint16(data, offset + 50);
  41640. break;
  41641. case "CFF ":
  41642. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  41643. break;
  41644. }
  41645. }
  41646. if (glyf) {
  41647. const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  41648. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  41649. }
  41650. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  41651. }
  41652. }
  41653. exports.FontRendererFactory = FontRendererFactory;
  41654. /***/ }),
  41655. /* 170 */
  41656. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41657. "use strict";
  41658. Object.defineProperty(exports, "__esModule", ({
  41659. value: true
  41660. }));
  41661. exports.getMetrics = exports.getFontBasicMetrics = void 0;
  41662. var _core_utils = __w_pdfjs_require__(131);
  41663. const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  41664. t.Courier = 600;
  41665. t["Courier-Bold"] = 600;
  41666. t["Courier-BoldOblique"] = 600;
  41667. t["Courier-Oblique"] = 600;
  41668. t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) {
  41669. t.space = 278;
  41670. t.exclam = 278;
  41671. t.quotedbl = 355;
  41672. t.numbersign = 556;
  41673. t.dollar = 556;
  41674. t.percent = 889;
  41675. t.ampersand = 667;
  41676. t.quoteright = 222;
  41677. t.parenleft = 333;
  41678. t.parenright = 333;
  41679. t.asterisk = 389;
  41680. t.plus = 584;
  41681. t.comma = 278;
  41682. t.hyphen = 333;
  41683. t.period = 278;
  41684. t.slash = 278;
  41685. t.zero = 556;
  41686. t.one = 556;
  41687. t.two = 556;
  41688. t.three = 556;
  41689. t.four = 556;
  41690. t.five = 556;
  41691. t.six = 556;
  41692. t.seven = 556;
  41693. t.eight = 556;
  41694. t.nine = 556;
  41695. t.colon = 278;
  41696. t.semicolon = 278;
  41697. t.less = 584;
  41698. t.equal = 584;
  41699. t.greater = 584;
  41700. t.question = 556;
  41701. t.at = 1015;
  41702. t.A = 667;
  41703. t.B = 667;
  41704. t.C = 722;
  41705. t.D = 722;
  41706. t.E = 667;
  41707. t.F = 611;
  41708. t.G = 778;
  41709. t.H = 722;
  41710. t.I = 278;
  41711. t.J = 500;
  41712. t.K = 667;
  41713. t.L = 556;
  41714. t.M = 833;
  41715. t.N = 722;
  41716. t.O = 778;
  41717. t.P = 667;
  41718. t.Q = 778;
  41719. t.R = 722;
  41720. t.S = 667;
  41721. t.T = 611;
  41722. t.U = 722;
  41723. t.V = 667;
  41724. t.W = 944;
  41725. t.X = 667;
  41726. t.Y = 667;
  41727. t.Z = 611;
  41728. t.bracketleft = 278;
  41729. t.backslash = 278;
  41730. t.bracketright = 278;
  41731. t.asciicircum = 469;
  41732. t.underscore = 556;
  41733. t.quoteleft = 222;
  41734. t.a = 556;
  41735. t.b = 556;
  41736. t.c = 500;
  41737. t.d = 556;
  41738. t.e = 556;
  41739. t.f = 278;
  41740. t.g = 556;
  41741. t.h = 556;
  41742. t.i = 222;
  41743. t.j = 222;
  41744. t.k = 500;
  41745. t.l = 222;
  41746. t.m = 833;
  41747. t.n = 556;
  41748. t.o = 556;
  41749. t.p = 556;
  41750. t.q = 556;
  41751. t.r = 333;
  41752. t.s = 500;
  41753. t.t = 278;
  41754. t.u = 556;
  41755. t.v = 500;
  41756. t.w = 722;
  41757. t.x = 500;
  41758. t.y = 500;
  41759. t.z = 500;
  41760. t.braceleft = 334;
  41761. t.bar = 260;
  41762. t.braceright = 334;
  41763. t.asciitilde = 584;
  41764. t.exclamdown = 333;
  41765. t.cent = 556;
  41766. t.sterling = 556;
  41767. t.fraction = 167;
  41768. t.yen = 556;
  41769. t.florin = 556;
  41770. t.section = 556;
  41771. t.currency = 556;
  41772. t.quotesingle = 191;
  41773. t.quotedblleft = 333;
  41774. t.guillemotleft = 556;
  41775. t.guilsinglleft = 333;
  41776. t.guilsinglright = 333;
  41777. t.fi = 500;
  41778. t.fl = 500;
  41779. t.endash = 556;
  41780. t.dagger = 556;
  41781. t.daggerdbl = 556;
  41782. t.periodcentered = 278;
  41783. t.paragraph = 537;
  41784. t.bullet = 350;
  41785. t.quotesinglbase = 222;
  41786. t.quotedblbase = 333;
  41787. t.quotedblright = 333;
  41788. t.guillemotright = 556;
  41789. t.ellipsis = 1000;
  41790. t.perthousand = 1000;
  41791. t.questiondown = 611;
  41792. t.grave = 333;
  41793. t.acute = 333;
  41794. t.circumflex = 333;
  41795. t.tilde = 333;
  41796. t.macron = 333;
  41797. t.breve = 333;
  41798. t.dotaccent = 333;
  41799. t.dieresis = 333;
  41800. t.ring = 333;
  41801. t.cedilla = 333;
  41802. t.hungarumlaut = 333;
  41803. t.ogonek = 333;
  41804. t.caron = 333;
  41805. t.emdash = 1000;
  41806. t.AE = 1000;
  41807. t.ordfeminine = 370;
  41808. t.Lslash = 556;
  41809. t.Oslash = 778;
  41810. t.OE = 1000;
  41811. t.ordmasculine = 365;
  41812. t.ae = 889;
  41813. t.dotlessi = 278;
  41814. t.lslash = 222;
  41815. t.oslash = 611;
  41816. t.oe = 944;
  41817. t.germandbls = 611;
  41818. t.Idieresis = 278;
  41819. t.eacute = 556;
  41820. t.abreve = 556;
  41821. t.uhungarumlaut = 556;
  41822. t.ecaron = 556;
  41823. t.Ydieresis = 667;
  41824. t.divide = 584;
  41825. t.Yacute = 667;
  41826. t.Acircumflex = 667;
  41827. t.aacute = 556;
  41828. t.Ucircumflex = 722;
  41829. t.yacute = 500;
  41830. t.scommaaccent = 500;
  41831. t.ecircumflex = 556;
  41832. t.Uring = 722;
  41833. t.Udieresis = 722;
  41834. t.aogonek = 556;
  41835. t.Uacute = 722;
  41836. t.uogonek = 556;
  41837. t.Edieresis = 667;
  41838. t.Dcroat = 722;
  41839. t.commaaccent = 250;
  41840. t.copyright = 737;
  41841. t.Emacron = 667;
  41842. t.ccaron = 500;
  41843. t.aring = 556;
  41844. t.Ncommaaccent = 722;
  41845. t.lacute = 222;
  41846. t.agrave = 556;
  41847. t.Tcommaaccent = 611;
  41848. t.Cacute = 722;
  41849. t.atilde = 556;
  41850. t.Edotaccent = 667;
  41851. t.scaron = 500;
  41852. t.scedilla = 500;
  41853. t.iacute = 278;
  41854. t.lozenge = 471;
  41855. t.Rcaron = 722;
  41856. t.Gcommaaccent = 778;
  41857. t.ucircumflex = 556;
  41858. t.acircumflex = 556;
  41859. t.Amacron = 667;
  41860. t.rcaron = 333;
  41861. t.ccedilla = 500;
  41862. t.Zdotaccent = 611;
  41863. t.Thorn = 667;
  41864. t.Omacron = 778;
  41865. t.Racute = 722;
  41866. t.Sacute = 667;
  41867. t.dcaron = 643;
  41868. t.Umacron = 722;
  41869. t.uring = 556;
  41870. t.threesuperior = 333;
  41871. t.Ograve = 778;
  41872. t.Agrave = 667;
  41873. t.Abreve = 667;
  41874. t.multiply = 584;
  41875. t.uacute = 556;
  41876. t.Tcaron = 611;
  41877. t.partialdiff = 476;
  41878. t.ydieresis = 500;
  41879. t.Nacute = 722;
  41880. t.icircumflex = 278;
  41881. t.Ecircumflex = 667;
  41882. t.adieresis = 556;
  41883. t.edieresis = 556;
  41884. t.cacute = 500;
  41885. t.nacute = 556;
  41886. t.umacron = 556;
  41887. t.Ncaron = 722;
  41888. t.Iacute = 278;
  41889. t.plusminus = 584;
  41890. t.brokenbar = 260;
  41891. t.registered = 737;
  41892. t.Gbreve = 778;
  41893. t.Idotaccent = 278;
  41894. t.summation = 600;
  41895. t.Egrave = 667;
  41896. t.racute = 333;
  41897. t.omacron = 556;
  41898. t.Zacute = 611;
  41899. t.Zcaron = 611;
  41900. t.greaterequal = 549;
  41901. t.Eth = 722;
  41902. t.Ccedilla = 722;
  41903. t.lcommaaccent = 222;
  41904. t.tcaron = 317;
  41905. t.eogonek = 556;
  41906. t.Uogonek = 722;
  41907. t.Aacute = 667;
  41908. t.Adieresis = 667;
  41909. t.egrave = 556;
  41910. t.zacute = 500;
  41911. t.iogonek = 222;
  41912. t.Oacute = 778;
  41913. t.oacute = 556;
  41914. t.amacron = 556;
  41915. t.sacute = 500;
  41916. t.idieresis = 278;
  41917. t.Ocircumflex = 778;
  41918. t.Ugrave = 722;
  41919. t.Delta = 612;
  41920. t.thorn = 556;
  41921. t.twosuperior = 333;
  41922. t.Odieresis = 778;
  41923. t.mu = 556;
  41924. t.igrave = 278;
  41925. t.ohungarumlaut = 556;
  41926. t.Eogonek = 667;
  41927. t.dcroat = 556;
  41928. t.threequarters = 834;
  41929. t.Scedilla = 667;
  41930. t.lcaron = 299;
  41931. t.Kcommaaccent = 667;
  41932. t.Lacute = 556;
  41933. t.trademark = 1000;
  41934. t.edotaccent = 556;
  41935. t.Igrave = 278;
  41936. t.Imacron = 278;
  41937. t.Lcaron = 556;
  41938. t.onehalf = 834;
  41939. t.lessequal = 549;
  41940. t.ocircumflex = 556;
  41941. t.ntilde = 556;
  41942. t.Uhungarumlaut = 722;
  41943. t.Eacute = 667;
  41944. t.emacron = 556;
  41945. t.gbreve = 556;
  41946. t.onequarter = 834;
  41947. t.Scaron = 667;
  41948. t.Scommaaccent = 667;
  41949. t.Ohungarumlaut = 778;
  41950. t.degree = 400;
  41951. t.ograve = 556;
  41952. t.Ccaron = 722;
  41953. t.ugrave = 556;
  41954. t.radical = 453;
  41955. t.Dcaron = 722;
  41956. t.rcommaaccent = 333;
  41957. t.Ntilde = 722;
  41958. t.otilde = 556;
  41959. t.Rcommaaccent = 722;
  41960. t.Lcommaaccent = 556;
  41961. t.Atilde = 667;
  41962. t.Aogonek = 667;
  41963. t.Aring = 667;
  41964. t.Otilde = 778;
  41965. t.zdotaccent = 500;
  41966. t.Ecaron = 667;
  41967. t.Iogonek = 278;
  41968. t.kcommaaccent = 500;
  41969. t.minus = 584;
  41970. t.Icircumflex = 278;
  41971. t.ncaron = 556;
  41972. t.tcommaaccent = 278;
  41973. t.logicalnot = 584;
  41974. t.odieresis = 556;
  41975. t.udieresis = 556;
  41976. t.notequal = 549;
  41977. t.gcommaaccent = 556;
  41978. t.eth = 556;
  41979. t.zcaron = 500;
  41980. t.ncommaaccent = 556;
  41981. t.onesuperior = 333;
  41982. t.imacron = 278;
  41983. t.Euro = 556;
  41984. });
  41985. t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  41986. t.space = 278;
  41987. t.exclam = 333;
  41988. t.quotedbl = 474;
  41989. t.numbersign = 556;
  41990. t.dollar = 556;
  41991. t.percent = 889;
  41992. t.ampersand = 722;
  41993. t.quoteright = 278;
  41994. t.parenleft = 333;
  41995. t.parenright = 333;
  41996. t.asterisk = 389;
  41997. t.plus = 584;
  41998. t.comma = 278;
  41999. t.hyphen = 333;
  42000. t.period = 278;
  42001. t.slash = 278;
  42002. t.zero = 556;
  42003. t.one = 556;
  42004. t.two = 556;
  42005. t.three = 556;
  42006. t.four = 556;
  42007. t.five = 556;
  42008. t.six = 556;
  42009. t.seven = 556;
  42010. t.eight = 556;
  42011. t.nine = 556;
  42012. t.colon = 333;
  42013. t.semicolon = 333;
  42014. t.less = 584;
  42015. t.equal = 584;
  42016. t.greater = 584;
  42017. t.question = 611;
  42018. t.at = 975;
  42019. t.A = 722;
  42020. t.B = 722;
  42021. t.C = 722;
  42022. t.D = 722;
  42023. t.E = 667;
  42024. t.F = 611;
  42025. t.G = 778;
  42026. t.H = 722;
  42027. t.I = 278;
  42028. t.J = 556;
  42029. t.K = 722;
  42030. t.L = 611;
  42031. t.M = 833;
  42032. t.N = 722;
  42033. t.O = 778;
  42034. t.P = 667;
  42035. t.Q = 778;
  42036. t.R = 722;
  42037. t.S = 667;
  42038. t.T = 611;
  42039. t.U = 722;
  42040. t.V = 667;
  42041. t.W = 944;
  42042. t.X = 667;
  42043. t.Y = 667;
  42044. t.Z = 611;
  42045. t.bracketleft = 333;
  42046. t.backslash = 278;
  42047. t.bracketright = 333;
  42048. t.asciicircum = 584;
  42049. t.underscore = 556;
  42050. t.quoteleft = 278;
  42051. t.a = 556;
  42052. t.b = 611;
  42053. t.c = 556;
  42054. t.d = 611;
  42055. t.e = 556;
  42056. t.f = 333;
  42057. t.g = 611;
  42058. t.h = 611;
  42059. t.i = 278;
  42060. t.j = 278;
  42061. t.k = 556;
  42062. t.l = 278;
  42063. t.m = 889;
  42064. t.n = 611;
  42065. t.o = 611;
  42066. t.p = 611;
  42067. t.q = 611;
  42068. t.r = 389;
  42069. t.s = 556;
  42070. t.t = 333;
  42071. t.u = 611;
  42072. t.v = 556;
  42073. t.w = 778;
  42074. t.x = 556;
  42075. t.y = 556;
  42076. t.z = 500;
  42077. t.braceleft = 389;
  42078. t.bar = 280;
  42079. t.braceright = 389;
  42080. t.asciitilde = 584;
  42081. t.exclamdown = 333;
  42082. t.cent = 556;
  42083. t.sterling = 556;
  42084. t.fraction = 167;
  42085. t.yen = 556;
  42086. t.florin = 556;
  42087. t.section = 556;
  42088. t.currency = 556;
  42089. t.quotesingle = 238;
  42090. t.quotedblleft = 500;
  42091. t.guillemotleft = 556;
  42092. t.guilsinglleft = 333;
  42093. t.guilsinglright = 333;
  42094. t.fi = 611;
  42095. t.fl = 611;
  42096. t.endash = 556;
  42097. t.dagger = 556;
  42098. t.daggerdbl = 556;
  42099. t.periodcentered = 278;
  42100. t.paragraph = 556;
  42101. t.bullet = 350;
  42102. t.quotesinglbase = 278;
  42103. t.quotedblbase = 500;
  42104. t.quotedblright = 500;
  42105. t.guillemotright = 556;
  42106. t.ellipsis = 1000;
  42107. t.perthousand = 1000;
  42108. t.questiondown = 611;
  42109. t.grave = 333;
  42110. t.acute = 333;
  42111. t.circumflex = 333;
  42112. t.tilde = 333;
  42113. t.macron = 333;
  42114. t.breve = 333;
  42115. t.dotaccent = 333;
  42116. t.dieresis = 333;
  42117. t.ring = 333;
  42118. t.cedilla = 333;
  42119. t.hungarumlaut = 333;
  42120. t.ogonek = 333;
  42121. t.caron = 333;
  42122. t.emdash = 1000;
  42123. t.AE = 1000;
  42124. t.ordfeminine = 370;
  42125. t.Lslash = 611;
  42126. t.Oslash = 778;
  42127. t.OE = 1000;
  42128. t.ordmasculine = 365;
  42129. t.ae = 889;
  42130. t.dotlessi = 278;
  42131. t.lslash = 278;
  42132. t.oslash = 611;
  42133. t.oe = 944;
  42134. t.germandbls = 611;
  42135. t.Idieresis = 278;
  42136. t.eacute = 556;
  42137. t.abreve = 556;
  42138. t.uhungarumlaut = 611;
  42139. t.ecaron = 556;
  42140. t.Ydieresis = 667;
  42141. t.divide = 584;
  42142. t.Yacute = 667;
  42143. t.Acircumflex = 722;
  42144. t.aacute = 556;
  42145. t.Ucircumflex = 722;
  42146. t.yacute = 556;
  42147. t.scommaaccent = 556;
  42148. t.ecircumflex = 556;
  42149. t.Uring = 722;
  42150. t.Udieresis = 722;
  42151. t.aogonek = 556;
  42152. t.Uacute = 722;
  42153. t.uogonek = 611;
  42154. t.Edieresis = 667;
  42155. t.Dcroat = 722;
  42156. t.commaaccent = 250;
  42157. t.copyright = 737;
  42158. t.Emacron = 667;
  42159. t.ccaron = 556;
  42160. t.aring = 556;
  42161. t.Ncommaaccent = 722;
  42162. t.lacute = 278;
  42163. t.agrave = 556;
  42164. t.Tcommaaccent = 611;
  42165. t.Cacute = 722;
  42166. t.atilde = 556;
  42167. t.Edotaccent = 667;
  42168. t.scaron = 556;
  42169. t.scedilla = 556;
  42170. t.iacute = 278;
  42171. t.lozenge = 494;
  42172. t.Rcaron = 722;
  42173. t.Gcommaaccent = 778;
  42174. t.ucircumflex = 611;
  42175. t.acircumflex = 556;
  42176. t.Amacron = 722;
  42177. t.rcaron = 389;
  42178. t.ccedilla = 556;
  42179. t.Zdotaccent = 611;
  42180. t.Thorn = 667;
  42181. t.Omacron = 778;
  42182. t.Racute = 722;
  42183. t.Sacute = 667;
  42184. t.dcaron = 743;
  42185. t.Umacron = 722;
  42186. t.uring = 611;
  42187. t.threesuperior = 333;
  42188. t.Ograve = 778;
  42189. t.Agrave = 722;
  42190. t.Abreve = 722;
  42191. t.multiply = 584;
  42192. t.uacute = 611;
  42193. t.Tcaron = 611;
  42194. t.partialdiff = 494;
  42195. t.ydieresis = 556;
  42196. t.Nacute = 722;
  42197. t.icircumflex = 278;
  42198. t.Ecircumflex = 667;
  42199. t.adieresis = 556;
  42200. t.edieresis = 556;
  42201. t.cacute = 556;
  42202. t.nacute = 611;
  42203. t.umacron = 611;
  42204. t.Ncaron = 722;
  42205. t.Iacute = 278;
  42206. t.plusminus = 584;
  42207. t.brokenbar = 280;
  42208. t.registered = 737;
  42209. t.Gbreve = 778;
  42210. t.Idotaccent = 278;
  42211. t.summation = 600;
  42212. t.Egrave = 667;
  42213. t.racute = 389;
  42214. t.omacron = 611;
  42215. t.Zacute = 611;
  42216. t.Zcaron = 611;
  42217. t.greaterequal = 549;
  42218. t.Eth = 722;
  42219. t.Ccedilla = 722;
  42220. t.lcommaaccent = 278;
  42221. t.tcaron = 389;
  42222. t.eogonek = 556;
  42223. t.Uogonek = 722;
  42224. t.Aacute = 722;
  42225. t.Adieresis = 722;
  42226. t.egrave = 556;
  42227. t.zacute = 500;
  42228. t.iogonek = 278;
  42229. t.Oacute = 778;
  42230. t.oacute = 611;
  42231. t.amacron = 556;
  42232. t.sacute = 556;
  42233. t.idieresis = 278;
  42234. t.Ocircumflex = 778;
  42235. t.Ugrave = 722;
  42236. t.Delta = 612;
  42237. t.thorn = 611;
  42238. t.twosuperior = 333;
  42239. t.Odieresis = 778;
  42240. t.mu = 611;
  42241. t.igrave = 278;
  42242. t.ohungarumlaut = 611;
  42243. t.Eogonek = 667;
  42244. t.dcroat = 611;
  42245. t.threequarters = 834;
  42246. t.Scedilla = 667;
  42247. t.lcaron = 400;
  42248. t.Kcommaaccent = 722;
  42249. t.Lacute = 611;
  42250. t.trademark = 1000;
  42251. t.edotaccent = 556;
  42252. t.Igrave = 278;
  42253. t.Imacron = 278;
  42254. t.Lcaron = 611;
  42255. t.onehalf = 834;
  42256. t.lessequal = 549;
  42257. t.ocircumflex = 611;
  42258. t.ntilde = 611;
  42259. t.Uhungarumlaut = 722;
  42260. t.Eacute = 667;
  42261. t.emacron = 556;
  42262. t.gbreve = 611;
  42263. t.onequarter = 834;
  42264. t.Scaron = 667;
  42265. t.Scommaaccent = 667;
  42266. t.Ohungarumlaut = 778;
  42267. t.degree = 400;
  42268. t.ograve = 611;
  42269. t.Ccaron = 722;
  42270. t.ugrave = 611;
  42271. t.radical = 549;
  42272. t.Dcaron = 722;
  42273. t.rcommaaccent = 389;
  42274. t.Ntilde = 722;
  42275. t.otilde = 611;
  42276. t.Rcommaaccent = 722;
  42277. t.Lcommaaccent = 611;
  42278. t.Atilde = 722;
  42279. t.Aogonek = 722;
  42280. t.Aring = 722;
  42281. t.Otilde = 778;
  42282. t.zdotaccent = 500;
  42283. t.Ecaron = 667;
  42284. t.Iogonek = 278;
  42285. t.kcommaaccent = 556;
  42286. t.minus = 584;
  42287. t.Icircumflex = 278;
  42288. t.ncaron = 611;
  42289. t.tcommaaccent = 333;
  42290. t.logicalnot = 584;
  42291. t.odieresis = 611;
  42292. t.udieresis = 611;
  42293. t.notequal = 549;
  42294. t.gcommaaccent = 611;
  42295. t.eth = 611;
  42296. t.zcaron = 500;
  42297. t.ncommaaccent = 611;
  42298. t.onesuperior = 333;
  42299. t.imacron = 278;
  42300. t.Euro = 556;
  42301. });
  42302. t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  42303. t.space = 278;
  42304. t.exclam = 333;
  42305. t.quotedbl = 474;
  42306. t.numbersign = 556;
  42307. t.dollar = 556;
  42308. t.percent = 889;
  42309. t.ampersand = 722;
  42310. t.quoteright = 278;
  42311. t.parenleft = 333;
  42312. t.parenright = 333;
  42313. t.asterisk = 389;
  42314. t.plus = 584;
  42315. t.comma = 278;
  42316. t.hyphen = 333;
  42317. t.period = 278;
  42318. t.slash = 278;
  42319. t.zero = 556;
  42320. t.one = 556;
  42321. t.two = 556;
  42322. t.three = 556;
  42323. t.four = 556;
  42324. t.five = 556;
  42325. t.six = 556;
  42326. t.seven = 556;
  42327. t.eight = 556;
  42328. t.nine = 556;
  42329. t.colon = 333;
  42330. t.semicolon = 333;
  42331. t.less = 584;
  42332. t.equal = 584;
  42333. t.greater = 584;
  42334. t.question = 611;
  42335. t.at = 975;
  42336. t.A = 722;
  42337. t.B = 722;
  42338. t.C = 722;
  42339. t.D = 722;
  42340. t.E = 667;
  42341. t.F = 611;
  42342. t.G = 778;
  42343. t.H = 722;
  42344. t.I = 278;
  42345. t.J = 556;
  42346. t.K = 722;
  42347. t.L = 611;
  42348. t.M = 833;
  42349. t.N = 722;
  42350. t.O = 778;
  42351. t.P = 667;
  42352. t.Q = 778;
  42353. t.R = 722;
  42354. t.S = 667;
  42355. t.T = 611;
  42356. t.U = 722;
  42357. t.V = 667;
  42358. t.W = 944;
  42359. t.X = 667;
  42360. t.Y = 667;
  42361. t.Z = 611;
  42362. t.bracketleft = 333;
  42363. t.backslash = 278;
  42364. t.bracketright = 333;
  42365. t.asciicircum = 584;
  42366. t.underscore = 556;
  42367. t.quoteleft = 278;
  42368. t.a = 556;
  42369. t.b = 611;
  42370. t.c = 556;
  42371. t.d = 611;
  42372. t.e = 556;
  42373. t.f = 333;
  42374. t.g = 611;
  42375. t.h = 611;
  42376. t.i = 278;
  42377. t.j = 278;
  42378. t.k = 556;
  42379. t.l = 278;
  42380. t.m = 889;
  42381. t.n = 611;
  42382. t.o = 611;
  42383. t.p = 611;
  42384. t.q = 611;
  42385. t.r = 389;
  42386. t.s = 556;
  42387. t.t = 333;
  42388. t.u = 611;
  42389. t.v = 556;
  42390. t.w = 778;
  42391. t.x = 556;
  42392. t.y = 556;
  42393. t.z = 500;
  42394. t.braceleft = 389;
  42395. t.bar = 280;
  42396. t.braceright = 389;
  42397. t.asciitilde = 584;
  42398. t.exclamdown = 333;
  42399. t.cent = 556;
  42400. t.sterling = 556;
  42401. t.fraction = 167;
  42402. t.yen = 556;
  42403. t.florin = 556;
  42404. t.section = 556;
  42405. t.currency = 556;
  42406. t.quotesingle = 238;
  42407. t.quotedblleft = 500;
  42408. t.guillemotleft = 556;
  42409. t.guilsinglleft = 333;
  42410. t.guilsinglright = 333;
  42411. t.fi = 611;
  42412. t.fl = 611;
  42413. t.endash = 556;
  42414. t.dagger = 556;
  42415. t.daggerdbl = 556;
  42416. t.periodcentered = 278;
  42417. t.paragraph = 556;
  42418. t.bullet = 350;
  42419. t.quotesinglbase = 278;
  42420. t.quotedblbase = 500;
  42421. t.quotedblright = 500;
  42422. t.guillemotright = 556;
  42423. t.ellipsis = 1000;
  42424. t.perthousand = 1000;
  42425. t.questiondown = 611;
  42426. t.grave = 333;
  42427. t.acute = 333;
  42428. t.circumflex = 333;
  42429. t.tilde = 333;
  42430. t.macron = 333;
  42431. t.breve = 333;
  42432. t.dotaccent = 333;
  42433. t.dieresis = 333;
  42434. t.ring = 333;
  42435. t.cedilla = 333;
  42436. t.hungarumlaut = 333;
  42437. t.ogonek = 333;
  42438. t.caron = 333;
  42439. t.emdash = 1000;
  42440. t.AE = 1000;
  42441. t.ordfeminine = 370;
  42442. t.Lslash = 611;
  42443. t.Oslash = 778;
  42444. t.OE = 1000;
  42445. t.ordmasculine = 365;
  42446. t.ae = 889;
  42447. t.dotlessi = 278;
  42448. t.lslash = 278;
  42449. t.oslash = 611;
  42450. t.oe = 944;
  42451. t.germandbls = 611;
  42452. t.Idieresis = 278;
  42453. t.eacute = 556;
  42454. t.abreve = 556;
  42455. t.uhungarumlaut = 611;
  42456. t.ecaron = 556;
  42457. t.Ydieresis = 667;
  42458. t.divide = 584;
  42459. t.Yacute = 667;
  42460. t.Acircumflex = 722;
  42461. t.aacute = 556;
  42462. t.Ucircumflex = 722;
  42463. t.yacute = 556;
  42464. t.scommaaccent = 556;
  42465. t.ecircumflex = 556;
  42466. t.Uring = 722;
  42467. t.Udieresis = 722;
  42468. t.aogonek = 556;
  42469. t.Uacute = 722;
  42470. t.uogonek = 611;
  42471. t.Edieresis = 667;
  42472. t.Dcroat = 722;
  42473. t.commaaccent = 250;
  42474. t.copyright = 737;
  42475. t.Emacron = 667;
  42476. t.ccaron = 556;
  42477. t.aring = 556;
  42478. t.Ncommaaccent = 722;
  42479. t.lacute = 278;
  42480. t.agrave = 556;
  42481. t.Tcommaaccent = 611;
  42482. t.Cacute = 722;
  42483. t.atilde = 556;
  42484. t.Edotaccent = 667;
  42485. t.scaron = 556;
  42486. t.scedilla = 556;
  42487. t.iacute = 278;
  42488. t.lozenge = 494;
  42489. t.Rcaron = 722;
  42490. t.Gcommaaccent = 778;
  42491. t.ucircumflex = 611;
  42492. t.acircumflex = 556;
  42493. t.Amacron = 722;
  42494. t.rcaron = 389;
  42495. t.ccedilla = 556;
  42496. t.Zdotaccent = 611;
  42497. t.Thorn = 667;
  42498. t.Omacron = 778;
  42499. t.Racute = 722;
  42500. t.Sacute = 667;
  42501. t.dcaron = 743;
  42502. t.Umacron = 722;
  42503. t.uring = 611;
  42504. t.threesuperior = 333;
  42505. t.Ograve = 778;
  42506. t.Agrave = 722;
  42507. t.Abreve = 722;
  42508. t.multiply = 584;
  42509. t.uacute = 611;
  42510. t.Tcaron = 611;
  42511. t.partialdiff = 494;
  42512. t.ydieresis = 556;
  42513. t.Nacute = 722;
  42514. t.icircumflex = 278;
  42515. t.Ecircumflex = 667;
  42516. t.adieresis = 556;
  42517. t.edieresis = 556;
  42518. t.cacute = 556;
  42519. t.nacute = 611;
  42520. t.umacron = 611;
  42521. t.Ncaron = 722;
  42522. t.Iacute = 278;
  42523. t.plusminus = 584;
  42524. t.brokenbar = 280;
  42525. t.registered = 737;
  42526. t.Gbreve = 778;
  42527. t.Idotaccent = 278;
  42528. t.summation = 600;
  42529. t.Egrave = 667;
  42530. t.racute = 389;
  42531. t.omacron = 611;
  42532. t.Zacute = 611;
  42533. t.Zcaron = 611;
  42534. t.greaterequal = 549;
  42535. t.Eth = 722;
  42536. t.Ccedilla = 722;
  42537. t.lcommaaccent = 278;
  42538. t.tcaron = 389;
  42539. t.eogonek = 556;
  42540. t.Uogonek = 722;
  42541. t.Aacute = 722;
  42542. t.Adieresis = 722;
  42543. t.egrave = 556;
  42544. t.zacute = 500;
  42545. t.iogonek = 278;
  42546. t.Oacute = 778;
  42547. t.oacute = 611;
  42548. t.amacron = 556;
  42549. t.sacute = 556;
  42550. t.idieresis = 278;
  42551. t.Ocircumflex = 778;
  42552. t.Ugrave = 722;
  42553. t.Delta = 612;
  42554. t.thorn = 611;
  42555. t.twosuperior = 333;
  42556. t.Odieresis = 778;
  42557. t.mu = 611;
  42558. t.igrave = 278;
  42559. t.ohungarumlaut = 611;
  42560. t.Eogonek = 667;
  42561. t.dcroat = 611;
  42562. t.threequarters = 834;
  42563. t.Scedilla = 667;
  42564. t.lcaron = 400;
  42565. t.Kcommaaccent = 722;
  42566. t.Lacute = 611;
  42567. t.trademark = 1000;
  42568. t.edotaccent = 556;
  42569. t.Igrave = 278;
  42570. t.Imacron = 278;
  42571. t.Lcaron = 611;
  42572. t.onehalf = 834;
  42573. t.lessequal = 549;
  42574. t.ocircumflex = 611;
  42575. t.ntilde = 611;
  42576. t.Uhungarumlaut = 722;
  42577. t.Eacute = 667;
  42578. t.emacron = 556;
  42579. t.gbreve = 611;
  42580. t.onequarter = 834;
  42581. t.Scaron = 667;
  42582. t.Scommaaccent = 667;
  42583. t.Ohungarumlaut = 778;
  42584. t.degree = 400;
  42585. t.ograve = 611;
  42586. t.Ccaron = 722;
  42587. t.ugrave = 611;
  42588. t.radical = 549;
  42589. t.Dcaron = 722;
  42590. t.rcommaaccent = 389;
  42591. t.Ntilde = 722;
  42592. t.otilde = 611;
  42593. t.Rcommaaccent = 722;
  42594. t.Lcommaaccent = 611;
  42595. t.Atilde = 722;
  42596. t.Aogonek = 722;
  42597. t.Aring = 722;
  42598. t.Otilde = 778;
  42599. t.zdotaccent = 500;
  42600. t.Ecaron = 667;
  42601. t.Iogonek = 278;
  42602. t.kcommaaccent = 556;
  42603. t.minus = 584;
  42604. t.Icircumflex = 278;
  42605. t.ncaron = 611;
  42606. t.tcommaaccent = 333;
  42607. t.logicalnot = 584;
  42608. t.odieresis = 611;
  42609. t.udieresis = 611;
  42610. t.notequal = 549;
  42611. t.gcommaaccent = 611;
  42612. t.eth = 611;
  42613. t.zcaron = 500;
  42614. t.ncommaaccent = 611;
  42615. t.onesuperior = 333;
  42616. t.imacron = 278;
  42617. t.Euro = 556;
  42618. });
  42619. t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  42620. t.space = 278;
  42621. t.exclam = 278;
  42622. t.quotedbl = 355;
  42623. t.numbersign = 556;
  42624. t.dollar = 556;
  42625. t.percent = 889;
  42626. t.ampersand = 667;
  42627. t.quoteright = 222;
  42628. t.parenleft = 333;
  42629. t.parenright = 333;
  42630. t.asterisk = 389;
  42631. t.plus = 584;
  42632. t.comma = 278;
  42633. t.hyphen = 333;
  42634. t.period = 278;
  42635. t.slash = 278;
  42636. t.zero = 556;
  42637. t.one = 556;
  42638. t.two = 556;
  42639. t.three = 556;
  42640. t.four = 556;
  42641. t.five = 556;
  42642. t.six = 556;
  42643. t.seven = 556;
  42644. t.eight = 556;
  42645. t.nine = 556;
  42646. t.colon = 278;
  42647. t.semicolon = 278;
  42648. t.less = 584;
  42649. t.equal = 584;
  42650. t.greater = 584;
  42651. t.question = 556;
  42652. t.at = 1015;
  42653. t.A = 667;
  42654. t.B = 667;
  42655. t.C = 722;
  42656. t.D = 722;
  42657. t.E = 667;
  42658. t.F = 611;
  42659. t.G = 778;
  42660. t.H = 722;
  42661. t.I = 278;
  42662. t.J = 500;
  42663. t.K = 667;
  42664. t.L = 556;
  42665. t.M = 833;
  42666. t.N = 722;
  42667. t.O = 778;
  42668. t.P = 667;
  42669. t.Q = 778;
  42670. t.R = 722;
  42671. t.S = 667;
  42672. t.T = 611;
  42673. t.U = 722;
  42674. t.V = 667;
  42675. t.W = 944;
  42676. t.X = 667;
  42677. t.Y = 667;
  42678. t.Z = 611;
  42679. t.bracketleft = 278;
  42680. t.backslash = 278;
  42681. t.bracketright = 278;
  42682. t.asciicircum = 469;
  42683. t.underscore = 556;
  42684. t.quoteleft = 222;
  42685. t.a = 556;
  42686. t.b = 556;
  42687. t.c = 500;
  42688. t.d = 556;
  42689. t.e = 556;
  42690. t.f = 278;
  42691. t.g = 556;
  42692. t.h = 556;
  42693. t.i = 222;
  42694. t.j = 222;
  42695. t.k = 500;
  42696. t.l = 222;
  42697. t.m = 833;
  42698. t.n = 556;
  42699. t.o = 556;
  42700. t.p = 556;
  42701. t.q = 556;
  42702. t.r = 333;
  42703. t.s = 500;
  42704. t.t = 278;
  42705. t.u = 556;
  42706. t.v = 500;
  42707. t.w = 722;
  42708. t.x = 500;
  42709. t.y = 500;
  42710. t.z = 500;
  42711. t.braceleft = 334;
  42712. t.bar = 260;
  42713. t.braceright = 334;
  42714. t.asciitilde = 584;
  42715. t.exclamdown = 333;
  42716. t.cent = 556;
  42717. t.sterling = 556;
  42718. t.fraction = 167;
  42719. t.yen = 556;
  42720. t.florin = 556;
  42721. t.section = 556;
  42722. t.currency = 556;
  42723. t.quotesingle = 191;
  42724. t.quotedblleft = 333;
  42725. t.guillemotleft = 556;
  42726. t.guilsinglleft = 333;
  42727. t.guilsinglright = 333;
  42728. t.fi = 500;
  42729. t.fl = 500;
  42730. t.endash = 556;
  42731. t.dagger = 556;
  42732. t.daggerdbl = 556;
  42733. t.periodcentered = 278;
  42734. t.paragraph = 537;
  42735. t.bullet = 350;
  42736. t.quotesinglbase = 222;
  42737. t.quotedblbase = 333;
  42738. t.quotedblright = 333;
  42739. t.guillemotright = 556;
  42740. t.ellipsis = 1000;
  42741. t.perthousand = 1000;
  42742. t.questiondown = 611;
  42743. t.grave = 333;
  42744. t.acute = 333;
  42745. t.circumflex = 333;
  42746. t.tilde = 333;
  42747. t.macron = 333;
  42748. t.breve = 333;
  42749. t.dotaccent = 333;
  42750. t.dieresis = 333;
  42751. t.ring = 333;
  42752. t.cedilla = 333;
  42753. t.hungarumlaut = 333;
  42754. t.ogonek = 333;
  42755. t.caron = 333;
  42756. t.emdash = 1000;
  42757. t.AE = 1000;
  42758. t.ordfeminine = 370;
  42759. t.Lslash = 556;
  42760. t.Oslash = 778;
  42761. t.OE = 1000;
  42762. t.ordmasculine = 365;
  42763. t.ae = 889;
  42764. t.dotlessi = 278;
  42765. t.lslash = 222;
  42766. t.oslash = 611;
  42767. t.oe = 944;
  42768. t.germandbls = 611;
  42769. t.Idieresis = 278;
  42770. t.eacute = 556;
  42771. t.abreve = 556;
  42772. t.uhungarumlaut = 556;
  42773. t.ecaron = 556;
  42774. t.Ydieresis = 667;
  42775. t.divide = 584;
  42776. t.Yacute = 667;
  42777. t.Acircumflex = 667;
  42778. t.aacute = 556;
  42779. t.Ucircumflex = 722;
  42780. t.yacute = 500;
  42781. t.scommaaccent = 500;
  42782. t.ecircumflex = 556;
  42783. t.Uring = 722;
  42784. t.Udieresis = 722;
  42785. t.aogonek = 556;
  42786. t.Uacute = 722;
  42787. t.uogonek = 556;
  42788. t.Edieresis = 667;
  42789. t.Dcroat = 722;
  42790. t.commaaccent = 250;
  42791. t.copyright = 737;
  42792. t.Emacron = 667;
  42793. t.ccaron = 500;
  42794. t.aring = 556;
  42795. t.Ncommaaccent = 722;
  42796. t.lacute = 222;
  42797. t.agrave = 556;
  42798. t.Tcommaaccent = 611;
  42799. t.Cacute = 722;
  42800. t.atilde = 556;
  42801. t.Edotaccent = 667;
  42802. t.scaron = 500;
  42803. t.scedilla = 500;
  42804. t.iacute = 278;
  42805. t.lozenge = 471;
  42806. t.Rcaron = 722;
  42807. t.Gcommaaccent = 778;
  42808. t.ucircumflex = 556;
  42809. t.acircumflex = 556;
  42810. t.Amacron = 667;
  42811. t.rcaron = 333;
  42812. t.ccedilla = 500;
  42813. t.Zdotaccent = 611;
  42814. t.Thorn = 667;
  42815. t.Omacron = 778;
  42816. t.Racute = 722;
  42817. t.Sacute = 667;
  42818. t.dcaron = 643;
  42819. t.Umacron = 722;
  42820. t.uring = 556;
  42821. t.threesuperior = 333;
  42822. t.Ograve = 778;
  42823. t.Agrave = 667;
  42824. t.Abreve = 667;
  42825. t.multiply = 584;
  42826. t.uacute = 556;
  42827. t.Tcaron = 611;
  42828. t.partialdiff = 476;
  42829. t.ydieresis = 500;
  42830. t.Nacute = 722;
  42831. t.icircumflex = 278;
  42832. t.Ecircumflex = 667;
  42833. t.adieresis = 556;
  42834. t.edieresis = 556;
  42835. t.cacute = 500;
  42836. t.nacute = 556;
  42837. t.umacron = 556;
  42838. t.Ncaron = 722;
  42839. t.Iacute = 278;
  42840. t.plusminus = 584;
  42841. t.brokenbar = 260;
  42842. t.registered = 737;
  42843. t.Gbreve = 778;
  42844. t.Idotaccent = 278;
  42845. t.summation = 600;
  42846. t.Egrave = 667;
  42847. t.racute = 333;
  42848. t.omacron = 556;
  42849. t.Zacute = 611;
  42850. t.Zcaron = 611;
  42851. t.greaterequal = 549;
  42852. t.Eth = 722;
  42853. t.Ccedilla = 722;
  42854. t.lcommaaccent = 222;
  42855. t.tcaron = 317;
  42856. t.eogonek = 556;
  42857. t.Uogonek = 722;
  42858. t.Aacute = 667;
  42859. t.Adieresis = 667;
  42860. t.egrave = 556;
  42861. t.zacute = 500;
  42862. t.iogonek = 222;
  42863. t.Oacute = 778;
  42864. t.oacute = 556;
  42865. t.amacron = 556;
  42866. t.sacute = 500;
  42867. t.idieresis = 278;
  42868. t.Ocircumflex = 778;
  42869. t.Ugrave = 722;
  42870. t.Delta = 612;
  42871. t.thorn = 556;
  42872. t.twosuperior = 333;
  42873. t.Odieresis = 778;
  42874. t.mu = 556;
  42875. t.igrave = 278;
  42876. t.ohungarumlaut = 556;
  42877. t.Eogonek = 667;
  42878. t.dcroat = 556;
  42879. t.threequarters = 834;
  42880. t.Scedilla = 667;
  42881. t.lcaron = 299;
  42882. t.Kcommaaccent = 667;
  42883. t.Lacute = 556;
  42884. t.trademark = 1000;
  42885. t.edotaccent = 556;
  42886. t.Igrave = 278;
  42887. t.Imacron = 278;
  42888. t.Lcaron = 556;
  42889. t.onehalf = 834;
  42890. t.lessequal = 549;
  42891. t.ocircumflex = 556;
  42892. t.ntilde = 556;
  42893. t.Uhungarumlaut = 722;
  42894. t.Eacute = 667;
  42895. t.emacron = 556;
  42896. t.gbreve = 556;
  42897. t.onequarter = 834;
  42898. t.Scaron = 667;
  42899. t.Scommaaccent = 667;
  42900. t.Ohungarumlaut = 778;
  42901. t.degree = 400;
  42902. t.ograve = 556;
  42903. t.Ccaron = 722;
  42904. t.ugrave = 556;
  42905. t.radical = 453;
  42906. t.Dcaron = 722;
  42907. t.rcommaaccent = 333;
  42908. t.Ntilde = 722;
  42909. t.otilde = 556;
  42910. t.Rcommaaccent = 722;
  42911. t.Lcommaaccent = 556;
  42912. t.Atilde = 667;
  42913. t.Aogonek = 667;
  42914. t.Aring = 667;
  42915. t.Otilde = 778;
  42916. t.zdotaccent = 500;
  42917. t.Ecaron = 667;
  42918. t.Iogonek = 278;
  42919. t.kcommaaccent = 500;
  42920. t.minus = 584;
  42921. t.Icircumflex = 278;
  42922. t.ncaron = 556;
  42923. t.tcommaaccent = 278;
  42924. t.logicalnot = 584;
  42925. t.odieresis = 556;
  42926. t.udieresis = 556;
  42927. t.notequal = 549;
  42928. t.gcommaaccent = 556;
  42929. t.eth = 556;
  42930. t.zcaron = 500;
  42931. t.ncommaaccent = 556;
  42932. t.onesuperior = 333;
  42933. t.imacron = 278;
  42934. t.Euro = 556;
  42935. });
  42936. t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) {
  42937. t.space = 250;
  42938. t.exclam = 333;
  42939. t.universal = 713;
  42940. t.numbersign = 500;
  42941. t.existential = 549;
  42942. t.percent = 833;
  42943. t.ampersand = 778;
  42944. t.suchthat = 439;
  42945. t.parenleft = 333;
  42946. t.parenright = 333;
  42947. t.asteriskmath = 500;
  42948. t.plus = 549;
  42949. t.comma = 250;
  42950. t.minus = 549;
  42951. t.period = 250;
  42952. t.slash = 278;
  42953. t.zero = 500;
  42954. t.one = 500;
  42955. t.two = 500;
  42956. t.three = 500;
  42957. t.four = 500;
  42958. t.five = 500;
  42959. t.six = 500;
  42960. t.seven = 500;
  42961. t.eight = 500;
  42962. t.nine = 500;
  42963. t.colon = 278;
  42964. t.semicolon = 278;
  42965. t.less = 549;
  42966. t.equal = 549;
  42967. t.greater = 549;
  42968. t.question = 444;
  42969. t.congruent = 549;
  42970. t.Alpha = 722;
  42971. t.Beta = 667;
  42972. t.Chi = 722;
  42973. t.Delta = 612;
  42974. t.Epsilon = 611;
  42975. t.Phi = 763;
  42976. t.Gamma = 603;
  42977. t.Eta = 722;
  42978. t.Iota = 333;
  42979. t.theta1 = 631;
  42980. t.Kappa = 722;
  42981. t.Lambda = 686;
  42982. t.Mu = 889;
  42983. t.Nu = 722;
  42984. t.Omicron = 722;
  42985. t.Pi = 768;
  42986. t.Theta = 741;
  42987. t.Rho = 556;
  42988. t.Sigma = 592;
  42989. t.Tau = 611;
  42990. t.Upsilon = 690;
  42991. t.sigma1 = 439;
  42992. t.Omega = 768;
  42993. t.Xi = 645;
  42994. t.Psi = 795;
  42995. t.Zeta = 611;
  42996. t.bracketleft = 333;
  42997. t.therefore = 863;
  42998. t.bracketright = 333;
  42999. t.perpendicular = 658;
  43000. t.underscore = 500;
  43001. t.radicalex = 500;
  43002. t.alpha = 631;
  43003. t.beta = 549;
  43004. t.chi = 549;
  43005. t.delta = 494;
  43006. t.epsilon = 439;
  43007. t.phi = 521;
  43008. t.gamma = 411;
  43009. t.eta = 603;
  43010. t.iota = 329;
  43011. t.phi1 = 603;
  43012. t.kappa = 549;
  43013. t.lambda = 549;
  43014. t.mu = 576;
  43015. t.nu = 521;
  43016. t.omicron = 549;
  43017. t.pi = 549;
  43018. t.theta = 521;
  43019. t.rho = 549;
  43020. t.sigma = 603;
  43021. t.tau = 439;
  43022. t.upsilon = 576;
  43023. t.omega1 = 713;
  43024. t.omega = 686;
  43025. t.xi = 493;
  43026. t.psi = 686;
  43027. t.zeta = 494;
  43028. t.braceleft = 480;
  43029. t.bar = 200;
  43030. t.braceright = 480;
  43031. t.similar = 549;
  43032. t.Euro = 750;
  43033. t.Upsilon1 = 620;
  43034. t.minute = 247;
  43035. t.lessequal = 549;
  43036. t.fraction = 167;
  43037. t.infinity = 713;
  43038. t.florin = 500;
  43039. t.club = 753;
  43040. t.diamond = 753;
  43041. t.heart = 753;
  43042. t.spade = 753;
  43043. t.arrowboth = 1042;
  43044. t.arrowleft = 987;
  43045. t.arrowup = 603;
  43046. t.arrowright = 987;
  43047. t.arrowdown = 603;
  43048. t.degree = 400;
  43049. t.plusminus = 549;
  43050. t.second = 411;
  43051. t.greaterequal = 549;
  43052. t.multiply = 549;
  43053. t.proportional = 713;
  43054. t.partialdiff = 494;
  43055. t.bullet = 460;
  43056. t.divide = 549;
  43057. t.notequal = 549;
  43058. t.equivalence = 549;
  43059. t.approxequal = 549;
  43060. t.ellipsis = 1000;
  43061. t.arrowvertex = 603;
  43062. t.arrowhorizex = 1000;
  43063. t.carriagereturn = 658;
  43064. t.aleph = 823;
  43065. t.Ifraktur = 686;
  43066. t.Rfraktur = 795;
  43067. t.weierstrass = 987;
  43068. t.circlemultiply = 768;
  43069. t.circleplus = 768;
  43070. t.emptyset = 823;
  43071. t.intersection = 768;
  43072. t.union = 768;
  43073. t.propersuperset = 713;
  43074. t.reflexsuperset = 713;
  43075. t.notsubset = 713;
  43076. t.propersubset = 713;
  43077. t.reflexsubset = 713;
  43078. t.element = 713;
  43079. t.notelement = 713;
  43080. t.angle = 768;
  43081. t.gradient = 713;
  43082. t.registerserif = 790;
  43083. t.copyrightserif = 790;
  43084. t.trademarkserif = 890;
  43085. t.product = 823;
  43086. t.radical = 549;
  43087. t.dotmath = 250;
  43088. t.logicalnot = 713;
  43089. t.logicaland = 603;
  43090. t.logicalor = 603;
  43091. t.arrowdblboth = 1042;
  43092. t.arrowdblleft = 987;
  43093. t.arrowdblup = 603;
  43094. t.arrowdblright = 987;
  43095. t.arrowdbldown = 603;
  43096. t.lozenge = 494;
  43097. t.angleleft = 329;
  43098. t.registersans = 790;
  43099. t.copyrightsans = 790;
  43100. t.trademarksans = 786;
  43101. t.summation = 713;
  43102. t.parenlefttp = 384;
  43103. t.parenleftex = 384;
  43104. t.parenleftbt = 384;
  43105. t.bracketlefttp = 384;
  43106. t.bracketleftex = 384;
  43107. t.bracketleftbt = 384;
  43108. t.bracelefttp = 494;
  43109. t.braceleftmid = 494;
  43110. t.braceleftbt = 494;
  43111. t.braceex = 494;
  43112. t.angleright = 329;
  43113. t.integral = 274;
  43114. t.integraltp = 686;
  43115. t.integralex = 686;
  43116. t.integralbt = 686;
  43117. t.parenrighttp = 384;
  43118. t.parenrightex = 384;
  43119. t.parenrightbt = 384;
  43120. t.bracketrighttp = 384;
  43121. t.bracketrightex = 384;
  43122. t.bracketrightbt = 384;
  43123. t.bracerighttp = 494;
  43124. t.bracerightmid = 494;
  43125. t.bracerightbt = 494;
  43126. t.apple = 790;
  43127. });
  43128. t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43129. t.space = 250;
  43130. t.exclam = 333;
  43131. t.quotedbl = 408;
  43132. t.numbersign = 500;
  43133. t.dollar = 500;
  43134. t.percent = 833;
  43135. t.ampersand = 778;
  43136. t.quoteright = 333;
  43137. t.parenleft = 333;
  43138. t.parenright = 333;
  43139. t.asterisk = 500;
  43140. t.plus = 564;
  43141. t.comma = 250;
  43142. t.hyphen = 333;
  43143. t.period = 250;
  43144. t.slash = 278;
  43145. t.zero = 500;
  43146. t.one = 500;
  43147. t.two = 500;
  43148. t.three = 500;
  43149. t.four = 500;
  43150. t.five = 500;
  43151. t.six = 500;
  43152. t.seven = 500;
  43153. t.eight = 500;
  43154. t.nine = 500;
  43155. t.colon = 278;
  43156. t.semicolon = 278;
  43157. t.less = 564;
  43158. t.equal = 564;
  43159. t.greater = 564;
  43160. t.question = 444;
  43161. t.at = 921;
  43162. t.A = 722;
  43163. t.B = 667;
  43164. t.C = 667;
  43165. t.D = 722;
  43166. t.E = 611;
  43167. t.F = 556;
  43168. t.G = 722;
  43169. t.H = 722;
  43170. t.I = 333;
  43171. t.J = 389;
  43172. t.K = 722;
  43173. t.L = 611;
  43174. t.M = 889;
  43175. t.N = 722;
  43176. t.O = 722;
  43177. t.P = 556;
  43178. t.Q = 722;
  43179. t.R = 667;
  43180. t.S = 556;
  43181. t.T = 611;
  43182. t.U = 722;
  43183. t.V = 722;
  43184. t.W = 944;
  43185. t.X = 722;
  43186. t.Y = 722;
  43187. t.Z = 611;
  43188. t.bracketleft = 333;
  43189. t.backslash = 278;
  43190. t.bracketright = 333;
  43191. t.asciicircum = 469;
  43192. t.underscore = 500;
  43193. t.quoteleft = 333;
  43194. t.a = 444;
  43195. t.b = 500;
  43196. t.c = 444;
  43197. t.d = 500;
  43198. t.e = 444;
  43199. t.f = 333;
  43200. t.g = 500;
  43201. t.h = 500;
  43202. t.i = 278;
  43203. t.j = 278;
  43204. t.k = 500;
  43205. t.l = 278;
  43206. t.m = 778;
  43207. t.n = 500;
  43208. t.o = 500;
  43209. t.p = 500;
  43210. t.q = 500;
  43211. t.r = 333;
  43212. t.s = 389;
  43213. t.t = 278;
  43214. t.u = 500;
  43215. t.v = 500;
  43216. t.w = 722;
  43217. t.x = 500;
  43218. t.y = 500;
  43219. t.z = 444;
  43220. t.braceleft = 480;
  43221. t.bar = 200;
  43222. t.braceright = 480;
  43223. t.asciitilde = 541;
  43224. t.exclamdown = 333;
  43225. t.cent = 500;
  43226. t.sterling = 500;
  43227. t.fraction = 167;
  43228. t.yen = 500;
  43229. t.florin = 500;
  43230. t.section = 500;
  43231. t.currency = 500;
  43232. t.quotesingle = 180;
  43233. t.quotedblleft = 444;
  43234. t.guillemotleft = 500;
  43235. t.guilsinglleft = 333;
  43236. t.guilsinglright = 333;
  43237. t.fi = 556;
  43238. t.fl = 556;
  43239. t.endash = 500;
  43240. t.dagger = 500;
  43241. t.daggerdbl = 500;
  43242. t.periodcentered = 250;
  43243. t.paragraph = 453;
  43244. t.bullet = 350;
  43245. t.quotesinglbase = 333;
  43246. t.quotedblbase = 444;
  43247. t.quotedblright = 444;
  43248. t.guillemotright = 500;
  43249. t.ellipsis = 1000;
  43250. t.perthousand = 1000;
  43251. t.questiondown = 444;
  43252. t.grave = 333;
  43253. t.acute = 333;
  43254. t.circumflex = 333;
  43255. t.tilde = 333;
  43256. t.macron = 333;
  43257. t.breve = 333;
  43258. t.dotaccent = 333;
  43259. t.dieresis = 333;
  43260. t.ring = 333;
  43261. t.cedilla = 333;
  43262. t.hungarumlaut = 333;
  43263. t.ogonek = 333;
  43264. t.caron = 333;
  43265. t.emdash = 1000;
  43266. t.AE = 889;
  43267. t.ordfeminine = 276;
  43268. t.Lslash = 611;
  43269. t.Oslash = 722;
  43270. t.OE = 889;
  43271. t.ordmasculine = 310;
  43272. t.ae = 667;
  43273. t.dotlessi = 278;
  43274. t.lslash = 278;
  43275. t.oslash = 500;
  43276. t.oe = 722;
  43277. t.germandbls = 500;
  43278. t.Idieresis = 333;
  43279. t.eacute = 444;
  43280. t.abreve = 444;
  43281. t.uhungarumlaut = 500;
  43282. t.ecaron = 444;
  43283. t.Ydieresis = 722;
  43284. t.divide = 564;
  43285. t.Yacute = 722;
  43286. t.Acircumflex = 722;
  43287. t.aacute = 444;
  43288. t.Ucircumflex = 722;
  43289. t.yacute = 500;
  43290. t.scommaaccent = 389;
  43291. t.ecircumflex = 444;
  43292. t.Uring = 722;
  43293. t.Udieresis = 722;
  43294. t.aogonek = 444;
  43295. t.Uacute = 722;
  43296. t.uogonek = 500;
  43297. t.Edieresis = 611;
  43298. t.Dcroat = 722;
  43299. t.commaaccent = 250;
  43300. t.copyright = 760;
  43301. t.Emacron = 611;
  43302. t.ccaron = 444;
  43303. t.aring = 444;
  43304. t.Ncommaaccent = 722;
  43305. t.lacute = 278;
  43306. t.agrave = 444;
  43307. t.Tcommaaccent = 611;
  43308. t.Cacute = 667;
  43309. t.atilde = 444;
  43310. t.Edotaccent = 611;
  43311. t.scaron = 389;
  43312. t.scedilla = 389;
  43313. t.iacute = 278;
  43314. t.lozenge = 471;
  43315. t.Rcaron = 667;
  43316. t.Gcommaaccent = 722;
  43317. t.ucircumflex = 500;
  43318. t.acircumflex = 444;
  43319. t.Amacron = 722;
  43320. t.rcaron = 333;
  43321. t.ccedilla = 444;
  43322. t.Zdotaccent = 611;
  43323. t.Thorn = 556;
  43324. t.Omacron = 722;
  43325. t.Racute = 667;
  43326. t.Sacute = 556;
  43327. t.dcaron = 588;
  43328. t.Umacron = 722;
  43329. t.uring = 500;
  43330. t.threesuperior = 300;
  43331. t.Ograve = 722;
  43332. t.Agrave = 722;
  43333. t.Abreve = 722;
  43334. t.multiply = 564;
  43335. t.uacute = 500;
  43336. t.Tcaron = 611;
  43337. t.partialdiff = 476;
  43338. t.ydieresis = 500;
  43339. t.Nacute = 722;
  43340. t.icircumflex = 278;
  43341. t.Ecircumflex = 611;
  43342. t.adieresis = 444;
  43343. t.edieresis = 444;
  43344. t.cacute = 444;
  43345. t.nacute = 500;
  43346. t.umacron = 500;
  43347. t.Ncaron = 722;
  43348. t.Iacute = 333;
  43349. t.plusminus = 564;
  43350. t.brokenbar = 200;
  43351. t.registered = 760;
  43352. t.Gbreve = 722;
  43353. t.Idotaccent = 333;
  43354. t.summation = 600;
  43355. t.Egrave = 611;
  43356. t.racute = 333;
  43357. t.omacron = 500;
  43358. t.Zacute = 611;
  43359. t.Zcaron = 611;
  43360. t.greaterequal = 549;
  43361. t.Eth = 722;
  43362. t.Ccedilla = 667;
  43363. t.lcommaaccent = 278;
  43364. t.tcaron = 326;
  43365. t.eogonek = 444;
  43366. t.Uogonek = 722;
  43367. t.Aacute = 722;
  43368. t.Adieresis = 722;
  43369. t.egrave = 444;
  43370. t.zacute = 444;
  43371. t.iogonek = 278;
  43372. t.Oacute = 722;
  43373. t.oacute = 500;
  43374. t.amacron = 444;
  43375. t.sacute = 389;
  43376. t.idieresis = 278;
  43377. t.Ocircumflex = 722;
  43378. t.Ugrave = 722;
  43379. t.Delta = 612;
  43380. t.thorn = 500;
  43381. t.twosuperior = 300;
  43382. t.Odieresis = 722;
  43383. t.mu = 500;
  43384. t.igrave = 278;
  43385. t.ohungarumlaut = 500;
  43386. t.Eogonek = 611;
  43387. t.dcroat = 500;
  43388. t.threequarters = 750;
  43389. t.Scedilla = 556;
  43390. t.lcaron = 344;
  43391. t.Kcommaaccent = 722;
  43392. t.Lacute = 611;
  43393. t.trademark = 980;
  43394. t.edotaccent = 444;
  43395. t.Igrave = 333;
  43396. t.Imacron = 333;
  43397. t.Lcaron = 611;
  43398. t.onehalf = 750;
  43399. t.lessequal = 549;
  43400. t.ocircumflex = 500;
  43401. t.ntilde = 500;
  43402. t.Uhungarumlaut = 722;
  43403. t.Eacute = 611;
  43404. t.emacron = 444;
  43405. t.gbreve = 500;
  43406. t.onequarter = 750;
  43407. t.Scaron = 556;
  43408. t.Scommaaccent = 556;
  43409. t.Ohungarumlaut = 722;
  43410. t.degree = 400;
  43411. t.ograve = 500;
  43412. t.Ccaron = 667;
  43413. t.ugrave = 500;
  43414. t.radical = 453;
  43415. t.Dcaron = 722;
  43416. t.rcommaaccent = 333;
  43417. t.Ntilde = 722;
  43418. t.otilde = 500;
  43419. t.Rcommaaccent = 667;
  43420. t.Lcommaaccent = 611;
  43421. t.Atilde = 722;
  43422. t.Aogonek = 722;
  43423. t.Aring = 722;
  43424. t.Otilde = 722;
  43425. t.zdotaccent = 444;
  43426. t.Ecaron = 611;
  43427. t.Iogonek = 333;
  43428. t.kcommaaccent = 500;
  43429. t.minus = 564;
  43430. t.Icircumflex = 333;
  43431. t.ncaron = 500;
  43432. t.tcommaaccent = 278;
  43433. t.logicalnot = 564;
  43434. t.odieresis = 500;
  43435. t.udieresis = 500;
  43436. t.notequal = 549;
  43437. t.gcommaaccent = 500;
  43438. t.eth = 500;
  43439. t.zcaron = 444;
  43440. t.ncommaaccent = 500;
  43441. t.onesuperior = 300;
  43442. t.imacron = 278;
  43443. t.Euro = 500;
  43444. });
  43445. t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43446. t.space = 250;
  43447. t.exclam = 333;
  43448. t.quotedbl = 555;
  43449. t.numbersign = 500;
  43450. t.dollar = 500;
  43451. t.percent = 1000;
  43452. t.ampersand = 833;
  43453. t.quoteright = 333;
  43454. t.parenleft = 333;
  43455. t.parenright = 333;
  43456. t.asterisk = 500;
  43457. t.plus = 570;
  43458. t.comma = 250;
  43459. t.hyphen = 333;
  43460. t.period = 250;
  43461. t.slash = 278;
  43462. t.zero = 500;
  43463. t.one = 500;
  43464. t.two = 500;
  43465. t.three = 500;
  43466. t.four = 500;
  43467. t.five = 500;
  43468. t.six = 500;
  43469. t.seven = 500;
  43470. t.eight = 500;
  43471. t.nine = 500;
  43472. t.colon = 333;
  43473. t.semicolon = 333;
  43474. t.less = 570;
  43475. t.equal = 570;
  43476. t.greater = 570;
  43477. t.question = 500;
  43478. t.at = 930;
  43479. t.A = 722;
  43480. t.B = 667;
  43481. t.C = 722;
  43482. t.D = 722;
  43483. t.E = 667;
  43484. t.F = 611;
  43485. t.G = 778;
  43486. t.H = 778;
  43487. t.I = 389;
  43488. t.J = 500;
  43489. t.K = 778;
  43490. t.L = 667;
  43491. t.M = 944;
  43492. t.N = 722;
  43493. t.O = 778;
  43494. t.P = 611;
  43495. t.Q = 778;
  43496. t.R = 722;
  43497. t.S = 556;
  43498. t.T = 667;
  43499. t.U = 722;
  43500. t.V = 722;
  43501. t.W = 1000;
  43502. t.X = 722;
  43503. t.Y = 722;
  43504. t.Z = 667;
  43505. t.bracketleft = 333;
  43506. t.backslash = 278;
  43507. t.bracketright = 333;
  43508. t.asciicircum = 581;
  43509. t.underscore = 500;
  43510. t.quoteleft = 333;
  43511. t.a = 500;
  43512. t.b = 556;
  43513. t.c = 444;
  43514. t.d = 556;
  43515. t.e = 444;
  43516. t.f = 333;
  43517. t.g = 500;
  43518. t.h = 556;
  43519. t.i = 278;
  43520. t.j = 333;
  43521. t.k = 556;
  43522. t.l = 278;
  43523. t.m = 833;
  43524. t.n = 556;
  43525. t.o = 500;
  43526. t.p = 556;
  43527. t.q = 556;
  43528. t.r = 444;
  43529. t.s = 389;
  43530. t.t = 333;
  43531. t.u = 556;
  43532. t.v = 500;
  43533. t.w = 722;
  43534. t.x = 500;
  43535. t.y = 500;
  43536. t.z = 444;
  43537. t.braceleft = 394;
  43538. t.bar = 220;
  43539. t.braceright = 394;
  43540. t.asciitilde = 520;
  43541. t.exclamdown = 333;
  43542. t.cent = 500;
  43543. t.sterling = 500;
  43544. t.fraction = 167;
  43545. t.yen = 500;
  43546. t.florin = 500;
  43547. t.section = 500;
  43548. t.currency = 500;
  43549. t.quotesingle = 278;
  43550. t.quotedblleft = 500;
  43551. t.guillemotleft = 500;
  43552. t.guilsinglleft = 333;
  43553. t.guilsinglright = 333;
  43554. t.fi = 556;
  43555. t.fl = 556;
  43556. t.endash = 500;
  43557. t.dagger = 500;
  43558. t.daggerdbl = 500;
  43559. t.periodcentered = 250;
  43560. t.paragraph = 540;
  43561. t.bullet = 350;
  43562. t.quotesinglbase = 333;
  43563. t.quotedblbase = 500;
  43564. t.quotedblright = 500;
  43565. t.guillemotright = 500;
  43566. t.ellipsis = 1000;
  43567. t.perthousand = 1000;
  43568. t.questiondown = 500;
  43569. t.grave = 333;
  43570. t.acute = 333;
  43571. t.circumflex = 333;
  43572. t.tilde = 333;
  43573. t.macron = 333;
  43574. t.breve = 333;
  43575. t.dotaccent = 333;
  43576. t.dieresis = 333;
  43577. t.ring = 333;
  43578. t.cedilla = 333;
  43579. t.hungarumlaut = 333;
  43580. t.ogonek = 333;
  43581. t.caron = 333;
  43582. t.emdash = 1000;
  43583. t.AE = 1000;
  43584. t.ordfeminine = 300;
  43585. t.Lslash = 667;
  43586. t.Oslash = 778;
  43587. t.OE = 1000;
  43588. t.ordmasculine = 330;
  43589. t.ae = 722;
  43590. t.dotlessi = 278;
  43591. t.lslash = 278;
  43592. t.oslash = 500;
  43593. t.oe = 722;
  43594. t.germandbls = 556;
  43595. t.Idieresis = 389;
  43596. t.eacute = 444;
  43597. t.abreve = 500;
  43598. t.uhungarumlaut = 556;
  43599. t.ecaron = 444;
  43600. t.Ydieresis = 722;
  43601. t.divide = 570;
  43602. t.Yacute = 722;
  43603. t.Acircumflex = 722;
  43604. t.aacute = 500;
  43605. t.Ucircumflex = 722;
  43606. t.yacute = 500;
  43607. t.scommaaccent = 389;
  43608. t.ecircumflex = 444;
  43609. t.Uring = 722;
  43610. t.Udieresis = 722;
  43611. t.aogonek = 500;
  43612. t.Uacute = 722;
  43613. t.uogonek = 556;
  43614. t.Edieresis = 667;
  43615. t.Dcroat = 722;
  43616. t.commaaccent = 250;
  43617. t.copyright = 747;
  43618. t.Emacron = 667;
  43619. t.ccaron = 444;
  43620. t.aring = 500;
  43621. t.Ncommaaccent = 722;
  43622. t.lacute = 278;
  43623. t.agrave = 500;
  43624. t.Tcommaaccent = 667;
  43625. t.Cacute = 722;
  43626. t.atilde = 500;
  43627. t.Edotaccent = 667;
  43628. t.scaron = 389;
  43629. t.scedilla = 389;
  43630. t.iacute = 278;
  43631. t.lozenge = 494;
  43632. t.Rcaron = 722;
  43633. t.Gcommaaccent = 778;
  43634. t.ucircumflex = 556;
  43635. t.acircumflex = 500;
  43636. t.Amacron = 722;
  43637. t.rcaron = 444;
  43638. t.ccedilla = 444;
  43639. t.Zdotaccent = 667;
  43640. t.Thorn = 611;
  43641. t.Omacron = 778;
  43642. t.Racute = 722;
  43643. t.Sacute = 556;
  43644. t.dcaron = 672;
  43645. t.Umacron = 722;
  43646. t.uring = 556;
  43647. t.threesuperior = 300;
  43648. t.Ograve = 778;
  43649. t.Agrave = 722;
  43650. t.Abreve = 722;
  43651. t.multiply = 570;
  43652. t.uacute = 556;
  43653. t.Tcaron = 667;
  43654. t.partialdiff = 494;
  43655. t.ydieresis = 500;
  43656. t.Nacute = 722;
  43657. t.icircumflex = 278;
  43658. t.Ecircumflex = 667;
  43659. t.adieresis = 500;
  43660. t.edieresis = 444;
  43661. t.cacute = 444;
  43662. t.nacute = 556;
  43663. t.umacron = 556;
  43664. t.Ncaron = 722;
  43665. t.Iacute = 389;
  43666. t.plusminus = 570;
  43667. t.brokenbar = 220;
  43668. t.registered = 747;
  43669. t.Gbreve = 778;
  43670. t.Idotaccent = 389;
  43671. t.summation = 600;
  43672. t.Egrave = 667;
  43673. t.racute = 444;
  43674. t.omacron = 500;
  43675. t.Zacute = 667;
  43676. t.Zcaron = 667;
  43677. t.greaterequal = 549;
  43678. t.Eth = 722;
  43679. t.Ccedilla = 722;
  43680. t.lcommaaccent = 278;
  43681. t.tcaron = 416;
  43682. t.eogonek = 444;
  43683. t.Uogonek = 722;
  43684. t.Aacute = 722;
  43685. t.Adieresis = 722;
  43686. t.egrave = 444;
  43687. t.zacute = 444;
  43688. t.iogonek = 278;
  43689. t.Oacute = 778;
  43690. t.oacute = 500;
  43691. t.amacron = 500;
  43692. t.sacute = 389;
  43693. t.idieresis = 278;
  43694. t.Ocircumflex = 778;
  43695. t.Ugrave = 722;
  43696. t.Delta = 612;
  43697. t.thorn = 556;
  43698. t.twosuperior = 300;
  43699. t.Odieresis = 778;
  43700. t.mu = 556;
  43701. t.igrave = 278;
  43702. t.ohungarumlaut = 500;
  43703. t.Eogonek = 667;
  43704. t.dcroat = 556;
  43705. t.threequarters = 750;
  43706. t.Scedilla = 556;
  43707. t.lcaron = 394;
  43708. t.Kcommaaccent = 778;
  43709. t.Lacute = 667;
  43710. t.trademark = 1000;
  43711. t.edotaccent = 444;
  43712. t.Igrave = 389;
  43713. t.Imacron = 389;
  43714. t.Lcaron = 667;
  43715. t.onehalf = 750;
  43716. t.lessequal = 549;
  43717. t.ocircumflex = 500;
  43718. t.ntilde = 556;
  43719. t.Uhungarumlaut = 722;
  43720. t.Eacute = 667;
  43721. t.emacron = 444;
  43722. t.gbreve = 500;
  43723. t.onequarter = 750;
  43724. t.Scaron = 556;
  43725. t.Scommaaccent = 556;
  43726. t.Ohungarumlaut = 778;
  43727. t.degree = 400;
  43728. t.ograve = 500;
  43729. t.Ccaron = 722;
  43730. t.ugrave = 556;
  43731. t.radical = 549;
  43732. t.Dcaron = 722;
  43733. t.rcommaaccent = 444;
  43734. t.Ntilde = 722;
  43735. t.otilde = 500;
  43736. t.Rcommaaccent = 722;
  43737. t.Lcommaaccent = 667;
  43738. t.Atilde = 722;
  43739. t.Aogonek = 722;
  43740. t.Aring = 722;
  43741. t.Otilde = 778;
  43742. t.zdotaccent = 444;
  43743. t.Ecaron = 667;
  43744. t.Iogonek = 389;
  43745. t.kcommaaccent = 556;
  43746. t.minus = 570;
  43747. t.Icircumflex = 389;
  43748. t.ncaron = 556;
  43749. t.tcommaaccent = 333;
  43750. t.logicalnot = 570;
  43751. t.odieresis = 500;
  43752. t.udieresis = 556;
  43753. t.notequal = 549;
  43754. t.gcommaaccent = 500;
  43755. t.eth = 500;
  43756. t.zcaron = 444;
  43757. t.ncommaaccent = 556;
  43758. t.onesuperior = 300;
  43759. t.imacron = 278;
  43760. t.Euro = 500;
  43761. });
  43762. t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43763. t.space = 250;
  43764. t.exclam = 389;
  43765. t.quotedbl = 555;
  43766. t.numbersign = 500;
  43767. t.dollar = 500;
  43768. t.percent = 833;
  43769. t.ampersand = 778;
  43770. t.quoteright = 333;
  43771. t.parenleft = 333;
  43772. t.parenright = 333;
  43773. t.asterisk = 500;
  43774. t.plus = 570;
  43775. t.comma = 250;
  43776. t.hyphen = 333;
  43777. t.period = 250;
  43778. t.slash = 278;
  43779. t.zero = 500;
  43780. t.one = 500;
  43781. t.two = 500;
  43782. t.three = 500;
  43783. t.four = 500;
  43784. t.five = 500;
  43785. t.six = 500;
  43786. t.seven = 500;
  43787. t.eight = 500;
  43788. t.nine = 500;
  43789. t.colon = 333;
  43790. t.semicolon = 333;
  43791. t.less = 570;
  43792. t.equal = 570;
  43793. t.greater = 570;
  43794. t.question = 500;
  43795. t.at = 832;
  43796. t.A = 667;
  43797. t.B = 667;
  43798. t.C = 667;
  43799. t.D = 722;
  43800. t.E = 667;
  43801. t.F = 667;
  43802. t.G = 722;
  43803. t.H = 778;
  43804. t.I = 389;
  43805. t.J = 500;
  43806. t.K = 667;
  43807. t.L = 611;
  43808. t.M = 889;
  43809. t.N = 722;
  43810. t.O = 722;
  43811. t.P = 611;
  43812. t.Q = 722;
  43813. t.R = 667;
  43814. t.S = 556;
  43815. t.T = 611;
  43816. t.U = 722;
  43817. t.V = 667;
  43818. t.W = 889;
  43819. t.X = 667;
  43820. t.Y = 611;
  43821. t.Z = 611;
  43822. t.bracketleft = 333;
  43823. t.backslash = 278;
  43824. t.bracketright = 333;
  43825. t.asciicircum = 570;
  43826. t.underscore = 500;
  43827. t.quoteleft = 333;
  43828. t.a = 500;
  43829. t.b = 500;
  43830. t.c = 444;
  43831. t.d = 500;
  43832. t.e = 444;
  43833. t.f = 333;
  43834. t.g = 500;
  43835. t.h = 556;
  43836. t.i = 278;
  43837. t.j = 278;
  43838. t.k = 500;
  43839. t.l = 278;
  43840. t.m = 778;
  43841. t.n = 556;
  43842. t.o = 500;
  43843. t.p = 500;
  43844. t.q = 500;
  43845. t.r = 389;
  43846. t.s = 389;
  43847. t.t = 278;
  43848. t.u = 556;
  43849. t.v = 444;
  43850. t.w = 667;
  43851. t.x = 500;
  43852. t.y = 444;
  43853. t.z = 389;
  43854. t.braceleft = 348;
  43855. t.bar = 220;
  43856. t.braceright = 348;
  43857. t.asciitilde = 570;
  43858. t.exclamdown = 389;
  43859. t.cent = 500;
  43860. t.sterling = 500;
  43861. t.fraction = 167;
  43862. t.yen = 500;
  43863. t.florin = 500;
  43864. t.section = 500;
  43865. t.currency = 500;
  43866. t.quotesingle = 278;
  43867. t.quotedblleft = 500;
  43868. t.guillemotleft = 500;
  43869. t.guilsinglleft = 333;
  43870. t.guilsinglright = 333;
  43871. t.fi = 556;
  43872. t.fl = 556;
  43873. t.endash = 500;
  43874. t.dagger = 500;
  43875. t.daggerdbl = 500;
  43876. t.periodcentered = 250;
  43877. t.paragraph = 500;
  43878. t.bullet = 350;
  43879. t.quotesinglbase = 333;
  43880. t.quotedblbase = 500;
  43881. t.quotedblright = 500;
  43882. t.guillemotright = 500;
  43883. t.ellipsis = 1000;
  43884. t.perthousand = 1000;
  43885. t.questiondown = 500;
  43886. t.grave = 333;
  43887. t.acute = 333;
  43888. t.circumflex = 333;
  43889. t.tilde = 333;
  43890. t.macron = 333;
  43891. t.breve = 333;
  43892. t.dotaccent = 333;
  43893. t.dieresis = 333;
  43894. t.ring = 333;
  43895. t.cedilla = 333;
  43896. t.hungarumlaut = 333;
  43897. t.ogonek = 333;
  43898. t.caron = 333;
  43899. t.emdash = 1000;
  43900. t.AE = 944;
  43901. t.ordfeminine = 266;
  43902. t.Lslash = 611;
  43903. t.Oslash = 722;
  43904. t.OE = 944;
  43905. t.ordmasculine = 300;
  43906. t.ae = 722;
  43907. t.dotlessi = 278;
  43908. t.lslash = 278;
  43909. t.oslash = 500;
  43910. t.oe = 722;
  43911. t.germandbls = 500;
  43912. t.Idieresis = 389;
  43913. t.eacute = 444;
  43914. t.abreve = 500;
  43915. t.uhungarumlaut = 556;
  43916. t.ecaron = 444;
  43917. t.Ydieresis = 611;
  43918. t.divide = 570;
  43919. t.Yacute = 611;
  43920. t.Acircumflex = 667;
  43921. t.aacute = 500;
  43922. t.Ucircumflex = 722;
  43923. t.yacute = 444;
  43924. t.scommaaccent = 389;
  43925. t.ecircumflex = 444;
  43926. t.Uring = 722;
  43927. t.Udieresis = 722;
  43928. t.aogonek = 500;
  43929. t.Uacute = 722;
  43930. t.uogonek = 556;
  43931. t.Edieresis = 667;
  43932. t.Dcroat = 722;
  43933. t.commaaccent = 250;
  43934. t.copyright = 747;
  43935. t.Emacron = 667;
  43936. t.ccaron = 444;
  43937. t.aring = 500;
  43938. t.Ncommaaccent = 722;
  43939. t.lacute = 278;
  43940. t.agrave = 500;
  43941. t.Tcommaaccent = 611;
  43942. t.Cacute = 667;
  43943. t.atilde = 500;
  43944. t.Edotaccent = 667;
  43945. t.scaron = 389;
  43946. t.scedilla = 389;
  43947. t.iacute = 278;
  43948. t.lozenge = 494;
  43949. t.Rcaron = 667;
  43950. t.Gcommaaccent = 722;
  43951. t.ucircumflex = 556;
  43952. t.acircumflex = 500;
  43953. t.Amacron = 667;
  43954. t.rcaron = 389;
  43955. t.ccedilla = 444;
  43956. t.Zdotaccent = 611;
  43957. t.Thorn = 611;
  43958. t.Omacron = 722;
  43959. t.Racute = 667;
  43960. t.Sacute = 556;
  43961. t.dcaron = 608;
  43962. t.Umacron = 722;
  43963. t.uring = 556;
  43964. t.threesuperior = 300;
  43965. t.Ograve = 722;
  43966. t.Agrave = 667;
  43967. t.Abreve = 667;
  43968. t.multiply = 570;
  43969. t.uacute = 556;
  43970. t.Tcaron = 611;
  43971. t.partialdiff = 494;
  43972. t.ydieresis = 444;
  43973. t.Nacute = 722;
  43974. t.icircumflex = 278;
  43975. t.Ecircumflex = 667;
  43976. t.adieresis = 500;
  43977. t.edieresis = 444;
  43978. t.cacute = 444;
  43979. t.nacute = 556;
  43980. t.umacron = 556;
  43981. t.Ncaron = 722;
  43982. t.Iacute = 389;
  43983. t.plusminus = 570;
  43984. t.brokenbar = 220;
  43985. t.registered = 747;
  43986. t.Gbreve = 722;
  43987. t.Idotaccent = 389;
  43988. t.summation = 600;
  43989. t.Egrave = 667;
  43990. t.racute = 389;
  43991. t.omacron = 500;
  43992. t.Zacute = 611;
  43993. t.Zcaron = 611;
  43994. t.greaterequal = 549;
  43995. t.Eth = 722;
  43996. t.Ccedilla = 667;
  43997. t.lcommaaccent = 278;
  43998. t.tcaron = 366;
  43999. t.eogonek = 444;
  44000. t.Uogonek = 722;
  44001. t.Aacute = 667;
  44002. t.Adieresis = 667;
  44003. t.egrave = 444;
  44004. t.zacute = 389;
  44005. t.iogonek = 278;
  44006. t.Oacute = 722;
  44007. t.oacute = 500;
  44008. t.amacron = 500;
  44009. t.sacute = 389;
  44010. t.idieresis = 278;
  44011. t.Ocircumflex = 722;
  44012. t.Ugrave = 722;
  44013. t.Delta = 612;
  44014. t.thorn = 500;
  44015. t.twosuperior = 300;
  44016. t.Odieresis = 722;
  44017. t.mu = 576;
  44018. t.igrave = 278;
  44019. t.ohungarumlaut = 500;
  44020. t.Eogonek = 667;
  44021. t.dcroat = 500;
  44022. t.threequarters = 750;
  44023. t.Scedilla = 556;
  44024. t.lcaron = 382;
  44025. t.Kcommaaccent = 667;
  44026. t.Lacute = 611;
  44027. t.trademark = 1000;
  44028. t.edotaccent = 444;
  44029. t.Igrave = 389;
  44030. t.Imacron = 389;
  44031. t.Lcaron = 611;
  44032. t.onehalf = 750;
  44033. t.lessequal = 549;
  44034. t.ocircumflex = 500;
  44035. t.ntilde = 556;
  44036. t.Uhungarumlaut = 722;
  44037. t.Eacute = 667;
  44038. t.emacron = 444;
  44039. t.gbreve = 500;
  44040. t.onequarter = 750;
  44041. t.Scaron = 556;
  44042. t.Scommaaccent = 556;
  44043. t.Ohungarumlaut = 722;
  44044. t.degree = 400;
  44045. t.ograve = 500;
  44046. t.Ccaron = 667;
  44047. t.ugrave = 556;
  44048. t.radical = 549;
  44049. t.Dcaron = 722;
  44050. t.rcommaaccent = 389;
  44051. t.Ntilde = 722;
  44052. t.otilde = 500;
  44053. t.Rcommaaccent = 667;
  44054. t.Lcommaaccent = 611;
  44055. t.Atilde = 667;
  44056. t.Aogonek = 667;
  44057. t.Aring = 667;
  44058. t.Otilde = 722;
  44059. t.zdotaccent = 389;
  44060. t.Ecaron = 667;
  44061. t.Iogonek = 389;
  44062. t.kcommaaccent = 500;
  44063. t.minus = 606;
  44064. t.Icircumflex = 389;
  44065. t.ncaron = 556;
  44066. t.tcommaaccent = 278;
  44067. t.logicalnot = 606;
  44068. t.odieresis = 500;
  44069. t.udieresis = 556;
  44070. t.notequal = 549;
  44071. t.gcommaaccent = 500;
  44072. t.eth = 500;
  44073. t.zcaron = 389;
  44074. t.ncommaaccent = 556;
  44075. t.onesuperior = 300;
  44076. t.imacron = 278;
  44077. t.Euro = 500;
  44078. });
  44079. t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  44080. t.space = 250;
  44081. t.exclam = 333;
  44082. t.quotedbl = 420;
  44083. t.numbersign = 500;
  44084. t.dollar = 500;
  44085. t.percent = 833;
  44086. t.ampersand = 778;
  44087. t.quoteright = 333;
  44088. t.parenleft = 333;
  44089. t.parenright = 333;
  44090. t.asterisk = 500;
  44091. t.plus = 675;
  44092. t.comma = 250;
  44093. t.hyphen = 333;
  44094. t.period = 250;
  44095. t.slash = 278;
  44096. t.zero = 500;
  44097. t.one = 500;
  44098. t.two = 500;
  44099. t.three = 500;
  44100. t.four = 500;
  44101. t.five = 500;
  44102. t.six = 500;
  44103. t.seven = 500;
  44104. t.eight = 500;
  44105. t.nine = 500;
  44106. t.colon = 333;
  44107. t.semicolon = 333;
  44108. t.less = 675;
  44109. t.equal = 675;
  44110. t.greater = 675;
  44111. t.question = 500;
  44112. t.at = 920;
  44113. t.A = 611;
  44114. t.B = 611;
  44115. t.C = 667;
  44116. t.D = 722;
  44117. t.E = 611;
  44118. t.F = 611;
  44119. t.G = 722;
  44120. t.H = 722;
  44121. t.I = 333;
  44122. t.J = 444;
  44123. t.K = 667;
  44124. t.L = 556;
  44125. t.M = 833;
  44126. t.N = 667;
  44127. t.O = 722;
  44128. t.P = 611;
  44129. t.Q = 722;
  44130. t.R = 611;
  44131. t.S = 500;
  44132. t.T = 556;
  44133. t.U = 722;
  44134. t.V = 611;
  44135. t.W = 833;
  44136. t.X = 611;
  44137. t.Y = 556;
  44138. t.Z = 556;
  44139. t.bracketleft = 389;
  44140. t.backslash = 278;
  44141. t.bracketright = 389;
  44142. t.asciicircum = 422;
  44143. t.underscore = 500;
  44144. t.quoteleft = 333;
  44145. t.a = 500;
  44146. t.b = 500;
  44147. t.c = 444;
  44148. t.d = 500;
  44149. t.e = 444;
  44150. t.f = 278;
  44151. t.g = 500;
  44152. t.h = 500;
  44153. t.i = 278;
  44154. t.j = 278;
  44155. t.k = 444;
  44156. t.l = 278;
  44157. t.m = 722;
  44158. t.n = 500;
  44159. t.o = 500;
  44160. t.p = 500;
  44161. t.q = 500;
  44162. t.r = 389;
  44163. t.s = 389;
  44164. t.t = 278;
  44165. t.u = 500;
  44166. t.v = 444;
  44167. t.w = 667;
  44168. t.x = 444;
  44169. t.y = 444;
  44170. t.z = 389;
  44171. t.braceleft = 400;
  44172. t.bar = 275;
  44173. t.braceright = 400;
  44174. t.asciitilde = 541;
  44175. t.exclamdown = 389;
  44176. t.cent = 500;
  44177. t.sterling = 500;
  44178. t.fraction = 167;
  44179. t.yen = 500;
  44180. t.florin = 500;
  44181. t.section = 500;
  44182. t.currency = 500;
  44183. t.quotesingle = 214;
  44184. t.quotedblleft = 556;
  44185. t.guillemotleft = 500;
  44186. t.guilsinglleft = 333;
  44187. t.guilsinglright = 333;
  44188. t.fi = 500;
  44189. t.fl = 500;
  44190. t.endash = 500;
  44191. t.dagger = 500;
  44192. t.daggerdbl = 500;
  44193. t.periodcentered = 250;
  44194. t.paragraph = 523;
  44195. t.bullet = 350;
  44196. t.quotesinglbase = 333;
  44197. t.quotedblbase = 556;
  44198. t.quotedblright = 556;
  44199. t.guillemotright = 500;
  44200. t.ellipsis = 889;
  44201. t.perthousand = 1000;
  44202. t.questiondown = 500;
  44203. t.grave = 333;
  44204. t.acute = 333;
  44205. t.circumflex = 333;
  44206. t.tilde = 333;
  44207. t.macron = 333;
  44208. t.breve = 333;
  44209. t.dotaccent = 333;
  44210. t.dieresis = 333;
  44211. t.ring = 333;
  44212. t.cedilla = 333;
  44213. t.hungarumlaut = 333;
  44214. t.ogonek = 333;
  44215. t.caron = 333;
  44216. t.emdash = 889;
  44217. t.AE = 889;
  44218. t.ordfeminine = 276;
  44219. t.Lslash = 556;
  44220. t.Oslash = 722;
  44221. t.OE = 944;
  44222. t.ordmasculine = 310;
  44223. t.ae = 667;
  44224. t.dotlessi = 278;
  44225. t.lslash = 278;
  44226. t.oslash = 500;
  44227. t.oe = 667;
  44228. t.germandbls = 500;
  44229. t.Idieresis = 333;
  44230. t.eacute = 444;
  44231. t.abreve = 500;
  44232. t.uhungarumlaut = 500;
  44233. t.ecaron = 444;
  44234. t.Ydieresis = 556;
  44235. t.divide = 675;
  44236. t.Yacute = 556;
  44237. t.Acircumflex = 611;
  44238. t.aacute = 500;
  44239. t.Ucircumflex = 722;
  44240. t.yacute = 444;
  44241. t.scommaaccent = 389;
  44242. t.ecircumflex = 444;
  44243. t.Uring = 722;
  44244. t.Udieresis = 722;
  44245. t.aogonek = 500;
  44246. t.Uacute = 722;
  44247. t.uogonek = 500;
  44248. t.Edieresis = 611;
  44249. t.Dcroat = 722;
  44250. t.commaaccent = 250;
  44251. t.copyright = 760;
  44252. t.Emacron = 611;
  44253. t.ccaron = 444;
  44254. t.aring = 500;
  44255. t.Ncommaaccent = 667;
  44256. t.lacute = 278;
  44257. t.agrave = 500;
  44258. t.Tcommaaccent = 556;
  44259. t.Cacute = 667;
  44260. t.atilde = 500;
  44261. t.Edotaccent = 611;
  44262. t.scaron = 389;
  44263. t.scedilla = 389;
  44264. t.iacute = 278;
  44265. t.lozenge = 471;
  44266. t.Rcaron = 611;
  44267. t.Gcommaaccent = 722;
  44268. t.ucircumflex = 500;
  44269. t.acircumflex = 500;
  44270. t.Amacron = 611;
  44271. t.rcaron = 389;
  44272. t.ccedilla = 444;
  44273. t.Zdotaccent = 556;
  44274. t.Thorn = 611;
  44275. t.Omacron = 722;
  44276. t.Racute = 611;
  44277. t.Sacute = 500;
  44278. t.dcaron = 544;
  44279. t.Umacron = 722;
  44280. t.uring = 500;
  44281. t.threesuperior = 300;
  44282. t.Ograve = 722;
  44283. t.Agrave = 611;
  44284. t.Abreve = 611;
  44285. t.multiply = 675;
  44286. t.uacute = 500;
  44287. t.Tcaron = 556;
  44288. t.partialdiff = 476;
  44289. t.ydieresis = 444;
  44290. t.Nacute = 667;
  44291. t.icircumflex = 278;
  44292. t.Ecircumflex = 611;
  44293. t.adieresis = 500;
  44294. t.edieresis = 444;
  44295. t.cacute = 444;
  44296. t.nacute = 500;
  44297. t.umacron = 500;
  44298. t.Ncaron = 667;
  44299. t.Iacute = 333;
  44300. t.plusminus = 675;
  44301. t.brokenbar = 275;
  44302. t.registered = 760;
  44303. t.Gbreve = 722;
  44304. t.Idotaccent = 333;
  44305. t.summation = 600;
  44306. t.Egrave = 611;
  44307. t.racute = 389;
  44308. t.omacron = 500;
  44309. t.Zacute = 556;
  44310. t.Zcaron = 556;
  44311. t.greaterequal = 549;
  44312. t.Eth = 722;
  44313. t.Ccedilla = 667;
  44314. t.lcommaaccent = 278;
  44315. t.tcaron = 300;
  44316. t.eogonek = 444;
  44317. t.Uogonek = 722;
  44318. t.Aacute = 611;
  44319. t.Adieresis = 611;
  44320. t.egrave = 444;
  44321. t.zacute = 389;
  44322. t.iogonek = 278;
  44323. t.Oacute = 722;
  44324. t.oacute = 500;
  44325. t.amacron = 500;
  44326. t.sacute = 389;
  44327. t.idieresis = 278;
  44328. t.Ocircumflex = 722;
  44329. t.Ugrave = 722;
  44330. t.Delta = 612;
  44331. t.thorn = 500;
  44332. t.twosuperior = 300;
  44333. t.Odieresis = 722;
  44334. t.mu = 500;
  44335. t.igrave = 278;
  44336. t.ohungarumlaut = 500;
  44337. t.Eogonek = 611;
  44338. t.dcroat = 500;
  44339. t.threequarters = 750;
  44340. t.Scedilla = 500;
  44341. t.lcaron = 300;
  44342. t.Kcommaaccent = 667;
  44343. t.Lacute = 556;
  44344. t.trademark = 980;
  44345. t.edotaccent = 444;
  44346. t.Igrave = 333;
  44347. t.Imacron = 333;
  44348. t.Lcaron = 611;
  44349. t.onehalf = 750;
  44350. t.lessequal = 549;
  44351. t.ocircumflex = 500;
  44352. t.ntilde = 500;
  44353. t.Uhungarumlaut = 722;
  44354. t.Eacute = 611;
  44355. t.emacron = 444;
  44356. t.gbreve = 500;
  44357. t.onequarter = 750;
  44358. t.Scaron = 500;
  44359. t.Scommaaccent = 500;
  44360. t.Ohungarumlaut = 722;
  44361. t.degree = 400;
  44362. t.ograve = 500;
  44363. t.Ccaron = 667;
  44364. t.ugrave = 500;
  44365. t.radical = 453;
  44366. t.Dcaron = 722;
  44367. t.rcommaaccent = 389;
  44368. t.Ntilde = 667;
  44369. t.otilde = 500;
  44370. t.Rcommaaccent = 611;
  44371. t.Lcommaaccent = 556;
  44372. t.Atilde = 611;
  44373. t.Aogonek = 611;
  44374. t.Aring = 611;
  44375. t.Otilde = 722;
  44376. t.zdotaccent = 389;
  44377. t.Ecaron = 611;
  44378. t.Iogonek = 333;
  44379. t.kcommaaccent = 444;
  44380. t.minus = 675;
  44381. t.Icircumflex = 333;
  44382. t.ncaron = 500;
  44383. t.tcommaaccent = 278;
  44384. t.logicalnot = 675;
  44385. t.odieresis = 500;
  44386. t.udieresis = 500;
  44387. t.notequal = 549;
  44388. t.gcommaaccent = 500;
  44389. t.eth = 500;
  44390. t.zcaron = 389;
  44391. t.ncommaaccent = 500;
  44392. t.onesuperior = 300;
  44393. t.imacron = 278;
  44394. t.Euro = 500;
  44395. });
  44396. t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) {
  44397. t.space = 278;
  44398. t.a1 = 974;
  44399. t.a2 = 961;
  44400. t.a202 = 974;
  44401. t.a3 = 980;
  44402. t.a4 = 719;
  44403. t.a5 = 789;
  44404. t.a119 = 790;
  44405. t.a118 = 791;
  44406. t.a117 = 690;
  44407. t.a11 = 960;
  44408. t.a12 = 939;
  44409. t.a13 = 549;
  44410. t.a14 = 855;
  44411. t.a15 = 911;
  44412. t.a16 = 933;
  44413. t.a105 = 911;
  44414. t.a17 = 945;
  44415. t.a18 = 974;
  44416. t.a19 = 755;
  44417. t.a20 = 846;
  44418. t.a21 = 762;
  44419. t.a22 = 761;
  44420. t.a23 = 571;
  44421. t.a24 = 677;
  44422. t.a25 = 763;
  44423. t.a26 = 760;
  44424. t.a27 = 759;
  44425. t.a28 = 754;
  44426. t.a6 = 494;
  44427. t.a7 = 552;
  44428. t.a8 = 537;
  44429. t.a9 = 577;
  44430. t.a10 = 692;
  44431. t.a29 = 786;
  44432. t.a30 = 788;
  44433. t.a31 = 788;
  44434. t.a32 = 790;
  44435. t.a33 = 793;
  44436. t.a34 = 794;
  44437. t.a35 = 816;
  44438. t.a36 = 823;
  44439. t.a37 = 789;
  44440. t.a38 = 841;
  44441. t.a39 = 823;
  44442. t.a40 = 833;
  44443. t.a41 = 816;
  44444. t.a42 = 831;
  44445. t.a43 = 923;
  44446. t.a44 = 744;
  44447. t.a45 = 723;
  44448. t.a46 = 749;
  44449. t.a47 = 790;
  44450. t.a48 = 792;
  44451. t.a49 = 695;
  44452. t.a50 = 776;
  44453. t.a51 = 768;
  44454. t.a52 = 792;
  44455. t.a53 = 759;
  44456. t.a54 = 707;
  44457. t.a55 = 708;
  44458. t.a56 = 682;
  44459. t.a57 = 701;
  44460. t.a58 = 826;
  44461. t.a59 = 815;
  44462. t.a60 = 789;
  44463. t.a61 = 789;
  44464. t.a62 = 707;
  44465. t.a63 = 687;
  44466. t.a64 = 696;
  44467. t.a65 = 689;
  44468. t.a66 = 786;
  44469. t.a67 = 787;
  44470. t.a68 = 713;
  44471. t.a69 = 791;
  44472. t.a70 = 785;
  44473. t.a71 = 791;
  44474. t.a72 = 873;
  44475. t.a73 = 761;
  44476. t.a74 = 762;
  44477. t.a203 = 762;
  44478. t.a75 = 759;
  44479. t.a204 = 759;
  44480. t.a76 = 892;
  44481. t.a77 = 892;
  44482. t.a78 = 788;
  44483. t.a79 = 784;
  44484. t.a81 = 438;
  44485. t.a82 = 138;
  44486. t.a83 = 277;
  44487. t.a84 = 415;
  44488. t.a97 = 392;
  44489. t.a98 = 392;
  44490. t.a99 = 668;
  44491. t.a100 = 668;
  44492. t.a89 = 390;
  44493. t.a90 = 390;
  44494. t.a93 = 317;
  44495. t.a94 = 317;
  44496. t.a91 = 276;
  44497. t.a92 = 276;
  44498. t.a205 = 509;
  44499. t.a85 = 509;
  44500. t.a206 = 410;
  44501. t.a86 = 410;
  44502. t.a87 = 234;
  44503. t.a88 = 234;
  44504. t.a95 = 334;
  44505. t.a96 = 334;
  44506. t.a101 = 732;
  44507. t.a102 = 544;
  44508. t.a103 = 544;
  44509. t.a104 = 910;
  44510. t.a106 = 667;
  44511. t.a107 = 760;
  44512. t.a108 = 760;
  44513. t.a112 = 776;
  44514. t.a111 = 595;
  44515. t.a110 = 694;
  44516. t.a109 = 626;
  44517. t.a120 = 788;
  44518. t.a121 = 788;
  44519. t.a122 = 788;
  44520. t.a123 = 788;
  44521. t.a124 = 788;
  44522. t.a125 = 788;
  44523. t.a126 = 788;
  44524. t.a127 = 788;
  44525. t.a128 = 788;
  44526. t.a129 = 788;
  44527. t.a130 = 788;
  44528. t.a131 = 788;
  44529. t.a132 = 788;
  44530. t.a133 = 788;
  44531. t.a134 = 788;
  44532. t.a135 = 788;
  44533. t.a136 = 788;
  44534. t.a137 = 788;
  44535. t.a138 = 788;
  44536. t.a139 = 788;
  44537. t.a140 = 788;
  44538. t.a141 = 788;
  44539. t.a142 = 788;
  44540. t.a143 = 788;
  44541. t.a144 = 788;
  44542. t.a145 = 788;
  44543. t.a146 = 788;
  44544. t.a147 = 788;
  44545. t.a148 = 788;
  44546. t.a149 = 788;
  44547. t.a150 = 788;
  44548. t.a151 = 788;
  44549. t.a152 = 788;
  44550. t.a153 = 788;
  44551. t.a154 = 788;
  44552. t.a155 = 788;
  44553. t.a156 = 788;
  44554. t.a157 = 788;
  44555. t.a158 = 788;
  44556. t.a159 = 788;
  44557. t.a160 = 894;
  44558. t.a161 = 838;
  44559. t.a163 = 1016;
  44560. t.a164 = 458;
  44561. t.a196 = 748;
  44562. t.a165 = 924;
  44563. t.a192 = 748;
  44564. t.a166 = 918;
  44565. t.a167 = 927;
  44566. t.a168 = 928;
  44567. t.a169 = 928;
  44568. t.a170 = 834;
  44569. t.a171 = 873;
  44570. t.a172 = 828;
  44571. t.a173 = 924;
  44572. t.a162 = 924;
  44573. t.a174 = 917;
  44574. t.a175 = 930;
  44575. t.a176 = 931;
  44576. t.a177 = 463;
  44577. t.a178 = 883;
  44578. t.a179 = 836;
  44579. t.a193 = 836;
  44580. t.a180 = 867;
  44581. t.a199 = 867;
  44582. t.a181 = 696;
  44583. t.a200 = 696;
  44584. t.a182 = 874;
  44585. t.a201 = 874;
  44586. t.a183 = 760;
  44587. t.a184 = 946;
  44588. t.a197 = 771;
  44589. t.a185 = 865;
  44590. t.a194 = 771;
  44591. t.a198 = 888;
  44592. t.a186 = 967;
  44593. t.a195 = 888;
  44594. t.a187 = 831;
  44595. t.a188 = 873;
  44596. t.a189 = 927;
  44597. t.a190 = 970;
  44598. t.a191 = 918;
  44599. });
  44600. });
  44601. exports.getMetrics = getMetrics;
  44602. const getFontBasicMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  44603. t.Courier = {
  44604. ascent: 629,
  44605. descent: -157,
  44606. capHeight: 562,
  44607. xHeight: -426
  44608. };
  44609. t["Courier-Bold"] = {
  44610. ascent: 629,
  44611. descent: -157,
  44612. capHeight: 562,
  44613. xHeight: 439
  44614. };
  44615. t["Courier-Oblique"] = {
  44616. ascent: 629,
  44617. descent: -157,
  44618. capHeight: 562,
  44619. xHeight: 426
  44620. };
  44621. t["Courier-BoldOblique"] = {
  44622. ascent: 629,
  44623. descent: -157,
  44624. capHeight: 562,
  44625. xHeight: 426
  44626. };
  44627. t.Helvetica = {
  44628. ascent: 718,
  44629. descent: -207,
  44630. capHeight: 718,
  44631. xHeight: 523
  44632. };
  44633. t["Helvetica-Bold"] = {
  44634. ascent: 718,
  44635. descent: -207,
  44636. capHeight: 718,
  44637. xHeight: 532
  44638. };
  44639. t["Helvetica-Oblique"] = {
  44640. ascent: 718,
  44641. descent: -207,
  44642. capHeight: 718,
  44643. xHeight: 523
  44644. };
  44645. t["Helvetica-BoldOblique"] = {
  44646. ascent: 718,
  44647. descent: -207,
  44648. capHeight: 718,
  44649. xHeight: 532
  44650. };
  44651. t["Times-Roman"] = {
  44652. ascent: 683,
  44653. descent: -217,
  44654. capHeight: 662,
  44655. xHeight: 450
  44656. };
  44657. t["Times-Bold"] = {
  44658. ascent: 683,
  44659. descent: -217,
  44660. capHeight: 676,
  44661. xHeight: 461
  44662. };
  44663. t["Times-Italic"] = {
  44664. ascent: 683,
  44665. descent: -217,
  44666. capHeight: 653,
  44667. xHeight: 441
  44668. };
  44669. t["Times-BoldItalic"] = {
  44670. ascent: 683,
  44671. descent: -217,
  44672. capHeight: 669,
  44673. xHeight: 462
  44674. };
  44675. t.Symbol = {
  44676. ascent: Math.NaN,
  44677. descent: Math.NaN,
  44678. capHeight: Math.NaN,
  44679. xHeight: Math.NaN
  44680. };
  44681. t.ZapfDingbats = {
  44682. ascent: Math.NaN,
  44683. descent: Math.NaN,
  44684. capHeight: Math.NaN,
  44685. xHeight: Math.NaN
  44686. };
  44687. });
  44688. exports.getFontBasicMetrics = getFontBasicMetrics;
  44689. /***/ }),
  44690. /* 171 */
  44691. /***/ ((__unused_webpack_module, exports) => {
  44692. "use strict";
  44693. Object.defineProperty(exports, "__esModule", ({
  44694. value: true
  44695. }));
  44696. exports.GlyfTable = void 0;
  44697. const ON_CURVE_POINT = 1 << 0;
  44698. const X_SHORT_VECTOR = 1 << 1;
  44699. const Y_SHORT_VECTOR = 1 << 2;
  44700. const REPEAT_FLAG = 1 << 3;
  44701. const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4;
  44702. const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5;
  44703. const OVERLAP_SIMPLE = 1 << 6;
  44704. const ARG_1_AND_2_ARE_WORDS = 1 << 0;
  44705. const ARGS_ARE_XY_VALUES = 1 << 1;
  44706. const WE_HAVE_A_SCALE = 1 << 3;
  44707. const MORE_COMPONENTS = 1 << 5;
  44708. const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6;
  44709. const WE_HAVE_A_TWO_BY_TWO = 1 << 7;
  44710. const WE_HAVE_INSTRUCTIONS = 1 << 8;
  44711. class GlyfTable {
  44712. constructor(_ref) {
  44713. let {
  44714. glyfTable,
  44715. isGlyphLocationsLong,
  44716. locaTable,
  44717. numGlyphs
  44718. } = _ref;
  44719. this.glyphs = [];
  44720. const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength);
  44721. const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength);
  44722. const offsetSize = isGlyphLocationsLong ? 4 : 2;
  44723. let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0);
  44724. let pos = 0;
  44725. for (let i = 0; i < numGlyphs; i++) {
  44726. pos += offsetSize;
  44727. const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos);
  44728. if (next === prev) {
  44729. this.glyphs.push(new Glyph({}));
  44730. continue;
  44731. }
  44732. const glyph = Glyph.parse(prev, glyf);
  44733. this.glyphs.push(glyph);
  44734. prev = next;
  44735. }
  44736. }
  44737. getSize() {
  44738. return this.glyphs.reduce((a, g) => {
  44739. const size = g.getSize();
  44740. return a + (size + 3 & ~3);
  44741. }, 0);
  44742. }
  44743. write() {
  44744. const totalSize = this.getSize();
  44745. const glyfTable = new DataView(new ArrayBuffer(totalSize));
  44746. const isLocationLong = totalSize > 0x1fffe;
  44747. const offsetSize = isLocationLong ? 4 : 2;
  44748. const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize));
  44749. if (isLocationLong) {
  44750. locaTable.setUint32(0, 0);
  44751. } else {
  44752. locaTable.setUint16(0, 0);
  44753. }
  44754. let pos = 0;
  44755. let locaIndex = 0;
  44756. for (const glyph of this.glyphs) {
  44757. pos += glyph.write(pos, glyfTable);
  44758. pos = pos + 3 & ~3;
  44759. locaIndex += offsetSize;
  44760. if (isLocationLong) {
  44761. locaTable.setUint32(locaIndex, pos);
  44762. } else {
  44763. locaTable.setUint16(locaIndex, pos >> 1);
  44764. }
  44765. }
  44766. return {
  44767. isLocationLong,
  44768. loca: new Uint8Array(locaTable.buffer),
  44769. glyf: new Uint8Array(glyfTable.buffer)
  44770. };
  44771. }
  44772. scale(factors) {
  44773. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  44774. this.glyphs[i].scale(factors[i]);
  44775. }
  44776. }
  44777. }
  44778. exports.GlyfTable = GlyfTable;
  44779. class Glyph {
  44780. constructor(_ref2) {
  44781. let {
  44782. header = null,
  44783. simple = null,
  44784. composites = null
  44785. } = _ref2;
  44786. this.header = header;
  44787. this.simple = simple;
  44788. this.composites = composites;
  44789. }
  44790. static parse(pos, glyf) {
  44791. const [read, header] = GlyphHeader.parse(pos, glyf);
  44792. pos += read;
  44793. if (header.numberOfContours < 0) {
  44794. const composites = [];
  44795. while (true) {
  44796. const [n, composite] = CompositeGlyph.parse(pos, glyf);
  44797. pos += n;
  44798. composites.push(composite);
  44799. if (!(composite.flags & MORE_COMPONENTS)) {
  44800. break;
  44801. }
  44802. }
  44803. return new Glyph({
  44804. header,
  44805. composites
  44806. });
  44807. }
  44808. const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours);
  44809. return new Glyph({
  44810. header,
  44811. simple
  44812. });
  44813. }
  44814. getSize() {
  44815. if (!this.header) {
  44816. return 0;
  44817. }
  44818. const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0);
  44819. return this.header.getSize() + size;
  44820. }
  44821. write(pos, buf) {
  44822. if (!this.header) {
  44823. return 0;
  44824. }
  44825. const spos = pos;
  44826. pos += this.header.write(pos, buf);
  44827. if (this.simple) {
  44828. pos += this.simple.write(pos, buf);
  44829. } else {
  44830. for (const composite of this.composites) {
  44831. pos += composite.write(pos, buf);
  44832. }
  44833. }
  44834. return pos - spos;
  44835. }
  44836. scale(factor) {
  44837. if (!this.header) {
  44838. return;
  44839. }
  44840. const xMiddle = (this.header.xMin + this.header.xMax) / 2;
  44841. this.header.scale(xMiddle, factor);
  44842. if (this.simple) {
  44843. this.simple.scale(xMiddle, factor);
  44844. } else {
  44845. for (const composite of this.composites) {
  44846. composite.scale(xMiddle, factor);
  44847. }
  44848. }
  44849. }
  44850. }
  44851. class GlyphHeader {
  44852. constructor(_ref3) {
  44853. let {
  44854. numberOfContours,
  44855. xMin,
  44856. yMin,
  44857. xMax,
  44858. yMax
  44859. } = _ref3;
  44860. this.numberOfContours = numberOfContours;
  44861. this.xMin = xMin;
  44862. this.yMin = yMin;
  44863. this.xMax = xMax;
  44864. this.yMax = yMax;
  44865. }
  44866. static parse(pos, glyf) {
  44867. return [10, new GlyphHeader({
  44868. numberOfContours: glyf.getInt16(pos),
  44869. xMin: glyf.getInt16(pos + 2),
  44870. yMin: glyf.getInt16(pos + 4),
  44871. xMax: glyf.getInt16(pos + 6),
  44872. yMax: glyf.getInt16(pos + 8)
  44873. })];
  44874. }
  44875. getSize() {
  44876. return 10;
  44877. }
  44878. write(pos, buf) {
  44879. buf.setInt16(pos, this.numberOfContours);
  44880. buf.setInt16(pos + 2, this.xMin);
  44881. buf.setInt16(pos + 4, this.yMin);
  44882. buf.setInt16(pos + 6, this.xMax);
  44883. buf.setInt16(pos + 8, this.yMax);
  44884. return 10;
  44885. }
  44886. scale(x, factor) {
  44887. this.xMin = Math.round(x + (this.xMin - x) * factor);
  44888. this.xMax = Math.round(x + (this.xMax - x) * factor);
  44889. }
  44890. }
  44891. class Contour {
  44892. constructor(_ref4) {
  44893. let {
  44894. flags,
  44895. xCoordinates,
  44896. yCoordinates
  44897. } = _ref4;
  44898. this.xCoordinates = xCoordinates;
  44899. this.yCoordinates = yCoordinates;
  44900. this.flags = flags;
  44901. }
  44902. }
  44903. class SimpleGlyph {
  44904. constructor(_ref5) {
  44905. let {
  44906. contours,
  44907. instructions
  44908. } = _ref5;
  44909. this.contours = contours;
  44910. this.instructions = instructions;
  44911. }
  44912. static parse(pos, glyf, numberOfContours) {
  44913. const endPtsOfContours = [];
  44914. for (let i = 0; i < numberOfContours; i++) {
  44915. const endPt = glyf.getUint16(pos);
  44916. pos += 2;
  44917. endPtsOfContours.push(endPt);
  44918. }
  44919. const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1;
  44920. const instructionLength = glyf.getUint16(pos);
  44921. pos += 2;
  44922. const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  44923. pos += instructionLength;
  44924. const flags = [];
  44925. for (let i = 0; i < numberOfPt; pos++, i++) {
  44926. let flag = glyf.getUint8(pos);
  44927. flags.push(flag);
  44928. if (flag & REPEAT_FLAG) {
  44929. const count = glyf.getUint8(++pos);
  44930. flag ^= REPEAT_FLAG;
  44931. for (let m = 0; m < count; m++) {
  44932. flags.push(flag);
  44933. }
  44934. i += count;
  44935. }
  44936. }
  44937. const allXCoordinates = [];
  44938. let xCoordinates = [];
  44939. let yCoordinates = [];
  44940. let pointFlags = [];
  44941. const contours = [];
  44942. let endPtsOfContoursIndex = 0;
  44943. let lastCoordinate = 0;
  44944. for (let i = 0; i < numberOfPt; i++) {
  44945. const flag = flags[i];
  44946. if (flag & X_SHORT_VECTOR) {
  44947. const x = glyf.getUint8(pos++);
  44948. lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x;
  44949. xCoordinates.push(lastCoordinate);
  44950. } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) {
  44951. xCoordinates.push(lastCoordinate);
  44952. } else {
  44953. lastCoordinate += glyf.getInt16(pos);
  44954. pos += 2;
  44955. xCoordinates.push(lastCoordinate);
  44956. }
  44957. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  44958. endPtsOfContoursIndex++;
  44959. allXCoordinates.push(xCoordinates);
  44960. xCoordinates = [];
  44961. }
  44962. }
  44963. lastCoordinate = 0;
  44964. endPtsOfContoursIndex = 0;
  44965. for (let i = 0; i < numberOfPt; i++) {
  44966. const flag = flags[i];
  44967. if (flag & Y_SHORT_VECTOR) {
  44968. const y = glyf.getUint8(pos++);
  44969. lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y;
  44970. yCoordinates.push(lastCoordinate);
  44971. } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) {
  44972. yCoordinates.push(lastCoordinate);
  44973. } else {
  44974. lastCoordinate += glyf.getInt16(pos);
  44975. pos += 2;
  44976. yCoordinates.push(lastCoordinate);
  44977. }
  44978. pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE);
  44979. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  44980. xCoordinates = allXCoordinates[endPtsOfContoursIndex];
  44981. endPtsOfContoursIndex++;
  44982. contours.push(new Contour({
  44983. flags: pointFlags,
  44984. xCoordinates,
  44985. yCoordinates
  44986. }));
  44987. yCoordinates = [];
  44988. pointFlags = [];
  44989. }
  44990. }
  44991. return new SimpleGlyph({
  44992. contours,
  44993. instructions
  44994. });
  44995. }
  44996. getSize() {
  44997. let size = this.contours.length * 2 + 2 + this.instructions.length;
  44998. let lastX = 0;
  44999. let lastY = 0;
  45000. for (const contour of this.contours) {
  45001. size += contour.flags.length;
  45002. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  45003. const x = contour.xCoordinates[i];
  45004. const y = contour.yCoordinates[i];
  45005. let abs = Math.abs(x - lastX);
  45006. if (abs > 255) {
  45007. size += 2;
  45008. } else if (abs > 0) {
  45009. size += 1;
  45010. }
  45011. lastX = x;
  45012. abs = Math.abs(y - lastY);
  45013. if (abs > 255) {
  45014. size += 2;
  45015. } else if (abs > 0) {
  45016. size += 1;
  45017. }
  45018. lastY = y;
  45019. }
  45020. }
  45021. return size;
  45022. }
  45023. write(pos, buf) {
  45024. const spos = pos;
  45025. const xCoordinates = [];
  45026. const yCoordinates = [];
  45027. const flags = [];
  45028. let lastX = 0;
  45029. let lastY = 0;
  45030. for (const contour of this.contours) {
  45031. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  45032. let flag = contour.flags[i];
  45033. const x = contour.xCoordinates[i];
  45034. let delta = x - lastX;
  45035. if (delta === 0) {
  45036. flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR;
  45037. xCoordinates.push(0);
  45038. } else {
  45039. const abs = Math.abs(delta);
  45040. if (abs <= 255) {
  45041. flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR;
  45042. xCoordinates.push(abs);
  45043. } else {
  45044. xCoordinates.push(delta);
  45045. }
  45046. }
  45047. lastX = x;
  45048. const y = contour.yCoordinates[i];
  45049. delta = y - lastY;
  45050. if (delta === 0) {
  45051. flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR;
  45052. yCoordinates.push(0);
  45053. } else {
  45054. const abs = Math.abs(delta);
  45055. if (abs <= 255) {
  45056. flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR;
  45057. yCoordinates.push(abs);
  45058. } else {
  45059. yCoordinates.push(delta);
  45060. }
  45061. }
  45062. lastY = y;
  45063. flags.push(flag);
  45064. }
  45065. buf.setUint16(pos, xCoordinates.length - 1);
  45066. pos += 2;
  45067. }
  45068. buf.setUint16(pos, this.instructions.length);
  45069. pos += 2;
  45070. if (this.instructions.length) {
  45071. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  45072. pos += this.instructions.length;
  45073. }
  45074. for (const flag of flags) {
  45075. buf.setUint8(pos++, flag);
  45076. }
  45077. for (let i = 0, ii = xCoordinates.length; i < ii; i++) {
  45078. const x = xCoordinates[i];
  45079. const flag = flags[i];
  45080. if (flag & X_SHORT_VECTOR) {
  45081. buf.setUint8(pos++, x);
  45082. } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) {
  45083. buf.setInt16(pos, x);
  45084. pos += 2;
  45085. }
  45086. }
  45087. for (let i = 0, ii = yCoordinates.length; i < ii; i++) {
  45088. const y = yCoordinates[i];
  45089. const flag = flags[i];
  45090. if (flag & Y_SHORT_VECTOR) {
  45091. buf.setUint8(pos++, y);
  45092. } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) {
  45093. buf.setInt16(pos, y);
  45094. pos += 2;
  45095. }
  45096. }
  45097. return pos - spos;
  45098. }
  45099. scale(x, factor) {
  45100. for (const contour of this.contours) {
  45101. if (contour.xCoordinates.length === 0) {
  45102. continue;
  45103. }
  45104. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  45105. contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor);
  45106. }
  45107. }
  45108. }
  45109. }
  45110. class CompositeGlyph {
  45111. constructor(_ref6) {
  45112. let {
  45113. flags,
  45114. glyphIndex,
  45115. argument1,
  45116. argument2,
  45117. transf,
  45118. instructions
  45119. } = _ref6;
  45120. this.flags = flags;
  45121. this.glyphIndex = glyphIndex;
  45122. this.argument1 = argument1;
  45123. this.argument2 = argument2;
  45124. this.transf = transf;
  45125. this.instructions = instructions;
  45126. }
  45127. static parse(pos, glyf) {
  45128. const spos = pos;
  45129. const transf = [];
  45130. let flags = glyf.getUint16(pos);
  45131. const glyphIndex = glyf.getUint16(pos + 2);
  45132. pos += 4;
  45133. let argument1, argument2;
  45134. if (flags & ARG_1_AND_2_ARE_WORDS) {
  45135. if (flags & ARGS_ARE_XY_VALUES) {
  45136. argument1 = glyf.getInt16(pos);
  45137. argument2 = glyf.getInt16(pos + 2);
  45138. } else {
  45139. argument1 = glyf.getUint16(pos);
  45140. argument2 = glyf.getUint16(pos + 2);
  45141. }
  45142. pos += 4;
  45143. flags ^= ARG_1_AND_2_ARE_WORDS;
  45144. } else {
  45145. if (flags & ARGS_ARE_XY_VALUES) {
  45146. argument1 = glyf.getInt8(pos);
  45147. argument2 = glyf.getInt8(pos + 1);
  45148. } else {
  45149. argument1 = glyf.getUint8(pos);
  45150. argument2 = glyf.getUint8(pos + 1);
  45151. }
  45152. pos += 2;
  45153. }
  45154. if (flags & WE_HAVE_A_SCALE) {
  45155. transf.push(glyf.getUint16(pos));
  45156. pos += 2;
  45157. } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
  45158. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2));
  45159. pos += 4;
  45160. } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
  45161. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6));
  45162. pos += 8;
  45163. }
  45164. let instructions = null;
  45165. if (flags & WE_HAVE_INSTRUCTIONS) {
  45166. const instructionLength = glyf.getUint16(pos);
  45167. pos += 2;
  45168. instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  45169. pos += instructionLength;
  45170. }
  45171. return [pos - spos, new CompositeGlyph({
  45172. flags,
  45173. glyphIndex,
  45174. argument1,
  45175. argument2,
  45176. transf,
  45177. instructions
  45178. })];
  45179. }
  45180. getSize() {
  45181. let size = 2 + 2 + this.transf.length * 2;
  45182. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  45183. size += 2 + this.instructions.length;
  45184. }
  45185. size += 2;
  45186. if (this.flags & 2) {
  45187. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  45188. size += 2;
  45189. }
  45190. } else {
  45191. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  45192. size += 2;
  45193. }
  45194. }
  45195. return size;
  45196. }
  45197. write(pos, buf) {
  45198. const spos = pos;
  45199. if (this.flags & ARGS_ARE_XY_VALUES) {
  45200. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  45201. this.flags |= ARG_1_AND_2_ARE_WORDS;
  45202. }
  45203. } else {
  45204. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  45205. this.flags |= ARG_1_AND_2_ARE_WORDS;
  45206. }
  45207. }
  45208. buf.setUint16(pos, this.flags);
  45209. buf.setUint16(pos + 2, this.glyphIndex);
  45210. pos += 4;
  45211. if (this.flags & ARG_1_AND_2_ARE_WORDS) {
  45212. if (this.flags & ARGS_ARE_XY_VALUES) {
  45213. buf.setInt16(pos, this.argument1);
  45214. buf.setInt16(pos + 2, this.argument2);
  45215. } else {
  45216. buf.setUint16(pos, this.argument1);
  45217. buf.setUint16(pos + 2, this.argument2);
  45218. }
  45219. pos += 4;
  45220. } else {
  45221. buf.setUint8(pos, this.argument1);
  45222. buf.setUint8(pos + 1, this.argument2);
  45223. pos += 2;
  45224. }
  45225. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  45226. buf.setUint16(pos, this.instructions.length);
  45227. pos += 2;
  45228. if (this.instructions.length) {
  45229. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  45230. pos += this.instructions.length;
  45231. }
  45232. }
  45233. return pos - spos;
  45234. }
  45235. scale(x, factor) {}
  45236. }
  45237. /***/ }),
  45238. /* 172 */
  45239. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45240. "use strict";
  45241. Object.defineProperty(exports, "__esModule", ({
  45242. value: true
  45243. }));
  45244. exports.OpenTypeFileBuilder = void 0;
  45245. var _core_utils = __w_pdfjs_require__(131);
  45246. var _util = __w_pdfjs_require__(2);
  45247. function writeInt16(dest, offset, num) {
  45248. dest[offset] = num >> 8 & 0xff;
  45249. dest[offset + 1] = num & 0xff;
  45250. }
  45251. function writeInt32(dest, offset, num) {
  45252. dest[offset] = num >> 24 & 0xff;
  45253. dest[offset + 1] = num >> 16 & 0xff;
  45254. dest[offset + 2] = num >> 8 & 0xff;
  45255. dest[offset + 3] = num & 0xff;
  45256. }
  45257. function writeData(dest, offset, data) {
  45258. if (data instanceof Uint8Array) {
  45259. dest.set(data, offset);
  45260. } else if (typeof data === "string") {
  45261. for (let i = 0, ii = data.length; i < ii; i++) {
  45262. dest[offset++] = data.charCodeAt(i) & 0xff;
  45263. }
  45264. } else {
  45265. for (let i = 0, ii = data.length; i < ii; i++) {
  45266. dest[offset++] = data[i] & 0xff;
  45267. }
  45268. }
  45269. }
  45270. const OTF_HEADER_SIZE = 12;
  45271. const OTF_TABLE_ENTRY_SIZE = 16;
  45272. class OpenTypeFileBuilder {
  45273. constructor(sfnt) {
  45274. this.sfnt = sfnt;
  45275. this.tables = Object.create(null);
  45276. }
  45277. static getSearchParams(entriesCount, entrySize) {
  45278. let maxPower2 = 1,
  45279. log2 = 0;
  45280. while ((maxPower2 ^ entriesCount) > maxPower2) {
  45281. maxPower2 <<= 1;
  45282. log2++;
  45283. }
  45284. const searchRange = maxPower2 * entrySize;
  45285. return {
  45286. range: searchRange,
  45287. entry: log2,
  45288. rangeShift: entrySize * entriesCount - searchRange
  45289. };
  45290. }
  45291. toArray() {
  45292. let sfnt = this.sfnt;
  45293. const tables = this.tables;
  45294. const tablesNames = Object.keys(tables);
  45295. tablesNames.sort();
  45296. const numTables = tablesNames.length;
  45297. let i, j, jj, table, tableName;
  45298. let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  45299. const tableOffsets = [offset];
  45300. for (i = 0; i < numTables; i++) {
  45301. table = tables[tablesNames[i]];
  45302. const paddedLength = (table.length + 3 & ~3) >>> 0;
  45303. offset += paddedLength;
  45304. tableOffsets.push(offset);
  45305. }
  45306. const file = new Uint8Array(offset);
  45307. for (i = 0; i < numTables; i++) {
  45308. table = tables[tablesNames[i]];
  45309. writeData(file, tableOffsets[i], table);
  45310. }
  45311. if (sfnt === "true") {
  45312. sfnt = (0, _util.string32)(0x00010000);
  45313. }
  45314. file[0] = sfnt.charCodeAt(0) & 0xff;
  45315. file[1] = sfnt.charCodeAt(1) & 0xff;
  45316. file[2] = sfnt.charCodeAt(2) & 0xff;
  45317. file[3] = sfnt.charCodeAt(3) & 0xff;
  45318. writeInt16(file, 4, numTables);
  45319. const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  45320. writeInt16(file, 6, searchParams.range);
  45321. writeInt16(file, 8, searchParams.entry);
  45322. writeInt16(file, 10, searchParams.rangeShift);
  45323. offset = OTF_HEADER_SIZE;
  45324. for (i = 0; i < numTables; i++) {
  45325. tableName = tablesNames[i];
  45326. file[offset] = tableName.charCodeAt(0) & 0xff;
  45327. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  45328. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  45329. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  45330. let checksum = 0;
  45331. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  45332. const quad = (0, _core_utils.readUint32)(file, j);
  45333. checksum = checksum + quad >>> 0;
  45334. }
  45335. writeInt32(file, offset + 4, checksum);
  45336. writeInt32(file, offset + 8, tableOffsets[i]);
  45337. writeInt32(file, offset + 12, tables[tableName].length);
  45338. offset += OTF_TABLE_ENTRY_SIZE;
  45339. }
  45340. return file;
  45341. }
  45342. addTable(tag, data) {
  45343. if (tag in this.tables) {
  45344. throw new Error("Table " + tag + " already exists");
  45345. }
  45346. this.tables[tag] = data;
  45347. }
  45348. }
  45349. exports.OpenTypeFileBuilder = OpenTypeFileBuilder;
  45350. /***/ }),
  45351. /* 173 */
  45352. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45353. "use strict";
  45354. Object.defineProperty(exports, "__esModule", ({
  45355. value: true
  45356. }));
  45357. exports.Type1Font = void 0;
  45358. var _cff_parser = __w_pdfjs_require__(160);
  45359. var _fonts_utils = __w_pdfjs_require__(163);
  45360. var _core_utils = __w_pdfjs_require__(131);
  45361. var _stream = __w_pdfjs_require__(135);
  45362. var _type1_parser = __w_pdfjs_require__(174);
  45363. var _util = __w_pdfjs_require__(2);
  45364. function findBlock(streamBytes, signature, startIndex) {
  45365. const streamBytesLength = streamBytes.length;
  45366. const signatureLength = signature.length;
  45367. const scanLength = streamBytesLength - signatureLength;
  45368. let i = startIndex,
  45369. found = false;
  45370. while (i < scanLength) {
  45371. let j = 0;
  45372. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  45373. j++;
  45374. }
  45375. if (j >= signatureLength) {
  45376. i += j;
  45377. while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) {
  45378. i++;
  45379. }
  45380. found = true;
  45381. break;
  45382. }
  45383. i++;
  45384. }
  45385. return {
  45386. found,
  45387. length: i
  45388. };
  45389. }
  45390. function getHeaderBlock(stream, suggestedLength) {
  45391. const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  45392. const streamStartPos = stream.pos;
  45393. let headerBytes, headerBytesLength, block;
  45394. try {
  45395. headerBytes = stream.getBytes(suggestedLength);
  45396. headerBytesLength = headerBytes.length;
  45397. } catch (ex) {}
  45398. if (headerBytesLength === suggestedLength) {
  45399. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  45400. if (block.found && block.length === suggestedLength) {
  45401. return {
  45402. stream: new _stream.Stream(headerBytes),
  45403. length: suggestedLength
  45404. };
  45405. }
  45406. }
  45407. (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
  45408. stream.pos = streamStartPos;
  45409. const SCAN_BLOCK_LENGTH = 2048;
  45410. let actualLength;
  45411. while (true) {
  45412. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  45413. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  45414. if (block.length === 0) {
  45415. break;
  45416. }
  45417. stream.pos += block.length;
  45418. if (block.found) {
  45419. actualLength = stream.pos - streamStartPos;
  45420. break;
  45421. }
  45422. }
  45423. stream.pos = streamStartPos;
  45424. if (actualLength) {
  45425. return {
  45426. stream: new _stream.Stream(stream.getBytes(actualLength)),
  45427. length: actualLength
  45428. };
  45429. }
  45430. (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
  45431. return {
  45432. stream: new _stream.Stream(stream.getBytes(suggestedLength)),
  45433. length: suggestedLength
  45434. };
  45435. }
  45436. function getEexecBlock(stream, suggestedLength) {
  45437. const eexecBytes = stream.getBytes();
  45438. return {
  45439. stream: new _stream.Stream(eexecBytes),
  45440. length: eexecBytes.length
  45441. };
  45442. }
  45443. class Type1Font {
  45444. constructor(name, file, properties) {
  45445. const PFB_HEADER_SIZE = 6;
  45446. let headerBlockLength = properties.length1;
  45447. let eexecBlockLength = properties.length2;
  45448. let pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  45449. const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  45450. if (pfbHeaderPresent) {
  45451. file.skip(PFB_HEADER_SIZE);
  45452. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  45453. }
  45454. const headerBlock = getHeaderBlock(file, headerBlockLength);
  45455. const headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  45456. headerBlockParser.extractFontHeader(properties);
  45457. if (pfbHeaderPresent) {
  45458. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  45459. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  45460. }
  45461. const eexecBlock = getEexecBlock(file, eexecBlockLength);
  45462. const eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  45463. const data = eexecBlockParser.extractFontProgram(properties);
  45464. for (const key in data.properties) {
  45465. properties[key] = data.properties[key];
  45466. }
  45467. const charstrings = data.charstrings;
  45468. const type2Charstrings = this.getType2Charstrings(charstrings);
  45469. const subrs = this.getType2Subrs(data.subrs);
  45470. this.charstrings = charstrings;
  45471. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  45472. this.seacs = this.getSeacs(data.charstrings);
  45473. }
  45474. get numGlyphs() {
  45475. return this.charstrings.length + 1;
  45476. }
  45477. getCharset() {
  45478. const charset = [".notdef"];
  45479. for (const {
  45480. glyphName
  45481. } of this.charstrings) {
  45482. charset.push(glyphName);
  45483. }
  45484. return charset;
  45485. }
  45486. getGlyphMapping(properties) {
  45487. const charstrings = this.charstrings;
  45488. if (properties.composite) {
  45489. const charCodeToGlyphId = Object.create(null);
  45490. for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
  45491. const charCode = properties.cMap.charCodeOf(glyphId);
  45492. charCodeToGlyphId[charCode] = glyphId + 1;
  45493. }
  45494. return charCodeToGlyphId;
  45495. }
  45496. const glyphNames = [".notdef"];
  45497. let builtInEncoding, glyphId;
  45498. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  45499. glyphNames.push(charstrings[glyphId].glyphName);
  45500. }
  45501. const encoding = properties.builtInEncoding;
  45502. if (encoding) {
  45503. builtInEncoding = Object.create(null);
  45504. for (const charCode in encoding) {
  45505. glyphId = glyphNames.indexOf(encoding[charCode]);
  45506. if (glyphId >= 0) {
  45507. builtInEncoding[charCode] = glyphId;
  45508. }
  45509. }
  45510. }
  45511. return (0, _fonts_utils.type1FontGlyphMapping)(properties, builtInEncoding, glyphNames);
  45512. }
  45513. hasGlyphId(id) {
  45514. if (id < 0 || id >= this.numGlyphs) {
  45515. return false;
  45516. }
  45517. if (id === 0) {
  45518. return true;
  45519. }
  45520. const glyph = this.charstrings[id - 1];
  45521. return glyph.charstring.length > 0;
  45522. }
  45523. getSeacs(charstrings) {
  45524. const seacMap = [];
  45525. for (let i = 0, ii = charstrings.length; i < ii; i++) {
  45526. const charstring = charstrings[i];
  45527. if (charstring.seac) {
  45528. seacMap[i + 1] = charstring.seac;
  45529. }
  45530. }
  45531. return seacMap;
  45532. }
  45533. getType2Charstrings(type1Charstrings) {
  45534. const type2Charstrings = [];
  45535. for (let i = 0, ii = type1Charstrings.length; i < ii; i++) {
  45536. type2Charstrings.push(type1Charstrings[i].charstring);
  45537. }
  45538. return type2Charstrings;
  45539. }
  45540. getType2Subrs(type1Subrs) {
  45541. let bias = 0;
  45542. const count = type1Subrs.length;
  45543. if (count < 1133) {
  45544. bias = 107;
  45545. } else if (count < 33769) {
  45546. bias = 1131;
  45547. } else {
  45548. bias = 32768;
  45549. }
  45550. const type2Subrs = [];
  45551. let i;
  45552. for (i = 0; i < bias; i++) {
  45553. type2Subrs.push([0x0b]);
  45554. }
  45555. for (i = 0; i < count; i++) {
  45556. type2Subrs.push(type1Subrs[i]);
  45557. }
  45558. return type2Subrs;
  45559. }
  45560. wrap(name, glyphs, charstrings, subrs, properties) {
  45561. const cff = new _cff_parser.CFF();
  45562. cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
  45563. cff.names = [name];
  45564. const topDict = new _cff_parser.CFFTopDict();
  45565. topDict.setByName("version", 391);
  45566. topDict.setByName("Notice", 392);
  45567. topDict.setByName("FullName", 393);
  45568. topDict.setByName("FamilyName", 394);
  45569. topDict.setByName("Weight", 395);
  45570. topDict.setByName("Encoding", null);
  45571. topDict.setByName("FontMatrix", properties.fontMatrix);
  45572. topDict.setByName("FontBBox", properties.bbox);
  45573. topDict.setByName("charset", null);
  45574. topDict.setByName("CharStrings", null);
  45575. topDict.setByName("Private", null);
  45576. cff.topDict = topDict;
  45577. const strings = new _cff_parser.CFFStrings();
  45578. strings.add("Version 0.11");
  45579. strings.add("See original notice");
  45580. strings.add(name);
  45581. strings.add(name);
  45582. strings.add("Medium");
  45583. cff.strings = strings;
  45584. cff.globalSubrIndex = new _cff_parser.CFFIndex();
  45585. const count = glyphs.length;
  45586. const charsetArray = [".notdef"];
  45587. let i, ii;
  45588. for (i = 0; i < count; i++) {
  45589. const glyphName = charstrings[i].glyphName;
  45590. const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
  45591. if (index === -1) {
  45592. strings.add(glyphName);
  45593. }
  45594. charsetArray.push(glyphName);
  45595. }
  45596. cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
  45597. const charStringsIndex = new _cff_parser.CFFIndex();
  45598. charStringsIndex.add([0x8b, 0x0e]);
  45599. for (i = 0; i < count; i++) {
  45600. charStringsIndex.add(glyphs[i]);
  45601. }
  45602. cff.charStrings = charStringsIndex;
  45603. const privateDict = new _cff_parser.CFFPrivateDict();
  45604. privateDict.setByName("Subrs", null);
  45605. const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
  45606. for (i = 0, ii = fields.length; i < ii; i++) {
  45607. const field = fields[i];
  45608. if (!(field in properties.privateData)) {
  45609. continue;
  45610. }
  45611. const value = properties.privateData[field];
  45612. if (Array.isArray(value)) {
  45613. for (let j = value.length - 1; j > 0; j--) {
  45614. value[j] -= value[j - 1];
  45615. }
  45616. }
  45617. privateDict.setByName(field, value);
  45618. }
  45619. cff.topDict.privateDict = privateDict;
  45620. const subrIndex = new _cff_parser.CFFIndex();
  45621. for (i = 0, ii = subrs.length; i < ii; i++) {
  45622. subrIndex.add(subrs[i]);
  45623. }
  45624. privateDict.subrsIndex = subrIndex;
  45625. const compiler = new _cff_parser.CFFCompiler(cff);
  45626. return compiler.compile();
  45627. }
  45628. }
  45629. exports.Type1Font = Type1Font;
  45630. /***/ }),
  45631. /* 174 */
  45632. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45633. "use strict";
  45634. Object.defineProperty(exports, "__esModule", ({
  45635. value: true
  45636. }));
  45637. exports.Type1Parser = void 0;
  45638. var _encodings = __w_pdfjs_require__(162);
  45639. var _core_utils = __w_pdfjs_require__(131);
  45640. var _stream = __w_pdfjs_require__(135);
  45641. var _util = __w_pdfjs_require__(2);
  45642. const HINTING_ENABLED = false;
  45643. const COMMAND_MAP = {
  45644. hstem: [1],
  45645. vstem: [3],
  45646. vmoveto: [4],
  45647. rlineto: [5],
  45648. hlineto: [6],
  45649. vlineto: [7],
  45650. rrcurveto: [8],
  45651. callsubr: [10],
  45652. flex: [12, 35],
  45653. drop: [12, 18],
  45654. endchar: [14],
  45655. rmoveto: [21],
  45656. hmoveto: [22],
  45657. vhcurveto: [30],
  45658. hvcurveto: [31]
  45659. };
  45660. class Type1CharString {
  45661. constructor() {
  45662. this.width = 0;
  45663. this.lsb = 0;
  45664. this.flexing = false;
  45665. this.output = [];
  45666. this.stack = [];
  45667. }
  45668. convert(encoded, subrs, seacAnalysisEnabled) {
  45669. const count = encoded.length;
  45670. let error = false;
  45671. let wx, sbx, subrNumber;
  45672. for (let i = 0; i < count; i++) {
  45673. let value = encoded[i];
  45674. if (value < 32) {
  45675. if (value === 12) {
  45676. value = (value << 8) + encoded[++i];
  45677. }
  45678. switch (value) {
  45679. case 1:
  45680. if (!HINTING_ENABLED) {
  45681. this.stack = [];
  45682. break;
  45683. }
  45684. error = this.executeCommand(2, COMMAND_MAP.hstem);
  45685. break;
  45686. case 3:
  45687. if (!HINTING_ENABLED) {
  45688. this.stack = [];
  45689. break;
  45690. }
  45691. error = this.executeCommand(2, COMMAND_MAP.vstem);
  45692. break;
  45693. case 4:
  45694. if (this.flexing) {
  45695. if (this.stack.length < 1) {
  45696. error = true;
  45697. break;
  45698. }
  45699. const dy = this.stack.pop();
  45700. this.stack.push(0, dy);
  45701. break;
  45702. }
  45703. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  45704. break;
  45705. case 5:
  45706. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  45707. break;
  45708. case 6:
  45709. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  45710. break;
  45711. case 7:
  45712. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  45713. break;
  45714. case 8:
  45715. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  45716. break;
  45717. case 9:
  45718. this.stack = [];
  45719. break;
  45720. case 10:
  45721. if (this.stack.length < 1) {
  45722. error = true;
  45723. break;
  45724. }
  45725. subrNumber = this.stack.pop();
  45726. if (!subrs[subrNumber]) {
  45727. error = true;
  45728. break;
  45729. }
  45730. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  45731. break;
  45732. case 11:
  45733. return error;
  45734. case 13:
  45735. if (this.stack.length < 2) {
  45736. error = true;
  45737. break;
  45738. }
  45739. wx = this.stack.pop();
  45740. sbx = this.stack.pop();
  45741. this.lsb = sbx;
  45742. this.width = wx;
  45743. this.stack.push(wx, sbx);
  45744. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  45745. break;
  45746. case 14:
  45747. this.output.push(COMMAND_MAP.endchar[0]);
  45748. break;
  45749. case 21:
  45750. if (this.flexing) {
  45751. break;
  45752. }
  45753. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  45754. break;
  45755. case 22:
  45756. if (this.flexing) {
  45757. this.stack.push(0);
  45758. break;
  45759. }
  45760. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  45761. break;
  45762. case 30:
  45763. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  45764. break;
  45765. case 31:
  45766. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  45767. break;
  45768. case (12 << 8) + 0:
  45769. this.stack = [];
  45770. break;
  45771. case (12 << 8) + 1:
  45772. if (!HINTING_ENABLED) {
  45773. this.stack = [];
  45774. break;
  45775. }
  45776. error = this.executeCommand(2, COMMAND_MAP.vstem);
  45777. break;
  45778. case (12 << 8) + 2:
  45779. if (!HINTING_ENABLED) {
  45780. this.stack = [];
  45781. break;
  45782. }
  45783. error = this.executeCommand(2, COMMAND_MAP.hstem);
  45784. break;
  45785. case (12 << 8) + 6:
  45786. if (seacAnalysisEnabled) {
  45787. const asb = this.stack.at(-5);
  45788. this.seac = this.stack.splice(-4, 4);
  45789. this.seac[0] += this.lsb - asb;
  45790. error = this.executeCommand(0, COMMAND_MAP.endchar);
  45791. } else {
  45792. error = this.executeCommand(4, COMMAND_MAP.endchar);
  45793. }
  45794. break;
  45795. case (12 << 8) + 7:
  45796. if (this.stack.length < 4) {
  45797. error = true;
  45798. break;
  45799. }
  45800. this.stack.pop();
  45801. wx = this.stack.pop();
  45802. const sby = this.stack.pop();
  45803. sbx = this.stack.pop();
  45804. this.lsb = sbx;
  45805. this.width = wx;
  45806. this.stack.push(wx, sbx, sby);
  45807. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  45808. break;
  45809. case (12 << 8) + 12:
  45810. if (this.stack.length < 2) {
  45811. error = true;
  45812. break;
  45813. }
  45814. const num2 = this.stack.pop();
  45815. const num1 = this.stack.pop();
  45816. this.stack.push(num1 / num2);
  45817. break;
  45818. case (12 << 8) + 16:
  45819. if (this.stack.length < 2) {
  45820. error = true;
  45821. break;
  45822. }
  45823. subrNumber = this.stack.pop();
  45824. const numArgs = this.stack.pop();
  45825. if (subrNumber === 0 && numArgs === 3) {
  45826. const flexArgs = this.stack.splice(this.stack.length - 17, 17);
  45827. 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]);
  45828. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  45829. this.flexing = false;
  45830. this.stack.push(flexArgs[15], flexArgs[16]);
  45831. } else if (subrNumber === 1 && numArgs === 0) {
  45832. this.flexing = true;
  45833. }
  45834. break;
  45835. case (12 << 8) + 17:
  45836. break;
  45837. case (12 << 8) + 33:
  45838. this.stack = [];
  45839. break;
  45840. default:
  45841. (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
  45842. break;
  45843. }
  45844. if (error) {
  45845. break;
  45846. }
  45847. continue;
  45848. } else if (value <= 246) {
  45849. value -= 139;
  45850. } else if (value <= 250) {
  45851. value = (value - 247) * 256 + encoded[++i] + 108;
  45852. } else if (value <= 254) {
  45853. value = -((value - 251) * 256) - encoded[++i] - 108;
  45854. } else {
  45855. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  45856. }
  45857. this.stack.push(value);
  45858. }
  45859. return error;
  45860. }
  45861. executeCommand(howManyArgs, command, keepStack) {
  45862. const stackLength = this.stack.length;
  45863. if (howManyArgs > stackLength) {
  45864. return true;
  45865. }
  45866. const start = stackLength - howManyArgs;
  45867. for (let i = start; i < stackLength; i++) {
  45868. let value = this.stack[i];
  45869. if (Number.isInteger(value)) {
  45870. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  45871. } else {
  45872. value = 65536 * value | 0;
  45873. this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  45874. }
  45875. }
  45876. this.output.push(...command);
  45877. if (keepStack) {
  45878. this.stack.splice(start, howManyArgs);
  45879. } else {
  45880. this.stack.length = 0;
  45881. }
  45882. return false;
  45883. }
  45884. }
  45885. const EEXEC_ENCRYPT_KEY = 55665;
  45886. const CHAR_STRS_ENCRYPT_KEY = 4330;
  45887. function isHexDigit(code) {
  45888. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  45889. }
  45890. function decrypt(data, key, discardNumber) {
  45891. if (discardNumber >= data.length) {
  45892. return new Uint8Array(0);
  45893. }
  45894. const c1 = 52845,
  45895. c2 = 22719;
  45896. let r = key | 0,
  45897. i,
  45898. j;
  45899. for (i = 0; i < discardNumber; i++) {
  45900. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  45901. }
  45902. const count = data.length - discardNumber;
  45903. const decrypted = new Uint8Array(count);
  45904. for (i = discardNumber, j = 0; j < count; i++, j++) {
  45905. const value = data[i];
  45906. decrypted[j] = value ^ r >> 8;
  45907. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  45908. }
  45909. return decrypted;
  45910. }
  45911. function decryptAscii(data, key, discardNumber) {
  45912. const c1 = 52845,
  45913. c2 = 22719;
  45914. let r = key | 0;
  45915. const count = data.length,
  45916. maybeLength = count >>> 1;
  45917. const decrypted = new Uint8Array(maybeLength);
  45918. let i, j;
  45919. for (i = 0, j = 0; i < count; i++) {
  45920. const digit1 = data[i];
  45921. if (!isHexDigit(digit1)) {
  45922. continue;
  45923. }
  45924. i++;
  45925. let digit2;
  45926. while (i < count && !isHexDigit(digit2 = data[i])) {
  45927. i++;
  45928. }
  45929. if (i < count) {
  45930. const value = parseInt(String.fromCharCode(digit1, digit2), 16);
  45931. decrypted[j++] = value ^ r >> 8;
  45932. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  45933. }
  45934. }
  45935. return decrypted.slice(discardNumber, j);
  45936. }
  45937. function isSpecial(c) {
  45938. return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
  45939. }
  45940. class Type1Parser {
  45941. constructor(stream, encrypted, seacAnalysisEnabled) {
  45942. if (encrypted) {
  45943. const data = stream.getBytes();
  45944. 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]));
  45945. stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  45946. }
  45947. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  45948. this.stream = stream;
  45949. this.nextChar();
  45950. }
  45951. readNumberArray() {
  45952. this.getToken();
  45953. const array = [];
  45954. while (true) {
  45955. const token = this.getToken();
  45956. if (token === null || token === "]" || token === "}") {
  45957. break;
  45958. }
  45959. array.push(parseFloat(token || 0));
  45960. }
  45961. return array;
  45962. }
  45963. readNumber() {
  45964. const token = this.getToken();
  45965. return parseFloat(token || 0);
  45966. }
  45967. readInt() {
  45968. const token = this.getToken();
  45969. return parseInt(token || 0, 10) | 0;
  45970. }
  45971. readBoolean() {
  45972. const token = this.getToken();
  45973. return token === "true" ? 1 : 0;
  45974. }
  45975. nextChar() {
  45976. return this.currentChar = this.stream.getByte();
  45977. }
  45978. prevChar() {
  45979. this.stream.skip(-2);
  45980. return this.currentChar = this.stream.getByte();
  45981. }
  45982. getToken() {
  45983. let comment = false;
  45984. let ch = this.currentChar;
  45985. while (true) {
  45986. if (ch === -1) {
  45987. return null;
  45988. }
  45989. if (comment) {
  45990. if (ch === 0x0a || ch === 0x0d) {
  45991. comment = false;
  45992. }
  45993. } else if (ch === 0x25) {
  45994. comment = true;
  45995. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  45996. break;
  45997. }
  45998. ch = this.nextChar();
  45999. }
  46000. if (isSpecial(ch)) {
  46001. this.nextChar();
  46002. return String.fromCharCode(ch);
  46003. }
  46004. let token = "";
  46005. do {
  46006. token += String.fromCharCode(ch);
  46007. ch = this.nextChar();
  46008. } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch));
  46009. return token;
  46010. }
  46011. readCharStrings(bytes, lenIV) {
  46012. if (lenIV === -1) {
  46013. return bytes;
  46014. }
  46015. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  46016. }
  46017. extractFontProgram(properties) {
  46018. const stream = this.stream;
  46019. const subrs = [],
  46020. charstrings = [];
  46021. const privateData = Object.create(null);
  46022. privateData.lenIV = 4;
  46023. const program = {
  46024. subrs: [],
  46025. charstrings: [],
  46026. properties: {
  46027. privateData
  46028. }
  46029. };
  46030. let token, length, data, lenIV;
  46031. while ((token = this.getToken()) !== null) {
  46032. if (token !== "/") {
  46033. continue;
  46034. }
  46035. token = this.getToken();
  46036. switch (token) {
  46037. case "CharStrings":
  46038. this.getToken();
  46039. this.getToken();
  46040. this.getToken();
  46041. this.getToken();
  46042. while (true) {
  46043. token = this.getToken();
  46044. if (token === null || token === "end") {
  46045. break;
  46046. }
  46047. if (token !== "/") {
  46048. continue;
  46049. }
  46050. const glyph = this.getToken();
  46051. length = this.readInt();
  46052. this.getToken();
  46053. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  46054. lenIV = program.properties.privateData.lenIV;
  46055. const encoded = this.readCharStrings(data, lenIV);
  46056. this.nextChar();
  46057. token = this.getToken();
  46058. if (token === "noaccess") {
  46059. this.getToken();
  46060. } else if (token === "/") {
  46061. this.prevChar();
  46062. }
  46063. charstrings.push({
  46064. glyph,
  46065. encoded
  46066. });
  46067. }
  46068. break;
  46069. case "Subrs":
  46070. this.readInt();
  46071. this.getToken();
  46072. while (this.getToken() === "dup") {
  46073. const index = this.readInt();
  46074. length = this.readInt();
  46075. this.getToken();
  46076. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  46077. lenIV = program.properties.privateData.lenIV;
  46078. const encoded = this.readCharStrings(data, lenIV);
  46079. this.nextChar();
  46080. token = this.getToken();
  46081. if (token === "noaccess") {
  46082. this.getToken();
  46083. }
  46084. subrs[index] = encoded;
  46085. }
  46086. break;
  46087. case "BlueValues":
  46088. case "OtherBlues":
  46089. case "FamilyBlues":
  46090. case "FamilyOtherBlues":
  46091. const blueArray = this.readNumberArray();
  46092. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  46093. program.properties.privateData[token] = blueArray;
  46094. }
  46095. break;
  46096. case "StemSnapH":
  46097. case "StemSnapV":
  46098. program.properties.privateData[token] = this.readNumberArray();
  46099. break;
  46100. case "StdHW":
  46101. case "StdVW":
  46102. program.properties.privateData[token] = this.readNumberArray()[0];
  46103. break;
  46104. case "BlueShift":
  46105. case "lenIV":
  46106. case "BlueFuzz":
  46107. case "BlueScale":
  46108. case "LanguageGroup":
  46109. case "ExpansionFactor":
  46110. program.properties.privateData[token] = this.readNumber();
  46111. break;
  46112. case "ForceBold":
  46113. program.properties.privateData[token] = this.readBoolean();
  46114. break;
  46115. }
  46116. }
  46117. for (const {
  46118. encoded,
  46119. glyph
  46120. } of charstrings) {
  46121. const charString = new Type1CharString();
  46122. const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  46123. let output = charString.output;
  46124. if (error) {
  46125. output = [14];
  46126. }
  46127. const charStringObject = {
  46128. glyphName: glyph,
  46129. charstring: output,
  46130. width: charString.width,
  46131. lsb: charString.lsb,
  46132. seac: charString.seac
  46133. };
  46134. if (glyph === ".notdef") {
  46135. program.charstrings.unshift(charStringObject);
  46136. } else {
  46137. program.charstrings.push(charStringObject);
  46138. }
  46139. if (properties.builtInEncoding) {
  46140. const index = properties.builtInEncoding.indexOf(glyph);
  46141. if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
  46142. properties.widths[index] = charString.width;
  46143. }
  46144. }
  46145. }
  46146. return program;
  46147. }
  46148. extractFontHeader(properties) {
  46149. let token;
  46150. while ((token = this.getToken()) !== null) {
  46151. if (token !== "/") {
  46152. continue;
  46153. }
  46154. token = this.getToken();
  46155. switch (token) {
  46156. case "FontMatrix":
  46157. const matrix = this.readNumberArray();
  46158. properties.fontMatrix = matrix;
  46159. break;
  46160. case "Encoding":
  46161. const encodingArg = this.getToken();
  46162. let encoding;
  46163. if (!/^\d+$/.test(encodingArg)) {
  46164. encoding = (0, _encodings.getEncoding)(encodingArg);
  46165. } else {
  46166. encoding = [];
  46167. const size = parseInt(encodingArg, 10) | 0;
  46168. this.getToken();
  46169. for (let j = 0; j < size; j++) {
  46170. token = this.getToken();
  46171. while (token !== "dup" && token !== "def") {
  46172. token = this.getToken();
  46173. if (token === null) {
  46174. return;
  46175. }
  46176. }
  46177. if (token === "def") {
  46178. break;
  46179. }
  46180. const index = this.readInt();
  46181. this.getToken();
  46182. const glyph = this.getToken();
  46183. encoding[index] = glyph;
  46184. this.getToken();
  46185. }
  46186. }
  46187. properties.builtInEncoding = encoding;
  46188. break;
  46189. case "FontBBox":
  46190. const fontBBox = this.readNumberArray();
  46191. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  46192. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  46193. properties.ascentScaled = true;
  46194. break;
  46195. }
  46196. }
  46197. }
  46198. }
  46199. exports.Type1Parser = Type1Parser;
  46200. /***/ }),
  46201. /* 175 */
  46202. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46203. "use strict";
  46204. Object.defineProperty(exports, "__esModule", ({
  46205. value: true
  46206. }));
  46207. exports.Pattern = void 0;
  46208. exports.getTilingPatternIR = getTilingPatternIR;
  46209. var _util = __w_pdfjs_require__(2);
  46210. var _base_stream = __w_pdfjs_require__(132);
  46211. var _colorspace = __w_pdfjs_require__(139);
  46212. var _core_utils = __w_pdfjs_require__(131);
  46213. const ShadingType = {
  46214. FUNCTION_BASED: 1,
  46215. AXIAL: 2,
  46216. RADIAL: 3,
  46217. FREE_FORM_MESH: 4,
  46218. LATTICE_FORM_MESH: 5,
  46219. COONS_PATCH_MESH: 6,
  46220. TENSOR_PATCH_MESH: 7
  46221. };
  46222. class Pattern {
  46223. constructor() {
  46224. (0, _util.unreachable)("Cannot initialize Pattern.");
  46225. }
  46226. static parseShading(shading, xref, res, handler, pdfFunctionFactory, localColorSpaceCache) {
  46227. const dict = shading instanceof _base_stream.BaseStream ? shading.dict : shading;
  46228. const type = dict.get("ShadingType");
  46229. try {
  46230. switch (type) {
  46231. case ShadingType.AXIAL:
  46232. case ShadingType.RADIAL:
  46233. return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, localColorSpaceCache);
  46234. case ShadingType.FREE_FORM_MESH:
  46235. case ShadingType.LATTICE_FORM_MESH:
  46236. case ShadingType.COONS_PATCH_MESH:
  46237. case ShadingType.TENSOR_PATCH_MESH:
  46238. return new MeshShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache);
  46239. default:
  46240. throw new _util.FormatError("Unsupported ShadingType: " + type);
  46241. }
  46242. } catch (ex) {
  46243. if (ex instanceof _core_utils.MissingDataException) {
  46244. throw ex;
  46245. }
  46246. handler.send("UnsupportedFeature", {
  46247. featureId: _util.UNSUPPORTED_FEATURES.shadingPattern
  46248. });
  46249. (0, _util.warn)(ex);
  46250. return new DummyShading();
  46251. }
  46252. }
  46253. }
  46254. exports.Pattern = Pattern;
  46255. class BaseShading {
  46256. static get SMALL_NUMBER() {
  46257. return (0, _util.shadow)(this, "SMALL_NUMBER", 1e-6);
  46258. }
  46259. constructor() {
  46260. if (this.constructor === BaseShading) {
  46261. (0, _util.unreachable)("Cannot initialize BaseShading.");
  46262. }
  46263. }
  46264. getIR() {
  46265. (0, _util.unreachable)("Abstract method `getIR` called.");
  46266. }
  46267. }
  46268. class RadialAxialShading extends BaseShading {
  46269. constructor(dict, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  46270. super();
  46271. this.coordsArr = dict.getArray("Coords");
  46272. this.shadingType = dict.get("ShadingType");
  46273. const cs = _colorspace.ColorSpace.parse({
  46274. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  46275. xref,
  46276. resources,
  46277. pdfFunctionFactory,
  46278. localColorSpaceCache
  46279. });
  46280. const bbox = dict.getArray("BBox");
  46281. if (Array.isArray(bbox) && bbox.length === 4) {
  46282. this.bbox = _util.Util.normalizeRect(bbox);
  46283. } else {
  46284. this.bbox = null;
  46285. }
  46286. let t0 = 0.0,
  46287. t1 = 1.0;
  46288. if (dict.has("Domain")) {
  46289. const domainArr = dict.getArray("Domain");
  46290. t0 = domainArr[0];
  46291. t1 = domainArr[1];
  46292. }
  46293. let extendStart = false,
  46294. extendEnd = false;
  46295. if (dict.has("Extend")) {
  46296. const extendArr = dict.getArray("Extend");
  46297. extendStart = extendArr[0];
  46298. extendEnd = extendArr[1];
  46299. }
  46300. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  46301. const [x1, y1, r1, x2, y2, r2] = this.coordsArr;
  46302. const distance = Math.hypot(x1 - x2, y1 - y2);
  46303. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  46304. (0, _util.warn)("Unsupported radial gradient.");
  46305. }
  46306. }
  46307. this.extendStart = extendStart;
  46308. this.extendEnd = extendEnd;
  46309. const fnObj = dict.getRaw("Function");
  46310. const fn = pdfFunctionFactory.createFromArray(fnObj);
  46311. const NUMBER_OF_SAMPLES = 10;
  46312. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  46313. const colorStops = this.colorStops = [];
  46314. if (t0 >= t1 || step <= 0) {
  46315. (0, _util.info)("Bad shading domain.");
  46316. return;
  46317. }
  46318. const color = new Float32Array(cs.numComps),
  46319. ratio = new Float32Array(1);
  46320. let rgbColor;
  46321. for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
  46322. ratio[0] = t0 + i * step;
  46323. fn(ratio, 0, color, 0);
  46324. rgbColor = cs.getRgb(color, 0);
  46325. const cssColor = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  46326. colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
  46327. }
  46328. let background = "transparent";
  46329. if (dict.has("Background")) {
  46330. rgbColor = cs.getRgb(dict.get("Background"), 0);
  46331. background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  46332. }
  46333. if (!extendStart) {
  46334. colorStops.unshift([0, background]);
  46335. colorStops[1][0] += BaseShading.SMALL_NUMBER;
  46336. }
  46337. if (!extendEnd) {
  46338. colorStops.at(-1)[0] -= BaseShading.SMALL_NUMBER;
  46339. colorStops.push([1, background]);
  46340. }
  46341. this.colorStops = colorStops;
  46342. }
  46343. getIR() {
  46344. const coordsArr = this.coordsArr;
  46345. const shadingType = this.shadingType;
  46346. let type, p0, p1, r0, r1;
  46347. if (shadingType === ShadingType.AXIAL) {
  46348. p0 = [coordsArr[0], coordsArr[1]];
  46349. p1 = [coordsArr[2], coordsArr[3]];
  46350. r0 = null;
  46351. r1 = null;
  46352. type = "axial";
  46353. } else if (shadingType === ShadingType.RADIAL) {
  46354. p0 = [coordsArr[0], coordsArr[1]];
  46355. p1 = [coordsArr[3], coordsArr[4]];
  46356. r0 = coordsArr[2];
  46357. r1 = coordsArr[5];
  46358. type = "radial";
  46359. } else {
  46360. (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
  46361. }
  46362. return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
  46363. }
  46364. }
  46365. class MeshStreamReader {
  46366. constructor(stream, context) {
  46367. this.stream = stream;
  46368. this.context = context;
  46369. this.buffer = 0;
  46370. this.bufferLength = 0;
  46371. const numComps = context.numComps;
  46372. this.tmpCompsBuf = new Float32Array(numComps);
  46373. const csNumComps = context.colorSpace.numComps;
  46374. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  46375. }
  46376. get hasData() {
  46377. if (this.stream.end) {
  46378. return this.stream.pos < this.stream.end;
  46379. }
  46380. if (this.bufferLength > 0) {
  46381. return true;
  46382. }
  46383. const nextByte = this.stream.getByte();
  46384. if (nextByte < 0) {
  46385. return false;
  46386. }
  46387. this.buffer = nextByte;
  46388. this.bufferLength = 8;
  46389. return true;
  46390. }
  46391. readBits(n) {
  46392. let buffer = this.buffer;
  46393. let bufferLength = this.bufferLength;
  46394. if (n === 32) {
  46395. if (bufferLength === 0) {
  46396. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  46397. }
  46398. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  46399. const nextByte = this.stream.getByte();
  46400. this.buffer = nextByte & (1 << bufferLength) - 1;
  46401. return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
  46402. }
  46403. if (n === 8 && bufferLength === 0) {
  46404. return this.stream.getByte();
  46405. }
  46406. while (bufferLength < n) {
  46407. buffer = buffer << 8 | this.stream.getByte();
  46408. bufferLength += 8;
  46409. }
  46410. bufferLength -= n;
  46411. this.bufferLength = bufferLength;
  46412. this.buffer = buffer & (1 << bufferLength) - 1;
  46413. return buffer >> bufferLength;
  46414. }
  46415. align() {
  46416. this.buffer = 0;
  46417. this.bufferLength = 0;
  46418. }
  46419. readFlag() {
  46420. return this.readBits(this.context.bitsPerFlag);
  46421. }
  46422. readCoordinate() {
  46423. const bitsPerCoordinate = this.context.bitsPerCoordinate;
  46424. const xi = this.readBits(bitsPerCoordinate);
  46425. const yi = this.readBits(bitsPerCoordinate);
  46426. const decode = this.context.decode;
  46427. const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  46428. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  46429. }
  46430. readComponents() {
  46431. const numComps = this.context.numComps;
  46432. const bitsPerComponent = this.context.bitsPerComponent;
  46433. const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  46434. const decode = this.context.decode;
  46435. const components = this.tmpCompsBuf;
  46436. for (let i = 0, j = 4; i < numComps; i++, j += 2) {
  46437. const ci = this.readBits(bitsPerComponent);
  46438. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  46439. }
  46440. const color = this.tmpCsCompsBuf;
  46441. if (this.context.colorFn) {
  46442. this.context.colorFn(components, 0, color, 0);
  46443. }
  46444. return this.context.colorSpace.getRgb(color, 0);
  46445. }
  46446. }
  46447. const getB = function getBClosure() {
  46448. function buildB(count) {
  46449. const lut = [];
  46450. for (let i = 0; i <= count; i++) {
  46451. const t = i / count,
  46452. t_ = 1 - t;
  46453. lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
  46454. }
  46455. return lut;
  46456. }
  46457. const cache = [];
  46458. return function (count) {
  46459. if (!cache[count]) {
  46460. cache[count] = buildB(count);
  46461. }
  46462. return cache[count];
  46463. };
  46464. }();
  46465. class MeshShading extends BaseShading {
  46466. static get MIN_SPLIT_PATCH_CHUNKS_AMOUNT() {
  46467. return (0, _util.shadow)(this, "MIN_SPLIT_PATCH_CHUNKS_AMOUNT", 3);
  46468. }
  46469. static get MAX_SPLIT_PATCH_CHUNKS_AMOUNT() {
  46470. return (0, _util.shadow)(this, "MAX_SPLIT_PATCH_CHUNKS_AMOUNT", 20);
  46471. }
  46472. static get TRIANGLE_DENSITY() {
  46473. return (0, _util.shadow)(this, "TRIANGLE_DENSITY", 20);
  46474. }
  46475. constructor(stream, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  46476. super();
  46477. if (!(stream instanceof _base_stream.BaseStream)) {
  46478. throw new _util.FormatError("Mesh data is not a stream");
  46479. }
  46480. const dict = stream.dict;
  46481. this.shadingType = dict.get("ShadingType");
  46482. const bbox = dict.getArray("BBox");
  46483. if (Array.isArray(bbox) && bbox.length === 4) {
  46484. this.bbox = _util.Util.normalizeRect(bbox);
  46485. } else {
  46486. this.bbox = null;
  46487. }
  46488. const cs = _colorspace.ColorSpace.parse({
  46489. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  46490. xref,
  46491. resources,
  46492. pdfFunctionFactory,
  46493. localColorSpaceCache
  46494. });
  46495. this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
  46496. const fnObj = dict.getRaw("Function");
  46497. const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  46498. this.coords = [];
  46499. this.colors = [];
  46500. this.figures = [];
  46501. const decodeContext = {
  46502. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  46503. bitsPerComponent: dict.get("BitsPerComponent"),
  46504. bitsPerFlag: dict.get("BitsPerFlag"),
  46505. decode: dict.getArray("Decode"),
  46506. colorFn: fn,
  46507. colorSpace: cs,
  46508. numComps: fn ? 1 : cs.numComps
  46509. };
  46510. const reader = new MeshStreamReader(stream, decodeContext);
  46511. let patchMesh = false;
  46512. switch (this.shadingType) {
  46513. case ShadingType.FREE_FORM_MESH:
  46514. this._decodeType4Shading(reader);
  46515. break;
  46516. case ShadingType.LATTICE_FORM_MESH:
  46517. const verticesPerRow = dict.get("VerticesPerRow") | 0;
  46518. if (verticesPerRow < 2) {
  46519. throw new _util.FormatError("Invalid VerticesPerRow");
  46520. }
  46521. this._decodeType5Shading(reader, verticesPerRow);
  46522. break;
  46523. case ShadingType.COONS_PATCH_MESH:
  46524. this._decodeType6Shading(reader);
  46525. patchMesh = true;
  46526. break;
  46527. case ShadingType.TENSOR_PATCH_MESH:
  46528. this._decodeType7Shading(reader);
  46529. patchMesh = true;
  46530. break;
  46531. default:
  46532. (0, _util.unreachable)("Unsupported mesh type.");
  46533. break;
  46534. }
  46535. if (patchMesh) {
  46536. this._updateBounds();
  46537. for (let i = 0, ii = this.figures.length; i < ii; i++) {
  46538. this._buildFigureFromPatch(i);
  46539. }
  46540. }
  46541. this._updateBounds();
  46542. this._packData();
  46543. }
  46544. _decodeType4Shading(reader) {
  46545. const coords = this.coords;
  46546. const colors = this.colors;
  46547. const operators = [];
  46548. const ps = [];
  46549. let verticesLeft = 0;
  46550. while (reader.hasData) {
  46551. const f = reader.readFlag();
  46552. const coord = reader.readCoordinate();
  46553. const color = reader.readComponents();
  46554. if (verticesLeft === 0) {
  46555. if (!(0 <= f && f <= 2)) {
  46556. throw new _util.FormatError("Unknown type4 flag");
  46557. }
  46558. switch (f) {
  46559. case 0:
  46560. verticesLeft = 3;
  46561. break;
  46562. case 1:
  46563. ps.push(ps.at(-2), ps.at(-1));
  46564. verticesLeft = 1;
  46565. break;
  46566. case 2:
  46567. ps.push(ps.at(-3), ps.at(-1));
  46568. verticesLeft = 1;
  46569. break;
  46570. }
  46571. operators.push(f);
  46572. }
  46573. ps.push(coords.length);
  46574. coords.push(coord);
  46575. colors.push(color);
  46576. verticesLeft--;
  46577. reader.align();
  46578. }
  46579. this.figures.push({
  46580. type: "triangles",
  46581. coords: new Int32Array(ps),
  46582. colors: new Int32Array(ps)
  46583. });
  46584. }
  46585. _decodeType5Shading(reader, verticesPerRow) {
  46586. const coords = this.coords;
  46587. const colors = this.colors;
  46588. const ps = [];
  46589. while (reader.hasData) {
  46590. const coord = reader.readCoordinate();
  46591. const color = reader.readComponents();
  46592. ps.push(coords.length);
  46593. coords.push(coord);
  46594. colors.push(color);
  46595. }
  46596. this.figures.push({
  46597. type: "lattice",
  46598. coords: new Int32Array(ps),
  46599. colors: new Int32Array(ps),
  46600. verticesPerRow
  46601. });
  46602. }
  46603. _decodeType6Shading(reader) {
  46604. const coords = this.coords;
  46605. const colors = this.colors;
  46606. const ps = new Int32Array(16);
  46607. const cs = new Int32Array(4);
  46608. while (reader.hasData) {
  46609. const f = reader.readFlag();
  46610. if (!(0 <= f && f <= 3)) {
  46611. throw new _util.FormatError("Unknown type6 flag");
  46612. }
  46613. const pi = coords.length;
  46614. for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  46615. coords.push(reader.readCoordinate());
  46616. }
  46617. const ci = colors.length;
  46618. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  46619. colors.push(reader.readComponents());
  46620. }
  46621. let tmp1, tmp2, tmp3, tmp4;
  46622. switch (f) {
  46623. case 0:
  46624. ps[12] = pi + 3;
  46625. ps[13] = pi + 4;
  46626. ps[14] = pi + 5;
  46627. ps[15] = pi + 6;
  46628. ps[8] = pi + 2;
  46629. ps[11] = pi + 7;
  46630. ps[4] = pi + 1;
  46631. ps[7] = pi + 8;
  46632. ps[0] = pi;
  46633. ps[1] = pi + 11;
  46634. ps[2] = pi + 10;
  46635. ps[3] = pi + 9;
  46636. cs[2] = ci + 1;
  46637. cs[3] = ci + 2;
  46638. cs[0] = ci;
  46639. cs[1] = ci + 3;
  46640. break;
  46641. case 1:
  46642. tmp1 = ps[12];
  46643. tmp2 = ps[13];
  46644. tmp3 = ps[14];
  46645. tmp4 = ps[15];
  46646. ps[12] = tmp4;
  46647. ps[13] = pi + 0;
  46648. ps[14] = pi + 1;
  46649. ps[15] = pi + 2;
  46650. ps[8] = tmp3;
  46651. ps[11] = pi + 3;
  46652. ps[4] = tmp2;
  46653. ps[7] = pi + 4;
  46654. ps[0] = tmp1;
  46655. ps[1] = pi + 7;
  46656. ps[2] = pi + 6;
  46657. ps[3] = pi + 5;
  46658. tmp1 = cs[2];
  46659. tmp2 = cs[3];
  46660. cs[2] = tmp2;
  46661. cs[3] = ci;
  46662. cs[0] = tmp1;
  46663. cs[1] = ci + 1;
  46664. break;
  46665. case 2:
  46666. tmp1 = ps[15];
  46667. tmp2 = ps[11];
  46668. ps[12] = ps[3];
  46669. ps[13] = pi + 0;
  46670. ps[14] = pi + 1;
  46671. ps[15] = pi + 2;
  46672. ps[8] = ps[7];
  46673. ps[11] = pi + 3;
  46674. ps[4] = tmp2;
  46675. ps[7] = pi + 4;
  46676. ps[0] = tmp1;
  46677. ps[1] = pi + 7;
  46678. ps[2] = pi + 6;
  46679. ps[3] = pi + 5;
  46680. tmp1 = cs[3];
  46681. cs[2] = cs[1];
  46682. cs[3] = ci;
  46683. cs[0] = tmp1;
  46684. cs[1] = ci + 1;
  46685. break;
  46686. case 3:
  46687. ps[12] = ps[0];
  46688. ps[13] = pi + 0;
  46689. ps[14] = pi + 1;
  46690. ps[15] = pi + 2;
  46691. ps[8] = ps[1];
  46692. ps[11] = pi + 3;
  46693. ps[4] = ps[2];
  46694. ps[7] = pi + 4;
  46695. ps[0] = ps[3];
  46696. ps[1] = pi + 7;
  46697. ps[2] = pi + 6;
  46698. ps[3] = pi + 5;
  46699. cs[2] = cs[0];
  46700. cs[3] = ci;
  46701. cs[0] = cs[1];
  46702. cs[1] = ci + 1;
  46703. break;
  46704. }
  46705. ps[5] = coords.length;
  46706. 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]);
  46707. ps[6] = coords.length;
  46708. 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]);
  46709. ps[9] = coords.length;
  46710. 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]);
  46711. ps[10] = coords.length;
  46712. 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]);
  46713. this.figures.push({
  46714. type: "patch",
  46715. coords: new Int32Array(ps),
  46716. colors: new Int32Array(cs)
  46717. });
  46718. }
  46719. }
  46720. _decodeType7Shading(reader) {
  46721. const coords = this.coords;
  46722. const colors = this.colors;
  46723. const ps = new Int32Array(16);
  46724. const cs = new Int32Array(4);
  46725. while (reader.hasData) {
  46726. const f = reader.readFlag();
  46727. if (!(0 <= f && f <= 3)) {
  46728. throw new _util.FormatError("Unknown type7 flag");
  46729. }
  46730. const pi = coords.length;
  46731. for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  46732. coords.push(reader.readCoordinate());
  46733. }
  46734. const ci = colors.length;
  46735. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  46736. colors.push(reader.readComponents());
  46737. }
  46738. let tmp1, tmp2, tmp3, tmp4;
  46739. switch (f) {
  46740. case 0:
  46741. ps[12] = pi + 3;
  46742. ps[13] = pi + 4;
  46743. ps[14] = pi + 5;
  46744. ps[15] = pi + 6;
  46745. ps[8] = pi + 2;
  46746. ps[9] = pi + 13;
  46747. ps[10] = pi + 14;
  46748. ps[11] = pi + 7;
  46749. ps[4] = pi + 1;
  46750. ps[5] = pi + 12;
  46751. ps[6] = pi + 15;
  46752. ps[7] = pi + 8;
  46753. ps[0] = pi;
  46754. ps[1] = pi + 11;
  46755. ps[2] = pi + 10;
  46756. ps[3] = pi + 9;
  46757. cs[2] = ci + 1;
  46758. cs[3] = ci + 2;
  46759. cs[0] = ci;
  46760. cs[1] = ci + 3;
  46761. break;
  46762. case 1:
  46763. tmp1 = ps[12];
  46764. tmp2 = ps[13];
  46765. tmp3 = ps[14];
  46766. tmp4 = ps[15];
  46767. ps[12] = tmp4;
  46768. ps[13] = pi + 0;
  46769. ps[14] = pi + 1;
  46770. ps[15] = pi + 2;
  46771. ps[8] = tmp3;
  46772. ps[9] = pi + 9;
  46773. ps[10] = pi + 10;
  46774. ps[11] = pi + 3;
  46775. ps[4] = tmp2;
  46776. ps[5] = pi + 8;
  46777. ps[6] = pi + 11;
  46778. ps[7] = pi + 4;
  46779. ps[0] = tmp1;
  46780. ps[1] = pi + 7;
  46781. ps[2] = pi + 6;
  46782. ps[3] = pi + 5;
  46783. tmp1 = cs[2];
  46784. tmp2 = cs[3];
  46785. cs[2] = tmp2;
  46786. cs[3] = ci;
  46787. cs[0] = tmp1;
  46788. cs[1] = ci + 1;
  46789. break;
  46790. case 2:
  46791. tmp1 = ps[15];
  46792. tmp2 = ps[11];
  46793. ps[12] = ps[3];
  46794. ps[13] = pi + 0;
  46795. ps[14] = pi + 1;
  46796. ps[15] = pi + 2;
  46797. ps[8] = ps[7];
  46798. ps[9] = pi + 9;
  46799. ps[10] = pi + 10;
  46800. ps[11] = pi + 3;
  46801. ps[4] = tmp2;
  46802. ps[5] = pi + 8;
  46803. ps[6] = pi + 11;
  46804. ps[7] = pi + 4;
  46805. ps[0] = tmp1;
  46806. ps[1] = pi + 7;
  46807. ps[2] = pi + 6;
  46808. ps[3] = pi + 5;
  46809. tmp1 = cs[3];
  46810. cs[2] = cs[1];
  46811. cs[3] = ci;
  46812. cs[0] = tmp1;
  46813. cs[1] = ci + 1;
  46814. break;
  46815. case 3:
  46816. ps[12] = ps[0];
  46817. ps[13] = pi + 0;
  46818. ps[14] = pi + 1;
  46819. ps[15] = pi + 2;
  46820. ps[8] = ps[1];
  46821. ps[9] = pi + 9;
  46822. ps[10] = pi + 10;
  46823. ps[11] = pi + 3;
  46824. ps[4] = ps[2];
  46825. ps[5] = pi + 8;
  46826. ps[6] = pi + 11;
  46827. ps[7] = pi + 4;
  46828. ps[0] = ps[3];
  46829. ps[1] = pi + 7;
  46830. ps[2] = pi + 6;
  46831. ps[3] = pi + 5;
  46832. cs[2] = cs[0];
  46833. cs[3] = ci;
  46834. cs[0] = cs[1];
  46835. cs[1] = ci + 1;
  46836. break;
  46837. }
  46838. this.figures.push({
  46839. type: "patch",
  46840. coords: new Int32Array(ps),
  46841. colors: new Int32Array(cs)
  46842. });
  46843. }
  46844. }
  46845. _buildFigureFromPatch(index) {
  46846. const figure = this.figures[index];
  46847. (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure");
  46848. const coords = this.coords,
  46849. colors = this.colors;
  46850. const pi = figure.coords;
  46851. const ci = figure.colors;
  46852. const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  46853. const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  46854. const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  46855. const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  46856. let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0]));
  46857. splitXBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  46858. let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1]));
  46859. splitYBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  46860. const verticesPerRow = splitXBy + 1;
  46861. const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  46862. const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  46863. let k = 0;
  46864. const cl = new Uint8Array(3),
  46865. cr = new Uint8Array(3);
  46866. const c0 = colors[ci[0]],
  46867. c1 = colors[ci[1]],
  46868. c2 = colors[ci[2]],
  46869. c3 = colors[ci[3]];
  46870. const bRow = getB(splitYBy),
  46871. bCol = getB(splitXBy);
  46872. for (let row = 0; row <= splitYBy; row++) {
  46873. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  46874. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  46875. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  46876. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  46877. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  46878. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  46879. for (let col = 0; col <= splitXBy; col++, k++) {
  46880. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  46881. continue;
  46882. }
  46883. let x = 0,
  46884. y = 0;
  46885. let q = 0;
  46886. for (let i = 0; i <= 3; i++) {
  46887. for (let j = 0; j <= 3; j++, q++) {
  46888. const m = bRow[row][i] * bCol[col][j];
  46889. x += coords[pi[q]][0] * m;
  46890. y += coords[pi[q]][1] * m;
  46891. }
  46892. }
  46893. figureCoords[k] = coords.length;
  46894. coords.push([x, y]);
  46895. figureColors[k] = colors.length;
  46896. const newColor = new Uint8Array(3);
  46897. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  46898. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  46899. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  46900. colors.push(newColor);
  46901. }
  46902. }
  46903. figureCoords[0] = pi[0];
  46904. figureColors[0] = ci[0];
  46905. figureCoords[splitXBy] = pi[3];
  46906. figureColors[splitXBy] = ci[1];
  46907. figureCoords[verticesPerRow * splitYBy] = pi[12];
  46908. figureColors[verticesPerRow * splitYBy] = ci[2];
  46909. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  46910. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  46911. this.figures[index] = {
  46912. type: "lattice",
  46913. coords: figureCoords,
  46914. colors: figureColors,
  46915. verticesPerRow
  46916. };
  46917. }
  46918. _updateBounds() {
  46919. let minX = this.coords[0][0],
  46920. minY = this.coords[0][1],
  46921. maxX = minX,
  46922. maxY = minY;
  46923. for (let i = 1, ii = this.coords.length; i < ii; i++) {
  46924. const x = this.coords[i][0],
  46925. y = this.coords[i][1];
  46926. minX = minX > x ? x : minX;
  46927. minY = minY > y ? y : minY;
  46928. maxX = maxX < x ? x : maxX;
  46929. maxY = maxY < y ? y : maxY;
  46930. }
  46931. this.bounds = [minX, minY, maxX, maxY];
  46932. }
  46933. _packData() {
  46934. let i, ii, j, jj;
  46935. const coords = this.coords;
  46936. const coordsPacked = new Float32Array(coords.length * 2);
  46937. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  46938. const xy = coords[i];
  46939. coordsPacked[j++] = xy[0];
  46940. coordsPacked[j++] = xy[1];
  46941. }
  46942. this.coords = coordsPacked;
  46943. const colors = this.colors;
  46944. const colorsPacked = new Uint8Array(colors.length * 3);
  46945. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  46946. const c = colors[i];
  46947. colorsPacked[j++] = c[0];
  46948. colorsPacked[j++] = c[1];
  46949. colorsPacked[j++] = c[2];
  46950. }
  46951. this.colors = colorsPacked;
  46952. const figures = this.figures;
  46953. for (i = 0, ii = figures.length; i < ii; i++) {
  46954. const figure = figures[i],
  46955. ps = figure.coords,
  46956. cs = figure.colors;
  46957. for (j = 0, jj = ps.length; j < jj; j++) {
  46958. ps[j] *= 2;
  46959. cs[j] *= 3;
  46960. }
  46961. }
  46962. }
  46963. getIR() {
  46964. return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.bbox, this.background];
  46965. }
  46966. }
  46967. class DummyShading extends BaseShading {
  46968. getIR() {
  46969. return ["Dummy"];
  46970. }
  46971. }
  46972. function getTilingPatternIR(operatorList, dict, color) {
  46973. const matrix = dict.getArray("Matrix");
  46974. const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
  46975. const xstep = dict.get("XStep");
  46976. const ystep = dict.get("YStep");
  46977. const paintType = dict.get("PaintType");
  46978. const tilingType = dict.get("TilingType");
  46979. if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  46980. throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
  46981. }
  46982. return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  46983. }
  46984. /***/ }),
  46985. /* 176 */
  46986. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46987. "use strict";
  46988. Object.defineProperty(exports, "__esModule", ({
  46989. value: true
  46990. }));
  46991. exports.getXfaFontDict = getXfaFontDict;
  46992. exports.getXfaFontName = getXfaFontName;
  46993. var _calibri_factors = __w_pdfjs_require__(177);
  46994. var _primitives = __w_pdfjs_require__(130);
  46995. var _helvetica_factors = __w_pdfjs_require__(178);
  46996. var _liberationsans_widths = __w_pdfjs_require__(179);
  46997. var _myriadpro_factors = __w_pdfjs_require__(180);
  46998. var _segoeui_factors = __w_pdfjs_require__(181);
  46999. var _core_utils = __w_pdfjs_require__(131);
  47000. var _fonts_utils = __w_pdfjs_require__(163);
  47001. const getXFAFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  47002. t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = {
  47003. name: "LiberationSans-Regular",
  47004. factors: _myriadpro_factors.MyriadProRegularFactors,
  47005. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47006. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  47007. metrics: _myriadpro_factors.MyriadProRegularMetrics
  47008. };
  47009. t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = {
  47010. name: "LiberationSans-Bold",
  47011. factors: _myriadpro_factors.MyriadProBoldFactors,
  47012. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47013. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  47014. metrics: _myriadpro_factors.MyriadProBoldMetrics
  47015. };
  47016. t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = {
  47017. name: "LiberationSans-Italic",
  47018. factors: _myriadpro_factors.MyriadProItalicFactors,
  47019. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47020. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  47021. metrics: _myriadpro_factors.MyriadProItalicMetrics
  47022. };
  47023. t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = {
  47024. name: "LiberationSans-BoldItalic",
  47025. factors: _myriadpro_factors.MyriadProBoldItalicFactors,
  47026. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47027. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  47028. metrics: _myriadpro_factors.MyriadProBoldItalicMetrics
  47029. };
  47030. t.ArialMT = t.Arial = t["Arial-Regular"] = {
  47031. name: "LiberationSans-Regular",
  47032. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47033. baseMapping: _liberationsans_widths.LiberationSansRegularMapping
  47034. };
  47035. t["Arial-BoldMT"] = t["Arial-Bold"] = {
  47036. name: "LiberationSans-Bold",
  47037. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47038. baseMapping: _liberationsans_widths.LiberationSansBoldMapping
  47039. };
  47040. t["Arial-ItalicMT"] = t["Arial-Italic"] = {
  47041. name: "LiberationSans-Italic",
  47042. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47043. baseMapping: _liberationsans_widths.LiberationSansItalicMapping
  47044. };
  47045. t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = {
  47046. name: "LiberationSans-BoldItalic",
  47047. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47048. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping
  47049. };
  47050. t["Calibri-Regular"] = {
  47051. name: "LiberationSans-Regular",
  47052. factors: _calibri_factors.CalibriRegularFactors,
  47053. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47054. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  47055. metrics: _calibri_factors.CalibriRegularMetrics
  47056. };
  47057. t["Calibri-Bold"] = {
  47058. name: "LiberationSans-Bold",
  47059. factors: _calibri_factors.CalibriBoldFactors,
  47060. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47061. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  47062. metrics: _calibri_factors.CalibriBoldMetrics
  47063. };
  47064. t["Calibri-Italic"] = {
  47065. name: "LiberationSans-Italic",
  47066. factors: _calibri_factors.CalibriItalicFactors,
  47067. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47068. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  47069. metrics: _calibri_factors.CalibriItalicMetrics
  47070. };
  47071. t["Calibri-BoldItalic"] = {
  47072. name: "LiberationSans-BoldItalic",
  47073. factors: _calibri_factors.CalibriBoldItalicFactors,
  47074. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47075. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  47076. metrics: _calibri_factors.CalibriBoldItalicMetrics
  47077. };
  47078. t["Segoeui-Regular"] = {
  47079. name: "LiberationSans-Regular",
  47080. factors: _segoeui_factors.SegoeuiRegularFactors,
  47081. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47082. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  47083. metrics: _segoeui_factors.SegoeuiRegularMetrics
  47084. };
  47085. t["Segoeui-Bold"] = {
  47086. name: "LiberationSans-Bold",
  47087. factors: _segoeui_factors.SegoeuiBoldFactors,
  47088. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47089. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  47090. metrics: _segoeui_factors.SegoeuiBoldMetrics
  47091. };
  47092. t["Segoeui-Italic"] = {
  47093. name: "LiberationSans-Italic",
  47094. factors: _segoeui_factors.SegoeuiItalicFactors,
  47095. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47096. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  47097. metrics: _segoeui_factors.SegoeuiItalicMetrics
  47098. };
  47099. t["Segoeui-BoldItalic"] = {
  47100. name: "LiberationSans-BoldItalic",
  47101. factors: _segoeui_factors.SegoeuiBoldItalicFactors,
  47102. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47103. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  47104. metrics: _segoeui_factors.SegoeuiBoldItalicMetrics
  47105. };
  47106. t["Helvetica-Regular"] = t.Helvetica = {
  47107. name: "LiberationSans-Regular",
  47108. factors: _helvetica_factors.HelveticaRegularFactors,
  47109. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47110. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  47111. metrics: _helvetica_factors.HelveticaRegularMetrics
  47112. };
  47113. t["Helvetica-Bold"] = {
  47114. name: "LiberationSans-Bold",
  47115. factors: _helvetica_factors.HelveticaBoldFactors,
  47116. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47117. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  47118. metrics: _helvetica_factors.HelveticaBoldMetrics
  47119. };
  47120. t["Helvetica-Italic"] = {
  47121. name: "LiberationSans-Italic",
  47122. factors: _helvetica_factors.HelveticaItalicFactors,
  47123. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47124. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  47125. metrics: _helvetica_factors.HelveticaItalicMetrics
  47126. };
  47127. t["Helvetica-BoldItalic"] = {
  47128. name: "LiberationSans-BoldItalic",
  47129. factors: _helvetica_factors.HelveticaBoldItalicFactors,
  47130. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47131. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  47132. metrics: _helvetica_factors.HelveticaBoldItalicMetrics
  47133. };
  47134. });
  47135. function getXfaFontName(name) {
  47136. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  47137. const fontMap = getXFAFontMap();
  47138. return fontMap[fontName];
  47139. }
  47140. function getXfaFontWidths(name) {
  47141. const info = getXfaFontName(name);
  47142. if (!info) {
  47143. return null;
  47144. }
  47145. const {
  47146. baseWidths,
  47147. baseMapping,
  47148. factors
  47149. } = info;
  47150. let rescaledBaseWidths;
  47151. if (!factors) {
  47152. rescaledBaseWidths = baseWidths;
  47153. } else {
  47154. rescaledBaseWidths = baseWidths.map((w, i) => w * factors[i]);
  47155. }
  47156. let currentCode = -2;
  47157. let currentArray;
  47158. const newWidths = [];
  47159. for (const [unicode, glyphIndex] of baseMapping.map((charUnicode, index) => [charUnicode, index]).sort((_ref, _ref2) => {
  47160. let [unicode1] = _ref;
  47161. let [unicode2] = _ref2;
  47162. return unicode1 - unicode2;
  47163. })) {
  47164. if (unicode === -1) {
  47165. continue;
  47166. }
  47167. if (unicode === currentCode + 1) {
  47168. currentArray.push(rescaledBaseWidths[glyphIndex]);
  47169. currentCode += 1;
  47170. } else {
  47171. currentCode = unicode;
  47172. currentArray = [rescaledBaseWidths[glyphIndex]];
  47173. newWidths.push(unicode, currentArray);
  47174. }
  47175. }
  47176. return newWidths;
  47177. }
  47178. function getXfaFontDict(name) {
  47179. const widths = getXfaFontWidths(name);
  47180. const dict = new _primitives.Dict(null);
  47181. dict.set("BaseFont", _primitives.Name.get(name));
  47182. dict.set("Type", _primitives.Name.get("Font"));
  47183. dict.set("Subtype", _primitives.Name.get("CIDFontType2"));
  47184. dict.set("Encoding", _primitives.Name.get("Identity-H"));
  47185. dict.set("CIDToGIDMap", _primitives.Name.get("Identity"));
  47186. dict.set("W", widths);
  47187. dict.set("FirstChar", widths[0]);
  47188. dict.set("LastChar", widths.at(-2) + widths.at(-1).length - 1);
  47189. const descriptor = new _primitives.Dict(null);
  47190. dict.set("FontDescriptor", descriptor);
  47191. const systemInfo = new _primitives.Dict(null);
  47192. systemInfo.set("Ordering", "Identity");
  47193. systemInfo.set("Registry", "Adobe");
  47194. systemInfo.set("Supplement", 0);
  47195. dict.set("CIDSystemInfo", systemInfo);
  47196. return dict;
  47197. }
  47198. /***/ }),
  47199. /* 177 */
  47200. /***/ ((__unused_webpack_module, exports) => {
  47201. "use strict";
  47202. Object.defineProperty(exports, "__esModule", ({
  47203. value: true
  47204. }));
  47205. exports.CalibriRegularMetrics = exports.CalibriRegularFactors = exports.CalibriItalicMetrics = exports.CalibriItalicFactors = exports.CalibriBoldMetrics = exports.CalibriBoldItalicMetrics = exports.CalibriBoldItalicFactors = exports.CalibriBoldFactors = void 0;
  47206. 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];
  47207. exports.CalibriBoldFactors = CalibriBoldFactors;
  47208. const CalibriBoldMetrics = {
  47209. lineHeight: 1.2207,
  47210. lineGap: 0.2207
  47211. };
  47212. exports.CalibriBoldMetrics = CalibriBoldMetrics;
  47213. 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];
  47214. exports.CalibriBoldItalicFactors = CalibriBoldItalicFactors;
  47215. const CalibriBoldItalicMetrics = {
  47216. lineHeight: 1.2207,
  47217. lineGap: 0.2207
  47218. };
  47219. exports.CalibriBoldItalicMetrics = CalibriBoldItalicMetrics;
  47220. 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];
  47221. exports.CalibriItalicFactors = CalibriItalicFactors;
  47222. const CalibriItalicMetrics = {
  47223. lineHeight: 1.2207,
  47224. lineGap: 0.2207
  47225. };
  47226. exports.CalibriItalicMetrics = CalibriItalicMetrics;
  47227. 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];
  47228. exports.CalibriRegularFactors = CalibriRegularFactors;
  47229. const CalibriRegularMetrics = {
  47230. lineHeight: 1.2207,
  47231. lineGap: 0.2207
  47232. };
  47233. exports.CalibriRegularMetrics = CalibriRegularMetrics;
  47234. /***/ }),
  47235. /* 178 */
  47236. /***/ ((__unused_webpack_module, exports) => {
  47237. "use strict";
  47238. Object.defineProperty(exports, "__esModule", ({
  47239. value: true
  47240. }));
  47241. exports.HelveticaRegularMetrics = exports.HelveticaRegularFactors = exports.HelveticaItalicMetrics = exports.HelveticaItalicFactors = exports.HelveticaBoldMetrics = exports.HelveticaBoldItalicMetrics = exports.HelveticaBoldItalicFactors = exports.HelveticaBoldFactors = void 0;
  47242. 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];
  47243. exports.HelveticaBoldFactors = HelveticaBoldFactors;
  47244. const HelveticaBoldMetrics = {
  47245. lineHeight: 1.2,
  47246. lineGap: 0.2
  47247. };
  47248. exports.HelveticaBoldMetrics = HelveticaBoldMetrics;
  47249. 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];
  47250. exports.HelveticaBoldItalicFactors = HelveticaBoldItalicFactors;
  47251. const HelveticaBoldItalicMetrics = {
  47252. lineHeight: 1.35,
  47253. lineGap: 0.2
  47254. };
  47255. exports.HelveticaBoldItalicMetrics = HelveticaBoldItalicMetrics;
  47256. 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];
  47257. exports.HelveticaItalicFactors = HelveticaItalicFactors;
  47258. const HelveticaItalicMetrics = {
  47259. lineHeight: 1.35,
  47260. lineGap: 0.2
  47261. };
  47262. exports.HelveticaItalicMetrics = HelveticaItalicMetrics;
  47263. 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];
  47264. exports.HelveticaRegularFactors = HelveticaRegularFactors;
  47265. const HelveticaRegularMetrics = {
  47266. lineHeight: 1.2,
  47267. lineGap: 0.2
  47268. };
  47269. exports.HelveticaRegularMetrics = HelveticaRegularMetrics;
  47270. /***/ }),
  47271. /* 179 */
  47272. /***/ ((__unused_webpack_module, exports) => {
  47273. "use strict";
  47274. Object.defineProperty(exports, "__esModule", ({
  47275. value: true
  47276. }));
  47277. exports.LiberationSansRegularWidths = exports.LiberationSansRegularMapping = exports.LiberationSansItalicWidths = exports.LiberationSansItalicMapping = exports.LiberationSansBoldWidths = exports.LiberationSansBoldMapping = exports.LiberationSansBoldItalicWidths = exports.LiberationSansBoldItalicMapping = void 0;
  47278. 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];
  47279. exports.LiberationSansBoldWidths = LiberationSansBoldWidths;
  47280. 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];
  47281. exports.LiberationSansBoldMapping = LiberationSansBoldMapping;
  47282. 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];
  47283. exports.LiberationSansBoldItalicWidths = LiberationSansBoldItalicWidths;
  47284. 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];
  47285. exports.LiberationSansBoldItalicMapping = LiberationSansBoldItalicMapping;
  47286. 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];
  47287. exports.LiberationSansItalicWidths = LiberationSansItalicWidths;
  47288. 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];
  47289. exports.LiberationSansItalicMapping = LiberationSansItalicMapping;
  47290. 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];
  47291. exports.LiberationSansRegularWidths = LiberationSansRegularWidths;
  47292. 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];
  47293. exports.LiberationSansRegularMapping = LiberationSansRegularMapping;
  47294. /***/ }),
  47295. /* 180 */
  47296. /***/ ((__unused_webpack_module, exports) => {
  47297. "use strict";
  47298. Object.defineProperty(exports, "__esModule", ({
  47299. value: true
  47300. }));
  47301. exports.MyriadProRegularMetrics = exports.MyriadProRegularFactors = exports.MyriadProItalicMetrics = exports.MyriadProItalicFactors = exports.MyriadProBoldMetrics = exports.MyriadProBoldItalicMetrics = exports.MyriadProBoldItalicFactors = exports.MyriadProBoldFactors = void 0;
  47302. 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];
  47303. exports.MyriadProBoldFactors = MyriadProBoldFactors;
  47304. const MyriadProBoldMetrics = {
  47305. lineHeight: 1.2,
  47306. lineGap: 0.2
  47307. };
  47308. exports.MyriadProBoldMetrics = MyriadProBoldMetrics;
  47309. 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];
  47310. exports.MyriadProBoldItalicFactors = MyriadProBoldItalicFactors;
  47311. const MyriadProBoldItalicMetrics = {
  47312. lineHeight: 1.2,
  47313. lineGap: 0.2
  47314. };
  47315. exports.MyriadProBoldItalicMetrics = MyriadProBoldItalicMetrics;
  47316. 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];
  47317. exports.MyriadProItalicFactors = MyriadProItalicFactors;
  47318. const MyriadProItalicMetrics = {
  47319. lineHeight: 1.2,
  47320. lineGap: 0.2
  47321. };
  47322. exports.MyriadProItalicMetrics = MyriadProItalicMetrics;
  47323. 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];
  47324. exports.MyriadProRegularFactors = MyriadProRegularFactors;
  47325. const MyriadProRegularMetrics = {
  47326. lineHeight: 1.2,
  47327. lineGap: 0.2
  47328. };
  47329. exports.MyriadProRegularMetrics = MyriadProRegularMetrics;
  47330. /***/ }),
  47331. /* 181 */
  47332. /***/ ((__unused_webpack_module, exports) => {
  47333. "use strict";
  47334. Object.defineProperty(exports, "__esModule", ({
  47335. value: true
  47336. }));
  47337. exports.SegoeuiRegularMetrics = exports.SegoeuiRegularFactors = exports.SegoeuiItalicMetrics = exports.SegoeuiItalicFactors = exports.SegoeuiBoldMetrics = exports.SegoeuiBoldItalicMetrics = exports.SegoeuiBoldItalicFactors = exports.SegoeuiBoldFactors = void 0;
  47338. 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];
  47339. exports.SegoeuiBoldFactors = SegoeuiBoldFactors;
  47340. const SegoeuiBoldMetrics = {
  47341. lineHeight: 1.33008,
  47342. lineGap: 0
  47343. };
  47344. exports.SegoeuiBoldMetrics = SegoeuiBoldMetrics;
  47345. 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];
  47346. exports.SegoeuiBoldItalicFactors = SegoeuiBoldItalicFactors;
  47347. const SegoeuiBoldItalicMetrics = {
  47348. lineHeight: 1.33008,
  47349. lineGap: 0
  47350. };
  47351. exports.SegoeuiBoldItalicMetrics = SegoeuiBoldItalicMetrics;
  47352. 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];
  47353. exports.SegoeuiItalicFactors = SegoeuiItalicFactors;
  47354. const SegoeuiItalicMetrics = {
  47355. lineHeight: 1.33008,
  47356. lineGap: 0
  47357. };
  47358. exports.SegoeuiItalicMetrics = SegoeuiItalicMetrics;
  47359. 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];
  47360. exports.SegoeuiRegularFactors = SegoeuiRegularFactors;
  47361. const SegoeuiRegularMetrics = {
  47362. lineHeight: 1.33008,
  47363. lineGap: 0
  47364. };
  47365. exports.SegoeuiRegularMetrics = SegoeuiRegularMetrics;
  47366. /***/ }),
  47367. /* 182 */
  47368. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47369. "use strict";
  47370. Object.defineProperty(exports, "__esModule", ({
  47371. value: true
  47372. }));
  47373. exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0;
  47374. exports.isPDFFunction = isPDFFunction;
  47375. var _primitives = __w_pdfjs_require__(130);
  47376. var _util = __w_pdfjs_require__(2);
  47377. var _ps_parser = __w_pdfjs_require__(183);
  47378. var _base_stream = __w_pdfjs_require__(132);
  47379. var _image_utils = __w_pdfjs_require__(184);
  47380. class PDFFunctionFactory {
  47381. constructor(_ref) {
  47382. let {
  47383. xref,
  47384. isEvalSupported = true
  47385. } = _ref;
  47386. this.xref = xref;
  47387. this.isEvalSupported = isEvalSupported !== false;
  47388. }
  47389. create(fn) {
  47390. const cachedFunction = this.getCached(fn);
  47391. if (cachedFunction) {
  47392. return cachedFunction;
  47393. }
  47394. const parsedFunction = PDFFunction.parse({
  47395. xref: this.xref,
  47396. isEvalSupported: this.isEvalSupported,
  47397. fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn
  47398. });
  47399. this._cache(fn, parsedFunction);
  47400. return parsedFunction;
  47401. }
  47402. createFromArray(fnObj) {
  47403. const cachedFunction = this.getCached(fnObj);
  47404. if (cachedFunction) {
  47405. return cachedFunction;
  47406. }
  47407. const parsedFunction = PDFFunction.parseArray({
  47408. xref: this.xref,
  47409. isEvalSupported: this.isEvalSupported,
  47410. fnObj: fnObj instanceof _primitives.Ref ? this.xref.fetch(fnObj) : fnObj
  47411. });
  47412. this._cache(fnObj, parsedFunction);
  47413. return parsedFunction;
  47414. }
  47415. getCached(cacheKey) {
  47416. let fnRef;
  47417. if (cacheKey instanceof _primitives.Ref) {
  47418. fnRef = cacheKey;
  47419. } else if (cacheKey instanceof _primitives.Dict) {
  47420. fnRef = cacheKey.objId;
  47421. } else if (cacheKey instanceof _base_stream.BaseStream) {
  47422. fnRef = cacheKey.dict && cacheKey.dict.objId;
  47423. }
  47424. if (fnRef) {
  47425. const localFunction = this._localFunctionCache.getByRef(fnRef);
  47426. if (localFunction) {
  47427. return localFunction;
  47428. }
  47429. }
  47430. return null;
  47431. }
  47432. _cache(cacheKey, parsedFunction) {
  47433. if (!parsedFunction) {
  47434. throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.');
  47435. }
  47436. let fnRef;
  47437. if (cacheKey instanceof _primitives.Ref) {
  47438. fnRef = cacheKey;
  47439. } else if (cacheKey instanceof _primitives.Dict) {
  47440. fnRef = cacheKey.objId;
  47441. } else if (cacheKey instanceof _base_stream.BaseStream) {
  47442. fnRef = cacheKey.dict && cacheKey.dict.objId;
  47443. }
  47444. if (fnRef) {
  47445. this._localFunctionCache.set(null, fnRef, parsedFunction);
  47446. }
  47447. }
  47448. get _localFunctionCache() {
  47449. return (0, _util.shadow)(this, "_localFunctionCache", new _image_utils.LocalFunctionCache());
  47450. }
  47451. }
  47452. exports.PDFFunctionFactory = PDFFunctionFactory;
  47453. function toNumberArray(arr) {
  47454. if (!Array.isArray(arr)) {
  47455. return null;
  47456. }
  47457. const length = arr.length;
  47458. for (let i = 0; i < length; i++) {
  47459. if (typeof arr[i] !== "number") {
  47460. const result = new Array(length);
  47461. for (let j = 0; j < length; j++) {
  47462. result[j] = +arr[j];
  47463. }
  47464. return result;
  47465. }
  47466. }
  47467. return arr;
  47468. }
  47469. class PDFFunction {
  47470. static getSampleArray(size, outputSize, bps, stream) {
  47471. let i, ii;
  47472. let length = 1;
  47473. for (i = 0, ii = size.length; i < ii; i++) {
  47474. length *= size[i];
  47475. }
  47476. length *= outputSize;
  47477. const array = new Array(length);
  47478. let codeSize = 0;
  47479. let codeBuf = 0;
  47480. const sampleMul = 1.0 / (2.0 ** bps - 1);
  47481. const strBytes = stream.getBytes((length * bps + 7) / 8);
  47482. let strIdx = 0;
  47483. for (i = 0; i < length; i++) {
  47484. while (codeSize < bps) {
  47485. codeBuf <<= 8;
  47486. codeBuf |= strBytes[strIdx++];
  47487. codeSize += 8;
  47488. }
  47489. codeSize -= bps;
  47490. array[i] = (codeBuf >> codeSize) * sampleMul;
  47491. codeBuf &= (1 << codeSize) - 1;
  47492. }
  47493. return array;
  47494. }
  47495. static parse(_ref2) {
  47496. let {
  47497. xref,
  47498. isEvalSupported,
  47499. fn
  47500. } = _ref2;
  47501. const dict = fn.dict || fn;
  47502. const typeNum = dict.get("FunctionType");
  47503. switch (typeNum) {
  47504. case 0:
  47505. return this.constructSampled({
  47506. xref,
  47507. isEvalSupported,
  47508. fn,
  47509. dict
  47510. });
  47511. case 1:
  47512. break;
  47513. case 2:
  47514. return this.constructInterpolated({
  47515. xref,
  47516. isEvalSupported,
  47517. dict
  47518. });
  47519. case 3:
  47520. return this.constructStiched({
  47521. xref,
  47522. isEvalSupported,
  47523. dict
  47524. });
  47525. case 4:
  47526. return this.constructPostScript({
  47527. xref,
  47528. isEvalSupported,
  47529. fn,
  47530. dict
  47531. });
  47532. }
  47533. throw new _util.FormatError("Unknown type of function");
  47534. }
  47535. static parseArray(_ref3) {
  47536. let {
  47537. xref,
  47538. isEvalSupported,
  47539. fnObj
  47540. } = _ref3;
  47541. if (!Array.isArray(fnObj)) {
  47542. return this.parse({
  47543. xref,
  47544. isEvalSupported,
  47545. fn: fnObj
  47546. });
  47547. }
  47548. const fnArray = [];
  47549. for (let j = 0, jj = fnObj.length; j < jj; j++) {
  47550. fnArray.push(this.parse({
  47551. xref,
  47552. isEvalSupported,
  47553. fn: xref.fetchIfRef(fnObj[j])
  47554. }));
  47555. }
  47556. return function (src, srcOffset, dest, destOffset) {
  47557. for (let i = 0, ii = fnArray.length; i < ii; i++) {
  47558. fnArray[i](src, srcOffset, dest, destOffset + i);
  47559. }
  47560. };
  47561. }
  47562. static constructSampled(_ref4) {
  47563. let {
  47564. xref,
  47565. isEvalSupported,
  47566. fn,
  47567. dict
  47568. } = _ref4;
  47569. function toMultiArray(arr) {
  47570. const inputLength = arr.length;
  47571. const out = [];
  47572. let index = 0;
  47573. for (let i = 0; i < inputLength; i += 2) {
  47574. out[index++] = [arr[i], arr[i + 1]];
  47575. }
  47576. return out;
  47577. }
  47578. function interpolate(x, xmin, xmax, ymin, ymax) {
  47579. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  47580. }
  47581. let domain = toNumberArray(dict.getArray("Domain"));
  47582. let range = toNumberArray(dict.getArray("Range"));
  47583. if (!domain || !range) {
  47584. throw new _util.FormatError("No domain or range");
  47585. }
  47586. const inputSize = domain.length / 2;
  47587. const outputSize = range.length / 2;
  47588. domain = toMultiArray(domain);
  47589. range = toMultiArray(range);
  47590. const size = toNumberArray(dict.getArray("Size"));
  47591. const bps = dict.get("BitsPerSample");
  47592. const order = dict.get("Order") || 1;
  47593. if (order !== 1) {
  47594. (0, _util.info)("No support for cubic spline interpolation: " + order);
  47595. }
  47596. let encode = toNumberArray(dict.getArray("Encode"));
  47597. if (!encode) {
  47598. encode = [];
  47599. for (let i = 0; i < inputSize; ++i) {
  47600. encode.push([0, size[i] - 1]);
  47601. }
  47602. } else {
  47603. encode = toMultiArray(encode);
  47604. }
  47605. let decode = toNumberArray(dict.getArray("Decode"));
  47606. if (!decode) {
  47607. decode = range;
  47608. } else {
  47609. decode = toMultiArray(decode);
  47610. }
  47611. const samples = this.getSampleArray(size, outputSize, bps, fn);
  47612. return function constructSampledFn(src, srcOffset, dest, destOffset) {
  47613. const cubeVertices = 1 << inputSize;
  47614. const cubeN = new Float64Array(cubeVertices);
  47615. const cubeVertex = new Uint32Array(cubeVertices);
  47616. let i, j;
  47617. for (j = 0; j < cubeVertices; j++) {
  47618. cubeN[j] = 1;
  47619. }
  47620. let k = outputSize,
  47621. pos = 1;
  47622. for (i = 0; i < inputSize; ++i) {
  47623. const domain_2i = domain[i][0];
  47624. const domain_2i_1 = domain[i][1];
  47625. const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  47626. let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  47627. const size_i = size[i];
  47628. e = Math.min(Math.max(e, 0), size_i - 1);
  47629. const e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  47630. const n0 = e0 + 1 - e;
  47631. const n1 = e - e0;
  47632. const offset0 = e0 * k;
  47633. const offset1 = offset0 + k;
  47634. for (j = 0; j < cubeVertices; j++) {
  47635. if (j & pos) {
  47636. cubeN[j] *= n1;
  47637. cubeVertex[j] += offset1;
  47638. } else {
  47639. cubeN[j] *= n0;
  47640. cubeVertex[j] += offset0;
  47641. }
  47642. }
  47643. k *= size_i;
  47644. pos <<= 1;
  47645. }
  47646. for (j = 0; j < outputSize; ++j) {
  47647. let rj = 0;
  47648. for (i = 0; i < cubeVertices; i++) {
  47649. rj += samples[cubeVertex[i] + j] * cubeN[i];
  47650. }
  47651. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  47652. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  47653. }
  47654. };
  47655. }
  47656. static constructInterpolated(_ref5) {
  47657. let {
  47658. xref,
  47659. isEvalSupported,
  47660. dict
  47661. } = _ref5;
  47662. const c0 = toNumberArray(dict.getArray("C0")) || [0];
  47663. const c1 = toNumberArray(dict.getArray("C1")) || [1];
  47664. const n = dict.get("N");
  47665. const diff = [];
  47666. for (let i = 0, ii = c0.length; i < ii; ++i) {
  47667. diff.push(c1[i] - c0[i]);
  47668. }
  47669. const length = diff.length;
  47670. return function constructInterpolatedFn(src, srcOffset, dest, destOffset) {
  47671. const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  47672. for (let j = 0; j < length; ++j) {
  47673. dest[destOffset + j] = c0[j] + x * diff[j];
  47674. }
  47675. };
  47676. }
  47677. static constructStiched(_ref6) {
  47678. let {
  47679. xref,
  47680. isEvalSupported,
  47681. dict
  47682. } = _ref6;
  47683. const domain = toNumberArray(dict.getArray("Domain"));
  47684. if (!domain) {
  47685. throw new _util.FormatError("No domain");
  47686. }
  47687. const inputSize = domain.length / 2;
  47688. if (inputSize !== 1) {
  47689. throw new _util.FormatError("Bad domain for stiched function");
  47690. }
  47691. const fnRefs = dict.get("Functions");
  47692. const fns = [];
  47693. for (let i = 0, ii = fnRefs.length; i < ii; ++i) {
  47694. fns.push(this.parse({
  47695. xref,
  47696. isEvalSupported,
  47697. fn: xref.fetchIfRef(fnRefs[i])
  47698. }));
  47699. }
  47700. const bounds = toNumberArray(dict.getArray("Bounds"));
  47701. const encode = toNumberArray(dict.getArray("Encode"));
  47702. const tmpBuf = new Float32Array(1);
  47703. return function constructStichedFn(src, srcOffset, dest, destOffset) {
  47704. const clip = function constructStichedFromIRClip(v, min, max) {
  47705. if (v > max) {
  47706. v = max;
  47707. } else if (v < min) {
  47708. v = min;
  47709. }
  47710. return v;
  47711. };
  47712. const v = clip(src[srcOffset], domain[0], domain[1]);
  47713. const length = bounds.length;
  47714. let i;
  47715. for (i = 0; i < length; ++i) {
  47716. if (v < bounds[i]) {
  47717. break;
  47718. }
  47719. }
  47720. let dmin = domain[0];
  47721. if (i > 0) {
  47722. dmin = bounds[i - 1];
  47723. }
  47724. let dmax = domain[1];
  47725. if (i < bounds.length) {
  47726. dmax = bounds[i];
  47727. }
  47728. const rmin = encode[2 * i];
  47729. const rmax = encode[2 * i + 1];
  47730. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  47731. fns[i](tmpBuf, 0, dest, destOffset);
  47732. };
  47733. }
  47734. static constructPostScript(_ref7) {
  47735. let {
  47736. xref,
  47737. isEvalSupported,
  47738. fn,
  47739. dict
  47740. } = _ref7;
  47741. const domain = toNumberArray(dict.getArray("Domain"));
  47742. const range = toNumberArray(dict.getArray("Range"));
  47743. if (!domain) {
  47744. throw new _util.FormatError("No domain.");
  47745. }
  47746. if (!range) {
  47747. throw new _util.FormatError("No range.");
  47748. }
  47749. const lexer = new _ps_parser.PostScriptLexer(fn);
  47750. const parser = new _ps_parser.PostScriptParser(lexer);
  47751. const code = parser.parse();
  47752. if (isEvalSupported && _util.FeatureTest.isEvalSupported) {
  47753. const compiled = new PostScriptCompiler().compile(code, domain, range);
  47754. if (compiled) {
  47755. return new Function("src", "srcOffset", "dest", "destOffset", compiled);
  47756. }
  47757. }
  47758. (0, _util.info)("Unable to compile PS function");
  47759. const numOutputs = range.length >> 1;
  47760. const numInputs = domain.length >> 1;
  47761. const evaluator = new PostScriptEvaluator(code);
  47762. const cache = Object.create(null);
  47763. const MAX_CACHE_SIZE = 2048 * 4;
  47764. let cache_available = MAX_CACHE_SIZE;
  47765. const tmpBuf = new Float32Array(numInputs);
  47766. return function constructPostScriptFn(src, srcOffset, dest, destOffset) {
  47767. let i, value;
  47768. let key = "";
  47769. const input = tmpBuf;
  47770. for (i = 0; i < numInputs; i++) {
  47771. value = src[srcOffset + i];
  47772. input[i] = value;
  47773. key += value + "_";
  47774. }
  47775. const cachedValue = cache[key];
  47776. if (cachedValue !== undefined) {
  47777. dest.set(cachedValue, destOffset);
  47778. return;
  47779. }
  47780. const output = new Float32Array(numOutputs);
  47781. const stack = evaluator.execute(input);
  47782. const stackIndex = stack.length - numOutputs;
  47783. for (i = 0; i < numOutputs; i++) {
  47784. value = stack[stackIndex + i];
  47785. let bound = range[i * 2];
  47786. if (value < bound) {
  47787. value = bound;
  47788. } else {
  47789. bound = range[i * 2 + 1];
  47790. if (value > bound) {
  47791. value = bound;
  47792. }
  47793. }
  47794. output[i] = value;
  47795. }
  47796. if (cache_available > 0) {
  47797. cache_available--;
  47798. cache[key] = output;
  47799. }
  47800. dest.set(output, destOffset);
  47801. };
  47802. }
  47803. }
  47804. function isPDFFunction(v) {
  47805. let fnDict;
  47806. if (typeof v !== "object") {
  47807. return false;
  47808. } else if (v instanceof _primitives.Dict) {
  47809. fnDict = v;
  47810. } else if (v instanceof _base_stream.BaseStream) {
  47811. fnDict = v.dict;
  47812. } else {
  47813. return false;
  47814. }
  47815. return fnDict.has("FunctionType");
  47816. }
  47817. class PostScriptStack {
  47818. static get MAX_STACK_SIZE() {
  47819. return (0, _util.shadow)(this, "MAX_STACK_SIZE", 100);
  47820. }
  47821. constructor(initialStack) {
  47822. this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
  47823. }
  47824. push(value) {
  47825. if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) {
  47826. throw new Error("PostScript function stack overflow.");
  47827. }
  47828. this.stack.push(value);
  47829. }
  47830. pop() {
  47831. if (this.stack.length <= 0) {
  47832. throw new Error("PostScript function stack underflow.");
  47833. }
  47834. return this.stack.pop();
  47835. }
  47836. copy(n) {
  47837. if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) {
  47838. throw new Error("PostScript function stack overflow.");
  47839. }
  47840. const stack = this.stack;
  47841. for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  47842. stack.push(stack[i]);
  47843. }
  47844. }
  47845. index(n) {
  47846. this.push(this.stack[this.stack.length - n - 1]);
  47847. }
  47848. roll(n, p) {
  47849. const stack = this.stack;
  47850. const l = stack.length - n;
  47851. const r = stack.length - 1;
  47852. const c = l + (p - Math.floor(p / n) * n);
  47853. for (let i = l, j = r; i < j; i++, j--) {
  47854. const t = stack[i];
  47855. stack[i] = stack[j];
  47856. stack[j] = t;
  47857. }
  47858. for (let i = l, j = c - 1; i < j; i++, j--) {
  47859. const t = stack[i];
  47860. stack[i] = stack[j];
  47861. stack[j] = t;
  47862. }
  47863. for (let i = c, j = r; i < j; i++, j--) {
  47864. const t = stack[i];
  47865. stack[i] = stack[j];
  47866. stack[j] = t;
  47867. }
  47868. }
  47869. }
  47870. class PostScriptEvaluator {
  47871. constructor(operators) {
  47872. this.operators = operators;
  47873. }
  47874. execute(initialStack) {
  47875. const stack = new PostScriptStack(initialStack);
  47876. let counter = 0;
  47877. const operators = this.operators;
  47878. const length = operators.length;
  47879. let operator, a, b;
  47880. while (counter < length) {
  47881. operator = operators[counter++];
  47882. if (typeof operator === "number") {
  47883. stack.push(operator);
  47884. continue;
  47885. }
  47886. switch (operator) {
  47887. case "jz":
  47888. b = stack.pop();
  47889. a = stack.pop();
  47890. if (!a) {
  47891. counter = b;
  47892. }
  47893. break;
  47894. case "j":
  47895. a = stack.pop();
  47896. counter = a;
  47897. break;
  47898. case "abs":
  47899. a = stack.pop();
  47900. stack.push(Math.abs(a));
  47901. break;
  47902. case "add":
  47903. b = stack.pop();
  47904. a = stack.pop();
  47905. stack.push(a + b);
  47906. break;
  47907. case "and":
  47908. b = stack.pop();
  47909. a = stack.pop();
  47910. if (typeof a === "boolean" && typeof b === "boolean") {
  47911. stack.push(a && b);
  47912. } else {
  47913. stack.push(a & b);
  47914. }
  47915. break;
  47916. case "atan":
  47917. a = stack.pop();
  47918. stack.push(Math.atan(a));
  47919. break;
  47920. case "bitshift":
  47921. b = stack.pop();
  47922. a = stack.pop();
  47923. if (a > 0) {
  47924. stack.push(a << b);
  47925. } else {
  47926. stack.push(a >> b);
  47927. }
  47928. break;
  47929. case "ceiling":
  47930. a = stack.pop();
  47931. stack.push(Math.ceil(a));
  47932. break;
  47933. case "copy":
  47934. a = stack.pop();
  47935. stack.copy(a);
  47936. break;
  47937. case "cos":
  47938. a = stack.pop();
  47939. stack.push(Math.cos(a));
  47940. break;
  47941. case "cvi":
  47942. a = stack.pop() | 0;
  47943. stack.push(a);
  47944. break;
  47945. case "cvr":
  47946. break;
  47947. case "div":
  47948. b = stack.pop();
  47949. a = stack.pop();
  47950. stack.push(a / b);
  47951. break;
  47952. case "dup":
  47953. stack.copy(1);
  47954. break;
  47955. case "eq":
  47956. b = stack.pop();
  47957. a = stack.pop();
  47958. stack.push(a === b);
  47959. break;
  47960. case "exch":
  47961. stack.roll(2, 1);
  47962. break;
  47963. case "exp":
  47964. b = stack.pop();
  47965. a = stack.pop();
  47966. stack.push(a ** b);
  47967. break;
  47968. case "false":
  47969. stack.push(false);
  47970. break;
  47971. case "floor":
  47972. a = stack.pop();
  47973. stack.push(Math.floor(a));
  47974. break;
  47975. case "ge":
  47976. b = stack.pop();
  47977. a = stack.pop();
  47978. stack.push(a >= b);
  47979. break;
  47980. case "gt":
  47981. b = stack.pop();
  47982. a = stack.pop();
  47983. stack.push(a > b);
  47984. break;
  47985. case "idiv":
  47986. b = stack.pop();
  47987. a = stack.pop();
  47988. stack.push(a / b | 0);
  47989. break;
  47990. case "index":
  47991. a = stack.pop();
  47992. stack.index(a);
  47993. break;
  47994. case "le":
  47995. b = stack.pop();
  47996. a = stack.pop();
  47997. stack.push(a <= b);
  47998. break;
  47999. case "ln":
  48000. a = stack.pop();
  48001. stack.push(Math.log(a));
  48002. break;
  48003. case "log":
  48004. a = stack.pop();
  48005. stack.push(Math.log(a) / Math.LN10);
  48006. break;
  48007. case "lt":
  48008. b = stack.pop();
  48009. a = stack.pop();
  48010. stack.push(a < b);
  48011. break;
  48012. case "mod":
  48013. b = stack.pop();
  48014. a = stack.pop();
  48015. stack.push(a % b);
  48016. break;
  48017. case "mul":
  48018. b = stack.pop();
  48019. a = stack.pop();
  48020. stack.push(a * b);
  48021. break;
  48022. case "ne":
  48023. b = stack.pop();
  48024. a = stack.pop();
  48025. stack.push(a !== b);
  48026. break;
  48027. case "neg":
  48028. a = stack.pop();
  48029. stack.push(-a);
  48030. break;
  48031. case "not":
  48032. a = stack.pop();
  48033. if (typeof a === "boolean") {
  48034. stack.push(!a);
  48035. } else {
  48036. stack.push(~a);
  48037. }
  48038. break;
  48039. case "or":
  48040. b = stack.pop();
  48041. a = stack.pop();
  48042. if (typeof a === "boolean" && typeof b === "boolean") {
  48043. stack.push(a || b);
  48044. } else {
  48045. stack.push(a | b);
  48046. }
  48047. break;
  48048. case "pop":
  48049. stack.pop();
  48050. break;
  48051. case "roll":
  48052. b = stack.pop();
  48053. a = stack.pop();
  48054. stack.roll(a, b);
  48055. break;
  48056. case "round":
  48057. a = stack.pop();
  48058. stack.push(Math.round(a));
  48059. break;
  48060. case "sin":
  48061. a = stack.pop();
  48062. stack.push(Math.sin(a));
  48063. break;
  48064. case "sqrt":
  48065. a = stack.pop();
  48066. stack.push(Math.sqrt(a));
  48067. break;
  48068. case "sub":
  48069. b = stack.pop();
  48070. a = stack.pop();
  48071. stack.push(a - b);
  48072. break;
  48073. case "true":
  48074. stack.push(true);
  48075. break;
  48076. case "truncate":
  48077. a = stack.pop();
  48078. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  48079. stack.push(a);
  48080. break;
  48081. case "xor":
  48082. b = stack.pop();
  48083. a = stack.pop();
  48084. if (typeof a === "boolean" && typeof b === "boolean") {
  48085. stack.push(a !== b);
  48086. } else {
  48087. stack.push(a ^ b);
  48088. }
  48089. break;
  48090. default:
  48091. throw new _util.FormatError(`Unknown operator ${operator}`);
  48092. }
  48093. }
  48094. return stack.stack;
  48095. }
  48096. }
  48097. exports.PostScriptEvaluator = PostScriptEvaluator;
  48098. class AstNode {
  48099. constructor(type) {
  48100. this.type = type;
  48101. }
  48102. visit(visitor) {
  48103. (0, _util.unreachable)("abstract method");
  48104. }
  48105. }
  48106. class AstArgument extends AstNode {
  48107. constructor(index, min, max) {
  48108. super("args");
  48109. this.index = index;
  48110. this.min = min;
  48111. this.max = max;
  48112. }
  48113. visit(visitor) {
  48114. visitor.visitArgument(this);
  48115. }
  48116. }
  48117. class AstLiteral extends AstNode {
  48118. constructor(number) {
  48119. super("literal");
  48120. this.number = number;
  48121. this.min = number;
  48122. this.max = number;
  48123. }
  48124. visit(visitor) {
  48125. visitor.visitLiteral(this);
  48126. }
  48127. }
  48128. class AstBinaryOperation extends AstNode {
  48129. constructor(op, arg1, arg2, min, max) {
  48130. super("binary");
  48131. this.op = op;
  48132. this.arg1 = arg1;
  48133. this.arg2 = arg2;
  48134. this.min = min;
  48135. this.max = max;
  48136. }
  48137. visit(visitor) {
  48138. visitor.visitBinaryOperation(this);
  48139. }
  48140. }
  48141. class AstMin extends AstNode {
  48142. constructor(arg, max) {
  48143. super("max");
  48144. this.arg = arg;
  48145. this.min = arg.min;
  48146. this.max = max;
  48147. }
  48148. visit(visitor) {
  48149. visitor.visitMin(this);
  48150. }
  48151. }
  48152. class AstVariable extends AstNode {
  48153. constructor(index, min, max) {
  48154. super("var");
  48155. this.index = index;
  48156. this.min = min;
  48157. this.max = max;
  48158. }
  48159. visit(visitor) {
  48160. visitor.visitVariable(this);
  48161. }
  48162. }
  48163. class AstVariableDefinition extends AstNode {
  48164. constructor(variable, arg) {
  48165. super("definition");
  48166. this.variable = variable;
  48167. this.arg = arg;
  48168. }
  48169. visit(visitor) {
  48170. visitor.visitVariableDefinition(this);
  48171. }
  48172. }
  48173. class ExpressionBuilderVisitor {
  48174. constructor() {
  48175. this.parts = [];
  48176. }
  48177. visitArgument(arg) {
  48178. this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
  48179. }
  48180. visitVariable(variable) {
  48181. this.parts.push("v", variable.index);
  48182. }
  48183. visitLiteral(literal) {
  48184. this.parts.push(literal.number);
  48185. }
  48186. visitBinaryOperation(operation) {
  48187. this.parts.push("(");
  48188. operation.arg1.visit(this);
  48189. this.parts.push(" ", operation.op, " ");
  48190. operation.arg2.visit(this);
  48191. this.parts.push(")");
  48192. }
  48193. visitVariableDefinition(definition) {
  48194. this.parts.push("var ");
  48195. definition.variable.visit(this);
  48196. this.parts.push(" = ");
  48197. definition.arg.visit(this);
  48198. this.parts.push(";");
  48199. }
  48200. visitMin(max) {
  48201. this.parts.push("Math.min(");
  48202. max.arg.visit(this);
  48203. this.parts.push(", ", max.max, ")");
  48204. }
  48205. toString() {
  48206. return this.parts.join("");
  48207. }
  48208. }
  48209. function buildAddOperation(num1, num2) {
  48210. if (num2.type === "literal" && num2.number === 0) {
  48211. return num1;
  48212. }
  48213. if (num1.type === "literal" && num1.number === 0) {
  48214. return num2;
  48215. }
  48216. if (num2.type === "literal" && num1.type === "literal") {
  48217. return new AstLiteral(num1.number + num2.number);
  48218. }
  48219. return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
  48220. }
  48221. function buildMulOperation(num1, num2) {
  48222. if (num2.type === "literal") {
  48223. if (num2.number === 0) {
  48224. return new AstLiteral(0);
  48225. } else if (num2.number === 1) {
  48226. return num1;
  48227. } else if (num1.type === "literal") {
  48228. return new AstLiteral(num1.number * num2.number);
  48229. }
  48230. }
  48231. if (num1.type === "literal") {
  48232. if (num1.number === 0) {
  48233. return new AstLiteral(0);
  48234. } else if (num1.number === 1) {
  48235. return num2;
  48236. }
  48237. }
  48238. const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  48239. const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  48240. return new AstBinaryOperation("*", num1, num2, min, max);
  48241. }
  48242. function buildSubOperation(num1, num2) {
  48243. if (num2.type === "literal") {
  48244. if (num2.number === 0) {
  48245. return num1;
  48246. } else if (num1.type === "literal") {
  48247. return new AstLiteral(num1.number - num2.number);
  48248. }
  48249. }
  48250. if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
  48251. return num2.arg2;
  48252. }
  48253. return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
  48254. }
  48255. function buildMinOperation(num1, max) {
  48256. if (num1.min >= max) {
  48257. return new AstLiteral(max);
  48258. } else if (num1.max <= max) {
  48259. return num1;
  48260. }
  48261. return new AstMin(num1, max);
  48262. }
  48263. class PostScriptCompiler {
  48264. compile(code, domain, range) {
  48265. const stack = [];
  48266. const instructions = [];
  48267. const inputSize = domain.length >> 1,
  48268. outputSize = range.length >> 1;
  48269. let lastRegister = 0;
  48270. let n, j;
  48271. let num1, num2, ast1, ast2, tmpVar, item;
  48272. for (let i = 0; i < inputSize; i++) {
  48273. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  48274. }
  48275. for (let i = 0, ii = code.length; i < ii; i++) {
  48276. item = code[i];
  48277. if (typeof item === "number") {
  48278. stack.push(new AstLiteral(item));
  48279. continue;
  48280. }
  48281. switch (item) {
  48282. case "add":
  48283. if (stack.length < 2) {
  48284. return null;
  48285. }
  48286. num2 = stack.pop();
  48287. num1 = stack.pop();
  48288. stack.push(buildAddOperation(num1, num2));
  48289. break;
  48290. case "cvr":
  48291. if (stack.length < 1) {
  48292. return null;
  48293. }
  48294. break;
  48295. case "mul":
  48296. if (stack.length < 2) {
  48297. return null;
  48298. }
  48299. num2 = stack.pop();
  48300. num1 = stack.pop();
  48301. stack.push(buildMulOperation(num1, num2));
  48302. break;
  48303. case "sub":
  48304. if (stack.length < 2) {
  48305. return null;
  48306. }
  48307. num2 = stack.pop();
  48308. num1 = stack.pop();
  48309. stack.push(buildSubOperation(num1, num2));
  48310. break;
  48311. case "exch":
  48312. if (stack.length < 2) {
  48313. return null;
  48314. }
  48315. ast1 = stack.pop();
  48316. ast2 = stack.pop();
  48317. stack.push(ast1, ast2);
  48318. break;
  48319. case "pop":
  48320. if (stack.length < 1) {
  48321. return null;
  48322. }
  48323. stack.pop();
  48324. break;
  48325. case "index":
  48326. if (stack.length < 1) {
  48327. return null;
  48328. }
  48329. num1 = stack.pop();
  48330. if (num1.type !== "literal") {
  48331. return null;
  48332. }
  48333. n = num1.number;
  48334. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  48335. return null;
  48336. }
  48337. ast1 = stack[stack.length - n - 1];
  48338. if (ast1.type === "literal" || ast1.type === "var") {
  48339. stack.push(ast1);
  48340. break;
  48341. }
  48342. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  48343. stack[stack.length - n - 1] = tmpVar;
  48344. stack.push(tmpVar);
  48345. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  48346. break;
  48347. case "dup":
  48348. if (stack.length < 1) {
  48349. return null;
  48350. }
  48351. 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]) {
  48352. num1 = stack.pop();
  48353. stack.push(buildMinOperation(num1, code[i + 1]));
  48354. i += 6;
  48355. break;
  48356. }
  48357. ast1 = stack.at(-1);
  48358. if (ast1.type === "literal" || ast1.type === "var") {
  48359. stack.push(ast1);
  48360. break;
  48361. }
  48362. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  48363. stack[stack.length - 1] = tmpVar;
  48364. stack.push(tmpVar);
  48365. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  48366. break;
  48367. case "roll":
  48368. if (stack.length < 2) {
  48369. return null;
  48370. }
  48371. num2 = stack.pop();
  48372. num1 = stack.pop();
  48373. if (num2.type !== "literal" || num1.type !== "literal") {
  48374. return null;
  48375. }
  48376. j = num2.number;
  48377. n = num1.number;
  48378. if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
  48379. return null;
  48380. }
  48381. j = (j % n + n) % n;
  48382. if (j === 0) {
  48383. break;
  48384. }
  48385. Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
  48386. break;
  48387. default:
  48388. return null;
  48389. }
  48390. }
  48391. if (stack.length !== outputSize) {
  48392. return null;
  48393. }
  48394. const result = [];
  48395. for (const instruction of instructions) {
  48396. const statementBuilder = new ExpressionBuilderVisitor();
  48397. instruction.visit(statementBuilder);
  48398. result.push(statementBuilder.toString());
  48399. }
  48400. for (let i = 0, ii = stack.length; i < ii; i++) {
  48401. const expr = stack[i],
  48402. statementBuilder = new ExpressionBuilderVisitor();
  48403. expr.visit(statementBuilder);
  48404. const min = range[i * 2],
  48405. max = range[i * 2 + 1];
  48406. const out = [statementBuilder.toString()];
  48407. if (min > expr.min) {
  48408. out.unshift("Math.max(", min, ", ");
  48409. out.push(")");
  48410. }
  48411. if (max < expr.max) {
  48412. out.unshift("Math.min(", max, ", ");
  48413. out.push(")");
  48414. }
  48415. out.unshift("dest[destOffset + ", i, "] = ");
  48416. out.push(";");
  48417. result.push(out.join(""));
  48418. }
  48419. return result.join("\n");
  48420. }
  48421. }
  48422. exports.PostScriptCompiler = PostScriptCompiler;
  48423. /***/ }),
  48424. /* 183 */
  48425. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48426. "use strict";
  48427. Object.defineProperty(exports, "__esModule", ({
  48428. value: true
  48429. }));
  48430. exports.PostScriptParser = exports.PostScriptLexer = void 0;
  48431. var _util = __w_pdfjs_require__(2);
  48432. var _primitives = __w_pdfjs_require__(130);
  48433. var _core_utils = __w_pdfjs_require__(131);
  48434. class PostScriptParser {
  48435. constructor(lexer) {
  48436. this.lexer = lexer;
  48437. this.operators = [];
  48438. this.token = null;
  48439. this.prev = null;
  48440. }
  48441. nextToken() {
  48442. this.prev = this.token;
  48443. this.token = this.lexer.getToken();
  48444. }
  48445. accept(type) {
  48446. if (this.token.type === type) {
  48447. this.nextToken();
  48448. return true;
  48449. }
  48450. return false;
  48451. }
  48452. expect(type) {
  48453. if (this.accept(type)) {
  48454. return true;
  48455. }
  48456. throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
  48457. }
  48458. parse() {
  48459. this.nextToken();
  48460. this.expect(PostScriptTokenTypes.LBRACE);
  48461. this.parseBlock();
  48462. this.expect(PostScriptTokenTypes.RBRACE);
  48463. return this.operators;
  48464. }
  48465. parseBlock() {
  48466. while (true) {
  48467. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  48468. this.operators.push(this.prev.value);
  48469. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  48470. this.operators.push(this.prev.value);
  48471. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  48472. this.parseCondition();
  48473. } else {
  48474. return;
  48475. }
  48476. }
  48477. }
  48478. parseCondition() {
  48479. const conditionLocation = this.operators.length;
  48480. this.operators.push(null, null);
  48481. this.parseBlock();
  48482. this.expect(PostScriptTokenTypes.RBRACE);
  48483. if (this.accept(PostScriptTokenTypes.IF)) {
  48484. this.operators[conditionLocation] = this.operators.length;
  48485. this.operators[conditionLocation + 1] = "jz";
  48486. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  48487. const jumpLocation = this.operators.length;
  48488. this.operators.push(null, null);
  48489. const endOfTrue = this.operators.length;
  48490. this.parseBlock();
  48491. this.expect(PostScriptTokenTypes.RBRACE);
  48492. this.expect(PostScriptTokenTypes.IFELSE);
  48493. this.operators[jumpLocation] = this.operators.length;
  48494. this.operators[jumpLocation + 1] = "j";
  48495. this.operators[conditionLocation] = endOfTrue;
  48496. this.operators[conditionLocation + 1] = "jz";
  48497. } else {
  48498. throw new _util.FormatError("PS Function: error parsing conditional.");
  48499. }
  48500. }
  48501. }
  48502. exports.PostScriptParser = PostScriptParser;
  48503. const PostScriptTokenTypes = {
  48504. LBRACE: 0,
  48505. RBRACE: 1,
  48506. NUMBER: 2,
  48507. OPERATOR: 3,
  48508. IF: 4,
  48509. IFELSE: 5
  48510. };
  48511. class PostScriptToken {
  48512. static get opCache() {
  48513. return (0, _util.shadow)(this, "opCache", Object.create(null));
  48514. }
  48515. constructor(type, value) {
  48516. this.type = type;
  48517. this.value = value;
  48518. }
  48519. static getOperator(op) {
  48520. const opValue = PostScriptToken.opCache[op];
  48521. if (opValue) {
  48522. return opValue;
  48523. }
  48524. return PostScriptToken.opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  48525. }
  48526. static get LBRACE() {
  48527. return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
  48528. }
  48529. static get RBRACE() {
  48530. return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
  48531. }
  48532. static get IF() {
  48533. return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
  48534. }
  48535. static get IFELSE() {
  48536. return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
  48537. }
  48538. }
  48539. class PostScriptLexer {
  48540. constructor(stream) {
  48541. this.stream = stream;
  48542. this.nextChar();
  48543. this.strBuf = [];
  48544. }
  48545. nextChar() {
  48546. return this.currentChar = this.stream.getByte();
  48547. }
  48548. getToken() {
  48549. let comment = false;
  48550. let ch = this.currentChar;
  48551. while (true) {
  48552. if (ch < 0) {
  48553. return _primitives.EOF;
  48554. }
  48555. if (comment) {
  48556. if (ch === 0x0a || ch === 0x0d) {
  48557. comment = false;
  48558. }
  48559. } else if (ch === 0x25) {
  48560. comment = true;
  48561. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  48562. break;
  48563. }
  48564. ch = this.nextChar();
  48565. }
  48566. switch (ch | 0) {
  48567. case 0x30:
  48568. case 0x31:
  48569. case 0x32:
  48570. case 0x33:
  48571. case 0x34:
  48572. case 0x35:
  48573. case 0x36:
  48574. case 0x37:
  48575. case 0x38:
  48576. case 0x39:
  48577. case 0x2b:
  48578. case 0x2d:
  48579. case 0x2e:
  48580. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  48581. case 0x7b:
  48582. this.nextChar();
  48583. return PostScriptToken.LBRACE;
  48584. case 0x7d:
  48585. this.nextChar();
  48586. return PostScriptToken.RBRACE;
  48587. }
  48588. const strBuf = this.strBuf;
  48589. strBuf.length = 0;
  48590. strBuf[0] = String.fromCharCode(ch);
  48591. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
  48592. strBuf.push(String.fromCharCode(ch));
  48593. }
  48594. const str = strBuf.join("");
  48595. switch (str.toLowerCase()) {
  48596. case "if":
  48597. return PostScriptToken.IF;
  48598. case "ifelse":
  48599. return PostScriptToken.IFELSE;
  48600. default:
  48601. return PostScriptToken.getOperator(str);
  48602. }
  48603. }
  48604. getNumber() {
  48605. let ch = this.currentChar;
  48606. const strBuf = this.strBuf;
  48607. strBuf.length = 0;
  48608. strBuf[0] = String.fromCharCode(ch);
  48609. while ((ch = this.nextChar()) >= 0) {
  48610. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
  48611. strBuf.push(String.fromCharCode(ch));
  48612. } else {
  48613. break;
  48614. }
  48615. }
  48616. const value = parseFloat(strBuf.join(""));
  48617. if (isNaN(value)) {
  48618. throw new _util.FormatError(`Invalid floating point number: ${value}`);
  48619. }
  48620. return value;
  48621. }
  48622. }
  48623. exports.PostScriptLexer = PostScriptLexer;
  48624. /***/ }),
  48625. /* 184 */
  48626. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48627. "use strict";
  48628. Object.defineProperty(exports, "__esModule", ({
  48629. value: true
  48630. }));
  48631. exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0;
  48632. var _util = __w_pdfjs_require__(2);
  48633. var _primitives = __w_pdfjs_require__(130);
  48634. class BaseLocalCache {
  48635. constructor(options) {
  48636. if (this.constructor === BaseLocalCache) {
  48637. (0, _util.unreachable)("Cannot initialize BaseLocalCache.");
  48638. }
  48639. this._onlyRefs = (options && options.onlyRefs) === true;
  48640. if (!this._onlyRefs) {
  48641. this._nameRefMap = new Map();
  48642. this._imageMap = new Map();
  48643. }
  48644. this._imageCache = new _primitives.RefSetCache();
  48645. }
  48646. getByName(name) {
  48647. if (this._onlyRefs) {
  48648. (0, _util.unreachable)("Should not call `getByName` method.");
  48649. }
  48650. const ref = this._nameRefMap.get(name);
  48651. if (ref) {
  48652. return this.getByRef(ref);
  48653. }
  48654. return this._imageMap.get(name) || null;
  48655. }
  48656. getByRef(ref) {
  48657. return this._imageCache.get(ref) || null;
  48658. }
  48659. set(name, ref, data) {
  48660. (0, _util.unreachable)("Abstract method `set` called.");
  48661. }
  48662. }
  48663. class LocalImageCache extends BaseLocalCache {
  48664. set(name) {
  48665. let ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  48666. let data = arguments.length > 2 ? arguments[2] : undefined;
  48667. if (typeof name !== "string") {
  48668. throw new Error('LocalImageCache.set - expected "name" argument.');
  48669. }
  48670. if (ref) {
  48671. if (this._imageCache.has(ref)) {
  48672. return;
  48673. }
  48674. this._nameRefMap.set(name, ref);
  48675. this._imageCache.put(ref, data);
  48676. return;
  48677. }
  48678. if (this._imageMap.has(name)) {
  48679. return;
  48680. }
  48681. this._imageMap.set(name, data);
  48682. }
  48683. }
  48684. exports.LocalImageCache = LocalImageCache;
  48685. class LocalColorSpaceCache extends BaseLocalCache {
  48686. set() {
  48687. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  48688. let ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  48689. let data = arguments.length > 2 ? arguments[2] : undefined;
  48690. if (typeof name !== "string" && !ref) {
  48691. throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');
  48692. }
  48693. if (ref) {
  48694. if (this._imageCache.has(ref)) {
  48695. return;
  48696. }
  48697. if (name !== null) {
  48698. this._nameRefMap.set(name, ref);
  48699. }
  48700. this._imageCache.put(ref, data);
  48701. return;
  48702. }
  48703. if (this._imageMap.has(name)) {
  48704. return;
  48705. }
  48706. this._imageMap.set(name, data);
  48707. }
  48708. }
  48709. exports.LocalColorSpaceCache = LocalColorSpaceCache;
  48710. class LocalFunctionCache extends BaseLocalCache {
  48711. constructor(options) {
  48712. super({
  48713. onlyRefs: true
  48714. });
  48715. }
  48716. set() {
  48717. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  48718. let ref = arguments.length > 1 ? arguments[1] : undefined;
  48719. let data = arguments.length > 2 ? arguments[2] : undefined;
  48720. if (!ref) {
  48721. throw new Error('LocalFunctionCache.set - expected "ref" argument.');
  48722. }
  48723. if (this._imageCache.has(ref)) {
  48724. return;
  48725. }
  48726. this._imageCache.put(ref, data);
  48727. }
  48728. }
  48729. exports.LocalFunctionCache = LocalFunctionCache;
  48730. class LocalGStateCache extends BaseLocalCache {
  48731. set(name) {
  48732. let ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  48733. let data = arguments.length > 2 ? arguments[2] : undefined;
  48734. if (typeof name !== "string") {
  48735. throw new Error('LocalGStateCache.set - expected "name" argument.');
  48736. }
  48737. if (ref) {
  48738. if (this._imageCache.has(ref)) {
  48739. return;
  48740. }
  48741. this._nameRefMap.set(name, ref);
  48742. this._imageCache.put(ref, data);
  48743. return;
  48744. }
  48745. if (this._imageMap.has(name)) {
  48746. return;
  48747. }
  48748. this._imageMap.set(name, data);
  48749. }
  48750. }
  48751. exports.LocalGStateCache = LocalGStateCache;
  48752. class LocalTilingPatternCache extends BaseLocalCache {
  48753. constructor(options) {
  48754. super({
  48755. onlyRefs: true
  48756. });
  48757. }
  48758. set() {
  48759. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  48760. let ref = arguments.length > 1 ? arguments[1] : undefined;
  48761. let data = arguments.length > 2 ? arguments[2] : undefined;
  48762. if (!ref) {
  48763. throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');
  48764. }
  48765. if (this._imageCache.has(ref)) {
  48766. return;
  48767. }
  48768. this._imageCache.put(ref, data);
  48769. }
  48770. }
  48771. exports.LocalTilingPatternCache = LocalTilingPatternCache;
  48772. class GlobalImageCache {
  48773. static get NUM_PAGES_THRESHOLD() {
  48774. return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
  48775. }
  48776. static get MIN_IMAGES_TO_CACHE() {
  48777. return (0, _util.shadow)(this, "MIN_IMAGES_TO_CACHE", 10);
  48778. }
  48779. static get MAX_BYTE_SIZE() {
  48780. return (0, _util.shadow)(this, "MAX_BYTE_SIZE", 40e6);
  48781. }
  48782. constructor() {
  48783. this._refCache = new _primitives.RefSetCache();
  48784. this._imageCache = new _primitives.RefSetCache();
  48785. }
  48786. get _byteSize() {
  48787. let byteSize = 0;
  48788. for (const imageData of this._imageCache) {
  48789. byteSize += imageData.byteSize;
  48790. }
  48791. return byteSize;
  48792. }
  48793. get _cacheLimitReached() {
  48794. if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) {
  48795. return false;
  48796. }
  48797. if (this._byteSize < GlobalImageCache.MAX_BYTE_SIZE) {
  48798. return false;
  48799. }
  48800. return true;
  48801. }
  48802. shouldCache(ref, pageIndex) {
  48803. const pageIndexSet = this._refCache.get(ref);
  48804. const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1;
  48805. if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  48806. return false;
  48807. }
  48808. if (!this._imageCache.has(ref) && this._cacheLimitReached) {
  48809. return false;
  48810. }
  48811. return true;
  48812. }
  48813. addPageIndex(ref, pageIndex) {
  48814. let pageIndexSet = this._refCache.get(ref);
  48815. if (!pageIndexSet) {
  48816. pageIndexSet = new Set();
  48817. this._refCache.put(ref, pageIndexSet);
  48818. }
  48819. pageIndexSet.add(pageIndex);
  48820. }
  48821. addByteSize(ref, byteSize) {
  48822. const imageData = this._imageCache.get(ref);
  48823. if (!imageData) {
  48824. return;
  48825. }
  48826. if (imageData.byteSize) {
  48827. return;
  48828. }
  48829. imageData.byteSize = byteSize;
  48830. }
  48831. getData(ref, pageIndex) {
  48832. const pageIndexSet = this._refCache.get(ref);
  48833. if (!pageIndexSet) {
  48834. return null;
  48835. }
  48836. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  48837. return null;
  48838. }
  48839. const imageData = this._imageCache.get(ref);
  48840. if (!imageData) {
  48841. return null;
  48842. }
  48843. pageIndexSet.add(pageIndex);
  48844. return imageData;
  48845. }
  48846. setData(ref, data) {
  48847. if (!this._refCache.has(ref)) {
  48848. throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.');
  48849. }
  48850. if (this._imageCache.has(ref)) {
  48851. return;
  48852. }
  48853. if (this._cacheLimitReached) {
  48854. (0, _util.warn)("GlobalImageCache.setData - cache limit reached.");
  48855. return;
  48856. }
  48857. this._imageCache.put(ref, data);
  48858. }
  48859. clear() {
  48860. let onlyData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  48861. if (!onlyData) {
  48862. this._refCache.clear();
  48863. }
  48864. this._imageCache.clear();
  48865. }
  48866. }
  48867. exports.GlobalImageCache = GlobalImageCache;
  48868. /***/ }),
  48869. /* 185 */
  48870. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48871. "use strict";
  48872. Object.defineProperty(exports, "__esModule", ({
  48873. value: true
  48874. }));
  48875. exports.bidi = bidi;
  48876. var _util = __w_pdfjs_require__(2);
  48877. 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"];
  48878. 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"];
  48879. function isOdd(i) {
  48880. return (i & 1) !== 0;
  48881. }
  48882. function isEven(i) {
  48883. return (i & 1) === 0;
  48884. }
  48885. function findUnequal(arr, start, value) {
  48886. let j, jj;
  48887. for (j = start, jj = arr.length; j < jj; ++j) {
  48888. if (arr[j] !== value) {
  48889. return j;
  48890. }
  48891. }
  48892. return j;
  48893. }
  48894. function setValues(arr, start, end, value) {
  48895. for (let j = start; j < end; ++j) {
  48896. arr[j] = value;
  48897. }
  48898. }
  48899. function reverseValues(arr, start, end) {
  48900. for (let i = start, j = end - 1; i < j; ++i, --j) {
  48901. const temp = arr[i];
  48902. arr[i] = arr[j];
  48903. arr[j] = temp;
  48904. }
  48905. }
  48906. function createBidiText(str, isLTR) {
  48907. let vertical = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  48908. let dir = "ltr";
  48909. if (vertical) {
  48910. dir = "ttb";
  48911. } else if (!isLTR) {
  48912. dir = "rtl";
  48913. }
  48914. return {
  48915. str,
  48916. dir
  48917. };
  48918. }
  48919. const chars = [];
  48920. const types = [];
  48921. function bidi(str) {
  48922. let startLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
  48923. let vertical = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  48924. let isLTR = true;
  48925. const strLength = str.length;
  48926. if (strLength === 0 || vertical) {
  48927. return createBidiText(str, isLTR, vertical);
  48928. }
  48929. chars.length = strLength;
  48930. types.length = strLength;
  48931. let numBidi = 0;
  48932. let i, ii;
  48933. for (i = 0; i < strLength; ++i) {
  48934. chars[i] = str.charAt(i);
  48935. const charCode = str.charCodeAt(i);
  48936. let charType = "L";
  48937. if (charCode <= 0x00ff) {
  48938. charType = baseTypes[charCode];
  48939. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  48940. charType = "R";
  48941. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  48942. charType = arabicTypes[charCode & 0xff];
  48943. if (!charType) {
  48944. (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16));
  48945. }
  48946. } else if (0x0700 <= charCode && charCode <= 0x08ac) {
  48947. charType = "AL";
  48948. }
  48949. if (charType === "R" || charType === "AL" || charType === "AN") {
  48950. numBidi++;
  48951. }
  48952. types[i] = charType;
  48953. }
  48954. if (numBidi === 0) {
  48955. isLTR = true;
  48956. return createBidiText(str, isLTR);
  48957. }
  48958. if (startLevel === -1) {
  48959. if (numBidi / strLength < 0.3 && strLength > 4) {
  48960. isLTR = true;
  48961. startLevel = 0;
  48962. } else {
  48963. isLTR = false;
  48964. startLevel = 1;
  48965. }
  48966. }
  48967. const levels = [];
  48968. for (i = 0; i < strLength; ++i) {
  48969. levels[i] = startLevel;
  48970. }
  48971. const e = isOdd(startLevel) ? "R" : "L";
  48972. const sor = e;
  48973. const eor = sor;
  48974. let lastType = sor;
  48975. for (i = 0; i < strLength; ++i) {
  48976. if (types[i] === "NSM") {
  48977. types[i] = lastType;
  48978. } else {
  48979. lastType = types[i];
  48980. }
  48981. }
  48982. lastType = sor;
  48983. let t;
  48984. for (i = 0; i < strLength; ++i) {
  48985. t = types[i];
  48986. if (t === "EN") {
  48987. types[i] = lastType === "AL" ? "AN" : "EN";
  48988. } else if (t === "R" || t === "L" || t === "AL") {
  48989. lastType = t;
  48990. }
  48991. }
  48992. for (i = 0; i < strLength; ++i) {
  48993. t = types[i];
  48994. if (t === "AL") {
  48995. types[i] = "R";
  48996. }
  48997. }
  48998. for (i = 1; i < strLength - 1; ++i) {
  48999. if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
  49000. types[i] = "EN";
  49001. }
  49002. if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
  49003. types[i] = types[i - 1];
  49004. }
  49005. }
  49006. for (i = 0; i < strLength; ++i) {
  49007. if (types[i] === "EN") {
  49008. for (let j = i - 1; j >= 0; --j) {
  49009. if (types[j] !== "ET") {
  49010. break;
  49011. }
  49012. types[j] = "EN";
  49013. }
  49014. for (let j = i + 1; j < strLength; ++j) {
  49015. if (types[j] !== "ET") {
  49016. break;
  49017. }
  49018. types[j] = "EN";
  49019. }
  49020. }
  49021. }
  49022. for (i = 0; i < strLength; ++i) {
  49023. t = types[i];
  49024. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  49025. types[i] = "ON";
  49026. }
  49027. }
  49028. lastType = sor;
  49029. for (i = 0; i < strLength; ++i) {
  49030. t = types[i];
  49031. if (t === "EN") {
  49032. types[i] = lastType === "L" ? "L" : "EN";
  49033. } else if (t === "R" || t === "L") {
  49034. lastType = t;
  49035. }
  49036. }
  49037. for (i = 0; i < strLength; ++i) {
  49038. if (types[i] === "ON") {
  49039. const end = findUnequal(types, i + 1, "ON");
  49040. let before = sor;
  49041. if (i > 0) {
  49042. before = types[i - 1];
  49043. }
  49044. let after = eor;
  49045. if (end + 1 < strLength) {
  49046. after = types[end + 1];
  49047. }
  49048. if (before !== "L") {
  49049. before = "R";
  49050. }
  49051. if (after !== "L") {
  49052. after = "R";
  49053. }
  49054. if (before === after) {
  49055. setValues(types, i, end, before);
  49056. }
  49057. i = end - 1;
  49058. }
  49059. }
  49060. for (i = 0; i < strLength; ++i) {
  49061. if (types[i] === "ON") {
  49062. types[i] = e;
  49063. }
  49064. }
  49065. for (i = 0; i < strLength; ++i) {
  49066. t = types[i];
  49067. if (isEven(levels[i])) {
  49068. if (t === "R") {
  49069. levels[i] += 1;
  49070. } else if (t === "AN" || t === "EN") {
  49071. levels[i] += 2;
  49072. }
  49073. } else {
  49074. if (t === "L" || t === "AN" || t === "EN") {
  49075. levels[i] += 1;
  49076. }
  49077. }
  49078. }
  49079. let highestLevel = -1;
  49080. let lowestOddLevel = 99;
  49081. let level;
  49082. for (i = 0, ii = levels.length; i < ii; ++i) {
  49083. level = levels[i];
  49084. if (highestLevel < level) {
  49085. highestLevel = level;
  49086. }
  49087. if (lowestOddLevel > level && isOdd(level)) {
  49088. lowestOddLevel = level;
  49089. }
  49090. }
  49091. for (level = highestLevel; level >= lowestOddLevel; --level) {
  49092. let start = -1;
  49093. for (i = 0, ii = levels.length; i < ii; ++i) {
  49094. if (levels[i] < level) {
  49095. if (start >= 0) {
  49096. reverseValues(chars, start, i);
  49097. start = -1;
  49098. }
  49099. } else if (start < 0) {
  49100. start = i;
  49101. }
  49102. }
  49103. if (start >= 0) {
  49104. reverseValues(chars, start, levels.length);
  49105. }
  49106. }
  49107. for (i = 0, ii = chars.length; i < ii; ++i) {
  49108. const ch = chars[i];
  49109. if (ch === "<" || ch === ">") {
  49110. chars[i] = "";
  49111. }
  49112. }
  49113. return createBidiText(chars.join(""), isLTR);
  49114. }
  49115. /***/ }),
  49116. /* 186 */
  49117. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49118. "use strict";
  49119. Object.defineProperty(exports, "__esModule", ({
  49120. value: true
  49121. }));
  49122. exports.MurmurHash3_64 = void 0;
  49123. var _util = __w_pdfjs_require__(2);
  49124. const SEED = 0xc3d2e1f0;
  49125. const MASK_HIGH = 0xffff0000;
  49126. const MASK_LOW = 0xffff;
  49127. class MurmurHash3_64 {
  49128. constructor(seed) {
  49129. this.h1 = seed ? seed & 0xffffffff : SEED;
  49130. this.h2 = seed ? seed & 0xffffffff : SEED;
  49131. }
  49132. update(input) {
  49133. let data, length;
  49134. if (typeof input === "string") {
  49135. data = new Uint8Array(input.length * 2);
  49136. length = 0;
  49137. for (let i = 0, ii = input.length; i < ii; i++) {
  49138. const code = input.charCodeAt(i);
  49139. if (code <= 0xff) {
  49140. data[length++] = code;
  49141. } else {
  49142. data[length++] = code >>> 8;
  49143. data[length++] = code & 0xff;
  49144. }
  49145. }
  49146. } else if ((0, _util.isArrayBuffer)(input)) {
  49147. data = input.slice();
  49148. length = data.byteLength;
  49149. } else {
  49150. throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
  49151. }
  49152. const blockCounts = length >> 2;
  49153. const tailLength = length - blockCounts * 4;
  49154. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  49155. let k1 = 0,
  49156. k2 = 0;
  49157. let h1 = this.h1,
  49158. h2 = this.h2;
  49159. const C1 = 0xcc9e2d51,
  49160. C2 = 0x1b873593;
  49161. const C1_LOW = C1 & MASK_LOW,
  49162. C2_LOW = C2 & MASK_LOW;
  49163. for (let i = 0; i < blockCounts; i++) {
  49164. if (i & 1) {
  49165. k1 = dataUint32[i];
  49166. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  49167. k1 = k1 << 15 | k1 >>> 17;
  49168. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  49169. h1 ^= k1;
  49170. h1 = h1 << 13 | h1 >>> 19;
  49171. h1 = h1 * 5 + 0xe6546b64;
  49172. } else {
  49173. k2 = dataUint32[i];
  49174. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  49175. k2 = k2 << 15 | k2 >>> 17;
  49176. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  49177. h2 ^= k2;
  49178. h2 = h2 << 13 | h2 >>> 19;
  49179. h2 = h2 * 5 + 0xe6546b64;
  49180. }
  49181. }
  49182. k1 = 0;
  49183. switch (tailLength) {
  49184. case 3:
  49185. k1 ^= data[blockCounts * 4 + 2] << 16;
  49186. case 2:
  49187. k1 ^= data[blockCounts * 4 + 1] << 8;
  49188. case 1:
  49189. k1 ^= data[blockCounts * 4];
  49190. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  49191. k1 = k1 << 15 | k1 >>> 17;
  49192. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  49193. if (blockCounts & 1) {
  49194. h1 ^= k1;
  49195. } else {
  49196. h2 ^= k1;
  49197. }
  49198. }
  49199. this.h1 = h1;
  49200. this.h2 = h2;
  49201. }
  49202. hexdigest() {
  49203. let h1 = this.h1,
  49204. h2 = this.h2;
  49205. h1 ^= h2 >>> 1;
  49206. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  49207. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  49208. h1 ^= h2 >>> 1;
  49209. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  49210. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  49211. h1 ^= h2 >>> 1;
  49212. const hex1 = (h1 >>> 0).toString(16),
  49213. hex2 = (h2 >>> 0).toString(16);
  49214. return hex1.padStart(8, "0") + hex2.padStart(8, "0");
  49215. }
  49216. }
  49217. exports.MurmurHash3_64 = MurmurHash3_64;
  49218. /***/ }),
  49219. /* 187 */
  49220. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49221. "use strict";
  49222. Object.defineProperty(exports, "__esModule", ({
  49223. value: true
  49224. }));
  49225. exports.OperatorList = void 0;
  49226. var _util = __w_pdfjs_require__(2);
  49227. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  49228. let state = parentState;
  49229. for (let i = 0, ii = pattern.length - 1; i < ii; i++) {
  49230. const item = pattern[i];
  49231. state = state[item] || (state[item] = []);
  49232. }
  49233. state[pattern.at(-1)] = {
  49234. checkFn,
  49235. iterateFn,
  49236. processFn
  49237. };
  49238. }
  49239. const InitialState = [];
  49240. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
  49241. const fnArray = context.fnArray;
  49242. const iFirstSave = context.iCurr - 3;
  49243. const pos = (i - iFirstSave) % 4;
  49244. switch (pos) {
  49245. case 0:
  49246. return fnArray[i] === _util.OPS.save;
  49247. case 1:
  49248. return fnArray[i] === _util.OPS.transform;
  49249. case 2:
  49250. return fnArray[i] === _util.OPS.paintInlineImageXObject;
  49251. case 3:
  49252. return fnArray[i] === _util.OPS.restore;
  49253. }
  49254. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  49255. }, function foundInlineImageGroup(context, i) {
  49256. const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  49257. const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  49258. const MAX_WIDTH = 1000;
  49259. const IMAGE_PADDING = 1;
  49260. const fnArray = context.fnArray,
  49261. argsArray = context.argsArray;
  49262. const curr = context.iCurr;
  49263. const iFirstSave = curr - 3;
  49264. const iFirstTransform = curr - 2;
  49265. const iFirstPIIXO = curr - 1;
  49266. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  49267. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  49268. return i - (i - iFirstSave) % 4;
  49269. }
  49270. let maxX = 0;
  49271. const map = [];
  49272. let maxLineHeight = 0;
  49273. let currentX = IMAGE_PADDING,
  49274. currentY = IMAGE_PADDING;
  49275. for (let q = 0; q < count; q++) {
  49276. const transform = argsArray[iFirstTransform + (q << 2)];
  49277. const img = argsArray[iFirstPIIXO + (q << 2)][0];
  49278. if (currentX + img.width > MAX_WIDTH) {
  49279. maxX = Math.max(maxX, currentX);
  49280. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  49281. currentX = 0;
  49282. maxLineHeight = 0;
  49283. }
  49284. map.push({
  49285. transform,
  49286. x: currentX,
  49287. y: currentY,
  49288. w: img.width,
  49289. h: img.height
  49290. });
  49291. currentX += img.width + 2 * IMAGE_PADDING;
  49292. maxLineHeight = Math.max(maxLineHeight, img.height);
  49293. }
  49294. const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  49295. const imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  49296. const imgData = new Uint8Array(imgWidth * imgHeight * 4);
  49297. const imgRowSize = imgWidth << 2;
  49298. for (let q = 0; q < count; q++) {
  49299. const data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  49300. const rowSize = map[q].w << 2;
  49301. let dataOffset = 0;
  49302. let offset = map[q].x + map[q].y * imgWidth << 2;
  49303. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  49304. for (let k = 0, kk = map[q].h; k < kk; k++) {
  49305. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  49306. dataOffset += rowSize;
  49307. offset += imgRowSize;
  49308. }
  49309. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  49310. while (offset >= 0) {
  49311. data[offset - 4] = data[offset];
  49312. data[offset - 3] = data[offset + 1];
  49313. data[offset - 2] = data[offset + 2];
  49314. data[offset - 1] = data[offset + 3];
  49315. data[offset + rowSize] = data[offset + rowSize - 4];
  49316. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  49317. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  49318. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  49319. offset -= imgRowSize;
  49320. }
  49321. }
  49322. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
  49323. argsArray.splice(iFirstSave, count * 4, [{
  49324. width: imgWidth,
  49325. height: imgHeight,
  49326. kind: _util.ImageKind.RGBA_32BPP,
  49327. data: imgData
  49328. }, map]);
  49329. return iFirstSave + 1;
  49330. });
  49331. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
  49332. const fnArray = context.fnArray;
  49333. const iFirstSave = context.iCurr - 3;
  49334. const pos = (i - iFirstSave) % 4;
  49335. switch (pos) {
  49336. case 0:
  49337. return fnArray[i] === _util.OPS.save;
  49338. case 1:
  49339. return fnArray[i] === _util.OPS.transform;
  49340. case 2:
  49341. return fnArray[i] === _util.OPS.paintImageMaskXObject;
  49342. case 3:
  49343. return fnArray[i] === _util.OPS.restore;
  49344. }
  49345. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  49346. }, function foundImageMaskGroup(context, i) {
  49347. const MIN_IMAGES_IN_MASKS_BLOCK = 10;
  49348. const MAX_IMAGES_IN_MASKS_BLOCK = 100;
  49349. const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  49350. const fnArray = context.fnArray,
  49351. argsArray = context.argsArray;
  49352. const curr = context.iCurr;
  49353. const iFirstSave = curr - 3;
  49354. const iFirstTransform = curr - 2;
  49355. const iFirstPIMXO = curr - 1;
  49356. let count = Math.floor((i - iFirstSave) / 4);
  49357. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  49358. return i - (i - iFirstSave) % 4;
  49359. }
  49360. let isSameImage = false;
  49361. let iTransform, transformArgs;
  49362. const firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  49363. const firstTransformArg0 = argsArray[iFirstTransform][0],
  49364. firstTransformArg1 = argsArray[iFirstTransform][1],
  49365. firstTransformArg2 = argsArray[iFirstTransform][2],
  49366. firstTransformArg3 = argsArray[iFirstTransform][3];
  49367. if (firstTransformArg1 === firstTransformArg2) {
  49368. isSameImage = true;
  49369. iTransform = iFirstTransform + 4;
  49370. let iPIMXO = iFirstPIMXO + 4;
  49371. for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  49372. transformArgs = argsArray[iTransform];
  49373. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) {
  49374. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  49375. isSameImage = false;
  49376. } else {
  49377. count = q;
  49378. }
  49379. break;
  49380. }
  49381. }
  49382. }
  49383. if (isSameImage) {
  49384. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  49385. const positions = new Float32Array(count * 2);
  49386. iTransform = iFirstTransform;
  49387. for (let q = 0; q < count; q++, iTransform += 4) {
  49388. transformArgs = argsArray[iTransform];
  49389. positions[q << 1] = transformArgs[4];
  49390. positions[(q << 1) + 1] = transformArgs[5];
  49391. }
  49392. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
  49393. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]);
  49394. } else {
  49395. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  49396. const images = [];
  49397. for (let q = 0; q < count; q++) {
  49398. transformArgs = argsArray[iFirstTransform + (q << 2)];
  49399. const maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  49400. images.push({
  49401. data: maskParams.data,
  49402. width: maskParams.width,
  49403. height: maskParams.height,
  49404. interpolate: maskParams.interpolate,
  49405. count: maskParams.count,
  49406. transform: transformArgs
  49407. });
  49408. }
  49409. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
  49410. argsArray.splice(iFirstSave, count * 4, [images]);
  49411. }
  49412. return iFirstSave + 1;
  49413. });
  49414. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
  49415. const argsArray = context.argsArray;
  49416. const iFirstTransform = context.iCurr - 2;
  49417. return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
  49418. }, function iterateImageGroup(context, i) {
  49419. const fnArray = context.fnArray,
  49420. argsArray = context.argsArray;
  49421. const iFirstSave = context.iCurr - 3;
  49422. const pos = (i - iFirstSave) % 4;
  49423. switch (pos) {
  49424. case 0:
  49425. return fnArray[i] === _util.OPS.save;
  49426. case 1:
  49427. if (fnArray[i] !== _util.OPS.transform) {
  49428. return false;
  49429. }
  49430. const iFirstTransform = context.iCurr - 2;
  49431. const firstTransformArg0 = argsArray[iFirstTransform][0];
  49432. const firstTransformArg3 = argsArray[iFirstTransform][3];
  49433. if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
  49434. return false;
  49435. }
  49436. return true;
  49437. case 2:
  49438. if (fnArray[i] !== _util.OPS.paintImageXObject) {
  49439. return false;
  49440. }
  49441. const iFirstPIXO = context.iCurr - 1;
  49442. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  49443. if (argsArray[i][0] !== firstPIXOArg0) {
  49444. return false;
  49445. }
  49446. return true;
  49447. case 3:
  49448. return fnArray[i] === _util.OPS.restore;
  49449. }
  49450. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  49451. }, function (context, i) {
  49452. const MIN_IMAGES_IN_BLOCK = 3;
  49453. const MAX_IMAGES_IN_BLOCK = 1000;
  49454. const fnArray = context.fnArray,
  49455. argsArray = context.argsArray;
  49456. const curr = context.iCurr;
  49457. const iFirstSave = curr - 3;
  49458. const iFirstTransform = curr - 2;
  49459. const iFirstPIXO = curr - 1;
  49460. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  49461. const firstTransformArg0 = argsArray[iFirstTransform][0];
  49462. const firstTransformArg3 = argsArray[iFirstTransform][3];
  49463. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
  49464. if (count < MIN_IMAGES_IN_BLOCK) {
  49465. return i - (i - iFirstSave) % 4;
  49466. }
  49467. const positions = new Float32Array(count * 2);
  49468. let iTransform = iFirstTransform;
  49469. for (let q = 0; q < count; q++, iTransform += 4) {
  49470. const transformArgs = argsArray[iTransform];
  49471. positions[q << 1] = transformArgs[4];
  49472. positions[(q << 1) + 1] = transformArgs[5];
  49473. }
  49474. const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  49475. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
  49476. argsArray.splice(iFirstSave, count * 4, args);
  49477. return iFirstSave + 1;
  49478. });
  49479. addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
  49480. const fnArray = context.fnArray,
  49481. argsArray = context.argsArray;
  49482. const iFirstSave = context.iCurr - 4;
  49483. const pos = (i - iFirstSave) % 5;
  49484. switch (pos) {
  49485. case 0:
  49486. return fnArray[i] === _util.OPS.beginText;
  49487. case 1:
  49488. return fnArray[i] === _util.OPS.setFont;
  49489. case 2:
  49490. return fnArray[i] === _util.OPS.setTextMatrix;
  49491. case 3:
  49492. if (fnArray[i] !== _util.OPS.showText) {
  49493. return false;
  49494. }
  49495. const iFirstSetFont = context.iCurr - 3;
  49496. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  49497. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  49498. if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
  49499. return false;
  49500. }
  49501. return true;
  49502. case 4:
  49503. return fnArray[i] === _util.OPS.endText;
  49504. }
  49505. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  49506. }, function (context, i) {
  49507. const MIN_CHARS_IN_BLOCK = 3;
  49508. const MAX_CHARS_IN_BLOCK = 1000;
  49509. const fnArray = context.fnArray,
  49510. argsArray = context.argsArray;
  49511. const curr = context.iCurr;
  49512. const iFirstBeginText = curr - 4;
  49513. const iFirstSetFont = curr - 3;
  49514. const iFirstSetTextMatrix = curr - 2;
  49515. const iFirstShowText = curr - 1;
  49516. const iFirstEndText = curr;
  49517. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  49518. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  49519. let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
  49520. if (count < MIN_CHARS_IN_BLOCK) {
  49521. return i - (i - iFirstBeginText) % 5;
  49522. }
  49523. let iFirst = iFirstBeginText;
  49524. 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) {
  49525. count++;
  49526. iFirst -= 5;
  49527. }
  49528. let iEndText = iFirst + 4;
  49529. for (let q = 1; q < count; q++) {
  49530. fnArray.splice(iEndText, 3);
  49531. argsArray.splice(iEndText, 3);
  49532. iEndText += 2;
  49533. }
  49534. return iEndText + 1;
  49535. });
  49536. class NullOptimizer {
  49537. constructor(queue) {
  49538. this.queue = queue;
  49539. }
  49540. _optimize() {}
  49541. push(fn, args) {
  49542. this.queue.fnArray.push(fn);
  49543. this.queue.argsArray.push(args);
  49544. this._optimize();
  49545. }
  49546. flush() {}
  49547. reset() {}
  49548. }
  49549. class QueueOptimizer extends NullOptimizer {
  49550. constructor(queue) {
  49551. super(queue);
  49552. this.state = null;
  49553. this.context = {
  49554. iCurr: 0,
  49555. fnArray: queue.fnArray,
  49556. argsArray: queue.argsArray
  49557. };
  49558. this.match = null;
  49559. this.lastProcessed = 0;
  49560. }
  49561. _optimize() {
  49562. const fnArray = this.queue.fnArray;
  49563. let i = this.lastProcessed,
  49564. ii = fnArray.length;
  49565. let state = this.state;
  49566. let match = this.match;
  49567. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  49568. this.lastProcessed = ii;
  49569. return;
  49570. }
  49571. const context = this.context;
  49572. while (i < ii) {
  49573. if (match) {
  49574. const iterate = (0, match.iterateFn)(context, i);
  49575. if (iterate) {
  49576. i++;
  49577. continue;
  49578. }
  49579. i = (0, match.processFn)(context, i + 1);
  49580. ii = fnArray.length;
  49581. match = null;
  49582. state = null;
  49583. if (i >= ii) {
  49584. break;
  49585. }
  49586. }
  49587. state = (state || InitialState)[fnArray[i]];
  49588. if (!state || Array.isArray(state)) {
  49589. i++;
  49590. continue;
  49591. }
  49592. context.iCurr = i;
  49593. i++;
  49594. if (state.checkFn && !(0, state.checkFn)(context)) {
  49595. state = null;
  49596. continue;
  49597. }
  49598. match = state;
  49599. state = null;
  49600. }
  49601. this.state = state;
  49602. this.match = match;
  49603. this.lastProcessed = i;
  49604. }
  49605. flush() {
  49606. while (this.match) {
  49607. const length = this.queue.fnArray.length;
  49608. this.lastProcessed = (0, this.match.processFn)(this.context, length);
  49609. this.match = null;
  49610. this.state = null;
  49611. this._optimize();
  49612. }
  49613. }
  49614. reset() {
  49615. this.state = null;
  49616. this.match = null;
  49617. this.lastProcessed = 0;
  49618. }
  49619. }
  49620. class OperatorList {
  49621. static get CHUNK_SIZE() {
  49622. return (0, _util.shadow)(this, "CHUNK_SIZE", 1000);
  49623. }
  49624. static get CHUNK_SIZE_ABOUT() {
  49625. return (0, _util.shadow)(this, "CHUNK_SIZE_ABOUT", this.CHUNK_SIZE - 5);
  49626. }
  49627. constructor() {
  49628. let intent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  49629. let streamSink = arguments.length > 1 ? arguments[1] : undefined;
  49630. this._streamSink = streamSink;
  49631. this.fnArray = [];
  49632. this.argsArray = [];
  49633. if (streamSink && !(intent & _util.RenderingIntentFlag.OPLIST)) {
  49634. this.optimizer = new QueueOptimizer(this);
  49635. } else {
  49636. this.optimizer = new NullOptimizer(this);
  49637. }
  49638. this.dependencies = new Set();
  49639. this._totalLength = 0;
  49640. this.weight = 0;
  49641. this._resolved = streamSink ? null : Promise.resolve();
  49642. }
  49643. get length() {
  49644. return this.argsArray.length;
  49645. }
  49646. get ready() {
  49647. return this._resolved || this._streamSink.ready;
  49648. }
  49649. get totalLength() {
  49650. return this._totalLength + this.length;
  49651. }
  49652. addOp(fn, args) {
  49653. this.optimizer.push(fn, args);
  49654. this.weight++;
  49655. if (this._streamSink) {
  49656. if (this.weight >= OperatorList.CHUNK_SIZE) {
  49657. this.flush();
  49658. } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
  49659. this.flush();
  49660. }
  49661. }
  49662. }
  49663. addImageOps(fn, args, optionalContent) {
  49664. if (optionalContent !== undefined) {
  49665. this.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  49666. }
  49667. this.addOp(fn, args);
  49668. if (optionalContent !== undefined) {
  49669. this.addOp(_util.OPS.endMarkedContent, []);
  49670. }
  49671. }
  49672. addDependency(dependency) {
  49673. if (this.dependencies.has(dependency)) {
  49674. return;
  49675. }
  49676. this.dependencies.add(dependency);
  49677. this.addOp(_util.OPS.dependency, [dependency]);
  49678. }
  49679. addDependencies(dependencies) {
  49680. for (const dependency of dependencies) {
  49681. this.addDependency(dependency);
  49682. }
  49683. }
  49684. addOpList(opList) {
  49685. if (!(opList instanceof OperatorList)) {
  49686. (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
  49687. return;
  49688. }
  49689. for (const dependency of opList.dependencies) {
  49690. this.dependencies.add(dependency);
  49691. }
  49692. for (let i = 0, ii = opList.length; i < ii; i++) {
  49693. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  49694. }
  49695. }
  49696. getIR() {
  49697. return {
  49698. fnArray: this.fnArray,
  49699. argsArray: this.argsArray,
  49700. length: this.length
  49701. };
  49702. }
  49703. get _transfers() {
  49704. const transfers = [];
  49705. const {
  49706. fnArray,
  49707. argsArray,
  49708. length
  49709. } = this;
  49710. for (let i = 0; i < length; i++) {
  49711. switch (fnArray[i]) {
  49712. case _util.OPS.paintInlineImageXObject:
  49713. case _util.OPS.paintInlineImageXObjectGroup:
  49714. case _util.OPS.paintImageMaskXObject:
  49715. const arg = argsArray[i][0];
  49716. if (!arg.cached && arg.data && arg.data.buffer instanceof ArrayBuffer) {
  49717. transfers.push(arg.data.buffer);
  49718. }
  49719. break;
  49720. }
  49721. }
  49722. return transfers;
  49723. }
  49724. flush() {
  49725. let lastChunk = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  49726. let separateAnnots = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  49727. this.optimizer.flush();
  49728. const length = this.length;
  49729. this._totalLength += length;
  49730. this._streamSink.enqueue({
  49731. fnArray: this.fnArray,
  49732. argsArray: this.argsArray,
  49733. lastChunk,
  49734. separateAnnots,
  49735. length
  49736. }, 1, this._transfers);
  49737. this.dependencies.clear();
  49738. this.fnArray.length = 0;
  49739. this.argsArray.length = 0;
  49740. this.weight = 0;
  49741. this.optimizer.reset();
  49742. }
  49743. }
  49744. exports.OperatorList = OperatorList;
  49745. /***/ }),
  49746. /* 188 */
  49747. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49748. "use strict";
  49749. Object.defineProperty(exports, "__esModule", ({
  49750. value: true
  49751. }));
  49752. exports.PDFImage = void 0;
  49753. var _util = __w_pdfjs_require__(2);
  49754. var _image_utils = __w_pdfjs_require__(189);
  49755. var _base_stream = __w_pdfjs_require__(132);
  49756. var _colorspace = __w_pdfjs_require__(139);
  49757. var _decode_stream = __w_pdfjs_require__(144);
  49758. var _jpeg_stream = __w_pdfjs_require__(152);
  49759. var _jpx = __w_pdfjs_require__(155);
  49760. var _primitives = __w_pdfjs_require__(130);
  49761. function decodeAndClamp(value, addend, coefficient, max) {
  49762. value = addend + value * coefficient;
  49763. if (value < 0) {
  49764. value = 0;
  49765. } else if (value > max) {
  49766. value = max;
  49767. }
  49768. return value;
  49769. }
  49770. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  49771. const length = w2 * h2;
  49772. let dest;
  49773. if (bpc <= 8) {
  49774. dest = new Uint8Array(length);
  49775. } else if (bpc <= 16) {
  49776. dest = new Uint16Array(length);
  49777. } else {
  49778. dest = new Uint32Array(length);
  49779. }
  49780. const xRatio = w1 / w2;
  49781. const yRatio = h1 / h2;
  49782. let i,
  49783. j,
  49784. py,
  49785. newIndex = 0,
  49786. oldIndex;
  49787. const xScaled = new Uint16Array(w2);
  49788. const w1Scanline = w1;
  49789. for (i = 0; i < w2; i++) {
  49790. xScaled[i] = Math.floor(i * xRatio);
  49791. }
  49792. for (i = 0; i < h2; i++) {
  49793. py = Math.floor(i * yRatio) * w1Scanline;
  49794. for (j = 0; j < w2; j++) {
  49795. oldIndex = py + xScaled[j];
  49796. dest[newIndex++] = src[oldIndex];
  49797. }
  49798. }
  49799. return dest;
  49800. }
  49801. class PDFImage {
  49802. constructor(_ref) {
  49803. let {
  49804. xref,
  49805. res,
  49806. image,
  49807. isInline = false,
  49808. smask = null,
  49809. mask = null,
  49810. isMask = false,
  49811. pdfFunctionFactory,
  49812. localColorSpaceCache
  49813. } = _ref;
  49814. this.image = image;
  49815. const dict = image.dict;
  49816. const filter = dict.get("F", "Filter");
  49817. let filterName;
  49818. if (filter instanceof _primitives.Name) {
  49819. filterName = filter.name;
  49820. } else if (Array.isArray(filter)) {
  49821. const filterZero = xref.fetchIfRef(filter[0]);
  49822. if (filterZero instanceof _primitives.Name) {
  49823. filterName = filterZero.name;
  49824. }
  49825. }
  49826. switch (filterName) {
  49827. case "JPXDecode":
  49828. const jpxImage = new _jpx.JpxImage();
  49829. jpxImage.parseImageProperties(image.stream);
  49830. image.stream.reset();
  49831. image.width = jpxImage.width;
  49832. image.height = jpxImage.height;
  49833. image.bitsPerComponent = jpxImage.bitsPerComponent;
  49834. image.numComps = jpxImage.componentsCount;
  49835. break;
  49836. case "JBIG2Decode":
  49837. image.bitsPerComponent = 1;
  49838. image.numComps = 1;
  49839. break;
  49840. }
  49841. let width = dict.get("W", "Width");
  49842. let height = dict.get("H", "Height");
  49843. if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
  49844. (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
  49845. width = image.width;
  49846. height = image.height;
  49847. }
  49848. if (width < 1 || height < 1) {
  49849. throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`);
  49850. }
  49851. this.width = width;
  49852. this.height = height;
  49853. this.interpolate = dict.get("I", "Interpolate");
  49854. this.imageMask = dict.get("IM", "ImageMask") || false;
  49855. this.matte = dict.get("Matte") || false;
  49856. let bitsPerComponent = image.bitsPerComponent;
  49857. if (!bitsPerComponent) {
  49858. bitsPerComponent = dict.get("BPC", "BitsPerComponent");
  49859. if (!bitsPerComponent) {
  49860. if (this.imageMask) {
  49861. bitsPerComponent = 1;
  49862. } else {
  49863. throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`);
  49864. }
  49865. }
  49866. }
  49867. this.bpc = bitsPerComponent;
  49868. if (!this.imageMask) {
  49869. let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace");
  49870. if (!colorSpace) {
  49871. (0, _util.info)("JPX images (which do not require color spaces)");
  49872. switch (image.numComps) {
  49873. case 1:
  49874. colorSpace = _primitives.Name.get("DeviceGray");
  49875. break;
  49876. case 3:
  49877. colorSpace = _primitives.Name.get("DeviceRGB");
  49878. break;
  49879. case 4:
  49880. colorSpace = _primitives.Name.get("DeviceCMYK");
  49881. break;
  49882. default:
  49883. throw new Error(`JPX images with ${image.numComps} color components not supported.`);
  49884. }
  49885. }
  49886. this.colorSpace = _colorspace.ColorSpace.parse({
  49887. cs: colorSpace,
  49888. xref,
  49889. resources: isInline ? res : null,
  49890. pdfFunctionFactory,
  49891. localColorSpaceCache
  49892. });
  49893. this.numComps = this.colorSpace.numComps;
  49894. }
  49895. this.decode = dict.getArray("D", "Decode");
  49896. this.needsDecode = false;
  49897. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
  49898. this.needsDecode = true;
  49899. const max = (1 << bitsPerComponent) - 1;
  49900. this.decodeCoefficients = [];
  49901. this.decodeAddends = [];
  49902. const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed";
  49903. for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  49904. const dmin = this.decode[i];
  49905. const dmax = this.decode[i + 1];
  49906. this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
  49907. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  49908. }
  49909. }
  49910. if (smask) {
  49911. this.smask = new PDFImage({
  49912. xref,
  49913. res,
  49914. image: smask,
  49915. isInline,
  49916. pdfFunctionFactory,
  49917. localColorSpaceCache
  49918. });
  49919. } else if (mask) {
  49920. if (mask instanceof _base_stream.BaseStream) {
  49921. const maskDict = mask.dict,
  49922. imageMask = maskDict.get("IM", "ImageMask");
  49923. if (!imageMask) {
  49924. (0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
  49925. } else {
  49926. this.mask = new PDFImage({
  49927. xref,
  49928. res,
  49929. image: mask,
  49930. isInline,
  49931. isMask: true,
  49932. pdfFunctionFactory,
  49933. localColorSpaceCache
  49934. });
  49935. }
  49936. } else {
  49937. this.mask = mask;
  49938. }
  49939. }
  49940. }
  49941. static async buildImage(_ref2) {
  49942. let {
  49943. xref,
  49944. res,
  49945. image,
  49946. isInline = false,
  49947. pdfFunctionFactory,
  49948. localColorSpaceCache
  49949. } = _ref2;
  49950. const imageData = image;
  49951. let smaskData = null;
  49952. let maskData = null;
  49953. const smask = image.dict.get("SMask");
  49954. const mask = image.dict.get("Mask");
  49955. if (smask) {
  49956. if (smask instanceof _base_stream.BaseStream) {
  49957. smaskData = smask;
  49958. } else {
  49959. (0, _util.warn)("Unsupported /SMask format.");
  49960. }
  49961. } else if (mask) {
  49962. if (mask instanceof _base_stream.BaseStream || Array.isArray(mask)) {
  49963. maskData = mask;
  49964. } else {
  49965. (0, _util.warn)("Unsupported /Mask format.");
  49966. }
  49967. }
  49968. return new PDFImage({
  49969. xref,
  49970. res,
  49971. image: imageData,
  49972. isInline,
  49973. smask: smaskData,
  49974. mask: maskData,
  49975. pdfFunctionFactory,
  49976. localColorSpaceCache
  49977. });
  49978. }
  49979. static createRawMask(_ref3) {
  49980. let {
  49981. imgArray,
  49982. width,
  49983. height,
  49984. imageIsFromDecodeStream,
  49985. inverseDecode,
  49986. interpolate
  49987. } = _ref3;
  49988. const computedLength = (width + 7 >> 3) * height;
  49989. const actualLength = imgArray.byteLength;
  49990. const haveFullData = computedLength === actualLength;
  49991. let data, i;
  49992. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  49993. data = imgArray;
  49994. } else if (!inverseDecode) {
  49995. data = new Uint8Array(imgArray);
  49996. } else {
  49997. data = new Uint8Array(computedLength);
  49998. data.set(imgArray);
  49999. data.fill(0xff, actualLength);
  50000. }
  50001. if (inverseDecode) {
  50002. for (i = 0; i < actualLength; i++) {
  50003. data[i] ^= 0xff;
  50004. }
  50005. }
  50006. return {
  50007. data,
  50008. width,
  50009. height,
  50010. interpolate
  50011. };
  50012. }
  50013. static createMask(_ref4) {
  50014. let {
  50015. imgArray,
  50016. width,
  50017. height,
  50018. imageIsFromDecodeStream,
  50019. inverseDecode,
  50020. interpolate
  50021. } = _ref4;
  50022. const isSingleOpaquePixel = width === 1 && height === 1 && inverseDecode === (imgArray.length === 0 || !!(imgArray[0] & 128));
  50023. if (isSingleOpaquePixel) {
  50024. return {
  50025. isSingleOpaquePixel
  50026. };
  50027. }
  50028. if (_util.FeatureTest.isOffscreenCanvasSupported) {
  50029. const canvas = new OffscreenCanvas(width, height);
  50030. const ctx = canvas.getContext("2d");
  50031. const imgData = ctx.createImageData(width, height);
  50032. (0, _image_utils.applyMaskImageData)({
  50033. src: imgArray,
  50034. dest: imgData.data,
  50035. width,
  50036. height,
  50037. inverseDecode
  50038. });
  50039. ctx.putImageData(imgData, 0, 0);
  50040. const bitmap = canvas.transferToImageBitmap();
  50041. return {
  50042. data: null,
  50043. width,
  50044. height,
  50045. interpolate,
  50046. bitmap
  50047. };
  50048. }
  50049. return this.createRawMask({
  50050. imgArray,
  50051. width,
  50052. height,
  50053. inverseDecode,
  50054. imageIsFromDecodeStream,
  50055. interpolate
  50056. });
  50057. }
  50058. get drawWidth() {
  50059. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  50060. }
  50061. get drawHeight() {
  50062. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  50063. }
  50064. decodeBuffer(buffer) {
  50065. const bpc = this.bpc;
  50066. const numComps = this.numComps;
  50067. const decodeAddends = this.decodeAddends;
  50068. const decodeCoefficients = this.decodeCoefficients;
  50069. const max = (1 << bpc) - 1;
  50070. let i, ii;
  50071. if (bpc === 1) {
  50072. for (i = 0, ii = buffer.length; i < ii; i++) {
  50073. buffer[i] = +!buffer[i];
  50074. }
  50075. return;
  50076. }
  50077. let index = 0;
  50078. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  50079. for (let j = 0; j < numComps; j++) {
  50080. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  50081. index++;
  50082. }
  50083. }
  50084. }
  50085. getComponents(buffer) {
  50086. const bpc = this.bpc;
  50087. if (bpc === 8) {
  50088. return buffer;
  50089. }
  50090. const width = this.width;
  50091. const height = this.height;
  50092. const numComps = this.numComps;
  50093. const length = width * height * numComps;
  50094. let bufferPos = 0;
  50095. let output;
  50096. if (bpc <= 8) {
  50097. output = new Uint8Array(length);
  50098. } else if (bpc <= 16) {
  50099. output = new Uint16Array(length);
  50100. } else {
  50101. output = new Uint32Array(length);
  50102. }
  50103. const rowComps = width * numComps;
  50104. const max = (1 << bpc) - 1;
  50105. let i = 0,
  50106. ii,
  50107. buf;
  50108. if (bpc === 1) {
  50109. let mask, loop1End, loop2End;
  50110. for (let j = 0; j < height; j++) {
  50111. loop1End = i + (rowComps & ~7);
  50112. loop2End = i + rowComps;
  50113. while (i < loop1End) {
  50114. buf = buffer[bufferPos++];
  50115. output[i] = buf >> 7 & 1;
  50116. output[i + 1] = buf >> 6 & 1;
  50117. output[i + 2] = buf >> 5 & 1;
  50118. output[i + 3] = buf >> 4 & 1;
  50119. output[i + 4] = buf >> 3 & 1;
  50120. output[i + 5] = buf >> 2 & 1;
  50121. output[i + 6] = buf >> 1 & 1;
  50122. output[i + 7] = buf & 1;
  50123. i += 8;
  50124. }
  50125. if (i < loop2End) {
  50126. buf = buffer[bufferPos++];
  50127. mask = 128;
  50128. while (i < loop2End) {
  50129. output[i++] = +!!(buf & mask);
  50130. mask >>= 1;
  50131. }
  50132. }
  50133. }
  50134. } else {
  50135. let bits = 0;
  50136. buf = 0;
  50137. for (i = 0, ii = length; i < ii; ++i) {
  50138. if (i % rowComps === 0) {
  50139. buf = 0;
  50140. bits = 0;
  50141. }
  50142. while (bits < bpc) {
  50143. buf = buf << 8 | buffer[bufferPos++];
  50144. bits += 8;
  50145. }
  50146. const remainingBits = bits - bpc;
  50147. let value = buf >> remainingBits;
  50148. if (value < 0) {
  50149. value = 0;
  50150. } else if (value > max) {
  50151. value = max;
  50152. }
  50153. output[i] = value;
  50154. buf &= (1 << remainingBits) - 1;
  50155. bits = remainingBits;
  50156. }
  50157. }
  50158. return output;
  50159. }
  50160. fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  50161. const smask = this.smask;
  50162. const mask = this.mask;
  50163. let alphaBuf, sw, sh, i, ii, j;
  50164. if (smask) {
  50165. sw = smask.width;
  50166. sh = smask.height;
  50167. alphaBuf = new Uint8ClampedArray(sw * sh);
  50168. smask.fillGrayBuffer(alphaBuf);
  50169. if (sw !== width || sh !== height) {
  50170. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  50171. }
  50172. } else if (mask) {
  50173. if (mask instanceof PDFImage) {
  50174. sw = mask.width;
  50175. sh = mask.height;
  50176. alphaBuf = new Uint8ClampedArray(sw * sh);
  50177. mask.numComps = 1;
  50178. mask.fillGrayBuffer(alphaBuf);
  50179. for (i = 0, ii = sw * sh; i < ii; ++i) {
  50180. alphaBuf[i] = 255 - alphaBuf[i];
  50181. }
  50182. if (sw !== width || sh !== height) {
  50183. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  50184. }
  50185. } else if (Array.isArray(mask)) {
  50186. alphaBuf = new Uint8ClampedArray(width * height);
  50187. const numComps = this.numComps;
  50188. for (i = 0, ii = width * height; i < ii; ++i) {
  50189. let opacity = 0;
  50190. const imageOffset = i * numComps;
  50191. for (j = 0; j < numComps; ++j) {
  50192. const color = image[imageOffset + j];
  50193. const maskOffset = j * 2;
  50194. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  50195. opacity = 255;
  50196. break;
  50197. }
  50198. }
  50199. alphaBuf[i] = opacity;
  50200. }
  50201. } else {
  50202. throw new _util.FormatError("Unknown mask format.");
  50203. }
  50204. }
  50205. if (alphaBuf) {
  50206. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  50207. rgbaBuf[j] = alphaBuf[i];
  50208. }
  50209. } else {
  50210. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  50211. rgbaBuf[j] = 255;
  50212. }
  50213. }
  50214. }
  50215. undoPreblend(buffer, width, height) {
  50216. const matte = this.smask && this.smask.matte;
  50217. if (!matte) {
  50218. return;
  50219. }
  50220. const matteRgb = this.colorSpace.getRgb(matte, 0);
  50221. const matteR = matteRgb[0];
  50222. const matteG = matteRgb[1];
  50223. const matteB = matteRgb[2];
  50224. const length = width * height * 4;
  50225. for (let i = 0; i < length; i += 4) {
  50226. const alpha = buffer[i + 3];
  50227. if (alpha === 0) {
  50228. buffer[i] = 255;
  50229. buffer[i + 1] = 255;
  50230. buffer[i + 2] = 255;
  50231. continue;
  50232. }
  50233. const k = 255 / alpha;
  50234. buffer[i] = (buffer[i] - matteR) * k + matteR;
  50235. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  50236. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  50237. }
  50238. }
  50239. createImageData() {
  50240. let forceRGBA = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  50241. const drawWidth = this.drawWidth;
  50242. const drawHeight = this.drawHeight;
  50243. const imgData = {
  50244. width: drawWidth,
  50245. height: drawHeight,
  50246. interpolate: this.interpolate,
  50247. kind: 0,
  50248. data: null
  50249. };
  50250. const numComps = this.numComps;
  50251. const originalWidth = this.width;
  50252. const originalHeight = this.height;
  50253. const bpc = this.bpc;
  50254. const rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  50255. if (!forceRGBA) {
  50256. let kind;
  50257. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  50258. kind = _util.ImageKind.GRAYSCALE_1BPP;
  50259. } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
  50260. kind = _util.ImageKind.RGB_24BPP;
  50261. }
  50262. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  50263. imgData.kind = kind;
  50264. imgData.data = this.getImageBytes(originalHeight * rowBytes, {});
  50265. if (this.needsDecode) {
  50266. (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
  50267. const buffer = imgData.data;
  50268. for (let i = 0, ii = buffer.length; i < ii; i++) {
  50269. buffer[i] ^= 0xff;
  50270. }
  50271. }
  50272. return imgData;
  50273. }
  50274. if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
  50275. let imageLength = originalHeight * rowBytes;
  50276. switch (this.colorSpace.name) {
  50277. case "DeviceGray":
  50278. imageLength *= 3;
  50279. case "DeviceRGB":
  50280. case "DeviceCMYK":
  50281. imgData.kind = _util.ImageKind.RGB_24BPP;
  50282. imgData.data = this.getImageBytes(imageLength, {
  50283. drawWidth,
  50284. drawHeight,
  50285. forceRGB: true
  50286. });
  50287. return imgData;
  50288. }
  50289. }
  50290. }
  50291. const imgArray = this.getImageBytes(originalHeight * rowBytes, {
  50292. internal: true
  50293. });
  50294. const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  50295. const comps = this.getComponents(imgArray);
  50296. let alpha01, maybeUndoPreblend;
  50297. if (!forceRGBA && !this.smask && !this.mask) {
  50298. imgData.kind = _util.ImageKind.RGB_24BPP;
  50299. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  50300. alpha01 = 0;
  50301. maybeUndoPreblend = false;
  50302. } else {
  50303. imgData.kind = _util.ImageKind.RGBA_32BPP;
  50304. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  50305. alpha01 = 1;
  50306. maybeUndoPreblend = true;
  50307. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  50308. }
  50309. if (this.needsDecode) {
  50310. this.decodeBuffer(comps);
  50311. }
  50312. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  50313. if (maybeUndoPreblend) {
  50314. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  50315. }
  50316. return imgData;
  50317. }
  50318. fillGrayBuffer(buffer) {
  50319. const numComps = this.numComps;
  50320. if (numComps !== 1) {
  50321. throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`);
  50322. }
  50323. const width = this.width;
  50324. const height = this.height;
  50325. const bpc = this.bpc;
  50326. const rowBytes = width * numComps * bpc + 7 >> 3;
  50327. const imgArray = this.getImageBytes(height * rowBytes, {
  50328. internal: true
  50329. });
  50330. const comps = this.getComponents(imgArray);
  50331. let i, length;
  50332. if (bpc === 1) {
  50333. length = width * height;
  50334. if (this.needsDecode) {
  50335. for (i = 0; i < length; ++i) {
  50336. buffer[i] = comps[i] - 1 & 255;
  50337. }
  50338. } else {
  50339. for (i = 0; i < length; ++i) {
  50340. buffer[i] = -comps[i] & 255;
  50341. }
  50342. }
  50343. return;
  50344. }
  50345. if (this.needsDecode) {
  50346. this.decodeBuffer(comps);
  50347. }
  50348. length = width * height;
  50349. const scale = 255 / ((1 << bpc) - 1);
  50350. for (i = 0; i < length; ++i) {
  50351. buffer[i] = scale * comps[i];
  50352. }
  50353. }
  50354. getImageBytes(length, _ref5) {
  50355. let {
  50356. drawWidth,
  50357. drawHeight,
  50358. forceRGB = false,
  50359. internal = false
  50360. } = _ref5;
  50361. this.image.reset();
  50362. this.image.drawWidth = drawWidth || this.width;
  50363. this.image.drawHeight = drawHeight || this.height;
  50364. this.image.forceRGB = !!forceRGB;
  50365. const imageBytes = this.image.getBytes(length);
  50366. if (internal || this.image instanceof _decode_stream.DecodeStream) {
  50367. return imageBytes;
  50368. }
  50369. (0, _util.assert)(imageBytes instanceof Uint8Array, 'PDFImage.getImageBytes: Unsupported "imageBytes" type.');
  50370. return new Uint8Array(imageBytes);
  50371. }
  50372. }
  50373. exports.PDFImage = PDFImage;
  50374. /***/ }),
  50375. /* 189 */
  50376. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50377. "use strict";
  50378. Object.defineProperty(exports, "__esModule", ({
  50379. value: true
  50380. }));
  50381. exports.applyMaskImageData = applyMaskImageData;
  50382. var _util = __w_pdfjs_require__(2);
  50383. function applyMaskImageData(_ref) {
  50384. let {
  50385. src,
  50386. srcPos = 0,
  50387. dest,
  50388. destPos = 0,
  50389. width,
  50390. height,
  50391. inverseDecode = false
  50392. } = _ref;
  50393. const opaque = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
  50394. const [zeroMapping, oneMapping] = !inverseDecode ? [opaque, 0] : [0, opaque];
  50395. const widthInSource = width >> 3;
  50396. const widthRemainder = width & 7;
  50397. const srcLength = src.length;
  50398. dest = new Uint32Array(dest.buffer);
  50399. for (let i = 0; i < height; i++) {
  50400. for (const max = srcPos + widthInSource; srcPos < max; srcPos++) {
  50401. const elem = srcPos < srcLength ? src[srcPos] : 255;
  50402. dest[destPos++] = elem & 0b10000000 ? oneMapping : zeroMapping;
  50403. dest[destPos++] = elem & 0b1000000 ? oneMapping : zeroMapping;
  50404. dest[destPos++] = elem & 0b100000 ? oneMapping : zeroMapping;
  50405. dest[destPos++] = elem & 0b10000 ? oneMapping : zeroMapping;
  50406. dest[destPos++] = elem & 0b1000 ? oneMapping : zeroMapping;
  50407. dest[destPos++] = elem & 0b100 ? oneMapping : zeroMapping;
  50408. dest[destPos++] = elem & 0b10 ? oneMapping : zeroMapping;
  50409. dest[destPos++] = elem & 0b1 ? oneMapping : zeroMapping;
  50410. }
  50411. if (widthRemainder === 0) {
  50412. continue;
  50413. }
  50414. const elem = srcPos < srcLength ? src[srcPos++] : 255;
  50415. for (let j = 0; j < widthRemainder; j++) {
  50416. dest[destPos++] = elem & 1 << 7 - j ? oneMapping : zeroMapping;
  50417. }
  50418. }
  50419. return {
  50420. srcPos,
  50421. destPos
  50422. };
  50423. }
  50424. /***/ }),
  50425. /* 190 */
  50426. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50427. "use strict";
  50428. Object.defineProperty(exports, "__esModule", ({
  50429. value: true
  50430. }));
  50431. exports.incrementalUpdate = incrementalUpdate;
  50432. exports.writeDict = writeDict;
  50433. exports.writeObject = writeObject;
  50434. var _util = __w_pdfjs_require__(2);
  50435. var _primitives = __w_pdfjs_require__(130);
  50436. var _core_utils = __w_pdfjs_require__(131);
  50437. var _xml_parser = __w_pdfjs_require__(191);
  50438. var _base_stream = __w_pdfjs_require__(132);
  50439. var _crypto = __w_pdfjs_require__(192);
  50440. function writeObject(ref, obj, buffer, transform) {
  50441. buffer.push(`${ref.num} ${ref.gen} obj\n`);
  50442. if (obj instanceof _primitives.Dict) {
  50443. writeDict(obj, buffer, transform);
  50444. } else if (obj instanceof _base_stream.BaseStream) {
  50445. writeStream(obj, buffer, transform);
  50446. }
  50447. buffer.push("\nendobj\n");
  50448. }
  50449. function writeDict(dict, buffer, transform) {
  50450. buffer.push("<<");
  50451. for (const key of dict.getKeys()) {
  50452. buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `);
  50453. writeValue(dict.getRaw(key), buffer, transform);
  50454. }
  50455. buffer.push(">>");
  50456. }
  50457. function writeStream(stream, buffer, transform) {
  50458. writeDict(stream.dict, buffer, transform);
  50459. buffer.push(" stream\n");
  50460. let string = stream.getString();
  50461. if (transform !== null) {
  50462. string = transform.encryptString(string);
  50463. }
  50464. buffer.push(string, "\nendstream\n");
  50465. }
  50466. function writeArray(array, buffer, transform) {
  50467. buffer.push("[");
  50468. let first = true;
  50469. for (const val of array) {
  50470. if (!first) {
  50471. buffer.push(" ");
  50472. } else {
  50473. first = false;
  50474. }
  50475. writeValue(val, buffer, transform);
  50476. }
  50477. buffer.push("]");
  50478. }
  50479. function writeValue(value, buffer, transform) {
  50480. if (value instanceof _primitives.Name) {
  50481. buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`);
  50482. } else if (value instanceof _primitives.Ref) {
  50483. buffer.push(`${value.num} ${value.gen} R`);
  50484. } else if (Array.isArray(value)) {
  50485. writeArray(value, buffer, transform);
  50486. } else if (typeof value === "string") {
  50487. if (transform !== null) {
  50488. value = transform.encryptString(value);
  50489. }
  50490. buffer.push(`(${(0, _util.escapeString)(value)})`);
  50491. } else if (typeof value === "number") {
  50492. buffer.push((0, _core_utils.numberToString)(value));
  50493. } else if (typeof value === "boolean") {
  50494. buffer.push(value.toString());
  50495. } else if (value instanceof _primitives.Dict) {
  50496. writeDict(value, buffer, transform);
  50497. } else if (value instanceof _base_stream.BaseStream) {
  50498. writeStream(value, buffer, transform);
  50499. } else if (value === null) {
  50500. buffer.push("null");
  50501. } else {
  50502. (0, _util.warn)(`Unhandled value in writer: ${typeof value}, please file a bug.`);
  50503. }
  50504. }
  50505. function writeInt(number, size, offset, buffer) {
  50506. for (let i = size + offset - 1; i > offset - 1; i--) {
  50507. buffer[i] = number & 0xff;
  50508. number >>= 8;
  50509. }
  50510. return offset + size;
  50511. }
  50512. function writeString(string, offset, buffer) {
  50513. for (let i = 0, len = string.length; i < len; i++) {
  50514. buffer[offset + i] = string.charCodeAt(i) & 0xff;
  50515. }
  50516. }
  50517. function computeMD5(filesize, xrefInfo) {
  50518. const time = Math.floor(Date.now() / 1000);
  50519. const filename = xrefInfo.filename || "";
  50520. const md5Buffer = [time.toString(), filename, filesize.toString()];
  50521. let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0);
  50522. for (const value of Object.values(xrefInfo.info)) {
  50523. md5Buffer.push(value);
  50524. md5BufferLen += value.length;
  50525. }
  50526. const array = new Uint8Array(md5BufferLen);
  50527. let offset = 0;
  50528. for (const str of md5Buffer) {
  50529. writeString(str, offset, array);
  50530. offset += str.length;
  50531. }
  50532. return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array));
  50533. }
  50534. function writeXFADataForAcroform(str, newRefs) {
  50535. const xml = new _xml_parser.SimpleXMLParser({
  50536. hasAttributes: true
  50537. }).parseFromString(str);
  50538. for (const {
  50539. xfa
  50540. } of newRefs) {
  50541. if (!xfa) {
  50542. continue;
  50543. }
  50544. const {
  50545. path,
  50546. value
  50547. } = xfa;
  50548. if (!path) {
  50549. continue;
  50550. }
  50551. const node = xml.documentElement.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  50552. if (node) {
  50553. if (Array.isArray(value)) {
  50554. node.childNodes = value.map(val => new _xml_parser.SimpleDOMNode("value", val));
  50555. } else {
  50556. node.childNodes = [new _xml_parser.SimpleDOMNode("#text", value)];
  50557. }
  50558. } else {
  50559. (0, _util.warn)(`Node not found for path: ${path}`);
  50560. }
  50561. }
  50562. const buffer = [];
  50563. xml.documentElement.dump(buffer);
  50564. return buffer.join("");
  50565. }
  50566. function updateXFA(_ref) {
  50567. let {
  50568. xfaData,
  50569. xfaDatasetsRef,
  50570. hasXfaDatasetsEntry,
  50571. acroFormRef,
  50572. acroForm,
  50573. newRefs,
  50574. xref,
  50575. xrefInfo
  50576. } = _ref;
  50577. if (xref === null) {
  50578. return;
  50579. }
  50580. if (!hasXfaDatasetsEntry) {
  50581. if (!acroFormRef) {
  50582. (0, _util.warn)("XFA - Cannot save it");
  50583. return;
  50584. }
  50585. const oldXfa = acroForm.get("XFA");
  50586. const newXfa = oldXfa.slice();
  50587. newXfa.splice(2, 0, "datasets");
  50588. newXfa.splice(3, 0, xfaDatasetsRef);
  50589. acroForm.set("XFA", newXfa);
  50590. const encrypt = xref.encrypt;
  50591. let transform = null;
  50592. if (encrypt) {
  50593. transform = encrypt.createCipherTransform(acroFormRef.num, acroFormRef.gen);
  50594. }
  50595. const buffer = [`${acroFormRef.num} ${acroFormRef.gen} obj\n`];
  50596. writeDict(acroForm, buffer, transform);
  50597. buffer.push("\n");
  50598. acroForm.set("XFA", oldXfa);
  50599. newRefs.push({
  50600. ref: acroFormRef,
  50601. data: buffer.join("")
  50602. });
  50603. }
  50604. if (xfaData === null) {
  50605. const datasets = xref.fetchIfRef(xfaDatasetsRef);
  50606. xfaData = writeXFADataForAcroform(datasets.getString(), newRefs);
  50607. }
  50608. const encrypt = xref.encrypt;
  50609. if (encrypt) {
  50610. const transform = encrypt.createCipherTransform(xfaDatasetsRef.num, xfaDatasetsRef.gen);
  50611. xfaData = transform.encryptString(xfaData);
  50612. }
  50613. const data = `${xfaDatasetsRef.num} ${xfaDatasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n";
  50614. newRefs.push({
  50615. ref: xfaDatasetsRef,
  50616. data
  50617. });
  50618. }
  50619. function incrementalUpdate(_ref2) {
  50620. let {
  50621. originalData,
  50622. xrefInfo,
  50623. newRefs,
  50624. xref = null,
  50625. hasXfa = false,
  50626. xfaDatasetsRef = null,
  50627. hasXfaDatasetsEntry = false,
  50628. acroFormRef = null,
  50629. acroForm = null,
  50630. xfaData = null
  50631. } = _ref2;
  50632. if (hasXfa) {
  50633. updateXFA({
  50634. xfaData,
  50635. xfaDatasetsRef,
  50636. hasXfaDatasetsEntry,
  50637. acroFormRef,
  50638. acroForm,
  50639. newRefs,
  50640. xref,
  50641. xrefInfo
  50642. });
  50643. }
  50644. const newXref = new _primitives.Dict(null);
  50645. const refForXrefTable = xrefInfo.newRef;
  50646. let buffer, baseOffset;
  50647. const lastByte = originalData.at(-1);
  50648. if (lastByte === 0x0a || lastByte === 0x0d) {
  50649. buffer = [];
  50650. baseOffset = originalData.length;
  50651. } else {
  50652. buffer = ["\n"];
  50653. baseOffset = originalData.length + 1;
  50654. }
  50655. newXref.set("Size", refForXrefTable.num + 1);
  50656. newXref.set("Prev", xrefInfo.startXRef);
  50657. newXref.set("Type", _primitives.Name.get("XRef"));
  50658. if (xrefInfo.rootRef !== null) {
  50659. newXref.set("Root", xrefInfo.rootRef);
  50660. }
  50661. if (xrefInfo.infoRef !== null) {
  50662. newXref.set("Info", xrefInfo.infoRef);
  50663. }
  50664. if (xrefInfo.encryptRef !== null) {
  50665. newXref.set("Encrypt", xrefInfo.encryptRef);
  50666. }
  50667. newRefs.push({
  50668. ref: refForXrefTable,
  50669. data: ""
  50670. });
  50671. newRefs = newRefs.sort((a, b) => {
  50672. return a.ref.num - b.ref.num;
  50673. });
  50674. const xrefTableData = [[0, 1, 0xffff]];
  50675. const indexes = [0, 1];
  50676. let maxOffset = 0;
  50677. for (const {
  50678. ref,
  50679. data
  50680. } of newRefs) {
  50681. maxOffset = Math.max(maxOffset, baseOffset);
  50682. xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]);
  50683. baseOffset += data.length;
  50684. indexes.push(ref.num, 1);
  50685. buffer.push(data);
  50686. }
  50687. newXref.set("Index", indexes);
  50688. if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) {
  50689. const md5 = computeMD5(baseOffset, xrefInfo);
  50690. newXref.set("ID", [xrefInfo.fileIds[0], md5]);
  50691. }
  50692. const offsetSize = Math.ceil(Math.log2(maxOffset) / 8);
  50693. const sizes = [1, offsetSize, 2];
  50694. const structSize = sizes[0] + sizes[1] + sizes[2];
  50695. const tableLength = structSize * xrefTableData.length;
  50696. newXref.set("W", sizes);
  50697. newXref.set("Length", tableLength);
  50698. buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`);
  50699. writeDict(newXref, buffer, null);
  50700. buffer.push(" stream\n");
  50701. const bufferLen = buffer.reduce((a, str) => a + str.length, 0);
  50702. const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`;
  50703. const array = new Uint8Array(originalData.length + bufferLen + tableLength + footer.length);
  50704. array.set(originalData);
  50705. let offset = originalData.length;
  50706. for (const str of buffer) {
  50707. writeString(str, offset, array);
  50708. offset += str.length;
  50709. }
  50710. for (const [type, objOffset, gen] of xrefTableData) {
  50711. offset = writeInt(type, sizes[0], offset, array);
  50712. offset = writeInt(objOffset, sizes[1], offset, array);
  50713. offset = writeInt(gen, sizes[2], offset, array);
  50714. }
  50715. writeString(footer, offset, array);
  50716. return array;
  50717. }
  50718. /***/ }),
  50719. /* 191 */
  50720. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50721. "use strict";
  50722. Object.defineProperty(exports, "__esModule", ({
  50723. value: true
  50724. }));
  50725. exports.XMLParserErrorCode = exports.XMLParserBase = exports.SimpleXMLParser = exports.SimpleDOMNode = void 0;
  50726. var _core_utils = __w_pdfjs_require__(131);
  50727. const XMLParserErrorCode = {
  50728. NoError: 0,
  50729. EndOfDocument: -1,
  50730. UnterminatedCdat: -2,
  50731. UnterminatedXmlDeclaration: -3,
  50732. UnterminatedDoctypeDeclaration: -4,
  50733. UnterminatedComment: -5,
  50734. MalformedElement: -6,
  50735. OutOfMemory: -7,
  50736. UnterminatedAttributeValue: -8,
  50737. UnterminatedElement: -9,
  50738. ElementNeverBegun: -10
  50739. };
  50740. exports.XMLParserErrorCode = XMLParserErrorCode;
  50741. function isWhitespace(s, index) {
  50742. const ch = s[index];
  50743. return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
  50744. }
  50745. function isWhitespaceString(s) {
  50746. for (let i = 0, ii = s.length; i < ii; i++) {
  50747. if (!isWhitespace(s, i)) {
  50748. return false;
  50749. }
  50750. }
  50751. return true;
  50752. }
  50753. class XMLParserBase {
  50754. _resolveEntities(s) {
  50755. return s.replace(/&([^;]+);/g, (all, entity) => {
  50756. if (entity.substring(0, 2) === "#x") {
  50757. return String.fromCodePoint(parseInt(entity.substring(2), 16));
  50758. } else if (entity.substring(0, 1) === "#") {
  50759. return String.fromCodePoint(parseInt(entity.substring(1), 10));
  50760. }
  50761. switch (entity) {
  50762. case "lt":
  50763. return "<";
  50764. case "gt":
  50765. return ">";
  50766. case "amp":
  50767. return "&";
  50768. case "quot":
  50769. return '"';
  50770. case "apos":
  50771. return "'";
  50772. }
  50773. return this.onResolveEntity(entity);
  50774. });
  50775. }
  50776. _parseContent(s, start) {
  50777. const attributes = [];
  50778. let pos = start;
  50779. function skipWs() {
  50780. while (pos < s.length && isWhitespace(s, pos)) {
  50781. ++pos;
  50782. }
  50783. }
  50784. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  50785. ++pos;
  50786. }
  50787. const name = s.substring(start, pos);
  50788. skipWs();
  50789. while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
  50790. skipWs();
  50791. let attrName = "",
  50792. attrValue = "";
  50793. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
  50794. attrName += s[pos];
  50795. ++pos;
  50796. }
  50797. skipWs();
  50798. if (s[pos] !== "=") {
  50799. return null;
  50800. }
  50801. ++pos;
  50802. skipWs();
  50803. const attrEndChar = s[pos];
  50804. if (attrEndChar !== '"' && attrEndChar !== "'") {
  50805. return null;
  50806. }
  50807. const attrEndIndex = s.indexOf(attrEndChar, ++pos);
  50808. if (attrEndIndex < 0) {
  50809. return null;
  50810. }
  50811. attrValue = s.substring(pos, attrEndIndex);
  50812. attributes.push({
  50813. name: attrName,
  50814. value: this._resolveEntities(attrValue)
  50815. });
  50816. pos = attrEndIndex + 1;
  50817. skipWs();
  50818. }
  50819. return {
  50820. name,
  50821. attributes,
  50822. parsed: pos - start
  50823. };
  50824. }
  50825. _parseProcessingInstruction(s, start) {
  50826. let pos = start;
  50827. function skipWs() {
  50828. while (pos < s.length && isWhitespace(s, pos)) {
  50829. ++pos;
  50830. }
  50831. }
  50832. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") {
  50833. ++pos;
  50834. }
  50835. const name = s.substring(start, pos);
  50836. skipWs();
  50837. const attrStart = pos;
  50838. while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
  50839. ++pos;
  50840. }
  50841. const value = s.substring(attrStart, pos);
  50842. return {
  50843. name,
  50844. value,
  50845. parsed: pos - start
  50846. };
  50847. }
  50848. parseXml(s) {
  50849. let i = 0;
  50850. while (i < s.length) {
  50851. const ch = s[i];
  50852. let j = i;
  50853. if (ch === "<") {
  50854. ++j;
  50855. const ch2 = s[j];
  50856. let q;
  50857. switch (ch2) {
  50858. case "/":
  50859. ++j;
  50860. q = s.indexOf(">", j);
  50861. if (q < 0) {
  50862. this.onError(XMLParserErrorCode.UnterminatedElement);
  50863. return;
  50864. }
  50865. this.onEndElement(s.substring(j, q));
  50866. j = q + 1;
  50867. break;
  50868. case "?":
  50869. ++j;
  50870. const pi = this._parseProcessingInstruction(s, j);
  50871. if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
  50872. this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
  50873. return;
  50874. }
  50875. this.onPi(pi.name, pi.value);
  50876. j += pi.parsed + 2;
  50877. break;
  50878. case "!":
  50879. if (s.substring(j + 1, j + 3) === "--") {
  50880. q = s.indexOf("-->", j + 3);
  50881. if (q < 0) {
  50882. this.onError(XMLParserErrorCode.UnterminatedComment);
  50883. return;
  50884. }
  50885. this.onComment(s.substring(j + 3, q));
  50886. j = q + 3;
  50887. } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
  50888. q = s.indexOf("]]>", j + 8);
  50889. if (q < 0) {
  50890. this.onError(XMLParserErrorCode.UnterminatedCdat);
  50891. return;
  50892. }
  50893. this.onCdata(s.substring(j + 8, q));
  50894. j = q + 3;
  50895. } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
  50896. const q2 = s.indexOf("[", j + 8);
  50897. let complexDoctype = false;
  50898. q = s.indexOf(">", j + 8);
  50899. if (q < 0) {
  50900. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  50901. return;
  50902. }
  50903. if (q2 > 0 && q > q2) {
  50904. q = s.indexOf("]>", j + 8);
  50905. if (q < 0) {
  50906. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  50907. return;
  50908. }
  50909. complexDoctype = true;
  50910. }
  50911. const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
  50912. this.onDoctype(doctypeContent);
  50913. j = q + (complexDoctype ? 2 : 1);
  50914. } else {
  50915. this.onError(XMLParserErrorCode.MalformedElement);
  50916. return;
  50917. }
  50918. break;
  50919. default:
  50920. const content = this._parseContent(s, j);
  50921. if (content === null) {
  50922. this.onError(XMLParserErrorCode.MalformedElement);
  50923. return;
  50924. }
  50925. let isClosed = false;
  50926. if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
  50927. isClosed = true;
  50928. } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
  50929. this.onError(XMLParserErrorCode.UnterminatedElement);
  50930. return;
  50931. }
  50932. this.onBeginElement(content.name, content.attributes, isClosed);
  50933. j += content.parsed + (isClosed ? 2 : 1);
  50934. break;
  50935. }
  50936. } else {
  50937. while (j < s.length && s[j] !== "<") {
  50938. j++;
  50939. }
  50940. const text = s.substring(i, j);
  50941. this.onText(this._resolveEntities(text));
  50942. }
  50943. i = j;
  50944. }
  50945. }
  50946. onResolveEntity(name) {
  50947. return `&${name};`;
  50948. }
  50949. onPi(name, value) {}
  50950. onComment(text) {}
  50951. onCdata(text) {}
  50952. onDoctype(doctypeContent) {}
  50953. onText(text) {}
  50954. onBeginElement(name, attributes, isEmpty) {}
  50955. onEndElement(name) {}
  50956. onError(code) {}
  50957. }
  50958. exports.XMLParserBase = XMLParserBase;
  50959. class SimpleDOMNode {
  50960. constructor(nodeName, nodeValue) {
  50961. this.nodeName = nodeName;
  50962. this.nodeValue = nodeValue;
  50963. Object.defineProperty(this, "parentNode", {
  50964. value: null,
  50965. writable: true
  50966. });
  50967. }
  50968. get firstChild() {
  50969. return this.childNodes && this.childNodes[0];
  50970. }
  50971. get nextSibling() {
  50972. const childNodes = this.parentNode.childNodes;
  50973. if (!childNodes) {
  50974. return undefined;
  50975. }
  50976. const index = childNodes.indexOf(this);
  50977. if (index === -1) {
  50978. return undefined;
  50979. }
  50980. return childNodes[index + 1];
  50981. }
  50982. get textContent() {
  50983. if (!this.childNodes) {
  50984. return this.nodeValue || "";
  50985. }
  50986. return this.childNodes.map(function (child) {
  50987. return child.textContent;
  50988. }).join("");
  50989. }
  50990. get children() {
  50991. return this.childNodes || [];
  50992. }
  50993. hasChildNodes() {
  50994. return this.childNodes && this.childNodes.length > 0;
  50995. }
  50996. searchNode(paths, pos) {
  50997. if (pos >= paths.length) {
  50998. return this;
  50999. }
  51000. const component = paths[pos];
  51001. const stack = [];
  51002. let node = this;
  51003. while (true) {
  51004. if (component.name === node.nodeName) {
  51005. if (component.pos === 0) {
  51006. const res = node.searchNode(paths, pos + 1);
  51007. if (res !== null) {
  51008. return res;
  51009. }
  51010. } else if (stack.length === 0) {
  51011. return null;
  51012. } else {
  51013. const [parent] = stack.pop();
  51014. let siblingPos = 0;
  51015. for (const child of parent.childNodes) {
  51016. if (component.name === child.nodeName) {
  51017. if (siblingPos === component.pos) {
  51018. return child.searchNode(paths, pos + 1);
  51019. }
  51020. siblingPos++;
  51021. }
  51022. }
  51023. return node.searchNode(paths, pos + 1);
  51024. }
  51025. }
  51026. if (node.childNodes && node.childNodes.length !== 0) {
  51027. stack.push([node, 0]);
  51028. node = node.childNodes[0];
  51029. } else if (stack.length === 0) {
  51030. return null;
  51031. } else {
  51032. while (stack.length !== 0) {
  51033. const [parent, currentPos] = stack.pop();
  51034. const newPos = currentPos + 1;
  51035. if (newPos < parent.childNodes.length) {
  51036. stack.push([parent, newPos]);
  51037. node = parent.childNodes[newPos];
  51038. break;
  51039. }
  51040. }
  51041. if (stack.length === 0) {
  51042. return null;
  51043. }
  51044. }
  51045. }
  51046. }
  51047. dump(buffer) {
  51048. if (this.nodeName === "#text") {
  51049. buffer.push((0, _core_utils.encodeToXmlString)(this.nodeValue));
  51050. return;
  51051. }
  51052. buffer.push(`<${this.nodeName}`);
  51053. if (this.attributes) {
  51054. for (const attribute of this.attributes) {
  51055. buffer.push(` ${attribute.name}="${(0, _core_utils.encodeToXmlString)(attribute.value)}"`);
  51056. }
  51057. }
  51058. if (this.hasChildNodes()) {
  51059. buffer.push(">");
  51060. for (const child of this.childNodes) {
  51061. child.dump(buffer);
  51062. }
  51063. buffer.push(`</${this.nodeName}>`);
  51064. } else if (this.nodeValue) {
  51065. buffer.push(`>${(0, _core_utils.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`);
  51066. } else {
  51067. buffer.push("/>");
  51068. }
  51069. }
  51070. }
  51071. exports.SimpleDOMNode = SimpleDOMNode;
  51072. class SimpleXMLParser extends XMLParserBase {
  51073. constructor(_ref) {
  51074. let {
  51075. hasAttributes = false,
  51076. lowerCaseName = false
  51077. } = _ref;
  51078. super();
  51079. this._currentFragment = null;
  51080. this._stack = null;
  51081. this._errorCode = XMLParserErrorCode.NoError;
  51082. this._hasAttributes = hasAttributes;
  51083. this._lowerCaseName = lowerCaseName;
  51084. }
  51085. parseFromString(data) {
  51086. this._currentFragment = [];
  51087. this._stack = [];
  51088. this._errorCode = XMLParserErrorCode.NoError;
  51089. this.parseXml(data);
  51090. if (this._errorCode !== XMLParserErrorCode.NoError) {
  51091. return undefined;
  51092. }
  51093. const [documentElement] = this._currentFragment;
  51094. if (!documentElement) {
  51095. return undefined;
  51096. }
  51097. return {
  51098. documentElement
  51099. };
  51100. }
  51101. onText(text) {
  51102. if (isWhitespaceString(text)) {
  51103. return;
  51104. }
  51105. const node = new SimpleDOMNode("#text", text);
  51106. this._currentFragment.push(node);
  51107. }
  51108. onCdata(text) {
  51109. const node = new SimpleDOMNode("#text", text);
  51110. this._currentFragment.push(node);
  51111. }
  51112. onBeginElement(name, attributes, isEmpty) {
  51113. if (this._lowerCaseName) {
  51114. name = name.toLowerCase();
  51115. }
  51116. const node = new SimpleDOMNode(name);
  51117. node.childNodes = [];
  51118. if (this._hasAttributes) {
  51119. node.attributes = attributes;
  51120. }
  51121. this._currentFragment.push(node);
  51122. if (isEmpty) {
  51123. return;
  51124. }
  51125. this._stack.push(this._currentFragment);
  51126. this._currentFragment = node.childNodes;
  51127. }
  51128. onEndElement(name) {
  51129. this._currentFragment = this._stack.pop() || [];
  51130. const lastElement = this._currentFragment.at(-1);
  51131. if (!lastElement) {
  51132. return null;
  51133. }
  51134. for (let i = 0, ii = lastElement.childNodes.length; i < ii; i++) {
  51135. lastElement.childNodes[i].parentNode = lastElement;
  51136. }
  51137. return lastElement;
  51138. }
  51139. onError(code) {
  51140. this._errorCode = code;
  51141. }
  51142. }
  51143. exports.SimpleXMLParser = SimpleXMLParser;
  51144. /***/ }),
  51145. /* 192 */
  51146. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51147. "use strict";
  51148. Object.defineProperty(exports, "__esModule", ({
  51149. value: true
  51150. }));
  51151. exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
  51152. exports.calculateSHA384 = calculateSHA384;
  51153. exports.calculateSHA512 = void 0;
  51154. var _util = __w_pdfjs_require__(2);
  51155. var _primitives = __w_pdfjs_require__(130);
  51156. var _decrypt_stream = __w_pdfjs_require__(193);
  51157. class ARCFourCipher {
  51158. constructor(key) {
  51159. this.a = 0;
  51160. this.b = 0;
  51161. const s = new Uint8Array(256);
  51162. const keyLength = key.length;
  51163. for (let i = 0; i < 256; ++i) {
  51164. s[i] = i;
  51165. }
  51166. for (let i = 0, j = 0; i < 256; ++i) {
  51167. const tmp = s[i];
  51168. j = j + tmp + key[i % keyLength] & 0xff;
  51169. s[i] = s[j];
  51170. s[j] = tmp;
  51171. }
  51172. this.s = s;
  51173. }
  51174. encryptBlock(data) {
  51175. let a = this.a,
  51176. b = this.b;
  51177. const s = this.s;
  51178. const n = data.length;
  51179. const output = new Uint8Array(n);
  51180. for (let i = 0; i < n; ++i) {
  51181. a = a + 1 & 0xff;
  51182. const tmp = s[a];
  51183. b = b + tmp & 0xff;
  51184. const tmp2 = s[b];
  51185. s[a] = tmp2;
  51186. s[b] = tmp;
  51187. output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
  51188. }
  51189. this.a = a;
  51190. this.b = b;
  51191. return output;
  51192. }
  51193. decryptBlock(data) {
  51194. return this.encryptBlock(data);
  51195. }
  51196. encrypt(data) {
  51197. return this.encryptBlock(data);
  51198. }
  51199. }
  51200. exports.ARCFourCipher = ARCFourCipher;
  51201. const calculateMD5 = function calculateMD5Closure() {
  51202. 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]);
  51203. 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]);
  51204. function hash(data, offset, length) {
  51205. let h0 = 1732584193,
  51206. h1 = -271733879,
  51207. h2 = -1732584194,
  51208. h3 = 271733878;
  51209. const paddedLength = length + 72 & ~63;
  51210. const padded = new Uint8Array(paddedLength);
  51211. let i, j;
  51212. for (i = 0; i < length; ++i) {
  51213. padded[i] = data[offset++];
  51214. }
  51215. padded[i++] = 0x80;
  51216. const n = paddedLength - 8;
  51217. while (i < n) {
  51218. padded[i++] = 0;
  51219. }
  51220. padded[i++] = length << 3 & 0xff;
  51221. padded[i++] = length >> 5 & 0xff;
  51222. padded[i++] = length >> 13 & 0xff;
  51223. padded[i++] = length >> 21 & 0xff;
  51224. padded[i++] = length >>> 29 & 0xff;
  51225. padded[i++] = 0;
  51226. padded[i++] = 0;
  51227. padded[i++] = 0;
  51228. const w = new Int32Array(16);
  51229. for (i = 0; i < paddedLength;) {
  51230. for (j = 0; j < 16; ++j, i += 4) {
  51231. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  51232. }
  51233. let a = h0,
  51234. b = h1,
  51235. c = h2,
  51236. d = h3,
  51237. f,
  51238. g;
  51239. for (j = 0; j < 64; ++j) {
  51240. if (j < 16) {
  51241. f = b & c | ~b & d;
  51242. g = j;
  51243. } else if (j < 32) {
  51244. f = d & b | ~d & c;
  51245. g = 5 * j + 1 & 15;
  51246. } else if (j < 48) {
  51247. f = b ^ c ^ d;
  51248. g = 3 * j + 5 & 15;
  51249. } else {
  51250. f = c ^ (b | ~d);
  51251. g = 7 * j & 15;
  51252. }
  51253. const tmp = d,
  51254. rotateArg = a + f + k[j] + w[g] | 0,
  51255. rotate = r[j];
  51256. d = c;
  51257. c = b;
  51258. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  51259. a = tmp;
  51260. }
  51261. h0 = h0 + a | 0;
  51262. h1 = h1 + b | 0;
  51263. h2 = h2 + c | 0;
  51264. h3 = h3 + d | 0;
  51265. }
  51266. 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]);
  51267. }
  51268. return hash;
  51269. }();
  51270. exports.calculateMD5 = calculateMD5;
  51271. class Word64 {
  51272. constructor(highInteger, lowInteger) {
  51273. this.high = highInteger | 0;
  51274. this.low = lowInteger | 0;
  51275. }
  51276. and(word) {
  51277. this.high &= word.high;
  51278. this.low &= word.low;
  51279. }
  51280. xor(word) {
  51281. this.high ^= word.high;
  51282. this.low ^= word.low;
  51283. }
  51284. or(word) {
  51285. this.high |= word.high;
  51286. this.low |= word.low;
  51287. }
  51288. shiftRight(places) {
  51289. if (places >= 32) {
  51290. this.low = this.high >>> places - 32 | 0;
  51291. this.high = 0;
  51292. } else {
  51293. this.low = this.low >>> places | this.high << 32 - places;
  51294. this.high = this.high >>> places | 0;
  51295. }
  51296. }
  51297. shiftLeft(places) {
  51298. if (places >= 32) {
  51299. this.high = this.low << places - 32;
  51300. this.low = 0;
  51301. } else {
  51302. this.high = this.high << places | this.low >>> 32 - places;
  51303. this.low <<= places;
  51304. }
  51305. }
  51306. rotateRight(places) {
  51307. let low, high;
  51308. if (places & 32) {
  51309. high = this.low;
  51310. low = this.high;
  51311. } else {
  51312. low = this.low;
  51313. high = this.high;
  51314. }
  51315. places &= 31;
  51316. this.low = low >>> places | high << 32 - places;
  51317. this.high = high >>> places | low << 32 - places;
  51318. }
  51319. not() {
  51320. this.high = ~this.high;
  51321. this.low = ~this.low;
  51322. }
  51323. add(word) {
  51324. const lowAdd = (this.low >>> 0) + (word.low >>> 0);
  51325. let highAdd = (this.high >>> 0) + (word.high >>> 0);
  51326. if (lowAdd > 0xffffffff) {
  51327. highAdd += 1;
  51328. }
  51329. this.low = lowAdd | 0;
  51330. this.high = highAdd | 0;
  51331. }
  51332. copyTo(bytes, offset) {
  51333. bytes[offset] = this.high >>> 24 & 0xff;
  51334. bytes[offset + 1] = this.high >> 16 & 0xff;
  51335. bytes[offset + 2] = this.high >> 8 & 0xff;
  51336. bytes[offset + 3] = this.high & 0xff;
  51337. bytes[offset + 4] = this.low >>> 24 & 0xff;
  51338. bytes[offset + 5] = this.low >> 16 & 0xff;
  51339. bytes[offset + 6] = this.low >> 8 & 0xff;
  51340. bytes[offset + 7] = this.low & 0xff;
  51341. }
  51342. assign(word) {
  51343. this.high = word.high;
  51344. this.low = word.low;
  51345. }
  51346. }
  51347. const calculateSHA256 = function calculateSHA256Closure() {
  51348. function rotr(x, n) {
  51349. return x >>> n | x << 32 - n;
  51350. }
  51351. function ch(x, y, z) {
  51352. return x & y ^ ~x & z;
  51353. }
  51354. function maj(x, y, z) {
  51355. return x & y ^ x & z ^ y & z;
  51356. }
  51357. function sigma(x) {
  51358. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  51359. }
  51360. function sigmaPrime(x) {
  51361. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  51362. }
  51363. function littleSigma(x) {
  51364. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  51365. }
  51366. function littleSigmaPrime(x) {
  51367. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  51368. }
  51369. 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];
  51370. function hash(data, offset, length) {
  51371. let h0 = 0x6a09e667,
  51372. h1 = 0xbb67ae85,
  51373. h2 = 0x3c6ef372,
  51374. h3 = 0xa54ff53a,
  51375. h4 = 0x510e527f,
  51376. h5 = 0x9b05688c,
  51377. h6 = 0x1f83d9ab,
  51378. h7 = 0x5be0cd19;
  51379. const paddedLength = Math.ceil((length + 9) / 64) * 64;
  51380. const padded = new Uint8Array(paddedLength);
  51381. let i, j;
  51382. for (i = 0; i < length; ++i) {
  51383. padded[i] = data[offset++];
  51384. }
  51385. padded[i++] = 0x80;
  51386. const n = paddedLength - 8;
  51387. while (i < n) {
  51388. padded[i++] = 0;
  51389. }
  51390. padded[i++] = 0;
  51391. padded[i++] = 0;
  51392. padded[i++] = 0;
  51393. padded[i++] = length >>> 29 & 0xff;
  51394. padded[i++] = length >> 21 & 0xff;
  51395. padded[i++] = length >> 13 & 0xff;
  51396. padded[i++] = length >> 5 & 0xff;
  51397. padded[i++] = length << 3 & 0xff;
  51398. const w = new Uint32Array(64);
  51399. for (i = 0; i < paddedLength;) {
  51400. for (j = 0; j < 16; ++j) {
  51401. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  51402. i += 4;
  51403. }
  51404. for (j = 16; j < 64; ++j) {
  51405. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  51406. }
  51407. let a = h0,
  51408. b = h1,
  51409. c = h2,
  51410. d = h3,
  51411. e = h4,
  51412. f = h5,
  51413. g = h6,
  51414. h = h7,
  51415. t1,
  51416. t2;
  51417. for (j = 0; j < 64; ++j) {
  51418. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  51419. t2 = sigma(a) + maj(a, b, c);
  51420. h = g;
  51421. g = f;
  51422. f = e;
  51423. e = d + t1 | 0;
  51424. d = c;
  51425. c = b;
  51426. b = a;
  51427. a = t1 + t2 | 0;
  51428. }
  51429. h0 = h0 + a | 0;
  51430. h1 = h1 + b | 0;
  51431. h2 = h2 + c | 0;
  51432. h3 = h3 + d | 0;
  51433. h4 = h4 + e | 0;
  51434. h5 = h5 + f | 0;
  51435. h6 = h6 + g | 0;
  51436. h7 = h7 + h | 0;
  51437. }
  51438. 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]);
  51439. }
  51440. return hash;
  51441. }();
  51442. exports.calculateSHA256 = calculateSHA256;
  51443. const calculateSHA512 = function calculateSHA512Closure() {
  51444. function ch(result, x, y, z, tmp) {
  51445. result.assign(x);
  51446. result.and(y);
  51447. tmp.assign(x);
  51448. tmp.not();
  51449. tmp.and(z);
  51450. result.xor(tmp);
  51451. }
  51452. function maj(result, x, y, z, tmp) {
  51453. result.assign(x);
  51454. result.and(y);
  51455. tmp.assign(x);
  51456. tmp.and(z);
  51457. result.xor(tmp);
  51458. tmp.assign(y);
  51459. tmp.and(z);
  51460. result.xor(tmp);
  51461. }
  51462. function sigma(result, x, tmp) {
  51463. result.assign(x);
  51464. result.rotateRight(28);
  51465. tmp.assign(x);
  51466. tmp.rotateRight(34);
  51467. result.xor(tmp);
  51468. tmp.assign(x);
  51469. tmp.rotateRight(39);
  51470. result.xor(tmp);
  51471. }
  51472. function sigmaPrime(result, x, tmp) {
  51473. result.assign(x);
  51474. result.rotateRight(14);
  51475. tmp.assign(x);
  51476. tmp.rotateRight(18);
  51477. result.xor(tmp);
  51478. tmp.assign(x);
  51479. tmp.rotateRight(41);
  51480. result.xor(tmp);
  51481. }
  51482. function littleSigma(result, x, tmp) {
  51483. result.assign(x);
  51484. result.rotateRight(1);
  51485. tmp.assign(x);
  51486. tmp.rotateRight(8);
  51487. result.xor(tmp);
  51488. tmp.assign(x);
  51489. tmp.shiftRight(7);
  51490. result.xor(tmp);
  51491. }
  51492. function littleSigmaPrime(result, x, tmp) {
  51493. result.assign(x);
  51494. result.rotateRight(19);
  51495. tmp.assign(x);
  51496. tmp.rotateRight(61);
  51497. result.xor(tmp);
  51498. tmp.assign(x);
  51499. tmp.shiftRight(6);
  51500. result.xor(tmp);
  51501. }
  51502. 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)];
  51503. function hash(data, offset, length) {
  51504. let mode384 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  51505. let h0, h1, h2, h3, h4, h5, h6, h7;
  51506. if (!mode384) {
  51507. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  51508. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  51509. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  51510. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  51511. h4 = new Word64(0x510e527f, 0xade682d1);
  51512. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  51513. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  51514. h7 = new Word64(0x5be0cd19, 0x137e2179);
  51515. } else {
  51516. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  51517. h1 = new Word64(0x629a292a, 0x367cd507);
  51518. h2 = new Word64(0x9159015a, 0x3070dd17);
  51519. h3 = new Word64(0x152fecd8, 0xf70e5939);
  51520. h4 = new Word64(0x67332667, 0xffc00b31);
  51521. h5 = new Word64(0x8eb44a87, 0x68581511);
  51522. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  51523. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  51524. }
  51525. const paddedLength = Math.ceil((length + 17) / 128) * 128;
  51526. const padded = new Uint8Array(paddedLength);
  51527. let i, j;
  51528. for (i = 0; i < length; ++i) {
  51529. padded[i] = data[offset++];
  51530. }
  51531. padded[i++] = 0x80;
  51532. const n = paddedLength - 16;
  51533. while (i < n) {
  51534. padded[i++] = 0;
  51535. }
  51536. padded[i++] = 0;
  51537. padded[i++] = 0;
  51538. padded[i++] = 0;
  51539. padded[i++] = 0;
  51540. padded[i++] = 0;
  51541. padded[i++] = 0;
  51542. padded[i++] = 0;
  51543. padded[i++] = 0;
  51544. padded[i++] = 0;
  51545. padded[i++] = 0;
  51546. padded[i++] = 0;
  51547. padded[i++] = length >>> 29 & 0xff;
  51548. padded[i++] = length >> 21 & 0xff;
  51549. padded[i++] = length >> 13 & 0xff;
  51550. padded[i++] = length >> 5 & 0xff;
  51551. padded[i++] = length << 3 & 0xff;
  51552. const w = new Array(80);
  51553. for (i = 0; i < 80; i++) {
  51554. w[i] = new Word64(0, 0);
  51555. }
  51556. let a = new Word64(0, 0),
  51557. b = new Word64(0, 0),
  51558. c = new Word64(0, 0);
  51559. let d = new Word64(0, 0),
  51560. e = new Word64(0, 0),
  51561. f = new Word64(0, 0);
  51562. let g = new Word64(0, 0),
  51563. h = new Word64(0, 0);
  51564. const t1 = new Word64(0, 0),
  51565. t2 = new Word64(0, 0);
  51566. const tmp1 = new Word64(0, 0),
  51567. tmp2 = new Word64(0, 0);
  51568. let tmp3;
  51569. for (i = 0; i < paddedLength;) {
  51570. for (j = 0; j < 16; ++j) {
  51571. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  51572. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  51573. i += 8;
  51574. }
  51575. for (j = 16; j < 80; ++j) {
  51576. tmp3 = w[j];
  51577. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  51578. tmp3.add(w[j - 7]);
  51579. littleSigma(tmp1, w[j - 15], tmp2);
  51580. tmp3.add(tmp1);
  51581. tmp3.add(w[j - 16]);
  51582. }
  51583. a.assign(h0);
  51584. b.assign(h1);
  51585. c.assign(h2);
  51586. d.assign(h3);
  51587. e.assign(h4);
  51588. f.assign(h5);
  51589. g.assign(h6);
  51590. h.assign(h7);
  51591. for (j = 0; j < 80; ++j) {
  51592. t1.assign(h);
  51593. sigmaPrime(tmp1, e, tmp2);
  51594. t1.add(tmp1);
  51595. ch(tmp1, e, f, g, tmp2);
  51596. t1.add(tmp1);
  51597. t1.add(k[j]);
  51598. t1.add(w[j]);
  51599. sigma(t2, a, tmp2);
  51600. maj(tmp1, a, b, c, tmp2);
  51601. t2.add(tmp1);
  51602. tmp3 = h;
  51603. h = g;
  51604. g = f;
  51605. f = e;
  51606. d.add(t1);
  51607. e = d;
  51608. d = c;
  51609. c = b;
  51610. b = a;
  51611. tmp3.assign(t1);
  51612. tmp3.add(t2);
  51613. a = tmp3;
  51614. }
  51615. h0.add(a);
  51616. h1.add(b);
  51617. h2.add(c);
  51618. h3.add(d);
  51619. h4.add(e);
  51620. h5.add(f);
  51621. h6.add(g);
  51622. h7.add(h);
  51623. }
  51624. let result;
  51625. if (!mode384) {
  51626. result = new Uint8Array(64);
  51627. h0.copyTo(result, 0);
  51628. h1.copyTo(result, 8);
  51629. h2.copyTo(result, 16);
  51630. h3.copyTo(result, 24);
  51631. h4.copyTo(result, 32);
  51632. h5.copyTo(result, 40);
  51633. h6.copyTo(result, 48);
  51634. h7.copyTo(result, 56);
  51635. } else {
  51636. result = new Uint8Array(48);
  51637. h0.copyTo(result, 0);
  51638. h1.copyTo(result, 8);
  51639. h2.copyTo(result, 16);
  51640. h3.copyTo(result, 24);
  51641. h4.copyTo(result, 32);
  51642. h5.copyTo(result, 40);
  51643. }
  51644. return result;
  51645. }
  51646. return hash;
  51647. }();
  51648. exports.calculateSHA512 = calculateSHA512;
  51649. function calculateSHA384(data, offset, length) {
  51650. return calculateSHA512(data, offset, length, true);
  51651. }
  51652. class NullCipher {
  51653. decryptBlock(data) {
  51654. return data;
  51655. }
  51656. encrypt(data) {
  51657. return data;
  51658. }
  51659. }
  51660. class AESBaseCipher {
  51661. constructor() {
  51662. if (this.constructor === AESBaseCipher) {
  51663. (0, _util.unreachable)("Cannot initialize AESBaseCipher.");
  51664. }
  51665. 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]);
  51666. 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]);
  51667. 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]);
  51668. this._mixCol = new Uint8Array(256);
  51669. for (let i = 0; i < 256; i++) {
  51670. if (i < 128) {
  51671. this._mixCol[i] = i << 1;
  51672. } else {
  51673. this._mixCol[i] = i << 1 ^ 0x1b;
  51674. }
  51675. }
  51676. this.buffer = new Uint8Array(16);
  51677. this.bufferPosition = 0;
  51678. }
  51679. _expandKey(cipherKey) {
  51680. (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
  51681. }
  51682. _decrypt(input, key) {
  51683. let t, u, v;
  51684. const state = new Uint8Array(16);
  51685. state.set(input);
  51686. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  51687. state[j] ^= key[k];
  51688. }
  51689. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  51690. t = state[13];
  51691. state[13] = state[9];
  51692. state[9] = state[5];
  51693. state[5] = state[1];
  51694. state[1] = t;
  51695. t = state[14];
  51696. u = state[10];
  51697. state[14] = state[6];
  51698. state[10] = state[2];
  51699. state[6] = t;
  51700. state[2] = u;
  51701. t = state[15];
  51702. u = state[11];
  51703. v = state[7];
  51704. state[15] = state[3];
  51705. state[11] = t;
  51706. state[7] = u;
  51707. state[3] = v;
  51708. for (let j = 0; j < 16; ++j) {
  51709. state[j] = this._inv_s[state[j]];
  51710. }
  51711. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  51712. state[j] ^= key[k];
  51713. }
  51714. for (let j = 0; j < 16; j += 4) {
  51715. const s0 = this._mix[state[j]];
  51716. const s1 = this._mix[state[j + 1]];
  51717. const s2 = this._mix[state[j + 2]];
  51718. const s3 = this._mix[state[j + 3]];
  51719. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  51720. state[j] = t >>> 24 & 0xff;
  51721. state[j + 1] = t >> 16 & 0xff;
  51722. state[j + 2] = t >> 8 & 0xff;
  51723. state[j + 3] = t & 0xff;
  51724. }
  51725. }
  51726. t = state[13];
  51727. state[13] = state[9];
  51728. state[9] = state[5];
  51729. state[5] = state[1];
  51730. state[1] = t;
  51731. t = state[14];
  51732. u = state[10];
  51733. state[14] = state[6];
  51734. state[10] = state[2];
  51735. state[6] = t;
  51736. state[2] = u;
  51737. t = state[15];
  51738. u = state[11];
  51739. v = state[7];
  51740. state[15] = state[3];
  51741. state[11] = t;
  51742. state[7] = u;
  51743. state[3] = v;
  51744. for (let j = 0; j < 16; ++j) {
  51745. state[j] = this._inv_s[state[j]];
  51746. state[j] ^= key[j];
  51747. }
  51748. return state;
  51749. }
  51750. _encrypt(input, key) {
  51751. const s = this._s;
  51752. let t, u, v;
  51753. const state = new Uint8Array(16);
  51754. state.set(input);
  51755. for (let j = 0; j < 16; ++j) {
  51756. state[j] ^= key[j];
  51757. }
  51758. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  51759. for (let j = 0; j < 16; ++j) {
  51760. state[j] = s[state[j]];
  51761. }
  51762. v = state[1];
  51763. state[1] = state[5];
  51764. state[5] = state[9];
  51765. state[9] = state[13];
  51766. state[13] = v;
  51767. v = state[2];
  51768. u = state[6];
  51769. state[2] = state[10];
  51770. state[6] = state[14];
  51771. state[10] = v;
  51772. state[14] = u;
  51773. v = state[3];
  51774. u = state[7];
  51775. t = state[11];
  51776. state[3] = state[15];
  51777. state[7] = v;
  51778. state[11] = u;
  51779. state[15] = t;
  51780. for (let j = 0; j < 16; j += 4) {
  51781. const s0 = state[j + 0];
  51782. const s1 = state[j + 1];
  51783. const s2 = state[j + 2];
  51784. const s3 = state[j + 3];
  51785. t = s0 ^ s1 ^ s2 ^ s3;
  51786. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  51787. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  51788. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  51789. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  51790. }
  51791. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  51792. state[j] ^= key[k];
  51793. }
  51794. }
  51795. for (let j = 0; j < 16; ++j) {
  51796. state[j] = s[state[j]];
  51797. }
  51798. v = state[1];
  51799. state[1] = state[5];
  51800. state[5] = state[9];
  51801. state[9] = state[13];
  51802. state[13] = v;
  51803. v = state[2];
  51804. u = state[6];
  51805. state[2] = state[10];
  51806. state[6] = state[14];
  51807. state[10] = v;
  51808. state[14] = u;
  51809. v = state[3];
  51810. u = state[7];
  51811. t = state[11];
  51812. state[3] = state[15];
  51813. state[7] = v;
  51814. state[11] = u;
  51815. state[15] = t;
  51816. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  51817. state[j] ^= key[k];
  51818. }
  51819. return state;
  51820. }
  51821. _decryptBlock2(data, finalize) {
  51822. const sourceLength = data.length;
  51823. let buffer = this.buffer,
  51824. bufferLength = this.bufferPosition;
  51825. const result = [];
  51826. let iv = this.iv;
  51827. for (let i = 0; i < sourceLength; ++i) {
  51828. buffer[bufferLength] = data[i];
  51829. ++bufferLength;
  51830. if (bufferLength < 16) {
  51831. continue;
  51832. }
  51833. const plain = this._decrypt(buffer, this._key);
  51834. for (let j = 0; j < 16; ++j) {
  51835. plain[j] ^= iv[j];
  51836. }
  51837. iv = buffer;
  51838. result.push(plain);
  51839. buffer = new Uint8Array(16);
  51840. bufferLength = 0;
  51841. }
  51842. this.buffer = buffer;
  51843. this.bufferLength = bufferLength;
  51844. this.iv = iv;
  51845. if (result.length === 0) {
  51846. return new Uint8Array(0);
  51847. }
  51848. let outputLength = 16 * result.length;
  51849. if (finalize) {
  51850. const lastBlock = result.at(-1);
  51851. let psLen = lastBlock[15];
  51852. if (psLen <= 16) {
  51853. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  51854. if (lastBlock[i] !== psLen) {
  51855. psLen = 0;
  51856. break;
  51857. }
  51858. }
  51859. outputLength -= psLen;
  51860. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  51861. }
  51862. }
  51863. const output = new Uint8Array(outputLength);
  51864. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  51865. output.set(result[i], j);
  51866. }
  51867. return output;
  51868. }
  51869. decryptBlock(data, finalize) {
  51870. let iv = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  51871. const sourceLength = data.length;
  51872. const buffer = this.buffer;
  51873. let bufferLength = this.bufferPosition;
  51874. if (iv) {
  51875. this.iv = iv;
  51876. } else {
  51877. for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  51878. buffer[bufferLength] = data[i];
  51879. }
  51880. if (bufferLength < 16) {
  51881. this.bufferLength = bufferLength;
  51882. return new Uint8Array(0);
  51883. }
  51884. this.iv = buffer;
  51885. data = data.subarray(16);
  51886. }
  51887. this.buffer = new Uint8Array(16);
  51888. this.bufferLength = 0;
  51889. this.decryptBlock = this._decryptBlock2;
  51890. return this.decryptBlock(data, finalize);
  51891. }
  51892. encrypt(data, iv) {
  51893. const sourceLength = data.length;
  51894. let buffer = this.buffer,
  51895. bufferLength = this.bufferPosition;
  51896. const result = [];
  51897. if (!iv) {
  51898. iv = new Uint8Array(16);
  51899. }
  51900. for (let i = 0; i < sourceLength; ++i) {
  51901. buffer[bufferLength] = data[i];
  51902. ++bufferLength;
  51903. if (bufferLength < 16) {
  51904. continue;
  51905. }
  51906. for (let j = 0; j < 16; ++j) {
  51907. buffer[j] ^= iv[j];
  51908. }
  51909. const cipher = this._encrypt(buffer, this._key);
  51910. iv = cipher;
  51911. result.push(cipher);
  51912. buffer = new Uint8Array(16);
  51913. bufferLength = 0;
  51914. }
  51915. this.buffer = buffer;
  51916. this.bufferLength = bufferLength;
  51917. this.iv = iv;
  51918. if (result.length === 0) {
  51919. return new Uint8Array(0);
  51920. }
  51921. const outputLength = 16 * result.length;
  51922. const output = new Uint8Array(outputLength);
  51923. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  51924. output.set(result[i], j);
  51925. }
  51926. return output;
  51927. }
  51928. }
  51929. class AES128Cipher extends AESBaseCipher {
  51930. constructor(key) {
  51931. super();
  51932. this._cyclesOfRepetition = 10;
  51933. this._keySize = 160;
  51934. 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]);
  51935. this._key = this._expandKey(key);
  51936. }
  51937. _expandKey(cipherKey) {
  51938. const b = 176;
  51939. const s = this._s;
  51940. const rcon = this._rcon;
  51941. const result = new Uint8Array(b);
  51942. result.set(cipherKey);
  51943. for (let j = 16, i = 1; j < b; ++i) {
  51944. let t1 = result[j - 3];
  51945. let t2 = result[j - 2];
  51946. let t3 = result[j - 1];
  51947. let t4 = result[j - 4];
  51948. t1 = s[t1];
  51949. t2 = s[t2];
  51950. t3 = s[t3];
  51951. t4 = s[t4];
  51952. t1 ^= rcon[i];
  51953. for (let n = 0; n < 4; ++n) {
  51954. result[j] = t1 ^= result[j - 16];
  51955. j++;
  51956. result[j] = t2 ^= result[j - 16];
  51957. j++;
  51958. result[j] = t3 ^= result[j - 16];
  51959. j++;
  51960. result[j] = t4 ^= result[j - 16];
  51961. j++;
  51962. }
  51963. }
  51964. return result;
  51965. }
  51966. }
  51967. exports.AES128Cipher = AES128Cipher;
  51968. class AES256Cipher extends AESBaseCipher {
  51969. constructor(key) {
  51970. super();
  51971. this._cyclesOfRepetition = 14;
  51972. this._keySize = 224;
  51973. this._key = this._expandKey(key);
  51974. }
  51975. _expandKey(cipherKey) {
  51976. const b = 240;
  51977. const s = this._s;
  51978. const result = new Uint8Array(b);
  51979. result.set(cipherKey);
  51980. let r = 1;
  51981. let t1, t2, t3, t4;
  51982. for (let j = 32, i = 1; j < b; ++i) {
  51983. if (j % 32 === 16) {
  51984. t1 = s[t1];
  51985. t2 = s[t2];
  51986. t3 = s[t3];
  51987. t4 = s[t4];
  51988. } else if (j % 32 === 0) {
  51989. t1 = result[j - 3];
  51990. t2 = result[j - 2];
  51991. t3 = result[j - 1];
  51992. t4 = result[j - 4];
  51993. t1 = s[t1];
  51994. t2 = s[t2];
  51995. t3 = s[t3];
  51996. t4 = s[t4];
  51997. t1 ^= r;
  51998. if ((r <<= 1) >= 256) {
  51999. r = (r ^ 0x1b) & 0xff;
  52000. }
  52001. }
  52002. for (let n = 0; n < 4; ++n) {
  52003. result[j] = t1 ^= result[j - 32];
  52004. j++;
  52005. result[j] = t2 ^= result[j - 32];
  52006. j++;
  52007. result[j] = t3 ^= result[j - 32];
  52008. j++;
  52009. result[j] = t4 ^= result[j - 32];
  52010. j++;
  52011. }
  52012. }
  52013. return result;
  52014. }
  52015. }
  52016. exports.AES256Cipher = AES256Cipher;
  52017. class PDF17 {
  52018. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  52019. const hashData = new Uint8Array(password.length + 56);
  52020. hashData.set(password, 0);
  52021. hashData.set(ownerValidationSalt, password.length);
  52022. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  52023. const result = calculateSHA256(hashData, 0, hashData.length);
  52024. return (0, _util.isArrayEqual)(result, ownerPassword);
  52025. }
  52026. checkUserPassword(password, userValidationSalt, userPassword) {
  52027. const hashData = new Uint8Array(password.length + 8);
  52028. hashData.set(password, 0);
  52029. hashData.set(userValidationSalt, password.length);
  52030. const result = calculateSHA256(hashData, 0, hashData.length);
  52031. return (0, _util.isArrayEqual)(result, userPassword);
  52032. }
  52033. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  52034. const hashData = new Uint8Array(password.length + 56);
  52035. hashData.set(password, 0);
  52036. hashData.set(ownerKeySalt, password.length);
  52037. hashData.set(userBytes, password.length + ownerKeySalt.length);
  52038. const key = calculateSHA256(hashData, 0, hashData.length);
  52039. const cipher = new AES256Cipher(key);
  52040. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  52041. }
  52042. getUserKey(password, userKeySalt, userEncryption) {
  52043. const hashData = new Uint8Array(password.length + 8);
  52044. hashData.set(password, 0);
  52045. hashData.set(userKeySalt, password.length);
  52046. const key = calculateSHA256(hashData, 0, hashData.length);
  52047. const cipher = new AES256Cipher(key);
  52048. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  52049. }
  52050. }
  52051. exports.PDF17 = PDF17;
  52052. const PDF20 = function PDF20Closure() {
  52053. function calculatePDF20Hash(password, input, userBytes) {
  52054. let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  52055. let e = [0];
  52056. let i = 0;
  52057. while (i < 64 || e.at(-1) > i - 32) {
  52058. const combinedLength = password.length + k.length + userBytes.length,
  52059. combinedArray = new Uint8Array(combinedLength);
  52060. let writeOffset = 0;
  52061. combinedArray.set(password, writeOffset);
  52062. writeOffset += password.length;
  52063. combinedArray.set(k, writeOffset);
  52064. writeOffset += k.length;
  52065. combinedArray.set(userBytes, writeOffset);
  52066. const k1 = new Uint8Array(combinedLength * 64);
  52067. for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) {
  52068. k1.set(combinedArray, pos);
  52069. }
  52070. const cipher = new AES128Cipher(k.subarray(0, 16));
  52071. e = cipher.encrypt(k1, k.subarray(16, 32));
  52072. let remainder = 0;
  52073. for (let z = 0; z < 16; z++) {
  52074. remainder *= 256 % 3;
  52075. remainder %= 3;
  52076. remainder += (e[z] >>> 0) % 3;
  52077. remainder %= 3;
  52078. }
  52079. if (remainder === 0) {
  52080. k = calculateSHA256(e, 0, e.length);
  52081. } else if (remainder === 1) {
  52082. k = calculateSHA384(e, 0, e.length);
  52083. } else if (remainder === 2) {
  52084. k = calculateSHA512(e, 0, e.length);
  52085. }
  52086. i++;
  52087. }
  52088. return k.subarray(0, 32);
  52089. }
  52090. class PDF20 {
  52091. hash(password, concatBytes, userBytes) {
  52092. return calculatePDF20Hash(password, concatBytes, userBytes);
  52093. }
  52094. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  52095. const hashData = new Uint8Array(password.length + 56);
  52096. hashData.set(password, 0);
  52097. hashData.set(ownerValidationSalt, password.length);
  52098. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  52099. const result = calculatePDF20Hash(password, hashData, userBytes);
  52100. return (0, _util.isArrayEqual)(result, ownerPassword);
  52101. }
  52102. checkUserPassword(password, userValidationSalt, userPassword) {
  52103. const hashData = new Uint8Array(password.length + 8);
  52104. hashData.set(password, 0);
  52105. hashData.set(userValidationSalt, password.length);
  52106. const result = calculatePDF20Hash(password, hashData, []);
  52107. return (0, _util.isArrayEqual)(result, userPassword);
  52108. }
  52109. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  52110. const hashData = new Uint8Array(password.length + 56);
  52111. hashData.set(password, 0);
  52112. hashData.set(ownerKeySalt, password.length);
  52113. hashData.set(userBytes, password.length + ownerKeySalt.length);
  52114. const key = calculatePDF20Hash(password, hashData, userBytes);
  52115. const cipher = new AES256Cipher(key);
  52116. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  52117. }
  52118. getUserKey(password, userKeySalt, userEncryption) {
  52119. const hashData = new Uint8Array(password.length + 8);
  52120. hashData.set(password, 0);
  52121. hashData.set(userKeySalt, password.length);
  52122. const key = calculatePDF20Hash(password, hashData, []);
  52123. const cipher = new AES256Cipher(key);
  52124. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  52125. }
  52126. }
  52127. return PDF20;
  52128. }();
  52129. exports.PDF20 = PDF20;
  52130. class CipherTransform {
  52131. constructor(stringCipherConstructor, streamCipherConstructor) {
  52132. this.StringCipherConstructor = stringCipherConstructor;
  52133. this.StreamCipherConstructor = streamCipherConstructor;
  52134. }
  52135. createStream(stream, length) {
  52136. const cipher = new this.StreamCipherConstructor();
  52137. return new _decrypt_stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  52138. return cipher.decryptBlock(data, finalize);
  52139. });
  52140. }
  52141. decryptString(s) {
  52142. const cipher = new this.StringCipherConstructor();
  52143. let data = (0, _util.stringToBytes)(s);
  52144. data = cipher.decryptBlock(data, true);
  52145. return (0, _util.bytesToString)(data);
  52146. }
  52147. encryptString(s) {
  52148. const cipher = new this.StringCipherConstructor();
  52149. if (cipher instanceof AESBaseCipher) {
  52150. const strLen = s.length;
  52151. const pad = 16 - strLen % 16;
  52152. s += String.fromCharCode(pad).repeat(pad);
  52153. const iv = new Uint8Array(16);
  52154. if (typeof crypto !== "undefined") {
  52155. crypto.getRandomValues(iv);
  52156. } else {
  52157. for (let i = 0; i < 16; i++) {
  52158. iv[i] = Math.floor(256 * Math.random());
  52159. }
  52160. }
  52161. let data = (0, _util.stringToBytes)(s);
  52162. data = cipher.encrypt(data, iv);
  52163. const buf = new Uint8Array(16 + data.length);
  52164. buf.set(iv);
  52165. buf.set(data, 16);
  52166. return (0, _util.bytesToString)(buf);
  52167. }
  52168. let data = (0, _util.stringToBytes)(s);
  52169. data = cipher.encrypt(data);
  52170. return (0, _util.bytesToString)(data);
  52171. }
  52172. }
  52173. const CipherTransformFactory = function CipherTransformFactoryClosure() {
  52174. 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]);
  52175. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  52176. if (password) {
  52177. const passwordLength = Math.min(127, password.length);
  52178. password = password.subarray(0, passwordLength);
  52179. } else {
  52180. password = [];
  52181. }
  52182. let pdfAlgorithm;
  52183. if (revision === 6) {
  52184. pdfAlgorithm = new PDF20();
  52185. } else {
  52186. pdfAlgorithm = new PDF17();
  52187. }
  52188. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  52189. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  52190. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  52191. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  52192. }
  52193. return null;
  52194. }
  52195. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  52196. const hashDataSize = 40 + ownerPassword.length + fileId.length;
  52197. const hashData = new Uint8Array(hashDataSize);
  52198. let i = 0,
  52199. j,
  52200. n;
  52201. if (password) {
  52202. n = Math.min(32, password.length);
  52203. for (; i < n; ++i) {
  52204. hashData[i] = password[i];
  52205. }
  52206. }
  52207. j = 0;
  52208. while (i < 32) {
  52209. hashData[i++] = defaultPasswordBytes[j++];
  52210. }
  52211. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  52212. hashData[i++] = ownerPassword[j];
  52213. }
  52214. hashData[i++] = flags & 0xff;
  52215. hashData[i++] = flags >> 8 & 0xff;
  52216. hashData[i++] = flags >> 16 & 0xff;
  52217. hashData[i++] = flags >>> 24 & 0xff;
  52218. for (j = 0, n = fileId.length; j < n; ++j) {
  52219. hashData[i++] = fileId[j];
  52220. }
  52221. if (revision >= 4 && !encryptMetadata) {
  52222. hashData[i++] = 0xff;
  52223. hashData[i++] = 0xff;
  52224. hashData[i++] = 0xff;
  52225. hashData[i++] = 0xff;
  52226. }
  52227. let hash = calculateMD5(hashData, 0, i);
  52228. const keyLengthInBytes = keyLength >> 3;
  52229. if (revision >= 3) {
  52230. for (j = 0; j < 50; ++j) {
  52231. hash = calculateMD5(hash, 0, keyLengthInBytes);
  52232. }
  52233. }
  52234. const encryptionKey = hash.subarray(0, keyLengthInBytes);
  52235. let cipher, checkData;
  52236. if (revision >= 3) {
  52237. for (i = 0; i < 32; ++i) {
  52238. hashData[i] = defaultPasswordBytes[i];
  52239. }
  52240. for (j = 0, n = fileId.length; j < n; ++j) {
  52241. hashData[i++] = fileId[j];
  52242. }
  52243. cipher = new ARCFourCipher(encryptionKey);
  52244. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  52245. n = encryptionKey.length;
  52246. const derivedKey = new Uint8Array(n);
  52247. for (j = 1; j <= 19; ++j) {
  52248. for (let k = 0; k < n; ++k) {
  52249. derivedKey[k] = encryptionKey[k] ^ j;
  52250. }
  52251. cipher = new ARCFourCipher(derivedKey);
  52252. checkData = cipher.encryptBlock(checkData);
  52253. }
  52254. for (j = 0, n = checkData.length; j < n; ++j) {
  52255. if (userPassword[j] !== checkData[j]) {
  52256. return null;
  52257. }
  52258. }
  52259. } else {
  52260. cipher = new ARCFourCipher(encryptionKey);
  52261. checkData = cipher.encryptBlock(defaultPasswordBytes);
  52262. for (j = 0, n = checkData.length; j < n; ++j) {
  52263. if (userPassword[j] !== checkData[j]) {
  52264. return null;
  52265. }
  52266. }
  52267. }
  52268. return encryptionKey;
  52269. }
  52270. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  52271. const hashData = new Uint8Array(32);
  52272. let i = 0;
  52273. const n = Math.min(32, password.length);
  52274. for (; i < n; ++i) {
  52275. hashData[i] = password[i];
  52276. }
  52277. let j = 0;
  52278. while (i < 32) {
  52279. hashData[i++] = defaultPasswordBytes[j++];
  52280. }
  52281. let hash = calculateMD5(hashData, 0, i);
  52282. const keyLengthInBytes = keyLength >> 3;
  52283. if (revision >= 3) {
  52284. for (j = 0; j < 50; ++j) {
  52285. hash = calculateMD5(hash, 0, hash.length);
  52286. }
  52287. }
  52288. let cipher, userPassword;
  52289. if (revision >= 3) {
  52290. userPassword = ownerPassword;
  52291. const derivedKey = new Uint8Array(keyLengthInBytes);
  52292. for (j = 19; j >= 0; j--) {
  52293. for (let k = 0; k < keyLengthInBytes; ++k) {
  52294. derivedKey[k] = hash[k] ^ j;
  52295. }
  52296. cipher = new ARCFourCipher(derivedKey);
  52297. userPassword = cipher.encryptBlock(userPassword);
  52298. }
  52299. } else {
  52300. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  52301. userPassword = cipher.encryptBlock(ownerPassword);
  52302. }
  52303. return userPassword;
  52304. }
  52305. const identityName = _primitives.Name.get("Identity");
  52306. function buildObjectKey(num, gen, encryptionKey) {
  52307. let isAes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  52308. const key = new Uint8Array(encryptionKey.length + 9);
  52309. const n = encryptionKey.length;
  52310. let i;
  52311. for (i = 0; i < n; ++i) {
  52312. key[i] = encryptionKey[i];
  52313. }
  52314. key[i++] = num & 0xff;
  52315. key[i++] = num >> 8 & 0xff;
  52316. key[i++] = num >> 16 & 0xff;
  52317. key[i++] = gen & 0xff;
  52318. key[i++] = gen >> 8 & 0xff;
  52319. if (isAes) {
  52320. key[i++] = 0x73;
  52321. key[i++] = 0x41;
  52322. key[i++] = 0x6c;
  52323. key[i++] = 0x54;
  52324. }
  52325. const hash = calculateMD5(key, 0, i);
  52326. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  52327. }
  52328. function buildCipherConstructor(cf, name, num, gen, key) {
  52329. if (!(name instanceof _primitives.Name)) {
  52330. throw new _util.FormatError("Invalid crypt filter name.");
  52331. }
  52332. const cryptFilter = cf.get(name.name);
  52333. let cfm;
  52334. if (cryptFilter !== null && cryptFilter !== undefined) {
  52335. cfm = cryptFilter.get("CFM");
  52336. }
  52337. if (!cfm || cfm.name === "None") {
  52338. return function cipherTransformFactoryBuildCipherConstructorNone() {
  52339. return new NullCipher();
  52340. };
  52341. }
  52342. if (cfm.name === "V2") {
  52343. return function cipherTransformFactoryBuildCipherConstructorV2() {
  52344. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  52345. };
  52346. }
  52347. if (cfm.name === "AESV2") {
  52348. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  52349. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  52350. };
  52351. }
  52352. if (cfm.name === "AESV3") {
  52353. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  52354. return new AES256Cipher(key);
  52355. };
  52356. }
  52357. throw new _util.FormatError("Unknown crypto method");
  52358. }
  52359. class CipherTransformFactory {
  52360. constructor(dict, fileId, password) {
  52361. const filter = dict.get("Filter");
  52362. if (!(0, _primitives.isName)(filter, "Standard")) {
  52363. throw new _util.FormatError("unknown encryption method");
  52364. }
  52365. this.filterName = filter.name;
  52366. this.dict = dict;
  52367. const algorithm = dict.get("V");
  52368. if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  52369. throw new _util.FormatError("unsupported encryption algorithm");
  52370. }
  52371. this.algorithm = algorithm;
  52372. let keyLength = dict.get("Length");
  52373. if (!keyLength) {
  52374. if (algorithm <= 3) {
  52375. keyLength = 40;
  52376. } else {
  52377. const cfDict = dict.get("CF");
  52378. const streamCryptoName = dict.get("StmF");
  52379. if (cfDict instanceof _primitives.Dict && streamCryptoName instanceof _primitives.Name) {
  52380. cfDict.suppressEncryption = true;
  52381. const handlerDict = cfDict.get(streamCryptoName.name);
  52382. keyLength = handlerDict && handlerDict.get("Length") || 128;
  52383. if (keyLength < 40) {
  52384. keyLength <<= 3;
  52385. }
  52386. }
  52387. }
  52388. }
  52389. if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  52390. throw new _util.FormatError("invalid key length");
  52391. }
  52392. const ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32);
  52393. const userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32);
  52394. const flags = dict.get("P");
  52395. const revision = dict.get("R");
  52396. const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
  52397. this.encryptMetadata = encryptMetadata;
  52398. const fileIdBytes = (0, _util.stringToBytes)(fileId);
  52399. let passwordBytes;
  52400. if (password) {
  52401. if (revision === 6) {
  52402. try {
  52403. password = (0, _util.utf8StringToString)(password);
  52404. } catch (ex) {
  52405. (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password.");
  52406. }
  52407. }
  52408. passwordBytes = (0, _util.stringToBytes)(password);
  52409. }
  52410. let encryptionKey;
  52411. if (algorithm !== 5) {
  52412. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  52413. } else {
  52414. const ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40);
  52415. const ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48);
  52416. const uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48);
  52417. const userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40);
  52418. const userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48);
  52419. const ownerEncryption = (0, _util.stringToBytes)(dict.get("OE"));
  52420. const userEncryption = (0, _util.stringToBytes)(dict.get("UE"));
  52421. const perms = (0, _util.stringToBytes)(dict.get("Perms"));
  52422. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  52423. }
  52424. if (!encryptionKey && !password) {
  52425. throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD);
  52426. } else if (!encryptionKey && password) {
  52427. const decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  52428. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  52429. }
  52430. if (!encryptionKey) {
  52431. throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD);
  52432. }
  52433. this.encryptionKey = encryptionKey;
  52434. if (algorithm >= 4) {
  52435. const cf = dict.get("CF");
  52436. if (cf instanceof _primitives.Dict) {
  52437. cf.suppressEncryption = true;
  52438. }
  52439. this.cf = cf;
  52440. this.stmf = dict.get("StmF") || identityName;
  52441. this.strf = dict.get("StrF") || identityName;
  52442. this.eff = dict.get("EFF") || this.stmf;
  52443. }
  52444. }
  52445. createCipherTransform(num, gen) {
  52446. if (this.algorithm === 4 || this.algorithm === 5) {
  52447. return new CipherTransform(buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey));
  52448. }
  52449. const key = buildObjectKey(num, gen, this.encryptionKey, false);
  52450. const cipherConstructor = function buildCipherCipherConstructor() {
  52451. return new ARCFourCipher(key);
  52452. };
  52453. return new CipherTransform(cipherConstructor, cipherConstructor);
  52454. }
  52455. }
  52456. return CipherTransformFactory;
  52457. }();
  52458. exports.CipherTransformFactory = CipherTransformFactory;
  52459. /***/ }),
  52460. /* 193 */
  52461. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52462. "use strict";
  52463. Object.defineProperty(exports, "__esModule", ({
  52464. value: true
  52465. }));
  52466. exports.DecryptStream = void 0;
  52467. var _decode_stream = __w_pdfjs_require__(144);
  52468. const chunkSize = 512;
  52469. class DecryptStream extends _decode_stream.DecodeStream {
  52470. constructor(str, maybeLength, decrypt) {
  52471. super(maybeLength);
  52472. this.str = str;
  52473. this.dict = str.dict;
  52474. this.decrypt = decrypt;
  52475. this.nextChunk = null;
  52476. this.initialized = false;
  52477. }
  52478. readBlock() {
  52479. let chunk;
  52480. if (this.initialized) {
  52481. chunk = this.nextChunk;
  52482. } else {
  52483. chunk = this.str.getBytes(chunkSize);
  52484. this.initialized = true;
  52485. }
  52486. if (!chunk || chunk.length === 0) {
  52487. this.eof = true;
  52488. return;
  52489. }
  52490. this.nextChunk = this.str.getBytes(chunkSize);
  52491. const hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  52492. const decrypt = this.decrypt;
  52493. chunk = decrypt(chunk, !hasMoreData);
  52494. let bufferLength = this.bufferLength;
  52495. const n = chunk.length,
  52496. buffer = this.ensureBuffer(bufferLength + n);
  52497. for (let i = 0; i < n; i++) {
  52498. buffer[bufferLength++] = chunk[i];
  52499. }
  52500. this.bufferLength = bufferLength;
  52501. }
  52502. }
  52503. exports.DecryptStream = DecryptStream;
  52504. /***/ }),
  52505. /* 194 */
  52506. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52507. "use strict";
  52508. Object.defineProperty(exports, "__esModule", ({
  52509. value: true
  52510. }));
  52511. exports.Catalog = void 0;
  52512. var _core_utils = __w_pdfjs_require__(131);
  52513. var _util = __w_pdfjs_require__(2);
  52514. var _primitives = __w_pdfjs_require__(130);
  52515. var _name_number_tree = __w_pdfjs_require__(195);
  52516. var _base_stream = __w_pdfjs_require__(132);
  52517. var _cleanup_helper = __w_pdfjs_require__(196);
  52518. var _colorspace = __w_pdfjs_require__(139);
  52519. var _file_spec = __w_pdfjs_require__(197);
  52520. var _image_utils = __w_pdfjs_require__(184);
  52521. var _metadata_parser = __w_pdfjs_require__(198);
  52522. var _struct_tree = __w_pdfjs_require__(199);
  52523. function fetchDestination(dest) {
  52524. if (dest instanceof _primitives.Dict) {
  52525. dest = dest.get("D");
  52526. }
  52527. return Array.isArray(dest) ? dest : null;
  52528. }
  52529. class Catalog {
  52530. constructor(pdfManager, xref) {
  52531. this.pdfManager = pdfManager;
  52532. this.xref = xref;
  52533. this._catDict = xref.getCatalogObj();
  52534. if (!(this._catDict instanceof _primitives.Dict)) {
  52535. throw new _util.FormatError("Catalog object is not a dictionary.");
  52536. }
  52537. this.toplevelPagesDict;
  52538. this._actualNumPages = null;
  52539. this.fontCache = new _primitives.RefSetCache();
  52540. this.builtInCMapCache = new Map();
  52541. this.standardFontDataCache = new Map();
  52542. this.globalImageCache = new _image_utils.GlobalImageCache();
  52543. this.pageKidsCountCache = new _primitives.RefSetCache();
  52544. this.pageIndexCache = new _primitives.RefSetCache();
  52545. this.nonBlendModesSet = new _primitives.RefSet();
  52546. }
  52547. get version() {
  52548. const version = this._catDict.get("Version");
  52549. return (0, _util.shadow)(this, "version", version instanceof _primitives.Name ? version.name : null);
  52550. }
  52551. get lang() {
  52552. const lang = this._catDict.get("Lang");
  52553. return (0, _util.shadow)(this, "lang", typeof lang === "string" ? (0, _util.stringToPDFString)(lang) : null);
  52554. }
  52555. get needsRendering() {
  52556. const needsRendering = this._catDict.get("NeedsRendering");
  52557. return (0, _util.shadow)(this, "needsRendering", typeof needsRendering === "boolean" ? needsRendering : false);
  52558. }
  52559. get collection() {
  52560. let collection = null;
  52561. try {
  52562. const obj = this._catDict.get("Collection");
  52563. if (obj instanceof _primitives.Dict && obj.size > 0) {
  52564. collection = obj;
  52565. }
  52566. } catch (ex) {
  52567. if (ex instanceof _core_utils.MissingDataException) {
  52568. throw ex;
  52569. }
  52570. (0, _util.info)("Cannot fetch Collection entry; assuming no collection is present.");
  52571. }
  52572. return (0, _util.shadow)(this, "collection", collection);
  52573. }
  52574. get acroForm() {
  52575. let acroForm = null;
  52576. try {
  52577. const obj = this._catDict.get("AcroForm");
  52578. if (obj instanceof _primitives.Dict && obj.size > 0) {
  52579. acroForm = obj;
  52580. }
  52581. } catch (ex) {
  52582. if (ex instanceof _core_utils.MissingDataException) {
  52583. throw ex;
  52584. }
  52585. (0, _util.info)("Cannot fetch AcroForm entry; assuming no forms are present.");
  52586. }
  52587. return (0, _util.shadow)(this, "acroForm", acroForm);
  52588. }
  52589. get acroFormRef() {
  52590. const value = this._catDict.getRaw("AcroForm");
  52591. return (0, _util.shadow)(this, "acroFormRef", value instanceof _primitives.Ref ? value : null);
  52592. }
  52593. get metadata() {
  52594. const streamRef = this._catDict.getRaw("Metadata");
  52595. if (!(streamRef instanceof _primitives.Ref)) {
  52596. return (0, _util.shadow)(this, "metadata", null);
  52597. }
  52598. let metadata = null;
  52599. try {
  52600. const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
  52601. const stream = this.xref.fetch(streamRef, suppressEncryption);
  52602. if (stream instanceof _base_stream.BaseStream && stream.dict instanceof _primitives.Dict) {
  52603. const type = stream.dict.get("Type");
  52604. const subtype = stream.dict.get("Subtype");
  52605. if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
  52606. const data = (0, _util.stringToUTF8String)(stream.getString());
  52607. if (data) {
  52608. metadata = new _metadata_parser.MetadataParser(data).serializable;
  52609. }
  52610. }
  52611. }
  52612. } catch (ex) {
  52613. if (ex instanceof _core_utils.MissingDataException) {
  52614. throw ex;
  52615. }
  52616. (0, _util.info)(`Skipping invalid Metadata: "${ex}".`);
  52617. }
  52618. return (0, _util.shadow)(this, "metadata", metadata);
  52619. }
  52620. get markInfo() {
  52621. let markInfo = null;
  52622. try {
  52623. markInfo = this._readMarkInfo();
  52624. } catch (ex) {
  52625. if (ex instanceof _core_utils.MissingDataException) {
  52626. throw ex;
  52627. }
  52628. (0, _util.warn)("Unable to read mark info.");
  52629. }
  52630. return (0, _util.shadow)(this, "markInfo", markInfo);
  52631. }
  52632. _readMarkInfo() {
  52633. const obj = this._catDict.get("MarkInfo");
  52634. if (!(obj instanceof _primitives.Dict)) {
  52635. return null;
  52636. }
  52637. const markInfo = {
  52638. Marked: false,
  52639. UserProperties: false,
  52640. Suspects: false
  52641. };
  52642. for (const key in markInfo) {
  52643. const value = obj.get(key);
  52644. if (typeof value === "boolean") {
  52645. markInfo[key] = value;
  52646. }
  52647. }
  52648. return markInfo;
  52649. }
  52650. get structTreeRoot() {
  52651. let structTree = null;
  52652. try {
  52653. structTree = this._readStructTreeRoot();
  52654. } catch (ex) {
  52655. if (ex instanceof _core_utils.MissingDataException) {
  52656. throw ex;
  52657. }
  52658. (0, _util.warn)("Unable read to structTreeRoot info.");
  52659. }
  52660. return (0, _util.shadow)(this, "structTreeRoot", structTree);
  52661. }
  52662. _readStructTreeRoot() {
  52663. const obj = this._catDict.get("StructTreeRoot");
  52664. if (!(obj instanceof _primitives.Dict)) {
  52665. return null;
  52666. }
  52667. const root = new _struct_tree.StructTreeRoot(obj);
  52668. root.init();
  52669. return root;
  52670. }
  52671. get toplevelPagesDict() {
  52672. const pagesObj = this._catDict.get("Pages");
  52673. if (!(pagesObj instanceof _primitives.Dict)) {
  52674. throw new _util.FormatError("Invalid top-level pages dictionary.");
  52675. }
  52676. return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
  52677. }
  52678. get documentOutline() {
  52679. let obj = null;
  52680. try {
  52681. obj = this._readDocumentOutline();
  52682. } catch (ex) {
  52683. if (ex instanceof _core_utils.MissingDataException) {
  52684. throw ex;
  52685. }
  52686. (0, _util.warn)("Unable to read document outline.");
  52687. }
  52688. return (0, _util.shadow)(this, "documentOutline", obj);
  52689. }
  52690. _readDocumentOutline() {
  52691. let obj = this._catDict.get("Outlines");
  52692. if (!(obj instanceof _primitives.Dict)) {
  52693. return null;
  52694. }
  52695. obj = obj.getRaw("First");
  52696. if (!(obj instanceof _primitives.Ref)) {
  52697. return null;
  52698. }
  52699. const root = {
  52700. items: []
  52701. };
  52702. const queue = [{
  52703. obj,
  52704. parent: root
  52705. }];
  52706. const processed = new _primitives.RefSet();
  52707. processed.put(obj);
  52708. const xref = this.xref,
  52709. blackColor = new Uint8ClampedArray(3);
  52710. while (queue.length > 0) {
  52711. const i = queue.shift();
  52712. const outlineDict = xref.fetchIfRef(i.obj);
  52713. if (outlineDict === null) {
  52714. continue;
  52715. }
  52716. if (!outlineDict.has("Title")) {
  52717. throw new _util.FormatError("Invalid outline item encountered.");
  52718. }
  52719. const data = {
  52720. url: null,
  52721. dest: null
  52722. };
  52723. Catalog.parseDestDictionary({
  52724. destDict: outlineDict,
  52725. resultObj: data,
  52726. docBaseUrl: this.pdfManager.docBaseUrl
  52727. });
  52728. const title = outlineDict.get("Title");
  52729. const flags = outlineDict.get("F") || 0;
  52730. const color = outlineDict.getArray("C");
  52731. const count = outlineDict.get("Count");
  52732. let rgbColor = blackColor;
  52733. if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  52734. rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
  52735. }
  52736. const outlineItem = {
  52737. dest: data.dest,
  52738. url: data.url,
  52739. unsafeUrl: data.unsafeUrl,
  52740. newWindow: data.newWindow,
  52741. title: (0, _util.stringToPDFString)(title),
  52742. color: rgbColor,
  52743. count: Number.isInteger(count) ? count : undefined,
  52744. bold: !!(flags & 2),
  52745. italic: !!(flags & 1),
  52746. items: []
  52747. };
  52748. i.parent.items.push(outlineItem);
  52749. obj = outlineDict.getRaw("First");
  52750. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  52751. queue.push({
  52752. obj,
  52753. parent: outlineItem
  52754. });
  52755. processed.put(obj);
  52756. }
  52757. obj = outlineDict.getRaw("Next");
  52758. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  52759. queue.push({
  52760. obj,
  52761. parent: i.parent
  52762. });
  52763. processed.put(obj);
  52764. }
  52765. }
  52766. return root.items.length > 0 ? root.items : null;
  52767. }
  52768. get permissions() {
  52769. let permissions = null;
  52770. try {
  52771. permissions = this._readPermissions();
  52772. } catch (ex) {
  52773. if (ex instanceof _core_utils.MissingDataException) {
  52774. throw ex;
  52775. }
  52776. (0, _util.warn)("Unable to read permissions.");
  52777. }
  52778. return (0, _util.shadow)(this, "permissions", permissions);
  52779. }
  52780. _readPermissions() {
  52781. const encrypt = this.xref.trailer.get("Encrypt");
  52782. if (!(encrypt instanceof _primitives.Dict)) {
  52783. return null;
  52784. }
  52785. let flags = encrypt.get("P");
  52786. if (typeof flags !== "number") {
  52787. return null;
  52788. }
  52789. flags += 2 ** 32;
  52790. const permissions = [];
  52791. for (const key in _util.PermissionFlag) {
  52792. const value = _util.PermissionFlag[key];
  52793. if (flags & value) {
  52794. permissions.push(value);
  52795. }
  52796. }
  52797. return permissions;
  52798. }
  52799. get optionalContentConfig() {
  52800. let config = null;
  52801. try {
  52802. const properties = this._catDict.get("OCProperties");
  52803. if (!properties) {
  52804. return (0, _util.shadow)(this, "optionalContentConfig", null);
  52805. }
  52806. const defaultConfig = properties.get("D");
  52807. if (!defaultConfig) {
  52808. return (0, _util.shadow)(this, "optionalContentConfig", null);
  52809. }
  52810. const groupsData = properties.get("OCGs");
  52811. if (!Array.isArray(groupsData)) {
  52812. return (0, _util.shadow)(this, "optionalContentConfig", null);
  52813. }
  52814. const groups = [];
  52815. const groupRefs = [];
  52816. for (const groupRef of groupsData) {
  52817. if (!(groupRef instanceof _primitives.Ref)) {
  52818. continue;
  52819. }
  52820. groupRefs.push(groupRef);
  52821. const group = this.xref.fetchIfRef(groupRef);
  52822. groups.push({
  52823. id: groupRef.toString(),
  52824. name: typeof group.get("Name") === "string" ? (0, _util.stringToPDFString)(group.get("Name")) : null,
  52825. intent: typeof group.get("Intent") === "string" ? (0, _util.stringToPDFString)(group.get("Intent")) : null
  52826. });
  52827. }
  52828. config = this._readOptionalContentConfig(defaultConfig, groupRefs);
  52829. config.groups = groups;
  52830. } catch (ex) {
  52831. if (ex instanceof _core_utils.MissingDataException) {
  52832. throw ex;
  52833. }
  52834. (0, _util.warn)(`Unable to read optional content config: ${ex}`);
  52835. }
  52836. return (0, _util.shadow)(this, "optionalContentConfig", config);
  52837. }
  52838. _readOptionalContentConfig(config, contentGroupRefs) {
  52839. function parseOnOff(refs) {
  52840. const onParsed = [];
  52841. if (Array.isArray(refs)) {
  52842. for (const value of refs) {
  52843. if (!(value instanceof _primitives.Ref)) {
  52844. continue;
  52845. }
  52846. if (contentGroupRefs.includes(value)) {
  52847. onParsed.push(value.toString());
  52848. }
  52849. }
  52850. }
  52851. return onParsed;
  52852. }
  52853. function parseOrder(refs) {
  52854. let nestedLevels = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  52855. if (!Array.isArray(refs)) {
  52856. return null;
  52857. }
  52858. const order = [];
  52859. for (const value of refs) {
  52860. if (value instanceof _primitives.Ref && contentGroupRefs.includes(value)) {
  52861. parsedOrderRefs.put(value);
  52862. order.push(value.toString());
  52863. continue;
  52864. }
  52865. const nestedOrder = parseNestedOrder(value, nestedLevels);
  52866. if (nestedOrder) {
  52867. order.push(nestedOrder);
  52868. }
  52869. }
  52870. if (nestedLevels > 0) {
  52871. return order;
  52872. }
  52873. const hiddenGroups = [];
  52874. for (const groupRef of contentGroupRefs) {
  52875. if (parsedOrderRefs.has(groupRef)) {
  52876. continue;
  52877. }
  52878. hiddenGroups.push(groupRef.toString());
  52879. }
  52880. if (hiddenGroups.length) {
  52881. order.push({
  52882. name: null,
  52883. order: hiddenGroups
  52884. });
  52885. }
  52886. return order;
  52887. }
  52888. function parseNestedOrder(ref, nestedLevels) {
  52889. if (++nestedLevels > MAX_NESTED_LEVELS) {
  52890. (0, _util.warn)("parseNestedOrder - reached MAX_NESTED_LEVELS.");
  52891. return null;
  52892. }
  52893. const value = xref.fetchIfRef(ref);
  52894. if (!Array.isArray(value)) {
  52895. return null;
  52896. }
  52897. const nestedName = xref.fetchIfRef(value[0]);
  52898. if (typeof nestedName !== "string") {
  52899. return null;
  52900. }
  52901. const nestedOrder = parseOrder(value.slice(1), nestedLevels);
  52902. if (!nestedOrder || !nestedOrder.length) {
  52903. return null;
  52904. }
  52905. return {
  52906. name: (0, _util.stringToPDFString)(nestedName),
  52907. order: nestedOrder
  52908. };
  52909. }
  52910. const xref = this.xref,
  52911. parsedOrderRefs = new _primitives.RefSet(),
  52912. MAX_NESTED_LEVELS = 10;
  52913. return {
  52914. name: typeof config.get("Name") === "string" ? (0, _util.stringToPDFString)(config.get("Name")) : null,
  52915. creator: typeof config.get("Creator") === "string" ? (0, _util.stringToPDFString)(config.get("Creator")) : null,
  52916. baseState: config.get("BaseState") instanceof _primitives.Name ? config.get("BaseState").name : null,
  52917. on: parseOnOff(config.get("ON")),
  52918. off: parseOnOff(config.get("OFF")),
  52919. order: parseOrder(config.get("Order")),
  52920. groups: null
  52921. };
  52922. }
  52923. setActualNumPages() {
  52924. let num = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  52925. this._actualNumPages = num;
  52926. }
  52927. get hasActualNumPages() {
  52928. return this._actualNumPages !== null;
  52929. }
  52930. get _pagesCount() {
  52931. const obj = this.toplevelPagesDict.get("Count");
  52932. if (!Number.isInteger(obj)) {
  52933. throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
  52934. }
  52935. return (0, _util.shadow)(this, "_pagesCount", obj);
  52936. }
  52937. get numPages() {
  52938. return this.hasActualNumPages ? this._actualNumPages : this._pagesCount;
  52939. }
  52940. get destinations() {
  52941. const obj = this._readDests(),
  52942. dests = Object.create(null);
  52943. if (obj instanceof _name_number_tree.NameTree) {
  52944. for (const [key, value] of obj.getAll()) {
  52945. const dest = fetchDestination(value);
  52946. if (dest) {
  52947. dests[(0, _util.stringToPDFString)(key)] = dest;
  52948. }
  52949. }
  52950. } else if (obj instanceof _primitives.Dict) {
  52951. obj.forEach(function (key, value) {
  52952. const dest = fetchDestination(value);
  52953. if (dest) {
  52954. dests[key] = dest;
  52955. }
  52956. });
  52957. }
  52958. return (0, _util.shadow)(this, "destinations", dests);
  52959. }
  52960. getDestination(id) {
  52961. const obj = this._readDests();
  52962. if (obj instanceof _name_number_tree.NameTree) {
  52963. const dest = fetchDestination(obj.get(id));
  52964. if (dest) {
  52965. return dest;
  52966. }
  52967. const allDest = this.destinations[id];
  52968. if (allDest) {
  52969. (0, _util.warn)(`Found "${id}" at an incorrect position in the NameTree.`);
  52970. return allDest;
  52971. }
  52972. } else if (obj instanceof _primitives.Dict) {
  52973. const dest = fetchDestination(obj.get(id));
  52974. if (dest) {
  52975. return dest;
  52976. }
  52977. }
  52978. return null;
  52979. }
  52980. _readDests() {
  52981. const obj = this._catDict.get("Names");
  52982. if (obj && obj.has("Dests")) {
  52983. return new _name_number_tree.NameTree(obj.getRaw("Dests"), this.xref);
  52984. } else if (this._catDict.has("Dests")) {
  52985. return this._catDict.get("Dests");
  52986. }
  52987. return undefined;
  52988. }
  52989. get pageLabels() {
  52990. let obj = null;
  52991. try {
  52992. obj = this._readPageLabels();
  52993. } catch (ex) {
  52994. if (ex instanceof _core_utils.MissingDataException) {
  52995. throw ex;
  52996. }
  52997. (0, _util.warn)("Unable to read page labels.");
  52998. }
  52999. return (0, _util.shadow)(this, "pageLabels", obj);
  53000. }
  53001. _readPageLabels() {
  53002. const obj = this._catDict.getRaw("PageLabels");
  53003. if (!obj) {
  53004. return null;
  53005. }
  53006. const pageLabels = new Array(this.numPages);
  53007. let style = null,
  53008. prefix = "";
  53009. const numberTree = new _name_number_tree.NumberTree(obj, this.xref);
  53010. const nums = numberTree.getAll();
  53011. let currentLabel = "",
  53012. currentIndex = 1;
  53013. for (let i = 0, ii = this.numPages; i < ii; i++) {
  53014. const labelDict = nums.get(i);
  53015. if (labelDict !== undefined) {
  53016. if (!(labelDict instanceof _primitives.Dict)) {
  53017. throw new _util.FormatError("PageLabel is not a dictionary.");
  53018. }
  53019. if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
  53020. throw new _util.FormatError("Invalid type in PageLabel dictionary.");
  53021. }
  53022. if (labelDict.has("S")) {
  53023. const s = labelDict.get("S");
  53024. if (!(s instanceof _primitives.Name)) {
  53025. throw new _util.FormatError("Invalid style in PageLabel dictionary.");
  53026. }
  53027. style = s.name;
  53028. } else {
  53029. style = null;
  53030. }
  53031. if (labelDict.has("P")) {
  53032. const p = labelDict.get("P");
  53033. if (typeof p !== "string") {
  53034. throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
  53035. }
  53036. prefix = (0, _util.stringToPDFString)(p);
  53037. } else {
  53038. prefix = "";
  53039. }
  53040. if (labelDict.has("St")) {
  53041. const st = labelDict.get("St");
  53042. if (!(Number.isInteger(st) && st >= 1)) {
  53043. throw new _util.FormatError("Invalid start in PageLabel dictionary.");
  53044. }
  53045. currentIndex = st;
  53046. } else {
  53047. currentIndex = 1;
  53048. }
  53049. }
  53050. switch (style) {
  53051. case "D":
  53052. currentLabel = currentIndex;
  53053. break;
  53054. case "R":
  53055. case "r":
  53056. currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
  53057. break;
  53058. case "A":
  53059. case "a":
  53060. const LIMIT = 26;
  53061. const A_UPPER_CASE = 0x41,
  53062. A_LOWER_CASE = 0x61;
  53063. const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  53064. const letterIndex = currentIndex - 1;
  53065. const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  53066. currentLabel = character.repeat(Math.floor(letterIndex / LIMIT) + 1);
  53067. break;
  53068. default:
  53069. if (style) {
  53070. throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
  53071. }
  53072. currentLabel = "";
  53073. }
  53074. pageLabels[i] = prefix + currentLabel;
  53075. currentIndex++;
  53076. }
  53077. return pageLabels;
  53078. }
  53079. get pageLayout() {
  53080. const obj = this._catDict.get("PageLayout");
  53081. let pageLayout = "";
  53082. if (obj instanceof _primitives.Name) {
  53083. switch (obj.name) {
  53084. case "SinglePage":
  53085. case "OneColumn":
  53086. case "TwoColumnLeft":
  53087. case "TwoColumnRight":
  53088. case "TwoPageLeft":
  53089. case "TwoPageRight":
  53090. pageLayout = obj.name;
  53091. }
  53092. }
  53093. return (0, _util.shadow)(this, "pageLayout", pageLayout);
  53094. }
  53095. get pageMode() {
  53096. const obj = this._catDict.get("PageMode");
  53097. let pageMode = "UseNone";
  53098. if (obj instanceof _primitives.Name) {
  53099. switch (obj.name) {
  53100. case "UseNone":
  53101. case "UseOutlines":
  53102. case "UseThumbs":
  53103. case "FullScreen":
  53104. case "UseOC":
  53105. case "UseAttachments":
  53106. pageMode = obj.name;
  53107. }
  53108. }
  53109. return (0, _util.shadow)(this, "pageMode", pageMode);
  53110. }
  53111. get viewerPreferences() {
  53112. const obj = this._catDict.get("ViewerPreferences");
  53113. if (!(obj instanceof _primitives.Dict)) {
  53114. return (0, _util.shadow)(this, "viewerPreferences", null);
  53115. }
  53116. let prefs = null;
  53117. for (const key of obj.getKeys()) {
  53118. const value = obj.get(key);
  53119. let prefValue;
  53120. switch (key) {
  53121. case "HideToolbar":
  53122. case "HideMenubar":
  53123. case "HideWindowUI":
  53124. case "FitWindow":
  53125. case "CenterWindow":
  53126. case "DisplayDocTitle":
  53127. case "PickTrayByPDFSize":
  53128. if (typeof value === "boolean") {
  53129. prefValue = value;
  53130. }
  53131. break;
  53132. case "NonFullScreenPageMode":
  53133. if (value instanceof _primitives.Name) {
  53134. switch (value.name) {
  53135. case "UseNone":
  53136. case "UseOutlines":
  53137. case "UseThumbs":
  53138. case "UseOC":
  53139. prefValue = value.name;
  53140. break;
  53141. default:
  53142. prefValue = "UseNone";
  53143. }
  53144. }
  53145. break;
  53146. case "Direction":
  53147. if (value instanceof _primitives.Name) {
  53148. switch (value.name) {
  53149. case "L2R":
  53150. case "R2L":
  53151. prefValue = value.name;
  53152. break;
  53153. default:
  53154. prefValue = "L2R";
  53155. }
  53156. }
  53157. break;
  53158. case "ViewArea":
  53159. case "ViewClip":
  53160. case "PrintArea":
  53161. case "PrintClip":
  53162. if (value instanceof _primitives.Name) {
  53163. switch (value.name) {
  53164. case "MediaBox":
  53165. case "CropBox":
  53166. case "BleedBox":
  53167. case "TrimBox":
  53168. case "ArtBox":
  53169. prefValue = value.name;
  53170. break;
  53171. default:
  53172. prefValue = "CropBox";
  53173. }
  53174. }
  53175. break;
  53176. case "PrintScaling":
  53177. if (value instanceof _primitives.Name) {
  53178. switch (value.name) {
  53179. case "None":
  53180. case "AppDefault":
  53181. prefValue = value.name;
  53182. break;
  53183. default:
  53184. prefValue = "AppDefault";
  53185. }
  53186. }
  53187. break;
  53188. case "Duplex":
  53189. if (value instanceof _primitives.Name) {
  53190. switch (value.name) {
  53191. case "Simplex":
  53192. case "DuplexFlipShortEdge":
  53193. case "DuplexFlipLongEdge":
  53194. prefValue = value.name;
  53195. break;
  53196. default:
  53197. prefValue = "None";
  53198. }
  53199. }
  53200. break;
  53201. case "PrintPageRange":
  53202. if (Array.isArray(value) && value.length % 2 === 0) {
  53203. const isValid = value.every((page, i, arr) => {
  53204. return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;
  53205. });
  53206. if (isValid) {
  53207. prefValue = value;
  53208. }
  53209. }
  53210. break;
  53211. case "NumCopies":
  53212. if (Number.isInteger(value) && value > 0) {
  53213. prefValue = value;
  53214. }
  53215. break;
  53216. default:
  53217. (0, _util.warn)(`Ignoring non-standard key in ViewerPreferences: ${key}.`);
  53218. continue;
  53219. }
  53220. if (prefValue === undefined) {
  53221. (0, _util.warn)(`Bad value, for key "${key}", in ViewerPreferences: ${value}.`);
  53222. continue;
  53223. }
  53224. if (!prefs) {
  53225. prefs = Object.create(null);
  53226. }
  53227. prefs[key] = prefValue;
  53228. }
  53229. return (0, _util.shadow)(this, "viewerPreferences", prefs);
  53230. }
  53231. get openAction() {
  53232. const obj = this._catDict.get("OpenAction");
  53233. const openAction = Object.create(null);
  53234. if (obj instanceof _primitives.Dict) {
  53235. const destDict = new _primitives.Dict(this.xref);
  53236. destDict.set("A", obj);
  53237. const resultObj = {
  53238. url: null,
  53239. dest: null,
  53240. action: null
  53241. };
  53242. Catalog.parseDestDictionary({
  53243. destDict,
  53244. resultObj
  53245. });
  53246. if (Array.isArray(resultObj.dest)) {
  53247. openAction.dest = resultObj.dest;
  53248. } else if (resultObj.action) {
  53249. openAction.action = resultObj.action;
  53250. }
  53251. } else if (Array.isArray(obj)) {
  53252. openAction.dest = obj;
  53253. }
  53254. return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null);
  53255. }
  53256. get attachments() {
  53257. const obj = this._catDict.get("Names");
  53258. let attachments = null;
  53259. if (obj instanceof _primitives.Dict && obj.has("EmbeddedFiles")) {
  53260. const nameTree = new _name_number_tree.NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
  53261. for (const [key, value] of nameTree.getAll()) {
  53262. const fs = new _file_spec.FileSpec(value, this.xref);
  53263. if (!attachments) {
  53264. attachments = Object.create(null);
  53265. }
  53266. attachments[(0, _util.stringToPDFString)(key)] = fs.serializable;
  53267. }
  53268. }
  53269. return (0, _util.shadow)(this, "attachments", attachments);
  53270. }
  53271. get xfaImages() {
  53272. const obj = this._catDict.get("Names");
  53273. let xfaImages = null;
  53274. if (obj instanceof _primitives.Dict && obj.has("XFAImages")) {
  53275. const nameTree = new _name_number_tree.NameTree(obj.getRaw("XFAImages"), this.xref);
  53276. for (const [key, value] of nameTree.getAll()) {
  53277. if (!xfaImages) {
  53278. xfaImages = new _primitives.Dict(this.xref);
  53279. }
  53280. xfaImages.set((0, _util.stringToPDFString)(key), value);
  53281. }
  53282. }
  53283. return (0, _util.shadow)(this, "xfaImages", xfaImages);
  53284. }
  53285. _collectJavaScript() {
  53286. const obj = this._catDict.get("Names");
  53287. let javaScript = null;
  53288. function appendIfJavaScriptDict(name, jsDict) {
  53289. if (!(jsDict instanceof _primitives.Dict)) {
  53290. return;
  53291. }
  53292. if (!(0, _primitives.isName)(jsDict.get("S"), "JavaScript")) {
  53293. return;
  53294. }
  53295. let js = jsDict.get("JS");
  53296. if (js instanceof _base_stream.BaseStream) {
  53297. js = js.getString();
  53298. } else if (typeof js !== "string") {
  53299. return;
  53300. }
  53301. if (javaScript === null) {
  53302. javaScript = new Map();
  53303. }
  53304. js = (0, _util.stringToPDFString)(js).replace(/\u0000/g, "");
  53305. javaScript.set(name, js);
  53306. }
  53307. if (obj instanceof _primitives.Dict && obj.has("JavaScript")) {
  53308. const nameTree = new _name_number_tree.NameTree(obj.getRaw("JavaScript"), this.xref);
  53309. for (const [key, value] of nameTree.getAll()) {
  53310. appendIfJavaScriptDict((0, _util.stringToPDFString)(key), value);
  53311. }
  53312. }
  53313. const openAction = this._catDict.get("OpenAction");
  53314. if (openAction) {
  53315. appendIfJavaScriptDict("OpenAction", openAction);
  53316. }
  53317. return javaScript;
  53318. }
  53319. get javaScript() {
  53320. const javaScript = this._collectJavaScript();
  53321. return (0, _util.shadow)(this, "javaScript", javaScript ? [...javaScript.values()] : null);
  53322. }
  53323. get jsActions() {
  53324. const javaScript = this._collectJavaScript();
  53325. let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType);
  53326. if (javaScript) {
  53327. if (!actions) {
  53328. actions = Object.create(null);
  53329. }
  53330. for (const [key, val] of javaScript) {
  53331. if (key in actions) {
  53332. actions[key].push(val);
  53333. } else {
  53334. actions[key] = [val];
  53335. }
  53336. }
  53337. }
  53338. return (0, _util.shadow)(this, "jsActions", actions);
  53339. }
  53340. async fontFallback(id, handler) {
  53341. const translatedFonts = await Promise.all(this.fontCache);
  53342. for (const translatedFont of translatedFonts) {
  53343. if (translatedFont.loadedName === id) {
  53344. translatedFont.fallback(handler);
  53345. return;
  53346. }
  53347. }
  53348. }
  53349. async cleanup() {
  53350. let manuallyTriggered = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  53351. (0, _cleanup_helper.clearGlobalCaches)();
  53352. this.globalImageCache.clear(manuallyTriggered);
  53353. this.pageKidsCountCache.clear();
  53354. this.pageIndexCache.clear();
  53355. this.nonBlendModesSet.clear();
  53356. const translatedFonts = await Promise.all(this.fontCache);
  53357. for (const {
  53358. dict
  53359. } of translatedFonts) {
  53360. delete dict.cacheKey;
  53361. }
  53362. this.fontCache.clear();
  53363. this.builtInCMapCache.clear();
  53364. this.standardFontDataCache.clear();
  53365. }
  53366. async getPageDict(pageIndex) {
  53367. const nodesToVisit = [this.toplevelPagesDict];
  53368. const visitedNodes = new _primitives.RefSet();
  53369. const pagesRef = this._catDict.getRaw("Pages");
  53370. if (pagesRef instanceof _primitives.Ref) {
  53371. visitedNodes.put(pagesRef);
  53372. }
  53373. const xref = this.xref,
  53374. pageKidsCountCache = this.pageKidsCountCache,
  53375. pageIndexCache = this.pageIndexCache;
  53376. let currentPageIndex = 0;
  53377. while (nodesToVisit.length) {
  53378. const currentNode = nodesToVisit.pop();
  53379. if (currentNode instanceof _primitives.Ref) {
  53380. const count = pageKidsCountCache.get(currentNode);
  53381. if (count >= 0 && currentPageIndex + count <= pageIndex) {
  53382. currentPageIndex += count;
  53383. continue;
  53384. }
  53385. if (visitedNodes.has(currentNode)) {
  53386. throw new _util.FormatError("Pages tree contains circular reference.");
  53387. }
  53388. visitedNodes.put(currentNode);
  53389. const obj = await xref.fetchAsync(currentNode);
  53390. if (obj instanceof _primitives.Dict) {
  53391. let type = obj.getRaw("Type");
  53392. if (type instanceof _primitives.Ref) {
  53393. type = await xref.fetchAsync(type);
  53394. }
  53395. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  53396. if (!pageKidsCountCache.has(currentNode)) {
  53397. pageKidsCountCache.put(currentNode, 1);
  53398. }
  53399. if (!pageIndexCache.has(currentNode)) {
  53400. pageIndexCache.put(currentNode, currentPageIndex);
  53401. }
  53402. if (currentPageIndex === pageIndex) {
  53403. return [obj, currentNode];
  53404. }
  53405. currentPageIndex++;
  53406. continue;
  53407. }
  53408. }
  53409. nodesToVisit.push(obj);
  53410. continue;
  53411. }
  53412. if (!(currentNode instanceof _primitives.Dict)) {
  53413. throw new _util.FormatError("Page dictionary kid reference points to wrong type of object.");
  53414. }
  53415. const {
  53416. objId
  53417. } = currentNode;
  53418. let count = currentNode.getRaw("Count");
  53419. if (count instanceof _primitives.Ref) {
  53420. count = await xref.fetchAsync(count);
  53421. }
  53422. if (Number.isInteger(count) && count >= 0) {
  53423. if (objId && !pageKidsCountCache.has(objId)) {
  53424. pageKidsCountCache.put(objId, count);
  53425. }
  53426. if (currentPageIndex + count <= pageIndex) {
  53427. currentPageIndex += count;
  53428. continue;
  53429. }
  53430. }
  53431. let kids = currentNode.getRaw("Kids");
  53432. if (kids instanceof _primitives.Ref) {
  53433. kids = await xref.fetchAsync(kids);
  53434. }
  53435. if (!Array.isArray(kids)) {
  53436. let type = currentNode.getRaw("Type");
  53437. if (type instanceof _primitives.Ref) {
  53438. type = await xref.fetchAsync(type);
  53439. }
  53440. if ((0, _primitives.isName)(type, "Page") || !currentNode.has("Kids")) {
  53441. if (currentPageIndex === pageIndex) {
  53442. return [currentNode, null];
  53443. }
  53444. currentPageIndex++;
  53445. continue;
  53446. }
  53447. throw new _util.FormatError("Page dictionary kids object is not an array.");
  53448. }
  53449. for (let last = kids.length - 1; last >= 0; last--) {
  53450. nodesToVisit.push(kids[last]);
  53451. }
  53452. }
  53453. throw new Error(`Page index ${pageIndex} not found.`);
  53454. }
  53455. async getAllPageDicts() {
  53456. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  53457. const queue = [{
  53458. currentNode: this.toplevelPagesDict,
  53459. posInKids: 0
  53460. }];
  53461. const visitedNodes = new _primitives.RefSet();
  53462. const pagesRef = this._catDict.getRaw("Pages");
  53463. if (pagesRef instanceof _primitives.Ref) {
  53464. visitedNodes.put(pagesRef);
  53465. }
  53466. const map = new Map(),
  53467. xref = this.xref,
  53468. pageIndexCache = this.pageIndexCache;
  53469. let pageIndex = 0;
  53470. function addPageDict(pageDict, pageRef) {
  53471. if (pageRef && !pageIndexCache.has(pageRef)) {
  53472. pageIndexCache.put(pageRef, pageIndex);
  53473. }
  53474. map.set(pageIndex++, [pageDict, pageRef]);
  53475. }
  53476. function addPageError(error) {
  53477. if (error instanceof _core_utils.XRefEntryException && !recoveryMode) {
  53478. throw error;
  53479. }
  53480. map.set(pageIndex++, [error, null]);
  53481. }
  53482. while (queue.length > 0) {
  53483. const queueItem = queue.at(-1);
  53484. const {
  53485. currentNode,
  53486. posInKids
  53487. } = queueItem;
  53488. let kids = currentNode.getRaw("Kids");
  53489. if (kids instanceof _primitives.Ref) {
  53490. try {
  53491. kids = await xref.fetchAsync(kids);
  53492. } catch (ex) {
  53493. addPageError(ex);
  53494. break;
  53495. }
  53496. }
  53497. if (!Array.isArray(kids)) {
  53498. addPageError(new _util.FormatError("Page dictionary kids object is not an array."));
  53499. break;
  53500. }
  53501. if (posInKids >= kids.length) {
  53502. queue.pop();
  53503. continue;
  53504. }
  53505. const kidObj = kids[posInKids];
  53506. let obj;
  53507. if (kidObj instanceof _primitives.Ref) {
  53508. if (visitedNodes.has(kidObj)) {
  53509. addPageError(new _util.FormatError("Pages tree contains circular reference."));
  53510. break;
  53511. }
  53512. visitedNodes.put(kidObj);
  53513. try {
  53514. obj = await xref.fetchAsync(kidObj);
  53515. } catch (ex) {
  53516. addPageError(ex);
  53517. break;
  53518. }
  53519. } else {
  53520. obj = kidObj;
  53521. }
  53522. if (!(obj instanceof _primitives.Dict)) {
  53523. addPageError(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
  53524. break;
  53525. }
  53526. let type = obj.getRaw("Type");
  53527. if (type instanceof _primitives.Ref) {
  53528. try {
  53529. type = await xref.fetchAsync(type);
  53530. } catch (ex) {
  53531. addPageError(ex);
  53532. break;
  53533. }
  53534. }
  53535. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  53536. addPageDict(obj, kidObj instanceof _primitives.Ref ? kidObj : null);
  53537. } else {
  53538. queue.push({
  53539. currentNode: obj,
  53540. posInKids: 0
  53541. });
  53542. }
  53543. queueItem.posInKids++;
  53544. }
  53545. return map;
  53546. }
  53547. getPageIndex(pageRef) {
  53548. const cachedPageIndex = this.pageIndexCache.get(pageRef);
  53549. if (cachedPageIndex !== undefined) {
  53550. return Promise.resolve(cachedPageIndex);
  53551. }
  53552. const xref = this.xref;
  53553. function pagesBeforeRef(kidRef) {
  53554. let total = 0,
  53555. parentRef;
  53556. return xref.fetchAsync(kidRef).then(function (node) {
  53557. if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !(node instanceof _primitives.Dict && !node.has("Type") && node.has("Contents"))) {
  53558. throw new _util.FormatError("The reference does not point to a /Page dictionary.");
  53559. }
  53560. if (!node) {
  53561. return null;
  53562. }
  53563. if (!(node instanceof _primitives.Dict)) {
  53564. throw new _util.FormatError("Node must be a dictionary.");
  53565. }
  53566. parentRef = node.getRaw("Parent");
  53567. return node.getAsync("Parent");
  53568. }).then(function (parent) {
  53569. if (!parent) {
  53570. return null;
  53571. }
  53572. if (!(parent instanceof _primitives.Dict)) {
  53573. throw new _util.FormatError("Parent must be a dictionary.");
  53574. }
  53575. return parent.getAsync("Kids");
  53576. }).then(function (kids) {
  53577. if (!kids) {
  53578. return null;
  53579. }
  53580. const kidPromises = [];
  53581. let found = false;
  53582. for (let i = 0, ii = kids.length; i < ii; i++) {
  53583. const kid = kids[i];
  53584. if (!(kid instanceof _primitives.Ref)) {
  53585. throw new _util.FormatError("Kid must be a reference.");
  53586. }
  53587. if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
  53588. found = true;
  53589. break;
  53590. }
  53591. kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
  53592. if (!(obj instanceof _primitives.Dict)) {
  53593. throw new _util.FormatError("Kid node must be a dictionary.");
  53594. }
  53595. if (obj.has("Count")) {
  53596. total += obj.get("Count");
  53597. } else {
  53598. total++;
  53599. }
  53600. }));
  53601. }
  53602. if (!found) {
  53603. throw new _util.FormatError("Kid reference not found in parent's kids.");
  53604. }
  53605. return Promise.all(kidPromises).then(function () {
  53606. return [total, parentRef];
  53607. });
  53608. });
  53609. }
  53610. let total = 0;
  53611. const next = ref => pagesBeforeRef(ref).then(args => {
  53612. if (!args) {
  53613. this.pageIndexCache.put(pageRef, total);
  53614. return total;
  53615. }
  53616. const [count, parentRef] = args;
  53617. total += count;
  53618. return next(parentRef);
  53619. });
  53620. return next(pageRef);
  53621. }
  53622. get baseUrl() {
  53623. const uri = this._catDict.get("URI");
  53624. if (uri instanceof _primitives.Dict) {
  53625. const base = uri.get("Base");
  53626. if (typeof base === "string") {
  53627. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(base, null, {
  53628. tryConvertEncoding: true
  53629. });
  53630. if (absoluteUrl) {
  53631. return (0, _util.shadow)(this, "baseUrl", absoluteUrl.href);
  53632. }
  53633. }
  53634. }
  53635. return (0, _util.shadow)(this, "baseUrl", null);
  53636. }
  53637. static parseDestDictionary(params) {
  53638. const destDict = params.destDict;
  53639. if (!(destDict instanceof _primitives.Dict)) {
  53640. (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
  53641. return;
  53642. }
  53643. const resultObj = params.resultObj;
  53644. if (typeof resultObj !== "object") {
  53645. (0, _util.warn)("parseDestDictionary: `resultObj` must be an object.");
  53646. return;
  53647. }
  53648. const docBaseUrl = params.docBaseUrl || null;
  53649. let action = destDict.get("A"),
  53650. url,
  53651. dest;
  53652. if (!(action instanceof _primitives.Dict)) {
  53653. if (destDict.has("Dest")) {
  53654. action = destDict.get("Dest");
  53655. } else {
  53656. action = destDict.get("AA");
  53657. if (action instanceof _primitives.Dict) {
  53658. if (action.has("D")) {
  53659. action = action.get("D");
  53660. } else if (action.has("U")) {
  53661. action = action.get("U");
  53662. }
  53663. }
  53664. }
  53665. }
  53666. if (action instanceof _primitives.Dict) {
  53667. const actionType = action.get("S");
  53668. if (!(actionType instanceof _primitives.Name)) {
  53669. (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
  53670. return;
  53671. }
  53672. const actionName = actionType.name;
  53673. switch (actionName) {
  53674. case "ResetForm":
  53675. const flags = action.get("Flags");
  53676. const include = ((typeof flags === "number" ? flags : 0) & 1) === 0;
  53677. const fields = [];
  53678. const refs = [];
  53679. for (const obj of action.get("Fields") || []) {
  53680. if (obj instanceof _primitives.Ref) {
  53681. refs.push(obj.toString());
  53682. } else if (typeof obj === "string") {
  53683. fields.push((0, _util.stringToPDFString)(obj));
  53684. }
  53685. }
  53686. resultObj.resetForm = {
  53687. fields,
  53688. refs,
  53689. include
  53690. };
  53691. break;
  53692. case "URI":
  53693. url = action.get("URI");
  53694. if (url instanceof _primitives.Name) {
  53695. url = "/" + url.name;
  53696. }
  53697. break;
  53698. case "GoTo":
  53699. dest = action.get("D");
  53700. break;
  53701. case "Launch":
  53702. case "GoToR":
  53703. const urlDict = action.get("F");
  53704. if (urlDict instanceof _primitives.Dict) {
  53705. url = urlDict.get("F") || null;
  53706. } else if (typeof urlDict === "string") {
  53707. url = urlDict;
  53708. }
  53709. let remoteDest = action.get("D");
  53710. if (remoteDest) {
  53711. if (remoteDest instanceof _primitives.Name) {
  53712. remoteDest = remoteDest.name;
  53713. }
  53714. if (typeof url === "string") {
  53715. const baseUrl = url.split("#")[0];
  53716. if (typeof remoteDest === "string") {
  53717. url = baseUrl + "#" + remoteDest;
  53718. } else if (Array.isArray(remoteDest)) {
  53719. url = baseUrl + "#" + JSON.stringify(remoteDest);
  53720. }
  53721. }
  53722. }
  53723. const newWindow = action.get("NewWindow");
  53724. if (typeof newWindow === "boolean") {
  53725. resultObj.newWindow = newWindow;
  53726. }
  53727. break;
  53728. case "Named":
  53729. const namedAction = action.get("N");
  53730. if (namedAction instanceof _primitives.Name) {
  53731. resultObj.action = namedAction.name;
  53732. }
  53733. break;
  53734. case "JavaScript":
  53735. const jsAction = action.get("JS");
  53736. let js;
  53737. if (jsAction instanceof _base_stream.BaseStream) {
  53738. js = jsAction.getString();
  53739. } else if (typeof jsAction === "string") {
  53740. js = jsAction;
  53741. }
  53742. const jsURL = js && (0, _core_utils.recoverJsURL)((0, _util.stringToPDFString)(js));
  53743. if (jsURL) {
  53744. url = jsURL.url;
  53745. resultObj.newWindow = jsURL.newWindow;
  53746. break;
  53747. }
  53748. default:
  53749. if (actionName === "JavaScript" || actionName === "SubmitForm") {
  53750. break;
  53751. }
  53752. (0, _util.warn)(`parseDestDictionary - unsupported action: "${actionName}".`);
  53753. break;
  53754. }
  53755. } else if (destDict.has("Dest")) {
  53756. dest = destDict.get("Dest");
  53757. }
  53758. if (typeof url === "string") {
  53759. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl, {
  53760. addDefaultProtocol: true,
  53761. tryConvertEncoding: true
  53762. });
  53763. if (absoluteUrl) {
  53764. resultObj.url = absoluteUrl.href;
  53765. }
  53766. resultObj.unsafeUrl = url;
  53767. }
  53768. if (dest) {
  53769. if (dest instanceof _primitives.Name) {
  53770. dest = dest.name;
  53771. }
  53772. if (typeof dest === "string") {
  53773. resultObj.dest = (0, _util.stringToPDFString)(dest);
  53774. } else if (Array.isArray(dest)) {
  53775. resultObj.dest = dest;
  53776. }
  53777. }
  53778. }
  53779. }
  53780. exports.Catalog = Catalog;
  53781. /***/ }),
  53782. /* 195 */
  53783. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  53784. "use strict";
  53785. Object.defineProperty(exports, "__esModule", ({
  53786. value: true
  53787. }));
  53788. exports.NumberTree = exports.NameTree = void 0;
  53789. var _primitives = __w_pdfjs_require__(130);
  53790. var _util = __w_pdfjs_require__(2);
  53791. class NameOrNumberTree {
  53792. constructor(root, xref, type) {
  53793. if (this.constructor === NameOrNumberTree) {
  53794. (0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
  53795. }
  53796. this.root = root;
  53797. this.xref = xref;
  53798. this._type = type;
  53799. }
  53800. getAll() {
  53801. const map = new Map();
  53802. if (!this.root) {
  53803. return map;
  53804. }
  53805. const xref = this.xref;
  53806. const processed = new _primitives.RefSet();
  53807. processed.put(this.root);
  53808. const queue = [this.root];
  53809. while (queue.length > 0) {
  53810. const obj = xref.fetchIfRef(queue.shift());
  53811. if (!(obj instanceof _primitives.Dict)) {
  53812. continue;
  53813. }
  53814. if (obj.has("Kids")) {
  53815. const kids = obj.get("Kids");
  53816. if (!Array.isArray(kids)) {
  53817. continue;
  53818. }
  53819. for (const kid of kids) {
  53820. if (processed.has(kid)) {
  53821. throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`);
  53822. }
  53823. queue.push(kid);
  53824. processed.put(kid);
  53825. }
  53826. continue;
  53827. }
  53828. const entries = obj.get(this._type);
  53829. if (!Array.isArray(entries)) {
  53830. continue;
  53831. }
  53832. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  53833. map.set(xref.fetchIfRef(entries[i]), xref.fetchIfRef(entries[i + 1]));
  53834. }
  53835. }
  53836. return map;
  53837. }
  53838. get(key) {
  53839. if (!this.root) {
  53840. return null;
  53841. }
  53842. const xref = this.xref;
  53843. let kidsOrEntries = xref.fetchIfRef(this.root);
  53844. let loopCount = 0;
  53845. const MAX_LEVELS = 10;
  53846. while (kidsOrEntries.has("Kids")) {
  53847. if (++loopCount > MAX_LEVELS) {
  53848. (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`);
  53849. return null;
  53850. }
  53851. const kids = kidsOrEntries.get("Kids");
  53852. if (!Array.isArray(kids)) {
  53853. return null;
  53854. }
  53855. let l = 0,
  53856. r = kids.length - 1;
  53857. while (l <= r) {
  53858. const m = l + r >> 1;
  53859. const kid = xref.fetchIfRef(kids[m]);
  53860. const limits = kid.get("Limits");
  53861. if (key < xref.fetchIfRef(limits[0])) {
  53862. r = m - 1;
  53863. } else if (key > xref.fetchIfRef(limits[1])) {
  53864. l = m + 1;
  53865. } else {
  53866. kidsOrEntries = kid;
  53867. break;
  53868. }
  53869. }
  53870. if (l > r) {
  53871. return null;
  53872. }
  53873. }
  53874. const entries = kidsOrEntries.get(this._type);
  53875. if (Array.isArray(entries)) {
  53876. let l = 0,
  53877. r = entries.length - 2;
  53878. while (l <= r) {
  53879. const tmp = l + r >> 1,
  53880. m = tmp + (tmp & 1);
  53881. const currentKey = xref.fetchIfRef(entries[m]);
  53882. if (key < currentKey) {
  53883. r = m - 2;
  53884. } else if (key > currentKey) {
  53885. l = m + 2;
  53886. } else {
  53887. return xref.fetchIfRef(entries[m + 1]);
  53888. }
  53889. }
  53890. }
  53891. return null;
  53892. }
  53893. }
  53894. class NameTree extends NameOrNumberTree {
  53895. constructor(root, xref) {
  53896. super(root, xref, "Names");
  53897. }
  53898. }
  53899. exports.NameTree = NameTree;
  53900. class NumberTree extends NameOrNumberTree {
  53901. constructor(root, xref) {
  53902. super(root, xref, "Nums");
  53903. }
  53904. }
  53905. exports.NumberTree = NumberTree;
  53906. /***/ }),
  53907. /* 196 */
  53908. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  53909. "use strict";
  53910. Object.defineProperty(exports, "__esModule", ({
  53911. value: true
  53912. }));
  53913. exports.clearGlobalCaches = clearGlobalCaches;
  53914. var _primitives = __w_pdfjs_require__(130);
  53915. var _unicode = __w_pdfjs_require__(165);
  53916. function clearGlobalCaches() {
  53917. (0, _primitives.clearPrimitiveCaches)();
  53918. (0, _unicode.clearUnicodeCaches)();
  53919. }
  53920. /***/ }),
  53921. /* 197 */
  53922. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  53923. "use strict";
  53924. Object.defineProperty(exports, "__esModule", ({
  53925. value: true
  53926. }));
  53927. exports.FileSpec = void 0;
  53928. var _util = __w_pdfjs_require__(2);
  53929. var _base_stream = __w_pdfjs_require__(132);
  53930. var _primitives = __w_pdfjs_require__(130);
  53931. function pickPlatformItem(dict) {
  53932. if (dict.has("UF")) {
  53933. return dict.get("UF");
  53934. } else if (dict.has("F")) {
  53935. return dict.get("F");
  53936. } else if (dict.has("Unix")) {
  53937. return dict.get("Unix");
  53938. } else if (dict.has("Mac")) {
  53939. return dict.get("Mac");
  53940. } else if (dict.has("DOS")) {
  53941. return dict.get("DOS");
  53942. }
  53943. return null;
  53944. }
  53945. class FileSpec {
  53946. constructor(root, xref) {
  53947. if (!(root instanceof _primitives.Dict)) {
  53948. return;
  53949. }
  53950. this.xref = xref;
  53951. this.root = root;
  53952. if (root.has("FS")) {
  53953. this.fs = root.get("FS");
  53954. }
  53955. this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : "";
  53956. if (root.has("RF")) {
  53957. (0, _util.warn)("Related file specifications are not supported");
  53958. }
  53959. this.contentAvailable = true;
  53960. if (!root.has("EF")) {
  53961. this.contentAvailable = false;
  53962. (0, _util.warn)("Non-embedded file specifications are not supported");
  53963. }
  53964. }
  53965. get filename() {
  53966. if (!this._filename && this.root) {
  53967. const filename = pickPlatformItem(this.root) || "unnamed";
  53968. this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/");
  53969. }
  53970. return this._filename;
  53971. }
  53972. get content() {
  53973. if (!this.contentAvailable) {
  53974. return null;
  53975. }
  53976. if (!this.contentRef && this.root) {
  53977. this.contentRef = pickPlatformItem(this.root.get("EF"));
  53978. }
  53979. let content = null;
  53980. if (this.contentRef) {
  53981. const fileObj = this.xref.fetchIfRef(this.contentRef);
  53982. if (fileObj instanceof _base_stream.BaseStream) {
  53983. content = fileObj.getBytes();
  53984. } else {
  53985. (0, _util.warn)("Embedded file specification points to non-existing/invalid content");
  53986. }
  53987. } else {
  53988. (0, _util.warn)("Embedded file specification does not have a content");
  53989. }
  53990. return content;
  53991. }
  53992. get serializable() {
  53993. return {
  53994. filename: this.filename,
  53995. content: this.content
  53996. };
  53997. }
  53998. }
  53999. exports.FileSpec = FileSpec;
  54000. /***/ }),
  54001. /* 198 */
  54002. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54003. "use strict";
  54004. Object.defineProperty(exports, "__esModule", ({
  54005. value: true
  54006. }));
  54007. exports.MetadataParser = void 0;
  54008. var _xml_parser = __w_pdfjs_require__(191);
  54009. class MetadataParser {
  54010. constructor(data) {
  54011. data = this._repair(data);
  54012. const parser = new _xml_parser.SimpleXMLParser({
  54013. lowerCaseName: true
  54014. });
  54015. const xmlDocument = parser.parseFromString(data);
  54016. this._metadataMap = new Map();
  54017. this._data = data;
  54018. if (xmlDocument) {
  54019. this._parse(xmlDocument);
  54020. }
  54021. }
  54022. _repair(data) {
  54023. return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) {
  54024. const bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
  54025. return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
  54026. }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
  54027. switch (name) {
  54028. case "amp":
  54029. return "&";
  54030. case "apos":
  54031. return "'";
  54032. case "gt":
  54033. return ">";
  54034. case "lt":
  54035. return "<";
  54036. case "quot":
  54037. return '"';
  54038. }
  54039. throw new Error(`_repair: ${name} isn't defined.`);
  54040. });
  54041. const charBuf = [];
  54042. for (let i = 0, ii = bytes.length; i < ii; i += 2) {
  54043. const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
  54044. if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
  54045. charBuf.push(String.fromCharCode(code));
  54046. } else {
  54047. charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";");
  54048. }
  54049. }
  54050. return ">" + charBuf.join("");
  54051. });
  54052. }
  54053. _getSequence(entry) {
  54054. const name = entry.nodeName;
  54055. if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") {
  54056. return null;
  54057. }
  54058. return entry.childNodes.filter(node => node.nodeName === "rdf:li");
  54059. }
  54060. _parseArray(entry) {
  54061. if (!entry.hasChildNodes()) {
  54062. return;
  54063. }
  54064. const [seqNode] = entry.childNodes;
  54065. const sequence = this._getSequence(seqNode) || [];
  54066. this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim()));
  54067. }
  54068. _parse(xmlDocument) {
  54069. let rdf = xmlDocument.documentElement;
  54070. if (rdf.nodeName !== "rdf:rdf") {
  54071. rdf = rdf.firstChild;
  54072. while (rdf && rdf.nodeName !== "rdf:rdf") {
  54073. rdf = rdf.nextSibling;
  54074. }
  54075. }
  54076. if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
  54077. return;
  54078. }
  54079. for (const desc of rdf.childNodes) {
  54080. if (desc.nodeName !== "rdf:description") {
  54081. continue;
  54082. }
  54083. for (const entry of desc.childNodes) {
  54084. const name = entry.nodeName;
  54085. switch (name) {
  54086. case "#text":
  54087. continue;
  54088. case "dc:creator":
  54089. case "dc:subject":
  54090. this._parseArray(entry);
  54091. continue;
  54092. }
  54093. this._metadataMap.set(name, entry.textContent.trim());
  54094. }
  54095. }
  54096. }
  54097. get serializable() {
  54098. return {
  54099. parsedData: this._metadataMap,
  54100. rawData: this._data
  54101. };
  54102. }
  54103. }
  54104. exports.MetadataParser = MetadataParser;
  54105. /***/ }),
  54106. /* 199 */
  54107. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54108. "use strict";
  54109. Object.defineProperty(exports, "__esModule", ({
  54110. value: true
  54111. }));
  54112. exports.StructTreeRoot = exports.StructTreePage = void 0;
  54113. var _primitives = __w_pdfjs_require__(130);
  54114. var _util = __w_pdfjs_require__(2);
  54115. var _name_number_tree = __w_pdfjs_require__(195);
  54116. const MAX_DEPTH = 40;
  54117. const StructElementType = {
  54118. PAGE_CONTENT: "PAGE_CONTENT",
  54119. STREAM_CONTENT: "STREAM_CONTENT",
  54120. OBJECT: "OBJECT",
  54121. ELEMENT: "ELEMENT"
  54122. };
  54123. class StructTreeRoot {
  54124. constructor(rootDict) {
  54125. this.dict = rootDict;
  54126. this.roleMap = new Map();
  54127. }
  54128. init() {
  54129. this.readRoleMap();
  54130. }
  54131. readRoleMap() {
  54132. const roleMapDict = this.dict.get("RoleMap");
  54133. if (!(roleMapDict instanceof _primitives.Dict)) {
  54134. return;
  54135. }
  54136. roleMapDict.forEach((key, value) => {
  54137. if (!(value instanceof _primitives.Name)) {
  54138. return;
  54139. }
  54140. this.roleMap.set(key, value.name);
  54141. });
  54142. }
  54143. }
  54144. exports.StructTreeRoot = StructTreeRoot;
  54145. class StructElementNode {
  54146. constructor(tree, dict) {
  54147. this.tree = tree;
  54148. this.dict = dict;
  54149. this.kids = [];
  54150. this.parseKids();
  54151. }
  54152. get role() {
  54153. const nameObj = this.dict.get("S");
  54154. const name = nameObj instanceof _primitives.Name ? nameObj.name : "";
  54155. const {
  54156. root
  54157. } = this.tree;
  54158. if (root.roleMap.has(name)) {
  54159. return root.roleMap.get(name);
  54160. }
  54161. return name;
  54162. }
  54163. parseKids() {
  54164. let pageObjId = null;
  54165. const objRef = this.dict.getRaw("Pg");
  54166. if (objRef instanceof _primitives.Ref) {
  54167. pageObjId = objRef.toString();
  54168. }
  54169. const kids = this.dict.get("K");
  54170. if (Array.isArray(kids)) {
  54171. for (const kid of kids) {
  54172. const element = this.parseKid(pageObjId, kid);
  54173. if (element) {
  54174. this.kids.push(element);
  54175. }
  54176. }
  54177. } else {
  54178. const element = this.parseKid(pageObjId, kids);
  54179. if (element) {
  54180. this.kids.push(element);
  54181. }
  54182. }
  54183. }
  54184. parseKid(pageObjId, kid) {
  54185. if (Number.isInteger(kid)) {
  54186. if (this.tree.pageDict.objId !== pageObjId) {
  54187. return null;
  54188. }
  54189. return new StructElement({
  54190. type: StructElementType.PAGE_CONTENT,
  54191. mcid: kid,
  54192. pageObjId
  54193. });
  54194. }
  54195. let kidDict = null;
  54196. if (kid instanceof _primitives.Ref) {
  54197. kidDict = this.dict.xref.fetch(kid);
  54198. } else if (kid instanceof _primitives.Dict) {
  54199. kidDict = kid;
  54200. }
  54201. if (!kidDict) {
  54202. return null;
  54203. }
  54204. const pageRef = kidDict.getRaw("Pg");
  54205. if (pageRef instanceof _primitives.Ref) {
  54206. pageObjId = pageRef.toString();
  54207. }
  54208. const type = kidDict.get("Type") instanceof _primitives.Name ? kidDict.get("Type").name : null;
  54209. if (type === "MCR") {
  54210. if (this.tree.pageDict.objId !== pageObjId) {
  54211. return null;
  54212. }
  54213. return new StructElement({
  54214. type: StructElementType.STREAM_CONTENT,
  54215. refObjId: kidDict.getRaw("Stm") instanceof _primitives.Ref ? kidDict.getRaw("Stm").toString() : null,
  54216. pageObjId,
  54217. mcid: kidDict.get("MCID")
  54218. });
  54219. }
  54220. if (type === "OBJR") {
  54221. if (this.tree.pageDict.objId !== pageObjId) {
  54222. return null;
  54223. }
  54224. return new StructElement({
  54225. type: StructElementType.OBJECT,
  54226. refObjId: kidDict.getRaw("Obj") instanceof _primitives.Ref ? kidDict.getRaw("Obj").toString() : null,
  54227. pageObjId
  54228. });
  54229. }
  54230. return new StructElement({
  54231. type: StructElementType.ELEMENT,
  54232. dict: kidDict
  54233. });
  54234. }
  54235. }
  54236. class StructElement {
  54237. constructor(_ref) {
  54238. let {
  54239. type,
  54240. dict = null,
  54241. mcid = null,
  54242. pageObjId = null,
  54243. refObjId = null
  54244. } = _ref;
  54245. this.type = type;
  54246. this.dict = dict;
  54247. this.mcid = mcid;
  54248. this.pageObjId = pageObjId;
  54249. this.refObjId = refObjId;
  54250. this.parentNode = null;
  54251. }
  54252. }
  54253. class StructTreePage {
  54254. constructor(structTreeRoot, pageDict) {
  54255. this.root = structTreeRoot;
  54256. this.rootDict = structTreeRoot ? structTreeRoot.dict : null;
  54257. this.pageDict = pageDict;
  54258. this.nodes = [];
  54259. }
  54260. parse() {
  54261. if (!this.root || !this.rootDict) {
  54262. return;
  54263. }
  54264. const parentTree = this.rootDict.get("ParentTree");
  54265. if (!parentTree) {
  54266. return;
  54267. }
  54268. const id = this.pageDict.get("StructParents");
  54269. if (!Number.isInteger(id)) {
  54270. return;
  54271. }
  54272. const numberTree = new _name_number_tree.NumberTree(parentTree, this.rootDict.xref);
  54273. const parentArray = numberTree.get(id);
  54274. if (!Array.isArray(parentArray)) {
  54275. return;
  54276. }
  54277. const map = new Map();
  54278. for (const ref of parentArray) {
  54279. if (ref instanceof _primitives.Ref) {
  54280. this.addNode(this.rootDict.xref.fetch(ref), map);
  54281. }
  54282. }
  54283. }
  54284. addNode(dict, map) {
  54285. let level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  54286. if (level > MAX_DEPTH) {
  54287. (0, _util.warn)("StructTree MAX_DEPTH reached.");
  54288. return null;
  54289. }
  54290. if (map.has(dict)) {
  54291. return map.get(dict);
  54292. }
  54293. const element = new StructElementNode(this, dict);
  54294. map.set(dict, element);
  54295. const parent = dict.get("P");
  54296. if (!parent || (0, _primitives.isName)(parent.get("Type"), "StructTreeRoot")) {
  54297. if (!this.addTopLevelNode(dict, element)) {
  54298. map.delete(dict);
  54299. }
  54300. return element;
  54301. }
  54302. const parentNode = this.addNode(parent, map, level + 1);
  54303. if (!parentNode) {
  54304. return element;
  54305. }
  54306. let save = false;
  54307. for (const kid of parentNode.kids) {
  54308. if (kid.type === StructElementType.ELEMENT && kid.dict === dict) {
  54309. kid.parentNode = element;
  54310. save = true;
  54311. }
  54312. }
  54313. if (!save) {
  54314. map.delete(dict);
  54315. }
  54316. return element;
  54317. }
  54318. addTopLevelNode(dict, element) {
  54319. const obj = this.rootDict.get("K");
  54320. if (!obj) {
  54321. return false;
  54322. }
  54323. if (obj instanceof _primitives.Dict) {
  54324. if (obj.objId !== dict.objId) {
  54325. return false;
  54326. }
  54327. this.nodes[0] = element;
  54328. return true;
  54329. }
  54330. if (!Array.isArray(obj)) {
  54331. return true;
  54332. }
  54333. let save = false;
  54334. for (let i = 0; i < obj.length; i++) {
  54335. const kidRef = obj[i];
  54336. if (kidRef && kidRef.toString() === dict.objId) {
  54337. this.nodes[i] = element;
  54338. save = true;
  54339. }
  54340. }
  54341. return save;
  54342. }
  54343. get serializable() {
  54344. function nodeToSerializable(node, parent) {
  54345. let level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  54346. if (level > MAX_DEPTH) {
  54347. (0, _util.warn)("StructTree too deep to be fully serialized.");
  54348. return;
  54349. }
  54350. const obj = Object.create(null);
  54351. obj.role = node.role;
  54352. obj.children = [];
  54353. parent.children.push(obj);
  54354. const alt = node.dict.get("Alt");
  54355. if (typeof alt === "string") {
  54356. obj.alt = (0, _util.stringToPDFString)(alt);
  54357. }
  54358. const lang = node.dict.get("Lang");
  54359. if (typeof lang === "string") {
  54360. obj.lang = (0, _util.stringToPDFString)(lang);
  54361. }
  54362. for (const kid of node.kids) {
  54363. const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null;
  54364. if (kidElement) {
  54365. nodeToSerializable(kidElement, obj, level + 1);
  54366. continue;
  54367. } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) {
  54368. obj.children.push({
  54369. type: "content",
  54370. id: `page${kid.pageObjId}_mcid${kid.mcid}`
  54371. });
  54372. } else if (kid.type === StructElementType.OBJECT) {
  54373. obj.children.push({
  54374. type: "object",
  54375. id: kid.refObjId
  54376. });
  54377. }
  54378. }
  54379. }
  54380. const root = Object.create(null);
  54381. root.children = [];
  54382. root.role = "Root";
  54383. for (const child of this.nodes) {
  54384. if (!child) {
  54385. continue;
  54386. }
  54387. nodeToSerializable(child, root);
  54388. }
  54389. return root;
  54390. }
  54391. }
  54392. exports.StructTreePage = StructTreePage;
  54393. /***/ }),
  54394. /* 200 */
  54395. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54396. "use strict";
  54397. Object.defineProperty(exports, "__esModule", ({
  54398. value: true
  54399. }));
  54400. exports.ObjectLoader = void 0;
  54401. var _primitives = __w_pdfjs_require__(130);
  54402. var _base_stream = __w_pdfjs_require__(132);
  54403. var _core_utils = __w_pdfjs_require__(131);
  54404. var _util = __w_pdfjs_require__(2);
  54405. function mayHaveChildren(value) {
  54406. return value instanceof _primitives.Ref || value instanceof _primitives.Dict || value instanceof _base_stream.BaseStream || Array.isArray(value);
  54407. }
  54408. function addChildren(node, nodesToVisit) {
  54409. if (node instanceof _primitives.Dict) {
  54410. node = node.getRawValues();
  54411. } else if (node instanceof _base_stream.BaseStream) {
  54412. node = node.dict.getRawValues();
  54413. } else if (!Array.isArray(node)) {
  54414. return;
  54415. }
  54416. for (const rawValue of node) {
  54417. if (mayHaveChildren(rawValue)) {
  54418. nodesToVisit.push(rawValue);
  54419. }
  54420. }
  54421. }
  54422. class ObjectLoader {
  54423. constructor(dict, keys, xref) {
  54424. this.dict = dict;
  54425. this.keys = keys;
  54426. this.xref = xref;
  54427. this.refSet = null;
  54428. }
  54429. async load() {
  54430. if (this.xref.stream.isDataLoaded) {
  54431. return undefined;
  54432. }
  54433. const {
  54434. keys,
  54435. dict
  54436. } = this;
  54437. this.refSet = new _primitives.RefSet();
  54438. const nodesToVisit = [];
  54439. for (let i = 0, ii = keys.length; i < ii; i++) {
  54440. const rawValue = dict.getRaw(keys[i]);
  54441. if (rawValue !== undefined) {
  54442. nodesToVisit.push(rawValue);
  54443. }
  54444. }
  54445. return this._walk(nodesToVisit);
  54446. }
  54447. async _walk(nodesToVisit) {
  54448. const nodesToRevisit = [];
  54449. const pendingRequests = [];
  54450. while (nodesToVisit.length) {
  54451. let currentNode = nodesToVisit.pop();
  54452. if (currentNode instanceof _primitives.Ref) {
  54453. if (this.refSet.has(currentNode)) {
  54454. continue;
  54455. }
  54456. try {
  54457. this.refSet.put(currentNode);
  54458. currentNode = this.xref.fetch(currentNode);
  54459. } catch (ex) {
  54460. if (!(ex instanceof _core_utils.MissingDataException)) {
  54461. (0, _util.warn)(`ObjectLoader._walk - requesting all data: "${ex}".`);
  54462. this.refSet = null;
  54463. const {
  54464. manager
  54465. } = this.xref.stream;
  54466. return manager.requestAllChunks();
  54467. }
  54468. nodesToRevisit.push(currentNode);
  54469. pendingRequests.push({
  54470. begin: ex.begin,
  54471. end: ex.end
  54472. });
  54473. }
  54474. }
  54475. if (currentNode instanceof _base_stream.BaseStream) {
  54476. const baseStreams = currentNode.getBaseStreams();
  54477. if (baseStreams) {
  54478. let foundMissingData = false;
  54479. for (const stream of baseStreams) {
  54480. if (stream.isDataLoaded) {
  54481. continue;
  54482. }
  54483. foundMissingData = true;
  54484. pendingRequests.push({
  54485. begin: stream.start,
  54486. end: stream.end
  54487. });
  54488. }
  54489. if (foundMissingData) {
  54490. nodesToRevisit.push(currentNode);
  54491. }
  54492. }
  54493. }
  54494. addChildren(currentNode, nodesToVisit);
  54495. }
  54496. if (pendingRequests.length) {
  54497. await this.xref.stream.manager.requestRanges(pendingRequests);
  54498. for (const node of nodesToRevisit) {
  54499. if (node instanceof _primitives.Ref) {
  54500. this.refSet.remove(node);
  54501. }
  54502. }
  54503. return this._walk(nodesToRevisit);
  54504. }
  54505. this.refSet = null;
  54506. return undefined;
  54507. }
  54508. }
  54509. exports.ObjectLoader = ObjectLoader;
  54510. /***/ }),
  54511. /* 201 */
  54512. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54513. "use strict";
  54514. Object.defineProperty(exports, "__esModule", ({
  54515. value: true
  54516. }));
  54517. exports.XFAFactory = void 0;
  54518. var _xfa_object = __w_pdfjs_require__(202);
  54519. var _bind = __w_pdfjs_require__(206);
  54520. var _data = __w_pdfjs_require__(212);
  54521. var _fonts = __w_pdfjs_require__(210);
  54522. var _utils = __w_pdfjs_require__(203);
  54523. var _util = __w_pdfjs_require__(2);
  54524. var _parser = __w_pdfjs_require__(213);
  54525. var _xhtml = __w_pdfjs_require__(223);
  54526. class XFAFactory {
  54527. constructor(data) {
  54528. try {
  54529. this.root = new _parser.XFAParser().parse(XFAFactory._createDocument(data));
  54530. const binder = new _bind.Binder(this.root);
  54531. this.form = binder.bind();
  54532. this.dataHandler = new _data.DataHandler(this.root, binder.getData());
  54533. this.form[_xfa_object.$globalData].template = this.form;
  54534. } catch (e) {
  54535. (0, _util.warn)(`XFA - an error occurred during parsing and binding: ${e}`);
  54536. }
  54537. }
  54538. isValid() {
  54539. return this.root && this.form;
  54540. }
  54541. _createPagesHelper() {
  54542. const iterator = this.form[_xfa_object.$toPages]();
  54543. return new Promise((resolve, reject) => {
  54544. const nextIteration = () => {
  54545. try {
  54546. const value = iterator.next();
  54547. if (value.done) {
  54548. resolve(value.value);
  54549. } else {
  54550. setTimeout(nextIteration, 0);
  54551. }
  54552. } catch (e) {
  54553. reject(e);
  54554. }
  54555. };
  54556. setTimeout(nextIteration, 0);
  54557. });
  54558. }
  54559. async _createPages() {
  54560. try {
  54561. this.pages = await this._createPagesHelper();
  54562. this.dims = this.pages.children.map(c => {
  54563. const {
  54564. width,
  54565. height
  54566. } = c.attributes.style;
  54567. return [0, 0, parseInt(width), parseInt(height)];
  54568. });
  54569. } catch (e) {
  54570. (0, _util.warn)(`XFA - an error occurred during layout: ${e}`);
  54571. }
  54572. }
  54573. getBoundingBox(pageIndex) {
  54574. return this.dims[pageIndex];
  54575. }
  54576. async getNumPages() {
  54577. if (!this.pages) {
  54578. await this._createPages();
  54579. }
  54580. return this.dims.length;
  54581. }
  54582. setImages(images) {
  54583. this.form[_xfa_object.$globalData].images = images;
  54584. }
  54585. setFonts(fonts) {
  54586. this.form[_xfa_object.$globalData].fontFinder = new _fonts.FontFinder(fonts);
  54587. const missingFonts = [];
  54588. for (let typeface of this.form[_xfa_object.$globalData].usedTypefaces) {
  54589. typeface = (0, _utils.stripQuotes)(typeface);
  54590. const font = this.form[_xfa_object.$globalData].fontFinder.find(typeface);
  54591. if (!font) {
  54592. missingFonts.push(typeface);
  54593. }
  54594. }
  54595. if (missingFonts.length > 0) {
  54596. return missingFonts;
  54597. }
  54598. return null;
  54599. }
  54600. appendFonts(fonts, reallyMissingFonts) {
  54601. this.form[_xfa_object.$globalData].fontFinder.add(fonts, reallyMissingFonts);
  54602. }
  54603. async getPages() {
  54604. if (!this.pages) {
  54605. await this._createPages();
  54606. }
  54607. const pages = this.pages;
  54608. this.pages = null;
  54609. return pages;
  54610. }
  54611. serializeData(storage) {
  54612. return this.dataHandler.serialize(storage);
  54613. }
  54614. static _createDocument(data) {
  54615. if (!data["/xdp:xdp"]) {
  54616. return data["xdp:xdp"];
  54617. }
  54618. return Object.values(data).join("");
  54619. }
  54620. static getRichTextAsHtml(rc) {
  54621. if (!rc || typeof rc !== "string") {
  54622. return null;
  54623. }
  54624. try {
  54625. let root = new _parser.XFAParser(_xhtml.XhtmlNamespace, true).parse(rc);
  54626. if (!["body", "xhtml"].includes(root[_xfa_object.$nodeName])) {
  54627. const newRoot = _xhtml.XhtmlNamespace.body({});
  54628. newRoot[_xfa_object.$appendChild](root);
  54629. root = newRoot;
  54630. }
  54631. const result = root[_xfa_object.$toHTML]();
  54632. if (!result.success) {
  54633. return null;
  54634. }
  54635. const {
  54636. html
  54637. } = result;
  54638. const {
  54639. attributes
  54640. } = html;
  54641. if (attributes) {
  54642. if (attributes.class) {
  54643. attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa"));
  54644. }
  54645. attributes.dir = "auto";
  54646. }
  54647. return {
  54648. html,
  54649. str: root[_xfa_object.$text]()
  54650. };
  54651. } catch (e) {
  54652. (0, _util.warn)(`XFA - an error occurred during parsing of rich text: ${e}`);
  54653. }
  54654. return null;
  54655. }
  54656. }
  54657. exports.XFAFactory = XFAFactory;
  54658. /***/ }),
  54659. /* 202 */
  54660. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54661. "use strict";
  54662. Object.defineProperty(exports, "__esModule", ({
  54663. value: true
  54664. }));
  54665. 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;
  54666. var _utils = __w_pdfjs_require__(203);
  54667. var _util = __w_pdfjs_require__(2);
  54668. var _core_utils = __w_pdfjs_require__(131);
  54669. var _namespaces = __w_pdfjs_require__(204);
  54670. var _som = __w_pdfjs_require__(205);
  54671. const $acceptWhitespace = Symbol();
  54672. exports.$acceptWhitespace = $acceptWhitespace;
  54673. const $addHTML = Symbol();
  54674. exports.$addHTML = $addHTML;
  54675. const $appendChild = Symbol();
  54676. exports.$appendChild = $appendChild;
  54677. const $childrenToHTML = Symbol();
  54678. exports.$childrenToHTML = $childrenToHTML;
  54679. const $clean = Symbol();
  54680. exports.$clean = $clean;
  54681. const $cleanPage = Symbol();
  54682. exports.$cleanPage = $cleanPage;
  54683. const $cleanup = Symbol();
  54684. exports.$cleanup = $cleanup;
  54685. const $clone = Symbol();
  54686. exports.$clone = $clone;
  54687. const $consumed = Symbol();
  54688. exports.$consumed = $consumed;
  54689. const $content = Symbol("content");
  54690. exports.$content = $content;
  54691. const $data = Symbol("data");
  54692. exports.$data = $data;
  54693. const $dump = Symbol();
  54694. exports.$dump = $dump;
  54695. const $extra = Symbol("extra");
  54696. exports.$extra = $extra;
  54697. const $finalize = Symbol();
  54698. exports.$finalize = $finalize;
  54699. const $flushHTML = Symbol();
  54700. exports.$flushHTML = $flushHTML;
  54701. const $getAttributeIt = Symbol();
  54702. exports.$getAttributeIt = $getAttributeIt;
  54703. const $getAttributes = Symbol();
  54704. exports.$getAttributes = $getAttributes;
  54705. const $getAvailableSpace = Symbol();
  54706. exports.$getAvailableSpace = $getAvailableSpace;
  54707. const $getChildrenByClass = Symbol();
  54708. exports.$getChildrenByClass = $getChildrenByClass;
  54709. const $getChildrenByName = Symbol();
  54710. exports.$getChildrenByName = $getChildrenByName;
  54711. const $getChildrenByNameIt = Symbol();
  54712. exports.$getChildrenByNameIt = $getChildrenByNameIt;
  54713. const $getDataValue = Symbol();
  54714. exports.$getDataValue = $getDataValue;
  54715. const $getExtra = Symbol();
  54716. exports.$getExtra = $getExtra;
  54717. const $getRealChildrenByNameIt = Symbol();
  54718. exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt;
  54719. const $getChildren = Symbol();
  54720. exports.$getChildren = $getChildren;
  54721. const $getContainedChildren = Symbol();
  54722. exports.$getContainedChildren = $getContainedChildren;
  54723. const $getNextPage = Symbol();
  54724. exports.$getNextPage = $getNextPage;
  54725. const $getSubformParent = Symbol();
  54726. exports.$getSubformParent = $getSubformParent;
  54727. const $getParent = Symbol();
  54728. exports.$getParent = $getParent;
  54729. const $getTemplateRoot = Symbol();
  54730. exports.$getTemplateRoot = $getTemplateRoot;
  54731. const $globalData = Symbol();
  54732. exports.$globalData = $globalData;
  54733. const $hasSettableValue = Symbol();
  54734. exports.$hasSettableValue = $hasSettableValue;
  54735. const $ids = Symbol();
  54736. exports.$ids = $ids;
  54737. const $indexOf = Symbol();
  54738. exports.$indexOf = $indexOf;
  54739. const $insertAt = Symbol();
  54740. exports.$insertAt = $insertAt;
  54741. const $isCDATAXml = Symbol();
  54742. exports.$isCDATAXml = $isCDATAXml;
  54743. const $isBindable = Symbol();
  54744. exports.$isBindable = $isBindable;
  54745. const $isDataValue = Symbol();
  54746. exports.$isDataValue = $isDataValue;
  54747. const $isDescendent = Symbol();
  54748. exports.$isDescendent = $isDescendent;
  54749. const $isNsAgnostic = Symbol();
  54750. exports.$isNsAgnostic = $isNsAgnostic;
  54751. const $isSplittable = Symbol();
  54752. exports.$isSplittable = $isSplittable;
  54753. const $isThereMoreWidth = Symbol();
  54754. exports.$isThereMoreWidth = $isThereMoreWidth;
  54755. const $isTransparent = Symbol();
  54756. exports.$isTransparent = $isTransparent;
  54757. const $isUsable = Symbol();
  54758. exports.$isUsable = $isUsable;
  54759. const $lastAttribute = Symbol();
  54760. const $namespaceId = Symbol("namespaceId");
  54761. exports.$namespaceId = $namespaceId;
  54762. const $nodeName = Symbol("nodeName");
  54763. exports.$nodeName = $nodeName;
  54764. const $nsAttributes = Symbol();
  54765. exports.$nsAttributes = $nsAttributes;
  54766. const $onChild = Symbol();
  54767. exports.$onChild = $onChild;
  54768. const $onChildCheck = Symbol();
  54769. exports.$onChildCheck = $onChildCheck;
  54770. const $onText = Symbol();
  54771. exports.$onText = $onText;
  54772. const $pushGlyphs = Symbol();
  54773. exports.$pushGlyphs = $pushGlyphs;
  54774. const $popPara = Symbol();
  54775. exports.$popPara = $popPara;
  54776. const $pushPara = Symbol();
  54777. exports.$pushPara = $pushPara;
  54778. const $removeChild = Symbol();
  54779. exports.$removeChild = $removeChild;
  54780. const $root = Symbol("root");
  54781. exports.$root = $root;
  54782. const $resolvePrototypes = Symbol();
  54783. exports.$resolvePrototypes = $resolvePrototypes;
  54784. const $searchNode = Symbol();
  54785. exports.$searchNode = $searchNode;
  54786. const $setId = Symbol();
  54787. exports.$setId = $setId;
  54788. const $setSetAttributes = Symbol();
  54789. exports.$setSetAttributes = $setSetAttributes;
  54790. const $setValue = Symbol();
  54791. exports.$setValue = $setValue;
  54792. const $tabIndex = Symbol();
  54793. exports.$tabIndex = $tabIndex;
  54794. const $text = Symbol();
  54795. exports.$text = $text;
  54796. const $toPages = Symbol();
  54797. exports.$toPages = $toPages;
  54798. const $toHTML = Symbol();
  54799. exports.$toHTML = $toHTML;
  54800. const $toString = Symbol();
  54801. exports.$toString = $toString;
  54802. const $toStyle = Symbol();
  54803. exports.$toStyle = $toStyle;
  54804. const $uid = Symbol("uid");
  54805. exports.$uid = $uid;
  54806. const _applyPrototype = Symbol();
  54807. const _attributes = Symbol();
  54808. const _attributeNames = Symbol();
  54809. const _children = Symbol("_children");
  54810. const _cloneAttribute = Symbol();
  54811. const _dataValue = Symbol();
  54812. const _defaultValue = Symbol();
  54813. const _filteredChildrenGenerator = Symbol();
  54814. const _getPrototype = Symbol();
  54815. const _getUnsetAttributes = Symbol();
  54816. const _hasChildren = Symbol();
  54817. const _max = Symbol();
  54818. const _options = Symbol();
  54819. const _parent = Symbol("parent");
  54820. const _resolvePrototypesHelper = Symbol();
  54821. const _setAttributes = Symbol();
  54822. const _validator = Symbol();
  54823. let uid = 0;
  54824. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  54825. class XFAObject {
  54826. constructor(nsId, name) {
  54827. let hasChildren = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  54828. this[$namespaceId] = nsId;
  54829. this[$nodeName] = name;
  54830. this[_hasChildren] = hasChildren;
  54831. this[_parent] = null;
  54832. this[_children] = [];
  54833. this[$uid] = `${name}${uid++}`;
  54834. this[$globalData] = null;
  54835. }
  54836. [$onChild](child) {
  54837. if (!this[_hasChildren] || !this[$onChildCheck](child)) {
  54838. return false;
  54839. }
  54840. const name = child[$nodeName];
  54841. const node = this[name];
  54842. if (node instanceof XFAObjectArray) {
  54843. if (node.push(child)) {
  54844. this[$appendChild](child);
  54845. return true;
  54846. }
  54847. } else {
  54848. if (node !== null) {
  54849. this[$removeChild](node);
  54850. }
  54851. this[name] = child;
  54852. this[$appendChild](child);
  54853. return true;
  54854. }
  54855. let id = "";
  54856. if (this.id) {
  54857. id = ` (id: ${this.id})`;
  54858. } else if (this.name) {
  54859. id = ` (name: ${this.name} ${this.h.value})`;
  54860. }
  54861. (0, _util.warn)(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`);
  54862. return false;
  54863. }
  54864. [$onChildCheck](child) {
  54865. return this.hasOwnProperty(child[$nodeName]) && child[$namespaceId] === this[$namespaceId];
  54866. }
  54867. [$isNsAgnostic]() {
  54868. return false;
  54869. }
  54870. [$acceptWhitespace]() {
  54871. return false;
  54872. }
  54873. [$isCDATAXml]() {
  54874. return false;
  54875. }
  54876. [$isBindable]() {
  54877. return false;
  54878. }
  54879. [$popPara]() {
  54880. if (this.para) {
  54881. this[$getTemplateRoot]()[$extra].paraStack.pop();
  54882. }
  54883. }
  54884. [$pushPara]() {
  54885. this[$getTemplateRoot]()[$extra].paraStack.push(this.para);
  54886. }
  54887. [$setId](ids) {
  54888. if (this.id && this[$namespaceId] === _namespaces.NamespaceIds.template.id) {
  54889. ids.set(this.id, this);
  54890. }
  54891. }
  54892. [$getTemplateRoot]() {
  54893. return this[$globalData].template;
  54894. }
  54895. [$isSplittable]() {
  54896. return false;
  54897. }
  54898. [$isThereMoreWidth]() {
  54899. return false;
  54900. }
  54901. [$appendChild](child) {
  54902. child[_parent] = this;
  54903. this[_children].push(child);
  54904. if (!child[$globalData] && this[$globalData]) {
  54905. child[$globalData] = this[$globalData];
  54906. }
  54907. }
  54908. [$removeChild](child) {
  54909. const i = this[_children].indexOf(child);
  54910. this[_children].splice(i, 1);
  54911. }
  54912. [$hasSettableValue]() {
  54913. return this.hasOwnProperty("value");
  54914. }
  54915. [$setValue](_) {}
  54916. [$onText](_) {}
  54917. [$finalize]() {}
  54918. [$clean](builder) {
  54919. delete this[_hasChildren];
  54920. if (this[$cleanup]) {
  54921. builder.clean(this[$cleanup]);
  54922. delete this[$cleanup];
  54923. }
  54924. }
  54925. [$indexOf](child) {
  54926. return this[_children].indexOf(child);
  54927. }
  54928. [$insertAt](i, child) {
  54929. child[_parent] = this;
  54930. this[_children].splice(i, 0, child);
  54931. if (!child[$globalData] && this[$globalData]) {
  54932. child[$globalData] = this[$globalData];
  54933. }
  54934. }
  54935. [$isTransparent]() {
  54936. return !this.name;
  54937. }
  54938. [$lastAttribute]() {
  54939. return "";
  54940. }
  54941. [$text]() {
  54942. if (this[_children].length === 0) {
  54943. return this[$content];
  54944. }
  54945. return this[_children].map(c => c[$text]()).join("");
  54946. }
  54947. get [_attributeNames]() {
  54948. const proto = Object.getPrototypeOf(this);
  54949. if (!proto._attributes) {
  54950. const attributes = proto._attributes = new Set();
  54951. for (const name of Object.getOwnPropertyNames(this)) {
  54952. if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) {
  54953. break;
  54954. }
  54955. attributes.add(name);
  54956. }
  54957. }
  54958. return (0, _util.shadow)(this, _attributeNames, proto._attributes);
  54959. }
  54960. [$isDescendent](parent) {
  54961. let node = this;
  54962. while (node) {
  54963. if (node === parent) {
  54964. return true;
  54965. }
  54966. node = node[$getParent]();
  54967. }
  54968. return false;
  54969. }
  54970. [$getParent]() {
  54971. return this[_parent];
  54972. }
  54973. [$getSubformParent]() {
  54974. return this[$getParent]();
  54975. }
  54976. [$getChildren]() {
  54977. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  54978. if (!name) {
  54979. return this[_children];
  54980. }
  54981. return this[name];
  54982. }
  54983. [$dump]() {
  54984. const dumped = Object.create(null);
  54985. if (this[$content]) {
  54986. dumped.$content = this[$content];
  54987. }
  54988. for (const name of Object.getOwnPropertyNames(this)) {
  54989. const value = this[name];
  54990. if (value === null) {
  54991. continue;
  54992. }
  54993. if (value instanceof XFAObject) {
  54994. dumped[name] = value[$dump]();
  54995. } else if (value instanceof XFAObjectArray) {
  54996. if (!value.isEmpty()) {
  54997. dumped[name] = value.dump();
  54998. }
  54999. } else {
  55000. dumped[name] = value;
  55001. }
  55002. }
  55003. return dumped;
  55004. }
  55005. [$toStyle]() {
  55006. return null;
  55007. }
  55008. [$toHTML]() {
  55009. return _utils.HTMLResult.EMPTY;
  55010. }
  55011. *[$getContainedChildren]() {
  55012. for (const node of this[$getChildren]()) {
  55013. yield node;
  55014. }
  55015. }
  55016. *[_filteredChildrenGenerator](filter, include) {
  55017. for (const node of this[$getContainedChildren]()) {
  55018. if (!filter || include === filter.has(node[$nodeName])) {
  55019. const availableSpace = this[$getAvailableSpace]();
  55020. const res = node[$toHTML](availableSpace);
  55021. if (!res.success) {
  55022. this[$extra].failingNode = node;
  55023. }
  55024. yield res;
  55025. }
  55026. }
  55027. }
  55028. [$flushHTML]() {
  55029. return null;
  55030. }
  55031. [$addHTML](html, bbox) {
  55032. this[$extra].children.push(html);
  55033. }
  55034. [$getAvailableSpace]() {}
  55035. [$childrenToHTML](_ref) {
  55036. let {
  55037. filter = null,
  55038. include = true
  55039. } = _ref;
  55040. if (!this[$extra].generator) {
  55041. this[$extra].generator = this[_filteredChildrenGenerator](filter, include);
  55042. } else {
  55043. const availableSpace = this[$getAvailableSpace]();
  55044. const res = this[$extra].failingNode[$toHTML](availableSpace);
  55045. if (!res.success) {
  55046. return res;
  55047. }
  55048. if (res.html) {
  55049. this[$addHTML](res.html, res.bbox);
  55050. }
  55051. delete this[$extra].failingNode;
  55052. }
  55053. while (true) {
  55054. const gen = this[$extra].generator.next();
  55055. if (gen.done) {
  55056. break;
  55057. }
  55058. const res = gen.value;
  55059. if (!res.success) {
  55060. return res;
  55061. }
  55062. if (res.html) {
  55063. this[$addHTML](res.html, res.bbox);
  55064. }
  55065. }
  55066. this[$extra].generator = null;
  55067. return _utils.HTMLResult.EMPTY;
  55068. }
  55069. [$setSetAttributes](attributes) {
  55070. this[_setAttributes] = new Set(Object.keys(attributes));
  55071. }
  55072. [_getUnsetAttributes](protoAttributes) {
  55073. const allAttr = this[_attributeNames];
  55074. const setAttr = this[_setAttributes];
  55075. return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x));
  55076. }
  55077. [$resolvePrototypes](ids) {
  55078. let ancestors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Set();
  55079. for (const child of this[_children]) {
  55080. child[_resolvePrototypesHelper](ids, ancestors);
  55081. }
  55082. }
  55083. [_resolvePrototypesHelper](ids, ancestors) {
  55084. const proto = this[_getPrototype](ids, ancestors);
  55085. if (proto) {
  55086. this[_applyPrototype](proto, ids, ancestors);
  55087. } else {
  55088. this[$resolvePrototypes](ids, ancestors);
  55089. }
  55090. }
  55091. [_getPrototype](ids, ancestors) {
  55092. const {
  55093. use,
  55094. usehref
  55095. } = this;
  55096. if (!use && !usehref) {
  55097. return null;
  55098. }
  55099. let proto = null;
  55100. let somExpression = null;
  55101. let id = null;
  55102. let ref = use;
  55103. if (usehref) {
  55104. ref = usehref;
  55105. if (usehref.startsWith("#som(") && usehref.endsWith(")")) {
  55106. somExpression = usehref.slice("#som(".length, usehref.length - 1);
  55107. } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) {
  55108. somExpression = usehref.slice(".#som(".length, usehref.length - 1);
  55109. } else if (usehref.startsWith("#")) {
  55110. id = usehref.slice(1);
  55111. } else if (usehref.startsWith(".#")) {
  55112. id = usehref.slice(2);
  55113. }
  55114. } else if (use.startsWith("#")) {
  55115. id = use.slice(1);
  55116. } else {
  55117. somExpression = use;
  55118. }
  55119. this.use = this.usehref = "";
  55120. if (id) {
  55121. proto = ids.get(id);
  55122. } else {
  55123. proto = (0, _som.searchNode)(ids.get($root), this, somExpression, true, false);
  55124. if (proto) {
  55125. proto = proto[0];
  55126. }
  55127. }
  55128. if (!proto) {
  55129. (0, _util.warn)(`XFA - Invalid prototype reference: ${ref}.`);
  55130. return null;
  55131. }
  55132. if (proto[$nodeName] !== this[$nodeName]) {
  55133. (0, _util.warn)(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`);
  55134. return null;
  55135. }
  55136. if (ancestors.has(proto)) {
  55137. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  55138. return null;
  55139. }
  55140. ancestors.add(proto);
  55141. const protoProto = proto[_getPrototype](ids, ancestors);
  55142. if (protoProto) {
  55143. proto[_applyPrototype](protoProto, ids, ancestors);
  55144. }
  55145. proto[$resolvePrototypes](ids, ancestors);
  55146. ancestors.delete(proto);
  55147. return proto;
  55148. }
  55149. [_applyPrototype](proto, ids, ancestors) {
  55150. if (ancestors.has(proto)) {
  55151. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  55152. return;
  55153. }
  55154. if (!this[$content] && proto[$content]) {
  55155. this[$content] = proto[$content];
  55156. }
  55157. const newAncestors = new Set(ancestors);
  55158. newAncestors.add(proto);
  55159. for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) {
  55160. this[unsetAttrName] = proto[unsetAttrName];
  55161. if (this[_setAttributes]) {
  55162. this[_setAttributes].add(unsetAttrName);
  55163. }
  55164. }
  55165. for (const name of Object.getOwnPropertyNames(this)) {
  55166. if (this[_attributeNames].has(name)) {
  55167. continue;
  55168. }
  55169. const value = this[name];
  55170. const protoValue = proto[name];
  55171. if (value instanceof XFAObjectArray) {
  55172. for (const child of value[_children]) {
  55173. child[_resolvePrototypesHelper](ids, ancestors);
  55174. }
  55175. for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) {
  55176. const child = proto[_children][i][$clone]();
  55177. if (value.push(child)) {
  55178. child[_parent] = this;
  55179. this[_children].push(child);
  55180. child[_resolvePrototypesHelper](ids, ancestors);
  55181. } else {
  55182. break;
  55183. }
  55184. }
  55185. continue;
  55186. }
  55187. if (value !== null) {
  55188. value[$resolvePrototypes](ids, ancestors);
  55189. if (protoValue) {
  55190. value[_applyPrototype](protoValue, ids, ancestors);
  55191. }
  55192. continue;
  55193. }
  55194. if (protoValue !== null) {
  55195. const child = protoValue[$clone]();
  55196. child[_parent] = this;
  55197. this[name] = child;
  55198. this[_children].push(child);
  55199. child[_resolvePrototypesHelper](ids, ancestors);
  55200. }
  55201. }
  55202. }
  55203. static [_cloneAttribute](obj) {
  55204. if (Array.isArray(obj)) {
  55205. return obj.map(x => XFAObject[_cloneAttribute](x));
  55206. }
  55207. if (typeof obj === "object" && obj !== null) {
  55208. return Object.assign({}, obj);
  55209. }
  55210. return obj;
  55211. }
  55212. [$clone]() {
  55213. const clone = Object.create(Object.getPrototypeOf(this));
  55214. for (const $symbol of Object.getOwnPropertySymbols(this)) {
  55215. try {
  55216. clone[$symbol] = this[$symbol];
  55217. } catch (_) {
  55218. (0, _util.shadow)(clone, $symbol, this[$symbol]);
  55219. }
  55220. }
  55221. clone[$uid] = `${clone[$nodeName]}${uid++}`;
  55222. clone[_children] = [];
  55223. for (const name of Object.getOwnPropertyNames(this)) {
  55224. if (this[_attributeNames].has(name)) {
  55225. clone[name] = XFAObject[_cloneAttribute](this[name]);
  55226. continue;
  55227. }
  55228. const value = this[name];
  55229. if (value instanceof XFAObjectArray) {
  55230. clone[name] = new XFAObjectArray(value[_max]);
  55231. } else {
  55232. clone[name] = null;
  55233. }
  55234. }
  55235. for (const child of this[_children]) {
  55236. const name = child[$nodeName];
  55237. const clonedChild = child[$clone]();
  55238. clone[_children].push(clonedChild);
  55239. clonedChild[_parent] = clone;
  55240. if (clone[name] === null) {
  55241. clone[name] = clonedChild;
  55242. } else {
  55243. clone[name][_children].push(clonedChild);
  55244. }
  55245. }
  55246. return clone;
  55247. }
  55248. [$getChildren]() {
  55249. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  55250. if (!name) {
  55251. return this[_children];
  55252. }
  55253. return this[_children].filter(c => c[$nodeName] === name);
  55254. }
  55255. [$getChildrenByClass](name) {
  55256. return this[name];
  55257. }
  55258. [$getChildrenByName](name, allTransparent) {
  55259. let first = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  55260. return Array.from(this[$getChildrenByNameIt](name, allTransparent, first));
  55261. }
  55262. *[$getChildrenByNameIt](name, allTransparent) {
  55263. let first = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  55264. if (name === "parent") {
  55265. yield this[_parent];
  55266. return;
  55267. }
  55268. for (const child of this[_children]) {
  55269. if (child[$nodeName] === name) {
  55270. yield child;
  55271. }
  55272. if (child.name === name) {
  55273. yield child;
  55274. }
  55275. if (allTransparent || child[$isTransparent]()) {
  55276. yield* child[$getChildrenByNameIt](name, allTransparent, false);
  55277. }
  55278. }
  55279. if (first && this[_attributeNames].has(name)) {
  55280. yield new XFAAttribute(this, name, this[name]);
  55281. }
  55282. }
  55283. }
  55284. exports.XFAObject = XFAObject;
  55285. class XFAObjectArray {
  55286. constructor() {
  55287. let max = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Infinity;
  55288. this[_max] = max;
  55289. this[_children] = [];
  55290. }
  55291. push(child) {
  55292. const len = this[_children].length;
  55293. if (len <= this[_max]) {
  55294. this[_children].push(child);
  55295. return true;
  55296. }
  55297. (0, _util.warn)(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`);
  55298. return false;
  55299. }
  55300. isEmpty() {
  55301. return this[_children].length === 0;
  55302. }
  55303. dump() {
  55304. return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]());
  55305. }
  55306. [$clone]() {
  55307. const clone = new XFAObjectArray(this[_max]);
  55308. clone[_children] = this[_children].map(c => c[$clone]());
  55309. return clone;
  55310. }
  55311. get children() {
  55312. return this[_children];
  55313. }
  55314. clear() {
  55315. this[_children].length = 0;
  55316. }
  55317. }
  55318. exports.XFAObjectArray = XFAObjectArray;
  55319. class XFAAttribute {
  55320. constructor(node, name, value) {
  55321. this[_parent] = node;
  55322. this[$nodeName] = name;
  55323. this[$content] = value;
  55324. this[$consumed] = false;
  55325. this[$uid] = `attribute${uid++}`;
  55326. }
  55327. [$getParent]() {
  55328. return this[_parent];
  55329. }
  55330. [$isDataValue]() {
  55331. return true;
  55332. }
  55333. [$getDataValue]() {
  55334. return this[$content].trim();
  55335. }
  55336. [$setValue](value) {
  55337. value = value.value || "";
  55338. this[$content] = value.toString();
  55339. }
  55340. [$text]() {
  55341. return this[$content];
  55342. }
  55343. [$isDescendent](parent) {
  55344. return this[_parent] === parent || this[_parent][$isDescendent](parent);
  55345. }
  55346. }
  55347. exports.XFAAttribute = XFAAttribute;
  55348. class XmlObject extends XFAObject {
  55349. constructor(nsId, name) {
  55350. let attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  55351. super(nsId, name);
  55352. this[$content] = "";
  55353. this[_dataValue] = null;
  55354. if (name !== "#text") {
  55355. const map = new Map();
  55356. this[_attributes] = map;
  55357. for (const [attrName, value] of Object.entries(attributes)) {
  55358. map.set(attrName, new XFAAttribute(this, attrName, value));
  55359. }
  55360. if (attributes.hasOwnProperty($nsAttributes)) {
  55361. const dataNode = attributes[$nsAttributes].xfa.dataNode;
  55362. if (dataNode !== undefined) {
  55363. if (dataNode === "dataGroup") {
  55364. this[_dataValue] = false;
  55365. } else if (dataNode === "dataValue") {
  55366. this[_dataValue] = true;
  55367. }
  55368. }
  55369. }
  55370. }
  55371. this[$consumed] = false;
  55372. }
  55373. [$toString](buf) {
  55374. const tagName = this[$nodeName];
  55375. if (tagName === "#text") {
  55376. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  55377. return;
  55378. }
  55379. const utf8TagName = (0, _util.utf8StringToString)(tagName);
  55380. const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : "";
  55381. buf.push(`<${prefix}${utf8TagName}`);
  55382. for (const [name, value] of this[_attributes].entries()) {
  55383. const utf8Name = (0, _util.utf8StringToString)(name);
  55384. buf.push(` ${utf8Name}="${(0, _core_utils.encodeToXmlString)(value[$content])}"`);
  55385. }
  55386. if (this[_dataValue] !== null) {
  55387. if (this[_dataValue]) {
  55388. buf.push(` xfa:dataNode="dataValue"`);
  55389. } else {
  55390. buf.push(` xfa:dataNode="dataGroup"`);
  55391. }
  55392. }
  55393. if (!this[$content] && this[_children].length === 0) {
  55394. buf.push("/>");
  55395. return;
  55396. }
  55397. buf.push(">");
  55398. if (this[$content]) {
  55399. if (typeof this[$content] === "string") {
  55400. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  55401. } else {
  55402. this[$content][$toString](buf);
  55403. }
  55404. } else {
  55405. for (const child of this[_children]) {
  55406. child[$toString](buf);
  55407. }
  55408. }
  55409. buf.push(`</${prefix}${utf8TagName}>`);
  55410. }
  55411. [$onChild](child) {
  55412. if (this[$content]) {
  55413. const node = new XmlObject(this[$namespaceId], "#text");
  55414. this[$appendChild](node);
  55415. node[$content] = this[$content];
  55416. this[$content] = "";
  55417. }
  55418. this[$appendChild](child);
  55419. return true;
  55420. }
  55421. [$onText](str) {
  55422. this[$content] += str;
  55423. }
  55424. [$finalize]() {
  55425. if (this[$content] && this[_children].length > 0) {
  55426. const node = new XmlObject(this[$namespaceId], "#text");
  55427. this[$appendChild](node);
  55428. node[$content] = this[$content];
  55429. delete this[$content];
  55430. }
  55431. }
  55432. [$toHTML]() {
  55433. if (this[$nodeName] === "#text") {
  55434. return _utils.HTMLResult.success({
  55435. name: "#text",
  55436. value: this[$content]
  55437. });
  55438. }
  55439. return _utils.HTMLResult.EMPTY;
  55440. }
  55441. [$getChildren]() {
  55442. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  55443. if (!name) {
  55444. return this[_children];
  55445. }
  55446. return this[_children].filter(c => c[$nodeName] === name);
  55447. }
  55448. [$getAttributes]() {
  55449. return this[_attributes];
  55450. }
  55451. [$getChildrenByClass](name) {
  55452. const value = this[_attributes].get(name);
  55453. if (value !== undefined) {
  55454. return value;
  55455. }
  55456. return this[$getChildren](name);
  55457. }
  55458. *[$getChildrenByNameIt](name, allTransparent) {
  55459. const value = this[_attributes].get(name);
  55460. if (value) {
  55461. yield value;
  55462. }
  55463. for (const child of this[_children]) {
  55464. if (child[$nodeName] === name) {
  55465. yield child;
  55466. }
  55467. if (allTransparent) {
  55468. yield* child[$getChildrenByNameIt](name, allTransparent);
  55469. }
  55470. }
  55471. }
  55472. *[$getAttributeIt](name, skipConsumed) {
  55473. const value = this[_attributes].get(name);
  55474. if (value && (!skipConsumed || !value[$consumed])) {
  55475. yield value;
  55476. }
  55477. for (const child of this[_children]) {
  55478. yield* child[$getAttributeIt](name, skipConsumed);
  55479. }
  55480. }
  55481. *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {
  55482. for (const child of this[_children]) {
  55483. if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) {
  55484. yield child;
  55485. }
  55486. if (allTransparent) {
  55487. yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed);
  55488. }
  55489. }
  55490. }
  55491. [$isDataValue]() {
  55492. if (this[_dataValue] === null) {
  55493. return this[_children].length === 0 || this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id;
  55494. }
  55495. return this[_dataValue];
  55496. }
  55497. [$getDataValue]() {
  55498. if (this[_dataValue] === null) {
  55499. if (this[_children].length === 0) {
  55500. return this[$content].trim();
  55501. }
  55502. if (this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  55503. return this[_children][0][$text]().trim();
  55504. }
  55505. return null;
  55506. }
  55507. return this[$content].trim();
  55508. }
  55509. [$setValue](value) {
  55510. value = value.value || "";
  55511. this[$content] = value.toString();
  55512. }
  55513. [$dump]() {
  55514. let hasNS = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  55515. const dumped = Object.create(null);
  55516. if (hasNS) {
  55517. dumped.$ns = this[$namespaceId];
  55518. }
  55519. if (this[$content]) {
  55520. dumped.$content = this[$content];
  55521. }
  55522. dumped.$name = this[$nodeName];
  55523. dumped.children = [];
  55524. for (const child of this[_children]) {
  55525. dumped.children.push(child[$dump](hasNS));
  55526. }
  55527. dumped.attributes = Object.create(null);
  55528. for (const [name, value] of this[_attributes]) {
  55529. dumped.attributes[name] = value[$content];
  55530. }
  55531. return dumped;
  55532. }
  55533. }
  55534. exports.XmlObject = XmlObject;
  55535. class ContentObject extends XFAObject {
  55536. constructor(nsId, name) {
  55537. super(nsId, name);
  55538. this[$content] = "";
  55539. }
  55540. [$onText](text) {
  55541. this[$content] += text;
  55542. }
  55543. [$finalize]() {}
  55544. }
  55545. exports.ContentObject = ContentObject;
  55546. class OptionObject extends ContentObject {
  55547. constructor(nsId, name, options) {
  55548. super(nsId, name);
  55549. this[_options] = options;
  55550. }
  55551. [$finalize]() {
  55552. this[$content] = (0, _utils.getKeyword)({
  55553. data: this[$content],
  55554. defaultValue: this[_options][0],
  55555. validate: k => this[_options].includes(k)
  55556. });
  55557. }
  55558. [$clean](builder) {
  55559. super[$clean](builder);
  55560. delete this[_options];
  55561. }
  55562. }
  55563. exports.OptionObject = OptionObject;
  55564. class StringObject extends ContentObject {
  55565. [$finalize]() {
  55566. this[$content] = this[$content].trim();
  55567. }
  55568. }
  55569. exports.StringObject = StringObject;
  55570. class IntegerObject extends ContentObject {
  55571. constructor(nsId, name, defaultValue, validator) {
  55572. super(nsId, name);
  55573. this[_defaultValue] = defaultValue;
  55574. this[_validator] = validator;
  55575. }
  55576. [$finalize]() {
  55577. this[$content] = (0, _utils.getInteger)({
  55578. data: this[$content],
  55579. defaultValue: this[_defaultValue],
  55580. validate: this[_validator]
  55581. });
  55582. }
  55583. [$clean](builder) {
  55584. super[$clean](builder);
  55585. delete this[_defaultValue];
  55586. delete this[_validator];
  55587. }
  55588. }
  55589. exports.IntegerObject = IntegerObject;
  55590. class Option01 extends IntegerObject {
  55591. constructor(nsId, name) {
  55592. super(nsId, name, 0, n => n === 1);
  55593. }
  55594. }
  55595. exports.Option01 = Option01;
  55596. class Option10 extends IntegerObject {
  55597. constructor(nsId, name) {
  55598. super(nsId, name, 1, n => n === 0);
  55599. }
  55600. }
  55601. exports.Option10 = Option10;
  55602. /***/ }),
  55603. /* 203 */
  55604. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  55605. "use strict";
  55606. Object.defineProperty(exports, "__esModule", ({
  55607. value: true
  55608. }));
  55609. exports.HTMLResult = void 0;
  55610. exports.getBBox = getBBox;
  55611. exports.getColor = getColor;
  55612. exports.getFloat = getFloat;
  55613. exports.getInteger = getInteger;
  55614. exports.getKeyword = getKeyword;
  55615. exports.getMeasurement = getMeasurement;
  55616. exports.getRatio = getRatio;
  55617. exports.getRelevant = getRelevant;
  55618. exports.getStringOption = getStringOption;
  55619. exports.stripQuotes = stripQuotes;
  55620. var _util = __w_pdfjs_require__(2);
  55621. const dimConverters = {
  55622. pt: x => x,
  55623. cm: x => x / 2.54 * 72,
  55624. mm: x => x / (10 * 2.54) * 72,
  55625. in: x => x * 72,
  55626. px: x => x
  55627. };
  55628. const measurementPattern = /([+-]?\d+\.?\d*)(.*)/;
  55629. function stripQuotes(str) {
  55630. if (str.startsWith("'") || str.startsWith('"')) {
  55631. return str.slice(1, str.length - 1);
  55632. }
  55633. return str;
  55634. }
  55635. function getInteger(_ref) {
  55636. let {
  55637. data,
  55638. defaultValue,
  55639. validate
  55640. } = _ref;
  55641. if (!data) {
  55642. return defaultValue;
  55643. }
  55644. data = data.trim();
  55645. const n = parseInt(data, 10);
  55646. if (!isNaN(n) && validate(n)) {
  55647. return n;
  55648. }
  55649. return defaultValue;
  55650. }
  55651. function getFloat(_ref2) {
  55652. let {
  55653. data,
  55654. defaultValue,
  55655. validate
  55656. } = _ref2;
  55657. if (!data) {
  55658. return defaultValue;
  55659. }
  55660. data = data.trim();
  55661. const n = parseFloat(data);
  55662. if (!isNaN(n) && validate(n)) {
  55663. return n;
  55664. }
  55665. return defaultValue;
  55666. }
  55667. function getKeyword(_ref3) {
  55668. let {
  55669. data,
  55670. defaultValue,
  55671. validate
  55672. } = _ref3;
  55673. if (!data) {
  55674. return defaultValue;
  55675. }
  55676. data = data.trim();
  55677. if (validate(data)) {
  55678. return data;
  55679. }
  55680. return defaultValue;
  55681. }
  55682. function getStringOption(data, options) {
  55683. return getKeyword({
  55684. data,
  55685. defaultValue: options[0],
  55686. validate: k => options.includes(k)
  55687. });
  55688. }
  55689. function getMeasurement(str) {
  55690. let def = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "0";
  55691. def = def || "0";
  55692. if (!str) {
  55693. return getMeasurement(def);
  55694. }
  55695. const match = str.trim().match(measurementPattern);
  55696. if (!match) {
  55697. return getMeasurement(def);
  55698. }
  55699. const [, valueStr, unit] = match;
  55700. const value = parseFloat(valueStr);
  55701. if (isNaN(value)) {
  55702. return getMeasurement(def);
  55703. }
  55704. if (value === 0) {
  55705. return 0;
  55706. }
  55707. const conv = dimConverters[unit];
  55708. if (conv) {
  55709. return conv(value);
  55710. }
  55711. return value;
  55712. }
  55713. function getRatio(data) {
  55714. if (!data) {
  55715. return {
  55716. num: 1,
  55717. den: 1
  55718. };
  55719. }
  55720. const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x));
  55721. if (ratio.length === 1) {
  55722. ratio.push(1);
  55723. }
  55724. if (ratio.length === 0) {
  55725. return {
  55726. num: 1,
  55727. den: 1
  55728. };
  55729. }
  55730. const [num, den] = ratio;
  55731. return {
  55732. num,
  55733. den
  55734. };
  55735. }
  55736. function getRelevant(data) {
  55737. if (!data) {
  55738. return [];
  55739. }
  55740. return data.trim().split(/\s+/).map(e => {
  55741. return {
  55742. excluded: e[0] === "-",
  55743. viewname: e.substring(1)
  55744. };
  55745. });
  55746. }
  55747. function getColor(data) {
  55748. let def = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0];
  55749. let [r, g, b] = def;
  55750. if (!data) {
  55751. return {
  55752. r,
  55753. g,
  55754. b
  55755. };
  55756. }
  55757. 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);
  55758. if (color.length < 3) {
  55759. return {
  55760. r,
  55761. g,
  55762. b
  55763. };
  55764. }
  55765. [r, g, b] = color;
  55766. return {
  55767. r,
  55768. g,
  55769. b
  55770. };
  55771. }
  55772. function getBBox(data) {
  55773. const def = -1;
  55774. if (!data) {
  55775. return {
  55776. x: def,
  55777. y: def,
  55778. width: def,
  55779. height: def
  55780. };
  55781. }
  55782. const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1"));
  55783. if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {
  55784. return {
  55785. x: def,
  55786. y: def,
  55787. width: def,
  55788. height: def
  55789. };
  55790. }
  55791. const [x, y, width, height] = bbox;
  55792. return {
  55793. x,
  55794. y,
  55795. width,
  55796. height
  55797. };
  55798. }
  55799. class HTMLResult {
  55800. static get FAILURE() {
  55801. return (0, _util.shadow)(this, "FAILURE", new HTMLResult(false, null, null, null));
  55802. }
  55803. static get EMPTY() {
  55804. return (0, _util.shadow)(this, "EMPTY", new HTMLResult(true, null, null, null));
  55805. }
  55806. constructor(success, html, bbox, breakNode) {
  55807. this.success = success;
  55808. this.html = html;
  55809. this.bbox = bbox;
  55810. this.breakNode = breakNode;
  55811. }
  55812. isBreak() {
  55813. return !!this.breakNode;
  55814. }
  55815. static breakNode(node) {
  55816. return new HTMLResult(false, null, null, node);
  55817. }
  55818. static success(html) {
  55819. let bbox = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  55820. return new HTMLResult(true, html, bbox, null);
  55821. }
  55822. }
  55823. exports.HTMLResult = HTMLResult;
  55824. /***/ }),
  55825. /* 204 */
  55826. /***/ ((__unused_webpack_module, exports) => {
  55827. "use strict";
  55828. Object.defineProperty(exports, "__esModule", ({
  55829. value: true
  55830. }));
  55831. exports.NamespaceIds = exports.$buildXFAObject = void 0;
  55832. const $buildXFAObject = Symbol();
  55833. exports.$buildXFAObject = $buildXFAObject;
  55834. const NamespaceIds = {
  55835. config: {
  55836. id: 0,
  55837. check: ns => ns.startsWith("http://www.xfa.org/schema/xci/")
  55838. },
  55839. connectionSet: {
  55840. id: 1,
  55841. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/")
  55842. },
  55843. datasets: {
  55844. id: 2,
  55845. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/")
  55846. },
  55847. form: {
  55848. id: 3,
  55849. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/")
  55850. },
  55851. localeSet: {
  55852. id: 4,
  55853. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/")
  55854. },
  55855. pdf: {
  55856. id: 5,
  55857. check: ns => ns === "http://ns.adobe.com/xdp/pdf/"
  55858. },
  55859. signature: {
  55860. id: 6,
  55861. check: ns => ns === "http://www.w3.org/2000/09/xmldsig#"
  55862. },
  55863. sourceSet: {
  55864. id: 7,
  55865. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/")
  55866. },
  55867. stylesheet: {
  55868. id: 8,
  55869. check: ns => ns === "http://www.w3.org/1999/XSL/Transform"
  55870. },
  55871. template: {
  55872. id: 9,
  55873. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/")
  55874. },
  55875. xdc: {
  55876. id: 10,
  55877. check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/")
  55878. },
  55879. xdp: {
  55880. id: 11,
  55881. check: ns => ns === "http://ns.adobe.com/xdp/"
  55882. },
  55883. xfdf: {
  55884. id: 12,
  55885. check: ns => ns === "http://ns.adobe.com/xfdf/"
  55886. },
  55887. xhtml: {
  55888. id: 13,
  55889. check: ns => ns === "http://www.w3.org/1999/xhtml"
  55890. },
  55891. xmpmeta: {
  55892. id: 14,
  55893. check: ns => ns === "http://ns.adobe.com/xmpmeta/"
  55894. }
  55895. };
  55896. exports.NamespaceIds = NamespaceIds;
  55897. /***/ }),
  55898. /* 205 */
  55899. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  55900. "use strict";
  55901. Object.defineProperty(exports, "__esModule", ({
  55902. value: true
  55903. }));
  55904. exports.createDataNode = createDataNode;
  55905. exports.searchNode = searchNode;
  55906. var _xfa_object = __w_pdfjs_require__(202);
  55907. var _namespaces = __w_pdfjs_require__(204);
  55908. var _util = __w_pdfjs_require__(2);
  55909. const namePattern = /^[^.[]+/;
  55910. const indexPattern = /^[^\]]+/;
  55911. const operators = {
  55912. dot: 0,
  55913. dotDot: 1,
  55914. dotHash: 2,
  55915. dotBracket: 3,
  55916. dotParen: 4
  55917. };
  55918. 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]]);
  55919. const somCache = new WeakMap();
  55920. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  55921. function parseIndex(index) {
  55922. index = index.trim();
  55923. if (index === "*") {
  55924. return Infinity;
  55925. }
  55926. return parseInt(index, 10) || 0;
  55927. }
  55928. function parseExpression(expr, dotDotAllowed) {
  55929. let noExpr = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  55930. let match = expr.match(namePattern);
  55931. if (!match) {
  55932. return null;
  55933. }
  55934. let [name] = match;
  55935. const parsed = [{
  55936. name,
  55937. cacheName: "." + name,
  55938. index: 0,
  55939. js: null,
  55940. formCalc: null,
  55941. operator: operators.dot
  55942. }];
  55943. let pos = name.length;
  55944. while (pos < expr.length) {
  55945. const spos = pos;
  55946. const char = expr.charAt(pos++);
  55947. if (char === "[") {
  55948. match = expr.slice(pos).match(indexPattern);
  55949. if (!match) {
  55950. (0, _util.warn)("XFA - Invalid index in SOM expression");
  55951. return null;
  55952. }
  55953. parsed.at(-1).index = parseIndex(match[0]);
  55954. pos += match[0].length + 1;
  55955. continue;
  55956. }
  55957. let operator;
  55958. switch (expr.charAt(pos)) {
  55959. case ".":
  55960. if (!dotDotAllowed) {
  55961. return null;
  55962. }
  55963. pos++;
  55964. operator = operators.dotDot;
  55965. break;
  55966. case "#":
  55967. pos++;
  55968. operator = operators.dotHash;
  55969. break;
  55970. case "[":
  55971. if (noExpr) {
  55972. (0, _util.warn)("XFA - SOM expression contains a FormCalc subexpression which is not supported for now.");
  55973. return null;
  55974. }
  55975. operator = operators.dotBracket;
  55976. break;
  55977. case "(":
  55978. if (noExpr) {
  55979. (0, _util.warn)("XFA - SOM expression contains a JavaScript subexpression which is not supported for now.");
  55980. return null;
  55981. }
  55982. operator = operators.dotParen;
  55983. break;
  55984. default:
  55985. operator = operators.dot;
  55986. break;
  55987. }
  55988. match = expr.slice(pos).match(namePattern);
  55989. if (!match) {
  55990. break;
  55991. }
  55992. [name] = match;
  55993. pos += name.length;
  55994. parsed.push({
  55995. name,
  55996. cacheName: expr.slice(spos, pos),
  55997. operator,
  55998. index: 0,
  55999. js: null,
  56000. formCalc: null
  56001. });
  56002. }
  56003. return parsed;
  56004. }
  56005. function searchNode(root, container, expr) {
  56006. let dotDotAllowed = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
  56007. let useCache = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  56008. const parsed = parseExpression(expr, dotDotAllowed);
  56009. if (!parsed) {
  56010. return null;
  56011. }
  56012. const fn = shortcuts.get(parsed[0].name);
  56013. let i = 0;
  56014. let isQualified;
  56015. if (fn) {
  56016. isQualified = true;
  56017. root = [fn(root, container)];
  56018. i = 1;
  56019. } else {
  56020. isQualified = container === null;
  56021. root = [container || root];
  56022. }
  56023. for (let ii = parsed.length; i < ii; i++) {
  56024. const {
  56025. name,
  56026. cacheName,
  56027. operator,
  56028. index
  56029. } = parsed[i];
  56030. const nodes = [];
  56031. for (const node of root) {
  56032. if (!(node instanceof _xfa_object.XFAObject)) {
  56033. continue;
  56034. }
  56035. let children, cached;
  56036. if (useCache) {
  56037. cached = somCache.get(node);
  56038. if (!cached) {
  56039. cached = new Map();
  56040. somCache.set(node, cached);
  56041. }
  56042. children = cached.get(cacheName);
  56043. }
  56044. if (!children) {
  56045. switch (operator) {
  56046. case operators.dot:
  56047. children = node[_xfa_object.$getChildrenByName](name, false);
  56048. break;
  56049. case operators.dotDot:
  56050. children = node[_xfa_object.$getChildrenByName](name, true);
  56051. break;
  56052. case operators.dotHash:
  56053. children = node[_xfa_object.$getChildrenByClass](name);
  56054. if (children instanceof _xfa_object.XFAObjectArray) {
  56055. children = children.children;
  56056. } else {
  56057. children = [children];
  56058. }
  56059. break;
  56060. default:
  56061. break;
  56062. }
  56063. if (useCache) {
  56064. cached.set(cacheName, children);
  56065. }
  56066. }
  56067. if (children.length > 0) {
  56068. nodes.push(children);
  56069. }
  56070. }
  56071. if (nodes.length === 0 && !isQualified && i === 0) {
  56072. const parent = container[_xfa_object.$getParent]();
  56073. container = parent;
  56074. if (!container) {
  56075. return null;
  56076. }
  56077. i = -1;
  56078. root = [container];
  56079. continue;
  56080. }
  56081. if (isFinite(index)) {
  56082. root = nodes.filter(node => index < node.length).map(node => node[index]);
  56083. } else {
  56084. root = nodes.flat();
  56085. }
  56086. }
  56087. if (root.length === 0) {
  56088. return null;
  56089. }
  56090. return root;
  56091. }
  56092. function createNodes(root, path) {
  56093. let node = null;
  56094. for (const {
  56095. name,
  56096. index
  56097. } of path) {
  56098. for (let i = 0, ii = !isFinite(index) ? 0 : index; i <= ii; i++) {
  56099. const nsId = root[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : root[_xfa_object.$namespaceId];
  56100. node = new _xfa_object.XmlObject(nsId, name);
  56101. root[_xfa_object.$appendChild](node);
  56102. }
  56103. root = node;
  56104. }
  56105. return node;
  56106. }
  56107. function createDataNode(root, container, expr) {
  56108. const parsed = parseExpression(expr);
  56109. if (!parsed) {
  56110. return null;
  56111. }
  56112. if (parsed.some(x => x.operator === operators.dotDot)) {
  56113. return null;
  56114. }
  56115. const fn = shortcuts.get(parsed[0].name);
  56116. let i = 0;
  56117. if (fn) {
  56118. root = fn(root, container);
  56119. i = 1;
  56120. } else {
  56121. root = container || root;
  56122. }
  56123. for (let ii = parsed.length; i < ii; i++) {
  56124. const {
  56125. name,
  56126. operator,
  56127. index
  56128. } = parsed[i];
  56129. if (!isFinite(index)) {
  56130. parsed[i].index = 0;
  56131. return createNodes(root, parsed.slice(i));
  56132. }
  56133. let children;
  56134. switch (operator) {
  56135. case operators.dot:
  56136. children = root[_xfa_object.$getChildrenByName](name, false);
  56137. break;
  56138. case operators.dotDot:
  56139. children = root[_xfa_object.$getChildrenByName](name, true);
  56140. break;
  56141. case operators.dotHash:
  56142. children = root[_xfa_object.$getChildrenByClass](name);
  56143. if (children instanceof _xfa_object.XFAObjectArray) {
  56144. children = children.children;
  56145. } else {
  56146. children = [children];
  56147. }
  56148. break;
  56149. default:
  56150. break;
  56151. }
  56152. if (children.length === 0) {
  56153. return createNodes(root, parsed.slice(i));
  56154. }
  56155. if (index < children.length) {
  56156. const child = children[index];
  56157. if (!(child instanceof _xfa_object.XFAObject)) {
  56158. (0, _util.warn)(`XFA - Cannot create a node.`);
  56159. return null;
  56160. }
  56161. root = child;
  56162. } else {
  56163. parsed[i].index = index - children.length;
  56164. return createNodes(root, parsed.slice(i));
  56165. }
  56166. }
  56167. return null;
  56168. }
  56169. /***/ }),
  56170. /* 206 */
  56171. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56172. "use strict";
  56173. Object.defineProperty(exports, "__esModule", ({
  56174. value: true
  56175. }));
  56176. exports.Binder = void 0;
  56177. var _xfa_object = __w_pdfjs_require__(202);
  56178. var _template = __w_pdfjs_require__(207);
  56179. var _som = __w_pdfjs_require__(205);
  56180. var _namespaces = __w_pdfjs_require__(204);
  56181. var _util = __w_pdfjs_require__(2);
  56182. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  56183. function createText(content) {
  56184. const node = new _template.Text({});
  56185. node[_xfa_object.$content] = content;
  56186. return node;
  56187. }
  56188. class Binder {
  56189. constructor(root) {
  56190. this.root = root;
  56191. this.datasets = root.datasets;
  56192. if (root.datasets && root.datasets.data) {
  56193. this.data = root.datasets.data;
  56194. } else {
  56195. this.data = new _xfa_object.XmlObject(_namespaces.NamespaceIds.datasets.id, "data");
  56196. }
  56197. this.emptyMerge = this.data[_xfa_object.$getChildren]().length === 0;
  56198. this.root.form = this.form = root.template[_xfa_object.$clone]();
  56199. }
  56200. _isConsumeData() {
  56201. return !this.emptyMerge && this._mergeMode;
  56202. }
  56203. _isMatchTemplate() {
  56204. return !this._isConsumeData();
  56205. }
  56206. bind() {
  56207. this._bindElement(this.form, this.data);
  56208. return this.form;
  56209. }
  56210. getData() {
  56211. return this.data;
  56212. }
  56213. _bindValue(formNode, data, picture) {
  56214. formNode[_xfa_object.$data] = data;
  56215. if (formNode[_xfa_object.$hasSettableValue]()) {
  56216. if (data[_xfa_object.$isDataValue]()) {
  56217. const value = data[_xfa_object.$getDataValue]();
  56218. formNode[_xfa_object.$setValue](createText(value));
  56219. } else if (formNode instanceof _template.Field && formNode.ui && formNode.ui.choiceList && formNode.ui.choiceList.open === "multiSelect") {
  56220. const value = data[_xfa_object.$getChildren]().map(child => child[_xfa_object.$content].trim()).join("\n");
  56221. formNode[_xfa_object.$setValue](createText(value));
  56222. } else if (this._isConsumeData()) {
  56223. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  56224. }
  56225. } else if (!data[_xfa_object.$isDataValue]() || this._isMatchTemplate()) {
  56226. this._bindElement(formNode, data);
  56227. } else {
  56228. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  56229. }
  56230. }
  56231. _findDataByNameToConsume(name, isValue, dataNode, global) {
  56232. if (!name) {
  56233. return null;
  56234. }
  56235. let generator, match;
  56236. for (let i = 0; i < 3; i++) {
  56237. generator = dataNode[_xfa_object.$getRealChildrenByNameIt](name, false, true);
  56238. while (true) {
  56239. match = generator.next().value;
  56240. if (!match) {
  56241. break;
  56242. }
  56243. if (isValue === match[_xfa_object.$isDataValue]()) {
  56244. return match;
  56245. }
  56246. }
  56247. if (dataNode[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.datasets.id && dataNode[_xfa_object.$nodeName] === "data") {
  56248. break;
  56249. }
  56250. dataNode = dataNode[_xfa_object.$getParent]();
  56251. }
  56252. if (!global) {
  56253. return null;
  56254. }
  56255. generator = this.data[_xfa_object.$getRealChildrenByNameIt](name, true, false);
  56256. match = generator.next().value;
  56257. if (match) {
  56258. return match;
  56259. }
  56260. generator = this.data[_xfa_object.$getAttributeIt](name, true);
  56261. match = generator.next().value;
  56262. if (match && match[_xfa_object.$isDataValue]()) {
  56263. return match;
  56264. }
  56265. return null;
  56266. }
  56267. _setProperties(formNode, dataNode) {
  56268. if (!formNode.hasOwnProperty("setProperty")) {
  56269. return;
  56270. }
  56271. for (const {
  56272. ref,
  56273. target,
  56274. connection
  56275. } of formNode.setProperty.children) {
  56276. if (connection) {
  56277. continue;
  56278. }
  56279. if (!ref) {
  56280. continue;
  56281. }
  56282. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  56283. if (!nodes) {
  56284. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  56285. continue;
  56286. }
  56287. const [node] = nodes;
  56288. if (!node[_xfa_object.$isDescendent](this.data)) {
  56289. (0, _util.warn)(`XFA - Invalid node: must be a data node.`);
  56290. continue;
  56291. }
  56292. const targetNodes = (0, _som.searchNode)(this.root, formNode, target, false, false);
  56293. if (!targetNodes) {
  56294. (0, _util.warn)(`XFA - Invalid target: ${target}.`);
  56295. continue;
  56296. }
  56297. const [targetNode] = targetNodes;
  56298. if (!targetNode[_xfa_object.$isDescendent](formNode)) {
  56299. (0, _util.warn)(`XFA - Invalid target: must be a property or subproperty.`);
  56300. continue;
  56301. }
  56302. const targetParent = targetNode[_xfa_object.$getParent]();
  56303. if (targetNode instanceof _template.SetProperty || targetParent instanceof _template.SetProperty) {
  56304. (0, _util.warn)(`XFA - Invalid target: cannot be a setProperty or one of its properties.`);
  56305. continue;
  56306. }
  56307. if (targetNode instanceof _template.BindItems || targetParent instanceof _template.BindItems) {
  56308. (0, _util.warn)(`XFA - Invalid target: cannot be a bindItems or one of its properties.`);
  56309. continue;
  56310. }
  56311. const content = node[_xfa_object.$text]();
  56312. const name = targetNode[_xfa_object.$nodeName];
  56313. if (targetNode instanceof _xfa_object.XFAAttribute) {
  56314. const attrs = Object.create(null);
  56315. attrs[name] = content;
  56316. const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]);
  56317. targetParent[name] = obj[name];
  56318. continue;
  56319. }
  56320. if (!targetNode.hasOwnProperty(_xfa_object.$content)) {
  56321. (0, _util.warn)(`XFA - Invalid node to use in setProperty`);
  56322. continue;
  56323. }
  56324. targetNode[_xfa_object.$data] = node;
  56325. targetNode[_xfa_object.$content] = content;
  56326. targetNode[_xfa_object.$finalize]();
  56327. }
  56328. }
  56329. _bindItems(formNode, dataNode) {
  56330. if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) {
  56331. return;
  56332. }
  56333. for (const item of formNode.items.children) {
  56334. formNode[_xfa_object.$removeChild](item);
  56335. }
  56336. formNode.items.clear();
  56337. const labels = new _template.Items({});
  56338. const values = new _template.Items({});
  56339. formNode[_xfa_object.$appendChild](labels);
  56340. formNode.items.push(labels);
  56341. formNode[_xfa_object.$appendChild](values);
  56342. formNode.items.push(values);
  56343. for (const {
  56344. ref,
  56345. labelRef,
  56346. valueRef,
  56347. connection
  56348. } of formNode.bindItems.children) {
  56349. if (connection) {
  56350. continue;
  56351. }
  56352. if (!ref) {
  56353. continue;
  56354. }
  56355. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  56356. if (!nodes) {
  56357. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  56358. continue;
  56359. }
  56360. for (const node of nodes) {
  56361. if (!node[_xfa_object.$isDescendent](this.datasets)) {
  56362. (0, _util.warn)(`XFA - Invalid ref (${ref}): must be a datasets child.`);
  56363. continue;
  56364. }
  56365. const labelNodes = (0, _som.searchNode)(this.root, node, labelRef, true, false);
  56366. if (!labelNodes) {
  56367. (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`);
  56368. continue;
  56369. }
  56370. const [labelNode] = labelNodes;
  56371. if (!labelNode[_xfa_object.$isDescendent](this.datasets)) {
  56372. (0, _util.warn)(`XFA - Invalid label: must be a datasets child.`);
  56373. continue;
  56374. }
  56375. const valueNodes = (0, _som.searchNode)(this.root, node, valueRef, true, false);
  56376. if (!valueNodes) {
  56377. (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`);
  56378. continue;
  56379. }
  56380. const [valueNode] = valueNodes;
  56381. if (!valueNode[_xfa_object.$isDescendent](this.datasets)) {
  56382. (0, _util.warn)(`XFA - Invalid value: must be a datasets child.`);
  56383. continue;
  56384. }
  56385. const label = createText(labelNode[_xfa_object.$text]());
  56386. const value = createText(valueNode[_xfa_object.$text]());
  56387. labels[_xfa_object.$appendChild](label);
  56388. labels.text.push(label);
  56389. values[_xfa_object.$appendChild](value);
  56390. values.text.push(value);
  56391. }
  56392. }
  56393. }
  56394. _bindOccurrences(formNode, matches, picture) {
  56395. let baseClone;
  56396. if (matches.length > 1) {
  56397. baseClone = formNode[_xfa_object.$clone]();
  56398. baseClone[_xfa_object.$removeChild](baseClone.occur);
  56399. baseClone.occur = null;
  56400. }
  56401. this._bindValue(formNode, matches[0], picture);
  56402. this._setProperties(formNode, matches[0]);
  56403. this._bindItems(formNode, matches[0]);
  56404. if (matches.length === 1) {
  56405. return;
  56406. }
  56407. const parent = formNode[_xfa_object.$getParent]();
  56408. const name = formNode[_xfa_object.$nodeName];
  56409. const pos = parent[_xfa_object.$indexOf](formNode);
  56410. for (let i = 1, ii = matches.length; i < ii; i++) {
  56411. const match = matches[i];
  56412. const clone = baseClone[_xfa_object.$clone]();
  56413. parent[name].push(clone);
  56414. parent[_xfa_object.$insertAt](pos + i, clone);
  56415. this._bindValue(clone, match, picture);
  56416. this._setProperties(clone, match);
  56417. this._bindItems(clone, match);
  56418. }
  56419. }
  56420. _createOccurrences(formNode) {
  56421. if (!this.emptyMerge) {
  56422. return;
  56423. }
  56424. const {
  56425. occur
  56426. } = formNode;
  56427. if (!occur || occur.initial <= 1) {
  56428. return;
  56429. }
  56430. const parent = formNode[_xfa_object.$getParent]();
  56431. const name = formNode[_xfa_object.$nodeName];
  56432. if (!(parent[name] instanceof _xfa_object.XFAObjectArray)) {
  56433. return;
  56434. }
  56435. let currentNumber;
  56436. if (formNode.name) {
  56437. currentNumber = parent[name].children.filter(e => e.name === formNode.name).length;
  56438. } else {
  56439. currentNumber = parent[name].children.length;
  56440. }
  56441. const pos = parent[_xfa_object.$indexOf](formNode) + 1;
  56442. const ii = occur.initial - currentNumber;
  56443. if (ii) {
  56444. const nodeClone = formNode[_xfa_object.$clone]();
  56445. nodeClone[_xfa_object.$removeChild](nodeClone.occur);
  56446. nodeClone.occur = null;
  56447. parent[name].push(nodeClone);
  56448. parent[_xfa_object.$insertAt](pos, nodeClone);
  56449. for (let i = 1; i < ii; i++) {
  56450. const clone = nodeClone[_xfa_object.$clone]();
  56451. parent[name].push(clone);
  56452. parent[_xfa_object.$insertAt](pos + i, clone);
  56453. }
  56454. }
  56455. }
  56456. _getOccurInfo(formNode) {
  56457. const {
  56458. name,
  56459. occur
  56460. } = formNode;
  56461. if (!occur || !name) {
  56462. return [1, 1];
  56463. }
  56464. const max = occur.max === -1 ? Infinity : occur.max;
  56465. return [occur.min, max];
  56466. }
  56467. _setAndBind(formNode, dataNode) {
  56468. this._setProperties(formNode, dataNode);
  56469. this._bindItems(formNode, dataNode);
  56470. this._bindElement(formNode, dataNode);
  56471. }
  56472. _bindElement(formNode, dataNode) {
  56473. const uselessNodes = [];
  56474. this._createOccurrences(formNode);
  56475. for (const child of formNode[_xfa_object.$getChildren]()) {
  56476. if (child[_xfa_object.$data]) {
  56477. continue;
  56478. }
  56479. if (this._mergeMode === undefined && child[_xfa_object.$nodeName] === "subform") {
  56480. this._mergeMode = child.mergeMode === "consumeData";
  56481. const dataChildren = dataNode[_xfa_object.$getChildren]();
  56482. if (dataChildren.length > 0) {
  56483. this._bindOccurrences(child, [dataChildren[0]], null);
  56484. } else if (this.emptyMerge) {
  56485. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  56486. const dataChild = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name || "root");
  56487. dataNode[_xfa_object.$appendChild](dataChild);
  56488. this._bindElement(child, dataChild);
  56489. }
  56490. continue;
  56491. }
  56492. if (!child[_xfa_object.$isBindable]()) {
  56493. continue;
  56494. }
  56495. let global = false;
  56496. let picture = null;
  56497. let ref = null;
  56498. let match = null;
  56499. if (child.bind) {
  56500. switch (child.bind.match) {
  56501. case "none":
  56502. this._setAndBind(child, dataNode);
  56503. continue;
  56504. case "global":
  56505. global = true;
  56506. break;
  56507. case "dataRef":
  56508. if (!child.bind.ref) {
  56509. (0, _util.warn)(`XFA - ref is empty in node ${child[_xfa_object.$nodeName]}.`);
  56510. this._setAndBind(child, dataNode);
  56511. continue;
  56512. }
  56513. ref = child.bind.ref;
  56514. break;
  56515. default:
  56516. break;
  56517. }
  56518. if (child.bind.picture) {
  56519. picture = child.bind.picture[_xfa_object.$content];
  56520. }
  56521. }
  56522. const [min, max] = this._getOccurInfo(child);
  56523. if (ref) {
  56524. match = (0, _som.searchNode)(this.root, dataNode, ref, true, false);
  56525. if (match === null) {
  56526. match = (0, _som.createDataNode)(this.data, dataNode, ref);
  56527. if (!match) {
  56528. continue;
  56529. }
  56530. if (this._isConsumeData()) {
  56531. match[_xfa_object.$consumed] = true;
  56532. }
  56533. this._setAndBind(child, match);
  56534. continue;
  56535. } else {
  56536. if (this._isConsumeData()) {
  56537. match = match.filter(node => !node[_xfa_object.$consumed]);
  56538. }
  56539. if (match.length > max) {
  56540. match = match.slice(0, max);
  56541. } else if (match.length === 0) {
  56542. match = null;
  56543. }
  56544. if (match && this._isConsumeData()) {
  56545. match.forEach(node => {
  56546. node[_xfa_object.$consumed] = true;
  56547. });
  56548. }
  56549. }
  56550. } else {
  56551. if (!child.name) {
  56552. this._setAndBind(child, dataNode);
  56553. continue;
  56554. }
  56555. if (this._isConsumeData()) {
  56556. const matches = [];
  56557. while (matches.length < max) {
  56558. const found = this._findDataByNameToConsume(child.name, child[_xfa_object.$hasSettableValue](), dataNode, global);
  56559. if (!found) {
  56560. break;
  56561. }
  56562. found[_xfa_object.$consumed] = true;
  56563. matches.push(found);
  56564. }
  56565. match = matches.length > 0 ? matches : null;
  56566. } else {
  56567. match = dataNode[_xfa_object.$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value;
  56568. if (!match) {
  56569. if (min === 0) {
  56570. uselessNodes.push(child);
  56571. continue;
  56572. }
  56573. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  56574. match = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name);
  56575. if (this.emptyMerge) {
  56576. match[_xfa_object.$consumed] = true;
  56577. }
  56578. dataNode[_xfa_object.$appendChild](match);
  56579. this._setAndBind(child, match);
  56580. continue;
  56581. }
  56582. if (this.emptyMerge) {
  56583. match[_xfa_object.$consumed] = true;
  56584. }
  56585. match = [match];
  56586. }
  56587. }
  56588. if (match) {
  56589. this._bindOccurrences(child, match, picture);
  56590. } else if (min > 0) {
  56591. this._setAndBind(child, dataNode);
  56592. } else {
  56593. uselessNodes.push(child);
  56594. }
  56595. }
  56596. uselessNodes.forEach(node => node[_xfa_object.$getParent]()[_xfa_object.$removeChild](node));
  56597. }
  56598. }
  56599. exports.Binder = Binder;
  56600. /***/ }),
  56601. /* 207 */
  56602. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56603. "use strict";
  56604. Object.defineProperty(exports, "__esModule", ({
  56605. value: true
  56606. }));
  56607. exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0;
  56608. var _xfa_object = __w_pdfjs_require__(202);
  56609. var _namespaces = __w_pdfjs_require__(204);
  56610. var _layout = __w_pdfjs_require__(208);
  56611. var _html_utils = __w_pdfjs_require__(209);
  56612. var _utils = __w_pdfjs_require__(203);
  56613. var _util = __w_pdfjs_require__(2);
  56614. var _fonts = __w_pdfjs_require__(210);
  56615. var _core_utils = __w_pdfjs_require__(131);
  56616. var _som = __w_pdfjs_require__(205);
  56617. const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id;
  56618. const SVG_NS = "http://www.w3.org/2000/svg";
  56619. const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2;
  56620. const MAX_EMPTY_PAGES = 3;
  56621. const DEFAULT_TAB_INDEX = 5000;
  56622. const HEADING_PATTERN = /^H(\d+)$/;
  56623. 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"]);
  56624. 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"]];
  56625. function getBorderDims(node) {
  56626. if (!node || !node.border) {
  56627. return {
  56628. w: 0,
  56629. h: 0
  56630. };
  56631. }
  56632. const borderExtra = node.border[_xfa_object.$getExtra]();
  56633. if (!borderExtra) {
  56634. return {
  56635. w: 0,
  56636. h: 0
  56637. };
  56638. }
  56639. return {
  56640. w: borderExtra.widths[0] + borderExtra.widths[2] + borderExtra.insets[0] + borderExtra.insets[2],
  56641. h: borderExtra.widths[1] + borderExtra.widths[3] + borderExtra.insets[1] + borderExtra.insets[3]
  56642. };
  56643. }
  56644. function hasMargin(node) {
  56645. return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset);
  56646. }
  56647. function _setValue(templateNode, value) {
  56648. if (!templateNode.value) {
  56649. const nodeValue = new Value({});
  56650. templateNode[_xfa_object.$appendChild](nodeValue);
  56651. templateNode.value = nodeValue;
  56652. }
  56653. templateNode.value[_xfa_object.$setValue](value);
  56654. }
  56655. function* getContainedChildren(node) {
  56656. for (const child of node[_xfa_object.$getChildren]()) {
  56657. if (child instanceof SubformSet) {
  56658. yield* child[_xfa_object.$getContainedChildren]();
  56659. continue;
  56660. }
  56661. yield child;
  56662. }
  56663. }
  56664. function isRequired(node) {
  56665. return node.validate && node.validate.nullTest === "error";
  56666. }
  56667. function setTabIndex(node) {
  56668. while (node) {
  56669. if (!node.traversal) {
  56670. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  56671. return;
  56672. }
  56673. if (node[_xfa_object.$tabIndex]) {
  56674. return;
  56675. }
  56676. let next = null;
  56677. for (const child of node.traversal[_xfa_object.$getChildren]()) {
  56678. if (child.operation === "next") {
  56679. next = child;
  56680. break;
  56681. }
  56682. }
  56683. if (!next || !next.ref) {
  56684. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  56685. return;
  56686. }
  56687. const root = node[_xfa_object.$getTemplateRoot]();
  56688. node[_xfa_object.$tabIndex] = ++root[_xfa_object.$tabIndex];
  56689. const ref = root[_xfa_object.$searchNode](next.ref, node);
  56690. if (!ref) {
  56691. return;
  56692. }
  56693. node = ref[0];
  56694. }
  56695. }
  56696. function applyAssist(obj, attributes) {
  56697. const assist = obj.assist;
  56698. if (assist) {
  56699. const assistTitle = assist[_xfa_object.$toHTML]();
  56700. if (assistTitle) {
  56701. attributes.title = assistTitle;
  56702. }
  56703. const role = assist.role;
  56704. const match = role.match(HEADING_PATTERN);
  56705. if (match) {
  56706. const ariaRole = "heading";
  56707. const ariaLevel = match[1];
  56708. attributes.role = ariaRole;
  56709. attributes["aria-level"] = ariaLevel;
  56710. }
  56711. }
  56712. if (obj.layout === "table") {
  56713. attributes.role = "table";
  56714. } else if (obj.layout === "row") {
  56715. attributes.role = "row";
  56716. } else {
  56717. const parent = obj[_xfa_object.$getParent]();
  56718. if (parent.layout === "row") {
  56719. if (parent.assist && parent.assist.role === "TH") {
  56720. attributes.role = "columnheader";
  56721. } else {
  56722. attributes.role = "cell";
  56723. }
  56724. }
  56725. }
  56726. }
  56727. function ariaLabel(obj) {
  56728. if (!obj.assist) {
  56729. return null;
  56730. }
  56731. const assist = obj.assist;
  56732. if (assist.speak && assist.speak[_xfa_object.$content] !== "") {
  56733. return assist.speak[_xfa_object.$content];
  56734. }
  56735. if (assist.toolTip) {
  56736. return assist.toolTip[_xfa_object.$content];
  56737. }
  56738. return null;
  56739. }
  56740. function valueToHtml(value) {
  56741. return _utils.HTMLResult.success({
  56742. name: "div",
  56743. attributes: {
  56744. class: ["xfaRich"],
  56745. style: Object.create(null)
  56746. },
  56747. children: [{
  56748. name: "span",
  56749. attributes: {
  56750. style: Object.create(null)
  56751. },
  56752. value
  56753. }]
  56754. });
  56755. }
  56756. function setFirstUnsplittable(node) {
  56757. const root = node[_xfa_object.$getTemplateRoot]();
  56758. if (root[_xfa_object.$extra].firstUnsplittable === null) {
  56759. root[_xfa_object.$extra].firstUnsplittable = node;
  56760. root[_xfa_object.$extra].noLayoutFailure = true;
  56761. }
  56762. }
  56763. function unsetFirstUnsplittable(node) {
  56764. const root = node[_xfa_object.$getTemplateRoot]();
  56765. if (root[_xfa_object.$extra].firstUnsplittable === node) {
  56766. root[_xfa_object.$extra].noLayoutFailure = false;
  56767. }
  56768. }
  56769. function handleBreak(node) {
  56770. if (node[_xfa_object.$extra]) {
  56771. return false;
  56772. }
  56773. node[_xfa_object.$extra] = Object.create(null);
  56774. if (node.targetType === "auto") {
  56775. return false;
  56776. }
  56777. const root = node[_xfa_object.$getTemplateRoot]();
  56778. let target = null;
  56779. if (node.target) {
  56780. target = root[_xfa_object.$searchNode](node.target, node[_xfa_object.$getParent]());
  56781. if (!target) {
  56782. return false;
  56783. }
  56784. target = target[0];
  56785. }
  56786. const {
  56787. currentPageArea,
  56788. currentContentArea
  56789. } = root[_xfa_object.$extra];
  56790. if (node.targetType === "pageArea") {
  56791. if (!(target instanceof PageArea)) {
  56792. target = null;
  56793. }
  56794. if (node.startNew) {
  56795. node[_xfa_object.$extra].target = target || currentPageArea;
  56796. return true;
  56797. } else if (target && target !== currentPageArea) {
  56798. node[_xfa_object.$extra].target = target;
  56799. return true;
  56800. }
  56801. return false;
  56802. }
  56803. if (!(target instanceof ContentArea)) {
  56804. target = null;
  56805. }
  56806. const pageArea = target && target[_xfa_object.$getParent]();
  56807. let index;
  56808. let nextPageArea = pageArea;
  56809. if (node.startNew) {
  56810. if (target) {
  56811. const contentAreas = pageArea.contentArea.children;
  56812. const indexForCurrent = contentAreas.indexOf(currentContentArea);
  56813. const indexForTarget = contentAreas.indexOf(target);
  56814. if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) {
  56815. nextPageArea = null;
  56816. }
  56817. index = indexForTarget - 1;
  56818. } else {
  56819. index = currentPageArea.contentArea.children.indexOf(currentContentArea);
  56820. }
  56821. } else if (target && target !== currentContentArea) {
  56822. const contentAreas = pageArea.contentArea.children;
  56823. index = contentAreas.indexOf(target) - 1;
  56824. nextPageArea = pageArea === currentPageArea ? null : pageArea;
  56825. } else {
  56826. return false;
  56827. }
  56828. node[_xfa_object.$extra].target = nextPageArea;
  56829. node[_xfa_object.$extra].index = index;
  56830. return true;
  56831. }
  56832. function handleOverflow(node, extraNode, space) {
  56833. const root = node[_xfa_object.$getTemplateRoot]();
  56834. const saved = root[_xfa_object.$extra].noLayoutFailure;
  56835. const savedMethod = extraNode[_xfa_object.$getSubformParent];
  56836. extraNode[_xfa_object.$getSubformParent] = () => node;
  56837. root[_xfa_object.$extra].noLayoutFailure = true;
  56838. const res = extraNode[_xfa_object.$toHTML](space);
  56839. node[_xfa_object.$addHTML](res.html, res.bbox);
  56840. root[_xfa_object.$extra].noLayoutFailure = saved;
  56841. extraNode[_xfa_object.$getSubformParent] = savedMethod;
  56842. }
  56843. class AppearanceFilter extends _xfa_object.StringObject {
  56844. constructor(attributes) {
  56845. super(TEMPLATE_NS_ID, "appearanceFilter");
  56846. this.id = attributes.id || "";
  56847. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56848. this.use = attributes.use || "";
  56849. this.usehref = attributes.usehref || "";
  56850. }
  56851. }
  56852. class Arc extends _xfa_object.XFAObject {
  56853. constructor(attributes) {
  56854. super(TEMPLATE_NS_ID, "arc", true);
  56855. this.circular = (0, _utils.getInteger)({
  56856. data: attributes.circular,
  56857. defaultValue: 0,
  56858. validate: x => x === 1
  56859. });
  56860. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  56861. this.id = attributes.id || "";
  56862. this.startAngle = (0, _utils.getFloat)({
  56863. data: attributes.startAngle,
  56864. defaultValue: 0,
  56865. validate: x => true
  56866. });
  56867. this.sweepAngle = (0, _utils.getFloat)({
  56868. data: attributes.sweepAngle,
  56869. defaultValue: 360,
  56870. validate: x => true
  56871. });
  56872. this.use = attributes.use || "";
  56873. this.usehref = attributes.usehref || "";
  56874. this.edge = null;
  56875. this.fill = null;
  56876. }
  56877. [_xfa_object.$toHTML]() {
  56878. const edge = this.edge || new Edge({});
  56879. const edgeStyle = edge[_xfa_object.$toStyle]();
  56880. const style = Object.create(null);
  56881. if (this.fill && this.fill.presence === "visible") {
  56882. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  56883. } else {
  56884. style.fill = "transparent";
  56885. }
  56886. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  56887. style.stroke = edgeStyle.color;
  56888. let arc;
  56889. const attributes = {
  56890. xmlns: SVG_NS,
  56891. style: {
  56892. width: "100%",
  56893. height: "100%",
  56894. overflow: "visible"
  56895. }
  56896. };
  56897. if (this.sweepAngle === 360) {
  56898. arc = {
  56899. name: "ellipse",
  56900. attributes: {
  56901. xmlns: SVG_NS,
  56902. cx: "50%",
  56903. cy: "50%",
  56904. rx: "50%",
  56905. ry: "50%",
  56906. style
  56907. }
  56908. };
  56909. } else {
  56910. const startAngle = this.startAngle * Math.PI / 180;
  56911. const sweepAngle = this.sweepAngle * Math.PI / 180;
  56912. const largeArc = this.sweepAngle > 180 ? 1 : 0;
  56913. 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))];
  56914. arc = {
  56915. name: "path",
  56916. attributes: {
  56917. xmlns: SVG_NS,
  56918. d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`,
  56919. vectorEffect: "non-scaling-stroke",
  56920. style
  56921. }
  56922. };
  56923. Object.assign(attributes, {
  56924. viewBox: "0 0 100 100",
  56925. preserveAspectRatio: "none"
  56926. });
  56927. }
  56928. const svg = {
  56929. name: "svg",
  56930. children: [arc],
  56931. attributes
  56932. };
  56933. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  56934. if (hasMargin(parent)) {
  56935. return _utils.HTMLResult.success({
  56936. name: "div",
  56937. attributes: {
  56938. style: {
  56939. display: "inline",
  56940. width: "100%",
  56941. height: "100%"
  56942. }
  56943. },
  56944. children: [svg]
  56945. });
  56946. }
  56947. svg.attributes.style.position = "absolute";
  56948. return _utils.HTMLResult.success(svg);
  56949. }
  56950. }
  56951. class Area extends _xfa_object.XFAObject {
  56952. constructor(attributes) {
  56953. super(TEMPLATE_NS_ID, "area", true);
  56954. this.colSpan = (0, _utils.getInteger)({
  56955. data: attributes.colSpan,
  56956. defaultValue: 1,
  56957. validate: n => n >= 1 || n === -1
  56958. });
  56959. this.id = attributes.id || "";
  56960. this.name = attributes.name || "";
  56961. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  56962. this.use = attributes.use || "";
  56963. this.usehref = attributes.usehref || "";
  56964. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  56965. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  56966. this.desc = null;
  56967. this.extras = null;
  56968. this.area = new _xfa_object.XFAObjectArray();
  56969. this.draw = new _xfa_object.XFAObjectArray();
  56970. this.exObject = new _xfa_object.XFAObjectArray();
  56971. this.exclGroup = new _xfa_object.XFAObjectArray();
  56972. this.field = new _xfa_object.XFAObjectArray();
  56973. this.subform = new _xfa_object.XFAObjectArray();
  56974. this.subformSet = new _xfa_object.XFAObjectArray();
  56975. }
  56976. *[_xfa_object.$getContainedChildren]() {
  56977. yield* getContainedChildren(this);
  56978. }
  56979. [_xfa_object.$isTransparent]() {
  56980. return true;
  56981. }
  56982. [_xfa_object.$isBindable]() {
  56983. return true;
  56984. }
  56985. [_xfa_object.$addHTML](html, bbox) {
  56986. const [x, y, w, h] = bbox;
  56987. this[_xfa_object.$extra].width = Math.max(this[_xfa_object.$extra].width, x + w);
  56988. this[_xfa_object.$extra].height = Math.max(this[_xfa_object.$extra].height, y + h);
  56989. this[_xfa_object.$extra].children.push(html);
  56990. }
  56991. [_xfa_object.$getAvailableSpace]() {
  56992. return this[_xfa_object.$extra].availableSpace;
  56993. }
  56994. [_xfa_object.$toHTML](availableSpace) {
  56995. const style = (0, _html_utils.toStyle)(this, "position");
  56996. const attributes = {
  56997. style,
  56998. id: this[_xfa_object.$uid],
  56999. class: ["xfaArea"]
  57000. };
  57001. if ((0, _html_utils.isPrintOnly)(this)) {
  57002. attributes.class.push("xfaPrintOnly");
  57003. }
  57004. if (this.name) {
  57005. attributes.xfaName = this.name;
  57006. }
  57007. const children = [];
  57008. this[_xfa_object.$extra] = {
  57009. children,
  57010. width: 0,
  57011. height: 0,
  57012. availableSpace
  57013. };
  57014. const result = this[_xfa_object.$childrenToHTML]({
  57015. filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]),
  57016. include: true
  57017. });
  57018. if (!result.success) {
  57019. if (result.isBreak()) {
  57020. return result;
  57021. }
  57022. delete this[_xfa_object.$extra];
  57023. return _utils.HTMLResult.FAILURE;
  57024. }
  57025. style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width);
  57026. style.height = (0, _html_utils.measureToString)(this[_xfa_object.$extra].height);
  57027. const html = {
  57028. name: "div",
  57029. attributes,
  57030. children
  57031. };
  57032. const bbox = [this.x, this.y, this[_xfa_object.$extra].width, this[_xfa_object.$extra].height];
  57033. delete this[_xfa_object.$extra];
  57034. return _utils.HTMLResult.success(html, bbox);
  57035. }
  57036. }
  57037. class Assist extends _xfa_object.XFAObject {
  57038. constructor(attributes) {
  57039. super(TEMPLATE_NS_ID, "assist", true);
  57040. this.id = attributes.id || "";
  57041. this.role = attributes.role || "";
  57042. this.use = attributes.use || "";
  57043. this.usehref = attributes.usehref || "";
  57044. this.speak = null;
  57045. this.toolTip = null;
  57046. }
  57047. [_xfa_object.$toHTML]() {
  57048. return this.toolTip && this.toolTip[_xfa_object.$content] ? this.toolTip[_xfa_object.$content] : null;
  57049. }
  57050. }
  57051. class Barcode extends _xfa_object.XFAObject {
  57052. constructor(attributes) {
  57053. super(TEMPLATE_NS_ID, "barcode", true);
  57054. this.charEncoding = (0, _utils.getKeyword)({
  57055. data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "",
  57056. defaultValue: "",
  57057. 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}/)
  57058. });
  57059. this.checksum = (0, _utils.getStringOption)(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]);
  57060. this.dataColumnCount = (0, _utils.getInteger)({
  57061. data: attributes.dataColumnCount,
  57062. defaultValue: -1,
  57063. validate: x => x >= 0
  57064. });
  57065. this.dataLength = (0, _utils.getInteger)({
  57066. data: attributes.dataLength,
  57067. defaultValue: -1,
  57068. validate: x => x >= 0
  57069. });
  57070. this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, ["none", "flateCompress"]);
  57071. this.dataRowCount = (0, _utils.getInteger)({
  57072. data: attributes.dataRowCount,
  57073. defaultValue: -1,
  57074. validate: x => x >= 0
  57075. });
  57076. this.endChar = attributes.endChar || "";
  57077. this.errorCorrectionLevel = (0, _utils.getInteger)({
  57078. data: attributes.errorCorrectionLevel,
  57079. defaultValue: -1,
  57080. validate: x => x >= 0 && x <= 8
  57081. });
  57082. this.id = attributes.id || "";
  57083. this.moduleHeight = (0, _utils.getMeasurement)(attributes.moduleHeight, "5mm");
  57084. this.moduleWidth = (0, _utils.getMeasurement)(attributes.moduleWidth, "0.25mm");
  57085. this.printCheckDigit = (0, _utils.getInteger)({
  57086. data: attributes.printCheckDigit,
  57087. defaultValue: 0,
  57088. validate: x => x === 1
  57089. });
  57090. this.rowColumnRatio = (0, _utils.getRatio)(attributes.rowColumnRatio);
  57091. this.startChar = attributes.startChar || "";
  57092. this.textLocation = (0, _utils.getStringOption)(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]);
  57093. this.truncate = (0, _utils.getInteger)({
  57094. data: attributes.truncate,
  57095. defaultValue: 0,
  57096. validate: x => x === 1
  57097. });
  57098. 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"]);
  57099. this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]);
  57100. this.use = attributes.use || "";
  57101. this.usehref = attributes.usehref || "";
  57102. this.wideNarrowRatio = (0, _utils.getRatio)(attributes.wideNarrowRatio);
  57103. this.encrypt = null;
  57104. this.extras = null;
  57105. }
  57106. }
  57107. class Bind extends _xfa_object.XFAObject {
  57108. constructor(attributes) {
  57109. super(TEMPLATE_NS_ID, "bind", true);
  57110. this.match = (0, _utils.getStringOption)(attributes.match, ["once", "dataRef", "global", "none"]);
  57111. this.ref = attributes.ref || "";
  57112. this.picture = null;
  57113. }
  57114. }
  57115. class BindItems extends _xfa_object.XFAObject {
  57116. constructor(attributes) {
  57117. super(TEMPLATE_NS_ID, "bindItems");
  57118. this.connection = attributes.connection || "";
  57119. this.labelRef = attributes.labelRef || "";
  57120. this.ref = attributes.ref || "";
  57121. this.valueRef = attributes.valueRef || "";
  57122. }
  57123. }
  57124. exports.BindItems = BindItems;
  57125. class Bookend extends _xfa_object.XFAObject {
  57126. constructor(attributes) {
  57127. super(TEMPLATE_NS_ID, "bookend");
  57128. this.id = attributes.id || "";
  57129. this.leader = attributes.leader || "";
  57130. this.trailer = attributes.trailer || "";
  57131. this.use = attributes.use || "";
  57132. this.usehref = attributes.usehref || "";
  57133. }
  57134. }
  57135. class BooleanElement extends _xfa_object.Option01 {
  57136. constructor(attributes) {
  57137. super(TEMPLATE_NS_ID, "boolean");
  57138. this.id = attributes.id || "";
  57139. this.name = attributes.name || "";
  57140. this.use = attributes.use || "";
  57141. this.usehref = attributes.usehref || "";
  57142. }
  57143. [_xfa_object.$toHTML](availableSpace) {
  57144. return valueToHtml(this[_xfa_object.$content] === 1 ? "1" : "0");
  57145. }
  57146. }
  57147. class Border extends _xfa_object.XFAObject {
  57148. constructor(attributes) {
  57149. super(TEMPLATE_NS_ID, "border", true);
  57150. this.break = (0, _utils.getStringOption)(attributes.break, ["close", "open"]);
  57151. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  57152. this.id = attributes.id || "";
  57153. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  57154. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  57155. this.use = attributes.use || "";
  57156. this.usehref = attributes.usehref || "";
  57157. this.corner = new _xfa_object.XFAObjectArray(4);
  57158. this.edge = new _xfa_object.XFAObjectArray(4);
  57159. this.extras = null;
  57160. this.fill = null;
  57161. this.margin = null;
  57162. }
  57163. [_xfa_object.$getExtra]() {
  57164. if (!this[_xfa_object.$extra]) {
  57165. const edges = this.edge.children.slice();
  57166. if (edges.length < 4) {
  57167. const defaultEdge = edges.at(-1) || new Edge({});
  57168. for (let i = edges.length; i < 4; i++) {
  57169. edges.push(defaultEdge);
  57170. }
  57171. }
  57172. const widths = edges.map(edge => edge.thickness);
  57173. const insets = [0, 0, 0, 0];
  57174. if (this.margin) {
  57175. insets[0] = this.margin.topInset;
  57176. insets[1] = this.margin.rightInset;
  57177. insets[2] = this.margin.bottomInset;
  57178. insets[3] = this.margin.leftInset;
  57179. }
  57180. this[_xfa_object.$extra] = {
  57181. widths,
  57182. insets,
  57183. edges
  57184. };
  57185. }
  57186. return this[_xfa_object.$extra];
  57187. }
  57188. [_xfa_object.$toStyle]() {
  57189. const {
  57190. edges
  57191. } = this[_xfa_object.$getExtra]();
  57192. const edgeStyles = edges.map(node => {
  57193. const style = node[_xfa_object.$toStyle]();
  57194. style.color = style.color || "#000000";
  57195. return style;
  57196. });
  57197. const style = Object.create(null);
  57198. if (this.margin) {
  57199. Object.assign(style, this.margin[_xfa_object.$toStyle]());
  57200. }
  57201. if (this.fill && this.fill.presence === "visible") {
  57202. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  57203. }
  57204. if (this.corner.children.some(node => node.radius !== 0)) {
  57205. const cornerStyles = this.corner.children.map(node => node[_xfa_object.$toStyle]());
  57206. if (cornerStyles.length === 2 || cornerStyles.length === 3) {
  57207. const last = cornerStyles.at(-1);
  57208. for (let i = cornerStyles.length; i < 4; i++) {
  57209. cornerStyles.push(last);
  57210. }
  57211. }
  57212. style.borderRadius = cornerStyles.map(s => s.radius).join(" ");
  57213. }
  57214. switch (this.presence) {
  57215. case "invisible":
  57216. case "hidden":
  57217. style.borderStyle = "";
  57218. break;
  57219. case "inactive":
  57220. style.borderStyle = "none";
  57221. break;
  57222. default:
  57223. style.borderStyle = edgeStyles.map(s => s.style).join(" ");
  57224. break;
  57225. }
  57226. style.borderWidth = edgeStyles.map(s => s.width).join(" ");
  57227. style.borderColor = edgeStyles.map(s => s.color).join(" ");
  57228. return style;
  57229. }
  57230. }
  57231. class Break extends _xfa_object.XFAObject {
  57232. constructor(attributes) {
  57233. super(TEMPLATE_NS_ID, "break", true);
  57234. this.after = (0, _utils.getStringOption)(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  57235. this.afterTarget = attributes.afterTarget || "";
  57236. this.before = (0, _utils.getStringOption)(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  57237. this.beforeTarget = attributes.beforeTarget || "";
  57238. this.bookendLeader = attributes.bookendLeader || "";
  57239. this.bookendTrailer = attributes.bookendTrailer || "";
  57240. this.id = attributes.id || "";
  57241. this.overflowLeader = attributes.overflowLeader || "";
  57242. this.overflowTarget = attributes.overflowTarget || "";
  57243. this.overflowTrailer = attributes.overflowTrailer || "";
  57244. this.startNew = (0, _utils.getInteger)({
  57245. data: attributes.startNew,
  57246. defaultValue: 0,
  57247. validate: x => x === 1
  57248. });
  57249. this.use = attributes.use || "";
  57250. this.usehref = attributes.usehref || "";
  57251. this.extras = null;
  57252. }
  57253. }
  57254. class BreakAfter extends _xfa_object.XFAObject {
  57255. constructor(attributes) {
  57256. super(TEMPLATE_NS_ID, "breakAfter", true);
  57257. this.id = attributes.id || "";
  57258. this.leader = attributes.leader || "";
  57259. this.startNew = (0, _utils.getInteger)({
  57260. data: attributes.startNew,
  57261. defaultValue: 0,
  57262. validate: x => x === 1
  57263. });
  57264. this.target = attributes.target || "";
  57265. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  57266. this.trailer = attributes.trailer || "";
  57267. this.use = attributes.use || "";
  57268. this.usehref = attributes.usehref || "";
  57269. this.script = null;
  57270. }
  57271. }
  57272. class BreakBefore extends _xfa_object.XFAObject {
  57273. constructor(attributes) {
  57274. super(TEMPLATE_NS_ID, "breakBefore", true);
  57275. this.id = attributes.id || "";
  57276. this.leader = attributes.leader || "";
  57277. this.startNew = (0, _utils.getInteger)({
  57278. data: attributes.startNew,
  57279. defaultValue: 0,
  57280. validate: x => x === 1
  57281. });
  57282. this.target = attributes.target || "";
  57283. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  57284. this.trailer = attributes.trailer || "";
  57285. this.use = attributes.use || "";
  57286. this.usehref = attributes.usehref || "";
  57287. this.script = null;
  57288. }
  57289. [_xfa_object.$toHTML](availableSpace) {
  57290. this[_xfa_object.$extra] = {};
  57291. return _utils.HTMLResult.FAILURE;
  57292. }
  57293. }
  57294. class Button extends _xfa_object.XFAObject {
  57295. constructor(attributes) {
  57296. super(TEMPLATE_NS_ID, "button", true);
  57297. this.highlight = (0, _utils.getStringOption)(attributes.highlight, ["inverted", "none", "outline", "push"]);
  57298. this.id = attributes.id || "";
  57299. this.use = attributes.use || "";
  57300. this.usehref = attributes.usehref || "";
  57301. this.extras = null;
  57302. }
  57303. [_xfa_object.$toHTML](availableSpace) {
  57304. const parent = this[_xfa_object.$getParent]();
  57305. const grandpa = parent[_xfa_object.$getParent]();
  57306. const htmlButton = {
  57307. name: "button",
  57308. attributes: {
  57309. id: this[_xfa_object.$uid],
  57310. class: ["xfaButton"],
  57311. style: {}
  57312. },
  57313. children: []
  57314. };
  57315. for (const event of grandpa.event.children) {
  57316. if (event.activity !== "click" || !event.script) {
  57317. continue;
  57318. }
  57319. const jsURL = (0, _core_utils.recoverJsURL)(event.script[_xfa_object.$content]);
  57320. if (!jsURL) {
  57321. continue;
  57322. }
  57323. const href = (0, _html_utils.fixURL)(jsURL.url);
  57324. if (!href) {
  57325. continue;
  57326. }
  57327. htmlButton.children.push({
  57328. name: "a",
  57329. attributes: {
  57330. id: "link" + this[_xfa_object.$uid],
  57331. href,
  57332. newWindow: jsURL.newWindow,
  57333. class: ["xfaLink"],
  57334. style: {}
  57335. },
  57336. children: []
  57337. });
  57338. }
  57339. return _utils.HTMLResult.success(htmlButton);
  57340. }
  57341. }
  57342. class Calculate extends _xfa_object.XFAObject {
  57343. constructor(attributes) {
  57344. super(TEMPLATE_NS_ID, "calculate", true);
  57345. this.id = attributes.id || "";
  57346. this.override = (0, _utils.getStringOption)(attributes.override, ["disabled", "error", "ignore", "warning"]);
  57347. this.use = attributes.use || "";
  57348. this.usehref = attributes.usehref || "";
  57349. this.extras = null;
  57350. this.message = null;
  57351. this.script = null;
  57352. }
  57353. }
  57354. class Caption extends _xfa_object.XFAObject {
  57355. constructor(attributes) {
  57356. super(TEMPLATE_NS_ID, "caption", true);
  57357. this.id = attributes.id || "";
  57358. this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]);
  57359. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  57360. this.reserve = Math.ceil((0, _utils.getMeasurement)(attributes.reserve));
  57361. this.use = attributes.use || "";
  57362. this.usehref = attributes.usehref || "";
  57363. this.extras = null;
  57364. this.font = null;
  57365. this.margin = null;
  57366. this.para = null;
  57367. this.value = null;
  57368. }
  57369. [_xfa_object.$setValue](value) {
  57370. _setValue(this, value);
  57371. }
  57372. [_xfa_object.$getExtra](availableSpace) {
  57373. if (!this[_xfa_object.$extra]) {
  57374. let {
  57375. width,
  57376. height
  57377. } = availableSpace;
  57378. switch (this.placement) {
  57379. case "left":
  57380. case "right":
  57381. case "inline":
  57382. width = this.reserve <= 0 ? width : this.reserve;
  57383. break;
  57384. case "top":
  57385. case "bottom":
  57386. height = this.reserve <= 0 ? height : this.reserve;
  57387. break;
  57388. }
  57389. this[_xfa_object.$extra] = (0, _html_utils.layoutNode)(this, {
  57390. width,
  57391. height
  57392. });
  57393. }
  57394. return this[_xfa_object.$extra];
  57395. }
  57396. [_xfa_object.$toHTML](availableSpace) {
  57397. if (!this.value) {
  57398. return _utils.HTMLResult.EMPTY;
  57399. }
  57400. this[_xfa_object.$pushPara]();
  57401. const value = this.value[_xfa_object.$toHTML](availableSpace).html;
  57402. if (!value) {
  57403. this[_xfa_object.$popPara]();
  57404. return _utils.HTMLResult.EMPTY;
  57405. }
  57406. const savedReserve = this.reserve;
  57407. if (this.reserve <= 0) {
  57408. const {
  57409. w,
  57410. h
  57411. } = this[_xfa_object.$getExtra](availableSpace);
  57412. switch (this.placement) {
  57413. case "left":
  57414. case "right":
  57415. case "inline":
  57416. this.reserve = w;
  57417. break;
  57418. case "top":
  57419. case "bottom":
  57420. this.reserve = h;
  57421. break;
  57422. }
  57423. }
  57424. const children = [];
  57425. if (typeof value === "string") {
  57426. children.push({
  57427. name: "#text",
  57428. value
  57429. });
  57430. } else {
  57431. children.push(value);
  57432. }
  57433. const style = (0, _html_utils.toStyle)(this, "font", "margin", "visibility");
  57434. switch (this.placement) {
  57435. case "left":
  57436. case "right":
  57437. if (this.reserve > 0) {
  57438. style.width = (0, _html_utils.measureToString)(this.reserve);
  57439. }
  57440. break;
  57441. case "top":
  57442. case "bottom":
  57443. if (this.reserve > 0) {
  57444. style.height = (0, _html_utils.measureToString)(this.reserve);
  57445. }
  57446. break;
  57447. }
  57448. (0, _html_utils.setPara)(this, null, value);
  57449. this[_xfa_object.$popPara]();
  57450. this.reserve = savedReserve;
  57451. return _utils.HTMLResult.success({
  57452. name: "div",
  57453. attributes: {
  57454. style,
  57455. class: ["xfaCaption"]
  57456. },
  57457. children
  57458. });
  57459. }
  57460. }
  57461. class Certificate extends _xfa_object.StringObject {
  57462. constructor(attributes) {
  57463. super(TEMPLATE_NS_ID, "certificate");
  57464. this.id = attributes.id || "";
  57465. this.name = attributes.name || "";
  57466. this.use = attributes.use || "";
  57467. this.usehref = attributes.usehref || "";
  57468. }
  57469. }
  57470. class Certificates extends _xfa_object.XFAObject {
  57471. constructor(attributes) {
  57472. super(TEMPLATE_NS_ID, "certificates", true);
  57473. this.credentialServerPolicy = (0, _utils.getStringOption)(attributes.credentialServerPolicy, ["optional", "required"]);
  57474. this.id = attributes.id || "";
  57475. this.url = attributes.url || "";
  57476. this.urlPolicy = attributes.urlPolicy || "";
  57477. this.use = attributes.use || "";
  57478. this.usehref = attributes.usehref || "";
  57479. this.encryption = null;
  57480. this.issuers = null;
  57481. this.keyUsage = null;
  57482. this.oids = null;
  57483. this.signing = null;
  57484. this.subjectDNs = null;
  57485. }
  57486. }
  57487. class CheckButton extends _xfa_object.XFAObject {
  57488. constructor(attributes) {
  57489. super(TEMPLATE_NS_ID, "checkButton", true);
  57490. this.id = attributes.id || "";
  57491. this.mark = (0, _utils.getStringOption)(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]);
  57492. this.shape = (0, _utils.getStringOption)(attributes.shape, ["square", "round"]);
  57493. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  57494. this.use = attributes.use || "";
  57495. this.usehref = attributes.usehref || "";
  57496. this.border = null;
  57497. this.extras = null;
  57498. this.margin = null;
  57499. }
  57500. [_xfa_object.$toHTML](availableSpace) {
  57501. const style = (0, _html_utils.toStyle)("margin");
  57502. const size = (0, _html_utils.measureToString)(this.size);
  57503. style.width = style.height = size;
  57504. let type;
  57505. let className;
  57506. let groupId;
  57507. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  57508. const items = field.items.children.length && field.items.children[0][_xfa_object.$toHTML]().html || [];
  57509. const exportedValue = {
  57510. on: (items[0] !== undefined ? items[0] : "on").toString(),
  57511. off: (items[1] !== undefined ? items[1] : "off").toString()
  57512. };
  57513. const value = field.value && field.value[_xfa_object.$text]() || "off";
  57514. const checked = value === exportedValue.on || undefined;
  57515. const container = field[_xfa_object.$getSubformParent]();
  57516. const fieldId = field[_xfa_object.$uid];
  57517. let dataId;
  57518. if (container instanceof ExclGroup) {
  57519. groupId = container[_xfa_object.$uid];
  57520. type = "radio";
  57521. className = "xfaRadio";
  57522. dataId = container[_xfa_object.$data] && container[_xfa_object.$data][_xfa_object.$uid] || container[_xfa_object.$uid];
  57523. } else {
  57524. type = "checkbox";
  57525. className = "xfaCheckbox";
  57526. dataId = field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid];
  57527. }
  57528. const input = {
  57529. name: "input",
  57530. attributes: {
  57531. class: [className],
  57532. style,
  57533. fieldId,
  57534. dataId,
  57535. type,
  57536. checked,
  57537. xfaOn: exportedValue.on,
  57538. xfaOff: exportedValue.off,
  57539. "aria-label": ariaLabel(field),
  57540. "aria-required": false
  57541. }
  57542. };
  57543. if (groupId) {
  57544. input.attributes.name = groupId;
  57545. }
  57546. if (isRequired(field)) {
  57547. input.attributes["aria-required"] = true;
  57548. input.attributes.required = true;
  57549. }
  57550. return _utils.HTMLResult.success({
  57551. name: "label",
  57552. attributes: {
  57553. class: ["xfaLabel"]
  57554. },
  57555. children: [input]
  57556. });
  57557. }
  57558. }
  57559. class ChoiceList extends _xfa_object.XFAObject {
  57560. constructor(attributes) {
  57561. super(TEMPLATE_NS_ID, "choiceList", true);
  57562. this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, ["select", "exit"]);
  57563. this.id = attributes.id || "";
  57564. this.open = (0, _utils.getStringOption)(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]);
  57565. this.textEntry = (0, _utils.getInteger)({
  57566. data: attributes.textEntry,
  57567. defaultValue: 0,
  57568. validate: x => x === 1
  57569. });
  57570. this.use = attributes.use || "";
  57571. this.usehref = attributes.usehref || "";
  57572. this.border = null;
  57573. this.extras = null;
  57574. this.margin = null;
  57575. }
  57576. [_xfa_object.$toHTML](availableSpace) {
  57577. const style = (0, _html_utils.toStyle)(this, "border", "margin");
  57578. const ui = this[_xfa_object.$getParent]();
  57579. const field = ui[_xfa_object.$getParent]();
  57580. const fontSize = field.font && field.font.size || 10;
  57581. const optionStyle = {
  57582. fontSize: `calc(${fontSize}px * var(--scale-factor))`
  57583. };
  57584. const children = [];
  57585. if (field.items.children.length > 0) {
  57586. const items = field.items;
  57587. let displayedIndex = 0;
  57588. let saveIndex = 0;
  57589. if (items.children.length === 2) {
  57590. displayedIndex = items.children[0].save;
  57591. saveIndex = 1 - displayedIndex;
  57592. }
  57593. const displayed = items.children[displayedIndex][_xfa_object.$toHTML]().html;
  57594. const values = items.children[saveIndex][_xfa_object.$toHTML]().html;
  57595. let selected = false;
  57596. const value = field.value && field.value[_xfa_object.$text]() || "";
  57597. for (let i = 0, ii = displayed.length; i < ii; i++) {
  57598. const option = {
  57599. name: "option",
  57600. attributes: {
  57601. value: values[i] || displayed[i],
  57602. style: optionStyle
  57603. },
  57604. value: displayed[i]
  57605. };
  57606. if (values[i] === value) {
  57607. option.attributes.selected = selected = true;
  57608. }
  57609. children.push(option);
  57610. }
  57611. if (!selected) {
  57612. children.splice(0, 0, {
  57613. name: "option",
  57614. attributes: {
  57615. hidden: true,
  57616. selected: true
  57617. },
  57618. value: " "
  57619. });
  57620. }
  57621. }
  57622. const selectAttributes = {
  57623. class: ["xfaSelect"],
  57624. fieldId: field[_xfa_object.$uid],
  57625. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  57626. style,
  57627. "aria-label": ariaLabel(field),
  57628. "aria-required": false
  57629. };
  57630. if (isRequired(field)) {
  57631. selectAttributes["aria-required"] = true;
  57632. selectAttributes.required = true;
  57633. }
  57634. if (this.open === "multiSelect") {
  57635. selectAttributes.multiple = true;
  57636. }
  57637. return _utils.HTMLResult.success({
  57638. name: "label",
  57639. attributes: {
  57640. class: ["xfaLabel"]
  57641. },
  57642. children: [{
  57643. name: "select",
  57644. children,
  57645. attributes: selectAttributes
  57646. }]
  57647. });
  57648. }
  57649. }
  57650. class Color extends _xfa_object.XFAObject {
  57651. constructor(attributes) {
  57652. super(TEMPLATE_NS_ID, "color", true);
  57653. this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, ["SRGB"]);
  57654. this.id = attributes.id || "";
  57655. this.use = attributes.use || "";
  57656. this.usehref = attributes.usehref || "";
  57657. this.value = attributes.value ? (0, _utils.getColor)(attributes.value) : "";
  57658. this.extras = null;
  57659. }
  57660. [_xfa_object.$hasSettableValue]() {
  57661. return false;
  57662. }
  57663. [_xfa_object.$toStyle]() {
  57664. return this.value ? _util.Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null;
  57665. }
  57666. }
  57667. class Comb extends _xfa_object.XFAObject {
  57668. constructor(attributes) {
  57669. super(TEMPLATE_NS_ID, "comb");
  57670. this.id = attributes.id || "";
  57671. this.numberOfCells = (0, _utils.getInteger)({
  57672. data: attributes.numberOfCells,
  57673. defaultValue: 0,
  57674. validate: x => x >= 0
  57675. });
  57676. this.use = attributes.use || "";
  57677. this.usehref = attributes.usehref || "";
  57678. }
  57679. }
  57680. class Connect extends _xfa_object.XFAObject {
  57681. constructor(attributes) {
  57682. super(TEMPLATE_NS_ID, "connect", true);
  57683. this.connection = attributes.connection || "";
  57684. this.id = attributes.id || "";
  57685. this.ref = attributes.ref || "";
  57686. this.usage = (0, _utils.getStringOption)(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]);
  57687. this.use = attributes.use || "";
  57688. this.usehref = attributes.usehref || "";
  57689. this.picture = null;
  57690. }
  57691. }
  57692. class ContentArea extends _xfa_object.XFAObject {
  57693. constructor(attributes) {
  57694. super(TEMPLATE_NS_ID, "contentArea", true);
  57695. this.h = (0, _utils.getMeasurement)(attributes.h);
  57696. this.id = attributes.id || "";
  57697. this.name = attributes.name || "";
  57698. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  57699. this.use = attributes.use || "";
  57700. this.usehref = attributes.usehref || "";
  57701. this.w = (0, _utils.getMeasurement)(attributes.w);
  57702. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  57703. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  57704. this.desc = null;
  57705. this.extras = null;
  57706. }
  57707. [_xfa_object.$toHTML](availableSpace) {
  57708. const left = (0, _html_utils.measureToString)(this.x);
  57709. const top = (0, _html_utils.measureToString)(this.y);
  57710. const style = {
  57711. left,
  57712. top,
  57713. width: (0, _html_utils.measureToString)(this.w),
  57714. height: (0, _html_utils.measureToString)(this.h)
  57715. };
  57716. const classNames = ["xfaContentarea"];
  57717. if ((0, _html_utils.isPrintOnly)(this)) {
  57718. classNames.push("xfaPrintOnly");
  57719. }
  57720. return _utils.HTMLResult.success({
  57721. name: "div",
  57722. children: [],
  57723. attributes: {
  57724. style,
  57725. class: classNames,
  57726. id: this[_xfa_object.$uid]
  57727. }
  57728. });
  57729. }
  57730. }
  57731. class Corner extends _xfa_object.XFAObject {
  57732. constructor(attributes) {
  57733. super(TEMPLATE_NS_ID, "corner", true);
  57734. this.id = attributes.id || "";
  57735. this.inverted = (0, _utils.getInteger)({
  57736. data: attributes.inverted,
  57737. defaultValue: 0,
  57738. validate: x => x === 1
  57739. });
  57740. this.join = (0, _utils.getStringOption)(attributes.join, ["square", "round"]);
  57741. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  57742. this.radius = (0, _utils.getMeasurement)(attributes.radius);
  57743. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  57744. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  57745. this.use = attributes.use || "";
  57746. this.usehref = attributes.usehref || "";
  57747. this.color = null;
  57748. this.extras = null;
  57749. }
  57750. [_xfa_object.$toStyle]() {
  57751. const style = (0, _html_utils.toStyle)(this, "visibility");
  57752. style.radius = (0, _html_utils.measureToString)(this.join === "square" ? 0 : this.radius);
  57753. return style;
  57754. }
  57755. }
  57756. class DateElement extends _xfa_object.ContentObject {
  57757. constructor(attributes) {
  57758. super(TEMPLATE_NS_ID, "date");
  57759. this.id = attributes.id || "";
  57760. this.name = attributes.name || "";
  57761. this.use = attributes.use || "";
  57762. this.usehref = attributes.usehref || "";
  57763. }
  57764. [_xfa_object.$finalize]() {
  57765. const date = this[_xfa_object.$content].trim();
  57766. this[_xfa_object.$content] = date ? new Date(date) : null;
  57767. }
  57768. [_xfa_object.$toHTML](availableSpace) {
  57769. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  57770. }
  57771. }
  57772. class DateTime extends _xfa_object.ContentObject {
  57773. constructor(attributes) {
  57774. super(TEMPLATE_NS_ID, "dateTime");
  57775. this.id = attributes.id || "";
  57776. this.name = attributes.name || "";
  57777. this.use = attributes.use || "";
  57778. this.usehref = attributes.usehref || "";
  57779. }
  57780. [_xfa_object.$finalize]() {
  57781. const date = this[_xfa_object.$content].trim();
  57782. this[_xfa_object.$content] = date ? new Date(date) : null;
  57783. }
  57784. [_xfa_object.$toHTML](availableSpace) {
  57785. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  57786. }
  57787. }
  57788. class DateTimeEdit extends _xfa_object.XFAObject {
  57789. constructor(attributes) {
  57790. super(TEMPLATE_NS_ID, "dateTimeEdit", true);
  57791. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  57792. this.id = attributes.id || "";
  57793. this.picker = (0, _utils.getStringOption)(attributes.picker, ["host", "none"]);
  57794. this.use = attributes.use || "";
  57795. this.usehref = attributes.usehref || "";
  57796. this.border = null;
  57797. this.comb = null;
  57798. this.extras = null;
  57799. this.margin = null;
  57800. }
  57801. [_xfa_object.$toHTML](availableSpace) {
  57802. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  57803. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  57804. const html = {
  57805. name: "input",
  57806. attributes: {
  57807. type: "text",
  57808. fieldId: field[_xfa_object.$uid],
  57809. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  57810. class: ["xfaTextfield"],
  57811. style,
  57812. "aria-label": ariaLabel(field),
  57813. "aria-required": false
  57814. }
  57815. };
  57816. if (isRequired(field)) {
  57817. html.attributes["aria-required"] = true;
  57818. html.attributes.required = true;
  57819. }
  57820. return _utils.HTMLResult.success({
  57821. name: "label",
  57822. attributes: {
  57823. class: ["xfaLabel"]
  57824. },
  57825. children: [html]
  57826. });
  57827. }
  57828. }
  57829. class Decimal extends _xfa_object.ContentObject {
  57830. constructor(attributes) {
  57831. super(TEMPLATE_NS_ID, "decimal");
  57832. this.fracDigits = (0, _utils.getInteger)({
  57833. data: attributes.fracDigits,
  57834. defaultValue: 2,
  57835. validate: x => true
  57836. });
  57837. this.id = attributes.id || "";
  57838. this.leadDigits = (0, _utils.getInteger)({
  57839. data: attributes.leadDigits,
  57840. defaultValue: -1,
  57841. validate: x => true
  57842. });
  57843. this.name = attributes.name || "";
  57844. this.use = attributes.use || "";
  57845. this.usehref = attributes.usehref || "";
  57846. }
  57847. [_xfa_object.$finalize]() {
  57848. const number = parseFloat(this[_xfa_object.$content].trim());
  57849. this[_xfa_object.$content] = isNaN(number) ? null : number;
  57850. }
  57851. [_xfa_object.$toHTML](availableSpace) {
  57852. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  57853. }
  57854. }
  57855. class DefaultUi extends _xfa_object.XFAObject {
  57856. constructor(attributes) {
  57857. super(TEMPLATE_NS_ID, "defaultUi", true);
  57858. this.id = attributes.id || "";
  57859. this.use = attributes.use || "";
  57860. this.usehref = attributes.usehref || "";
  57861. this.extras = null;
  57862. }
  57863. }
  57864. class Desc extends _xfa_object.XFAObject {
  57865. constructor(attributes) {
  57866. super(TEMPLATE_NS_ID, "desc", true);
  57867. this.id = attributes.id || "";
  57868. this.use = attributes.use || "";
  57869. this.usehref = attributes.usehref || "";
  57870. this.boolean = new _xfa_object.XFAObjectArray();
  57871. this.date = new _xfa_object.XFAObjectArray();
  57872. this.dateTime = new _xfa_object.XFAObjectArray();
  57873. this.decimal = new _xfa_object.XFAObjectArray();
  57874. this.exData = new _xfa_object.XFAObjectArray();
  57875. this.float = new _xfa_object.XFAObjectArray();
  57876. this.image = new _xfa_object.XFAObjectArray();
  57877. this.integer = new _xfa_object.XFAObjectArray();
  57878. this.text = new _xfa_object.XFAObjectArray();
  57879. this.time = new _xfa_object.XFAObjectArray();
  57880. }
  57881. }
  57882. class DigestMethod extends _xfa_object.OptionObject {
  57883. constructor(attributes) {
  57884. super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]);
  57885. this.id = attributes.id || "";
  57886. this.use = attributes.use || "";
  57887. this.usehref = attributes.usehref || "";
  57888. }
  57889. }
  57890. class DigestMethods extends _xfa_object.XFAObject {
  57891. constructor(attributes) {
  57892. super(TEMPLATE_NS_ID, "digestMethods", true);
  57893. this.id = attributes.id || "";
  57894. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  57895. this.use = attributes.use || "";
  57896. this.usehref = attributes.usehref || "";
  57897. this.digestMethod = new _xfa_object.XFAObjectArray();
  57898. }
  57899. }
  57900. class Draw extends _xfa_object.XFAObject {
  57901. constructor(attributes) {
  57902. super(TEMPLATE_NS_ID, "draw", true);
  57903. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  57904. this.colSpan = (0, _utils.getInteger)({
  57905. data: attributes.colSpan,
  57906. defaultValue: 1,
  57907. validate: n => n >= 1 || n === -1
  57908. });
  57909. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  57910. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  57911. this.id = attributes.id || "";
  57912. this.locale = attributes.locale || "";
  57913. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  57914. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  57915. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  57916. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  57917. this.name = attributes.name || "";
  57918. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  57919. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  57920. this.rotate = (0, _utils.getInteger)({
  57921. data: attributes.rotate,
  57922. defaultValue: 0,
  57923. validate: x => x % 90 === 0
  57924. });
  57925. this.use = attributes.use || "";
  57926. this.usehref = attributes.usehref || "";
  57927. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  57928. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  57929. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  57930. this.assist = null;
  57931. this.border = null;
  57932. this.caption = null;
  57933. this.desc = null;
  57934. this.extras = null;
  57935. this.font = null;
  57936. this.keep = null;
  57937. this.margin = null;
  57938. this.para = null;
  57939. this.traversal = null;
  57940. this.ui = null;
  57941. this.value = null;
  57942. this.setProperty = new _xfa_object.XFAObjectArray();
  57943. }
  57944. [_xfa_object.$setValue](value) {
  57945. _setValue(this, value);
  57946. }
  57947. [_xfa_object.$toHTML](availableSpace) {
  57948. setTabIndex(this);
  57949. if (this.presence === "hidden" || this.presence === "inactive") {
  57950. return _utils.HTMLResult.EMPTY;
  57951. }
  57952. (0, _html_utils.fixDimensions)(this);
  57953. this[_xfa_object.$pushPara]();
  57954. const savedW = this.w;
  57955. const savedH = this.h;
  57956. const {
  57957. w,
  57958. h,
  57959. isBroken
  57960. } = (0, _html_utils.layoutNode)(this, availableSpace);
  57961. if (w && this.w === "") {
  57962. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  57963. this[_xfa_object.$popPara]();
  57964. return _utils.HTMLResult.FAILURE;
  57965. }
  57966. this.w = w;
  57967. }
  57968. if (h && this.h === "") {
  57969. this.h = h;
  57970. }
  57971. setFirstUnsplittable(this);
  57972. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  57973. this.w = savedW;
  57974. this.h = savedH;
  57975. this[_xfa_object.$popPara]();
  57976. return _utils.HTMLResult.FAILURE;
  57977. }
  57978. unsetFirstUnsplittable(this);
  57979. const style = (0, _html_utils.toStyle)(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin");
  57980. (0, _html_utils.setMinMaxDimensions)(this, style);
  57981. if (style.margin) {
  57982. style.padding = style.margin;
  57983. delete style.margin;
  57984. }
  57985. const classNames = ["xfaDraw"];
  57986. if (this.font) {
  57987. classNames.push("xfaFont");
  57988. }
  57989. if ((0, _html_utils.isPrintOnly)(this)) {
  57990. classNames.push("xfaPrintOnly");
  57991. }
  57992. const attributes = {
  57993. style,
  57994. id: this[_xfa_object.$uid],
  57995. class: classNames
  57996. };
  57997. if (this.name) {
  57998. attributes.xfaName = this.name;
  57999. }
  58000. const html = {
  58001. name: "div",
  58002. attributes,
  58003. children: []
  58004. };
  58005. applyAssist(this, attributes);
  58006. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  58007. const value = this.value ? this.value[_xfa_object.$toHTML](availableSpace).html : null;
  58008. if (value === null) {
  58009. this.w = savedW;
  58010. this.h = savedH;
  58011. this[_xfa_object.$popPara]();
  58012. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  58013. }
  58014. html.children.push(value);
  58015. (0, _html_utils.setPara)(this, style, value);
  58016. this.w = savedW;
  58017. this.h = savedH;
  58018. this[_xfa_object.$popPara]();
  58019. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  58020. }
  58021. }
  58022. class Edge extends _xfa_object.XFAObject {
  58023. constructor(attributes) {
  58024. super(TEMPLATE_NS_ID, "edge", true);
  58025. this.cap = (0, _utils.getStringOption)(attributes.cap, ["square", "butt", "round"]);
  58026. this.id = attributes.id || "";
  58027. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  58028. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  58029. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  58030. this.use = attributes.use || "";
  58031. this.usehref = attributes.usehref || "";
  58032. this.color = null;
  58033. this.extras = null;
  58034. }
  58035. [_xfa_object.$toStyle]() {
  58036. const style = (0, _html_utils.toStyle)(this, "visibility");
  58037. Object.assign(style, {
  58038. linecap: this.cap,
  58039. width: (0, _html_utils.measureToString)(this.thickness),
  58040. color: this.color ? this.color[_xfa_object.$toStyle]() : "#000000",
  58041. style: ""
  58042. });
  58043. if (this.presence !== "visible") {
  58044. style.style = "none";
  58045. } else {
  58046. switch (this.stroke) {
  58047. case "solid":
  58048. style.style = "solid";
  58049. break;
  58050. case "dashDot":
  58051. style.style = "dashed";
  58052. break;
  58053. case "dashDotDot":
  58054. style.style = "dashed";
  58055. break;
  58056. case "dashed":
  58057. style.style = "dashed";
  58058. break;
  58059. case "dotted":
  58060. style.style = "dotted";
  58061. break;
  58062. case "embossed":
  58063. style.style = "ridge";
  58064. break;
  58065. case "etched":
  58066. style.style = "groove";
  58067. break;
  58068. case "lowered":
  58069. style.style = "inset";
  58070. break;
  58071. case "raised":
  58072. style.style = "outset";
  58073. break;
  58074. }
  58075. }
  58076. return style;
  58077. }
  58078. }
  58079. class Encoding extends _xfa_object.OptionObject {
  58080. constructor(attributes) {
  58081. super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]);
  58082. this.id = attributes.id || "";
  58083. this.use = attributes.use || "";
  58084. this.usehref = attributes.usehref || "";
  58085. }
  58086. }
  58087. class Encodings extends _xfa_object.XFAObject {
  58088. constructor(attributes) {
  58089. super(TEMPLATE_NS_ID, "encodings", true);
  58090. this.id = attributes.id || "";
  58091. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  58092. this.use = attributes.use || "";
  58093. this.usehref = attributes.usehref || "";
  58094. this.encoding = new _xfa_object.XFAObjectArray();
  58095. }
  58096. }
  58097. class Encrypt extends _xfa_object.XFAObject {
  58098. constructor(attributes) {
  58099. super(TEMPLATE_NS_ID, "encrypt", true);
  58100. this.id = attributes.id || "";
  58101. this.use = attributes.use || "";
  58102. this.usehref = attributes.usehref || "";
  58103. this.certificate = null;
  58104. }
  58105. }
  58106. class EncryptData extends _xfa_object.XFAObject {
  58107. constructor(attributes) {
  58108. super(TEMPLATE_NS_ID, "encryptData", true);
  58109. this.id = attributes.id || "";
  58110. this.operation = (0, _utils.getStringOption)(attributes.operation, ["encrypt", "decrypt"]);
  58111. this.target = attributes.target || "";
  58112. this.use = attributes.use || "";
  58113. this.usehref = attributes.usehref || "";
  58114. this.filter = null;
  58115. this.manifest = null;
  58116. }
  58117. }
  58118. class Encryption extends _xfa_object.XFAObject {
  58119. constructor(attributes) {
  58120. super(TEMPLATE_NS_ID, "encryption", true);
  58121. this.id = attributes.id || "";
  58122. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  58123. this.use = attributes.use || "";
  58124. this.usehref = attributes.usehref || "";
  58125. this.certificate = new _xfa_object.XFAObjectArray();
  58126. }
  58127. }
  58128. class EncryptionMethod extends _xfa_object.OptionObject {
  58129. constructor(attributes) {
  58130. super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]);
  58131. this.id = attributes.id || "";
  58132. this.use = attributes.use || "";
  58133. this.usehref = attributes.usehref || "";
  58134. }
  58135. }
  58136. class EncryptionMethods extends _xfa_object.XFAObject {
  58137. constructor(attributes) {
  58138. super(TEMPLATE_NS_ID, "encryptionMethods", true);
  58139. this.id = attributes.id || "";
  58140. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  58141. this.use = attributes.use || "";
  58142. this.usehref = attributes.usehref || "";
  58143. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  58144. }
  58145. }
  58146. class Event extends _xfa_object.XFAObject {
  58147. constructor(attributes) {
  58148. super(TEMPLATE_NS_ID, "event", true);
  58149. 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"]);
  58150. this.id = attributes.id || "";
  58151. this.listen = (0, _utils.getStringOption)(attributes.listen, ["refOnly", "refAndDescendents"]);
  58152. this.name = attributes.name || "";
  58153. this.ref = attributes.ref || "";
  58154. this.use = attributes.use || "";
  58155. this.usehref = attributes.usehref || "";
  58156. this.extras = null;
  58157. this.encryptData = null;
  58158. this.execute = null;
  58159. this.script = null;
  58160. this.signData = null;
  58161. this.submit = null;
  58162. }
  58163. }
  58164. class ExData extends _xfa_object.ContentObject {
  58165. constructor(attributes) {
  58166. super(TEMPLATE_NS_ID, "exData");
  58167. this.contentType = attributes.contentType || "";
  58168. this.href = attributes.href || "";
  58169. this.id = attributes.id || "";
  58170. this.maxLength = (0, _utils.getInteger)({
  58171. data: attributes.maxLength,
  58172. defaultValue: -1,
  58173. validate: x => x >= -1
  58174. });
  58175. this.name = attributes.name || "";
  58176. this.rid = attributes.rid || "";
  58177. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["none", "base64", "package"]);
  58178. this.use = attributes.use || "";
  58179. this.usehref = attributes.usehref || "";
  58180. }
  58181. [_xfa_object.$isCDATAXml]() {
  58182. return this.contentType === "text/html";
  58183. }
  58184. [_xfa_object.$onChild](child) {
  58185. if (this.contentType === "text/html" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  58186. this[_xfa_object.$content] = child;
  58187. return true;
  58188. }
  58189. if (this.contentType === "text/xml") {
  58190. this[_xfa_object.$content] = child;
  58191. return true;
  58192. }
  58193. return false;
  58194. }
  58195. [_xfa_object.$toHTML](availableSpace) {
  58196. if (this.contentType !== "text/html" || !this[_xfa_object.$content]) {
  58197. return _utils.HTMLResult.EMPTY;
  58198. }
  58199. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  58200. }
  58201. }
  58202. class ExObject extends _xfa_object.XFAObject {
  58203. constructor(attributes) {
  58204. super(TEMPLATE_NS_ID, "exObject", true);
  58205. this.archive = attributes.archive || "";
  58206. this.classId = attributes.classId || "";
  58207. this.codeBase = attributes.codeBase || "";
  58208. this.codeType = attributes.codeType || "";
  58209. this.id = attributes.id || "";
  58210. this.name = attributes.name || "";
  58211. this.use = attributes.use || "";
  58212. this.usehref = attributes.usehref || "";
  58213. this.extras = null;
  58214. this.boolean = new _xfa_object.XFAObjectArray();
  58215. this.date = new _xfa_object.XFAObjectArray();
  58216. this.dateTime = new _xfa_object.XFAObjectArray();
  58217. this.decimal = new _xfa_object.XFAObjectArray();
  58218. this.exData = new _xfa_object.XFAObjectArray();
  58219. this.exObject = new _xfa_object.XFAObjectArray();
  58220. this.float = new _xfa_object.XFAObjectArray();
  58221. this.image = new _xfa_object.XFAObjectArray();
  58222. this.integer = new _xfa_object.XFAObjectArray();
  58223. this.text = new _xfa_object.XFAObjectArray();
  58224. this.time = new _xfa_object.XFAObjectArray();
  58225. }
  58226. }
  58227. class ExclGroup extends _xfa_object.XFAObject {
  58228. constructor(attributes) {
  58229. super(TEMPLATE_NS_ID, "exclGroup", true);
  58230. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  58231. this.accessKey = attributes.accessKey || "";
  58232. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  58233. this.colSpan = (0, _utils.getInteger)({
  58234. data: attributes.colSpan,
  58235. defaultValue: 1,
  58236. validate: n => n >= 1 || n === -1
  58237. });
  58238. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  58239. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  58240. this.id = attributes.id || "";
  58241. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  58242. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  58243. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  58244. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  58245. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  58246. this.name = attributes.name || "";
  58247. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  58248. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  58249. this.use = attributes.use || "";
  58250. this.usehref = attributes.usehref || "";
  58251. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  58252. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  58253. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  58254. this.assist = null;
  58255. this.bind = null;
  58256. this.border = null;
  58257. this.calculate = null;
  58258. this.caption = null;
  58259. this.desc = null;
  58260. this.extras = null;
  58261. this.margin = null;
  58262. this.para = null;
  58263. this.traversal = null;
  58264. this.validate = null;
  58265. this.connect = new _xfa_object.XFAObjectArray();
  58266. this.event = new _xfa_object.XFAObjectArray();
  58267. this.field = new _xfa_object.XFAObjectArray();
  58268. this.setProperty = new _xfa_object.XFAObjectArray();
  58269. }
  58270. [_xfa_object.$isBindable]() {
  58271. return true;
  58272. }
  58273. [_xfa_object.$hasSettableValue]() {
  58274. return true;
  58275. }
  58276. [_xfa_object.$setValue](value) {
  58277. for (const field of this.field.children) {
  58278. if (!field.value) {
  58279. const nodeValue = new Value({});
  58280. field[_xfa_object.$appendChild](nodeValue);
  58281. field.value = nodeValue;
  58282. }
  58283. field.value[_xfa_object.$setValue](value);
  58284. }
  58285. }
  58286. [_xfa_object.$isThereMoreWidth]() {
  58287. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  58288. }
  58289. [_xfa_object.$isSplittable]() {
  58290. const parent = this[_xfa_object.$getSubformParent]();
  58291. if (!parent[_xfa_object.$isSplittable]()) {
  58292. return false;
  58293. }
  58294. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  58295. return this[_xfa_object.$extra]._isSplittable;
  58296. }
  58297. if (this.layout === "position" || this.layout.includes("row")) {
  58298. this[_xfa_object.$extra]._isSplittable = false;
  58299. return false;
  58300. }
  58301. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  58302. return false;
  58303. }
  58304. this[_xfa_object.$extra]._isSplittable = true;
  58305. return true;
  58306. }
  58307. [_xfa_object.$flushHTML]() {
  58308. return (0, _layout.flushHTML)(this);
  58309. }
  58310. [_xfa_object.$addHTML](html, bbox) {
  58311. (0, _layout.addHTML)(this, html, bbox);
  58312. }
  58313. [_xfa_object.$getAvailableSpace]() {
  58314. return (0, _layout.getAvailableSpace)(this);
  58315. }
  58316. [_xfa_object.$toHTML](availableSpace) {
  58317. setTabIndex(this);
  58318. if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  58319. return _utils.HTMLResult.EMPTY;
  58320. }
  58321. (0, _html_utils.fixDimensions)(this);
  58322. const children = [];
  58323. const attributes = {
  58324. id: this[_xfa_object.$uid],
  58325. class: []
  58326. };
  58327. (0, _html_utils.setAccess)(this, attributes.class);
  58328. if (!this[_xfa_object.$extra]) {
  58329. this[_xfa_object.$extra] = Object.create(null);
  58330. }
  58331. Object.assign(this[_xfa_object.$extra], {
  58332. children,
  58333. attributes,
  58334. attempt: 0,
  58335. line: null,
  58336. numberInLine: 0,
  58337. availableSpace: {
  58338. width: Math.min(this.w || Infinity, availableSpace.width),
  58339. height: Math.min(this.h || Infinity, availableSpace.height)
  58340. },
  58341. width: 0,
  58342. height: 0,
  58343. prevHeight: 0,
  58344. currentWidth: 0
  58345. });
  58346. const isSplittable = this[_xfa_object.$isSplittable]();
  58347. if (!isSplittable) {
  58348. setFirstUnsplittable(this);
  58349. }
  58350. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  58351. return _utils.HTMLResult.FAILURE;
  58352. }
  58353. const filter = new Set(["field"]);
  58354. if (this.layout.includes("row")) {
  58355. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  58356. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  58357. this[_xfa_object.$extra].columnWidths = columnWidths;
  58358. this[_xfa_object.$extra].currentColumn = 0;
  58359. }
  58360. }
  58361. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  58362. const classNames = ["xfaExclgroup"];
  58363. const cl = (0, _html_utils.layoutClass)(this);
  58364. if (cl) {
  58365. classNames.push(cl);
  58366. }
  58367. if ((0, _html_utils.isPrintOnly)(this)) {
  58368. classNames.push("xfaPrintOnly");
  58369. }
  58370. attributes.style = style;
  58371. attributes.class = classNames;
  58372. if (this.name) {
  58373. attributes.xfaName = this.name;
  58374. }
  58375. this[_xfa_object.$pushPara]();
  58376. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  58377. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  58378. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  58379. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  58380. this[_xfa_object.$extra].numberInLine = 0;
  58381. }
  58382. const result = this[_xfa_object.$childrenToHTML]({
  58383. filter,
  58384. include: true
  58385. });
  58386. if (result.success) {
  58387. break;
  58388. }
  58389. if (result.isBreak()) {
  58390. this[_xfa_object.$popPara]();
  58391. return result;
  58392. }
  58393. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58394. this[_xfa_object.$extra].attempt = maxRun;
  58395. break;
  58396. }
  58397. }
  58398. this[_xfa_object.$popPara]();
  58399. if (!isSplittable) {
  58400. unsetFirstUnsplittable(this);
  58401. }
  58402. if (this[_xfa_object.$extra].attempt === maxRun) {
  58403. if (!isSplittable) {
  58404. delete this[_xfa_object.$extra];
  58405. }
  58406. return _utils.HTMLResult.FAILURE;
  58407. }
  58408. let marginH = 0;
  58409. let marginV = 0;
  58410. if (this.margin) {
  58411. marginH = this.margin.leftInset + this.margin.rightInset;
  58412. marginV = this.margin.topInset + this.margin.bottomInset;
  58413. }
  58414. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  58415. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  58416. const bbox = [this.x, this.y, width, height];
  58417. if (this.w === "") {
  58418. style.width = (0, _html_utils.measureToString)(width);
  58419. }
  58420. if (this.h === "") {
  58421. style.height = (0, _html_utils.measureToString)(height);
  58422. }
  58423. const html = {
  58424. name: "div",
  58425. attributes,
  58426. children
  58427. };
  58428. applyAssist(this, attributes);
  58429. delete this[_xfa_object.$extra];
  58430. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  58431. }
  58432. }
  58433. class Execute extends _xfa_object.XFAObject {
  58434. constructor(attributes) {
  58435. super(TEMPLATE_NS_ID, "execute");
  58436. this.connection = attributes.connection || "";
  58437. this.executeType = (0, _utils.getStringOption)(attributes.executeType, ["import", "remerge"]);
  58438. this.id = attributes.id || "";
  58439. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  58440. this.use = attributes.use || "";
  58441. this.usehref = attributes.usehref || "";
  58442. }
  58443. }
  58444. class Extras extends _xfa_object.XFAObject {
  58445. constructor(attributes) {
  58446. super(TEMPLATE_NS_ID, "extras", true);
  58447. this.id = attributes.id || "";
  58448. this.name = attributes.name || "";
  58449. this.use = attributes.use || "";
  58450. this.usehref = attributes.usehref || "";
  58451. this.boolean = new _xfa_object.XFAObjectArray();
  58452. this.date = new _xfa_object.XFAObjectArray();
  58453. this.dateTime = new _xfa_object.XFAObjectArray();
  58454. this.decimal = new _xfa_object.XFAObjectArray();
  58455. this.exData = new _xfa_object.XFAObjectArray();
  58456. this.extras = new _xfa_object.XFAObjectArray();
  58457. this.float = new _xfa_object.XFAObjectArray();
  58458. this.image = new _xfa_object.XFAObjectArray();
  58459. this.integer = new _xfa_object.XFAObjectArray();
  58460. this.text = new _xfa_object.XFAObjectArray();
  58461. this.time = new _xfa_object.XFAObjectArray();
  58462. }
  58463. }
  58464. class Field extends _xfa_object.XFAObject {
  58465. constructor(attributes) {
  58466. super(TEMPLATE_NS_ID, "field", true);
  58467. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  58468. this.accessKey = attributes.accessKey || "";
  58469. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  58470. this.colSpan = (0, _utils.getInteger)({
  58471. data: attributes.colSpan,
  58472. defaultValue: 1,
  58473. validate: n => n >= 1 || n === -1
  58474. });
  58475. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  58476. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  58477. this.id = attributes.id || "";
  58478. this.locale = attributes.locale || "";
  58479. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  58480. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  58481. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  58482. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  58483. this.name = attributes.name || "";
  58484. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  58485. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  58486. this.rotate = (0, _utils.getInteger)({
  58487. data: attributes.rotate,
  58488. defaultValue: 0,
  58489. validate: x => x % 90 === 0
  58490. });
  58491. this.use = attributes.use || "";
  58492. this.usehref = attributes.usehref || "";
  58493. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  58494. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  58495. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  58496. this.assist = null;
  58497. this.bind = null;
  58498. this.border = null;
  58499. this.calculate = null;
  58500. this.caption = null;
  58501. this.desc = null;
  58502. this.extras = null;
  58503. this.font = null;
  58504. this.format = null;
  58505. this.items = new _xfa_object.XFAObjectArray(2);
  58506. this.keep = null;
  58507. this.margin = null;
  58508. this.para = null;
  58509. this.traversal = null;
  58510. this.ui = null;
  58511. this.validate = null;
  58512. this.value = null;
  58513. this.bindItems = new _xfa_object.XFAObjectArray();
  58514. this.connect = new _xfa_object.XFAObjectArray();
  58515. this.event = new _xfa_object.XFAObjectArray();
  58516. this.setProperty = new _xfa_object.XFAObjectArray();
  58517. }
  58518. [_xfa_object.$isBindable]() {
  58519. return true;
  58520. }
  58521. [_xfa_object.$setValue](value) {
  58522. _setValue(this, value);
  58523. }
  58524. [_xfa_object.$toHTML](availableSpace) {
  58525. setTabIndex(this);
  58526. if (!this.ui) {
  58527. this.ui = new Ui({});
  58528. this.ui[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  58529. this[_xfa_object.$appendChild](this.ui);
  58530. let node;
  58531. switch (this.items.children.length) {
  58532. case 0:
  58533. node = new TextEdit({});
  58534. this.ui.textEdit = node;
  58535. break;
  58536. case 1:
  58537. node = new CheckButton({});
  58538. this.ui.checkButton = node;
  58539. break;
  58540. case 2:
  58541. node = new ChoiceList({});
  58542. this.ui.choiceList = node;
  58543. break;
  58544. }
  58545. this.ui[_xfa_object.$appendChild](node);
  58546. }
  58547. if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  58548. return _utils.HTMLResult.EMPTY;
  58549. }
  58550. if (this.caption) {
  58551. delete this.caption[_xfa_object.$extra];
  58552. }
  58553. this[_xfa_object.$pushPara]();
  58554. const caption = this.caption ? this.caption[_xfa_object.$toHTML](availableSpace).html : null;
  58555. const savedW = this.w;
  58556. const savedH = this.h;
  58557. let marginH = 0;
  58558. let marginV = 0;
  58559. if (this.margin) {
  58560. marginH = this.margin.leftInset + this.margin.rightInset;
  58561. marginV = this.margin.topInset + this.margin.bottomInset;
  58562. }
  58563. let borderDims = null;
  58564. if (this.w === "" || this.h === "") {
  58565. let width = null;
  58566. let height = null;
  58567. let uiW = 0;
  58568. let uiH = 0;
  58569. if (this.ui.checkButton) {
  58570. uiW = uiH = this.ui.checkButton.size;
  58571. } else {
  58572. const {
  58573. w,
  58574. h
  58575. } = (0, _html_utils.layoutNode)(this, availableSpace);
  58576. if (w !== null) {
  58577. uiW = w;
  58578. uiH = h;
  58579. } else {
  58580. uiH = (0, _fonts.getMetrics)(this.font, true).lineNoGap;
  58581. }
  58582. }
  58583. borderDims = getBorderDims(this.ui[_xfa_object.$getExtra]());
  58584. uiW += borderDims.w;
  58585. uiH += borderDims.h;
  58586. if (this.caption) {
  58587. const {
  58588. w,
  58589. h,
  58590. isBroken
  58591. } = this.caption[_xfa_object.$getExtra](availableSpace);
  58592. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  58593. this[_xfa_object.$popPara]();
  58594. return _utils.HTMLResult.FAILURE;
  58595. }
  58596. width = w;
  58597. height = h;
  58598. switch (this.caption.placement) {
  58599. case "left":
  58600. case "right":
  58601. case "inline":
  58602. width += uiW;
  58603. break;
  58604. case "top":
  58605. case "bottom":
  58606. height += uiH;
  58607. break;
  58608. }
  58609. } else {
  58610. width = uiW;
  58611. height = uiH;
  58612. }
  58613. if (width && this.w === "") {
  58614. width += marginH;
  58615. this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW);
  58616. }
  58617. if (height && this.h === "") {
  58618. height += marginV;
  58619. this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH);
  58620. }
  58621. }
  58622. this[_xfa_object.$popPara]();
  58623. (0, _html_utils.fixDimensions)(this);
  58624. setFirstUnsplittable(this);
  58625. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  58626. this.w = savedW;
  58627. this.h = savedH;
  58628. this[_xfa_object.$popPara]();
  58629. return _utils.HTMLResult.FAILURE;
  58630. }
  58631. unsetFirstUnsplittable(this);
  58632. const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign");
  58633. (0, _html_utils.setMinMaxDimensions)(this, style);
  58634. const classNames = ["xfaField"];
  58635. if (this.font) {
  58636. classNames.push("xfaFont");
  58637. }
  58638. if ((0, _html_utils.isPrintOnly)(this)) {
  58639. classNames.push("xfaPrintOnly");
  58640. }
  58641. const attributes = {
  58642. style,
  58643. id: this[_xfa_object.$uid],
  58644. class: classNames
  58645. };
  58646. if (style.margin) {
  58647. style.padding = style.margin;
  58648. delete style.margin;
  58649. }
  58650. (0, _html_utils.setAccess)(this, classNames);
  58651. if (this.name) {
  58652. attributes.xfaName = this.name;
  58653. }
  58654. const children = [];
  58655. const html = {
  58656. name: "div",
  58657. attributes,
  58658. children
  58659. };
  58660. applyAssist(this, attributes);
  58661. const borderStyle = this.border ? this.border[_xfa_object.$toStyle]() : null;
  58662. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  58663. const ui = this.ui[_xfa_object.$toHTML]().html;
  58664. if (!ui) {
  58665. Object.assign(style, borderStyle);
  58666. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  58667. }
  58668. if (this[_xfa_object.$tabIndex]) {
  58669. if (ui.children && ui.children[0]) {
  58670. ui.children[0].attributes.tabindex = this[_xfa_object.$tabIndex];
  58671. } else {
  58672. ui.attributes.tabindex = this[_xfa_object.$tabIndex];
  58673. }
  58674. }
  58675. if (!ui.attributes.style) {
  58676. ui.attributes.style = Object.create(null);
  58677. }
  58678. let aElement = null;
  58679. if (this.ui.button) {
  58680. if (ui.children.length === 1) {
  58681. [aElement] = ui.children.splice(0, 1);
  58682. }
  58683. Object.assign(ui.attributes.style, borderStyle);
  58684. } else {
  58685. Object.assign(style, borderStyle);
  58686. }
  58687. children.push(ui);
  58688. if (this.value) {
  58689. if (this.ui.imageEdit) {
  58690. ui.children.push(this.value[_xfa_object.$toHTML]().html);
  58691. } else if (!this.ui.button) {
  58692. let value = "";
  58693. if (this.value.exData) {
  58694. value = this.value.exData[_xfa_object.$text]();
  58695. } else if (this.value.text) {
  58696. value = this.value.text[_xfa_object.$getExtra]();
  58697. } else {
  58698. const htmlValue = this.value[_xfa_object.$toHTML]().html;
  58699. if (htmlValue !== null) {
  58700. value = htmlValue.children[0].value;
  58701. }
  58702. }
  58703. if (this.ui.textEdit && this.value.text && this.value.text.maxChars) {
  58704. ui.children[0].attributes.maxLength = this.value.text.maxChars;
  58705. }
  58706. if (value) {
  58707. if (this.ui.numericEdit) {
  58708. value = parseFloat(value);
  58709. value = isNaN(value) ? "" : value.toString();
  58710. }
  58711. if (ui.children[0].name === "textarea") {
  58712. ui.children[0].attributes.textContent = value;
  58713. } else {
  58714. ui.children[0].attributes.value = value;
  58715. }
  58716. }
  58717. }
  58718. }
  58719. if (!this.ui.imageEdit && ui.children && ui.children[0] && this.h) {
  58720. borderDims = borderDims || getBorderDims(this.ui[_xfa_object.$getExtra]());
  58721. let captionHeight = 0;
  58722. if (this.caption && ["top", "bottom"].includes(this.caption.placement)) {
  58723. captionHeight = this.caption.reserve;
  58724. if (captionHeight <= 0) {
  58725. captionHeight = this.caption[_xfa_object.$getExtra](availableSpace).h;
  58726. }
  58727. const inputHeight = this.h - captionHeight - marginV - borderDims.h;
  58728. ui.children[0].attributes.style.height = (0, _html_utils.measureToString)(inputHeight);
  58729. } else {
  58730. ui.children[0].attributes.style.height = "100%";
  58731. }
  58732. }
  58733. if (aElement) {
  58734. ui.children.push(aElement);
  58735. }
  58736. if (!caption) {
  58737. if (ui.attributes.class) {
  58738. ui.attributes.class.push("xfaLeft");
  58739. }
  58740. this.w = savedW;
  58741. this.h = savedH;
  58742. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  58743. }
  58744. if (this.ui.button) {
  58745. if (style.padding) {
  58746. delete style.padding;
  58747. }
  58748. if (caption.name === "div") {
  58749. caption.name = "span";
  58750. }
  58751. ui.children.push(caption);
  58752. return _utils.HTMLResult.success(html, bbox);
  58753. } else if (this.ui.checkButton) {
  58754. caption.attributes.class[0] = "xfaCaptionForCheckButton";
  58755. }
  58756. if (!ui.attributes.class) {
  58757. ui.attributes.class = [];
  58758. }
  58759. ui.children.splice(0, 0, caption);
  58760. switch (this.caption.placement) {
  58761. case "left":
  58762. ui.attributes.class.push("xfaLeft");
  58763. break;
  58764. case "right":
  58765. ui.attributes.class.push("xfaRight");
  58766. break;
  58767. case "top":
  58768. ui.attributes.class.push("xfaTop");
  58769. break;
  58770. case "bottom":
  58771. ui.attributes.class.push("xfaBottom");
  58772. break;
  58773. case "inline":
  58774. ui.attributes.class.push("xfaLeft");
  58775. break;
  58776. }
  58777. this.w = savedW;
  58778. this.h = savedH;
  58779. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  58780. }
  58781. }
  58782. exports.Field = Field;
  58783. class Fill extends _xfa_object.XFAObject {
  58784. constructor(attributes) {
  58785. super(TEMPLATE_NS_ID, "fill", true);
  58786. this.id = attributes.id || "";
  58787. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  58788. this.use = attributes.use || "";
  58789. this.usehref = attributes.usehref || "";
  58790. this.color = null;
  58791. this.extras = null;
  58792. this.linear = null;
  58793. this.pattern = null;
  58794. this.radial = null;
  58795. this.solid = null;
  58796. this.stipple = null;
  58797. }
  58798. [_xfa_object.$toStyle]() {
  58799. const parent = this[_xfa_object.$getParent]();
  58800. const grandpa = parent[_xfa_object.$getParent]();
  58801. const ggrandpa = grandpa[_xfa_object.$getParent]();
  58802. const style = Object.create(null);
  58803. let propName = "color";
  58804. let altPropName = propName;
  58805. if (parent instanceof Border) {
  58806. propName = "background-color";
  58807. altPropName = "background";
  58808. if (ggrandpa instanceof Ui) {
  58809. style.backgroundColor = "white";
  58810. }
  58811. }
  58812. if (parent instanceof Rectangle || parent instanceof Arc) {
  58813. propName = altPropName = "fill";
  58814. style.fill = "white";
  58815. }
  58816. for (const name of Object.getOwnPropertyNames(this)) {
  58817. if (name === "extras" || name === "color") {
  58818. continue;
  58819. }
  58820. const obj = this[name];
  58821. if (!(obj instanceof _xfa_object.XFAObject)) {
  58822. continue;
  58823. }
  58824. const color = obj[_xfa_object.$toStyle](this.color);
  58825. if (color) {
  58826. style[color.startsWith("#") ? propName : altPropName] = color;
  58827. }
  58828. return style;
  58829. }
  58830. if (this.color && this.color.value) {
  58831. const color = this.color[_xfa_object.$toStyle]();
  58832. style[color.startsWith("#") ? propName : altPropName] = color;
  58833. }
  58834. return style;
  58835. }
  58836. }
  58837. class Filter extends _xfa_object.XFAObject {
  58838. constructor(attributes) {
  58839. super(TEMPLATE_NS_ID, "filter", true);
  58840. this.addRevocationInfo = (0, _utils.getStringOption)(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
  58841. this.id = attributes.id || "";
  58842. this.name = attributes.name || "";
  58843. this.use = attributes.use || "";
  58844. this.usehref = attributes.usehref || "";
  58845. this.version = (0, _utils.getInteger)({
  58846. data: this.version,
  58847. defaultValue: 5,
  58848. validate: x => x >= 1 && x <= 5
  58849. });
  58850. this.appearanceFilter = null;
  58851. this.certificates = null;
  58852. this.digestMethods = null;
  58853. this.encodings = null;
  58854. this.encryptionMethods = null;
  58855. this.handler = null;
  58856. this.lockDocument = null;
  58857. this.mdp = null;
  58858. this.reasons = null;
  58859. this.timeStamp = null;
  58860. }
  58861. }
  58862. class Float extends _xfa_object.ContentObject {
  58863. constructor(attributes) {
  58864. super(TEMPLATE_NS_ID, "float");
  58865. this.id = attributes.id || "";
  58866. this.name = attributes.name || "";
  58867. this.use = attributes.use || "";
  58868. this.usehref = attributes.usehref || "";
  58869. }
  58870. [_xfa_object.$finalize]() {
  58871. const number = parseFloat(this[_xfa_object.$content].trim());
  58872. this[_xfa_object.$content] = isNaN(number) ? null : number;
  58873. }
  58874. [_xfa_object.$toHTML](availableSpace) {
  58875. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  58876. }
  58877. }
  58878. class Font extends _xfa_object.XFAObject {
  58879. constructor(attributes) {
  58880. super(TEMPLATE_NS_ID, "font", true);
  58881. this.baselineShift = (0, _utils.getMeasurement)(attributes.baselineShift);
  58882. this.fontHorizontalScale = (0, _utils.getFloat)({
  58883. data: attributes.fontHorizontalScale,
  58884. defaultValue: 100,
  58885. validate: x => x >= 0
  58886. });
  58887. this.fontVerticalScale = (0, _utils.getFloat)({
  58888. data: attributes.fontVerticalScale,
  58889. defaultValue: 100,
  58890. validate: x => x >= 0
  58891. });
  58892. this.id = attributes.id || "";
  58893. this.kerningMode = (0, _utils.getStringOption)(attributes.kerningMode, ["none", "pair"]);
  58894. this.letterSpacing = (0, _utils.getMeasurement)(attributes.letterSpacing, "0");
  58895. this.lineThrough = (0, _utils.getInteger)({
  58896. data: attributes.lineThrough,
  58897. defaultValue: 0,
  58898. validate: x => x === 1 || x === 2
  58899. });
  58900. this.lineThroughPeriod = (0, _utils.getStringOption)(attributes.lineThroughPeriod, ["all", "word"]);
  58901. this.overline = (0, _utils.getInteger)({
  58902. data: attributes.overline,
  58903. defaultValue: 0,
  58904. validate: x => x === 1 || x === 2
  58905. });
  58906. this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]);
  58907. this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]);
  58908. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  58909. this.typeface = attributes.typeface || "Courier";
  58910. this.underline = (0, _utils.getInteger)({
  58911. data: attributes.underline,
  58912. defaultValue: 0,
  58913. validate: x => x === 1 || x === 2
  58914. });
  58915. this.underlinePeriod = (0, _utils.getStringOption)(attributes.underlinePeriod, ["all", "word"]);
  58916. this.use = attributes.use || "";
  58917. this.usehref = attributes.usehref || "";
  58918. this.weight = (0, _utils.getStringOption)(attributes.weight, ["normal", "bold"]);
  58919. this.extras = null;
  58920. this.fill = null;
  58921. }
  58922. [_xfa_object.$clean](builder) {
  58923. super[_xfa_object.$clean](builder);
  58924. this[_xfa_object.$globalData].usedTypefaces.add(this.typeface);
  58925. }
  58926. [_xfa_object.$toStyle]() {
  58927. const style = (0, _html_utils.toStyle)(this, "fill");
  58928. const color = style.color;
  58929. if (color) {
  58930. if (color === "#000000") {
  58931. delete style.color;
  58932. } else if (!color.startsWith("#")) {
  58933. style.background = color;
  58934. style.backgroundClip = "text";
  58935. style.color = "transparent";
  58936. }
  58937. }
  58938. if (this.baselineShift) {
  58939. style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift);
  58940. }
  58941. style.fontKerning = this.kerningMode === "none" ? "none" : "normal";
  58942. style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing);
  58943. if (this.lineThrough !== 0) {
  58944. style.textDecoration = "line-through";
  58945. if (this.lineThrough === 2) {
  58946. style.textDecorationStyle = "double";
  58947. }
  58948. }
  58949. if (this.overline !== 0) {
  58950. style.textDecoration = "overline";
  58951. if (this.overline === 2) {
  58952. style.textDecorationStyle = "double";
  58953. }
  58954. }
  58955. style.fontStyle = this.posture;
  58956. style.fontSize = (0, _html_utils.measureToString)(0.99 * this.size);
  58957. (0, _html_utils.setFontFamily)(this, this, this[_xfa_object.$globalData].fontFinder, style);
  58958. if (this.underline !== 0) {
  58959. style.textDecoration = "underline";
  58960. if (this.underline === 2) {
  58961. style.textDecorationStyle = "double";
  58962. }
  58963. }
  58964. style.fontWeight = this.weight;
  58965. return style;
  58966. }
  58967. }
  58968. class Format extends _xfa_object.XFAObject {
  58969. constructor(attributes) {
  58970. super(TEMPLATE_NS_ID, "format", true);
  58971. this.id = attributes.id || "";
  58972. this.use = attributes.use || "";
  58973. this.usehref = attributes.usehref || "";
  58974. this.extras = null;
  58975. this.picture = null;
  58976. }
  58977. }
  58978. class Handler extends _xfa_object.StringObject {
  58979. constructor(attributes) {
  58980. super(TEMPLATE_NS_ID, "handler");
  58981. this.id = attributes.id || "";
  58982. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  58983. this.use = attributes.use || "";
  58984. this.usehref = attributes.usehref || "";
  58985. }
  58986. }
  58987. class Hyphenation extends _xfa_object.XFAObject {
  58988. constructor(attributes) {
  58989. super(TEMPLATE_NS_ID, "hyphenation");
  58990. this.excludeAllCaps = (0, _utils.getInteger)({
  58991. data: attributes.excludeAllCaps,
  58992. defaultValue: 0,
  58993. validate: x => x === 1
  58994. });
  58995. this.excludeInitialCap = (0, _utils.getInteger)({
  58996. data: attributes.excludeInitialCap,
  58997. defaultValue: 0,
  58998. validate: x => x === 1
  58999. });
  59000. this.hyphenate = (0, _utils.getInteger)({
  59001. data: attributes.hyphenate,
  59002. defaultValue: 0,
  59003. validate: x => x === 1
  59004. });
  59005. this.id = attributes.id || "";
  59006. this.pushCharacterCount = (0, _utils.getInteger)({
  59007. data: attributes.pushCharacterCount,
  59008. defaultValue: 3,
  59009. validate: x => x >= 0
  59010. });
  59011. this.remainCharacterCount = (0, _utils.getInteger)({
  59012. data: attributes.remainCharacterCount,
  59013. defaultValue: 3,
  59014. validate: x => x >= 0
  59015. });
  59016. this.use = attributes.use || "";
  59017. this.usehref = attributes.usehref || "";
  59018. this.wordCharacterCount = (0, _utils.getInteger)({
  59019. data: attributes.wordCharacterCount,
  59020. defaultValue: 7,
  59021. validate: x => x >= 0
  59022. });
  59023. }
  59024. }
  59025. class Image extends _xfa_object.StringObject {
  59026. constructor(attributes) {
  59027. super(TEMPLATE_NS_ID, "image");
  59028. this.aspect = (0, _utils.getStringOption)(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
  59029. this.contentType = attributes.contentType || "";
  59030. this.href = attributes.href || "";
  59031. this.id = attributes.id || "";
  59032. this.name = attributes.name || "";
  59033. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["base64", "none", "package"]);
  59034. this.use = attributes.use || "";
  59035. this.usehref = attributes.usehref || "";
  59036. }
  59037. [_xfa_object.$toHTML]() {
  59038. if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) {
  59039. return _utils.HTMLResult.EMPTY;
  59040. }
  59041. let buffer = this[_xfa_object.$globalData].images && this[_xfa_object.$globalData].images.get(this.href);
  59042. if (!buffer && (this.href || !this[_xfa_object.$content])) {
  59043. return _utils.HTMLResult.EMPTY;
  59044. }
  59045. if (!buffer && this.transferEncoding === "base64") {
  59046. buffer = (0, _util.stringToBytes)(atob(this[_xfa_object.$content]));
  59047. }
  59048. if (!buffer) {
  59049. return _utils.HTMLResult.EMPTY;
  59050. }
  59051. if (!this.contentType) {
  59052. for (const [header, type] of IMAGES_HEADERS) {
  59053. if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) {
  59054. this.contentType = type;
  59055. break;
  59056. }
  59057. }
  59058. if (!this.contentType) {
  59059. return _utils.HTMLResult.EMPTY;
  59060. }
  59061. }
  59062. const blob = new Blob([buffer], {
  59063. type: this.contentType
  59064. });
  59065. let style;
  59066. switch (this.aspect) {
  59067. case "fit":
  59068. case "actual":
  59069. break;
  59070. case "height":
  59071. style = {
  59072. height: "100%",
  59073. objectFit: "fill"
  59074. };
  59075. break;
  59076. case "none":
  59077. style = {
  59078. width: "100%",
  59079. height: "100%",
  59080. objectFit: "fill"
  59081. };
  59082. break;
  59083. case "width":
  59084. style = {
  59085. width: "100%",
  59086. objectFit: "fill"
  59087. };
  59088. break;
  59089. }
  59090. const parent = this[_xfa_object.$getParent]();
  59091. return _utils.HTMLResult.success({
  59092. name: "img",
  59093. attributes: {
  59094. class: ["xfaImage"],
  59095. style,
  59096. src: URL.createObjectURL(blob),
  59097. alt: parent ? ariaLabel(parent[_xfa_object.$getParent]()) : null
  59098. }
  59099. });
  59100. }
  59101. }
  59102. class ImageEdit extends _xfa_object.XFAObject {
  59103. constructor(attributes) {
  59104. super(TEMPLATE_NS_ID, "imageEdit", true);
  59105. this.data = (0, _utils.getStringOption)(attributes.data, ["link", "embed"]);
  59106. this.id = attributes.id || "";
  59107. this.use = attributes.use || "";
  59108. this.usehref = attributes.usehref || "";
  59109. this.border = null;
  59110. this.extras = null;
  59111. this.margin = null;
  59112. }
  59113. [_xfa_object.$toHTML](availableSpace) {
  59114. if (this.data === "embed") {
  59115. return _utils.HTMLResult.success({
  59116. name: "div",
  59117. children: [],
  59118. attributes: {}
  59119. });
  59120. }
  59121. return _utils.HTMLResult.EMPTY;
  59122. }
  59123. }
  59124. class Integer extends _xfa_object.ContentObject {
  59125. constructor(attributes) {
  59126. super(TEMPLATE_NS_ID, "integer");
  59127. this.id = attributes.id || "";
  59128. this.name = attributes.name || "";
  59129. this.use = attributes.use || "";
  59130. this.usehref = attributes.usehref || "";
  59131. }
  59132. [_xfa_object.$finalize]() {
  59133. const number = parseInt(this[_xfa_object.$content].trim(), 10);
  59134. this[_xfa_object.$content] = isNaN(number) ? null : number;
  59135. }
  59136. [_xfa_object.$toHTML](availableSpace) {
  59137. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  59138. }
  59139. }
  59140. class Issuers extends _xfa_object.XFAObject {
  59141. constructor(attributes) {
  59142. super(TEMPLATE_NS_ID, "issuers", true);
  59143. this.id = attributes.id || "";
  59144. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  59145. this.use = attributes.use || "";
  59146. this.usehref = attributes.usehref || "";
  59147. this.certificate = new _xfa_object.XFAObjectArray();
  59148. }
  59149. }
  59150. class Items extends _xfa_object.XFAObject {
  59151. constructor(attributes) {
  59152. super(TEMPLATE_NS_ID, "items", true);
  59153. this.id = attributes.id || "";
  59154. this.name = attributes.name || "";
  59155. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  59156. this.ref = attributes.ref || "";
  59157. this.save = (0, _utils.getInteger)({
  59158. data: attributes.save,
  59159. defaultValue: 0,
  59160. validate: x => x === 1
  59161. });
  59162. this.use = attributes.use || "";
  59163. this.usehref = attributes.usehref || "";
  59164. this.boolean = new _xfa_object.XFAObjectArray();
  59165. this.date = new _xfa_object.XFAObjectArray();
  59166. this.dateTime = new _xfa_object.XFAObjectArray();
  59167. this.decimal = new _xfa_object.XFAObjectArray();
  59168. this.exData = new _xfa_object.XFAObjectArray();
  59169. this.float = new _xfa_object.XFAObjectArray();
  59170. this.image = new _xfa_object.XFAObjectArray();
  59171. this.integer = new _xfa_object.XFAObjectArray();
  59172. this.text = new _xfa_object.XFAObjectArray();
  59173. this.time = new _xfa_object.XFAObjectArray();
  59174. }
  59175. [_xfa_object.$toHTML]() {
  59176. const output = [];
  59177. for (const child of this[_xfa_object.$getChildren]()) {
  59178. output.push(child[_xfa_object.$text]());
  59179. }
  59180. return _utils.HTMLResult.success(output);
  59181. }
  59182. }
  59183. exports.Items = Items;
  59184. class Keep extends _xfa_object.XFAObject {
  59185. constructor(attributes) {
  59186. super(TEMPLATE_NS_ID, "keep", true);
  59187. this.id = attributes.id || "";
  59188. const options = ["none", "contentArea", "pageArea"];
  59189. this.intact = (0, _utils.getStringOption)(attributes.intact, options);
  59190. this.next = (0, _utils.getStringOption)(attributes.next, options);
  59191. this.previous = (0, _utils.getStringOption)(attributes.previous, options);
  59192. this.use = attributes.use || "";
  59193. this.usehref = attributes.usehref || "";
  59194. this.extras = null;
  59195. }
  59196. }
  59197. class KeyUsage extends _xfa_object.XFAObject {
  59198. constructor(attributes) {
  59199. super(TEMPLATE_NS_ID, "keyUsage");
  59200. const options = ["", "yes", "no"];
  59201. this.crlSign = (0, _utils.getStringOption)(attributes.crlSign, options);
  59202. this.dataEncipherment = (0, _utils.getStringOption)(attributes.dataEncipherment, options);
  59203. this.decipherOnly = (0, _utils.getStringOption)(attributes.decipherOnly, options);
  59204. this.digitalSignature = (0, _utils.getStringOption)(attributes.digitalSignature, options);
  59205. this.encipherOnly = (0, _utils.getStringOption)(attributes.encipherOnly, options);
  59206. this.id = attributes.id || "";
  59207. this.keyAgreement = (0, _utils.getStringOption)(attributes.keyAgreement, options);
  59208. this.keyCertSign = (0, _utils.getStringOption)(attributes.keyCertSign, options);
  59209. this.keyEncipherment = (0, _utils.getStringOption)(attributes.keyEncipherment, options);
  59210. this.nonRepudiation = (0, _utils.getStringOption)(attributes.nonRepudiation, options);
  59211. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  59212. this.use = attributes.use || "";
  59213. this.usehref = attributes.usehref || "";
  59214. }
  59215. }
  59216. class Line extends _xfa_object.XFAObject {
  59217. constructor(attributes) {
  59218. super(TEMPLATE_NS_ID, "line", true);
  59219. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  59220. this.id = attributes.id || "";
  59221. this.slope = (0, _utils.getStringOption)(attributes.slope, ["\\", "/"]);
  59222. this.use = attributes.use || "";
  59223. this.usehref = attributes.usehref || "";
  59224. this.edge = null;
  59225. }
  59226. [_xfa_object.$toHTML]() {
  59227. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  59228. const edge = this.edge || new Edge({});
  59229. const edgeStyle = edge[_xfa_object.$toStyle]();
  59230. const style = Object.create(null);
  59231. const thickness = edge.presence === "visible" ? edge.thickness : 0;
  59232. style.strokeWidth = (0, _html_utils.measureToString)(thickness);
  59233. style.stroke = edgeStyle.color;
  59234. let x1, y1, x2, y2;
  59235. let width = "100%";
  59236. let height = "100%";
  59237. if (parent.w <= thickness) {
  59238. [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"];
  59239. width = style.strokeWidth;
  59240. } else if (parent.h <= thickness) {
  59241. [x1, y1, x2, y2] = [0, "50%", "100%", "50%"];
  59242. height = style.strokeWidth;
  59243. } else {
  59244. if (this.slope === "\\") {
  59245. [x1, y1, x2, y2] = [0, 0, "100%", "100%"];
  59246. } else {
  59247. [x1, y1, x2, y2] = [0, "100%", "100%", 0];
  59248. }
  59249. }
  59250. const line = {
  59251. name: "line",
  59252. attributes: {
  59253. xmlns: SVG_NS,
  59254. x1,
  59255. y1,
  59256. x2,
  59257. y2,
  59258. style
  59259. }
  59260. };
  59261. const svg = {
  59262. name: "svg",
  59263. children: [line],
  59264. attributes: {
  59265. xmlns: SVG_NS,
  59266. width,
  59267. height,
  59268. style: {
  59269. overflow: "visible"
  59270. }
  59271. }
  59272. };
  59273. if (hasMargin(parent)) {
  59274. return _utils.HTMLResult.success({
  59275. name: "div",
  59276. attributes: {
  59277. style: {
  59278. display: "inline",
  59279. width: "100%",
  59280. height: "100%"
  59281. }
  59282. },
  59283. children: [svg]
  59284. });
  59285. }
  59286. svg.attributes.style.position = "absolute";
  59287. return _utils.HTMLResult.success(svg);
  59288. }
  59289. }
  59290. class Linear extends _xfa_object.XFAObject {
  59291. constructor(attributes) {
  59292. super(TEMPLATE_NS_ID, "linear", true);
  59293. this.id = attributes.id || "";
  59294. this.type = (0, _utils.getStringOption)(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]);
  59295. this.use = attributes.use || "";
  59296. this.usehref = attributes.usehref || "";
  59297. this.color = null;
  59298. this.extras = null;
  59299. }
  59300. [_xfa_object.$toStyle](startColor) {
  59301. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  59302. const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
  59303. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  59304. return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
  59305. }
  59306. }
  59307. class LockDocument extends _xfa_object.ContentObject {
  59308. constructor(attributes) {
  59309. super(TEMPLATE_NS_ID, "lockDocument");
  59310. this.id = attributes.id || "";
  59311. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  59312. this.use = attributes.use || "";
  59313. this.usehref = attributes.usehref || "";
  59314. }
  59315. [_xfa_object.$finalize]() {
  59316. this[_xfa_object.$content] = (0, _utils.getStringOption)(this[_xfa_object.$content], ["auto", "0", "1"]);
  59317. }
  59318. }
  59319. class Manifest extends _xfa_object.XFAObject {
  59320. constructor(attributes) {
  59321. super(TEMPLATE_NS_ID, "manifest", true);
  59322. this.action = (0, _utils.getStringOption)(attributes.action, ["include", "all", "exclude"]);
  59323. this.id = attributes.id || "";
  59324. this.name = attributes.name || "";
  59325. this.use = attributes.use || "";
  59326. this.usehref = attributes.usehref || "";
  59327. this.extras = null;
  59328. this.ref = new _xfa_object.XFAObjectArray();
  59329. }
  59330. }
  59331. class Margin extends _xfa_object.XFAObject {
  59332. constructor(attributes) {
  59333. super(TEMPLATE_NS_ID, "margin", true);
  59334. this.bottomInset = (0, _utils.getMeasurement)(attributes.bottomInset, "0");
  59335. this.id = attributes.id || "";
  59336. this.leftInset = (0, _utils.getMeasurement)(attributes.leftInset, "0");
  59337. this.rightInset = (0, _utils.getMeasurement)(attributes.rightInset, "0");
  59338. this.topInset = (0, _utils.getMeasurement)(attributes.topInset, "0");
  59339. this.use = attributes.use || "";
  59340. this.usehref = attributes.usehref || "";
  59341. this.extras = null;
  59342. }
  59343. [_xfa_object.$toStyle]() {
  59344. return {
  59345. 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)
  59346. };
  59347. }
  59348. }
  59349. class Mdp extends _xfa_object.XFAObject {
  59350. constructor(attributes) {
  59351. super(TEMPLATE_NS_ID, "mdp");
  59352. this.id = attributes.id || "";
  59353. this.permissions = (0, _utils.getInteger)({
  59354. data: attributes.permissions,
  59355. defaultValue: 2,
  59356. validate: x => x === 1 || x === 3
  59357. });
  59358. this.signatureType = (0, _utils.getStringOption)(attributes.signatureType, ["filler", "author"]);
  59359. this.use = attributes.use || "";
  59360. this.usehref = attributes.usehref || "";
  59361. }
  59362. }
  59363. class Medium extends _xfa_object.XFAObject {
  59364. constructor(attributes) {
  59365. super(TEMPLATE_NS_ID, "medium");
  59366. this.id = attributes.id || "";
  59367. this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox);
  59368. this.long = (0, _utils.getMeasurement)(attributes.long);
  59369. this.orientation = (0, _utils.getStringOption)(attributes.orientation, ["portrait", "landscape"]);
  59370. this.short = (0, _utils.getMeasurement)(attributes.short);
  59371. this.stock = attributes.stock || "";
  59372. this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, ["auto", "delegate", "pageFront"]);
  59373. this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, ["auto", "delegate"]);
  59374. this.use = attributes.use || "";
  59375. this.usehref = attributes.usehref || "";
  59376. }
  59377. }
  59378. class Message extends _xfa_object.XFAObject {
  59379. constructor(attributes) {
  59380. super(TEMPLATE_NS_ID, "message", true);
  59381. this.id = attributes.id || "";
  59382. this.use = attributes.use || "";
  59383. this.usehref = attributes.usehref || "";
  59384. this.text = new _xfa_object.XFAObjectArray();
  59385. }
  59386. }
  59387. class NumericEdit extends _xfa_object.XFAObject {
  59388. constructor(attributes) {
  59389. super(TEMPLATE_NS_ID, "numericEdit", true);
  59390. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  59391. this.id = attributes.id || "";
  59392. this.use = attributes.use || "";
  59393. this.usehref = attributes.usehref || "";
  59394. this.border = null;
  59395. this.comb = null;
  59396. this.extras = null;
  59397. this.margin = null;
  59398. }
  59399. [_xfa_object.$toHTML](availableSpace) {
  59400. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  59401. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  59402. const html = {
  59403. name: "input",
  59404. attributes: {
  59405. type: "text",
  59406. fieldId: field[_xfa_object.$uid],
  59407. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  59408. class: ["xfaTextfield"],
  59409. style,
  59410. "aria-label": ariaLabel(field),
  59411. "aria-required": false
  59412. }
  59413. };
  59414. if (isRequired(field)) {
  59415. html.attributes["aria-required"] = true;
  59416. html.attributes.required = true;
  59417. }
  59418. return _utils.HTMLResult.success({
  59419. name: "label",
  59420. attributes: {
  59421. class: ["xfaLabel"]
  59422. },
  59423. children: [html]
  59424. });
  59425. }
  59426. }
  59427. class Occur extends _xfa_object.XFAObject {
  59428. constructor(attributes) {
  59429. super(TEMPLATE_NS_ID, "occur", true);
  59430. this.id = attributes.id || "";
  59431. this.initial = attributes.initial !== "" ? (0, _utils.getInteger)({
  59432. data: attributes.initial,
  59433. defaultValue: "",
  59434. validate: x => true
  59435. }) : "";
  59436. this.max = attributes.max !== "" ? (0, _utils.getInteger)({
  59437. data: attributes.max,
  59438. defaultValue: 1,
  59439. validate: x => true
  59440. }) : "";
  59441. this.min = attributes.min !== "" ? (0, _utils.getInteger)({
  59442. data: attributes.min,
  59443. defaultValue: 1,
  59444. validate: x => true
  59445. }) : "";
  59446. this.use = attributes.use || "";
  59447. this.usehref = attributes.usehref || "";
  59448. this.extras = null;
  59449. }
  59450. [_xfa_object.$clean]() {
  59451. const parent = this[_xfa_object.$getParent]();
  59452. const originalMin = this.min;
  59453. if (this.min === "") {
  59454. this.min = parent instanceof PageArea || parent instanceof PageSet ? 0 : 1;
  59455. }
  59456. if (this.max === "") {
  59457. if (originalMin === "") {
  59458. this.max = parent instanceof PageArea || parent instanceof PageSet ? -1 : 1;
  59459. } else {
  59460. this.max = this.min;
  59461. }
  59462. }
  59463. if (this.max !== -1 && this.max < this.min) {
  59464. this.max = this.min;
  59465. }
  59466. if (this.initial === "") {
  59467. this.initial = parent instanceof Template ? 1 : this.min;
  59468. }
  59469. }
  59470. }
  59471. class Oid extends _xfa_object.StringObject {
  59472. constructor(attributes) {
  59473. super(TEMPLATE_NS_ID, "oid");
  59474. this.id = attributes.id || "";
  59475. this.name = attributes.name || "";
  59476. this.use = attributes.use || "";
  59477. this.usehref = attributes.usehref || "";
  59478. }
  59479. }
  59480. class Oids extends _xfa_object.XFAObject {
  59481. constructor(attributes) {
  59482. super(TEMPLATE_NS_ID, "oids", true);
  59483. this.id = attributes.id || "";
  59484. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  59485. this.use = attributes.use || "";
  59486. this.usehref = attributes.usehref || "";
  59487. this.oid = new _xfa_object.XFAObjectArray();
  59488. }
  59489. }
  59490. class Overflow extends _xfa_object.XFAObject {
  59491. constructor(attributes) {
  59492. super(TEMPLATE_NS_ID, "overflow");
  59493. this.id = attributes.id || "";
  59494. this.leader = attributes.leader || "";
  59495. this.target = attributes.target || "";
  59496. this.trailer = attributes.trailer || "";
  59497. this.use = attributes.use || "";
  59498. this.usehref = attributes.usehref || "";
  59499. }
  59500. [_xfa_object.$getExtra]() {
  59501. if (!this[_xfa_object.$extra]) {
  59502. const parent = this[_xfa_object.$getParent]();
  59503. const root = this[_xfa_object.$getTemplateRoot]();
  59504. const target = root[_xfa_object.$searchNode](this.target, parent);
  59505. const leader = root[_xfa_object.$searchNode](this.leader, parent);
  59506. const trailer = root[_xfa_object.$searchNode](this.trailer, parent);
  59507. this[_xfa_object.$extra] = {
  59508. target: target && target[0] || null,
  59509. leader: leader && leader[0] || null,
  59510. trailer: trailer && trailer[0] || null,
  59511. addLeader: false,
  59512. addTrailer: false
  59513. };
  59514. }
  59515. return this[_xfa_object.$extra];
  59516. }
  59517. }
  59518. class PageArea extends _xfa_object.XFAObject {
  59519. constructor(attributes) {
  59520. super(TEMPLATE_NS_ID, "pageArea", true);
  59521. this.blankOrNotBlank = (0, _utils.getStringOption)(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]);
  59522. this.id = attributes.id || "";
  59523. this.initialNumber = (0, _utils.getInteger)({
  59524. data: attributes.initialNumber,
  59525. defaultValue: 1,
  59526. validate: x => true
  59527. });
  59528. this.name = attributes.name || "";
  59529. this.numbered = (0, _utils.getInteger)({
  59530. data: attributes.numbered,
  59531. defaultValue: 1,
  59532. validate: x => true
  59533. });
  59534. this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, ["any", "even", "odd"]);
  59535. this.pagePosition = (0, _utils.getStringOption)(attributes.pagePosition, ["any", "first", "last", "only", "rest"]);
  59536. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  59537. this.use = attributes.use || "";
  59538. this.usehref = attributes.usehref || "";
  59539. this.desc = null;
  59540. this.extras = null;
  59541. this.medium = null;
  59542. this.occur = null;
  59543. this.area = new _xfa_object.XFAObjectArray();
  59544. this.contentArea = new _xfa_object.XFAObjectArray();
  59545. this.draw = new _xfa_object.XFAObjectArray();
  59546. this.exclGroup = new _xfa_object.XFAObjectArray();
  59547. this.field = new _xfa_object.XFAObjectArray();
  59548. this.subform = new _xfa_object.XFAObjectArray();
  59549. }
  59550. [_xfa_object.$isUsable]() {
  59551. if (!this[_xfa_object.$extra]) {
  59552. this[_xfa_object.$extra] = {
  59553. numberOfUse: 0
  59554. };
  59555. return true;
  59556. }
  59557. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  59558. }
  59559. [_xfa_object.$cleanPage]() {
  59560. delete this[_xfa_object.$extra];
  59561. }
  59562. [_xfa_object.$getNextPage]() {
  59563. if (!this[_xfa_object.$extra]) {
  59564. this[_xfa_object.$extra] = {
  59565. numberOfUse: 0
  59566. };
  59567. }
  59568. const parent = this[_xfa_object.$getParent]();
  59569. if (parent.relation === "orderedOccurrence") {
  59570. if (this[_xfa_object.$isUsable]()) {
  59571. this[_xfa_object.$extra].numberOfUse += 1;
  59572. return this;
  59573. }
  59574. }
  59575. return parent[_xfa_object.$getNextPage]();
  59576. }
  59577. [_xfa_object.$getAvailableSpace]() {
  59578. return this[_xfa_object.$extra].space || {
  59579. width: 0,
  59580. height: 0
  59581. };
  59582. }
  59583. [_xfa_object.$toHTML]() {
  59584. if (!this[_xfa_object.$extra]) {
  59585. this[_xfa_object.$extra] = {
  59586. numberOfUse: 1
  59587. };
  59588. }
  59589. const children = [];
  59590. this[_xfa_object.$extra].children = children;
  59591. const style = Object.create(null);
  59592. if (this.medium && this.medium.short && this.medium.long) {
  59593. style.width = (0, _html_utils.measureToString)(this.medium.short);
  59594. style.height = (0, _html_utils.measureToString)(this.medium.long);
  59595. this[_xfa_object.$extra].space = {
  59596. width: this.medium.short,
  59597. height: this.medium.long
  59598. };
  59599. if (this.medium.orientation === "landscape") {
  59600. const x = style.width;
  59601. style.width = style.height;
  59602. style.height = x;
  59603. this[_xfa_object.$extra].space = {
  59604. width: this.medium.long,
  59605. height: this.medium.short
  59606. };
  59607. }
  59608. } else {
  59609. (0, _util.warn)("XFA - No medium specified in pageArea: please file a bug.");
  59610. }
  59611. this[_xfa_object.$childrenToHTML]({
  59612. filter: new Set(["area", "draw", "field", "subform"]),
  59613. include: true
  59614. });
  59615. this[_xfa_object.$childrenToHTML]({
  59616. filter: new Set(["contentArea"]),
  59617. include: true
  59618. });
  59619. return _utils.HTMLResult.success({
  59620. name: "div",
  59621. children,
  59622. attributes: {
  59623. class: ["xfaPage"],
  59624. id: this[_xfa_object.$uid],
  59625. style,
  59626. xfaName: this.name
  59627. }
  59628. });
  59629. }
  59630. }
  59631. class PageSet extends _xfa_object.XFAObject {
  59632. constructor(attributes) {
  59633. super(TEMPLATE_NS_ID, "pageSet", true);
  59634. this.duplexImposition = (0, _utils.getStringOption)(attributes.duplexImposition, ["longEdge", "shortEdge"]);
  59635. this.id = attributes.id || "";
  59636. this.name = attributes.name || "";
  59637. this.relation = (0, _utils.getStringOption)(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
  59638. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  59639. this.use = attributes.use || "";
  59640. this.usehref = attributes.usehref || "";
  59641. this.extras = null;
  59642. this.occur = null;
  59643. this.pageArea = new _xfa_object.XFAObjectArray();
  59644. this.pageSet = new _xfa_object.XFAObjectArray();
  59645. }
  59646. [_xfa_object.$cleanPage]() {
  59647. for (const page of this.pageArea.children) {
  59648. page[_xfa_object.$cleanPage]();
  59649. }
  59650. for (const page of this.pageSet.children) {
  59651. page[_xfa_object.$cleanPage]();
  59652. }
  59653. }
  59654. [_xfa_object.$isUsable]() {
  59655. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  59656. }
  59657. [_xfa_object.$getNextPage]() {
  59658. if (!this[_xfa_object.$extra]) {
  59659. this[_xfa_object.$extra] = {
  59660. numberOfUse: 1,
  59661. pageIndex: -1,
  59662. pageSetIndex: -1
  59663. };
  59664. }
  59665. if (this.relation === "orderedOccurrence") {
  59666. if (this[_xfa_object.$extra].pageIndex + 1 < this.pageArea.children.length) {
  59667. this[_xfa_object.$extra].pageIndex += 1;
  59668. const pageArea = this.pageArea.children[this[_xfa_object.$extra].pageIndex];
  59669. return pageArea[_xfa_object.$getNextPage]();
  59670. }
  59671. if (this[_xfa_object.$extra].pageSetIndex + 1 < this.pageSet.children.length) {
  59672. this[_xfa_object.$extra].pageSetIndex += 1;
  59673. return this.pageSet.children[this[_xfa_object.$extra].pageSetIndex][_xfa_object.$getNextPage]();
  59674. }
  59675. if (this[_xfa_object.$isUsable]()) {
  59676. this[_xfa_object.$extra].numberOfUse += 1;
  59677. this[_xfa_object.$extra].pageIndex = -1;
  59678. this[_xfa_object.$extra].pageSetIndex = -1;
  59679. return this[_xfa_object.$getNextPage]();
  59680. }
  59681. const parent = this[_xfa_object.$getParent]();
  59682. if (parent instanceof PageSet) {
  59683. return parent[_xfa_object.$getNextPage]();
  59684. }
  59685. this[_xfa_object.$cleanPage]();
  59686. return this[_xfa_object.$getNextPage]();
  59687. }
  59688. const pageNumber = this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].pageNumber;
  59689. const parity = pageNumber % 2 === 0 ? "even" : "odd";
  59690. const position = pageNumber === 0 ? "first" : "rest";
  59691. let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position);
  59692. if (page) {
  59693. return page;
  59694. }
  59695. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position);
  59696. if (page) {
  59697. return page;
  59698. }
  59699. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any");
  59700. if (page) {
  59701. return page;
  59702. }
  59703. return this.pageArea.children[0];
  59704. }
  59705. }
  59706. class Para extends _xfa_object.XFAObject {
  59707. constructor(attributes) {
  59708. super(TEMPLATE_NS_ID, "para", true);
  59709. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  59710. this.id = attributes.id || "";
  59711. this.lineHeight = attributes.lineHeight ? (0, _utils.getMeasurement)(attributes.lineHeight, "0pt") : "";
  59712. this.marginLeft = attributes.marginLeft ? (0, _utils.getMeasurement)(attributes.marginLeft, "0pt") : "";
  59713. this.marginRight = attributes.marginRight ? (0, _utils.getMeasurement)(attributes.marginRight, "0pt") : "";
  59714. this.orphans = (0, _utils.getInteger)({
  59715. data: attributes.orphans,
  59716. defaultValue: 0,
  59717. validate: x => x >= 0
  59718. });
  59719. this.preserve = attributes.preserve || "";
  59720. this.radixOffset = attributes.radixOffset ? (0, _utils.getMeasurement)(attributes.radixOffset, "0pt") : "";
  59721. this.spaceAbove = attributes.spaceAbove ? (0, _utils.getMeasurement)(attributes.spaceAbove, "0pt") : "";
  59722. this.spaceBelow = attributes.spaceBelow ? (0, _utils.getMeasurement)(attributes.spaceBelow, "0pt") : "";
  59723. this.tabDefault = attributes.tabDefault ? (0, _utils.getMeasurement)(this.tabDefault) : "";
  59724. this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x);
  59725. this.textIndent = attributes.textIndent ? (0, _utils.getMeasurement)(attributes.textIndent, "0pt") : "";
  59726. this.use = attributes.use || "";
  59727. this.usehref = attributes.usehref || "";
  59728. this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, ["top", "bottom", "middle"]);
  59729. this.widows = (0, _utils.getInteger)({
  59730. data: attributes.widows,
  59731. defaultValue: 0,
  59732. validate: x => x >= 0
  59733. });
  59734. this.hyphenation = null;
  59735. }
  59736. [_xfa_object.$toStyle]() {
  59737. const style = (0, _html_utils.toStyle)(this, "hAlign");
  59738. if (this.marginLeft !== "") {
  59739. style.paddingLeft = (0, _html_utils.measureToString)(this.marginLeft);
  59740. }
  59741. if (this.marginRight !== "") {
  59742. style.paddingight = (0, _html_utils.measureToString)(this.marginRight);
  59743. }
  59744. if (this.spaceAbove !== "") {
  59745. style.paddingTop = (0, _html_utils.measureToString)(this.spaceAbove);
  59746. }
  59747. if (this.spaceBelow !== "") {
  59748. style.paddingBottom = (0, _html_utils.measureToString)(this.spaceBelow);
  59749. }
  59750. if (this.textIndent !== "") {
  59751. style.textIndent = (0, _html_utils.measureToString)(this.textIndent);
  59752. (0, _html_utils.fixTextIndent)(style);
  59753. }
  59754. if (this.lineHeight > 0) {
  59755. style.lineHeight = (0, _html_utils.measureToString)(this.lineHeight);
  59756. }
  59757. if (this.tabDefault !== "") {
  59758. style.tabSize = (0, _html_utils.measureToString)(this.tabDefault);
  59759. }
  59760. if (this.tabStops.length > 0) {}
  59761. if (this.hyphenatation) {
  59762. Object.assign(style, this.hyphenatation[_xfa_object.$toStyle]());
  59763. }
  59764. return style;
  59765. }
  59766. }
  59767. class PasswordEdit extends _xfa_object.XFAObject {
  59768. constructor(attributes) {
  59769. super(TEMPLATE_NS_ID, "passwordEdit", true);
  59770. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  59771. this.id = attributes.id || "";
  59772. this.passwordChar = attributes.passwordChar || "*";
  59773. this.use = attributes.use || "";
  59774. this.usehref = attributes.usehref || "";
  59775. this.border = null;
  59776. this.extras = null;
  59777. this.margin = null;
  59778. }
  59779. }
  59780. class Pattern extends _xfa_object.XFAObject {
  59781. constructor(attributes) {
  59782. super(TEMPLATE_NS_ID, "pattern", true);
  59783. this.id = attributes.id || "";
  59784. this.type = (0, _utils.getStringOption)(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
  59785. this.use = attributes.use || "";
  59786. this.usehref = attributes.usehref || "";
  59787. this.color = null;
  59788. this.extras = null;
  59789. }
  59790. [_xfa_object.$toStyle](startColor) {
  59791. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  59792. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  59793. const width = 5;
  59794. const cmd = "repeating-linear-gradient";
  59795. const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
  59796. switch (this.type) {
  59797. case "crossHatch":
  59798. return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
  59799. case "crossDiagonal":
  59800. return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
  59801. case "diagonalLeft":
  59802. return `${cmd}(45deg,${colors})`;
  59803. case "diagonalRight":
  59804. return `${cmd}(-45deg,${colors})`;
  59805. case "horizontal":
  59806. return `${cmd}(to top,${colors})`;
  59807. case "vertical":
  59808. return `${cmd}(to right,${colors})`;
  59809. }
  59810. return "";
  59811. }
  59812. }
  59813. class Picture extends _xfa_object.StringObject {
  59814. constructor(attributes) {
  59815. super(TEMPLATE_NS_ID, "picture");
  59816. this.id = attributes.id || "";
  59817. this.use = attributes.use || "";
  59818. this.usehref = attributes.usehref || "";
  59819. }
  59820. }
  59821. class Proto extends _xfa_object.XFAObject {
  59822. constructor(attributes) {
  59823. super(TEMPLATE_NS_ID, "proto", true);
  59824. this.appearanceFilter = new _xfa_object.XFAObjectArray();
  59825. this.arc = new _xfa_object.XFAObjectArray();
  59826. this.area = new _xfa_object.XFAObjectArray();
  59827. this.assist = new _xfa_object.XFAObjectArray();
  59828. this.barcode = new _xfa_object.XFAObjectArray();
  59829. this.bindItems = new _xfa_object.XFAObjectArray();
  59830. this.bookend = new _xfa_object.XFAObjectArray();
  59831. this.boolean = new _xfa_object.XFAObjectArray();
  59832. this.border = new _xfa_object.XFAObjectArray();
  59833. this.break = new _xfa_object.XFAObjectArray();
  59834. this.breakAfter = new _xfa_object.XFAObjectArray();
  59835. this.breakBefore = new _xfa_object.XFAObjectArray();
  59836. this.button = new _xfa_object.XFAObjectArray();
  59837. this.calculate = new _xfa_object.XFAObjectArray();
  59838. this.caption = new _xfa_object.XFAObjectArray();
  59839. this.certificate = new _xfa_object.XFAObjectArray();
  59840. this.certificates = new _xfa_object.XFAObjectArray();
  59841. this.checkButton = new _xfa_object.XFAObjectArray();
  59842. this.choiceList = new _xfa_object.XFAObjectArray();
  59843. this.color = new _xfa_object.XFAObjectArray();
  59844. this.comb = new _xfa_object.XFAObjectArray();
  59845. this.connect = new _xfa_object.XFAObjectArray();
  59846. this.contentArea = new _xfa_object.XFAObjectArray();
  59847. this.corner = new _xfa_object.XFAObjectArray();
  59848. this.date = new _xfa_object.XFAObjectArray();
  59849. this.dateTime = new _xfa_object.XFAObjectArray();
  59850. this.dateTimeEdit = new _xfa_object.XFAObjectArray();
  59851. this.decimal = new _xfa_object.XFAObjectArray();
  59852. this.defaultUi = new _xfa_object.XFAObjectArray();
  59853. this.desc = new _xfa_object.XFAObjectArray();
  59854. this.digestMethod = new _xfa_object.XFAObjectArray();
  59855. this.digestMethods = new _xfa_object.XFAObjectArray();
  59856. this.draw = new _xfa_object.XFAObjectArray();
  59857. this.edge = new _xfa_object.XFAObjectArray();
  59858. this.encoding = new _xfa_object.XFAObjectArray();
  59859. this.encodings = new _xfa_object.XFAObjectArray();
  59860. this.encrypt = new _xfa_object.XFAObjectArray();
  59861. this.encryptData = new _xfa_object.XFAObjectArray();
  59862. this.encryption = new _xfa_object.XFAObjectArray();
  59863. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  59864. this.encryptionMethods = new _xfa_object.XFAObjectArray();
  59865. this.event = new _xfa_object.XFAObjectArray();
  59866. this.exData = new _xfa_object.XFAObjectArray();
  59867. this.exObject = new _xfa_object.XFAObjectArray();
  59868. this.exclGroup = new _xfa_object.XFAObjectArray();
  59869. this.execute = new _xfa_object.XFAObjectArray();
  59870. this.extras = new _xfa_object.XFAObjectArray();
  59871. this.field = new _xfa_object.XFAObjectArray();
  59872. this.fill = new _xfa_object.XFAObjectArray();
  59873. this.filter = new _xfa_object.XFAObjectArray();
  59874. this.float = new _xfa_object.XFAObjectArray();
  59875. this.font = new _xfa_object.XFAObjectArray();
  59876. this.format = new _xfa_object.XFAObjectArray();
  59877. this.handler = new _xfa_object.XFAObjectArray();
  59878. this.hyphenation = new _xfa_object.XFAObjectArray();
  59879. this.image = new _xfa_object.XFAObjectArray();
  59880. this.imageEdit = new _xfa_object.XFAObjectArray();
  59881. this.integer = new _xfa_object.XFAObjectArray();
  59882. this.issuers = new _xfa_object.XFAObjectArray();
  59883. this.items = new _xfa_object.XFAObjectArray();
  59884. this.keep = new _xfa_object.XFAObjectArray();
  59885. this.keyUsage = new _xfa_object.XFAObjectArray();
  59886. this.line = new _xfa_object.XFAObjectArray();
  59887. this.linear = new _xfa_object.XFAObjectArray();
  59888. this.lockDocument = new _xfa_object.XFAObjectArray();
  59889. this.manifest = new _xfa_object.XFAObjectArray();
  59890. this.margin = new _xfa_object.XFAObjectArray();
  59891. this.mdp = new _xfa_object.XFAObjectArray();
  59892. this.medium = new _xfa_object.XFAObjectArray();
  59893. this.message = new _xfa_object.XFAObjectArray();
  59894. this.numericEdit = new _xfa_object.XFAObjectArray();
  59895. this.occur = new _xfa_object.XFAObjectArray();
  59896. this.oid = new _xfa_object.XFAObjectArray();
  59897. this.oids = new _xfa_object.XFAObjectArray();
  59898. this.overflow = new _xfa_object.XFAObjectArray();
  59899. this.pageArea = new _xfa_object.XFAObjectArray();
  59900. this.pageSet = new _xfa_object.XFAObjectArray();
  59901. this.para = new _xfa_object.XFAObjectArray();
  59902. this.passwordEdit = new _xfa_object.XFAObjectArray();
  59903. this.pattern = new _xfa_object.XFAObjectArray();
  59904. this.picture = new _xfa_object.XFAObjectArray();
  59905. this.radial = new _xfa_object.XFAObjectArray();
  59906. this.reason = new _xfa_object.XFAObjectArray();
  59907. this.reasons = new _xfa_object.XFAObjectArray();
  59908. this.rectangle = new _xfa_object.XFAObjectArray();
  59909. this.ref = new _xfa_object.XFAObjectArray();
  59910. this.script = new _xfa_object.XFAObjectArray();
  59911. this.setProperty = new _xfa_object.XFAObjectArray();
  59912. this.signData = new _xfa_object.XFAObjectArray();
  59913. this.signature = new _xfa_object.XFAObjectArray();
  59914. this.signing = new _xfa_object.XFAObjectArray();
  59915. this.solid = new _xfa_object.XFAObjectArray();
  59916. this.speak = new _xfa_object.XFAObjectArray();
  59917. this.stipple = new _xfa_object.XFAObjectArray();
  59918. this.subform = new _xfa_object.XFAObjectArray();
  59919. this.subformSet = new _xfa_object.XFAObjectArray();
  59920. this.subjectDN = new _xfa_object.XFAObjectArray();
  59921. this.subjectDNs = new _xfa_object.XFAObjectArray();
  59922. this.submit = new _xfa_object.XFAObjectArray();
  59923. this.text = new _xfa_object.XFAObjectArray();
  59924. this.textEdit = new _xfa_object.XFAObjectArray();
  59925. this.time = new _xfa_object.XFAObjectArray();
  59926. this.timeStamp = new _xfa_object.XFAObjectArray();
  59927. this.toolTip = new _xfa_object.XFAObjectArray();
  59928. this.traversal = new _xfa_object.XFAObjectArray();
  59929. this.traverse = new _xfa_object.XFAObjectArray();
  59930. this.ui = new _xfa_object.XFAObjectArray();
  59931. this.validate = new _xfa_object.XFAObjectArray();
  59932. this.value = new _xfa_object.XFAObjectArray();
  59933. this.variables = new _xfa_object.XFAObjectArray();
  59934. }
  59935. }
  59936. class Radial extends _xfa_object.XFAObject {
  59937. constructor(attributes) {
  59938. super(TEMPLATE_NS_ID, "radial", true);
  59939. this.id = attributes.id || "";
  59940. this.type = (0, _utils.getStringOption)(attributes.type, ["toEdge", "toCenter"]);
  59941. this.use = attributes.use || "";
  59942. this.usehref = attributes.usehref || "";
  59943. this.color = null;
  59944. this.extras = null;
  59945. }
  59946. [_xfa_object.$toStyle](startColor) {
  59947. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  59948. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  59949. const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
  59950. return `radial-gradient(circle at center, ${colors})`;
  59951. }
  59952. }
  59953. class Reason extends _xfa_object.StringObject {
  59954. constructor(attributes) {
  59955. super(TEMPLATE_NS_ID, "reason");
  59956. this.id = attributes.id || "";
  59957. this.name = attributes.name || "";
  59958. this.use = attributes.use || "";
  59959. this.usehref = attributes.usehref || "";
  59960. }
  59961. }
  59962. class Reasons extends _xfa_object.XFAObject {
  59963. constructor(attributes) {
  59964. super(TEMPLATE_NS_ID, "reasons", true);
  59965. this.id = attributes.id || "";
  59966. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  59967. this.use = attributes.use || "";
  59968. this.usehref = attributes.usehref || "";
  59969. this.reason = new _xfa_object.XFAObjectArray();
  59970. }
  59971. }
  59972. class Rectangle extends _xfa_object.XFAObject {
  59973. constructor(attributes) {
  59974. super(TEMPLATE_NS_ID, "rectangle", true);
  59975. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  59976. this.id = attributes.id || "";
  59977. this.use = attributes.use || "";
  59978. this.usehref = attributes.usehref || "";
  59979. this.corner = new _xfa_object.XFAObjectArray(4);
  59980. this.edge = new _xfa_object.XFAObjectArray(4);
  59981. this.fill = null;
  59982. }
  59983. [_xfa_object.$toHTML]() {
  59984. const edge = this.edge.children.length ? this.edge.children[0] : new Edge({});
  59985. const edgeStyle = edge[_xfa_object.$toStyle]();
  59986. const style = Object.create(null);
  59987. if (this.fill && this.fill.presence === "visible") {
  59988. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  59989. } else {
  59990. style.fill = "transparent";
  59991. }
  59992. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  59993. style.stroke = edgeStyle.color;
  59994. const corner = this.corner.children.length ? this.corner.children[0] : new Corner({});
  59995. const cornerStyle = corner[_xfa_object.$toStyle]();
  59996. const rect = {
  59997. name: "rect",
  59998. attributes: {
  59999. xmlns: SVG_NS,
  60000. width: "100%",
  60001. height: "100%",
  60002. x: 0,
  60003. y: 0,
  60004. rx: cornerStyle.radius,
  60005. ry: cornerStyle.radius,
  60006. style
  60007. }
  60008. };
  60009. const svg = {
  60010. name: "svg",
  60011. children: [rect],
  60012. attributes: {
  60013. xmlns: SVG_NS,
  60014. style: {
  60015. overflow: "visible"
  60016. },
  60017. width: "100%",
  60018. height: "100%"
  60019. }
  60020. };
  60021. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  60022. if (hasMargin(parent)) {
  60023. return _utils.HTMLResult.success({
  60024. name: "div",
  60025. attributes: {
  60026. style: {
  60027. display: "inline",
  60028. width: "100%",
  60029. height: "100%"
  60030. }
  60031. },
  60032. children: [svg]
  60033. });
  60034. }
  60035. svg.attributes.style.position = "absolute";
  60036. return _utils.HTMLResult.success(svg);
  60037. }
  60038. }
  60039. class RefElement extends _xfa_object.StringObject {
  60040. constructor(attributes) {
  60041. super(TEMPLATE_NS_ID, "ref");
  60042. this.id = attributes.id || "";
  60043. this.use = attributes.use || "";
  60044. this.usehref = attributes.usehref || "";
  60045. }
  60046. }
  60047. class Script extends _xfa_object.StringObject {
  60048. constructor(attributes) {
  60049. super(TEMPLATE_NS_ID, "script");
  60050. this.binding = attributes.binding || "";
  60051. this.contentType = attributes.contentType || "";
  60052. this.id = attributes.id || "";
  60053. this.name = attributes.name || "";
  60054. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  60055. this.use = attributes.use || "";
  60056. this.usehref = attributes.usehref || "";
  60057. }
  60058. }
  60059. class SetProperty extends _xfa_object.XFAObject {
  60060. constructor(attributes) {
  60061. super(TEMPLATE_NS_ID, "setProperty");
  60062. this.connection = attributes.connection || "";
  60063. this.ref = attributes.ref || "";
  60064. this.target = attributes.target || "";
  60065. }
  60066. }
  60067. exports.SetProperty = SetProperty;
  60068. class SignData extends _xfa_object.XFAObject {
  60069. constructor(attributes) {
  60070. super(TEMPLATE_NS_ID, "signData", true);
  60071. this.id = attributes.id || "";
  60072. this.operation = (0, _utils.getStringOption)(attributes.operation, ["sign", "clear", "verify"]);
  60073. this.ref = attributes.ref || "";
  60074. this.target = attributes.target || "";
  60075. this.use = attributes.use || "";
  60076. this.usehref = attributes.usehref || "";
  60077. this.filter = null;
  60078. this.manifest = null;
  60079. }
  60080. }
  60081. class Signature extends _xfa_object.XFAObject {
  60082. constructor(attributes) {
  60083. super(TEMPLATE_NS_ID, "signature", true);
  60084. this.id = attributes.id || "";
  60085. this.type = (0, _utils.getStringOption)(attributes.type, ["PDF1.3", "PDF1.6"]);
  60086. this.use = attributes.use || "";
  60087. this.usehref = attributes.usehref || "";
  60088. this.border = null;
  60089. this.extras = null;
  60090. this.filter = null;
  60091. this.manifest = null;
  60092. this.margin = null;
  60093. }
  60094. }
  60095. class Signing extends _xfa_object.XFAObject {
  60096. constructor(attributes) {
  60097. super(TEMPLATE_NS_ID, "signing", true);
  60098. this.id = attributes.id || "";
  60099. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  60100. this.use = attributes.use || "";
  60101. this.usehref = attributes.usehref || "";
  60102. this.certificate = new _xfa_object.XFAObjectArray();
  60103. }
  60104. }
  60105. class Solid extends _xfa_object.XFAObject {
  60106. constructor(attributes) {
  60107. super(TEMPLATE_NS_ID, "solid", true);
  60108. this.id = attributes.id || "";
  60109. this.use = attributes.use || "";
  60110. this.usehref = attributes.usehref || "";
  60111. this.extras = null;
  60112. }
  60113. [_xfa_object.$toStyle](startColor) {
  60114. return startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  60115. }
  60116. }
  60117. class Speak extends _xfa_object.StringObject {
  60118. constructor(attributes) {
  60119. super(TEMPLATE_NS_ID, "speak");
  60120. this.disable = (0, _utils.getInteger)({
  60121. data: attributes.disable,
  60122. defaultValue: 0,
  60123. validate: x => x === 1
  60124. });
  60125. this.id = attributes.id || "";
  60126. this.priority = (0, _utils.getStringOption)(attributes.priority, ["custom", "caption", "name", "toolTip"]);
  60127. this.rid = attributes.rid || "";
  60128. this.use = attributes.use || "";
  60129. this.usehref = attributes.usehref || "";
  60130. }
  60131. }
  60132. class Stipple extends _xfa_object.XFAObject {
  60133. constructor(attributes) {
  60134. super(TEMPLATE_NS_ID, "stipple", true);
  60135. this.id = attributes.id || "";
  60136. this.rate = (0, _utils.getInteger)({
  60137. data: attributes.rate,
  60138. defaultValue: 50,
  60139. validate: x => x >= 0 && x <= 100
  60140. });
  60141. this.use = attributes.use || "";
  60142. this.usehref = attributes.usehref || "";
  60143. this.color = null;
  60144. this.extras = null;
  60145. }
  60146. [_xfa_object.$toStyle](bgColor) {
  60147. const alpha = this.rate / 100;
  60148. 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));
  60149. }
  60150. }
  60151. class Subform extends _xfa_object.XFAObject {
  60152. constructor(attributes) {
  60153. super(TEMPLATE_NS_ID, "subform", true);
  60154. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  60155. this.allowMacro = (0, _utils.getInteger)({
  60156. data: attributes.allowMacro,
  60157. defaultValue: 0,
  60158. validate: x => x === 1
  60159. });
  60160. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  60161. this.colSpan = (0, _utils.getInteger)({
  60162. data: attributes.colSpan,
  60163. defaultValue: 1,
  60164. validate: n => n >= 1 || n === -1
  60165. });
  60166. this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : (0, _utils.getMeasurement)(x));
  60167. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  60168. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  60169. this.id = attributes.id || "";
  60170. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  60171. this.locale = attributes.locale || "";
  60172. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  60173. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  60174. this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, ["consumeData", "matchTemplate"]);
  60175. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  60176. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  60177. this.name = attributes.name || "";
  60178. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  60179. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  60180. this.restoreState = (0, _utils.getStringOption)(attributes.restoreState, ["manual", "auto"]);
  60181. this.scope = (0, _utils.getStringOption)(attributes.scope, ["name", "none"]);
  60182. this.use = attributes.use || "";
  60183. this.usehref = attributes.usehref || "";
  60184. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  60185. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  60186. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  60187. this.assist = null;
  60188. this.bind = null;
  60189. this.bookend = null;
  60190. this.border = null;
  60191. this.break = null;
  60192. this.calculate = null;
  60193. this.desc = null;
  60194. this.extras = null;
  60195. this.keep = null;
  60196. this.margin = null;
  60197. this.occur = null;
  60198. this.overflow = null;
  60199. this.pageSet = null;
  60200. this.para = null;
  60201. this.traversal = null;
  60202. this.validate = null;
  60203. this.variables = null;
  60204. this.area = new _xfa_object.XFAObjectArray();
  60205. this.breakAfter = new _xfa_object.XFAObjectArray();
  60206. this.breakBefore = new _xfa_object.XFAObjectArray();
  60207. this.connect = new _xfa_object.XFAObjectArray();
  60208. this.draw = new _xfa_object.XFAObjectArray();
  60209. this.event = new _xfa_object.XFAObjectArray();
  60210. this.exObject = new _xfa_object.XFAObjectArray();
  60211. this.exclGroup = new _xfa_object.XFAObjectArray();
  60212. this.field = new _xfa_object.XFAObjectArray();
  60213. this.proto = new _xfa_object.XFAObjectArray();
  60214. this.setProperty = new _xfa_object.XFAObjectArray();
  60215. this.subform = new _xfa_object.XFAObjectArray();
  60216. this.subformSet = new _xfa_object.XFAObjectArray();
  60217. }
  60218. [_xfa_object.$getSubformParent]() {
  60219. const parent = this[_xfa_object.$getParent]();
  60220. if (parent instanceof SubformSet) {
  60221. return parent[_xfa_object.$getSubformParent]();
  60222. }
  60223. return parent;
  60224. }
  60225. [_xfa_object.$isBindable]() {
  60226. return true;
  60227. }
  60228. [_xfa_object.$isThereMoreWidth]() {
  60229. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  60230. }
  60231. *[_xfa_object.$getContainedChildren]() {
  60232. yield* getContainedChildren(this);
  60233. }
  60234. [_xfa_object.$flushHTML]() {
  60235. return (0, _layout.flushHTML)(this);
  60236. }
  60237. [_xfa_object.$addHTML](html, bbox) {
  60238. (0, _layout.addHTML)(this, html, bbox);
  60239. }
  60240. [_xfa_object.$getAvailableSpace]() {
  60241. return (0, _layout.getAvailableSpace)(this);
  60242. }
  60243. [_xfa_object.$isSplittable]() {
  60244. const parent = this[_xfa_object.$getSubformParent]();
  60245. if (!parent[_xfa_object.$isSplittable]()) {
  60246. return false;
  60247. }
  60248. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  60249. return this[_xfa_object.$extra]._isSplittable;
  60250. }
  60251. if (this.layout === "position" || this.layout.includes("row")) {
  60252. this[_xfa_object.$extra]._isSplittable = false;
  60253. return false;
  60254. }
  60255. if (this.keep && this.keep.intact !== "none") {
  60256. this[_xfa_object.$extra]._isSplittable = false;
  60257. return false;
  60258. }
  60259. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  60260. return false;
  60261. }
  60262. this[_xfa_object.$extra]._isSplittable = true;
  60263. return true;
  60264. }
  60265. [_xfa_object.$toHTML](availableSpace) {
  60266. setTabIndex(this);
  60267. if (this.break) {
  60268. if (this.break.after !== "auto" || this.break.afterTarget !== "") {
  60269. const node = new BreakAfter({
  60270. targetType: this.break.after,
  60271. target: this.break.afterTarget,
  60272. startNew: this.break.startNew.toString()
  60273. });
  60274. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  60275. this[_xfa_object.$appendChild](node);
  60276. this.breakAfter.push(node);
  60277. }
  60278. if (this.break.before !== "auto" || this.break.beforeTarget !== "") {
  60279. const node = new BreakBefore({
  60280. targetType: this.break.before,
  60281. target: this.break.beforeTarget,
  60282. startNew: this.break.startNew.toString()
  60283. });
  60284. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  60285. this[_xfa_object.$appendChild](node);
  60286. this.breakBefore.push(node);
  60287. }
  60288. if (this.break.overflowTarget !== "") {
  60289. const node = new Overflow({
  60290. target: this.break.overflowTarget,
  60291. leader: this.break.overflowLeader,
  60292. trailer: this.break.overflowTrailer
  60293. });
  60294. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  60295. this[_xfa_object.$appendChild](node);
  60296. this.overflow.push(node);
  60297. }
  60298. this[_xfa_object.$removeChild](this.break);
  60299. this.break = null;
  60300. }
  60301. if (this.presence === "hidden" || this.presence === "inactive") {
  60302. return _utils.HTMLResult.EMPTY;
  60303. }
  60304. if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) {
  60305. (0, _util.warn)("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");
  60306. }
  60307. if (this.breakBefore.children.length >= 1) {
  60308. const breakBefore = this.breakBefore.children[0];
  60309. if (handleBreak(breakBefore)) {
  60310. return _utils.HTMLResult.breakNode(breakBefore);
  60311. }
  60312. }
  60313. if (this[_xfa_object.$extra] && this[_xfa_object.$extra].afterBreakAfter) {
  60314. return _utils.HTMLResult.EMPTY;
  60315. }
  60316. (0, _html_utils.fixDimensions)(this);
  60317. const children = [];
  60318. const attributes = {
  60319. id: this[_xfa_object.$uid],
  60320. class: []
  60321. };
  60322. (0, _html_utils.setAccess)(this, attributes.class);
  60323. if (!this[_xfa_object.$extra]) {
  60324. this[_xfa_object.$extra] = Object.create(null);
  60325. }
  60326. Object.assign(this[_xfa_object.$extra], {
  60327. children,
  60328. line: null,
  60329. attributes,
  60330. attempt: 0,
  60331. numberInLine: 0,
  60332. availableSpace: {
  60333. width: Math.min(this.w || Infinity, availableSpace.width),
  60334. height: Math.min(this.h || Infinity, availableSpace.height)
  60335. },
  60336. width: 0,
  60337. height: 0,
  60338. prevHeight: 0,
  60339. currentWidth: 0
  60340. });
  60341. const root = this[_xfa_object.$getTemplateRoot]();
  60342. const savedNoLayoutFailure = root[_xfa_object.$extra].noLayoutFailure;
  60343. const isSplittable = this[_xfa_object.$isSplittable]();
  60344. if (!isSplittable) {
  60345. setFirstUnsplittable(this);
  60346. }
  60347. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  60348. return _utils.HTMLResult.FAILURE;
  60349. }
  60350. const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]);
  60351. if (this.layout.includes("row")) {
  60352. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  60353. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  60354. this[_xfa_object.$extra].columnWidths = columnWidths;
  60355. this[_xfa_object.$extra].currentColumn = 0;
  60356. }
  60357. }
  60358. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  60359. const classNames = ["xfaSubform"];
  60360. const cl = (0, _html_utils.layoutClass)(this);
  60361. if (cl) {
  60362. classNames.push(cl);
  60363. }
  60364. attributes.style = style;
  60365. attributes.class = classNames;
  60366. if (this.name) {
  60367. attributes.xfaName = this.name;
  60368. }
  60369. if (this.overflow) {
  60370. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  60371. if (overflowExtra.addLeader) {
  60372. overflowExtra.addLeader = false;
  60373. handleOverflow(this, overflowExtra.leader, availableSpace);
  60374. }
  60375. }
  60376. this[_xfa_object.$pushPara]();
  60377. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  60378. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  60379. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  60380. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  60381. this[_xfa_object.$extra].numberInLine = 0;
  60382. }
  60383. const result = this[_xfa_object.$childrenToHTML]({
  60384. filter,
  60385. include: true
  60386. });
  60387. if (result.success) {
  60388. break;
  60389. }
  60390. if (result.isBreak()) {
  60391. this[_xfa_object.$popPara]();
  60392. return result;
  60393. }
  60394. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !root[_xfa_object.$extra].noLayoutFailure) {
  60395. this[_xfa_object.$extra].attempt = maxRun;
  60396. break;
  60397. }
  60398. }
  60399. this[_xfa_object.$popPara]();
  60400. if (!isSplittable) {
  60401. unsetFirstUnsplittable(this);
  60402. }
  60403. root[_xfa_object.$extra].noLayoutFailure = savedNoLayoutFailure;
  60404. if (this[_xfa_object.$extra].attempt === maxRun) {
  60405. if (this.overflow) {
  60406. this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].overflowNode = this.overflow;
  60407. }
  60408. if (!isSplittable) {
  60409. delete this[_xfa_object.$extra];
  60410. }
  60411. return _utils.HTMLResult.FAILURE;
  60412. }
  60413. if (this.overflow) {
  60414. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  60415. if (overflowExtra.addTrailer) {
  60416. overflowExtra.addTrailer = false;
  60417. handleOverflow(this, overflowExtra.trailer, availableSpace);
  60418. }
  60419. }
  60420. let marginH = 0;
  60421. let marginV = 0;
  60422. if (this.margin) {
  60423. marginH = this.margin.leftInset + this.margin.rightInset;
  60424. marginV = this.margin.topInset + this.margin.bottomInset;
  60425. }
  60426. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  60427. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  60428. const bbox = [this.x, this.y, width, height];
  60429. if (this.w === "") {
  60430. style.width = (0, _html_utils.measureToString)(width);
  60431. }
  60432. if (this.h === "") {
  60433. style.height = (0, _html_utils.measureToString)(height);
  60434. }
  60435. if ((style.width === "0px" || style.height === "0px") && children.length === 0) {
  60436. return _utils.HTMLResult.EMPTY;
  60437. }
  60438. const html = {
  60439. name: "div",
  60440. attributes,
  60441. children
  60442. };
  60443. applyAssist(this, attributes);
  60444. const result = _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  60445. if (this.breakAfter.children.length >= 1) {
  60446. const breakAfter = this.breakAfter.children[0];
  60447. if (handleBreak(breakAfter)) {
  60448. this[_xfa_object.$extra].afterBreakAfter = result;
  60449. return _utils.HTMLResult.breakNode(breakAfter);
  60450. }
  60451. }
  60452. delete this[_xfa_object.$extra];
  60453. return result;
  60454. }
  60455. }
  60456. class SubformSet extends _xfa_object.XFAObject {
  60457. constructor(attributes) {
  60458. super(TEMPLATE_NS_ID, "subformSet", true);
  60459. this.id = attributes.id || "";
  60460. this.name = attributes.name || "";
  60461. this.relation = (0, _utils.getStringOption)(attributes.relation, ["ordered", "choice", "unordered"]);
  60462. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  60463. this.use = attributes.use || "";
  60464. this.usehref = attributes.usehref || "";
  60465. this.bookend = null;
  60466. this.break = null;
  60467. this.desc = null;
  60468. this.extras = null;
  60469. this.occur = null;
  60470. this.overflow = null;
  60471. this.breakAfter = new _xfa_object.XFAObjectArray();
  60472. this.breakBefore = new _xfa_object.XFAObjectArray();
  60473. this.subform = new _xfa_object.XFAObjectArray();
  60474. this.subformSet = new _xfa_object.XFAObjectArray();
  60475. }
  60476. *[_xfa_object.$getContainedChildren]() {
  60477. yield* getContainedChildren(this);
  60478. }
  60479. [_xfa_object.$getSubformParent]() {
  60480. let parent = this[_xfa_object.$getParent]();
  60481. while (!(parent instanceof Subform)) {
  60482. parent = parent[_xfa_object.$getParent]();
  60483. }
  60484. return parent;
  60485. }
  60486. [_xfa_object.$isBindable]() {
  60487. return true;
  60488. }
  60489. }
  60490. class SubjectDN extends _xfa_object.ContentObject {
  60491. constructor(attributes) {
  60492. super(TEMPLATE_NS_ID, "subjectDN");
  60493. this.delimiter = attributes.delimiter || ",";
  60494. this.id = attributes.id || "";
  60495. this.name = attributes.name || "";
  60496. this.use = attributes.use || "";
  60497. this.usehref = attributes.usehref || "";
  60498. }
  60499. [_xfa_object.$finalize]() {
  60500. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].split(this.delimiter).map(kv => {
  60501. kv = kv.split("=", 2);
  60502. kv[0] = kv[0].trim();
  60503. return kv;
  60504. }));
  60505. }
  60506. }
  60507. class SubjectDNs extends _xfa_object.XFAObject {
  60508. constructor(attributes) {
  60509. super(TEMPLATE_NS_ID, "subjectDNs", true);
  60510. this.id = attributes.id || "";
  60511. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  60512. this.use = attributes.use || "";
  60513. this.usehref = attributes.usehref || "";
  60514. this.subjectDN = new _xfa_object.XFAObjectArray();
  60515. }
  60516. }
  60517. class Submit extends _xfa_object.XFAObject {
  60518. constructor(attributes) {
  60519. super(TEMPLATE_NS_ID, "submit", true);
  60520. this.embedPDF = (0, _utils.getInteger)({
  60521. data: attributes.embedPDF,
  60522. defaultValue: 0,
  60523. validate: x => x === 1
  60524. });
  60525. this.format = (0, _utils.getStringOption)(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]);
  60526. this.id = attributes.id || "";
  60527. this.target = attributes.target || "";
  60528. this.textEncoding = (0, _utils.getKeyword)({
  60529. data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "",
  60530. defaultValue: "",
  60531. 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}/)
  60532. });
  60533. this.use = attributes.use || "";
  60534. this.usehref = attributes.usehref || "";
  60535. this.xdpContent = attributes.xdpContent || "";
  60536. this.encrypt = null;
  60537. this.encryptData = new _xfa_object.XFAObjectArray();
  60538. this.signData = new _xfa_object.XFAObjectArray();
  60539. }
  60540. }
  60541. class Template extends _xfa_object.XFAObject {
  60542. constructor(attributes) {
  60543. super(TEMPLATE_NS_ID, "template", true);
  60544. this.baseProfile = (0, _utils.getStringOption)(attributes.baseProfile, ["full", "interactiveForms"]);
  60545. this.extras = null;
  60546. this.subform = new _xfa_object.XFAObjectArray();
  60547. }
  60548. [_xfa_object.$finalize]() {
  60549. if (this.subform.children.length === 0) {
  60550. (0, _util.warn)("XFA - No subforms in template node.");
  60551. }
  60552. if (this.subform.children.length >= 2) {
  60553. (0, _util.warn)("XFA - Several subforms in template node: please file a bug.");
  60554. }
  60555. this[_xfa_object.$tabIndex] = DEFAULT_TAB_INDEX;
  60556. }
  60557. [_xfa_object.$isSplittable]() {
  60558. return true;
  60559. }
  60560. [_xfa_object.$searchNode](expr, container) {
  60561. if (expr.startsWith("#")) {
  60562. return [this[_xfa_object.$ids].get(expr.slice(1))];
  60563. }
  60564. return (0, _som.searchNode)(this, container, expr, true, true);
  60565. }
  60566. *[_xfa_object.$toPages]() {
  60567. if (!this.subform.children.length) {
  60568. return _utils.HTMLResult.success({
  60569. name: "div",
  60570. children: []
  60571. });
  60572. }
  60573. this[_xfa_object.$extra] = {
  60574. overflowNode: null,
  60575. firstUnsplittable: null,
  60576. currentContentArea: null,
  60577. currentPageArea: null,
  60578. noLayoutFailure: false,
  60579. pageNumber: 1,
  60580. pagePosition: "first",
  60581. oddOrEven: "odd",
  60582. blankOrNotBlank: "nonBlank",
  60583. paraStack: []
  60584. };
  60585. const root = this.subform.children[0];
  60586. root.pageSet[_xfa_object.$cleanPage]();
  60587. const pageAreas = root.pageSet.pageArea.children;
  60588. const mainHtml = {
  60589. name: "div",
  60590. children: []
  60591. };
  60592. let pageArea = null;
  60593. let breakBefore = null;
  60594. let breakBeforeTarget = null;
  60595. if (root.breakBefore.children.length >= 1) {
  60596. breakBefore = root.breakBefore.children[0];
  60597. breakBeforeTarget = breakBefore.target;
  60598. } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) {
  60599. breakBefore = root.subform.children[0].breakBefore.children[0];
  60600. breakBeforeTarget = breakBefore.target;
  60601. } else if (root.break && root.break.beforeTarget) {
  60602. breakBefore = root.break;
  60603. breakBeforeTarget = breakBefore.beforeTarget;
  60604. } else if (root.subform.children.length >= 1 && root.subform.children[0].break && root.subform.children[0].break.beforeTarget) {
  60605. breakBefore = root.subform.children[0].break;
  60606. breakBeforeTarget = breakBefore.beforeTarget;
  60607. }
  60608. if (breakBefore) {
  60609. const target = this[_xfa_object.$searchNode](breakBeforeTarget, breakBefore[_xfa_object.$getParent]());
  60610. if (target instanceof PageArea) {
  60611. pageArea = target;
  60612. breakBefore[_xfa_object.$extra] = {};
  60613. }
  60614. }
  60615. if (!pageArea) {
  60616. pageArea = pageAreas[0];
  60617. }
  60618. pageArea[_xfa_object.$extra] = {
  60619. numberOfUse: 1
  60620. };
  60621. const pageAreaParent = pageArea[_xfa_object.$getParent]();
  60622. pageAreaParent[_xfa_object.$extra] = {
  60623. numberOfUse: 1,
  60624. pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea),
  60625. pageSetIndex: 0
  60626. };
  60627. let targetPageArea;
  60628. let leader = null;
  60629. let trailer = null;
  60630. let hasSomething = true;
  60631. let hasSomethingCounter = 0;
  60632. let startIndex = 0;
  60633. while (true) {
  60634. if (!hasSomething) {
  60635. mainHtml.children.pop();
  60636. if (++hasSomethingCounter === MAX_EMPTY_PAGES) {
  60637. (0, _util.warn)("XFA - Something goes wrong: please file a bug.");
  60638. return mainHtml;
  60639. }
  60640. } else {
  60641. hasSomethingCounter = 0;
  60642. }
  60643. targetPageArea = null;
  60644. this[_xfa_object.$extra].currentPageArea = pageArea;
  60645. const page = pageArea[_xfa_object.$toHTML]().html;
  60646. mainHtml.children.push(page);
  60647. if (leader) {
  60648. this[_xfa_object.$extra].noLayoutFailure = true;
  60649. page.children.push(leader[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  60650. leader = null;
  60651. }
  60652. if (trailer) {
  60653. this[_xfa_object.$extra].noLayoutFailure = true;
  60654. page.children.push(trailer[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  60655. trailer = null;
  60656. }
  60657. const contentAreas = pageArea.contentArea.children;
  60658. const htmlContentAreas = page.children.filter(node => node.attributes.class.includes("xfaContentarea"));
  60659. hasSomething = false;
  60660. this[_xfa_object.$extra].firstUnsplittable = null;
  60661. this[_xfa_object.$extra].noLayoutFailure = false;
  60662. const flush = index => {
  60663. const html = root[_xfa_object.$flushHTML]();
  60664. if (html) {
  60665. hasSomething = hasSomething || html.children && html.children.length !== 0;
  60666. htmlContentAreas[index].children.push(html);
  60667. }
  60668. };
  60669. for (let i = startIndex, ii = contentAreas.length; i < ii; i++) {
  60670. const contentArea = this[_xfa_object.$extra].currentContentArea = contentAreas[i];
  60671. const space = {
  60672. width: contentArea.w,
  60673. height: contentArea.h
  60674. };
  60675. startIndex = 0;
  60676. if (leader) {
  60677. htmlContentAreas[i].children.push(leader[_xfa_object.$toHTML](space).html);
  60678. leader = null;
  60679. }
  60680. if (trailer) {
  60681. htmlContentAreas[i].children.push(trailer[_xfa_object.$toHTML](space).html);
  60682. trailer = null;
  60683. }
  60684. const html = root[_xfa_object.$toHTML](space);
  60685. if (html.success) {
  60686. if (html.html) {
  60687. hasSomething = hasSomething || html.html.children && html.html.children.length !== 0;
  60688. htmlContentAreas[i].children.push(html.html);
  60689. } else if (!hasSomething && mainHtml.children.length > 1) {
  60690. mainHtml.children.pop();
  60691. }
  60692. return mainHtml;
  60693. }
  60694. if (html.isBreak()) {
  60695. const node = html.breakNode;
  60696. flush(i);
  60697. if (node.targetType === "auto") {
  60698. continue;
  60699. }
  60700. if (node.leader) {
  60701. leader = this[_xfa_object.$searchNode](node.leader, node[_xfa_object.$getParent]());
  60702. leader = leader ? leader[0] : null;
  60703. }
  60704. if (node.trailer) {
  60705. trailer = this[_xfa_object.$searchNode](node.trailer, node[_xfa_object.$getParent]());
  60706. trailer = trailer ? trailer[0] : null;
  60707. }
  60708. if (node.targetType === "pageArea") {
  60709. targetPageArea = node[_xfa_object.$extra].target;
  60710. i = Infinity;
  60711. } else if (!node[_xfa_object.$extra].target) {
  60712. i = node[_xfa_object.$extra].index;
  60713. } else {
  60714. targetPageArea = node[_xfa_object.$extra].target;
  60715. startIndex = node[_xfa_object.$extra].index + 1;
  60716. i = Infinity;
  60717. }
  60718. continue;
  60719. }
  60720. if (this[_xfa_object.$extra].overflowNode) {
  60721. const node = this[_xfa_object.$extra].overflowNode;
  60722. this[_xfa_object.$extra].overflowNode = null;
  60723. const overflowExtra = node[_xfa_object.$getExtra]();
  60724. const target = overflowExtra.target;
  60725. overflowExtra.addLeader = overflowExtra.leader !== null;
  60726. overflowExtra.addTrailer = overflowExtra.trailer !== null;
  60727. flush(i);
  60728. const currentIndex = i;
  60729. i = Infinity;
  60730. if (target instanceof PageArea) {
  60731. targetPageArea = target;
  60732. } else if (target instanceof ContentArea) {
  60733. const index = contentAreas.indexOf(target);
  60734. if (index !== -1) {
  60735. if (index > currentIndex) {
  60736. i = index - 1;
  60737. } else {
  60738. startIndex = index;
  60739. }
  60740. } else {
  60741. targetPageArea = target[_xfa_object.$getParent]();
  60742. startIndex = targetPageArea.contentArea.children.indexOf(target);
  60743. }
  60744. }
  60745. continue;
  60746. }
  60747. flush(i);
  60748. }
  60749. this[_xfa_object.$extra].pageNumber += 1;
  60750. if (targetPageArea) {
  60751. if (targetPageArea[_xfa_object.$isUsable]()) {
  60752. targetPageArea[_xfa_object.$extra].numberOfUse += 1;
  60753. } else {
  60754. targetPageArea = null;
  60755. }
  60756. }
  60757. pageArea = targetPageArea || pageArea[_xfa_object.$getNextPage]();
  60758. yield null;
  60759. }
  60760. }
  60761. }
  60762. exports.Template = Template;
  60763. class Text extends _xfa_object.ContentObject {
  60764. constructor(attributes) {
  60765. super(TEMPLATE_NS_ID, "text");
  60766. this.id = attributes.id || "";
  60767. this.maxChars = (0, _utils.getInteger)({
  60768. data: attributes.maxChars,
  60769. defaultValue: 0,
  60770. validate: x => x >= 0
  60771. });
  60772. this.name = attributes.name || "";
  60773. this.rid = attributes.rid || "";
  60774. this.use = attributes.use || "";
  60775. this.usehref = attributes.usehref || "";
  60776. }
  60777. [_xfa_object.$acceptWhitespace]() {
  60778. return true;
  60779. }
  60780. [_xfa_object.$onChild](child) {
  60781. if (child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  60782. this[_xfa_object.$content] = child;
  60783. return true;
  60784. }
  60785. (0, _util.warn)(`XFA - Invalid content in Text: ${child[_xfa_object.$nodeName]}.`);
  60786. return false;
  60787. }
  60788. [_xfa_object.$onText](str) {
  60789. if (this[_xfa_object.$content] instanceof _xfa_object.XFAObject) {
  60790. return;
  60791. }
  60792. super[_xfa_object.$onText](str);
  60793. }
  60794. [_xfa_object.$finalize]() {
  60795. if (typeof this[_xfa_object.$content] === "string") {
  60796. this[_xfa_object.$content] = this[_xfa_object.$content].replace(/\r\n/g, "\n");
  60797. }
  60798. }
  60799. [_xfa_object.$getExtra]() {
  60800. if (typeof this[_xfa_object.$content] === "string") {
  60801. return this[_xfa_object.$content].split(/[\u2029\u2028\n]/).reduce((acc, line) => {
  60802. if (line) {
  60803. acc.push(line);
  60804. }
  60805. return acc;
  60806. }, []).join("\n");
  60807. }
  60808. return this[_xfa_object.$content][_xfa_object.$text]();
  60809. }
  60810. [_xfa_object.$toHTML](availableSpace) {
  60811. if (typeof this[_xfa_object.$content] === "string") {
  60812. const html = valueToHtml(this[_xfa_object.$content]).html;
  60813. if (this[_xfa_object.$content].includes("\u2029")) {
  60814. html.name = "div";
  60815. html.children = [];
  60816. this[_xfa_object.$content].split("\u2029").map(para => para.split(/[\u2028\n]/).reduce((acc, line) => {
  60817. acc.push({
  60818. name: "span",
  60819. value: line
  60820. }, {
  60821. name: "br"
  60822. });
  60823. return acc;
  60824. }, [])).forEach(lines => {
  60825. html.children.push({
  60826. name: "p",
  60827. children: lines
  60828. });
  60829. });
  60830. } else if (/[\u2028\n]/.test(this[_xfa_object.$content])) {
  60831. html.name = "div";
  60832. html.children = [];
  60833. this[_xfa_object.$content].split(/[\u2028\n]/).forEach(line => {
  60834. html.children.push({
  60835. name: "span",
  60836. value: line
  60837. }, {
  60838. name: "br"
  60839. });
  60840. });
  60841. }
  60842. return _utils.HTMLResult.success(html);
  60843. }
  60844. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  60845. }
  60846. }
  60847. exports.Text = Text;
  60848. class TextEdit extends _xfa_object.XFAObject {
  60849. constructor(attributes) {
  60850. super(TEMPLATE_NS_ID, "textEdit", true);
  60851. this.allowRichText = (0, _utils.getInteger)({
  60852. data: attributes.allowRichText,
  60853. defaultValue: 0,
  60854. validate: x => x === 1
  60855. });
  60856. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  60857. this.id = attributes.id || "";
  60858. this.multiLine = (0, _utils.getInteger)({
  60859. data: attributes.multiLine,
  60860. defaultValue: "",
  60861. validate: x => x === 0 || x === 1
  60862. });
  60863. this.use = attributes.use || "";
  60864. this.usehref = attributes.usehref || "";
  60865. this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]);
  60866. this.border = null;
  60867. this.comb = null;
  60868. this.extras = null;
  60869. this.margin = null;
  60870. }
  60871. [_xfa_object.$toHTML](availableSpace) {
  60872. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  60873. let html;
  60874. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  60875. if (this.multiLine === "") {
  60876. this.multiLine = field instanceof Draw ? 1 : 0;
  60877. }
  60878. if (this.multiLine === 1) {
  60879. html = {
  60880. name: "textarea",
  60881. attributes: {
  60882. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  60883. fieldId: field[_xfa_object.$uid],
  60884. class: ["xfaTextfield"],
  60885. style,
  60886. "aria-label": ariaLabel(field),
  60887. "aria-required": false
  60888. }
  60889. };
  60890. } else {
  60891. html = {
  60892. name: "input",
  60893. attributes: {
  60894. type: "text",
  60895. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  60896. fieldId: field[_xfa_object.$uid],
  60897. class: ["xfaTextfield"],
  60898. style,
  60899. "aria-label": ariaLabel(field),
  60900. "aria-required": false
  60901. }
  60902. };
  60903. }
  60904. if (isRequired(field)) {
  60905. html.attributes["aria-required"] = true;
  60906. html.attributes.required = true;
  60907. }
  60908. return _utils.HTMLResult.success({
  60909. name: "label",
  60910. attributes: {
  60911. class: ["xfaLabel"]
  60912. },
  60913. children: [html]
  60914. });
  60915. }
  60916. }
  60917. class Time extends _xfa_object.StringObject {
  60918. constructor(attributes) {
  60919. super(TEMPLATE_NS_ID, "time");
  60920. this.id = attributes.id || "";
  60921. this.name = attributes.name || "";
  60922. this.use = attributes.use || "";
  60923. this.usehref = attributes.usehref || "";
  60924. }
  60925. [_xfa_object.$finalize]() {
  60926. const date = this[_xfa_object.$content].trim();
  60927. this[_xfa_object.$content] = date ? new Date(date) : null;
  60928. }
  60929. [_xfa_object.$toHTML](availableSpace) {
  60930. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  60931. }
  60932. }
  60933. class TimeStamp extends _xfa_object.XFAObject {
  60934. constructor(attributes) {
  60935. super(TEMPLATE_NS_ID, "timeStamp");
  60936. this.id = attributes.id || "";
  60937. this.server = attributes.server || "";
  60938. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  60939. this.use = attributes.use || "";
  60940. this.usehref = attributes.usehref || "";
  60941. }
  60942. }
  60943. class ToolTip extends _xfa_object.StringObject {
  60944. constructor(attributes) {
  60945. super(TEMPLATE_NS_ID, "toolTip");
  60946. this.id = attributes.id || "";
  60947. this.rid = attributes.rid || "";
  60948. this.use = attributes.use || "";
  60949. this.usehref = attributes.usehref || "";
  60950. }
  60951. }
  60952. class Traversal extends _xfa_object.XFAObject {
  60953. constructor(attributes) {
  60954. super(TEMPLATE_NS_ID, "traversal", true);
  60955. this.id = attributes.id || "";
  60956. this.use = attributes.use || "";
  60957. this.usehref = attributes.usehref || "";
  60958. this.extras = null;
  60959. this.traverse = new _xfa_object.XFAObjectArray();
  60960. }
  60961. }
  60962. class Traverse extends _xfa_object.XFAObject {
  60963. constructor(attributes) {
  60964. super(TEMPLATE_NS_ID, "traverse", true);
  60965. this.id = attributes.id || "";
  60966. this.operation = (0, _utils.getStringOption)(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]);
  60967. this.ref = attributes.ref || "";
  60968. this.use = attributes.use || "";
  60969. this.usehref = attributes.usehref || "";
  60970. this.extras = null;
  60971. this.script = null;
  60972. }
  60973. get name() {
  60974. return this.operation;
  60975. }
  60976. [_xfa_object.$isTransparent]() {
  60977. return false;
  60978. }
  60979. }
  60980. class Ui extends _xfa_object.XFAObject {
  60981. constructor(attributes) {
  60982. super(TEMPLATE_NS_ID, "ui", true);
  60983. this.id = attributes.id || "";
  60984. this.use = attributes.use || "";
  60985. this.usehref = attributes.usehref || "";
  60986. this.extras = null;
  60987. this.picture = null;
  60988. this.barcode = null;
  60989. this.button = null;
  60990. this.checkButton = null;
  60991. this.choiceList = null;
  60992. this.dateTimeEdit = null;
  60993. this.defaultUi = null;
  60994. this.imageEdit = null;
  60995. this.numericEdit = null;
  60996. this.passwordEdit = null;
  60997. this.signature = null;
  60998. this.textEdit = null;
  60999. }
  61000. [_xfa_object.$getExtra]() {
  61001. if (this[_xfa_object.$extra] === undefined) {
  61002. for (const name of Object.getOwnPropertyNames(this)) {
  61003. if (name === "extras" || name === "picture") {
  61004. continue;
  61005. }
  61006. const obj = this[name];
  61007. if (!(obj instanceof _xfa_object.XFAObject)) {
  61008. continue;
  61009. }
  61010. this[_xfa_object.$extra] = obj;
  61011. return obj;
  61012. }
  61013. this[_xfa_object.$extra] = null;
  61014. }
  61015. return this[_xfa_object.$extra];
  61016. }
  61017. [_xfa_object.$toHTML](availableSpace) {
  61018. const obj = this[_xfa_object.$getExtra]();
  61019. if (obj) {
  61020. return obj[_xfa_object.$toHTML](availableSpace);
  61021. }
  61022. return _utils.HTMLResult.EMPTY;
  61023. }
  61024. }
  61025. class Validate extends _xfa_object.XFAObject {
  61026. constructor(attributes) {
  61027. super(TEMPLATE_NS_ID, "validate", true);
  61028. this.formatTest = (0, _utils.getStringOption)(attributes.formatTest, ["warning", "disabled", "error"]);
  61029. this.id = attributes.id || "";
  61030. this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, ["disabled", "error", "warning"]);
  61031. this.scriptTest = (0, _utils.getStringOption)(attributes.scriptTest, ["error", "disabled", "warning"]);
  61032. this.use = attributes.use || "";
  61033. this.usehref = attributes.usehref || "";
  61034. this.extras = null;
  61035. this.message = null;
  61036. this.picture = null;
  61037. this.script = null;
  61038. }
  61039. }
  61040. class Value extends _xfa_object.XFAObject {
  61041. constructor(attributes) {
  61042. super(TEMPLATE_NS_ID, "value", true);
  61043. this.id = attributes.id || "";
  61044. this.override = (0, _utils.getInteger)({
  61045. data: attributes.override,
  61046. defaultValue: 0,
  61047. validate: x => x === 1
  61048. });
  61049. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  61050. this.use = attributes.use || "";
  61051. this.usehref = attributes.usehref || "";
  61052. this.arc = null;
  61053. this.boolean = null;
  61054. this.date = null;
  61055. this.dateTime = null;
  61056. this.decimal = null;
  61057. this.exData = null;
  61058. this.float = null;
  61059. this.image = null;
  61060. this.integer = null;
  61061. this.line = null;
  61062. this.rectangle = null;
  61063. this.text = null;
  61064. this.time = null;
  61065. }
  61066. [_xfa_object.$setValue](value) {
  61067. const parent = this[_xfa_object.$getParent]();
  61068. if (parent instanceof Field) {
  61069. if (parent.ui && parent.ui.imageEdit) {
  61070. if (!this.image) {
  61071. this.image = new Image({});
  61072. this[_xfa_object.$appendChild](this.image);
  61073. }
  61074. this.image[_xfa_object.$content] = value[_xfa_object.$content];
  61075. return;
  61076. }
  61077. }
  61078. const valueName = value[_xfa_object.$nodeName];
  61079. if (this[valueName] !== null) {
  61080. this[valueName][_xfa_object.$content] = value[_xfa_object.$content];
  61081. return;
  61082. }
  61083. for (const name of Object.getOwnPropertyNames(this)) {
  61084. const obj = this[name];
  61085. if (obj instanceof _xfa_object.XFAObject) {
  61086. this[name] = null;
  61087. this[_xfa_object.$removeChild](obj);
  61088. }
  61089. }
  61090. this[value[_xfa_object.$nodeName]] = value;
  61091. this[_xfa_object.$appendChild](value);
  61092. }
  61093. [_xfa_object.$text]() {
  61094. if (this.exData) {
  61095. if (typeof this.exData[_xfa_object.$content] === "string") {
  61096. return this.exData[_xfa_object.$content].trim();
  61097. }
  61098. return this.exData[_xfa_object.$content][_xfa_object.$text]().trim();
  61099. }
  61100. for (const name of Object.getOwnPropertyNames(this)) {
  61101. if (name === "image") {
  61102. continue;
  61103. }
  61104. const obj = this[name];
  61105. if (obj instanceof _xfa_object.XFAObject) {
  61106. return (obj[_xfa_object.$content] || "").toString().trim();
  61107. }
  61108. }
  61109. return null;
  61110. }
  61111. [_xfa_object.$toHTML](availableSpace) {
  61112. for (const name of Object.getOwnPropertyNames(this)) {
  61113. const obj = this[name];
  61114. if (!(obj instanceof _xfa_object.XFAObject)) {
  61115. continue;
  61116. }
  61117. return obj[_xfa_object.$toHTML](availableSpace);
  61118. }
  61119. return _utils.HTMLResult.EMPTY;
  61120. }
  61121. }
  61122. exports.Value = Value;
  61123. class Variables extends _xfa_object.XFAObject {
  61124. constructor(attributes) {
  61125. super(TEMPLATE_NS_ID, "variables", true);
  61126. this.id = attributes.id || "";
  61127. this.use = attributes.use || "";
  61128. this.usehref = attributes.usehref || "";
  61129. this.boolean = new _xfa_object.XFAObjectArray();
  61130. this.date = new _xfa_object.XFAObjectArray();
  61131. this.dateTime = new _xfa_object.XFAObjectArray();
  61132. this.decimal = new _xfa_object.XFAObjectArray();
  61133. this.exData = new _xfa_object.XFAObjectArray();
  61134. this.float = new _xfa_object.XFAObjectArray();
  61135. this.image = new _xfa_object.XFAObjectArray();
  61136. this.integer = new _xfa_object.XFAObjectArray();
  61137. this.manifest = new _xfa_object.XFAObjectArray();
  61138. this.script = new _xfa_object.XFAObjectArray();
  61139. this.text = new _xfa_object.XFAObjectArray();
  61140. this.time = new _xfa_object.XFAObjectArray();
  61141. }
  61142. [_xfa_object.$isTransparent]() {
  61143. return true;
  61144. }
  61145. }
  61146. class TemplateNamespace {
  61147. static [_namespaces.$buildXFAObject](name, attributes) {
  61148. if (TemplateNamespace.hasOwnProperty(name)) {
  61149. const node = TemplateNamespace[name](attributes);
  61150. node[_xfa_object.$setSetAttributes](attributes);
  61151. return node;
  61152. }
  61153. return undefined;
  61154. }
  61155. static appearanceFilter(attrs) {
  61156. return new AppearanceFilter(attrs);
  61157. }
  61158. static arc(attrs) {
  61159. return new Arc(attrs);
  61160. }
  61161. static area(attrs) {
  61162. return new Area(attrs);
  61163. }
  61164. static assist(attrs) {
  61165. return new Assist(attrs);
  61166. }
  61167. static barcode(attrs) {
  61168. return new Barcode(attrs);
  61169. }
  61170. static bind(attrs) {
  61171. return new Bind(attrs);
  61172. }
  61173. static bindItems(attrs) {
  61174. return new BindItems(attrs);
  61175. }
  61176. static bookend(attrs) {
  61177. return new Bookend(attrs);
  61178. }
  61179. static boolean(attrs) {
  61180. return new BooleanElement(attrs);
  61181. }
  61182. static border(attrs) {
  61183. return new Border(attrs);
  61184. }
  61185. static break(attrs) {
  61186. return new Break(attrs);
  61187. }
  61188. static breakAfter(attrs) {
  61189. return new BreakAfter(attrs);
  61190. }
  61191. static breakBefore(attrs) {
  61192. return new BreakBefore(attrs);
  61193. }
  61194. static button(attrs) {
  61195. return new Button(attrs);
  61196. }
  61197. static calculate(attrs) {
  61198. return new Calculate(attrs);
  61199. }
  61200. static caption(attrs) {
  61201. return new Caption(attrs);
  61202. }
  61203. static certificate(attrs) {
  61204. return new Certificate(attrs);
  61205. }
  61206. static certificates(attrs) {
  61207. return new Certificates(attrs);
  61208. }
  61209. static checkButton(attrs) {
  61210. return new CheckButton(attrs);
  61211. }
  61212. static choiceList(attrs) {
  61213. return new ChoiceList(attrs);
  61214. }
  61215. static color(attrs) {
  61216. return new Color(attrs);
  61217. }
  61218. static comb(attrs) {
  61219. return new Comb(attrs);
  61220. }
  61221. static connect(attrs) {
  61222. return new Connect(attrs);
  61223. }
  61224. static contentArea(attrs) {
  61225. return new ContentArea(attrs);
  61226. }
  61227. static corner(attrs) {
  61228. return new Corner(attrs);
  61229. }
  61230. static date(attrs) {
  61231. return new DateElement(attrs);
  61232. }
  61233. static dateTime(attrs) {
  61234. return new DateTime(attrs);
  61235. }
  61236. static dateTimeEdit(attrs) {
  61237. return new DateTimeEdit(attrs);
  61238. }
  61239. static decimal(attrs) {
  61240. return new Decimal(attrs);
  61241. }
  61242. static defaultUi(attrs) {
  61243. return new DefaultUi(attrs);
  61244. }
  61245. static desc(attrs) {
  61246. return new Desc(attrs);
  61247. }
  61248. static digestMethod(attrs) {
  61249. return new DigestMethod(attrs);
  61250. }
  61251. static digestMethods(attrs) {
  61252. return new DigestMethods(attrs);
  61253. }
  61254. static draw(attrs) {
  61255. return new Draw(attrs);
  61256. }
  61257. static edge(attrs) {
  61258. return new Edge(attrs);
  61259. }
  61260. static encoding(attrs) {
  61261. return new Encoding(attrs);
  61262. }
  61263. static encodings(attrs) {
  61264. return new Encodings(attrs);
  61265. }
  61266. static encrypt(attrs) {
  61267. return new Encrypt(attrs);
  61268. }
  61269. static encryptData(attrs) {
  61270. return new EncryptData(attrs);
  61271. }
  61272. static encryption(attrs) {
  61273. return new Encryption(attrs);
  61274. }
  61275. static encryptionMethod(attrs) {
  61276. return new EncryptionMethod(attrs);
  61277. }
  61278. static encryptionMethods(attrs) {
  61279. return new EncryptionMethods(attrs);
  61280. }
  61281. static event(attrs) {
  61282. return new Event(attrs);
  61283. }
  61284. static exData(attrs) {
  61285. return new ExData(attrs);
  61286. }
  61287. static exObject(attrs) {
  61288. return new ExObject(attrs);
  61289. }
  61290. static exclGroup(attrs) {
  61291. return new ExclGroup(attrs);
  61292. }
  61293. static execute(attrs) {
  61294. return new Execute(attrs);
  61295. }
  61296. static extras(attrs) {
  61297. return new Extras(attrs);
  61298. }
  61299. static field(attrs) {
  61300. return new Field(attrs);
  61301. }
  61302. static fill(attrs) {
  61303. return new Fill(attrs);
  61304. }
  61305. static filter(attrs) {
  61306. return new Filter(attrs);
  61307. }
  61308. static float(attrs) {
  61309. return new Float(attrs);
  61310. }
  61311. static font(attrs) {
  61312. return new Font(attrs);
  61313. }
  61314. static format(attrs) {
  61315. return new Format(attrs);
  61316. }
  61317. static handler(attrs) {
  61318. return new Handler(attrs);
  61319. }
  61320. static hyphenation(attrs) {
  61321. return new Hyphenation(attrs);
  61322. }
  61323. static image(attrs) {
  61324. return new Image(attrs);
  61325. }
  61326. static imageEdit(attrs) {
  61327. return new ImageEdit(attrs);
  61328. }
  61329. static integer(attrs) {
  61330. return new Integer(attrs);
  61331. }
  61332. static issuers(attrs) {
  61333. return new Issuers(attrs);
  61334. }
  61335. static items(attrs) {
  61336. return new Items(attrs);
  61337. }
  61338. static keep(attrs) {
  61339. return new Keep(attrs);
  61340. }
  61341. static keyUsage(attrs) {
  61342. return new KeyUsage(attrs);
  61343. }
  61344. static line(attrs) {
  61345. return new Line(attrs);
  61346. }
  61347. static linear(attrs) {
  61348. return new Linear(attrs);
  61349. }
  61350. static lockDocument(attrs) {
  61351. return new LockDocument(attrs);
  61352. }
  61353. static manifest(attrs) {
  61354. return new Manifest(attrs);
  61355. }
  61356. static margin(attrs) {
  61357. return new Margin(attrs);
  61358. }
  61359. static mdp(attrs) {
  61360. return new Mdp(attrs);
  61361. }
  61362. static medium(attrs) {
  61363. return new Medium(attrs);
  61364. }
  61365. static message(attrs) {
  61366. return new Message(attrs);
  61367. }
  61368. static numericEdit(attrs) {
  61369. return new NumericEdit(attrs);
  61370. }
  61371. static occur(attrs) {
  61372. return new Occur(attrs);
  61373. }
  61374. static oid(attrs) {
  61375. return new Oid(attrs);
  61376. }
  61377. static oids(attrs) {
  61378. return new Oids(attrs);
  61379. }
  61380. static overflow(attrs) {
  61381. return new Overflow(attrs);
  61382. }
  61383. static pageArea(attrs) {
  61384. return new PageArea(attrs);
  61385. }
  61386. static pageSet(attrs) {
  61387. return new PageSet(attrs);
  61388. }
  61389. static para(attrs) {
  61390. return new Para(attrs);
  61391. }
  61392. static passwordEdit(attrs) {
  61393. return new PasswordEdit(attrs);
  61394. }
  61395. static pattern(attrs) {
  61396. return new Pattern(attrs);
  61397. }
  61398. static picture(attrs) {
  61399. return new Picture(attrs);
  61400. }
  61401. static proto(attrs) {
  61402. return new Proto(attrs);
  61403. }
  61404. static radial(attrs) {
  61405. return new Radial(attrs);
  61406. }
  61407. static reason(attrs) {
  61408. return new Reason(attrs);
  61409. }
  61410. static reasons(attrs) {
  61411. return new Reasons(attrs);
  61412. }
  61413. static rectangle(attrs) {
  61414. return new Rectangle(attrs);
  61415. }
  61416. static ref(attrs) {
  61417. return new RefElement(attrs);
  61418. }
  61419. static script(attrs) {
  61420. return new Script(attrs);
  61421. }
  61422. static setProperty(attrs) {
  61423. return new SetProperty(attrs);
  61424. }
  61425. static signData(attrs) {
  61426. return new SignData(attrs);
  61427. }
  61428. static signature(attrs) {
  61429. return new Signature(attrs);
  61430. }
  61431. static signing(attrs) {
  61432. return new Signing(attrs);
  61433. }
  61434. static solid(attrs) {
  61435. return new Solid(attrs);
  61436. }
  61437. static speak(attrs) {
  61438. return new Speak(attrs);
  61439. }
  61440. static stipple(attrs) {
  61441. return new Stipple(attrs);
  61442. }
  61443. static subform(attrs) {
  61444. return new Subform(attrs);
  61445. }
  61446. static subformSet(attrs) {
  61447. return new SubformSet(attrs);
  61448. }
  61449. static subjectDN(attrs) {
  61450. return new SubjectDN(attrs);
  61451. }
  61452. static subjectDNs(attrs) {
  61453. return new SubjectDNs(attrs);
  61454. }
  61455. static submit(attrs) {
  61456. return new Submit(attrs);
  61457. }
  61458. static template(attrs) {
  61459. return new Template(attrs);
  61460. }
  61461. static text(attrs) {
  61462. return new Text(attrs);
  61463. }
  61464. static textEdit(attrs) {
  61465. return new TextEdit(attrs);
  61466. }
  61467. static time(attrs) {
  61468. return new Time(attrs);
  61469. }
  61470. static timeStamp(attrs) {
  61471. return new TimeStamp(attrs);
  61472. }
  61473. static toolTip(attrs) {
  61474. return new ToolTip(attrs);
  61475. }
  61476. static traversal(attrs) {
  61477. return new Traversal(attrs);
  61478. }
  61479. static traverse(attrs) {
  61480. return new Traverse(attrs);
  61481. }
  61482. static ui(attrs) {
  61483. return new Ui(attrs);
  61484. }
  61485. static validate(attrs) {
  61486. return new Validate(attrs);
  61487. }
  61488. static value(attrs) {
  61489. return new Value(attrs);
  61490. }
  61491. static variables(attrs) {
  61492. return new Variables(attrs);
  61493. }
  61494. }
  61495. exports.TemplateNamespace = TemplateNamespace;
  61496. /***/ }),
  61497. /* 208 */
  61498. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61499. "use strict";
  61500. Object.defineProperty(exports, "__esModule", ({
  61501. value: true
  61502. }));
  61503. exports.addHTML = addHTML;
  61504. exports.checkDimensions = checkDimensions;
  61505. exports.flushHTML = flushHTML;
  61506. exports.getAvailableSpace = getAvailableSpace;
  61507. var _xfa_object = __w_pdfjs_require__(202);
  61508. var _html_utils = __w_pdfjs_require__(209);
  61509. function createLine(node, children) {
  61510. return {
  61511. name: "div",
  61512. attributes: {
  61513. class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"]
  61514. },
  61515. children
  61516. };
  61517. }
  61518. function flushHTML(node) {
  61519. if (!node[_xfa_object.$extra]) {
  61520. return null;
  61521. }
  61522. const attributes = node[_xfa_object.$extra].attributes;
  61523. const html = {
  61524. name: "div",
  61525. attributes,
  61526. children: node[_xfa_object.$extra].children
  61527. };
  61528. if (node[_xfa_object.$extra].failingNode) {
  61529. const htmlFromFailing = node[_xfa_object.$extra].failingNode[_xfa_object.$flushHTML]();
  61530. if (htmlFromFailing) {
  61531. if (node.layout.endsWith("-tb")) {
  61532. html.children.push(createLine(node, [htmlFromFailing]));
  61533. } else {
  61534. html.children.push(htmlFromFailing);
  61535. }
  61536. }
  61537. }
  61538. if (html.children.length === 0) {
  61539. return null;
  61540. }
  61541. return html;
  61542. }
  61543. function addHTML(node, html, bbox) {
  61544. const extra = node[_xfa_object.$extra];
  61545. const availableSpace = extra.availableSpace;
  61546. const [x, y, w, h] = bbox;
  61547. switch (node.layout) {
  61548. case "position":
  61549. {
  61550. extra.width = Math.max(extra.width, x + w);
  61551. extra.height = Math.max(extra.height, y + h);
  61552. extra.children.push(html);
  61553. break;
  61554. }
  61555. case "lr-tb":
  61556. case "rl-tb":
  61557. if (!extra.line || extra.attempt === 1) {
  61558. extra.line = createLine(node, []);
  61559. extra.children.push(extra.line);
  61560. extra.numberInLine = 0;
  61561. }
  61562. extra.numberInLine += 1;
  61563. extra.line.children.push(html);
  61564. if (extra.attempt === 0) {
  61565. extra.currentWidth += w;
  61566. extra.height = Math.max(extra.height, extra.prevHeight + h);
  61567. } else {
  61568. extra.currentWidth = w;
  61569. extra.prevHeight = extra.height;
  61570. extra.height += h;
  61571. extra.attempt = 0;
  61572. }
  61573. extra.width = Math.max(extra.width, extra.currentWidth);
  61574. break;
  61575. case "rl-row":
  61576. case "row":
  61577. {
  61578. extra.children.push(html);
  61579. extra.width += w;
  61580. extra.height = Math.max(extra.height, h);
  61581. const height = (0, _html_utils.measureToString)(extra.height);
  61582. for (const child of extra.children) {
  61583. child.attributes.style.height = height;
  61584. }
  61585. break;
  61586. }
  61587. case "table":
  61588. {
  61589. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  61590. extra.height += h;
  61591. extra.children.push(html);
  61592. break;
  61593. }
  61594. case "tb":
  61595. {
  61596. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  61597. extra.height += h;
  61598. extra.children.push(html);
  61599. break;
  61600. }
  61601. }
  61602. }
  61603. function getAvailableSpace(node) {
  61604. const availableSpace = node[_xfa_object.$extra].availableSpace;
  61605. const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0;
  61606. const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0;
  61607. switch (node.layout) {
  61608. case "lr-tb":
  61609. case "rl-tb":
  61610. if (node[_xfa_object.$extra].attempt === 0) {
  61611. return {
  61612. width: availableSpace.width - marginH - node[_xfa_object.$extra].currentWidth,
  61613. height: availableSpace.height - marginV - node[_xfa_object.$extra].prevHeight
  61614. };
  61615. }
  61616. return {
  61617. width: availableSpace.width - marginH,
  61618. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  61619. };
  61620. case "rl-row":
  61621. case "row":
  61622. const width = node[_xfa_object.$extra].columnWidths.slice(node[_xfa_object.$extra].currentColumn).reduce((a, x) => a + x);
  61623. return {
  61624. width,
  61625. height: availableSpace.height - marginH
  61626. };
  61627. case "table":
  61628. case "tb":
  61629. return {
  61630. width: availableSpace.width - marginH,
  61631. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  61632. };
  61633. case "position":
  61634. default:
  61635. return availableSpace;
  61636. }
  61637. }
  61638. function getTransformedBBox(node) {
  61639. let w = node.w === "" ? NaN : node.w;
  61640. let h = node.h === "" ? NaN : node.h;
  61641. let [centerX, centerY] = [0, 0];
  61642. switch (node.anchorType || "") {
  61643. case "bottomCenter":
  61644. [centerX, centerY] = [w / 2, h];
  61645. break;
  61646. case "bottomLeft":
  61647. [centerX, centerY] = [0, h];
  61648. break;
  61649. case "bottomRight":
  61650. [centerX, centerY] = [w, h];
  61651. break;
  61652. case "middleCenter":
  61653. [centerX, centerY] = [w / 2, h / 2];
  61654. break;
  61655. case "middleLeft":
  61656. [centerX, centerY] = [0, h / 2];
  61657. break;
  61658. case "middleRight":
  61659. [centerX, centerY] = [w, h / 2];
  61660. break;
  61661. case "topCenter":
  61662. [centerX, centerY] = [w / 2, 0];
  61663. break;
  61664. case "topRight":
  61665. [centerX, centerY] = [w, 0];
  61666. break;
  61667. }
  61668. let x, y;
  61669. switch (node.rotate || 0) {
  61670. case 0:
  61671. [x, y] = [-centerX, -centerY];
  61672. break;
  61673. case 90:
  61674. [x, y] = [-centerY, centerX];
  61675. [w, h] = [h, -w];
  61676. break;
  61677. case 180:
  61678. [x, y] = [centerX, centerY];
  61679. [w, h] = [-w, -h];
  61680. break;
  61681. case 270:
  61682. [x, y] = [centerY, -centerX];
  61683. [w, h] = [-h, w];
  61684. break;
  61685. }
  61686. return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)];
  61687. }
  61688. function checkDimensions(node, space) {
  61689. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].firstUnsplittable === null) {
  61690. return true;
  61691. }
  61692. if (node.w === 0 || node.h === 0) {
  61693. return true;
  61694. }
  61695. const ERROR = 2;
  61696. const parent = node[_xfa_object.$getSubformParent]();
  61697. const attempt = parent[_xfa_object.$extra] && parent[_xfa_object.$extra].attempt || 0;
  61698. const [, y, w, h] = getTransformedBBox(node);
  61699. switch (parent.layout) {
  61700. case "lr-tb":
  61701. case "rl-tb":
  61702. if (attempt === 0) {
  61703. if (!node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  61704. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  61705. return false;
  61706. }
  61707. if (node.w !== "") {
  61708. if (Math.round(w - space.width) <= ERROR) {
  61709. return true;
  61710. }
  61711. if (parent[_xfa_object.$extra].numberInLine === 0) {
  61712. return space.height > ERROR;
  61713. }
  61714. return false;
  61715. }
  61716. return space.width > ERROR;
  61717. }
  61718. if (node.w !== "") {
  61719. return Math.round(w - space.width) <= ERROR;
  61720. }
  61721. return space.width > ERROR;
  61722. }
  61723. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  61724. return true;
  61725. }
  61726. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  61727. return false;
  61728. }
  61729. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  61730. return space.height > ERROR;
  61731. }
  61732. if (parent[_xfa_object.$isThereMoreWidth]()) {
  61733. return false;
  61734. }
  61735. return space.height > ERROR;
  61736. case "table":
  61737. case "tb":
  61738. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  61739. return true;
  61740. }
  61741. if (node.h !== "" && !node[_xfa_object.$isSplittable]()) {
  61742. return Math.round(h - space.height) <= ERROR;
  61743. }
  61744. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  61745. return space.height > ERROR;
  61746. }
  61747. if (parent[_xfa_object.$isThereMoreWidth]()) {
  61748. return false;
  61749. }
  61750. return space.height > ERROR;
  61751. case "position":
  61752. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  61753. return true;
  61754. }
  61755. if (node.h === "" || Math.round(h + y - space.height) <= ERROR) {
  61756. return true;
  61757. }
  61758. const area = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].currentContentArea;
  61759. return h + y > area.h;
  61760. case "rl-row":
  61761. case "row":
  61762. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  61763. return true;
  61764. }
  61765. if (node.h !== "") {
  61766. return Math.round(h - space.height) <= ERROR;
  61767. }
  61768. return true;
  61769. default:
  61770. return true;
  61771. }
  61772. }
  61773. /***/ }),
  61774. /* 209 */
  61775. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61776. "use strict";
  61777. Object.defineProperty(exports, "__esModule", ({
  61778. value: true
  61779. }));
  61780. exports.computeBbox = computeBbox;
  61781. exports.createWrapper = createWrapper;
  61782. exports.fixDimensions = fixDimensions;
  61783. exports.fixTextIndent = fixTextIndent;
  61784. exports.fixURL = fixURL;
  61785. exports.isPrintOnly = isPrintOnly;
  61786. exports.layoutClass = layoutClass;
  61787. exports.layoutNode = layoutNode;
  61788. exports.measureToString = measureToString;
  61789. exports.setAccess = setAccess;
  61790. exports.setFontFamily = setFontFamily;
  61791. exports.setMinMaxDimensions = setMinMaxDimensions;
  61792. exports.setPara = setPara;
  61793. exports.toStyle = toStyle;
  61794. var _xfa_object = __w_pdfjs_require__(202);
  61795. var _util = __w_pdfjs_require__(2);
  61796. var _utils = __w_pdfjs_require__(203);
  61797. var _fonts = __w_pdfjs_require__(210);
  61798. var _text = __w_pdfjs_require__(211);
  61799. function measureToString(m) {
  61800. if (typeof m === "string") {
  61801. return "0px";
  61802. }
  61803. return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;
  61804. }
  61805. const converters = {
  61806. anchorType(node, style) {
  61807. const parent = node[_xfa_object.$getSubformParent]();
  61808. if (!parent || parent.layout && parent.layout !== "position") {
  61809. return;
  61810. }
  61811. if (!("transform" in style)) {
  61812. style.transform = "";
  61813. }
  61814. switch (node.anchorType) {
  61815. case "bottomCenter":
  61816. style.transform += "translate(-50%, -100%)";
  61817. break;
  61818. case "bottomLeft":
  61819. style.transform += "translate(0,-100%)";
  61820. break;
  61821. case "bottomRight":
  61822. style.transform += "translate(-100%,-100%)";
  61823. break;
  61824. case "middleCenter":
  61825. style.transform += "translate(-50%,-50%)";
  61826. break;
  61827. case "middleLeft":
  61828. style.transform += "translate(0,-50%)";
  61829. break;
  61830. case "middleRight":
  61831. style.transform += "translate(-100%,-50%)";
  61832. break;
  61833. case "topCenter":
  61834. style.transform += "translate(-50%,0)";
  61835. break;
  61836. case "topRight":
  61837. style.transform += "translate(-100%,0)";
  61838. break;
  61839. }
  61840. },
  61841. dimensions(node, style) {
  61842. const parent = node[_xfa_object.$getSubformParent]();
  61843. let width = node.w;
  61844. const height = node.h;
  61845. if (parent.layout && parent.layout.includes("row")) {
  61846. const extra = parent[_xfa_object.$extra];
  61847. const colSpan = node.colSpan;
  61848. let w;
  61849. if (colSpan === -1) {
  61850. w = extra.columnWidths.slice(extra.currentColumn).reduce((a, x) => a + x, 0);
  61851. extra.currentColumn = 0;
  61852. } else {
  61853. w = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, x) => a + x, 0);
  61854. extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length;
  61855. }
  61856. if (!isNaN(w)) {
  61857. width = node.w = w;
  61858. }
  61859. }
  61860. if (width !== "") {
  61861. style.width = measureToString(width);
  61862. } else {
  61863. style.width = "auto";
  61864. }
  61865. if (height !== "") {
  61866. style.height = measureToString(height);
  61867. } else {
  61868. style.height = "auto";
  61869. }
  61870. },
  61871. position(node, style) {
  61872. const parent = node[_xfa_object.$getSubformParent]();
  61873. if (parent && parent.layout && parent.layout !== "position") {
  61874. return;
  61875. }
  61876. style.position = "absolute";
  61877. style.left = measureToString(node.x);
  61878. style.top = measureToString(node.y);
  61879. },
  61880. rotate(node, style) {
  61881. if (node.rotate) {
  61882. if (!("transform" in style)) {
  61883. style.transform = "";
  61884. }
  61885. style.transform += `rotate(-${node.rotate}deg)`;
  61886. style.transformOrigin = "top left";
  61887. }
  61888. },
  61889. presence(node, style) {
  61890. switch (node.presence) {
  61891. case "invisible":
  61892. style.visibility = "hidden";
  61893. break;
  61894. case "hidden":
  61895. case "inactive":
  61896. style.display = "none";
  61897. break;
  61898. }
  61899. },
  61900. hAlign(node, style) {
  61901. if (node[_xfa_object.$nodeName] === "para") {
  61902. switch (node.hAlign) {
  61903. case "justifyAll":
  61904. style.textAlign = "justify-all";
  61905. break;
  61906. case "radix":
  61907. style.textAlign = "left";
  61908. break;
  61909. default:
  61910. style.textAlign = node.hAlign;
  61911. }
  61912. } else {
  61913. switch (node.hAlign) {
  61914. case "left":
  61915. style.alignSelf = "start";
  61916. break;
  61917. case "center":
  61918. style.alignSelf = "center";
  61919. break;
  61920. case "right":
  61921. style.alignSelf = "end";
  61922. break;
  61923. }
  61924. }
  61925. },
  61926. margin(node, style) {
  61927. if (node.margin) {
  61928. style.margin = node.margin[_xfa_object.$toStyle]().margin;
  61929. }
  61930. }
  61931. };
  61932. function setMinMaxDimensions(node, style) {
  61933. const parent = node[_xfa_object.$getSubformParent]();
  61934. if (parent.layout === "position") {
  61935. if (node.minW > 0) {
  61936. style.minWidth = measureToString(node.minW);
  61937. }
  61938. if (node.maxW > 0) {
  61939. style.maxWidth = measureToString(node.maxW);
  61940. }
  61941. if (node.minH > 0) {
  61942. style.minHeight = measureToString(node.minH);
  61943. }
  61944. if (node.maxH > 0) {
  61945. style.maxHeight = measureToString(node.maxH);
  61946. }
  61947. }
  61948. }
  61949. function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) {
  61950. const measure = new _text.TextMeasure(xfaFont, margin, lineHeight, fontFinder);
  61951. if (typeof text === "string") {
  61952. measure.addString(text);
  61953. } else {
  61954. text[_xfa_object.$pushGlyphs](measure);
  61955. }
  61956. return measure.compute(width);
  61957. }
  61958. function layoutNode(node, availableSpace) {
  61959. let height = null;
  61960. let width = null;
  61961. let isBroken = false;
  61962. if ((!node.w || !node.h) && node.value) {
  61963. let marginH = 0;
  61964. let marginV = 0;
  61965. if (node.margin) {
  61966. marginH = node.margin.leftInset + node.margin.rightInset;
  61967. marginV = node.margin.topInset + node.margin.bottomInset;
  61968. }
  61969. let lineHeight = null;
  61970. let margin = null;
  61971. if (node.para) {
  61972. margin = Object.create(null);
  61973. lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight;
  61974. margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove;
  61975. margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow;
  61976. margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft;
  61977. margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight;
  61978. }
  61979. let font = node.font;
  61980. if (!font) {
  61981. const root = node[_xfa_object.$getTemplateRoot]();
  61982. let parent = node[_xfa_object.$getParent]();
  61983. while (parent && parent !== root) {
  61984. if (parent.font) {
  61985. font = parent.font;
  61986. break;
  61987. }
  61988. parent = parent[_xfa_object.$getParent]();
  61989. }
  61990. }
  61991. const maxWidth = (node.w || availableSpace.width) - marginH;
  61992. const fontFinder = node[_xfa_object.$globalData].fontFinder;
  61993. if (node.value.exData && node.value.exData[_xfa_object.$content] && node.value.exData.contentType === "text/html") {
  61994. const res = layoutText(node.value.exData[_xfa_object.$content], font, margin, lineHeight, fontFinder, maxWidth);
  61995. width = res.width;
  61996. height = res.height;
  61997. isBroken = res.isBroken;
  61998. } else {
  61999. const text = node.value[_xfa_object.$text]();
  62000. if (text) {
  62001. const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth);
  62002. width = res.width;
  62003. height = res.height;
  62004. isBroken = res.isBroken;
  62005. }
  62006. }
  62007. if (width !== null && !node.w) {
  62008. width += marginH;
  62009. }
  62010. if (height !== null && !node.h) {
  62011. height += marginV;
  62012. }
  62013. }
  62014. return {
  62015. w: width,
  62016. h: height,
  62017. isBroken
  62018. };
  62019. }
  62020. function computeBbox(node, html, availableSpace) {
  62021. let bbox;
  62022. if (node.w !== "" && node.h !== "") {
  62023. bbox = [node.x, node.y, node.w, node.h];
  62024. } else {
  62025. if (!availableSpace) {
  62026. return null;
  62027. }
  62028. let width = node.w;
  62029. if (width === "") {
  62030. if (node.maxW === 0) {
  62031. const parent = node[_xfa_object.$getSubformParent]();
  62032. if (parent.layout === "position" && parent.w !== "") {
  62033. width = 0;
  62034. } else {
  62035. width = node.minW;
  62036. }
  62037. } else {
  62038. width = Math.min(node.maxW, availableSpace.width);
  62039. }
  62040. html.attributes.style.width = measureToString(width);
  62041. }
  62042. let height = node.h;
  62043. if (height === "") {
  62044. if (node.maxH === 0) {
  62045. const parent = node[_xfa_object.$getSubformParent]();
  62046. if (parent.layout === "position" && parent.h !== "") {
  62047. height = 0;
  62048. } else {
  62049. height = node.minH;
  62050. }
  62051. } else {
  62052. height = Math.min(node.maxH, availableSpace.height);
  62053. }
  62054. html.attributes.style.height = measureToString(height);
  62055. }
  62056. bbox = [node.x, node.y, width, height];
  62057. }
  62058. return bbox;
  62059. }
  62060. function fixDimensions(node) {
  62061. const parent = node[_xfa_object.$getSubformParent]();
  62062. if (parent.layout && parent.layout.includes("row")) {
  62063. const extra = parent[_xfa_object.$extra];
  62064. const colSpan = node.colSpan;
  62065. let width;
  62066. if (colSpan === -1) {
  62067. width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0);
  62068. } else {
  62069. width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0);
  62070. }
  62071. if (!isNaN(width)) {
  62072. node.w = width;
  62073. }
  62074. }
  62075. if (parent.layout && parent.layout !== "position") {
  62076. node.x = node.y = 0;
  62077. }
  62078. if (node.layout === "table") {
  62079. if (node.w === "" && Array.isArray(node.columnWidths)) {
  62080. node.w = node.columnWidths.reduce((a, x) => a + x, 0);
  62081. }
  62082. }
  62083. }
  62084. function layoutClass(node) {
  62085. switch (node.layout) {
  62086. case "position":
  62087. return "xfaPosition";
  62088. case "lr-tb":
  62089. return "xfaLrTb";
  62090. case "rl-row":
  62091. return "xfaRlRow";
  62092. case "rl-tb":
  62093. return "xfaRlTb";
  62094. case "row":
  62095. return "xfaRow";
  62096. case "table":
  62097. return "xfaTable";
  62098. case "tb":
  62099. return "xfaTb";
  62100. default:
  62101. return "xfaPosition";
  62102. }
  62103. }
  62104. function toStyle(node) {
  62105. const style = Object.create(null);
  62106. for (var _len = arguments.length, names = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  62107. names[_key - 1] = arguments[_key];
  62108. }
  62109. for (const name of names) {
  62110. const value = node[name];
  62111. if (value === null) {
  62112. continue;
  62113. }
  62114. if (converters.hasOwnProperty(name)) {
  62115. converters[name](node, style);
  62116. continue;
  62117. }
  62118. if (value instanceof _xfa_object.XFAObject) {
  62119. const newStyle = value[_xfa_object.$toStyle]();
  62120. if (newStyle) {
  62121. Object.assign(style, newStyle);
  62122. } else {
  62123. (0, _util.warn)(`(DEBUG) - XFA - style for ${name} not implemented yet`);
  62124. }
  62125. }
  62126. }
  62127. return style;
  62128. }
  62129. function createWrapper(node, html) {
  62130. const {
  62131. attributes
  62132. } = html;
  62133. const {
  62134. style
  62135. } = attributes;
  62136. const wrapper = {
  62137. name: "div",
  62138. attributes: {
  62139. class: ["xfaWrapper"],
  62140. style: Object.create(null)
  62141. },
  62142. children: []
  62143. };
  62144. attributes.class.push("xfaWrapped");
  62145. if (node.border) {
  62146. const {
  62147. widths,
  62148. insets
  62149. } = node.border[_xfa_object.$extra];
  62150. let width, height;
  62151. let top = insets[0];
  62152. let left = insets[3];
  62153. const insetsH = insets[0] + insets[2];
  62154. const insetsW = insets[1] + insets[3];
  62155. switch (node.border.hand) {
  62156. case "even":
  62157. top -= widths[0] / 2;
  62158. left -= widths[3] / 2;
  62159. width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
  62160. height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;
  62161. break;
  62162. case "left":
  62163. top -= widths[0];
  62164. left -= widths[3];
  62165. width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
  62166. height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
  62167. break;
  62168. case "right":
  62169. width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
  62170. height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
  62171. break;
  62172. }
  62173. const classNames = ["xfaBorder"];
  62174. if (isPrintOnly(node.border)) {
  62175. classNames.push("xfaPrintOnly");
  62176. }
  62177. const border = {
  62178. name: "div",
  62179. attributes: {
  62180. class: classNames,
  62181. style: {
  62182. top: `${top}px`,
  62183. left: `${left}px`,
  62184. width,
  62185. height
  62186. }
  62187. },
  62188. children: []
  62189. };
  62190. for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) {
  62191. if (style[key] !== undefined) {
  62192. border.attributes.style[key] = style[key];
  62193. delete style[key];
  62194. }
  62195. }
  62196. wrapper.children.push(border, html);
  62197. } else {
  62198. wrapper.children.push(html);
  62199. }
  62200. for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) {
  62201. if (style[key] !== undefined) {
  62202. wrapper.attributes.style[key] = style[key];
  62203. delete style[key];
  62204. }
  62205. }
  62206. if (style.position === "absolute") {
  62207. wrapper.attributes.style.position = "absolute";
  62208. } else {
  62209. wrapper.attributes.style.position = "relative";
  62210. }
  62211. delete style.position;
  62212. if (style.alignSelf) {
  62213. wrapper.attributes.style.alignSelf = style.alignSelf;
  62214. delete style.alignSelf;
  62215. }
  62216. return wrapper;
  62217. }
  62218. function fixTextIndent(styles) {
  62219. const indent = (0, _utils.getMeasurement)(styles.textIndent, "0px");
  62220. if (indent >= 0) {
  62221. return;
  62222. }
  62223. const align = styles.textAlign === "right" ? "right" : "left";
  62224. const name = "padding" + (align === "left" ? "Left" : "Right");
  62225. const padding = (0, _utils.getMeasurement)(styles[name], "0px");
  62226. styles[name] = `${padding - indent}px`;
  62227. }
  62228. function setAccess(node, classNames) {
  62229. switch (node.access) {
  62230. case "nonInteractive":
  62231. classNames.push("xfaNonInteractive");
  62232. break;
  62233. case "readOnly":
  62234. classNames.push("xfaReadOnly");
  62235. break;
  62236. case "protected":
  62237. classNames.push("xfaDisabled");
  62238. break;
  62239. }
  62240. }
  62241. function isPrintOnly(node) {
  62242. return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print";
  62243. }
  62244. function getCurrentPara(node) {
  62245. const stack = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].paraStack;
  62246. return stack.length ? stack.at(-1) : null;
  62247. }
  62248. function setPara(node, nodeStyle, value) {
  62249. if (value.attributes.class && value.attributes.class.includes("xfaRich")) {
  62250. if (nodeStyle) {
  62251. if (node.h === "") {
  62252. nodeStyle.height = "auto";
  62253. }
  62254. if (node.w === "") {
  62255. nodeStyle.width = "auto";
  62256. }
  62257. }
  62258. const para = getCurrentPara(node);
  62259. if (para) {
  62260. const valueStyle = value.attributes.style;
  62261. valueStyle.display = "flex";
  62262. valueStyle.flexDirection = "column";
  62263. switch (para.vAlign) {
  62264. case "top":
  62265. valueStyle.justifyContent = "start";
  62266. break;
  62267. case "bottom":
  62268. valueStyle.justifyContent = "end";
  62269. break;
  62270. case "middle":
  62271. valueStyle.justifyContent = "center";
  62272. break;
  62273. }
  62274. const paraStyle = para[_xfa_object.$toStyle]();
  62275. for (const [key, val] of Object.entries(paraStyle)) {
  62276. if (!(key in valueStyle)) {
  62277. valueStyle[key] = val;
  62278. }
  62279. }
  62280. }
  62281. }
  62282. }
  62283. function setFontFamily(xfaFont, node, fontFinder, style) {
  62284. if (!fontFinder) {
  62285. delete style.fontFamily;
  62286. return;
  62287. }
  62288. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  62289. style.fontFamily = `"${name}"`;
  62290. const typeface = fontFinder.find(name);
  62291. if (typeface) {
  62292. const {
  62293. fontFamily
  62294. } = typeface.regular.cssFontInfo;
  62295. if (fontFamily !== name) {
  62296. style.fontFamily = `"${fontFamily}"`;
  62297. }
  62298. const para = getCurrentPara(node);
  62299. if (para && para.lineHeight !== "") {
  62300. return;
  62301. }
  62302. if (style.lineHeight) {
  62303. return;
  62304. }
  62305. const pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  62306. if (pdfFont) {
  62307. style.lineHeight = Math.max(1.2, pdfFont.lineHeight);
  62308. }
  62309. }
  62310. }
  62311. function fixURL(str) {
  62312. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(str, null, {
  62313. addDefaultProtocol: true,
  62314. tryConvertEncoding: true
  62315. });
  62316. return absoluteUrl ? absoluteUrl.href : null;
  62317. }
  62318. /***/ }),
  62319. /* 210 */
  62320. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62321. "use strict";
  62322. Object.defineProperty(exports, "__esModule", ({
  62323. value: true
  62324. }));
  62325. exports.FontFinder = void 0;
  62326. exports.getMetrics = getMetrics;
  62327. exports.selectFont = selectFont;
  62328. var _xfa_object = __w_pdfjs_require__(202);
  62329. var _utils = __w_pdfjs_require__(203);
  62330. var _util = __w_pdfjs_require__(2);
  62331. class FontFinder {
  62332. constructor(pdfFonts) {
  62333. this.fonts = new Map();
  62334. this.cache = new Map();
  62335. this.warned = new Set();
  62336. this.defaultFont = null;
  62337. this.add(pdfFonts);
  62338. }
  62339. add(pdfFonts) {
  62340. let reallyMissingFonts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  62341. for (const pdfFont of pdfFonts) {
  62342. this.addPdfFont(pdfFont);
  62343. }
  62344. for (const pdfFont of this.fonts.values()) {
  62345. if (!pdfFont.regular) {
  62346. pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic;
  62347. }
  62348. }
  62349. if (!reallyMissingFonts || reallyMissingFonts.size === 0) {
  62350. return;
  62351. }
  62352. const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA");
  62353. for (const missing of reallyMissingFonts) {
  62354. this.fonts.set(missing, myriad);
  62355. }
  62356. }
  62357. addPdfFont(pdfFont) {
  62358. const cssFontInfo = pdfFont.cssFontInfo;
  62359. const name = cssFontInfo.fontFamily;
  62360. let font = this.fonts.get(name);
  62361. if (!font) {
  62362. font = Object.create(null);
  62363. this.fonts.set(name, font);
  62364. if (!this.defaultFont) {
  62365. this.defaultFont = font;
  62366. }
  62367. }
  62368. let property = "";
  62369. const fontWeight = parseFloat(cssFontInfo.fontWeight);
  62370. if (parseFloat(cssFontInfo.italicAngle) !== 0) {
  62371. property = fontWeight >= 700 ? "bolditalic" : "italic";
  62372. } else if (fontWeight >= 700) {
  62373. property = "bold";
  62374. }
  62375. if (!property) {
  62376. if (pdfFont.name.includes("Bold") || pdfFont.psName && pdfFont.psName.includes("Bold")) {
  62377. property = "bold";
  62378. }
  62379. if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName && (pdfFont.psName.includes("Italic") || pdfFont.psName.endsWith("It"))) {
  62380. property += "italic";
  62381. }
  62382. }
  62383. if (!property) {
  62384. property = "regular";
  62385. }
  62386. font[property] = pdfFont;
  62387. }
  62388. getDefault() {
  62389. return this.defaultFont;
  62390. }
  62391. find(fontName) {
  62392. let mustWarn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  62393. let font = this.fonts.get(fontName) || this.cache.get(fontName);
  62394. if (font) {
  62395. return font;
  62396. }
  62397. const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi;
  62398. let name = fontName.replace(pattern, "");
  62399. font = this.fonts.get(name);
  62400. if (font) {
  62401. this.cache.set(fontName, font);
  62402. return font;
  62403. }
  62404. name = name.toLowerCase();
  62405. const maybe = [];
  62406. for (const [family, pdfFont] of this.fonts.entries()) {
  62407. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  62408. maybe.push(pdfFont);
  62409. }
  62410. }
  62411. if (maybe.length === 0) {
  62412. for (const [, pdfFont] of this.fonts.entries()) {
  62413. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  62414. maybe.push(pdfFont);
  62415. }
  62416. }
  62417. }
  62418. if (maybe.length === 0) {
  62419. name = name.replace(/psmt|mt/gi, "");
  62420. for (const [family, pdfFont] of this.fonts.entries()) {
  62421. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  62422. maybe.push(pdfFont);
  62423. }
  62424. }
  62425. }
  62426. if (maybe.length === 0) {
  62427. for (const pdfFont of this.fonts.values()) {
  62428. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  62429. maybe.push(pdfFont);
  62430. }
  62431. }
  62432. }
  62433. if (maybe.length >= 1) {
  62434. if (maybe.length !== 1 && mustWarn) {
  62435. (0, _util.warn)(`XFA - Too many choices to guess the correct font: ${fontName}`);
  62436. }
  62437. this.cache.set(fontName, maybe[0]);
  62438. return maybe[0];
  62439. }
  62440. if (mustWarn && !this.warned.has(fontName)) {
  62441. this.warned.add(fontName);
  62442. (0, _util.warn)(`XFA - Cannot find the font: ${fontName}`);
  62443. }
  62444. return null;
  62445. }
  62446. }
  62447. exports.FontFinder = FontFinder;
  62448. function selectFont(xfaFont, typeface) {
  62449. if (xfaFont.posture === "italic") {
  62450. if (xfaFont.weight === "bold") {
  62451. return typeface.bolditalic;
  62452. }
  62453. return typeface.italic;
  62454. } else if (xfaFont.weight === "bold") {
  62455. return typeface.bold;
  62456. }
  62457. return typeface.regular;
  62458. }
  62459. function getMetrics(xfaFont) {
  62460. let real = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  62461. let pdfFont = null;
  62462. if (xfaFont) {
  62463. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  62464. const typeface = xfaFont[_xfa_object.$globalData].fontFinder.find(name);
  62465. pdfFont = selectFont(xfaFont, typeface);
  62466. }
  62467. if (!pdfFont) {
  62468. return {
  62469. lineHeight: 12,
  62470. lineGap: 2,
  62471. lineNoGap: 10
  62472. };
  62473. }
  62474. const size = xfaFont.size || 10;
  62475. const lineHeight = pdfFont.lineHeight ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight) : 1.2;
  62476. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  62477. return {
  62478. lineHeight: lineHeight * size,
  62479. lineGap: lineGap * size,
  62480. lineNoGap: Math.max(1, lineHeight - lineGap) * size
  62481. };
  62482. }
  62483. /***/ }),
  62484. /* 211 */
  62485. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62486. "use strict";
  62487. Object.defineProperty(exports, "__esModule", ({
  62488. value: true
  62489. }));
  62490. exports.TextMeasure = void 0;
  62491. var _fonts = __w_pdfjs_require__(210);
  62492. const WIDTH_FACTOR = 1.02;
  62493. class FontInfo {
  62494. constructor(xfaFont, margin, lineHeight, fontFinder) {
  62495. this.lineHeight = lineHeight;
  62496. this.paraMargin = margin || {
  62497. top: 0,
  62498. bottom: 0,
  62499. left: 0,
  62500. right: 0
  62501. };
  62502. if (!xfaFont) {
  62503. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  62504. return;
  62505. }
  62506. this.xfaFont = {
  62507. typeface: xfaFont.typeface,
  62508. posture: xfaFont.posture,
  62509. weight: xfaFont.weight,
  62510. size: xfaFont.size,
  62511. letterSpacing: xfaFont.letterSpacing
  62512. };
  62513. const typeface = fontFinder.find(xfaFont.typeface);
  62514. if (!typeface) {
  62515. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  62516. return;
  62517. }
  62518. this.pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  62519. if (!this.pdfFont) {
  62520. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  62521. }
  62522. }
  62523. defaultFont(fontFinder) {
  62524. const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault();
  62525. if (font && font.regular) {
  62526. const pdfFont = font.regular;
  62527. const info = pdfFont.cssFontInfo;
  62528. const xfaFont = {
  62529. typeface: info.fontFamily,
  62530. posture: "normal",
  62531. weight: "normal",
  62532. size: 10,
  62533. letterSpacing: 0
  62534. };
  62535. return [pdfFont, xfaFont];
  62536. }
  62537. const xfaFont = {
  62538. typeface: "Courier",
  62539. posture: "normal",
  62540. weight: "normal",
  62541. size: 10,
  62542. letterSpacing: 0
  62543. };
  62544. return [null, xfaFont];
  62545. }
  62546. }
  62547. class FontSelector {
  62548. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) {
  62549. this.fontFinder = fontFinder;
  62550. this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)];
  62551. }
  62552. pushData(xfaFont, margin, lineHeight) {
  62553. const lastFont = this.stack.at(-1);
  62554. for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) {
  62555. if (!xfaFont[name]) {
  62556. xfaFont[name] = lastFont.xfaFont[name];
  62557. }
  62558. }
  62559. for (const name of ["top", "bottom", "left", "right"]) {
  62560. if (isNaN(margin[name])) {
  62561. margin[name] = lastFont.paraMargin[name];
  62562. }
  62563. }
  62564. const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder);
  62565. if (!fontInfo.pdfFont) {
  62566. fontInfo.pdfFont = lastFont.pdfFont;
  62567. }
  62568. this.stack.push(fontInfo);
  62569. }
  62570. popFont() {
  62571. this.stack.pop();
  62572. }
  62573. topFont() {
  62574. return this.stack.at(-1);
  62575. }
  62576. }
  62577. class TextMeasure {
  62578. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) {
  62579. this.glyphs = [];
  62580. this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts);
  62581. this.extraHeight = 0;
  62582. }
  62583. pushData(xfaFont, margin, lineHeight) {
  62584. this.fontSelector.pushData(xfaFont, margin, lineHeight);
  62585. }
  62586. popFont(xfaFont) {
  62587. return this.fontSelector.popFont();
  62588. }
  62589. addPara() {
  62590. const lastFont = this.fontSelector.topFont();
  62591. this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom;
  62592. }
  62593. addString(str) {
  62594. if (!str) {
  62595. return;
  62596. }
  62597. const lastFont = this.fontSelector.topFont();
  62598. const fontSize = lastFont.xfaFont.size;
  62599. if (lastFont.pdfFont) {
  62600. const letterSpacing = lastFont.xfaFont.letterSpacing;
  62601. const pdfFont = lastFont.pdfFont;
  62602. const fontLineHeight = pdfFont.lineHeight || 1.2;
  62603. const lineHeight = lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize;
  62604. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  62605. const noGap = fontLineHeight - lineGap;
  62606. const firstLineHeight = Math.max(1, noGap) * fontSize;
  62607. const scale = fontSize / 1000;
  62608. const fallbackWidth = pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width;
  62609. for (const line of str.split(/[\u2029\n]/)) {
  62610. const encodedLine = pdfFont.encodeString(line).join("");
  62611. const glyphs = pdfFont.charsToGlyphs(encodedLine);
  62612. for (const glyph of glyphs) {
  62613. const width = glyph.width || fallbackWidth;
  62614. this.glyphs.push([width * scale + letterSpacing, lineHeight, firstLineHeight, glyph.unicode, false]);
  62615. }
  62616. this.glyphs.push([0, 0, 0, "\n", true]);
  62617. }
  62618. this.glyphs.pop();
  62619. return;
  62620. }
  62621. for (const line of str.split(/[\u2029\n]/)) {
  62622. for (const char of line.split("")) {
  62623. this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]);
  62624. }
  62625. this.glyphs.push([0, 0, 0, "\n", true]);
  62626. }
  62627. this.glyphs.pop();
  62628. }
  62629. compute(maxWidth) {
  62630. let lastSpacePos = -1,
  62631. lastSpaceWidth = 0,
  62632. width = 0,
  62633. height = 0,
  62634. currentLineWidth = 0,
  62635. currentLineHeight = 0;
  62636. let isBroken = false;
  62637. let isFirstLine = true;
  62638. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  62639. const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] = this.glyphs[i];
  62640. const isSpace = char === " ";
  62641. const glyphHeight = isFirstLine ? firstLineHeight : lineHeight;
  62642. if (isEOL) {
  62643. width = Math.max(width, currentLineWidth);
  62644. currentLineWidth = 0;
  62645. height += currentLineHeight;
  62646. currentLineHeight = glyphHeight;
  62647. lastSpacePos = -1;
  62648. lastSpaceWidth = 0;
  62649. isFirstLine = false;
  62650. continue;
  62651. }
  62652. if (isSpace) {
  62653. if (currentLineWidth + glyphWidth > maxWidth) {
  62654. width = Math.max(width, currentLineWidth);
  62655. currentLineWidth = 0;
  62656. height += currentLineHeight;
  62657. currentLineHeight = glyphHeight;
  62658. lastSpacePos = -1;
  62659. lastSpaceWidth = 0;
  62660. isBroken = true;
  62661. isFirstLine = false;
  62662. } else {
  62663. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  62664. lastSpaceWidth = currentLineWidth;
  62665. currentLineWidth += glyphWidth;
  62666. lastSpacePos = i;
  62667. }
  62668. continue;
  62669. }
  62670. if (currentLineWidth + glyphWidth > maxWidth) {
  62671. height += currentLineHeight;
  62672. currentLineHeight = glyphHeight;
  62673. if (lastSpacePos !== -1) {
  62674. i = lastSpacePos;
  62675. width = Math.max(width, lastSpaceWidth);
  62676. currentLineWidth = 0;
  62677. lastSpacePos = -1;
  62678. lastSpaceWidth = 0;
  62679. } else {
  62680. width = Math.max(width, currentLineWidth);
  62681. currentLineWidth = glyphWidth;
  62682. }
  62683. isBroken = true;
  62684. isFirstLine = false;
  62685. continue;
  62686. }
  62687. currentLineWidth += glyphWidth;
  62688. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  62689. }
  62690. width = Math.max(width, currentLineWidth);
  62691. height += currentLineHeight + this.extraHeight;
  62692. return {
  62693. width: WIDTH_FACTOR * width,
  62694. height,
  62695. isBroken
  62696. };
  62697. }
  62698. }
  62699. exports.TextMeasure = TextMeasure;
  62700. /***/ }),
  62701. /* 212 */
  62702. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62703. "use strict";
  62704. Object.defineProperty(exports, "__esModule", ({
  62705. value: true
  62706. }));
  62707. exports.DataHandler = void 0;
  62708. var _xfa_object = __w_pdfjs_require__(202);
  62709. class DataHandler {
  62710. constructor(root, data) {
  62711. this.data = data;
  62712. this.dataset = root.datasets || null;
  62713. }
  62714. serialize(storage) {
  62715. const stack = [[-1, this.data[_xfa_object.$getChildren]()]];
  62716. while (stack.length > 0) {
  62717. const last = stack.at(-1);
  62718. const [i, children] = last;
  62719. if (i + 1 === children.length) {
  62720. stack.pop();
  62721. continue;
  62722. }
  62723. const child = children[++last[0]];
  62724. const storageEntry = storage.get(child[_xfa_object.$uid]);
  62725. if (storageEntry) {
  62726. child[_xfa_object.$setValue](storageEntry);
  62727. } else {
  62728. const attributes = child[_xfa_object.$getAttributes]();
  62729. for (const value of attributes.values()) {
  62730. const entry = storage.get(value[_xfa_object.$uid]);
  62731. if (entry) {
  62732. value[_xfa_object.$setValue](entry);
  62733. break;
  62734. }
  62735. }
  62736. }
  62737. const nodes = child[_xfa_object.$getChildren]();
  62738. if (nodes.length > 0) {
  62739. stack.push([-1, nodes]);
  62740. }
  62741. }
  62742. const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`];
  62743. if (this.dataset) {
  62744. for (const child of this.dataset[_xfa_object.$getChildren]()) {
  62745. if (child[_xfa_object.$nodeName] !== "data") {
  62746. child[_xfa_object.$toString](buf);
  62747. }
  62748. }
  62749. }
  62750. this.data[_xfa_object.$toString](buf);
  62751. buf.push("</xfa:datasets>");
  62752. return buf.join("");
  62753. }
  62754. }
  62755. exports.DataHandler = DataHandler;
  62756. /***/ }),
  62757. /* 213 */
  62758. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62759. "use strict";
  62760. Object.defineProperty(exports, "__esModule", ({
  62761. value: true
  62762. }));
  62763. exports.XFAParser = void 0;
  62764. var _xfa_object = __w_pdfjs_require__(202);
  62765. var _xml_parser = __w_pdfjs_require__(191);
  62766. var _builder = __w_pdfjs_require__(214);
  62767. var _util = __w_pdfjs_require__(2);
  62768. class XFAParser extends _xml_parser.XMLParserBase {
  62769. constructor() {
  62770. let rootNameSpace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  62771. let richText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  62772. super();
  62773. this._builder = new _builder.Builder(rootNameSpace);
  62774. this._stack = [];
  62775. this._globalData = {
  62776. usedTypefaces: new Set()
  62777. };
  62778. this._ids = new Map();
  62779. this._current = this._builder.buildRoot(this._ids);
  62780. this._errorCode = _xml_parser.XMLParserErrorCode.NoError;
  62781. this._whiteRegex = /^\s+$/;
  62782. this._nbsps = /\xa0+/g;
  62783. this._richText = richText;
  62784. }
  62785. parse(data) {
  62786. this.parseXml(data);
  62787. if (this._errorCode !== _xml_parser.XMLParserErrorCode.NoError) {
  62788. return undefined;
  62789. }
  62790. this._current[_xfa_object.$finalize]();
  62791. return this._current.element;
  62792. }
  62793. onText(text) {
  62794. text = text.replace(this._nbsps, match => match.slice(1) + " ");
  62795. if (this._richText || this._current[_xfa_object.$acceptWhitespace]()) {
  62796. this._current[_xfa_object.$onText](text, this._richText);
  62797. return;
  62798. }
  62799. if (this._whiteRegex.test(text)) {
  62800. return;
  62801. }
  62802. this._current[_xfa_object.$onText](text.trim());
  62803. }
  62804. onCdata(text) {
  62805. this._current[_xfa_object.$onText](text);
  62806. }
  62807. _mkAttributes(attributes, tagName) {
  62808. let namespace = null;
  62809. let prefixes = null;
  62810. const attributeObj = Object.create({});
  62811. for (const {
  62812. name,
  62813. value
  62814. } of attributes) {
  62815. if (name === "xmlns") {
  62816. if (!namespace) {
  62817. namespace = value;
  62818. } else {
  62819. (0, _util.warn)(`XFA - multiple namespace definition in <${tagName}>`);
  62820. }
  62821. } else if (name.startsWith("xmlns:")) {
  62822. const prefix = name.substring("xmlns:".length);
  62823. if (!prefixes) {
  62824. prefixes = [];
  62825. }
  62826. prefixes.push({
  62827. prefix,
  62828. value
  62829. });
  62830. } else {
  62831. const i = name.indexOf(":");
  62832. if (i === -1) {
  62833. attributeObj[name] = value;
  62834. } else {
  62835. let nsAttrs = attributeObj[_xfa_object.$nsAttributes];
  62836. if (!nsAttrs) {
  62837. nsAttrs = attributeObj[_xfa_object.$nsAttributes] = Object.create(null);
  62838. }
  62839. const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
  62840. let attrs = nsAttrs[ns];
  62841. if (!attrs) {
  62842. attrs = nsAttrs[ns] = Object.create(null);
  62843. }
  62844. attrs[attrName] = value;
  62845. }
  62846. }
  62847. }
  62848. return [namespace, prefixes, attributeObj];
  62849. }
  62850. _getNameAndPrefix(name, nsAgnostic) {
  62851. const i = name.indexOf(":");
  62852. if (i === -1) {
  62853. return [name, null];
  62854. }
  62855. return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)];
  62856. }
  62857. onBeginElement(tagName, attributes, isEmpty) {
  62858. const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName);
  62859. const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic());
  62860. const node = this._builder.build({
  62861. nsPrefix,
  62862. name,
  62863. attributes: attributesObj,
  62864. namespace,
  62865. prefixes
  62866. });
  62867. node[_xfa_object.$globalData] = this._globalData;
  62868. if (isEmpty) {
  62869. node[_xfa_object.$finalize]();
  62870. if (this._current[_xfa_object.$onChild](node)) {
  62871. node[_xfa_object.$setId](this._ids);
  62872. }
  62873. node[_xfa_object.$clean](this._builder);
  62874. return;
  62875. }
  62876. this._stack.push(this._current);
  62877. this._current = node;
  62878. }
  62879. onEndElement(name) {
  62880. const node = this._current;
  62881. if (node[_xfa_object.$isCDATAXml]() && typeof node[_xfa_object.$content] === "string") {
  62882. const parser = new XFAParser();
  62883. parser._globalData = this._globalData;
  62884. const root = parser.parse(node[_xfa_object.$content]);
  62885. node[_xfa_object.$content] = null;
  62886. node[_xfa_object.$onChild](root);
  62887. }
  62888. node[_xfa_object.$finalize]();
  62889. this._current = this._stack.pop();
  62890. if (this._current[_xfa_object.$onChild](node)) {
  62891. node[_xfa_object.$setId](this._ids);
  62892. }
  62893. node[_xfa_object.$clean](this._builder);
  62894. }
  62895. onError(code) {
  62896. this._errorCode = code;
  62897. }
  62898. }
  62899. exports.XFAParser = XFAParser;
  62900. /***/ }),
  62901. /* 214 */
  62902. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62903. "use strict";
  62904. Object.defineProperty(exports, "__esModule", ({
  62905. value: true
  62906. }));
  62907. exports.Builder = void 0;
  62908. var _namespaces = __w_pdfjs_require__(204);
  62909. var _xfa_object = __w_pdfjs_require__(202);
  62910. var _setup = __w_pdfjs_require__(215);
  62911. var _template = __w_pdfjs_require__(207);
  62912. var _unknown = __w_pdfjs_require__(224);
  62913. var _util = __w_pdfjs_require__(2);
  62914. class Root extends _xfa_object.XFAObject {
  62915. constructor(ids) {
  62916. super(-1, "root", Object.create(null));
  62917. this.element = null;
  62918. this[_xfa_object.$ids] = ids;
  62919. }
  62920. [_xfa_object.$onChild](child) {
  62921. this.element = child;
  62922. return true;
  62923. }
  62924. [_xfa_object.$finalize]() {
  62925. super[_xfa_object.$finalize]();
  62926. if (this.element.template instanceof _template.Template) {
  62927. this[_xfa_object.$ids].set(_xfa_object.$root, this.element);
  62928. this.element.template[_xfa_object.$resolvePrototypes](this[_xfa_object.$ids]);
  62929. this.element.template[_xfa_object.$ids] = this[_xfa_object.$ids];
  62930. }
  62931. }
  62932. }
  62933. class Empty extends _xfa_object.XFAObject {
  62934. constructor() {
  62935. super(-1, "", Object.create(null));
  62936. }
  62937. [_xfa_object.$onChild](_) {
  62938. return false;
  62939. }
  62940. }
  62941. class Builder {
  62942. constructor() {
  62943. let rootNameSpace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  62944. this._namespaceStack = [];
  62945. this._nsAgnosticLevel = 0;
  62946. this._namespacePrefixes = new Map();
  62947. this._namespaces = new Map();
  62948. this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(_ref => {
  62949. let {
  62950. id
  62951. } = _ref;
  62952. return id;
  62953. }));
  62954. this._currentNamespace = rootNameSpace || new _unknown.UnknownNamespace(++this._nextNsId);
  62955. }
  62956. buildRoot(ids) {
  62957. return new Root(ids);
  62958. }
  62959. build(_ref2) {
  62960. let {
  62961. nsPrefix,
  62962. name,
  62963. attributes,
  62964. namespace,
  62965. prefixes
  62966. } = _ref2;
  62967. const hasNamespaceDef = namespace !== null;
  62968. if (hasNamespaceDef) {
  62969. this._namespaceStack.push(this._currentNamespace);
  62970. this._currentNamespace = this._searchNamespace(namespace);
  62971. }
  62972. if (prefixes) {
  62973. this._addNamespacePrefix(prefixes);
  62974. }
  62975. if (attributes.hasOwnProperty(_xfa_object.$nsAttributes)) {
  62976. const dataTemplate = _setup.NamespaceSetUp.datasets;
  62977. const nsAttrs = attributes[_xfa_object.$nsAttributes];
  62978. let xfaAttrs = null;
  62979. for (const [ns, attrs] of Object.entries(nsAttrs)) {
  62980. const nsToUse = this._getNamespaceToUse(ns);
  62981. if (nsToUse === dataTemplate) {
  62982. xfaAttrs = {
  62983. xfa: attrs
  62984. };
  62985. break;
  62986. }
  62987. }
  62988. if (xfaAttrs) {
  62989. attributes[_xfa_object.$nsAttributes] = xfaAttrs;
  62990. } else {
  62991. delete attributes[_xfa_object.$nsAttributes];
  62992. }
  62993. }
  62994. const namespaceToUse = this._getNamespaceToUse(nsPrefix);
  62995. const node = namespaceToUse && namespaceToUse[_namespaces.$buildXFAObject](name, attributes) || new Empty();
  62996. if (node[_xfa_object.$isNsAgnostic]()) {
  62997. this._nsAgnosticLevel++;
  62998. }
  62999. if (hasNamespaceDef || prefixes || node[_xfa_object.$isNsAgnostic]()) {
  63000. node[_xfa_object.$cleanup] = {
  63001. hasNamespace: hasNamespaceDef,
  63002. prefixes,
  63003. nsAgnostic: node[_xfa_object.$isNsAgnostic]()
  63004. };
  63005. }
  63006. return node;
  63007. }
  63008. isNsAgnostic() {
  63009. return this._nsAgnosticLevel > 0;
  63010. }
  63011. _searchNamespace(nsName) {
  63012. let ns = this._namespaces.get(nsName);
  63013. if (ns) {
  63014. return ns;
  63015. }
  63016. for (const [name, {
  63017. check
  63018. }] of Object.entries(_namespaces.NamespaceIds)) {
  63019. if (check(nsName)) {
  63020. ns = _setup.NamespaceSetUp[name];
  63021. if (ns) {
  63022. this._namespaces.set(nsName, ns);
  63023. return ns;
  63024. }
  63025. break;
  63026. }
  63027. }
  63028. ns = new _unknown.UnknownNamespace(++this._nextNsId);
  63029. this._namespaces.set(nsName, ns);
  63030. return ns;
  63031. }
  63032. _addNamespacePrefix(prefixes) {
  63033. for (const {
  63034. prefix,
  63035. value
  63036. } of prefixes) {
  63037. const namespace = this._searchNamespace(value);
  63038. let prefixStack = this._namespacePrefixes.get(prefix);
  63039. if (!prefixStack) {
  63040. prefixStack = [];
  63041. this._namespacePrefixes.set(prefix, prefixStack);
  63042. }
  63043. prefixStack.push(namespace);
  63044. }
  63045. }
  63046. _getNamespaceToUse(prefix) {
  63047. if (!prefix) {
  63048. return this._currentNamespace;
  63049. }
  63050. const prefixStack = this._namespacePrefixes.get(prefix);
  63051. if (prefixStack && prefixStack.length > 0) {
  63052. return prefixStack.at(-1);
  63053. }
  63054. (0, _util.warn)(`Unknown namespace prefix: ${prefix}.`);
  63055. return null;
  63056. }
  63057. clean(data) {
  63058. const {
  63059. hasNamespace,
  63060. prefixes,
  63061. nsAgnostic
  63062. } = data;
  63063. if (hasNamespace) {
  63064. this._currentNamespace = this._namespaceStack.pop();
  63065. }
  63066. if (prefixes) {
  63067. prefixes.forEach(_ref3 => {
  63068. let {
  63069. prefix
  63070. } = _ref3;
  63071. this._namespacePrefixes.get(prefix).pop();
  63072. });
  63073. }
  63074. if (nsAgnostic) {
  63075. this._nsAgnosticLevel--;
  63076. }
  63077. }
  63078. }
  63079. exports.Builder = Builder;
  63080. /***/ }),
  63081. /* 215 */
  63082. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63083. "use strict";
  63084. Object.defineProperty(exports, "__esModule", ({
  63085. value: true
  63086. }));
  63087. exports.NamespaceSetUp = void 0;
  63088. var _config = __w_pdfjs_require__(216);
  63089. var _connection_set = __w_pdfjs_require__(217);
  63090. var _datasets = __w_pdfjs_require__(218);
  63091. var _locale_set = __w_pdfjs_require__(219);
  63092. var _signature = __w_pdfjs_require__(220);
  63093. var _stylesheet = __w_pdfjs_require__(221);
  63094. var _template = __w_pdfjs_require__(207);
  63095. var _xdp = __w_pdfjs_require__(222);
  63096. var _xhtml = __w_pdfjs_require__(223);
  63097. const NamespaceSetUp = {
  63098. config: _config.ConfigNamespace,
  63099. connection: _connection_set.ConnectionSetNamespace,
  63100. datasets: _datasets.DatasetsNamespace,
  63101. localeSet: _locale_set.LocaleSetNamespace,
  63102. signature: _signature.SignatureNamespace,
  63103. stylesheet: _stylesheet.StylesheetNamespace,
  63104. template: _template.TemplateNamespace,
  63105. xdp: _xdp.XdpNamespace,
  63106. xhtml: _xhtml.XhtmlNamespace
  63107. };
  63108. exports.NamespaceSetUp = NamespaceSetUp;
  63109. /***/ }),
  63110. /* 216 */
  63111. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63112. "use strict";
  63113. Object.defineProperty(exports, "__esModule", ({
  63114. value: true
  63115. }));
  63116. exports.ConfigNamespace = void 0;
  63117. var _namespaces = __w_pdfjs_require__(204);
  63118. var _xfa_object = __w_pdfjs_require__(202);
  63119. var _utils = __w_pdfjs_require__(203);
  63120. var _util = __w_pdfjs_require__(2);
  63121. const CONFIG_NS_ID = _namespaces.NamespaceIds.config.id;
  63122. class Acrobat extends _xfa_object.XFAObject {
  63123. constructor(attributes) {
  63124. super(CONFIG_NS_ID, "acrobat", true);
  63125. this.acrobat7 = null;
  63126. this.autoSave = null;
  63127. this.common = null;
  63128. this.validate = null;
  63129. this.validateApprovalSignatures = null;
  63130. this.submitUrl = new _xfa_object.XFAObjectArray();
  63131. }
  63132. }
  63133. class Acrobat7 extends _xfa_object.XFAObject {
  63134. constructor(attributes) {
  63135. super(CONFIG_NS_ID, "acrobat7", true);
  63136. this.dynamicRender = null;
  63137. }
  63138. }
  63139. class ADBE_JSConsole extends _xfa_object.OptionObject {
  63140. constructor(attributes) {
  63141. super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]);
  63142. }
  63143. }
  63144. class ADBE_JSDebugger extends _xfa_object.OptionObject {
  63145. constructor(attributes) {
  63146. super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]);
  63147. }
  63148. }
  63149. class AddSilentPrint extends _xfa_object.Option01 {
  63150. constructor(attributes) {
  63151. super(CONFIG_NS_ID, "addSilentPrint");
  63152. }
  63153. }
  63154. class AddViewerPreferences extends _xfa_object.Option01 {
  63155. constructor(attributes) {
  63156. super(CONFIG_NS_ID, "addViewerPreferences");
  63157. }
  63158. }
  63159. class AdjustData extends _xfa_object.Option10 {
  63160. constructor(attributes) {
  63161. super(CONFIG_NS_ID, "adjustData");
  63162. }
  63163. }
  63164. class AdobeExtensionLevel extends _xfa_object.IntegerObject {
  63165. constructor(attributes) {
  63166. super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8);
  63167. }
  63168. }
  63169. class Agent extends _xfa_object.XFAObject {
  63170. constructor(attributes) {
  63171. super(CONFIG_NS_ID, "agent", true);
  63172. this.name = attributes.name ? attributes.name.trim() : "";
  63173. this.common = new _xfa_object.XFAObjectArray();
  63174. }
  63175. }
  63176. class AlwaysEmbed extends _xfa_object.ContentObject {
  63177. constructor(attributes) {
  63178. super(CONFIG_NS_ID, "alwaysEmbed");
  63179. }
  63180. }
  63181. class Amd extends _xfa_object.StringObject {
  63182. constructor(attributes) {
  63183. super(CONFIG_NS_ID, "amd");
  63184. }
  63185. }
  63186. class Area extends _xfa_object.XFAObject {
  63187. constructor(attributes) {
  63188. super(CONFIG_NS_ID, "area");
  63189. this.level = (0, _utils.getInteger)({
  63190. data: attributes.level,
  63191. defaultValue: 0,
  63192. validate: n => n >= 1 && n <= 3
  63193. });
  63194. this.name = (0, _utils.getStringOption)(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]);
  63195. }
  63196. }
  63197. class Attributes extends _xfa_object.OptionObject {
  63198. constructor(attributes) {
  63199. super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]);
  63200. }
  63201. }
  63202. class AutoSave extends _xfa_object.OptionObject {
  63203. constructor(attributes) {
  63204. super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]);
  63205. }
  63206. }
  63207. class Base extends _xfa_object.StringObject {
  63208. constructor(attributes) {
  63209. super(CONFIG_NS_ID, "base");
  63210. }
  63211. }
  63212. class BatchOutput extends _xfa_object.XFAObject {
  63213. constructor(attributes) {
  63214. super(CONFIG_NS_ID, "batchOutput");
  63215. this.format = (0, _utils.getStringOption)(attributes.format, ["none", "concat", "zip", "zipCompress"]);
  63216. }
  63217. }
  63218. class BehaviorOverride extends _xfa_object.ContentObject {
  63219. constructor(attributes) {
  63220. super(CONFIG_NS_ID, "behaviorOverride");
  63221. }
  63222. [_xfa_object.$finalize]() {
  63223. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2)));
  63224. }
  63225. }
  63226. class Cache extends _xfa_object.XFAObject {
  63227. constructor(attributes) {
  63228. super(CONFIG_NS_ID, "cache", true);
  63229. this.templateCache = null;
  63230. }
  63231. }
  63232. class Change extends _xfa_object.Option01 {
  63233. constructor(attributes) {
  63234. super(CONFIG_NS_ID, "change");
  63235. }
  63236. }
  63237. class Common extends _xfa_object.XFAObject {
  63238. constructor(attributes) {
  63239. super(CONFIG_NS_ID, "common", true);
  63240. this.data = null;
  63241. this.locale = null;
  63242. this.localeSet = null;
  63243. this.messaging = null;
  63244. this.suppressBanner = null;
  63245. this.template = null;
  63246. this.validationMessaging = null;
  63247. this.versionControl = null;
  63248. this.log = new _xfa_object.XFAObjectArray();
  63249. }
  63250. }
  63251. class Compress extends _xfa_object.XFAObject {
  63252. constructor(attributes) {
  63253. super(CONFIG_NS_ID, "compress");
  63254. this.scope = (0, _utils.getStringOption)(attributes.scope, ["imageOnly", "document"]);
  63255. }
  63256. }
  63257. class CompressLogicalStructure extends _xfa_object.Option01 {
  63258. constructor(attributes) {
  63259. super(CONFIG_NS_ID, "compressLogicalStructure");
  63260. }
  63261. }
  63262. class CompressObjectStream extends _xfa_object.Option10 {
  63263. constructor(attributes) {
  63264. super(CONFIG_NS_ID, "compressObjectStream");
  63265. }
  63266. }
  63267. class Compression extends _xfa_object.XFAObject {
  63268. constructor(attributes) {
  63269. super(CONFIG_NS_ID, "compression", true);
  63270. this.compressLogicalStructure = null;
  63271. this.compressObjectStream = null;
  63272. this.level = null;
  63273. this.type = null;
  63274. }
  63275. }
  63276. class Config extends _xfa_object.XFAObject {
  63277. constructor(attributes) {
  63278. super(CONFIG_NS_ID, "config", true);
  63279. this.acrobat = null;
  63280. this.present = null;
  63281. this.trace = null;
  63282. this.agent = new _xfa_object.XFAObjectArray();
  63283. }
  63284. }
  63285. class Conformance extends _xfa_object.OptionObject {
  63286. constructor(attributes) {
  63287. super(CONFIG_NS_ID, "conformance", ["A", "B"]);
  63288. }
  63289. }
  63290. class ContentCopy extends _xfa_object.Option01 {
  63291. constructor(attributes) {
  63292. super(CONFIG_NS_ID, "contentCopy");
  63293. }
  63294. }
  63295. class Copies extends _xfa_object.IntegerObject {
  63296. constructor(attributes) {
  63297. super(CONFIG_NS_ID, "copies", 1, n => n >= 1);
  63298. }
  63299. }
  63300. class Creator extends _xfa_object.StringObject {
  63301. constructor(attributes) {
  63302. super(CONFIG_NS_ID, "creator");
  63303. }
  63304. }
  63305. class CurrentPage extends _xfa_object.IntegerObject {
  63306. constructor(attributes) {
  63307. super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0);
  63308. }
  63309. }
  63310. class Data extends _xfa_object.XFAObject {
  63311. constructor(attributes) {
  63312. super(CONFIG_NS_ID, "data", true);
  63313. this.adjustData = null;
  63314. this.attributes = null;
  63315. this.incrementalLoad = null;
  63316. this.outputXSL = null;
  63317. this.range = null;
  63318. this.record = null;
  63319. this.startNode = null;
  63320. this.uri = null;
  63321. this.window = null;
  63322. this.xsl = null;
  63323. this.excludeNS = new _xfa_object.XFAObjectArray();
  63324. this.transform = new _xfa_object.XFAObjectArray();
  63325. }
  63326. }
  63327. class Debug extends _xfa_object.XFAObject {
  63328. constructor(attributes) {
  63329. super(CONFIG_NS_ID, "debug", true);
  63330. this.uri = null;
  63331. }
  63332. }
  63333. class DefaultTypeface extends _xfa_object.ContentObject {
  63334. constructor(attributes) {
  63335. super(CONFIG_NS_ID, "defaultTypeface");
  63336. this.writingScript = (0, _utils.getStringOption)(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]);
  63337. }
  63338. }
  63339. class Destination extends _xfa_object.OptionObject {
  63340. constructor(attributes) {
  63341. super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]);
  63342. }
  63343. }
  63344. class DocumentAssembly extends _xfa_object.Option01 {
  63345. constructor(attributes) {
  63346. super(CONFIG_NS_ID, "documentAssembly");
  63347. }
  63348. }
  63349. class Driver extends _xfa_object.XFAObject {
  63350. constructor(attributes) {
  63351. super(CONFIG_NS_ID, "driver", true);
  63352. this.name = attributes.name ? attributes.name.trim() : "";
  63353. this.fontInfo = null;
  63354. this.xdc = null;
  63355. }
  63356. }
  63357. class DuplexOption extends _xfa_object.OptionObject {
  63358. constructor(attributes) {
  63359. super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]);
  63360. }
  63361. }
  63362. class DynamicRender extends _xfa_object.OptionObject {
  63363. constructor(attributes) {
  63364. super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]);
  63365. }
  63366. }
  63367. class Embed extends _xfa_object.Option01 {
  63368. constructor(attributes) {
  63369. super(CONFIG_NS_ID, "embed");
  63370. }
  63371. }
  63372. class Encrypt extends _xfa_object.Option01 {
  63373. constructor(attributes) {
  63374. super(CONFIG_NS_ID, "encrypt");
  63375. }
  63376. }
  63377. class Encryption extends _xfa_object.XFAObject {
  63378. constructor(attributes) {
  63379. super(CONFIG_NS_ID, "encryption", true);
  63380. this.encrypt = null;
  63381. this.encryptionLevel = null;
  63382. this.permissions = null;
  63383. }
  63384. }
  63385. class EncryptionLevel extends _xfa_object.OptionObject {
  63386. constructor(attributes) {
  63387. super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]);
  63388. }
  63389. }
  63390. class Enforce extends _xfa_object.StringObject {
  63391. constructor(attributes) {
  63392. super(CONFIG_NS_ID, "enforce");
  63393. }
  63394. }
  63395. class Equate extends _xfa_object.XFAObject {
  63396. constructor(attributes) {
  63397. super(CONFIG_NS_ID, "equate");
  63398. this.force = (0, _utils.getInteger)({
  63399. data: attributes.force,
  63400. defaultValue: 1,
  63401. validate: n => n === 0
  63402. });
  63403. this.from = attributes.from || "";
  63404. this.to = attributes.to || "";
  63405. }
  63406. }
  63407. class EquateRange extends _xfa_object.XFAObject {
  63408. constructor(attributes) {
  63409. super(CONFIG_NS_ID, "equateRange");
  63410. this.from = attributes.from || "";
  63411. this.to = attributes.to || "";
  63412. this._unicodeRange = attributes.unicodeRange || "";
  63413. }
  63414. get unicodeRange() {
  63415. const ranges = [];
  63416. const unicodeRegex = /U\+([0-9a-fA-F]+)/;
  63417. const unicodeRange = this._unicodeRange;
  63418. for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) {
  63419. range = range.split("-", 2).map(x => {
  63420. const found = x.match(unicodeRegex);
  63421. if (!found) {
  63422. return 0;
  63423. }
  63424. return parseInt(found[1], 16);
  63425. });
  63426. if (range.length === 1) {
  63427. range.push(range[0]);
  63428. }
  63429. ranges.push(range);
  63430. }
  63431. return (0, _util.shadow)(this, "unicodeRange", ranges);
  63432. }
  63433. }
  63434. class Exclude extends _xfa_object.ContentObject {
  63435. constructor(attributes) {
  63436. super(CONFIG_NS_ID, "exclude");
  63437. }
  63438. [_xfa_object.$finalize]() {
  63439. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x));
  63440. }
  63441. }
  63442. class ExcludeNS extends _xfa_object.StringObject {
  63443. constructor(attributes) {
  63444. super(CONFIG_NS_ID, "excludeNS");
  63445. }
  63446. }
  63447. class FlipLabel extends _xfa_object.OptionObject {
  63448. constructor(attributes) {
  63449. super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]);
  63450. }
  63451. }
  63452. class FontInfo extends _xfa_object.XFAObject {
  63453. constructor(attributes) {
  63454. super(CONFIG_NS_ID, "fontInfo", true);
  63455. this.embed = null;
  63456. this.map = null;
  63457. this.subsetBelow = null;
  63458. this.alwaysEmbed = new _xfa_object.XFAObjectArray();
  63459. this.defaultTypeface = new _xfa_object.XFAObjectArray();
  63460. this.neverEmbed = new _xfa_object.XFAObjectArray();
  63461. }
  63462. }
  63463. class FormFieldFilling extends _xfa_object.Option01 {
  63464. constructor(attributes) {
  63465. super(CONFIG_NS_ID, "formFieldFilling");
  63466. }
  63467. }
  63468. class GroupParent extends _xfa_object.StringObject {
  63469. constructor(attributes) {
  63470. super(CONFIG_NS_ID, "groupParent");
  63471. }
  63472. }
  63473. class IfEmpty extends _xfa_object.OptionObject {
  63474. constructor(attributes) {
  63475. super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]);
  63476. }
  63477. }
  63478. class IncludeXDPContent extends _xfa_object.StringObject {
  63479. constructor(attributes) {
  63480. super(CONFIG_NS_ID, "includeXDPContent");
  63481. }
  63482. }
  63483. class IncrementalLoad extends _xfa_object.OptionObject {
  63484. constructor(attributes) {
  63485. super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]);
  63486. }
  63487. }
  63488. class IncrementalMerge extends _xfa_object.Option01 {
  63489. constructor(attributes) {
  63490. super(CONFIG_NS_ID, "incrementalMerge");
  63491. }
  63492. }
  63493. class Interactive extends _xfa_object.Option01 {
  63494. constructor(attributes) {
  63495. super(CONFIG_NS_ID, "interactive");
  63496. }
  63497. }
  63498. class Jog extends _xfa_object.OptionObject {
  63499. constructor(attributes) {
  63500. super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]);
  63501. }
  63502. }
  63503. class LabelPrinter extends _xfa_object.XFAObject {
  63504. constructor(attributes) {
  63505. super(CONFIG_NS_ID, "labelPrinter", true);
  63506. this.name = (0, _utils.getStringOption)(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]);
  63507. this.batchOutput = null;
  63508. this.flipLabel = null;
  63509. this.fontInfo = null;
  63510. this.xdc = null;
  63511. }
  63512. }
  63513. class Layout extends _xfa_object.OptionObject {
  63514. constructor(attributes) {
  63515. super(CONFIG_NS_ID, "layout", ["paginate", "panel"]);
  63516. }
  63517. }
  63518. class Level extends _xfa_object.IntegerObject {
  63519. constructor(attributes) {
  63520. super(CONFIG_NS_ID, "level", 0, n => n > 0);
  63521. }
  63522. }
  63523. class Linearized extends _xfa_object.Option01 {
  63524. constructor(attributes) {
  63525. super(CONFIG_NS_ID, "linearized");
  63526. }
  63527. }
  63528. class Locale extends _xfa_object.StringObject {
  63529. constructor(attributes) {
  63530. super(CONFIG_NS_ID, "locale");
  63531. }
  63532. }
  63533. class LocaleSet extends _xfa_object.StringObject {
  63534. constructor(attributes) {
  63535. super(CONFIG_NS_ID, "localeSet");
  63536. }
  63537. }
  63538. class Log extends _xfa_object.XFAObject {
  63539. constructor(attributes) {
  63540. super(CONFIG_NS_ID, "log", true);
  63541. this.mode = null;
  63542. this.threshold = null;
  63543. this.to = null;
  63544. this.uri = null;
  63545. }
  63546. }
  63547. class MapElement extends _xfa_object.XFAObject {
  63548. constructor(attributes) {
  63549. super(CONFIG_NS_ID, "map", true);
  63550. this.equate = new _xfa_object.XFAObjectArray();
  63551. this.equateRange = new _xfa_object.XFAObjectArray();
  63552. }
  63553. }
  63554. class MediumInfo extends _xfa_object.XFAObject {
  63555. constructor(attributes) {
  63556. super(CONFIG_NS_ID, "mediumInfo", true);
  63557. this.map = null;
  63558. }
  63559. }
  63560. class Message extends _xfa_object.XFAObject {
  63561. constructor(attributes) {
  63562. super(CONFIG_NS_ID, "message", true);
  63563. this.msgId = null;
  63564. this.severity = null;
  63565. }
  63566. }
  63567. class Messaging extends _xfa_object.XFAObject {
  63568. constructor(attributes) {
  63569. super(CONFIG_NS_ID, "messaging", true);
  63570. this.message = new _xfa_object.XFAObjectArray();
  63571. }
  63572. }
  63573. class Mode extends _xfa_object.OptionObject {
  63574. constructor(attributes) {
  63575. super(CONFIG_NS_ID, "mode", ["append", "overwrite"]);
  63576. }
  63577. }
  63578. class ModifyAnnots extends _xfa_object.Option01 {
  63579. constructor(attributes) {
  63580. super(CONFIG_NS_ID, "modifyAnnots");
  63581. }
  63582. }
  63583. class MsgId extends _xfa_object.IntegerObject {
  63584. constructor(attributes) {
  63585. super(CONFIG_NS_ID, "msgId", 1, n => n >= 1);
  63586. }
  63587. }
  63588. class NameAttr extends _xfa_object.StringObject {
  63589. constructor(attributes) {
  63590. super(CONFIG_NS_ID, "nameAttr");
  63591. }
  63592. }
  63593. class NeverEmbed extends _xfa_object.ContentObject {
  63594. constructor(attributes) {
  63595. super(CONFIG_NS_ID, "neverEmbed");
  63596. }
  63597. }
  63598. class NumberOfCopies extends _xfa_object.IntegerObject {
  63599. constructor(attributes) {
  63600. super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5);
  63601. }
  63602. }
  63603. class OpenAction extends _xfa_object.XFAObject {
  63604. constructor(attributes) {
  63605. super(CONFIG_NS_ID, "openAction", true);
  63606. this.destination = null;
  63607. }
  63608. }
  63609. class Output extends _xfa_object.XFAObject {
  63610. constructor(attributes) {
  63611. super(CONFIG_NS_ID, "output", true);
  63612. this.to = null;
  63613. this.type = null;
  63614. this.uri = null;
  63615. }
  63616. }
  63617. class OutputBin extends _xfa_object.StringObject {
  63618. constructor(attributes) {
  63619. super(CONFIG_NS_ID, "outputBin");
  63620. }
  63621. }
  63622. class OutputXSL extends _xfa_object.XFAObject {
  63623. constructor(attributes) {
  63624. super(CONFIG_NS_ID, "outputXSL", true);
  63625. this.uri = null;
  63626. }
  63627. }
  63628. class Overprint extends _xfa_object.OptionObject {
  63629. constructor(attributes) {
  63630. super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]);
  63631. }
  63632. }
  63633. class Packets extends _xfa_object.StringObject {
  63634. constructor(attributes) {
  63635. super(CONFIG_NS_ID, "packets");
  63636. }
  63637. [_xfa_object.$finalize]() {
  63638. if (this[_xfa_object.$content] === "*") {
  63639. return;
  63640. }
  63641. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x));
  63642. }
  63643. }
  63644. class PageOffset extends _xfa_object.XFAObject {
  63645. constructor(attributes) {
  63646. super(CONFIG_NS_ID, "pageOffset");
  63647. this.x = (0, _utils.getInteger)({
  63648. data: attributes.x,
  63649. defaultValue: "useXDCSetting",
  63650. validate: n => true
  63651. });
  63652. this.y = (0, _utils.getInteger)({
  63653. data: attributes.y,
  63654. defaultValue: "useXDCSetting",
  63655. validate: n => true
  63656. });
  63657. }
  63658. }
  63659. class PageRange extends _xfa_object.StringObject {
  63660. constructor(attributes) {
  63661. super(CONFIG_NS_ID, "pageRange");
  63662. }
  63663. [_xfa_object.$finalize]() {
  63664. const numbers = this[_xfa_object.$content].trim().split(/\s+/).map(x => parseInt(x, 10));
  63665. const ranges = [];
  63666. for (let i = 0, ii = numbers.length; i < ii; i += 2) {
  63667. ranges.push(numbers.slice(i, i + 2));
  63668. }
  63669. this[_xfa_object.$content] = ranges;
  63670. }
  63671. }
  63672. class Pagination extends _xfa_object.OptionObject {
  63673. constructor(attributes) {
  63674. super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]);
  63675. }
  63676. }
  63677. class PaginationOverride extends _xfa_object.OptionObject {
  63678. constructor(attributes) {
  63679. super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]);
  63680. }
  63681. }
  63682. class Part extends _xfa_object.IntegerObject {
  63683. constructor(attributes) {
  63684. super(CONFIG_NS_ID, "part", 1, n => false);
  63685. }
  63686. }
  63687. class Pcl extends _xfa_object.XFAObject {
  63688. constructor(attributes) {
  63689. super(CONFIG_NS_ID, "pcl", true);
  63690. this.name = attributes.name || "";
  63691. this.batchOutput = null;
  63692. this.fontInfo = null;
  63693. this.jog = null;
  63694. this.mediumInfo = null;
  63695. this.outputBin = null;
  63696. this.pageOffset = null;
  63697. this.staple = null;
  63698. this.xdc = null;
  63699. }
  63700. }
  63701. class Pdf extends _xfa_object.XFAObject {
  63702. constructor(attributes) {
  63703. super(CONFIG_NS_ID, "pdf", true);
  63704. this.name = attributes.name || "";
  63705. this.adobeExtensionLevel = null;
  63706. this.batchOutput = null;
  63707. this.compression = null;
  63708. this.creator = null;
  63709. this.encryption = null;
  63710. this.fontInfo = null;
  63711. this.interactive = null;
  63712. this.linearized = null;
  63713. this.openAction = null;
  63714. this.pdfa = null;
  63715. this.producer = null;
  63716. this.renderPolicy = null;
  63717. this.scriptModel = null;
  63718. this.silentPrint = null;
  63719. this.submitFormat = null;
  63720. this.tagged = null;
  63721. this.version = null;
  63722. this.viewerPreferences = null;
  63723. this.xdc = null;
  63724. }
  63725. }
  63726. class Pdfa extends _xfa_object.XFAObject {
  63727. constructor(attributes) {
  63728. super(CONFIG_NS_ID, "pdfa", true);
  63729. this.amd = null;
  63730. this.conformance = null;
  63731. this.includeXDPContent = null;
  63732. this.part = null;
  63733. }
  63734. }
  63735. class Permissions extends _xfa_object.XFAObject {
  63736. constructor(attributes) {
  63737. super(CONFIG_NS_ID, "permissions", true);
  63738. this.accessibleContent = null;
  63739. this.change = null;
  63740. this.contentCopy = null;
  63741. this.documentAssembly = null;
  63742. this.formFieldFilling = null;
  63743. this.modifyAnnots = null;
  63744. this.plaintextMetadata = null;
  63745. this.print = null;
  63746. this.printHighQuality = null;
  63747. }
  63748. }
  63749. class PickTrayByPDFSize extends _xfa_object.Option01 {
  63750. constructor(attributes) {
  63751. super(CONFIG_NS_ID, "pickTrayByPDFSize");
  63752. }
  63753. }
  63754. class Picture extends _xfa_object.StringObject {
  63755. constructor(attributes) {
  63756. super(CONFIG_NS_ID, "picture");
  63757. }
  63758. }
  63759. class PlaintextMetadata extends _xfa_object.Option01 {
  63760. constructor(attributes) {
  63761. super(CONFIG_NS_ID, "plaintextMetadata");
  63762. }
  63763. }
  63764. class Presence extends _xfa_object.OptionObject {
  63765. constructor(attributes) {
  63766. super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]);
  63767. }
  63768. }
  63769. class Present extends _xfa_object.XFAObject {
  63770. constructor(attributes) {
  63771. super(CONFIG_NS_ID, "present", true);
  63772. this.behaviorOverride = null;
  63773. this.cache = null;
  63774. this.common = null;
  63775. this.copies = null;
  63776. this.destination = null;
  63777. this.incrementalMerge = null;
  63778. this.layout = null;
  63779. this.output = null;
  63780. this.overprint = null;
  63781. this.pagination = null;
  63782. this.paginationOverride = null;
  63783. this.script = null;
  63784. this.validate = null;
  63785. this.xdp = null;
  63786. this.driver = new _xfa_object.XFAObjectArray();
  63787. this.labelPrinter = new _xfa_object.XFAObjectArray();
  63788. this.pcl = new _xfa_object.XFAObjectArray();
  63789. this.pdf = new _xfa_object.XFAObjectArray();
  63790. this.ps = new _xfa_object.XFAObjectArray();
  63791. this.submitUrl = new _xfa_object.XFAObjectArray();
  63792. this.webClient = new _xfa_object.XFAObjectArray();
  63793. this.zpl = new _xfa_object.XFAObjectArray();
  63794. }
  63795. }
  63796. class Print extends _xfa_object.Option01 {
  63797. constructor(attributes) {
  63798. super(CONFIG_NS_ID, "print");
  63799. }
  63800. }
  63801. class PrintHighQuality extends _xfa_object.Option01 {
  63802. constructor(attributes) {
  63803. super(CONFIG_NS_ID, "printHighQuality");
  63804. }
  63805. }
  63806. class PrintScaling extends _xfa_object.OptionObject {
  63807. constructor(attributes) {
  63808. super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]);
  63809. }
  63810. }
  63811. class PrinterName extends _xfa_object.StringObject {
  63812. constructor(attributes) {
  63813. super(CONFIG_NS_ID, "printerName");
  63814. }
  63815. }
  63816. class Producer extends _xfa_object.StringObject {
  63817. constructor(attributes) {
  63818. super(CONFIG_NS_ID, "producer");
  63819. }
  63820. }
  63821. class Ps extends _xfa_object.XFAObject {
  63822. constructor(attributes) {
  63823. super(CONFIG_NS_ID, "ps", true);
  63824. this.name = attributes.name || "";
  63825. this.batchOutput = null;
  63826. this.fontInfo = null;
  63827. this.jog = null;
  63828. this.mediumInfo = null;
  63829. this.outputBin = null;
  63830. this.staple = null;
  63831. this.xdc = null;
  63832. }
  63833. }
  63834. class Range extends _xfa_object.ContentObject {
  63835. constructor(attributes) {
  63836. super(CONFIG_NS_ID, "range");
  63837. }
  63838. [_xfa_object.$finalize]() {
  63839. 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 => {
  63840. if (range.length === 1) {
  63841. range.push(range[0]);
  63842. }
  63843. return range;
  63844. });
  63845. }
  63846. }
  63847. class Record extends _xfa_object.ContentObject {
  63848. constructor(attributes) {
  63849. super(CONFIG_NS_ID, "record");
  63850. }
  63851. [_xfa_object.$finalize]() {
  63852. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  63853. const n = parseInt(this[_xfa_object.$content], 10);
  63854. if (!isNaN(n) && n >= 0) {
  63855. this[_xfa_object.$content] = n;
  63856. }
  63857. }
  63858. }
  63859. class Relevant extends _xfa_object.ContentObject {
  63860. constructor(attributes) {
  63861. super(CONFIG_NS_ID, "relevant");
  63862. }
  63863. [_xfa_object.$finalize]() {
  63864. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/);
  63865. }
  63866. }
  63867. class Rename extends _xfa_object.ContentObject {
  63868. constructor(attributes) {
  63869. super(CONFIG_NS_ID, "rename");
  63870. }
  63871. [_xfa_object.$finalize]() {
  63872. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  63873. if (this[_xfa_object.$content].toLowerCase().startsWith("xml") || this[_xfa_object.$content].match(new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u"))) {
  63874. (0, _util.warn)("XFA - Rename: invalid XFA name");
  63875. }
  63876. }
  63877. }
  63878. class RenderPolicy extends _xfa_object.OptionObject {
  63879. constructor(attributes) {
  63880. super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]);
  63881. }
  63882. }
  63883. class RunScripts extends _xfa_object.OptionObject {
  63884. constructor(attributes) {
  63885. super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]);
  63886. }
  63887. }
  63888. class Script extends _xfa_object.XFAObject {
  63889. constructor(attributes) {
  63890. super(CONFIG_NS_ID, "script", true);
  63891. this.currentPage = null;
  63892. this.exclude = null;
  63893. this.runScripts = null;
  63894. }
  63895. }
  63896. class ScriptModel extends _xfa_object.OptionObject {
  63897. constructor(attributes) {
  63898. super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]);
  63899. }
  63900. }
  63901. class Severity extends _xfa_object.OptionObject {
  63902. constructor(attributes) {
  63903. super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]);
  63904. }
  63905. }
  63906. class SilentPrint extends _xfa_object.XFAObject {
  63907. constructor(attributes) {
  63908. super(CONFIG_NS_ID, "silentPrint", true);
  63909. this.addSilentPrint = null;
  63910. this.printerName = null;
  63911. }
  63912. }
  63913. class Staple extends _xfa_object.XFAObject {
  63914. constructor(attributes) {
  63915. super(CONFIG_NS_ID, "staple");
  63916. this.mode = (0, _utils.getStringOption)(attributes.mode, ["usePrinterSetting", "on", "off"]);
  63917. }
  63918. }
  63919. class StartNode extends _xfa_object.StringObject {
  63920. constructor(attributes) {
  63921. super(CONFIG_NS_ID, "startNode");
  63922. }
  63923. }
  63924. class StartPage extends _xfa_object.IntegerObject {
  63925. constructor(attributes) {
  63926. super(CONFIG_NS_ID, "startPage", 0, n => true);
  63927. }
  63928. }
  63929. class SubmitFormat extends _xfa_object.OptionObject {
  63930. constructor(attributes) {
  63931. super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]);
  63932. }
  63933. }
  63934. class SubmitUrl extends _xfa_object.StringObject {
  63935. constructor(attributes) {
  63936. super(CONFIG_NS_ID, "submitUrl");
  63937. }
  63938. }
  63939. class SubsetBelow extends _xfa_object.IntegerObject {
  63940. constructor(attributes) {
  63941. super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100);
  63942. }
  63943. }
  63944. class SuppressBanner extends _xfa_object.Option01 {
  63945. constructor(attributes) {
  63946. super(CONFIG_NS_ID, "suppressBanner");
  63947. }
  63948. }
  63949. class Tagged extends _xfa_object.Option01 {
  63950. constructor(attributes) {
  63951. super(CONFIG_NS_ID, "tagged");
  63952. }
  63953. }
  63954. class Template extends _xfa_object.XFAObject {
  63955. constructor(attributes) {
  63956. super(CONFIG_NS_ID, "template", true);
  63957. this.base = null;
  63958. this.relevant = null;
  63959. this.startPage = null;
  63960. this.uri = null;
  63961. this.xsl = null;
  63962. }
  63963. }
  63964. class Threshold extends _xfa_object.OptionObject {
  63965. constructor(attributes) {
  63966. super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]);
  63967. }
  63968. }
  63969. class To extends _xfa_object.OptionObject {
  63970. constructor(attributes) {
  63971. super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]);
  63972. }
  63973. }
  63974. class TemplateCache extends _xfa_object.XFAObject {
  63975. constructor(attributes) {
  63976. super(CONFIG_NS_ID, "templateCache");
  63977. this.maxEntries = (0, _utils.getInteger)({
  63978. data: attributes.maxEntries,
  63979. defaultValue: 5,
  63980. validate: n => n >= 0
  63981. });
  63982. }
  63983. }
  63984. class Trace extends _xfa_object.XFAObject {
  63985. constructor(attributes) {
  63986. super(CONFIG_NS_ID, "trace", true);
  63987. this.area = new _xfa_object.XFAObjectArray();
  63988. }
  63989. }
  63990. class Transform extends _xfa_object.XFAObject {
  63991. constructor(attributes) {
  63992. super(CONFIG_NS_ID, "transform", true);
  63993. this.groupParent = null;
  63994. this.ifEmpty = null;
  63995. this.nameAttr = null;
  63996. this.picture = null;
  63997. this.presence = null;
  63998. this.rename = null;
  63999. this.whitespace = null;
  64000. }
  64001. }
  64002. class Type extends _xfa_object.OptionObject {
  64003. constructor(attributes) {
  64004. super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]);
  64005. }
  64006. }
  64007. class Uri extends _xfa_object.StringObject {
  64008. constructor(attributes) {
  64009. super(CONFIG_NS_ID, "uri");
  64010. }
  64011. }
  64012. class Validate extends _xfa_object.OptionObject {
  64013. constructor(attributes) {
  64014. super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]);
  64015. }
  64016. }
  64017. class ValidateApprovalSignatures extends _xfa_object.ContentObject {
  64018. constructor(attributes) {
  64019. super(CONFIG_NS_ID, "validateApprovalSignatures");
  64020. }
  64021. [_xfa_object.$finalize]() {
  64022. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x));
  64023. }
  64024. }
  64025. class ValidationMessaging extends _xfa_object.OptionObject {
  64026. constructor(attributes) {
  64027. super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]);
  64028. }
  64029. }
  64030. class Version extends _xfa_object.OptionObject {
  64031. constructor(attributes) {
  64032. super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]);
  64033. }
  64034. }
  64035. class VersionControl extends _xfa_object.XFAObject {
  64036. constructor(attributes) {
  64037. super(CONFIG_NS_ID, "VersionControl");
  64038. this.outputBelow = (0, _utils.getStringOption)(attributes.outputBelow, ["warn", "error", "update"]);
  64039. this.sourceAbove = (0, _utils.getStringOption)(attributes.sourceAbove, ["warn", "error"]);
  64040. this.sourceBelow = (0, _utils.getStringOption)(attributes.sourceBelow, ["update", "maintain"]);
  64041. }
  64042. }
  64043. class ViewerPreferences extends _xfa_object.XFAObject {
  64044. constructor(attributes) {
  64045. super(CONFIG_NS_ID, "viewerPreferences", true);
  64046. this.ADBE_JSConsole = null;
  64047. this.ADBE_JSDebugger = null;
  64048. this.addViewerPreferences = null;
  64049. this.duplexOption = null;
  64050. this.enforce = null;
  64051. this.numberOfCopies = null;
  64052. this.pageRange = null;
  64053. this.pickTrayByPDFSize = null;
  64054. this.printScaling = null;
  64055. }
  64056. }
  64057. class WebClient extends _xfa_object.XFAObject {
  64058. constructor(attributes) {
  64059. super(CONFIG_NS_ID, "webClient", true);
  64060. this.name = attributes.name ? attributes.name.trim() : "";
  64061. this.fontInfo = null;
  64062. this.xdc = null;
  64063. }
  64064. }
  64065. class Whitespace extends _xfa_object.OptionObject {
  64066. constructor(attributes) {
  64067. super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]);
  64068. }
  64069. }
  64070. class Window extends _xfa_object.ContentObject {
  64071. constructor(attributes) {
  64072. super(CONFIG_NS_ID, "window");
  64073. }
  64074. [_xfa_object.$finalize]() {
  64075. const pair = this[_xfa_object.$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10));
  64076. if (pair.some(x => isNaN(x))) {
  64077. this[_xfa_object.$content] = [0, 0];
  64078. return;
  64079. }
  64080. if (pair.length === 1) {
  64081. pair.push(pair[0]);
  64082. }
  64083. this[_xfa_object.$content] = pair;
  64084. }
  64085. }
  64086. class Xdc extends _xfa_object.XFAObject {
  64087. constructor(attributes) {
  64088. super(CONFIG_NS_ID, "xdc", true);
  64089. this.uri = new _xfa_object.XFAObjectArray();
  64090. this.xsl = new _xfa_object.XFAObjectArray();
  64091. }
  64092. }
  64093. class Xdp extends _xfa_object.XFAObject {
  64094. constructor(attributes) {
  64095. super(CONFIG_NS_ID, "xdp", true);
  64096. this.packets = null;
  64097. }
  64098. }
  64099. class Xsl extends _xfa_object.XFAObject {
  64100. constructor(attributes) {
  64101. super(CONFIG_NS_ID, "xsl", true);
  64102. this.debug = null;
  64103. this.uri = null;
  64104. }
  64105. }
  64106. class Zpl extends _xfa_object.XFAObject {
  64107. constructor(attributes) {
  64108. super(CONFIG_NS_ID, "zpl", true);
  64109. this.name = attributes.name ? attributes.name.trim() : "";
  64110. this.batchOutput = null;
  64111. this.flipLabel = null;
  64112. this.fontInfo = null;
  64113. this.xdc = null;
  64114. }
  64115. }
  64116. class ConfigNamespace {
  64117. static [_namespaces.$buildXFAObject](name, attributes) {
  64118. if (ConfigNamespace.hasOwnProperty(name)) {
  64119. return ConfigNamespace[name](attributes);
  64120. }
  64121. return undefined;
  64122. }
  64123. static acrobat(attrs) {
  64124. return new Acrobat(attrs);
  64125. }
  64126. static acrobat7(attrs) {
  64127. return new Acrobat7(attrs);
  64128. }
  64129. static ADBE_JSConsole(attrs) {
  64130. return new ADBE_JSConsole(attrs);
  64131. }
  64132. static ADBE_JSDebugger(attrs) {
  64133. return new ADBE_JSDebugger(attrs);
  64134. }
  64135. static addSilentPrint(attrs) {
  64136. return new AddSilentPrint(attrs);
  64137. }
  64138. static addViewerPreferences(attrs) {
  64139. return new AddViewerPreferences(attrs);
  64140. }
  64141. static adjustData(attrs) {
  64142. return new AdjustData(attrs);
  64143. }
  64144. static adobeExtensionLevel(attrs) {
  64145. return new AdobeExtensionLevel(attrs);
  64146. }
  64147. static agent(attrs) {
  64148. return new Agent(attrs);
  64149. }
  64150. static alwaysEmbed(attrs) {
  64151. return new AlwaysEmbed(attrs);
  64152. }
  64153. static amd(attrs) {
  64154. return new Amd(attrs);
  64155. }
  64156. static area(attrs) {
  64157. return new Area(attrs);
  64158. }
  64159. static attributes(attrs) {
  64160. return new Attributes(attrs);
  64161. }
  64162. static autoSave(attrs) {
  64163. return new AutoSave(attrs);
  64164. }
  64165. static base(attrs) {
  64166. return new Base(attrs);
  64167. }
  64168. static batchOutput(attrs) {
  64169. return new BatchOutput(attrs);
  64170. }
  64171. static behaviorOverride(attrs) {
  64172. return new BehaviorOverride(attrs);
  64173. }
  64174. static cache(attrs) {
  64175. return new Cache(attrs);
  64176. }
  64177. static change(attrs) {
  64178. return new Change(attrs);
  64179. }
  64180. static common(attrs) {
  64181. return new Common(attrs);
  64182. }
  64183. static compress(attrs) {
  64184. return new Compress(attrs);
  64185. }
  64186. static compressLogicalStructure(attrs) {
  64187. return new CompressLogicalStructure(attrs);
  64188. }
  64189. static compressObjectStream(attrs) {
  64190. return new CompressObjectStream(attrs);
  64191. }
  64192. static compression(attrs) {
  64193. return new Compression(attrs);
  64194. }
  64195. static config(attrs) {
  64196. return new Config(attrs);
  64197. }
  64198. static conformance(attrs) {
  64199. return new Conformance(attrs);
  64200. }
  64201. static contentCopy(attrs) {
  64202. return new ContentCopy(attrs);
  64203. }
  64204. static copies(attrs) {
  64205. return new Copies(attrs);
  64206. }
  64207. static creator(attrs) {
  64208. return new Creator(attrs);
  64209. }
  64210. static currentPage(attrs) {
  64211. return new CurrentPage(attrs);
  64212. }
  64213. static data(attrs) {
  64214. return new Data(attrs);
  64215. }
  64216. static debug(attrs) {
  64217. return new Debug(attrs);
  64218. }
  64219. static defaultTypeface(attrs) {
  64220. return new DefaultTypeface(attrs);
  64221. }
  64222. static destination(attrs) {
  64223. return new Destination(attrs);
  64224. }
  64225. static documentAssembly(attrs) {
  64226. return new DocumentAssembly(attrs);
  64227. }
  64228. static driver(attrs) {
  64229. return new Driver(attrs);
  64230. }
  64231. static duplexOption(attrs) {
  64232. return new DuplexOption(attrs);
  64233. }
  64234. static dynamicRender(attrs) {
  64235. return new DynamicRender(attrs);
  64236. }
  64237. static embed(attrs) {
  64238. return new Embed(attrs);
  64239. }
  64240. static encrypt(attrs) {
  64241. return new Encrypt(attrs);
  64242. }
  64243. static encryption(attrs) {
  64244. return new Encryption(attrs);
  64245. }
  64246. static encryptionLevel(attrs) {
  64247. return new EncryptionLevel(attrs);
  64248. }
  64249. static enforce(attrs) {
  64250. return new Enforce(attrs);
  64251. }
  64252. static equate(attrs) {
  64253. return new Equate(attrs);
  64254. }
  64255. static equateRange(attrs) {
  64256. return new EquateRange(attrs);
  64257. }
  64258. static exclude(attrs) {
  64259. return new Exclude(attrs);
  64260. }
  64261. static excludeNS(attrs) {
  64262. return new ExcludeNS(attrs);
  64263. }
  64264. static flipLabel(attrs) {
  64265. return new FlipLabel(attrs);
  64266. }
  64267. static fontInfo(attrs) {
  64268. return new FontInfo(attrs);
  64269. }
  64270. static formFieldFilling(attrs) {
  64271. return new FormFieldFilling(attrs);
  64272. }
  64273. static groupParent(attrs) {
  64274. return new GroupParent(attrs);
  64275. }
  64276. static ifEmpty(attrs) {
  64277. return new IfEmpty(attrs);
  64278. }
  64279. static includeXDPContent(attrs) {
  64280. return new IncludeXDPContent(attrs);
  64281. }
  64282. static incrementalLoad(attrs) {
  64283. return new IncrementalLoad(attrs);
  64284. }
  64285. static incrementalMerge(attrs) {
  64286. return new IncrementalMerge(attrs);
  64287. }
  64288. static interactive(attrs) {
  64289. return new Interactive(attrs);
  64290. }
  64291. static jog(attrs) {
  64292. return new Jog(attrs);
  64293. }
  64294. static labelPrinter(attrs) {
  64295. return new LabelPrinter(attrs);
  64296. }
  64297. static layout(attrs) {
  64298. return new Layout(attrs);
  64299. }
  64300. static level(attrs) {
  64301. return new Level(attrs);
  64302. }
  64303. static linearized(attrs) {
  64304. return new Linearized(attrs);
  64305. }
  64306. static locale(attrs) {
  64307. return new Locale(attrs);
  64308. }
  64309. static localeSet(attrs) {
  64310. return new LocaleSet(attrs);
  64311. }
  64312. static log(attrs) {
  64313. return new Log(attrs);
  64314. }
  64315. static map(attrs) {
  64316. return new MapElement(attrs);
  64317. }
  64318. static mediumInfo(attrs) {
  64319. return new MediumInfo(attrs);
  64320. }
  64321. static message(attrs) {
  64322. return new Message(attrs);
  64323. }
  64324. static messaging(attrs) {
  64325. return new Messaging(attrs);
  64326. }
  64327. static mode(attrs) {
  64328. return new Mode(attrs);
  64329. }
  64330. static modifyAnnots(attrs) {
  64331. return new ModifyAnnots(attrs);
  64332. }
  64333. static msgId(attrs) {
  64334. return new MsgId(attrs);
  64335. }
  64336. static nameAttr(attrs) {
  64337. return new NameAttr(attrs);
  64338. }
  64339. static neverEmbed(attrs) {
  64340. return new NeverEmbed(attrs);
  64341. }
  64342. static numberOfCopies(attrs) {
  64343. return new NumberOfCopies(attrs);
  64344. }
  64345. static openAction(attrs) {
  64346. return new OpenAction(attrs);
  64347. }
  64348. static output(attrs) {
  64349. return new Output(attrs);
  64350. }
  64351. static outputBin(attrs) {
  64352. return new OutputBin(attrs);
  64353. }
  64354. static outputXSL(attrs) {
  64355. return new OutputXSL(attrs);
  64356. }
  64357. static overprint(attrs) {
  64358. return new Overprint(attrs);
  64359. }
  64360. static packets(attrs) {
  64361. return new Packets(attrs);
  64362. }
  64363. static pageOffset(attrs) {
  64364. return new PageOffset(attrs);
  64365. }
  64366. static pageRange(attrs) {
  64367. return new PageRange(attrs);
  64368. }
  64369. static pagination(attrs) {
  64370. return new Pagination(attrs);
  64371. }
  64372. static paginationOverride(attrs) {
  64373. return new PaginationOverride(attrs);
  64374. }
  64375. static part(attrs) {
  64376. return new Part(attrs);
  64377. }
  64378. static pcl(attrs) {
  64379. return new Pcl(attrs);
  64380. }
  64381. static pdf(attrs) {
  64382. return new Pdf(attrs);
  64383. }
  64384. static pdfa(attrs) {
  64385. return new Pdfa(attrs);
  64386. }
  64387. static permissions(attrs) {
  64388. return new Permissions(attrs);
  64389. }
  64390. static pickTrayByPDFSize(attrs) {
  64391. return new PickTrayByPDFSize(attrs);
  64392. }
  64393. static picture(attrs) {
  64394. return new Picture(attrs);
  64395. }
  64396. static plaintextMetadata(attrs) {
  64397. return new PlaintextMetadata(attrs);
  64398. }
  64399. static presence(attrs) {
  64400. return new Presence(attrs);
  64401. }
  64402. static present(attrs) {
  64403. return new Present(attrs);
  64404. }
  64405. static print(attrs) {
  64406. return new Print(attrs);
  64407. }
  64408. static printHighQuality(attrs) {
  64409. return new PrintHighQuality(attrs);
  64410. }
  64411. static printScaling(attrs) {
  64412. return new PrintScaling(attrs);
  64413. }
  64414. static printerName(attrs) {
  64415. return new PrinterName(attrs);
  64416. }
  64417. static producer(attrs) {
  64418. return new Producer(attrs);
  64419. }
  64420. static ps(attrs) {
  64421. return new Ps(attrs);
  64422. }
  64423. static range(attrs) {
  64424. return new Range(attrs);
  64425. }
  64426. static record(attrs) {
  64427. return new Record(attrs);
  64428. }
  64429. static relevant(attrs) {
  64430. return new Relevant(attrs);
  64431. }
  64432. static rename(attrs) {
  64433. return new Rename(attrs);
  64434. }
  64435. static renderPolicy(attrs) {
  64436. return new RenderPolicy(attrs);
  64437. }
  64438. static runScripts(attrs) {
  64439. return new RunScripts(attrs);
  64440. }
  64441. static script(attrs) {
  64442. return new Script(attrs);
  64443. }
  64444. static scriptModel(attrs) {
  64445. return new ScriptModel(attrs);
  64446. }
  64447. static severity(attrs) {
  64448. return new Severity(attrs);
  64449. }
  64450. static silentPrint(attrs) {
  64451. return new SilentPrint(attrs);
  64452. }
  64453. static staple(attrs) {
  64454. return new Staple(attrs);
  64455. }
  64456. static startNode(attrs) {
  64457. return new StartNode(attrs);
  64458. }
  64459. static startPage(attrs) {
  64460. return new StartPage(attrs);
  64461. }
  64462. static submitFormat(attrs) {
  64463. return new SubmitFormat(attrs);
  64464. }
  64465. static submitUrl(attrs) {
  64466. return new SubmitUrl(attrs);
  64467. }
  64468. static subsetBelow(attrs) {
  64469. return new SubsetBelow(attrs);
  64470. }
  64471. static suppressBanner(attrs) {
  64472. return new SuppressBanner(attrs);
  64473. }
  64474. static tagged(attrs) {
  64475. return new Tagged(attrs);
  64476. }
  64477. static template(attrs) {
  64478. return new Template(attrs);
  64479. }
  64480. static templateCache(attrs) {
  64481. return new TemplateCache(attrs);
  64482. }
  64483. static threshold(attrs) {
  64484. return new Threshold(attrs);
  64485. }
  64486. static to(attrs) {
  64487. return new To(attrs);
  64488. }
  64489. static trace(attrs) {
  64490. return new Trace(attrs);
  64491. }
  64492. static transform(attrs) {
  64493. return new Transform(attrs);
  64494. }
  64495. static type(attrs) {
  64496. return new Type(attrs);
  64497. }
  64498. static uri(attrs) {
  64499. return new Uri(attrs);
  64500. }
  64501. static validate(attrs) {
  64502. return new Validate(attrs);
  64503. }
  64504. static validateApprovalSignatures(attrs) {
  64505. return new ValidateApprovalSignatures(attrs);
  64506. }
  64507. static validationMessaging(attrs) {
  64508. return new ValidationMessaging(attrs);
  64509. }
  64510. static version(attrs) {
  64511. return new Version(attrs);
  64512. }
  64513. static versionControl(attrs) {
  64514. return new VersionControl(attrs);
  64515. }
  64516. static viewerPreferences(attrs) {
  64517. return new ViewerPreferences(attrs);
  64518. }
  64519. static webClient(attrs) {
  64520. return new WebClient(attrs);
  64521. }
  64522. static whitespace(attrs) {
  64523. return new Whitespace(attrs);
  64524. }
  64525. static window(attrs) {
  64526. return new Window(attrs);
  64527. }
  64528. static xdc(attrs) {
  64529. return new Xdc(attrs);
  64530. }
  64531. static xdp(attrs) {
  64532. return new Xdp(attrs);
  64533. }
  64534. static xsl(attrs) {
  64535. return new Xsl(attrs);
  64536. }
  64537. static zpl(attrs) {
  64538. return new Zpl(attrs);
  64539. }
  64540. }
  64541. exports.ConfigNamespace = ConfigNamespace;
  64542. /***/ }),
  64543. /* 217 */
  64544. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  64545. "use strict";
  64546. Object.defineProperty(exports, "__esModule", ({
  64547. value: true
  64548. }));
  64549. exports.ConnectionSetNamespace = void 0;
  64550. var _namespaces = __w_pdfjs_require__(204);
  64551. var _xfa_object = __w_pdfjs_require__(202);
  64552. const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id;
  64553. class ConnectionSet extends _xfa_object.XFAObject {
  64554. constructor(attributes) {
  64555. super(CONNECTION_SET_NS_ID, "connectionSet", true);
  64556. this.wsdlConnection = new _xfa_object.XFAObjectArray();
  64557. this.xmlConnection = new _xfa_object.XFAObjectArray();
  64558. this.xsdConnection = new _xfa_object.XFAObjectArray();
  64559. }
  64560. }
  64561. class EffectiveInputPolicy extends _xfa_object.XFAObject {
  64562. constructor(attributes) {
  64563. super(CONNECTION_SET_NS_ID, "effectiveInputPolicy");
  64564. this.id = attributes.id || "";
  64565. this.name = attributes.name || "";
  64566. this.use = attributes.use || "";
  64567. this.usehref = attributes.usehref || "";
  64568. }
  64569. }
  64570. class EffectiveOutputPolicy extends _xfa_object.XFAObject {
  64571. constructor(attributes) {
  64572. super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy");
  64573. this.id = attributes.id || "";
  64574. this.name = attributes.name || "";
  64575. this.use = attributes.use || "";
  64576. this.usehref = attributes.usehref || "";
  64577. }
  64578. }
  64579. class Operation extends _xfa_object.StringObject {
  64580. constructor(attributes) {
  64581. super(CONNECTION_SET_NS_ID, "operation");
  64582. this.id = attributes.id || "";
  64583. this.input = attributes.input || "";
  64584. this.name = attributes.name || "";
  64585. this.output = attributes.output || "";
  64586. this.use = attributes.use || "";
  64587. this.usehref = attributes.usehref || "";
  64588. }
  64589. }
  64590. class RootElement extends _xfa_object.StringObject {
  64591. constructor(attributes) {
  64592. super(CONNECTION_SET_NS_ID, "rootElement");
  64593. this.id = attributes.id || "";
  64594. this.name = attributes.name || "";
  64595. this.use = attributes.use || "";
  64596. this.usehref = attributes.usehref || "";
  64597. }
  64598. }
  64599. class SoapAction extends _xfa_object.StringObject {
  64600. constructor(attributes) {
  64601. super(CONNECTION_SET_NS_ID, "soapAction");
  64602. this.id = attributes.id || "";
  64603. this.name = attributes.name || "";
  64604. this.use = attributes.use || "";
  64605. this.usehref = attributes.usehref || "";
  64606. }
  64607. }
  64608. class SoapAddress extends _xfa_object.StringObject {
  64609. constructor(attributes) {
  64610. super(CONNECTION_SET_NS_ID, "soapAddress");
  64611. this.id = attributes.id || "";
  64612. this.name = attributes.name || "";
  64613. this.use = attributes.use || "";
  64614. this.usehref = attributes.usehref || "";
  64615. }
  64616. }
  64617. class Uri extends _xfa_object.StringObject {
  64618. constructor(attributes) {
  64619. super(CONNECTION_SET_NS_ID, "uri");
  64620. this.id = attributes.id || "";
  64621. this.name = attributes.name || "";
  64622. this.use = attributes.use || "";
  64623. this.usehref = attributes.usehref || "";
  64624. }
  64625. }
  64626. class WsdlAddress extends _xfa_object.StringObject {
  64627. constructor(attributes) {
  64628. super(CONNECTION_SET_NS_ID, "wsdlAddress");
  64629. this.id = attributes.id || "";
  64630. this.name = attributes.name || "";
  64631. this.use = attributes.use || "";
  64632. this.usehref = attributes.usehref || "";
  64633. }
  64634. }
  64635. class WsdlConnection extends _xfa_object.XFAObject {
  64636. constructor(attributes) {
  64637. super(CONNECTION_SET_NS_ID, "wsdlConnection", true);
  64638. this.dataDescription = attributes.dataDescription || "";
  64639. this.name = attributes.name || "";
  64640. this.effectiveInputPolicy = null;
  64641. this.effectiveOutputPolicy = null;
  64642. this.operation = null;
  64643. this.soapAction = null;
  64644. this.soapAddress = null;
  64645. this.wsdlAddress = null;
  64646. }
  64647. }
  64648. class XmlConnection extends _xfa_object.XFAObject {
  64649. constructor(attributes) {
  64650. super(CONNECTION_SET_NS_ID, "xmlConnection", true);
  64651. this.dataDescription = attributes.dataDescription || "";
  64652. this.name = attributes.name || "";
  64653. this.uri = null;
  64654. }
  64655. }
  64656. class XsdConnection extends _xfa_object.XFAObject {
  64657. constructor(attributes) {
  64658. super(CONNECTION_SET_NS_ID, "xsdConnection", true);
  64659. this.dataDescription = attributes.dataDescription || "";
  64660. this.name = attributes.name || "";
  64661. this.rootElement = null;
  64662. this.uri = null;
  64663. }
  64664. }
  64665. class ConnectionSetNamespace {
  64666. static [_namespaces.$buildXFAObject](name, attributes) {
  64667. if (ConnectionSetNamespace.hasOwnProperty(name)) {
  64668. return ConnectionSetNamespace[name](attributes);
  64669. }
  64670. return undefined;
  64671. }
  64672. static connectionSet(attrs) {
  64673. return new ConnectionSet(attrs);
  64674. }
  64675. static effectiveInputPolicy(attrs) {
  64676. return new EffectiveInputPolicy(attrs);
  64677. }
  64678. static effectiveOutputPolicy(attrs) {
  64679. return new EffectiveOutputPolicy(attrs);
  64680. }
  64681. static operation(attrs) {
  64682. return new Operation(attrs);
  64683. }
  64684. static rootElement(attrs) {
  64685. return new RootElement(attrs);
  64686. }
  64687. static soapAction(attrs) {
  64688. return new SoapAction(attrs);
  64689. }
  64690. static soapAddress(attrs) {
  64691. return new SoapAddress(attrs);
  64692. }
  64693. static uri(attrs) {
  64694. return new Uri(attrs);
  64695. }
  64696. static wsdlAddress(attrs) {
  64697. return new WsdlAddress(attrs);
  64698. }
  64699. static wsdlConnection(attrs) {
  64700. return new WsdlConnection(attrs);
  64701. }
  64702. static xmlConnection(attrs) {
  64703. return new XmlConnection(attrs);
  64704. }
  64705. static xsdConnection(attrs) {
  64706. return new XsdConnection(attrs);
  64707. }
  64708. }
  64709. exports.ConnectionSetNamespace = ConnectionSetNamespace;
  64710. /***/ }),
  64711. /* 218 */
  64712. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  64713. "use strict";
  64714. Object.defineProperty(exports, "__esModule", ({
  64715. value: true
  64716. }));
  64717. exports.DatasetsNamespace = void 0;
  64718. var _xfa_object = __w_pdfjs_require__(202);
  64719. var _namespaces = __w_pdfjs_require__(204);
  64720. const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id;
  64721. class Data extends _xfa_object.XmlObject {
  64722. constructor(attributes) {
  64723. super(DATASETS_NS_ID, "data", attributes);
  64724. }
  64725. [_xfa_object.$isNsAgnostic]() {
  64726. return true;
  64727. }
  64728. }
  64729. class Datasets extends _xfa_object.XFAObject {
  64730. constructor(attributes) {
  64731. super(DATASETS_NS_ID, "datasets", true);
  64732. this.data = null;
  64733. this.Signature = null;
  64734. }
  64735. [_xfa_object.$onChild](child) {
  64736. const name = child[_xfa_object.$nodeName];
  64737. if (name === "data" && child[_xfa_object.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.signature.id) {
  64738. this[name] = child;
  64739. }
  64740. this[_xfa_object.$appendChild](child);
  64741. }
  64742. }
  64743. class DatasetsNamespace {
  64744. static [_namespaces.$buildXFAObject](name, attributes) {
  64745. if (DatasetsNamespace.hasOwnProperty(name)) {
  64746. return DatasetsNamespace[name](attributes);
  64747. }
  64748. return undefined;
  64749. }
  64750. static datasets(attributes) {
  64751. return new Datasets(attributes);
  64752. }
  64753. static data(attributes) {
  64754. return new Data(attributes);
  64755. }
  64756. }
  64757. exports.DatasetsNamespace = DatasetsNamespace;
  64758. /***/ }),
  64759. /* 219 */
  64760. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  64761. "use strict";
  64762. Object.defineProperty(exports, "__esModule", ({
  64763. value: true
  64764. }));
  64765. exports.LocaleSetNamespace = void 0;
  64766. var _namespaces = __w_pdfjs_require__(204);
  64767. var _xfa_object = __w_pdfjs_require__(202);
  64768. var _utils = __w_pdfjs_require__(203);
  64769. const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id;
  64770. class CalendarSymbols extends _xfa_object.XFAObject {
  64771. constructor(attributes) {
  64772. super(LOCALE_SET_NS_ID, "calendarSymbols", true);
  64773. this.name = "gregorian";
  64774. this.dayNames = new _xfa_object.XFAObjectArray(2);
  64775. this.eraNames = null;
  64776. this.meridiemNames = null;
  64777. this.monthNames = new _xfa_object.XFAObjectArray(2);
  64778. }
  64779. }
  64780. class CurrencySymbol extends _xfa_object.StringObject {
  64781. constructor(attributes) {
  64782. super(LOCALE_SET_NS_ID, "currencySymbol");
  64783. this.name = (0, _utils.getStringOption)(attributes.name, ["symbol", "isoname", "decimal"]);
  64784. }
  64785. }
  64786. class CurrencySymbols extends _xfa_object.XFAObject {
  64787. constructor(attributes) {
  64788. super(LOCALE_SET_NS_ID, "currencySymbols", true);
  64789. this.currencySymbol = new _xfa_object.XFAObjectArray(3);
  64790. }
  64791. }
  64792. class DatePattern extends _xfa_object.StringObject {
  64793. constructor(attributes) {
  64794. super(LOCALE_SET_NS_ID, "datePattern");
  64795. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  64796. }
  64797. }
  64798. class DatePatterns extends _xfa_object.XFAObject {
  64799. constructor(attributes) {
  64800. super(LOCALE_SET_NS_ID, "datePatterns", true);
  64801. this.datePattern = new _xfa_object.XFAObjectArray(4);
  64802. }
  64803. }
  64804. class DateTimeSymbols extends _xfa_object.ContentObject {
  64805. constructor(attributes) {
  64806. super(LOCALE_SET_NS_ID, "dateTimeSymbols");
  64807. }
  64808. }
  64809. class Day extends _xfa_object.StringObject {
  64810. constructor(attributes) {
  64811. super(LOCALE_SET_NS_ID, "day");
  64812. }
  64813. }
  64814. class DayNames extends _xfa_object.XFAObject {
  64815. constructor(attributes) {
  64816. super(LOCALE_SET_NS_ID, "dayNames", true);
  64817. this.abbr = (0, _utils.getInteger)({
  64818. data: attributes.abbr,
  64819. defaultValue: 0,
  64820. validate: x => x === 1
  64821. });
  64822. this.day = new _xfa_object.XFAObjectArray(7);
  64823. }
  64824. }
  64825. class Era extends _xfa_object.StringObject {
  64826. constructor(attributes) {
  64827. super(LOCALE_SET_NS_ID, "era");
  64828. }
  64829. }
  64830. class EraNames extends _xfa_object.XFAObject {
  64831. constructor(attributes) {
  64832. super(LOCALE_SET_NS_ID, "eraNames", true);
  64833. this.era = new _xfa_object.XFAObjectArray(2);
  64834. }
  64835. }
  64836. class Locale extends _xfa_object.XFAObject {
  64837. constructor(attributes) {
  64838. super(LOCALE_SET_NS_ID, "locale", true);
  64839. this.desc = attributes.desc || "";
  64840. this.name = "isoname";
  64841. this.calendarSymbols = null;
  64842. this.currencySymbols = null;
  64843. this.datePatterns = null;
  64844. this.dateTimeSymbols = null;
  64845. this.numberPatterns = null;
  64846. this.numberSymbols = null;
  64847. this.timePatterns = null;
  64848. this.typeFaces = null;
  64849. }
  64850. }
  64851. class LocaleSet extends _xfa_object.XFAObject {
  64852. constructor(attributes) {
  64853. super(LOCALE_SET_NS_ID, "localeSet", true);
  64854. this.locale = new _xfa_object.XFAObjectArray();
  64855. }
  64856. }
  64857. class Meridiem extends _xfa_object.StringObject {
  64858. constructor(attributes) {
  64859. super(LOCALE_SET_NS_ID, "meridiem");
  64860. }
  64861. }
  64862. class MeridiemNames extends _xfa_object.XFAObject {
  64863. constructor(attributes) {
  64864. super(LOCALE_SET_NS_ID, "meridiemNames", true);
  64865. this.meridiem = new _xfa_object.XFAObjectArray(2);
  64866. }
  64867. }
  64868. class Month extends _xfa_object.StringObject {
  64869. constructor(attributes) {
  64870. super(LOCALE_SET_NS_ID, "month");
  64871. }
  64872. }
  64873. class MonthNames extends _xfa_object.XFAObject {
  64874. constructor(attributes) {
  64875. super(LOCALE_SET_NS_ID, "monthNames", true);
  64876. this.abbr = (0, _utils.getInteger)({
  64877. data: attributes.abbr,
  64878. defaultValue: 0,
  64879. validate: x => x === 1
  64880. });
  64881. this.month = new _xfa_object.XFAObjectArray(12);
  64882. }
  64883. }
  64884. class NumberPattern extends _xfa_object.StringObject {
  64885. constructor(attributes) {
  64886. super(LOCALE_SET_NS_ID, "numberPattern");
  64887. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  64888. }
  64889. }
  64890. class NumberPatterns extends _xfa_object.XFAObject {
  64891. constructor(attributes) {
  64892. super(LOCALE_SET_NS_ID, "numberPatterns", true);
  64893. this.numberPattern = new _xfa_object.XFAObjectArray(4);
  64894. }
  64895. }
  64896. class NumberSymbol extends _xfa_object.StringObject {
  64897. constructor(attributes) {
  64898. super(LOCALE_SET_NS_ID, "numberSymbol");
  64899. this.name = (0, _utils.getStringOption)(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]);
  64900. }
  64901. }
  64902. class NumberSymbols extends _xfa_object.XFAObject {
  64903. constructor(attributes) {
  64904. super(LOCALE_SET_NS_ID, "numberSymbols", true);
  64905. this.numberSymbol = new _xfa_object.XFAObjectArray(5);
  64906. }
  64907. }
  64908. class TimePattern extends _xfa_object.StringObject {
  64909. constructor(attributes) {
  64910. super(LOCALE_SET_NS_ID, "timePattern");
  64911. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  64912. }
  64913. }
  64914. class TimePatterns extends _xfa_object.XFAObject {
  64915. constructor(attributes) {
  64916. super(LOCALE_SET_NS_ID, "timePatterns", true);
  64917. this.timePattern = new _xfa_object.XFAObjectArray(4);
  64918. }
  64919. }
  64920. class TypeFace extends _xfa_object.XFAObject {
  64921. constructor(attributes) {
  64922. super(LOCALE_SET_NS_ID, "typeFace", true);
  64923. this.name = attributes.name | "";
  64924. }
  64925. }
  64926. class TypeFaces extends _xfa_object.XFAObject {
  64927. constructor(attributes) {
  64928. super(LOCALE_SET_NS_ID, "typeFaces", true);
  64929. this.typeFace = new _xfa_object.XFAObjectArray();
  64930. }
  64931. }
  64932. class LocaleSetNamespace {
  64933. static [_namespaces.$buildXFAObject](name, attributes) {
  64934. if (LocaleSetNamespace.hasOwnProperty(name)) {
  64935. return LocaleSetNamespace[name](attributes);
  64936. }
  64937. return undefined;
  64938. }
  64939. static calendarSymbols(attrs) {
  64940. return new CalendarSymbols(attrs);
  64941. }
  64942. static currencySymbol(attrs) {
  64943. return new CurrencySymbol(attrs);
  64944. }
  64945. static currencySymbols(attrs) {
  64946. return new CurrencySymbols(attrs);
  64947. }
  64948. static datePattern(attrs) {
  64949. return new DatePattern(attrs);
  64950. }
  64951. static datePatterns(attrs) {
  64952. return new DatePatterns(attrs);
  64953. }
  64954. static dateTimeSymbols(attrs) {
  64955. return new DateTimeSymbols(attrs);
  64956. }
  64957. static day(attrs) {
  64958. return new Day(attrs);
  64959. }
  64960. static dayNames(attrs) {
  64961. return new DayNames(attrs);
  64962. }
  64963. static era(attrs) {
  64964. return new Era(attrs);
  64965. }
  64966. static eraNames(attrs) {
  64967. return new EraNames(attrs);
  64968. }
  64969. static locale(attrs) {
  64970. return new Locale(attrs);
  64971. }
  64972. static localeSet(attrs) {
  64973. return new LocaleSet(attrs);
  64974. }
  64975. static meridiem(attrs) {
  64976. return new Meridiem(attrs);
  64977. }
  64978. static meridiemNames(attrs) {
  64979. return new MeridiemNames(attrs);
  64980. }
  64981. static month(attrs) {
  64982. return new Month(attrs);
  64983. }
  64984. static monthNames(attrs) {
  64985. return new MonthNames(attrs);
  64986. }
  64987. static numberPattern(attrs) {
  64988. return new NumberPattern(attrs);
  64989. }
  64990. static numberPatterns(attrs) {
  64991. return new NumberPatterns(attrs);
  64992. }
  64993. static numberSymbol(attrs) {
  64994. return new NumberSymbol(attrs);
  64995. }
  64996. static numberSymbols(attrs) {
  64997. return new NumberSymbols(attrs);
  64998. }
  64999. static timePattern(attrs) {
  65000. return new TimePattern(attrs);
  65001. }
  65002. static timePatterns(attrs) {
  65003. return new TimePatterns(attrs);
  65004. }
  65005. static typeFace(attrs) {
  65006. return new TypeFace(attrs);
  65007. }
  65008. static typeFaces(attrs) {
  65009. return new TypeFaces(attrs);
  65010. }
  65011. }
  65012. exports.LocaleSetNamespace = LocaleSetNamespace;
  65013. /***/ }),
  65014. /* 220 */
  65015. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65016. "use strict";
  65017. Object.defineProperty(exports, "__esModule", ({
  65018. value: true
  65019. }));
  65020. exports.SignatureNamespace = void 0;
  65021. var _namespaces = __w_pdfjs_require__(204);
  65022. var _xfa_object = __w_pdfjs_require__(202);
  65023. const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id;
  65024. class Signature extends _xfa_object.XFAObject {
  65025. constructor(attributes) {
  65026. super(SIGNATURE_NS_ID, "signature", true);
  65027. }
  65028. }
  65029. class SignatureNamespace {
  65030. static [_namespaces.$buildXFAObject](name, attributes) {
  65031. if (SignatureNamespace.hasOwnProperty(name)) {
  65032. return SignatureNamespace[name](attributes);
  65033. }
  65034. return undefined;
  65035. }
  65036. static signature(attributes) {
  65037. return new Signature(attributes);
  65038. }
  65039. }
  65040. exports.SignatureNamespace = SignatureNamespace;
  65041. /***/ }),
  65042. /* 221 */
  65043. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65044. "use strict";
  65045. Object.defineProperty(exports, "__esModule", ({
  65046. value: true
  65047. }));
  65048. exports.StylesheetNamespace = void 0;
  65049. var _namespaces = __w_pdfjs_require__(204);
  65050. var _xfa_object = __w_pdfjs_require__(202);
  65051. const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id;
  65052. class Stylesheet extends _xfa_object.XFAObject {
  65053. constructor(attributes) {
  65054. super(STYLESHEET_NS_ID, "stylesheet", true);
  65055. }
  65056. }
  65057. class StylesheetNamespace {
  65058. static [_namespaces.$buildXFAObject](name, attributes) {
  65059. if (StylesheetNamespace.hasOwnProperty(name)) {
  65060. return StylesheetNamespace[name](attributes);
  65061. }
  65062. return undefined;
  65063. }
  65064. static stylesheet(attributes) {
  65065. return new Stylesheet(attributes);
  65066. }
  65067. }
  65068. exports.StylesheetNamespace = StylesheetNamespace;
  65069. /***/ }),
  65070. /* 222 */
  65071. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65072. "use strict";
  65073. Object.defineProperty(exports, "__esModule", ({
  65074. value: true
  65075. }));
  65076. exports.XdpNamespace = void 0;
  65077. var _namespaces = __w_pdfjs_require__(204);
  65078. var _xfa_object = __w_pdfjs_require__(202);
  65079. const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id;
  65080. class Xdp extends _xfa_object.XFAObject {
  65081. constructor(attributes) {
  65082. super(XDP_NS_ID, "xdp", true);
  65083. this.uuid = attributes.uuid || "";
  65084. this.timeStamp = attributes.timeStamp || "";
  65085. this.config = null;
  65086. this.connectionSet = null;
  65087. this.datasets = null;
  65088. this.localeSet = null;
  65089. this.stylesheet = new _xfa_object.XFAObjectArray();
  65090. this.template = null;
  65091. }
  65092. [_xfa_object.$onChildCheck](child) {
  65093. const ns = _namespaces.NamespaceIds[child[_xfa_object.$nodeName]];
  65094. return ns && child[_xfa_object.$namespaceId] === ns.id;
  65095. }
  65096. }
  65097. class XdpNamespace {
  65098. static [_namespaces.$buildXFAObject](name, attributes) {
  65099. if (XdpNamespace.hasOwnProperty(name)) {
  65100. return XdpNamespace[name](attributes);
  65101. }
  65102. return undefined;
  65103. }
  65104. static xdp(attributes) {
  65105. return new Xdp(attributes);
  65106. }
  65107. }
  65108. exports.XdpNamespace = XdpNamespace;
  65109. /***/ }),
  65110. /* 223 */
  65111. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65112. "use strict";
  65113. Object.defineProperty(exports, "__esModule", ({
  65114. value: true
  65115. }));
  65116. exports.XhtmlNamespace = void 0;
  65117. var _xfa_object = __w_pdfjs_require__(202);
  65118. var _namespaces = __w_pdfjs_require__(204);
  65119. var _html_utils = __w_pdfjs_require__(209);
  65120. var _utils = __w_pdfjs_require__(203);
  65121. const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id;
  65122. const $richText = Symbol();
  65123. 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"]);
  65124. 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) => {
  65125. value = original.fontSize = (0, _utils.getMeasurement)(value);
  65126. return (0, _html_utils.measureToString)(0.99 * value);
  65127. }], ["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))]]);
  65128. const spacesRegExp = /\s+/g;
  65129. const crlfRegExp = /[\r\n]+/g;
  65130. const crlfForRichTextRegExp = /\r\n?/g;
  65131. function mapStyle(styleStr, node, richText) {
  65132. const style = Object.create(null);
  65133. if (!styleStr) {
  65134. return style;
  65135. }
  65136. const original = Object.create(null);
  65137. for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) {
  65138. const mapping = StyleMapping.get(key);
  65139. if (mapping === "") {
  65140. continue;
  65141. }
  65142. let newValue = value;
  65143. if (mapping) {
  65144. if (typeof mapping === "string") {
  65145. newValue = mapping;
  65146. } else {
  65147. newValue = mapping(value, original);
  65148. }
  65149. }
  65150. if (key.endsWith("scale")) {
  65151. if (style.transform) {
  65152. style.transform = `${style[key]} ${newValue}`;
  65153. } else {
  65154. style.transform = newValue;
  65155. }
  65156. } else {
  65157. style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue;
  65158. }
  65159. }
  65160. if (style.fontFamily) {
  65161. (0, _html_utils.setFontFamily)({
  65162. typeface: style.fontFamily,
  65163. weight: style.fontWeight || "normal",
  65164. posture: style.fontStyle || "normal",
  65165. size: original.fontSize || 0
  65166. }, node, node[_xfa_object.$globalData].fontFinder, style);
  65167. }
  65168. if (richText && style.verticalAlign && style.verticalAlign !== "0px" && style.fontSize) {
  65169. const SUB_SUPER_SCRIPT_FACTOR = 0.583;
  65170. const VERTICAL_FACTOR = 0.333;
  65171. const fontSize = (0, _utils.getMeasurement)(style.fontSize);
  65172. style.fontSize = (0, _html_utils.measureToString)(fontSize * SUB_SUPER_SCRIPT_FACTOR);
  65173. style.verticalAlign = (0, _html_utils.measureToString)(Math.sign((0, _utils.getMeasurement)(style.verticalAlign)) * fontSize * VERTICAL_FACTOR);
  65174. }
  65175. if (richText && style.fontSize) {
  65176. style.fontSize = `calc(${style.fontSize} * var(--scale-factor))`;
  65177. }
  65178. (0, _html_utils.fixTextIndent)(style);
  65179. return style;
  65180. }
  65181. function checkStyle(node) {
  65182. if (!node.style) {
  65183. return "";
  65184. }
  65185. return node.style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(_ref => {
  65186. let [key, value] = _ref;
  65187. if (key === "font-family") {
  65188. node[_xfa_object.$globalData].usedTypefaces.add(value);
  65189. }
  65190. return VALID_STYLES.has(key);
  65191. }).map(kv => kv.join(":")).join(";");
  65192. }
  65193. const NoWhites = new Set(["body", "html"]);
  65194. class XhtmlObject extends _xfa_object.XmlObject {
  65195. constructor(attributes, name) {
  65196. super(XHTML_NS_ID, name);
  65197. this[$richText] = false;
  65198. this.style = attributes.style || "";
  65199. }
  65200. [_xfa_object.$clean](builder) {
  65201. super[_xfa_object.$clean](builder);
  65202. this.style = checkStyle(this);
  65203. }
  65204. [_xfa_object.$acceptWhitespace]() {
  65205. return !NoWhites.has(this[_xfa_object.$nodeName]);
  65206. }
  65207. [_xfa_object.$onText](str) {
  65208. let richText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  65209. if (!richText) {
  65210. str = str.replace(crlfRegExp, "");
  65211. if (!this.style.includes("xfa-spacerun:yes")) {
  65212. str = str.replace(spacesRegExp, " ");
  65213. }
  65214. } else {
  65215. this[$richText] = true;
  65216. }
  65217. if (str) {
  65218. this[_xfa_object.$content] += str;
  65219. }
  65220. }
  65221. [_xfa_object.$pushGlyphs](measure) {
  65222. let mustPop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  65223. const xfaFont = Object.create(null);
  65224. const margin = {
  65225. top: NaN,
  65226. bottom: NaN,
  65227. left: NaN,
  65228. right: NaN
  65229. };
  65230. let lineHeight = null;
  65231. for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) {
  65232. switch (key) {
  65233. case "font-family":
  65234. xfaFont.typeface = (0, _utils.stripQuotes)(value);
  65235. break;
  65236. case "font-size":
  65237. xfaFont.size = (0, _utils.getMeasurement)(value);
  65238. break;
  65239. case "font-weight":
  65240. xfaFont.weight = value;
  65241. break;
  65242. case "font-style":
  65243. xfaFont.posture = value;
  65244. break;
  65245. case "letter-spacing":
  65246. xfaFont.letterSpacing = (0, _utils.getMeasurement)(value);
  65247. break;
  65248. case "margin":
  65249. const values = value.split(/ \t/).map(x => (0, _utils.getMeasurement)(x));
  65250. switch (values.length) {
  65251. case 1:
  65252. margin.top = margin.bottom = margin.left = margin.right = values[0];
  65253. break;
  65254. case 2:
  65255. margin.top = margin.bottom = values[0];
  65256. margin.left = margin.right = values[1];
  65257. break;
  65258. case 3:
  65259. margin.top = values[0];
  65260. margin.bottom = values[2];
  65261. margin.left = margin.right = values[1];
  65262. break;
  65263. case 4:
  65264. margin.top = values[0];
  65265. margin.left = values[1];
  65266. margin.bottom = values[2];
  65267. margin.right = values[3];
  65268. break;
  65269. }
  65270. break;
  65271. case "margin-top":
  65272. margin.top = (0, _utils.getMeasurement)(value);
  65273. break;
  65274. case "margin-bottom":
  65275. margin.bottom = (0, _utils.getMeasurement)(value);
  65276. break;
  65277. case "margin-left":
  65278. margin.left = (0, _utils.getMeasurement)(value);
  65279. break;
  65280. case "margin-right":
  65281. margin.right = (0, _utils.getMeasurement)(value);
  65282. break;
  65283. case "line-height":
  65284. lineHeight = (0, _utils.getMeasurement)(value);
  65285. break;
  65286. }
  65287. }
  65288. measure.pushData(xfaFont, margin, lineHeight);
  65289. if (this[_xfa_object.$content]) {
  65290. measure.addString(this[_xfa_object.$content]);
  65291. } else {
  65292. for (const child of this[_xfa_object.$getChildren]()) {
  65293. if (child[_xfa_object.$nodeName] === "#text") {
  65294. measure.addString(child[_xfa_object.$content]);
  65295. continue;
  65296. }
  65297. child[_xfa_object.$pushGlyphs](measure);
  65298. }
  65299. }
  65300. if (mustPop) {
  65301. measure.popFont();
  65302. }
  65303. }
  65304. [_xfa_object.$toHTML](availableSpace) {
  65305. const children = [];
  65306. this[_xfa_object.$extra] = {
  65307. children
  65308. };
  65309. this[_xfa_object.$childrenToHTML]({});
  65310. if (children.length === 0 && !this[_xfa_object.$content]) {
  65311. return _utils.HTMLResult.EMPTY;
  65312. }
  65313. let value;
  65314. if (this[$richText]) {
  65315. value = this[_xfa_object.$content] ? this[_xfa_object.$content].replace(crlfForRichTextRegExp, "\n") : undefined;
  65316. } else {
  65317. value = this[_xfa_object.$content] || undefined;
  65318. }
  65319. return _utils.HTMLResult.success({
  65320. name: this[_xfa_object.$nodeName],
  65321. attributes: {
  65322. href: this.href,
  65323. style: mapStyle(this.style, this, this[$richText])
  65324. },
  65325. children,
  65326. value
  65327. });
  65328. }
  65329. }
  65330. class A extends XhtmlObject {
  65331. constructor(attributes) {
  65332. super(attributes, "a");
  65333. this.href = (0, _html_utils.fixURL)(attributes.href) || "";
  65334. }
  65335. }
  65336. class B extends XhtmlObject {
  65337. constructor(attributes) {
  65338. super(attributes, "b");
  65339. }
  65340. [_xfa_object.$pushGlyphs](measure) {
  65341. measure.pushFont({
  65342. weight: "bold"
  65343. });
  65344. super[_xfa_object.$pushGlyphs](measure);
  65345. measure.popFont();
  65346. }
  65347. }
  65348. class Body extends XhtmlObject {
  65349. constructor(attributes) {
  65350. super(attributes, "body");
  65351. }
  65352. [_xfa_object.$toHTML](availableSpace) {
  65353. const res = super[_xfa_object.$toHTML](availableSpace);
  65354. const {
  65355. html
  65356. } = res;
  65357. if (!html) {
  65358. return _utils.HTMLResult.EMPTY;
  65359. }
  65360. html.name = "div";
  65361. html.attributes.class = ["xfaRich"];
  65362. return res;
  65363. }
  65364. }
  65365. class Br extends XhtmlObject {
  65366. constructor(attributes) {
  65367. super(attributes, "br");
  65368. }
  65369. [_xfa_object.$text]() {
  65370. return "\n";
  65371. }
  65372. [_xfa_object.$pushGlyphs](measure) {
  65373. measure.addString("\n");
  65374. }
  65375. [_xfa_object.$toHTML](availableSpace) {
  65376. return _utils.HTMLResult.success({
  65377. name: "br"
  65378. });
  65379. }
  65380. }
  65381. class Html extends XhtmlObject {
  65382. constructor(attributes) {
  65383. super(attributes, "html");
  65384. }
  65385. [_xfa_object.$toHTML](availableSpace) {
  65386. const children = [];
  65387. this[_xfa_object.$extra] = {
  65388. children
  65389. };
  65390. this[_xfa_object.$childrenToHTML]({});
  65391. if (children.length === 0) {
  65392. return _utils.HTMLResult.success({
  65393. name: "div",
  65394. attributes: {
  65395. class: ["xfaRich"],
  65396. style: {}
  65397. },
  65398. value: this[_xfa_object.$content] || ""
  65399. });
  65400. }
  65401. if (children.length === 1) {
  65402. const child = children[0];
  65403. if (child.attributes && child.attributes.class.includes("xfaRich")) {
  65404. return _utils.HTMLResult.success(child);
  65405. }
  65406. }
  65407. return _utils.HTMLResult.success({
  65408. name: "div",
  65409. attributes: {
  65410. class: ["xfaRich"],
  65411. style: {}
  65412. },
  65413. children
  65414. });
  65415. }
  65416. }
  65417. class I extends XhtmlObject {
  65418. constructor(attributes) {
  65419. super(attributes, "i");
  65420. }
  65421. [_xfa_object.$pushGlyphs](measure) {
  65422. measure.pushFont({
  65423. posture: "italic"
  65424. });
  65425. super[_xfa_object.$pushGlyphs](measure);
  65426. measure.popFont();
  65427. }
  65428. }
  65429. class Li extends XhtmlObject {
  65430. constructor(attributes) {
  65431. super(attributes, "li");
  65432. }
  65433. }
  65434. class Ol extends XhtmlObject {
  65435. constructor(attributes) {
  65436. super(attributes, "ol");
  65437. }
  65438. }
  65439. class P extends XhtmlObject {
  65440. constructor(attributes) {
  65441. super(attributes, "p");
  65442. }
  65443. [_xfa_object.$pushGlyphs](measure) {
  65444. super[_xfa_object.$pushGlyphs](measure, false);
  65445. measure.addString("\n");
  65446. measure.addPara();
  65447. measure.popFont();
  65448. }
  65449. [_xfa_object.$text]() {
  65450. const siblings = this[_xfa_object.$getParent]()[_xfa_object.$getChildren]();
  65451. if (siblings.at(-1) === this) {
  65452. return super[_xfa_object.$text]();
  65453. }
  65454. return super[_xfa_object.$text]() + "\n";
  65455. }
  65456. }
  65457. class Span extends XhtmlObject {
  65458. constructor(attributes) {
  65459. super(attributes, "span");
  65460. }
  65461. }
  65462. class Sub extends XhtmlObject {
  65463. constructor(attributes) {
  65464. super(attributes, "sub");
  65465. }
  65466. }
  65467. class Sup extends XhtmlObject {
  65468. constructor(attributes) {
  65469. super(attributes, "sup");
  65470. }
  65471. }
  65472. class Ul extends XhtmlObject {
  65473. constructor(attributes) {
  65474. super(attributes, "ul");
  65475. }
  65476. }
  65477. class XhtmlNamespace {
  65478. static [_namespaces.$buildXFAObject](name, attributes) {
  65479. if (XhtmlNamespace.hasOwnProperty(name)) {
  65480. return XhtmlNamespace[name](attributes);
  65481. }
  65482. return undefined;
  65483. }
  65484. static a(attributes) {
  65485. return new A(attributes);
  65486. }
  65487. static b(attributes) {
  65488. return new B(attributes);
  65489. }
  65490. static body(attributes) {
  65491. return new Body(attributes);
  65492. }
  65493. static br(attributes) {
  65494. return new Br(attributes);
  65495. }
  65496. static html(attributes) {
  65497. return new Html(attributes);
  65498. }
  65499. static i(attributes) {
  65500. return new I(attributes);
  65501. }
  65502. static li(attributes) {
  65503. return new Li(attributes);
  65504. }
  65505. static ol(attributes) {
  65506. return new Ol(attributes);
  65507. }
  65508. static p(attributes) {
  65509. return new P(attributes);
  65510. }
  65511. static span(attributes) {
  65512. return new Span(attributes);
  65513. }
  65514. static sub(attributes) {
  65515. return new Sub(attributes);
  65516. }
  65517. static sup(attributes) {
  65518. return new Sup(attributes);
  65519. }
  65520. static ul(attributes) {
  65521. return new Ul(attributes);
  65522. }
  65523. }
  65524. exports.XhtmlNamespace = XhtmlNamespace;
  65525. /***/ }),
  65526. /* 224 */
  65527. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65528. "use strict";
  65529. Object.defineProperty(exports, "__esModule", ({
  65530. value: true
  65531. }));
  65532. exports.UnknownNamespace = void 0;
  65533. var _namespaces = __w_pdfjs_require__(204);
  65534. var _xfa_object = __w_pdfjs_require__(202);
  65535. class UnknownNamespace {
  65536. constructor(nsId) {
  65537. this.namespaceId = nsId;
  65538. }
  65539. [_namespaces.$buildXFAObject](name, attributes) {
  65540. return new _xfa_object.XmlObject(this.namespaceId, name, attributes);
  65541. }
  65542. }
  65543. exports.UnknownNamespace = UnknownNamespace;
  65544. /***/ }),
  65545. /* 225 */
  65546. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65547. "use strict";
  65548. Object.defineProperty(exports, "__esModule", ({
  65549. value: true
  65550. }));
  65551. exports.DatasetReader = void 0;
  65552. var _util = __w_pdfjs_require__(2);
  65553. var _core_utils = __w_pdfjs_require__(131);
  65554. var _xml_parser = __w_pdfjs_require__(191);
  65555. function decodeString(str) {
  65556. try {
  65557. return (0, _util.stringToUTF8String)(str);
  65558. } catch (ex) {
  65559. (0, _util.warn)(`UTF-8 decoding failed: "${ex}".`);
  65560. return str;
  65561. }
  65562. }
  65563. class DatasetXMLParser extends _xml_parser.SimpleXMLParser {
  65564. constructor(options) {
  65565. super(options);
  65566. this.node = null;
  65567. }
  65568. onEndElement(name) {
  65569. const node = super.onEndElement(name);
  65570. if (node && name === "xfa:datasets") {
  65571. this.node = node;
  65572. throw new Error("Aborting DatasetXMLParser.");
  65573. }
  65574. }
  65575. }
  65576. class DatasetReader {
  65577. constructor(data) {
  65578. if (data.datasets) {
  65579. this.node = new _xml_parser.SimpleXMLParser({
  65580. hasAttributes: true
  65581. }).parseFromString(data.datasets).documentElement;
  65582. } else {
  65583. const parser = new DatasetXMLParser({
  65584. hasAttributes: true
  65585. });
  65586. try {
  65587. parser.parseFromString(data["xdp:xdp"]);
  65588. } catch (_) {}
  65589. this.node = parser.node;
  65590. }
  65591. }
  65592. getValue(path) {
  65593. if (!this.node || !path) {
  65594. return "";
  65595. }
  65596. const node = this.node.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  65597. if (!node) {
  65598. return "";
  65599. }
  65600. const first = node.firstChild;
  65601. if (first && first.nodeName === "value") {
  65602. return node.children.map(child => decodeString(child.textContent));
  65603. }
  65604. return decodeString(node.textContent);
  65605. }
  65606. }
  65607. exports.DatasetReader = DatasetReader;
  65608. /***/ }),
  65609. /* 226 */
  65610. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65611. "use strict";
  65612. Object.defineProperty(exports, "__esModule", ({
  65613. value: true
  65614. }));
  65615. exports.XRef = void 0;
  65616. var _util = __w_pdfjs_require__(2);
  65617. var _primitives = __w_pdfjs_require__(130);
  65618. var _core_utils = __w_pdfjs_require__(131);
  65619. var _parser = __w_pdfjs_require__(142);
  65620. var _base_stream = __w_pdfjs_require__(132);
  65621. var _crypto = __w_pdfjs_require__(192);
  65622. class XRef {
  65623. constructor(stream, pdfManager) {
  65624. this.stream = stream;
  65625. this.pdfManager = pdfManager;
  65626. this.entries = [];
  65627. this.xrefstms = Object.create(null);
  65628. this._cacheMap = new Map();
  65629. this._pendingRefs = new _primitives.RefSet();
  65630. this.stats = new _core_utils.DocStats(pdfManager.msgHandler);
  65631. this._newRefNum = null;
  65632. }
  65633. getNewRef() {
  65634. if (this._newRefNum === null) {
  65635. this._newRefNum = this.entries.length || 1;
  65636. }
  65637. return _primitives.Ref.get(this._newRefNum++, 0);
  65638. }
  65639. resetNewRef() {
  65640. this._newRefNum = null;
  65641. }
  65642. setStartXRef(startXRef) {
  65643. this.startXRefQueue = [startXRef];
  65644. }
  65645. parse() {
  65646. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  65647. let trailerDict;
  65648. if (!recoveryMode) {
  65649. trailerDict = this.readXRef();
  65650. } else {
  65651. (0, _util.warn)("Indexing all PDF objects");
  65652. trailerDict = this.indexObjects();
  65653. }
  65654. trailerDict.assignXref(this);
  65655. this.trailer = trailerDict;
  65656. let encrypt;
  65657. try {
  65658. encrypt = trailerDict.get("Encrypt");
  65659. } catch (ex) {
  65660. if (ex instanceof _core_utils.MissingDataException) {
  65661. throw ex;
  65662. }
  65663. (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
  65664. }
  65665. if (encrypt instanceof _primitives.Dict) {
  65666. const ids = trailerDict.get("ID");
  65667. const fileId = ids && ids.length ? ids[0] : "";
  65668. encrypt.suppressEncryption = true;
  65669. this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  65670. }
  65671. let root;
  65672. try {
  65673. root = trailerDict.get("Root");
  65674. } catch (ex) {
  65675. if (ex instanceof _core_utils.MissingDataException) {
  65676. throw ex;
  65677. }
  65678. (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
  65679. }
  65680. if (root instanceof _primitives.Dict) {
  65681. try {
  65682. const pages = root.get("Pages");
  65683. if (pages instanceof _primitives.Dict) {
  65684. this.root = root;
  65685. return;
  65686. }
  65687. } catch (ex) {
  65688. if (ex instanceof _core_utils.MissingDataException) {
  65689. throw ex;
  65690. }
  65691. (0, _util.warn)(`XRef.parse - Invalid "Pages" reference: "${ex}".`);
  65692. }
  65693. }
  65694. if (!recoveryMode) {
  65695. throw new _core_utils.XRefParseException();
  65696. }
  65697. throw new _util.InvalidPDFException("Invalid Root reference.");
  65698. }
  65699. processXRefTable(parser) {
  65700. if (!("tableState" in this)) {
  65701. this.tableState = {
  65702. entryNum: 0,
  65703. streamPos: parser.lexer.stream.pos,
  65704. parserBuf1: parser.buf1,
  65705. parserBuf2: parser.buf2
  65706. };
  65707. }
  65708. const obj = this.readXRefTable(parser);
  65709. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  65710. throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary");
  65711. }
  65712. let dict = parser.getObj();
  65713. if (!(dict instanceof _primitives.Dict) && dict.dict) {
  65714. dict = dict.dict;
  65715. }
  65716. if (!(dict instanceof _primitives.Dict)) {
  65717. throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary");
  65718. }
  65719. delete this.tableState;
  65720. return dict;
  65721. }
  65722. readXRefTable(parser) {
  65723. const stream = parser.lexer.stream;
  65724. const tableState = this.tableState;
  65725. stream.pos = tableState.streamPos;
  65726. parser.buf1 = tableState.parserBuf1;
  65727. parser.buf2 = tableState.parserBuf2;
  65728. let obj;
  65729. while (true) {
  65730. if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
  65731. if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) {
  65732. break;
  65733. }
  65734. tableState.firstEntryNum = obj;
  65735. tableState.entryCount = parser.getObj();
  65736. }
  65737. let first = tableState.firstEntryNum;
  65738. const count = tableState.entryCount;
  65739. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  65740. throw new _util.FormatError("Invalid XRef table: wrong types in subsection header");
  65741. }
  65742. for (let i = tableState.entryNum; i < count; i++) {
  65743. tableState.streamPos = stream.pos;
  65744. tableState.entryNum = i;
  65745. tableState.parserBuf1 = parser.buf1;
  65746. tableState.parserBuf2 = parser.buf2;
  65747. const entry = {};
  65748. entry.offset = parser.getObj();
  65749. entry.gen = parser.getObj();
  65750. const type = parser.getObj();
  65751. if (type instanceof _primitives.Cmd) {
  65752. switch (type.cmd) {
  65753. case "f":
  65754. entry.free = true;
  65755. break;
  65756. case "n":
  65757. entry.uncompressed = true;
  65758. break;
  65759. }
  65760. }
  65761. if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
  65762. throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
  65763. }
  65764. if (i === 0 && entry.free && first === 1) {
  65765. first = 0;
  65766. }
  65767. if (!this.entries[i + first]) {
  65768. this.entries[i + first] = entry;
  65769. }
  65770. }
  65771. tableState.entryNum = 0;
  65772. tableState.streamPos = stream.pos;
  65773. tableState.parserBuf1 = parser.buf1;
  65774. tableState.parserBuf2 = parser.buf2;
  65775. delete tableState.firstEntryNum;
  65776. delete tableState.entryCount;
  65777. }
  65778. if (this.entries[0] && !this.entries[0].free) {
  65779. throw new _util.FormatError("Invalid XRef table: unexpected first object");
  65780. }
  65781. return obj;
  65782. }
  65783. processXRefStream(stream) {
  65784. if (!("streamState" in this)) {
  65785. const streamParameters = stream.dict;
  65786. const byteWidths = streamParameters.get("W");
  65787. let range = streamParameters.get("Index");
  65788. if (!range) {
  65789. range = [0, streamParameters.get("Size")];
  65790. }
  65791. this.streamState = {
  65792. entryRanges: range,
  65793. byteWidths,
  65794. entryNum: 0,
  65795. streamPos: stream.pos
  65796. };
  65797. }
  65798. this.readXRefStream(stream);
  65799. delete this.streamState;
  65800. return stream.dict;
  65801. }
  65802. readXRefStream(stream) {
  65803. const streamState = this.streamState;
  65804. stream.pos = streamState.streamPos;
  65805. const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths;
  65806. const entryRanges = streamState.entryRanges;
  65807. while (entryRanges.length > 0) {
  65808. const [first, n] = entryRanges;
  65809. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  65810. throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
  65811. }
  65812. if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
  65813. throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
  65814. }
  65815. for (let i = streamState.entryNum; i < n; ++i) {
  65816. streamState.entryNum = i;
  65817. streamState.streamPos = stream.pos;
  65818. let type = 0,
  65819. offset = 0,
  65820. generation = 0;
  65821. for (let j = 0; j < typeFieldWidth; ++j) {
  65822. const typeByte = stream.getByte();
  65823. if (typeByte === -1) {
  65824. throw new _util.FormatError("Invalid XRef byteWidths 'type'.");
  65825. }
  65826. type = type << 8 | typeByte;
  65827. }
  65828. if (typeFieldWidth === 0) {
  65829. type = 1;
  65830. }
  65831. for (let j = 0; j < offsetFieldWidth; ++j) {
  65832. const offsetByte = stream.getByte();
  65833. if (offsetByte === -1) {
  65834. throw new _util.FormatError("Invalid XRef byteWidths 'offset'.");
  65835. }
  65836. offset = offset << 8 | offsetByte;
  65837. }
  65838. for (let j = 0; j < generationFieldWidth; ++j) {
  65839. const generationByte = stream.getByte();
  65840. if (generationByte === -1) {
  65841. throw new _util.FormatError("Invalid XRef byteWidths 'generation'.");
  65842. }
  65843. generation = generation << 8 | generationByte;
  65844. }
  65845. const entry = {};
  65846. entry.offset = offset;
  65847. entry.gen = generation;
  65848. switch (type) {
  65849. case 0:
  65850. entry.free = true;
  65851. break;
  65852. case 1:
  65853. entry.uncompressed = true;
  65854. break;
  65855. case 2:
  65856. break;
  65857. default:
  65858. throw new _util.FormatError(`Invalid XRef entry type: ${type}`);
  65859. }
  65860. if (!this.entries[first + i]) {
  65861. this.entries[first + i] = entry;
  65862. }
  65863. }
  65864. streamState.entryNum = 0;
  65865. streamState.streamPos = stream.pos;
  65866. entryRanges.splice(0, 2);
  65867. }
  65868. }
  65869. indexObjects() {
  65870. const TAB = 0x9,
  65871. LF = 0xa,
  65872. CR = 0xd,
  65873. SPACE = 0x20;
  65874. const PERCENT = 0x25,
  65875. LT = 0x3c;
  65876. function readToken(data, offset) {
  65877. let token = "",
  65878. ch = data[offset];
  65879. while (ch !== LF && ch !== CR && ch !== LT) {
  65880. if (++offset >= data.length) {
  65881. break;
  65882. }
  65883. token += String.fromCharCode(ch);
  65884. ch = data[offset];
  65885. }
  65886. return token;
  65887. }
  65888. function skipUntil(data, offset, what) {
  65889. const length = what.length,
  65890. dataLength = data.length;
  65891. let skipped = 0;
  65892. while (offset < dataLength) {
  65893. let i = 0;
  65894. while (i < length && data[offset + i] === what[i]) {
  65895. ++i;
  65896. }
  65897. if (i >= length) {
  65898. break;
  65899. }
  65900. offset++;
  65901. skipped++;
  65902. }
  65903. return skipped;
  65904. }
  65905. const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  65906. const endobjRegExp = /\bendobj[\b\s]$/;
  65907. const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/;
  65908. const CHECK_CONTENT_LENGTH = 25;
  65909. const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  65910. const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  65911. const objBytes = new Uint8Array([111, 98, 106]);
  65912. const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  65913. this.entries.length = 0;
  65914. this._cacheMap.clear();
  65915. const stream = this.stream;
  65916. stream.pos = 0;
  65917. const buffer = stream.getBytes(),
  65918. length = buffer.length;
  65919. let position = stream.start;
  65920. const trailers = [],
  65921. xrefStms = [];
  65922. while (position < length) {
  65923. let ch = buffer[position];
  65924. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  65925. ++position;
  65926. continue;
  65927. }
  65928. if (ch === PERCENT) {
  65929. do {
  65930. ++position;
  65931. if (position >= length) {
  65932. break;
  65933. }
  65934. ch = buffer[position];
  65935. } while (ch !== LF && ch !== CR);
  65936. continue;
  65937. }
  65938. const token = readToken(buffer, position);
  65939. let m;
  65940. if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
  65941. position += skipUntil(buffer, position, trailerBytes);
  65942. trailers.push(position);
  65943. position += skipUntil(buffer, position, startxrefBytes);
  65944. } else if (m = objRegExp.exec(token)) {
  65945. const num = m[1] | 0,
  65946. gen = m[2] | 0;
  65947. let contentLength,
  65948. startPos = position + token.length,
  65949. updateEntries = false;
  65950. if (!this.entries[num]) {
  65951. updateEntries = true;
  65952. } else if (this.entries[num].gen === gen) {
  65953. try {
  65954. const parser = new _parser.Parser({
  65955. lexer: new _parser.Lexer(stream.makeSubStream(startPos))
  65956. });
  65957. parser.getObj();
  65958. updateEntries = true;
  65959. } catch (ex) {
  65960. if (ex instanceof _core_utils.ParserEOFException) {
  65961. (0, _util.warn)(`indexObjects -- checking object (${token}): "${ex}".`);
  65962. } else {
  65963. updateEntries = true;
  65964. }
  65965. }
  65966. }
  65967. if (updateEntries) {
  65968. this.entries[num] = {
  65969. offset: position - stream.start,
  65970. gen,
  65971. uncompressed: true
  65972. };
  65973. }
  65974. while (startPos < buffer.length) {
  65975. const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4;
  65976. contentLength = endPos - position;
  65977. const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos);
  65978. const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
  65979. if (endobjRegExp.test(tokenStr)) {
  65980. break;
  65981. } else {
  65982. const objToken = nestedObjRegExp.exec(tokenStr);
  65983. if (objToken && objToken[1]) {
  65984. (0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.');
  65985. contentLength -= objToken[1].length;
  65986. break;
  65987. }
  65988. }
  65989. startPos = endPos;
  65990. }
  65991. const content = buffer.subarray(position, position + contentLength);
  65992. const xrefTagOffset = skipUntil(content, 0, xrefBytes);
  65993. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  65994. xrefStms.push(position - stream.start);
  65995. this.xrefstms[position - stream.start] = 1;
  65996. }
  65997. position += contentLength;
  65998. } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
  65999. trailers.push(position);
  66000. position += skipUntil(buffer, position, startxrefBytes);
  66001. } else {
  66002. position += token.length + 1;
  66003. }
  66004. }
  66005. for (let i = 0, ii = xrefStms.length; i < ii; ++i) {
  66006. this.startXRefQueue.push(xrefStms[i]);
  66007. this.readXRef(true);
  66008. }
  66009. let trailerDict;
  66010. for (let i = 0, ii = trailers.length; i < ii; ++i) {
  66011. stream.pos = trailers[i];
  66012. const parser = new _parser.Parser({
  66013. lexer: new _parser.Lexer(stream),
  66014. xref: this,
  66015. allowStreams: true,
  66016. recoveryMode: true
  66017. });
  66018. const obj = parser.getObj();
  66019. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  66020. continue;
  66021. }
  66022. const dict = parser.getObj();
  66023. if (!(dict instanceof _primitives.Dict)) {
  66024. continue;
  66025. }
  66026. try {
  66027. const rootDict = dict.get("Root");
  66028. if (!(rootDict instanceof _primitives.Dict)) {
  66029. continue;
  66030. }
  66031. const pagesDict = rootDict.get("Pages");
  66032. if (!(pagesDict instanceof _primitives.Dict)) {
  66033. continue;
  66034. }
  66035. const pagesCount = pagesDict.get("Count");
  66036. if (!Number.isInteger(pagesCount)) {
  66037. continue;
  66038. }
  66039. } catch (ex) {
  66040. continue;
  66041. }
  66042. if (dict.has("ID")) {
  66043. return dict;
  66044. }
  66045. trailerDict = dict;
  66046. }
  66047. if (trailerDict) {
  66048. return trailerDict;
  66049. }
  66050. if (this.topDict) {
  66051. return this.topDict;
  66052. }
  66053. throw new _util.InvalidPDFException("Invalid PDF structure.");
  66054. }
  66055. readXRef() {
  66056. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  66057. const stream = this.stream;
  66058. const startXRefParsedCache = new Set();
  66059. try {
  66060. while (this.startXRefQueue.length) {
  66061. const startXRef = this.startXRefQueue[0];
  66062. if (startXRefParsedCache.has(startXRef)) {
  66063. (0, _util.warn)("readXRef - skipping XRef table since it was already parsed.");
  66064. this.startXRefQueue.shift();
  66065. continue;
  66066. }
  66067. startXRefParsedCache.add(startXRef);
  66068. stream.pos = startXRef + stream.start;
  66069. const parser = new _parser.Parser({
  66070. lexer: new _parser.Lexer(stream),
  66071. xref: this,
  66072. allowStreams: true
  66073. });
  66074. let obj = parser.getObj();
  66075. let dict;
  66076. if ((0, _primitives.isCmd)(obj, "xref")) {
  66077. dict = this.processXRefTable(parser);
  66078. if (!this.topDict) {
  66079. this.topDict = dict;
  66080. }
  66081. obj = dict.get("XRefStm");
  66082. if (Number.isInteger(obj)) {
  66083. const pos = obj;
  66084. if (!(pos in this.xrefstms)) {
  66085. this.xrefstms[pos] = 1;
  66086. this.startXRefQueue.push(pos);
  66087. }
  66088. }
  66089. } else if (Number.isInteger(obj)) {
  66090. if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !((obj = parser.getObj()) instanceof _base_stream.BaseStream)) {
  66091. throw new _util.FormatError("Invalid XRef stream");
  66092. }
  66093. dict = this.processXRefStream(obj);
  66094. if (!this.topDict) {
  66095. this.topDict = dict;
  66096. }
  66097. if (!dict) {
  66098. throw new _util.FormatError("Failed to read XRef stream");
  66099. }
  66100. } else {
  66101. throw new _util.FormatError("Invalid XRef stream header");
  66102. }
  66103. obj = dict.get("Prev");
  66104. if (Number.isInteger(obj)) {
  66105. this.startXRefQueue.push(obj);
  66106. } else if (obj instanceof _primitives.Ref) {
  66107. this.startXRefQueue.push(obj.num);
  66108. }
  66109. this.startXRefQueue.shift();
  66110. }
  66111. return this.topDict;
  66112. } catch (e) {
  66113. if (e instanceof _core_utils.MissingDataException) {
  66114. throw e;
  66115. }
  66116. (0, _util.info)("(while reading XRef): " + e);
  66117. this.startXRefQueue.shift();
  66118. }
  66119. if (recoveryMode) {
  66120. return undefined;
  66121. }
  66122. throw new _core_utils.XRefParseException();
  66123. }
  66124. getEntry(i) {
  66125. const xrefEntry = this.entries[i];
  66126. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  66127. return xrefEntry;
  66128. }
  66129. return null;
  66130. }
  66131. fetchIfRef(obj) {
  66132. let suppressEncryption = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  66133. if (obj instanceof _primitives.Ref) {
  66134. return this.fetch(obj, suppressEncryption);
  66135. }
  66136. return obj;
  66137. }
  66138. fetch(ref) {
  66139. let suppressEncryption = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  66140. if (!(ref instanceof _primitives.Ref)) {
  66141. throw new Error("ref object is not a reference");
  66142. }
  66143. const num = ref.num;
  66144. const cacheEntry = this._cacheMap.get(num);
  66145. if (cacheEntry !== undefined) {
  66146. if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
  66147. cacheEntry.objId = ref.toString();
  66148. }
  66149. return cacheEntry;
  66150. }
  66151. let xrefEntry = this.getEntry(num);
  66152. if (xrefEntry === null) {
  66153. this._cacheMap.set(num, xrefEntry);
  66154. return xrefEntry;
  66155. }
  66156. if (this._pendingRefs.has(ref)) {
  66157. this._pendingRefs.remove(ref);
  66158. (0, _util.warn)(`Ignoring circular reference: ${ref}.`);
  66159. return _primitives.CIRCULAR_REF;
  66160. }
  66161. this._pendingRefs.put(ref);
  66162. try {
  66163. if (xrefEntry.uncompressed) {
  66164. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  66165. } else {
  66166. xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
  66167. }
  66168. this._pendingRefs.remove(ref);
  66169. } catch (ex) {
  66170. this._pendingRefs.remove(ref);
  66171. throw ex;
  66172. }
  66173. if (xrefEntry instanceof _primitives.Dict) {
  66174. xrefEntry.objId = ref.toString();
  66175. } else if (xrefEntry instanceof _base_stream.BaseStream) {
  66176. xrefEntry.dict.objId = ref.toString();
  66177. }
  66178. return xrefEntry;
  66179. }
  66180. fetchUncompressed(ref, xrefEntry) {
  66181. let suppressEncryption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  66182. const gen = ref.gen;
  66183. let num = ref.num;
  66184. if (xrefEntry.gen !== gen) {
  66185. throw new _core_utils.XRefEntryException(`Inconsistent generation in XRef: ${ref}`);
  66186. }
  66187. const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  66188. const parser = new _parser.Parser({
  66189. lexer: new _parser.Lexer(stream),
  66190. xref: this,
  66191. allowStreams: true
  66192. });
  66193. const obj1 = parser.getObj();
  66194. const obj2 = parser.getObj();
  66195. const obj3 = parser.getObj();
  66196. if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
  66197. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  66198. }
  66199. if (obj3.cmd !== "obj") {
  66200. if (obj3.cmd.startsWith("obj")) {
  66201. num = parseInt(obj3.cmd.substring(3), 10);
  66202. if (!Number.isNaN(num)) {
  66203. return num;
  66204. }
  66205. }
  66206. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  66207. }
  66208. if (this.encrypt && !suppressEncryption) {
  66209. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  66210. } else {
  66211. xrefEntry = parser.getObj();
  66212. }
  66213. if (!(xrefEntry instanceof _base_stream.BaseStream)) {
  66214. this._cacheMap.set(num, xrefEntry);
  66215. }
  66216. return xrefEntry;
  66217. }
  66218. fetchCompressed(ref, xrefEntry) {
  66219. let suppressEncryption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  66220. const tableOffset = xrefEntry.offset;
  66221. const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
  66222. if (!(stream instanceof _base_stream.BaseStream)) {
  66223. throw new _util.FormatError("bad ObjStm stream");
  66224. }
  66225. const first = stream.dict.get("First");
  66226. const n = stream.dict.get("N");
  66227. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  66228. throw new _util.FormatError("invalid first and n parameters for ObjStm stream");
  66229. }
  66230. let parser = new _parser.Parser({
  66231. lexer: new _parser.Lexer(stream),
  66232. xref: this,
  66233. allowStreams: true
  66234. });
  66235. const nums = new Array(n);
  66236. const offsets = new Array(n);
  66237. for (let i = 0; i < n; ++i) {
  66238. const num = parser.getObj();
  66239. if (!Number.isInteger(num)) {
  66240. throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
  66241. }
  66242. const offset = parser.getObj();
  66243. if (!Number.isInteger(offset)) {
  66244. throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
  66245. }
  66246. nums[i] = num;
  66247. offsets[i] = offset;
  66248. }
  66249. const start = (stream.start || 0) + first;
  66250. const entries = new Array(n);
  66251. for (let i = 0; i < n; ++i) {
  66252. const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;
  66253. if (length < 0) {
  66254. throw new _util.FormatError("Invalid offset in the ObjStm stream.");
  66255. }
  66256. parser = new _parser.Parser({
  66257. lexer: new _parser.Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)),
  66258. xref: this,
  66259. allowStreams: true
  66260. });
  66261. const obj = parser.getObj();
  66262. entries[i] = obj;
  66263. if (obj instanceof _base_stream.BaseStream) {
  66264. continue;
  66265. }
  66266. const num = nums[i],
  66267. entry = this.entries[num];
  66268. if (entry && entry.offset === tableOffset && entry.gen === i) {
  66269. this._cacheMap.set(num, obj);
  66270. }
  66271. }
  66272. xrefEntry = entries[xrefEntry.gen];
  66273. if (xrefEntry === undefined) {
  66274. throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
  66275. }
  66276. return xrefEntry;
  66277. }
  66278. async fetchIfRefAsync(obj, suppressEncryption) {
  66279. if (obj instanceof _primitives.Ref) {
  66280. return this.fetchAsync(obj, suppressEncryption);
  66281. }
  66282. return obj;
  66283. }
  66284. async fetchAsync(ref, suppressEncryption) {
  66285. try {
  66286. return this.fetch(ref, suppressEncryption);
  66287. } catch (ex) {
  66288. if (!(ex instanceof _core_utils.MissingDataException)) {
  66289. throw ex;
  66290. }
  66291. await this.pdfManager.requestRange(ex.begin, ex.end);
  66292. return this.fetchAsync(ref, suppressEncryption);
  66293. }
  66294. }
  66295. getCatalogObj() {
  66296. return this.root;
  66297. }
  66298. }
  66299. exports.XRef = XRef;
  66300. /***/ }),
  66301. /* 227 */
  66302. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  66303. "use strict";
  66304. Object.defineProperty(exports, "__esModule", ({
  66305. value: true
  66306. }));
  66307. exports.MessageHandler = void 0;
  66308. var _util = __w_pdfjs_require__(2);
  66309. const CallbackKind = {
  66310. UNKNOWN: 0,
  66311. DATA: 1,
  66312. ERROR: 2
  66313. };
  66314. const StreamKind = {
  66315. UNKNOWN: 0,
  66316. CANCEL: 1,
  66317. CANCEL_COMPLETE: 2,
  66318. CLOSE: 3,
  66319. ENQUEUE: 4,
  66320. ERROR: 5,
  66321. PULL: 6,
  66322. PULL_COMPLETE: 7,
  66323. START_COMPLETE: 8
  66324. };
  66325. function wrapReason(reason) {
  66326. if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) {
  66327. (0, _util.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
  66328. }
  66329. switch (reason.name) {
  66330. case "AbortException":
  66331. return new _util.AbortException(reason.message);
  66332. case "MissingPDFException":
  66333. return new _util.MissingPDFException(reason.message);
  66334. case "PasswordException":
  66335. return new _util.PasswordException(reason.message, reason.code);
  66336. case "UnexpectedResponseException":
  66337. return new _util.UnexpectedResponseException(reason.message, reason.status);
  66338. case "UnknownErrorException":
  66339. return new _util.UnknownErrorException(reason.message, reason.details);
  66340. default:
  66341. return new _util.UnknownErrorException(reason.message, reason.toString());
  66342. }
  66343. }
  66344. class MessageHandler {
  66345. constructor(sourceName, targetName, comObj) {
  66346. this.sourceName = sourceName;
  66347. this.targetName = targetName;
  66348. this.comObj = comObj;
  66349. this.callbackId = 1;
  66350. this.streamId = 1;
  66351. this.streamSinks = Object.create(null);
  66352. this.streamControllers = Object.create(null);
  66353. this.callbackCapabilities = Object.create(null);
  66354. this.actionHandler = Object.create(null);
  66355. this._onComObjOnMessage = event => {
  66356. const data = event.data;
  66357. if (data.targetName !== this.sourceName) {
  66358. return;
  66359. }
  66360. if (data.stream) {
  66361. this._processStreamMessage(data);
  66362. return;
  66363. }
  66364. if (data.callback) {
  66365. const callbackId = data.callbackId;
  66366. const capability = this.callbackCapabilities[callbackId];
  66367. if (!capability) {
  66368. throw new Error(`Cannot resolve callback ${callbackId}`);
  66369. }
  66370. delete this.callbackCapabilities[callbackId];
  66371. if (data.callback === CallbackKind.DATA) {
  66372. capability.resolve(data.data);
  66373. } else if (data.callback === CallbackKind.ERROR) {
  66374. capability.reject(wrapReason(data.reason));
  66375. } else {
  66376. throw new Error("Unexpected callback case");
  66377. }
  66378. return;
  66379. }
  66380. const action = this.actionHandler[data.action];
  66381. if (!action) {
  66382. throw new Error(`Unknown action from worker: ${data.action}`);
  66383. }
  66384. if (data.callbackId) {
  66385. const cbSourceName = this.sourceName;
  66386. const cbTargetName = data.sourceName;
  66387. new Promise(function (resolve) {
  66388. resolve(action(data.data));
  66389. }).then(function (result) {
  66390. comObj.postMessage({
  66391. sourceName: cbSourceName,
  66392. targetName: cbTargetName,
  66393. callback: CallbackKind.DATA,
  66394. callbackId: data.callbackId,
  66395. data: result
  66396. });
  66397. }, function (reason) {
  66398. comObj.postMessage({
  66399. sourceName: cbSourceName,
  66400. targetName: cbTargetName,
  66401. callback: CallbackKind.ERROR,
  66402. callbackId: data.callbackId,
  66403. reason: wrapReason(reason)
  66404. });
  66405. });
  66406. return;
  66407. }
  66408. if (data.streamId) {
  66409. this._createStreamSink(data);
  66410. return;
  66411. }
  66412. action(data.data);
  66413. };
  66414. comObj.addEventListener("message", this._onComObjOnMessage);
  66415. }
  66416. on(actionName, handler) {
  66417. const ah = this.actionHandler;
  66418. if (ah[actionName]) {
  66419. throw new Error(`There is already an actionName called "${actionName}"`);
  66420. }
  66421. ah[actionName] = handler;
  66422. }
  66423. send(actionName, data, transfers) {
  66424. this.comObj.postMessage({
  66425. sourceName: this.sourceName,
  66426. targetName: this.targetName,
  66427. action: actionName,
  66428. data
  66429. }, transfers);
  66430. }
  66431. sendWithPromise(actionName, data, transfers) {
  66432. const callbackId = this.callbackId++;
  66433. const capability = (0, _util.createPromiseCapability)();
  66434. this.callbackCapabilities[callbackId] = capability;
  66435. try {
  66436. this.comObj.postMessage({
  66437. sourceName: this.sourceName,
  66438. targetName: this.targetName,
  66439. action: actionName,
  66440. callbackId,
  66441. data
  66442. }, transfers);
  66443. } catch (ex) {
  66444. capability.reject(ex);
  66445. }
  66446. return capability.promise;
  66447. }
  66448. sendWithStream(actionName, data, queueingStrategy, transfers) {
  66449. const streamId = this.streamId++,
  66450. sourceName = this.sourceName,
  66451. targetName = this.targetName,
  66452. comObj = this.comObj;
  66453. return new ReadableStream({
  66454. start: controller => {
  66455. const startCapability = (0, _util.createPromiseCapability)();
  66456. this.streamControllers[streamId] = {
  66457. controller,
  66458. startCall: startCapability,
  66459. pullCall: null,
  66460. cancelCall: null,
  66461. isClosed: false
  66462. };
  66463. comObj.postMessage({
  66464. sourceName,
  66465. targetName,
  66466. action: actionName,
  66467. streamId,
  66468. data,
  66469. desiredSize: controller.desiredSize
  66470. }, transfers);
  66471. return startCapability.promise;
  66472. },
  66473. pull: controller => {
  66474. const pullCapability = (0, _util.createPromiseCapability)();
  66475. this.streamControllers[streamId].pullCall = pullCapability;
  66476. comObj.postMessage({
  66477. sourceName,
  66478. targetName,
  66479. stream: StreamKind.PULL,
  66480. streamId,
  66481. desiredSize: controller.desiredSize
  66482. });
  66483. return pullCapability.promise;
  66484. },
  66485. cancel: reason => {
  66486. (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
  66487. const cancelCapability = (0, _util.createPromiseCapability)();
  66488. this.streamControllers[streamId].cancelCall = cancelCapability;
  66489. this.streamControllers[streamId].isClosed = true;
  66490. comObj.postMessage({
  66491. sourceName,
  66492. targetName,
  66493. stream: StreamKind.CANCEL,
  66494. streamId,
  66495. reason: wrapReason(reason)
  66496. });
  66497. return cancelCapability.promise;
  66498. }
  66499. }, queueingStrategy);
  66500. }
  66501. _createStreamSink(data) {
  66502. const streamId = data.streamId,
  66503. sourceName = this.sourceName,
  66504. targetName = data.sourceName,
  66505. comObj = this.comObj;
  66506. const self = this,
  66507. action = this.actionHandler[data.action];
  66508. const streamSink = {
  66509. enqueue(chunk) {
  66510. let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
  66511. let transfers = arguments.length > 2 ? arguments[2] : undefined;
  66512. if (this.isCancelled) {
  66513. return;
  66514. }
  66515. const lastDesiredSize = this.desiredSize;
  66516. this.desiredSize -= size;
  66517. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  66518. this.sinkCapability = (0, _util.createPromiseCapability)();
  66519. this.ready = this.sinkCapability.promise;
  66520. }
  66521. comObj.postMessage({
  66522. sourceName,
  66523. targetName,
  66524. stream: StreamKind.ENQUEUE,
  66525. streamId,
  66526. chunk
  66527. }, transfers);
  66528. },
  66529. close() {
  66530. if (this.isCancelled) {
  66531. return;
  66532. }
  66533. this.isCancelled = true;
  66534. comObj.postMessage({
  66535. sourceName,
  66536. targetName,
  66537. stream: StreamKind.CLOSE,
  66538. streamId
  66539. });
  66540. delete self.streamSinks[streamId];
  66541. },
  66542. error(reason) {
  66543. (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
  66544. if (this.isCancelled) {
  66545. return;
  66546. }
  66547. this.isCancelled = true;
  66548. comObj.postMessage({
  66549. sourceName,
  66550. targetName,
  66551. stream: StreamKind.ERROR,
  66552. streamId,
  66553. reason: wrapReason(reason)
  66554. });
  66555. },
  66556. sinkCapability: (0, _util.createPromiseCapability)(),
  66557. onPull: null,
  66558. onCancel: null,
  66559. isCancelled: false,
  66560. desiredSize: data.desiredSize,
  66561. ready: null
  66562. };
  66563. streamSink.sinkCapability.resolve();
  66564. streamSink.ready = streamSink.sinkCapability.promise;
  66565. this.streamSinks[streamId] = streamSink;
  66566. new Promise(function (resolve) {
  66567. resolve(action(data.data, streamSink));
  66568. }).then(function () {
  66569. comObj.postMessage({
  66570. sourceName,
  66571. targetName,
  66572. stream: StreamKind.START_COMPLETE,
  66573. streamId,
  66574. success: true
  66575. });
  66576. }, function (reason) {
  66577. comObj.postMessage({
  66578. sourceName,
  66579. targetName,
  66580. stream: StreamKind.START_COMPLETE,
  66581. streamId,
  66582. reason: wrapReason(reason)
  66583. });
  66584. });
  66585. }
  66586. _processStreamMessage(data) {
  66587. const streamId = data.streamId,
  66588. sourceName = this.sourceName,
  66589. targetName = data.sourceName,
  66590. comObj = this.comObj;
  66591. const streamController = this.streamControllers[streamId],
  66592. streamSink = this.streamSinks[streamId];
  66593. switch (data.stream) {
  66594. case StreamKind.START_COMPLETE:
  66595. if (data.success) {
  66596. streamController.startCall.resolve();
  66597. } else {
  66598. streamController.startCall.reject(wrapReason(data.reason));
  66599. }
  66600. break;
  66601. case StreamKind.PULL_COMPLETE:
  66602. if (data.success) {
  66603. streamController.pullCall.resolve();
  66604. } else {
  66605. streamController.pullCall.reject(wrapReason(data.reason));
  66606. }
  66607. break;
  66608. case StreamKind.PULL:
  66609. if (!streamSink) {
  66610. comObj.postMessage({
  66611. sourceName,
  66612. targetName,
  66613. stream: StreamKind.PULL_COMPLETE,
  66614. streamId,
  66615. success: true
  66616. });
  66617. break;
  66618. }
  66619. if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
  66620. streamSink.sinkCapability.resolve();
  66621. }
  66622. streamSink.desiredSize = data.desiredSize;
  66623. new Promise(function (resolve) {
  66624. resolve(streamSink.onPull && streamSink.onPull());
  66625. }).then(function () {
  66626. comObj.postMessage({
  66627. sourceName,
  66628. targetName,
  66629. stream: StreamKind.PULL_COMPLETE,
  66630. streamId,
  66631. success: true
  66632. });
  66633. }, function (reason) {
  66634. comObj.postMessage({
  66635. sourceName,
  66636. targetName,
  66637. stream: StreamKind.PULL_COMPLETE,
  66638. streamId,
  66639. reason: wrapReason(reason)
  66640. });
  66641. });
  66642. break;
  66643. case StreamKind.ENQUEUE:
  66644. (0, _util.assert)(streamController, "enqueue should have stream controller");
  66645. if (streamController.isClosed) {
  66646. break;
  66647. }
  66648. streamController.controller.enqueue(data.chunk);
  66649. break;
  66650. case StreamKind.CLOSE:
  66651. (0, _util.assert)(streamController, "close should have stream controller");
  66652. if (streamController.isClosed) {
  66653. break;
  66654. }
  66655. streamController.isClosed = true;
  66656. streamController.controller.close();
  66657. this._deleteStreamController(streamController, streamId);
  66658. break;
  66659. case StreamKind.ERROR:
  66660. (0, _util.assert)(streamController, "error should have stream controller");
  66661. streamController.controller.error(wrapReason(data.reason));
  66662. this._deleteStreamController(streamController, streamId);
  66663. break;
  66664. case StreamKind.CANCEL_COMPLETE:
  66665. if (data.success) {
  66666. streamController.cancelCall.resolve();
  66667. } else {
  66668. streamController.cancelCall.reject(wrapReason(data.reason));
  66669. }
  66670. this._deleteStreamController(streamController, streamId);
  66671. break;
  66672. case StreamKind.CANCEL:
  66673. if (!streamSink) {
  66674. break;
  66675. }
  66676. new Promise(function (resolve) {
  66677. resolve(streamSink.onCancel && streamSink.onCancel(wrapReason(data.reason)));
  66678. }).then(function () {
  66679. comObj.postMessage({
  66680. sourceName,
  66681. targetName,
  66682. stream: StreamKind.CANCEL_COMPLETE,
  66683. streamId,
  66684. success: true
  66685. });
  66686. }, function (reason) {
  66687. comObj.postMessage({
  66688. sourceName,
  66689. targetName,
  66690. stream: StreamKind.CANCEL_COMPLETE,
  66691. streamId,
  66692. reason: wrapReason(reason)
  66693. });
  66694. });
  66695. streamSink.sinkCapability.reject(wrapReason(data.reason));
  66696. streamSink.isCancelled = true;
  66697. delete this.streamSinks[streamId];
  66698. break;
  66699. default:
  66700. throw new Error("Unexpected stream case");
  66701. }
  66702. }
  66703. async _deleteStreamController(streamController, streamId) {
  66704. await Promise.allSettled([streamController.startCall && streamController.startCall.promise, streamController.pullCall && streamController.pullCall.promise, streamController.cancelCall && streamController.cancelCall.promise]);
  66705. delete this.streamControllers[streamId];
  66706. }
  66707. destroy() {
  66708. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  66709. }
  66710. }
  66711. exports.MessageHandler = MessageHandler;
  66712. /***/ }),
  66713. /* 228 */
  66714. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  66715. "use strict";
  66716. Object.defineProperty(exports, "__esModule", ({
  66717. value: true
  66718. }));
  66719. exports.PDFWorkerStream = void 0;
  66720. var _util = __w_pdfjs_require__(2);
  66721. class PDFWorkerStream {
  66722. constructor(msgHandler) {
  66723. this._msgHandler = msgHandler;
  66724. this._contentLength = null;
  66725. this._fullRequestReader = null;
  66726. this._rangeRequestReaders = [];
  66727. }
  66728. getFullReader() {
  66729. (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
  66730. this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
  66731. return this._fullRequestReader;
  66732. }
  66733. getRangeReader(begin, end) {
  66734. const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
  66735. this._rangeRequestReaders.push(reader);
  66736. return reader;
  66737. }
  66738. cancelAllRequests(reason) {
  66739. if (this._fullRequestReader) {
  66740. this._fullRequestReader.cancel(reason);
  66741. }
  66742. for (const reader of this._rangeRequestReaders.slice(0)) {
  66743. reader.cancel(reason);
  66744. }
  66745. }
  66746. }
  66747. exports.PDFWorkerStream = PDFWorkerStream;
  66748. class PDFWorkerStreamReader {
  66749. constructor(msgHandler) {
  66750. this._msgHandler = msgHandler;
  66751. this.onProgress = null;
  66752. this._contentLength = null;
  66753. this._isRangeSupported = false;
  66754. this._isStreamingSupported = false;
  66755. const readableStream = this._msgHandler.sendWithStream("GetReader");
  66756. this._reader = readableStream.getReader();
  66757. this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
  66758. this._isStreamingSupported = data.isStreamingSupported;
  66759. this._isRangeSupported = data.isRangeSupported;
  66760. this._contentLength = data.contentLength;
  66761. });
  66762. }
  66763. get headersReady() {
  66764. return this._headersReady;
  66765. }
  66766. get contentLength() {
  66767. return this._contentLength;
  66768. }
  66769. get isStreamingSupported() {
  66770. return this._isStreamingSupported;
  66771. }
  66772. get isRangeSupported() {
  66773. return this._isRangeSupported;
  66774. }
  66775. async read() {
  66776. const {
  66777. value,
  66778. done
  66779. } = await this._reader.read();
  66780. if (done) {
  66781. return {
  66782. value: undefined,
  66783. done: true
  66784. };
  66785. }
  66786. return {
  66787. value: value.buffer,
  66788. done: false
  66789. };
  66790. }
  66791. cancel(reason) {
  66792. this._reader.cancel(reason);
  66793. }
  66794. }
  66795. class PDFWorkerStreamRangeReader {
  66796. constructor(begin, end, msgHandler) {
  66797. this._msgHandler = msgHandler;
  66798. this.onProgress = null;
  66799. const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
  66800. begin,
  66801. end
  66802. });
  66803. this._reader = readableStream.getReader();
  66804. }
  66805. get isStreamingSupported() {
  66806. return false;
  66807. }
  66808. async read() {
  66809. const {
  66810. value,
  66811. done
  66812. } = await this._reader.read();
  66813. if (done) {
  66814. return {
  66815. value: undefined,
  66816. done: true
  66817. };
  66818. }
  66819. return {
  66820. value: value.buffer,
  66821. done: false
  66822. };
  66823. }
  66824. cancel(reason) {
  66825. this._reader.cancel(reason);
  66826. }
  66827. }
  66828. /***/ })
  66829. /******/ ]);
  66830. /************************************************************************/
  66831. /******/ // The module cache
  66832. /******/ var __webpack_module_cache__ = {};
  66833. /******/
  66834. /******/ // The require function
  66835. /******/ function __w_pdfjs_require__(moduleId) {
  66836. /******/ // Check if module is in cache
  66837. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  66838. /******/ if (cachedModule !== undefined) {
  66839. /******/ return cachedModule.exports;
  66840. /******/ }
  66841. /******/ // Create a new module (and put it into the cache)
  66842. /******/ var module = __webpack_module_cache__[moduleId] = {
  66843. /******/ // no module.id needed
  66844. /******/ // no module.loaded needed
  66845. /******/ exports: {}
  66846. /******/ };
  66847. /******/
  66848. /******/ // Execute the module function
  66849. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  66850. /******/
  66851. /******/ // Return the exports of the module
  66852. /******/ return module.exports;
  66853. /******/ }
  66854. /******/
  66855. /************************************************************************/
  66856. /******/ /* webpack/runtime/define property getters */
  66857. /******/ (() => {
  66858. /******/ // define getter functions for harmony exports
  66859. /******/ __w_pdfjs_require__.d = (exports, definition) => {
  66860. /******/ for(var key in definition) {
  66861. /******/ if(__w_pdfjs_require__.o(definition, key) && !__w_pdfjs_require__.o(exports, key)) {
  66862. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  66863. /******/ }
  66864. /******/ }
  66865. /******/ };
  66866. /******/ })();
  66867. /******/
  66868. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  66869. /******/ (() => {
  66870. /******/ __w_pdfjs_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  66871. /******/ })();
  66872. /******/
  66873. /******/ /* webpack/runtime/make namespace object */
  66874. /******/ (() => {
  66875. /******/ // define __esModule on exports
  66876. /******/ __w_pdfjs_require__.r = (exports) => {
  66877. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  66878. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  66879. /******/ }
  66880. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  66881. /******/ };
  66882. /******/ })();
  66883. /******/
  66884. /************************************************************************/
  66885. var __webpack_exports__ = {};
  66886. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  66887. (() => {
  66888. "use strict";
  66889. var exports = __webpack_exports__;
  66890. Object.defineProperty(exports, "__esModule", ({
  66891. value: true
  66892. }));
  66893. Object.defineProperty(exports, "WorkerMessageHandler", ({
  66894. enumerable: true,
  66895. get: function () {
  66896. return _worker.WorkerMessageHandler;
  66897. }
  66898. }));
  66899. var _worker = __w_pdfjs_require__(1);
  66900. const pdfjsVersion = '2.16.105';
  66901. const pdfjsBuild = '172ccdbe5';
  66902. })();
  66903. /******/ return __webpack_exports__;
  66904. /******/ })()
  66905. ;
  66906. });
  66907. //# sourceMappingURL=pdf.worker.js.map